您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
自动为关键词添加“+”号,跳过数字、量词和介词
当前为
// ==UserScript== // @name Amazon Keyword Modifier // @namespace http://tampermonkey.net/ // @version 1.0 // @description 自动为关键词添加“+”号,跳过数字、量词和介词 // @author You // @match https://www.amazon.*/* // @grant none // ==/UserScript== (function() { 'use strict'; // 定义要跳过的量词和介词 const skipWords = [ "for", "in", "on", "at", "with", "by", "to", "of", "and", "or", "the", "a", "an", "is", "are", "was", "were", "be", "been", "am", "as", "but", "if", "then" ]; // 检查是否为数字 function isNumber(word) { return /^\d+$/.test(word); } // 处理输入内容 function processKeywords(input) { return input.split(" ").map(word => { if (isNumber(word) || skipWords.includes(word.toLowerCase())) { return word; } return "+" + word; }).join(" "); } // 创建输入框和按钮 function createUI() { const container = document.createElement("div"); container.style.position = "fixed"; container.style.top = "10px"; container.style.right = "10px"; container.style.padding = "10px"; container.style.backgroundColor = "#fff"; container.style.border = "1px solid #ccc"; container.style.borderRadius = "5px"; container.style.boxShadow = "0 2px 5px rgba(0, 0, 0, 0.2)"; container.style.zIndex = "9999"; const input = document.createElement("input"); input.type = "text"; input.placeholder = "输入关键词"; input.style.width = "300px"; input.style.marginRight = "10px"; const button = document.createElement("button"); button.textContent = "生成"; button.style.cursor = "pointer"; const output = document.createElement("div"); output.style.marginTop = "10px"; output.style.color = "#333"; button.addEventListener("click", () => { const processed = processKeywords(input.value); output.textContent = processed; }); container.appendChild(input); container.appendChild(button); container.appendChild(output); document.body.appendChild(container); } // 初始化界面 createUI(); })();