Module:Speen

From Uncyclopedia, the content-free encyclopedia
Jump to navigation Jump to search
local p = {}

function p.main(frame)
    local args = frame:getParent().args
    local word = args[1] or "Speen"
    
    local root = mw.html.create('span')
    root:addClass('speen-wrapper')
    
    math.randomseed(os.time())

    local len = mw.ustring.len(word)
    for i = 1, len do
        local char = mw.ustring.sub(word, i, i)
        
        if char == " " then
            root:wikitext(" ")
        else
            local letterSpan = root:tag('span')
            letterSpan:addClass('speen-letter')
            letterSpan:wikitext(char)
            
            local randomDelay = math.random() * 2
            letterSpan:css('animation-delay', '-' .. randomDelay .. 's')
        end
    end

    return tostring(root)
end

return p