Customize your forum experience with Firefox and Greasemonkey

Started by kurumi, January 24, 2017, 01:49:37 AM

Previous topic - Next topic

kurumi

First off, thanks to all the mods who are doing a great job IMO. But if the increased number of inflammatory political posts is bothering you (and it's not just here; it's everywhere), then you can, in a way, mute or modify what you see. It's sort of like AdBlock or the killfiles of ancient (1990s) internet.

* use firefox (apparently there's also a way in Chrome)
* get the GreaseMonkey add-on
* restart firefox
* in the "monkey" menu in the toolbar, select "new user script"
* namespace: http://www.aaroads.com
* include: https://www.aaroads.com/forum/*
* edit the script at the bottom of this post (between the dashed lines) and paste it in

This will modify the way the pages appear for only you and only this browser.

The script takes care of two things:
1. posters you still want to see, but would like to change what they say in their sig. In the example script below, you can change a guy who hates Texas and the Cowboys (and loves to let everyone know) into a more polite fan of both.
2. posters who you'd like to mute. The script removes both their threads (in the forum listing) and their posts (within a thread).

For the sig edits, change the "el.innerHTML.replace" statements below. You can add more of them in each loop.

To mute, just edit or add their usernames to the "peopleToHide" list

-----
// ==UserScript==
// @name        Hello
// @namespace   http://www.aaroads.com
// @description testing
// @include     https://www.aaroads.com/forum/*
// @version     1
// @grant       none
// ==/UserScript==

// left side sig
var els = document.getElementsByTagName("li");
for(var i = 0, l = els.length; i < l; i++) {
  var el = els;
  el.innerHTML = el.innerHTML.replace(/Cowboys suck/gi, 'I love the Cowboys');
}

// bottom sig
var els = document.getElementsByTagName("div");
for(var i = 0, l = els.length; i < l; i++) {
  var el = els;
  el.innerHTML = el.innerHTML.replace(/Texas is dumb/gi, 'Texas is a beautiful state');
}

var peopleToHide = ["annoyinguser1", "annoyinguser2"];

for (var j = 0; j < peopleToHide.length; j++) {
  var xpath = "//a[contains(@title,'View the profile of " + peopleToHide[j] + "')]/../../../../div[contains(@class, 'clearfix')]";
   var comments = document.evaluate(xpath,
     document,
     null,
     XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
     null);

   for (var i = 0; i < comments.snapshotLength; i++) {
      comments.snapshotItem(i).remove();
   }
 
  xpath = "//div[@id='messageindex']/table/tbody/tr[td/a[contains(@title,'View the profile of " + peopleToHide[j] + "')]]";
   var posts = document.evaluate(xpath,
     document,
     null,
     XPathResult.UNORDERED_NODE_SNAPSHOT_TYPE,
     null);

   for (var i = 0; i < posts.snapshotLength; i++) {
      posts.snapshotItem(i).remove();
   }
}
----

My first SF/horror short story collection is available: "Young Man, Open Your Winter Eye"


1995hoo

Hmmm.....I now have this amusing mental image of a certain user's signature praising Trump and Rick Scott.....
"You know, you never have a guaranteed spot until you have a spot guaranteed."
—Olaf Kolzig, as quoted in the Washington Times on March 28, 2003,
commenting on the Capitals clinching a playoff spot.

"That sounded stupid, didn't it?"
—Kolzig, to the same reporter a few seconds later.

DaBigE

Seems like a lot of work for items that can be adjusted in your profile settings (Ignore List and Don't Show Users' Signatures). Granted, the forum settings option won't replace undesirable messages with rosey ones.
"We gotta find this road, it's like Bob's road!" - Rabbit, Twister

kurumi

Quote from: DaBigE on January 24, 2017, 11:17:19 PM
Seems like a lot of work for items that can be adjusted in your profile settings (Ignore List and Don't Show Users' Signatures). Granted, the forum settings option won't replace undesirable messages with rosey ones.

I didn't know about the ignore list feature. You're right, that is a lot of work that isn't needed. Thanks!
My first SF/horror short story collection is available: "Young Man, Open Your Winter Eye"

Alps

Quote from: DaBigE on January 24, 2017, 11:17:19 PM
Seems like a lot of work for items that can be adjusted in your profile settings (Ignore List and Don't Show Users' Signatures). Granted, the forum settings option won't replace undesirable messages with rosey ones.
The "ignore" list just hides the post. You still know they posted, and sometimes open it anyway if it's in an interesting thread. Your solution completely removes people. It's valuable knowledge.



Opinions expressed here on belong solely to the poster and do not represent or reflect the opinions or beliefs of AARoads, its creators and/or associates.