现在可以超链接直达了
// ==UserScript==// @name NodeSeek 去除跳转页(稳)// @namespace https://nodeseek.com/// @version 1.2.0// @description 移除 nodeseek 的 /jump?to= 跳转;支持相对链接、多重编码、中键/新标签;直接访问 /jump 时自动直达// @match *://*.nodeseek.com/*// @run-at document-start// @grant none// ==/UserScript==(function() { 'use strict'; // 多次 decode,兼容双重编码;再试 BASE64 兜底 function smartDecode(value) { if (!value) return value; let s = value; for (let i = 0; i < 5; i++) { try { const d = decodeURIComponent(s); if (d === s) break; s = d; } catch { break; } } if (!/^[a-z]+:\/\//i.test(s)) { try { const b = atob(s); if (/^[a-z]+:\/\//i.test(b)) s = b; } catch {} } return s; } function extractReal(href) { try { const u = new URL(href, location.origin); // 兼容相对路径 if (u.pathname === '/jump' && u.searchParams.has('to')) { const real = smartDecode(u.searchParams.get('to')); return real || href; } return href; } catch { return href; } } function rewriteAnchor(a) { if (!a || a.dataset.nsFixed) return; const orig = a.getAttribute('href'); if (!orig) return; const real = extractReal(orig); if (real && real !== a.href) { a.href = real; a.dataset.nsFixed = '1'; } } function sweep(root) { (root.querySelectorAll ? root : document) .querySelectorAll('a[href]') .forEach(rewriteAnchor); } // DOM 就绪后扫一次 if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', () => sweep(document), { once: true }); } else { sweep(document); } // 监听异步渲染 & href 变化 new MutationObserver(muts => { for (const m of muts) { if (m.type === 'childList') { m.addedNodes.forEach(n => { if (n.nodeType === 1) { if (n.tagName === 'A') rewriteAnchor(n); else sweep(n); } }); } else if (m.type === 'attributes' && m.attributeName === 'href' && m.target.tagName === 'A') { rewriteAnchor(m.target); } } }).observe(document.documentElement, { childList: true, subtree: true, attributes: true, attributeFilter: ['href'] }); // 捕获阶段拦截点击,避免站点脚本先处理 function clickHandler(e) { const a = e.target && e.target.closest ? e.target.closest('a[href]') : null; if (!a) return; const href = a.getAttribute('href'); if (!href) return; let u; try { u = new URL(href, location.origin); } catch { return; } if (u.pathname !== '/jump' || !u.searchParams.has('to')) return; const real = extractReal(href); if (!real) return; e.preventDefault(); e.stopPropagation(); e.stopImmediatePropagation?.(); const openInNewTab = a.target === '_blank' || e.type === 'auxclick' || e.ctrlKey || e.metaKey || e.button === 1; if (openInNewTab) window.open(real, '_blank', 'noopener'); else location.href = real; } document.addEventListener('click', clickHandler, true); document.addEventListener('auxclick', clickHandler, true); // 直接访问 /jump 页面时自动跳走(不留历史记录) if (location.pathname === '/jump') { const real = extractReal(location.href); if (real && real !== location.href) location.replace(real); }})();