// ==UserScript== // @name 吾爱破解桌面版优化 // @namespace http://tampermonkey.net/ // @version 2025-03-17 // @description 为吾爱破解的桌面版网页增加一些便利性功能 // @author wcx19911123 // @match https://www.52pojie.cn/* // @icon https://www.google.com/s2/favicons?sz=64&domain=52pojie.cn // @grant none // @license MIT // @downloadURL none // ==/UserScript== (function() { 'use strict'; let debug = false; let dgb = function(){ debug && [...arguments].forEach(o => console.log(o)); }; let doWhenThen = function(when, then){ let eventId = setInterval(function(){ let exists = typeof when == 'function' ? when() : when; dgb(exists); if(exists){ clearInterval(eventId); }else{ return; } dgb('then!!'); exists = then(exists); },100); }; doWhenThen(() => document.querySelector('#g_upmine'), o => dgb(o) || o.insertAdjacentHTML('afterend', '|桌面版优化')); let addGlobalCSS = function(id, css){ let style = document.querySelector(`#wcx19911123_${id}_CSS`); if(!style){ document.querySelector('head').insertAdjacentHTML('beforeend', ``); } }; let settings = { 'hideTop2GatesAnd1Tool': '隐藏页面最顶端2个入门1个工具', 'hideSubPageBannerText': '隐藏分区版头说明内容', 'hideSubPageTopThreads': '隐藏分区版头所有置顶帖', }; let readSetting = function(){ let setting = localStorage.getItem('wcx19911123_setting'); if(setting){ setting = JSON.parse(setting); } return setting || {}; }; window.wcx19911123_open_menu = function(obj){ addGlobalCSS('menuTop', ` #wcx19911123_open_menu_top{ position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); background-color: #fff; padding: 20px; border-radius: 10px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.5); z-index: 999; } #wcx19911123_open_menu_top.close{ display: none !important; }`); let menuDiv = document.querySelector('#wcx19911123_open_menu_top'); if(!menuDiv){ window.wcx19911123_setting = readSetting(); document.querySelector('body').insertAdjacentHTML('beforeend', `

桌面版优化设置

${[...Object.keys(settings)].map(o=>`${settings[o]}
`).join('')}
`); } menuDiv?.classList?.remove('close'); }; window.wcx19911123_saveSetting = function(){ localStorage.setItem('wcx19911123_setting', JSON.stringify(window.wcx19911123_setting)); location.reload(); } let setting = readSetting(); if(setting.hideTop2GatesAnd1Tool){ addGlobalCSS('hideTop2GatesAnd1Tool', ` #toptb{ display: none !important; }`); } if(setting.hideSubPageBannerText){ addGlobalCSS('hideSubPageBannerText', ` #ct > div > div.bm.bml.pbn > div.bm_c.cl.pbn{ display: none !important; }`); } if(setting.hideSubPageTopThreads){ addGlobalCSS('hideSubPageTopThreads', ` #threadlisttableid tbody[id^=stickthread_]{ display: none !important; }`); } })();