Skip to content

Instantly share code, notes, and snippets.

@maury91
Last active February 10, 2019 02:05
Show Gist options
  • Save maury91/a549e72de82c4bfef41b537d93bf8e9c to your computer and use it in GitHub Desktop.
Save maury91/a549e72de82c4bfef41b537d93bf8e9c to your computer and use it in GitHub Desktop.
const domInsertionObserver = new MutationObserver(function(mutationsList){
const addedPosts = [...mutationsList]
.filter(mutation => mutation.type === 'childList' && mutation.addedNodes.length)
.flatMap(mutation => [...mutation.addedNodes])
.filter(addedNode => typeof addedNode.id === 'string' && addedNode.id.startsWith('u_fetchstream'))
});
domInsertionObserver.observe(document.querySelector('div[id^=feed_stream]'), { childList: true, subtree: true });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment