Naudotojas:Vpovilaitis/monobook.js: Skirtumas tarp puslapio versijų
Ištrintas turinys Pridėtas turinys
S MediaWiki:Monobook.js pervadintas į Naudotojas:Vpovilaitis/monobook.js (anksčiau buvo nukreipiamasis) |
Puslapis keičiamas su „document.write('<script type="text/javascript" src="' + 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js' + '&action=raw&ctype=text/javascript"></' + 'sc…“ |
||
1 eilutė: | 1 eilutė: | ||
document.write('<script type="text/javascript" src="' |
|||
var nuo = 203; |
|||
+ 'http://en.wikipedia.org/w/index.php?title=User:Cacycle/wikEd.js' |
|||
var iki = 299; |
|||
+ '&action=raw&ctype=text/javascript"></' + 'script>'); |
|||
var canPrastinti = false; |
|||
// Atsimink |
|||
window.nahInitObject = function(array, preset) { |
|||
for (var key in preset) { |
|||
if (typeof(key) != 'string') { |
|||
continue; |
|||
} |
|||
if (array[key] == null) { |
|||
array[key] = preset[key]; |
|||
} |
|||
} |
|||
return; |
|||
} |
|||
if (typeof(window.nahSettings) == 'undefined') { window.nahSettings = {}; } |
|||
window.nahPoSsInitText = function() { |
|||
nahInitObject(window.nahSettings , { |
|||
from: "", |
|||
to: "" |
|||
}); |
|||
}; |
|||
if (typeof(prastinimasText) == 'undefined') { window.prastinimasText = {}; } |
|||
window.PrastinimasInitText = function() { |
|||
nahInitObject(prastinimasText, { |
|||
/*b001: [ '== Afrika ==', new RegExp(/\=\=Africa\=\=/gm) ], |
|||
b002: [ '== Azija ==', new RegExp(/\=\=Asia\=\=/gm) ], |
|||
b003: [ '== Europa ==', new RegExp(/\=\=Europe\=\=/gm) ], |
|||
b004: [ '== Vidurinieji rytai ==', new RegExp(/\=\=Middle East\=\=/gm) ], |
|||
b005: [ '[[Egiptas]]', new RegExp(/\[\[Egypt\]\]/gm) ], |
|||
b006: [ '[[Kinija]]', new RegExp(/\[\[China\]\]/gm) ], |
|||
b007: [ '[[Korėja]]', new RegExp(/\[\[Korea\]\]/gm) ], |
|||
b008: [ '[[Indija]]', new RegExp(/\[\[India\]\]/gm) ], |
|||
b009: [ '[[Atėnai]]', new RegExp(/\[\[Athens\]\]/gm) ], |
|||
b010: [ '[[Airija]]', new RegExp(/\[\[Ireland\]\]/gm) ], |
|||
b011: [ '[[Asirija]]', new RegExp(/\[\[Assyria\]\]/gm) ], |
|||
b012: [ '[[Babilonija]]', new RegExp(/\[\[Babylon\]\]/gm) ], |
|||
b013: [ '[[Elamas]]', new RegExp(/\[\[Elam\|Elamite Dynasties\]\]/gm) ], |
|||
b014: [ '[[Hetitai]]', new RegExp(/\[\[Hittites\]\]/gm) ], |
|||
b015: [ '[[Mitanija]]', new RegExp(/\[\[Mitanni\]\]/gm) ]*/ |
|||
}); |
|||
}; |
|||
var ivykiuTipai = { |
|||
'mirtis': 'Mirtis', |
|||
'gimimas': 'Gimtadienis', |
|||
'Atnaujinta': 'Atnaujinta', |
|||
'ivykis': 'Įvykis' |
|||
}; |
|||
function PrastinimasInList_tab() |
|||
{ |
|||
var isbot = false; |
|||
if (wgUserName == 'VP-bot') isbot = true; |
|||
if (wgUserName == 'Vpovilaitis') isbot = true; |
|||
for (i=0;i<wgUserGroups.length;i++){ |
|||
if (wgUserGroups[i] == 'sysop') isbot = true; |
|||
if (wgUserGroups[i] == 'bot') isbot = true; |
|||
} |
|||
if (!isbot) return false; |
|||
var toolbar = document.getElementById('pt-logout'); |
|||
if (!toolbar) return false; |
|||
var textbox = document.getElementById('mw-pages'); |
|||
var textbox2 = document.getElementById('bodyContent'); |
|||
if (!textbox && !textbox2) return false; |
|||
// Atsimink |
|||
var image = document.createElement("img"); |
|||
image.width = 16; |
|||
image.height = 16; |
|||
image.src = 'http://upload.wikimedia.org/wikipedia/commons/b/b5/Button_mini_stub.png'; |
|||
image.border = 0; |
|||
image.alt = 'Automatinis prastinimas'; |
|||
image.title = 'Automatinis prastinimas'; |
|||
image.style.cursor = "pointer"; |
|||
image.onclick = function() { |
|||
var n = document.URL.search(/\&vpaction\=/); |
|||
if (n >= 0){ |
|||
var kom = document.URL.substr(n+10); |
|||
n = kom.search(/\&/); |
|||
if (n >= 0) |
|||
kom = kom.substr(0,n); |
|||
var nword = document.URL.search(/\&word\=/); |
|||
var komword = ''; |
|||
if (nword >= 0){ |
|||
komword = document.URL.substr(nword+6); |
|||
nword = komword.search(/\&/); |
|||
if (nword >= 0) |
|||
komword = decodeURI(komword.substr(0,nword)).replace('+',' ').replace('\\%20',' ').replace('_',' '); |
|||
} |
|||
var nword2 = document.URL.search(/\&word2\=/); |
|||
var komword2 = ''; |
|||
if (nword2 >= 0){ |
|||
komword2 = document.URL.substr(nword2+7); |
|||
nword2 = komword2.search(/\&/); |
|||
if (nword2 >= 0) |
|||
komword2 = decodeURI(komword2.substr(0,nword2)).replace('+',' ').replace('\\%20',' ').replace('_',' '); |
|||
} |
|||
var nword3 = document.URL.search(/\&word3\=/); |
|||
var komword3 = ''; |
|||
if (nword3 >= 0){ |
|||
komword3 = document.URL.substr(nword3+7); |
|||
nword3 = komword3.search(/\&/); |
|||
if (nword3 >= 0) |
|||
komword3 = decodeURI(komword3.substr(0,nword3)).replace('+',' ').replace('\\%20',' ').replace('_',' '); |
|||
} |
|||
switch (kom) { |
|||
} |
|||
} |
|||
var toc=document.getElementById('mw-pages'); |
|||
var toc1=document.getElementById('mw-subcategories'); |
|||
if (toc || toc1) { |
|||
window.nahSettings['From'] = wgTitle; |
|||
var VPHTML = ""; |
|||
// text displayed from the beginning |
|||
VPHTML += "<div id=\"VPIntroLinks\"><div>" + |
|||
"<p>Puslapį /"+window.nahSettings['From']+ |
|||
"/<br>pervadinti į: <input type=\"text\" id=\"VPNameInput\"></p>" + |
|||
" <p><a href=\"javascript:VPSettings(1);\">Pervadinti.</a></p>" + |
|||
" <p><a href=\"javascript:VPSettings(2);\">Prastinti.</a></p>" + |
|||
" <p><a href=\"javascript:VPSettings(0);\">Išeiti.</a></p>" + |
|||
"</div></div>"; |
|||
var nahNahToolbar = document.createElement("div"); |
|||
nahNahToolbar.setAttribute("id", "nahToolbar"); |
|||
nahNahToolbar.innerHTML = VPHTML; |
|||
var VPToolbar = document.getElementById('contentSub') |
|||
VPToolbar.parentNode.insertBefore(nahNahToolbar, VPToolbar); |
|||
} |
|||
} |
|||
toolbar.appendChild(image); |
|||
} |
|||
function VPSettings(kom){ |
|||
switch (kom) { |
|||
case 0: document.getElementById("VPIntroLinks").style.display = "none"; |
|||
break; |
|||
case 1: window.nahSettings['To'] = document.getElementById("VPNameInput").value; |
|||
document.getElementById("VPIntroLinks").style.display = "none"; |
|||
var toc=document.getElementById('mw-pages'); |
|||
if (toc){ |
|||
var tocLinks=toc.getElementsByTagName('A'); |
|||
var tocLen = tocLinks.length; |
|||
var kk = 0; |
|||
for (j=0; j<tocLen/*, kk<50*/; ++j) { |
|||
//if (tocLinks[j].innerHTML.search(/\:/) == -1 ){ |
|||
var ww = window.open('http://lt.wikiquote.org/w/index.php?title='+tocLinks[j].innerHTML + |
|||
'&action=edit&redirect=no&vpaction=pervadintiKat', '','',false); |
|||
while (!ww.closed) {}; |
|||
kk++; |
|||
//} |
|||
} |
|||
} |
|||
toc=document.getElementById('mw-subcategories'); |
|||
if (toc){ |
|||
tocLinks=toc.getElementsByTagName('A'); |
|||
tocLen = tocLinks.length; |
|||
kk = 0; |
|||
for (j=0; j<tocLen/*, kk<50*/; ++j) { |
|||
//if (tocLinks[j].innerHTML.search(/\:/) == -1 ){ |
|||
var ww = window.open('http://lt.wikiquote.org/w/index.php?title=Kategorija:'+tocLinks[j].innerHTML + |
|||
'&action=edit&redirect=no&vpaction=pervadintiKat', '','',false); |
|||
while (!ww.closed) {}; |
|||
kk++; |
|||
//} |
|||
} |
|||
} |
|||
break; |
|||
case 2: window.nahSettings['To'] = document.getElementById("VPNameInput").value; |
|||
document.getElementById("VPIntroLinks").style.display = "none"; |
|||
var toc=document.getElementById('mw-pages'); |
|||
var tocLinks=toc.getElementsByTagName('A'); |
|||
var tocLen = tocLinks.length; |
|||
var kk = 0; |
|||
for (j=0; j<tocLen/*, kk<50*/; ++j) { |
|||
//if (tocLinks[j].innerHTML.search(/\:/) == -1 ){ |
|||
var ww = window.open('http://lt.wikiquote.org/w/index.php?title='+tocLinks[j].innerHTML + |
|||
'&action=edit&vpaction=Prastinti', '','',false); |
|||
while (!ww.closed) {}; |
|||
kk++; |
|||
//} |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
// Atsimink |
|||
addOnloadHook(PrastinimasInList_tab); |
|||
// Now set everything up |
|||
window.onload = Main; |
|||
function Main() |
|||
{ |
|||
var isbot = false; |
|||
if (wgUserName == 'VP-bot') isbot = true; |
|||
if (wgUserName == 'Vpovilaitis') isbot = true; |
|||
for (i=0;i<wgUserGroups.length;i++){ |
|||
if (wgUserGroups[i] == 'sysop') isbot = true; |
|||
if (wgUserGroups[i] == 'bot') isbot = true; |
|||
} |
|||
if (!isbot) return false; |
|||
window.nahPoSsInitText (); |
|||
window.PrastinimasInitText (); |
|||
//LivePreviewInstall(); |
|||
if (wgAction == "edit"){ |
|||
var n = document.URL.search(/\&vpaction\=/); |
|||
if (n >= 0){ |
|||
var kom = document.URL.substr(n+10); |
|||
n = kom.search(/\&/); |
|||
if (n >= 0) |
|||
kom = kom.substr(0,n); |
|||
var nword = document.URL.search(/\&word\=/); |
|||
var komword = ''; |
|||
if (nword >= 0){ |
|||
komword = document.URL.substr(nword+6); |
|||
nword = komword.search(/\&/); |
|||
if (nword >= 0) |
|||
komword = decodeURI(komword.substr(0,nword)).replace('+',' ').replace('\\%20',' ').replace('_',' '); |
|||
} |
|||
var nword2 = document.URL.search(/\&word2\=/); |
|||
var komword2 = ''; |
|||
if (nword2 >= 0){ |
|||
komword2 = document.URL.substr(nword2+7); |
|||
nword2 = komword2.search(/\&/); |
|||
if (nword2 >= 0) |
|||
komword2 = decodeURI(komword2.substr(0,nword2)).replace('+',' ').replace('\\%20',' ').replace('_',' '); |
|||
} |
|||
switch (kom) { |
|||
case 'Prastinti': |
|||
if (window.opener){ |
|||
var rez = document.editform.wpTextbox1.value+''; |
|||
if (rez != '') { |
|||
for (var key in prastinimasText){ |
|||
while (rez.search(prastinimasText[key][1]) != -1){ |
|||
//alert(key); |
|||
rez = rez.replace(prastinimasText[key][1], prastinimasText[key][0]); |
|||
isChange+= ', '+key; |
|||
} |
|||
} |
|||
document.editform.wpTextbox1.value = rez; |
|||
document.editform.wpSummary.value += '[[Naudotojas:'+wgUserName+'|' |
|||
+(isbot ? wgUserName : wgUserName.substr(0,2).toUpperCase()+'-Priemonė:')+']] '+isChange; |
|||
document.forms[0].submit(); |
|||
} |
|||
setTimeout("for (jj=0; jj<100; jj++) {};",10000); |
|||
window.close(); |
|||
} |
|||
break; |
|||
case 'pervadintiKat': |
|||
if (window.opener){ |
|||
var rez = document.editform.wpTextbox1.value+''; |
|||
//window.alert(window.opener.nahSettings['From']); |
|||
//window.alert(window.opener.nahSettings['To']); |
|||
var fro = window.opener.nahSettings['From'].replace(/\(/g, '\\(').replace(/\)/g, '\\)') |
|||
var tof = window.opener.nahSettings['To'] |
|||
if (rez != '' && ( |
|||
rez.search(new RegExp("\\[\\[Kategorija\\:"+fro+"(\\|[^\\]]*)?\\]\\]",'gm')) != -1 |
|||
|| rez.search(new RegExp("\\[\\[kategorija\\:"+fro+"(\\|[^\\]]*)?\\]\\]",'gm')) != -1 |
|||
|| rez.search(new RegExp("\\[\\[Category\\:"+fro+"(\\|[^\\]]*)?\\]\\]",'gm')) != -1 |
|||
|| rez.search(new RegExp("\\[\\[category\\:"+fro+"(\\|[^\\]]*)?\\]\\]",'gm')) != -1 |
|||
|| rez.search(new RegExp("\\[\\[Kategorija\\:"+fro.substr(0,1).toLowerCase()+fro.substr(1)+"(\\|[^\\]]*)?\\]\\]",'gm')) != -1 |
|||
|| rez.search(new RegExp("\\[\\[kategorija\\:"+fro.substr(0,1).toLowerCase()+fro.substr(1)+"(\\|[^\\]]*)?\\]\\]",'gm')) != -1 |
|||
|| rez.search(new RegExp("\\[\\[Category\\:"+fro.substr(0,1).toLowerCase()+fro.substr(1)+"(\\|[^\\]]*)?\\]\\]",'gm')) != -1 |
|||
|| rez.search(new RegExp("\\[\\[category\\:"+fro.substr(0,1).toLowerCase()+fro.substr(1)+"(\\|[^\\]]*)?\\]\\]",'gm')) != -1) ) { |
|||
rez = rez.replace(new RegExp("\\[\\[Kategorija\\:"+fro+"(\\|[^\\]]*)?\\]\\]",'gm'), |
|||
'['+'[Kategorija:'+tof+'$1]]'); |
|||
rez = rez.replace(new RegExp("\\[\\[kategorija\\:"+fro+"(\\|[^\\]]*)?\\]\\]",'gm'), |
|||
'['+'[Kategorija:'+tof+'$1]]'); |
|||
rez = rez.replace(new RegExp("\\[\\[Category\\:"+fro+"(\\|[^\\]]*)?\\]\\]",'gm'), |
|||
'['+'[Kategorija:'+tof+'$1]]'); |
|||
rez = rez.replace(new RegExp("\\[\\[category\\:"+fro+"(\\|[^\\]]*)?\\]\\]",'gm'), |
|||
'['+'[Kategorija:'+tof+'$1]]'); |
|||
rez = rez.replace(new RegExp("\\[\\[Kategorija\\:"+fro.substr(0,1).toLowerCase()+fro.substr(1)+"(\\|[^\\]]*)?\\]\\]",'gm'), |
|||
'['+'[Kategorija:'+tof+'$1]]'); |
|||
rez = rez.replace(new RegExp("\\[\\[kategorija\\:"+fro.substr(0,1).toLowerCase()+fro.substr(1)+"(\\|[^\\]]*)?\\]\\]",'gm'), |
|||
'['+'[Kategorija:'+tof+'$1]]'); |
|||
rez = rez.replace(new RegExp("\\[\\[Category\\:"+fro.substr(0,1).toLowerCase()+fro.substr(1)+"(\\|[^\\]]*)?\\]\\]",'gm'), |
|||
'['+'[Kategorija:'+tof+'$1]]'); |
|||
rez = rez.replace(new RegExp("\\[\\[category\\:"+fro.substr(0,1).toLowerCase()+fro.substr(1)+"(\\|[^\\]]*)?\\]\\]",'gm'), |
|||
'['+'[Kategorija:'+tof+'$1]]'); |
|||
document.editform.wpTextbox1.value = rez; |
|||
document.editform.wpSummary.value += '[[Naudotojas:'+wgUserName+'|' |
|||
+(isbot ? wgUserName : wgUserName.substr(0,2).toUpperCase()+'-bot:')+']] kategorijos pervadinimas'; |
|||
document.forms[0].submit(); |
|||
} |
|||
setTimeout("for (jj=0; jj<100; jj++) {};",10000); |
|||
window.close(); |
|||
} |
|||
break; |
|||
} |
|||
} |
|||
} |
|||
if (wgAction == "watch"){ |
|||
var n = document.URL.search(/\&vpaction\=/); |
|||
if (n >= 0){ |
|||
var kom = document.URL.substr(n+10); |
|||
n = kom.search(/\&/); |
|||
if (n >= 0) |
|||
kom = kom.substr(0,n); |
|||
switch (kom) { |
|||
case 'stebeti': |
|||
setTimeout("for (jj=0; jj<100; jj++) {};",10000); |
|||
window.close(); |
|||
if (window.opener){ |
|||
window.close(); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
} |