FilmCoder / Slormuxify

Hey man, what's up? => Hizorz, bb, what's ploxin? - Chrome extension to Slormuxify all text in your browser, on the fly. Grand aspirations of Slormux: giggles and world peace.
0 stars 0 forks source link

Chrome Extension: Content Loaded Dynamically Is Not Translated #1

Closed FilmCoder closed 5 years ago

FilmCoder commented 5 years ago

We need all content to be translated as it appears. For example, when scrolling down facebook, we need new posts that are loaded async to be translated as well. This will make translator MUCH more useful, all sorts of websites besides facebook dynamically load content.

These are new DOM nodes dynamically created. Let's try using MutationObserver, useful links here: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver https://developer.mozilla.org/en-US/docs/Web/API/MutationRecord

FilmCoder commented 5 years ago

OK, so it shouldn't be TOO complicated assuming every change that is added to the DOM is called by the mutation observer. Then it's just processing each node and slormuxifying it. Like here: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver

But say for example a parent DOM node gets added to the DOM, and it has a bunch of children that have children and so forth. If that parent node is the only one called by the mutation observer, then we would need to traverse that tree recursively and slormuxify all text nodes as we traverse.

FilmCoder commented 5 years ago

This could potentially cause an issue where as the user is typing text what they type is being slormuxified on the fly. We don't want that, it would be annoying. But I think we should just kill this issue and see what happens.

FilmCoder commented 5 years ago

Note: If this turns out to be more difficult than anticipated it, it's not core functionality. I'm ready to get this app on the chrome store and onto discord. Don't spend more than an hour on this.