diff --git a/main.user.js b/main.user.js index 8548133..2c73182 100644 --- a/main.user.js +++ b/main.user.js @@ -1,7 +1,7 @@ // ==UserScript== // @name 灰机wiki查看版本历史 // @namespace https://github.com/gui-ying233/huijiHistory -// @version 2.1.0 +// @version 2.2.0 // @description 以另一种方式查看灰机wiki版本历史(绕过权限错误)。 // @author 鬼影233, Honoka55 // @match *.huijiwiki.com/* @@ -26,6 +26,17 @@ }); if (!document.body.getElementsByClassName("permissions-errors")[0]) return; + const parseDate = timestamp => { + const date = new Date(timestamp); + return `${date.getFullYear()}年${ + date.getMonth() + 1 + }月${date.getDate()}日 (${ + ["日", "一", "二", "三", "四", "五", "六"][date.getDay()] + }) ${date.getHours().toString().padStart(2, 0)}:${date + .getMinutes() + .toString() + .padStart(2, 0)}`; + }; switch (mw.config.get("wgAction")) { case "history": const pageName = mw.config.get("wgPageName"); @@ -74,7 +85,6 @@ }) => { const li = document.createElement("li"); li.dataset.mwRevid = revid; - const date = new Date(timestamp); const newestRev = mw.config.get("wgCurRevisionId") === revid; @@ -101,33 +111,15 @@ { oldid: revid, } - )}" class="mw-changeslist-date" title="${pageName}"> - ${date.getFullYear()}年${date.getMonth() + 1}月${date.getDate()}日 (${ - [ - "日", - "一", - "二", - "三", - "四", - "五", - "六", - ][date.getDay()] - }) ${date - .getHours() - .toString() - .padStart(2, 0)}:${date - .getMinutes() - .toString() - .padStart( - 2, - 0 - )}\u200E ${parseDate( + timestamp + )}\u200E ${user}(${user}(讨论 | 贡献)\u200E . . (${size}字节)\u200E . . (${comment})`; + )}" class="mw-usertoollinks-contribs user-link" title="Special:Contributions/${user}">贡献)\u200E . . (${size}字节)\u200E . . (${comment})`; document .getElementById("pagehistory") .appendChild(li); @@ -170,7 +162,11 @@ .done(d => { document.getElementById( "mw-content-text" - ).innerHTML = `
(没有差异) |
(没有差异) |