User:PicassoAndPringles/global.js

if (window.location.pathname==="/wiki/Special:Chat"){ console.log("chatting"); var t = document.getElementsByTagName("title")[0]; var n=0; var m=new MutationObserver(function(r){ if(!document.hasFocus){    n++;    t.innerHTML="("+n+") "+(n==1?t.innerHTML:t.innerHTML.substr((n-1).toString.length+3));    console.log(n);  } }); m.observe(document.getElementsByClassName("Chat")[0].children[0],{"childList":true}); window.addEventListener("focus",function{ if(n>0){    t.innerHTML=t.innerHTML.substr(n.toString.length+3);    n=0;  } }); }