MediaWiki:Common.js
Материал из SubaruWiki
(Различия между версиями)
Figaro (Обсуждение | вклад) |
Figaro (Обсуждение | вклад) |
||
(12 промежуточных версий не показаны.) | |||
Строка 2: | Строка 2: | ||
function addWikifButton() { | function addWikifButton() { | ||
- | var toolbar = document.getElementById('toolbar'); | + | var toolbar = document.getElementById('toolbar'); |
if (!toolbar) | if (!toolbar) | ||
{ | { | ||
- | |||
return; | return; | ||
} | } | ||
Строка 11: | Строка 10: | ||
i.src = 'http://upload.wikimedia.org/wikisource/ru/d/d1/Button-wikifikator.png'; | i.src = 'http://upload.wikimedia.org/wikisource/ru/d/d1/Button-wikifikator.png'; | ||
i.alt = i.title = 'викификатор'; | i.alt = i.title = 'викификатор'; | ||
- | i.onclick = Wikify; | + | i.onclick = function(){Wikify();}; |
i.style.cursor = 'pointer'; | i.style.cursor = 'pointer'; | ||
- | toolbar.appendChild(i); | + | toolbar.appendChild(i); |
} | } | ||
if (wgAction == 'edit' || wgAction == 'submit') { | if (wgAction == 'edit' || wgAction == 'submit') { | ||
- | + | importScriptURI('/index.php?title=MediaWiki:Wikificator.js&action=raw&ctype=text/javascript'); | |
- | + | ||
addOnloadHook(addWikifButton); | addOnloadHook(addWikifButton); | ||
} | } |
Текущая версия на 09:33, 20 ноября 2011
/* Размещённый здесь JavaScript код будет загружаться всем пользователям при обращении к каждой странице */ function addWikifButton() { var toolbar = document.getElementById('toolbar'); if (!toolbar) { return; } var i = document.createElement('img'); i.src = 'http://upload.wikimedia.org/wikisource/ru/d/d1/Button-wikifikator.png'; i.alt = i.title = 'викификатор'; i.onclick = function(){Wikify();}; i.style.cursor = 'pointer'; toolbar.appendChild(i); } if (wgAction == 'edit' || wgAction == 'submit') { importScriptURI('/index.php?title=MediaWiki:Wikificator.js&action=raw&ctype=text/javascript'); addOnloadHook(addWikifButton); }