$(document).ready(function() { function s1() { var audio = new Audio('1.mp3'); audio.play(); } function s2() { var audio = new Audio('2.mp3'); audio.play(); } function s(text, timeout) { setTimeout(function() { var chatDiv = $('#chat'); var messageDiv = $('
' + text + '

'); chatDiv.append(messageDiv); chatDiv.scrollTop(chatDiv[0].scrollHeight); s1(); }, timeout); } function r(text, timeout) { setTimeout(function() { $('#typingStatus').show(); var chatDiv = $('#chat'); var messageDiv = $('
' + text + '

'); chatDiv.append(messageDiv); chatDiv.scrollTop(chatDiv[0].scrollHeight); s2(); }, timeout); } function c(id, timeout) { setTimeout(function() { $('#' + id).html(''); }, timeout); } function tampil2() { $('#typingStatus').show(); } function singit2() { $('#typingStatus').hide(); } function singit(detik) { // showTypingStatus(); // Show typing status when typing starts setTimeout(singit2, detik); // Hide typing status after 2 seconds (adjust as needed) } function tampil(detik) { // showTypingStatus(); // Show typing status when typing starts setTimeout(tampil2, detik); // Hide typing status after 2 seconds (adjust as needed) } });