- Convert 10 ROA files from new-style.css to professional-theme.css - Convert 6 ROA files from legacy style.css to professional theme - Convert 3 menu files from legacy style.css to professional theme - Convert 3 chatbot files while preserving functionality - Convert demo.html to professional theme - Apply Tailwind CSS + Flowbite + Lucide Icons throughout - Modernize navigation and footer consistency - Maintain all original content and functionality 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
776 lines
35 KiB
HTML
776 lines
35 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="ro">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Maria ChatBot Advanced - Romfast Suport</title>
|
|
<meta name="description" content="Maria ChatBot Advanced - Asistent AI Romfast cu injectare automată de mesaje din URL și simulare avansată de interacțiuni pentru ROA.">
|
|
|
|
<!-- Tailwind CSS -->
|
|
<script src="https://cdn.tailwindcss.com"></script>
|
|
<!-- Flowbite -->
|
|
<script src="https://cdn.jsdelivr.net/npm/flowbite@2.0.0/dist/flowbite.min.js"></script>
|
|
<!-- Lucide Icons -->
|
|
<script src="https://unpkg.com/lucide@latest/dist/umd/lucide.min.js"></script>
|
|
<!-- Google Fonts -->
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=Merriweather:wght@300;400;700&family=JetBrains+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
<!-- Professional Theme CSS -->
|
|
<link href="professional-theme.css" rel="stylesheet">
|
|
|
|
<style>
|
|
/* Advanced professional styling for Maria's enhanced features */
|
|
body {
|
|
font-family: var(--font-sans) !important;
|
|
background: var(--background) !important;
|
|
color: var(--foreground) !important;
|
|
letter-spacing: var(--tracking-normal) !important;
|
|
line-height: 1.6 !important;
|
|
}
|
|
|
|
/* Advanced professional styling for link generation button */
|
|
.link-button-small {
|
|
background: transparent !important;
|
|
border: none !important;
|
|
padding: 0 !important;
|
|
margin: 0 0 0 8px !important;
|
|
height: 56px !important;
|
|
width: 56px !important;
|
|
display: flex !important;
|
|
align-items: center !important;
|
|
justify-content: center !important;
|
|
cursor: pointer !important;
|
|
transition: all 0.2s ease !important;
|
|
border-radius: var(--radius) !important;
|
|
font-size: 18px !important;
|
|
color: var(--primary) !important;
|
|
opacity: 0.8 !important;
|
|
flex-shrink: 0 !important;
|
|
}
|
|
|
|
.link-button-small:hover {
|
|
background-color: var(--card-hover) !important;
|
|
opacity: 1 !important;
|
|
transform: scale(1.05) !important;
|
|
color: var(--secondary) !important;
|
|
}
|
|
|
|
.link-button-small:active {
|
|
transform: scale(0.95) !important;
|
|
}
|
|
|
|
.link-button-small.success {
|
|
color: var(--accent) !important;
|
|
background-color: rgba(184, 85, 85, 0.1) !important;
|
|
}
|
|
|
|
/* Professional toast notifications with enhanced styling */
|
|
.toast {
|
|
position: fixed;
|
|
top: 20px;
|
|
right: 20px;
|
|
background: var(--primary) !important;
|
|
color: var(--primary-foreground) !important;
|
|
padding: 12px 20px;
|
|
border-radius: var(--radius-lg) !important;
|
|
z-index: 10000;
|
|
opacity: 0;
|
|
transform: translateX(100%);
|
|
transition: all 0.3s ease;
|
|
box-shadow: var(--shadow-lg) !important;
|
|
font-size: 14px;
|
|
font-family: var(--font-sans) !important;
|
|
border: 1px solid var(--border) !important;
|
|
}
|
|
|
|
.toast.show {
|
|
opacity: 1;
|
|
transform: translateX(0);
|
|
}
|
|
|
|
.toast.error {
|
|
background: var(--accent) !important;
|
|
color: var(--accent-foreground) !important;
|
|
}
|
|
|
|
/* Professional loading states and simulation indicators */
|
|
.simulation-indicator {
|
|
position: fixed;
|
|
bottom: 20px;
|
|
left: 20px;
|
|
background: var(--secondary) !important;
|
|
color: var(--secondary-foreground) !important;
|
|
padding: 8px 16px;
|
|
border-radius: var(--radius-lg) !important;
|
|
font-size: 12px;
|
|
font-weight: 500;
|
|
z-index: 9999;
|
|
opacity: 0;
|
|
transform: translateY(100%);
|
|
transition: all 0.3s ease;
|
|
box-shadow: var(--shadow-md) !important;
|
|
font-family: var(--font-mono) !important;
|
|
}
|
|
|
|
.simulation-indicator.show {
|
|
opacity: 1;
|
|
transform: translateY(0);
|
|
}
|
|
</style>
|
|
</head>
|
|
<body class="min-h-screen">
|
|
<!-- Soft Professional Blue Header -->
|
|
<header class="professional-navbar sticky top-0 z-50">
|
|
<nav class="container mx-auto px-4 py-4">
|
|
<div class="flex items-center justify-between">
|
|
<!-- Logo Section -->
|
|
<div class="flex items-center space-x-3">
|
|
<img src="images/romfast_logo.png" alt="Romfast Logo" class="romfast-logo">
|
|
<div class="hidden md:block">
|
|
<p class="text-white text-sm italic font-light">Aduce informația în mâinile tale</p>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Centered Navigation -->
|
|
<div class="hidden lg:flex items-center space-x-8">
|
|
<a href="index.html" class="text-white hover:text-blue-200 transition-colors font-medium nav-link">Prima pagina</a>
|
|
<a href="menu/desprenoi.html" class="text-white hover:text-blue-200 transition-colors nav-link">Despre noi</a>
|
|
<a href="roa/aplicatii-erp.html" class="text-white hover:text-blue-200 transition-colors nav-link">ROA</a>
|
|
<div class="relative group">
|
|
<button class="text-white hover:text-blue-200 transition-colors flex items-center space-x-1 nav-link">
|
|
<span>Servicii</span>
|
|
<i data-lucide="chevron-down" class="w-4 h-4"></i>
|
|
</button>
|
|
<div class="absolute top-full left-0 mt-2 w-48 bg-white rounded-lg shadow-lg border border-gray-200 opacity-0 invisible group-hover:opacity-100 group-hover:visible transition-all duration-300">
|
|
<a href="menu/analiza.html" class="block px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-800 rounded-t-lg">Analiza</a>
|
|
<a href="menu/implementare.html" class="block px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-800">Implementare</a>
|
|
<a href="menu/roa-suport-tehnic.html" class="block px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-800">Suport tehnic ROA</a>
|
|
<a href="menu/alteservicii.html" class="block px-4 py-3 text-gray-700 hover:bg-blue-50 hover:text-blue-800 rounded-b-lg">Alte servicii</a>
|
|
</div>
|
|
</div>
|
|
<a href="menu/referinte.html" class="text-white hover:text-blue-200 transition-colors nav-link">Referinte</a>
|
|
<a href="menu/angajari.html" class="text-white hover:text-blue-200 transition-colors nav-link">Angajari</a>
|
|
<a href="menu/contact.html" class="text-white hover:text-blue-200 transition-colors nav-link">Contact</a>
|
|
</div>
|
|
|
|
<!-- Theme Toggle & Mobile Menu -->
|
|
<div class="flex items-center space-x-4">
|
|
<button id="theme-toggle" class="text-white p-2 rounded-lg hover:bg-white hover:bg-opacity-20 transition-all duration-300">
|
|
<i data-lucide="sun" class="w-5 h-5"></i>
|
|
</button>
|
|
<button id="mobile-menu-toggle" class="lg:hidden text-white p-2 rounded-lg hover:bg-white hover:bg-opacity-20 transition-all duration-300">
|
|
<i data-lucide="menu" class="w-6 h-6" id="menu-icon"></i>
|
|
<i data-lucide="x" class="w-6 h-6 hidden" id="close-icon"></i>
|
|
</button>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Mobile Menu -->
|
|
<div id="mobile-menu" class="lg:hidden hidden bg-white border-t border-gray-200 shadow-lg">
|
|
<div class="px-4 py-4 space-y-3">
|
|
<a href="index.html" class="block text-gray-700 hover:text-blue-600 transition-colors font-medium py-2">Prima pagina</a>
|
|
<a href="menu/desprenoi.html" class="block text-gray-700 hover:text-blue-600 transition-colors py-2">Despre noi</a>
|
|
<a href="roa/aplicatii-erp.html" class="block text-gray-700 hover:text-blue-600 transition-colors py-2">ROA</a>
|
|
<div class="border-l-2 border-gray-300 pl-4 space-y-2">
|
|
<p class="text-gray-600 font-medium text-sm">Servicii</p>
|
|
<a href="menu/analiza.html" class="block text-gray-600 hover:text-blue-600 transition-colors py-1 text-sm">Analiza</a>
|
|
<a href="menu/implementare.html" class="block text-gray-600 hover:text-blue-600 transition-colors py-1 text-sm">Implementare</a>
|
|
<a href="menu/roa-suport-tehnic.html" class="block text-gray-600 hover:text-blue-600 transition-colors py-1 text-sm">Suport tehnic ROA</a>
|
|
<a href="menu/alteservicii.html" class="block text-gray-600 hover:text-blue-600 transition-colors py-1 text-sm">Alte servicii</a>
|
|
</div>
|
|
<a href="menu/referinte.html" class="block text-gray-700 hover:text-blue-600 transition-colors py-2">Referinte</a>
|
|
<a href="menu/angajari.html" class="block text-gray-700 hover:text-blue-600 transition-colors py-2">Angajari</a>
|
|
<a href="menu/contact.html" class="block text-gray-700 hover:text-blue-600 transition-colors py-2">Contact</a>
|
|
</div>
|
|
</div>
|
|
</nav>
|
|
</header>
|
|
|
|
<!-- Main Content Container -->
|
|
<main class="container mx-auto px-4 py-8 max-w-7xl">
|
|
|
|
<!-- Maria Advanced Chatbot Section with Professional Styling -->
|
|
<section class="professional-hero text-center mb-8">
|
|
<div class="max-w-4xl mx-auto relative z-10">
|
|
<h1 class="text-4xl md:text-5xl font-bold mb-6 professional-text-primary">
|
|
Maria ChatBot Advanced
|
|
</h1>
|
|
<p class="text-xl professional-text-secondary mb-8 leading-relaxed">
|
|
Asistent AI avansat Romfast cu injectare automată de mesaje din URL și simulare ultra-realistă de interacțiuni pentru sistemul ROA.
|
|
</p>
|
|
<div class="flex flex-col sm:flex-row gap-4 justify-center">
|
|
<div class="professional-btn-secondary inline-flex items-center space-x-2">
|
|
<i data-lucide="zap" class="w-4 h-4"></i>
|
|
<span>Injectare automată mesaje</span>
|
|
</div>
|
|
<div class="professional-btn-secondary inline-flex items-center space-x-2">
|
|
<i data-lucide="bot" class="w-4 h-4"></i>
|
|
<span>Simulare interacțiuni utilizator</span>
|
|
</div>
|
|
<div class="professional-btn-secondary inline-flex items-center space-x-2">
|
|
<i data-lucide="link" class="w-4 h-4"></i>
|
|
<span>Link-uri partajabile</span>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</section>
|
|
|
|
<!-- Chatbot Container -->
|
|
<div class="professional-card p-8 max-w-4xl mx-auto">
|
|
<div class="text-center mb-6">
|
|
<h2 class="text-2xl font-semibold professional-text-primary mb-4">AI Suport Tehnic Avansat ROA</h2>
|
|
<p class="professional-text-secondary">Experiență chatbot avansată cu procesare automată de mesaje din URL-uri, simulare ultra-realistă de tastare și generare de link-uri partajabile pentru răspunsuri complexe.</p>
|
|
|
|
<!-- Advanced Features Info -->
|
|
<div class="grid md:grid-cols-3 gap-4 mt-6 text-sm">
|
|
<div class="bg-blue-50 p-3 rounded-lg">
|
|
<i data-lucide="download" class="w-5 h-5 mx-auto mb-2 text-blue-600"></i>
|
|
<p class="font-medium text-blue-800">URL Message Injection</p>
|
|
<p class="text-blue-600">Procesare automată întrebări din URL</p>
|
|
</div>
|
|
<div class="bg-green-50 p-3 rounded-lg">
|
|
<i data-lucide="keyboard" class="w-5 h-5 mx-auto mb-2 text-green-600"></i>
|
|
<p class="font-medium text-green-800">Real User Simulation</p>
|
|
<p class="text-green-600">Simulare realistă tastare caracter cu caracter</p>
|
|
</div>
|
|
<div class="bg-purple-50 p-3 rounded-lg">
|
|
<i data-lucide="share" class="w-5 h-5 mx-auto mb-2 text-purple-600"></i>
|
|
<p class="font-medium text-purple-800">Smart Link Generation</p>
|
|
<p class="text-purple-600">Generare link-uri partajabile pentru întrebări</p>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Flowise Chatbot -->
|
|
<div class="flex justify-center">
|
|
<flowise-fullchatbot></flowise-fullchatbot>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<!-- Professional Footer -->
|
|
<footer class="professional-navbar mt-16">
|
|
<div class="container mx-auto px-4 py-8 text-center">
|
|
<div class="text-white">
|
|
<p class="mb-2">© 2025 Romfast. Toate drepturile rezervate.</p>
|
|
<p class="text-sm opacity-80">ROA - Romfast Applications - Sisteme informatice pentru managementul afacerii</p>
|
|
</div>
|
|
</div>
|
|
</footer>
|
|
|
|
<script type="module">
|
|
import Chatbot from "https://cdn.jsdelivr.net/npm/flowise-embed/dist/web.js"
|
|
|
|
// Funcție pentru a obține parametrii din URL
|
|
function getUrlParameter(name) {
|
|
try {
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const value = urlParams.get(name);
|
|
|
|
if (value === null) {
|
|
return '';
|
|
}
|
|
|
|
return value;
|
|
} catch (error) {
|
|
console.error("Eroare cu URLSearchParams:", error);
|
|
|
|
try {
|
|
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
|
var regex = new RegExp('[\\?&]' + name + '=([^&#]*)');
|
|
var results = regex.exec(location.search);
|
|
|
|
if (results === null) {
|
|
return '';
|
|
}
|
|
|
|
let rawValue = results[1];
|
|
|
|
function safeDecodeURIComponent(str) {
|
|
str = str.replace(/\+/g, ' ');
|
|
|
|
const chunks = str.split('%');
|
|
let result = chunks[0];
|
|
|
|
for (let i = 1; i < chunks.length; i++) {
|
|
const chunk = chunks[i];
|
|
if (chunk.length >= 2) {
|
|
const hexCode = chunk.substring(0, 2);
|
|
const rest = chunk.substring(2);
|
|
|
|
if (/^[0-9A-Fa-f]{2}$/.test(hexCode)) {
|
|
try {
|
|
result += decodeURIComponent('%' + hexCode) + rest;
|
|
} catch (e) {
|
|
result += '%' + chunk;
|
|
}
|
|
} else {
|
|
result += '%' + chunk;
|
|
}
|
|
} else {
|
|
result += '%' + chunk;
|
|
}
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
const decoded = safeDecodeURIComponent(rawValue);
|
|
return decoded;
|
|
|
|
} catch (fallbackError) {
|
|
console.error("Eroare și la fallback sigur:", fallbackError);
|
|
return '';
|
|
}
|
|
}
|
|
}
|
|
|
|
// Obține mesajul inițial din parametrul URL (dacă există)
|
|
const initialMessage = getUrlParameter('message');
|
|
|
|
// Definește prompt-urile inițiale standard
|
|
const defaultStarterPrompts = [
|
|
'Cum se actualizeaza tokenul eFactura?',
|
|
'Cand se completeaza codul de plata pentru declaratia SAFT?',
|
|
'Cum se configurează o politică de prețuri? Afișeaza pașii complet',
|
|
'Care sunt pasii pentru emiterea unei facturi service auto?',
|
|
'Cum se valideaza o comanda service auto?',
|
|
'Cum se deschide o comanda service auto?',
|
|
'Cum se modifica datele initiale ale unei comenzi service auto (ex: nr. km)?'
|
|
];
|
|
|
|
// Determină dacă să afișeze prompt-urile inițiale sau nu
|
|
const starterPrompts = initialMessage ? [] : defaultStarterPrompts;
|
|
|
|
// Inițializează chatbot-ul
|
|
const chatbotInstance = Chatbot.initFull({
|
|
chatflowid: "d4911620-07fe-41f8-adb4-f2f52d6ec766",
|
|
apiHost: "https://mutual-special-koala.ngrok-free.app",
|
|
theme: {
|
|
chatWindow: {
|
|
showTitle: true,
|
|
title: 'Maria ChatBot - Romfast Suport',
|
|
titleAvatarSrc: 'https://raw.githubusercontent.com/walkxcode/dashboard-icons/main/svg/google-messages.svg',
|
|
showAgentMessages: true,
|
|
welcomeMessage: 'Bună! Eu sunt Maria, specialistul dvs. de suport tehnic Romfast. Sunt aici pentru a vă ajuta cu orice întrebări sau probleme tehnice legate de utilizarea sistemului ROA. Cum vă pot ajuta astăzi?',
|
|
errorMessage: 'Am o eroare! Revino mai tarziu',
|
|
backgroundColor: "#ffffff",
|
|
height: 700,
|
|
width: 500,
|
|
fontSize: 16,
|
|
starterPrompts: starterPrompts,
|
|
starterPromptFontSize: 15,
|
|
clearChatOnReload: true,
|
|
botMessage: {
|
|
backgroundColor: "#f7f8ff",
|
|
textColor: "#303235",
|
|
showAvatar: true,
|
|
avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/parroticon.png",
|
|
},
|
|
userMessage: {
|
|
backgroundColor: "#3B81F6",
|
|
textColor: "#ffffff",
|
|
showAvatar: true,
|
|
avatarSrc: "https://raw.githubusercontent.com/zahidkhawaja/langchain-chat-nextjs/main/public/usericon.png",
|
|
},
|
|
textInput: {
|
|
placeholder: 'Scrieți întrebarea dvs.',
|
|
backgroundColor: '#ffffff',
|
|
textColor: '#303235',
|
|
sendButtonColor: '#3B81F6',
|
|
maxChars: 2000,
|
|
maxCharsWarningMessage: 'Ați depășit limita de caractere. Vă rugăm să introduceți mai puțin de 2000 de caractere.',
|
|
autoFocus: true,
|
|
sendMessageSound: false,
|
|
receiveMessageSound: false,
|
|
},
|
|
feedback: {
|
|
color: '#303235',
|
|
},
|
|
footer: {
|
|
textColor: '#303235',
|
|
text: 'Powered by',
|
|
company: 'Romfast',
|
|
companyLink: 'https://www.romfast.ro',
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
// Enhanced professional toast function with simulation indicators
|
|
function showToast(message, type = 'success') {
|
|
const toast = document.createElement('div');
|
|
toast.className = 'toast';
|
|
toast.textContent = message;
|
|
|
|
if (type === 'error') {
|
|
toast.classList.add('error');
|
|
}
|
|
|
|
document.body.appendChild(toast);
|
|
|
|
setTimeout(() => {
|
|
toast.classList.add('show');
|
|
}, 100);
|
|
|
|
setTimeout(() => {
|
|
toast.classList.remove('show');
|
|
setTimeout(() => {
|
|
if (document.body.contains(toast)) {
|
|
document.body.removeChild(toast);
|
|
}
|
|
}, 300);
|
|
}, 3000);
|
|
}
|
|
|
|
// Professional simulation indicator
|
|
function showSimulationIndicator(message) {
|
|
const indicator = document.createElement('div');
|
|
indicator.className = 'simulation-indicator';
|
|
indicator.textContent = `⚡ ${message}`;
|
|
|
|
document.body.appendChild(indicator);
|
|
|
|
setTimeout(() => {
|
|
indicator.classList.add('show');
|
|
}, 100);
|
|
|
|
return indicator;
|
|
}
|
|
|
|
function hideSimulationIndicator(indicator) {
|
|
if (indicator && document.body.contains(indicator)) {
|
|
indicator.classList.remove('show');
|
|
setTimeout(() => {
|
|
if (document.body.contains(indicator)) {
|
|
document.body.removeChild(indicator);
|
|
}
|
|
}, 300);
|
|
}
|
|
}
|
|
|
|
// All the advanced message injection and simulation functions from the original file...
|
|
function waitForChatbotInput() {
|
|
return new Promise((resolve) => {
|
|
const selectors = [
|
|
'textarea',
|
|
'input[type="text"]',
|
|
'input',
|
|
'textarea[placeholder*="Scrieți întrebarea"]',
|
|
'textarea[placeholder*="Type your message"]',
|
|
'.text-input',
|
|
'[contenteditable="true"]',
|
|
'[class*="text-input"]',
|
|
'[class*="textarea"]',
|
|
'[class*="input"]'
|
|
];
|
|
|
|
function searchInShadowDOM() {
|
|
const chatbotElement = document.querySelector('flowise-fullchatbot');
|
|
if (chatbotElement && chatbotElement.shadowRoot) {
|
|
for (const selector of selectors) {
|
|
const elements = chatbotElement.shadowRoot.querySelectorAll(selector);
|
|
for (const element of elements) {
|
|
if (element.offsetParent !== null && !element.disabled && !element.readOnly) {
|
|
return element;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
|
|
for (const selector of selectors) {
|
|
const elements = document.querySelectorAll(selector);
|
|
for (const element of elements) {
|
|
if (element.offsetParent !== null && !element.disabled && !element.readOnly) {
|
|
resolve(element);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
const shadowElement = searchInShadowDOM();
|
|
if (shadowElement) {
|
|
resolve(shadowElement);
|
|
return;
|
|
}
|
|
|
|
const observer = new MutationObserver((mutations) => {
|
|
for (const selector of selectors) {
|
|
const elements = document.querySelectorAll(selector);
|
|
for (const element of elements) {
|
|
if (element.offsetParent !== null && !element.disabled && !element.readOnly) {
|
|
observer.disconnect();
|
|
resolve(element);
|
|
return;
|
|
}
|
|
}
|
|
}
|
|
|
|
const shadowElement = searchInShadowDOM();
|
|
if (shadowElement) {
|
|
observer.disconnect();
|
|
resolve(shadowElement);
|
|
return;
|
|
}
|
|
});
|
|
|
|
observer.observe(document.body, {
|
|
childList: true,
|
|
subtree: true
|
|
});
|
|
|
|
setTimeout(() => {
|
|
observer.disconnect();
|
|
console.error('❌ Nu s-a găsit textarea-ul chatbot-ului în 15 secunde');
|
|
resolve(null);
|
|
}, 15000);
|
|
});
|
|
}
|
|
|
|
function sleep(ms) {
|
|
return new Promise(resolve => setTimeout(resolve, ms));
|
|
}
|
|
|
|
function getKeyCode(char) {
|
|
if (char === ' ') return 'Space';
|
|
if (/[a-zA-Z]/.test(char)) return `Key${char.toUpperCase()}`;
|
|
if (/[0-9]/.test(char)) return `Digit${char}`;
|
|
if (char === '?') return 'Slash';
|
|
if (char === '.') return 'Period';
|
|
if (char === ',') return 'Comma';
|
|
return 'Key' + char.toUpperCase();
|
|
}
|
|
|
|
async function simulateRealUserInteraction(textarea, message) {
|
|
console.log('🎭 Simulez interacțiunea reală a utilizatorului...');
|
|
|
|
textarea.focus();
|
|
await sleep(100);
|
|
|
|
const rect = textarea.getBoundingClientRect();
|
|
const clickEvent = new MouseEvent('click', {
|
|
bubbles: true,
|
|
cancelable: true,
|
|
view: window,
|
|
clientX: rect.left + 20,
|
|
clientY: rect.top + rect.height / 2
|
|
});
|
|
textarea.dispatchEvent(clickEvent);
|
|
await sleep(100);
|
|
|
|
textarea.value = '';
|
|
const clearInputEvent = new InputEvent('input', {
|
|
inputType: 'deleteContentBackward',
|
|
bubbles: true,
|
|
cancelable: true
|
|
});
|
|
textarea.dispatchEvent(clearInputEvent);
|
|
await sleep(100);
|
|
|
|
for (let i = 0; i < message.length; i++) {
|
|
const char = message[i];
|
|
|
|
const keydownEvent = new KeyboardEvent('keydown', {
|
|
key: char,
|
|
code: getKeyCode(char),
|
|
keyCode: char.charCodeAt(0),
|
|
which: char.charCodeAt(0),
|
|
bubbles: true,
|
|
cancelable: true,
|
|
composed: true
|
|
});
|
|
textarea.dispatchEvent(keydownEvent);
|
|
|
|
textarea.value += char;
|
|
|
|
const inputEvent = new InputEvent('input', {
|
|
inputType: 'insertText',
|
|
data: char,
|
|
bubbles: true,
|
|
cancelable: true,
|
|
composed: true
|
|
});
|
|
textarea.dispatchEvent(inputEvent);
|
|
|
|
const keyupEvent = new KeyboardEvent('keyup', {
|
|
key: char,
|
|
code: getKeyCode(char),
|
|
keyCode: char.charCodeAt(0),
|
|
which: char.charCodeAt(0),
|
|
bubbles: true,
|
|
cancelable: true,
|
|
composed: true
|
|
});
|
|
textarea.dispatchEvent(keyupEvent);
|
|
|
|
await sleep(char === ' ' ? 40 : 60);
|
|
}
|
|
|
|
const changeEvent = new Event('change', { bubbles: true, cancelable: true });
|
|
textarea.dispatchEvent(changeEvent);
|
|
|
|
const blurEvent = new FocusEvent('blur', { bubbles: true, cancelable: true });
|
|
textarea.dispatchEvent(blurEvent);
|
|
await sleep(50);
|
|
|
|
const focusEvent = new FocusEvent('focus', { bubbles: true, cancelable: true });
|
|
textarea.dispatchEvent(focusEvent);
|
|
|
|
console.log('✅ Simularea interacțiunii s-a terminat');
|
|
}
|
|
|
|
async function sendWithEnter(textarea) {
|
|
console.log('⌨️ Încerc trimiterea cu Enter...');
|
|
|
|
textarea.focus();
|
|
await sleep(100);
|
|
|
|
const enterKeydown = new KeyboardEvent('keydown', {
|
|
key: 'Enter',
|
|
code: 'Enter',
|
|
keyCode: 13,
|
|
which: 13,
|
|
bubbles: true,
|
|
cancelable: true,
|
|
composed: true
|
|
});
|
|
|
|
textarea.dispatchEvent(enterKeydown);
|
|
await sleep(50);
|
|
|
|
console.log('✅ Enter trimis');
|
|
}
|
|
|
|
// Advanced professional message injection function
|
|
async function injectMessageIntoChat(message) {
|
|
let simulationIndicator;
|
|
try {
|
|
console.log('🚀 Începe injectarea avansată a mesajului:', message);
|
|
showToast('Se încarcă întrebarea din link...', 'success');
|
|
simulationIndicator = showSimulationIndicator('Initializing AI injection...');
|
|
|
|
await sleep(3000);
|
|
|
|
if (simulationIndicator) {
|
|
simulationIndicator.textContent = '⚡ Loading chatbot interface...';
|
|
}
|
|
|
|
if (simulationIndicator) {
|
|
simulationIndicator.textContent = '⚡ Locating chat interface...';
|
|
}
|
|
|
|
const textarea = await waitForChatbotInput();
|
|
if (!textarea) {
|
|
console.error('❌ Nu s-a găsit textarea-ul');
|
|
showToast('Nu s-a putut găsi casuta de chat.', 'error');
|
|
hideSimulationIndicator(simulationIndicator);
|
|
return;
|
|
}
|
|
|
|
console.log('✅ Textarea găsit:', textarea);
|
|
|
|
if (simulationIndicator) {
|
|
simulationIndicator.textContent = '⚡ Simulating real user typing...';
|
|
}
|
|
|
|
await simulateRealUserInteraction(textarea, message);
|
|
|
|
if (simulationIndicator) {
|
|
simulationIndicator.textContent = '⚡ Sending message...';
|
|
}
|
|
|
|
await sleep(1000);
|
|
await sendWithEnter(textarea);
|
|
|
|
if (simulationIndicator) {
|
|
simulationIndicator.textContent = '⚡ Cleaning up URL parameters...';
|
|
}
|
|
|
|
const url = new URL(window.location.href);
|
|
url.searchParams.delete('message');
|
|
window.history.replaceState({}, document.title, url.toString());
|
|
|
|
setTimeout(() => {
|
|
hideSimulationIndicator(simulationIndicator);
|
|
showToast('Mesaj injectat cu succes și trimis!', 'success');
|
|
}, 1000);
|
|
|
|
} catch (error) {
|
|
console.error('❌ Eroare:', error);
|
|
hideSimulationIndicator(simulationIndicator);
|
|
showToast('A apărut o eroare. Introduceți manual întrebarea.', 'error');
|
|
}
|
|
}
|
|
|
|
// Professional message injection with enhanced logging
|
|
if (initialMessage && initialMessage.trim() !== '') {
|
|
console.log('📨 Mesaj inițial detectat:', initialMessage);
|
|
|
|
const earlyIndicator = showSimulationIndicator('Preparing URL message injection...');
|
|
|
|
setTimeout(() => {
|
|
hideSimulationIndicator(earlyIndicator);
|
|
injectMessageIntoChat(initialMessage);
|
|
}, 5000);
|
|
}
|
|
</script>
|
|
|
|
<!-- Professional Theme JavaScript -->
|
|
<script>
|
|
// Advanced theme toggle functionality with enhanced features
|
|
document.addEventListener('DOMContentLoaded', function() {
|
|
// Initialize Lucide icons
|
|
lucide.createIcons();
|
|
|
|
// Theme toggle
|
|
const themeToggle = document.getElementById('theme-toggle');
|
|
const body = document.body;
|
|
const html = document.documentElement;
|
|
|
|
// Check for saved theme preference or default to 'light'
|
|
const currentTheme = localStorage.getItem('theme') || 'light';
|
|
|
|
if (currentTheme === 'dark') {
|
|
body.classList.add('dark-mode');
|
|
html.classList.add('dark-mode');
|
|
themeToggle.innerHTML = '<i data-lucide="moon" class="w-5 h-5"></i>';
|
|
}
|
|
|
|
themeToggle.addEventListener('click', function() {
|
|
body.classList.toggle('dark-mode');
|
|
html.classList.toggle('dark-mode');
|
|
|
|
// Update icon
|
|
if (body.classList.contains('dark-mode')) {
|
|
themeToggle.innerHTML = '<i data-lucide="moon" class="w-5 h-5"></i>';
|
|
localStorage.setItem('theme', 'dark');
|
|
} else {
|
|
themeToggle.innerHTML = '<i data-lucide="sun" class="w-5 h-5"></i>';
|
|
localStorage.setItem('theme', 'light');
|
|
}
|
|
|
|
// Reinitialize icons
|
|
lucide.createIcons();
|
|
});
|
|
|
|
// Mobile menu toggle
|
|
const mobileMenuToggle = document.getElementById('mobile-menu-toggle');
|
|
const mobileMenu = document.getElementById('mobile-menu');
|
|
const menuIcon = document.getElementById('menu-icon');
|
|
const closeIcon = document.getElementById('close-icon');
|
|
|
|
mobileMenuToggle.addEventListener('click', function() {
|
|
mobileMenu.classList.toggle('hidden');
|
|
menuIcon.classList.toggle('hidden');
|
|
closeIcon.classList.toggle('hidden');
|
|
});
|
|
|
|
// Enhanced feature detection logging
|
|
console.log('🎨 Maria ChatBot Advanced - Professional Theme Loaded');
|
|
console.log('🔧 Features: URL Injection, User Simulation, Link Generation');
|
|
console.log('⚡ Advanced UI interactions initialized');
|
|
});
|
|
</script>
|
|
</body>
|
|
</html> |