MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus Populus DE
Zur Navigation springenZur Suche springenThk (Diskussion | Beiträge) |
Thk (Diskussion | Beiträge) |
||
Zeile 27: | Zeile 27: | ||
if (newQuizLink !== null) { |
if (newQuizLink !== null) { |
||
newQuizLink.setAttribute('href', |
newQuizLink.setAttribute('href', |
||
− | window.location.href.replace(/title=Quiz: |
+ | window.location.href.replace(/\d(<=title=Quiz:)+/, Math.floor(Math.random() * 1000000000)) |
); |
); |
||
} |
} |
Version vom 20. Juli 2023, 09:51 Uhr
(function () { const className = "selected"; var thkOnHashChangedListener = function(){ var prev = document.querySelector('#toc a.' + className); if (prev !== null) { prev.classList.remove(className); } var curr = document.querySelector('#toc a[href="' + window.location.hash + '"]'); if (curr !== null) { curr.classList.add(className); } }; window.addEventListener("hashchange", thkOnHashChangedListener); var firstA = document.querySelector('#toc a:first-of-type'); if (firstA !== null) { firstA.classList.add(className); } // See Populus:QuizEditIntro var newQuizLink = document.querySelector('a[href="http://neuequizfragedummy"]'); if (newQuizLink !== null) { newQuizLink.setAttribute('href', window.location.href.replace(/\d(<=title=Quiz:)+/, Math.floor(Math.random() * 1000000000)) ); } })();