NOTICE: By continued use of this site you understand and agree to the binding Terms of Service and Privacy Policy.
// ==UserScript== // @name u3c3-preview // @namespace https://rachpt.cn // @version 2025.05.01.1051 // @author rachpt // @description U3C3 增强插件 // @license MIT // @icon https://u001.25img.com/nnn/favicon.png // @match https://u001.25img.com/* // @match https://u3c3u3c3.u3c3u3c3u3c3.com/* // @exclude */view* // @run-at document-start // ==/UserScript== (function () { 'use strict'; function P(e){const r=Array.isArray(e)?e:[e],t=()=>{r.forEach((n,i)=>{try{n();}catch(l){console.error(`执行函数 ${n.name||`#${i+1}`} 时发生错误:`,l);}});};document.readyState==="complete"?t():window.addEventListener("load",t);}function E(e){const r=e.querySelector("td:nth-child(2)>a");if(!r)return false;const t=r.getAttribute("title")||r.textContent?.trim()||"";return !!(t==="國產原创"||t?.startsWith("【表妹推荐】")||/^\((同人|成年).*?\).*/.test(t)||/(Vol|No)\.\d+$/.test(t)||/【.*?-手机搜索】/.test(t)||/^\w+-\d+(-\w+)?\s*/.test(t.replace(/^\++\s*/,""))||/^[\w]+-[\d]+\s/.test(t.replace(/\[[\w\d/ ]+?\]\s*/,""))||/^[\w]+-[\d]+\s/.test(t.replace(/^(\+{3}\s*)?\[?F?HDC?\]?\s*/,""))||/^[-/[\]()\.',\w\d]+$/.test(t.replace(/\s+/g,""))||/^(\[[\w\d\/\s]+?\]\s*)?(FC|fc)2-?(PPV|ppv)[-\s]*\d+?[-\s]*/.test(t.replace(/^\++\s*/,"")))}function L(e){return [...e.values()].filter(r=>!E(r))}const v=(e,r)=>{let t=null;return (...n)=>{t&&clearTimeout(t),t=setTimeout(()=>{e.apply(null,n),t=null;},r);}};let s=null,o=null,h=null;function C(e,r){h=r,s=document.createElement("div"),s.className="status-indicator",s.style.cssText="position:fixed;left:0;top:50%;color:white;padding:5px;z-index:9999;font-size:11px;transform:translateY(-50%);border-radius:0 10px 10px 0;background-color:rgba(0, 0, 0, 0.5);box-shadow:0 0 10px rgba(0, 0, 0, 0.3);width:fit-content;min-width:80px;",o=document.createElement("button"),o.textContent="下一页",o.style.cssText="display:block;margin-top:4px;padding:5px;width:100%;background-color:#337ab7;color:white;border:none;border-radius:3px;cursor:pointer;",o.addEventListener("click",()=>{h&&h();}),s.appendChild(o),document.body.appendChild(s),b(e);}function b(e){if(!s)return;Array.from(s.childNodes).forEach(n=>{n!==o&&s?.removeChild(n);});const t=document.createElement("div");t.innerHTML=`<section>页码:${e.currentPage}</section><section>条数:${e.currentPageItems}</section><section>总条:${e.totalItemsLoaded}</section><section>过滤:${e.totalItemsFiltered}</section>`,s.insertBefore(t,o),o&&(o.disabled=e.isLoading,o.style.opacity=e.isLoading?"0.6":"1",o.textContent=e.isLoading?"加载中...":"下一页");}let d=1,a=false,y=0,w=0,u=0;function x(){return new URLSearchParams(window.location.search)}function I(){const r=x().get("type")||"",t=d+1;return r?`/?type=${r}&p=${t}`:`/?p=${t}`}function m(){b({currentPage:d,currentPageItems:u,totalItemsLoaded:y,totalItemsFiltered:w,isLoading:a});}function T(e){const n=new DOMParser().parseFromString(e,"text/html").querySelectorAll("table.torrent-list tbody tr"),i=n.length,l=L(n),g=i-l.length,c=document.createDocumentFragment();for(const f of l)c.appendChild(f.cloneNode(true));return {fragment:c,filtered:g,total:i}}async function p(e=false){if(!(a&&!e)){a=true,m();try{const r=I(),t=await fetch(r);if(!t.ok)throw new Error(`HTTP error! status: ${t.status}`);const n=await t.text(),{fragment:i,filtered:l,total:g}=T(n);d++,w+=l,y+=g,u=document.querySelectorAll("table.torrent-list tbody tr").length,m();const c=i.childNodes.length;if(c){const f=document.querySelector("table.torrent-list tbody");f&&(f.appendChild(i),u=document.querySelectorAll("table.torrent-list tbody tr").length,m());}c<=40&&await p(!0);}catch(r){console.error("加载下一页失败:",r);}finally{a=false,m();}}}function S(){const e=window.innerHeight+window.scrollY,r=document.body.offsetHeight;return e>=r-400}const $=v(async()=>{S()&&await p();},1e3);function A(){const e=x();d=parseInt(e.get("p")||"1"),u=document.querySelectorAll("table.torrent-list tbody tr").length,C({currentPage:d,currentPageItems:u,totalItemsLoaded:y,totalItemsFiltered:w,isLoading:a},()=>p(true)),window.addEventListener("scroll",$,{passive:true}),S()&&p(),console.log("无限滚动功能已初始化"),document.querySelector(".center>nav")?.remove(),document.querySelector("#addEmail_n")?.remove();}P([A]); })();