// WPlace AutoBOT Script Manager - Neon Cyberpunk Edition // Fixed version with proper content script communication (function() { 'use strict'; console.log('%cš® WPlace AutoBOT Script Manager v2.0 - FIXED', 'color: #00ff41; font-weight: bold; font-size: 16px;'); console.log('%cā” Neon Cyberpunk Theme with Content Script Bridge', 'color: #00ff41; font-weight: bold;'); // Available scripts configuration const AVAILABLE_SCRIPTS = [ { name: 'Auto-Image.js', title: 'Auto Image Placer', description: 'Automatically place images on the canvas with smart positioning', category: 'Automation', primary: true }, { name: 'Auto-Farm.js', title: 'Auto Farm Bot', description: 'Automated farming and resource collection', category: 'Automation' }, { name: 'Auto-Repair.js', title: 'Auto Repair Tool', description: 'Automatically repair damaged pixels and structures', category: 'Utility' } ]; // Neon cyberpunk CSS styles const NEON_STYLES = ` @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap'); @keyframes neon-glow { 0%, 100% { box-shadow: 0 0 5px #00ff41, 0 0 10px #00ff41, 0 0 15px #00ff41; } 50% { box-shadow: 0 0 10px #00ff41, 0 0 20px #00ff41, 0 0 30px #00ff41; } } @keyframes pixel-blink { 0%, 50% { opacity: 1; } 51%, 100% { opacity: 0.7; } } @keyframes scanline { 0% { transform: translateX(-100%); } 100% { transform: translateX(100vw); } } @keyframes neon-fade-in { from { opacity: 0; transform: scale(0.8) translateY(20px); } to { opacity: 1; transform: scale(1) translateY(0); } } @keyframes neon-fade-out { from { opacity: 1; transform: scale(1) translateY(0); } to { opacity: 0; transform: scale(0.8) translateY(-20px); } } @keyframes backdrop-fade-in { from { opacity: 0; } to { opacity: 1; } } @keyframes backdrop-fade-out { from { opacity: 1; } to { opacity: 0; } } .script-manager-backdrop { position: fixed; top: 0; left: 0; width: 100vw; height: 100vh; background: rgba(26, 26, 46, 0.8); backdrop-filter: blur(5px); z-index: 999998; animation: backdrop-fade-in 0.3s ease-out forwards; } .script-manager-container { position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 90%; max-width: 600px; background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%); border: 2px solid #00ff41; border-radius: 0; z-index: 999999; font-family: 'Press Start 2P', monospace; color: #00ff41; box-shadow: 0 0 30px rgba(0, 255, 65, 0.5), inset 0 0 30px rgba(0, 255, 65, 0.1); animation: neon-fade-in 0.3s ease-out forwards; outline: none; } .script-manager-container::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px; background: linear-gradient(90deg, transparent, #00ff41, transparent); z-index: 1; pointer-events: none; animation: scanline 3s linear infinite; opacity: 0.7; } .script-manager-header { background: #16213e; border-bottom: 2px solid #00ff41; padding: 15px 20px; position: relative; display: flex; justify-content: space-between; align-items: center; } .header-content { display: flex; align-items: center; gap: 15px; } .header-icon { width: 32px; height: 32px; border-radius: 6px; box-shadow: 0 0 15px rgba(0, 255, 65, 0.4); transition: all 0.3s ease; animation: pixel-blink 3s infinite; } .header-icon:hover { transform: scale(1.1); box-shadow: 0 0 25px rgba(0, 255, 65, 0.6); } .script-manager-title { color: #00ff41; font-size: 14px; text-shadow: 0 0 15px #00ff41; margin: 0; text-transform: uppercase; letter-spacing: 2px; } .script-manager-close { background: transparent; border: 2px solid #ff073a; color: #ff073a; width: 40px; height: 40px; border-radius: 0; font-family: 'Press Start 2P', monospace; font-size: 16px; cursor: pointer; transition: all 0.3s ease; text-shadow: 0 0 10px #ff073a; } .script-manager-close:hover { background: #ff073a; color: #000; box-shadow: 0 0 20px rgba(255, 7, 58, 0.6); transform: scale(1.1); } .script-manager-content { padding: 20px; min-height: 200px; max-height: 400px; overflow-y: auto; } .script-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 15px; } .script-card { background: linear-gradient(135deg, #1a1a2e, #16213e); border: 1px solid #00ff41; padding: 15px; cursor: pointer; transition: all 0.3s ease; position: relative; overflow: hidden; } .script-card::before { content: ''; position: absolute; top: 0; left: -100%; width: 100%; height: 100%; background: linear-gradient(90deg, transparent, rgba(0, 255, 65, 0.1), transparent); transition: left 0.5s ease; } .script-card:hover::before { left: 100%; } .script-card:hover { border-color: #39ff14; box-shadow: 0 0 20px rgba(0, 255, 65, 0.4); transform: translateY(-2px); } .script-card.primary { border-color: #39ff14; box-shadow: 0 0 15px rgba(57, 255, 20, 0.3); } .script-card.primary::after { content: 'ā RECOMMENDED'; position: absolute; top: 5px; right: 5px; background: #39ff14; color: #000; padding: 2px 5px; font-size: 6px; text-shadow: none; } .script-name { color: #00ff41; font-size: 10px; font-weight: bold; text-shadow: 0 0 10px #00ff41; margin-bottom: 8px; text-transform: uppercase; } .script-description { color: #00ff41dd; font-size: 7px; line-height: 1.4; margin-bottom: 10px; text-shadow: 0 0 5px #00ff41; } .script-category { background: rgba(255, 107, 53, 0.2); border: 1px solid #ff6b35; color: #ff6b35; padding: 3px 8px; font-size: 7px; text-transform: uppercase; letter-spacing: 1px; text-shadow: 0 0 5px #ff6b35; display: inline-block; } .script-manager-footer { background: #16213e; border-top: 2px solid #00ff41; padding: 15px 20px; display: flex; justify-content: space-between; align-items: center; } .status-text { color: #00ff41dd; font-size: 8px; text-shadow: 0 0 5px #00ff41; } .action-buttons { display: flex; gap: 10px; } .neon-btn { background: #16213e; border: 2px solid #00ff41; border-radius: 0; color: #00ff41; padding: 8px 15px; font-family: 'Press Start 2P', monospace; font-size: 8px; text-transform: uppercase; cursor: pointer; transition: all 0.3s ease; text-shadow: 0 0 8px #00ff41; letter-spacing: 1px; } .neon-btn:hover { background: #00ff41; color: #000; box-shadow: 0 0 20px rgba(0, 255, 65, 0.6); transform: scale(1.05); } .neon-btn.secondary { border-color: #ff6b35; color: #ff6b35; text-shadow: 0 0 8px #ff6b35; } .neon-btn.secondary:hover { background: #ff6b35; color: #000; box-shadow: 0 0 20px rgba(255, 107, 53, 0.6); } .loading-container { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 200px; gap: 20px; } .loading-spinner { width: 40px; height: 40px; border: 2px solid #16213e; border-top: 2px solid #00ff41; border-radius: 50%; animation: spin 1s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .loading-text { color: #00ff41; font-size: 10px; text-align: center; text-shadow: 0 0 10px #00ff41; animation: pixel-blink 1.5s infinite; } `; // ESC key handler for closing function handleEscKey(event) { if (event.key === 'Escape') { closeScriptManager(); } } // Execute script function with content script communication async function executeScript(scriptName) { console.group(`%cš Executing ${scriptName}`, 'color: #00ff41; font-weight: bold;'); try { showLoading(`Launching ${scriptName}...`); console.log('%cš Script Manager ā Content Script ā Background Script ā Execute', 'color: #ff6b35; font-weight: bold;'); console.log('Script Manager runs in page context, using postMessage bridge to extension'); // Create response promise const responsePromise = new Promise((resolve, reject) => { const timeoutId = setTimeout(() => { reject(new Error('Timeout: No response from extension after 10 seconds')); }, 10000); const handleResponse = (event) => { if (event.source !== window || !event.data) return; if (event.data.type === 'AUTOBOT_SCRIPT_RESPONSE') { clearTimeout(timeoutId); window.removeEventListener('message', handleResponse); if (event.data.success) { resolve(event.data); } else { reject(new Error(event.data.error || 'Script execution failed')); } } }; window.addEventListener('message', handleResponse); }); // Send message to content script console.log(`%cš¤ Sending postMessage to content script`, 'color: #06b6d4;'); console.log(` Script: ${scriptName}`); window.postMessage({ type: 'AUTOBOT_EXECUTE_SCRIPT', scriptName: scriptName, source: 'script-manager', timestamp: Date.now() }, '*'); // Wait for response const response = await responsePromise; console.log(`%cā ${scriptName} executed successfully!`, 'color: #39ff14; font-weight: bold;'); showSuccess(`${scriptName} launched successfully!`); setTimeout(() => { closeScriptManager(); }, 2000); } catch (error) { console.error(`%cā Failed to execute ${scriptName}:`, 'color: #ff073a; font-weight: bold;', error); showError(`Failed to launch ${scriptName}: ${error.message}`); } finally { console.groupEnd(); } } // UI Management functions function showLoading(message) { const container = document.getElementById('script-manager-content'); if (!container) return; container.innerHTML = `
${script.description}
${script.category}