-
Notifications
You must be signed in to change notification settings - Fork 23
/
header.js
98 lines (83 loc) · 4.44 KB
/
header.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
86
87
88
89
90
91
92
93
94
95
96
97
// We add a simple `onload` hook to inject the custom header for our `HTML`-generated pages
window.onload = function() {
// <header class="navigation">
const header = document.createElement('header')
header.classList.add("navigation")
header.appendChild((() => {
const container = document.createElement('div')
container.classList.add('container')
container.appendChild((() => {
const nav = document.createElement('nav')
nav.classList.add("navbar")
nav.appendChild((() => {
const ul = document.createElement("ul")
ul.classList.add("navbar-nav")
ul.appendChild((() => {
const smalllink = document.createElement('li')
smalllink.classList.add('small-item')
smalllink.appendChild((() => {
const a = document.createElement('a')
a.classList.add("nav-link")
a.href = 'http://www.rxinfer.ml'
a.innerHTML = 'RxInfer.jl'
a.title = 'RxInfer.jl'
return a
})())
return smalllink
})())
const items = [
{ title: "Home", link: "http://www.rxinfer.ml", icon: [ "fas", "fa-diagram-project" ] },
{ title: "Get Started", link: "https://reactivebayes.github.io/RxInfer.jl/stable/manuals/getting-started/", icon: [ "fas", "fa-person-chalkboard" ] },
{ title: "Documentation", link: "https://reactivebayes.github.io/RxInfer.jl/stable/", icon: [ "fas", "fa-book" ] },
{ title: "Examples", link: "https://reactivebayes.github.io/RxInfer.jl/stable/examples/overview/", icon: [ "fas", "fa-laptop-code" ] },
{ title: "Papers", link: "https://biaslab.github.io/publication/", icon: [ "far", "fa-book-open" ] },
{ title: "Team", link: "https://github.com/orgs/ReactiveBayes/people", icon: [ "fas", "fa-people-group" ] },
{ title: "Discussions", link: "https://github.com/orgs/ReactiveBayes/discussions", icon: [ "far", "fa-comment" ] },
// { title: "Contact", link: "http://www.rxinfer.ml/contact/" }, the redirect is broken for now
{ title: "GitHub", link: "https://github.com/reactivebayes/RxInfer.jl", icon: [ "fab", "fa-github" ] },
]
items.forEach((item) => {
ul.appendChild(((item) => {
const li = document.createElement("li")
li.classList.add("nav-item")
li.appendChild((() => {
const a = document.createElement("a")
if (item.icon !== undefined) {
a.appendChild((() => {
const i = document.createElement("i")
i.classList.add(...(item.icon))
return i
})())
}
a.classList.add("nav-link")
a.href = item.link
a.title = item.title
a.appendChild((() => {
const span = document.createElement("span")
span.innerHTML = ` ${item.title}`
return span
})())
return a
})())
return li
})(item))
})
return ul
})())
return nav
})())
return container
})())
const documenterTarget = document.querySelector('#documenter');
documenterTarget.parentNode.insertBefore(header, documenterTarget);
// Edit broken links in the examples, see issue #70
const editOnGithubLinkTarget = document.querySelector('.docs-edit-link');
if (editOnGithubLinkTarget) {
const link = editOnGithubLinkTarget.href;
if (link.includes('docs/src/examples')) {
const fixedLink = link.replace('docs/src/', '').replace('.md', '.ipynb');
editOnGithubLinkTarget.href = fixedLink;
console.log('Fixed link for the example: ', fixedLink)
}
}
}