[checked revision] | [checked revision] |
(Blanked the page) Tag: Blanking |
No edit summary |
||
(5 intermediate revisions by one other user not shown) | |||
Line 1: | Line 1: | ||
+ | local util_args = require('Module:ArgsUtil') |
||
+ | local util_html = require("Module:HtmlUtil") |
||
+ | local util_toggle = require("Module:ToggleUtil") |
||
+ | local util_vars = require("Module:VarsUtil") |
||
+ | local i18n = require('Module:i18nUtil') |
||
+ | local PlayerTeamHistoryCompact = require('Module:PlayerTeamHistoryCompact')._main |
||
+ | local PlayerTeamHistory = require('Module:PlayerTeamHistory')._main |
||
+ | local NewsQueryPlayer = require('Module:NewsQueryPlayer')._main |
||
+ | |||
+ | local TOGGLES_TABLE = { |
||
+ | order = { 'full', 'compact' }, |
||
+ | } |
||
+ | |||
+ | local TOGGLES_DATE = { |
||
+ | order = { 'approx', 'exact' }, |
||
+ | key = 'date' |
||
+ | } |
||
+ | |||
+ | local h = {} |
||
+ | |||
+ | local p = {} |
||
+ | function p.main(frame) |
||
+ | local args = util_args.merge() |
||
+ | i18n.init('PlayerTimelineSection') |
||
+ | local output = mw.html.create() |
||
+ | local div = output:tag('div') |
||
+ | :addClass('player-history') |
||
+ | h.printContent(div, args) |
||
+ | if util_args.castAsBool(args.suppressoutput) then return '' end |
||
+ | return output, '[[Category:PlayersWithAutomatedNews]]' |
||
+ | end |
||
+ | |||
+ | function h.printContent(output, args) |
||
+ | output:tag('h2') |
||
+ | :wikitext(i18n.print('TeamHistory')) |
||
+ | h.printLowContentIntroIfNeeded(output) |
||
+ | h.printPTH(output, args) |
||
+ | output:tag('h2') |
||
+ | :wikitext(i18n.print('News')) |
||
+ | output:tag('div') |
||
+ | :addClass('player-history-timeline') |
||
+ | :wikitext(tostring(NewsQueryPlayer(args))) |
||
+ | end |
||
+ | |||
+ | function h.printPTH(output, args) |
||
+ | h.printToggler(output) |
||
+ | local div = output:tag('div') |
||
+ | :addClass('player-history-teamlist') |
||
+ | local div2 = div:tag('div'):wikitext(tostring(PlayerTeamHistoryCompact(args))) |
||
+ | local div1 = div:tag('div'):wikitext(tostring(PlayerTeamHistory(args))) |
||
+ | h.printToggleClasses(div1, 'full') |
||
+ | h.printToggleClasses(div2, 'compact') |
||
+ | end |
||
+ | |||
+ | function h.printToggler(tbl) |
||
+ | local div = tbl:tag('div') |
||
+ | :addClass('toggle-button') |
||
+ | div:wikitext(i18n.print('toggleIntro')) |
||
+ | util_toggle.printOptionFromListTogglers(div, TOGGLES_TABLE) |
||
+ | local div2 = tbl:tag('div') |
||
+ | :addClass('toggle-button') |
||
+ | div2:wikitext(i18n.print('toggleDatesIntro')) |
||
+ | util_toggle.printOptionFromListTogglers(div2, TOGGLES_DATE) |
||
+ | util_html.clear(tbl) |
||
+ | return |
||
+ | end |
||
+ | |||
+ | function h.printToggleClasses(div, label) |
||
+ | util_toggle.oflCellClasses(div, TOGGLES_TABLE, label) |
||
+ | end |
||
+ | |||
+ | function h.printLowContentIntroIfNeeded(output) |
||
+ | if not util_vars.getBool('isLowContent') then return end |
||
+ | output:tag('div') |
||
+ | :addClass('low-content-notice-wrapper') |
||
+ | :tag('div') |
||
+ | :addClass('low-content-notice') |
||
+ | :wikitext(i18n.print('lowContentIntro')) |
||
+ | |||
+ | end |
||
+ | |||
+ | return p |
Latest revision as of 16:58, 18 August 2020
Documentation for this module may be created at Module:PlayerTimelineSection/doc
local util_args = require('Module:ArgsUtil')
local util_html = require("Module:HtmlUtil")
local util_toggle = require("Module:ToggleUtil")
local util_vars = require("Module:VarsUtil")
local i18n = require('Module:i18nUtil')
local PlayerTeamHistoryCompact = require('Module:PlayerTeamHistoryCompact')._main
local PlayerTeamHistory = require('Module:PlayerTeamHistory')._main
local NewsQueryPlayer = require('Module:NewsQueryPlayer')._main
local TOGGLES_TABLE = {
order = { 'full', 'compact' },
}
local TOGGLES_DATE = {
order = { 'approx', 'exact' },
key = 'date'
}
local h = {}
local p = {}
function p.main(frame)
local args = util_args.merge()
i18n.init('PlayerTimelineSection')
local output = mw.html.create()
local div = output:tag('div')
:addClass('player-history')
h.printContent(div, args)
if util_args.castAsBool(args.suppressoutput) then return '' end
return output, '[[Category:PlayersWithAutomatedNews]]'
end
function h.printContent(output, args)
output:tag('h2')
:wikitext(i18n.print('TeamHistory'))
h.printLowContentIntroIfNeeded(output)
h.printPTH(output, args)
output:tag('h2')
:wikitext(i18n.print('News'))
output:tag('div')
:addClass('player-history-timeline')
:wikitext(tostring(NewsQueryPlayer(args)))
end
function h.printPTH(output, args)
h.printToggler(output)
local div = output:tag('div')
:addClass('player-history-teamlist')
local div2 = div:tag('div'):wikitext(tostring(PlayerTeamHistoryCompact(args)))
local div1 = div:tag('div'):wikitext(tostring(PlayerTeamHistory(args)))
h.printToggleClasses(div1, 'full')
h.printToggleClasses(div2, 'compact')
end
function h.printToggler(tbl)
local div = tbl:tag('div')
:addClass('toggle-button')
div:wikitext(i18n.print('toggleIntro'))
util_toggle.printOptionFromListTogglers(div, TOGGLES_TABLE)
local div2 = tbl:tag('div')
:addClass('toggle-button')
div2:wikitext(i18n.print('toggleDatesIntro'))
util_toggle.printOptionFromListTogglers(div2, TOGGLES_DATE)
util_html.clear(tbl)
return
end
function h.printToggleClasses(div, label)
util_toggle.oflCellClasses(div, TOGGLES_TABLE, label)
end
function h.printLowContentIntroIfNeeded(output)
if not util_vars.getBool('isLowContent') then return end
output:tag('div')
:addClass('low-content-notice-wrapper')
:tag('div')
:addClass('low-content-notice')
:wikitext(i18n.print('lowContentIntro'))
end
return p