Modul:Util: Unterschied zwischen den Versionen

Permanently protected module
IMT HilfeWiki - das Wiki
 
imported>Oetterer
K (Schützte „Modul:Util“: Automatic protection of selected project pages ([Bearbeiten=Nur Administratoren erlauben] (unbeschränkt) [Verschieben=Nur Administratoren erlauben] (unbeschränkt)))
Zeile 7: Zeile 7:
  
 
function p.getSkin()
 
function p.getSkin()
return mw and mw.bootstrap and mw.bootstrap.getSkin() or 'unknown'
+
-- dont shorten this to return mw and mw.bootstrap and mw.bootstrap.getSkin() or 'unknown'
 +
-- or dependant templates will show missing module bootstrap when BSC is not loaded
 +
if mw and mw.bootstrap then
 +
return mw.bootstrap.getSkin()
 +
else
 +
return 'unknown'
 +
end
 
end
 
end
  
 
return p
 
return p

Version vom 7. Oktober 2022, 17:56 Uhr

Documentation icon Module documentation

This module implements various general utility functions to be used via #invoke.

Usage[Quelltext bearbeiten]

{{#invoke:Util|getSkin}}
returns name of active skin, if Extension:BootstrapComponents is installed, "unknown" otherwise.

local p = {}

function p.globalFileExtension()
	-- return '.png'
	return '.svg'
end

function p.getSkin()
	-- dont shorten this to return mw and mw.bootstrap and mw.bootstrap.getSkin() or 'unknown'
	-- or dependant templates will show missing module bootstrap when BSC is not loaded
	if mw and mw.bootstrap then
		return mw.bootstrap.getSkin()
	else
		return 'unknown'
	end
end

return p
Cookies helfen uns bei der Bereitstellung des IMT HilfeWikis. Bei der Nutzung vom IMT HilfeWiki werden die in der Datenschutzerklärung beschriebenen Cookies gespeichert.