Версия 20:38, 22 октября 2011 | | Версия 16:25, 19 января 2012 |
Строка 37: | | Строка 37: |
| } | | | } |
| | | | |
? | addOnloadHook(addPlayButton); | | + | /* addOnloadHook(addPlayButton); */ |
| | | | |
| | | | |
Версия 16:25, 19 января 2012
/* Размещённый здесь JavaScript код будет загружаться всем пользователям при обращении к каждой странице */
function addWikifButton() {
var toolbar = document.getElementById('toolbar')
if (!toolbar) return
var i = document.createElement('img')
i.src = 'https://upload.wikimedia.org/wikisource/ru/d/d1/Button-wikifikator.png'
i.alt = i.title = 'викификатор'
i.onclick = Wikify
i.style.cursor = 'pointer'
toolbar.appendChild(i)
}
if (wgAction == 'edit' || wgAction == 'submit') {
importScriptURI('https://ru.wikipedia.org/w/index.php?title=MediaWiki:Wikificator.js&action=raw&ctype=text/javascript')
addOnloadHook(addWikifButton)
}
function addPlayButton() {
try {
var logout = document.getElementById('pt-logout');
if (logout != null) {
document.getElementById('footer-wot-link').style.display = 'none';
}
var headerAttract = document.getElementById('header-attract');
headerAttract.setAttribute( 'id', 'old-header-attract');
headerAttract.style.display = 'none';
var head = document.getElementById('mw-head');
var aNode = document.createElement( 'a' );
var divNode = document.createElement( 'div' );
aNode.setAttribute( 'href', 'javascript:void(0)' );
aNode.setAttribute( 'id', 'header-attract');
divNode.setAttribute( 'id', 'btn-play');
divNode.appendChild( aNode );
head.appendChild( divNode );
} catch(e) {
return;
}
}
/* addOnloadHook(addPlayButton); */
var tacticCounter = 1;
var mapImages = new Array();
function tacticNext() {
document.getElementById('step' + tacticCounter).style.display = 'none';
if (tacticCounter < mapImages.length - 1) {
tacticCounter++ ;
if (tacticCounter == mapImages.length - 1) document.getElementById('nextsteplink').innerHTML = 'В начало';
} else {
tacticCounter = 1;
document.getElementById('nextsteplink').innerHTML = 'Продолжить »';
}
document.getElementById('step' + tacticCounter).style.display = 'block';
document.getElementById('tacticimg').src = mapImages[tacticCounter];
return false;
}
function tacticSlideShow() {
try {
var mapDiv = document.getElementById('tacticmap');
if (mapDiv == null) {
return;
}
mapImages = mapDiv.innerHTML.split(',');
mapDiv.innerHTML = '';
mapDiv.style.background = 'url(' + mapImages[0] + ') top no-repeat';
var imgNode = document.createElement( 'img' );
imgNode.id = 'tacticimg';
imgNode.src = mapImages[1];
mapDiv.appendChild( imgNode );
var aNode = document.createElement( 'a' );
aNode.setAttribute( 'id', 'nextsteplink' );
aNode.setAttribute( 'href', '#' );
aNode.setAttribute( 'onClick', 'return tacticNext();' );
aNode.appendChild(document.createTextNode('Продолжить »'));
document.getElementById('nextstep').appendChild(aNode);
} catch(e) {
return;
}
}
addOnloadHook(tacticSlideShow);
function tthToTop() {
document.getElementById('stockTTH').style.display = 'none';
document.getElementById('topTTH').style.display = 'block';
return false;
}
function tthToStock() {
document.getElementById('topTTH').style.display = 'none';
document.getElementById('stockTTH').style.display = 'block';
return false;
}
function tthTopStock() {
try {
var toStock = document.getElementById('toStock');
var toTop = document.getElementById('toTop');
if (toStock == null || toTop == null) {
return;
}
var aNode = document.createElement( 'a' );
aNode.setAttribute( 'href', '#' );
aNode.setAttribute( 'onClick', 'return tthToTop();' );
aNode.appendChild(document.createTextNode('топ'));
toTop.appendChild(aNode);
var aNode = document.createElement( 'a' );
aNode.setAttribute( 'href', '#' );
aNode.setAttribute( 'onClick', 'return tthToStock();' );
aNode.appendChild(document.createTextNode('сток'));
toStock.appendChild(aNode);
} catch(e) {
return;
}
}
addOnloadHook(tthTopStock);