メニューを切り替える
Toggle preferences menu
個人設定を切り替える
ログインしていません
編集を行うと、IPアドレスが公開されます。

「モジュール:Tracklist」の版間の差分

提供: MONACA Wiki
編集の要約なし
タグ: 差し戻し済み
編集の要約なし
 
(同じ利用者による、間の10版が非表示)
10行目: 10行目:
local width = {} --列幅格納用テーブル
local width = {} --列幅格納用テーブル
local collapsed = false --折りたたみ可否
local collapsed = false --折りたたみ可否
local writer, lyrics, music, arranger, extra, length = function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end --基本セル関数
local writer, lyrics, music, arranger, strings_arrange, brass_arrange, horn_arrange, orchestra_arrange, remix, singer, extra, length = function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end, function() return '' end --基本セル関数
local md = true --microdata on/off
local md = true --microdata on/off


92行目: 92行目:
md = (args.microdata == 'no') and false or args.id
md = (args.microdata == 'no') and false or args.id
end
end


--[[
--[[
202行目: 203行目:
arranger = function(x) return '<td>' .. (x.arranger or all.arrangements and all.arrangements[2] or all.producing and all.producing[2]  or all.all and all.all[2] or '&nbsp;') .. '</td>' end
arranger = function(x) return '<td>' .. (x.arranger or all.arrangements and all.arrangements[2] or all.producing and all.producing[2]  or all.all and all.all[2] or '&nbsp;') .. '</td>' end
end
end
if credits.strings_arrange then
        result = result .. '<th scope="col" style="width:' .. (args.strings_arrange_width or width.credits) .. ';">ストリングスアレンジ</th>'
        -- ストリングスアレンジセル関数再定義
        strings_arrange = function(x) return '<td>' .. (x.strings_arrange or '&nbsp;') .. '</td>' end
    end
if credits.brass_arrange then
        -- ブラスアレンジ列追加
        result = result .. '<th scope="col" style="width:' .. (args.brass_arrange_width or width.credits) .. ';">ブラスアレンジ</th>'
        -- ブラスアレンジセル関数再定義
        brass_arrange = function(x) return '<td>' .. (x.brass_arrange or '&nbsp;') .. '</td>' end
    end
if credits.horn_arrange then
        -- ホーンアレンジ列追加
        result = result .. '<th scope="col" style="width:' .. (args.horn_arrange_width or width.credits) .. ';">ホーンアレンジ</th>'
        -- ホーンアレンジセル関数再定義
        horn_arrange = function(x) return '<td>' .. (x.horn_arrange or '&nbsp;') .. '</td>' end
    end
if credits.orchestra_arrange then
        -- オーケストラアレンジ列追加
        result = result .. '<th scope="col" style="width:' .. (args.orchestra_arrange_width or width.credits) .. ';">オーケストラアレンジ</th>'
        -- オーケストラアレンジセル関数再定義
        orchestra_arrange = function(x) return '<td>' .. (x.orchestra_arrange or '&nbsp;') .. '</td>' end
    end
if credits.remix then
        -- リミックス列追加
        result = result .. '<th scope="col" style="width:' .. (args.remix_width or width.credits) .. ';">リミックス</th>'
        -- オーケストラアレンジセル関数再定義
        remix = function(x) return '<td>' .. (x.remix or '&nbsp;') .. '</td>' end
    end
if credits.singer then
        -- 歌列追加
        result = result .. '<th scope="col" style="width:' .. (args.singer_width or width.credits) .. ';">歌</th>'
        -- オーケストラアレンジセル関数再定義
        singer = function(x) return '<td>' .. (x.singer or '&nbsp;') .. '</td>' end
    end
if credits.extra then
if credits.extra then
--extra1列追加
--extra列追加
result = result .. '<th scope="col" style="width:' .. (args.extra_width or width.credits) .. ';">' .. credits.extra .. '</th>'
result = result .. '<th scope="col" style="width:' .. (args.extra_width or width.credits) .. ';">' .. credits.extra .. '</th>'
--extra1セル関数再定義
--extraセル関数再定義
extra = function(x) return '<td>' .. (x.extra or '&nbsp;') .. '</td>' end
extra = function(x) return '<td>' .. (x.extra or '&nbsp;') .. '</td>' end
end
end
end
if credits.length then
if credits.length then
--時間列追加
--時間列追加
218行目: 253行目:
length = function(x) return '<td style="padding-right:0.5em; text-align:right; white-space:nowrap;">' .. (x.length and ('<time datetime="'.. string.gsub(x.length, '^(%d+):(%d+)$', 'PT%1M%2S') ..'">' .. x.length .. '</time>') or '&nbsp;') .. '</td>' end
length = function(x) return '<td style="padding-right:0.5em; text-align:right; white-space:nowrap;">' .. (x.length and ('<time datetime="'.. string.gsub(x.length, '^(%d+):(%d+)$', 'PT%1M%2S') ..'">' .. x.length .. '</time>') or '&nbsp;') .. '</td>' end
end
end
end
result = result .. '</tr>'
result = result .. '</tr>'
240行目: 276行目:
for k, v in ipairs(trackA) do
for k, v in ipairs(trackA) do
local color = (v[1] % 2 == 0) and '' or '' --偶数/奇数で別色指定
local color = (v[1] % 2 == 0) and '' or '' --偶数/奇数で別色指定
result = result .. '<tr itemprop="track" itemscope itemtype="http://schema.org/MusicRecording" style="background-color:' .. color .. '; vertical-align:top;"><td style="padding-left:0.5em; text-align:right;"><span itemprop="position">' .. (v['#'] or v[1]) .. '</span>.</td><td>' .. (v.title and ('<span itemprop="name">' .. v.title .. '</span>') or 'タイトルなし') .. (v.note and ('<small>(' .. v.note .. ')</small>') or '') .. '</td>' .. writer(v) .. lyrics(v) .. music(v) .. arranger(v) ..  extra(v) .. length(v) .. '</tr>'
result = result .. '<tr itemprop="track" itemscope itemtype="http://schema.org/MusicRecording" style="background-color:' .. color .. '; vertical-align:top;"><td style="padding-left:0.5em; text-align:right;"><span itemprop="position">' .. (v['#'] or v[1]) .. '</span>.</td><td>' .. (v.title and ('<span itemprop="name">' .. v.title .. '</span>') or 'タイトルなし') .. (v.note and ('<small>(' .. v.note .. ')</small>') or '') .. '</td>' .. writer(v) .. lyrics(v) .. music(v) .. arranger(v) ..  strings_arrange(v) .. brass_arrange(v) .. horn_arrange(v) .. orchestra_arrange(v) .. remix(v) .. singer(v) .. extra(v) .. length(v) .. '</tr>'
end
end
else
else
for k, v in ipairs(trackA) do
for k, v in ipairs(trackA) do
local color = (v[1] % 2 == 0) and '' or ''
local color = (v[1] % 2 == 0) and '' or ''
result = result .. '<tr style="background-color:' .. color .. '; vertical-align:top;"><td style="padding-left:0.5em; text-align:right;">' .. (v['#'] or v[1]) .. '.</td><td>' .. (v.title and ('' .. v.title .. '') or 'タイトルなし') .. (v.note and ('<small>(' .. v.note .. ')</small>') or '') .. '</td>' .. writer(v) .. lyrics(v) .. music(v) .. arranger(v) ..  extra(v) .. length(v) .. '</tr>'
result = result .. '<tr style="background-color:' .. color .. '; vertical-align:top;"><td style="padding-left:0.5em; text-align:right;">' .. (v['#'] or v[1]) .. '.</td><td>' .. (v.title and ('' .. v.title .. '') or 'タイトルなし') .. (v.note and ('<small>(' .. v.note .. ')</small>') or '') .. '</td>' .. writer(v) .. lyrics(v) .. music(v) .. arranger(v) ..  strings_arrange(v) .. brass_arrange(v) .. horn_arrange(v) .. orchestra_arrange(v) .. remix(v) .. singer(v) .. extra(v) .. length(v) .. '</tr>'
end
end
end
end
279行目: 315行目:
total = '<time datetime="PT' .. min .. 'M' .. sec .. 'S">'.. min .. ':' .. sec .. '</time>'
total = '<time datetime="PT' .. min .. 'M' .. sec .. 'S">'.. min .. ':' .. sec .. '</time>'
--合計時間行追加
--合計時間行追加
return '<tr style="text-align:right; font-size:111%;"><th colspan="' .. (col - 1) .. '"><div style="width:7.5em; text-align:left; margin:0 0 0 auto; padding-left:0.5em; white-space:nowrap; font-weight:bold;">合計時間:</div></th><td style="padding-right:0.5em;">'.. total .. '</td></tr>'
return '<tr style="text-align:right; font-size:111%;"><th colspan="' .. (col - 1) .. '"><div style="width:7.5em; text-align:left; margin:0 0 0 auto; padding-left:0.5em; white-space:nowrap; font-weight:bold;>合計時間:</div></th><td style="padding-right:0.5em;">'.. total .. '</td></tr>'
else
else
return ''
return ''
296行目: 332行目:
:wikitext(header() .. body() .. footer()) --tableタグ内
:wikitext(header() .. body() .. footer()) --tableタグ内
:attr({class = 'tracklist', id = args.id or ''})
:attr({class = 'tracklist', id = args.id or ''})
:cssText('display:block; max-width:100%; width:auto; border-spacing:0px; border-collapse:collapse; padding:0.2em; font-size:90%; text-align:left;')
:cssText('display:block; max-width:100%; width:auto; border-spacing:0px; border-collapse:collapse; padding:0.2em; font-size:90%; text-align:left; vertical-align: middle;')
if collapsed then
if collapsed then
--折りたたみ表示追加指定
--折りたたみ表示追加指定
307行目: 343行目:
end
end
return tostring(table)
return tostring(table)
end
-- calc_columns 関数に新しい変数に関する表示可否判定のロジックを追加
local function calc_columns()
    local col = 2 -- #, タイトル
    -- ...
    if credits.strings_arrange then col = col + 1 end
    if credits.brass_arrange then col = col + 1 end
    if credits.horn_arrange then col = col + 1 end
if credits.orchestra_arrange then col = col + 1 end
    if credits.remix then col = col + 1 end
if credits.singer then col = col + 1 end
    return col
end
-- ...
-- calc_width 関数に新しい変数に関する列幅の計算ロジックを追加
local function calc_width()
    local width = {}
    -- ...
    if not credits.strings_arrange then col = col + 1 end
    if not credits.brass_arrange then col = col + 1 end
    if not credits.horn_arrange then col = col + 1 end
    if not credits.orchestra_arrange then col = col + 1 end
if not credits.singer then col = col + 1 end
    if not credits.remix then col = col + 1 end
    return width
end
end


return p
return p