MediaWiki:ChatNotification/code.js

$(window).blur(function {   notification.chatFocus = false;    $(window).focus(function { notification.chatFocus = true; notification.reset; }); }); notification = { chatFocus: true, title: $('title')[0], notifications: 0, patt: /^\(\d*\+?\) /, updateTitle: function { if (this.notifications === 0) { this.title.text = this.title.text.replace(this.patt, ""); return; }       if (this.patt.exec(this.title.text)) { this.title.text = this.title.text.replace(this.patt, "(" + this.notifications + ") "); } else { this.title.text = "(" + this.notifications + ") " + this.title.text; }   },    add: function { if (this.notifications <100){ this.notifications += 1; }else{ this.notifications="100+" }       this.updateTitle; },   reset: function { this.notifications = 0; this.updateTitle; } };