Skip to content
Snippets Groups Projects
Commit ec121172 authored by Hotte's avatar Hotte
Browse files

TimestampMagic

parent b63d784c
Branches
No related tags found
No related merge requests found
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
}, },
{ {
"filename": "OpenSourceInfoscreen.jpg", "filename": "OpenSourceInfoscreen.jpg",
"enddate": "18.11.2016" "enddate": "18.11.2017"
} }
] ]
} }
...@@ -44,14 +44,6 @@ ...@@ -44,14 +44,6 @@
{ {
"type": "panel", "type": "panel",
"name": "ufc" "name": "ufc"
},
{
"type": "panel",
"name": "mensaPlan"
},
{
"type": "panel",
"name": "lsfView"
} }
] ]
} }
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
}, },
{ {
"filename": "OpenSourceInfoscreen.jpg", "filename": "OpenSourceInfoscreen.jpg",
"enddate": "18.11.2016" "enddate": "18.11.2017"
} }
] ]
} }
......
...@@ -5,13 +5,15 @@ var werbung_panel = null; ...@@ -5,13 +5,15 @@ var werbung_panel = null;
this.loaded=function(panel,config) { this.loaded=function(panel,config) {
werbung_panel = panel; werbung_panel = panel;
werbung_config = config werbung_config = config;
} }
function setNextWerbung() { function setNextWerbung() {
if(nextWerbung+1<werbung_config.files.length) { if(nextWerbung+1<werbung_config.files.length) {
console.log("Werbung: SETNEXT - (" + nextWerbung + " + 1)");
nextWerbung += 1; nextWerbung += 1;
} else { } else {
console.log("Werbung: SETNEXT - (0)");
nextWerbung = 0; nextWerbung = 0;
} }
} }
...@@ -27,22 +29,28 @@ this.resize=function() { ...@@ -27,22 +29,28 @@ this.resize=function() {
this.hide = function() { this.hide = function() {
} }
function getUTC() {
return Date.UTC(new Date().getFullYear(), new Date().getMonth(), new Date().getDate());
}
this.checkShowCondition = function() { this.checkShowCondition = function() {
var werbungOriginalNext = nextWerbung; var werbungOriginalNext = nextWerbung;
var enddateEl = werbung_config.files[nextWerbung].enddate.split("."); var enddateEl = werbung_config.files[nextWerbung].enddate.split(".");
if(Date.now() <= Date.UTC(enddateEl[2], enddateEl[1], enddateEl[0])) { if( getUTC() <= Date.UTC(enddateEl[2], enddateEl[1], enddateEl[0])) {
console.log("Werbung: CurrentWerbung = " + nextWerbung + " D:" + getUTC() + "D2:" + Date.UTC(enddateEl[2], enddateEl[1], enddateEl[0]));
return 20; return 20;
} else { } else {
console.log("Werbung: Skipped - Out Of Date"); console.log("Werbung: Skipped - Out Of Date - (" + nextWerbung + ")");
setNextWerbung() setNextWerbung();
} }
while(nextWerbung != werbungOriginalNext){ while(nextWerbung != werbungOriginalNext){
enddateEl = werbung_config.files[nextWerbung].enddate.split("."); enddateEl = werbung_config.files[nextWerbung].enddate.split(".");
if(Date.now() <= Date.UTC(enddateEl[2], enddateEl[1], enddateEl[0])) { if( getUTC() <= Date.UTC(enddateEl[2], enddateEl[1], enddateEl[0])) {
console.log("Werbung: CurrentWerbung = " + nextWerbung + " D:" + getUTC() + "D2:" + Date.UTC(enddateEl[2], enddateEl[1], enddateEl[0]));
return 20; return 20;
} else { } else {
console.log("Werbung: Skipped - Out Of Date"); console.log("Werbung: Skipped - Out Of Date - (" + nextWerbung + ")");
setNextWerbung() setNextWerbung();
} }
} }
return 0; return 0;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment