打开/关闭搜索
搜索
打开/关闭菜单
1.2万
1.8万
94
8万
导航
首页
最近更改
特殊页面
上传文件
随机页面
随机页面
随机歌曲
随机P主
编辑相关
帮助
讨论版
公共沙盒
待修改页面
批量上传文件
友情链接
VCPedia
打开/关闭外观设置菜单
通知
打开/关闭个人菜单
未登录
登录后可编辑和发表评论。
user-interface-preferences
个人工具
创建账号
登录
欢迎加入
本站官方QQ群
!
查看“︁Widget:PrefixindexListTable”︁的源代码
来自Vocawiki
更多语言
查看
阅读
查看源代码
查看历史
associated-pages
Widget
讨论
更多操作
←
Widget:PrefixindexListTable
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您没有权限编辑
Widget
命名空间内的页面。
您可以查看和复制此页面的源代码。
<noinclude>本widget是为了提升{{tl|Subpagelist}}的可识别性而设立的 作者:[[User:Nbdd0121|XYZ指示物]]、[[User:AnnAngela]]</noinclude><includeonly><style>table.mw-prefixindex-list-table td{text-align:center;border:1px solid #a7d7f9;width:33%}table.mw-prefixindex-list-table{border-collapse:collapse;margin-bottom:1em;width:100%;}</style><!--{if !isset($wgPrefixindexListTable) || !$wgPrefixindexListTable}--><!--{assign var="wgPrefixindexListTable" value=true scope="global"}--><script> "use strict"; window.RLQ = window.RLQ || []; window.RLQ.push(["jquery", function () { const sort = (() => { const chinesenumSort = (() => { const normalizationList = { 一: "1", 二: "2", 三: "3", 四: "4", 五: "5", 六: "6", 七: "7", 八: "8", 九: "9", }; function alphanum(a, b) { function chunkify(t) { const tz = new Array(); let x = 0, y = -1, n = 0, i, j; while (i = (j = t.charAt(x++)).charCodeAt(0), !!i) { const m = i === 46 || i >= 48 && i <= 57; if (m !== n) { tz[++y] = ""; n = m; } tz[y] += j; } return tz; } const aa = chunkify(a); const bb = chunkify(b); for (let x = 0; aa[x] && bb[x]; x++) { if (aa[x] !== bb[x]) { const c = Number(aa[x]), d = Number(bb[x]); if (c === aa[x] && d === bb[x]) { return c - d; } return aa[x] > bb[x] ? 1 : -1; } } return aa.length - bb.length; } function chineseNorm(_title) { let title = _title.replace(/([一二三四五六七八九])十([一二三四五六七八九])/g, "$1$2").replace(/十(?=[一二三四五六七八九])/g, "1").replace(/十/g, "10"); title = title.replace(/[一二三四五六七八九]/g, (c) => { return normalizationList[c]; }); return title; } return function chinesenumSort(a, b) { const na = chineseNorm(a); const nb = chineseNorm(b); return alphanum(na, nb); }; })(); const proposalSort = (() => { const methods = ["setFullYear", "setMonth", "setDate"]; const nowTime = new Date().getTime(); function parse($ele, cB) { const text = $ele.text(); const isPinned = text.startsWith("【置顶】"); if (!text) { return -1; } const date = new Date(0); const match = Array.from(text.match(/\((\d{4}\.\d{1,2}\.\d{1,2})\)/) || []); if (!match[1]) { return -1; } match[1].split(".").forEach((_v, i) => { const v = +_v; date[methods[i]](i === 1 ? v - 1 : v); }); if (cB && (isPinned || date.getTime() > nowTime - 7 * 24 * 60 * 60 * 1000)) { $ele.css("font-weight", "700"); } return { time: date.getTime(), isPinned }; } return function proposalSort(a, b, cB) { const { time: aT, isPinned: aP } = parse(a, cB); const { time: bT, isPinned: bP } = parse(b, cB); if (cB) { if (aP && !bP) { return -1; } if (!aP && bP) { return 1; } } return aT - bT; }; })(); return function sort(a, b, t, cB) { switch (t) { case "chinesenum": return chinesenumSort($(a).text(), $(b).text()); case "proposal": return proposalSort($(a), $(b), cB); default: throw new ReferenceError("Widget:SortSubpageList: Type is not defined"); } }; })(); $(".subpagelist").each((_, ele) => { const $table = $(ele); const config = $table.find(".subpagelistConfig")[0]; const $list = $table.find(".mw-prefixindex-list"); const list = $list.find("li").toArray(); if (config && config.dataset) { if (config.dataset.sort) { list.sort((a, b) => { return sort(a, b, config.dataset.sort, config.dataset.closeBolb === "true"); }); } if (config.dataset.blueborder) { const table = $("<table/>"); table.addClass("mw-prefixindex-list-table"); list.forEach((li, idx) => { if (idx % 3 === 0) { $("<tr/>").appendTo(table); } $("<td/>").append($(li).children()).appendTo(table.find("tr").last()); }); const lastRow = table.find("tr").last(); const l = 3 - lastRow.find("td").length; for (let i = 0; i < l; i++) { lastRow.append("<td/>"); } $table.append(table); $list.remove(); } else { list.forEach((li) => { $list.append(li); }); if (config.dataset.noAdditionalLineBreak === "true") { const l = 3 - list.length % 3; for (let i = 0; i < l; i++) { $list.append("<br>"); // 黑科技,用 <br> 来调整 } } } } }); }]); </script><!--{/if}--></includeonly>
该页面嵌入的页面:
Template:Tl
(
查看源代码
)
返回
Widget:PrefixindexListTable
。
查看“︁Widget:PrefixindexListTable”︁的源代码
来自Vocawiki