X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=score.js;h=22b909903fb3f5c58975cf74c8751f662c1d5697;hb=165775c5c9cde9d59b980cc100f3f5b5a8c1e436;hp=394bb558043a7efd1beeda406824ee6e799e86aa;hpb=45c38ca40bb25cbe64b23b7f5bd7fd293ea407f9;p=ultimatescore diff --git a/score.js b/score.js index 394bb55..22b9099 100644 --- a/score.js +++ b/score.js @@ -10,7 +10,7 @@ let clocks = [ let clock_visible = false; let comment_visible = false; let lowerthird_visible = false; -let clock_limit = 30 * 60; +let clock_limit = 25 * 60; let scoreA = 0; let scoreB = 0; let state = {}; @@ -87,6 +87,12 @@ function setclock(num, amount) clocks[num].elapsed = amount; clocks[num].origin = Date.now(); update_clock(num); + + // The BT-6000 likes to reset to 0:00 a while after the match is over, + // so go hide it then. + if (num == 0 && !clocks[num].running) { + hideclock(); + } } function setclockfromstate() @@ -188,6 +194,27 @@ function hidelowerthird() lowerthird_visible = false; } +function set_sound_shark_volume_db(volume_db) +{ + let img = document.getElementById('lowerthird-img'); + let should_enable = (volume_db > -40.0); + let currently_enabled = (img.style.display === 'inline' && img.src.match(/microphone\.png$/)); + + if (should_enable === currently_enabled) { + return; + } + + if (should_enable) { + img.style.display = 'inline'; + img.src = 'generic/microphone.png'; + document.getElementById('lowerthird-picture').className = 'lowerthird-picture lowerthird-picture-animate-in'; + document.getElementById('lowerthird-picture-content').className = 'lowerthird-picture-content lowerthird-picture-content-animate-in'; + } else { + document.getElementById('lowerthird-picture').className = 'lowerthird-picture lowerthird-picture-animate-out'; + document.getElementById('lowerthird-picture-content').className = 'lowerthird-picture-content lowerthird-picture-content-animate-out'; + } +} + function time_elapsed_raw(num) { let elapsed = (Date.now() - clocks[num].origin) * 1e-3;