Skip to content

Instantly share code, notes, and snippets.

@emersonveenstra
Created October 8, 2018 23:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emersonveenstra/87687ec904b3219dd6b712febee1ade6 to your computer and use it in GitHub Desktop.
Save emersonveenstra/87687ec904b3219dd6b712febee1ade6 to your computer and use it in GitHub Desktop.
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