User:AmiDaniel/vpfunctions.js

/* */

/** * This is a simple little helper function for JVP2, needed to append text and submit forms. * You will need this added to your monobook.js in order for JVP2 to work! * * Author: Daniel Cannon (alias AmiDaniel) * */

$( function {	if (location.href.indexOf("&action=edit") == -1 || location.href.indexOf("&dosave=") == -1) return;

/* Safeguard against primitive browser hijacking. */	var now = new Date; var curTime = "" + now.getTime; var token = location.href.split("&dosave=")[1].split("&")[0];

if (!(token.length > 4) || curTime.indexOf(token) == -1) { document.getElementById('content').innerHTML = "DoSave failed. Invalid token: " + token + " " + curTime + document.getElementById('content').innerHTML + ""; return; }

document.getElementById('content').innerHTML = "The page is being saved. Please wait." + document.getElementById('content').innerHTML + "";

/* Set the edit summary. */	var sum = location.href.split("&sum=")[1].split("&")[0]; document.getElementById('wpSummary').value = unescape(sum);

/* Append the text. */	if (location.href.indexOf("&append=") != -1) { var append = location.href.split("&append=")[1].split("&")[0]; document.getElementById('wpTextbox1').value += "\n\n" + unescape(append); }

/* Mark as minor. */	document.getElementById('wpMinoredit').checked = 'checked';

/* Submit the form. */	document.getElementById('editform').submit; });

/* */