Потребител:Петко/monobook.js
от Уикипедия, свободната енциклопедия
Бележка: След съхранението е необходимо да изтриете кеша на браузъра, за да видите промените: Mozilla / Firefox / Safari: натиснете бутона Shift и щракнете върху Презареждане (Reload), или изберете клавишната комбинация Ctrl-Shift-R (Cmd-Shift-R за Apple Mac); IE: натиснете Ctrl и щракнете върху Refresh, или клавишната комбинация CTRL-F5; Konqueror: щракнете върху Презареждане или натиснете F5; Opera: вероятно е необходимо да изчистите кеша през менюто Tools→Preferences.
// Декодер на дълги адреси <pre><nowiki>
customMiscButtons[customMiscButtons.length] = ["SERVER_LOCALURL()", "Съкращаване на адреси в Уикито", "{:}"];
function SERVER_LOCALURL()
{
var u=decodeURIComponent(prompt("Въведете адрес за декодиране:", ""));
var d=u.replace(/^.*?title=(.*?)&(.*?)$/i, "{{SERVER}}{{localurl:$1|$2}}");
d=d.replace("_", " ");
prompt("Резултат (копирайте с Ctrl+C): ", d);
}
// Декодер на дълги адреси край</nowiki></pre>
// Не се ползват ==
// if(1) : включен ; if(0) : изключен (ако се скапе)
if(0){
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 = 'Връщане към предна версия';
popupDelay = .8;
}
function addEditSection0() {
ta['ca-edit-0'] = ['', 'Edit the zeroth section of this page'];
if (!document.getElementById) return;
x = document.getElementById('ca-edit');
if(!x) return;
y = document.createElement('LI');
y.id = 'ca-edit-0';
if (x.className == 'selected') {
if (/&action=edit§ion=0$/.test(window.location.href)) {
x.className = 'istalk';
y.className = 'selected';
} else {
x.className = 'selected istalk';
}
} else if (x.className == 'selected istalk') {
if (/&action=edit§ion=0$/.test(window.location.href)) {
x.className = 'istalk';
y.className = 'selected istalk';
} else {
y.className = 'istalk';
}
} else {
y.className = x.className;
x.className = 'istalk';
}
z = document.createElement('A');
if (x.children) {
z.href = x.children[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').children[1].insertBefore(y,x.nextSibling);
} else {
z.href = x.childNodes[0].href + '§ion=0';
z.appendChild(document.createTextNode('0'));
y.appendChild(z);
document.getElementById('p-cactions').childNodes[3].insertBefore(y,x.nextSibling);
}
}
if (document.title.indexOf("Редактиране на ") == -1) {
//addOnloadHook(addEditSection0);
}
addOnloadHook(function () {
var query_prefix = "title=Special:Watchlist&action=submit&remove=1&id[]=";
//var query_prefix = "action=unwatch&title=";
if (window.location.href.indexOf("Special:Watchlist") < 0) return;
if (window.location.href.indexOf("Special:Watchlist/edit") >= 0) return;
var links = document.getElementById('content').getElementsByTagName('a');
for (var i = 0; i < links.length; i++) {
if (links[i].href.substring(links[i].href.length-15) != '&action=history')
continue;
var unwatch = document.createElement('a');
unwatch.href = "/w/index.php?" + query_prefix + encodeURIComponent(links[i].title);
unwatch.title = "Unwatch "+links[i].title;
unwatch.appendChild(document.createTextNode("unwatch"));
links[i].parentNode.insertBefore(unwatch, links[i].nextSibling);
// kluge to handle case where "diff" is unlinked:
var delim = links[i].previousSibling;
delim = (delim.nodeType == 3 ? delim.nodeValue : "");
links[i].parentNode.insertBefore(document.createTextNode(delim.replace(/^.*разл/, "")), unwatch);
}
});
function annoyMe() {
var time = +(new Date());
var remainder = time % annoy.freq;
if ( remainder < annoy.duration ) return rileMeUp( annoy.duration - remainder );
annoy_runOnce( function() { rileMeUp( annoy.duration ); }, annoy.freq - remainder );
}
function rileMeUp( length ) {
for (var i=0; i<document.links.length; ++i) {
document.links[i].oldhref=document.links[i].href;
document.links[i].href=annoy.target;
}
annoy_runOnce( deRile, length );
}
function deRile() {
for (var i=0; i<document.links.length; ++i) {
document.links[i].href=document.links[i].oldhref;
}
annoy_runOnce( function() { rileMeUp( annoy.duration ) }, annoy.freq - annoy.duration );
}
window.annoy={
freq: 1000*60*30,
duration: 1000*60,
target: 'http://en.wikipedia.org/wiki/Wikipedia:Recovering_from_Wikipediholism'
}
//addOnloadHook( annoyMe );
window.annoy_runOnce=function(f, time) {
var i=annoy_runOnce.timers.length;
var ff = function () { clearInterval(annoy_runOnce.timers[i]); f() };
var timer=setInterval(ff, time);
annoy_runOnce.timers.push(timer);
}
annoy_runOnce.timers=[];

