您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
Cleans JustWatch links to get directly to the movies
当前为
// ==UserScript== // @name JustWatch Link Cleaner // @namespace MickyFoley // @version 1.0 // @description Cleans JustWatch links to get directly to the movies // @author MickyFoley // @match https://www.justwatch.com/* // @license GPL-3.0-only // @grant none // ==/UserScript== (function() { 'use strict'; // Function to clean a URL function cleanUrl(url) { const decodedUrl = decodeURIComponent(url); const cleanUrlParam = new URL(decodedUrl).searchParams.get('r'); if (cleanUrlParam) { const urlWithoutSearchReferral = cleanUrlParam.split('?searchReferral=')[0]; return urlWithoutSearchReferral; } return null; } // Function to clean and modify the links function cleanLinks() { // Get all the anchor elements on the page const links = document.querySelectorAll('a[href*="click.justwatch.com/a?r="]'); // Loop through each link and modify its href attribute links.forEach(link => { const cleanUrlParam = cleanUrl(link.href); if (cleanUrlParam) { link.href = cleanUrlParam; } }); } // Call the cleanLinks function initially cleanLinks(); // Set up a MutationObserver to monitor DOM changes const observer = new MutationObserver(mutations => { // Call the cleanLinks function whenever the DOM changes cleanLinks(); }); // Start observing the DOM for changes observer.observe(document.body, { childList: true, subtree: true }); })();