User:That Guy, From That Show!/auto testn.js

// User:Quarl/auto_testn.js - adds "tN" tabs for autotagging 'test'.

// requires wikipage.js, wikiedit.js, addilink.js // enhanced by: advanced_sig.js

// based on http://en.wikipedia.org/wiki/Wikipedia:WikiProject_User_scripts/Scripts/test-n.js //   Can be used from non-edit pages, and automatically submits the changes.

//

if(typeof window.makeSignature=='undefined')makeSignature=function{return "~"};

function testn(number) {   var page = prompt("Vandalism to which article? (Empty to use  instead of )") if (typeof page != 'string') return;

wikiPage.getEditorAsync(testn_edit, number, page); }

function testn_edit(editor, number, page) { if (!number) { alert("## ERROR: No number!"); return; } var text; var summary;

if (page) { text = '' + page + ' '; summary = "Vandalism to " + page + " - warning " + number; } else { text = ' '; summary = "Vandalism - warning " + number; }   text = '\n\n' + text + ' ' + makeSignature + '\n';

if (editor.refuseCreate) return; editor.wpTextbox1 = trim_lines(editor.wpTextbox1) + text; editor.wpSummary = summary; editor.submit; }

function auto_testn_init { // Only add tab to User talk pages (but not subpages)

if (wikiPage.sandboxP ||       wikiPage.namespace == 'User talk' && !wikiPage.subarticle) {       auto_testn_addTabs; } }

function auto_testn_addTabs {   var tabs = getTabActions; addlilink(tabs,'javascript:testn("1")',"t1",'testn1','experiment - sand 1'); addlilink(tabs,'javascript:testn("2")',"t2",'testn2','nonsense - sand 2'); addlilink(tabs,'javascript:testn("2a")',"t2a",'testn2a','blanking - sand 2a'); addlilink(tabs,'javascript:testn("3")',"t3",'testn3','stop - block 3'); addlilink(tabs,'javascript:testn("4")',"t4",'testn4','stop - last warn 4'); }

$(auto_testn_init);

//

//