Modul:EinklappHilfsSkripte: Unterschied zwischen den Versionen
Keine Bearbeitungszusammenfassung |
(Jetzt auch an der letzten (und einzig entscheidenden) Stelle style durch class ersetzt) |
||
| (6 dazwischenliegende Versionen desselben Benutzers werden nicht angezeigt) | |||
| Zeile 37: | Zeile 37: | ||
end | 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='' | |||
-- if otherclasses~='' then | |||
-- otherclasses = ' ' .. otherclasses | |||
-- end | |||
CssClassPart = collapsedstring .. otherclasses | |||
if CssClassPart==' ' then | |||
-- There is no style specification, so no need to add anything | |||
CssClassString='' | |||
else | |||
CssClassString='class=\"' .. CssClassPart .. '\"'; | |||
end | |||
return CssClassString; | |||
end | |||
return p | return p | ||
Aktuelle Version vom 1. März 2024, 23:17 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=''
-- if otherclasses~='' then
-- otherclasses = ' ' .. otherclasses
-- end
CssClassPart = collapsedstring .. otherclasses
if CssClassPart==' ' then
-- There is no style specification, so no need to add anything
CssClassString=''
else
CssClassString='class=\"' .. CssClassPart .. '\"';
end
return CssClassString;
end
return p