www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - User script to make your own censorship (Chrome)

reply Guillaume Piolat <first.last gmail.com> writes:
Here is an easy 5 minute tutorial to hide dlang forum posts from 
a custom-made list of users you don't want to hear about.



STEP 1

   https://imgur.com/a/jX3QizJ

   * Install the User JavaScript and CSS chrome extension.
     You can find it here => 
https://chrome.google.com/webstore/detail/user-javascript-and-css/nbhcbdghjpllgmfilhnhkllmkecfmpld


STEP 2

   https://imgur.com/a/BcG9K0G

   * Use the following user script:


---------------------------------->8---------------------------------------


var matches = document.querySelectorAll("div.post-wrapper");

var unwantedAuthors = ["DummyAuthor", "WellKnownTrollUsername"]; 
/* CHANGE ME */

matches.forEach(function(userItem) {
	
    var hidden = false;
    var names = userItem.querySelectorAll("div.post-author");
    names.forEach( function(userItem) {
    	
    	   var name = userItem.innerHTML;
    	   for(var author of unwantedAuthors)
    	   {
    	       if (name == author) { hidden = true; }
    	   }
    });
    if (hidden)
    {
    	   if (!userItem.silented)
    	   {
    	       userItem.style.visibility = "hidden";
    	       userItem.silented = true;
        }
    }
});


---------------------------------->8---------------------------------------

Replace the list of user name with authors you don't want to read 
from on the Web frontend of the dlang forums. Whole message area 
will be blanked instead.

You can now make your own information filter.
May 26 2020
parent welkam <wwwelkam gmail.com> writes:
On Tuesday, 26 May 2020 at 13:21:49 UTC, Guillaume Piolat wrote:
 [awesome stuff]
Nice but it leaves space empty. Better to use userItem.style.display = "none";
May 26 2020