User:Chairboy/protecthelper.greasemonkey.js
From Wikipedia, the free encyclopedia
Note: After saving, you have to bypass your browser's cache to see the changes. In Internet Explorer and Firefox, hold down the Ctrl key and click the Refresh or Reload button. Opera users have to clear their caches through Tools→Preferences, see the instructions for Opera. Konqueror and Safari users can just click the Reload button.
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://en.wikipedia.org/* // ==/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>

