$('.chat[data-chat=person2]').addClass('active-chat') $('.person[data-chat=person2]').addClass('active') $('.left .person').mousedown(function () { if ($(this).hasClass('.active')) { return false } const findChat = $(this).attr('data-chat') const personName = $(this).find('.name').text() $('.right .top .name').html(personName) $('.chat').removeClass('active-chat') $('.left .person').removeClass('active') $(this).addClass('active') $('.chat[data-chat = ' + findChat + ']').addClass('active-chat') }) function push_statment(msg) { $('.chat').append('
' + msg + '
') } function push_silent_response(msg) { $('.chat').append('
' + msg + '
') } function push_response(msg, callback) { if (msg == 'Just a second...') { $('.chat').append('
' + msg + '
') } else { speak_response(msg, callback) if (msg.toUpperCase().indexOf(' CLOUD') != -1) { $('.chat').append('
' + ' ' + msg + '
') } else if (msg.toUpperCase().indexOf(' RAIN') != -1 || msg.toUpperCase().indexOf(' DRIZZLE') != -1) { $('.chat').append('
' + ' ' + msg + '
') } else if (msg.toUpperCase().indexOf(' SUN') != -1 || msg.toUpperCase().indexOf('AND CLEAR') != -1) { $('.chat').append('
' + ' ' + msg + '
') } else if (msg.toUpperCase().indexOf(' SNOW') != -1) { $('.chat').append('
' + ' ' + msg + '
') } else if (msg.indexOf(' AM') != -1 || msg.indexOf(' PM') != -1) { $('.chat').append('
' + ' ' + msg + '
') } else { $('.chat').append('
' + msg + '
') } } } function push_yt_response(id) { $('.chat').append('
') } function push_timer_response(msg) { if (!msg) { $('.chat').append('
') } else { // $('.countdown').remove(); const old = document.getElementsByClassName('countdown')[0] old.innerHTML = msg $('.countdown').removeClass('countdown') } } function push_movie_response(id) { const old = document.getElementById('movie') if (old) { old.innerHTML = '' } $('.chat').append('
') } $('#textbox').keypress(function (e) { if (e.which == 13) { $(this).blur() log_speech($('#textbox').val()) document.getElementById('textbox').value = '' return false } })