User:Voice of All/Protection/monobook.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
The accompanying .css page for this skin can be added at User:Voice of All/Protection/monobook.css. |
//<pre><nowiki>
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()
{
document.getElementById('editform').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);
}
}
addOnloadHook(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 ") != -1)
{
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 [[Category:VoA scripted admins]]
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:unprotect()","(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:unprotect()","(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","/");}
}
}
else if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1)
{
var nothing = 'yep!';
}
}
////////////////////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);
var txtbox = document.editform.wpTextbox1;
if (txtbox.value.search('\\{\\{\w\w-(semi|full)-protected\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.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 = '{{protected' + '}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value += '+{{protected' + '}}';
window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=fprotect',
'Page protect',
'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);
var txtbox = document.editform.wpTextbox1;
if (txtbox.value.search('\\{\\{\w\w-(semi|full)-protected\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.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 = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value += '+{{sprotected' + '}}';
window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=sprotect',
'Page protect',
'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);
var txtbox = document.editform.wpTextbox1;
if (txtbox.value.search('\\{\\{\w\w-(semi|full)-protected\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.value.search(/\{\{[Ss]protect|\{\{[Pp]rotect/) != -1)
{var z_check = 'notag';}
else if (txtbox.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 = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value += '+{{sprotected' + '}}';
window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=sprotect',
'Page protect',
'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);
var txtbox = document.editform.wpTextbox1;
if (txtbox.value.search('\\{\\{\w\w-(semi|full)-protected\\}\\}') != -1)
{z_check = 'notag';}
if (txtbox.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.value.search(/\{\{[Ss]protect|\{\{[Pp]rotect/) != -1)
{var z_check = 'notag';}
else if (txtbox.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 = '{{Vprotected' + '}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value += '+{{Vprotected' + '}}';
window2 = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=fprotect',
'Page protect',
'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);
var txtbox = document.editform.wpTextbox1;
if (txtbox.value.search('\\{\\{\w\w-(semi|full)-protected\\}\\}') != -1)
{z_check = 'notag';}
if (txtbox.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.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 = '{{protected' + '}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value += '+{{protected' + '}}';
window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=fprotect',
'Page protect',
'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);
var txtbox = document.editform.wpTextbox1;
if (txtbox.value.search('\\{\\{\w\w-(semi|full)-protected\\}\\}') != -1)
{z_check = 'notag';}
if (txtbox.value.search('\\{\\{[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)[Ss]protect(ed|-banneduser)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.value.search('\\{\\{[Mm]oveprotect(ed)\\}\\}') != -1)
{var z_check = 'notag';}
else if (txtbox.value.search('\\{\\{(tl\\|)(Vp|vp|P|p)rotect(ed)\\}\\}') != -1)
{z_check = 'notag';}
else if (txtbox.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 = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
document.editform.wpSummary.value += '+{{sprotected' + '}}';
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';
var m = null;
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(m = document.editform.wpTextbox1.value.match(/\{\{(\w\w-|)semi-protected(2|)\}\}/) )
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{(\w\w-|)full-protected(2|)\}\}/) )
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{(\w\w-|)semi-protected(\|small=\w{2,3}|)\}\}/) )
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{(\w\w-|)full-protected(\|small=\w{2,3}|)\}\}/) )
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{pp-(dispute|vandalism)\}\}/) )
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{sprot(ect|ected|)(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{semiprotect(ed|)(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{sprotect-banneduser(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{sprotected-banneduser(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{vprotect(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{vprotected(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{Vprotect(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{Vprotected(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{protect(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{protected(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{Protect(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{moveprotect(2|)\}\}/i))
{
whattag = m[0];
}
else if(m = document.editform.wpTextbox1.value.match(/\{\{moveprotected(2|)\}\}/i))
{
whattag = m[0];
}
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;
}
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(whattag,'');
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();
}
}
//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('{{sprotect}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{sprotect}}')[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('{{vprotect}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{vprotect}}')[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('{{vutprotected}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{vutprotected}}')[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('{{vprotected}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{vprotected}}')[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('{{sprotected}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{sprotected}}')[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('{{Usertalk-sprotect}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[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('{{usertalk-sprotect}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[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('{{unblockabuse}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{unblockabuse}}')[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('{{protect}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{protect}}')[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('{{protected}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{protected}}')[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('{{moveprotect}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{moveprotect}}')[0] == '')
{
document.editform.wpSummary.value += 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotect}}')[1];
}
}
else if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
{
if (document.editform.wpTextbox1.value.split('{{moveprotected}}')[0] == '')
{
document.editform.wpSummary.value += 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotected}}')[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')
{
gonotagged = 'yes';
}
else if (reg == 'r')
{
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')
{
gonotagged = 'yes';
}
else if (level == 'f')
{
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('{{' + tagtype + '}}','');
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace('{{' + whattag_upper + '}}','');
var windowcp = window.open('http://en.wikipedia.org/w/index.php?title=' + target.replace(/&/g,"%26") + '&action=protect&jsaction=unprotect',
'Page unprotect',
'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',
'Page unprotect',
'location=no,toolbar=no,status=no,directories=no,scrollbars=yes,fullscreen=yes');
}
}
//
//This function sets the selected values on the Confirm protection page
addOnloadHook(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 (location.href.indexOf('&action=protect') !=-1)
{
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.';
document.getElementById('expires').value = '5 days';
}
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.';
document.getElementById('expires').value = 'infinite';
}
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 +=":{{RFPP|p}} due to [[Wikipedia:Edit war|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 +=":{{RFPP|s}} 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 +=":{{RFPP|m}} 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 +=":{{RFPP|u}} 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 +=":{{RFPP|d}} Page " + value + "[http://en.wikipedia.org/w/index.php?title=Special:Log/protect&user=" + usera + "] by [[user:" + user + "|" + 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 +=":{{RFPP|d}} It's still too soon to un-protect since the wave of [[Wikipedia:Vandalism|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 +=":{{RFPP|d}} The [[WP:AGF|reasonable]] issues that started the [[Wikipedia:Edit war|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 <no" + "wiki>{{Editprotected}}</nowiki> 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 +=":{{RFPP|d}} There is not enough recent activity to [[Wikipedia:Protection_policy#Uses|justify]] [[Wikipedia:Protection policy|protection]] at this time. For now, be sure to use descriptive [[Wikipedia:Edit summary|edit summaries]] and discuss edits on [[Wikipedia:Talk pages|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 +=":{{RFPP|d}} There is not enough recent activity to [[Wikipedia:Protection_policy#Uses|justify]] [[Wikipedia:Semi-protection_policy|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 +=":{{RFPP|b}} " + "~" + "~" + "~" + "~";
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 +=":{{RFPP|n}} The page is now monitored for changes by a [[User:VoABot II|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 +=":{{RFPP|ap}} 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 +=":{{RFPP|au}} The page is not actually protected. " + "~" + "~" + "~" + "~";
f.wpSummary.value += "Response: page was not protected";
}
function URLEncoding(input)
{
var encodedInputString=escape(input);
encodedInputString=encodedInputString.replace(/\+/g, "%2B");
encodedInputString=encodedInputString.replace(/\//g,"%2F");
encodedInputString=encodedInputString.replace(/&/g,"%26");
var outputurl=encodedInputString;
return outputurl;
}
//</nowiki></pre>