User:Mets501/Protection monobook.js

// VoABot_on=1;

//This function sets the selected values on the Confirm protection page $(WP_PP_helper); function WP_PP_helper { if (document.title.indexOf('Wikipedia:List of protected pages') !=0) return; if (document.title.indexOf('/') !=-1) return; if (location.href.search(/&action=/) !=-1) return; var l =document.getElementById('bodyContent').getElementsByTagName('li'); for (var i=0; i (release)  ' + l[i].innerHTML; }  } }

function WP_PP_unprotect(title) { var URL = mw.config.get('wgServer') + mw.config.get('wgScriptPath') + '/index.php?title=' + escape(title) + '&action=edit&jsaction=release'; window.open(URL,'WP:AUTOunpro:' + title,'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); }

function jssubmitclose { var form = document.getElementById('editform'); form.submit; }

//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 + '" '; } } }

//Auto-replace function autoreplacetxt(s,r) { var original = document.editform.wpTextbox1.value; if(s) { if(!r && r != '') {alert('Action cancelled.'); return;} var txt = document.editform.wpTextbox1; txt.value = txt.value.replace(new RegExp(s, "g"), r); } }

$(protection_tabs); function protection_tabs { var non_art = /Talk:| talk:|User:|MediaWiki:|Image:|Wikipedia:|Template:|Portal:|Help:|Main Page|Category:/; if (document.title.indexOf("Editing User talk:") != -1) {     addToolboxLink("javascript:usprotect","(Semi-Protect)","sem-pro",","); addToolboxLink("javascript:ufprotect","(Full-Protect)","full-pro","."); if(document.getElementById('ca-unprotect')) {addToolboxLink("javascript:uunprotect","(Un-Protect)","un-pro","/");} }   else if (document.title.indexOf("Editing User:") != -1) {       addToolboxLink("javascript:usprotect","(Semi-Protect)","sem-pro",","); addToolboxLink("javascript:ufprotect","(Full-Protect)","full-pro","."); if(document.getElementById('ca-unprotect')) {addToolboxLink("javascript:uunprotect","(Un-Protect)","un-pro","/");} } else if (document.title.indexOf("Editing Wikipedia:Requests for page protection (section)") != -1) {       var tabs = document.getElementById('p-cactions').getElementsByTagName('ul')[0]; addlimenu(tabs, 'Sysop response', 'respfunc'); var respfunc = document.getElementById('respfunc').getElementsByTagName('ul')[0]; addlilink(respfunc, 'javascript:rfpps',"semi-pro", ''); addlilink(respfunc, 'javascript:rfppp',"full-pro", ''); addlilink(respfunc, 'javascript:rfppm',"move-pro", ''); addlilink(respfunc, 'javascript:rfpprv',"!semi-pro", ''); addlilink(respfunc, 'javascript:rfppr',"!full-pro", ''); addlilink(respfunc, 'javascript:rfppun',"un-protect", ''); addlilink(respfunc, 'javascript:rfpprus',"keep s-pro", ''); addlilink(respfunc, 'javascript:rfppruf',"keep f-pro", ''); addlilink(respfunc, 'javascript:rfppb',"block user", ''); addlilink(respfunc, 'javascript:rfppu',"other sysop", ''); addlilink(respfunc, 'javascript:rfppbot',"VoABot", ''); } //This line removes a minor glitch else if (document.title.indexOf("Editing Wikipedia:Administrators' noticeboard/3RR (section)") != -1 || document.title.indexOf("Editing Help:Contents/Editing Wikipedia") != -1 || document.title.indexOf("Help:Contents/Editing Wikipedia") != -1) {   var nothing = 'yep!'; } else if(document.title.indexOf("Editing Talk:") != -1 || document.title.indexOf("Editing Wikipedia talk:") != -1 || document.title.indexOf("Editing Template talk:") != -1 || document.title.indexOf("Editing MediaWiki talk:") != -1 || document.title.indexOf("Editing Help talk:") != -1 || document.title.indexOf("Editing Portal talk:") != -1 || document.title.indexOf("Editing Image talk:") != -1) {     if(document.getElementById('ca-protect')) {     addToolboxLink("javascript:osprotect","(Semi-Protect)","sem-pro",","); addToolboxLink("javascript:oprotect","(Full-Protect)","full-pro","."); }     if(document.getElementById('ca-unprotect')) {     addToolboxLink("javascript:usprotect","(Semi-Protect)","sem-pro",","); addToolboxLink("javascript:ufprotect","(Full-Protect)","full-pro","."); addToolboxLink("javascript:ounprotect","(Un-Protect)","un-pro","/"); }   } else if(document.title.indexOf("Editing Wikipedia:") != -1 || document.title.indexOf("Editing Template:") != -1 || document.title.indexOf("Editing Category:") != -1 || document.title.indexOf("Editing MediaWiki:") != -1 || document.title.indexOf("Editing Portal:") != -1 || document.title.indexOf("Editing Help:") != -1 || document.title.indexOf("Editing Image:") != -1) {     if(document.getElementById('ca-protect')) {     addToolboxLink("javascript:usprotect","(Semi-Protect)","sem-pro",","); addToolboxLink("javascript:ufprotect","(Full-Protect)","full-pro","."); }     if(document.getElementById('ca-unprotect')) {addToolboxLink("javascript:ounprotect","(Un-Protect)","un-pro","/");} } else {       if(document.getElementById('ca-protect')) {     addToolboxLink("javascript:sprotect","(Semi-Protect)","sem-pro",","); addToolboxLink("javascript:protect","(Full-Protect)","full-pro","."); }     if(document.getElementById('ca-unprotect')) {addToolboxLink("javascript:unprotect","(Un-Protect)","un-pro","/");} } }

////////////////////WP:PP variables//////////////////// //This is for if people skrew with the WP:PP page layout var WPPPoffset=3; var allartsec = 9 - WPPPoffset; var movesec = 7 - WPPPoffset; var artfull = 10 - WPPPoffset; var artsemi = 11 - WPPPoffset; var otherpro = 13 - WPPPoffset; var userfull = 16 - WPPPoffset; var usersemi = 17 - WPPPoffset; var regtalk = 18 - WPPPoffset; var anontalk = 19 - WPPPoffset; var VoAsection = 12 - WPPPoffset; //End of WP:PP constants ////////////////////

function protect { var message = "Are you sure you want to full-protect this page?"; var return_value = confirm(message); if (return_value == true) { var z_check = ''; var target = document.title.split("Editing ")[1].split(" - ")[0]; jstarget = URLEncoding(target); if (document.editform.wpTextbox1.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search(/\{\{[Ss]protect|\{\{[Pp]rotect/) != -1) {var z_check = 'notag';} else { 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;} } document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value += '+'; if (VoABot_on == 0) { window1 = window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artfull + '&jsaction=plist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=fprotect',             'targetname2',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); jssubmitclose; return; } if (z_check == 'notag') { alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually."); return; } } }

function sprotect { var message = "Are you sure you want to semi-protect this page?"; var return_value = confirm(message); if (return_value == true) { var z = ''; var target = document.title.split("Editing ")[1].split(" - ")[0]; jstarget = URLEncoding(target); if (document.editform.wpTextbox1.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search(/\{\{[Ss]protect|\{\{[Pp]rotect/) != -1) {var z_check = 'notag';} else { 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;} } document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value += '+'; if (VoABot_on == 0) { window1 = window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + artsemi + '&jsaction=plist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=sprotect',             'targetname2',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); jssubmitclose; return; } if (z == 'notag') { alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually."); return; } } }

function usprotect { var z_check = ''; if (document.title.indexOf("Editing User talk") != -1) {   value = 't'; } if (document.title.indexOf("Editing User:") != -1) {   value = 'u'; } var reg = ''; var target = document.title.split("Editing ")[1].split(" - ")[0]; jstarget = URLEncoding(target); if (document.editform.wpTextbox1.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search(/\{\{[Ss]protect|\{\{[Pp]rotect/) != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search(/\{\{[Uu]sertalk-sprotect|\{\{[Ss]utprotected/) != -1) {var z_check = 'notag';} if (z_check == 'notag') {   alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually."); return; } else { if (value == 'u') {     var act = 'u'; type = 17; } else if (value == 't') {     var act = 'ut'; var reg = prompt('Is this an anon or a registered user (enter *a* or *r*)?'); if (reg == 'a') {           type = 19; }        else if (reg == 'r') {           type = 18; }        else {           alert("Error: Invalid input. Make sure you are not actually including the asterisk symbols."); return; }     }  else {     alert("Error: Invalid input. Make sure you are not actually including the asterisk symbols."); return; } 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;} } document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value += '+'; window1 = window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + type + '&jsaction=' + act + 'plist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=sprotect',             'targetname2',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); return; } }

function ufprotect { var z_check = ''; if (document.title.indexOf("Editing User:") != -1) {   value = 'u'; } var reg = ''; var target = document.title.split("Editing ")[1].split(" - ")[0]; jstarget = URLEncoding(target); if (document.editform.wpTextbox1.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search(/\{\{[Ss]protect|\{\{[Pp]rotect/) != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search(/\{\{[Uu]sertalk-sprotect|\{\{[Ss]utprotected/) != -1) {var z_check = 'notag';} if (z_check == 'notag') {   alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually."); return; } else { if (value == 'u') {     var act = 'u'; type = 16; } 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;} } document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value += '+'; window1 = window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + type + '&jsaction=' + act + 'plist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=fprotect',             'targetname2',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); return; } }

function oprotect { var z = ''; var target = document.title.split("Editing ")[1].split(" - ")[0]; jstarget = URLEncoding(target); if (document.editform.wpTextbox1.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} if (z == 'notag') {   alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually."); return; } else { 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;} } document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value += '+'; window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&jsaction=oplist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=fprotect',             'targetname2',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } }

function osprotect { var z =''; var target = document.title.split("Editing ")[1].split(" - ")[0]; jstarget = URLEncoding(target); if (document.editform.wpTextbox1.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1) {z_check = 'notag';} else if (document.editform.wpTextbox1.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1) {var z_check = 'notag';} if (z == 'notag') { alert("Error: A protection tag is already on this page. If this tag is supposed to be part of the text, then add the desired protection tag manually."); } else { 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;} } document.editform.wpTextbox1.value = '\n' + document.editform.wpTextbox1.value; document.editform.wpSummary.value += '+'; window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + otherpro + '&jsaction=oplist&fakeaction=' + target,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=sprotect',             'targetnameo',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } }

function unprotect { var message = "Are you sure you want to unprotect this page?"; var auto='&auto=0'; if (location.href.indexOf('&jsaction=release') ==-1) {var return_value = confirm(message);} else {return_value=true; auto='&auto=1';} if (return_value == true) { var original = document.editform.wpTextbox1.value; jstarget = URLEncoding(mw.config.get('wgTitle')); if (document.editform.wpTextbox1.value.search(/\{\{sprotect\}\}/i) !=-1) { whattag = 'sprotect'; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{sprotect\|.+\}\}/i) !=-1) { whattag = document.editform.wpTextbox1.value.match(/\{\{sprotect\|.+\}\}/i)[0].split('')[0]; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{sprot\}\}/i) !=-1) { whattag = document.editform.wpTextbox1.value.match(/\{\{sprot\}\}/i)[0].split('')[0]; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{sprotected\}\}/i) !=-1) { whattag = 'sprotected'; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{semiprotect\}\}/i) !=-1) { whattag = 'semiprotect'; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{semiprotected\}\}/i) !=-1) { whattag = 'semiprotected'; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{semi-protected\}\}/i) !=-1) { whattag = 'semi-protected'; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{sprotect-banneduser\}\}/i) !=-1) { whattag = 'sprotect-banneduser'; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{sprotected-banneduser\}\}/i) !=-1) { whattag = 'sprotected-banneduser'; whattype = artsemi; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{vprotect\}\}/i) !=-1) { whattag = 'vprotect'; whattype = artfull; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{vprotected\}\}/i) !=-1) { whattag = 'vprotected'; whattype = artfull; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{Vprotect\}\}/i) !=-1) { whattag = 'Vprotect'; whattype = artfull; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{Vprotected\}\}/i) !=-1) { whattag = 'Vprotected'; whattype = artfull; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{protect\}\}/i) !=-1) { whattag = 'protect'; whattype = artfull; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{protected\}\}/i) !=-1) { whattag = 'protected'; whattype = artfull; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{Protect\}\}/i) !=-1) { whattag = 'Protect'; whattype = artfull; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{Protected\}\}/i) !=-1) { whattag = 'Protected'; whattype = artfull; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{moveprotect\}\}/i) !=-1) { whattag = 'moveprotect'; whattype = movesec; var go = 'yes'; } else if (document.editform.wpTextbox1.value.search(/\{\{moveprotected\}\}/i) !=-1) { whattag = 'moveprotected'; whattype = movesec; var go = 'yes'; } else { alert("Error: There is no recognized protection tag on this page."); location.href = 'http://en.wikipedia.org/w/index.php?title=' + mw.config.get('wgTitle').replace(/&/g,"%26") + '&action=protect&jsaction=unprotect'; return; } if (go == 'yes') { 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;} } document.editform.wpSummary.value += 'Unprotected page -- removing tag'; var whattag_upper = whattag.substring(0,1).toUpperCase + whattag.substring(1,whattag.length); document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(,); document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(,); if (VoABot_on==0) { window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + whattype + '&jsaction=pdelist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } window.open('http://en.wikipedia.org/w/index.php?title=' + mw.config.get('wgTitle').replace(/&/g,"%26") + '&action=protect&jsaction=unprotect' + auto,             'WP:unpro:' + mw.config.get('wgTitle'),    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); jssubmitclose; } } }

function ounprotect { var undefined; var original = document.editform.wpTextbox1.value; var target = document.title.split("Editing ")[1].split(" - ")[0]; jstarget = URLEncoding(target); if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   whattag = 'sprotect'; whattype = otherpro; var go = 'yes'; } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   whattag = 'sprotected'; whattype = otherpro; var go = 'yes'; } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   whattag = 'vprotect'; whattype = otherpro; var go = 'yes'; } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   whattag = 'vprotected'; whattype = otherpro; var go = 'yes'; } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   whattag = 'protect'; whattype = otherpro; var go = 'yes'; } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   whattag = 'protected'; whattype = otherpro; var go = 'yes'; } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   whattag = 'moveprotect'; whattype = movesec; var go = 'yes'; } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   whattag = 'moveprotected'; whattype = movesec; var go = 'yes'; } else { alert("Error: There is no recognized protection tag on this page."); } if (go == 'no') { alert("Error: The protection tag is preceded by text (in which case you have to remove it manually)."); } if (go == 'yes') { 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;} } document.editform.wpSummary.value += 'Unprotected page -- removing tag'; document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(,); if (VoABot_on ==0) { window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + whattype + '&jsaction=pdelist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=unprotect',             'targetnamep',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } }

//USERPAGE UNPROTECT function uunprotect { var gotagged = 'no'; var gonotagged = 'no'; if (document.title.indexOf("Editing User talk:") != -1) {   value = 't'; } if (document.title.indexOf("Editing User:") != -1) {   value = 'u'; } var original = document.editform.wpTextbox1.value; var target = document.title.split("Editing ")[1].split(" - ")[0]; jstarget = URLEncoding(target); if (value == 'u') {     type = 17; } else if (value == 't') {     var reg = prompt('Is this an anon or a registered user (enter *a* or *r*)?'); if (reg == 'a') {           type = 19; }        else if (reg == 'r') {           type = 18; }        else {           alert("Error: Invalid input. Make sure you are not actually including the asterisk symbols."); return; }     }  else {     alert("Error: Invalid input. Make sure you are not actually including the asterisk symbols."); return; } //Tag search if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'sprotect'; type = usersemi; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'sprotect'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'sprotect'; type = regtalk; }     }   } }  else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'vprotect'; type = userfull; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'vprotect'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'vprotect'; type = regtalk; }     }   } }  else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'vutprotected'; type = userfull; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'vutprotected'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'vutprotected'; type = regtalk; }     }   } } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'vprotected'; type = userfull; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'vprotected'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'vprotected'; type = regtalk; }     }   } }  else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'sprotected'; type = usersemi; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'sprotected'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'sprotected'; type = regtalk; }     }   } } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'Usertalk-sprotect'; type = usersemi; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'Usertalk-sprotect'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'Usertalk-sprotect'; type = regtalk; }     }   } } else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'usertalk-sprotect'; type = usersemi; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'usertalk-sprotect'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'usertalk-sprotect'; type = regtalk; }     }   } }  else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'unblockabuse'; type = userfull; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'protect'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'protect'; type = regtalk; }     }   } }  else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'protect'; type = userfull; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'protect'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'protect'; type = regtalk; }     }   } }  else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) {    if (value == 'u') { gotagged = 'yes'; tagtype = 'protected'; type = userfull; }    else if (value == 't') {       if (reg == 'a') { gotagged = 'yes'; tagtype = 'protected'; type = anontalk; }       else if (reg == 'r') { gotagged = 'yes'; tagtype = 'protected'; type = regtalk; }     }   } }  else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) { document.editform.wpSummary.value += 'Unprotected'; document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('')[1]; }  }  else if (document.editform.wpTextbox1.value.split('')[1] != undefined) {   if (document.editform.wpTextbox1.value.split()[0] == ) { document.editform.wpSummary.value += 'Unprotected'; document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('')[1]; }  } //No tag found...what now? else { var message = "Note: Either there is no recognized protection tag on this page or it is preceded by text. Press OK to continue."; var return_value = confirm(message); //If they click OK if (return_value == true) {   if (value == 't') {    if (reg == 'a') { window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + anontalk + '&jsaction=pdelist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); gonotagged = 'yes'; }    else if (reg == 'r') { window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + regtalk + '&jsaction=pdelist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); gonotagged = 'yes'; }    else {    alert("An unknown error has occured."); }    }    if (value == 'u') { var level = prompt("Page no longer semi or fully protected (enter *s* or *f*)?"); if (level == 's') { window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + usersemi + '&jsaction=pdelist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); gonotagged = 'yes'; }    else if (level == 'f') { window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + userfull + '&jsaction=pdelist&fakeaction=' + target,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); gonotagged = 'yes'; }    else {      alert("Invalid input."); return; }     }   else if (value != 'u' && value != 't') {     alert("An unknown page recognition error has occured."); }    }   else {   document.editform.wpSummary.value += ""; return; }   }  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;} } if (gotagged == 'yes') { document.editform.wpSummary.value += 'Unprotected'; var whattag_upper = tagtype.substring(0,1).toUpperCase + tagtype.substring(1,whattag.length); document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(,); document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(,); var windowpp = window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=' + type + '&jsaction=pdelist&fakeaction=' + jstarget,             'targetname',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); var windowcp = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=unprotect',             'targetnameu',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } if (gonotagged == 'yes') { var windowcp = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=unprotect',             'targetnameu',    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes'); } } //

//This function sets the selected values on the Confirm protection page $(auto_protect); function auto_protect { if (document.title.indexOf('Editing ') ==0) {   if (location.href.indexOf('&jsaction=release') !=-1) {      if (!document.getElementById('ca-unprotect')){window.close; return;} unprotect; }   }  else if (document.title.indexOf('Confirm protection') ==0) {     var auto = '0'; var action = ''; var target = ''; if (location.search) {         var l = location.search.substring(1).split('&'); for (var i = 0; i < l.length; ++i) {             var eq = l[i].indexOf('='); var name = l[i].substring(0, eq); if (name == 'jsaction') action = l[i].substring(eq + 1); else if (name == 'jstarget') target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' '); else if (name == 'auto') auto = unescape(l[i].substring(eq + 1)).replace(/_/g, ' '); }        }      var edit = document.getElementById('mwProtect-level-edit'); var move = document.getElementById('mwProtect-level-move'); if (action == 'unprotect') {        var reasonbox = document.getElementById('mwProtect-reason'); reasonbox.value = 'Page protected for a while; hopefully protection is no longer necessary.'; if (document.getElementsByTagName('option')[2].selected==true) {reasonbox.value = 'Page locked for a while and dispute seems to have resolved/ended.';} //move (allow,semi,full) move.getElementsByTagName('option')[0].selected=true; move.getElementsByTagName('option')[1].selected=false; move.getElementsByTagName('option')[2].selected=false; //edit (allow,semi,full) edit.getElementsByTagName('option')[0].selected=true; edit.getElementsByTagName('option')[1].selected=false; edit.getElementsByTagName('option')[2].selected=false; }     else if (action == 'sprotect') { //move (allow,semi,full) move.getElementsByTagName('option')[0].selected=false; move.getElementsByTagName('option')[1].selected=true; move.getElementsByTagName('option')[2].selected=false; //edit (allow,semi,full) edit.getElementsByTagName('option')[0].selected=false; edit.getElementsByTagName('option')[1].selected=true; edit.getElementsByTagName('option')[2].selected=false; document.getElementById('mwProtect-reason').value = 'Heavy vandalism from multiple sources.'; }     if (action == 'fprotect') { //move (allow,semi,full) move.getElementsByTagName('option')[0].selected=false; move.getElementsByTagName('option')[1].selected=false; move.getElementsByTagName('option')[2].selected=true; //edit (allow,semi,full) edit.getElementsByTagName('option')[0].selected=false; edit.getElementsByTagName('option')[1].selected=false; edit.getElementsByTagName('option')[2].selected=true; document.getElementById('mwProtect-reason').value = 'Users engaging in edit warring.'; }   if (auto=='1') {document.getElementsByTagName('form')[0].click;} } } //END

//RFPP tabs

function rfppp { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": Fully protected due to revert warring. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: page fully protected"; }

function rfpps { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": Semi-protected due to heavy vandalism. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: page semi-protected"; }

function rfppm { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": Move-protected due to excessive renaming. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: page move-protected"; }

function rfppun { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": Un-protected. It's been protected for long enough. Hopefully things have calmed down since then. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: page un-protected"; }

function rfppu { var pro = prompt("A user already protected or un-protected (enter *p* or *u*)?") if (pro == 'p') { value = 'protected'; } else if (pro == 'u') { value = 'un-protected'; } else { alert("Error: Invalid input. Make sure that you are not actually including the aterisk symbols."); return; } var user = prompt("What user?") if (!user){return;} usera = user.replace(/ /g,'_'); var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": Page " + value + "+ usera + " by " + user + "" + ". " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: " + value + " by another Sysop"; }

function rfpprus { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": Its still to soon to un-protect since the wave of vandalism will likely continue immediately after un-protection. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: un-protection request denied"; }

function rfppruf { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": The reasonable issues that started the revert war do not yet seem to have been resolved. It is also too soon to assume that the editors have lost enough interest. Consider adding  to the page's talk page to request small modifications, or making a significant edit request on this page for large edits that are agreed upon. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: un-protection request denied"; }

function rfppr { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": There is not enough recent activity to justify protection at this time. For now, be sure to use descriptive edit summaries and discuss edits on talk. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: protection request denied"; }

function rfpprv { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": There is not enough recent activity to justify protection at this time. Just watchlist and revert any vandalism. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: protection request denied"; }

function rfppb { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": The user has been blocked from editing. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: user blocked"; }

function rfppbot { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": The page is now monitored for changes by a bot. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: page monitored by bot"; }

function rfppap { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": The page is already protected. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: page already protected"; }

function rfppau { var f = document.editform, t = f.wpTextbox1; if (t.value.length > 0) t.value += '\n'; t.value +=": The page is not actually protected. " + "~" + "~" + "~" + "~"; f.wpSummary.value += "Response: page was not protected"; }

//