FANDOM


Resuming the work on trying to restore functionalities in Monobook that Wikia want to leave broken just to sabotage the Monobook skin, as I said in my previous post about fixing blogs, today I'll show you the code needed to fix galleries of type Slideshow.

  • Slideshow test
  • Slideshow test

Just put the following code in your Special:Mypage/global.js (for a fix on all wikis), or if you're an admin on a wiki, put this in MediaWiki:Monobook.js

/* Fix for slideshow galleries in Monobook */
function monobook_InitSlideshow() {
	var sld = null;
	for (var it = 0; (sld = document.getElementById('slideshow-'+it.toString())) || document.getElementById('gallery-'+it.toString()); it++) {
		if (!sld) continue;
		$.getScript(stylepath + '/common/jquery/jquery-slideshow-0.4.js?' + wgStyleVersion, function(i) {
			return function() {
				var slideshow = $('#slideshow-'+i.toString());
				var cb = function(index) {
					var item = slideshow.find('li').eq(index);
					if (item.attr('title')) {
						item.css('backgroundImage', 'url(' + item.attr('title') + ')');
						item.removeAttr('title');
					}
				};
				//var item = slideshow.find('li').first();
				var item = slideshow.find('li').eq(0);
				if (item.attr('title')!='') {
					item.css('backgroundImage', 'url(' + item.attr('title') + ')');
				}
				item.removeAttr('title');
				slideshow.slideshow({
					buttonsClass:'wikia-button',
					nextClass:'wikia-slideshow-next',
					prevClass:'wikia-slideshow-prev',
					slideWidth:'300px',
					slidesClass:'wikia-slideshow-images',
					slideCallback: cb
				});
			};
		}(it));
	}
}

if (jQuery.prototype.jquery == '1.3.2') {
	wgAfterContentAndJS.push(monobook_InitSlideshow);
}
/* End Fix for slideshow galleries in Monobook */

If you visit other wikis that don't have this fix apllied, tell them how to fix it, so others could benefit.