MediaWiki:Gadget-DeferredDisplay.js

/** * Deferred display of nsfw-tagged images. * jshint validation * @author Dschwen, 2013 */

(function ($, mw) {	// nothing should be tagged outside these pages yet	var fpc = "Featured picture candidate";	var ti = mw.config.get("wgTitle");	if ($.inArray(mw.config.get('wgNamespaceNumber'), [4, 5, 10, 11, 14, 15]) === -1 || (ti.indexOf(fpc) === -1 && ti !== "Nsfw/sandbox"))		return;	// wrap non thumb images first	$('img[alt*=NSFWTAG]').each(function (i, e) { $(e).wrap($(' ').css({ display: 'inline-block', width: $(e).width + 'px', height: $(e).height + 'px', backgroundColor: '#eee' }));	}).parent.add($('.thumbinner,.gallerybox').has('.nsfwelement').find('.image').parent)	.one('click', function (e) { $(this).css('background', 'none').find('img').css({			visibility: ''		}); e.preventDefault; })	.css({ backgroundImage: 'url("//upload.wikimedia.org/wikipedia/commons/thumb/d/d7/Dialog-warning-orange.svg/40px-Dialog-warning-orange.svg.png")', backgroundRepeat: 'no-repeat', backgroundPosition: 'center' })	.find('img').css({ visibility: 'hidden' }); }(jQuery, mediaWiki));