MediaWiki:Common.js: Difference between revisions
Appearance
No edit summary Tag: Reverted |
No edit summary Tag: Reverted |
||
| Line 2: | Line 2: | ||
$(function () { | $(function () { | ||
console.log(" | console.log("BASELINE JS OK"); | ||
/ | // ORIGINAL WORKING SELECT DROPDOWNS | ||
document.querySelectorAll('.mw-dropdown-ui | document.querySelectorAll('.mw-dropdown-ui').forEach(container => { | ||
const container | const select = container.querySelector('select'); | ||
const sections = container.querySelectorAll('.dropdown-section'); | const sections = container.querySelectorAll('.dropdown-section'); | ||
if (!select) return; | |||
select.addEventListener('change', function () { | select.addEventListener('change', function () { | ||
| Line 15: | Line 17: | ||
if (target) target.style.display = 'block'; | if (target) target.style.display = 'block'; | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||
}); | }); | ||
Revision as of 21:52, 21 April 2026
mw.loader.using(['mediawiki.util']).then(function () {
$(function () {
console.log("BASELINE JS OK");
// ORIGINAL WORKING SELECT DROPDOWNS
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';
});
});
});
});