FANDOM


-- <pre>
local p = {}
 
function p.main(frame)
	local args = frame:getParent().args
	local images = {}
 
	-- I don't think I want this changing
	-- Can change later if there's demand
	local imgsize = 187 -- or tonumber(args.imgsize)
	for i, v in ipairs(args) do
		local img = {}
		img.file = v:match(':?([^:]-%.[pjg][npi][ggf])')
		local cpt = args['caption'..i] or ''
		img.caption = cpt:find('%S') and cpt or nil
		table.insert(images,img)
	end
 
	local ret = mw.html.create('div')
			:addClass('wikia-gallery')
			:addClass('wikia-gallery-captions-left')
			:addClass('gifgallery')
			:css('margin-bottom','90px')
 
	for i, v in ipairs(images) do
		local _v = ret:tag('div')
			:addClass('wikia-gallery-item')
			:css({ ['max-width'] = imgsize..'px',
				width = imgsize..'px',
				height = imgsize..'px' })
		local _t = _v:tag('div')
				:css({ height = imgsize..'px',
					margin = '0 auto',
					position = 'relative',
					['text-align'] = 'center' })
		_t:tag('div')
			:addClass('gallery-image-wrapper')
			:addClass('extimage')
			:css({ ['max-height'] = imgsize..'px',
				['max-width'] = imgsize..'px'
				 })
			:wikitext(string.format('[[File:%s]]',v.file))
		:done()
		if v.caption then
			_v:tag('div')
				:addClass('lightbox-caption')
				:css('max-width',(imgsize-10)..'px')
				:wikitext(v.caption)
			:done()
		end
		_v:done()
	end
 
	return ret
end
 
return p

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.