MediaWiki:Timeless.js
From Ghost Theory Wiki
Note: After publishing, you may have to bypass your browser's cache to see the changes.
- Firefox / Safari: Hold Shift while clicking Reload, or press either Ctrl-F5 or Ctrl-R (⌘-R on a Mac)
- Google Chrome: Press Ctrl-Shift-R (⌘-Shift-R on a Mac)
- Edge: Hold Ctrl while clicking Refresh, or press Ctrl-F5.
/* All JavaScript here will be loaded for users of the Timeless skin */
/* Portlet Toggle */
document.querySelectorAll('.portlet-header').forEach(header => {
header.addEventListener('click', function () {
const portlet = this.closest('.mw-portlet');
const body = portlet.querySelector('.mw-portlet-body');
const arrow = this.querySelector('.portlet-arrow');
body.classList.toggle('collapsed');
arrow.classList.toggle('collapsed');
});
});
/* Year Toggle */
document.querySelectorAll('.year-header').forEach(header => {
header.addEventListener('click', function () {
const yearItem = this.closest('.year-item');
const content = yearItem.querySelector('.year-content');
const arrow = this.querySelector('.year-arrow');
content.classList.toggle('expanded');
arrow.classList.toggle('collapsed');
});
});
/* Search Functionality */
document.getElementById('searchInput')?.addEventListener('keyup', function (e) {
const searchTerm = e.target.value.toLowerCase();
document.querySelectorAll('.mw-portlet-body a, .year-content a').forEach(link => {
const linkText = link.textContent.toLowerCase();
link.parentElement.style.display = linkText.includes(searchTerm) ? 'block' : 'none';
});
});
