Jump to content

Module:Medals table and Module:Medals table/sandbox: Difference between pages

(Difference between pages)
Page 1
Page 2
Content deleted Content added
cast totals as numbers
 
m Testing dark mode
 
Line 50: Line 50:
local limitReached = false
local limitReached = false
local showLimit = tonumber(args['show_limit'])
local showLimit = tonumber(args['show_limit'])
local lang = mw.getContentLanguage()


local function getFlag(code)
local function getFlag(code)
Line 99: Line 98:
footer = footer .. host .. leading
footer = footer .. host .. leading
end
end
local sticky = frame:extensionTag{ name = "templatestyles", args = {src = "template:sticky header/styles.css" } }
root = root
root = root
Line 106: Line 103:
:addClass('wikitable')
:addClass('wikitable')
:addClass('sortable')
:addClass('sortable')
:addClass('sticky-header-multi')
:addClass('plainrowheaders')
:addClass('plainrowheaders')
:addClass('jquery-tablesorter')
:addClass('jquery-tablesorter')
Line 208: Line 204:
local isHost = args['host_' .. IOC]
local isHost = args['host_' .. IOC]
-- this is mainly for the parameter names example so you can override it.
-- this is mainly for the parameter names example so you can override it.
local total = tonumber(args['total_' .. IOC]) or (gold + silver + bronze)
local total = args['total_' .. IOC] or gold + silver + bronze
local color = isHost and hostColor or defaultRowColor
local color = isHost and hostColor or defaultRowColor


Line 266: Line 262:
:wikitext(nation)
:wikitext(nation)
:tag('td')
:tag('td')
:wikitext(lang:formatNum(gold))
:wikitext(gold)
:tag('td')
:tag('td')
:wikitext(lang:formatNum(silver))
:wikitext(silver)
:tag('td')
:tag('td')
:wikitext(lang:formatNum(bronze))
:wikitext(bronze)
:tag('td')
:tag('td')
:wikitext(lang:formatNum(total))
:wikitext(total)
end
end
remainingEnd = rank
remainingEnd = rank
Line 286: Line 282:
:wikitext(args['remaining_link'] or args['remaining_text'] or 'Remaining')
:wikitext(args['remaining_link'] or args['remaining_text'] or 'Remaining')
:tag('td')
:tag('td')
:wikitext(lang:formatNum(remainingGold))
:wikitext(remainingGold)
:tag('td')
:tag('td')
:wikitext(lang:formatNum(remainingSilver))
:wikitext(remainingSilver)
:tag('td')
:tag('td')
:wikitext(lang:formatNum(remainingBronze))
:wikitext(remainingBronze)
:tag('td')
:tag('td')
:wikitext(lang:formatNum(remainingGold + remainingSilver + remainingBronze))
:wikitext(remainingGold+remainingSilver+remainingBronze)
end
end


Line 315: Line 311:
:attr('colspan', colspan)
:attr('colspan', colspan)
:tag('th')
:tag('th')
:wikitext(lang:formatNum(tonumber(args['total_gold']) or totalGold))
:wikitext(args['total_gold'] or totalGold)
:css('font-weight', 'bold')
:css('font-weight', 'bold')
:tag('th')
:tag('th')
:wikitext(lang:formatNum(tonumber(args['total_silver']) or totalSilver))
:wikitext(args['total_silver'] or totalSilver)
:css('font-weight', 'bold')
:css('font-weight', 'bold')
:tag('th')
:tag('th')
:wikitext(lang:formatNum(tonumber(args['total_bronze']) or totalBronze))
:wikitext(args['total_bronze'] or totalBronze)
:css('font-weight', 'bold')
:css('font-weight', 'bold')
:tag('th')
:tag('th')
:wikitext(lang:formatNum(tonumber(args['grand_total']) or (totalGold + totalSilver + totalBronze)))
:wikitext(args['grand_total'] or totalGold+totalSilver+totalBronze)
:css('font-weight', 'bold')
:css('font-weight', 'bold')
end
end
Line 347: Line 343:
end
end


return header .. sticky .. tostring(root) .. footer
return header .. tostring(root) .. footer
end
end