changecoin / changetip-browser-extension

Browser extension for changetip
https://www.changetip.com
MIT License
0 stars 2 forks source link

detecting comments loaded via "load more comments" doesn't work with RES enabled #7

Open honestbleeps opened 10 years ago

honestbleeps commented 10 years ago

This is a dicey one...

Apparently, having MutationObservers active from two separate scripts is not possible - enabling/disabling RES breaks/unbreaks this functionality, and all sorts of monkeying around with it seems to reveal that having a mutationobserver on a single page element is only possible once, period, even from separate scripts.

For some time now I've wanted to add more event dispatching from RES to other scripts (we already fire a "neverEndingLoad" event to help external scripts know when RES loads a new page via never ending reddit), so it seems the changetip extension will need to detect the presence of RES, and use MutationObservers if it's not there, but listen for soon-to-exist RES events otherwise...

TechNickAI commented 10 years ago

Welp, I'm glad you are the one working on the extension. :)

honestbleeps commented 10 years ago

just to add to the notes: sadly, you can't pass reference to a DOM element via a custom event or via window.postMessage, so this is getting even trickier to solve. I'll figure something out for it, though.