Module:YouTube Preview: Difference between revisions
Appearance
Cherrykano (talk | contribs) Created page with "local p = {} local seriesClasses = { ['sunshine'] = llss, ['nijigasaki'] = lln, ['superstar'] = llst, ['hasunosora'] = llll, ['sim'] = llsim, ['gny'] = gny, ['bluebird'] = llbb } local possibleRows = { 'Channel', 'Release', 'Illustration', 'Video', 'Production' } local function buildRow(title, content, style) local row = mw.html.create('div') :addClass('videobox-row') row :tag('div') :addClass('videobox-title') :addClass(style) :wikitext(titl..." |
Cherrykano (talk | contribs) mNo edit summary |
||
| Line 45: | Line 45: | ||
local header = root:tag('div') | local header = root:tag('div') | ||
:addClass(videobox-header) | :addClass('videobox-header') | ||
:addClass(style) | :addClass(style) | ||
:wikitext(frame.args['Title']) | :wikitext(frame.args['Title']) | ||
local video = root:tag('div') | local video = root:tag('div') | ||
:addClass(videobox-video) | :addClass('videobox-video') | ||
:wikitext(string.format('<youtube width="300">%s</youtube>', frame.args['URL'])) | :wikitext(string.format('<youtube width="300">%s</youtube>', frame.args['URL'])) | ||
Revision as of 21:34, 9 April 2026
Documentation for this module may be created at Module:YouTube Preview/doc
local p = {}
local seriesClasses = {
['sunshine'] = llss,
['nijigasaki'] = lln,
['superstar'] = llst,
['hasunosora'] = llll,
['sim'] = llsim,
['gny'] = gny,
['bluebird'] = llbb
}
local possibleRows = {
'Channel',
'Release',
'Illustration',
'Video',
'Production'
}
local function buildRow(title, content, style)
local row = mw.html.create('div')
:addClass('videobox-row')
row
:tag('div')
:addClass('videobox-title')
:addClass(style)
:wikitext(title)
row
:tag('div')
:wikitext(content)
return row
end
function p.main(frame)
local style = 'cat-ll'
if frame.args['Series'] then
style = 'cat-' .. frame.args['Series']
end
local root = mw.html.create('div')
local header = root:tag('div')
:addClass('videobox-header')
:addClass(style)
:wikitext(frame.args['Title'])
local video = root:tag('div')
:addClass('videobox-video')
:wikitext(string.format('<youtube width="300">%s</youtube>', frame.args['URL']))
for v in pairs(possibleRows) do
if frame.args[v] then
root:node(buildRow(v, frame.args[v], style))
end
end
return frame:extensionTag{
name = 'templatestyles',
args = { src = 'Module:YouTube Preview/styles.css' }
} .. tostring(root)
end
return p