MediaWiki:Common.js: Difference between revisions
MediaWiki interface page
More actions
m Not finished |
mNo edit summary |
||
| Line 503: | Line 503: | ||
init: function() { | init: function() { | ||
var galleryIndex = 0; | var galleryIndex = 0; | ||
var galleryBuckets = {}; | |||
$('.pwiki-gallery').each(function() { | $('.pwiki-gallery').each(function() { | ||
var gID = 'pwiki-gallery-' + galleryIndex.toString(); | |||
$(this).attr('id', gID); | |||
galleryBuckets[gID] = null; | |||
galleryIndex++; | galleryIndex++; | ||
}); | }); | ||
$('.lightboxed').each(function() { | $('.lightboxed').each(function() { | ||
var gallery = $(this).closest('.pwiki-gallery'); | var gallery = $(this).closest('.pwiki-gallery'); | ||
if(gallery.length) { | if(gallery.length) { | ||
// In gallery | // In gallery | ||
var gID = gallery.attr('id'); | |||
if(galleryBuckets[gID] == null) { | |||
galleryBuckets[gID] = $(this); | |||
} else { | |||
galleryBuckets[gID].add($(this)); | |||
} | |||
} else { | } else { | ||
// Not in gallery, lightbox separately | // Not in gallery, lightbox separately | ||
| Line 517: | Line 525: | ||
} | } | ||
}); | }); | ||
for(var gID in galleryBuckets) { | |||
galleryBuckets[gID].lightBox(lightboxStuff.settings); | |||
} | |||
} | } | ||
}; | }; | ||