From 1152e613842f2c0646eafe6caffdbdb29b2ffc62 Mon Sep 17 00:00:00 2001 From: raphael Date: Sat, 24 Oct 2020 15:31:41 +0200 Subject: [PATCH] fixes incorrect event name appearnece --- css/style.css | 8 +++++++- index.html | 2 +- js/app.js | 36 +++++++++++++++++++++++++++++------- 3 files changed, 37 insertions(+), 9 deletions(-) diff --git a/css/style.css b/css/style.css index b45dfa7..90871a3 100644 --- a/css/style.css +++ b/css/style.css @@ -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; } } \ No newline at end of file diff --git a/index.html b/index.html index 6d13c6d..a67659d 100644 --- a/index.html +++ b/index.html @@ -20,7 +20,7 @@
:
-
Hello
+
diff --git a/js/app.js b/js/app.js index c5ca379..7ba2233 100644 --- a/js/app.js +++ b/js/app.js @@ -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) {