User:Iggyvolz/global.js

function getUrlVars { var vars = {}; var parts = window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {       vars[key] = value;    }); return vars; } // Script from http://papermashup.com/read-url-get-variables-withjavascript/ var action = getUrlVars["action"]; var preview = getUrlVars["preview"]; var text = getUrlVars["text"]; if(action=="edit") { if(preview=="true") { document.getElementById("wpTextbox1").innerHTML=text; } } if($(location).attr('href').toLowerCase.indexOf("special:chat") >= 0) // Only trigger if URL contains Special:Chat - may cause a problem if on a page where Special:Chat is in the title { $("input[type=submit]").css("display","inline") $("input[type=submit]").click(function{ e = jQuery.Event("keypress") e.which = 13 // enter key $('textarea[name=message]').keypress(function{}).trigger(e) }) }