Last active
August 23, 2020 20:34
-
-
Save w0rm49/e1c68190953dc7d877dd574d5e18fffb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ==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