// ==UserScript== // @name Amazon Keyword Modifier (Comprehensive) // @namespace http://tampermonkey.net/ // @version 1.4 // @description Add "+" to keywords except units, symbols, and logical words on Amazon pages // @author Your Name // @match https://www.amazon.com/* // @grant GM_setClipboard // @downloadURL https://update.greasyfork.icu/scripts/524013/Amazon%20Keyword%20Modifier%20%28Comprehensive%29.user.js // @updateURL https://update.greasyfork.icu/scripts/524013/Amazon%20Keyword%20Modifier%20%28Comprehensive%29.meta.js // ==/UserScript== (function () { 'use strict'; // List of words to exclude const excludedWords = [ "and", "or", "not", "but", "nor", "so", "yet", "for", "in", "on", "at", "by", "to", "of", "with", "about", "as", "from", "into", "over", "under", "after", "before", "around", "through", "between", "sets", "set", "pack", "pcs", "dozen", "pair", "unit", "kg", "g", "lb", "oz", "cm", "mm", "m", "km", "in", "ft", "ml", "l", "box", "bottle", "jar", "can", "tray" ]; const excludedSymbols = /^[!@#$%^&*(),.?":{}|<>+=/\\~`;'\[\]-]+$/; // Create a floating button const button = document.createElement("div"); button.textContent = "+"; button.style.position = "fixed"; button.style.bottom = "20px"; button.style.left = "20px"; button.style.width = "50px"; button.style.height = "50px"; button.style.borderRadius = "50%"; button.style.backgroundColor = "#007bff"; button.style.color = "white"; button.style.fontSize = "24px"; button.style.textAlign = "center"; button.style.lineHeight = "50px"; button.style.cursor = "pointer"; button.style.boxShadow = "0 4px 8px rgba(0, 0, 0, 0.2)"; document.body.appendChild(button); // Create a popup const popup = document.createElement("div"); popup.style.position = "fixed"; popup.style.bottom = "80px"; popup.style.left = "20px"; popup.style.width = "300px"; popup.style.padding = "20px"; popup.style.backgroundColor = "white"; popup.style.border = "1px solid #ccc"; popup.style.boxShadow = "0 4px 8px rgba(0, 0, 0, 0.2)"; popup.style.display = "none"; popup.style.zIndex = "1000"; document.body.appendChild(popup); // Add input box for keywords const input = document.createElement("textarea"); input.style.width = "100%"; input.style.height = "80px"; input.placeholder = "Enter keywords here (one per line)..."; popup.appendChild(input); // Create a button container const buttonContainer = document.createElement("div"); buttonContainer.style.display = "flex"; buttonContainer.style.justifyContent = "space-between"; buttonContainer.style.margin = "10px 0"; popup.appendChild(buttonContainer); // Add buttons const generateButton = document.createElement("button"); generateButton.textContent = "Generate +"; generateButton.style.flex = "1"; generateButton.style.marginRight = "5px"; buttonContainer.appendChild(generateButton); const copyButton = document.createElement("button"); copyButton.textContent = "Copy"; copyButton.style.flex = "1"; copyButton.style.marginRight = "5px"; buttonContainer.appendChild(copyButton); const clearButton = document.createElement("button"); clearButton.textContent = "Clear"; clearButton.style.flex = "1"; buttonContainer.appendChild(clearButton); const closeButton = document.createElement("button"); closeButton.textContent = "Close"; closeButton.style.flex = "1"; buttonContainer.appendChild(closeButton); // Add output box for generated content const output = document.createElement("textarea"); output.style.width = "100%"; output.style.height = "80px"; output.style.marginTop = "10px"; output.style.backgroundColor = "#f9f9f9"; output.style.border = "1px solid #ccc"; output.style.readOnly = true; output.placeholder = "Generated keywords will appear here..."; popup.appendChild(output); // Show popup on button click button.addEventListener("click", () => { popup.style.display = popup.style.display === "none" ? "block" : "none"; }); // Generate "+" keywords generateButton.addEventListener("click", () => { const lines = input.value.split(/\n/); // Split input by line const processedLines = lines.map(line => { const words = line.trim().split(/\s+/); const processedWords = words.map(word => { if ( /^\d+$/.test(word) || // Exclude numbers excludedWords.includes(word.toLowerCase()) || // Exclude specific words excludedSymbols.test(word) // Exclude symbols ) { return word; } else { return `+${word}`; } }); return processedWords.join(" "); }).filter(line => line.trim() !== ""); // Remove empty lines output.value = processedLines.join("\n"); // Join lines with newline }); // Copy to clipboard copyButton.addEventListener("click", () => { if (output.value.trim() !== "") { GM_setClipboard(output.value); alert("Copied to clipboard!"); } else { alert("No content to copy!"); } }); // Clear input and output clearButton.addEventListener("click", () => { input.value = ""; output.value = ""; }); // Close popup closeButton.addEventListener("click", () => { popup.style.display = "none"; }); })();