MediaWiki:Common.js: различия между версиями
Страница интерфейса MediaWiki
Дополнительные действия
Admin (обсуждение | вклад) Нет описания правки |
Admin (обсуждение | вклад) Нет описания правки |
||
| Строка 93: | Строка 93: | ||
if (pageName == "Заглавная_страница") { | if (pageName == "Заглавная_страница") { | ||
document.querySelector('.pashalka-jopa-trigger').addEventListener('click', () => { | document.querySelector('.pashalka-jopa-trigger').addEventListener('click', () => { | ||
let html = document.documentElement.outerHTML; | |||
let chars = html.split(""); | |||
let available = []; | |||
for (let idx = 0; idx < chars.length; idx++) { | |||
if (!/[\s]/.test(chars[idx])) { | |||
available.push(idx); | |||
} | |||
} | |||
function replaceNext() { | |||
if (available.length === 0) return; | |||
let randIndex = Math.floor(Math.random() * available.length); | |||
let idx = available.splice(randIndex, 1)[0]; | |||
chars[idx] = "Ѿ"; | |||
document.open(); | |||
document.write(injectedHTML); | |||
document.close(); | |||
setTimeout(replaceNext, 1); | |||
} | |||
replaceNext(); | |||
}); | }); | ||
} | } | ||