hw>WikiSysop Created page with "local p = {} -- p stands for package function p.forDate( frame ) local todayU = frame:callParserFunction( '#time:U' ) local soonU = frame:callParserFunction( '#time:U..." |
m 1 revision imported |
||
(6 intermediate revisions by 4 users not shown) | |||
Line 6: | Line 6: | ||
local timeU = frame:callParserFunction( '#time:U', frame.args[1] ) | local timeU = frame:callParserFunction( '#time:U', frame.args[1] ) | ||
local color = 'green' | local color = 'green' | ||
local shape = '◉' -- different shapes for accessibility WCAG 1.4.1 | |||
local statusind = 'aktuell' | |||
if ( timeU < soonU ) then | if ( timeU < soonU ) then | ||
color = ' | color = '#CC8500' | ||
shape = '◐' | |||
statusind = 'ablaufend' | |||
end | end | ||
if ( timeU < todayU ) then | if ( timeU < todayU ) then | ||
color = 'red' | color = 'red' | ||
shape = '◎' | |||
statusind = 'abgelaufen' | |||
end | end | ||
return p.getIndicator( frame, color ) | return p.getIndicator( frame, color, shape, statusind ) | ||
end | end | ||
function p.getIndicator( frame, color ) | function p.getIndicator( frame, color, shape, statusind ) | ||
-- adding the | -- adding the statusind in hidden text makes the indicator sortable in tables | ||
return "<span class='date-indicator' style='color: " .. color .. ";font-size:1em;'> | 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 | end | ||
return p | return p |
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