create bug.tools

This commit is contained in:
4DBug
2026-02-28 21:33:31 -06:00
commit 91cee9a33a
63 changed files with 2019 additions and 0 deletions

41
js/switchPage.js Normal file
View File

@@ -0,0 +1,41 @@
const pages = {
home: { title: "welcome" },
contact: { title: "contact" },
links: { title: "links" },
sitemap: { title: "sitemap" }
};
function switchPage(pageKey) {
const page = pages[pageKey];
const template = document.getElementById('page-' + pageKey);
if (!page || !template) return;
const contentDiv = document.getElementById('page-content');
const toolbarTitle = document.getElementById('toolbar-title');
location.hash = pageKey === 'home' ? '' : pageKey;
contentDiv.style.opacity = 0;
setTimeout(() => {
contentDiv.innerHTML = '';
contentDiv.appendChild(template.content.cloneNode(true));
if (toolbarTitle) {
toolbarTitle.textContent = page.title;
toolbarTitle.setAttribute('data-text', page.title);
}
contentDiv.style.transition = 'opacity 0.3s ease';
contentDiv.style.opacity = 1;
}, 150);
}
document.addEventListener('DOMContentLoaded', () => {
const hash = location.hash.replace('#', '');
switchPage(pages[hash] ? hash : 'home');
});
window.addEventListener('hashchange', () => {
const hash = location.hash.replace('#', '');
switchPage(pages[hash] ? hash : 'home');
});