// ==UserScript== // @name 脚本猫脚本站美化 // @namespace https://bbs.tampermonkey.net.cn/ // @version 0.4.0 // @description 脚本猫脚本站个性美化,向下滚动会出现返回顶部按钮! // @author 张仨 // @match https://scriptcat.org/* // @run-at document-end // @grant unsafeWindow // @grant GM_addStyle // ==/UserScript== var toTop = document.createElement("div"); document.body.appendChild(toTop); toTop.className = "back-to-top"; toTop.innerHTML = `` var oBtn = document.querySelector(".back-to-top>button"); window.onscroll = function () { if (getTop() > 80) { oBtn.style.marginTop = "0px"; } else { oBtn.style.marginTop = "80px"; }; }; oBtn.onclick = function () { var timer = setInterval(function () { document.documentElement.scrollTop -= 10; if (getTop() <= 0) { clearInterval(timer); }; }); }; function getTop() { return document.documentElement.scrollTop || document.body.scrollTop; }; GM_addStyle(` .light-layout { background-image: url(https://img30.360buyimg.com/pop/jfs/t1/103195/35/25753/886812/623dc5afE76b0f9fd/917d28dbcacb8348.jpg) !important; background-repeat: no-repeat !important; background-position: top !important; background-attachment: fixed !important; } .light-layout-header { background-color: rgba(255,255,255,0.6) !important; } .light-pagination-item, .light-pagination-item-link, .light-card, .light-collapse, .light-collapse-content { background-color: rgba(255,255,255,0.6) !important; border-radius: 10px !important; } .light-list-items>.mb-3, .light-menu-overflow, .dark-menu-overflow, .dark-input, .light-layout-header>.items-center { background: rgba(0,0,0,0) !important; } .dark-space-item, .light-space-item { cursor: pointer; } .dark-layout { background-image: url(https://pic.rmb.bdstatic.com/bjh/57d2014fbe2c4760c4e32a1fab25a799.jpeg) !important; background-repeat: no-repeat !important; background-position: top !important; background-attachment: fixed !important; } .dark-layout-header { background-color: rgba(30,30,30,0.3) !important; } .dark-list-items>.mb-3, .dark-pagination-item, .dark-pagination-item-link, .dark-card, .dark-collapse, .dark-collapse-content { background-color: rgba(30,30,30,0.6) !important; border-radius: 10px !important; } .dark-card-body>.text-center>.text-gray-500 { color: rgb(126 169 235) !important; } .back-to-top { position: fixed; bottom: 60px; right: 60px; width: 80px; height: 80px; overflow: hidden; z-index: 999999; } .back-to-top button { background-color: rgb(31, 151, 217); width: 80px; height: 80px; border: none; outline: none; cursor: pointer; color: white; font-size: 50px; border-radius: 50px; transition: .6s; margin-top: 80px; } .back-to-top button:hover { opacity: .5; }` )