Użytkownik:Michalwadas/monobook.js: Różnice pomiędzy wersjami

Z Nonsensopedii, polskiej encyklopedii humoru
M (test monobooka Holly)
M (Cofnij.)
Linia 1: Linia 1:
importScript('Użytkownik:Michalwadas/facebook.js');
// <nowiki>


///////////////////////////////////////////////////
///// OPISY ZMIAN I AUTOWKLEJANIE DO ARTÓW
///////////////////////////////////////////////////

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-dno'] = '{{ek|Dno totalne}}';
texts['sdu'] = '{{Kasacja}}';
texts['worek'] = '{{worek}}';

var s='';
for (dn in descs) {
s+='<a href="#" onclick="addToSummary(&apos;'+descs[dn]+'&apos;);return false;">'+dn+'</a>, ';
}
document.getElementById('editOptions').innerHTML =
'<small style="border:1px solid #444;background:#eee;padding:2px">&nbsp;<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(&apos;'+texts[dn]+'&apos;,&apos;'+descs[dn]+
'&apos;);return false;">'+dn+'</button>&nbsp;';
}
s+='<a href="#" onclick="addToText(&apos;'+texts[dn]+'&apos;);return false;">'+dn+'</a>, ';
}
if (wgCanonicalNamespace=='Gra') {
var gl = '<a href="#" onclick="addGameCategory();return false;"><b>Kategoria Gra</b></a>;&nbsp; &nbsp;';
} else var gl='';
document.getElementById('editform').innerHTML =
'<small style="border:1px solid #444;background:#eee;padding:2px">&nbsp;<b>Dodatkowe</b>: '+gl+s+
'</small>'+document.getElementById('editform').innerHTML;
document.getElementById('editOptions').innerHTML += '<br /><b>GOTOWCE (tekst &amp; opis)</b>: '+c+'<br /><br />';

}
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);
}
function addGameCategory() {
document.getElementById('wpTextbox1').value += "\n\n[[kategoria:Gra|"+wgTitle.substring(wgTitle.indexOf(' ')+1, wgTitle.length)+']]';
}


///////////////////////////////////////////////////
///// AUTOMATYCZNY REVERT
///////////////////////////////////////////////////

function RegisterRevert() {
d = document.getElementById('mw-diff-otitle1').firstChild.firstChild;
document.getElementById('mw-diff-otitle1').innerHTML += '(<a href="#" onclick="revertArticle(&apos;'+d.innerText+'&apos;,&apos;'+d.href+'&apos;);">przywróć</a>)';
}
var conn = new XMLHttpRequest;

var revertEditToken='';
var revertAutoSummary='';
var revertVersion='';
var revertAddress='';
var revertStartTime='';
var revertEditTime='';
var revertContents='';

function revertShowMsg(text) {
document.getElementById('revertMessage').innerHTML = text;
}

function revertGetContents() {
if (conn.readyState==4 && conn.status==200) {
revertContents = conn.responseText;
document.getElementById('revertConfirm').disabled = '';
revertShowMsg('Gotowy.');
}
}

function revertDo() {
revertShowMsg('Trwa wysyłanie danych...');
var f = document.createElement('form');
function HiddenInput(name, value) {
var e = document.createElement('input');
e.type='hidden';
e.name = name;
e.value = value;
return e;
}
f.action = '/index.php?title='+encodeURI(wgPageName)+'&action=submit';
f.method = 'post';
f.enctype = 'multipart/form-data';
f.appendChild(HiddenInput('wpLogin', ''));
f.appendChild(HiddenInput('wpSection', ''));
f.appendChild(HiddenInput('wpStarttime', revertStartTime));
f.appendChild(HiddenInput('wpEdittime', revertEditTime));
f.appendChild(HiddenInput('wpScrolltop', ''));
f.appendChild(HiddenInput('wpTextbox1', revertContents));
var rdesc = '';
var opt = document.getElementById('revertReason').selectedIndex;
if (opt==0) rdesc=''; else
if (opt==1) rdesc = document.getElementById('revertDesc').value; else
rdesc = document.getElementById('revertReason').options[opt].innerHTML;
f.appendChild(HiddenInput('wpSummary', 'Revert: '+revertVersion+((rdesc!='')?' ('+rdesc+')':'')));
f.appendChild(HiddenInput('wpSave', 'Zapisz'));
f.appendChild(HiddenInput('wpEditToken', revertEditToken));
f.appendChild(HiddenInput('wpAutoSummary', revertAutoSummary));
f.appendChild(HiddenInput('antispam', ''));
f.submit();
revertShowMsg('Wysłano!<br /><a href="javascript:history.back();">Wstecz</a>');
}

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);
revertStartTime = conn.responseText.substr(conn.responseText.indexOf('name="wpStarttime"')-16, 14);
revertEditTime = conn.responseText.substr(conn.responseText.indexOf('name="wpEdittime"')-16, 14);
conn = new XMLHttpRequest;
conn.open('GET', revertAddress, true);
conn.onreadystatechange = revertGetContents;
conn.send(null);
revertShowMsg('Pobieranie treści...');
}
}

function revertReasonChange() {
document.getElementById('revertDesc').style.visibility = ((document.getElementById('revertReason').selectedIndex==1)?'visible':'hidden');
}

function revertArticle(ver,addr) {
document.getElementById('mw-diff-otitle1').parentNode.innerHTML = '<span id="revertMessage" style="color:#006600;font-size:14pt"></span>';
s = '<h3>Przyczyna revertu:</h3><select id="revertReason" style="width:80%" onchange="revertReasonChange();"><option value="noreason">(brak)</option><option value="custom">(własny)</option>';
reasons=Array('wandalizm', 'blank', 'bezsens', 'bo tak', 'głupoty', 'celebrities');
for (var i=0;i<reasons.length;i++) {
s += '<option value="n">'+reasons[i]+'</option>';
}
s += '</select><button id="revertConfirm" onclick="revertDo();" disabled="disabled" style="width:16%">OK</button><input type="text" id="revertDesc" value="" style="width:98%;visibility:hidden" />';
document.getElementById('mw-diff-ntitle1').parentNode.innerHTML=s;
//d = document.getElementById('jump-to-nav');
conn.open('GET', '/index.php?title='+encodeURI(wgPageName)+'&action=edit', true);
conn.onreadystatechange = revertGetEditToken;
revertVersion = ver;
revertAddress = addr+'&action=raw';
conn.send(null);
revertShowMsg('Pobieranie danych...');
}

function CheckHistory() {
if (document.getElementById('mw-diff-otitle1')) {
RegisterRevert();
}
}

if ((wgAction=='edit') || (wgAction=='submit')) {
addOnloadHook(RegisterDescs);
}

addOnloadHook(CheckHistory);


importScript('User:Chommik12/HotCat.js');
importScript('User:Chommik12/HotCat.js');
setTimeout("hotcat()",1500);
setTimeout("hotcat()",1500);
importScript('Użytkownik:Michalwadas/multikat.js');


// </nowiki>

var adres = wgServer +'/wiki/' + wgPageName;
var napisX = Math.round(screen.width/1280 * 160); // Odpowiedni rozmiar
var napisY = Math.round(screen.width/1280 * 33);
var ikonki = Math.round(screen.width/1280 * 20);
if (ikonki > 20) {
ikonki = 20; //Nie lubimy rozpikselowania
}
if (napisX > 160) {
napisX = 160; //Nie lubimy rozpikselowania
}
if (napisY > 33) {
napisY = 33; //Nie lubimy rozpikselowania
}
document.write('<div name="share_it" style="z-index: 3000; position: absolute; left: 170px; top: 45px;"><img width=' + napisX +' height=' + napisY + ' src="http://komixxy.pl/res/img/podzielSie.png" /><a target="_blank" href="http://www.facebook.pl/share.php?u=' + adres + '&amp;t=' + 'Z Nonsensopedii, polskiej encyklopedii humoru' + '"><img title="Udostępnij to na Facebooku!" class="fb_share" width=' + ikonki +' height=' + ikonki +' src="http://images3.wikia.nocookie.net/__cb20100804204142/nonsensopedia/images/6/64/Icon_facebook.png" /></a><a target="_blank" title="Udostępnij to na GG (opis)!" class="gg_share" href="gg:/set_status?description=' + adres + '"><img src="http://images1.wikia.nocookie.net/__cb20100805075707/nonsensopedia/images/a/a8/Logo_gg_share.png" width=' + ikonki +' height=' + ikonki +' /></a><a title="Wykop to!!" target="_blank" class="wykop_to" href="http://www.wykop.pl/dodaj?url=' + adres + '&title=' + wgPageName + '&desc=Z Nonsensopedii, polskiej encyklopedii humoru"><img src="http://images2.wikia.nocookie.net/__cb20100805120046/nonsensopedia/images/4/46/Logo_wykop_share.png" width=' + ikonki +' height=' + ikonki +' /></a></div>');

function kat() {

var textarea = document.getElementById('wpTextbox1');
var temp = 12;
var kategoria = '';
//wgPageName.substring(temp);
if (document.title.indexOf('Gra:Strona!/Opozycja/') != -1)
temp = 21;
if (document.title.indexOf('Gra:Strona!/Koalicja/') != -1)
temp = 21;
if (document.title.indexOf('Gra:Strona!/Szatan/') != -1)
temp = 19;
kategoria = '[[Kategoria:Gra – Multiplayer|' + wgPageName.substring(temp) + ']]';
textarea.innerHTML = textarea.innerHTML + kategoria;

}

function toolbar_extra() {

var toolbar = document.getElementById('toolbar');
if (toolbar == null) {
return false;
}
var button1 = '<img style="cursor: pointer;" title="Kategoryzacja multiplyera" alt="Pozioma linia (używaj oszczędnie)" src="http://images1.wikia.nocookie.net/__cb20100810191541/nonsensopedia/images/a/a8/Przycisk_mediawiki.png" id="kat_mult_gra" class="mw-toolbar-editbutton" border="0" height="22" width="23" onclick="kat();">';
if((document.title.indexOf('Edytujesz ') != -1)&&(wgNamespaceNumber == 108) && (document.title.indexOf('Strona!') != -1)) // tylko strony gry multiplayer
toolbar.innerHTML = toolbar.innerHTML + button1;
}
addOnloadHook(toolbar_extra);

Wersja z 09:50, 11 sie 2010

importScript('Użytkownik:Michalwadas/facebook.js');
importScript('User:Chommik12/HotCat.js');
setTimeout("hotcat()",1500);
importScript('Użytkownik:Michalwadas/multikat.js');