ARCHIVE.PH MIGHT ACK SOON (GLOWNIGGERS ARE AFTER ITS ADMIN)
ALWAYS USE MULTIPLE ARCHIVES AND REARCHIVE EVERYTHING (on megalodon.jp and other archivers) NOW!!! (possibly a false alarm doey)
Module:Slideshow
From Soyjak Wiki, the free ensoyclopedia
Jump to navigationJump to search
you aren't supposed to fuggen use this, use Template:Slideshow instead
-- If someone could make this work with a stylesheet that would be great, because it broke with it, it's 3 am and I can't be asked to fix it
local p = {}
function p.main(frame)
local args = frame:getParent().args
local count = tonumber(args.count) or 3
local title = args.title or "Slideshow"
local position = args.position or "left"
-- User must provide a unique prefix
local prefix = args.prefix or "slideshow_default"
-- Width and height can be numbers (px) or strings (like "100%")
local width = args.width or 480
local height = args.height or 320
local menuWidth = args.menuWidth or 80 -- default menu column width
-- Add "px" if width/height are numbers
if type(width) == "number" then width = width .. "px" end
if type(height) == "number" then height = height .. "px" end
if type(menuWidth) == "number" then menuWidth = menuWidth .. "px" end
local out = {}
-- Table start
table.insert(out, string.format(
'{| style="float: %s; height: %s; width: %s; border-radius: 3px; border: 1px solid #444;"\n|+ %s\n|-\n',
position, height, width, title
))
-- Menu column
table.insert(out, string.format(
'| style="background: #eee; width: %s; text-align: center; vertical-align: top;" |\n',
menuWidth
))
table.insert(out, string.format('<div style="height: %s; overflow-y: auto; scrollbar-width:thin; overflow-x: hidden;">\n', height))
table.insert(out, '<div style="background: #dedede; margin-bottom: 3px;"><b>Menu</b></div>\n')
table.insert(out, string.format('<div class="slideshow-container" data-slideshow="%s">\n', prefix))
for i = 1, count do
local stitle = args["slide" .. i .. "title"] or ("Slide " .. i)
local slideID = string.format("%s_slide%d", prefix, i)
table.insert(out, string.format(
'<div class="morphlink showhidetext" data-correspondingcontent="%s" ' ..
'style="background-color:#ddd;color:black;padding:2px;border:1px solid #aaa;border-radius:2px;margin-bottom:2px">%s</div>\n',
slideID, stitle
))
end
table.insert(out, "</div>\n") -- close slideshow-container
table.insert(out, "</div>\n") -- close wrapper div for menu scrolling
-- Slides column
table.insert(out, '| style="vertical-align: top;" |\n')
table.insert(out, string.format('<div style="height: %s; overflow-y: auto;">\n', height))
for i = 1, count do
local stitle = args["slide" .. i .. "title"] or ("Slide " .. i)
local scontent = args["slide" .. i .. "content"] or ("Slide " .. i .. " content")
local hidden = (i == 1) and "" or " hiddentext"
local slideID = string.format("%s_slide%d", prefix, i)
table.insert(out, string.format(
'<div id="%s" class="morphcontent%s" style="overflow-y:auto;">' ..
'<div style="background:#dedede"><b>%s</b></div>%s</div>\n',
slideID, hidden, stitle, scontent
))
end
table.insert(out, "</div>\n") -- close wrapper div for slides scrolling
table.insert(out, '|}\n') -- close table
return table.concat(out)
end
return p