User:Ultimate Dark Carnage/chat.js

localStorage.setItem('original_title', document.title); window.focused = true; window.count = 0; window.originalTitle = localStorage.getItem('original_title');

$('head').append(mw.html.element('meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' }));

NodeChatDiscussion.prototype.notify = function(child){ if (mainRoom.initialized && child.attributes.name != wgUserName){ if (window.focused === true){ window.count = 0; return; }       if (window.count > 999) window.count = '999+'; else window.count += 1; document.title = '('.concat(window.count) + ') ' + window.originalTitle; } };

mainRoom.model.chats.bind('afteradd', $.proxy(mainRoom.viewDiscussion.notify, mainRoom.viewDiscussion));

$(window).on('blur', function(event){ window.focused = false; }); $(window).on('focus', function(event){ window.focused = true; document.title = window.originalTitle; });