if (display_number !== undefined && display_number !== '') {
text = " " + display_number + " " + text;
}
+ text = text.replace(/\n/, '<br />');
var subtext = response.values[i][3];
if (subtext === undefined || subtext === '') {
subtext = 'TrønDisk 2017';
"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);
};
}
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) {
}
};
- 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({});