User script to make your own censorship (Chrome)

Guillaume Piolat first.last at gmail.com
Tue May 26 13:21:49 UTC 2020


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.


More information about the Digitalmars-d mailing list