您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Removes all tracking info from imdb links. Keeps other parameters intact.
当前为
- // ==UserScript==
- // @name IMDb - fix links
- // @namespace https://github.com/Procyon-b
- // @version 1.0.1
- // @description Removes all tracking info from imdb links. Keeps other parameters intact.
- // @author Achernar
- // @match https://www.imdb.com/*
- // @run-at document-body
- // @grant none
- // ==/UserScript==
- (function() {
- "use strict";
- var t;
- function fix(u) {
- return u.replace('?', '?&').replace(/&(pf_rd_[a-z]|ref_)=[^&#]*/g, '').replace('?&', '?').replace(/\?$/, '');
- }
- if (t=location.search) {
- let s=fix(t);
- if (s!=t) history.replaceState(null, null, (s || location.pathname)+location.hash);
- }
- new MutationObserver(function(mutL){
- for (let m of mutL) {
- if (m.addedNodes) fixL(m.target.querySelectorAll('a'));
- }
- }).observe(document, {childList:true, subtree:true});
- function fixL(L) {
- for (let a of L) {
- if (a.LnkFixed || !a.href) continue;
- if (a.protocol && a.protocol.startsWith('http') && a.host.endsWith('imdb.com') && a.search) a.search=fix(a.search);
- if (a.pathname!=='/') a.LnkFixed=1;
- }
- }
- fixL(document.links)
- })();