User:TopGun/hotSign.js

//Slight modification of script made by User:Fred Gandt/hotSign.js

var hot_sign_textarea; function hotSign(hot_sign_event) {	if((hot_sign_event.keyCode==220)&&hot_sign_event.ctrlKey) // ctrl + \ {		var hot_sign_sig="--"+""; var hot_sign_ss=hot_sign_textarea.selectionStart; var hot_sign_se=hot_sign_textarea.selectionEnd; var hot_sign_part_1=hot_sign_textarea.value.substr(0,hot_sign_ss); var hot_sign_part_2=hot_sign_textarea.value.substr(hot_sign_se); hot_sign_textarea.value=(hot_sign_part_1+hot_sign_sig+hot_sign_part_2); hot_sign_textarea.focus; var hot_sign_l=hot_sign_sig.length; if(hot_sign_ss!=hot_sign_se) { 			hot_sign_textarea.setSelectionRange(hot_sign_ss,(hot_sign_ss+hot_sign_l)); }		else {			var hot_sign_pos=(hot_sign_ss+hot_sign_l); hot_sign_textarea.setSelectionRange(hot_sign_pos,hot_sign_pos); }		return false; } } function hotSignInit {	hot_sign_textarea=document.getElementById("wpTextbox1"); if(hot_sign_textarea) {		hot_sign_textarea.setAttribute("onkeydown","return hotSign(event);"); } } jQuery(document).ready(hotSignInit);