Skip to content

Instantly share code, notes, and snippets.

@sampotts
Created September 23, 2016 06:59
Show Gist options
  • Save sampotts/acbfd3dcfcbfc252dacb6768ffe46a0c to your computer and use it in GitHub Desktop.
Save sampotts/acbfd3dcfcbfc252dacb6768ffe46a0c to your computer and use it in GitHub Desktop.
;(function() {
if (!('MutationObserver' in window)) {
return;
}
var observer = new MutationObserver(function(mutations) {  
    console.log('mutation: ' + mutations.length);
    for(var m = 0; m < mutations.length; ++m) {
        for(var n = 0; n < mutations[m].addedNodes.length; ++n) {
            findEmbed(mutations[m].addedNodes[n]);
        }
    }
});
function findEmbed(node){
    var $embed = $(node).find('[data-selz-b]');
    if($embed.length > 0){
        eval($embed.text());
        window._$elz = _$elz;
    }
}
observer.observe(document.getElementById("content"), {
    childList: true
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment