User:GolgothaKinslayer/global.js

importScriptPage('WikiaNavBarHider/code.js', 'dev');

*/ /** * @fileOverview NoImageLightbox * http://dev.wikia.com/wiki/NoImageLightbox/code.js * - Kills image lightbox so that clicking an image takes you to the File: * - By default videos should still play normally, but you can set *      window.NoImageLightbox.novideo = true *  to disable the lightbox entirely for both images and videos * - Available under Creative Commons Attribution-Share Alike License 3.0 * @author User:Mathmagician */ /*jshint forin:true, noempty:true, eqeqeq:true, bitwise:true, strict:true, undef:true, unused:true, curly:true, browser:true, jquery:true */ /*global mediaWiki */ if ({ 'oasis': 1, 'wikia': 1 }[mediaWiki.config.get('skin')] === 1) { (function ($, mw, window) {		"use strict";		// [private] variables		var $images, NoImageLightbox;		// fix hrefs to go to the File: page		// Note: doesn't affect videos, video hrefs are already correct, don't need updated		function updateImgLinkHrefs {			$images.each(function { // Note: a.image, a.lightbox excludes image previews on File: pages themselves, // which are of course intended to link to the direct URL of the image var $img = $(this), urlpart = $img.attr('data-image-key'), // already url encoded $a = $img.parent('a.image, a.lightbox'); $a.attr('href', '/wiki/File:' + urlpart); });		}		// turns off the lightbox for both images and videos		function killLightboxEntirely {			window.wgEnableLightboxExt = false;			$("#WikiaArticle, #RelatedVideosRL, #LatestPhotosModule, #WikiaArticleComments").off('.lightbox');		}		// DEFAULT: turn off the lightbox for IMAGES ONLY		function killLightboxForImagesOnly {			// runs before Wikia's LightboxLoader.loadLightbox event			// and prevents it from executing by stopping propagation on images			$images			.off('click.noimagelightbox')			.on('click.noimagelightbox', function (event) { event.stopImmediatePropagation; });		}		// init		function initNoImageLightbox {			//console.log('***** NOIMAGELIGHTBOX SCRIPT - init');			$images = $('img[data-image-key]');			NoImageLightbox = window.NoImageLightbox || {};			updateImgLinkHrefs;			if (NoImageLightbox.novideo) {				killLightboxEntirely;			} else {				killLightboxForImagesOnly;			}		}		// automatically add init to the ajaxCallAgain array for compatibility with AjaxRC		// e.g. when images show up in the activity feed on Special:WikiActivity		if ($.isArray(window.ajaxCallAgain)) {			window.ajaxCallAgain[window.ajaxCallAgain.length] = initNoImageLightbox;		} else {			window.ajaxCallAgain = [initNoImageLightbox];		}		// call init on $(document).ready and when Right Rail loads		$(initNoImageLightbox);		$('#WikiaRail').on('DOMNodeInserted.noimagelightbox', initNoImageLightbox);	}(jQuery, mediaWiki, window)); } /*