Anonymous

Module:Icons: Difference between revisions

From Melvor Idle
Use inline-flex instead of inline-block; reverse order of amount & image for _Currency
No edit summary
Tag: Manual revert
(Use inline-flex instead of inline-block; reverse order of amount & image for _Currency)
Line 789: Line 789:


if menu then
if menu then
return '{| class="articletable" style="display:inline-block;vertical-align:middle;"\r\n|-\r\n|' .. expIcon .. resultText .. '\r\n|}'
return '{| class="articletable" style="display:inline-flex;vertical-align:middle;"\r\n|-\r\n|' .. expIcon .. resultText .. '\r\n|}'
elseif not noicon and not nospan then
elseif not noicon and not nospan then
return '<span style="display:inline-block">' .. expIcon .. resultText .. '</span>'
return '<span style="display:inline-flex">' .. expIcon .. resultText .. '</span>'
else
else
return resultText
return resultText
Line 810: Line 810:
result = result.." Level "..level
result = result.." Level "..level


result = '<span style="display:inline-block">'..result..'</span>'
result = '<span style="display:inline-flex">'..result..'</span>'
return result
return result
end
end
Line 837: Line 837:
result = result..p.Icon({linkname, img=iconname, type='item', notext=true, nospan=true, alt=altTextItem})..p.Icon({'Mastery', notext=true, nospan=true, alt=altTextMastery})
result = result..p.Icon({linkname, img=iconname, type='item', notext=true, nospan=true, alt=altTextItem})..p.Icon({'Mastery', notext=true, nospan=true, alt=altTextMastery})
if showText then result = result..'[['..linkname..']] [[Mastery]]' end
if showText then result = result..'[['..linkname..']] [[Mastery]]' end
result = '<span style="display:inline-block">'..result..'</span>'
result = '<span style="display:inline-flex">'..result..'</span>'
return result
return result
end
end
Line 851: Line 851:
function p._Currency(fileName, link, altText, amount, maxAmount)
function p._Currency(fileName, link, altText, amount, maxAmount)
local ret = {}
local ret = {}
table.insert(ret, '<span style="display:inline-block">')
table.insert(ret, '<span style="display:inline-flex">')
-- Currency icon
local sep = ''
if fileName ~= nil then
table.insert(ret, '[[File:' .. fileName .. '|25px')
if link ~= nil then
table.insert(ret, '|link=' .. link)
end
table.insert(ret, '|alt=' .. ((altText == nil and '') or altText) .. ']]')
end
-- Currency amounts
-- Currency amounts
if tonumber(amount) ~= nil then
if tonumber(amount) ~= nil then
sep = '&nbsp;'
local function numColour(amount)
local function numColour(amount)
if tonumber(amount) < 0 then
if tonumber(amount) < 0 then
Line 869: Line 863:
end
end
end
end
table.insert(ret, '&nbsp;' .. numColour(amount))
table.insert(ret, numColour(amount))
if (tonumber(maxAmount) ~= nil and maxAmount > amount) then
if (tonumber(maxAmount) ~= nil and maxAmount > amount) then
table.insert(ret, ' - ' .. numColour(maxAmount))
table.insert(ret, ' - ' .. numColour(maxAmount))
end
end
end
-- Currency icon
if fileName ~= nil then
table.insert(ret, sep .. '[[File:' .. fileName .. '|25px')
if link ~= nil then
table.insert(ret, '|link=' .. link)
end
table.insert(ret, '|alt=' .. ((altText == nil and '') or altText) .. ']]')
end
end
table.insert(ret, '</span>')
table.insert(ret, '</span>')