Module:Splash: Difference between revisions
imported>Ttv pedro270707 m (Splash can now be chosen if desired. The argument is "splash".) |
imported>Ttv pedro270707 m (Splash can now be chosen if desired. The argument is "splash".) |
(No difference)
|
Revision as of 15:15, 12 March 2023
Documentation for this module may be created at Module:Splash/doc
local p = {} local splashes = require("Module:Splash/splashes") function p.generateSplash( f ) local args = f if f == mw.getCurrentFrame() then args = require( 'Module:ProcessArgs' ).merge( true ) else f = mw.getCurrentFrame() end math.randomseed(os.time()) local randomSplash = "missingno" if args.splash then randomSplash = args.splash elseif os.date("*t", os.time()).month == 1 and os.date("*t", os.time()).day == 19 then randomSplash = "Happy birthday, jonkadelic!" elseif os.date("*t", os.time()).month == 4 and os.date("*t", os.time()).day == 29 then randomSplash = "Happy birthday, MaggAndGeez!" elseif os.date("*t", os.time()).month == 5 and os.date("*t", os.time()).day == 17 then randomSplash = "Happy birthday, Minecraft!" elseif os.date("*t", os.time()).month == 12 and os.date("*t", os.time()).day == 24 then randomSplash = "Merry X-mas!" elseif os.date("*t", os.time()).month == 1 and os.date("*t", os.time()).day == 1 then randomSplash = "Happy new year!" else randomSplash = splashes.splashes[math.random(#splashes.splashes)] end 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