import { $$, addStyle, DOMUtils, httpx, log, utils } from "@/env"; import { Panel } from "@components/setting/panel"; import { MTUtils } from "@/utils/MTUtils"; import { unsafeWindow } from "ViteGM"; export const MTGuide = { init() { DOMUtils.onReady(() => { Panel.execMenuOnce("mt-guide-beautifyPage", () => { this.beautifyPage(); }); }); }, /** * 页面美化 */ beautifyPage() { log.info(`页面美化`); addStyle(/*css*/ ` .xst{font-size:15px} td.author_img{width:50px;padding:15px 0} td.author_img img{width:40px;height:40px;border-radius:50%} .list_author{margin-top:2px;color:#999;font-size:12px} .bankuai_tu_by a{color:#999!important} .bankuai_tu_by img{height:16px;margin:1px 1px 0 0;vertical-align:top} tbody a:hover{text-decoration:none;color:#3498db} .byg_th_align em+a{margin-right:5px} `); $$(".bm_c table tbody").forEach(($tbody) => { let $common = $tbody.querySelector("th.common")!; let commonHTML = DOMUtils.html($common); let forumUrl = $common.querySelectorAll("a")[0].getAttribute("href")!; let mid = null; let $uidAnchor = $tbody.querySelector("td.by>cite>a")!; let uid = $uidAnchor.getAttribute("href")!.match(/uid-(\d+)/)![1]; let newHTML = /*html*/ `
[${$tbody.querySelector("tr>td.by>a")!.outerHTML}] ${commonHTML}
作者:  ${$tbody.querySelectorAll("td.by>cite>a")[0].innerHTML} ${$tbody.querySelectorAll("td.by>em>span")[0].innerHTML}    |    最后发表:  ${$tbody.querySelectorAll("td.by>cite>a")[1].innerHTML}    ${$tbody.querySelectorAll("td.by>em>a")[0].innerHTML} ${ $tbody.querySelectorAll("td.num>a")[0].innerText }   ${ $tbody.querySelectorAll("td.num>em")[0].innerText }
`; DOMUtils.html($tbody, newHTML); }); }, };