From 44ed963ca873fb7cda35e56ff6b11887c257ad1b Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Mon, 21 Dec 2015 12:01:57 +0100 Subject: show subtitles-silence-message after some time --- assets/js/lustige-subtitles.js | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'assets/js') diff --git a/assets/js/lustige-subtitles.js b/assets/js/lustige-subtitles.js index e8df92b..ac62879 100644 --- a/assets/js/lustige-subtitles.js +++ b/assets/js/lustige-subtitles.js @@ -96,6 +96,8 @@ function openSocket() var primus = Primus.connect(baseurl); window.primus_connection = primus; + window.silence_warning = window.setTimeout(showSilenceWarning, 10*1000); + primus.on('open', function() { primus.emit('join', room); @@ -116,10 +118,17 @@ function openSocket() if (text && text.trim().length > 0 && roomId == room) { //console.log('line', roomId, userId, text, color); appendLine(text); + window.clearTimeout(window.silence_warning); + window.silence_warning = window.setTimeout(showSilenceWarning, 60*1000); } }); } +function showSilenceWarning() +{ + appendLine('*silence*'); +} + function appendLine(line) { var -- cgit v1.2.3