MediaWiki:Common.js — различия между версиями
Строка 10: | Строка 10: | ||
} | } | ||
if (mw.config.get("wgAction") == 'edit' || mw.config.get("wgAction") == 'submit') { | if (mw.config.get("wgAction") == 'edit' || mw.config.get("wgAction") == 'submit') { | ||
− | document. | + | (function() |
− | + | { | |
+ | let wikiHeadEl = document.createElement('script'); | ||
+ | wikiHeadEl.type = "text/javascript"; | ||
+ | wikiHeadEl.src = "//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikificator.js&action=raw&ctype=text/javascript"; | ||
+ | wikiHeadEl.addEventListener('load', () => window.setTimeout(addWikifButton, 250)); | ||
+ | |||
+ | document.head.appendChild(wikiHeadEl); | ||
+ | })(); | ||
} | } |
Версия 21:25, 16 августа 2021
function addWikifButton() {
var toolbar = document.getElementById('toolbar')
if (!toolbar) return
var i = document.createElement('img')
i.src = '//upload.wikimedia.org/wikisource/ru/d/d1/Button-wikifikator.png'
i.alt = i.title = 'викификатор'
i.onclick = window.Wikify
i.style.cursor = 'pointer'
toolbar.appendChild(i)
}
if (mw.config.get("wgAction") == 'edit' || mw.config.get("wgAction") == 'submit') {
(function()
{
let wikiHeadEl = document.createElement('script');
wikiHeadEl.type = "text/javascript";
wikiHeadEl.src = "//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikificator.js&action=raw&ctype=text/javascript";
wikiHeadEl.addEventListener('load', () => window.setTimeout(addWikifButton, 250));
document.head.appendChild(wikiHeadEl);
})();
}