您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Add a Google search icon next to the product title on Amazon
当前为
// ==UserScript== // @name Amazon Product Title Google Search // @namespace https://wesfoster.com/ // @version 1.0 // @description Add a Google search icon next to the product title on Amazon // @author Wes Foster // @match https://www.amazon.com/*/dp/* // @license GNU GPLv3 // @grant none // ==/UserScript== (function() { 'use strict'; // Locate the productTitle element let productTitleElement = document.getElementById('productTitle'); if (productTitleElement) { // Create new link element let linkElement = document.createElement('a'); linkElement.href = '#'; // Add event for click to open Google search in new tab linkElement.addEventListener('click', function (event) { event.preventDefault(); window.open('https://www.google.com/search?q=' + encodeURIComponent(productTitleElement.textContent.trim()), '_blank'); }); // Create new img element let imgElement = document.createElement('img'); imgElement.src = 'https://www.google.com/favicon.ico'; // Google's favicon as icon imgElement.style.marginLeft = '10px'; // Add some space between the title and the icon imgElement.height = 16; // Modify as needed imgElement.width = 16; // Modify as needed // Add img to link so image can be clicked linkElement.appendChild(imgElement); // Add link to product title productTitleElement.appendChild(linkElement); } else { console.log('Amazon Product Title Google Search: Product title not found.') } })();