tchen01 / monospace

display monospaced textblocks in facebook chat
MIT License
7 stars 2 forks source link

Get MutationObserver working #6

Closed jayelm closed 9 years ago

jayelm commented 9 years ago

Using a MutationObserver would allow the script to run faster, since listening for DOMNodeInserted is deprecated.

I got it to work at least partially on the MutationObserver branch, but the problem I have is that it seems to modify the the inputted code before it is fully placed into the file such that FB (or something else) modifies the code straight back.

More specifically, whenever I type a code block, the block briefly flashes on screen but then is replaced by the original text.

tchen01 commented 9 years ago

When you first enter a chat on facbook it creates a new element. After that element has been created a the entire container of chats is refreshed. The new mutation observer will have to detect this refresh and then redraw every element of the chat.

jayelm commented 9 years ago

Done