Zuletzt bearbeitet vor einem Jahr
von Redaktion

Modul:IndicatorProcess: Unterschied zwischen den Versionen

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..."
 
K 1 Version importiert
 
(4 dazwischenliegende Versionen von 3 Benutzern werden nicht angezeigt)
Zeile 6: Zeile 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 = 'orange'
     color = '#CC8500'
    shape = '&#9680;'
    statusind = 'ablaufend'
     end
     end
     if ( timeU < todayU ) then
     if ( timeU < todayU ) then
     color = 'red'
     color = 'red'
    shape = '&#9678;'
    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 color in hidden text makes the indicator sortable in tables
-- adding the statusind in hidden text makes the indicator sortable in tables
     return "<span class='date-indicator' style='color: " .. color .. ";font-size:1em;'>&#9673;<span style='display:none;'>" .. color .. "</span></span>";
     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

Aktuelle Version vom 29. April 2025, 13:34 Uhr

Die Dokumentation für dieses Modul kann unter Modul:IndicatorProcess/Doku erstellt werden

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 = '&#9673;'  -- different shapes for accessibility WCAG 1.4.1
    local statusind = 'aktuell'
    if ( timeU < soonU ) then
    	color = '#CC8500'
    	shape = '&#9680;'
    	statusind = 'ablaufend'
    end
    if ( timeU < todayU ) then
    	color = 'red'
    	shape = '&#9678;'
    	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