Jump to content

User:Voice of All/Protection/monobook.js

From Wikipedia, the free encyclopedia
This is an old revision of this page, as edited by Aaron Schulz (talk | contribs) at 22:26, 20 March 2006 (new). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.
(diff) ← Previous revision | Latest revision (diff) | Newer revision → (diff)
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 Wikipedia:Bypass your cache.
addOnloadHook(protection_tabs);

function protection_tabs()
{
  var c1 = document.getElementById('column-one');
  var tabs = c1.getElementsByTagName('div')[0].getElementsByTagName('ul')[0];

if  (document.title.indexOf("") != -1)
{
if (document.title.indexOf("Editing ") != -1)
{
  if (document.title.indexOf("Editing User talk:") != -1)
    {
      tabs.appendChild(tnaddlilink('javascript:usprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:uunprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
    }
  else if (document.title.indexOf("Editing User:") != -1)
    {  
      tabs.appendChild(tnaddlilink('javascript:usprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:uunprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
    }
  else if (document.title.indexOf("Editing Wikipedia:Requests for page protection (section)") != -1)
    {
    if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }     
    }
  else if (document.title.indexOf("Editing Wikipedia:Administrators' noticeboard/3RR (section)") != -1)
    {
    if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
    if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
    }
//This line removes a minor glitch [[Category:VoA scripted admins]]
 else if(document.title.indexOf("Editing Help:Contents/Editing Wikipedia") != -1)
   {
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
   }
 else if(document.title.indexOf("Help:Contents/Editing Wikipedia") != -1)
 {
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
   }
 else if(document.title.indexOf("Editing Talk") != -1)
 {
      tabs.appendChild(tnaddlilink('javascript:oprotect()',"(fp)"));
      tabs.appendChild(tnaddlilink('javascript:osprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:ounprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
      if(document.getElementById('ca-edit'))
      {
        document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
      }
   }
 else if(document.title.indexOf("Editing Wikipedia talk") != -1)
 {
      tabs.appendChild(tnaddlilink('javascript:oprotect()',"(fp)"));
      tabs.appendChild(tnaddlilink('javascript:osprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:ounprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
   }
  else
   {  
      tabs.appendChild(tnaddlilink('javascript:protect()',"(fp)"));
      tabs.appendChild(tnaddlilink('javascript:sprotect()',"(sp)"));
      tabs.appendChild(tnaddlilink('javascript:unprotect()',"(up)"));
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'P (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'P (on)';
      }
      if(document.getElementById('ca-edit'))
      {
        document.getElementById('ca-edit').firstChild.innerHTML = 'Edit';
      }
   }
}
 else if (document.title.indexOf("User:") != -1)
 {
      if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
      if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
 }
 else if (document.title.indexOf("User talk:") != -1)
 {
 if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
 if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
 }
 else
 {
 if(document.getElementById('ca-protect'))
      {
        document.getElementById('ca-protect').firstChild.innerHTML = 'Protection (off)';
      }
 if(document.getElementById('ca-unprotect'))
      {
        document.getElementById('ca-unprotect').firstChild.innerHTML = 'Protection (on)';
      }
}
}
}

function protect()
{
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    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
  {
  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=Wikipedia:List_of_protected_pages&action=edit&section=10&fakeaction=plist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function sprotect()
{
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    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
  {
  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=Wikipedia:List_of_protected_pages&action=edit&section=11&fakeaction=plist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function usprotect()
{
  if (document.title.indexOf("Editing User talk") != -1)
    {
    value = 't'; 
    }
  if (document.title.indexOf("Editing User:") != -1)
    {
    value = 'u';
    }
  var reg = '';
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{Sprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{Sprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{vutprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{Vutprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{vprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{vprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{Vprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{Vprotected}}')[1] != undefined)
  {
    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;
      }
  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=Wikipedia:List_of_protected_pages&action=edit&section=' + type + '&fakeaction=' + act + 'plist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function oprotect()
{
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    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
  {
  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=Wikipedia:List_of_protected_pages&action=edit&section=13&fakeaction=oplist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function osprotect()
{
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotect}}')[1] != undefined)
  {
    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 (document.editform.wpTextbox1.value.split('{{moveprotected}}')[1] != undefined)
  {
    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
  {
  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=Wikipedia:List_of_protected_pages&action=edit&section=13&fakeaction=oplist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
  }
}

function unprotect()
{
  var undefined;
  var original = document.editform.wpTextbox1.value;
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=11&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=11&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{semiprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{semiprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{semiprotect}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=11&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{semiprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{semiprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{semiprotected}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=11&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
else if (document.editform.wpTextbox1.value.split('{{vprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=10&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{vprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotected}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=10&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=10&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=10&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  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];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=7&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     } 
  }
  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]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=7&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     } 
  }
  else
  {
alert("Error: Either there is no recognized protection tag on this page or the tag is preceded by text (in which case you have to remove it manually).");
return;
//document.editform.wpTextbox1.value = original;  
  }
}

function ounprotect()
{
  var undefined;
  var original = document.editform.wpTextbox1.value;
  var target = document.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  if (document.editform.wpTextbox1.value.split('{{sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=13&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1];
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=13&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protect}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=13&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protected}}')[0] == '')
     {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=13&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
     }
  }
  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]; 
     } 
  }
  else
  {
alert("Error: Either there is no recognized protection tag on this page or the tag is preceded by text (in which case you have to remove it manually).");
return;
  }
}

//USERPAGE UNPROTECT
function uunprotect()
{
  var undefined;
  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.editform.action;
  target = target.substring(target.indexOf('title=') + 6, target.lastIndexOf('&action=submit'));
  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')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=17&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{vprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=16&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{vutprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vutprotected}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vutprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=16&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vutprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vutprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
else if (document.editform.wpTextbox1.value.split('{{vprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{vprotected}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=16&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{vprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{sprotected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{sprotected}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=17&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{sprotected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
 else if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=17&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{Usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
 else if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=17&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{usertalk-sprotect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{protect}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protect}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=16&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protect}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  else if (document.editform.wpTextbox1.value.split('{{protected}}')[1] != undefined)
  {
    if (document.editform.wpTextbox1.value.split('{{protected}}')[0] == '')
     {
     if (value == 'u')
      {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=16&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
      }
     else if (value == 't')
      {
        if (reg == 'a')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
        else if (reg == 'r')
          {
document.editform.wpSummary.value = 'Unprotected';
document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split('{{protected}}')[1]; 
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');
          }
      }
   }
}
  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')
       {
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=19&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');   
       }
     else if (reg == 'r')
       {
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=18&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');  
       }
     else
       {
     alert("An unknown error has occured. Please contact User:Voice of All for help.");
       }
     }
    if (value == 'u')
     { 
var level = prompt("Page no longer semi or fully protected (enter *s* or *f*)?");
     if (level == 's')
        {
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=17&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');  
        }
     else if (level == 'f')
        {
window.open('http://en.wikipedia.org/w/index.php?title=Wikipedia:List_of_protected_pages&action=edit&section=16&fakeaction=pdelist&faketarget=' + target,
              'targetname',
    'location=no,toolbar=no,status=no,directories=no,scrollbars=yes');   
        }
     else
        {
       alert("Invalid input."); 
        }
      }
   else if (value != 'u' && value != 't')
       {
      alert("An unknown page recognition error has occured. Please contact User:Voice of All for help."); 
       }
     }
   else 
     { 
   document.editform.wpSummary.value = "";
   return;
     } 
   }
 } 

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[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'plist')
        {
  var pagename = strip_namespace(target);
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*{{article|" + pagename + "}}. " + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "[[" + pagename + "]] protected ";
        }
    }
}

addOnloadHook(autouplist);

function autouplist()
{
  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[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'uplist')
        {
  var username = target.split("User:")[1];
  var pagename = strip_namespace(username);
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*[[User:" + pagename + "]] --" + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "[[" + pagename + "]]" + " protected ";
        }
    }
}

addOnloadHook(autoutplist);

function autoutplist()
{
  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[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'utplist')
        {
  var username = target.split("User talk:")[1];
  var pagename = strip_namespace(username);
  var reason = prompt("Enter an explanation for protection:")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*{{vandal|" + pagename + "}} --" + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "[[" + pagename + "]]" + " protected ";
        }
    }
}

addOnloadHook(autooplist);

function autooplist()
{
  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[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
        }
      if (action == 'oplist')
        {
  var pagename = strip_namespace(target);
  var reason = prompt("Enter an explanation for protection")
  var f = document.editform, t = f.wpTextbox1;
  if (t.value.length > 0)
    t.value += '\n';
  t.value +="*{{article|" + pagename + "}}. " + reason + ". " + "~" + "~" + "~" + "~";
  f.wpSummary.value = "[[" + target + "]]" + " protected ";
        }
    }
}

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[i].indexOf('=');
              var name = l[i].substring(0, eq);
              if (name == 'fakeaction')
                action = l[i].substring(eq + 1);
              else if (name == 'faketarget')
                target = unescape(l[i].substring(eq + 1)).replace(/_/g, ' ');
            }
         }
      if (action == 'pdelist')
        {
         var undefined;
         var splitpoint = '';
         var nada = '';
         var pagename = strip_namespace(target);
         var original = document.editform.wpTextbox1.value;
         document.editform.wpTextbox1.value = pagename;
         var username = document.editform.wpTextbox1.value.split("User:")[1];
         var usertalk = document.editform.wpTextbox1.value.split("User talk:")[1];
         var thepage = "*{{article|" + target + "}}";
         var theuser = "*[[" + target + "]]";
         var vandaltalk = "*{{vandal|" + usertalk + "}}";
         document.editform.wpTextbox1.value = original;
      if (document.editform.wpTextbox1.value.split(thepage)[1] != undefined)
        {
         if (document.editform.wpTextbox1.value.split(thepage)[0] != undefined)
           {
         var firsthalf = document.editform.wpTextbox1.value.split(thepage)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(thepage)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*{{")[0];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 1) 
                    {
         secondhalf = original.split(thepage)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The page has been automatically located and de-listed.");
         alert("The removed page's explanation was: " + splitpoint + " ...was removed.");
                    }
              else 
                    {
           secondhalf = document.editform.wpTextbox1.value.split(splitpoint)[1];
           document.editform.wpTextbox1.value = firsthalf + secondhalf;
           document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
           alert("The page has been located and de-listed. The de-listed page's protection explanation: " + "------------------------------------------------------------------------------------------------------------------------------" + splitpoint + "------------------------------------------------------------------------------------------------------------------------------" + " ...was also removed. Please read this summary; avoid clicking 'save page' if necessary.");
           }
        }
     } 
else if (document.editform.wpTextbox1.value.split(vandaltalk)[1] != undefined)
         {
         if (document.editform.wpTextbox1.value.split(vandaltalk)[0] != undefined)
            {
         var firsthalf = document.editform.wpTextbox1.value.split(vandaltalk)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(vandaltalk)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*" + "{{")[0];
         document.editform.wpTextbox1.value = original.split(splitpoint)[1];
         var secondhalf = original.split(splitpoint)[1];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 1) 
                    {
         secondhalf = document.editform.wpTextbox1.value.split(vandaltalk)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The user's page has been located and de-listed. The de-listed page had no protection summary or explanation."); 
                    }
              else 
                    {
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
alert("The user's page has been located and de-listed. The de-listed page's protection explanation: " + "-------------------------------------------------------------------------------------------------------------------------" + splitpoint + "-------------------------------------------------------------------------------------------------------------------------" + " ...was also removed. Please read this; avoid clicking 'save page' if necessary.");
                    }
              }
         }
else if (document.editform.wpTextbox1.value.split(theuser)[1] != undefined)
         {
         if (document.editform.wpTextbox1.value.split(theuser)[0] != undefined)
            {
         var firsthalf = document.editform.wpTextbox1.value.split(theuser)[0];
         document.editform.wpTextbox1.value = document.editform.wpTextbox1.value.split(theuser)[1]; 
         splitpoint = document.editform.wpTextbox1.value.split("*" + "[[User:")[0];
         document.editform.wpTextbox1.value = original.split(splitpoint)[1];
         var secondhalf = original.split(splitpoint)[1];
         document.editform.wpTextbox1.value = original;
              if (splitpoint.length <= 1) 
                    {
         secondhalf = document.editform.wpTextbox1.value.split(theuser)[1];
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
         alert("The user's page has been located and de-listed. The de-listed page had no protection summary or explanation."); 
                    }
              else 
                    {
         document.editform.wpTextbox1.value = firsthalf + secondhalf;
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
alert("The user's page has been located and de-listed. The de-listed page's protection explanation: " + "-------------------------------------------------------------------------------------------------------------------------" + splitpoint + "-------------------------------------------------------------------------------------------------------------------------" + " ...was also removed. Please read this; avoid clicking 'save page' if necessary.");
                    }
              }
         }
     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.");
          alert("Debuging Information: " + "vandaltalk=" + vandaltalk + "|username=" + username + "|target=" + target + "|splitpoint=" + splitpoint); 
         document.editform.wpSummary.value = "[[" + target + "]] unprotected; delisting.";
          return;
          document.editform.wpTextbox1.value = original;
         }
      }
   }
}