hwmlr>Unknown user No edit summary |
m 1 revision imported |
(No difference)
|
Latest revision as of 07:34, 2 May 2025
No content
local p = {} -- p stands for package
function p.forDate( frame )
local todayU = frame:callParserFunction( '#time:U' )
local soonU = frame:callParserFunction( '#time:U', '+2 months' )
local timeU = frame:callParserFunction( '#time:U', frame.args[1] )
local color = 'green'
local shape = '◉' -- different shapes for accessibility WCAG 1.4.1
local statusind = 'aktuell'
if ( timeU < soonU ) then
color = '#CC8500'
shape = '◐'
statusind = 'ablaufend'
end
if ( timeU < todayU ) then
color = 'red'
shape = '◎'
statusind = 'abgelaufen'
end
return p.getIndicator( frame, color, shape, statusind )
end
function p.getIndicator( frame, color, shape, statusind )
-- adding the statusind in hidden text makes the indicator sortable in tables
return "<span class='date-indicator' title='" .. statusind .. "' role='img' style='color: " .. color .. ";font-size:1em;' aria-label='" .. statusind .. "'>" .. shape .. "<span style='display:none'>" .. statusind .. "</span></span>";
end
return p