// ==================== МОДУЛЬ МНЕМОСХЕМЫ ==================== (function() { const core = window.VideoIPRedirect; if (!core) { console.error('[CAPS_Enhancer] CORE не загружен!'); return; } const debugLog = (msg, ...args) => core.debugLog('mnemo', msg, ...args); debugLog('🏠 Загрузка модуля...'); // Функция для получения хоста из текущего URL function getCurrentHostFromUrl() { const hostname = window.location.hostname; debugLog('Используем hostname:', hostname); return hostname; } // Функция для поиска ссылки на мнемосхему function findMnemoLink() { debugLog('Поиск ссылки на мнемосхему'); const allLinks = document.querySelectorAll('a'); for (let link of allLinks) { const text = link.textContent.toLowerCase().trim(); const href = link.getAttribute('href') || ''; if (text.includes('мнемосхема') || href.includes('/scheme')) { debugLog('✅ Найдена!'); return link; } } debugLog('❌ Ссылка не найдена'); return null; } // Кнопка "Лещ" — переход на host:порт_видео (тот же стиль, что и Мнемосхема) function createVideoButton(host) { const oldVideoBtn = document.querySelector('.video-redirect-btn'); if (oldVideoBtn) oldVideoBtn.remove(); const portVideo = core.TARGET_PORT_VIDEO || core.CONFIG?.ports?.video || '5000'; const targetUrl = `http://${host}:${portVideo}`; const button = core.createStyledButton( 'Лещ', (e) => { e.preventDefault(); e.stopPropagation(); window.open(targetUrl, '_blank'); }, 'video-redirect-btn' ); button.setAttribute('data-host', host); button.setAttribute('data-port', portVideo); return button; } // Функция для создания кнопки "Мнемосхема" function createButton(originalLink, host) { const oldBtn = document.querySelector('.scheme-redirect-btn'); if (oldBtn) oldBtn.remove(); const mode = core.CONFIG?.mnemo?.mode || 'host-port'; const currentHostWithPort = window.location.host || host; let targetUrl; if (mode === 'host-scheme') { targetUrl = `http://${currentHostWithPort}/scheme`; } else { targetUrl = `http://${host}:${core.TARGET_PORT_SCHEME}`; } const button = core.createStyledButton( 'Мнемосхема', (e) => { e.preventDefault(); e.stopPropagation(); window.open(targetUrl, '_blank'); }, 'scheme-redirect-btn' ); // Для кнопки мнемосхемы используем вместо