]> git.sesse.net Git - ultimatescore/blobdiff - quickl3.js
Make the borders a bit sleeker.
[ultimatescore] / quickl3.js
index fc9617357fb2dd26b65d8a8a8bbc65a5be92ae07..79cc7bf0616ddd1a398c5ae6410b524153518c41 100644 (file)
@@ -32,6 +32,10 @@ var load_l3 = function(sheet, prefix, cb)
                                "text": text,
                                "subtext": subtext
                        };
+                       var image = response.values[i][4];
+                       if (image !== undefined && image.match(/^file:/) !== null) {
+                               l3s[prefix + number].image = image;
+                       }
                }
                cb(l3s, sheet);
        };
@@ -49,21 +53,32 @@ function quicklowerthird()
        }
        document.getElementById('lowerthird-headline-content').innerHTML = code.text;
        document.getElementById('lowerthird-subheading-content').innerHTML = code.subtext;
+       var img = document.getElementById('lowerthird-img');
+       if (code.image !== undefined) {
+               img.src = code.image;
+               img.style.display = 'inline';
+       } else {
+               img.style.display = 'none';
+       }
        showlowerthird();
 
        if (state['code'].match(/^C/) === null) {
                setTimeout(function() { hidelowerthird(); }, 4000);
+       } else {
+               setTimeout(function() { hidelowerthird(); }, 6000);
        }
 }
 
-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) {
@@ -76,11 +91,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);
 }
 
-// Test
-state = { 'A': 'TFK', 'B': 'ESK' };
-loadquickl3s();
+// Start by loading calls only
+loadquickl3s({});