mirror of
https://github.com/sfall-team/sfall.git
synced 2026-07-27 16:52:34 -07:00
deploy: 980986a0cb589ff68d83d12de6924a539c511df3
This commit is contained in:
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -29,13 +29,18 @@ function initNav() {
|
||||
}
|
||||
if (target) {
|
||||
e.preventDefault();
|
||||
target.ariaPressed = target.parentNode.classList.toggle('active');
|
||||
const active = target.parentNode.classList.toggle('active');
|
||||
const passive = target.parentNode.classList.toggle('passive');
|
||||
if (active && passive) target.parentNode.classList.toggle('passive');
|
||||
target.ariaPressed = active;
|
||||
}
|
||||
});
|
||||
|
||||
const siteNav = document.getElementById('site-nav');
|
||||
const mainHeader = document.getElementById('main-header');
|
||||
const menuButton = document.getElementById('menu-button');
|
||||
|
||||
disableHeadStyleSheet();
|
||||
|
||||
jtd.addEvent(menuButton, 'click', function(e){
|
||||
e.preventDefault();
|
||||
@@ -51,6 +56,14 @@ function initNav() {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// The page-specific <style> in the <head> is needed only when JS is disabled.
|
||||
// Moreover, it incorrectly overrides dynamic stylesheets set by setTheme(theme).
|
||||
// The page-specific stylesheet is assumed to have index 1 in the list of stylesheets.
|
||||
|
||||
function disableHeadStyleSheet() {
|
||||
document.styleSheets[1].disabled = true;
|
||||
}
|
||||
// Site search
|
||||
|
||||
function initSearch() {
|
||||
@@ -437,15 +450,55 @@ jtd.setTheme = function(theme) {
|
||||
cssFile.setAttribute('href', '/sfall/assets/css/just-the-docs-' + theme + '.css');
|
||||
}
|
||||
|
||||
// Note: pathname can have a trailing slash on a local jekyll server
|
||||
// and not have the slash on GitHub Pages
|
||||
|
||||
function navLink() {
|
||||
var href = document.location.pathname;
|
||||
if (href.endsWith('/') && href != '/') {
|
||||
href = href.slice(0, -1);
|
||||
}
|
||||
return document.getElementById('site-nav').querySelector('a[href="' + href + '"], a[href="' + href + '/"]');
|
||||
}
|
||||
|
||||
// Scroll site-nav to ensure the link to the current page is visible
|
||||
|
||||
function scrollNav() {
|
||||
const href = document.location.pathname;
|
||||
const siteNav = document.getElementById('site-nav');
|
||||
const targetLink = siteNav.querySelector('a[href="' + href + '"], a[href="' + href + '/"]');
|
||||
if(targetLink){
|
||||
const targetLink = navLink();
|
||||
if (targetLink) {
|
||||
const rect = targetLink.getBoundingClientRect();
|
||||
siteNav.scrollBy(0, rect.top - 3*rect.height);
|
||||
document.getElementById('site-nav').scrollBy(0, rect.top - 3*rect.height);
|
||||
}
|
||||
}
|
||||
|
||||
// Find the nav-list-link that refers to the current page
|
||||
// then make it and all enclosing nav-list-item elements active,
|
||||
// and make all other folded collections passive
|
||||
|
||||
function activateNav() {
|
||||
var target = navLink();
|
||||
if (target) {
|
||||
target.classList.toggle('active', true);
|
||||
}
|
||||
while (target) {
|
||||
while (target && !(target.classList && target.classList.contains('nav-list-item'))) {
|
||||
target = target.parentNode;
|
||||
}
|
||||
if (target) {
|
||||
target.classList.toggle('active', true);
|
||||
target = target.parentNode;
|
||||
}
|
||||
}
|
||||
const elements = document.getElementsByClassName("nav-category-list");
|
||||
for (const element of elements) {
|
||||
const item = element.children[0];
|
||||
const active = item.classList.toggle('active');
|
||||
if (active) {
|
||||
item.classList.toggle('active', false);
|
||||
item.classList.toggle('passive', true);
|
||||
} else {
|
||||
item.classList.toggle('active', true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -454,6 +507,7 @@ function scrollNav() {
|
||||
jtd.onReady(function(){
|
||||
initNav();
|
||||
initSearch();
|
||||
activateNav();
|
||||
scrollNav();
|
||||
});
|
||||
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -1 +1 @@
|
||||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="/sfall/feed.xml" rel="self" type="application/atom+xml" /><link href="/sfall/" rel="alternate" type="text/html" /><updated>2023-08-09T00:25:30+00:00</updated><id>/sfall/feed.xml</id><title type="html">sfall</title><subtitle>Sfall documentation</subtitle></feed>
|
||||
<?xml version="1.0" encoding="utf-8"?><feed xmlns="http://www.w3.org/2005/Atom" ><generator uri="https://jekyllrb.com/" version="3.9.0">Jekyll</generator><link href="/sfall/feed.xml" rel="self" type="application/atom+xml" /><link href="/sfall/" rel="alternate" type="text/html" /><updated>2023-08-22T02:01:08+00:00</updated><id>/sfall/feed.xml</id><title type="html">sfall</title><subtitle>Sfall documentation</subtitle></feed>
|
||||
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user