MediaWiki:Timeless.js: Difference between revisions

From Ghost Theory Wiki
Created page with "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 To..."
 
m Blanked the page
Tags: Blanking Manual revert
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
/* 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';
  });
});

Latest revision as of 02:31, 16 December 2025