diff --git a/config.js b/config.js
index be415b7..4cefebd 100644
--- a/config.js
+++ b/config.js
@@ -8,17 +8,17 @@ displaySystem.config({
//modules, order determines z stacking
modules: {
'background': {
- // visible: false
+ visible: false,
color: 'black',
//optional chromakey background color
// color: "lime",
},
'camera': {
- // visible: true,
+ visible: false,
// audio: true,
},
'gallery': {
- visible: true,
+ visible: false,
transition: 'fade',
size: 'cover',
timeout: 4,
@@ -33,11 +33,11 @@ displaySystem.config({
],
},
'clock': {
- visible: true,
+ visible: false,
// countdown: 20,
},
'time': {
- visible: true,
+ visible: false,
// format: "MM:ss",
},
'twitter': {
@@ -45,7 +45,7 @@ displaySystem.config({
// speed: 500,
},
'lowThird': {
- visible: true,
+ visible: false,
line1: 'β€οΈ press \'C\'',
line2: 'to show the control window',
},
@@ -53,54 +53,71 @@ displaySystem.config({
// visible: true,
header: 'results round 1',
data: [
- ['π³π± just try',1],
- ['π³π± to copy',2],
- ['πͺπ¬ and paste',3],
- ['πͺπ¬ some cells',4],
- ['πͺπ¬ from excel',5],
- ['πΊπΈ into the control',6],
- ['πΊπΈ window! You\'ll be',7],
- ['πΊπΈ amazed!',8],
- ['π³π± It even has',8],
- ['π³π± automatic',8],
- ['π³π± paging',8],
+ ['π³π± just try', 1],
+ ['π³π± to copy', 2],
+ ['πͺπ¬ and paste', 3],
+ ['πͺπ¬ some cells', 4],
+ ['πͺπ¬ from excel', 5],
+ ['πΊπΈ into the control', 6],
+ ['πΊπΈ window! You\'ll be', 7],
+ ['πΊπΈ amazed!', 8],
+ ['π³π± It even has', 8],
+ ['π³π± automatic', 8],
+ ['π³π± paging', 8],
],
timer: 5000,
- lines: 8
+ lines: 12
},
'sprite': {
- // visible: true,
+ visible: true,
+ text: [{
+ data:'2017 Regional, Modiin'
+ }
+ ],
sprites: [{
- width: '100%',
- top: '3.5vh',
- fontSize: '8vh',
- textAlign: 'center',
- color: 'rgba(255,255,255,0.5)',
- html: 'FIRST LEGO League'
+ side: 'top',
+ id: 'FIRST',
+ alias: 'firstLegoLeague',
+ imgClass: 'firstLogo',
+ },
+ {
+ side: 'top',
+ id: 'challenge',
+ alias: 'challengeTheme',
+ imgClass: 'challengeLogo'
+
+ }, {
+ side: 'top',
+ id: 'LEGOEd',
+ alias: 'legoEducation',
+ imgClass: 'legoLogo',
+ },
+ {
+ side: 'bottom',
+ id: 'sponsor1',
+ alias: 'sponsor1',
+ imgClass: 'sponsor1Img',
+ }, {
+ side: 'bottom',
+ id: 'sponsor2',
+ alias: 'sponsor2',
+ imgClass: 'sponsor2Img',
+
}]
},
'table': {
- // visible: true,
- header: ['team name', 'number', 'score 1', 'score 2'],
+ visible: true,
+ header: ['rank', 'NO.', 'name', 'best', '1', '2', '3'],
data: [
- ['yuby',1, 100, 167],
- ['ahgf',2, 120, 198],
- ['butny',3, 10, 387],
- ['batey',4, 140, 243],
- ['meroy',5, 101, 543],
- ['marnc',6, 123, 198],
- ['arben',7, 189, 123],
- ['opic',8, 203, 431],
- ['poner',9, 403, 142],
- ['notar',10, 257, 289],
- ['serminc',11, 143, 365],
+ ['--', '--', ' ', '--', '--', '--', '--'],
+
],
timer: 10000,
lines: 8
},
'css': {
href: [
- 'themes/rednblue-plus/rednblue-plus.css',
+ 'themes/fll/flltable.css',
// 'themes/rednblue-plus/rednblue-plus-mod-rtl.css',
// 'themes/rednblue-plus/rednblue-plus-mod-opaque.css'
],
@@ -115,7 +132,7 @@ displaySystem.config({
zoom: 1,
aspect: 'native',
rotation: 0,
- overscan: [0,0,0,0]
+ overscan: [0, 0, 0, 0]
},
'keybindings': {
'q': 'time.show()',
diff --git a/css/style.css b/css/style.css
index 848127c..5f45a55 100644
--- a/css/style.css
+++ b/css/style.css
@@ -4,12 +4,18 @@ html, body {
margin: 0;
padding: 0;
}
+
+
+
/* hides screen during initialization, overridden in themes */
+
body {
visibility: hidden;
}
+
/* hides elements that are supposed to be hidden at least until theme is loaded and overrides the behavior */
+
.hidden {
visibility: hidden;
}
@@ -22,7 +28,9 @@ body {
bottom: 0;
}
+
/* control window */
+
@media screen {
body.controls {
font-family: verdana, helvetica, sans-serif;
@@ -41,8 +49,7 @@ body {
display: inline-block;
white-space: nowrap;
}
- body.controls input,
- body.controls textarea {
+ body.controls input, body.controls textarea {
width: 75px;
border: 1px solid silver;
border-right: none;
@@ -56,4 +63,4 @@ body {
body.controls button {
margin-right: 4px;
}
-}
+}
\ No newline at end of file
diff --git a/js/main.js b/js/main.js
index 49a7622..807c62c 100644
--- a/js/main.js
+++ b/js/main.js
@@ -1,5 +1,5 @@
// display system main
-var displaySystem = (function() {
+var displaySystem = (function () {
var system = {};
var config;
var modules = {};
@@ -9,12 +9,12 @@ var displaySystem = (function() {
function setConfig(_config) {
config = _config;
- setTimeout(init,0);
+ setTimeout(init, 0);
}
function prependToHead(el) {
var h = document.getElementsByTagName('head')[0];
- h.insertBefore(el,h.firstChild);
+ h.insertBefore(el, h.firstChild);
}
function appendToHead(el) {
@@ -22,14 +22,14 @@ var displaySystem = (function() {
h.appendChild(el);
}
- function loadScript(src,onload) {
+ function loadScript(src, onload) {
var el = document.createElement('script');
el.src = src;
el.onload = onload;
appendToHead(el);
}
- function loadCss(src,onLoad) {
+ function loadCss(src, onLoad) {
var el = document.createElement('link');
el.rel = 'stylesheet';
el.href = src;
@@ -43,18 +43,20 @@ var displaySystem = (function() {
function initWebsocket(config) {
var ws, host;
+ var port = config.wsHost.substr(config.wsHost.indexOf(":"), config.wsHost.length);
+ config.wsHost = config.wsHost || `http://${window.location.hostname}:${port}/` || '';
if (config.wsHost || config.wssHost) {
if (pendingConnection) {
clearTimeout(pendingConnection);
}
if (window.location.protocol === 'https:') {
- host = 'wss://'+config.wssHost;
+ host = 'wss://' + config.wssHost;
} else {
- host = 'ws://'+config.wsHost;
+ host = 'ws://' + config.wsHost;
}
ws = new WebSocket(host);
- ws.onopen = function() {
+ ws.onopen = function () {
if (config.mserverNode) {
ws.send(JSON.stringify({
type: "subscribe",
@@ -64,20 +66,20 @@ var displaySystem = (function() {
backoff = 100;
}
};
- ws.onerror = function(e){
+ ws.onerror = function (e) {
console.log("error");
ws.close();
};
- ws.onclose = function() {
- console.log("close reconnecting in",backoff,'ms');
+ ws.onclose = function () {
+ console.log("close reconnecting in", backoff, 'ms');
connected = false;
delete system.ws;
- pendingConnection = setTimeout(function() {
+ pendingConnection = setTimeout(function () {
connect();
- },backoff);
- backoff = Math.min(maxBackoff,backoff * 2);
+ }, backoff);
+ backoff = Math.min(maxBackoff, backoff * 2);
};
- ws.onmessage = function(msg) {
+ ws.onmessage = function (msg) {
var data = JSON.parse(msg.data);
if (data.topic) {
handleMessage(data);
@@ -99,7 +101,7 @@ var displaySystem = (function() {
function getArguments(f) {
var deps = f.toString().match(/^function\s*\w*\((.*?)\)/)[1];
- return deps?deps.split(/\s*,\s*/):[];
+ return deps ? deps.split(/\s*,\s*/) : [];
}
var handlers = {};
@@ -113,37 +115,37 @@ var displaySystem = (function() {
var module = modules[moduleName];
var api = module[action];
var args = getArguments(api);
- var data = args.map(function(arg) {
- return (msg.data||{})[arg];
+ var data = args.map(function (arg) {
+ return (msg.data || {})[arg];
});
- api.apply(module,data);
+ api.apply(module, data);
}
//handle individual handlers
if (handlers[topic]) {
- handlers[topic].forEach(function(handler) {
+ handlers[topic].forEach(function (handler) {
handler(msg);
});
}
}
}
- function sendMessage(def,action,data) {
+ function sendMessage(def, action, data) {
if (config.wsHost || config.wssHost) {
ws.send(JSON.stringify({
type: "publish",
node: config.mserverNode,
- topic: def.name+':'+action,
+ topic: def.name + ':' + action,
data: data
}));
}
}
- function onMessage(def,action,handler) {
+ function onMessage(def, action, handler) {
if (!def.name) {
return;
}
- var topic = (def.name+':'+action);
+ var topic = (def.name + ':' + action);
if (!handlers[topic]) {
handlers[topic] = [];
}
@@ -153,14 +155,14 @@ var displaySystem = (function() {
function init() {
// initWebsocket();
connect();
- var modulePath = config.modulePath||'modules';
+ var modulePath = config.modulePath || 'modules';
var pending = [];
- Object.keys(config.modules).forEach(function(name,i) {
- var src = modulePath+'/'+name+'.js';
+ Object.keys(config.modules).forEach(function (name, i) {
+ var src = modulePath + '/' + name + '.js';
pending[i] = {
name: name
};
- loadScript(src,function() {
+ loadScript(src, function () {
pending[i].def = lastModule;
checkLoaded(pending);
});
@@ -168,10 +170,10 @@ var displaySystem = (function() {
}
function checkLoaded(pending) {
- if (pending.every(function(module) {
+ if (pending.every(function (module) {
return module.def;
})) {
- pending.forEach(function(module) {
+ pending.forEach(function (module) {
initializeModule(module.def);
});
}
@@ -185,7 +187,7 @@ var displaySystem = (function() {
// add html
if (def.template) {
var d = document.createElement('div');
- d.className = 'moduleContainer '+def.name;
+ d.className = 'moduleContainer ' + def.name;
d.innerHTML = def.template;
document.getElementById('mainContainer').appendChild(d);
}
@@ -196,14 +198,14 @@ var displaySystem = (function() {
prependToHead(s);
}
// register api
- var m,cfg;
+ var m, cfg;
if (def.factory) {
if (def.name) {
//TODO: this is a bit of a tight coupling between names in config and module names
cfg = config.modules[def.name];
}
- m = def.factory(cfg,function(action, handler) {
- return onMessage(def,action,handler);
+ m = def.factory(cfg, function (action, handler) {
+ return onMessage(def, action, handler);
});
}
if (def.name) {
diff --git a/modules/sprite.js b/modules/sprite.js
index 4245b0a..601435a 100644
--- a/modules/sprite.js
+++ b/modules/sprite.js
@@ -8,8 +8,15 @@ displaySystem.registerModule({
position: absolute;
}
`,
- factory: function(config,onMessage) {
+ factory: function (config, onMessage) {
var sprites = [];
+ var texts = [];
+ var top = document.createElement('div');
+ var bottom = document.createElement('div');
+ getElement().appendChild(top);
+ getElement().appendChild(bottom);
+ top.setAttribute("id", "top");
+ bottom.setAttribute("id", "bottom");
function getElement() {
return document.getElementById('sprite');
@@ -40,19 +47,52 @@ displaySystem.registerModule({
function addSprite(config) {
let sprite = document.createElement('div');
sprite.className = 'sprite';
- sprite.innerHTML = config.html || '';
+ var imageServer = "http://10.100.102.13:1395/";
+ var imgSrc = imageServer.concat(config.alias);
+
+ var img = document.createElement('img');
+ img.setAttribute("src", imgSrc);
+ img.setAttribute("class", config.imgClass);
+ sprite.appendChild(img);
Object.keys(config).forEach((key) => {
- sprite.style[key] = config[key];
+
+ if (key === "id") {
+ sprite.id = config[key];
+ }
+
+ else {
+ sprite.style[key] = config[key];
+ }
+
});
- getElement().appendChild(sprite);
+ var spriteWrapper = document.getElementById(config.side);
+ spriteWrapper.appendChild(sprite);
+ getElement().appendChild(spriteWrapper);
return sprite;
}
+ function addText(config) {
+ let text = document.createElement('span');
+ text.setAttribute("id", "eventName");
+
+ text.innerHTML = config.data;
+ bottom.appendChild(text);
+ return text;
+ }
+ function setText(configText) {
+ texts.forEach(removeSprite);
+ texts = configText.map(addText);
+ }
function set(configSprites) {
sprites.forEach(removeSprite);
sprites = configSprites.map(addSprite);
}
-
+ if (config.data) {
+ sprites = config.data;
+ }
+ if (config.text) {
+ setText(config.text);
+ }
if (config.sprites) {
set(config.sprites);
}
diff --git a/modules/table.js b/modules/table.js
index ce07525..8bc91f0 100644
--- a/modules/table.js
+++ b/modules/table.js
@@ -27,7 +27,8 @@ displaySystem.registerModule({
//text-align: left;
}
*/
- factory: function(config,onMessage) {
+ factory: function (config, onMessage) {
+
var numberOfLines = 8;
var pageTimeout = 5000;
var pageTimer;
@@ -57,24 +58,24 @@ displaySystem.registerModule({
function setFromString(pasteFromExcel) {
var lines = pasteFromExcel.trim().split(/[\n\r]+/);
- var data = lines.map(function(line) {
+ var data = lines.map(function (line) {
return line.split(/\t/);
});
header = data.shift();
- set(data,header);
+ set(data, header);
}
- function setPage(data,header,page) {
- var pageData = data.slice(page*numberOfLines,(page+1)*numberOfLines);
+ function setPage(data, header, page) {
+ var pageData = data.slice(page * numberOfLines, (page + 1) * numberOfLines);
var head = '';
if (header) {
- head = ' ';
+ head = ''+header.join(' ')+' ';
}
- var html = pageData.slice(0,numberOfLines).map(function(row) {
+ var html = pageData.slice(0, numberOfLines).map(function (row) {
return [
'' + header.join(' ') + '