模块:Db:修订间差异
MJ Hamster(留言 | 贡献) 小无编辑摘要 |
MJ Hamster(留言 | 贡献) 小无编辑摘要 |
||
| (未显示同一用户的4个中间版本) | |||
| 第371行: | 第371行: | ||
local currentValue = ValueFromValuesByKey(songEntry, conditionField) | local currentValue = ValueFromValuesByKey(songEntry, conditionField) | ||
local match = false | local match = false | ||
if | -- 1. 数字和布尔值的精确匹配 | ||
-- Pack | if currentValue == conditionValue then | ||
if string.upper(currentValue) == string.upper( | match = true | ||
match = true | |||
-- 2. 字符串匹配 | |||
elseif type(currentValue) == 'string' and type(conditionValue) == 'string' then | |||
-- 2a. Pack 字段: 缩写解析后的精确匹配 (Case-insensitive Exact Match) | |||
if isPackFilter then | |||
local targetValue = resolvedConditionValue -- 这会是完整的包名或原始输入 | |||
if string.upper(currentValue) == string.upper(targetValue) then | |||
match = true | |||
end | |||
-- 2b. 其他字符串字段: 模糊匹配 (Case-insensitive Fuzzy Match) | |||
else | |||
local searchString = conditionValue | |||
-- 模糊匹配:只要 currentValue 包含 searchString(不区分大小写) | |||
if string.find(string.upper(currentValue), string.upper(searchString), 1, true) then | |||
match = true | |||
end | |||
end | end | ||
end | end | ||
| 第395行: | 第411行: | ||
local output = {} | local output = {} | ||
-- 检查是否需要禁用宽度设置 | |||
local disableWidths = (#displayFields <= 8) | |||
-- 表格样式 | -- 表格样式 | ||
| 第409行: | 第428行: | ||
local separator = ' ' -- 默认分隔符是空格 | local separator = ' ' -- 默认分隔符是空格 | ||
-- BPM | if not disableWidths then -- 宽度要求失效检查 | ||
-- BPM/Key/Duration 字段,固定宽度 6% | |||
if field == 'bpm' or field == 'key' or field == 'duration' then | |||
headerStyle = ' style="width: 6%;"' | |||
separator = ' | ' | |||
-- Pack 字段,固定宽度 10% | |||
elseif field == 'pack' then | |||
headerStyle = ' style="width: 10%;"' | |||
separator = ' | ' | |||
elseif mode then -- 谱面难度字段 (3.2% 固定宽度) | |||
headerStyle = ' style="width: 3.2%;"' | |||
separator = ' | ' | |||
elseif string.match(field, '_notes$') then -- NOTES 字段 (4% 固定宽度) | |||
headerStyle = ' style="width: 4%;"' | |||
separator = ' | ' | |||
end | |||
end | end | ||
| 第450行: | 第475行: | ||
end | end | ||
-- *** NOTES 字段样式逻辑 (包含 | -- *** NOTES 字段样式逻辑 (包含 _sc_notes 默认颜色) *** | ||
if string.match(field, '_notes$') then | if string.match(field, '_notes$') then | ||
local numValue = tonumber(rawValue) | local numValue = tonumber(rawValue) | ||
| 第458行: | 第483行: | ||
-- 高优先级:应用红/紫色的 formatNotesValue | -- 高优先级:应用红/紫色的 formatNotesValue | ||
formattedValue = formatNotesValue(formattedValue, 'table') | formattedValue = formatNotesValue(formattedValue, 'table') | ||
-- 2. | -- 2. 检查是否为所有 _sc_notes 字段且为低优先级(< 2000) | ||
elseif field | elseif string.match(field, '_sc_notes$') then | ||
-- sc_notes 默认颜色:3d66ff (如果值不是高优先级) | -- sc_notes 默认颜色:3d66ff (如果值不是高优先级) | ||
formattedValue = '<span style="color: #3d66ff;">' .. formattedValue .. '</span>' | formattedValue = '<span style="color: #3d66ff;">' .. formattedValue .. '</span>' | ||