MMM-CalendarExt3Timeline
The successor of CalendarExtTimeline, the Magicmirror module. A sibling module of MMM-CalendarExt3. This module would show the timeline of events.
The successor of CalendarExtTimeline, the Magicmirror module. A sibling module of MMM-CalendarExt3. This module would show the timeline of events.
@rsiggins
In my test, the module itself returns the right time of the target place converted to my local timezone. Anyway, there may be some special reason for your case.
Of course, the developer should look inside to know what really happened. But as a emergency cure, you can use some monkey-patching before real fixation from the developer.
{
module: "MMM-ModuleMonkeyPatch",
config: {
patches: [
{
module: "MMM-OpenmapWeather",
method: "processWeather",
patch: function (original, args) {
const [ data ] = args
const yourDesiredOffset = 5 * 60 * 60 // 5 hours
data.sys.sunrise = new Date((data.sys.sunrise + yourDesiredOffset) * 1000).valueOf()
data.sys.sunset = new Date((data.sys.sunset + yourDesiredOffset) * 1000).valueOf()
original(data)
}
},
]
}
}
start: function () {
// init your module.
// Not recommended doing your real job here. Because this method is evaluated only one time on startup before all the stuff be prepared (e.g, DOM creating)
this.timer = null
},
notificationReceived: function (notification, payload, sender) {
if (notification === 'DOM_OBJECTS_CREATED') {
// This might be the best position where your real job starts.
this.myJob()
}
},
myJob: function () {
clearTimeout(this.timer)
let rand = Math.floor( ... ) // random number to pick
let hour = (new Date()).getHours() // select hour to pick the folder
// ... Your logic for picking image by hour and rand
this.timer = setTimeout(() => {
// ... Your logic for displaying image picked.
this.myJob() // recursive execution per updateInterval.
// It would be a better habbit to use setTimeout instead of setInterval
}, this.config.updateInterval)
},
@mumblebaj
Thanks for your hard work on my behalf.
BTW, if you are not maintaining MMM-News any more, can you return the ownership to me again? I want to archive it in my control back.
@JeffreyDaro
To save the daily quota,
updateInterval
as some minutes, not seconds. It will help your quota consumption.start: function () {
this.timer = null
this.targetURL = null
this.setImageURL()
},
getDom: function () {
console.log(">", this.targetURL)
var dom = document.createElement('div')
dom.style.backgroundImage = `url(${this.targetURL})`
dom.style.height = '100vh' // I recommend to control this through CSS, but in this example, I just hardcode it.
dom.style.width = '100vw'
dom.style.backgroundSize = 'cover'
return dom
},
notificationReceived: function (notification, payload, sender) {
if (notification === 'DOM_OBJECTS_CREATED') {
this.job()
}
},
job: function () {
clearTimeout(this.timer)
this.updateDom()
this.setImageURL()
this.timer = setTimeout(() => {
this.job()
}, this.config.updateInterval)
},
setImageURL: function () {
// do your logic for picking image. Here I pick the random unsplash image instead for example.
let rand = Math.floor(Math.random() * 100000)
this.targetURL = `https://source.unsplash.com/random?seed=${rand}`
}
@bicolorbore586
Sorry, It can’t be done at this moment. In some day, I have a plan to update. I’ll consider your needs at that time.
@fozi
Once I was the original creator of this module (and many others)
For some personal reasons, I couldn’t maintain my modules anymore at that time by myself. But I didn’t want to break the maintenance of the modules for the community. So I transferred all the ownership to any volunteer who wants to take over. I believed that they could keep the module’s maintenance and develop more than me.
After one and a half years passed, I return to this scene now.
What I see is, …
Some modules are being maintained still well, some are abandoned, some are, …
Well, I will not claim my ownership back, those modules are not mine anymore from my discard. And I believe everyone has his own good mind. So I don’t care.
However, a little sorry to you for this situation though.
@bicolorbore586
Since 1.3.0
, with manipulateDateCell
callback function in configuration, you can handle date cell itself. So you can achieve what you want.
Here is a simple example; (more tweek might be needed to match with your wants wholely)
manipulateDateCell: (cell, events) => {
if (Array.isArray(events) && events.some(e => e.calendarName === 'Holidays')) {
let dateIcon = document.createElement('span')
dateIcon.classList.add('fa', 'fa-fas', 'fa-fw', 'fa-gift')
dateIcon.style.color = 'red'
dateIcon.style.fontSize = '0.9em'
let header = cell.querySelector('.cellHeader')
let celldate = header.querySelector('.cellDate')
header.insertBefore(dateIcon, celldate)
}
}
Anyway, it could be possible.