User:GeorgeMoney/autoedit.js

// //---AUTOEDIT-- /*

parameters:
__mandatory__: 'txt' is the text you want to put in the edit box; 'sum' is your summary; example: autoedit('hello', 'saying hello to user');

__optional__: _mode_: the mode to use. Modes are: 'r': replace all existing text (or create page if no text) with your text; 'a': append your text to bottom of original; 't': add your text to top of original text; mode examples: autoedit('', 'adding header to all pages', 't'); default mode: 'r'; _watch_: To click 'Watch this page'. Use either true or false; watch examples: autoedit('hi', 'saying hi', '', true); watch notes: because this parameter occurs after the mode parameter, if you dont want to include the mode parameter, leave it like ''. so autoedit('text','summary',,true) notice how the mode is , but you can still use a mode like 'a'; watch default: false; _minor_: like watch except to mark edit as minor; minor default: false; _autoclick_: What button to click for autoclick autoclick options: 'wpSave', 'wpDiff', 'wpPreview'; to not use autoclick, value is 'none'; autoclick default: wpSave;

function autoedit(txt, sum, mode, watch, minor, autoclick) { /* if(booluse) { var otherif = (intitle('action=submit')); } else { var otherif = false; }

if(!txt||!sum) { return "Missing parameters"; }

if(!autoclick) { autoclick = 'wpSave'; }

if(!mode) { mode = 'r'; }

if(watch == "false") { watch = false; } if(minor == "false") { minor = false; }

if(!watch) { document.getElementById('wpWatchthis').checked = ""; } else { document.getElementById('wpWatchthis').checked = "checked"; } if(!minor) { document.getElementById('wpMinoredit').checked = ""; } else { document.getElementById('wpMinoredit').checked = "checked"; }

var txta = document.getElementById('wpTextbox1'); var sma = document.getElementById('wpSummary');

if(mode=='r') { txta.value = txt; } else if(mode=='a') { txta.value += '\n'+txt; } else if(mode=='t') { txta.value = txt + '\n' + document.getElementById('wpTextbox1').value; }

sma.value = sum;

if(autoclick!='none') { document.getElementById(autoclick).click; }

}

//Originally from User:Lupin/autoedit.js function gv(paramName) { var cmdRe=RegExp('[&?]'+paramName+'=([^&]*)'); var h=document.location; var m; if (m=cmdRe.exec(h)) { try { return unescape(decodeURI(m[1])); } catch (someError) {} } return null; }; //