User:MACH-59330/chat.js

// chat imports importArticles({   type: 'script',    articles: [        'u:kocka:MediaWiki:Emoticons/code.js',        // 'u:dev:Colors/code.js'    ] }); // mobile chatskin meta tag $('head').append(mw.html.element('meta', { name: 'viewport', content: 'width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' })); // HTML5 desktop notifications by TK-999 require(['wikia.window', 'mw'], function (context, mw) {	if (!context.Notification) {		return;	}	// ping variables	var pings = new RegExp('(' + ['Speedit', 'Speedy', 'Speedo', 'help', 'CSS', 'infobox', 'PI'].join('|') + ')', 'gi'),       notification = document.createElement('audio');        notification.src = 'http://images.wikia.nocookie.net/speedit/images/0/01/Notification.ogg';        notification.style.display = 'none';    // notification function	document.body.appendChild(notification);	function notify(message) {		var data = JSON.parse(message.data).attrs;		if (data.isInlineAlert || !pings.test(data.text)) {			return;		}		var options = {			body: data.text,			icon: data.avatarSrc		};        notification.play;		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); }); // ping highlight recolor /* var pingclr = dev.colors.parse(dev.colors.wikia.link), pingbg = pingclr.mix(dev.colors.wikia.page,0.95); mw.util.addCSS('.ChatWindow .Chat .ping {' +   'color:' + pingclr + ';' +    'background: ' + pingbg + ';' + '}'); */