Jump to content

MediaWiki:Common.js: Difference between revisions

From Once Human Guide
No edit summary
Tag: Reverted
No edit summary
Tag: Reverted
Line 2: Line 2:
   $(function () {
   $(function () {


     // === ORIGINAL WORKING DROPDOWN SYSTEM ===
    console.log("COMMON.JS LOADED");
 
     /* ===== DROPDOWN SYSTEM (ORIGINAL SIMPLE VERSION) ===== */
 
     document.querySelectorAll('.mw-dropdown-ui').forEach(container => {
     document.querySelectorAll('.mw-dropdown-ui').forEach(container => {
       const select = container.querySelector('select');
       const select = container.querySelector('select');

Revision as of 21:46, 21 April 2026

mw.loader.using('mediawiki.util').then(function () {
  $(function () {

    console.log("COMMON.JS LOADED");

    /* ===== DROPDOWN SYSTEM (ORIGINAL SIMPLE VERSION) ===== */

    document.querySelectorAll('.mw-dropdown-ui').forEach(container => {
      const select = container.querySelector('select');
      const sections = container.querySelectorAll('.dropdown-section');

      if (!select) return;

      select.addEventListener('change', function () {
        sections.forEach(s => s.style.display = 'none');

        const target = container.querySelector('#' + this.value);
        if (target) target.style.display = 'block';
      });
    });

  });
});