NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name DiktaPlus // @namespace Dikta // @description Lägger till lite funktioner till Dikta.se // @include *dikta.se* // @version 0.1-alpha // @grant GM_getValue // @grant GM_setValue // @grant GM_listValues // @grant GM_log // @grant GM_xmlhttpRequest // ==/UserScript== function KollaInbox(text) { var regexp = /<a[^>]*id=(\d+)/; var senaste = regexp.exec(text); return Number(senaste[1]); } function LikaOlika(nya, vilken) { var gamla = GM_getValue(vilken, -1); if (nya == gamla) { return false;} else { return true; }} if (window.location.pathname.search("mess") == -1) { GM_xmlhttpRequest({ method: "GET", url: "http://www.dikta.se/mess.php?mode=inbox", onload: function(response) { if(LikaOlika(KollaInbox(response.responseText), "inbox") === true){ var inbox = document.getElementsByClassName("navbar"); inbox = inbox[3]; inbox.style.color = "red"; inbox.innerHTML = "<INBOX>"; } } }); } else { GM_setValue("inbox",KollaInbox(document.body.innerHTML)); }