Modul:EinklappHilfsSkripte: Unterschied zwischen den Versionen
Erscheinungsbild
should now support changing the default collapsible state for the Screenshot box. |
now it should work |
||
| Zeile 51: | Zeile 51: | ||
collapsedstring='' | collapsedstring='' | ||
if iscollapsible==1 then | if iscollapsible==1 then | ||
collapsedstring= | collapsedstring='mw-collapsible' | ||
if isalreadycollapsed==1 then | if isalreadycollapsed==1 then | ||
collapsedstring=collapsedstring .. ' mw-collapsed' | collapsedstring=collapsedstring .. ' mw-collapsed' | ||
| Zeile 58: | Zeile 58: | ||
CssStyleString='' | CssStyleString='' | ||
CssStylePart='' | CssStylePart= collapsedstring .. ' ' .. otherclasses | ||
if CssStylePart=='' then | if CssStylePart==' ' then | ||
-- There is no style specification, so no need to add anything | -- There is no style specification, so no need to add anything | ||
CssStyleString='' | CssStyleString='' | ||
else | else | ||
CssStyleString='style=' .. CssStylePart | CssStyleString='style=\"' .. CssStylePart .. '\"' | ||
end | end | ||
Version vom 1. März 2024, 21:57 Uhr
Die Dokumentation für dieses Modul kann unter Modul:EinklappHilfsSkripte/Doku erstellt werden
local p = {}
function p.collapsibleclasstext(frame)
iscollapsible=tonumber(frame.args[1])
isalreadycollapsed=tonumber(frame.args[2])
hasmaximumwidth=tonumber(frame.args[3])
boxcssclass=tostring(frame.args[4])
collapsedstring=''
widthstring=''
CssStyleString=' '
if hasmaximumwidth==1 then
-- Das ist ziemlich unelegant: Die Box ist links 2em eingerückt, deswegen können wir nicht width:100% nehmen.
-- em-Angaben scheinen aber mit width nicht zu funktionieren im Zusammenspiel mit 100%.
-- Deswegen verwenden wir einfach einen anderen Wert, der vom Aussehen her ungefähr passt.
widthstring=widthstring .. '\"width:94%;\"'
CssStyleString='style=' .. widthstring
end
if iscollapsible==1 then
collapsedstring=collapsedstring .. 'mw-collapsible'
if isalreadycollapsed==1 then
collapsedstring=collapsedstring .. ' mw-collapsed'
end
end
-- collapsedstring='mw-collapsible'
CssClassString='class=\"' .. collapsedstring .. ' ' .. boxcssclass .. ' wikitable\"';
--CssClassString='class=\"' .. 'mw-collapsible ' .. ' beispielboxtable wikitable\"';
FullCssString=CssClassString .. CssStyleString
return FullCssString;
end
--This is a function to only return Css style information
--e.g. "style = mw-collapsible mw-collapsed someotherclass'.
--'someotherclass' is given in args[3].
--this duplicates some parts of the collapsibleclasstext function above,
--if I ever get the time I should probably clean this up.
--Momentan wird das vor allem für die ScreenshotBox genutzt
function p.classstring_addcollapsible(frame)
iscollapsible=tonumber(frame.args[1])
isalreadycollapsed=tonumber(frame.args[2])
otherclasses=tostring(frame.args[3])
collapsedstring=''
if iscollapsible==1 then
collapsedstring='mw-collapsible'
if isalreadycollapsed==1 then
collapsedstring=collapsedstring .. ' mw-collapsed'
end
end
CssStyleString=''
CssStylePart= collapsedstring .. ' ' .. otherclasses
if CssStylePart==' ' then
-- There is no style specification, so no need to add anything
CssStyleString=''
else
CssStyleString='style=\"' .. CssStylePart .. '\"'
end
return CssStyleString;
end
return p