User:Troy 07/VoA Script.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Troy 07/VoA Script. |
/* The following script was imported from [[User:VoA/monobook.js]] (minus the UTC clock)
*/
//IMPORTS
importScript('User:Voice_of_All/Addtabs/monobook.js');
importScript('User:Voice_of_All/History/monobook.js');
importScript('User:Voice_of_All/CheckUser/monobook.js');
importScript('User:Lightdarkness/aiv.js');
//</nowiki></pre>
//<pre><nowiki>
function jssubmitclose()
{
var form = document.getElementById('editform');
form.submit();
}
//END
//Auto-replace
function oldautoreplacetxt(what,withw)
{
i = 1;
var original = document.editform.wpTextbox1.value;
if (what == ''){alert("Invalid command."); return;}
else if (what == 'null'){alert("Action cancelled."); return;}
else {
if (withw == ''){alert("All such appearances of text will be removed.");}
else if (withw.split(what)[1] != undefined) {alert("Action cancelled to avoid infinite loop."); return;}
else {
if (document.editform.wpTextbox1.value.split(what)[1] != undefined)
{
while (i == 1)
{
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(what, withw);
if (document.editform.wpTextbox1.value.indexOf(what) != -1)
{i = 1;}
else
{i = -1;}
}
}
//document.editform.wpSummary.value += 'JS: Replacing text "' + what + '" with "' + withw + '" ';
}
}
}
//END
function markminor()
{
var form = document.getElementById('bodyContent');
l = form.getElementsByTagName('input');
for (i = 0; i < l.length; i++)
{
if (l[i].name == 'wpMinoredit')
{l[i].value = '1'; l[i].checked=true;}
}
}
function jssubmit()
{
var form = document.getElementById('bodyContent');
l = form.getElementsByTagName('input');
for (i = 0; i < l.length; i++)
{
if (l[i].name == 'wpMinoredit')
{l[i].value = '1'; l[i].checked=true;}
}
var form = document.getElementById('editform');
form.submit();
}
addOnloadHook(CaseADD)
function CaseADD()
{
if (location.href.indexOf('&fakeaction=CaseADD&target=') != -1)
{
addTab("javascript:Alpha_userwait()", "(Add)", "ca-add", "Add", "");
alert('Add "[NEW]" to the proper alphabetical location and press (add).' + '\n' + 'The necessary spaces above and below will be added automatically.');
var name = unescape(location.href.split('&target=')[1].split('&badlist=')[0]);
document.editform.wpSummary.value += "Adding [[User:" + name + "]] case.";
var case_identifier = '[[Wikipedia:Requests for checkuser/Case/' + name;
if (document.editform.wpTextbox1.value.indexOf('|' + case_identifier) != -1)
{alert('A case for this user already exists, be sure to integrate them after pressing "(add)".');}
}
}
//
var Alpha_user_done = 0;
function Alpha_userwait()
{
if (Alpha_user_done == 1){alert('Already added.'); return;}
if (document.editform.wpTextbox1.value.indexOf('[NEW]') != -1){Alpha_user_done=1;}
var name = unescape(location.href.split('&target=')[1].split('&badlist=')[0]);
var thebadlist = unescape(location.href.split('&badlist=')[1].split('&')[0]);
var date = unescape(location.href.split('&date=')[1].split('&')[0]);
var case_identifier = '[[Wikipedia:Requests for checkuser/Case/' + name;
var txt = document.editform.wpTextbox1.value;
if (txt.indexOf('|' + case_identifier) != -1)
{
var num = txt.split('|' + case_identifier)[0];
num = num.split('rowspan=')[num.split('rowspan=').length-1];
var row_cur = '|rowspan=' + num + '|' + case_identifier;
document.editform.wpTextbox1.value = txt.replace(row_cur,'|' + case_identifier);
var to_add = '|-\n|' + date + '\n|' + thebadlist;
var case_sec = document.editform.wpTextbox1.value.split('|' + case_identifier)[1].split(/(\n|\r)(\n|\r)\|-(\n|\r)/)[0];
var cases = case_sec.split('|[[').length;
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(case_identifier,'rowspan=' + cases + '|' + case_identifier);
}
else
{
var to_add = "\n|-\n|[[Wikipedia:Requests for checkuser/Case/" + name + "|'''" + name + "''']]\n|" + date + "\n|" + thebadlist + "\n";
}
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace('[NEW]',to_add);
markminor();
}
addOnloadHook(CUmovedown)
function CUmovedown()
{
if (location.href.indexOf('&fakeaction=RFCUmoveC&target=') != -1)
{
var pagename = unescape(location.href.split('&target=')[1]);
var pagefind = "{{" + pagename + "}}";
var txt = document.editform.wpTextbox1.value;
if (txt.indexOf(pagefind) == -1)
{alert('Case "' + pagename + '" not found.'); return;}
if (txt.indexOf('==Completed requests==') == -1)
{alert('Page section format error.'); return;}
if (txt.split('==Completed requests==')[1].indexOf(pagename) !=-1)
{alert('Case already moved.'); return;}
if (txt.split('==Completed requests==')[1].split('<!-- completed subpages begin below this mark -->')[1] == undefined)
{alert('Page format error.'); return;}
var prereq = txt.split('==Completed requests==')[0];
var oldreq = txt.split('==Completed requests==')[1].split('<!-- completed subpages begin below this mark -->')[1];
oldreq = '==Completed requests==' + '\n' + '<!--put completed requests at the top of the list-->' + '\n' + '<!-- completed subpages begin below this mark -->' + '\n' + pagefind + '\n' + '----' + oldreq;
document.editform.wpTextbox1.value = prereq.replace('\n' + pagefind,'').replace(pagefind,'') + oldreq;
document.editform.wpSummary.value = "Moving [[User:" + pagename.split('/Case/')[1] + "|" + pagename.split('/Case/')[1] + "]] case to completed.";
alert('Case "' + pagename + '" found and moved to fulfilled section.');
markminor();
oldautoreplacetxt('----\n----','----');
oldautoreplacetxt('---- \n----','----');
}
else if (location.href.indexOf('&fakeaction=RFCUmoveD&target=') != -1)
{
var pagename = unescape(location.href.split('&target=')[1]);
var pagefind = "{{" + pagename + "}}";
var txt = document.editform.wpTextbox1.value;
if (txt.indexOf(pagefind) == -1)
{alert('Case "' + pagename + '" not found.'); return;}
if (txt.indexOf('==Declined requests==') == -1)
{alert('Page section format error.'); return;}
if (txt.split('==Declined requests==')[1].indexOf(pagename) != -1){alert('Case already moved.'); return;}
if (txt.split('==Completed requests==')[0].split('==Declined requests==')[1].split('<!--declined subpages begin below this mark -->')[1] == undefined)
{alert('Page format error.'); return;}
var prereq = txt.split('==Declined requests==')[0];
var oldreq = txt.split('==Declined requests==')[1].split('<!--declined subpages begin below this mark -->')[1].split('==Completed requests==')[0];
oldreq += '==Completed requests==' + txt.split('==Completed requests==')[1];
oldreq = '==Declined requests==' + '\n' + '<!--put declined requests at the top of the list-->' + '\n' + '<!--declined subpages begin below this mark -->' + '\n' + pagefind + '\n' + '----' + oldreq;
document.editform.wpTextbox1.value = prereq.replace('\n' + pagefind,'').replace(pagefind,'') + oldreq;
document.editform.wpSummary.value = "Moving [[User:" + pagename.split('/Case/')[1] + "|" + pagename.split('/Case/')[1] + "]] case to completed.";
alert('Case "' + pagename + '" found and moved to denied section.');
markminor();
oldautoreplacetxt('----\n----','----');
oldautoreplacetxt('---- \n----','----');
//jssubmit();
}
else if (location.href.indexOf('&fakeaction=RFCUdel&target=') != -1)
{
var pagename = unescape(location.href.split('&target=')[1]);
var pagefind = "{{" + pagename + "}}";
var txt = document.editform.wpTextbox1.value;
if (txt.indexOf('==Declined requests==') == -1)
{alert('Page section format error.'); return;}
if (txt.split('==Declined requests==')[1].indexOf(pagefind) == -1)
{alert('Case "' + pagename + '" not found.'); return;}
document.editform.wpTextbox1.value = txt.replace('\n' + pagefind,'').replace('\n' + pagefind,'').replace(pagefind,'');
document.editform.wpSummary.value = "Archiving case for [[User:" + pagename.split('/Case/')[1] + "|" + pagename.split('/Case/')[1] + "]].";
alert('Case "' + pagename + '" found and removed from the fulfilled/denied section.');
markminor();
oldautoreplacetxt('----\n----','----');
oldautoreplacetxt('---- \n----','----');
}
}
addOnloadHook(CUlinks)
function CUlinks()
{
if(document.title.indexOf("Wikipedia:Requests for checkuser/Case/") == 0)
{
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, 'complete', 'carchfunc');
var carchfunc = document.getElementById('carchfunc').getElementsByTagName('ul')[0];
addlilink(carchfunc, 'javascript:CUdonearch(1)', 'done', '');
addlilink(carchfunc, 'javascript:CUdonearch(2)', 'rej.', '');
}
if(document.title.indexOf("Editing Wikipedia:Requests for checkuser/Case/") == 0 || document.title.indexOf("Editing Wikipedia:Requests for checkuser/IP check") == 0)
{
var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0];
addlimenu(tabs, 'Message', 'cclosefunc');
var cclosefunc = document.getElementById('cclosefunc').getElementsByTagName('ul')[0];
//Checkuser functions
addlilink(cclosefunc, 'javascript:CUdone(1)', 'conf', '');
addlilink(cclosefunc, 'javascript:CUdone(2)', 'prob', '');
addlilink(cclosefunc, 'javascript:CUdone(3)', 'poss', '');
addlilink(cclosefunc, 'javascript:CUdone(4)', 'incon', '');
addlilink(cclosefunc, 'javascript:CUdone(5)', 'unlik', '');
addlilink(cclosefunc, 'javascript:CUdone(6)', 'unrel', '');
addlilink(cclosefunc, 'javascript:CUdone(7)', 'decl', '');
addlilink(cclosefunc, 'javascript:CUdone(8)', 'info', '');
addlilink(cclosefunc, 'javascript:CUdone(9)', 'note', '');
addlilink(cclosefunc, 'javascript:CUdone(10)', 'fish', '');
addlilink(cclosefunc, 'javascript:CUdone(11)', 'creq', '');
addlilink(cclosefunc, 'javascript:CUdone(12)', 'cnote', '');
addlilink(cclosefunc, 'javascript:CUdone(13)', 'block', '');
addlilink(cclosefunc, 'javascript:CUdone(14)', 'orb', '');
addlilink(cclosefunc, 'javascript:CUdone(15)', 'unnes', '');
addlilink(cclosefunc, 'javascript:CUdone(16)', 'stale', '');
if (document.title.indexOf("(section)") != -1)
{
//Checkuser functions
addlimenu(tabs, 'complete', 'carchfunc');
var carchfunc = document.getElementById('carchfunc').getElementsByTagName('ul')[0];
addlilink(carchfunc, 'javascript:CUdonearch(1)', 'done', '');
addlilink(carchfunc, 'javascript:CUdonearch(2)', 'rej.', '');
addlilink(carchfunc, 'javascript:CUdonearch(3)', 'arch', '');
}
}
}
function CUdonearch(num)
{
if (num != 3 && document.getElementById('bodyContent').innerHTML.search('The following discussion is preserved as an archive') != -1)
if (num == 3 && document.editform.wpTextbox1.value.search('The following discussion is preserved as an archive') != -1)
{alert('Case already closed'); return;}
var username = document.title.replace('Editing ','').split(' (section)')[0].split(' - ')[0];
if (num==1)
{
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Requests_for_checkuser&action=edit&fakeaction=RFCUmoveC&target=' + escape(username),
'targetnameRFCUmov',
'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
}
else if (num==2)
{
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Requests_for_checkuser&action=edit&fakeaction=RFCUmoveD&target=' + escape(username),
'targetnameRFCUmov',
'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
}
else if (num==3)
{
var username = document.title.replace('Editing ','').split(' (section)')[0].split(' - ')[0];
var user_name = document.title.split(' (section)')[0].split(' - ')[0].split('/Case/')[1];
var offset=0;
var badlist = '';
var badlist_show = '';
var txt = document.editform.wpTextbox1.value.split('<noinclude>')[0];
if (txt.indexOf("{{subst:Rfcub}}") !=-1 || txt.indexOf("{{subst:Rfcua}}") !=-1)
{alert('Case already closed!'); return;}
oldautoreplacetxt('{{Checkuser|','{{checkuser|');
oldautoreplacetxt('{{Checkip|','{{checkip|');
oldautoreplacetxt('{{Vandal|','{{vandal|');
if (txt.indexOf('{{checkuser|') != -1)
{
if (badlist != '') badlist+=', ';
var l = txt.split('{{checkuser|');
for (var i=1; i< l.length; i++)
{
name = l[i].split('}}')[0];
if (name != user_name && badlist.indexOf(name) ==-1)
{
badlist_show += name + '\n';
badlist+=name;
if (i != l.length-1)badlist+=', ';
}
}
}
if (txt.indexOf('{{vandal|') != -1)
{
if (badlist != '') badlist+=', ';
var l = txt.split('{{vandal|');
for (var i=1; i< l.length; i++)
{
name = l[i].split('}}')[0];
if (name != user_name && badlist.indexOf(name) ==-1)
{
badlist_show += name + '\n';
badlist+=name;
if (i != l.length-1) badlist+=', ';
}
}
}
if (txt.indexOf('{{checkip|') != -1)
{
if (badlist != '') badlist+=', ';
var l = txt.split('{{checkip|');
for (var i=1; i< l.length; i++)
{
name = l[i].split('}}')[0];
badlist_show += name + '\n';
badlist+=name;
if (i != l.length-1) badlist+=', ';
}
}
alert('Possible user and IP socks:' + '\n' + badlist_show);
if (document.editform.wpTextbox1.value.indexOf("<noinclude>") != -1)
{
var splitbefore = document.editform.wpTextbox1.value.split("<noinclude>")[0];
document.editform.wpTextbox1.value = "{{subst:Rfcua}}" + "\n" + splitbefore + "\n" + "{{subst:Rfcub}}" + "\n" + document.editform.wpTextbox1.value.split(splitbefore)[1];
}
else
{
document.editform.wpTextbox1.value = "{{subst:Rfcua}}" + "\n" + document.editform.wpTextbox1.value + "\n" + "{{subst:Rfcub}}";
}
document.editform.wpSummary.value = "Closing case.";
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Requests_for_checkuser&action=edit&fakeaction=RFCUdel&target=' + escape(username),'targetnameRFCUdel','location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var name = username.split('/Case/')[1];
var letter = name.substring(0,1).toLowerCase();
var sec=0;
var secoffset=1;
if (letter == 'a'){sec=1;}
else if (letter == 'b'){sec=2;}
else if (letter == 'c'){sec=3;}
else if (letter == 'd'){sec=4;}
else if (letter == 'e'){sec=5;}
else if (letter == 'f'){sec=6;}
else if (letter == 'g'){sec=7;}
else if (letter == 'h'){sec=8;}
else if (letter == 'i'){sec=9;}
else if (letter == 'j'){sec=10;}
else if (letter == 'k'){sec=11;}
else if (letter == 'l'){sec=12;}
else if (letter == 'm'){sec=13;}
else if (letter == 'n'){sec=14;}
else if (letter == 'o'){sec=15;}
else if (letter == 'p'){sec=16;}
else if (letter == 'q'){sec=17;}
else if (letter == 'r'){sec=18;}
else if (letter == 's'){sec=19;}
else if (letter == 't'){sec=20;}
else if (letter == 'u'){sec=21;}
else if (letter == 'v'){sec=22;}
else if (letter == 'w'){sec=23;}
else if (letter == 'x'){sec=24;}
else if (letter == 'y'){sec=25;}
else if (letter == 'z'){sec=26;}
else {sec=0;}
sec+=secoffset;
var date = ''
if (document.editform.wpTextbox1.value.search(/\d\d:\d\d, \d{1,2} \w+ \d\d\d\d/i) !=-1)
{
var txt = document.editform.wpTextbox1.value;
var l_ind = txt.match(/\d\d:\d\d, \d{1,2} \w+ \d\d\d\d/i).length -1 ;
var date = txt.match(/\d\d:\d\d, \d{1,2} \w+ \d\d\d\d/i)[l_ind];
var day = date.split(', ')[1].split(' ')[0];
if (day.length == 1) day = '0' + day;
var month = date.split(', ')[1].split(' ')[1].split(' ')[0];
if (month.search(/January/i) == 0) month = '01';
if (month.search(/February/i) == 0) month = '02';
if (month.search(/March/i) == 0) month = '03';
if (month.search(/April/i) == 0) month = '04';
if (month.search(/May/i) == 0) month = '05';
if (month.search(/June/i) == 0) month = '06';
if (month.search(/July/i) == 0) month = '07';
if (month.search(/August/i) == 0) month = '08';
if (month.search(/September/i) == 0) month = '09';
if (month.search(/October/i) == 0) month = '10';
if (month.search(/November/i) == 0) month = '11';
if (month.search(/December/i) == 0) month = '12';
var year = date.match(/\d\d\d\d/)[0];
var date = '[[' + year + '-' + month + '-' + day + ']]';
}
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:Requests_for_checkuser/Case&action=edit§ion=' + sec + '&fakeaction=CaseADD&target=' + escape(name) + '&badlist=' + escape(badlist) + '&date=' + escape(date),
'targetnameCaseADD',
'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
//jssubmit();
}
}
//
CUdonealready = 0;
//
function CUdone(type)
{
var z = 0;
document.editform.wpTextbox1.value.replace('<noinclude>{{Wikipedia:Requests for checkuser/Inputbox/Sample/Tag}}</noinclude>','');
if (type == 1)
{
CUdonealready=1;
document.editform.wpSummary.value += "Confirmed.";
var txt_add = "{{Confirmed}}. ~~~~";
}
else if (type == 2)
{
CUdonealready=1;
var txt_add = "{{Likely}}. ~~~~";
document.editform.wpSummary.value += "Likely.";
}
else if (type == 3)
{
CUdonealready=1;
var txt_add = "{{Possible}}. ~~~~";
document.editform.wpSummary.value += "Possible.";
}
else if (type == 4)
{
CUdonealready=1;
var txt_add = "{{Inconclusive}}. ~~~~";
document.editform.wpSummary.value += "Inconclusive.";
}
else if (type == 5)
{
CUdonealready=1;
var txt_add = "{{unlikely}} ~~~~";
document.editform.wpSummary.value += "Unlikely.";
}
else if (type == 6)
{
CUdonealready=1;
var txt_add = "{{Unrelated}}. ~~~~";
document.editform.wpSummary.value += "Unrelated.";
}
else if (type == 7)
{
CUdonealready=1;
var txt_add = "{{Declined}}. ~~~~";
document.editform.wpSummary.value += "Declined.";
}
else if (type == 8)
{
CUdonealready=1;
var txt_add = "{{MoreInfo}}. ~~~~";
document.editform.wpSummary.value += "More information required.";
}
else if (type == 9)
{
CUdonealready=1;
var txt_add = "{{TakeNote}} ~~~~";
document.editform.wpSummary.value += "Note.";
}
else if (type == 10)
{
CUdonealready=1;
var txt_add = "{{Fishing}} ~~~~";
document.editform.wpSummary.value += "No fishing.";
}
else if (type == 11)
{
CUdonealready=1;
var txt_add = "{{clerk request}}NULL. ~~~~";
document.editform.wpSummary.value += "Clerk attention required.";
}
else if (type == 12)
{
CUdonealready=1;
var txt_add = "{{clerknote}}NULL. ~~~~";
document.editform.wpSummary.value += "Clerk note.";
}
else if (type == 13)
{
CUdonealready=1;
var txt_add = "{{IPblock}} ~~~~";
document.editform.wpSummary.value += "IP blocked.";
}
else if (type == 14)
{
CUdonealready=1;
var txt_add = "{{crystalball}} ~~~~";
document.editform.wpSummary.value += "Not a crystal ball.";
}
else if (type == 15)
{
CUdonealready=1;
var txt_add = "{{unnecessary}} ~~~~";
document.editform.wpSummary.value += "Unnecessary.";
}
else if (type == 16)
{
CUdonealready=1;
var txt_add = "{{staleIP}} ~~~~";
document.editform.wpSummary.value += "Stale.";
}
if( document.editform.wpTextbox1.value.indexOf('<!-- BEGIN ARCHIVE TEMPLATE -->') !=-1)
{
var before = document.editform.wpTextbox1.value.split('<!-- BEGIN ARCHIVE TEMPLATE -->')[0];
var after = document.editform.wpTextbox1.value.split(before)[1];
document.editform.wpTextbox1.value = before + "\n" + txt_add + "\n" + after;
}
else if( document.editform.wpTextbox1.value.indexOf('<noinclude>') !=-1)
{
var before = document.editform.wpTextbox1.value.split('<noinclude>')[0];
var after = document.editform.wpTextbox1.value.split(before)[1];
document.editform.wpTextbox1.value = before + "\n" + txt_add + "\n" + after;
}
else
{document.editform.wpTextbox1.value += "\n" + txt_add;}
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace('<!--Please do not remove the following tag until this case has been listed on RFCU. -->','');
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace('<noinclude>{{Wikipedia:Requests for checkuser/Inputbox/Sample/Tag}}</noinclude>','');
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(/\n\n\n/g,'\n\n');
}
////////CLIENT SIDE CHECKUSER IP info retriever/////////////
//security override HTTP request
//ALSO, reduce IE security settings
//For FF/NS, go enable, see "http://esw.w3.org/topic/SparqlCalendarDemoUsage#FAQ"
//Basically, enable "signed.applets.codebase_principal_support" in about:config
if(wgCanonicalSpecialPageName == 'Contributions') {
addOnloadHook(prefixContribsInit);
var prefixlimit = 500;
var frm = ''; //global
}
addOnloadHook(WHOIScheck)
function WHOIScheck()
{
if (location.href.indexOf('Special:Contributions') ==-1) return;
var body=document.getElementById('bodyContent');
if (!body) return;
addTab("javascript:CU_comprehensive()", "WHOIS all IPs", "ca-checkall", "Check all IPs", "");
}
//
function makeCURequestXML_DNS(type, url, parameters)
{
if(window.XMLHttpRequest)
{
try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); }
catch (e) {alert("Permission UniversalBrowserRead denied. Please enable 'signed.applets.codebase_principle_support' through 'about:config' in your browser."); }
http_request = false;
http_request = new XMLHttpRequest();
if (!http_request)
{alert('Cannot create XMLHTTP instance'); return false;}
http_request.onreadystatechange = CU_comprehensive_check_WHOIS;
http_request.open(type, url, true);
http_request.send(parameters);
}
else if (window.ActiveXObject)
{
try
{http_request = new ActiveXObject("Msxml2.XMLHTTP");}
catch (e)
{
try
{http_request = new ActiveXObject("Microsoft.XMLHTTP");}
catch (e){}
}
if (!http_request) {showError(ERROR_XML);}
http_request.onreadystatechange = CU_comprehensive_check_WHOIS;
http_request.open(type, url, true);
http_request.send(parameters);
}
}
//
//
function makeCURequestXML_WHOIS(type, url, parameters)
{
if(window.XMLHttpRequest)
{
try {netscape.security.PrivilegeManager.enablePrivilege("UniversalBrowserRead"); }
catch (e) {alert("Permission UniversalBrowserRead denied. Please enable 'signed.applets.codebase_principle_support' through 'about:config' in your browser."); }
http_request = false;
http_request = new XMLHttpRequest();
if (!http_request)
{alert('Cannot create XMLHTTP instance'); return false;}
http_request.onreadystatechange = CU_comprehensive_check_parse;
http_request.open(type, url, true);
http_request.send(parameters);
}
else if (window.ActiveXObject)
{
try
{http_request = new ActiveXObject("Msxml2.XMLHTTP");}
catch (e)
{
try
{http_request = new ActiveXObject("Microsoft.XMLHTTP");}
catch (e){}
}
if (!http_request) {showError(ERROR_XML);}
http_request.onreadystatechange = CU_comprehensive_check_parse;
http_request.open(type, url, true);
http_request.send(parameters);
}
}
//
//IP/WHOIS for CU principle results//
CU_li_index = 0;
CU_li_ip_list = '|';
function CU_comprehensive()
{
var results = document.getElementById('checkuserresults');
if( !results )
{alert("No checkuser results");}
var ul = results.getElementsByTagName('ul')[0];
if (!ul)
{alert('There is no IP list.'); return;}
if (!ul.getElementsByTagName('li')[0])
{alert('There are no elements in this list.'); return;}
var ls = ul.getElementsByTagName('li');
if (!ls[0].getElementsByTagName('a')[0])
{alert('There are no expected elements in this list.'); return;}
if (document.getElementById('contentSub').innerHTML.search(/Checking all IPs, please wait...|All data retrieved:/) != -1)
{alert('Results already shown.'); return;}
document.getElementById('contentSub').innerHTML += '<br>Checking all IPs, please wait...';
CU_comprehensive_check();
}
function CU_comprehensive_check()
{
var list = document.getElementById('checkuserresults').getElementsByTagName('ul')[0];
if (list.getElementsByTagName('li')[CU_li_index] && list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0])
{
var link = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].href;
var name = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].innerHTML;
// Must be an IP address, and one that we didn't already do
if (name.search(/^(\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}|:(:[0-9A-Fa-f]{1,4}){1,7}|[0-9A-Fa-f]{1,4}(:{1,2}[0-9A-Fa-f]{1,4}|::$){1,7})$/) !=-1 && CU_li_ip_list.indexOf('|' + name + '|') ==-1)
{
var URL = 'http://www.dnsstuff.com/tools/ipall.ch?domain=' + name;
CU_li_ip_list += name + '|';
CU_comprehensive_check_DNS(URL);
}
else
{CU_li_index+=1; CU_comprehensive_check();}
}
else if (list.getElementsByTagName('li')[CU_li_index])
{CU_li_index+=1; CU_comprehensive_check();}
else
{
document.getElementById('contentSub').innerHTML = '<br><strong><span style="color:darkblue;">All data retrieved:</span> DNS/WHOIS scan completed.</strong>';
}
}
function CU_comprehensive_check_DNS(URL)
{
var list = document.getElementById('checkuserresults').getElementsByTagName('ul')[0];
var name = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].innerHTML;
document.getElementById('contentSub').innerHTML = '<br><strong>Retrieving DNS XML page data for ' + name + '...</strong>';
makeCURequestXML_DNS("GET",URL,null);
}
function CU_comprehensive_check_WHOIS()
{
if (http_request.readyState != 4) return;
xml_DNS_user_CU = http_request.responseText;
var list = document.getElementById('checkuserresults').getElementsByTagName('ul')[0];
var name = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].innerHTML;
var URL = 'http://www.dnsstuff.com/tools/whois.ch?ip=' + name;
document.getElementById('contentSub').innerHTML = '<br><strong>Retrieving WHOIS XML page data for ' + name + '...</strong>';
makeCURequestXML_WHOIS("GET",URL,null);
}
function CU_comprehensive_check_parse()
{
if (http_request.readyState != 4) return;
xml_WHOIS_CU = http_request.responseText;
var list = document.getElementById('checkuserresults').getElementsByTagName('ul')[0];
var name = list.getElementsByTagName('li')[CU_li_index].getElementsByTagName('a')[0].innerHTML;
document.getElementById('contentSub').innerHTML = '<br><strong>Parsing WHOIS XML page data for ' + name + '...</strong>';
//WHOIS
//parse WHOIS results
var OrgName='';
var Address='';
var City='';
var StateProv='';
var Country='';
var CIDR='';
var Location='';
// A data chunk may appear at the top
// Get user location
if( xml_WHOIS_CU.indexOf('Location:') !=-1)
{Location += xml_WHOIS_CU.split('Location:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ']';}
// Focus...
if (xml_WHOIS_CU.indexOf('<TR><TD><PRE>') !=-1)
{xml_WHOIS_CU = http_request.responseText.split('<TR><TD><PRE>')[1];}
xml_WHOIS_CU = xml_WHOIS_CU.split('</PRE></TD></TR>')[0].split('<PRE><BR>')[0];
// Get name
if (xml_WHOIS_CU.indexOf('OrgName:') !=-1)
{OrgName += xml_WHOIS_CU.split('OrgName:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';}
else if (xml_WHOIS_CU.indexOf('org-name:') !=-1)
{OrgName += xml_WHOIS_CU.split('org-name:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';}
else if (xml_WHOIS_CU.indexOf('organisation:') !=-1)
{OrgName += xml_WHOIS_CU.split('organisation:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';}
// Get address
if (xml_WHOIS_CU.indexOf('Address:') !=-1)
{Address += xml_WHOIS_CU.split('Address:')[1].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';}
var address_lines = xml_WHOIS_CU.split('address:');
if (address_lines[1])
{Address += address_lines[1].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';}
if (address_lines[2])
{Address += address_lines[2].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';}
if (address_lines[3])
{Address += address_lines[3].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';}
if (address_lines[4])
{Address += address_lines[4].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';}
if (address_lines[5])
{Address += address_lines[5].split(/[\n\r]\w+:/)[0].split(']')[0] + ', ';}
// Get city
if ( City=='' && xml_WHOIS_CU.indexOf('city:') !=-1)
{City += '<u>' + xml_WHOIS_CU.split('city:')[1].split('\n')[0].split('\r')[0].split(']')[0] + '</u>' + ', ';}
// Get state
if (xml_WHOIS_CU.indexOf('StateProv:') !=-1)
{StateProv += xml_WHOIS_CU.split('StateProv:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';}
else if (xml_WHOIS_CU.indexOf('stateprov:') !=-1)
{StateProv += xml_WHOIS_CU.split('stateprov:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';}
// Get country
if ( Country=='' && xml_WHOIS_CU.indexOf('Country:') !=-1)
{Country += xml_WHOIS_CU.split('Country:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';}
else if ( Country=='' && xml_WHOIS_CU.indexOf('country:') !=-1)
{Country += xml_WHOIS_CU.split('country:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';}
// Get CIDR
if (xml_WHOIS_CU.indexOf('CIDR:') !=-1)
{CIDR = xml_WHOIS_CU.split('CIDR:')[1].split('\n')[0].split('\r')[0].split(']')[0];}
else if (xml_WHOIS_CU.indexOf('route:') !=-1)
{CIDR = xml_WHOIS_CU.split('route:')[1].split('\n')[0].split('\r')[0].split(']')[0];}
else if (xml_WHOIS_CU.indexOf('inetnum:') !=-1)
{CIDR = xml_WHOIS_CU.split('inetnum:')[1].split('\n')[0].split('\r')[0].split(']')[0];}
// join them
var output_IP_info = '<strong>' + OrgName + '</strong>' + Address + City + '<strong>' + StateProv + '</strong>' + '<i>' + Country + '</i>';
// add CIDR
if (CIDR !='')
output_IP_info += '<br/><span style="color:darkred;">CIDR:</span>' + CIDR;
// Parse DNS items
document.getElementById('contentSub').innerHTML = '<br><strong>Parsing DNS XML page data for ' + name + '...</strong>';
if (xml_DNS_user_CU.indexOf('<PRE>') != -1)
{xml_DNS_user_CU = xml_DNS_user_CU.split('<PRE>')[1].split('</PRE>')[0];}
var rev_DNS_info = '';
if (xml_DNS_user_CU.indexOf('Reverse DNS:') !=-1)
{rev_DNS_info = '<strong>' + xml_DNS_user_CU.split('Reverse DNS:')[1].split('\n')[0].split('\r')[0] + '</strong>';}
output_IP_info += ' <span style="color:darkred;">RDNS</span>:' + rev_DNS_info;
output_IP_info = output_IP_info.replace(/Internet Assigned Numbers Authority/,'IANA');
// Add location
if (Location !='')
output_IP_info += '<br/><span style="color:darkred;">Location:</span>' + Location;
link = '<a href="http://www.dnsstuff.com/tools/whois.ch?%26ip%3D' + name + '">(Full)</a> ';
list.getElementsByTagName('li')[CU_li_index].innerHTML += '<div style="background-color: #f9f9f9; border: 1px solid #8888aa; padding: 3px;">' + link + output_IP_info + '</div>';
//
CU_li_index += 1;
CU_comprehensive_check();
}
//////////////
//</nowiki></pre>
//<pre><nowiki>
// ============= test-n.js ==============
function tnaddlilink(url, name)
{
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);
return li;
}
function testn(number)
{
var IPnote = '';
if (document.title.split(' - ')[0].split('.').length == 4)
{IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
var varticle = '';
if (location.href.indexOf('&vanarticle=') != -1)
{varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value +="====" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] ([[UTC]])" + varticle + "====" + "\n" + "{{subst:" + "test" + number + "}} " + IPnote + "~" + "~" + "~" + "~";
f.wpSummary.value = "User notice:" + " test" + number;
}
function warningn()
{
var IPnote = '';
if (document.title.split(' - ')[0].split('.').length == 4)
{IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
var varticle = '';
if (location.href.indexOf('&vanarticle=') != -1)
{varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value +="====" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] ([[UTC]])" + varticle + "====" + "\n" + "{{subst:" + "bv" + "}} " + IPnote + "~" + "~" + "~" + "~";
f.wpSummary.value = "User notice:" + " bv";
}
function testbl(number)
{
var IPnote = '';
if (document.title.split(' - ')[0].split('.').length == 4)
{IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
var varticle = '';
if (location.href.indexOf('&vanarticle=') != -1)
{varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value +="====" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] ([[UTC]])" + varticle + "====" + "\n" + "{{subst:" + "Blank" + number + "}} " + IPnote + "~" + "~" + "~" + "~";
f.wpSummary.value = "User notice:" + " Blank" + number;
}
function spam()
{
var IPnote = '';
if (document.title.split(' - ')[0].split('.').length == 4)
{IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
var varticle = '';
if (location.href.indexOf('&vanarticle=') != -1)
{varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value +="====" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] ([[UTC]])" + varticle + "====" + "\n" + "{{subst:" + "spam}} " + IPnote + "~" + "~" + "~" + "~";
f.wpSummary.value = "User notice:" + " spam";
}
function spamn(number)
{
var IPnote = '';
if (document.title.split(' - ')[0].split('.').length == 4)
{IPnote = "''If this is an [[IP address]], and it is shared by multiple users, ignore this warning if you did not make any [[Wikipedia:vandalism|unconstructive]] edits.'' ";}
var varticle = '';
if (location.href.indexOf('&vanarticle=') != -1)
{varticle = ' to [[' + unescape(location.href.split('&vanarticle=')[1].split('&')[0].replace(/(Image|Category):/i,':$1:')) + ']]';}
var f = document.editform, t = f.wpTextbox1;
if (t.value.length > 0)
t.value += '\n';
t.value +="====" + "Regarding edits made during [[{{subst:CURRENTMONTHNAME}} {{subst:CURRENTDAY}}]] [[{{subst:CURRENTYEAR}}]] ([[UTC]])" + varticle + "====" + "\n" + "{{subst:" + "spam" + number + "}} " + IPnote + "~" + "~" + "~" + "~";
f.wpSummary.value = "User notice:" + " spam" + number;
}
//Quick warning tabs
addOnloadHook(add_testn_tabs);
function add_testn_tabs()
{
var c1 = document.getElementById('column-one');
var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];
if (document.title.indexOf("Editing User talk:") != -1)
{
tabs.appendChild(tnaddlilink('javascript:testn(1)',"t"));
tabs.appendChild(tnaddlilink('javascript:testn(2)',"t2"));
tabs.appendChild(tnaddlilink('javascript:testn(3)',"t3"));
tabs.appendChild(tnaddlilink('javascript:testn(4)',"t4"));
tabs.appendChild(tnaddlilink('javascript:warningn(1)',"bv"));
tabs.appendChild(tnaddlilink('javascript:testbl(1)',"b"));
tabs.appendChild(tnaddlilink('javascript:testbl(2)',"b2"));
tabs.appendChild(tnaddlilink('javascript:testbl(3)',"b3"));
tabs.appendChild(tnaddlilink('javascript:testbl(4)',"b4"));
tabs.appendChild(tnaddlilink('javascript:spam()',"s"));
tabs.appendChild(tnaddlilink('javascript:spamn(2)',"s2"));
if(document.getElementById('ca-delete'))
{
document.getElementById('ca-delete').firstChild.innerHTML = '[d]';
}
if(document.getElementById('ca-move'))
{
document.getElementById('ca-move').firstChild.innerHTML = '[m]';
}
if(document.getElementById('ca-watch'))
{
document.getElementById('ca-watch').firstChild.innerHTML = '[w]';
}
if(document.getElementById('ca-unwatch'))
{
document.getElementById('ca-unwatch').firstChild.innerHTML = '[uw]';
}
if(document.getElementById('ca-edit'))
{
document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
}
if(document.getElementById('ca-talk'))
{
document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';
}
if(document.getElementById('ca-protect'))
{
document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
}
if(document.getElementById('ca-unprotect'))
{
document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
}
}
}
//</nowiki></pre>
//<pre><nowiki>
//Please leave the following line
//[[user:Where/easy db]]
//Start db script
//modded by VoA
addOnloadHook(function()
{
//check if called from deletion request
if (document.title.indexOf("Editing ") != -1 && wgNamespaceNumber !=-1)
{
if (document.URL.lastIndexOf("&fakeaction=huff") == -1)
return;
if (document.URL.lastIndexOf("&reason=off") != -1)
{
var type = prompt("Enter criteria for speedy deletion, e.g. A1, G3");
var f = document.editform, t = f.wpTextbox1;
t.value = "{{db-" + type.toLowerCase() + "}}\n" + t.value;
f.wpSummary.value = "JS: Requesting speedy deletion ([[WP:CSD#" + type + "|CSD " + type + "]])";
f.wpSave.click();
return;
}
else if (document.URL.lastIndexOf("&reason=on") != -1)
{
var type = prompt("Enter reason for speedy deletion");
var f = document.editform, t = f.wpTextbox1;
t.value = "{{db|" + type + "}}\n" + t.value;
f.wpSummary.value = "JS: Requesting speedy deletion";
f.wpSave.click();
return;
}
}
if (window.location.href.search(/Special:|&action=/) != -1)
return;
addTab("javascript:easyDb(0)", "db (csd)", "ca-db0", "Request speedy deletion according to WP:CSD", "");
addTab("javascript:easyDb(1)", "db (reason)", "ca-db0", "Request speedy deletion with reason", "");
});
function easyDb(n)
{
if (n == 0)
{
//edit page
var title = document.title.substr(0, document.title.lastIndexOf(' - Wikipedia, the free'));
location.assign("/w/index.php?title=" + title + "&action=edit&fakeaction=huff&reason=off");
}
if (n == 1)
{
//edit page
var title = document.title.substr(0, document.title.lastIndexOf(' - Wikipedia, the free'));
location.assign("/w/index.php?title=" + title + "&action=edit&fakeaction=huff&reason=on");
}
}
// </nowiki></pre>