Toggle menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Item thumbnail

From Sekaipedia
Revision as of 23:54, 1 November 2021 by ChaoticShadow (talk | contribs) (Created page with "local getArgs = require('Module:Arguments').getArgs local p = {} function p.main(frame) local args = getArgs(frame) return p._main(args) end function p._main(args) loc...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)



local getArgs   = require('Module:Arguments').getArgs

local p = {}

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

function p._main(args)
	local item = args['item']
	local image = args['image']
	local link = args['link'] or ''
	local count = args['count']
	local icon_size = '80px'
	
	local root = mw.html.create('div')
	root:css({
		['position'] = 'relative',
		['height'] = icon_size,
		['width'] = icon_size
	})
		:wikitext(string.format(
			'[[File:%s|80px|link=%s|%s]]',
			image,
			link,
			link
		))
	
	if count and tonumber(count) > 1 then
		root:tag('div')
			:css({
				['bottom'] =  0,
				['right'] = 0,
				['position'] = 'absolute',
				['padding'] = '0 5px',
				['background'] = '#00cdba',
				['border-radius'] = '5px 0 5px 0',
				['user-select'] = 'none'
			})
			:wikitext('x' .. count)
	end
		
	return tostring(root)
end

return p
Cookies help us deliver our services. By using our services, you agree to our use of cookies.