User:Monochromatic Bunny/chat.js

if (mw.config.get('wgPageName') === 'Special:Torus') { importScriptURI('http://monchbox.wikia.com/wiki/MediaWiki:Torus.js/main.js?action=raw&ctype=text/javascript&templates=expand&t=' + (new Date).getTime); $('head').append(' \            #torus { \                 position: fixed !important; \	         margin-top: 0 !important; \                 top: 0 !important; \	         left: 0 !important; \	         width: 100% !important; \	         height: 100% !important; \             } \             #WikiHeader, \             #WikiaHeader, \             #WikiaBar, \             #globalNavigation, \             .AdminDashboardHeader { \                 display: none; \             } \        '); }

importScriptPage('User:Monchoman45/ChatHacks.js', 'c'); $.getScript('https://raw.github.com/sactage/wikia-js-snippets/master/ChatOptions.js');

/** * Shows an HTML5 desktop notification if your name is mentioned in chat * @see https://developer.mozilla.org/en-US/docs/Web/API/notification * credit to TK-999 */ require(['wikia.window', 'mw'], function (context, mw) {	if (!context.Notification) {		return;	}	// cache user name	var user = mw.config.get('wgUserName');	function notify(message) {		var data = JSON.parse(message.data).attrs;		if (data.isInlineAlert || data.text.indexOf(user) === -1) {			return;		}		var options = {			body: data.text,			icon: data.avatarSrc		};		new context.Notification(data.name, options);	}	// unbind listener if the user didn't allow notifications	Notification.requestPermission(function (response) { if (response !== "granted") { context.mainRoom.socket.unbind('chat:add', notify); }	});	context.mainRoom.socket.bind('chat:add', notify); });