Module:Splash: Difference between revisions
imported>Ttv pedro270707 (Initial splash module) |
imported>Ttv pedro270707 mNo edit summary |
||
Line 3: | Line 3: | ||
function p.generateSplash() | function p.generateSplash() | ||
math.randomseed(os.time()) | |||
local randomSplash = splashes.splashes[math.random(#splashes.splashes)] | local randomSplash = splashes.splashes[math.random(#splashes.splashes)] | ||
mw.html.create('div') | local div = mw.html.create('div') | ||
:addClass('splash-text') | :addClass('splash-text') | ||
:attr('id', 'splash-text') | :attr('id', 'splash-text') | ||
:wikitext(randomSplash) | :wikitext(randomSplash) | ||
:css('font-size', tostring(2880 / (#randomSplash*6 + 32)) .. 'px') | :css('font-size', tostring(2880 / (#randomSplash*6 + 32)) .. 'px') | ||
return div | |||
end | end | ||
return p | return p |
Revision as of 03:04, 5 March 2023
Documentation for this module may be created at Module:Splash/doc
local p = {} local splashes = require("Module:Splash/splashes") function p.generateSplash() math.randomseed(os.time()) local randomSplash = splashes.splashes[math.random(#splashes.splashes)] local div = mw.html.create('div') :addClass('splash-text') :attr('id', 'splash-text') :wikitext(randomSplash) :css('font-size', tostring(2880 / (#randomSplash*6 + 32)) .. 'px') return div end return p