您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Enhances the Amazon ShoptheLook page by adding product titles to each item.
// ==UserScript== // @name Amazon ShoptheLook Enhancer // @namespace Violentmonkey Scripts // @match https://www.amazon.com/shopthelook?q=* // @grant GM_xmlhttpRequest // @version 1.1 // @license MIT // @description Enhances the Amazon ShoptheLook page by adding product titles to each item. // ==/UserScript== function enhanceShoptheLook() { const sectionElement = document.querySelector('#product_grid_container > div > section'); if (!sectionElement) return; const articleElements = sectionElement.querySelectorAll('article'); let newHtml = ''; articleElements.forEach(article => { const imageContainerLink = article.querySelector('section.item-image-container > div > div > a'); if (!imageContainerLink) return; const href = imageContainerLink.getAttribute('href'); if (!href) return; GM_xmlhttpRequest({ method: 'GET', url: href, onload: function(response) { const parser = new DOMParser(); const doc = parser.parseFromString(response.responseText, 'text/html'); const productTitleElement = doc.querySelector('#productTitle'); if (productTitleElement) { const originalArticleHtml = article.outerHTML; const titleHtml = productTitleElement.outerHTML; newHtml += originalArticleHtml.replace('</article>', titleHtml + '</article>'); } else { newHtml += article.outerHTML; } } }); }); const originalSection = document.querySelector('#product_grid_container > div > section'); originalSection.innerHTML = newHtml; } enhanceShoptheLook(); window.addEventListener('load', enhanceShoptheLook); window.addEventListener('hashchange', enhanceShoptheLook);