Read the statement by Michael Teeuw here.
Move / load div modules around
-
Hello guys, I have an issue. I want to controle the visibility and the module’s position at run time without edition the config file.
I made a module (well, I edited an existing module to fit my needs but that doesn’t matter) to do that.
Show and hide module is easy enough.
as for moving them, my methode is to get div of the module on the screen, get the div of the region I want to put it in (it’s inside container actually) then appendChild.
That’s works fine.BUT, my end goal is to have lot’s of module (more than the screen can show at one time) and control where I put them and if I need to show them or not at run time. Obviously I don’t want to have them all at screen at startup. I would like to have most of them hidden. but if I don’t set a position, the dev of the module is never created and therefor I can’t move it.
How can I do that ? How can I create the div of the module if no position was given ? (I noticed the divs have different value for the style depending on the modules, and I don’t know where to find those information so I can’t really create a generic function to create the div). if every module had the same style it would be no problem but that’s not the case
I would like to avoid editing the index.html if possible.
-
@romain Why not set some random position and hide all (other) modules on startup with the method you use at runtime? As far as I know it is possible to get a list of all modules.
MMM-ProfileSwitcher does something similar at startup (shows only modules with class “default” at start). Maybe you can look into their code to see how they do it?! Or you just use the MMM-ProfileSwitcher itself just to hide all modules at startup (quick and dirty).
-
I choose your first idea to hide all other module at startup. It worked good enough
-
Romain can you please tell me how you were able to do that?