MediaWiki:Common.js
Материал из SubaruWiki
(Различия между версиями)
Figaro (Обсуждение | вклад) (Новая страница: «/* Размещённый здесь JavaScript код будет загружаться всем пользователям при обращении к каждо...») |
Figaro (Обсуждение | вклад) |
||
(17 промежуточных версий не показаны.) | |||
Строка 2: | Строка 2: | ||
function addWikifButton() { | function addWikifButton() { | ||
- | var toolbar = document.getElementById('toolbar') | + | var toolbar = document.getElementById('toolbar'); |
- | if (!toolbar) return | + | if (!toolbar) |
- | var i = document.createElement('img') | + | { |
- | i.src = 'http://upload.wikimedia.org/wikisource/ru/d/d1/Button-wikifikator.png' | + | return; |
- | i.alt = i.title = 'викификатор' | + | } |
- | i.onclick = Wikify | + | var i = document.createElement('img'); |
- | i.style.cursor = 'pointer' | + | i.src = 'http://upload.wikimedia.org/wikisource/ru/d/d1/Button-wikifikator.png'; |
- | toolbar.appendChild(i) | + | i.alt = i.title = 'викификатор'; |
+ | i.onclick = function(){Wikify();}; | ||
+ | i.style.cursor = 'pointer'; | ||
+ | toolbar.appendChild(i); | ||
} | } | ||
if (wgAction == 'edit' || wgAction == 'submit') { | if (wgAction == 'edit' || wgAction == 'submit') { | ||
- | importScriptURI(' | + | 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); }