「モジュール:有無」の版間の差分
表示
細編集の要約なし |
細編集の要約なし |
||
| (同じ利用者による、間の12版が非表示) | |||
| 1行目: | 1行目: | ||
local p = {} | local p = {} | ||
local BG_COLORS = { | local BG_COLORS = { | ||
| 174行目: | 76行目: | ||
BG_LEFT=BG_COLORS.FOR3DS, | BG_LEFT=BG_COLORS.FOR3DS, | ||
FONT_LEFT=FONT_COLORS.ON, | FONT_LEFT=FONT_COLORS.ON, | ||
BORDER_LEFT= | BORDER_LEFT=BG_COLORS.FOR3DS, | ||
BG_RIGHT=BG_COLORS.OFF, | BG_RIGHT=BG_COLORS.OFF, | ||
FONT_RIGHT=FONT_COLORS.OFF, | FONT_RIGHT=FONT_COLORS.OFF, | ||
BORDER_RIGHT= | BORDER_RIGHT=BORDER_COLORS.OFF | ||
} | } | ||
local COLORS_FOR_11 = { | local COLORS_FOR_11 = { | ||
BG_LEFT=BG_COLORS.FOR3DS, | BG_LEFT=BG_COLORS.FOR3DS, | ||
FONT_LEFT=FONT_COLORS.ON, | FONT_LEFT=FONT_COLORS.ON, | ||
BORDER_LEFT= | BORDER_LEFT=BG_COLORS.FOR3DS, | ||
BG_RIGHT=BG_COLORS.FORWIIU, | BG_RIGHT=BG_COLORS.FORWIIU, | ||
FONT_RIGHT=FONT_COLORS.ON, | FONT_RIGHT=FONT_COLORS.ON, | ||
| 203行目: | 105行目: | ||
} | } | ||
local function buildHtmlDivided(colors, textLeft, textRight) | |||
local a = { | |||
'<span style="white-space:nowrap;">', | |||
'<span ', | |||
'style="', | |||
'display:inline-block;', | |||
'bottom:1px;', | |||
'position:relative;', | |||
'line-height:1.5em;', | |||
'text-align:center;', | |||
'font-size:70%;', | |||
'font-weight:bold;', | |||
'width:1.75em;', | |||
'border:solid 1px ' .. colors.BORDER_LEFT .. ';', | |||
'border-radius:1em 0 0 1em;', | |||
'background:' .. colors.BG_LEFT .. ';', | |||
'color:' .. colors.FONT_LEFT .. ';', | |||
'"', | |||
'>', | |||
textLeft, | |||
'</span>', | |||
'<span ', | |||
'style="', | |||
'display:inline-block;', | |||
'bottom:1px;', | |||
'position:relative;', | |||
'line-height:1.5em;', | |||
'text-align:center;', | |||
'font-size:70%;', | |||
'font-weight:bold;', | |||
'width:1.75em;', | |||
'border:solid 1px ' .. colors.BORDER_RIGHT .. ';', | |||
'border-radius:0 1em 1em 0;', | |||
'margin-right:3px;', | |||
'background:' .. colors.BG_RIGHT .. ';', | |||
'color:' .. colors.FONT_RIGHT .. ';', | |||
'"', | |||
'>', | |||
textRight, | |||
'</span>', | |||
'</span>' | |||
} | |||
return table.concat(a, "") | |||
end | |||
local function buildHtmlOne(colors, text) | |||
local a = { | |||
'<span style="white-space:nowrap;">', | |||
'<span ', | |||
'style="', | |||
'display:inline-block;', | |||
'bottom:1px;', | |||
'position:relative;', | |||
'line-height:1.5em;', | |||
'text-align:center;', | |||
'font-size:70%;', | |||
'font-weight:bold;', | |||
'width:3.5em;', | |||
'border:solid 1px ' .. colors.BORDER .. ';', | |||
'border-radius:1em;', | |||
'margin-right:3px;', | |||
'background:' .. colors.BG .. ';', | |||
'color:' .. colors.FONT .. ';', | |||
'"', | |||
'>', | |||
text, | |||
'</span>', | |||
'</span>' | |||
} | |||
return table.concat(a, "") | |||
end | |||
function | function getHtmlDevided(on) | ||
if on == '0/0' then | if on == '0/0' then | ||
return | return buildHtmlDivided(COLORS_FOR_00, '3', 'U') | ||
elseif on == '0/1' then | elseif on == '0/1' then | ||
return | return buildHtmlDivided(COLORS_FOR_01, '3', 'U') | ||
elseif on == '1/0' then | elseif on == '1/0' then | ||
return | return buildHtmlDivided(COLORS_FOR_10, '3', 'U') | ||
elseif on == '1/1' then | elseif on == '1/1' then | ||
return | return buildHtmlDivided(COLORS_FOR_11, '3', 'U') | ||
else | else | ||
return | return buildHtmlDivided(COLORS_FOR_11, '3', 'U') | ||
end | end | ||
end | end | ||
function | function getHtmlOneOn(title) | ||
if title == TITLES.N64 then | if title == TITLES.N64 then | ||
return | return buildHtmlOne(COLORS_64, TITLES.N64) | ||
elseif title == TITLES.DX then | elseif title == TITLES.DX then | ||
return | return buildHtmlOne(COLORS_DX, TITLES.DX) | ||
elseif title == TITLES.X then | elseif title == TITLES.X then | ||
return | return buildHtmlOne(COLORS_X, TITLES.X) | ||
elseif title == TITLES.FOR3DS then | elseif title == TITLES.FOR3DS then | ||
return | return buildHtmlOne(COLORS_3DS, TITLES.FOR3DS) | ||
elseif title == TITLES.FORWIIU then | elseif title == TITLES.FORWIIU then | ||
return | return buildHtmlOne(COLORS_WIIU, TITLES.FORWIIU) | ||
elseif title == TITLES.SP then | elseif title == TITLES.SP then | ||
return | return buildHtmlOne(COLORS_SP, TITLES.SP) | ||
else | else | ||
return | return buildHtmlOne(COLORS_UNKNOWN, '?') | ||
end | end | ||
end | end | ||
function | function getHtmlOneOff(title) | ||
local t = '' | local t = '' | ||
if title == TITLES.N64 then | if title == TITLES.N64 then | ||
| 254行目: | 229行目: | ||
end | end | ||
return | return buildHtmlOne(COLORS_OFF, t) | ||
end | end | ||
--[[ | --[[ | ||
| 264行目: | 239行目: | ||
if a.title == TITLES.FOR then | if a.title == TITLES.FOR then | ||
return | return getHtmlDevided(a.on) | ||
end | end | ||
if a.on == '0' then | if a.on == '0' then | ||
return | return getHtmlOneOff(a.title) | ||
end | end | ||
return | return getHtmlOneOn(a.title) | ||
end | end | ||
return p | return p | ||
2026年3月9日 (月) 07:46時点における最新版
このモジュールについての説明文ページを モジュール:有無/doc に作成できます
local p = {}
local BG_COLORS = {
OFF="#FFF",
N64="rgb(151,114,19)",
DX="#705DA8",
X="#FE6061",
FOR3DS='#9A1424',
FORWIIU='#0096C8',
SP='repeating-linear-gradient(-45deg, #4d4d4d, #4d4d4d 1px, #000 1px, #000 4px)',
UNKNOWN='#008000'
}
local FONT_COLORS = {
OFF="#808080",
ON="#FFF"
}
local BORDER_COLORS = {
ON="transparent",
OFF="#ccc"
}
local COLORS_OFF = {
BG=BG_COLORS.OFF,
FONT=FONT_COLORS.OFF,
BORDER=BORDER_COLORS.OFF
}
local COLORS_UNKNOWN = {
BG=BG_COLORS.UNKNOWN,
FONT=FONT_COLORS.ON,
BORDER=BORDER_COLORS.ON
}
local COLORS_64 = {
BG=BG_COLORS.N64,
FONT=FONT_COLORS.ON,
BORDER=BORDER_COLORS.ON
}
local COLORS_DX = {
BG=BG_COLORS.DX,
FONT=FONT_COLORS.ON,
BORDER=BORDER_COLORS.ON
}
local COLORS_X = {
BG=BG_COLORS.X,
FONT=FONT_COLORS.ON,
BORDER=BORDER_COLORS.ON
}
local COLORS_3DS = {
BG=BG_COLORS.FOR3DS,
FONT=FONT_COLORS.ON,
BORDER=BORDER_COLORS.ON
}
local COLORS_WIIU = {
BG=BG_COLORS.FORWIIU,
FONT=FONT_COLORS.ON,
BORDER=BORDER_COLORS.ON
}
local COLORS_FOR_00 = {
BG_LEFT=BG_COLORS.OFF,
FONT_LEFT=FONT_COLORS.OFF,
BORDER_LEFT=BORDER_COLORS.OFF,
BG_RIGHT=BG_COLORS.OFF,
FONT_RIGHT=FONT_COLORS.OFF,
BORDER_RIGHT=BORDER_COLORS.OFF
}
local COLORS_FOR_01 = {
BG_LEFT=BG_COLORS.OFF,
FONT_LEFT=FONT_COLORS.OFF,
BORDER_LEFT=BORDER_COLORS.OFF,
BG_RIGHT=BG_COLORS.FORWIIU,
FONT_RIGHT=FONT_COLORS.ON,
BORDER_RIGHT=BG_COLORS.FORWIIU
}
local COLORS_FOR_10 = {
BG_LEFT=BG_COLORS.FOR3DS,
FONT_LEFT=FONT_COLORS.ON,
BORDER_LEFT=BG_COLORS.FOR3DS,
BG_RIGHT=BG_COLORS.OFF,
FONT_RIGHT=FONT_COLORS.OFF,
BORDER_RIGHT=BORDER_COLORS.OFF
}
local COLORS_FOR_11 = {
BG_LEFT=BG_COLORS.FOR3DS,
FONT_LEFT=FONT_COLORS.ON,
BORDER_LEFT=BG_COLORS.FOR3DS,
BG_RIGHT=BG_COLORS.FORWIIU,
FONT_RIGHT=FONT_COLORS.ON,
BORDER_RIGHT=BG_COLORS.FORWIIU
}
local COLORS_SP = {
BG=BG_COLORS.SP,
FONT=FONT_COLORS.ON,
BORDER=BORDER_COLORS.ON
}
local TITLES = {
N64='64',
DX='DX',
X='X',
FOR3DS='3DS',
FORWIIU='WiiU',
FOR='for',
SP='SP'
}
local function buildHtmlDivided(colors, textLeft, textRight)
local a = {
'<span style="white-space:nowrap;">',
'<span ',
'style="',
'display:inline-block;',
'bottom:1px;',
'position:relative;',
'line-height:1.5em;',
'text-align:center;',
'font-size:70%;',
'font-weight:bold;',
'width:1.75em;',
'border:solid 1px ' .. colors.BORDER_LEFT .. ';',
'border-radius:1em 0 0 1em;',
'background:' .. colors.BG_LEFT .. ';',
'color:' .. colors.FONT_LEFT .. ';',
'"',
'>',
textLeft,
'</span>',
'<span ',
'style="',
'display:inline-block;',
'bottom:1px;',
'position:relative;',
'line-height:1.5em;',
'text-align:center;',
'font-size:70%;',
'font-weight:bold;',
'width:1.75em;',
'border:solid 1px ' .. colors.BORDER_RIGHT .. ';',
'border-radius:0 1em 1em 0;',
'margin-right:3px;',
'background:' .. colors.BG_RIGHT .. ';',
'color:' .. colors.FONT_RIGHT .. ';',
'"',
'>',
textRight,
'</span>',
'</span>'
}
return table.concat(a, "")
end
local function buildHtmlOne(colors, text)
local a = {
'<span style="white-space:nowrap;">',
'<span ',
'style="',
'display:inline-block;',
'bottom:1px;',
'position:relative;',
'line-height:1.5em;',
'text-align:center;',
'font-size:70%;',
'font-weight:bold;',
'width:3.5em;',
'border:solid 1px ' .. colors.BORDER .. ';',
'border-radius:1em;',
'margin-right:3px;',
'background:' .. colors.BG .. ';',
'color:' .. colors.FONT .. ';',
'"',
'>',
text,
'</span>',
'</span>'
}
return table.concat(a, "")
end
function getHtmlDevided(on)
if on == '0/0' then
return buildHtmlDivided(COLORS_FOR_00, '3', 'U')
elseif on == '0/1' then
return buildHtmlDivided(COLORS_FOR_01, '3', 'U')
elseif on == '1/0' then
return buildHtmlDivided(COLORS_FOR_10, '3', 'U')
elseif on == '1/1' then
return buildHtmlDivided(COLORS_FOR_11, '3', 'U')
else
return buildHtmlDivided(COLORS_FOR_11, '3', 'U')
end
end
function getHtmlOneOn(title)
if title == TITLES.N64 then
return buildHtmlOne(COLORS_64, TITLES.N64)
elseif title == TITLES.DX then
return buildHtmlOne(COLORS_DX, TITLES.DX)
elseif title == TITLES.X then
return buildHtmlOne(COLORS_X, TITLES.X)
elseif title == TITLES.FOR3DS then
return buildHtmlOne(COLORS_3DS, TITLES.FOR3DS)
elseif title == TITLES.FORWIIU then
return buildHtmlOne(COLORS_WIIU, TITLES.FORWIIU)
elseif title == TITLES.SP then
return buildHtmlOne(COLORS_SP, TITLES.SP)
else
return buildHtmlOne(COLORS_UNKNOWN, '?')
end
end
function getHtmlOneOff(title)
local t = ''
if title == TITLES.N64 then
t = TITLES.N64
elseif title == TITLES.DX then
t = TITLES.DX
elseif title == TITLES.X then
t = TITLES.X
elseif title == TITLES.FOR3DS then
t = TITLES.FOR3DS
elseif title == TITLES.FORWIIU then
t = TITLES.FORWIIU
elseif title == TITLES.SP then
t = TITLES.SP
else
t = '?'
end
return buildHtmlOne(COLORS_OFF, t)
end
--[[
frame.args.title 64|DX|X|3DS|WiiU|for|SP
frame.args.on 0|1|0/0|0/1|1/0|1/1
]]--
function p.main(frame)
local a = frame.args
if a.title == TITLES.FOR then
return getHtmlDevided(a.on)
end
if a.on == '0' then
return getHtmlOneOff(a.title)
end
return getHtmlOneOn(a.title)
end
return p