Module:Crafting: Difference between revisions

m
no edit summary
(fix the puffer i hope)
mNo edit summary
 
(40 intermediate revisions by 2 users not shown)
Line 97: Line 97:
if hideTooltip then
if hideTooltip then
sprite:HideTooltip()
sprite:HideTooltip()
end
local enchanted = args['enchanted'] or args['Enchanted']
if enchanted then
sprite:SetEnchanted()
end
end


local inline = args['inline'] or args['Inline']
local inline = args['inline'] or args['Inline']
local spriteDiv
local spriteDiv
local parentDiv
local parentDiv = mw.html.create("span"):css("position","relative")
if inline ~= 'false' then
if inline ~= 'false' then
spriteDiv = sprite:GenerateHTML("span")
spriteDiv = sprite:GenerateHTML("span")
spriteDiv:css("display","inline-block")
spriteDiv:css("display","inline-block")
spriteDiv:css("vertical-align","middle")
spriteDiv:css("vertical-align","middle")
spriteDiv:css("border-style","hidden")
parentDiv = mw.html.create("span")
else
else
spriteDiv = sprite:GenerateHTML()
spriteDiv = sprite:GenerateHTML()
parentDiv = mw.html.create("span")
end
end


local count = tonumber(args['count']) or tonumber(args['Count']) or 1 or '?'
local count = tonumber(args['count']) or tonumber(args['Count']) or string.match(tostring(args['count']),'%?') or string.match(tostring(args['Count']),'%?') or 1
if count ~= 1 then
if count ~= 1 then
local countSpan = parentDiv:tag("span"):wikitext(count)
local countSpan = parentDiv:tag("span"):wikitext(count)
countSpan:addClass("invslot-stacksize")
countSpan:addClass("invslot-stacksize")
end
end
local enchanted = args['enchanted'] or args['Enchanted']
if enchanted == 'true' then
spriteDiv:addClass("enchanted")
end
local link = args['link'] or args['Link']
if link and #link ~= 0 then
if link:sub( 1,2 ) == '[[' then
parentDiv:wikitext(link:sub( 1,#link-2 ) .. '|')
elseif link:sub ( 1,1 ) == '[' then
parentDiv:wikitext(link:sub( 1,#link-1 ) .. '|')
end
end


parentDiv:node(spriteDiv)
parentDiv:node(spriteDiv)
if link and #link ~= 0 then
if link:sub( 1,2 ) == '[[' then
parentDiv:wikitext(']]')
elseif link:sub ( 1,1 ) == '[' then
parentDiv:wikitext(']')
end
end


return parentDiv
return parentDiv
Line 178: Line 193:
if hideTooltip then
if hideTooltip then
sprite:HideTooltip()
sprite:HideTooltip()
end
local enchanted = args['enchanted'] or args['Enchanted']
if enchanted then
sprite:addClass("enchanted")
end
end


Line 192: Line 202:
spriteDiv:css("border-width","3px")
spriteDiv:css("border-width","3px")
spriteDiv:css("border-style","solid")
spriteDiv:css("border-style","solid")
spriteDiv:css("box-sizing","border-box")


if args['standard'] or args['Standard'] then
if args['standard'] or args['Standard'] then
Bureaucrats, Check users, emailconfirmed, Interface administrators, staff, Administrators, translation-admin, Widget editors
1,637

edits