User:Richmond2010/wikia.js

if ({ 'oasis': 1, 'wikia': 1 }[mediaWiki.config.get('skin')] === 1) { (function ($, mw, window, NoImageLightbox) {		"use strict";		// turns off the lightbox for both images and videos		function killLightboxEntirely {			// fix image hrefs to go to the File: page			$('img[data-image-key]').each(function { var $img = $(this), $a = $img.parent('a'); if ($a.hasClass('image')) { $a.attr('href', '/wiki/File:' + $img.attr('data-image-key')); }			});			// turn off the lightbox entirely			window.wgEnableLightboxExt = false;			$("#WikiaArticle, #RelatedVideosRL, #LatestPhotosModule, #WikiaArticleComments").off('.lightbox');		}		// DEFAULT: turn off the lightbox for IMAGES ONLY		function killLightboxForImagesOnly {			if (window.LightboxLoader) {				var loadLightbox = window.LightboxLoader.loadLightbox;				if (typeof loadLightbox === 'function') {					window.LightboxLoader.loadLightbox = function (strFilename, obj) {						try {							var $context = $(obj.target.context); //  (presumably could be )							var contextDataImageKey = $context.attr('data-image-key');							var childDataImageKey = $context.children('img').first.attr('data-image-key');							// go to file page if possible, else load the lightbox anyways							if (typeof contextDataImageKey === 'string' && contextDataImageKey.length) {								window.location.href = '/wiki/File:' + contextDataImageKey; } else if (typeof childDataImageKey === 'string' && childDataImageKey.length) { window.location.href = '/wiki/File:' + childDataImageKey; } else { return loadLightbox.apply(window.LightboxLoader, arguments); }						} catch (e) { return loadLightbox.apply(window.LightboxLoader, arguments); }					};				}			}		}		// init on $(document).ready if (NoImageLightbox.novideo) { $(killLightboxEntirely); } else { $(killLightboxForImagesOnly); }	}(jQuery, mediaWiki, window, window.NoImageLightbox || {})); }