fix: tabs are a sin

This commit is contained in:
Simon Hyll
2024-05-24 20:22:18 +02:00
parent 1ce00557e4
commit b387bc22fc
151 changed files with 5707 additions and 5707 deletions

View File

@@ -1,45 +1,45 @@
async function chapterNavigation() {
let navigating = false;
document.addEventListener('keydown', function (e) {
if (navigating) return;
if (e.altKey || e.ctrlKey || e.metaKey) {
return;
}
if (window.search && document.activeElement === window.search) {
return;
}
let navigating = false;
document.addEventListener('keydown', function (e) {
if (navigating) return;
if (e.altKey || e.ctrlKey || e.metaKey) {
return;
}
if (window.search && document.activeElement === window.search) {
return;
}
switch (e.key) {
case 'ArrowLeft':
e.preventDefault();
let previousButton = document.querySelector('a[rel="prev"]');
if (!previousButton && window.location.pathname !== '/') previousButton = { href: '/' };
switch (e.key) {
case 'ArrowLeft':
e.preventDefault();
let previousButton = document.querySelector('a[rel="prev"]');
if (!previousButton && window.location.pathname !== '/') previousButton = { href: '/' };
if (document.referrer.includes(window.location.host))
if (previousButton) {
window.location.href = previousButton.href;
navigating = true;
}
break;
case 'ArrowRight':
e.preventDefault();
let nextButton = document.querySelector('a[rel="next"]');
if (!nextButton && window.location.pathname === '/') nextButton = { href: '/start/' };
if (document.referrer.includes(window.location.host))
if (previousButton) {
window.location.href = previousButton.href;
navigating = true;
}
break;
case 'ArrowRight':
e.preventDefault();
let nextButton = document.querySelector('a[rel="next"]');
if (!nextButton && window.location.pathname === '/') nextButton = { href: '/start/' };
if (nextButton) {
window.location.href = nextButton.href;
navigating = true;
}
break;
}
});
if (nextButton) {
window.location.href = nextButton.href;
navigating = true;
}
break;
}
});
}
window.addEventListener('DOMContentLoaded', () => {
chapterNavigation();
chapterNavigation();
});
window.onload = function () {
document.body.setAttribute('tabindex', '-1');
document.body.focus();
document.body.setAttribute('tabindex', '-1');
document.body.focus();
};