Author Topic: geekhack Super Ignore™ userscript - hide users even while logged out  (Read 1557 times)

0 Members and 1 Guest are viewing this topic.

Offline Coreda

  • Thread Starter
  • Posts: 776
Something simple I slapped together recently. Entirely hides posts by specified users and optionally threads/topics created by them as well both on the board index pages and the Spy page.

Just needs one to manually add users by their user ID number (seen in the URL of their username link) in the script itself.

To install and configure:

  • Install the Tampermonkey userscript manager addon (haven't tested in Greasemonkey but likely works with it too).
  • Click the addon toolbar icon and select 'Create a new script'.
  • Paste in the script embedded in this post and change or remove the ignored users seen at line 23, replacing '11111'/'22222' with the actual user ID number of the users to ignore (mine is '22672' for example). Note: always omit the comma after whatever the the last item is (or if it's the sole item), as seen in the examples.
  • (Optional) Change 'hideThreads' to 'false' if you only want to hide posts.
  • Click Tampermonkey's File>Save menu item or use Ctrl+S.

Reload a page on geekhack and bask in nothingness :p

Note: doesn't hide quoted posts. I thought about it but the way it currently hides posts entirely it might make some replies seem non-sensical/out of context. Perhaps it would work if semi-hidden in a quote to indicate/toggle an ignored post. Also would have hosted on Github but having an issue with it atm.

Userscript:

More
Code: [Select]
// ==UserScript==
// @name         geekhack.org - Super Ignore
// @namespace    Coreda
// @version      2020-04-05
// @description  Hide user posts and optionally topics on geekhack even while logged out.
// @author       Coreda
// @license      MIT
// @match        https://geekhack.org/index.php?topic=*
// @match        https://geekhack.org/index.php?PHPSESSID=*&topic=*
// @match        https://geekhack.org/index.php?board=*
// @match        https://geekhack.org/index.php?action=recenttopics*
// @grant        none
// ==/UserScript==

(function() {
    'use strict';

    var hideThreads = true;

    function qsa(sel, parent){ return Array.prototype.slice.call((parent || document).querySelectorAll(sel)); }

    var ignoredUsers = [].concat(
         qsa("a[href$='u=11111']"), // Example ID only
         qsa("a[href$='u=22222']") // Example ID only
        )

    // Marginally less pre-hide flash than using a remove function
    function hide(elem) {
        elem.style.display = "none";
        }

    ignoredUsers.forEach(function(entry) {
        // Check if page is forum post
        if (window.location.href.indexOf("topic=") > -1) {
            var parent = entry.parentNode.parentNode.parentNode.parentNode;
            if (parent.classList.contains("windowbg") || parent.classList.contains("windowbg2")) {
                hide(parent);
                }
            }
        // Check if page is topic index
        if (hideThreads == true && window.location.href.indexOf("board=") > -1) {
            var parent = entry.parentNode.parentNode.parentNode.parentNode;
            if (parent.nodeName.toLowerCase() == "tr") {
                hide(parent);
                }
            }
        // Check if page is Spy
        if (hideThreads == true && window.location.href.indexOf("action=recenttopics") > -1) {
            var parent = entry.parentNode.parentNode;
            // Checks if username is contained in last table cell (to distinguish OP vs last poster)
            if(!entry.parentNode.nextElementSibling) {
                hide(parent);
                }
            }
    });

})();
« Last Edit: Wed, 08 April 2020, 05:38:31 by Coreda »

Offline tp4tissue

  • * Destiny Supporter
  • Posts: 13568
  • Location: Official Geekhack Public Defender..
  • OmniExpert of: Rice, Top-Ramen, Ergodox, n Females
Re: geekhack Super Ignore™ userscript - hide users even while logged out
« Reply #1 on: Mon, 06 April 2020, 11:56:30 »
GH is prettty dead 99% of the time.

What would be the point of this, the post rate in general is so slow.
The only active section has been the shopping section.

LOL, if you got personal beef with Tp4,  just say it..

Offline Coreda

  • Thread Starter
  • Posts: 776
Re: geekhack Super Ignore™ userscript - hide users even while logged out
« Reply #2 on: Mon, 06 April 2020, 12:08:51 »
What would be the point of this, the post rate in general is so slow.

I only use it for one user since their non sequiturs in virtually every topic became a bit annoying. Not naming names though  :D

LOL, if you got personal beef with Tp4,  just say it..

Not at all. tp keeps non IC/GB geekhack alive  ^-^

Offline tp4tissue

  • * Destiny Supporter
  • Posts: 13568
  • Location: Official Geekhack Public Defender..
  • OmniExpert of: Rice, Top-Ramen, Ergodox, n Females
Re: geekhack Super Ignore™ userscript - hide users even while logged out
« Reply #3 on: Mon, 06 April 2020, 12:16:05 »
What would be the point of this, the post rate in general is so slow.

I only use it for one user since their non sequiturs in virtually every topic became a bit annoying. Not naming names though  :D

LOL, if you got personal beef with Tp4,  just say it..

Not at all. tp keeps non IC/GB geekhack alive  ^-^

Glad Tp4 can count on your support in the upcoming cleansing. <covid is almost sure to shake up the establishment>

Stay safe y'all

Offline Coreda

  • Thread Starter
  • Posts: 776
Re: geekhack Super Ignore™ userscript - hide users even while logged out
« Reply #4 on: Mon, 06 April 2020, 12:28:26 »
Glad Tp4 can count on your support in the upcoming cleansing.

Replaced the default examples with quasi-dummy values instead  :thumb:

Offline Coreda

  • Thread Starter
  • Posts: 776
Re: geekhack Super Ignore™ userscript - hide users even while logged out
« Reply #5 on: Mon, 06 April 2020, 12:29:01 »
Oops double post.