Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Matthieu Haefele
website
Commits
5a228b9e
Commit
5a228b9e
authored
Jan 13, 2018
by
Marco Mancini
Browse files
Cleaned; d3js no longer used in indico
parent
aba69d71
Changes
4
Hide whitespace changes
Inline
Side-by-side
content/js/d3.min.js
deleted
100644 → 0
View file @
aba69d71
This source diff could not be displayed because it is too large. You can
view the blob
instead.
content/js/indico.js
View file @
5a228b9e
...
...
@@ -18,13 +18,7 @@ function read_indico_timetable(url, nb_event)
alert
(
"
unable to read the event
"
+
nb_event
+
"
from
"
+
url
);
},
complete
:
function
(
data
){
// console.log(data);
// parse(data.responseJSON, nb_event);
IndicoPlanning
.
parse
(
data
.
responseJSON
,
nb_event
,
'
indico
'
);
//IndicoPlanning.newMarkUp_Indico('indico',data.responseJSON.results['940'])
}
});
...
...
content/js/indico_planning.js
View file @
5a228b9e
...
...
@@ -8,38 +8,32 @@ Script to parse JSON arriving from indico "timetable" and to insert
(
function
(
exports
){
function
transform_data_keys
(
data
){
var
newdata
=
{};
for
(
let
ii
in
data
){
//days
let
locentry
=
{};
let
a
=
data
[
ii
];
//Session
for
(
let
jj
in
a
){
let
bb
=
a
[
jj
];
if
(
bb
.
entryType
===
'
Session
'
){
if
(
Object
.
keys
(
bb
.
entries
).
length
>
0
){
//console.log(a[jj])
let
newentries
=
{};
let
entries
=
a
[
jj
].
entries
;
for
(
let
kk
in
entries
){
newentries
[
entries
[
kk
].
startDate
.
time
+
'
_
'
+
kk
]
=
entries
[
kk
];
}
bb
.
entries
=
newentries
;
}
}
locentry
[
a
[
jj
].
startDate
.
time
+
'
_
'
+
jj
]
=
bb
;
function
serialize_Indico
(
base
,
level
,
obj
)
{
// convert object into array
let
sortable
=
[];
for
(
let
key
in
obj
){
if
(
obj
[
key
].
hasOwnProperty
(
'
startDate
'
)){
let
newkey
=
base
+
'
:
'
+
obj
[
key
][
'
startDate
'
][
'
time
'
];
obj
[
key
].
level
=
level
;
sortable
.
push
([
newkey
,
obj
[
key
]]);
// each item is an array in format [key, value]
}
if
(
obj
[
key
].
hasOwnProperty
(
'
entries
'
)){
obj
[
key
][
'
entries
'
]
=
serialize_Indico
(
base
,
level
+
1
,
obj
[
key
][
'
entries
'
]);
}
newdata
[
ii
]
=
locentry
;
}
return
newdata
;
// sort items by value
sortable
.
sort
(
function
(
a
,
b
){
let
x
=
a
[
0
].
toLowerCase
(),
y
=
b
[
0
].
toLowerCase
();
return
x
<
y
?
-
1
:
x
>
y
?
1
:
0
;
});
return
sortable
;
// array in format [ [ key1, val1 ], [ key2, val2 ], ... ]
}
function
newMark
Up_Indico
(
key
,
data
,
where
){
function
Make
Up_Indico
(
key
,
data
,
where
){
var
element
=
document
.
getElementById
(
where
);
// day level
moment
.
locale
(
'
fr
'
);
...
...
@@ -171,122 +165,6 @@ Script to parse JSON arriving from indico "timetable" and to insert
function
serialize_Indico
(
base
,
level
,
obj
)
{
// convert object into array
let
sortable
=
[];
for
(
let
key
in
obj
){
if
(
obj
[
key
].
hasOwnProperty
(
'
startDate
'
)){
let
newkey
=
base
+
'
:
'
+
obj
[
key
][
'
startDate
'
][
'
time
'
];
obj
[
key
].
level
=
level
;
sortable
.
push
([
newkey
,
obj
[
key
]]);
// each item is an array in format [key, value]
}
if
(
obj
[
key
].
hasOwnProperty
(
'
entries
'
)){
obj
[
key
][
'
entries
'
]
=
serialize_Indico
(
base
,
level
+
1
,
obj
[
key
][
'
entries
'
]);
}
}
// sort items by value
sortable
.
sort
(
function
(
a
,
b
){
let
x
=
a
[
0
].
toLowerCase
(),
y
=
b
[
0
].
toLowerCase
();
return
x
<
y
?
-
1
:
x
>
y
?
1
:
0
;
});
return
sortable
;
// array in format [ [ key1, val1 ], [ key2, val2 ], ... ]
}
function
makeup_Indico
(
key
,
event_array
,
where
){
// level 0 : parsing days
moment
.
locale
(
'
fr
'
);
let
m
=
moment
(
key
,
[
'
YYYYMMDD
'
]).
format
(
'
dddd DD MMMM YYYY
'
);
// where to append the result
let
element
=
document
.
getElementById
(
where
);
let
day
=
d3
.
select
(
'
#
'
+
element
.
id
)
.
append
(
'
div
'
)
.
attr
(
'
class
'
,
'
indico indico_event
'
)
.
attr
(
'
id
'
,
'
indico_
'
+
key
)
;
day
.
append
(
'
div
'
)
.
attr
(
'
class
'
,
'
indico_date
'
)
.
html
(
m
);
let
hours
=
day
.
selectAll
(
null
)
.
data
(
event_array
)
.
enter
()
.
append
(
"
div
"
)
.
attr
(
'
class
'
,
function
(
d
){
return
'
indico_
'
+
d
[
1
].
level
;
});
let
headers
=
hours
.
append
(
'
div
'
)
.
attr
(
'
class
'
,
'
indico_header
'
)
;
headers
.
append
(
'
div
'
)
.
attr
(
'
class
'
,
'
indico_times
'
)
.
html
(
function
(
d
){
let
start
=
d
[
1
].
startDate
.
time
.
split
(
'
:
'
);
start
.
pop
();
start
=
start
.
join
(
'
:
'
);
let
end
=
d
[
1
].
endDate
.
time
.
split
(
'
:
'
);
end
.
pop
();
end
=
end
.
join
(
'
:
'
);
return
start
+
'
-
'
+
end
;
});
headers
.
append
(
'
div
'
)
.
attr
(
'
class
'
,
'
indico_title
'
)
.
html
(
function
(
d
){
return
d
[
1
].
title
;
});
hours
.
append
(
'
div
'
)
.
attr
(
'
class
'
,
'
indico_desc
'
)
.
html
(
function
(
d
){
return
d
[
1
].
description
;
});
hours
.
append
(
'
div
'
)
.
attr
(
'
class
'
,
'
indico_loc
'
)
.
html
(
function
(
d
){
return
(
d
[
1
].
level
<
2
)
?
'
Lieu :
'
+
d
[
1
].
room
:
''
;
});
hours
.
append
(
'
div
'
)
.
attr
(
'
class
'
,
'
indico_conveners
'
)
.
html
(
function
(
d
){
//console.log(d[1]._type,d[1].entryType,d[1])
let
result
=
''
;
switch
(
d
[
1
].
entryType
){
case
'
Contribution
'
:
if
(
d
[
1
].
presenters
.
length
>
0
){
result
=
'
Contributeurs :
'
+
d
[
1
].
presenters
.
map
(
function
(
a
)
{
return
a
.
name
;}).
join
(
'
,
'
)
+
''
;
}
break
;
case
'
Session
'
:
if
(
d
[
1
].
conveners
.
length
>
0
){
result
=
'
Conveners :
'
+
d
[
1
].
conveners
.
map
(
function
(
a
)
{
return
a
.
name
;}).
join
(
'
,
'
)
+
''
;
}
break
;
}
return
result
;
});
}
function
parse_indico_json
(
data
,
nb_event
,
where
){
let
event
=
data
.
results
[
nb_event
];
// loop on days
...
...
@@ -296,13 +174,11 @@ Script to parse JSON arriving from indico "timetable" and to insert
let
day_event
=
serialize_Indico
(
key
,
1
,
event
[
key
]);
// for any day the div is created and appended in where element
newMark
Up_Indico
(
key
,
day_event
,
where
);
Make
Up_Indico
(
key
,
day_event
,
where
);
}
}
/* Exported fuctions */
exports
.
parse
=
parse_indico_json
;
exports
.
transform_data_keys
=
transform_data_keys
;
exports
.
newMarkUp_Indico
=
newMarkUp_Indico
;
})(
this
.
IndicoPlanning
=
{});
themes/html5-dopetrope/templates/base.html
View file @
5a228b9e
...
...
@@ -241,7 +241,6 @@
{% endif %}
</section>
</div>
<script
src=
"/js/d3.min.js"
></script>
<script
src=
"/theme/js/jquery.min.js"
></script>
<script
src=
"/theme/js/jquery.dropotron.js"
></script>
<script
src=
"/theme/js/config.js"
></script>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment