MediaWiki:Gadget-GalleryLoadInline.js

$('div.expandgallery').click(function{	var t = $(this);	var etext = $(t).find('.expandgallery-text');	var edata = $(t).find('.expandgallery-data');	var msg = $(etext).html;

var query = $(edata).find('.expandgallery-query').html; var displayed = parseInt($(edata).find('.expandgallery-displayed').html,10); var count_all = parseInt($(edata).find('.expandgallery-count_all').html,10); var load_limit = parseInt($(edata).find('.expandgallery-load_limit').html,10); var character = $(edata).find('.expandgallery-character').html; var cameo = $(edata).find('.expandgallery-cameo').html; var location = $(edata).find('.expandgallery-location').html; var weapon = $(edata).find('.expandgallery-weapon').html; var artist = $(edata).find('.expandgallery-artist').html; var source = $(edata).find('.expandgallery-source').html; var section = $(edata).find('.expandgallery-section').html; var season = $(edata).find('.expandgallery-season').html; var episode = $(edata).find('.expandgallery-episode').html; var sort = $(edata).find('.expandgallery-sort').html; var widths = parseInt($(edata).find('.expandgallery-widths').html,10); // build query var url = '//blazblue.wiki/api.php' + '?action=parse&text=&contentmodel=wikitext'; console.log(url);

$(etext).html("Loading images...");

$.ajax({	   url: url,	    data: { format: 'json' },	    dataType: 'jsonp',	    success: function (data) {	    	var text;			var html;			var gallery;

// single out the html returned from the ajax query text = data.parse.text["*"]; console.log(text);

// append new images to gallery gallery = $(t).prev; html = $(text).find(".gallery").html; $(gallery).find(".gallery").append(html);

// update existing count of displayed images displayed = displayed + load_limit; $(edata).find('.expandgallery-displayed').html(displayed);

// if there's nothing left to display, disable the load more element if ((displayed >= count_all) 			    || (html === undefined)			     || (html === "")			) { $(t).css("display","none"); } }	}).done( function ( data ) { // replace loading text with its original text $(etext).html(msg); }); });