I want to hide the comments with some words inside by a (Tampermonkey) user script. As an example, I tried to apply a script
// ==UserScript==
// @name H
Disqus-powered comments are typically loaded in an <iframe>. So rather than set your script to run on the main site, you set it to run on the iframe src
URL. In this case, http://disqus.com/embed/comments/...
Also, these comments are AJAX driven. So you must use AJAX savvy techniques.
A script like this should work (selector might need tuning):
// ==UserScript==
// @name Hide select CNN comments
// @match http://disqus.com/embed/comments/*
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @grant GM_addStyle
// ==/UserScript==
/*- The @grant directive is needed to work around a design change
introduced in GM 1.0. It restores the sandbox.
*/
//--- Only run on comments for CNN pages
if (/&f=cnn&/i.test (location.search) ) {
waitForKeyElements ('li.post:contains("Abbas")', hideComment);
}
function hideComment (jNode) {
jNode.hide ();
}