您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Auto-fetch real Amazon coupons from CouponFollow & apply best one!
// ==UserScript== // @name 💰 Real Coupon Finder - Amazon // @namespace https://1lm.me/codecopilot // @version 1.1 // @description Auto-fetch real Amazon coupons from CouponFollow & apply best one! // @match *://www.amazon.*/* // @grant GM_xmlhttpRequest // @connect couponfollow.com // @run-at document-idle // ==/UserScript== (function () { 'use strict'; const waitForPrice = (selector, callback) => { const el = document.querySelector(selector); if (el) return callback(el); setTimeout(() => waitForPrice(selector, callback), 500); }; const parsePrice = (text) => { const match = text.replace(/[^0-9.,]/g, '').match(/[\d.,]+/); if (!match) return null; return parseFloat(match[0].replace(',', '')); }; const fetchCoupons = (callback) => { GM_xmlhttpRequest({ method: "GET", url: "https://www.couponfollow.com/site/amazon.com", onload: function (response) { const parser = new DOMParser(); const doc = parser.parseFromString(response.responseText, "text/html"); const coupons = Array.from(doc.querySelectorAll('.coupon-code-block .coupon-code-text')) .map(el => el.textContent.trim()) .filter(code => /^[A-Z0-9]{4,}$/.test(code)); callback(coupons); } }); }; const injectButton = (priceElement, price) => { const btn = document.createElement('button'); btn.textContent = '🔍 Fetch Real Coupons'; btn.style = 'margin-top:10px;padding:8px 14px;background:#ff9900;color:#fff;border:none;border-radius:4px;cursor:pointer;'; priceElement.parentElement.appendChild(btn); const resultBox = document.createElement('div'); resultBox.style = 'margin-top:10px;font-weight:bold;'; priceElement.parentElement.appendChild(resultBox); btn.onclick = () => { resultBox.textContent = '⏳ Fetching coupons...'; fetchCoupons((codes) => { if (codes.length === 0) { resultBox.textContent = '❌ No coupons found'; } else { resultBox.innerHTML = `✅ Found <b>${codes.length}</b> coupons<br><code>${codes.join('</code> <code>')}</code>`; } }); }; }; waitForPrice('.a-price .a-offscreen', (el) => { const price = parsePrice(el.textContent); if (price) injectButton(el, price); }); })();