Userscript: hide the {Course Forum} topics in this forum -- please improve on it if you know how

I changed this script: Forums > Course ideas: Different colours of the words - Memrise

I have no idea what I’m doing and the original script writer also doesn’t seem to know what they’re doing. Could anyone that has some idea about how this works comment if the userscript seems a bit off?

The page seems to take a bit longer to load with it enabled.

Install with Greasemonkey on Firefox or Tampermonkey on Chrome.

// ==UserScript== 
// @name Hide [Course Forum] topic on community.memrise 
// @namespace http://use.i.E.your.homepage/ 
// @version 0.1 
// @description enter something useful 
// @match http://community.memrise.com/*
// @copyright 2012+, You 
// ==/UserScript==

setInterval(function(){ 

$("tr.ember-view:contains('[Course Forum]')").css("opacity","0.1");

},500);

And a userstyle to show the topics again on mouse over. It also gives topics that you mouse over a light blue background. Install with Stylish:

@-moz-document url(http://community.memrise.com/latest) {

tr.ember-view{transition: all 0.5s ease;}
tr.ember-view:hover {opacity: 1 !important; background-color: rgba(176,226,255,0.4);}

}

Result:

That script looks okay to me. You might want to change your selector in the first part to be

`tr.ember-view .main-link:contains('[Course Forum]')"`

which should make it so that it just looks inside the thread’s title for the test “[Course Forum]”, instead of also searching the description, poster names, etc.

You also might want to change

setInterval(function(){ 

$("tr.ember-view:contains('[Course Forum]')").css("opacity","0.1");

},500);

to be

$(function() {
    $("tr.ember-view .main-link:contains('[Course Forum]')").css("opacity","0.1");
})

At the moment, the script is waiting 0.5 seconds and then changing the opacity of the course forum topics. With the change, it should change the opacity as soon as the page’s content is finished loading.

However, please note that this is untested. Please let me know if it works :slight_smile:

Thanks :slight_smile:

Including .main-link results in only the thread title being hidden, not also the description, poster names, etc. So, that’s not what I want.

So I just tried:

$(function() {
    $("tr.ember-view:contains('[Course Forum]')").css("opacity","0.1");
    });

It seems to work, some of the time, on the top of the page, but it doesn’t affect the titles that auto-load below the spinning icon after you scroll down. Perhaps they did know what they were doing.

Oh, right.

I suppose you could do

`tr.ember-view .main-link:contains('[Course Forum]').parent('tr')[0].css("opacity","0.1");`

but that’s probably overkill, and might actually be slower :slight_smile:

You’re right; this function only runs once, as soon as the page is finished loading, so it wouldn’t hide the ones that are loaded later.

The other code that you posted is running the hiding function every 500 milliseconds (so twice a second). This isn’t ideal, but if you want to do things the “proper” way, you’d have to do a lot more work, because you’d have to track down the function that’s loading the posts and write code to modify it.

Indeed, it looks like the person that wrote the original code did perhaps know what they were doing :slight_smile:

If you want, you could increase the interval to 1000 or 2000 milliseconds, which would probably delay the hiding of the topics but would also perhaps eat less battery power, etc.

1 Like

Thanks, I’ve changed that now to 10000 milliseconds, which is still fine.

Cool :slight_smile: