EdddieN / machinon-domoticz_theme

GNU General Public License v3.0
46 stars 21 forks source link

Improve detected change in html code with proxy() object #129

Closed landaisbenj closed 5 years ago

landaisbenj commented 6 years ago

Need to find a better way like observer() to detect all change on html code.

We need to let flex propriety manage tile. We also need to detect all change in main-view to make another improvement.

For this, we can't use observer() who was deprecated. Maybe can be replace by proxy(). Need to see that.

EdddieN commented 6 years ago

Not sure what this is, but reads related to tile flex which works now perfect for me. Should we close?

landaisbenj commented 6 years ago

Hm. It's not an issue. But a feature maybe we could have. Just give me one monce.

landaisbenj commented 6 years ago

NTMS don't know how make proxy in place of observe. I work on this way:

const holder = $('#holder');
var observer = new MutationObserver(function(mutationsList, observer) {
        $(mutationsList).each(function(index, item){
            if (item.type === 'childList'){
                if (item.addedNodes.length > 0){

                    if ( item.addedNodes != null )  {
                       //console.log('Added ' + item.addedNodes[0].tagName + ' tag.');

                        for (var i = 0; i < item.addedNodes.length; ++i) {
                            if ((item.addedNodes[i].id === 'dashcontent') || (item.addedNodes[i].id === 'lightcontent') ) {
                                console.log(item.addedNodes[i].id)
                            }
                        }
                    }
                    /*Exemple:
                    if (item.addedNodes.length > 0){
                        console.log('new div is being added!');
                    }

                    if (item.removedNodes.length > 0){
                        console.log('div has been removed'); 
                    }
                    */
                }
            }
        });
    });
        // Start observing the target node for configured mutations
    observer.observe(holder[0], { 
        attributes: true, 
        childList: true, 
        subtree: true 
    });
EdddieN commented 5 years ago

Is this linked to this/ https://github.com/EdddieN/machinon-domoticz_theme/issues/184

landaisbenj commented 5 years ago

No. But more I search more I find observer not deprecated on mutation observer and with my test it work on mobile too. Our bug on mobile version are also as css. I'm on a way to create another engine and make custom.css in the good way on my github.

EdddieN commented 5 years ago

Ok, happy to test as many things as needed

landaisbenj commented 5 years ago

I know to detect all change in html. So i can adapt all css to make great change. But our "custom.css" is too muche bigger to me. And i need to restart him by the beggining. However, a big change are announced on the domoticz html engine with angular 7, and i asked to dev to make some change on ajax dom's inject... So whatever we what to change, this update can make a crash of all our css... So i'm a pretty blocked... I prefere wait this update: angular7, and dom inject change, and css change for search anymore.

EdddieN commented 5 years ago

Ah! Ok, so best to freeze all the issues until new update from Domoticz then, happy to do so and I’ll stop testing then

landaisbenj commented 5 years ago

not necessarily all issue but maybe new custom.css change...

DewGew commented 5 years ago

@landaisbenj @davidlb this issue fixed?

landaisbenj commented 5 years ago

We can close, because the problem isn't on observer. It's on dashboard css...