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

TimestampMagic

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