User:Saftzie/global.js

// __NOINDEX__

(function (mw, $) {	'use strict';

var wgNamespaceNumber = mw.config.get('wgNamespaceNumber');

// redirect Specal:Chat to Oasis (function 	{		var			query, t;

if ((wgNamespaceNumber === -1) &&			(mw.config.get('wgPageName') === 'Special:Chat') &&			(mw.config.get('skin') !== 'oasis')) {			query = location.search.replace(/^\?/, '').split('&'); if ((query.length === 1) && (query[0].length === 0)) {			 query = []; }			t = query.filter(function (v)			{	 		return (v.search(/^useskin=/) === 0);			}); if ((t.length === 1) && (t[0] === 'useskin=oasis')) {		 	return; // error, prevent infinite loop }			query = query.filter(function (v)			{		 	return (v.search(/^useskin=/) !== 0);			}); query.push('useskin=oasis'); location.search = '?' + query.join('&'); }	});

// add classes to closed and highlighted thread items if (wgNamespaceNumber === 2000) {		$(function 		{			$('.ThreadList > .thread').each(function {				var li = $(this);

$.post(mw.util.wikiScript('wikia'),				{					controller: 'Forum',					method: 'brickHeader',					id: li.data('id'),					format: 'json'				}, function (data)				{					if (data.isClosed)					{						li.addClass('g-closed');					}					if (data.isNotifyeveryone)					{						li.addClass('g-highlight');					}				}); });		});	} }(mediaWiki, jQuery));