用来美化 poe.com
// ==UserScript== // @name Poe.com 美化 // @namespace http://tampermonkey.net/ // @version 0.1.2 // @description 用来美化 poe.com // @author poeticalcode // @match https://poe.com/* // @icon https://www.google.com/s2/favicons?sz=64&domain=poe.com // @grant GM_addStyle // @license GNU GPLv3 // ==/UserScript== (function () { 'use strict'; GM_addStyle(` aside{ min-width: unset !important; } section{ max-width: unset !important; width: unset !important; } .Message_botMessageBubble__CPGMI{ background-color: transparent; } .ChatPageMainFooter_footer__Hm4Rt{ padding: 8px 18px; } .ChatMessageInputView_growWrap__mX_pX:after, .ChatMessageInputView_growWrap__mX_pX>.ChatMessageInputView_textInput__Aervw{ border-radius:10px; } `); const link = document.createElement('link'); link.rel = 'stylesheet'; link.href = 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/styles/default.min.css'; document.head.appendChild(link); link.onload = () => { const script = document.createElement('script'); script.src = 'https://cdn.jsdelivr.net/gh/highlightjs/[email protected]/build/highlight.min.js'; document.body.appendChild(script); script.onload = () => { const highlightCode = () => { document.querySelectorAll('pre code').forEach((el) => { !el.classList.contains('hljs') && hljs.highlightElement(el); }); } highlightCode(); let flag = false; let clearId = null; document.querySelector(".InfiniteScroll_scrollContainerReverse__3F2Dd").addEventListener('scroll', () => { clearTimeout(clearId) clearId = setTimeout(() => { highlightCode() }, 500); }); let btn = document.createElement("button") btn.innerText = "折叠"; btn.addEventListener("click", () => { flag = !flag let aside = document.querySelector(".PageWithSidebarLayout_leftSidebar__Y6XQo") aside.style.display = flag ? "none" : "unset" }) let header = document.querySelector(".PageWithSidebarNavbar_navbar__LpjAK") header.firstChild.before(btn); } } })();