I have it working, right now it does use the
//<![CDATA[ tags and I splice the date instead of the getHours(). I also do not use toLocaleTimeString. Besides this I simplified some other stuff and took out some other function. It's almost like the epub has a timeout when stuff takes too long. But I'm happy this works and I hope this helps anyone:
Quote:
function startup() {
var dt = new Date()
var t = dt.toTimeString().slice(0, 8);
var h = t.slice(0,2);
var greeting = "Hello!";
if (h < 12){
greeting = "Good Morning!";
} else if (h< 18) {
greeting = "Good afternoon!";
} else {
greeting = "Good evening";
}
document.getElementById("greeting").textContent = greeting;
}
document.addEventListener("DOMContentLoaded", startup);
|
this shows a different greeting based on the system time of the ereader