User:Technical 13/SandBox/EmailHelper.js
Appearance
Code that you insert on this page could contain malicious content capable of compromising your account. If you import a script from another page with "importScript", "mw.loader.load", "iusc", or "lusc", take note that this causes you to dynamically load a remote script, which could be changed by others. Editors are responsible for all edits and actions they perform, including by scripts. User scripts are not centrally supported and may malfunction or become inoperable due to software changes. A guide to help you find broken scripts is available. If you are unsure whether code you are adding to this page is safe, you can ask at the appropriate village pump. This code will be executed when previewing this page. |
![]() | This user script seems to have a documentation page at User:Technical 13/SandBox/EmailHelper. |
//<nowiki>
if(mw.config.get("wgCanonicalSpecialPageName") === "Emailuser"){
function parseEmail(){
var wikiTimestamp = new Date();
$('#mw-input-wpText').val($('#mw-input-wpText').val().replace(/\[\[(.*?)(\|.*?)?\]\]/gi, "\(- http://en.wikipedia.org/wiki/$1 -\)"));
$('#mw-input-wpText').val($('#mw-input-wpText').val().replace(/~{3,4}/gi, mw.user.options.get('nickname')));
}
function sendEmail(){
/* This will allow me to post the {{YGM}} template on the recievers talk page when clicking send */
}
$("label[for='mw-input-wpCCMe']").after('<input type="checkbox" checked="checked" value="1" id="YGM" /> <label for="YGM">Leave {{<a href="/wiki/Template:You%27ve_got_mail">You\'ve got mail</a>}} on talkpage.</label>');
/* Will need to highjack the send button here and create my own replacement send button the runs onClick="sendEmail()" */
$('span.mw-htmlform-submit-buttons').append('<input class="mw-htmlform-parse" value="Preview" onClick="parseEmail()" type="button"></input>');
$('span.mw-htmlform-submit-buttons').append('<input class="mw-htmlform-reset" type="reset" value="Reset"></input>');
}
//</nowiki>