Last active
December 2, 2017 16:51
-
-
Save cmaher/88d01c73763592e8d246e03757894a3d to your computer and use it in GitHub Desktop.
tampermonkey script to hide clickbait related articles
This file contains 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 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