mirror of
https://github.com/tauri-apps/tauri-docs.git
synced 2026-01-31 00:35:16 +01:00
fix: tabs are a sin
This commit is contained in:
@@ -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();
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user