Read the statement by Michael Teeuw here.
MMM-Page-Selector: A page switcher that can set positions of modules
-
@veldrovive That would be great - thanks a lot!!!
You could implement it as an option for the config part - maybe there are people out there that like to have a fallback to the standard page. -
Yea. I’m trying my best not to change base functionality so any sort of bells and whistles like this will have to be manually activated.
-
@Veldrovive If I got your new pages-implementation right, we define a name for a module which is later used to organize the page layout. Is that correct? Would it be possible to give multiple names to the same module (not have on module configured and shown multiple times via different names)?
It would be helpful for modules with rate-limited APIs, if different parts of one module should be shown at different locations on the same page. I would like to achieve this via a custom css which addresses your name-tag.
If this where possible, I would like to take this one step further in the future and implement a distance based layout which keeps the information most important to me readable throughout the room, when I prepare for my way to work. Changing the layout via css could be dynamic and would not involve a whole page refresh as it occurs when switching between pages.
-
Ok, I’ve implemented persistent pages. In order to access them right now, you need to be in the development branch since I don’t have the time to do extensive testing.
I’m not exactly sure what you mean when you say “not have on module configured and shown multiple times via different names”. You do not want to have the same module shown multiple times on the same page?
If the module was shown multiple times by this module, then all the instances would have the same config and I don’t see how that would help with rate-limited APIs.
Could you clarify? -
Thanks for the persistent pages. I can try them today or tomorrow.
Regarding showing one module multiple times: I do not want to put e.g. “clock” multiple times into the config.js and show it in different places on the screen.
My idea was - and I hope that I got the concept right - that if the same module (which is implemented only once in the config.js and calls the API only once) could be shown multiple times on one page. Then I could set multiple name-tags for that module and address each representation of this module separately via the name-tag in the custom.css file and show/hide/scale different parts of the module at different locations on the screen. This could be of general use for other people as well.
My next step after this would be to learn how to inject css info dynamically - e.g. to keep infos about my upcoming trains/flights, the traffic-map to the station and weather info at my destination at the same visual size as I move throughout the room. This I would like to achieve with a distance measurement via PIR or doppler-microwave-sensor.
I hope this helps to explain the idea I had.
-
The way that this system would have to work could not reduce API calls. Duplicating the module would simply send two calls instead of one. As I understand it, a large rework of how magic mirror works at a much baser level than what this module does would be necessary to change that.
It would be possible to have one module shown in different places by assigning it multiple names, but I don’t see how that would really be useful. -
OK - thank for your feedback.
Do you have any idea on how to change the css-info or the class of a module on the fly? Would this be possible through notifications?
-
I’ve worked with changing the classes of modules on the fly during my work on this module.
In order to change the class of a module or some modules:MM.getModules().withClass(/*Your module name or list of names*/).enumerate(module => { ref = document.getElementById(module.data.identifier); if(ref === null){ Log.log("Module does not exist") }else{ ref.classList.add("Your new class") // Or if you want to get rid of a class ref.classList.remove("Your old class") } })
-
@veldrovive Thank you very much!
-
Dear @Veldrovive,
sorry for not getting back to you anytime sooner. I am still struggling to get my mirror to work again. I updated MMM-Page-Selector from a version prior the changes with the second config-layout to your development branch to try out persistent pages.
Since then, my mirror is very slow and unusable. If I try the new layout, my mirror stays black. If I try the old layout for the config file, it sometimes shows an image after a long period of time - but so slow, you can see how the site is being built up.
I will need some time, hopefully this weekend, to reduce my current config to just MMM-Page-Selector and add one module after the other to see if the problem originates from MMM-Page-Selector or the combination with another module.