User:Vish/common.js

(function ($, mw) {	// wrap non thumb images first	$('img[alt*=NSFWTAG]').each(function (i, e) { $(e).wrap($(' ').css({ display: 'block', width: $(e).width + 'px', height: $(e).height + 'px', backgroundColor: '#eee' }));	}).parent.add($('.thumbinner,.gallerybox').has('.nsfwelement').find('.image').parent)	.one('click', function (e) { console.log($(e)); $(this).css('background', 'none').find('img').css({			visibility: ''		}); e.preventDefault; })	.css({ backgroundImage: 'url("https://static.jojowiki.com/images/customizations/Dialog-warning-yellow.png")', backgroundRepeat: 'no-repeat', backgroundPosition: 'center' })	.find('img').css({ visibility: 'hidden' }); }(jQuery, mediaWiki));

document.addEventListener("pageshow", function {	var youtube = $(".youtube");	console.log(youtube);	console.log($(".youtube"));

for (var i = 0; i < youtube.length; i++) { var source = "https://img.youtube.com/vi/"+ $(youtube[i]).data('embed') +"/hqdefault.jpg";

var image = new Image; image.src = source; image.addEventListener("load", function {					youtube[i].appendChild(image);		});

youtube[i].addEventListener( "click", function {			var iframe = document.createElement("iframe");

iframe.setAttribute("frameborder", "0"); iframe.setAttribute("width", $(this).data('embed-width')); iframe.setAttribute("height", $(this).data('embed-height')); iframe.setAttribute("allowfullscreen", "true"); iframe.setAttribute("src", "https://www.youtube.com/embed/"+ $(this).data('embed') +"?" + $(this).data('embed-query'));

this.innerHTML = ""; this.appendChild(iframe); });	}; }(jQuery));