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

Module:Card: Difference between revisions

From The Petit Planet Wiki
to skim out genshin stuff
 
No edit summary
 
(7 intermediate revisions by the same user not shown)
Line 6: Line 6:


local QUALITY_STARS = {
local QUALITY_STARS = {
['1'] = '[[File:Icon 1 Star.png|x16px|link=|alt=Quality 1]]',
['1'] = '[[File:1 Star Icon.png|x16px|link=|alt=Quality 1]]',
['2'] = '[[File:Icon 2 Stars.png|x16px|link=|alt=Quality 2]]',
['2'] = '[[File:2 Stars Icon.png|x16px|link=|alt=Quality 2]]',
['3'] = '[[File:Icon 3 Stars.png|x16px|link=|alt=Quality 3]]',
['3'] = '[[File:3 Stars Icon.png|x16px|link=|alt=Quality 3]]',
['4'] = '[[File:Icon 4 Stars.png|x16px|link=|alt=Quality 4]]',
['4'] = '[[File:4 Stars Icon.png|x16px|link=|alt=Quality 4]]',
['5'] = '[[File:Icon 5 Stars.png|x16px|link=|alt=Quality 5]]'
['5'] = '[[File:5 Stars Icon.png|x16px|link=|alt=Quality 5]]'
}
local MILIASTRA_WONDERLAND_QUALITY_STARS = {
['1'] = '[[File:Miliastra 1 Star.png|x16px|link=|alt=Quality 1]]',
['2'] = '[[File:Miliastra 2 Star.png|x16px|link=|alt=Quality 2]]',
['3'] = '[[File:Miliastra 3 Star.png|x16px|link=|alt=Quality 3]]',
['4'] = '[[File:Miliastra 4 Star.png|x16px|link=|alt=Quality 4]]',
['5'] = '[[File:Miliastra 5 Star.png|x16px|link=|alt=Quality 5]]'
}
}
local PREFIX_ICONS = {
local PREFIX_ICONS = {
Line 41: Line 34:
label='Card Text',
label='Card Text',
description='The text below the image.',
description='The text below the image.',
default='—',
displayDefault='"—" for most items; same as Image Name for characters',
example={'100', 'Lv. 1', 'Set'},
example={'100', 'Lv. 1', 'Set'},
},
},
Line 496: Line 487:
if a.mini then
if a.mini then
if a.text ~= '—' and tonumber((a.text:gsub(',', ''):gsub('[kKmMbBtT%%]$', ''))) ~= nil then
node_card:tag('span'):addClass('card-text'):wikitext(a.text)
end
if lib.isNotEmpty(a.icon_right) then
if lib.isNotEmpty(a.icon_right) then
node_card:tag('span')
node_card:tag('span')
Line 514: Line 502:
end
end
if a.stars then
if a.stars then
local starsImage = a.miliastra_wonderland and MILIASTRA_WONDERLAND_QUALITY_STARS[a.quality] or QUALITY_STARS[a.quality]
local starsImage = QUALITY_STARS[a.quality]
if starsImage then
if starsImage then
node_card:tag('span')
node_card:tag('span')
Line 546: Line 534:
end
end
local node_text = node_card:tag('span')
if lib.isNotEmpty(a.text) then
:addClass('card-text')
local node_text = node_card:tag('span')
:addClass('card-font')
:addClass('card-text')
:addClass(a.text_size and 'card-text-' .. a.text_size or '')
:addClass('card-font')
:wikitext(' ', a.text)
:wikitext(a.text)
if a.multiline_text then
node_text:addClass('multi-line')
if a.text_size then
node_text:addClass('card-text-' .. a.text_size)
end
if a.multiline_text then
node_text:addClass('multi-line')
end
end
end