MediaWiki:Wikia.js

(function {	var changeColors = function {		var PIs = $('.portable-infobox');		if (PIs.length) PIs.each(function { var $PI = $(this); var color = '', classNames = $PI.attr('class').split(' '); for (var i = 0; i < classNames.length; i++) { if (classNames[i].indexOf('pi-theme-_') !== -1) { color = classNames[i].replace('pi-theme-_', ''); break; }			}			if (color) { $PI.css('border', '3px #' + color + 'ridge'); $PI.find('h2').css('background-color', '#' + color); }		});	};	// Run it now	changeColors;	// Bind it to TabView loadContent function, so Portable Infoboxes	// inside TabView can also have fabulous custom backgrounds.	// - - - -	// WARNING! This may cause compatibility issues!	/*	TabViewClass.prototype.loadContent = function(tabLink) {		var tabUrl = tabLink.attr('href')		, dataTabId = tabLink.parent.attr('data-tab')		  , containerSelector = $('#' + this.cashedStuff.containersWrapperId).children('div[data-tab-body="' + dataTabId + '"]');		if (containerSelector.data('loaded') !== true) {			containerSelector.startThrobbing;			$.get(tabUrl, { action: 'render' }, function(html) { containerSelector.html(html).data('loaded', true).stopThrobbing; mw.hook('wikipage.content').fire(containerSelector); changeColors; });		}	};	*/ });

/* * Preparing for the upcoming movie. * This script changes the background of the wikia between two images on a RNG. * Images in question are: * https://images.wikia.com/robyns-little-land/images/0/0b/WikiBackground.png * https://images.wikia.com/robyns-little-land/images/5/5c/WikiBackground2.jpg * Do not edit until further notice. * * Feel free to steal the code elsewhere :P */ /* var background = [ '#06030c url(https://images.wikia.com/robyns-little-land/images/0/0b/WikiBackground.png) 50% -30px/cover no-repeat fixed', 'url(https://images.wikia.com/robyns-little-land/images/5/5c/WikiBackground2.jpg) 0 0 / cover no-repeat fixed #06030c' ]; var final = background[Math.floor(Math.random * background.length)]; $('body.skin-oasis').css({  'background' : final });