Użytkownik:Adiblol/monobook.js
Z Nonsensopedii, polskiej encyklopedii humoru
Uwaga: aby zobaczyć zmiany po zapisaniu, może zajść potrzeba wyczyszczenia pamięci podręcznej przeglądarki.
- Firefox / Safari: Przytrzymaj Shift podczas klikania Odśwież bieżącą stronę, lub naciśnij klawisze Ctrl+F5 lub Ctrl+R (⌘-R na komputerze Mac)
- Google Chrome: Naciśnij Ctrl-Shift-R (⌘-Shift-R na komputerze Mac)
- Internet Explorer: Przytrzymaj Ctrl jednocześnie klikając Odśwież lub naciśnij klawisze Ctrl+F5
- Konqueror: Kliknij polecenie Odśwież lub naciśnij klawisz F5
- Opera: Wyczyść pamięć podręczną w Narzędzia → Preferencje
// <nowiki>
/*function ElementExists(arr, el) {
alert(arr);
alert(el);
for(var i=0;i<arr.length;i++) {
if (arr[i]==el) return true;
}
return false;
}*/
function RegisterDescs() {
descs=Array();
texts=Array();
descs['ek'] = '{{[[Szablon:Ek|ek]]}}';
descs['ek-prywata'] = 'ek ([[N:P|prywata]])';
descs['ek-total'] = 'ek (totalne zło)';
descs['red'] = 'red.';
descs['lit'] = 'literówka';
descs['popr.format'] = 'popr. format. wiki';
descs['sdu'] = 'SdU';
descs['worek'] = '[[N:W|worek]]';
descs['kat.'] = 'kategoria';
texts['ek'] = '{{ek}}';
texts['ek-prywata'] = '{{ek|[[Nonsensopedia:Prywata|Prywata]]}}';
texts['ek-total'] = '{{ek|TOTALNE ZŁO I BEZSENS!!!}}';
texts['sdu'] = '{{Kasacja}}';
texts['worek'] = '{{worek}}';
var s='';
for (dn in descs) {
s+='<a href="#" onclick="addToSummary(''+descs[dn]+'');return false;">'+dn+'</a>, ';
}
document.getElementById('editOptions').innerHTML =
'<small style="border:1px solid #444;background:#eee;padding:2px"> <b>Gotowce</b>: '+s+
'</small>'+document.getElementById('editOptions').innerHTML;
s='';
var c='';
for (dn in texts) {
if (descs[dn]) {
c+='<button style="height:23px" onclick="addToTextAndSummary(''+texts[dn]+'',''+descs[dn]+
'');return false;">'+dn+'</button> ';
}
s+='<a href="#" onclick="addToText(''+texts[dn]+'');return false;">'+dn+'</a>, ';
}
if (wgCanonicalNamespace=='Gra') {
var gl = '<a href="#" onclick="addGameCategory();return false;"><b>Kategoria Gra</b></a>; ';
} else var gl='';
document.getElementById('editform').innerHTML =
'<small style="border:1px solid #444;background:#eee;padding:2px"> <b>Dodatkowe</b>: '+gl+s+
'</small>'+document.getElementById('editform').innerHTML;
document.getElementById('editOptions').innerHTML += '<br /><b>GOTOWCE (tekst & opis)</b>: '+c+'<br /><br />';
}
function addGameCategory() {
document.getElementById('wpTextbox1').value += "\n\n[[kategoria:Gra|"+wgTitle.substring(wgTitle.indexOf(' ')+1, wgTitle.length)+']]';
}
function RegisterRevert() {
d = document.getElementById('mw-diff-otitle1');
rver = d.firstChild.firstChild.innerText;
d.innerHTML += '(<a href="#" onclick="revertArticle(''+rver+'');">przywróć</a>)';
}
var conn = new XMLHttpRequest;
var revertEditToken='';
var revertAutoSummary='';
var revertVersion='';
function revertDone() {
if (conn.readyState==4 && conn.status==200) {
alert('Revert zakończony!');
location.href='/index.php?title='+escape(wgPageName);
}
}
function revertGetContents() {
if (conn.readyState==4 && conn.status==200) {
var cont = conn.responseText;
conn.open('POST', '/index.php?title='+escape(wgPageName)+'&action=submit', true);
conn.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
conn.setRequestHeader("Content-length", text.length);
conn.setRequestHeader("Connection", "close");
conn.onreadystatechange = revertDone;
conn.send('wpLogin=&wpSection=&wpScrolltop=&wpTextbox1='+escape(cont)+'&wpSave=Zapisz&wpSummary='+escape('Revert: '+revertVersion)+'wpAutoSummary='+escape(revertAutoSummary)+'&wpEditToken='+escape(revertEditToken)+'&antispam=');
}
}
function revertGetEditToken() {
if (conn.readyState==4 && conn.status==200) {
revertEditToken = conn.responseText.substr(conn.responseText.indexOf('name="wpEditToken"')-36, 34);
revertAutoSummary = conn.responseText.substr(conn.responseText.indexOf('name="wpAutoSummary"')+42, 32);
conn.open('GET', '/index.php?title="'+escape(wgPageName)+'&action=raw', true);
conn.onreadystatechange = revertGetContents;
conn.send(null);
}
}
function revertArticle(ver) {
d = document.getElementById('jump-to-nav');
conn.open('GET', '/index.php?title='+escape(wgPageName)+'&action=edit', true);
conn.onreadystatechange = revertGetEditToken;
revertVersion = ver;
conn.send(null);
}
function CheckHistory() {
if (document.getElementById('mw-diff-otitle1')) {
RegisterRevert();
}
}
if ((wgAction=='edit') || (wgAction=='submit')) {
addOnloadHook(RegisterDescs);
}
addOnloadHook(CheckHistory);
function addToSummary(v) {
document.getElementById('wpSummary').value += v;
}
function addToText(v) {
document.getElementById('wpTextbox1').value=v+"\n\n\n"+document.getElementById('wpTextbox1').value;
}
function addToTextAndSummary(t,s) {
addToText(t);
addToSummary(s);
}
// </nowiki>