Module:Animate
From MCC Island Wiki
More actions
Documentation for this module may be created at Module:Animate/doc
local getArgs = require('Module:Arguments').getArgs
local p = {}
function p.animate(frame)
local args = getArgs(frame)
local files = {}
local size = args.size or ''
local link = args.link or ''
for i = 1, 10 do -- arbitrary upper limit for number of frames, change as necessary
if args[i] then
table.insert(files, args[i])
else
break
end
end
if size ~= '' then size = '|' .. size end
if link ~= '' then link = '|link=' .. link end
local images = {}
for _, file in ipairs(files) do
if file == '' then
table.insert(images, '<span><br></span>')
else
table.insert(images, '<span>[[File:' .. file .. size .. link .. ']]</span>')
end
end
images[1] = images[1]:gsub('^<span>', '<span class="animated-active">')
return '<span class="animated">' .. table.concat(images) .. '</span>'
end
return p