// ==UserScript== // @name Multi-Platform AI Prompt Manager // @namespace http://tampermonkey.net/ // @version 2.3 // @description Save, manage and insert prompts across multiple AI chatbot platforms with improved input detection, fixed visibility, dark mode support, and better insertion // @author skyline/imwaitingnow // @license MIT // @match https://chatgpt.com/* // @match https://chat.openai.com/* // @match https://claude.ai/* // @match https://x.com/i/grok* // @match https://twitter.com/i/grok* // @match https://chat.deepseek.com/* // @match https://chat.qwen.ai/* // @match https://qwen.alibaba.com/* // @match https://tongyi.aliyun.com/* // @match https://grok.com/* // @match https://gemini.google.com/* // @grant GM_setValue // @grant GM_getValue // @grant GM_deleteValue // @grant GM_listValues // @downloadURL https://update.greasyfork.icu/scripts/546101/Multi-Platform%20AI%20Prompt%20Manager.user.js // @updateURL https://update.greasyfork.icu/scripts/546101/Multi-Platform%20AI%20Prompt%20Manager.meta.js // ==/UserScript== (function() { 'use strict'; const PLATFORM_CONFIG = { chatgpt: { name: 'ChatGPT', domains: ['chatgpt.com', 'chat.openai.com'], storageKey: 'chatgpt_saved_prompts', theme: { primary: '#10a37f', primaryDark: '#0e8c6a', secondary: '#f7f7f8', surface: '#ffffff', surfaceSecondary: '#f7f7f8', text: '#353740', textSecondary: '#8e8ea0', border: '#e5e5e5', borderMedium: '#d1d5db', shadow: 'rgba(0,0,0,0.1)' }, darkTheme: { primary: '#10a37f', primaryDark: '#0e8c6a', secondary: '#202123', surface: '#343541', surfaceSecondary: '#40414f', text: '#ececf1', textSecondary: '#a3a3a3', border: '#4d4d4f', borderMedium: '#5e5e60', shadow: 'rgba(0,0,0,0.1)' }, icon: '🤖' }, claude: { name: 'Claude', domains: ['claude.ai'], storageKey: 'claude_saved_prompts', theme: { primary: '#CC785C', primaryDark: '#b8654a', secondary: '#f5f5f5', surface: '#ffffff', surfaceSecondary: '#f8f8f8', text: '#1f2937', textSecondary: '#6b7280', border: '#e5e7eb', borderMedium: '#d1d5db', shadow: 'rgba(204, 120, 92, 0.15)' }, icon: '🔶' }, grok: { name: 'Grok', domains: ['x.com', 'twitter.com', 'grok.com'], storageKey: 'grok_saved_prompts', theme: { primary: '#1d9bf0', primaryDark: '#1a8cd8', secondary: '#16181c', surface: '#000000', surfaceSecondary: '#16181c', text: '#e7e9ea', textSecondary: '#71767b', border: '#2f3336', borderMedium: '#3e4348', shadow: 'rgba(29, 155, 240, 0.15)' }, icon: '🚀' }, deepseek: { name: 'DeepSeek', domains: ['chat.deepseek.com'], storageKey: 'deepseek_saved_prompts', theme: { primary: '#2563eb', primaryDark: '#1d4ed8', secondary: '#f8fafc', surface: '#ffffff', surfaceSecondary: '#f1f5f9', text: '#0f172a', textSecondary: '#64748b', border: '#e2e8f0', borderMedium: '#cbd5e1', shadow: 'rgba(37, 99, 235, 0.15)' }, icon: '🌊' }, qwen: { name: 'Qwen', domains: ['chat.qwen.ai', 'qwen.alibaba.com', 'tongyi.aliyun.com'], storageKey: 'qwen_saved_prompts', theme: { primary: '#ff6a00', primaryDark: '#e55a00', secondary: '#fef7ed', surface: '#ffffff', surfaceSecondary: '#fef2e2', text: '#1c1c1c', textSecondary: '#666666', border: '#fed7aa', borderMedium: '#fdba74', shadow: 'rgba(255, 106, 0, 0.15)' }, icon: '🔥' }, gemini: { name: 'Gemini', domains: ['gemini.google.com'], storageKey: 'gemini_saved_prompts', theme: { primary: '#4285f4', primaryDark: '#3367d6', secondary: '#f8f9fa', surface: '#ffffff', surfaceSecondary: '#f1f3f4', text: '#202124', textSecondary: '#5f6368', border: '#dadce0', borderMedium: '#bdc1c6', shadow: 'rgba(66, 133, 244, 0.15)' }, icon: '✨' } }; let currentPlatform = null; let activePlatformTab = null; let allPlatformPrompts = {}; let isToolbarVisible = false; let isToolbarMinimized = false; let lastInsertedPrompt = ''; let undoTimeout = null; let inputDetectionCache = null; let inputDetectionObserver = null; let visibilityCheckInterval = null; let uiChangeObserver = null; let isDarkMode = false; function detectPlatform() { const hostname = window.location.hostname; for (const [key, config] of Object.entries(PLATFORM_CONFIG)) { if (config.domains.some(domain => hostname.includes(domain))) { return key; } } return 'chatgpt'; } function findChatGPTInput() { const selectors = [ '[data-testid="composer-text-input"]', 'textarea[placeholder*="Message"]', 'textarea[placeholder*="Send a message"]', 'div[contenteditable="true"][data-testid*="composer"]', 'form textarea', '#prompt-textarea' ]; for (const selector of selectors) { const element = document.querySelector(selector); if (element && isElementVisible(element)) { return element; } } const textareas = document.querySelectorAll('textarea'); for (const textarea of textareas) { if (isElementVisible(textarea) && textarea.offsetHeight > 30) { return textarea; } } return null; } function findClaudeInput() { const selectors = [ '[data-testid="chat-input"]', 'div[contenteditable="true"][data-testid*="chat"]', '.ProseMirror[contenteditable="true"]', 'div[role="textbox"]', 'div[contenteditable="true"]' ]; for (const selector of selectors) { const element = document.querySelector(selector); if (element && isElementVisible(element)) { return element; } } const editables = document.querySelectorAll('[contenteditable="true"]'); for (const editable of editables) { if (isElementVisible(editable) && editable.offsetHeight > 30) { return editable; } } return null; } function findGrokInput() { const selectors = [ 'textarea[placeholder*="Ask Grok"]', 'textarea[placeholder*="Message Grok"]', 'div[contenteditable="true"][data-testid*="grok"]', 'textarea[data-testid*="text-input"]', '.composer textarea', 'div[role="textbox"]' ]; for (const selector of selectors) { const element = document.querySelector(selector); if (element && isElementVisible(element)) { return element; } } const textareas = document.querySelectorAll('textarea'); for (const textarea of textareas) { const placeholder = textarea.placeholder?.toLowerCase() || ''; if (isElementVisible(textarea) && ( placeholder.includes('ask') || placeholder.includes('message') || placeholder.includes('chat') || textarea.offsetHeight > 40 )) { return textarea; } } return null; } function findDeepSeekInput() { const selectors = [ 'textarea[placeholder*="Send a message"]', 'div[contenteditable="true"]', '.chat-input textarea', 'textarea.form-control', '[data-testid="chat-input"]', '.input-area textarea', '.message-input textarea' ]; for (const selector of selectors) { const element = document.querySelector(selector); if (element && isElementVisible(element)) { return element; } } const textareas = document.querySelectorAll('textarea'); for (const textarea of textareas) { if (isElementVisible(textarea) && textarea.offsetHeight > 30) { return textarea; } } const editables = document.querySelectorAll('[contenteditable="true"]'); for (const editable of editables) { if (isElementVisible(editable) && editable.offsetHeight > 30) { return editable; } } return null; } function findQwenInput() { const selectors = [ 'textarea[placeholder*="请输入"]', 'textarea[placeholder*="输入消息"]', 'textarea[placeholder*="Send a message"]', 'div[contenteditable="true"]', '.chat-input textarea', '[data-testid="input"]', '.input-wrapper textarea', '.message-input textarea' ]; for (const selector of selectors) { const element = document.querySelector(selector); if (element && isElementVisible(element)) { return element; } } const textareas = document.querySelectorAll('textarea'); for (const textarea of textareas) { if (isElementVisible(textarea) && textarea.offsetHeight > 30) { return textarea; } } const editables = document.querySelectorAll('[contenteditable="true"]'); for (const editable of editables) { if (isElementVisible(editable) && editable.offsetHeight > 30) { return editable; } } return null; } function findGeminiInput() { const selectors = [ 'div[contenteditable="true"][data-testid*="input"]', 'div[contenteditable="true"][role="textbox"]', 'textarea[placeholder*="Enter a prompt"]', 'textarea[placeholder*="Message Gemini"]', '.input-area div[contenteditable="true"]', 'div[contenteditable="true"]', '.message-input-container textarea' ]; for (const selector of selectors) { const element = document.querySelector(selector); if (element && isElementVisible(element)) { return element; } } const editables = document.querySelectorAll('[contenteditable="true"]'); for (const editable of editables) { if (isElementVisible(editable) && editable.offsetHeight > 30) { const parent = editable.closest('[data-testid], .input, .message, .chat'); if (parent || editable.offsetHeight > 50) { return editable; } } } const textareas = document.querySelectorAll('textarea'); for (const textarea of textareas) { if (isElementVisible(textarea) && textarea.offsetHeight > 30) { return textarea; } } return null; } function isElementVisible(element) { if (!element) return false; const rect = element.getBoundingClientRect(); const style = window.getComputedStyle(element); return rect.width > 0 && rect.height > 0 && style.display !== 'none' && style.visibility !== 'hidden' && style.opacity !== '0'; } function findInputForCurrentPlatform() { if (inputDetectionCache && isElementVisible(inputDetectionCache)) { return inputDetectionCache; } let input = null; switch (currentPlatform) { case 'chatgpt': input = findChatGPTInput(); break; case 'claude': input = findClaudeInput(); break; case 'grok': input = findGrokInput(); break; case 'deepseek': input = findDeepSeekInput(); break; case 'qwen': input = findQwenInput(); break; case 'gemini': input = findGeminiInput(); break; default: input = findChatGPTInput(); } if (input) { inputDetectionCache = input; } return input; } function setupInputDetectionObserver() { if (inputDetectionObserver) { inputDetectionObserver.disconnect(); } inputDetectionObserver = new MutationObserver(() => { inputDetectionCache = null; }); inputDetectionObserver.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] }); } function setupUIChangeObserver() { if (uiChangeObserver) { uiChangeObserver.disconnect(); } uiChangeObserver = new MutationObserver((mutations) => { let shouldCheckVisibility = false; mutations.forEach((mutation) => { if (mutation.type === 'childList') { mutation.addedNodes.forEach((node) => { if (node.nodeType === Node.ELEMENT_NODE) { const computedStyle = window.getComputedStyle(node); const zIndex = parseInt(computedStyle.zIndex) || 0; if (zIndex > 5000 || node.classList.contains('modal') || node.classList.contains('overlay') || node.classList.contains('popup')) { shouldCheckVisibility = true; } } }); } }); if (shouldCheckVisibility) { setTimeout(ensureToggleButtonVisibility, 100); } }); uiChangeObserver.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class', 'z-index'] }); } function ensureToggleButtonVisibility() { const toggleButton = document.getElementById('prompt-manager-toggle'); if (!toggleButton) { createToggleButton(); return; } const rect = toggleButton.getBoundingClientRect(); const isVisible = rect.width > 0 && rect.height > 0; const computedStyle = window.getComputedStyle(toggleButton); if (!isVisible || computedStyle.display === 'none' || computedStyle.visibility === 'hidden') { toggleButton.remove(); createToggleButton(); } else { toggleButton.style.setProperty('z-index', '2147483647', 'important'); toggleButton.style.setProperty('position', 'fixed', 'important'); toggleButton.style.setProperty('display', 'flex', 'important'); toggleButton.style.setProperty('visibility', 'visible', 'important'); toggleButton.style.setProperty('opacity', '1', 'important'); } } function startVisibilityCheck() { if (visibilityCheckInterval) { clearInterval(visibilityCheckInterval); } visibilityCheckInterval = setInterval(ensureToggleButtonVisibility, 3000); } function stopVisibilityCheck() { if (visibilityCheckInterval) { clearInterval(visibilityCheckInterval); visibilityCheckInterval = null; } } function insertPromptIntoInput(prompt, textInput) { lastInsertedPrompt = textInput.tagName === 'TEXTAREA' ? textInput.value : textInput.textContent; if (textInput.tagName === 'TEXTAREA') { const setValue = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value').set; setValue.call(textInput, prompt.content); const inputEvent = new Event('input', { bubbles: true }); textInput.dispatchEvent(inputEvent); textInput.dispatchEvent(new Event('change', { bubbles: true })); } else if (textInput.contentEditable === 'true') { textInput.textContent = prompt.content; const inputEvent = new InputEvent('input', { bubbles: true, cancelable: true, inputType: 'insertText', data: prompt.content }); textInput.dispatchEvent(inputEvent); textInput.dispatchEvent(new Event('change', { bubbles: true })); } textInput.focus(); setTimeout(() => textInput.focus(), 100); } function undoLastInsertion() { const textInput = findInputForCurrentPlatform(); const undoBtn = document.getElementById('prompt-undo-btn'); if (textInput && lastInsertedPrompt !== '') { if (textInput.tagName === 'TEXTAREA') { const setValue = Object.getOwnPropertyDescriptor(window.HTMLTextAreaElement.prototype, 'value').set; setValue.call(textInput, lastInsertedPrompt); const inputEvent = new Event('input', { bubbles: true }); textInput.dispatchEvent(inputEvent); textInput.dispatchEvent(new Event('change', { bubbles: true })); } else if (textInput.contentEditable === 'true') { textInput.textContent = lastInsertedPrompt; const inputEvent = new InputEvent('input', { bubbles: true, cancelable: true, inputType: 'insertText', data: lastInsertedPrompt }); textInput.dispatchEvent(inputEvent); textInput.dispatchEvent(new Event('change', { bubbles: true })); } textInput.focus(); if (undoBtn) undoBtn.classList.remove('visible'); lastInsertedPrompt = ''; showNotification('Insertion undone!'); } } function loadAllPrompts() { allPlatformPrompts = {}; Object.entries(PLATFORM_CONFIG).forEach(([platform, config]) => { const storageKey = config.storageKey; let storedData = GM_getValue(storageKey, null); if (storedData === null) { const localStorageData = localStorage.getItem(storageKey); if (localStorageData) { storedData = localStorageData; GM_setValue(storageKey, storedData); } else { storedData = '[]'; } } allPlatformPrompts[platform] = JSON.parse(storedData); }); } function savePromptsForPlatform(platform, prompts) { const config = PLATFORM_CONFIG[platform]; if (config) { GM_setValue(config.storageKey, JSON.stringify(prompts)); allPlatformPrompts[platform] = prompts; } } function getCurrentPrompts() { const targetPlatform = activePlatformTab || currentPlatform; return allPlatformPrompts[targetPlatform] || []; } function setCurrentPrompts(prompts) { const targetPlatform = activePlatformTab || currentPlatform; savePromptsForPlatform(targetPlatform, prompts); } function generateStyles(platform) { const theme = isDarkMode && PLATFORM_CONFIG[platform].darkTheme ? PLATFORM_CONFIG[platform].darkTheme : PLATFORM_CONFIG[platform].theme; return ` :root { --primary: ${theme.primary}; --primary-dark: ${theme.primaryDark}; --surface-primary: ${theme.surface}; --surface-secondary: ${theme.secondary}; --text-primary: ${theme.text}; --text-secondary: ${theme.textSecondary}; --border-light: ${theme.border}; --border-medium: ${theme.borderMedium}; --shadow-color: ${theme.shadow}; } #prompt-manager-toggle { position: fixed !important; top: 50% !important; right: 10px !important; transform: translateY(-50%) !important; z-index: 2147483647 !important; background: var(--surface-primary) !important; border: 1px solid var(--border-light) !important; border-radius: 8px !important; width: 40px !important; height: 40px !important; cursor: pointer !important; display: flex !important; align-items: center !important; justify-content: center !important; box-shadow: 0 2px 8px var(--shadow-color) !important; transition: all 0.2s ease !important; visibility: visible !important; opacity: 1 !important; pointer-events: auto !important; } #prompt-manager-toggle:hover { background: var(--surface-secondary) !important; box-shadow: 0 4px 12px var(--shadow-color) !important; } .hamburger { width: 18px !important; height: 12px !important; position: relative !important; } .hamburger span { display: block !important; position: absolute !important; height: 2px !important; width: 100% !important; background: var(--text-primary) !important; border-radius: 1px !important; opacity: 1 !important; left: 0 !important; transform: rotate(0deg) !important; transition: 0.25s ease-in-out !important; } .hamburger span:nth-child(1) { top: 0px !important; } .hamburger span:nth-child(2) { top: 5px !important; } .hamburger span:nth-child(3) { top: 10px !important; } #prompt-manager-toolbar { position: fixed !important; top: 0 !important; right: -380px !important; width: 380px !important; height: 100vh !important; background: var(--surface-primary) !important; border-left: 1px solid var(--border-light) !important; box-shadow: -2px 0 15px var(--shadow-color) !important; z-index: 2147483646 !important; transition: right 0.3s ease !important; display: flex !important; flex-direction: column !important; } #prompt-manager-toolbar.visible { right: 0 !important; } #prompt-manager-toolbar.minimized { width: 60px !important; } .toolbar-header { padding: 16px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; background: var(--surface-secondary); } .toolbar-title { font-weight: 600; color: var(--text-primary); font-size: 14px; display: flex; align-items: center; gap: 8px; } .platform-indicator { font-size: 16px; } .toolbar-controls { display: flex; gap: 8px; } .toolbar-btn { background: transparent; border: 1px solid var(--border-light); border-radius: 6px; padding: 6px 8px; cursor: pointer; color: var(--text-primary); font-size: 12px; transition: all 0.2s ease; } .toolbar-btn:hover { background: var(--surface-secondary); } .platform-tabs { display: flex; background: var(--surface-secondary); border-bottom: 1px solid var(--border-light); overflow-x: auto; scrollbar-width: none; -ms-overflow-style: none; } .platform-tabs::-webkit-scrollbar { display: none; } .platform-tab { flex: 1; min-width: 60px; padding: 8px 4px; text-align: center; cursor: pointer; border: none; background: transparent; color: var(--text-secondary); font-size: 11px; transition: all 0.2s ease; white-space: nowrap; display: flex; flex-direction: column; align-items: center; gap: 2px; } .platform-tab:hover { background: var(--surface-primary); color: var(--text-primary); } .platform-tab.active { background: var(--primary); color: white; } .platform-tab-icon { font-size: 14px; } .platform-tab-name { font-size: 9px; font-weight: 500; } .prompt-list { flex: 1; overflow-y: auto; padding: 16px; } .prompt-item { margin-bottom: 12px; border: 1px solid var(--border-light); border-radius: 8px; background: var(--surface-primary); transition: all 0.2s ease; } .prompt-item:hover { border-color: var(--border-medium); box-shadow: 0 2px 4px var(--shadow-color); } .prompt-header { padding: 12px; border-bottom: 1px solid var(--border-light); display: flex; align-items: center; justify-content: space-between; } .prompt-name { font-weight: 500; color: var(--text-primary); font-size: 13px; max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; } .prompt-actions { display: flex; gap: 4px; } .action-btn { background: transparent; border: none; padding: 4px 6px; border-radius: 4px; cursor: pointer; color: var(--text-secondary); font-size: 11px; transition: all 0.2s ease; } .action-btn:hover { background: var(--surface-secondary); color: var(--text-primary); } .action-btn.danger:hover { background: #fee; color: #d32f2f; } .action-btn.clone:hover { background: var(--primary); color: white; } .prompt-preview { padding: 12px; color: var(--text-secondary); font-size: 12px; line-height: 1.4; max-height: 60px; overflow: hidden; cursor: pointer; } .prompt-preview:hover { color: var(--text-primary); } .add-prompt-form { padding: 16px; border-top: 1px solid var(--border-light); background: var(--surface-secondary); } .form-group { margin-bottom: 12px; } .form-label { display: block; margin-bottom: 4px; color: var(--text-primary); font-size: 12px; font-weight: 500; } .form-input, .form-textarea { width: 100%; padding: 8px 12px; border: 1px solid var(--border-light); border-radius: 6px; background: var(--surface-primary); color: var(--text-primary); font-size: 13px; resize: vertical; box-sizing: border-box; } .form-textarea { min-height: 80px; font-family: inherit; } .form-input:focus, .form-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(var(--primary), 0.2); } .form-actions { display: flex; gap: 6px; flex-wrap: wrap; } .btn-primary { background: var(--primary); color: white; border: none; padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 11px; font-weight: 500; transition: all 0.2s ease; } .btn-primary:hover { background: var(--primary-dark); } .btn-secondary { background: transparent; color: var(--text-primary); border: 1px solid var(--border-light); padding: 8px 12px; border-radius: 6px; cursor: pointer; font-size: 11px; transition: all 0.2s ease; } .btn-secondary:hover { background: var(--surface-primary); } .clone-modal { position: fixed !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; background: rgba(0,0,0,0.5) !important; z-index: 2147483647 !important; display: flex !important; align-items: center !important; justify-content: center !important; } .clone-modal-content { background: var(--surface-primary); border-radius: 8px; padding: 20px; max-width: 400px; width: 90%; box-shadow: 0 10px 25px rgba(0,0,0,0.2); } .clone-modal h3 { margin: 0 0 16px 0; color: var(--text-primary); font-size: 16px; } .platform-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-bottom: 16px; } .platform-option { padding: 12px; border: 1px solid var(--border-light); border-radius: 6px; cursor: pointer; text-align: center; transition: all 0.2s ease; display: flex; flex-direction: column; align-items: center; gap: 4px; } .platform-option:hover { border-color: var(--primary); background: var(--surface-secondary); } .platform-option.selected { border-color: var(--primary); background: var(--primary); color: white; } .clone-actions { display: flex; gap: 8px; justify-content: flex-end; } #prompt-undo-btn { position: fixed !important; right: 20px !important; bottom: 20px !important; background: #f59e0b !important; color: white !important; border: none !important; border-radius: 20px !important; padding: 8px 16px !important; cursor: pointer !important; font-size: 12px !important; font-weight: 500 !important; box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3) !important; opacity: 0 !important; transform: translateY(20px) !important; transition: all 0.3s ease !important; z-index: 2147483645 !important; } #prompt-undo-btn.visible { opacity: 1 !important; transform: translateY(0) !important; } #prompt-undo-btn:hover { background: #d97706 !important; transform: translateY(-2px) !important; box-shadow: 0 4px 12px rgba(245, 158, 11, 0.4) !important; } .minimized .toolbar-header, .minimized .platform-tabs, .minimized .prompt-list, .minimized .add-prompt-form { display: none; } .minimized-controls { display: none; padding: 16px 8px; flex-direction: column; gap: 8px; align-items: center; } .minimized .minimized-controls { display: flex; } .minimized-btn { width: 40px; height: 40px; border: 1px solid var(--border-light); border-radius: 6px; background: var(--surface-primary); cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; } .minimized-btn:hover { background: var(--surface-secondary); } .prompt-list::-webkit-scrollbar { width: 6px; } .prompt-list::-webkit-scrollbar-track { background: var(--surface-secondary); } .prompt-list::-webkit-scrollbar-thumb { background: var(--border-medium); border-radius: 3px; } .prompt-list::-webkit-scrollbar-thumb:hover { background: var(--text-secondary); } .sync-status { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: #10b981; } @keyframes fadeInUp { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } } .fade-in-up { animation: fadeInUp 0.3s ease; } @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } } .syncing { animation: pulse 1s infinite; } `; } function injectStyles() { const existingStyle = document.getElementById('prompt-manager-styles'); if (existingStyle) { existingStyle.remove(); } const styleSheet = document.createElement('style'); styleSheet.id = 'prompt-manager-styles'; styleSheet.textContent = generateStyles(currentPlatform); document.head.appendChild(styleSheet); } function createToggleButton() { const existingButton = document.getElementById('prompt-manager-toggle'); if (existingButton) { existingButton.remove(); } const button = document.createElement('div'); button.id = 'prompt-manager-toggle'; button.innerHTML = `