Skip to content

Instantly share code, notes, and snippets.

@willh
Created August 31, 2015 18:03
Show Gist options
  • Save willh/8e995a638deffd2b70b4 to your computer and use it in GitHub Desktop.
Save willh/8e995a638deffd2b70b4 to your computer and use it in GitHub Desktop.
Clean up Guardian articles to remove inane clickbait
Step 1: Select and copy the following javascript (triple click on the line for easy selecting)
javascript: (function() { var elems = document.getElementsByTagName('p'); for (var i in elems) { if (typeof(elems[i]) != 'object') continue; if((' ' + elems[i].className + ' ').indexOf(' ' + 'byline' + ' ') >= 0) { var byline = elems[i]; if (byline.innerHTML.indexOf('Jonathan Jones') != -1) { byline.parentNode.parentNode.style.display = 'none'; } } }})();
Step 2: Right click on your bookmark bar and click on 'Add Page'
Step 3: Enter 'Guardian Cleanup' in Name and paste the javascript from step 1 as the url
Step 4: Click Save to create bookmarklet
Step 5: Demo by navigating to sample page http://www.theguardian.com/artanddesign/jonathanjonesblog/2015/aug/31/terry-pratchett-is-not-a-literary-genius and clicking 'Guardian Cleanup' in your bookmark bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment