User:Chairboy/protecthelper.greasemonkey.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | Documentation for this user script can be added at User:Chairboy/protecthelper.greasemonkey. |
Simple helper script to easily populate the protect rationale when protecting pages. Lists a few common reasons, if you can think of more, let me know.
[[Image:Protecthelper.png|center]]
It doesn't do anything cool like pre-check boxes yet, but I'll see if I can figure out an efficient way to do that soon.
<pre>
// Protect helper script
// Help with wikipedia article protection
// 2007-03-15
// GFDL
// Ben Hallert
//
// ==UserScript==
// @name ProtectHelper
// @namespace http://hallert.net/
// @description Provide a dropdown menu of common page protection rationale on Wikipedia. Admins only.
// @include http://wiki.riteme.site/*
// ==/UserScript==
if (document.getElementById('mwProtect-reason'))
{
var protect_table = document.getElementById('mwProtectSet');
var par = document.getElementById('mwProtect-reason');
var newhelper = document.createElement('select');
newhelper.setAttribute('id','protecthelper');
newhelper.setAttribute('onChange','document.getElementById(\'mwProtect-reason\').value = document.getElementById(\'protecthelper\').value;');
newhelper.innerHTML = "<option value=\'\'>Select a protect reason</option>"
+ "<option value=\'[[WP:SALT]] - Protecting a page that has been repeatedly re-created after proper deletion or as a result of a policy violation.\'>Salting a page</option>"
+ "<option value=\'[[WP:TPP]] - Page fully protected to stop an edit war, to hold a history review during a deletion review, or to prevent a disruptive user from using his or her talk page as an abuse tool.\'>Full protection</option>"
+ "<option value=\'[[WP:TPP]] - Page protected from being moved as a result of on-going page-move vandalism, an active page name dispute, or it is a high-visibility page that has no reason to be moved.\'>Move protection</option>"
+ "<option value=\'[[WP:TPP]] - Cascading protection to secure transcluded pages, either due to high visibility or to prevent from article recreation.\'>Cascading protection</option>"
+ "<option value=\'[[WP:TPP]] - Semi protected page against new and unregistered users due to heavy and continued vandalism\'>Semi protection</option>"
+ "<option value=\'\'>---------------</option>"
+ "<option value=\'[[WP:PROT]] - Manually unprotecting page\'>Unprotecting</option>";
if(protect_table)
{
var firsttbody = protect_table.getElementsByTagName('tbody')[0];
if(firsttbody)
{
var firstrow = firsttbody.getElementsByTagName('tr')[0];
if(firstrow)
{
var newcell = firstrow.insertCell(0);
newcell.setAttribute('rowspan','1');
newcell.setAttribute('colspan','3');
newcell.appendChild(newhelper);
newhelper.setAttribute('size','8');
}
}
}
}
void 0
</pre>