Skip to content

Commit d9d51ea

Browse files
authored
Merge pull request #2 from shnizzedy/furo-theme
👽️ Inject version dropdowns in furo theme
2 parents 46dfc4c + 1fbe964 commit d9d51ea

File tree

4 files changed

+21
-3
lines changed

4 files changed

+21
-3
lines changed

docs/_sources/_static/custom.css

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,19 @@
1+
/* docs version dropdown: top bar */
2+
.brand > select {
3+
background: transparent;
4+
border: none;
5+
color: var(--color-header-text);
6+
}
7+
8+
/* docs version dropdown: side bar */
9+
.sidebar-brand-text > select {
10+
background-color: transparent;
11+
border: none;
12+
color: var(--color-sidebar-link-text--top-level);
13+
text-decoration: underline;
14+
text-decoration-color: var(--color-link-underline);
15+
}
16+
117
.svg-flowchart > svg {
218
width: 100%;
319
height: auto;

scripts/versionList.js renamed to docs/_sources/_static/versionList.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,10 @@ function createDropdown(here) {
2424
function versionDropdown() {
2525
const here = window.location.href;
2626
const dochome = "https://" + here.split('/').slice(2, 5).join('/');
27-
const navTitles = document.getElementsByClassName("nav-item-0");
27+
const navTitles = document.querySelectorAll(".brand,.sidebar-brand-text");
2828
createDropdown(here).then(dropdown => {
2929
for (let item of navTitles) {
30+
item.parentElement.removeAttribute("href");
3031
let newTitle = document.createElement("div");
3132
let newTitlePrefix = document.createElement("a");
3233
newTitlePrefix.setAttribute("href", dochome);

docs/_sources/_templates/layout.html

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,4 @@
99
gtag('js', new Date());
1010
gtag('config', 'UA-19224662-10');
1111
</script>
12-
<script defer src="https://fcp-indi.github.io/scripts/versionList.js"></script>
1312
{% endblock %}

docs/_sources/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ def yaml_to_rst(path):
171171

172172
# General information about the project.
173173
project = 'C-PAC'
174-
copyright = '2012‒2022, C-PAC Developers. C-PAC is licensed under LGPL-3' \
174+
copyright = '2012‒2023, C-PAC Developers. C-PAC is licensed under LGPL-3' \
175175
'.0-or-later'
176176
# The version info for the project you're documenting, acts as replacement for
177177
# |version| and |release|, also used in various other places throughout the
@@ -435,6 +435,8 @@ def _unireplace(release_note, unireplace):
435435
html_css_files = [
436436
'custom.css',
437437
]
438+
html_js_files = [
439+
('versionList.js', {'defer': 'defer'})]
438440

439441
# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
440442
# using the given strftime format.

0 commit comments

Comments
 (0)