fixes incorrect event name appearnece

This commit is contained in:
Raphael Maenle 2020-10-24 15:31:41 +02:00
parent a462151406
commit 1152e61384
3 changed files with 37 additions and 9 deletions

View File

@ -124,10 +124,16 @@ position: absolute;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
font-size: 200%;
font-size: 175%;
color: white;
text-align: center;
z-index: 2;
line-height: 100%;
overflow: hidden;
text-overflow: ellipsis;
display: -webkit-box;
-webkit-line-clamp: 2; /* number of lines to show */
-webkit-box-orient: vertical;
}
}

View File

@ -20,7 +20,7 @@
<div id="str-console">:</div>
<div id="str-minutes"></div>
</div>
<div id="str-event">Hello</div>
<div id="str-event"></div>
</div>
<div id="container">

View File

@ -584,6 +584,7 @@ var flagDigital = true;
wait_time = LONG_WAIT;
var wroteEvent = false;
for(var event in events.events){
var startedBeforeToday = false;
@ -647,10 +648,17 @@ var flagDigital = true;
}
if(eventNow(e, hour, minute)) {
drawEventName(e);
console.log("!!!writing name");
wroteEvent = true;
drawEventName(e.name);
}
}
if(!wroteEvent) {
drawEventName("");
}
if(DESIGN === 0) {
} else if(DESIGN === 1) {
var inner = document.body.clientWidth / 2 - thickness;
@ -668,18 +676,32 @@ var flagDigital = true;
}
function eventNow(event, hour, minute) {
if( event.startDateTime.time.hour <= hour &&
event.startDateTime.time.minute <= minute &&
event.stopDateTime.time.hour >= hour &&
event.stopDateTime.time.minute >= minute) {
if( ((event.startDateTime.time.hour < hour) ||
(event.startDateTime.time.hour <= hour &&
event.startDateTime.time.minute <= minute)) ) {
console.log("start before");
}
if( ((event.stopDateTime.time.hour > hour) ||
(event.stopDateTime.time.hour >= hour &&
event.stopDateTime.time.minute >= minute)) ) {
console.log("stop after");
}
if( ((event.startDateTime.time.hour < hour) ||
(event.startDateTime.time.hour <= hour &&
event.startDateTime.time.minute <= minute)) &&
((event.stopDateTime.time.hour > hour) ||
(event.stopDateTime.time.hour >= hour &&
event.stopDateTime.time.minute >= minute)) ){
return true;
}
return false;
}
function drawEventName(event) {
function drawEventName(name) {
var strEvent = document.getElementById("str-event");
strEvent.innerHTML = event.name;
strEvent.innerHTML = name;
}
function drawDigitalWatch(datetime) {