您需要先安装一个扩展,例如 篡改猴、Greasemonkey 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 暴力猴,之后才能安装此脚本。
您需要先安装一个扩展,例如 篡改猴 或 Userscripts ,之后才能安装此脚本。
您需要先安装一款用户脚本管理器扩展,例如 Tampermonkey,才能安装此脚本。
您需要先安装用户脚本管理器扩展后才能安装此脚本。
Greasy Fork is available in English.
输入关键词生成组合叠词
当前为
// ==UserScript== // @name 关键词叠词生成器 // @namespace http://tampermonkey.net/ // @version 1.0 // @description 输入关键词生成组合叠词 // @author You // @match https://www.amazon.com/* // @match https://www.amazon.co.uk/* // @grant GM_addStyle // ==/UserScript== (function () { 'use strict'; // 创建样式,确保元素显示并美化 GM_addStyle(` #wordGeneratorContainer { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 9999; background-color: #f9f9f9; padding: 20px; border: 2px solid #ccc; border-radius: 15px; box-shadow: 0 8px 15px rgba(0, 0, 0, 0.2); display: none; font-family: 'Arial', sans-serif; transition: all 0.3s ease; width: auto; max-width: 500px; min-width: 300px; } #wordGeneratorContainer .inputRow { display: flex; align-items: center; justify-content: space-between; width: 100%; margin-bottom: 10px; } #wordGeneratorContainer input, #wordGeneratorContainer button { margin: 5px; padding: 12px 18px; font-size: 16px; border-radius: 8px; border: 1px solid #ccc; outline: none; transition: border 0.3s ease; width: 48%; } #outputArea { white-space: pre-wrap; word-wrap: break-word; margin-top: 15px; border: 1px solid #ddd; padding: 15px; background-color: #f4f4f4; min-height: 150px; max-height: 200px; overflow-y: auto; border-radius: 8px; } `); // 创建生成器容器 const container = document.createElement('div'); container.id = 'wordGeneratorContainer'; const inputRow = document.createElement('div'); inputRow.classList.add('inputRow'); const inputBox = document.createElement('input'); inputBox.type = 'text'; inputBox.placeholder = '输入关键词'; const generateButton = document.createElement('button'); generateButton.textContent = '生成叠词'; const outputArea = document.createElement('pre'); outputArea.id = 'outputArea'; container.appendChild(inputRow); inputRow.appendChild(inputBox); inputRow.appendChild(generateButton); container.appendChild(outputArea); document.body.appendChild(container); // 生成叠词组合 function generateCombinations(input) { const words = input.trim().split(/\s+/); const length = words.length; if (length < 2 || length > 4) { return '请输入 2 到 4 个关键词!'; } const combinations = []; // AB式 if (length === 2) { combinations.push(`${words[0]} ${words[1]} ${words[0]} ${words[1]}`); combinations.push(`${words[0]} ${words[0]} ${words[1]} ${words[1]}`); combinations.push(`${words[0]} ${words[0]} ${words[1]}`); combinations.push(`${words[0]} ${words[1]} ${words[1]}`); } // ABC式 if (length === 3) { combinations.push(`${words[0]} ${words[1]} ${words[2]} ${words[0]} ${words[1]} ${words[2]}`); combinations.push(`${words[0]} ${words[0]} ${words[1]} ${words[1]} ${words[2]} ${words[2]}`); combinations.push(`${words[0]} ${words[0]} ${words[1]} ${words[2]}`); combinations.push(`${words[0]} ${words[1]} ${words[1]} ${words[2]}`); combinations.push(`${words[0]} ${words[1]} ${words[2]} ${words[2]}`); } // ABCD式 if (length === 4) { combinations.push(`${words[0]} ${words[1]} ${words[2]} ${words[3]} ${words[0]} ${words[1]} ${words[2]} ${words[3]}`); combinations.push(`${words[0]} ${words[0]} ${words[1]} ${words[1]} ${words[2]} ${words[2]} ${words[3]} ${words[3]}`); combinations.push(`${words[0]} ${words[0]} ${words[1]} ${words[2]} ${words[3]}`); combinations.push(`${words[0]} ${words[1]} ${words[1]} ${words[2]} ${words[3]}`); combinations.push(`${words[0]} ${words[1]} ${words[2]} ${words[2]} ${words[3]}`); combinations.push(`${words[0]} ${words[1]} ${words[2]} ${words[3]} ${words[3]}`); } return combinations.join('\n'); } // 添加事件监听器 generateButton.addEventListener('click', () => { const input = inputBox.value; const output = generateCombinations(input); outputArea.textContent = output; }); })();