您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Creates a button that opens a new tab on Walmart and searches for the product using the extracted title from Walgreens product page
当前为
// ==UserScript== // @name Walgreens to Walmart Search // @namespace http://tampermonkey.net/ // @version 1 // @description Creates a button that opens a new tab on Walmart and searches for the product using the extracted title from Walgreens product page // @author Your Name // @match https://www.walgreens.com/store/c/* // @grant none // ==/UserScript== (function() { 'use strict'; // Get the product title from the page var productTitle = document.querySelector('title').innerText.replace(' | Walgreens', ''); // Create the Walmart search URL with the product title var searchUrl = 'https://www.walmart.com/search?q=' + encodeURIComponent(productTitle) + '&facet=fulfillment_method_in_store%3AIn-store'; // Create the button element var button = document.createElement('a'); button.innerHTML = 'Walmart'; button.href = searchUrl; button.target = '_blank'; // Add the button after the product name var productName = document.querySelector('#productName'); productName.parentNode.insertBefore(button, productName.nextSibling); // Style the button with CSS button.style.backgroundColor = '#0071DC'; button.style.color = 'white'; button.style.padding = '5px 20px'; button.style.margin = '5px 10px 10px 0'; button.style.borderRadius = '5px'; button.style.border = 'none'; button.style.cursor = 'pointer'; button.style.transition = 'background-color 0.3s'; button.addEventListener('mouseover', () => { button.style.backgroundColor = '#004F9A'; }); button.addEventListener('mouseout', () => { button.style.backgroundColor = '#0071DC'; }); })();