User:Akhilleus/scripts/compare.js

//copying from User:Voice of All/Specialadmin/monobook.js so I can use the non-admin bits

//NOTE: for security override HTTP request info for IP range and commons image duplicates script: //For FF/NS, go enable, see "http://esw.w3.org/topic/SparqlCalendarDemoUsage#FAQ" //Basically, enable "signed.applets.codebase_principal_support" in about:config //Reduce IE security settings for future versions (this does not support IE yet)

var cvrollbacklink=' Reverting... ';

function checkall { if (document.getElementById('bodyContent')) {form = document.getElementById('bodyContent');} else if (document.getElementById('quickbar')) {form = document.getElementById('content');} l = form.getElementsByTagName('input'); for (i = 0 ; i < l.length; i++) {   if (l[i].type == 'checkbox') {l[i].value = '1'; l[i].checked=true;} } } //END

// Mvaluejs_class = 'DMalak1'; Rvaluejs_class = 'ERollen2'; Uvaluejs_class = 'DRaven2'; //

//MASTER rollback function addmasterroll { if (location.href.indexOf(':Contributions') != -1 || location.href.indexOf('&title=Special%3AContribution') != -1 && location.href.search(/\d{1,3}(@|%40)\d{1,2}/) == -1) {    masterlogview(100,'creation',"pages","ca-npages","Views user's new pages"); masterlogview(100,'move',"moves","ca-viewpm","Views user's page moves"); masterlogview(50,'upload',"uploads", "ca-viewup", "Views user's image uploads"); addTab("javascript:masterroll", "revert all edits", "ca-massroll", "Rollback user's top edits", ""); document.getElementById('ca-massroll').firstChild.innerHTML = ' revert all edits '; addTab("javascript:number_count", "#", "ca-numb", "Number edits", ""); } else if (location.href.indexOf(':Contributions') != -1 || location.href.indexOf('&title=Special%3AContribution') != -1 && location.href.search(/\d{1,3}(@|%40)\d{1,2}/) != -1) {    addTab("javascript:masterroll", "revert all edits", "ca-massroll", "Rollback top edits", ""); document.getElementById('ca-massroll').firstChild.innerHTML = ' revert all edits '; } else if (document.title.indexOf('Move log') != -1 && location.href.search('&user=[^&]') !=-1) {    addTab("javascript:movemasterroll", "revert all moves", "ca-rvmoves", "Reverts user's page moves", ""); document.getElementById('ca-rvmoves').firstChild.innerHTML = ' revert all moves '; } else if (document.title.indexOf('Upload log') != -1 && location.href.search('&user=[^&]') !=-1) {    addTab("javascript:masterdelete", "revert all uploads", "ca-rvuploads", "Reverts uploads", ""); document.getElementById('ca-rvuploads').firstChild.innerHTML = ' revert all uploads '; } else if (location.href.search(/Special:Newpages.*[&\?]username=[^&]/) !=-1) {   addTab("javascript:masternuke", "delete all pages", "ca-delpages", "Delete all pages", ""); document.getElementById('ca-delpages').firstChild.innerHTML = ' delete all pages '; } else if (document.title.indexOf('View and restore deleted pages') != -1 && location.href.search(/&timestamp=|&action=submit/) == -1) {   addTab("javascript:checkall", "Select all", "ca-checkall", "Check all deleted revisions", ""); } if (location.href.search(/&action=history|title=Special:Log|title=Special%3ALog/) != -1) {addTab("javascript:number_count", "#", "ca-numb", "Number edits", "");} } //END

function number_count { //check for monobook then cologneblue if (document.getElementById('bodyContent')) { if (!document.getElementById('bodyContent')){return;} var body = document.getElementById('bodyContent'); } else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } if (!body.getElementsByTagName('ul')[0]){return;} var l = body.getElementsByTagName('ul')[0].getElementsByTagName('li'); if (l[0].innerHTML.indexOf(' #1 ') != -1) return; addTab("javascript:time_frame", "@", "ca-frame", "Time frame", ""); for (var i=0; i < l.length; i++) {  var c = i+1; l[i].innerHTML = ' #' + c + ' ' + l[i].innerHTML; } }

function time_frame { //check for monobook then cologneblue if (document.getElementById('bodyContent')) { if (!document.getElementById('bodyContent')){return;} var body = document.getElementById('bodyContent'); } else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } var range = prompt('Select two edit numbers for the range.' + '\n' + 'Use the format: X-Y.' + '\n' + '(dates must show like "09:12, April 8, 2001" in user preferences)') if (!range || range == '' || range.split('-').length != 2){return;} var r1 = 1*range.split('-')[0]; var r2 = 1*range.split('-')[1]; var limit = r2 - r1 + 1; var offset = r1 - 1; //logs can use offsets (and only offsets) if (location.href.search(/Special:Log|Special%3ALog/) !=-1) { var URL = location.href.replace(/&offset=\d+/g,).replace(/&limit=\d+/g,) + '&offset=' + offset + '&limit=' + limit; location.href = URL; return; } //others use timestamps if (document.title.indexOf('User contributions') ==0) var yearloc = body.getElementsByTagName('li')[r1 - 1].innerHTML.split(' (<a href="')[0].split('(<A href="')[0]; else if (body.getElementsByTagName('li')[r1 - 1].innerHTML.search(/\(cur\) \(last\)/) !=-1) var yearloc = body.getElementsByTagName('li')[r1 - 1].getElementsByTagName('a')[0].innerHTML; else if (body.getElementsByTagName('li')[r1 - 1].innerHTML.search(/\(cur\) | \(last\)/) !=-1) var yearloc = body.getElementsByTagName('li')[r1 - 1].getElementsByTagName('a')[1].innerHTML; else if (body.getElementsByTagName('li')[r1 - 1].innerHTML.search(/\(cur\) | \(last\)/) ==-1) var yearloc = body.getElementsByTagName('li')[r1 - 1].getElementsByTagName('a')[2].innerHTML; if (yearloc.indexOf('January ') !=-1) {var LMonth = 'January'; var LMval = '01'; var LDay = yearloc.split('January ')[1].split(',')[0]; var LYear = yearloc.split('January ')[1].split(', ')[1]; var LTime = yearloc.split(', January ')[0];} else if (yearloc.indexOf('February ') !=-1) {var LMonth = 'February'; var LMval = '02'; var LDay = yearloc.split('February ')[1].split(',')[0]; var LYear = yearloc.split('February ')[1].split(', ')[1]; var LTime = yearloc.split(', February ')[0];} else if (yearloc.indexOf('March ') !=-1) {var LMonth = 'March'; var LMval = '03'; var LDay = yearloc.split('March ')[1].split(',')[0]; var LYear = yearloc.split('March ')[1].split(', ')[1]; var LTime = yearloc.split(', March ')[0];} else if (yearloc.indexOf('April ') !=-1) {var LMonth = 'April'; var LMval = '04'; var LDay = yearloc.split('April ')[1].split(',')[0]; var LYear = yearloc.split('April ')[1].split(', ')[1]; var LTime = yearloc.split(', April ')[0];} else if (yearloc.indexOf('May ') !=-1) {var LMonth = 'May'; var LMval = '05'; var LDay = yearloc.split('May ')[1].split(',')[0]; var LYear = yearloc.split('May ')[1].split(', ')[1]; var LTime = yearloc.split(', May ')[0];} else if (yearloc.indexOf('June ') !=-1) {var LMonth = 'June'; var LMval = '06'; var LDay = yearloc.split('June ')[1].split(',')[0]; var LYear = yearloc.split('June ')[1].split(', ')[1]; var LTime = yearloc.split(', June ')[0];} else if (yearloc.indexOf('July ') !=-1) {var LMonth = 'July'; var LMval = '07'; var LDay = yearloc.split('July ')[1].split(',')[0]; var LYear = yearloc.split('July ')[1].split(', ')[1]; var LTime = yearloc.split(', July ')[0];} else if (yearloc.indexOf('August ') !=-1) {var LMonth = 'August'; var LMval = '08'; var LDay = yearloc.split('August ')[1].split(',')[0]; var LYear = yearloc.split('August ')[1].split(', ')[1]; var LTime = yearloc.split(', August ')[0];} else if (yearloc.indexOf('September ') !=-1) {var LMonth = 'September'; var LMval = '09'; var LDay = yearloc.split('September ')[1].split(',')[0]; var LYear = yearloc.split('September ')[1].split(', ')[1]; var LTime = yearloc.split(', September ')[0];} else if (yearloc.indexOf('October ') !=-1) {var LMonth = 'October'; var LMval = '10'; var LDay = yearloc.split('October ')[1].split(',')[0]; var LYear = yearloc.split('October ')[1].split(', ')[1]; var LTime = yearloc.split(', October ')[0];} else if (yearloc.indexOf('November ') !=-1) {var LMonth = 'November'; var LMval = '11'; var LDay = yearloc.split('November ')[1].split(',')[0]; var LYear = yearloc.split('November ')[1].split(', ')[1]; var LTime = yearloc.split(', November ')[0];} else if (yearloc.indexOf('December ') !=-1) {var LMonth = 'December'; var LMval = '12'; var LDay = yearloc.split('December ')[1].split(',')[0]; var LYear = yearloc.split('December ')[1].split(', ')[1]; var LTime = yearloc.split(', December ')[0];} if (LDay.search(/\d\d/) ==-1){LDay = '0' + LDay;} var LTime = LTime.replace(/:/g,''); var timestamp = LYear +  + LMval +  + LDay + '' + LTime + '59'; //target contribs if (location.href.indexOf('Special:Contributions/') ==-1) {var URL = location.href.replace(/&offset=\d+/g,).replace(/&limit=\d+/g,) + '&offset=' + timestamp + '&limit=' + limit;} //implicit taget else if (location.href.indexOf('Special:Contributions/') !=-1) { var user = location.href.split('Special:Contributions/')[1]; var URL = wgServer + '/w/index.php?title=Special:Contributions&target=' + user + '&offset=' + timestamp + '&limit=' + limit; } // history page else if (location.href.indexOf('&action=history') !=-1) { var URL = wgServer + '/w/index.php?title=' + wgTitle + '&action=history&offset=' + timestamp + '&limit=' + limit; } location.href = URL; }

function masterlogview(number,type,name,ID,title) {   if (document.getElementById('contentSub')) {   var c = document.getElementById('contentSub'); var a = c.getElementsByTagName('a'); }   else {   var c = document.getElementsByTagName('p')[0]; var a = c.getElementsByTagName('a'); }   vandal = a[0].href; if (vandal.indexOf("User:") !=-1) {vandal = vandal.split("User:")[1];} else if (vandal.indexOf("User talk:") !=-1) {vandal = vandal.split("User talk:")[1];} else if (vandal.indexOf("User_talk:") !=-1) {vandal = vandal.split("User_talk:")[1];} if (vandal.indexOf("&action=") !=-1) {vandal = vandal.split("&action=")[0];} if (vandal.search(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) !==-1){return;} //create URL if (type != 'creation') {         URL = '/w/index.php?title=Special:Log&type=' + type + '&user=' + vandal + '&page=&limit=' + number; }         else if (type == 'creation') {         URL = '/wiki/Special:Newpages?username=' + vandal + '&limit=' + number; }  addTab(URL, name, ID, title, ""); } //END

//////////////Auto-actions////////////// function winclosed { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } //for master rollback for moves if (location.href.indexOf('&fakaction=masterfill') != -1 && document.title.indexOf('Move page') != -1) {   document.getElementById('wpReason').value = 'Automated revert of mass page moving.'; document.getElementById('movepage').submit; } //for master rollback for image uploads else if (document.title.indexOf('Image:')==0 && location.href.indexOf('&jsaction=ImagevandalRV&target=') !=-1) { var bad_user = unescape(location.href.split('&target=')[1].split('&')[0]); var reason = location.href.split('&reason=')[1].split('&')[0]; var history_num = 1; var uls = body.getElementsByTagName('ul'); for (h=0; h' + bad_user + '' + bad_user + ' (') == -1)         {        var RV_linkURL = history[i].getElementsByTagName('a')[1].href;        Delete = 0;        if (RV_linkURL.indexOf('&wpEditToken=') ==-1){alert('Parsing error!'); return;}        document.getElementById('contentSub').innerHTML = ' Reverting: ' + RV_linkURL + ' .';        location.href = RV_linkURL;        break;         }      } //if user is the only contibutor   if (Delete == 1)    {    var Delete_AllURL = history[0].getElementsByTagName('a')[0].href;    if (Delete_AllURL.indexOf('&action=delete') ==-1){alert('Parsing error!'); return;}    Delete_AllURL += '&jsaction=imagenuke&reason=' + reason;    document.getElementById('contentSub').innerHTML = ' Deleting: ' + Delete_AllURL + ' .'; location.href = Delete_AllURL; } } //for master rollback for images, last step else if (document.title.indexOf('Confirm delete')==0 && location.href.indexOf('&action=delete&jsaction=imagenuke&reason=') !=-1) { var reason = unescape(location.href.split('&reason=')[1].split('&')[0]); document.getElementById('wpReason').value = reason; var form = document.getElementsByTagName('input')[1]; form.click; } //for master delete for page creations else if (document.title.indexOf('Confirm delete')==0 && location.href.indexOf('&action=delete&jsaction=nuke') !=-1) { if (document.getElementById('wpReason').value.length < 1) {document.getElementById('wpReason').value = 'Deleted vandalism page with only one contributor.';} var form = document.getElementsByTagName('input')[1]; form.click; } else if (document.title.indexOf('Confirm delete')==0 && location.href.indexOf('&jsaction=RollbackDelete') !=-1) { if (document.getElementById('wpReason').value.length < 1) {document.getElementById('wpReason').value = 'Deleted test or vandalism page with only one contributor.';} var form = document.getElementsByTagName('input')[1]; var message = 'Do you want to delete this page since it has only one author?'; var return_value = confirm(message); if (return_value == true) {form.click;} } else if (document.title.indexOf('Rollback failed') == 0 && body.innerHTML.indexOf(' last contributor is the only author of this page') != -1) { var article = location.href.split('?title=')[1].split('&action')[0]; location.href = wgServer + '/w/index.php?title=' + article + '&action=delete&jsaction=RollbackDelete'; } } //////////////

function jswin_close { //close JS action inputs if (document.title.search(/Action complete|Internal error/) ==0) { setTimeout('window.close',1000); } //close JS action inputs else if (document.title.indexOf('Move page')==0) { if (document.getElementById('contentSub').innerHTML == 'Move succeeded') {setTimeout('window.close',1000);} } //close JS launched rollbacks else if (location.href.search(/&action=rollback.+&jsaction=close/) !=-1) { window.close; } }

//reverts edits function masterroll { //monobook if (document.getElementById('bodyContent')) { if (!document.getElementById('bodyContent')){return;} var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } if (!body.getElementsByTagName('ul')[0]) {alert('No edits found.'); return;} z=0; var oldloc = location.href; var message = "Are you sure you want to revert all top edits shown on this page by this user? Use this only to revert a large wave of vandalism by a single user or IP address." + "\n" + "To control how many edits this will revert, please set the number of articles on the list before performing this operation. You may also want to change the offset as well." + "\n" + "Close all other programs if there is a large number of edits to be reverted, otherwise, this may cause memory problems. Press OK to continue."; var return_value = confirm(message); if (return_value == true) {   var js_con_class = prompt("Secondary confirmation:" + "\n" + "All top edits by this user will be reverted!" + "\n" + "Confirm type:"); if (js_con_class == Rvaluejs_class) {   l = body.getElementsByTagName('li'); document.getElementById('contentSub').innerHTML = " All of the user's top edits are being reverted. This page will be refreshed automatically in 20 seconds ."; for (var i = 0; i < l.length; i++) {     if (i == l.length-1){setTimeout("window.location.reload",20000);} var t = l[i].innerHTML; if (t.indexOf(' (') != -1)        {        var article = l[i].getElementsByTagName('a')[0].href.split('&')[0].split('title=')[1].replace(/[^\/]*\/\/[^\/]*/, '');        var li_a = l[i].getElementsByTagName('a');        for (k = 3; k < li_a.length; k++)          {        if (l[i].getElementsByTagName('a')[k].href.indexOf('&action=rollback') !=-1)           { z += 1; var URL = l[i].getElementsByTagName('a')[k].href + '&jsaction=close'; l[i].innerHTML += ' (' + cvrollbacklink + ')'; window.open(URL,'MasterrollJS' + z,'height=300,width=800,directories=yes,resizeable=yes,scrollbars=yes');        break;           }             }        }      }  }        else          {         alert("Operation aborted.");         return;          } }        else          {         alert("Operation aborted.");         return;          } } //

//rollback moves function movemasterroll { //monobook if (document.getElementById('bodyContent')) { if (!document.getElementById('bodyContent')){return;} var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } if (!body.getElementsByTagName('ul')[0]) {alert('No page moves found.'); return;} var oldloc = location.href; var message = "Are you sure you want to revert all page moves by this user? Use this only to revert a large wave of vandalism by a single user or IP address." + "\n" + "To control how many moves this will revert, please set the number of articles on the list before performing this operation. You may also want to change the offset as well." + "\n" + "Close all other programs if there is a large number of moves to be reverted, otherwise, this may cause memory problems. Press OK to continue."; var return_value = confirm(message); if (return_value == true) {   var Val_type = prompt("Secondary confirmation:" + "\n" + "All top moves by this user will be reverted!" + "\n" + "Confirm type:"); if (Val_type == Mvaluejs_class) {   var c = document.getElementById('contentSub'); var a = c.getElementsByTagName('a'); l = body.getElementsByTagName('li'); document.getElementById('contentSub').innerHTML = " All of the user's top page moves are being reverted. This page will be refreshed automatically in 20 seconds ."; for (var i = l.length -1; i >= 0; i--) {     if (i == 0){setTimeout("window.location.reload",20000);} var t = l[i].innerHTML; if (t.indexOf('moved') != -1) {       var li_a = l[i].getElementsByTagName('a'); for (k = 1; k <li_a.length; k++) {           if (li_a[k].href.indexOf('&redirect=no') != -1) {var article = li_a[k].href;} if (li_a[k].href.indexOf('title=Special:Movepage&wpOldTitle=') != -1) {             var URL = li_a[k].href + '&fakaction=masterfill'; l[i].innerHTML += ' (' + cvrollbacklink + ')'; window.open(URL,'MasterMoveRV:' + article,'height=300,width=800,resizeable=yes,scrollbars=yes'); break; }              }        }   } }        else {        alert("Operation aborted."); return; } }       else {        alert("Operation aborted."); return; } } //END

//deletes recent page creations function masternuke { //monobook if (document.getElementById('bodyContent')) { if (!document.getElementById('bodyContent')){return;} var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } if (body.getElementsByTagName('ol')[0] == undefined) {alert('No page creations found.'); return;} var oldloc = location.href; var message = "Are you sure you want to delete all pages created by this user? Use this only to revert a large wave of vandalism by a single user." + "\n" + "To control how many pages this will delete, please set the number of articles on the list before performing this operation. You may also want to change the offset as well." + "\n" + "Close all other programs if there is a large number of moves to be reverted, otherwise, this may cause memory problems. Press OK to continue."; var return_value = confirm(message); if (return_value == true) {   var Val_type = prompt("Secondary confirmation:" + "\n" + "All recent pages created by this user will be deleted!" + "\n" + "Confirm type:"); if (Val_type == Rvaluejs_class) {   var c = document.getElementById('contentSub'); var a = c.getElementsByTagName('a'); l = body.getElementsByTagName('li'); document.getElementById('contentSub').innerHTML = " All of the user's recent page creations are being deleted. This page will be refreshed automatically in 20 seconds ."; for (var i = 0; i < l.length; i++) {     if (i == 0){setTimeout("window.location.reload",20000);} var article = l[i].getElementsByTagName('a')[0].innerHTML; var URL = wgServer + '/w/index.php?title=' + article + '&action=delete&jsaction=nuke'; l[i].innerHTML += ' (' + dvrollbacklink + ' )'; window.open(URL,'MasterNUKE:' + article,'height=700,width=700,resizeable=yes,scrollbars=yes'); }  }        else {        alert("Operation aborted."); return; } }       else {        alert("Operation aborted."); return; } } //END

//reverts/deletes uploads function masterdelete { //monobook if (document.getElementById('bodyContent')) { if (!document.getElementById('bodyContent')){return;} var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } if (!body.getElementsByTagName('ul')[0]){return;} var z = 0; var unique_img_list = '|'; //are there any? if (body.getElementsByTagName('ul')[0] == undefined) {alert('No file uploads found.'); return;} var oldloc = location.href; var message = "Are you sure you want to revert all uploads shown on this page by this user? Use this only to revert a large wave of vandalism by a single user or IP address. Uploads of which this user is the only author will be deleted." + "\n" + "To control how many uploads this will revert, please set the number of images on the list before performing this operation. You may also want to change the offset as well." + "\n" + "Close all other programs if there is a large number of edits to be reverted. Unfortunetely, this script has to load the image pages to get the file histories, so it is STRONGLY recommended that you disable images in this browser first if there is a large number of images to be reverted. Press OK to continue."; var return_value = confirm(message); if (return_value == true) {  var Val_type = prompt("Secondary confirmation:" + "\n" + "All uploads by this user will be reverted!" + "\n" + "Confirm type:"); if (Val_type == Uvaluejs_class) {   var reason = prompt('Enter an explanation:'); if (!reason || reason.length < 6){alert('Too short!'); return;} l = body.getElementsByTagName('ul')[0].getElementsByTagName('li'); var vandal = l[0].getElementsByTagName('a')[0].innerHTML; document.getElementById('contentSub').innerHTML = " All of the user's uploads are being reverted. This page will be refreshed automatically in 30 seconds ."; for (var i = 0; i < l.length; i++) {       if (i == l.length-1){setTimeout("window.location.reload",30000);} //check for non-deleted images var li_a = l[i].getElementsByTagName('a'); for (k = 2; k <li_a.length; k++) {       if (l[i].getElementsByTagName('a')[k].innerHTML.indexOf('Image:') != -1 && l[i].getElementsByTagName('a')[k].href.indexOf('&action=edit') == -1) {          z += 1; var name = l[i].getElementsByTagName('a')[k].innerHTML; if (unique_img_list.indexOf('|' + name + '|') ==-1) {              unique_img_list += name + '|'; var URL = wgServer + '/w/index.php?title=' + name; URL += '&jsaction=ImagevandalRV&target=' + escape(vandal) + '&reason=' + escape(reason); l[i].innerHTML += ' (' + cvrollbacklink + ')'; window.open(URL,'MasterrollImages' + z,'height=700,width=700,directories,resizeable,scrollbars'); break; }            else {l[i].innerHTML += ' ( old )';} }           }     }  }        else {        alert("Operation aborted."); return; } }       else {        alert("Operation aborted."); return; } } //

////////////Wikipedia:WikiProject User scripts/Scripts/RBL check//////////// // This script adds an "RBL check" link to the toolbox on IP user/talk/contribs pages.

addOnloadHook(function {    var href = document.getElementById('t-contributions');    if (href) href = href.getElementsByTagName('a');    if (href) href = href[0];    if (href) href = href.href;    else href = window.location.href;

var addr = /(\/wiki\/|[?&]title=)Special:Contributions(\/([^\/?&#]*)|[?&#]|$)/.exec(href); if (!addr) return; addr = addr[3]; if (!addr) { addr = /^[^?#]*\?([^&#]*&)*target=([^&#]*)/.exec(href); if (!addr) return; addr = addr[2]; }   if (!/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/.test(addr)) return;

addLink('p-tb', 'http://www.robtex.com/rbls/'+addr+'.html', 'RBL check', 't-rblcheck', 'Multi-RBL check', null, 't-contributions'); }); ////////////

/////////////////////////////////IP range contribs check///////////////////////////////// //globals var starting_IP_trunk = ''; var starting_IP_end = 0; var IP_num_JS_count = 0; var IP_num_JS_static = 0; //

function IPRange_contribs_tab { if (location.href.search(/Special(:|%3A)Contributions/) != -1 && location.href.search(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) != -1 && location.href.search(/\d{1,3}(@|%40)\d{1,2}/) == -1) { addTab("javascript:IPRange_contribs_query", "/24 Range", "ca-range", "Check a medium or small IP range", ""); addTab("javascript:IPRange_contribs_query2", "/16 Range", "ca-range2", "Monitor a large IP range", ""); } }

//for /24 ranges function IPRange_contribs_query { if (location.href.indexOf('/Special:Contributions/') != -1) {var IP = location.href.split('/Special:Contributions/')[1];} else {var IP = location.href.split('&target=')[1].split('&')[0];} var number = prompt('Consecutive IP range indexes?' + '\n' + 'Use format: X-Y' + '\n' + '(For fourth IP block)'); if (!number || number=='' || number.split('-').length !=2){return;} var start = 1*number.split('-')[0]; var end = 1*number.split('-')[1]; var count = end - start; if (end > 255){end = 255;} var IP = IP.split('.')[0] + '.' + IP.split('.')[1] + '.' + IP.split('.')[2] + '.' + start; location.href = wgServer + '/w/index.php?&limit=1&target=' + IP + '@' + count + '&title=Special%3AContributions&namespace='; }

//for /16 ranges function IPRange_contribs_query2 { if (location.href.indexOf('/Special:Contributions/') != -1) {var IP = location.href.split('/Special:Contributions/')[1];} else {var IP = location.href.split('&target=')[1].split('&')[0];} var number = prompt('Consecutive IP range indexes?' + '\n' + 'Use format: X-Y' + '\n' + '(For third IP block)'); if (!number || number=='' || number.split('-').length !=2){return;} var start = 1*number.split('-')[0]; var end = 1*number.split('-')[1]; var count = end - start; if (end > 255){end = 255;} var IP = IP.split('.')[0] + '.' + IP.split('.')[1] + '.' + start; location.href = wgServer + '/w/index.php?&limit=1&target=' + IP + '@' + count + '&title=Special%3AContributions&namespace='; }

function IPRange_contribs { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } //for /24 queries if (location.href.search(/&target=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}%40\d{1,2}/) != -1 && location.href.indexOf('&title=Special%3AContributions') != -1) { var target = location.href.split('&target=')[1].split('&')[0]; starting_IP_trunk = target.split('.')[0] + '.' + target.split('.')[1] + '.' + target.split('.')[2] + '.'; var ending_num = target.split('%40')[1]; starting_IP_end = target.split('.')[3].split('%40')[0]; // var IP_end_last_show = 1*starting_IP_end + 1*ending_num; var IP_start_show = starting_IP_trunk + starting_IP_end; var IP_last_show = starting_IP_trunk + IP_end_last_show; body.innerHTML = body.innerHTML.replace('No changes were found matching these criteria.',''); document.getElementById('siteSub').innerHTML += " Checking IP range contributions from " + IP_start_show + " to " + IP_last_show + " :"; makeRangeRequestXML_DNS('GET', starting_IP_trunk + '0/24', null) } //for /16 queries else if (location.href.search(/&target=\d{1,3}\.\d{1,3}\.\d{1,3}%40\d{1,2}/) != -1 && location.href.indexOf('&title=Special%3AContributions') != -1) { var target = location.href.split('&target=')[1].split('&')[0]; starting_IP_trunk = target.split('.')[0] + '.' + target.split('.')[1] + '.'; var ending_num = target.split('%40')[1]; starting_IP_end = target.split('.')[2].split('%40')[0]; // var IP_end_last_show = 1*starting_IP_end + 1*ending_num; var IP_start_show = starting_IP_trunk + starting_IP_end; var IP_last_show = starting_IP_trunk + IP_end_last_show; var starting_IP_end_last = 1*starting_IP_end + 1*ending_num; var ip_reg = ''; for (var i=starting_IP_end; i <= starting_IP_end_last; i++) {    if (i != starting_IP_end_last) {ip_reg += i + '|';} else {ip_reg += i;} } ip_reg = '" title="Special:Contributions">' + starting_IP_trunk + '(' + ip_reg + ')\\.\\d{1,3} ';  ip_reg_RC_range = new RegExp(ip_reg,'i');  body.innerHTML = body.innerHTML.replace('No changes were found matching these criteria.','');  document.getElementById('siteSub').innerHTML += " Checking IP range contributions from " + IP_start_show + " to " + IP_last_show + " :";  var iterations = prompt('How many additional 10 minute checks?');  if (!iterations){history.go(-1);}  RC_XML_contribs_range(iterations);  } //for /24 UI else if (location.href.search(/&target=\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}@\d{1,2}/) != -1 && location.href.indexOf('&title=Special%3AContributions') != -1)  {  document.getElementById('siteSub').innerHTML += ' Select a namespace and press "Go" to check contribtutions from this IP range. This will only check back 20 edits however. ';  } //for /16 UI else if (location.href.search(/&target=\d{1,3}\.\d{1,3}\.\d{1,3}@\d{1,2}/) != -1 && location.href.indexOf('&title=Special%3AContributions') != -1) { document.getElementById('siteSub').innerHTML += ' Select a namespace and press "Go" to check contribtutions from this IP range. This will only check about 2-4 hours back of recent changes. Subsequent edits will be monitored each minute for X iterations. '; } }

// var offset_RC_index = 0; var timestamp_RC_index = 0; function RC_XML_contribs_range(upper_limit) { upper_limit_RC_range = upper_limit; //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } body.innerHTML += ''; RC_page_XML_range(0); }

function RC_page_XML_range(offset_RC_index) { document.getElementById('contentSub').innerHTML = " Checking last 5000 IP recent changes from timestamp '" + timestamp_RC_index + "' (" + offset_RC_index + "/" + upper_limit_RC_range + ") :"; var namespace = '&namespace='; if (location.href.search(/&namespace=\d/) != -1) {namespace = '&namespace=' + location.href.split('&namespace=')[1].split('&')[0];} // var URL = '/w/index.php?title=Special:Recentchanges&hideliu=1&limit=5000' + namespace + '&from=' + timestamp_RC_index + '&useskin=none'; xml_http = HTTPClient; xml_http.open("GET", URL, true); xml_http.onreadystatechange = RC_page_XML_range_parse; xml_http.send(null); }

function RC_page_XML_range_parse { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); }  if (xml_http.readyState != 4) {return;} xml_rc_contribs_xml = xml_http.responseText; document.getElementById('contentSub').innerHTML = " Parsing recent changes XML...(" + offset_RC_index + "/" + upper_limit_RC_range + ") "; //timestamp if (xml_rc_contribs_xml.indexOf('/>Show new changes starting from <') !=-1) {timestamp_RC_index = xml_rc_contribs_xml.split('/>Show new changes starting from <')[1].split('from=')[1].split('"')[0].split('&')[0];} else    {timestamp_RC_index = xml_rc_contribs_xml.split('name="from" value="')[1].split('"')[0];}  timestamp_RC_index = timestamp_RC_index.substr(0,12) + '59'; //  if (xml_rc_contribs_xml.indexOf(' ') != -1)    {xml_rc_contribs_xml = xml_rc_contribs_xml.split(' ')[1].split('')[0];}  var li_sections = xml_rc_contribs_xml.split('');  var last_index = li_sections.length-1;  var rewrite = false;  for (var i=1; i')[0];    if (html_li.search(ip_reg_RC_range) != -1)    body.getElementsByTagName('ul')[0].innerHTML = '' + html_li + '' + body.getElementsByTagName('ul')[0].innerHTML;    rewrite = true;    }  offset_RC_index = offset_RC_index + 1;  if (offset_RC_index > upper_limit_RC_range) {   document.getElementById('contentSub').innerHTML = " Done: edits retrieved. "; body.ranSetupTooltipsAlready=false; setupTooltips(body); return; } setTimeout("RC_page_XML_range",600000); document.getElementById('contentSub').innerHTML = " Waiting 10 minutes for next XML request...(" + offset_RC_index + "/" + upper_limit_RC_range + ") "; //rewrite popups if (rewrite==true) {   body.ranSetupTooltipsAlready=false; setupTooltips(body); } //RC_page_XML_range(offset_RC_index); }

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

//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

// function makeRangeRequestXML_DNS(type, url, parameters) {  document.getElementById('contentSub').innerHTML = " Checking DNS info for " + url + ". Please wait... "; 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.overrideMimeType) {http_request.overrideMimeType('text/xml'); } if (!http_request) {alert('Cannot create XMLHTTP instance'); return false;} http_request.onreadystatechange = IPRange_contribs_XML_ready; http_request.open(type, 'http://www.dnsstuff.com/tools/ptr.ch?ip=' + 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 = IPRange_contribs_XML_ready; http_request.open(type, 'http://www.dnsstuff.com/tools/ptr.ch?ip=' + url, true); http_request.send(parameters); } } //

// function makeRangeRequestXML_WHOIS(type, url, parameters) {  document.getElementById('contentSub').innerHTML = " Looking up WHOIS info for " + current_IP_name + " :"; 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.overrideMimeType) {http_request.overrideMimeType('text/xml'); } if (!http_request) {alert('Cannot create XMLHTTP instance'); return false;} http_request.onreadystatechange = parse_contribs_ready; http_request.open(type, 'http://www.dnsstuff.com/tools/whois.ch?ip=' + 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 = parse_contribs_ready; http_request.open(type, 'http://www.dnsstuff.com/tools/whois.ch?ip=' + url, true); http_request.send(parameters); } } //////////////////////////////

function IPRange_contribs_XML_ready { if (http_request.readyState != 4) {return;} xml_DNS_user_CU = http_request.responseText; if (xml_DNS_user_CU.indexOf('') != -1) {xml_DNS_user_CU = xml_DNS_user_CU.split('')[1].split('')[0];} IPRange_contribs_XML; }

function IPRange_contribs_XML { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } var namespace = '&namespace='; if (location.href.search(/&namespace=\d/) != -1) {namespace = '&namespace=' + location.href.split('&namespace=')[1].split('&')[0];} var target = location.href.split('&target=')[1].split('&')[0]; if (target.indexOf('@') != -1) {var ending_num = target.split('@')[1];} else if (target.indexOf('%40') != -1) {var ending_num = target.split('%40')[1];} var current_num = 1*starting_IP_end + 1*IP_num_JS_count; if (IP_num_JS_count > ending_num) { document.getElementById('contentSub').innerHTML = " Done: edits retrieved. "; edits_page_compared_js = 1; addTab("javascript:compare_contribs_range", "Compare", "ca-comp", "Compare", ""); addTab("javascript:contribs_reset", "reset", "ca-reset", "Reset to range contribs", ""); body.ranSetupTooltipsAlready=false; setupTooltips(body); return; } if (current_num > 255) { document.getElementById('contentSub').innerHTML = " IP bloc number exceeds 255, query stopped! "; edits_page_compared_js = 1; addTab("javascript:compare_contribs_range", "Compare", "ca-comp", "Compare", ""); addTab("javascript:contribs_reset", "reset", "ca-reset", "Reset to range contribs", ""); body.ranSetupTooltipsAlready=false; setupTooltips(body); return; } if (location.href.indexOf('Special:Contributions&target=') != -1) { var URL = location.href.split('Special:Contributions&target=')[0] + 'Special:Contributions&target=' + starting_IP_trunk + current_num + namespace + '&limit=20'; } else { var URL = '/w/index.php?title=Special:Contributions&target=' + starting_IP_trunk + current_num + namespace + '&limit=20'; } document.getElementById('contentSub').innerHTML = " Checking: " + starting_IP_trunk + current_num + " "; current_IP_name = starting_IP_trunk + current_num; IPRange_contribs_edits; }

function IPRange_contribs_edits { var namespace = '&namespace='; if (location.href.search(/&namespace=\d/) != -1) {namespace = '&namespace=' + location.href.split('&namespace=')[1].split('&')[0];} // document.getElementById('contentSub').innerHTML = " Searching contributions info for " + current_IP_name + " :"; var URL = '/w/index.php?title=Special:Contributions&target=' + current_IP_name + namespace + '&limit=20&useksin=standard'; xml_http = HTTPClient; xml_http.open("GET", URL, true); xml_http.onreadystatechange = IPRange_contribs_WHOIS; xml_http.send(null); }

function IPRange_contribs_WHOIS { if (xml_http.readyState != 4) return; xml_edits_user = xml_http.responseText; if (xml_edits_user.indexOf('No changes were found matching these criteria.') ==-1 && xml_edits_user.indexOf('') !=-1) {makeRangeRequestXML_WHOIS('GET', current_IP_name, null);} else {xml_WHOIS_user_CU = ''; parse_contribs_xml;} }

function parse_contribs_ready { if (http_request.readyState != 4) {return;} xml_WHOIS_user_CU = http_request.responseText; parse_contribs_xml; }

function parse_contribs_xml { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } //WHOIS if (xml_WHOIS_user_CU.indexOf(' Whois Record ') !=-1) {xml_WHOIS_user_CU = xml_WHOIS_user_CU.split(' Whois Record ')[1];} else if (xml_WHOIS_user_CU.indexOf('Whois Record</H3>') !=-1) {xml_WHOIS_user_CU = xml_WHOIS_user_CU.split('<H3>Whois Record</H3>')[1];} if (xml_WHOIS_user_CU.indexOf('<p class="whois_record">') != -1) {xml_WHOIS_user_CU = xml_WHOIS_user_CU.split('<p class="whois_record">')[1].split(' ')[0];} if (xml_WHOIS_user_CU.indexOf('<TABLE ') != -1) {xml_WHOIS_user_CU = xml_WHOIS_user_CU.split('<TABLE ')[1];} //parse WHOIS results var OrgName = ''; var Address = ''; var City = ''; var StateProv = ''; var Country = ''; if (xml_WHOIS_user_CU.indexOf('OrgName:') !=-1) {OrgName = xml_WHOIS_user_CU.split('OrgName:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.split('Address:')[1] !=undefined) {Address = xml_WHOIS_user_CU.split('Address:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.split('Address:')[2] !=undefined) {Address += xml_WHOIS_user_CU.split('Address:')[2].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.split('Address:')[3] !=undefined) {Address += xml_WHOIS_user_CU.split('Address:')[3].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.split('address:')[1] !=undefined) {Address = xml_WHOIS_user_CU.split('address:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.split('address:')[2] !=undefined) {Address += xml_WHOIS_user_CU.split('address:')[2].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.split('address:')[3] !=undefined) {Address += xml_WHOIS_user_CU.split('address:')[3].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.indexOf('City:') !=-1) {City = ' ' + xml_WHOIS_user_CU.split('City:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ' ' + ', ';} //DNS again... if (xml_DNS_user_CU.indexOf('City: ') !=-1) {City = ' ' + xml_DNS_user_CU.split('City: ')[1].split('\n')[0].split('\r')[0].split(']')[0] + ' ' + ', ';} // if (xml_WHOIS_user_CU.indexOf('StateProv:') !=-1) {StateProv = xml_WHOIS_user_CU.split('StateProv:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.indexOf('OrgName:') !=-1) {Country = xml_WHOIS_user_CU.split('Country:')[1].split('\n')[0].split('\r')[0].split(']')[0] + ', ';} if (xml_WHOIS_user_CU.search(/(OrgName|Address|City|StateProv|Country):/) ==-1 && xml_WHOIS_user_CU.indexOf(' ') != -1) {OrgName = xml_WHOIS_user_CU.split(' ')[1].split(' ')[0] + ', ';} var output_IP_info = ' ' + OrgName + ' ' + Address + City + ' ' + StateProv + ' ' + ' + Country + '; //parse DNS items document.getElementById('contentSub').innerHTML = ' Parsing DNS XML page data for ' + current_IP_name + '... '; var rev_DNS_info = '?'; if (xml_DNS_user_CU.indexOf(current_IP_name + ' - ') !=-1) {rev_DNS_info = ' ' + xml_DNS_user_CU.split(current_IP_name + ' - ')[1].split('\n')[0].split('\r')[0] + ' ';} output_IP_info += ' DNS : ' + rev_DNS_info; output_IP_info = output_IP_info.replace(/Internet Assigned Numbers Authority/,'IANA'); //parse edits if (xml_edits_user.indexOf('No changes were found matching these criteria.') ==-1 && xml_edits_user.indexOf('<ul>') !=-1) { var contribs = xml_edits_user.split('<ul>')[1].split('</ul>')[0]; var current_num = 1*starting_IP_end + 1*IP_num_JS_count; body.innerHTML += ' <a href="/wiki/Special:Contributions/' + current_IP_name + '">' + current_IP_name + '</a> || ' + output_IP_info + ' ' + '<ul>' + contribs + '</ul>'; } else { body.innerHTML += ' ' + current_IP_name + ' (no contribs exist) || ' + output_IP_info + ' '; } IP_num_JS_count += 1; IPRange_contribs_XML; } /////////////////////////////////

////////////////////Compare contribs//////////////////// function Compare_tab_add { if (document.title.indexOf('User contributions') == 0 && location.href.search(/\d{1,3}(@|%40)\d{1,2}/) == -1) {addTab("javascript:compare_contribs", "Compare", "ca-comp", "Compare", "");} }

//globals username_contribs_comp = ''; username_contribs_comp2 = ''; // function compare_contribs { username_contribs_comp2 = prompt('Compare with who?' + '\n' + '*for last 2000 edits' + '\n' + '*selected namespace' + '\n' + '*for last 15 (un)blocks'); if (!username_contribs_comp2){return;} username_contribs_comp = document.getElementById('contentSub').getElementsByTagName('a')[0].innerHTML; if (username_contribs_comp == 'Talk' && location.href.indexOf('&target=') != -1) {username_contribs_comp = location.href.split('&target=')[1].split('&')[0];} else if (username_contribs_comp == 'Talk' && location.href.indexOf('/Special:Contributions/') != -1) {username_contribs_comp = location.href.split('/Special:Contributions/')[1];} if (username_contribs_comp == username_contribs_comp2){alert('Cannot compare a user with his/herself!'); return;} document.getElementById('contentSub').innerHTML += " Requesting block log and contribs XML for users... "; var namespace = ''; //get namespace if (document.getElementById('namespace')) {   var inputs = document.getElementById('namespace').getElementsByTagName('option'); for (i=0; i<inputs.length; i++) {      if (inputs[i].selected==true) {var namespace = '&namespace=' + inputs[i].value; break;} }   } //  var URL = '/w/index.php?title=Special:Contributions&target=' + username_contribs_comp + namespace + '&limit=2000&useksin=none'; xml_http = HTTPClient; xml_http.open("GET", URL, true); xml_http.onreadystatechange = parse_xml_contribs2; xml_http.send(null); }

function parse_xml_contribs2 { if (xml_http.readyState != 4) {return;} doc1_xml_contribs_xml = xml_http.responseText; var namespace = ''; //get namespace if (document.getElementById('namespace')) {   var inputs = document.getElementById('namespace').getElementsByTagName('option'); for (i=0; i<inputs.length; i++) {      if (inputs[i].selected==true) {var namespace = '&namespace=' + inputs[i].value; break;} }   } //  var URL = '/w/index.php?title=Special:Contributions&target=' + username_contribs_comp2 + namespace + '&limit=2000&useksin=none'; xml_http = HTTPClient; xml_http.open("GET", URL, true); xml_http.onreadystatechange = parse_xml_comparecontribs_log; xml_http.send(null); }

function compare_contribs_range { username_contribs_comp2 = prompt('Compare with who?' + '\n' + '*for last 2000 edits' + '\n' + '*current namespace'); if (!username_contribs_comp2){return;} username_contribs_comp = 'Selected IP range'; document.getElementById('contentSub').innerHTML += " Requesting contribs XML for other user... "; var namespace = ''; if (location.href.search(/&namespace=\d/) != -1) {var namespace = location.href.match(/&namespace=\d/)[0];} var URL = '/w/index.php?title=Special:Contributions&target=' + username_contribs_comp2 + namespace + '&limit=2000&useksin=none'; xml_http = HTTPClient; xml_http.open("GET", URL, true); xml_http.onreadystatechange = parse_xml_contribs_range; xml_http.send(null); }

//cache doc_js_ipcontribs_range_cache = ''; // function parse_xml_contribs_range { if (xml_http.readyState != 4) {return;} //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } document.getElementById('contentSub').innerHTML += " Parsing contribs XML for other user... "; xml = xml_http.responseText; var doc2 = standard_XMLParse(xml); if (doc_js_ipcontribs_range_cache == '') { doc_js_ipcontribs_range_cache = body.innerHTML; } else {body.innerHTML = doc_js_ipcontribs_range_cache;} var doc1 = body; //check for any contribs if (doc1.getElementsByTagName('li')[0] == undefined) {document.getElementById('contentSub').innerHTML += " Note: One of these users has no contributions in this namespace! "; return;} else if (doc2.getElementById('bodyContent').getElementsByTagName('li')[0] == undefined) {document.getElementById('contentSub').innerHTML += " Note: One of these users has no contributions in this namespace! "; return;} // var l = doc1.getElementsByTagName('li'); var name_list = '||'; var list_common = '||'; for (i=0; i<l.length; i++) {   if (l[i].getElementsByTagName('a')[2] != undefined) {   var name = l[i].getElementsByTagName('a')[2].innerHTML; name_list += name + '||'; } }  if (doc2.getElementsByTagName('ul')[0] != undefined) { var h = doc2.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li'); for (i=0; i<h.length; i++) {    var name = h[i].getElementsByTagName('a')[2].innerHTML; if (name_list.indexOf('||' + name + '||') != -1 && list_common.indexOf('||' + name + '||') == -1) {list_common += name + '||';} } } //  if (list_common == '||' || doc2.getElementsByTagName('ul')[0] == undefined) { document.getElementById('contentSub').innerHTML += " Done: comparison between edits by " + username_contribs_comp + " and " + username_contribs_comp2 + " finished. (no matches) "; var uls = body.getElementsByTagName('ul'); for (i=0; i<uls.length; i++) {    uls[i].innerHTML = ''; } var ps = body.getElementsByTagName('p'); for (i=1; i<ps.length; i++) {    ps[i].innerHTML = ''; } return; } // var txt_add = ''; var common_names = list_common.split('||'); for (i=1; i< common_names.length-1; i++) { var pgname = common_names[i]; var pglink = '<a href="/wiki/' + pgname + '" title="' + pgname + '">' + pgname + '</a>'; txt_add += " Page: " + pglink + " " + username_contribs_comp2 + "  <ul>"; for (k=0; k<h.length; k++) {     var name = h[k].getElementsByTagName('a')[2].innerHTML; if (name == pgname) {txt_add += '<li>' + h[k].innerHTML + '</li>';} }  txt_add += "</ul> " + username_contribs_comp + "  <ul>"; for (k=0; k<l.length; k++) {     if (l[k].getElementsByTagName('a')[2] != undefined) {        var name = l[k].getElementsByTagName('a')[2].innerHTML; if (name == pgname) {txt_add += '<li>' + l[k].innerHTML + '</li>';} }     }      txt_add += '</ul>' } // document.getElementById('contentSub').innerHTML += " Done: comparison between edits by " + username_contribs_comp + " and " + username_contribs_comp2 + " finished. "; body.getElementsByTagName('ul')[0].innerHTML = ''; var uls = body.getElementsByTagName('ul'); for (i=0; i<uls.length; i++) {uls[i].innerHTML = '';} var ps = body.getElementsByTagName('p'); for (i=1; i<ps.length; i++) {ps[i].innerHTML = '';} body.innerHTML += txt_add; edits_page_compared_js = 1; addTab("javascript:date_highlight", "date", "ca-datem", "Highlight a date", ""); body.ranSetupTooltipsAlready=false; setupTooltips(body); }

function contribs_reset { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } if (doc_js_ipcontribs_range_cache == '') { doc_js_ipcontribs_range_cache = body.innerHTML; } else {body.innerHTML = doc_js_ipcontribs_range_cache;} body.ranSetupTooltipsAlready=false; setupTooltips(body); }

function parse_xml_comparecontribs_log { if (xml_http.readyState != 4) {return;} doc2_xml_contribs_xml = xml_http.responseText; var namespace = ''; if (location.href.indexOf('&namespace=') !=-1) {namespace = location.href.split('&namespace=')[1].split('&')[0];} URL = '/w/index.php?title=Special:Log&type=block&limit=15&page=User%3A' + username_contribs_comp + '&useskin=none'; xml_http = HTTPClient; xml_http.open("GET", URL, true); xml_http.onreadystatechange = parse_xml_comparecontribs_log2; xml_http.send(null); }

function parse_xml_comparecontribs_log2 { if (xml_http.readyState != 4) {return;} doc1_xml_log_xml = xml_http.responseText; URL = '/w/index.php?title=Special:Log&type=block&limit=15&page=User%3A' + username_contribs_comp2 + '&useskin=none'; xml_http = HTTPClient; xml_http.open("GET", URL, true); xml_http.onreadystatechange = parse_xml_comparecontribs; xml_http.send(null); }

function parse_xml_comparecontribs { if (xml_http.readyState != 4) {return;} //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } document.getElementById('contentSub').innerHTML += " Parsing block log and contribs XML for users... "; doc2_xml_log_xml = xml_http.responseText; var user1block_count = 0; var user2block_count = 0; var user1edit_count = 0; var user2edit_count = 0; // var txt_add = ''; if (doc1_xml_log_xml.indexOf('<ul>') != -1 || doc2_xml_log_xml.indexOf('<ul>') != -1) { txt_add += ' '; txt_add += " Block log (last 20): "; } // if (doc2_xml_log_xml.indexOf('<ul>') != -1) { user2block_ul = '<ul>' + doc2_xml_log_xml.split('<ul>')[1].split('</ul>')[0] + '</ul>'; user2block_count = user2block_ul.split('</a>) blocked "<a').length - 1; txt_add += " " + username_contribs_comp2 + "  ";  txt_add += user2block_ul;  }  if (doc1_xml_log_xml.indexOf('<ul>') != -1)  {  user1block_ul = '<ul>' + doc1_xml_log_xml.split('<ul>')[1].split('</ul>')[0] + '</ul>';  user1block_count = user1block_ul.split('</a>) blocked "<a').length - 1; txt_add += " " + username_contribs_comp + " <ul>"; txt_add += user1block_ul; } if (doc1_xml_log_xml.indexOf('<ul>') != -1 || doc2_xml_log_xml.indexOf('<ul>') != -1) { txt_add += ' <br style="clear:both;">'; } // txt_add += ' '; txt_add += " Pages edited in common by " + username_contribs_comp + " and " + username_contribs_comp2 + " : "; // if (doc1_xml_contribs_xml.indexOf('<ul>') != -1) {user1edit_count = doc1_xml_contribs_xml.split('<ul>')[1].split('</ul>')[0].split('<li>').length - 1;} if (doc2_xml_contribs_xml.indexOf('<ul>') != -1) {user2edit_count = doc2_xml_contribs_xml.split('<ul>')[1].split('</ul>')[0].split('<li>').length - 1;} // var blocklink = '<a href = "/w/index.php?title=Special:Log&type=block&limit=20&page=User%3A' + username_contribs_comp + '">block(s)</a>'; var blocklink2 = '<a href = "/w/index.php?title=Special:Log&type=block&limit=20&page=User%3A' + username_contribs_comp2 + '">block(s)</a>'; //parse var doc1 = standard_XMLParse(doc1_xml_contribs_xml); var doc2 = standard_XMLParse(doc2_xml_contribs_xml); //check for any contribs if (doc1.getElementById('bodyContent').getElementsByTagName('li')[0] == undefined) {document.getElementById('contentSub').innerHTML += " Note: One of these users has no contributions in this namespace! "; return;} else if (doc2.getElementById('bodyContent').getElementsByTagName('li')[0] == undefined) {document.getElementById('contentSub').innerHTML += " Note: One of these users has no contributions in this namespace! "; return;} //compile a list of pages edited var User_talk1 = 'User talk:' + username_contribs_comp; var User_talk2 = 'User talk:' + username_contribs_comp2; var l = doc1.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li'); var name_list = '||'; var list_common = '||'; var list_talkbyuser1 = ''; var list_talkbyuser2 = ''; var list_afdbyuser1 = ''; var list_afdbyuser2 = ''; for (i=0; i<l.length; i++) { var name = l[i].getElementsByTagName('a')[2].innerHTML; name_list += name + '||'; if (name == User_talk2) {list_talkbyuser1 += '<li>' + l[i].innerHTML + '</li>';} else if (name.search(/.+ for Deletion|(Redirects|Categories) for [Dd]iscussion|Deletion review/) ==0) {list_afdbyuser1 += '<li>' + l[i].innerHTML + '</li>';} } //compile a list of pages edited in common (along with second talk page run) if (doc2.getElementsByTagName('ul')[0] != undefined) { var h = doc2.getElementById('bodyContent').getElementsByTagName('ul')[0].getElementsByTagName('li'); for (i=0; i<h.length; i++) {    var name = h[i].getElementsByTagName('a')[2].innerHTML; if (name_list.indexOf('||' + name + '||') != -1 && list_common.indexOf('||' + name + '||') == -1) {list_common += name + '||';} if (name == User_talk1) {list_talkbyuser2 += '<li>' + h[i].innerHTML + '</li>';} else if (name.search(/.+ for Deletion|(Redirects|Categories) for [Dd]iscussion|Deletion review/) ==0) {list_afdbyuser2 += '<li>' + h[i].innerHTML + '</li>';} } } //  if (list_common == '||' || doc2.getElementsByTagName('ul')[0] == undefined) { document.getElementById('contentSub').innerHTML += " Done: edit comparison between " + username_contribs_comp + " ( " + user1edit_count + " scanned) ( " + user1block_count + " " + blocklink + ") and " + username_contribs_comp2 + " ( " + user2edit_count + " scanned) ( " + user2block_count + " " + blocklink2 + ") finished. (no matches) "; body.getElementsByTagName('ul')[0].innerHTML = ''; document.getElementsByTagName('p')[1].innerHTML = ''; document.getElementsByTagName('p')[2].innerHTML = ''; return; } //return list of edits to pages in common var common_names = list_common.split('||'); for (i=1; i< common_names.length-1; i++) { var pgname = common_names[i]; var pglink = '<a href="/wiki/' + pgname + '" title="' + pgname + '">' + pgname + '</a>'; txt_add += " Page: " + pglink + " " + username_contribs_comp2 + "  <ul>"; for (k=0; k<h.length; k++) {     var name = h[k].getElementsByTagName('a')[2].innerHTML; if (name == pgname) {txt_add += '<li>' + h[k].innerHTML + '</li>';} }  txt_add += "</ul> " + username_contribs_comp + "  <ul>"; for (k=0; k<l.length; k++) {     var name = l[k].getElementsByTagName('a')[2].innerHTML; if (name == pgname) {txt_add += '<li>' + l[k].innerHTML + '</li>';} }     txt_add += '</ul>' } txt_add += ' <br style="clear:both;">'; //talk edit parsing if (list_talkbyuser1 !=  || list_talkbyuser2 != ) {    txt_add += ' '; txt_add += " User talk interaction "; } if (list_talkbyuser2 != '') {    txt_add += " Edits by " + username_contribs_comp2 + " to talk page of " + username_contribs_comp + "  <ul>" + list_talkbyuser2 + "</ul>"; } if (list_talkbyuser1 != '') {    txt_add += " Edits by " + username_contribs_comp + " to talk page of " + username_contribs_comp2 + "  <ul>" + list_talkbyuser1 + "</ul>"; } txt_add += ' <br style="clear:both;">'; //AFD parsing if (list_afdbyuser1 !=  && list_afdbyuser2 != ) {    txt_add += ' '; txt_add += " Edits to deletion pages "; txt_add += " " + username_contribs_comp2 + " <ul>" + list_afdbyuser2 + "</ul>"; txt_add += " " + username_contribs_comp + " <ul>" + list_afdbyuser1 + "</ul>"; } txt_add += ' <br style="clear:both;">'; //Finish document.getElementById('contentSub').innerHTML += " Done: edit comparison between " + username_contribs_comp + " ( " + user1edit_count + " scanned) ( " + user1block_count + " " + blocklink + ") and " + username_contribs_comp2 + " ( " + user2edit_count + " scanned) ( " + user2block_count + " " + blocklink2 + ") finished. "; body.getElementsByTagName('ul')[0].innerHTML = ''; document.getElementsByTagName('p')[1].innerHTML = ''; document.getElementsByTagName('p')[2].innerHTML = ''; body.innerHTML += txt_add; edits_page_compared_js = 1; addTab("javascript:date_highlight", "date", "ca-datem", "Highlight a date", "f"); body.ranSetupTooltipsAlready=false; setupTooltips(body); } //////////////////// function date_highlight { //monobook if (document.getElementById('bodyContent')) { var body = document.getElementById('bodyContent'); } //cologneblue else if (document.getElementById('quickbar')) { if (!document.getElementById('content')){return;} var body = document.getElementById('content'); } if (!body.getElementsByTagName('li')[0]){return;} var date = prompt('This will highlight a certain date.' + '\n' + 'Enter a date fragment:' + '\n' + '(example: "August 7, 2006")'); if (!date){return;} var l = body.getElementsByTagName('li'); for (var i=0; i<l.length; i++) { l[i].innerHTML = l[i].innerHTML.replace(/<span style="background-color:.+"><i>(.+)<\/i><\/span>/i,'$1'); if (l[i].innerHTML.split('(<a href="')[0].indexOf(date) !=-1)   {l[i].innerHTML = '  + l[i].innerHTML +  ';}  }  body.ranSetupTooltipsAlready=false;  setupTooltips(body); }

function deletehist { if (location.href.search(/Special:Log\/delete|&type=delete/) !=-1) { var ul = document.getElementById('bodyContent').getElementsByTagName('ul')[0]; if (!ul || !ul.getElementsByTagName('li')[0]){return;} var l = ul.getElementsByTagName('li'); //admin or sysop viewing this? if (l[0].innerHTML.indexOf('">block</a>)') ==-1){return;} for (var i=0; i<l.length; i++)     {     var name = l[i].getElementsByTagName('a')[4].innerHTML;     l[i].innerHTML = '<a href="/wiki/Special:Undelete/' + name + '">(review)</a> ' + l[i].innerHTML;     }  } }

function blockhist { if (location.href.search(/Special:(Log\/block|Blockip)|&type=block/) !=-1) { var ul = document.getElementById('bodyContent').getElementsByTagName('ul')[0]; if (!ul || !ul.getElementsByTagName('li')[0]){return;} var l = ul.getElementsByTagName('li'); //admin or sysop viewing this? if (l[0].innerHTML.indexOf('">block</a>)') ==-1){return;} //unblock links if (location.href.search(/&page=[^&]/) ==-1)     {     for (var i=0; i<l.length; i++)       {         if (l[i].getElementsByTagName('a')[4])         {     var name = l[i].getElementsByTagName('a')[4].innerHTML;     l[i].innerHTML = '(<a href="/w/index.php?title=Special%3ALog&type=block&page=User:' + name + '">hist</a>) (<a href="/w/index.php?title=Special%3AIpblocklist&action=search&limit=&ip=' + name + '">status</a>) ' + l[i].innerHTML;         }       }     }  else     {     var name = l[0].getElementsByTagName('a')[4].innerHTML;     l[0].innerHTML = '(<a href="/w/index.php?title=Special%3AIpblocklist&action=search&limit=&ip=' + name + '">status</a>) ' + l[0].innerHTML;     }  } }

//options addOnloadHook(SA_main_functions) function SA_main_functions { jswin_close; deletehist; blockhist; winclosed; Compare_tab_add; IPRange_contribs; IPRange_contribs_tab; } //

//END