User:NQ/custom-scripts/rxtest.js

//MusikAnimal's code - just testing something out.

// (function {	var responses = {};	if(document.title.indexOf("Wikipedia:WikiProject Resource Exchange/Resource Request (section)") !== -1) {			responses = {				"Resolved" : {				code : "",				summary : "marking resolved."				},

"Re-Sent-Sign" : { code : ": ~", summary : "" },

"Aye-Mail" : { code : ": ✅ Mail. ~", summary : "" },

"Aye-Sent" : { code : ": ✅ sent. ~", summary : "" },				"First time" : { code : ":Hi, I've sent you the article by mail. Do let me know if you need anything else. Regards ~", summary : "" },				"No email" : { code : ":Hi, you do not have your email enabled. Please email me via Special:EmailUser/NQ. Regards ~", summary : "email not enabled." },				"Sent" : { code : ": sent. ~", summary : "" },				"by mail" : { code : ": by mail. ~", summary : "" },				"mail" : { code : ": mail. ~", summary : "" }			}	}

var respondFn = function(e) { var response = e.data.response; var code = response.code, value = "";

var $textarea = $("#wpTextbox1"); var currentText = $textarea.val; var caretPos = $textarea[0].selectionStart; $textarea.val(currentText.substring(0, caretPos) + code + currentText.substring(caretPos)); $("#wpSummary").val($("#wpSummary").val + (response.summary + value).trim); };		for(var response in responses) { var id = responses[response].code.replace(/\W/g, ''); mw.util.addPortletLink('p-tb', 'javascript:', "("+response+")", "rh-"+id, responses[response].summary); $("#rh-"+id).click({		 	response : responses[response]		}, respondFn); } }); //