Версия 22:35, 1 сентября 2011 | | Версия 22:49, 1 сентября 2011 |
Строка 45: | | Строка 45: |
| | | | |
| function tacticNext() { | | | function tacticNext() { |
? | if (tacticCounter < tacticPages) { | | + | document.getElementById('step' + tacticCounter).style.display = 'none'; |
? | document.getElementById('step' + tacticCounter).style.display = 'none'; | | + | document.getElementById(mapPrefix + tacticCounter).style.display = 'none'; |
? | document.getElementById(mapPrefix + tacticCounter).style.display = 'none'; | | + | |
| | | | |
? | document.getElementById('step' + ++tacticCounter).style.display = 'block'; | | + | if (tacticCounter < tacticPages) { |
? | document.getElementById(mapPrefix + tacticCounter).style.display = 'block'; | | + | tacticCounter++ ; |
? | } | | + | if (tacticCounter == tacticPages) document.getElementById('nextsteplink').innerText = 'В начало'; |
| | + | } else { tacticCounter = 1; } |
| | + | |
| | + | document.getElementById('step' + tacticCounter).style.display = 'block'; |
| | + | document.getElementById(mapPrefix + tacticCounter).style.display = 'block'; |
| return false; | | | return false; |
| } | | | } |
Строка 61: | | Строка 64: |
| return; | | | return; |
| } | | | } |
? | var aNode = document.createElement( 'a' ); | | + | var aNode = document.createElement( 'a' ); |
| | + | aNode.setAttribute( 'id', 'nextsteplink' ); |
| aNode.setAttribute( 'href', '#' ); | | | aNode.setAttribute( 'href', '#' ); |
| aNode.setAttribute( 'onClick', 'return tacticNext();' ); | | | aNode.setAttribute( 'onClick', 'return tacticNext();' ); |
Версия 22:49, 1 сентября 2011
/* Размещённый здесь 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 tacticPages = 4;
var mapPrefix = 'karel54_';
function tacticNext() {
document.getElementById('step' + tacticCounter).style.display = 'none';
document.getElementById(mapPrefix + tacticCounter).style.display = 'none';
if (tacticCounter < tacticPages) {
tacticCounter++ ;
if (tacticCounter == tacticPages) document.getElementById('nextsteplink').innerText = 'В начало';
} else { tacticCounter = 1; }
document.getElementById('step' + tacticCounter).style.display = 'block';
document.getElementById(mapPrefix + tacticCounter).style.display = 'block';
return false;
}
function tacticSlideShow() {
try {
var nextDiv = document.getElementById('nextstep');
if (nextDiv == null) {
return;
}
var aNode = document.createElement( 'a' );
aNode.setAttribute( 'id', 'nextsteplink' );
aNode.setAttribute( 'href', '#' );
aNode.setAttribute( 'onClick', 'return tacticNext();' );
aNode.appendChild(document.createTextNode('Продолжить »'));
nextDiv.appendChild( aNode );
} catch(e) {
return;
}
}
addOnloadHook(tacticSlideShow);