]> git.sesse.net Git - ultimatescore/commitdiff
Some cleanup.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 25 Oct 2017 07:38:59 +0000 (09:38 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Wed, 25 Oct 2017 07:41:19 +0000 (09:41 +0200)
quickl3.js
score.js

index 1457c1761bbba428f0e3c5db3733761a5d001e47..3fde4499600f771376351a57a76bed2892786630 100644 (file)
@@ -67,14 +67,16 @@ function quicklowerthird()
        }
 }
 
-function loadquickl3s()
+function loadquickl3s(sheets)
 {
-       var sheet_a = state['A'];
-       var sheet_b = state['B'];
-       var sheet_c = 'Calls';
-
        var newl3s = {};
-       var num_left = 3;
+       var num_left = 1;
+
+       for (var prop in sheets) {
+               if (sheets.hasOwnProperty(prop)) {
+                       ++num_left;
+               }
+       }
 
        var cb = function(response, group_name) {
                for (var p in response) {
@@ -87,10 +89,13 @@ function loadquickl3s()
                }
        };
 
-       load_l3(sheet_a, 'A', cb);
-       load_l3(sheet_b, 'B', cb);
-       load_l3(sheet_c, 'C', cb);
+       for (var prop in sheets) {
+               if (sheets.hasOwnProperty(prop)) {
+                       load_l3(sheets[prop], prop, cb);
+               }
+       }
+       load_l3('Calls', 'C', cb);
 }
 
 // Start by loading calls only
-loadquickl3s();
+loadquickl3s({});
index 9222fa9e758a78682edd42ef8967f8e534640092..60f420e670fc73a0359b315b8c88a9c35b771d39 100644 (file)
--- a/score.js
+++ b/score.js
@@ -13,8 +13,8 @@ function setteams()
        document.getElementById('team1').innerHTML = state['team1'];
        document.getElementById('team2').innerHTML = state['team2'];
 
-       state = { 'A': state['team1'], 'B': state['team2'] };
-       loadquickl3s();
+       var sheets = { 'A': state['team1'], 'B': state['team2'] };
+       loadquickl3s(sheets);
 }
 
 function setcolors()