MediaWiki:Common.js — различия между версиями
м |
м |
||
Строка 11: | Строка 11: | ||
if (mw.config.get("wgAction") == 'edit' || mw.config.get("wgAction") == 'submit') { | if (mw.config.get("wgAction") == 'edit' || mw.config.get("wgAction") == 'submit') { | ||
var wikiHeadEl = document.createElement('script'); | var wikiHeadEl = document.createElement('script'); | ||
− | wikiHeadEl.type | + | wikiHeadEl.setAttribute('type', "text/javascript"); |
− | wikiHeadEl.src | + | wikiHeadEl.setAttribute('src', "//ru.wikipedia.org/w/index.php?title=MediaWiki:Gadget-wikificator.js&action=raw&ctype=text/javascript"); |
wikiHeadEl.addEventListener('load', () => window.setTimeout(addWikifButton, 250)); | wikiHeadEl.addEventListener('load', () => window.setTimeout(addWikifButton, 250)); | ||
document.head.appendChild(wikiHeadEl); | document.head.appendChild(wikiHeadEl); | ||
} | } |
Версия 21:30, 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') {
var wikiHeadEl = document.createElement('script');
wikiHeadEl.setAttribute('type', "text/javascript");
wikiHeadEl.setAttribute('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);
}