Misplaced Pages

User:Voice of All/Protection/monobook.js

Article snapshot taken from[REDACTED] with creative commons attribution-sharealike license. Give it a read and then ask your questions in the chat. We can research this topic together.
< User:Voice of All

This is an old revision of this page, as edited by Aaron Schulz (talk | contribs) at 09:39, 11 June 2006 (m). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Revision as of 09:39, 11 June 2006 by Aaron Schulz (talk | contribs) (m)(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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.
Note: After saving, you have to bypass your browser's cache to see the changes. Google Chrome, Firefox, Microsoft Edge and Safari: Hold down the ⇧ Shift key and click the Reload toolbar button. For details and instructions about other browsers, see Misplaced Pages:Bypass your cache.
//<pre><nowiki>
//Helper tools

function strip_namespace(target)
{
  var colon = target.indexOf(':');
  if (colon != -1)
    {
      var spaces = new Array('User', 'Misplaced Pages', 'Image', 'MediaWiki', 'Template', 'Help', 'Category');
      var ns = target.substring(0, colon);
      if (ns == '' || ns == 'Talk')
        return target.substring(colon + 1);
      else
        for (var i = 0; i < spaces.length; ++i)
          {
            if (ns == spaces
                || ns == spaces + '_talk')
              return target.substring(colon + 1);
          }
    }

  return target;
}
//END

function jssubmitclose()
{
var form = document.getElementById('editform');
form.submit();
setTimeout('window.close()',12000);
}
//END

//Auto-replace
function oldautoreplacetxt(what,withw)
{
var undefined;
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) != undefined) {alert("Action cancelled to avoid infinite loop."); return;}
else {
if (document.editform.wpTextbox1.value.split(what) != undefined)
 {
  while (i == 1)
  {
  document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace(what, withw);
  if (document.editform.wpTextbox1.value.indexOf(what) != -1)
  {i = 1;}
  else
  {i = -1;}
  }
 }
//document.editform.wpSummary.value += 'JS: Replacing text "' + what + '" with "' + withw + '" ';
  }
 }
}
//END

//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);
 }
}
//END

// ============= test-n.js ==============
function tnaddlilink(url, name)
{
  var na = document.createElement('a');
  na.setAttribute('href', url);

  var txt = document.createTextNode(name);
  na.appendChild(txt);

  var li = document.createElement('li');
  li.appendChild(na);
  return li;
}
//---------------------------------------------------------------
function URLEncoding(input)
      {
        var encodedInputString=escape(input);
        encodedInputString=encodedInputString.replace("+", "%2B");
        encodedInputString=encodedInputString.replace("/", "%2F");        
        var outputurl=encodedInputString;
        return outputurl;
      }
//END
addOnloadHook(protection_tabs);
function protection_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div').getElementsByTagName('ul');
  if(document.getElementById('ca-protect'))
  {document.getElementById('ca-protect').firstChild.innerHTML = '<span style="color:black;">Protection (off)</span>';}
  if(document.getElementById('ca-unprotect'))
  {document.getElementById('ca-unprotect').firstChild.innerHTML = '<strong>Protection (on)</strong>';}
  if (document.title.indexOf("Editing ") != -1)
  {
      document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
      document.getElementById('ca-talk').firstChild.innerHTML = 'Talk';
      if(document.getElementById('ca-protect'))
      {document.getElementById('ca-protect').firstChild.innerHTML = '<span style="color:black;">P (off)</span>';}
      if(document.getElementById('ca-unprotect'))
      {document.getElementById('ca-unprotect').firstChild.innerHTML = '<strong>P (on)</strong>';}
    if (document.title.indexOf("Editing User talk:") != -1)
    {
      addTab("javascript:usprotect()", "(s)", "ca-sp", "Semi-protect", "");
      if(document.getElementById('ca-unprotect'))
      {
        addTab("javascript:uunprotect()", "(u)", "ca-up", "Un-protect", "");
      }
    }
    else if (document.title.indexOf("Editing User:") != -1)
    {  
      addTab("javascript:usprotect()", "(s)", "ca-sp", "Semi-protect", "");
      addTab("javascript:ufprotect()", "(p)", "ca-fp", "Full-protect", "");
      if(document.getElementById('ca-unprotect'))
      {
        addTab("javascript:uunprotect()", "(u)", "ca-up", "Un-protect", "");
      }
    }
  else if (document.title.indexOf("Editing Misplaced Pages:Requests for page protection (section)") != -1)
    {
    tabs.appendChild(tnaddlilink('javascript:rfpps()',"a|s"));
    tabs.appendChild(tnaddlilink('javascript:rfppp()',"a|p"));
    tabs.appendChild(tnaddlilink('javascript:rfppm()',"a|m"));
    tabs.appendChild(tnaddlilink('javascript:rfpprv()',"r|s"));
    tabs.appendChild(tnaddlilink('javascript:rfppr()',"r|p"));
    tabs.appendChild(tnaddlilink('javascript:rfppun()',"a|u"));
    tabs.appendChild(tnaddlilink('javascript:rfppru()',"r|u"));
    tabs.appendChild(tnaddlilink('javascript:rfppu()',"au"));    
    }
//This line removes a minor glitch ]
  else if (document.title.indexOf("Editing Misplaced Pages:Administrators' noticeboard/3RR (section)") != -1 || document.title.indexOf("Editing Help:Contents/Editing Misplaced Pages") != -1 || document.title.indexOf("Help:Contents/Editing Misplaced Pages") != -1)
    {
    var nothing = 'yep!';
    }
 else if(document.title.indexOf("Editing Talk:") != -1 || document.title.indexOf("Editing Misplaced Pages 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'))
      {
      addTab("javascript:oprotect()", "(p)", "ca-ofp", "Full-protect", "");
      addTab("javascript:osprotect()", "(s)", "ca-osp", "Semi-protect", "");
      }
      if(document.getElementById('ca-unprotect'))
      {
      addTab("javascript:oprotect()", "(p)", "ca-ofp", "Full-protect", "");
      addTab("javascript:osprotect()", "(s)", "ca-osp", "Semi-protect", "");
      addTab("javascript:ounprotect()", "(u)", "ca-oup", "Un-protect", "");
      }
    }
 else if(document.title.indexOf("Editing Misplaced Pages:") != -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'))
      {
      addTab("javascript:oprotect()", "(p)", "ca-ofp", "Full-protect", "");
      addTab("javascript:osprotect()", "(s)", "ca-osp", "Semi-protect", "");
      }
      if(document.getElementById('ca-unprotect'))
      {
      addTab("javascript:oprotect()", "(p)", "ca-ofp", "Full-protect", "");
      addTab("javascript:osprotect()", "(s)", "ca-osp", "Semi-protect", "");
      addTab("javascript:ounprotect()", "(u)", "ca-oup", "Un-protect", "");
      }
    }
  else
   {  
      if(document.getElementById('ca-protect'))
      {
      addTab("javascript:protect()", "(p)", "ca-fp", "Full-protect", "");
      addTab("javascript:sprotect()", "(s)", "ca-sp", "Semi-protect", "");
      }
      if(document.getElementById('ca-unprotect'))
      {
      addTab("javascript:protect()", "(p)", "ca-fp", "Full-protect", "");
      addTab("javascript:sprotect()", "(s)", "ca-sp", "Semi-protect", "");
      addTab("javascript:unprotect()", "(u)", "ca-up", "Un-protect", "");
      }
   }
  }
 else if (document.title.indexOf("User:") != -1 || document.title.indexOf("User talk:") != -1)
    {
 var nothing = 'yep!';
    }
}

//*****************************************************
//PROTECTION JS
//*****************************************************
//*****************************************************
//This is for if people skrew with the WP:PP page layout
  var movesec = 7;
  var artfull = 10;
  var artsemi = 11;
  var otherpro = 13;
  var userfull = 16;  
  var usersemi = 17;
  var regtalk = 18;  
  var anontalk = 19;
//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 = '';
  var target = document.title.split("Editing ").split(" - ");
  jstarget = URLEncoding(target);
  if (document.editform.wpTextbox1.value.split('{{sprotect}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{tl|protected}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{tl|vprotected}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != undefined)
  {
   var z = 'notag';
  }
  else
  {
  form = document.getElementById('bodyContent');
  l = form.getElementsByTagName('input');
  for (i = 0 ; i < l.length; i++)
    {
    if (l.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  document.editform.wpTextbox1.value = '{{protected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value += '+{{protected' + '}}';
window1 = window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + artfull + '&fakeaction=plist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window2 = window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jsfprotect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=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 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 ").split(" - ");
  jstarget = URLEncoding(target);
  if (document.editform.wpTextbox1.value.split('{{sprotect}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{usertalk-sprotected}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotected}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}') != undefined)
  {
    var z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != undefined)
  {
    var z = 'notag';
  }
  else
  {
  form = document.getElementById('bodyContent');
  l = form.getElementsByTagName('input');
  for (i = 0 ; i < l.length; i++)
    {
    if (l.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  document.editform.wpTextbox1.value = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value += '+{{sprotected' + '}}';
window1 = window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + artsemi + '&fakeaction=plist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window2 = window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jssprotect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=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 = '';
  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 ").split(" - ");
  jstarget = URLEncoding(target);
  if (document.editform.wpTextbox1.value.split('{{sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vutprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vutprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotect}}') != undefined)
  {
   z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sutprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sutprotected}}') != undefined)
  {
    z = '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
  {
  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.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  document.editform.wpTextbox1.value = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value += '+{{sprotected' + '}}';
window1 = window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + type + '&fakeaction=' + act + 'plist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window2 = window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jssprotect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
         return;
  }
}

function ufprotect()
{
  var z = '';
  if (document.title.indexOf("Editing User:") != -1)
    {
    value = 'u';
    }
  var reg = '';
  var target = document.title.split("Editing ").split(" - ");
  jstarget = URLEncoding(target);
  if (document.editform.wpTextbox1.value.split('{{sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vutprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vutprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotect}}') != undefined)
  {
   z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sutprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sutprotected}}') != undefined)
  {
    z = '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
  {
  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.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  document.editform.wpTextbox1.value = '{{Vprotected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value += '+{{Vprotected' + '}}';
window1 = window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + type + '&fakeaction=' + act + 'plist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window2 = window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jsfprotect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
         return;
  }
}

function oprotect()
{
  var z = '';
  var target = document.title.split("Editing ").split(" - ");
  jstarget = URLEncoding(target);
  if (document.editform.wpTextbox1.value.split('{{sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != undefined)
  {
    z = '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.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  document.editform.wpTextbox1.value = '{{protected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value += '+{{protected' + '}}';
window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=oplist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jsfprotect',
              'targetname2',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function osprotect()
{
  var z ='';
  var target = document.title.split("Editing ").split(" - ");
  jstarget = URLEncoding(target);
  if (document.editform.wpTextbox1.value.split('{{sprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotected}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}') != undefined)
  {
    z = 'notag';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != undefined)
  {
    z = '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.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  document.editform.wpTextbox1.value = '{{sprotected' + '}}\n' + document.editform.wpTextbox1.value;
  document.editform.wpSummary.value += '+{{sprotected' + '}}';
window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + otherpro + '&fakeaction=oplist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jssprotect',
              'targetnameo',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function unprotect()
{
var message = "Are you sure you want to unprotect this page?"; 
var return_value = confirm(message); 
if (return_value == true)
{
  var undefined;
  var original = document.editform.wpTextbox1.value;
  var target = document.title.split("Editing ").split(" - ");
  jstarget = URLEncoding(target);
  if (document.editform.wpTextbox1.value.split('{{sprotect}}') != undefined)
  {
whattag = 'sprotect';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}') != undefined)
  {
whattag = 'sprotected';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{semiprotect}}') != undefined)
  {
whattag = 'semiprotect';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{semiprotected}}') != undefined)
  {
whattag = 'semiprotected';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{semi-protected}}') != undefined)
  {
whattag = 'semi-protected';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sprotect}}') != undefined)
  {
whattag = 'Sprotect';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Sprotected}}') != undefined)
  {
whattag = 'Sprotected';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Semiprotect}}') != undefined)
  {
whattag = 'Semiprotect';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Semiprotected}}') != undefined)
  {
whattag = 'Semiprotected';
whattype = artsemi;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Semi-protected}}') != undefined)
  {
whattag = 'Semi-protected';
whattype = artsemi;
var go = 'yes';
  }
else if (document.editform.wpTextbox1.value.split('{{vprotect}}') != undefined)
  {
whattag = 'vprotect';
whattype = artfull;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotected}}') != undefined)
  {
whattag = 'vprotected';
whattype = artfull;
var go = 'yes';
  }
else if (document.editform.wpTextbox1.value.split('{{Vprotect}}') != undefined)
  {
whattag = 'Vprotect';
whattype = artfull;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Vprotected}}') != undefined)
  {
whattag = 'Vprotected';
whattype = artfull;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}') != undefined)
  {
whattag = 'protect';
whattype = artfull;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}') != undefined)
  {
whattag = 'protected';
whattype = artfull;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Protect}}') != undefined)
  {
whattag = 'Protect';
whattype = artfull;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Protected}}') != undefined)
  {
whattag = 'Protected';
whattype = artfull;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}') != undefined)
  {
whattag = 'moveprotect';
whattype = movesec;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != undefined)
  {
whattag = 'moveprotected';
whattype = movesec;
var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{Moveprotected}}') != undefined)
  {
whattag = 'Moveprotected';
whattype = movesec;
var go = 'yes';
  }
  else
  {
alert("Error: There is no recognized protection tag on this page.");
return;
  }
if (go == 'yes')
    {
  form = document.getElementById('bodyContent');
  l = form.getElementsByTagName('input');
  for (i = 0 ; i < l.length; i++)
    {
    if (l.name == 'wpMinoredit')
      {l.value = '1'; l.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/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + whattype + '&fakeaction=pdelist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jsunprotect',
              'targetnamepro',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
    jssubmitclose();
    return;
    }
  }
}

function ounprotect()
{
  var undefined;
  var original = document.editform.wpTextbox1.value;
  var target = document.title.split("Editing ").split(" - ");
  jstarget = URLEncoding(target);
  if (document.editform.wpTextbox1.value.split('{{sprotect}}') != undefined)
  {
    whattag = 'sprotect';
    whattype = otherpro;
    var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}') != undefined)
  {
    whattag = 'sprotected';
    whattype = otherpro;
    var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}') != undefined)
  {
    whattag = 'protect';
    whattype = otherpro;
    var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}') != undefined)
  {
    whattag = 'protected';
    whattype = otherpro;
    var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotect}}') != undefined)
  {
    whattag = 'moveprotect';
    whattype = movesec;
    var go = 'yes';
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != 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.name == 'wpMinoredit')
      {l.value = '1'; l.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/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + whattype + '&fakeaction=pdelist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jsunprotect',
              'targetnamep',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

//USERPAGE UNPROTECT
function uunprotect()
{
  var undefined;
  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 ").split(" - ");
  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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotect}}') == '')
     {
     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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotect}}') == '')
     {
     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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vutprotected}}') == '')
     {
     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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotected}}') == '')
     {
     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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotected}}') == '')
     {
     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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}') == '')
     {
     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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}') == '')
     {
     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('{{protect}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protect}}') == '')
     {
     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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protected}}') == '')
     {
     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}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{moveprotect}}') == '')
     {
document.editform.wpSummary.value += 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotect}}');
     } 
  }
  else if (document.editform.wpTextbox1.value.split('{{moveprotected}}') != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{moveprotected}}') == '')
     {
document.editform.wpSummary.value += 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{moveprotected}}'); 
     } 
  }
//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/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + anontalk + '&fakeaction=pdelist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');   
gonotagged = 'yes';
       }
     else if (reg == 'r')
       {
window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + regtalk + '&fakeaction=pdelist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=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/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + usersemi + '&fakeaction=pdelist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');  
gonotagged = 'yes';
        }
     else if (level == 'f')
        {
window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + userfull + '&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=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.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
if (gotagged == 'yes')
   {
document.editform.wpSummary.value += 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.replace('{{' + tagtype + '}}',''); 
var windowpp = window.open('http://en.wikipedia.org/search/?title=Misplaced Pages:List_of_protected_pages&action=edit&section=' + type + '&fakeaction=pdelist&faketarget=' + jstarget,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
var windowcp = window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jsunprotect',
              'targetnameu',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
   }
if (gonotagged == 'yes')
   {
var windowcp = window.open('http://en.wikipedia.org/search/?title=' + target + '&action=protect&fakeaction=jsunprotect',
              'targetnameu',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
   }
 } 

//Listing function
addOnloadHook(autoplist);
function autoplist()
{
  if (document.title.indexOf('Editing ') == 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.indexOf('=');
              var name = l.substring(0, eq);
              if (name == 'fakeaction')
                action = l.substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l.substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'plist')
        {
         autoreplacetxt('\n\n','\n');
         var pagename = strip_namespace(target);
         pagename = unescape(pagename);
         var original = document.editform.wpTextbox1.value;
         document.editform.wpTextbox1.value = pagename;
         var username = document.editform.wpTextbox1.value.split("User:");
         var usertalk = document.editform.wpTextbox1.value.split("User talk:");
         var themovename = document.editform.wpTextbox1.value.split("Misplaced Pages:");
         var themove = "*{{Non-article|Misplaced Pages|" + themovename + "}}";
         var thepage = "*{{article|" + target + "}}";
         var thepage2 = "* {{article|" + target + "}}";
         var lapage = "*{{la|" + target + "}}";
         var theuser = "*]";
         var vandaltalk = "*{{vandal|" + usertalk + "}}";
         document.editform.wpTextbox1.value = original;
            if (document.editform.wpTextbox1.value.split(theuser) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(vandaltalk) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(themove) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(thepage) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(thepage2) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(lapage) != undefined) 
            {
            var errorl = 'yes';
            }
         if (errorl == 'yes')
            {  
            alert("Error: The page is already listed.");
            return;
            }  
         else
            {        
  form = document.getElementById('bodyContent');
  l = form.getElementsByTagName('input');
  for (i = 0 ; i < l.length; i++)
    {
    if (l.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  t.value +="*{{article|" + pagename + "}}. " + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value += "] protected; adding to list.";
            }
        }
      if (action == 'uplist')
        {
         autoreplacetxt('\n\n','\n');
         var username = target.split("User:");
         var pagename = strip_namespace(target);
         pagename = unescape(pagename);
         var original = document.editform.wpTextbox1.value;
         document.editform.wpTextbox1.value = pagename;
         var username = document.editform.wpTextbox1.value.split("User:");
         var usertalk = document.editform.wpTextbox1.value.split("User talk:");
         var themovename = document.editform.wpTextbox1.value.split("Misplaced Pages:");
         var themove = "*{{Non-article|Misplaced Pages|" + themovename + "}}";
         var thepage = "*{{article|" + target + "}}";
         var thepage2 = "* {{article|" + target + "}}";
         var lapage = "*{{la|" + target + "}}";
         var theuser = "*]";
         var vandaltalk = "*{{vandal|" + usertalk + "}}";
         document.editform.wpTextbox1.value = original;
            if (document.editform.wpTextbox1.value.split(theuser) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(vandaltalk) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(themove) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(thepage) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(thepage2) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(lapage) != undefined) 
            {
            var errorl = 'yes';
            }
         if (errorl == 'yes')
            {  
            alert("Error: The page is already listed.");
            return;
            } 
         else
            { 
  form = document.getElementById('bodyContent');
  l = form.getElementsByTagName('input');
  for (i = 0 ; i < l.length; i++)
    {
    if (l.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  t.value +="*] -- " + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value += "]" + " protected; adding to list.";
            } 
        }
if (action == 'utplist')
        {
         autoreplacetxt('\n\n','\n');
         var username = target.split("User talk:");
         var pagename = strip_namespace(target);
         pagename = unescape(pagename);
         var original = document.editform.wpTextbox1.value;
         document.editform.wpTextbox1.value = pagename;
         var username = document.editform.wpTextbox1.value.split("User:");
         var usertalk = document.editform.wpTextbox1.value.split("User talk:");
         var themovename = document.editform.wpTextbox1.value.split("Misplaced Pages:");
         var themove = "*{{Non-article|Misplaced Pages|" + themovename + "}}";
         var thepage = "*{{article|" + target + "}}";
         var thepage2 = "* {{article|" + target + "}}";
         var lapage = "*{{la|" + target + "}}";
         var theuser = "*]";
         var vandaltalk = "*{{vandal|" + usertalk + "}}";
         document.editform.wpTextbox1.value = original;
            if (document.editform.wpTextbox1.value.split(theuser) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(vandaltalk) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(themove) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(thepage) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(thepage2) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(lapage) != undefined) 
            {
            var errorl = 'yes';
            }
         if (errorl == 'yes')
            {  
            alert("Error: The page is already listed.");
            return;
            } 
         else
            {
  form = document.getElementById('bodyContent');
  l = form.getElementsByTagName('input');
  for (i = 0 ; i < l.length; i++)
    {
    if (l.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  t.value +="*{{vandal|" + pagename + "}} --" + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value += "]" + " protected; adding to list.";
            }
        }
 if (action == 'oplist')
        {
         autoreplacetxt('\n\n','\n');
         var pagename = strip_namespace(target);
         pagename = unescape(pagename);
         var original = document.editform.wpTextbox1.value;
         document.editform.wpTextbox1.value = pagename;
         var username = document.editform.wpTextbox1.value.split("User:");
         var usertalk = document.editform.wpTextbox1.value.split("User talk:");
         var themovename = document.editform.wpTextbox1.value.split("Misplaced Pages:");
         var themove = "*{{Non-article|Misplaced Pages|" + themovename + "}}";
         var thepage = "*{{article|" + target + "}}";
         var thepage2 = "* {{article|" + target + "}}";
         var lapage = "*{{la|" + target + "}}";
         var theuser = "*]";
         var vandaltalk = "*{{vandal|" + usertalk + "}}";
         document.editform.wpTextbox1.value = original;
            if (document.editform.wpTextbox1.value.split(theuser) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(vandaltalk) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(themove) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(thepage) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(thepage2) != undefined) 
            {
            var errorl = 'yes';
            }
            else if (document.editform.wpTextbox1.value.split(lapage) != undefined) 
            {
            var errorl = 'yes';
            }
         if (errorl == 'yes')
            {  
            alert("Error: The page is already listed.");
            return;
            } 
         else
            {
  form = document.getElementById('bodyContent');
  l = form.getElementsByTagName('input');
  for (i = 0 ; i < l.length; i++)
    {
    if (l.name == 'wpMinoredit')
      {l.value = '1'; l.checked=true;}
    }
  var reason = prompt("Enter an explanation for protection")
  var f = document.editform, t = f.wpTextbox1;
  t.value +="*{{Non-article|Misplaced Pages|" + pagename + "}}. " + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value += "]" + " protected; adding to list.";
            }
        }
    }
}

//This function sets the selected values on the Confirm protection page
addOnloadHook(jsprotect);
function jsprotect()
{
  if (document.title.indexOf('Confirm protection') != -1)
    {
      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.indexOf('=');
              var name = l.substring(0, eq);
              if (name == 'fakeaction')
                action = l.substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l.substring(eq + 1)).replace(/_/g, ' ');
            }
         }
      if (action == 'jsunprotect')
         {
         document.getElementsByTagName('option').selected=true;
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=true;
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=false;
         document.getElementById('mwProtect-reason').value = 'Article locked for a while; hopefully, protection is no longer necessary.';
         }
      if (action == 'jssprotect')
         {
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=true;
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=true;
         document.getElementsByTagName('option').selected=false;
         document.getElementById('mwProtect-reason').value = 'Heavy vandalism from multiple sources.';
         }
      if (action == 'jsfprotect')
         {
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=true;
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=false;
         document.getElementsByTagName('option').selected=true;
         document.getElementById('mwProtect-reason').value = 'Users engaging in edit warring.';
         }
    }
}
//END

addOnloadHook(autopdelist);
function autopdelist()
{
  if (document.title.indexOf('Editing ') == 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.indexOf('=');
              var name = l.substring(0, eq);
              if (name == 'fakeaction')
                action = l.substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l.substring(eq + 1)).replace(/_/g, ' ');
            }
         }
      if (action == 'pdelist')
        {
         oldautoreplacetxt('* {{','*{{');
         autoreplacetxt('\n\n','\n');
         var pagename = strip_namespace(target);
         var original = document.editform.wpTextbox1.value;
         document.editform.wpTextbox1.value = pagename;
         var username = document.editform.wpTextbox1.value.split("User:");
         var usertalk = document.editform.wpTextbox1.value.split("User talk:");
         var themovename = document.editform.wpTextbox1.value.split("Misplaced Pages:");
         var themove = "*{{Non-article|Misplaced Pages|" + themovename + "}}";
         var thepage = "*{{article|" + target + "}}";
         var thepageLC = target.substring(0,1).toLowerCase + target.substr(1);
         var thepage2 = "*{{article|" + thepageLC + "}}";
         var lapage = "*{{la|" + target + "}}";
         var theuser = "*]";
         var vandaltalk = "*{{vandal|" + usertalk + "}}";
         document.editform.wpTextbox1.value = original;
        form = document.getElementById('bodyContent');
        l = form.getElementsByTagName('input');
        for (i = 0 ; i < l.length; i++)
            {
           if (l.name == 'wpMinoredit')
           {l.value = '1'; l.checked=true;}
            }
      if (document.editform.wpTextbox1.value.split(thepage) != undefined)
        {
         if (document.editform.wpTextbox1.value.split(thepage) != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(thepage);
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(thepage); 
         splitpoint = document.editform.wpTextbox1.value.split("*{{");
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = original.split(thepage);
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value += "] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
                    }
              else 
                    {
           secondhalf = document.editform.wpTextbox1.value.split(thepage + splitpoint);
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value += "] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                    }
          }
      } 
      else if (document.editform.wpTextbox1.value.split(thepage2) != undefined)
        {
         if (document.editform.wpTextbox1.value.split(thepage2) != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(thepage2);
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(thepage2); 
         splitpoint = document.editform.wpTextbox1.value.split("*{{");
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = original.split(thepage2);
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value += "] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
         return;
                    }
              else 
                    {   
           secondhalf = document.editform.wpTextbox1.value.split(thepage2 + splitpoint);
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value += "] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                    }
           }
       }
      else if (document.editform.wpTextbox1.value.split(themove) != undefined)
        {
         if (document.editform.wpTextbox1.value.split(themove) != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(themove);
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(themove); 
         splitpoint = document.editform.wpTextbox1.value.split("*{{");
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = original.split(themove);
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value += "] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
                    }
              else 
                    {
                 if (splitpoint.split("*" + " != undefined) 
                       {
           splitpointb = splitpoint.split("*" + ";
           secondhalf = document.editform.wpTextbox1.value.split(themove + splitpointb);
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value += "] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpointb + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
                 else 
                       {
           secondhalf = document.editform.wpTextbox1.value.split(themove + splitpoint);
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value += "] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
           }
        }
     } 
     else if (document.editform.wpTextbox1.value.split(lapage) != undefined)
        {
         if (document.editform.wpTextbox1.value.split(lapage) != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(lapage);
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(lapage); 
         splitpoint = document.editform.wpTextbox1.value.split("*{{");
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = original.split(lapage);
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value += "] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
 	            }
              else 
                    {
                 if (splitpoint.split("*" + " != undefined) 
                       {
           splitpointb = splitpoint.split("*" + ";
           secondhalf = document.editform.wpTextbox1.value.split(lapage + splitpointb);
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value += "] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpointb + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
                 else 
                       {
           secondhalf = document.editform.wpTextbox1.value.split(lapage + splitpoint);
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value += "] unprotected; delisting.";
           alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                       }
           }
        }
     } 
else if (document.editform.wpTextbox1.value.split(vandaltalk) != undefined)
         {
         if (document.editform.wpTextbox1.value.split(vandaltalk) != undefined)
            {
         var firsthalf = document.editform.wpTextbox1.value.split(vandaltalk);
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(vandaltalk); 
         splitpoint = document.editform.wpTextbox1.value.split("*" + "{{");
         document.editform.wpTextbox1.value = original.split(splitpoint);
         var secondhalf = original.split(vandaltalk + splitpoint);
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = document.editform.wpTextbox1.value.split(vandaltalk);
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value += "] unprotected; delisting.";
         alert("The page has been located and de-listed. The de-listed page had no protection summary or explanation.");
         return;
                    }
              else 
                    {
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value += "] unprotected; delisting.";
         alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                    }
              }
         }
else if (document.editform.wpTextbox1.value.split(theuser) != undefined)
         {
         if (document.editform.wpTextbox1.value.split(theuser) != undefined)
            {
         var firsthalf = document.editform.wpTextbox1.value.split(theuser);
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(theuser); 
         splitpoint = document.editform.wpTextbox1.value.split("*" + ";
         document.editform.wpTextbox1.value = original.split(splitpoint);
         var secondhalf = original.split(theuser + splitpoint);
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 3) 
                    {
         secondhalf = document.editform.wpTextbox1.value.split(theuser + splitpoint);
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value += "] unprotected; delisting.";
         alert("The user's page has been located and de-listed. The de-listed page had no protection summary or explanation."); 
         return;
                    }
              else 
                    {
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value += "] unprotected; delisting.";
         alert('The page has been located and de-listed. The protection explanation:' + '\n' + '------------' + '\n' + splitpoint + '\n' + '------------' + '\n' + '...was also removed. Please read this summary; avoid clicking "save page" if necessary.');
         return;
                    }
              }
         }
     else
         {
          alert("Note: The page you unprotected was not found on the list and may never have been listed. However, check to make sure that this is not a glitch, such as the listed article being a redirect to the actual page or beind the newest entry, or inconsistant asterik usage. Move-protected articles tend to be listed inconsistantly. Also, some entries for non-articles are listed with templates that this tool does not look for." + "\n" + "------------" + "\n" + "Debuging Information: " + "vandaltalk=" + vandaltalk + " |username=" + username + " |username2=" + usertalk + " |target=" + target + " |thepage=" + thepage + " |thepage2=" + thepage2 + " |themove=" + themove + " |theuser=" + theuser); 
         document.editform.wpSummary.value += "] unprotected; delisting.";
          return;
          document.editform.wpTextbox1.value = original;
         }
      }
   }
}
//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 ]. " + "~" + "~" + "~" + "~";
  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 ]. " + "~" + "~" + "~" + "~";
  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.''' Its 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(' ','_').replace(' ','_').replace(' ','_');
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +=":Page already " + value + " by ]" + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value += "Response: already " + value + " by another user";
}

function rfppru()
{
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +=":The issues that started the ] have not yet been resolved and the edits also appear to be in ]. It is also too soon to assume that the editors have just left for good, so the page is better left protected for now. " + "~" + "~" + "~" + "~";
  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 ] ] at this time. For now, be sure to use descriptive ] and discuss edits on ]. " + "~" + "~" + "~" + "~";
  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 ] ] at this time. Just ] and revert any vandalism. " + "~" + "~" + "~" + "~";
  f.wpSummary.value += "Response: protection request denied";
}
//</nowiki></pre>
User:Voice of All/Protection/monobook.js Add topic