您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Redirects specific image URLs on V2EX to a different URL.
// ==UserScript== // @name V2EX Image Redirector // @namespace http://tampermonkey.net/ // @version 1.3 // @description Redirects specific image URLs on V2EX to a different URL. // @author Your name // @match *://*/* // @grant none // ==/UserScript== (function() { 'use strict'; function replaceImgurLinks() { // 替换图片src属性 const images = document.querySelectorAll('img[src^="https://i.imgur.com/"]'); images.forEach(img => { img.src = img.src.replace('https://i.imgur.com/', 'https://search.pstatic.net/common?src=https://i.imgur.com/'); }); // 替换a标签href属性 const links = document.querySelectorAll('a[href^="https://i.imgur.com/"]'); links.forEach(link => { link.href = link.href.replace('https://i.imgur.com/', 'https://search.pstatic.net/common?src=https://i.imgur.com/'); }); // 替换内联样式中的背景图片URL const elementsWithStyle = document.querySelectorAll('[style*="https://i.imgur.com/"]'); elementsWithStyle.forEach(el => { el.style.cssText = el.style.cssText.replace(/https:\/\/i\.imgur\.com\//g, 'https://search.pstatic.net/common?src=https://i.imgur.com/'); }); } // 初始执行 replaceImgurLinks(); // 监听DOM变化,处理动态加载的内容 const observer = new MutationObserver(replaceImgurLinks); observer.observe(document.body, { childList: true, subtree: true }); })();