Wikipedista:Hkmaly/monobook.js
Poznámka: Po uložení musíte vyprázdnit mezipaměť vašeho prohlížeče, jinak změny neuvidíte.
// <pre><nowiki>
document.write('<'+'script type="text/javascript" src="'
+ 'http://en.wikipedia.org/w/index.php?title=User:Lupin/popups.js'
+ '&action=raw&ctype=text/javascript&dontcountme=s"><'+'/script>');
popupRevertSummary='Revertování na revizi %s s použitím utility [[:en:Wikipedia:Tools/Navigation_popups|popups]]';
popupRevertSummaryPrompt=true;
document.write('<'+'script type="text/javascript" src="http://www.karlin.mff.cuni.cz/~hkmaly/jsproxy.php/wiki.js"><'+'/script>');
// získat (enkódované) lokální URL nějaké stránky (obdoba localurl:)
function getLocalURL(text) {
text = text.substring(0, 1).toUpperCase() + text.substring(1);
return "/wiki/" + encodeURIComponent(text.replace(/ /g,"_")).replace(/%2f/gi,"/");
}
// Appends a new tab.
// </nowiki></pre> Převzato z [[commons:MediaWiki:Extra-tabs.js]].
// <pre><nowiki>
function appendSth(url, name, id) {
var na = document.createElement('a');
na.setAttribute('href', url);
var txt = document.createTextNode(name);
na.appendChild(txt);
var li = document.createElement('li');
li.appendChild(na);
// Grab the element we want to append the tab and append the tab to it.
var c1 = document.getElementById(id);
if(c1) {
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
tabs.appendChild(li);
}
}
function appendTab(url, name) {
appendSth(url,name,'column-one');
}
function appendTool(url, name) {
appendSth(url,name,'p-tb');
}
// Něco užitečných odkazů - a BTW, musí to být v addOnloadHook, aby se to spustilo až po načtení stránky
$(function() {
appendTool(getLocalURL('Special:Prefixindex/' + wgPageName.substring(0, wgPageName.length - 1)), 'Substránky');
});
// </nowiki></pre>