Skip to content

Instantly share code, notes, and snippets.

@w0rm49
Last active August 23, 2020 20:34
Show Gist options
  • Select an option

  • Save w0rm49/e1c68190953dc7d877dd574d5e18fffb to your computer and use it in GitHub Desktop.

Select an option

Save w0rm49/e1c68190953dc7d877dd574d5e18fffb to your computer and use it in GitHub Desktop.
// ==UserScript==
// @name instacrap
// @namespace http://tampermonkey.net/
// @version 0.4
// @description ahh stop that bullshit
// @author w0rm49
// @match https://www.instagram.com/*
// @match http://www.instagram.com/*
// @match https://*.instagram.com/*
// @match http://*.instagram.com/*
// @updateURL https://gist.githubusercontent.com/w0rm49/e1c68190953dc7d877dd574d5e18fffb/raw/instacrap.user.js
// @downloadURL https://gist.githubusercontent.com/w0rm49/e1c68190953dc7d877dd574d5e18fffb/raw/instacrap.user.js
// ==/UserScript==
(function() {
'use strict';
const root = document.getElementById('react-root');
const uncrap = () => {
const nodes = Array.from(document.querySelectorAll('a[href^="/p/"]:not([data-cleared]'));
nodes.map(node => {
node.dataset.cleared = true;
node.addEventListener('click', e => {
e.stopImmediatePropagation();
window.location.href = node.href;
}, true)
});
const imgs = Array.from(document.querySelectorAll('img[srcset]:not([data-cleared]'));
imgs.map(node => {
node.dataset.cleared = true;
const blocker = node.parentNode.nextSibling;
if (blocker) {
blocker.parentNode.removeChild(blocker);
}
});
}
root.addEventListener('DOMNodeInserted', uncrap, false);
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment