User:H/TUPjs.js
From Wikipedia, the free encyclopedia
< User:H
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.
//<nowiki> function getQueryVariable(variable) { var query = window.location.search.substring(1); var vars = query.split("&"); for (var i=0;i<vars.length;i++) { var pair = vars[i].split("="); if (pair[0] == variable) { return pair[1]; } } return 0; } function TUPjs() { if (getQueryVariable("TUPjs")) { document.getElementById('wpReason').value = ('Deleting temporary userpage that is not in a sockpuppet category, and has not been edited in over 31 days'); document.getElementById('wpReason').focus(); } if (getQueryVariable("notTUP")) { var textbox = document.getElementById( 'wpTextbox1' ); myregexp1 = new RegExp('\\[\\[Category:Temporary Wikipedian userpages(\|.*?)?\\]\\]', 'ig'); myregexp2 = new RegExp('indef((block(e?d?(user(-big)?)?)?)?|vandal)\\}\\}', 'ig'); myregexp3 = new RegExp('vandal(block|ismonly)\\}\\}', 'ig'); myregexp4 = new RegExp('blockedindef\\}\\}', 'ig'); myregexp5 = new RegExp('s/block3(\|.*?)?\\}\\}', 'ig'); // Remove temp category // 1 textbox.value = textbox.value.replace(myregexp1, ''); // Subst any of cats a sockpuppet should not be in (not done yet) // 2 var start_offset2 = textbox.value.search(myregexp2); if (start_offset2 > 0) textbox.value = (textbox.value.substr(0,start_offset2)+'subst:'+textbox.value.substr(start_offset2)); // 3 var start_offset3 = textbox.value.search(myregexp3); if (start_offset3 > 0) textbox.value = (textbox.value.substr(0,start_offset3)+'subst:'+textbox.value.substr(start_offset3)); // 4 var start_offset4 = textbox.value.search(myregexp4); if (start_offset4 > 0) textbox.value = (textbox.value.substr(0,start_offset4)+'subst:'+textbox.value.substr(start_offset4)); // 5 var start_offset5 = textbox.value.search(myregexp5); if (start_offset5 > 0) textbox.value = (textbox.value.substr(0,start_offset5)+'subst:'+textbox.value.substr(start_offset5)); document.getElementById('wpSummary').value = ('User pages that are in a sock puppet category should not be marked as temporary'); document.getElementById('wpDiff').click(); } if (document.getElementById('wpSummary').value.indexOf('User pages that are in a sock puppet category should not be marked as temporary') != -1) { document.getElementById('wpSave').focus();2 scroll(0,0); } } addOnloadHook(TUPjs); // </nowiki>