User:Kbh3rd/mytools.js

//  /*  * Some knick-knacks for the Toolbox */

// ***************** // Vandal page edits // ***************** function vanDate { var d=new Date var f = document.editform ;

var month=new Array(12) month[0]="January"; month[1]="February"; month[2]="March"; month[3]="April"; month[4]="May"; month[5]="June"; month[6]="July"; month[7]="August"; month[8]="September"; month[9]="October"; month[10]="November"; month[11]="December";

f.wpTextbox1.value += "\n==== "+month[d.getMonth]+" "+d.getFullYear+" ====\n\n" ; f.wpSummary.value = month[d.getMonth] ; f.wpMinoredit.checked=true; f.wpWatchthis.checked=true; if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ; } function vanIP {

whackCheckMonth ;	// borrow function from vandal warning toolbox to add month heading if not there yet.

var d=new Date ; var f = document.editform ; var user=prompt("Please enter User:","") f.wpTextbox1.value+= "* "+user+"" + " " + (1+d.getMonth)+"/"+d.getDate+"/"+d.getFullYear + " \n" ; f.wpSummary.value = user ; f.wpMinoredit.checked=true; f.wpWatchthis.checked=true; if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ; } function vanPleaseWarn { var article = prompt ("What article are we referring to?", "") ; document.editform.wpTextbox1.value += "Hi. I noticed that you actively revert vandalism to articles.  Thanks!!  "+ "I also noticed that in at least one case (" + article + ") you didn't leave a warning message " + "on the vandal's talk page. I think it's important to leave messages in almost every instance of " + "even the most minor inappropriate edits for these (and probably other) reasons: \n\n" + "* People just test-editing can be directed to the sandbox " + " where they won't corrupt real articles.\n" + "* Mischievious newcomers may stop if their first edits result in a polite request to behave.\n" + "* Sysops can more quickly ban more serious vandals if they've already been warned a few times.\n\n" + "Leaving lots of messages can be tedious, even with the templates documented at Vandalism. " + "So I've made some vandal-warning tools " + "that are explained at User:Kbh3rd/Vandal_warning_toolbox. A list of warnings can be added to that " + "toolbox menu on the left whenever a user talk page is being edited so that the proper warning message " + "is only a click away. You might like to try it out."+ "\n\n" + "Thanks again for your help! ~\n\n" ; document.editform.wpSummary.value = "A tool for leaving warning messages" ; document.editform.wpMinoredit.checked=false; document.editform.wpWatchthis.checked=false; } function vanToolboxChange { var f = document.editform ; f.wpTextbox1.value += "I hope you're finding the " + "warning toolbox useful. " + "I've made a few minor changes to it " + "that you might want to be aware of. ~" ; f.wpSummary.value = "Changes to vandal warning toolbox" ; f.wpMinoredit.checked=false; f.wpWatchthis.checked=false; f.wpTextbox1.focus; if (f.wpTextbox1.scrollTop || true) f.wpTextbox1.scrollTop = f.wpTextbox1.scrollHeight ; } // ************************************************** // Installation // ************************************************** window.van_addlilink=function(tabs, url, name, id, title, key){ var na = document.createElement('a'); na.href = url; na.appendChild(document.createTextNode(name)); var li = document.createElement('li'); if(id) li.id = id; li.appendChild(na); tabs.appendChild(li); if(id) { if(key && title) ta[id] = [key, title]; else if(key)    ta[id] = [key, '']; else if(title)  ta[id] = ['', title]; }   // re-render the title and accesskeys from existing code in wikibits.js    // akeytt; return li; } window.van_addToolboxLink=function(url, name, id){ var tb = document.getElementById('p-tb').getElementsByTagName('ul')[0]; van_addlilink(tb, url, name, id); } window.vandalTools=function { if (document.title.match("Editing User talk:") ) { van_addToolboxLink('javascript:{vanPleaseWarn;};void(0);', '°Pls Warn', 'toolbox_plswarn') ; van_addToolboxLink('javascript:{vanToolboxChange;}void(0);','Toolbox change msg', 'toolbox_tbchange'); } else { if (document.title.match("Editing User:Kbh3rd/Watch") ) { van_addToolboxLink('javascript:{vanDate;};void(0);', 'Vandal date', 'toolbox_vandate'); van_addToolboxLink('javascript:{vanIP;};void(0);', 'Vandal User', 'toolbox_vanuser'); } } } // onload window.simpleAddOnload=function(f) { if (window.addEventListener) window.addEventListener("load", f, false); else if (window.attachEvent) window.attachEvent("onload",f); }

simpleAddOnload(vandalTools);

//