跳转到内容
打开/关闭搜索
搜索
打开/关闭菜单
397
文件
1979
用户
1.2万
编辑
Gal中文百科
导航
首页
最近更改
随机页面
MediaWiki帮助
特殊页面
在其他项目中
打开/关闭外观设置菜单
无法加载偏好设置。请检查您的网络连接并重试。
重试
打开/关闭个人菜单
未登录
未登录用户的IP地址会在进行任意编辑后公开展示。
user-interface-preferences
个人工具
讨论
贡献
创建账号
登录
编辑“︁
Module
:
剧集列表
”︁
来自Gal中文百科
查看
阅读
编辑源代码
查看历史
associated-pages
模块
讨论
更多操作
更多
工具
链入页面
相关更改
页面信息
警告:
您没有登录。如果您进行任何编辑,您的IP地址会公开展示。如果您
登录
或
创建账号
,您的编辑会以您的用户名署名,此外还有其他益处。
反垃圾检查。
不要
加入这个!
local p = {} local episodes = {} local titleList = {"A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"} local localColSpan = 0 local localRowSpan = 0 local summaryRow = false function episodes.headerRow(frame, text, style, rowStyle, colspan, rowspan) local row = mw.html.create("th") if checknil(text) then localColSpan = localColSpan + 1 row :attr("colspan", (colspan or "1")) :attr("rowspan", (rowspan or tostring(localRowSpan-1))) :cssText("padding:.2em .5em;"..(rowStyle or "")..(style or "")) :wikitext(text) return row end return end function episodes.baseSummaryRow(frame, text, lineColor) local row = mw.html.create("td") if text ~= "" then local summaryDiv = mw.html.create('div') -- Copy and edited from the [[en:Module:Episode list]] :css("max-width", "90vw") :css("position", "sticky") :css("left", "0.2em") :newline() :wikitext(text) row:addClass("description") :attr("colspan", 30) :css("padding", ".5em") :css("text-align", "left") :css("background", "var(--background-color-base, transparent)") :css("color", "var(--color-base)") :css("white-space", "normal") :css("border-bottom", ".3em solid "..(lineColor or "#aaa")) :node(summaryDiv) return mw.html.create("tr"):node(row) end return end function episodes.titleRow(frame, text, subtitle, nativeTitle, rowStyle, style, subtitleStyle, colspan, rowspan) local row = mw.html.create("td") if summaryRow then text = "<strong>"..text.."</strong>" end if checknil(subtitle) then text = text .. "<br /><small style=\"color:gray;" ..(checknil(subtitleStyle) and subtitleStyle or "").. "\"><em>" ..subtitle.. "</em></small>" end if string.find(text or "", "plainlist", 0, true) ~= nil then -- {{ubl}} template fixed text = string.gsub(text, "<br />", "") end if checknil(nativeTitle) then if string.find(nativeTitle, "plainlist", 0, true) ~= nil then text = text.."-{"..string.gsub(string.gsub(nativeTitle, "\"><ul><li>", "\"><ul><li>("),"</li></ul></div>",")</li></ul></div>").."}-" else text = text .. "<br />-{(" ..nativeTitle.. ")}-" end end if checknil(text) then row:attr("colspan", colspan) :attr("rowspan", (summaryRow and "1" or (rowspan or "1"))) :css("text-align", "left") :css("padding", ".2em .5em") :css("line-height", "1.2") :cssText((rowStyle or "")..(style or "")) :wikitext(text) return row end return end function episodes.multipleTitleRow(frame, text, subtitle, nativeTitle, style, rowStyle, subtitleStyle, colspan, rowspan) local row = mw.html.create() if checknil(text) then row:node(episodes.titleRow( frame, text, subtitle, nativeTitle, style, rowStyle, subtitleStyle, colspan, rowspan )):addClass("Title-EX") :attr("scope", "row") :css("height", "2em") return row end return end function episodes.chapterRow(frame, text, style, rowStyle, lineColor) local row = mw.html.create("th") if checknil(text) then if checknil(lineColor) then row:css("border-bottom", ".3em solid"..(lineColor or "#aaa")) end row:attr("colspan", (colspan or "25")) :cssText((rowStyle or "")..(style or "")) :wikitext(text) return row end return end function episodes.baseRow(frame, tableclass, class, text, style, rowStyle, colspan, rowspan) local row = mw.html.create(tableclass or "td") -- Check text if text == "TBA" or text == "待公布" then -- {{TBA}} template text = "待公布" style = "background: #DDF; vertical-align: middle;"..(style == nil and style or "") elseif text == "TBD" or text == "待定" then -- {{TBD}} template text = "待定" style = "background: #FFD; vertical-align: middle;"..(style == nil and style or "") elseif text == "N/A" or text == "不适用" or text == "不适用" or text == "-" then -- {{N/A}} template if text ~= "-" then text = "不适用" end if class ~= nil then class = "table-na skin-invert"..(class.." " or "") end style = "background: var(--background-color-disabled-subtle, #ececec); color: var(--color-disabled, #2c2c2c); vertical-align: middle; font-size: smaller;"..(style == nil and style or "") end if checknil(text) then localColSpan = localColSpan + 1 if summaryRow then if localRowSpan > 0 then rowspan = tostring(localRowSpan-1) else rowspan = "1" end end if string.find(text or "", "data-temp=\"spml\"", 0, true) ~= nil then -- {{spml}} template fixed text = text:gsub("、", "<span style='user-select: none'>、</span>") text = "<span style='white-space:normal'>"..text.."</span>" end row :addClass(class) :attr("scope", "col") :attr("colspan", (colspan or "1")) :attr("rowspan", rowspan or tostring(localRowSpan-1)) :css("text-align", "center") :cssText("padding:.2em .5em;"..(rowStyle or "")..(style or "")) :wikitext(text) return row end return "" end function episodes.listrow(frame, args, id, text, dtext) local htext = "td" if id == 1 then htext = "th" elseif id == 2 then return episodes.titleRow( frame, args["Title"], args["Subtitle"], args["NativeTitle"], args["TitleStyle"], args.Style, args["SubtitleStyle"], args["TitleColSpan"], args["TitleRowSpan"] ) elseif id == 3 then return episodes.multipleTitleRow( frame, args["Title"..text], args["Subtitle"..text], args["NativeTitle"..text], args["Title"..text.."Style"], args.Style, args["Subtitle"..text.."Style"], args["Title"..text.."ColSpan"], args["Title"..text.."RowSpan"] ) elseif id == -1 then return episodes.headerRow( frame, (args[text] or dtext), args[text.."Style"], args.Style, args[text.."ColSpan"], args[text.."RowSpan"] ) end return episodes.baseRow( frame, htext, args[text.."Class"], args[text], args[text.."Style"], args.Style, args[text.."ColSpan"], args[text.."RowSpan"] ) end function checknil(data) return ((data or "") ~= "") end function episodes.base(frame, args) args = args or {} local base = mw.html.create("tr") summaryRow = checknil(args.Summary) and (not checknil(args.SublistOf) or (checknil(args.SublistOf) and mw.title.getCurrentTitle().text ~= args.SublistOf)) if args.Chapter then base:node(episodes.chapterRow(frame, args.Chapter, args.ChapterStyle, args.Style, args.ChapterColSpan, args.LineColor)) return base end base :node(episodes.listrow(frame, args, -1, "Header0")) :node(episodes.listrow(frame, args, -1, "Header1")) if checknil(args["TitleA"]) then localRowSpan = localRowSpan + 1 for i=1,#titleList do if checknil(args["Title"..titleList[i]]) then localRowSpan = localRowSpan + 1 end end else localRowSpan = 0 end if args["Number"] ~= "!INVISIBLE" then base:node(episodes.listrow(frame, args, (summaryRow and 1 or 0), "Number")) end if checknil(args["TitleA"]) then base:node(episodes.listrow(frame, args, 3, "A")) elseif args["Title"] ~= "!INVISIBLE" then base:node(episodes.listrow(frame, args, 2, "")) end for i=0,20 do base:node(episodes.listrow(frame, args, 0, "Aux"..i)) if mw.title.getCurrentTitle().text ~= args.SublistOf then if i%5 == 0 then for j=0+6*((i-5)/5),5+6*((i-5)/5) do base:node(episodes.listrow(frame, args, 0, "SubAux"..i)) end end end end if checknil(args["TitleA"]) then for i=2,#titleList do if checknil(args["Title"..titleList[i]]) then base:tag("tr"):node(episodes.listrow(frame, args, 3, titleList[i])) end end end if summaryRow then base:tag("tr"):node(episodes.baseSummaryRow(frame, args.Summary, args.LineColor)) end return base end function episodes.header(frame, args) args = args or {} local header = mw.html.create((args.ExcludeTableTag and "tr" or "table")) if not args.ExcludeTableTag then header :addClass("wikitable") :addClass("wikiepisodetable") :css("border-collapse", "collapse") :css("border-spacing", "0") :cssText(args.TableStyle) end if (args.Caption or "") ~= "" then header:tag("caption") :cssText(args.CaptionStyle) :wikitext(args.Caption) end local headerRow = header:tag("tr") headerRow :cssText("border-bottom: .3em solid " .. (args.LineColor or "#aaa")) :node(episodes.listrow(frame, args, -1, "Header0")) :node(episodes.listrow(frame, args, -1, "Header1")) if args["Number"] ~= "!INVISIBLE" then headerRow:node(episodes.listrow(frame, args, -1, "Number" , "#")) end if args["Title"] ~= "!INVISIBLE" then headerRow:node(episodes.listrow(frame, args, -1, "Title" , "剧集标题")) end for i=0,20 do headerRow:node(episodes.listrow(frame, args, -1, "Aux"..i)) if mw.title.getCurrentTitle().text ~= args.SublistOf then if i%5 == 0 then for j=0+6*((i-5)/5),5+6*((i-5)/5) do headerRow:node(episodes.listrow(frame, args, -1, "SubAux"..i)) end end end end return tostring(mw.ustring.gsub(tostring(header), "</table>", "")) end function p.mainHeader(frame) local args = require('Module:Arguments').getArgs(frame, { removeBlanks = false, wrappers = "Template:剧集列表/base/header" }) return episodes.header(frame, args) end function p.main(frame) local args = require('Module:Arguments').getArgs(frame, { removeBlanks = false, wrappers = "Template:剧集列表/base" }) return episodes.base(frame, args) end return p
摘要:
请注意,所有对Gal中文百科的贡献均可能会被其他贡献者编辑、修改或删除。如果您不希望您的文字作品被随意编辑,请不要在此提交。
您同时也向我们承诺,您提交的内容为您自己所创作,或是复制自公共领域或类似自由来源(详情请见
Gal中文百科:著作权
)。
未经许可,请勿提交受著作权保护的作品!
取消
编辑帮助
(在新窗口中打开)
此页面嵌入的页面:
Module:剧集列表/doc
(
编辑
)
编辑“︁
Module
:
剧集列表
”︁
来自Gal中文百科