User:Xplt/global.js

var tabTitle = document.title; var hidden, visibilityChange; if (typeof document.hidden !== "undefined") { hidden = "hidden"; visibilityChange = "visibilitychange"; } else if (typeof document.mozHidden !== "undefined") { hidden = "mozHidden"; visibilityChange = "mozvisibilitychange"; } else if (typeof document.msHidden !== "undefined") { hidden = "msHidden"; visibilityChange = "msvisibilitychange"; } else if (typeof document.webkitHidden !== "undefined") { hidden = "webkitHidden"; visibilityChange = "webkitvisibilitychange"; }   var target = document.querySelector('#Chat_4978.Chat'); var observer = new MutationObserver(function(mutations) {       mutations.forEach(function(mutation) { document.title = "[*]" + tabTitle; });       });    var config = { attributes: true, childList: true, characterData: true } function handleVisibilityChange { if (document[hidden]) { observer.observe(target, config); } else { observer.disconnect; document.title = tabTitle; }   }      if (!(typeof document.addEventListener === "undefined" || typeof hidden === "undefined")) { document.addEventListener(visibilityChange, handleVisibilityChange, false); }