Module:StoreTableHead: Difference between revisions
Jump to navigation
Jump to search
No edit summary Tag: Reverted |
No edit summary |
||
(11 intermediate revisions by the same user not shown) | |||
Line 10: | Line 10: | ||
{args.buymultiplier,1000}, | {args.buymultiplier,1000}, | ||
{args.sellmultiplier,1000}, | {args.sellmultiplier,1000}, | ||
{args.currency,' | {args.currency,'numulite'}, | ||
{args.namenotes,''}, | {args.namenotes,''}, | ||
{args.delta,0}, | {args.delta,0}, | ||
Line 19: | Line 19: | ||
{args.hidesell,'yes'}, | {args.hidesell,'yes'}, | ||
{args.hidestock,'yes'}, | {args.hidestock,'yes'}, | ||
{args.hiderestock,' | {args.hiderestock,'yes'}, | ||
{args.hidecaption,'no'} | {args.hidecaption,'no'} | ||
} | } | ||
local ret = mw.html.create('') | local ret = mw.html.create('') | ||
Line 28: | Line 30: | ||
ret:tag('caption') | ret:tag('caption') | ||
:css('white-space','nowrap') | :css('white-space','nowrap') | ||
:done() | :done() | ||
end | end | ||
Line 47: | Line 49: | ||
end | end | ||
if not(yesno(hidege)) then | if not(yesno(hidege)) then | ||
ret:tag('th'):attr('data-sort-type', 'number'):wikitext(' | ret:tag('th'):attr('data-sort-type', 'number'):wikitext('Price'):done() | ||
end | end | ||
local i = 1 | local i = 1 |
Latest revision as of 17:10, 1 April 2024
Documentation for this module may be created at Module:StoreTableHead/doc
local p = {}
local params = require('Module:Paramtest')
local yesno = require('Module:Yesno')
local var = mw.ext.VariablesLua
function p.main(frame)
local args = frame:getParent().args
local buymultiplier,sellmultiplier,currency,namenotes,delta,smw,hideimage,hidege,hidebuy,hidesell,hidestock,hiderestock,hidecaption = params.defaults{
{args.buymultiplier,1000},
{args.sellmultiplier,1000},
{args.currency,'numulite'},
{args.namenotes,''},
{args.delta,0},
{args.smw,'yes'},
{args.hideimage,'no'},
{args.hidege,'no'},
{args.hidebuy,'yes'},
{args.hidesell,'yes'},
{args.hidestock,'yes'},
{args.hiderestock,'yes'},
{args.hidecaption,'no'}
}
local ret = mw.html.create('')
if not(yesno(hidecaption)) then
ret:tag('caption')
:css('white-space','nowrap')
:done()
end
ret:tag('tr')
local colspan = yesno(hideimage) and 1 or 2
ret:tag('th'):attr('colspan', colspan):wikitext('Item'):done()
if not(yesno(hidestock)) then
ret:tag('th'):attr('data-sort-type', 'number'):wikitext('Number<br>in stock'):done()
end
if not(yesno(hiderestock)) then
ret:tag('th'):attr('data-sort-type', 'number'):wikitext('Restock<br/>time'):done()
end
if not(yesno(hidesell)) then
ret:tag('th'):attr('data-sort-type', 'number'):wikitext('Price<br>sold at'):done()
end
if not(yesno(hidebuy)) then
ret:tag('th'):attr('data-sort-type', 'number'):wikitext('Price<br>bought at'):done()
end
if not(yesno(hidege)) then
ret:tag('th'):attr('data-sort-type', 'number'):wikitext('Price'):done()
end
local i = 1
while args['column' .. i] do
ret:tag('th'):attr('data-sort-type', 'number'):wikitext(args['column' .. i]):done()
i = i+1
end
ret:done()
return '<table class="wikitable sortable" style="text-align:center;">' .. tostring(ret)
end
return p