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

+DateCheckForWerbung +LSFViewFix

parent 6d91b947
Branches
No related tags found
No related merge requests found
...@@ -22,11 +22,13 @@ ...@@ -22,11 +22,13 @@
"name": "werbung", "name": "werbung",
"config": { "config": {
"files": [ "files": [
{ {
"filename": "Grillen2016_0.png" "filename": "itour2016_0.png",
"enddate": "02.11.2016"
}, },
{ {
"filename": "itour2016_0.png" "filename": "DAT_2016_Flyer_DINA6.png",
"enddate": "18.11.2016"
} }
] ]
} }
...@@ -46,4 +48,4 @@ ...@@ -46,4 +48,4 @@
] ]
} }
} }
} }
\ No newline at end of file
...@@ -2,10 +2,18 @@ var lsfViewJson = null; ...@@ -2,10 +2,18 @@ var lsfViewJson = null;
this.checkShowCondition = function() { this.checkShowCondition = function() {
var date = new Date(); var date = new Date();
var roundH = date.getHours()%2 == 1? date.getHours()+1 : date.getHours();
if(date.getHours() >= 8 && date.getHours() <= 18 && date.getHours()%2 == 1 && date.getMinutes() > 44){ if(date.getHours() >= 8 && date.getHours() <= 18 && date.getHours()%2 == 1 && date.getMinutes() > 44){
console.log("TITTEN"); for (i = 0; i < lsfViewJson.events.length; i++) {
return 120; if(lsfViewJson.events[i].StartTime.substring(0, 2) == roundH) {
console.log("LSF-View: Event Found");
return 10;
}
}
console.log("LSF-View: No Events");
return 0;
} else { } else {
console.log("LSF-View: Out Of Time");
return 0; //Skip Panel? return 0; //Skip Panel?
} }
} }
......
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
File suppressed by a .gitattributes entry or the file's encoding is unsupported.
...@@ -7,8 +7,7 @@ this.loaded=function(panel,config) { ...@@ -7,8 +7,7 @@ this.loaded=function(panel,config) {
werbung_config = config werbung_config = config
} }
this.show=function() { function setNextWerbung() {
$(werbung_panel).find("#werbung_display").attr("src", "panels/werbung/img/"+werbung_config.files[nextWerbung].filename);
if(nextWerbung+1<werbung_config.files.length) { if(nextWerbung+1<werbung_config.files.length) {
nextWerbung += 1; nextWerbung += 1;
} else { } else {
...@@ -16,6 +15,11 @@ this.show=function() { ...@@ -16,6 +15,11 @@ this.show=function() {
} }
} }
this.show=function() {
$(werbung_panel).find("#werbung_display").attr("src", "panels/werbung/img/"+werbung_config.files[nextWerbung].filename);
setNextWerbung();
}
this.resize=function() { this.resize=function() {
} }
...@@ -23,5 +27,23 @@ this.hide = function() { ...@@ -23,5 +27,23 @@ this.hide = function() {
} }
this.checkShowCondition = function() { this.checkShowCondition = function() {
return 20; var werbungOriginalNext = nextWerbung;
var enddateEl = werbung_config.files[nextWerbung].enddate.split(".");
if(Date.now() <= Date.UTC(enddateEl[2], enddateEl[1], enddateEl[0])) {
return 20;
} else {
console.log("Werbung: Skipped - Out Of Date");
setNextWerbung()
}
while(nextWerbung != werbungOriginalNext){
console.log("Werbung: IN LOOP");
enddateEl = werbung_config.files[nextWerbung].enddate.split(".");
if(Date.now() <= Date.UTC(enddateEl[2], enddateEl[1], enddateEl[0])) {
return 20;
} else {
console.log("Werbung: Skipped - Out Of Date");
setNextWerbung()
}
}
return 0;
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment