// ==UserScript== // @name HF AutoSignature // @namespace HF AutoSignature // @description Insert automatically your signature when you click on "Post Reply" // @include http://www.hackforums.net/* // @require http://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js // @version 1 // @grant GM_getValue // @grant GM_setValue // @grant GM_deleteValue // @downloadURL none // ==/UserScript== var signature = GM_getValue('autoSignature', ''); var enabled = GM_getValue('autoSignatureEnabled', false); function saveAutoSigSettings() { GM_setValue('autoSignature', document.getElementById('signature').value); if (document.getElementById('checkEnable').checked) { GM_setValue('autoSignatureEnabled', true); } else { GM_setValue('autoSignatureEnabled', false); } document.getElementById('submitAutoSig').innerHTML = "Changes saved successfully. To save again, you can click here."; } exportFunction(saveAutoSigSettings, unsafeWindow, {defineAs: "saveAutoSigSettings"}); if (document.URL.indexOf("showthread.php") >= 0) { $('#quick_reply_submit').on("click", function () { if (enabled) { prevMessage = document.getElementById("message").value; document.getElementById("message").value = prevMessage + '\n\n' + signature; } }) } if (document.URL.indexOf("usercp.php") >= 0) { var settingsAutoSigHTML = "
HF AutoSignature : Settings
Your signature :

"; $('.quick_keys > table:nth-child(1) > tbody:nth-child(1) > tr:nth-child(1) > td:nth-child(2) > br:nth-child(2)').after(settingsAutoSigHTML); if (enabled) { document.getElementById('checkEnable').setAttribute('checked', 'checked'); } }