User:SD0001/EmailHelper.js

// Forked from User:Technical 13/SandBox/EmailHelper.js // if(mw.config.get("wgCanonicalSpecialPageName") === "Emailuser"){ /* parse email */ function parseEmail{ var wikiTimestamp = new Date; wikiTimestamp = wikiTimestamp.toLocaleTimeString('en') + ", " + wikiTimestamp.toLocaleDateString('en'); $('textarea[name=wpText]').val($('textarea[name=wpText]').val			.replace(/\[\[(.*?)(\|.*?)?\]\]/gi, "\(- http://en.wikipedia.org/wiki/$1 -\)")		); /* signatures */// Parse signatures and timestamps $('textarea[name=wpText]')[0].value = ( $('textarea[name=wpText]').val			.replace(/~{5}/gi, wikiTimestamp)			.replace(/~{4}/gi, mw.user.options.get('nickname') + " " + wikiTimestamp)) .replace(/~{3}/gi, mw.user.options.get('nickname')) ;	}	/* send email */ function sendEmail{ /* YGM */// Post the template on the recipient's talk page if selected if($('#YGM').prop('checked')) { //Post the message }		/* submit */ // $('form.visualClear').submit; }	/* highjack the send */// This will prevent default behavior and allow for preparsing and send of 	$('button[type=submit]').attr({id:'wpSave',title:'Send email [Alt]+[Shift]+[S]',accessley:'s',onClick:'sendEmail',type:'button'}); /* add preview */// This will convert the wikitext to text in the textarea $('span.mw-htmlform-submit-buttons').append(' '); /* add reset */// Adds a reset button to clear the text area $('span.mw-htmlform-submit-buttons').append(' '); /* ygm label and checkbox */// Add a check box to post the template on the recipient's talk page $("label[for='ooui-php-3']").after(' Leave on talkpage. '); } //