MediaWiki:Common.js: Difference between revisions
From The Undead Archive
TheUnburied (talk | contribs) Created page with "→Any JavaScript here will be loaded for all users on every page load.: (function () { function weightedChoose(container) { const options = [...container.querySelectorAll(".gadget-choose-option")]; const weights = options.map(el => parseFloat(el.dataset.weight ?? 1)); const total = weights.reduce((sum, w) => sum + w, 0); let random = Math.random() * total; const chosen = options.find((_el, i) => (random -= weights[i]) < 0)..." |
TheUnburied (talk | contribs) Blanked the page Tag: Blanking |
||
| Line 1: | Line 1: | ||
