老魔-预览

老王论坛、魔性论坛、司机社 预览帖子图四张

// ==UserScript==
// @name         老魔-预览
// @version      0.3.4
// @namespace    https://sleazyfork.org/zh-CN/users/1461640-%E6%98%9F%E5%AE%BF%E8%80%81%E9%AD%94
// @author       星宿老魔
// @description  老王论坛、魔性论坛、司机社 预览帖子图四张
// @match        https://laowang.vip/*
// @match        https://moxing.app/*
// @match        https://sjs47.com/*
// @match        https://xsijishe.net/*
// @icon         https://www.google.com/s2/favicons?sz=64&domain=laowang.vip
// @license      MIT
// @grant        GM_getValue
// @grant        GM_setValue
// @grant        GM_deleteValue
// @grant        GM_listValues
// @grant        GM_registerMenuCommand
// @run-at       document-start
// ==/UserScript==

(function(){"use strict";const CONFIG={MAX_PREVIEW_IMAGES:4,DETAIL_IMAGES_COUNT:4,rateLimit:{maxConcurrent:3,minDelay:200,maxDelay:400},
CACHE_MAX_AGE:864e5,selectors:{laowang:{threadList:"#threadlist .bm_c",threadItem:"li",threadLink:'div.c.cl a[href*="viewthread"]',threadTitle:"h3 a",
threadAuth:".auth",postImages:".pcb img.zoom[zoomfile], .pattl img.zoom[zoomfile]"},laowangSearch:{threadList:"body",threadItem:"div.result-item",
threadLink:"h3.result-title a",threadTitle:"h3.result-title a",threadAuth:null,postImages:".pcb img.zoom[zoomfile], .pattl img.zoom[zoomfile]"},
moxing:{threadList:"#threadlisttableid",threadItem:'tbody[id^="normalthread_"]',threadLink:"a.s.xst",threadTitle:"a.s.xst",threadAuth:".list_author",
postImages:".t_fsz img.zoom, .t_fsz img.inline-image, .t_fsz img.attach-img"},moxingSearch:{threadList:"#threadlist",threadItem:"li.pbw.z",
threadLink:"h3.xs3 a",threadTitle:"h3.xs3 a",threadAuth:null,postImages:".t_fsz img.zoom, .t_fsz img.inline-image, .t_fsz img.attach-img"},sjs:{
threadList:".nex_forumlist_pics",threadItem:".nex_thread_pics",threadLink:"a",threadTitle:"a",threadAuth:null,postImages:".nex_thread_pics a"}},
styles:{
imagePlaceholder:"\n      width: 100% !important;\n      height: 100% !important;\n      background: #f0f0f0 !important;\n      display: flex !important;\n      align-items: center !important;\n      justify-content: center !important;\n      color: #999 !important;\n      font-size: 12px !important;\n    ",
threadContainer:"\n      display: flex !important;\n      flex-direction: column !important;\n      padding: 15px !important;\n      margin-bottom: 15px !important;\n      background: #fff !important;\n      border: 1px solid #e5e5e5 !important;\n      border-radius: 8px !important;\n      width: 100% !important;\n      box-sizing: border-box !important;\n      opacity: 0 !important;\n      transition: opacity 0.3s ease-in !important;\n    ",
titleContainer:"\n      margin-bottom: 12px !important;\n      font-size: 15px !important;\n      font-weight: 500 !important;\n    ",
previewContainer:"\n      display: block !important;\n      width: 100% !important;\n    ",
imageWrapper:"\n      width: calc(25% - 8px) !important;\n      aspect-ratio: 16/9 !important;\n      overflow: hidden !important;\n      border-radius: 4px !important;\n      cursor: pointer !important;\n      position: relative !important;\n      background: #f5f5f5 !important;\n    ",
image:"\n      width: 100% !important;\n      height: 100% !important;\n      object-fit: contain !important;\n      display: block !important;\n    ",
authInfo:"margin-top: 10px; font-size: 12px; color: #999;",
listContainer:"\n      display: flex !important;\n      flex-direction: column !important;\n      gap: 0 !important;\n      padding: 0 !important;\n    "
}};class Storage{static get(t,e=null){try{const n=GM_getValue(t);if(null==n)return e;try{return JSON.parse(n)}catch{return n}}catch(n){return void 0,e
}}static set(t,e){try{const n=JSON.stringify(e);return GM_setValue(t,n),!0}catch(n){return void 0,!1}}static delete(t){try{return GM_deleteValue(t),!0
}catch(e){return void 0,!1}}static listKeys(){try{return GM_listValues()}catch(t){return void 0,[]}}static migrateFromLocalStorage(t,e=!0){try{
const n=localStorage.getItem(t);if(null!==n){try{const e=JSON.parse(n);this.set(t,e)}catch{GM_setValue(t,n)}return e&&localStorage.removeItem(t),!0}
return!1}catch(n){return void 0,!1}}}const t=class _SimpleCache{constructor(){this.prefix="lwlt_cache_",this.maxAge=CONFIG.CACHE_MAX_AGE}
static getInstance(){return this.instance||(this.instance=new _SimpleCache),this.instance}getCacheKey(t){const e=t.match(/tid=(\d+)/),n=e?e[1]:btoa(t)
;return this.prefix+n}get(t){const e=this.getCacheKey(t),n=Storage.get(e);return n?Date.now()-n.timestamp>this.maxAge?(this.delete(t),
null):n.data:null}set(t,e){const n=this.getCacheKey(t),i={data:e,timestamp:Date.now()};Storage.set(n,i)}delete(t){const e=this.getCacheKey(t)
;return Storage.delete(e)}clear(){Storage.listKeys().forEach(t=>{t.startsWith(this.prefix)&&Storage.delete(t)})}static get(t){
return _SimpleCache.getInstance().get(t)}static set(t,e){_SimpleCache.getInstance().set(t,e)}static delete(t){
return _SimpleCache.getInstance().delete(t)}};t.instance=null;let e=t;const n=class{static async waitForSlot(t){
return this.pendingRequests<t?(this.pendingRequests++,void 0):new Promise(t=>{this.requestQueue.push(()=>{this.pendingRequests++,t()})})}
static releaseSlot(t,e){this.pendingRequests--;const n=t+Math.random()*(e-t);setTimeout(()=>{const t=this.requestQueue.shift();t&&t()},n)}
static async fetchPostImages(t,n,i,r,o){const a=e.get(t);if(a)return void 0,{images:a};void 0,await this.waitForSlot(n);try{
const n=t.includes("moxing.app")?"https://moxing.app/":"https://laowang.vip/",i=await fetch(t,{headers:{"User-Agent":navigator.userAgent,Referer:n}})
;if(!i.ok){return void 0,{images:[],error:429===i.status?"请求过快,请稍后重试":`请求失败 (${i.status})`}}
const r=await i.text(),a=(new DOMParser).parseFromString(r,"text/html");let s=Array.from(a.querySelectorAll(o));0===s.length&&(void 0,
s=t.includes("moxing.app")?Array.from(a.querySelectorAll(".t_fsz img.zoom, .pcb img.zoom, img.zoom[zoomfile]")):Array.from(a.querySelectorAll("img.zoom[zoomfile]")))
;const c=[];for(const e of s){const n=e.getAttribute("zoomfile")||e.getAttribute("file")||e.getAttribute("src");if(!n)continue
;if(n.includes("none.gif"))continue;if(n.includes("static/image"))continue;if(n.includes("/rleft.gif"))continue;if(n.includes("/rright.gif"))continue
;if(n.includes("icon"))continue;if(c.length>=CONFIG.DETAIL_IMAGES_COUNT)break
;const i=t.includes("moxing.app")?"https://moxing.app":"https://laowang.vip",r=n.startsWith("http")?n:`${i}${n}`;c.includes(r)||c.push(r)}
return c.length>0?(e.set(t,c),{images:c}):(void 0,{images:[],error:"无图片"})}catch(s){return void 0,{images:[],error:s instanceof Error?s.message:"网络错误"
}}finally{this.releaseSlot(i,r)}}};n.pendingRequests=0,n.requestQueue=[];let i=n;const r=class{static init(){
this.overlay||(this.overlay=document.createElement("div"),
this.overlay.style.cssText="\n      position: fixed;\n      top: 0;\n      left: 0;\n      width: 100%;\n      height: 100%;\n      background: rgba(0, 0, 0, 0.95);\n      z-index: 999999;\n      display: none;\n      align-items: center;\n      justify-content: center;\n    ",
this.img=document.createElement("img"),
this.img.style.cssText="\n      max-width: 85%;\n      max-height: 85%;\n      object-fit: contain;\n      border-radius: 4px;\n    ",
this.counter=document.createElement("div"),
this.counter.style.cssText="\n      position: absolute;\n      top: 20px;\n      left: 50%;\n      transform: translateX(-50%);\n      color: white;\n      background: rgba(0, 0, 0, 0.6);\n      padding: 8px 16px;\n      border-radius: 20px;\n      font-size: 14px;\n    ",
this.prevBtn=this.createNavButton("‹","left"),this.nextBtn=this.createNavButton("›","right"),this.overlay.appendChild(this.img),
this.overlay.appendChild(this.counter),this.overlay.appendChild(this.prevBtn),this.overlay.appendChild(this.nextBtn),
document.body.appendChild(this.overlay),this.setupEvents())}static createNavButton(t,e){const n=document.createElement("button")
;return n.innerHTML="‹"===t?'<svg viewBox="0 0 24 24" fill="white" width="30" height="30"><path d="M15.41 7.41L14 6l-6 6 6 6 1.41-1.41L10.83 12z"/></svg>':'<svg viewBox="0 0 24 24" fill="white" width="30" height="30"><path d="M10 6L8.59 7.41 13.17 12l-4.58 4.59L10 18l6-6z"/></svg>',
n.style.cssText=`\n      position: fixed;\n      ${e}: 16px;\n      top: 50%;\n      transform: translateY(-50%);\n      width: 40px;\n      height: 40px;\n      background: rgba(255, 255, 255, 0.2);\n      border-radius: 50%;\n      border: none;\n      display: flex;\n      align-items: center;\n      justify-content: center;\n      color: white;\n      cursor: pointer;\n      user-select: none;\n      z-index: 10002;\n    `,
n}static setupEvents(){this.overlay.onclick=t=>{t.target===this.overlay&&this.close()},this.prevBtn.onclick=t=>{t.stopPropagation(),this.prev()},
this.nextBtn.onclick=t=>{t.stopPropagation(),this.next()},document.addEventListener("keydown",t=>{
"flex"===this.overlay?.style.display&&("Escape"===t.key?this.close():"ArrowLeft"===t.key?this.prev():"ArrowRight"===t.key&&this.next())})}
static show(t,e=0){this.init(),this.images=t,this.currentIndex=e,this.updateImage(),this.overlay.style.display="flex"}static close(){
this.overlay&&(this.overlay.style.display="none")}static prev(){this.currentIndex=(this.currentIndex-1+this.images.length)%this.images.length,
this.updateImage()}static next(){this.currentIndex=(this.currentIndex+1)%this.images.length,this.updateImage()}static updateImage(){
const t=this.images[this.currentIndex];this.img.style.display="none",this.img.src="",
this.counter.textContent=`${this.currentIndex+1} / ${this.images.length}`,this.images.length<=1?(this.prevBtn.style.display="none",
this.nextBtn.style.display="none",this.counter.style.display="none"):(this.prevBtn.style.display="flex",this.nextBtn.style.display="flex",
this.counter.style.display="block"),this.img.onload=()=>{this.img.style.display="block"},this.img.onerror=()=>{this.img.alt="图片加载失败"},this.img.src=t}}
;r.overlay=null,r.img=null,r.counter=null,r.prevBtn=null,r.nextBtn=null,r.images=[],r.currentIndex=0;let o=r;class ThreadRenderer{
static showError(t,e,n,i){const r=t.querySelector(".preview-container");if(!r)return;const o=window.scrollY;r.innerHTML=""
;const a=document.createElement("div")
;a.style.cssText="\n      width: 100% !important;\n      padding: 20px !important;\n      text-align: center !important;\n      background: #fff3cd !important;\n      border: 1px solid #ffc107 !important;\n      border-radius: 4px !important;\n      color: #856404 !important;\n    "
;const s=document.createElement("div");s.style.cssText="margin-bottom: 10px !important; font-size: 14px !important;",s.textContent=`⚠️ ${n}`
;const l=document.createElement("button")
;l.textContent="点击重试",l.style.cssText="\n      padding: 6px 16px !important;\n      background: #ffc107 !important;\n      border: none !important;\n      border-radius: 4px !important;\n      color: #000 !important;\n      cursor: pointer !important;\n      font-size: 13px !important;\n    ",
l.onclick=async n=>{n.preventDefault(),n.stopPropagation(),l.textContent="加载中...",l.disabled=!0
;const{ThreadProcessor:r}=await Promise.resolve().then(()=>c);r.retryLoadThread(t,e,i)},a.appendChild(s),a.appendChild(l),r.appendChild(a),
requestAnimationFrame(()=>{window.scrollTo(0,o)})}static renderThreadCard(t,e,n,i,r){const o=window.scrollY
;"moxing"===r||"moxingSearch"===r?this.renderMoxingPreview(t):"laowangSearch"===r?this.renderLaowangSearchCard(t,e,n):this.renderLaowangCard(t,e,n,i),
t.setAttribute("data-processed","1"),requestAnimationFrame(()=>{window.scrollTo(0,o)})}static renderMoxingPreview(t){
const e=document.createElement("tr");e.className="custom-preview-row";const n=document.createElement("td");n.colSpan=100,
n.style.cssText="padding: 10px 20px; background: transparent;";const i=document.createElement("div")
;i.style.cssText="\n      display: flex !important;\n      gap: 8px !important;\n      width: 100% !important;\n    ",i.className="preview-container"
;for(let r=0;r<CONFIG.MAX_PREVIEW_IMAGES;r++){const t=document.createElement("div")
;t.style.cssText="\n        flex: 1 !important;\n        min-width: 0 !important;\n        height: 200px !important;\n        background: #f0f0f0 !important;\n        border-radius: 4px !important;\n        overflow: hidden !important;\n        display: flex !important;\n        align-items: center !important;\n        justify-content: center !important;\n        color: #999 !important;\n        font-size: 12px !important;\n      ",
t.textContent="加载中...",i.appendChild(t)}n.appendChild(i),e.appendChild(n),t.appendChild(e)}static renderLaowangCard(t,e,n,i){
t.style.cssText=CONFIG.styles.threadContainer;const r=document.createElement("div");r.style.cssText=CONFIG.styles.titleContainer,
r.innerHTML=`<a href="${e}" style="color: #333; text-decoration: none;">${n}</a>`;const o=document.createElement("div")
;o.style.cssText="\n      display: flex !important;\n      gap: 8px !important;\n      width: 100% !important;\n    ",o.className="preview-container"
;for(let a=0;a<CONFIG.MAX_PREVIEW_IMAGES;a++){const t=document.createElement("div")
;t.style.cssText="\n        flex: 1 !important;\n        min-width: 0 !important;\n        height: 200px !important;\n        background: #f0f0f0 !important;\n        border-radius: 4px !important;\n        overflow: hidden !important;\n        display: flex !important;\n        align-items: center !important;\n        justify-content: center !important;\n        color: #999 !important;\n        font-size: 12px !important;\n      ",
t.textContent="加载中...",o.appendChild(t)}t.innerHTML="",t.appendChild(r),t.appendChild(o),i&&(i.style.cssText=CONFIG.styles.authInfo,t.appendChild(i)),
t.style.opacity="1"}static renderLaowangSearchCard(t,e,n){const i=document.createElement("div")
;i.style.cssText="\n      display: flex !important;\n      gap: 8px !important;\n      width: 100% !important;\n      margin-top: 12px !important;\n    ",
i.className="preview-container";for(let r=0;r<CONFIG.MAX_PREVIEW_IMAGES;r++){const t=document.createElement("div")
;t.style.cssText="\n        flex: 1 !important;\n        min-width: 0 !important;\n        height: 200px !important;\n        background: #f0f0f0 !important;\n        border-radius: 4px !important;\n        overflow: hidden !important;\n        display: flex !important;\n        align-items: center !important;\n        justify-content: center !important;\n        color: #999 !important;\n        font-size: 12px !important;\n      ",
t.textContent="加载中...",i.appendChild(t)}t.appendChild(i)}static updateAllImages(t,e){const n=t.querySelector(".preview-container");if(!n)return
;const i=window.scrollY;n.innerHTML="";const r=document.createElement("div")
;r.style.cssText="\n      display: flex !important;\n      gap: 8px !important;\n      width: 100% !important;\n    ",e.forEach((t,n)=>{
const i=document.createElement("div")
;i.style.cssText="\n        flex: 1 !important;\n        min-width: 0 !important;\n        height: 200px !important;\n        background: #f5f5f5 !important;\n        border-radius: 4px !important;\n        overflow: hidden !important;\n        cursor: pointer !important;\n        display: flex !important;\n        align-items: center !important;\n        justify-content: center !important;\n      "
;const a=document.createElement("img")
;a.src=t,a.loading="lazy",a.style.cssText="\n        max-width: 100% !important;\n        max-height: 100% !important;\n        width: auto !important;\n        height: auto !important;\n        object-fit: contain !important;\n        display: block !important;\n      ",
i.onclick=t=>{t.preventDefault(),t.stopPropagation(),o.show(e,n)},i.appendChild(a),r.appendChild(i)}),n.appendChild(r),requestAnimationFrame(()=>{
window.scrollTo(0,i)})}static adjustListContainerStyle(t){const e=t.querySelector("ul");e&&(e.style.display="block",e.style.position="relative")}}
const a=class{static processThreadList(t){const e=CONFIG.selectors[t],n=document.querySelector(e.threadList);if(!n)return
;const i=Array.from(n.querySelectorAll(e.threadItem)).filter(t=>t.querySelector(e.threadLink));ThreadRenderer.adjustListContainerStyle(n),
this.initLazyLoading(i,t)}static initLazyLoading(t,n){this.observer=new IntersectionObserver(t=>{t.forEach(t=>{if(t.isIntersecting){const e=t.target
;if(e.getAttribute("data-loaded"))return;this.loadThread(e,n),this.observer?.unobserve(e)}})},{rootMargin:"200px",threshold:.01}),t.forEach(t=>{
if(t.getAttribute("data-processed"))return
;const i=CONFIG.selectors[n],r=t.querySelector(i.threadLink),o=t.querySelector(i.threadTitle),a=i.threadAuth?t.querySelector(i.threadAuth):null
;if(!r||!o)return;const s=r.href,c=o.textContent?.trim()||"";ThreadRenderer.renderThreadCard(t,s,c,a,n),t._threadData={threadUrl:s};const l=e.get(s)
;l?(void 0,this.loadThreadDirectly(t,l)):this.observer&&this.observer.observe(t)})}static loadThreadDirectly(t,e){t.setAttribute("data-loaded","1"),
e.length>0&&ThreadRenderer.updateAllImages(t,e)}static async loadThread(t,e){t.setAttribute("data-loaded","1");const n=t._threadData;if(!n)return
;const{threadUrl:r}=n,{maxConcurrent:o,minDelay:a,maxDelay:s}=CONFIG.rateLimit,c=CONFIG.selectors[e],l=await i.fetchPostImages(r,o,a,s,c.postImages)
;l.error?ThreadRenderer.showError(t,r,l.error,e):0===l.images.length?ThreadRenderer.showError(t,r,"无图片",e):ThreadRenderer.updateAllImages(t,l.images)}
static async retryLoadThread(t,n,i){e.delete(n),t.removeAttribute("data-loaded");const r=t.querySelector(".preview-container");if(r){r.innerHTML=""
;for(let t=0;t<CONFIG.MAX_PREVIEW_IMAGES;t++){const t=document.createElement("div");t.style.cssText=CONFIG.styles.imageWrapper
;const e=document.createElement("div");e.style.cssText=CONFIG.styles.imagePlaceholder,e.textContent="加载中...",t.appendChild(e),r.appendChild(t)}}
await this.loadThread(t,i)}};a.observer=null;let s=a;const c=Object.freeze(Object.defineProperty({__proto__:null,ThreadProcessor:s
},Symbol.toStringTag,{value:"Module"})),l=class{static initContainer(){return this.container||(this.container=document.createElement("div"),
this.container.id="toast-container",Object.assign(this.container.style,{position:"fixed",top:"20px",right:"20px",zIndex:"99999",pointerEvents:"none"
}),document.body.appendChild(this.container)),this.container}static show(t,e="info",n=4e3){
const i=this.initContainer(),r=document.createElement("div");r.textContent=t,Object.assign(r.style,{padding:"12px 20px",marginBottom:"10px",
borderRadius:"6px",color:"white",boxShadow:"0 2px 12px rgba(0,0,0,0.15)",opacity:"0",transform:"translateX(100%)",transition:"all 0.3s ease-out",
fontSize:"14px",fontWeight:"400",maxWidth:"300px",wordWrap:"break-word",pointerEvents:"auto",cursor:"pointer"});const o={success:"#10B981",
error:"#EF4444",warning:"#F59E0B",info:"#3B82F6"};return r.style.backgroundColor=o[e],r.addEventListener("click",()=>{this.removeToast(r)}),
i.appendChild(r),setTimeout(()=>{r.style.opacity="1",r.style.transform="translateX(0)"},10),n>0&&setTimeout(()=>{this.removeToast(r)},n),r}
static removeToast(t){t.style.opacity="0",t.style.transform="translateX(100%)",setTimeout(()=>{t.parentNode&&t.remove()},300)}static success(t,e=4e3){
return this.show(t,"success",e)}static error(t,e=5e3){return this.show(t,"error",e)}static warning(t,e=4e3){return this.show(t,"warning",e)}
static info(t,e=3e3){return this.show(t,"info",e)}};l.container=null;let d=l;class AutoSignIn{static isAlreadySignedIn(t){
const e=document.querySelector("#fx_checkin_b");if(!e)return void 0,!1;const n=e.alt||"";return void 0,
0===n.indexOf("点击签到")||0===n.indexOf("签到领奖")?(void 0,!1):n.includes("已签到")||n.includes("已签")?(void 0,!0):(void 0,!1)}static getSignInApiUrl(){
const t=document.querySelector("#JD_sign");if(t&&t.href)return void 0,t.href;const e=document.querySelector("#fx_checkin_b");if(e&&e.parentElement){
const t=e.parentElement;if("A"===t.tagName&&t.href)return void 0,t.href}const n=document.querySelectorAll('a[href*="k_misign"]');for(const i of n){
const t=i.href;if(t&&(t.includes("qiandao")||t.includes("sign")))return void 0,t}return void 0,null}static async performSignIn(t){try{
const e="sjs"===t?"司机社":"魔性论坛",n=this.getSignInApiUrl();if(!n)return void 0,!1;void 0;const i=await fetch(n,{method:"GET",credentials:"include",
headers:{"X-Requested-With":"XMLHttpRequest",Accept:"*/*"}});return void 0,i.ok?(await i.text(),void 0,d.success(`${e}签到成功,即将刷新页面`),setTimeout(()=>{
location.reload()},1e3),!0):(void 0,!1)}catch(e){return void 0,!1}}static async init(t){try{if(void 0,await new Promise(t=>setTimeout(t,200)),
this.isAlreadySignedIn(t))return void 0,void 0;await this.performSignIn(t)}catch(e){void 0}}}class SjsProcessor{static getImageUrl(t){
const e=t.match(/url\(\s*([^)]+)\s*\)/);if(!e)return"";let n=e[1].trim();return n=n.replace(/^['"]|['"]$/g,""),n}static processImages(){void 0,
document.querySelectorAll(".nex_forumlist_pics .nex_thread_pics a").forEach(t=>{const e=t;if(e.dataset.processed)return;e.dataset.processed="1"
;const n=this.getImageUrl(e.getAttribute("style")||"");if(void 0,!n)return;const i=e.parentElement;i&&(i.style.width="180px",i.style.height="180px"),
e.style.cssText=`\n        display: block;\n        width: 100%;\n        height: 100%;\n        background: url(${n}) center center no-repeat;\n        background-size: contain;\n      `
;const r=e.closest(".nex_forumlist_pics"),a=r?.querySelectorAll(".nex_thread_pics a")||[],s=Array.from(a).map(t=>this.getImageUrl(t.getAttribute("style")||"")).filter(Boolean),c=s.indexOf(n)
;void 0,e.onclick=t=>{t.preventDefault(),o.show(s,c)}}),document.querySelectorAll(".nex_forumlist_pics ul").forEach(t=>{const e=t
;e.style.display="flex",e.style.flexWrap="nowrap",e.style.gap="10px"})}static init(){if(!document.body)return setTimeout(()=>this.init(),10),void 0
;this.processImages(),AutoSignIn.init("sjs");const t=document.querySelector(".nex_forumlist_pics")
;t&&new MutationObserver(()=>this.processImages()).observe(t,{childList:!0,subtree:!0})}}function p(){
return/laowang\.vip|laowangwnr3p\.com|y6ptsn8\.com/.test(location.hostname)?"laowang":/moxing\.app|moxing\.vip/.test(location.hostname)?"moxing":/sjs47\.com|xsijishe\.net/.test(location.hostname)?"sjs":null
}function m(t){return"laowang"===t?/\/search\/s\.php/.test(location.href):("moxing"===t||"sjs"===t)&&/search\.php\?mod=forum/.test(location.href)}
function h(t){if("laowang"===t)return!!m("laowang")||/forum\.php\?mod=forumdisplay/.test(location.href);if("moxing"===t){if(m("moxing"))return!0
;const t=document.querySelector('td.by a[href*="forumdefstyle"]');return t&&t.classList.contains("chked")?(void 0,location.href=t.href,
!1):/forum-\d+-\d+\.html/.test(location.href)||/forum\.php\?mod=forumdisplay/.test(location.href)}
return!("sjs"!==t||(/misc\.php\?mod=mobile/.test(location.href)||/mobile=1/.test(location.href)?(void 0,location.href=location.origin+"/forum.php",
1):"/"===location.pathname||"/index.php"===location.pathname||"/forum.php"===location.pathname&&!location.search.includes("fid=")&&!location.search.includes("mod=forumdisplay")))
}function u(t){
return"moxing"===t?"/"===location.pathname||"/index.php"===location.pathname&&!location.search:"sjs"===t&&("/"===location.pathname||"/index.php"===location.pathname&&!location.search||"/forum.php"===location.pathname&&!location.search)
}function g(){const t=document.querySelectorAll('.deanbkms[id^="forum_rules_"]');t.length>0&&(void 0,t.forEach(t=>{t.style.display="none"}))}
function f(){"undefined"!=typeof GM_registerMenuCommand&&GM_registerMenuCommand("🗑️ 清空图片缓存",()=>{try{e.getInstance().clear(),d.success("缓存已清空"),
setTimeout(()=>{location.reload()},500)}catch(t){d.error("清空失败")}})}async function init(){try{void 0,f();const t=p();if(!t)return void 0,void 0;void 0
;const e=u(t),n=h(t),i=m(t);if("sjs"===t&&i)return void 0,void 0;if("loading"===document.readyState&&await new Promise(t=>{
document.addEventListener("DOMContentLoaded",t,{once:!0})}),e)return void 0,"sjs"===t?(void 0,AutoSignIn.init("sjs")):(void 0,
"moxing"===t&&AutoSignIn.init("moxing")),void 0;if(n||i){if(i,void 0,"sjs"===t)SjsProcessor.init();else{let e=t
;i&&(e="laowang"===t?"laowangSearch":"moxingSearch"),s.processThreadList(e),"laowang"===t&&g()}return}void 0}catch(t){void 0}}init()})();