MediaWiki:Common.js: Unterschied zwischen den Versionen
Aus Populus DE
Zur Navigation springenZur Suche springenThk (Diskussion | Beiträge) |
Thk (Diskussion | Beiträge) |
||
Zeile 21: | Zeile 21: | ||
if (firstA !== null) { |
if (firstA !== null) { |
||
firstA.classList.add(className); |
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(/title=Quiz:(\d+)&/, Math.floor(Math.random() * 1000000000)) |
||
+ | ); |
||
} |
} |
||
Version vom 20. Juli 2023, 09:38 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(/title=Quiz:(\d+)&/, Math.floor(Math.random() * 1000000000)) ); } })();