var timeout; | |
var observer = new MutationObserver(function(mutations) { | |
mutations.forEach(function(mutation) { | |
if (mutation.addedNodes.length !== 0) hideGiphies(); | |
}); | |
}); | |
function hideGiphies() { | |
if (!document.body.classList.contains('loading')) { | |
var giphies = document.querySelectorAll('div[data-real-src*="giphy.com"]'); | |
for (var i = 0; i < giphies.length; i++) { | |
giphies[i].parentElement.parentElement.style.display = "none"; | |
} | |
var target = document.querySelector('#msgs_div'); | |
observer.observe(target, {childList: true}); | |
window.clearInterval(timeout); | |
} | |
} | |
document.addEventListener('DOMContentLoaded', function() { | |
timeout = window.setInterval(hideGiphies, 200); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment