AARoads Forum

Meta => Suggestions and Questions => Topic started by: kurumi on January 24, 2017, 01:49:37 AM

Title: Customize your forum experience with Firefox and Greasemonkey
Post by: kurumi on January 24, 2017, 01:49:37 AM
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();
   }
}
----

Title: Re: Customize your forum experience with Firefox and Greasemonkey
Post by: 1995hoo on January 24, 2017, 09:42:21 PM
Hmmm.....I now have this amusing mental image of a certain user's signature praising Trump and Rick Scott.....
Title: Re: Customize your forum experience with Firefox and Greasemonkey
Post by: 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.
Title: Re: Customize your forum experience with Firefox and Greasemonkey
Post by: kurumi on January 25, 2017, 02:22:32 AM
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!
Title: Re: Customize your forum experience with Firefox and Greasemonkey
Post by: Alps on January 25, 2017, 11:45:17 PM
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.