Module:Crafting: Difference between revisions

m
no edit summary
mNo edit summary
mNo edit summary
 
(62 intermediate revisions by 3 users not shown)
Line 85: Line 85:


     local name = args['name'] or args['Name'] or args['title'] or args['Title']
     local name = args['name'] or args['Name'] or args['title'] or args['Title']
     if name then
     if name and #name ~= 0 then
         sprite:SetTitle(name)
         sprite:SetTitle(name)
     end
     end


     local lore = args['lore'] or args['Lore'] or args['text'] or args['Text']
     local lore = args['lore'] or args['Lore'] or args['text'] or args['Text']
     if lore then
     if lore and #lore ~= 0 then
         sprite:SetLore(lore)
         sprite:SetLore(lore)
     end
     end
local hideTooltip = args['hideToolTip'] or args['hideTooltip'] or args['HideToolTip'] or args['HideTooltip']
if hideTooltip then
sprite:HideTooltip()
end


local inline = args['inline'] or args['Inline']
local inline = args['inline'] or args['Inline']
local spriteDiv
local spriteDiv
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")
Line 104: Line 110:
end
end


local hideTooltip = args['hideToolTip'] or args['hideTooltip'] or args['HideToolTip'] or args['HideTooltip']
local count = tonumber(args['count']) or tonumber(args['Count']) or string.match(tostring(args['count']),'%?') or string.match(tostring(args['Count']),'%?') or 1
if hideTooltip then
if count ~= 1 then
spriteDiv:removeClass("masterTooltip")
local countSpan = parentDiv:tag("span"):wikitext(count)
countSpan:addClass("invslot-stacksize")
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
end


local count = tonumber(args['count']) or tonumber(args['Count']) or 1 or '?'
 
if count ~= 1 then
parentDiv:node(spriteDiv)
local countSpan = spriteDiv:tag("span"):wikitext(count)
if link and #link ~= 0 then
countSpan:addClass("invslot-stacksize")
if link:sub( 1,2 ) == '[[' then
parentDiv:wikitext(']]')
elseif link:sub ( 1,1 ) == '[' then
parentDiv:wikitext(']')
end
end
end


return spriteDiv
return parentDiv
end
end


Line 151: Line 177:
else
else
sprite:SetSize(args['size'] or args['Size'] or 32)
sprite:SetSize(args['size'] or args['Size'] or 32)
end
    local name = args['name'] or args['Name'] or args['title'] or args['Title']
    if name and #name ~= 0 then
        sprite:SetTitle(name)
    end
    local lore = args['lore'] or args['Lore'] or args['text'] or args['Text']
    if lore and #lore ~= 0 then
        sprite:SetLore(lore)
    end
local hideTooltip = args['hideToolTip'] or args['hideTooltip'] or args['HideToolTip'] or args['HideTooltip']
if hideTooltip then
sprite:HideTooltip()
end
end


Line 160: 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,639

edits