Scholar:绕过点击跟踪重定向
改写结果链接的 href,直接跳转到论文,绕过 Google 的重定向和 ping 属性。
可复制的代码
// Rewrite result links to bypass Google's click-tracking redirect
(function () {
function clean(a) {
if (a.dataset.jzSchClean) { return; }
var href = a.getAttribute('href') || '';
var m = href.match(/^\/scholar_url\?url=([^&]+)/);
if (m) {
try { a.href = decodeURIComponent(m[1]); } catch (e) { /* ignore */ }
}
if (/^https?:\/\/www\.google\.[a-z.]+\/url\?/.test(href)) {
try {
var u = new URL(href);
var real = u.searchParams.get('url') || u.searchParams.get('q');
if (real) { a.href = real; }
} catch (e) { /* ignore */ }
}
a.dataset.jzSchClean = '1';
a.removeAttribute('onmousedown');
a.removeAttribute('ping');
}
function scan() {
document.querySelectorAll('h3.gs_rt a, div.gs_or_ggsm a, div.gs_ri a, div.gs_fl a').forEach(clean);
}
scan();
new MutationObserver(function () {
clearTimeout(window.__jzSchPriv);
window.__jzSchPriv = setTimeout(scan, 350);
}).observe(document.body, { childList: true, subtree: true });
})();
如何使用此示例
- 用上方按钮复制代码。
- 安装 JustZix(2 分钟),在目标页面打开扩展。
- 添加一条匹配该页面的新规则。
- 将代码粘贴到规则的 JavaScript 面板并保存 — 每次访问页面时都会运行。
为此示例评分
暂无评分 — 成为第一个。