-
Notifications
You must be signed in to change notification settings - Fork 0
/
load-templates-questions.js
85 lines (72 loc) · 2.15 KB
/
load-templates-questions.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
const questionsNavigation = d3.select("#questions-navigation");
if (questionsNavigation.size() > 0) {
Promise.all([d3.text("../questions.yml")]).then(([questionsData]) => {
questionsData = jsyaml.load(questionsData);
questionsNavigation
.append("a")
.style("padding", "0 1rem")
.attr("href", "../")
.append("h4")
.text("Home");
const questionsList = questionsNavigation
.append("div")
.classed("questions--list", true);
let questionsDropdown = questionsList
.append("h4")
.classed("navigation-handler", true)
.style("cursor", "pointer")
.text("Research topics")
.append("div");
questionsList
.append("ol")
.classed("closed", true)
.style("height", "calc(1rem + " + questionsData.length * 50 + "px)")
.selectAll("li")
.data(questionsData)
.join("li")
.append("a")
.attr("href", (d) => "../" + d.folder)
.text((d) => d.title);
questionsList.select(".navigation-handler").on("click", function () {
console.log("click");
const list = questionsList.select("ol");
const isOpen = list.classed("closed");
list.classed("closed", !isOpen);
});
});
}
const footer = d3.select(".footer");
if (footer.size() > 0) {
// Footer //
Promise.all([
d3.text('../info.yml')
])
.then(([info]) => {
info = jsyaml.load(info);
const footerContainer = footer
.append("div")
.classed("footer__container", true);
const footerLogo1 = footerContainer
.append("div")
.classed("footer__item", true)
.append("div")
.classed("logo logo-density", true);
const footerLogo2 = footerContainer
.append("div")
.classed("footer__item", true)
.append("div")
.classed("logo logo-politecnico", true);
const footerAuthors = footerContainer
.append("div")
.classed("footer__item", true);
let text = "Project by";
footerAuthors
.append("h5")
.text(text);
footerAuthors
.selectAll("p")
.data(info.authors)
.join("p")
.text(d => d.name);
})
}