Nikšić

25 to 36 out of 62 properties

Loading...
  • sr
    • en
(function () { const chatContainer = document.createElement('div'); chatContainer.style.position = 'fixed'; chatContainer.style.bottom = '20px'; chatContainer.style.right = '20px'; chatContainer.style.width = '300px'; chatContainer.style.height = '400px'; chatContainer.style.background = '#fff'; chatContainer.style.border = '1px solid #ccc'; chatContainer.style.borderRadius = '10px'; chatContainer.style.boxShadow = '0 4px 8px rgba(0,0,0,0.2)'; chatContainer.style.zIndex = '9999'; chatContainer.style.display = 'flex'; chatContainer.style.flexDirection = 'column'; chatContainer.style.overflow = 'hidden'; chatContainer.innerHTML = `
Pitaj nas 👋
`; document.body.appendChild(chatContainer);const chatLog = document.getElementById('chat-log'); const chatInput = document.getElementById('chat-input');chatInput.addEventListener('keydown', async function (e) { if (e.key === 'Enter') { const message = chatInput.value.trim(); if (!message) return;chatLog.innerHTML += `
Ti: ${message}
`; chatInput.value = '';const response = await fetch('/wp-content/uploads/chatbot/chatbot.php', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message }), });const data = await response.json(); const reply = data.choices?.[0]?.message?.content || 'Greška u odgovoru.'; chatLog.innerHTML += `
Bot: ${reply}
`; chatLog.scrollTop = chatLog.scrollHeight; } }); })();