模块:勋章:修订间差异
跳到导航
跳到搜索
标签:回退 |
小无编辑摘要 |
||
第1行: | 第1行: | ||
local p = {} | local p = {} | ||
-- | --处理可选择人名 | ||
function | function renderSelect(tabIndices, args) | ||
local splitCount = tonumber(args['splitCount']) | |||
local | local tabs_pages = mw.html.create('div') | ||
:addClass('tabs_pages') | |||
:css('display', 'grid') | |||
:css('margin', '2.5%') | |||
:css('gap', '4px') | |||
:css('grid-template-columns', string.rep('1fr ', splitCount)) | |||
for i, tabIndex in ipairs(tabIndices) do | |||
tabs_pages:tag('div') | |||
:addClass('tab') | |||
:css('margin', '0') | |||
:css('padding', '4px') | |||
:css('font-weight', '700') | |||
: | :wikitext(args['tab' .. tabIndex]) | ||
:css(' | |||
:css(' | |||
:css(' | |||
:wikitext(args[' | |||
end | end | ||
return tostring(tabs_pages) | |||
end | |||
--处理感言内容 | |||
function renderContent(tabIndices, args) | |||
local tabs_contents = mw.html.create('div') | |||
:addClass('tabs-contents') | |||
for i, tabIndex in ipairs(tabIndices) do | |||
tabs_contents:tag('div') | |||
:addClass('tab-c') | |||
:wikitext(args['content' .. tabIndex]) | |||
end | end | ||
return | return tostring(tabs_contents) | ||
end | end | ||
function p. | |||
local args={} | function p.testimonials(frame) | ||
local args, tabIndices = {}, {} | |||
-- | |||
--获取页面传来的参数,而非模板本身的参数 | |||
local parent_args = frame:getParent().args; | local parent_args = frame:getParent().args; | ||
--可自定义每行几人,预设5 | |||
if args['splitCount'] == nil then args['splitCount'] = 5 end | |||
--将获取的参数传给args | --将获取的参数传给args | ||
for k, v in pairs(parent_args) do | for k, v in pairs(parent_args) do | ||
if v ~= 'nil' then | if v ~= 'nil' then args[k] = v end --避免空的参数 | ||
end | end | ||
--|tab(x) 的数字可能非123...,可能是012...、037...等 | |||
--用于处理上述情况 | |||
for k, v in pairs(args) do | for k, v in pairs(args) do | ||
local tabIndex = ('' .. k):match('^tab(%d+)$') | |||
local | if tabIndex then table.insert(tabIndices, tonumber(tabIndex)) end | ||
if | |||
end | end | ||
table.sort( | table.sort(tabIndices) | ||
--处理勋章 | --处理勋章 | ||
local mainDiv = | local mainDiv = mw.html.create('div') | ||
:addClass('tabs-container') | |||
mainDiv:node(renderSelect(tabIndices, args)) | |||
mainDiv:node(renderContent(tabIndices, args)) | |||
return tostring(mainDiv) | return tostring(mainDiv) |
2022年6月7日 (二) 13:45的版本
-{}- if args['cost' .. awardNum] then local cost = infoTable:tag('tr') cost :tag('th') :wikitext('获取条件') :done() :tag('td') :wikitext(args['cost' .. awardNum]) :done() end
-{}- {{勋章 |file1 = [[file:D级消费勋章-同盟DIVE.gif]] |name1 = 同盟DIVE |EXP1 = 30天 |author1 = kzdds123 |description1 = 发帖是不可能发帖的,这辈子不可能发帖的, 做活动又不会做 ,就是潜水这种东西 ,才能维持的了生活这样子 }}
脚本错误:函数“awards”不存在。
-{}- {{勋章 |file1 = [[File:限制会员勋章.gif]] |name1 = 限制会员 |author1 = - |cost1 = - |EXP1 = 永久 |description1 = 限制在新手村的时候还请好好学习版规噢! }}
脚本错误:函数“awards”不存在。
-{}- {{勋章 |file1 = [[File:限制会员勋章.gif]] |name1 = LV0:战五路线 |price1 = 5[[节操]] |Purchase1 = 回帖战斗力+100(触发 100%) |EXP1 = 永久 |Effect1 = - |upgrade1 =战斗狂人 |requirements1 = 战斗力≥0 |ability1 = 无效果 |description1 = 主要用于新人因连续两月做降低战斗力任务,<br> 导致战斗力低于-250而无法购买大部分勋章的情况时的补救措施。 }}
脚本错误:函数“awards”不存在。
local p = {} --处理可选择人名 function renderSelect(tabIndices, args) local splitCount = tonumber(args['splitCount']) local tabs_pages = mw.html.create('div') :addClass('tabs_pages') :css('display', 'grid') :css('margin', '2.5%') :css('gap', '4px') :css('grid-template-columns', string.rep('1fr ', splitCount)) for i, tabIndex in ipairs(tabIndices) do tabs_pages:tag('div') :addClass('tab') :css('margin', '0') :css('padding', '4px') :css('font-weight', '700') :wikitext(args['tab' .. tabIndex]) end return tostring(tabs_pages) end --处理感言内容 function renderContent(tabIndices, args) local tabs_contents = mw.html.create('div') :addClass('tabs-contents') for i, tabIndex in ipairs(tabIndices) do tabs_contents:tag('div') :addClass('tab-c') :wikitext(args['content' .. tabIndex]) end return tostring(tabs_contents) end function p.testimonials(frame) local args, tabIndices = {}, {} --获取页面传来的参数,而非模板本身的参数 local parent_args = frame:getParent().args; --可自定义每行几人,预设5 if args['splitCount'] == nil then args['splitCount'] = 5 end --将获取的参数传给args for k, v in pairs(parent_args) do if v ~= 'nil' then args[k] = v end --避免空的参数 end --|tab(x) 的数字可能非123...,可能是012...、037...等 --用于处理上述情况 for k, v in pairs(args) do local tabIndex = ('' .. k):match('^tab(%d+)$') if tabIndex then table.insert(tabIndices, tonumber(tabIndex)) end end table.sort(tabIndices) --处理勋章 local mainDiv = mw.html.create('div') :addClass('tabs-container') mainDiv:node(renderSelect(tabIndices, args)) mainDiv:node(renderContent(tabIndices, args)) return tostring(mainDiv) end return p