Skip to content

Instantly share code, notes, and snippets.

@cmaher
Last active December 2, 2017 16:51
Show Gist options
  • Save cmaher/88d01c73763592e8d246e03757894a3d to your computer and use it in GitHub Desktop.
Save cmaher/88d01c73763592e8d246e03757894a3d to your computer and use it in GitHub Desktop.
tampermonkey script to hide clickbait related articles
// ==UserScript==
// @name kill-clickbait
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Remove clickbait related articles
// @author cmaher
// @match *://*/*
// @grant none
// ==/UserScript==
(function() {
'use strict';
function hideSelector(selector) {
document.querySelectorAll(selector).forEach(function (n) {
n.remove();
});
}
function remove() {
let selectors = [
'.OUTBRAIN',
'#taboola-below-article-thumbnails',
'#taboola-below-comments-thumbnails',
'.trc_related_container',
'.article-revcontent-wrapper',
];
selectors.forEach(hideSelector);
}
function delayedRemove(millis) {
return new Promise((resolve) => {
window.setTimeout(() => {
remove();
resolve();
}, millis);
});
}
delayedRemove(1000)
.then(() => delayedRemove(2000))
.then(() => delayedRemove(3000))
.then(() => delayedRemove(5000))
.then(() => delayedRemove(10000));
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment