User:Voice of All/CheckUser/monobook.js

//Attention, unless you are the script author (Voice of All) or a CheckUser, you should NOT be editing this unless it is clear, clean cut, obvious fix. Thanks.

//

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|" + 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('')[1] == undefined)

{alert('Page format error.'); return;}

var prereq = txt.split('==Completed requests==')[0];

var oldreq = txt.split('==Completed requests==')[1].split('')[1];

oldreq = '==Completed requests==' + '\n' + '' + '\n' + '' + '\n' + pagefind + '\n' + '----' + oldreq;

document.editform.wpTextbox1.value = prereq.replace('\n' + pagefind,).replace(pagefind,) + oldreq;

document.editform.wpSummary.value = "Moving " + 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('')[1] == undefined)

{alert('Page format error.'); return;}

var prereq = txt.split('==Declined requests==')[0];

var oldreq = txt.split('==Declined requests==')[1].split('')[1].split('==Completed requests==')[0];

oldreq += '==Completed requests==' + txt.split('==Completed requests==')[1];

oldreq = '==Declined requests==' + '\n' + '' + '\n' + '' + '\n' + pagefind + '\n' + '----' + oldreq;

document.editform.wpTextbox1.value = prereq.replace('\n' + pagefind,).replace(pagefind,) + oldreq;

document.editform.wpSummary.value = "Moving " + 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 " + 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('')[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("") != -1)

{

var splitbefore = document.editform.wpTextbox1.value.split("")[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('{{Wikipedia:Requests for checkuser/Inputbox/Sample/Tag}}','');

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('') !=-1)

{

var before = document.editform.wpTextbox1.value.split('')[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('') !=-1)

{

var before = document.editform.wpTextbox1.value.split('')[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('','');

document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace('{{Wikipedia:Requests for checkuser/Inputbox/Sample/Tag}}','');

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

addOnloadHook(WHOIScheck)

function WHOIScheck()

{

if (location.href.indexOf('Special:CheckUser') ==-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 += '
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 = '
All data retrieved: DNS/WHOIS scan completed.';

}

}

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 = '
Retrieving DNS XML page data for ' + name + '...';

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://whois.lanctrl.com/index.php?query=' + name;

document.getElementById('contentSub').innerHTML = '
Retrieving WHOIS XML page data for ' + name + '...';

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 = '
Parsing WHOIS XML page data for ' + name + '...';

//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].split('

// Focus...

if (xml_WHOIS_CU.indexOf('

') !=-1)

{xml_WHOIS_CU = http_request.responseText.split('

')[1];}

xml_WHOIS_CU = xml_WHOIS_CU.split('

')[0].split('

')[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 += '' + xml_WHOIS_CU.split('city:')[1].split('\n')[0].split('\r')[0].split(']')[0] + '' + ', ';}

// 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 = '' + OrgName + '' + Address + City + '' + StateProv + '' + '' + Country + '';

// add CIDR

if (CIDR !='')

output_IP_info += '
CIDR:' + CIDR;

// Parse DNS items

document.getElementById('contentSub').innerHTML = '
Parsing DNS XML page data for ' + name + '...';

if (xml_DNS_user_CU.indexOf('

') != -1)

{xml_DNS_user_CU = xml_DNS_user_CU.split('

')[1].split('
')[0];}

var rev_DNS_info = '';

if (xml_DNS_user_CU.indexOf('Reverse DNS:') !=-1)

{rev_DNS_info = '' + xml_DNS_user_CU.split('Reverse DNS:')[1].split('\n')[0].split('\r')[0] + '';}

output_IP_info += ' RDNS:' + rev_DNS_info;

output_IP_info = output_IP_info.replace(/Internet Assigned Numbers Authority/,'IANA');

// Add location

if (Location !='')

output_IP_info += '
Location:' + Location;

link = '(Full) ';

list.getElementsByTagName('li')[CU_li_index].innerHTML += '

' + link + output_IP_info + '
';

//

CU_li_index += 1;

CU_comprehensive_check();

}

//////////////

//