You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
57 lines
1.7 KiB
JavaScript
57 lines
1.7 KiB
JavaScript
(function () {
|
|
const messageInput = document.getElementById('messageInputTag');
|
|
const submitButton = document.getElementById('submitButton');
|
|
if (messageInput){
|
|
messageInput.addEventListener('input', function () {
|
|
if (messageInput.value.trim() !== "") {
|
|
submitButton.classList.remove('hidden');
|
|
} else {
|
|
submitButton.classList.add('hidden');
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
document.querySelectorAll('.reaction-button').forEach(button => {
|
|
button.addEventListener('click', function() {
|
|
const reaction = this.getAttribute('data-reaction');
|
|
const eventMessage = {
|
|
event_type: 'submit_review',
|
|
reaction: reaction
|
|
};
|
|
osichatSocket.send(JSON.stringify(eventMessage));
|
|
});
|
|
});
|
|
|
|
|
|
|
|
if (document.getElementById('sendReview')){
|
|
document.getElementById('sendReview').addEventListener('submit', function(event) {
|
|
event.preventDefault();
|
|
|
|
const details = document.getElementById('messageInputTag').value.trim();
|
|
if (details) {
|
|
const eventMessage = {
|
|
event_type: 'submit_review',
|
|
details: details
|
|
};
|
|
|
|
osichatSocket.send(JSON.stringify(eventMessage));
|
|
} else {
|
|
console.error('Details cannot be empty');
|
|
}
|
|
});
|
|
}
|
|
|
|
|
|
|
|
document.getElementById("startNewConversation").addEventListener("click", function() {
|
|
const eventMessage = {
|
|
event_type: "start_conversation"
|
|
};
|
|
osichatSocket.send(JSON.stringify(eventMessage));
|
|
});
|
|
|
|
|
|
|
|
})(); |