您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
(自用脚本)替换第一张白底图,替换时需要鼠标选中第一张白底图,网页加载完毕才可以。
// ==UserScript== // @name 替换亚马逊主图看效果 // @namespace http://tampermonkey.net/ // @version 0.13 // @description (自用脚本)替换第一张白底图,替换时需要鼠标选中第一张白底图,网页加载完毕才可以。 // @author z-l.top // @match https://www.amazon.com/* // @match https://www.amazon.co.jp/* // @icon https://cdn.h5ds.com/space/files/600972551685382144/20231114/648860499810643968.webp // @icon https://blog.z-l.top/img/favicon.png // @grant none // @license MIT // ==/UserScript== (function() { 'use strict'; // Function to set id of "zoomWindow" to empty function setIdToEmpty() { var zoomWindow = document.getElementById("zoomWindow"); if (zoomWindow) { zoomWindow.id = ""; } } // Create a button var button = document.createElement("button"); button.innerHTML = "换主图"; button.style.position = "fixed"; button.style.left = "10px"; button.style.zIndex = "999"; button.style.top = "10px"; button.style.padding = "10px"; button.style.backgroundColor = "#007bff"; button.style.color = "#fff"; button.style.border = "none"; button.style.borderRadius = "5px"; button.style.cursor = "pointer"; document.body.appendChild(button); // Function to replace images with clipboard image URL function replaceImagesFromClipboard() { navigator.clipboard.readText().then(function(text) { const imageUrl = text.trim(); if (imageUrl.match(/\.(jpeg|jpg|gif|png)$/) != null) { var detailImg = document.getElementById("detailImg"); if (detailImg) { detailImg.src = imageUrl; } var imgTagWrapper = document.querySelector(".imgTagWrapper"); if (imgTagWrapper) { imgTagWrapper.querySelector("img").src = imageUrl; } var firstButtonImg = document.querySelector(".a-button-text img"); if (firstButtonImg) { firstButtonImg.src = imageUrl; } } else { alert("剪贴板内容不是有效的图片链接"); } }).catch(function(err) { console.error('无法读取剪贴板内容:', err); }); } // Attach click event to the button button.addEventListener("click", replaceImagesFromClipboard); // Add keydown event listener for the shortcut document.addEventListener("keydown", function(event) { if (event.key === "s") { replaceImagesFromClipboard(); // 使用剪贴板中的链接 } }); // Run setIdToEmpty function setIdToEmpty(); // MutationObserver to detect changes in the DOM var observer = new MutationObserver(function(mutations) { mutations.forEach(function(mutation) { setIdToEmpty(); }); }); var config = { attributes: true, childList: true, subtree: true }; observer.observe(document.body, config); })();