]> git.sesse.net Git - ultimatescore/blobdiff - score.js
Make the roster scripts executable.
[ultimatescore] / score.js
index bedb8299f337b8c3519377aac03750cff2797acb..ab3e465cc74f10d98b0f7db17a6a8b21a0766635 100644 (file)
--- a/score.js
+++ b/score.js
@@ -1,9 +1,10 @@
 'use strict';
 
-let num_clocks = 2;
+let num_clocks = 3;
 let clocks = [
        { 'running': false, 'elapsed': 0, 'origin': undefined, 'id': 'clock' },
-       { 'running': false, 'elapsed': 0, 'origin': undefined, 'id': 'clock2' }
+       { 'running': false, 'elapsed': 0, 'origin': undefined, 'id': 'clock2' },
+       { 'running': false, 'elapsed': 0, 'origin': undefined, 'id': 'clock3' }
 ];
 
 let clock_visible = false;
@@ -29,6 +30,12 @@ function setteams2()
        document.getElementById('score2_team2').innerHTML = state['team2'];
 }
 
+function setteams3()
+{
+       document.getElementById('score3_team1').innerHTML = state['team1'];
+       document.getElementById('score3_team2').innerHTML = state['team2'];
+}
+
 function setcolors()
 {
        document.getElementById('team1color').style.backgroundColor = state['team1color'];
@@ -49,6 +56,13 @@ function setscore2()
        document.getElementById('score2_score').innerHTML = scoreA + " – " + scoreB;
 }
 
+function setscore3()
+{
+       scoreA = state['score1'];
+       scoreB = state['score2'];
+       document.getElementById('score3_score').innerHTML = scoreA + " – " + scoreB;
+}
+
 function startclock(num)
 {
        if (!clocks[num].running) {
@@ -73,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()
@@ -174,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;