# The Gaming Den

Welcome to the Gaming Den.

Skip to content

## There a way to extend 'ignore' to threads created too?

Practice posts and questions about the boards. The registration code for this board is 'Th3G@m|ngD3n' (Note the use of numbers and symbols!)

Moderator: Moderators

Post Reply

- Print view

26 posts

- 1
- 2
- Next

OgreBattle
  King
  Posts: 6819
  Joined: Sat Sep 03, 2011 9:33 am

### There a way to extend 'ignore' to threads created too?

- Quote

Post by OgreBattle » Tue May 05, 2015 2:37 am

So ignore is a fine and dandy feature of the Den, but while I can ignore posts made by people set to ignore, any new threads they create still show up.
Is there a way for the ignore feature to extended so threads created by ignored people don't show up?
Top

erik
  King
  Posts: 5847
  Joined: Fri Mar 07, 2008 7:54 pm

###

- Quote

Post by erik » Tue May 05, 2015 4:05 am

I've been looking into scripts that we can use via Greasemonkey plugin, but so far the scripts for flagging threads to be ignored (either by selecting threads, or automatically based upon a scripted ignore list) have been for other versions of vb software not applicable to our forum (or that I've yet to learn how to adapt to our forum). My search continues.
When I get time I'll teach myself how to write one up for the den but I'm traveling next weekend and have a fairly packed summer schedule already, so can't even offer a tentative estimate on completion date.
Top

DSMatticus
  King
  Posts: 5271
  Joined: Thu Apr 14, 2011 5:32 am

###

- Quote

Post by DSMatticus » Tue May 05, 2015 6:12 am

This has been a requested feature before, and hey, I don't think I've done any javascript since... I was a freshman in college. So here's a greasemonkey plugin that AFAIK does that. EDIT: And by that, I mean hides any thread started by silva specifically. Sorry, forgot to mention that.

Code: Select all

    // ==UserScript==
    // @name        Ignore Silva Threads
    // @namespace   http&#58;//www.tgdmb.com/profile.php?mode=viewprofile&u=1278
    // @version     1.0
    // @grant		none
    // @include     http&#58;//www.tgdmb.com/*
    // ==/UserScript==

    var mslist = document.getElementsByTagName&#40;"a"&#41;;

    for &#40;var i = 0; i < mslist.length; i++&#41; &#123;
        var ms = mslist&#91;i&#93;;
        if &#40;ms.getAttribute&#40;"href"&#41; == "profile.php?mode=viewprofile&u=1768"&#41; &#123;
    		if &#40;ms.parentNode.parentNode.getAttribute&#40;"class"&#41; == "row3"&#41; &#123;
    			var ds = ms.parentNode.parentNode.parentNode;
    			ds.parentNode.removeChild&#40;ds&#41;;
    		&#125;
        &#125;
    &#125;

If you have greasemonkey, you can just click "new user script" or whatever and copy paste this over top of it. The usual disclaimers apply - I take no responsibility for your computer exploding/your house catching fire/your spouse leaving you/your bank account being mysteriously emptied/global warming. All of those things are clearly your fault. Feel free to provide bug reports or feature requests or whatever.
EDIT: Repasted just to make sure I didn't copy-paste from an out-of-date window by accident.
Last edited by DSMatticus on Tue May 05, 2015 6:18 am, edited 2 times in total.
Top

Koumei
  Serious Badass
  Posts: 13796
  Joined: Fri Mar 07, 2008 7:54 pm
  Location: South Ausfailia

###

- Quote

Post by Koumei » Tue May 05, 2015 9:56 am

> DSMatticus wrote:And by that, I mean hides any thread started by silva specifically.

I assure you it does everything it needs to do.

> Count Arioch the 28th wrote:There is NOTHING better than lesbians. Lesbians make everything better.

Top

erik
  King
  Posts: 5847
  Joined: Fri Mar 07, 2008 7:54 pm

###

- Quote

Post by erik » Tue May 05, 2015 11:15 pm

// @include http://tgdmb.com/*
I had to take out the "www." to get it to work (actually I just added it under preferences, but you know what I mean), but now it's workin' baby.
Thanks, DSM!
Top

Dean
  Duke
  Posts: 2059
  Joined: Mon May 12, 2008 3:14 am

###

- Quote

Post by Dean » Wed May 06, 2015 12:30 am

I consider this a bold new achievement for mankind

> DSMatticus wrote:Fuck you, fuck you, fuck you, fuck you. I am filled with an unfathomable hatred.

Top

Starmaker
  Duke
  Posts: 2402
  Joined: Fri Mar 07, 2008 7:54 pm
  Location: Redmonton
  Contact:
  Contact Starmaker
  Website

###

- Quote

Post by Starmaker » Wed May 06, 2015 6:31 pm

I don't want to look thankless, but here's a bug report:
When the two most recent silva threads on a page are consecutive, the top of the two doesn't get ignored.
Experimental data:
Currently, there are two pairs of silva threads on the first page of IMHO, plus an assortment of loose threads (preceded and followed by nonsilva posters).
All the loose threads get ignored.
The second pair (down the page) gets ignored in full.
However, out of the first pair, comprising two most recent silva threads, the top thread is still displayed.
The same thing happens on the second page of IMHO: the most recent silva threads happen to be consecutive, and the first is still displayed. The second of the pair and all the loose threads vanish just fine.
There wasn't enough silva for an advanced falsification experiment (incredible, right?), so I found a page with a pair of consecutive threads by another poster which had a more recent loose thread by the same poster and changed the script to ignore them instead. It worked: the most recent loose thread, the pair down the page, and other loose threads vanished.
Top

DSMatticus
  King
  Posts: 5271
  Joined: Thu Apr 14, 2011 5:32 am

###

- Quote

Post by DSMatticus » Wed May 06, 2015 8:16 pm

Solved, I think. Here's the new version:

Code: Select all

    // ==UserScript==
    // @name        Ignore Silva Threads
    // @namespace   http&#58;//www.tgdmb.com/profile.php?mode=viewprofile&u=1278
    // @version     1.02
    // @grant		none
    // @include     http&#58;//www.tgdmb.com/*
    // ==/UserScript==

    var mslist = document.getElementsByTagName&#40;"a"&#41;;

    var i = 0;
    while &#40;i < mslist.length&#41; &#123;
        var ms = mslist&#91;i&#93;;
    	var increment = 1;
        if &#40;ms.parentNode.parentNode.getAttribute&#40;"class"&#41; == "row3"&#41; &#123;
    		if &#40;ms.getAttribute&#40;"href"&#41; == "profile.php?mode=viewprofile&u=1768"&#41; &#123;
    			var ds = ms.parentNode.parentNode.parentNode;
    			ds.parentNode.removeChild&#40;ds&#41;;
    			increment = 0;
    		&#125;
        &#125;
    	if &#40;increment == 1&#41; &#123;
    		i++;
    	&#125;
    &#125;

Explanation for funsies: this script works by looping over every hyperlink on the page, and checking each to see if it is 1) the author field of the table, and 2) a hyperlink to silva's user profile. If so, it's a thread by silva and should be removed. The problem is that the list I was looping over was not the static derivative of the html source I thought it was. It was actually a live reflection of the html source. Removing elements from the html changed the position of every element after that on the list, which threw off the loop count and caused me to skip whatever was after a removed thread. Two silva threads back to back? The second hides in the shadow of the first. The whole story is slightly more complicated than that, because each table entry is actually multiple hyperlinks, but whatever.
The proper fix would have been to use a proper iterator, but I am too lazy to even google whether or not javascript provides iterators (am I being too mean to javascript here?). Instead I just switched to a while loop and increment only on not-removal, so if we remove something at position 3 we'll check position 3 again to see what new element "fell" into the slot. No more shadow.
Last edited by DSMatticus on Wed May 06, 2015 8:21 pm, edited 1 time in total.
Top

Pixels
  Knight
  Posts: 430
  Joined: Mon Jun 14, 2010 9:06 pm

###

- Quote

Post by Pixels » Wed May 06, 2015 8:47 pm

You could also have reversed the order of your for loop. I.e.,

Code: Select all

    ...
    for &#40;var i = mslist.length; i >= 0; i--&#41; &#123;
    ...

Top

DSMatticus
  King
  Posts: 5271
  Joined: Thu Apr 14, 2011 5:32 am

###

- Quote

Post by DSMatticus » Wed May 06, 2015 9:33 pm

That's not completely safe in this instance. The loop runs on hyperlinks, but removes table entries. Table entries are composed of multiple hyperlinks, at least one of which (the thread title) comes before the author field. If the loop is at position i and decides to remove a table entry, it will (bare minimum, I haven't looked at the html source too closely) remove the list element at i (safe), i+1 (safe), and i-1 (dangerous).
You might consider decrementing by more than one, but I'm not sure the number of hyperlinks in each table entry is fixed (consider the hyperlinks to individual pages), and even if they were that would require aligning your loop with the table itself (there are a bunch of hyperlinks before and after the table) so you didn't end up decrement hopping between, say, the thread title instead of the author field.
Last edited by DSMatticus on Wed May 06, 2015 9:33 pm, edited 1 time in total.
Top

DSMatticus
  King
  Posts: 5271
  Joined: Thu Apr 14, 2011 5:32 am

###

- Quote

Post by DSMatticus » Sat May 09, 2015 6:44 pm

I'm being dumb. Not incrementing on removal doesn't work for the same exact reasons I described above. If we find silva as an author at position i, we can (but won't always) remove enough elements from the list that the "next" author ends up at a position behind i. It's the same goddamn problem I just pointed out. Derp.
So while my last fix reduced the amount of skippage considerably, silva's latest thread has shown me that it still doesn't always work.

Code: Select all

    // ==UserScript==
    // @name        Ignore Silva Threads
    // @namespace   http&#58;//www.tgdmb.com/profile.php?mode=viewprofile&u=1278
    // @version     1.03
    // @grant		none
    // @include     http&#58;//www.tgdmb.com/*
    // ==/UserScript==

    var mslist = document.getElementsByTagName&#40;"a"&#41;;

    for &#40;var i = 0; i < mslist.length; i ++&#41; &#123;
    	var ms = mslist&#91;i&#93;;
        if &#40;ms.parentNode.parentNode.getAttribute&#40;"class"&#41; == "row3"&#41; &#123;
    		if &#40;ms.getAttribute&#40;"href"&#41; == "profile.php?mode=viewprofile&u=1768"&#41; &#123;
    			var ds = ms.parentNode.parentNode.parentNode;
    			var oldLength = mslist.length;
    			ds.parentNode.removeChild&#40;ds&#41;;
    			var newLength = mslist.length;
    			i = &#40;i - &#40;oldLength - newLength&#41;&#41; - 1;
    			if &#40;i < 0&#41; &#123;
    				i = 0;
    			&#125;
    		&#125;
        &#125;
    &#125;

I think this version does it. It counts how many elements were removed and moves i back by that many steps. If that puts i below 0 (which is theoretically possible; the number of list elements isn't contrained by i because a table entry can contain some unknown number of list elements in front of i) it gets set to 0 instead.
Top

OgreBattle
  King
  Posts: 6819
  Joined: Sat Sep 03, 2011 9:33 am

###

- Quote

Post by OgreBattle » Tue Jun 02, 2015 6:59 am

So does the latest thing DSMatticus posted work?
Top

DSMatticus
  King
  Posts: 5271
  Joined: Thu Apr 14, 2011 5:32 am

###

- Quote

Post by DSMatticus » Tue Jun 02, 2015 8:49 am

I've been using it since I posted it and I haven't seen any bugs. The problems with the earlier versions weren't particularly complicated or crippling; the documentation I was using didn't feel like mentioning that getElementsByTagName returned a live list, which would have been really nice to know. My first attempt to account for that had a simple counting error, in that it needed to count things and it didn't.
If you're the sort of dirty heathen who types addresses into the address bar without the www (like erik), you might need to configure the script in greasemonkey to also include "http://tgdmb.com". Greasemonkey > manage user scripts > options on the script you want. If you browse tgdmb using https (... does that even do anything? Does tgdmb even support that?), you'll have to do something similar.
Last edited by DSMatticus on Tue Jun 02, 2015 8:50 am, edited 1 time in total.
Top

nockermensch
  Duke
  Posts: 1896
  Joined: Fri Jan 06, 2012 1:11 pm
  Location: Rio: the Janeiro

###

- Quote

Post by nockermensch » Mon Jun 08, 2015 8:24 pm

DSM, another strategy that works in this situation is to do the loop twice.
For the first pass you just mark all the elements you want to delete (add the class "delete-me" to them, for example).
For the second pass your code can be just:
var silvaThreads = document.getElementsByClassName("delete-me");
while(silvaThreads.length > 0) {
var silvaThread = silvaThreads.pop();
silvaThread.parentNode.removeChild(silvaThread);
}
The resulting code is much cleaner to read and you don't have to worry about skipping threads.
Last edited by nockermensch on Mon Jun 08, 2015 8:26 pm, edited 1 time in total.
@ @ Nockermensch

> Koumei wrote:After all, in Firefox you keep tabs in your browser, but in SovietPutin's Russia, browser keeps tabs on you.

> Mord wrote:Chromatic Wolves are massively under-CRed. Its "Dood to stone" spell-like is a TPK waiting to happen if you run into it before anyone in the party has Dance of Sack or Shield of Farts.

Top

OgreBattle
  King
  Posts: 6819
  Joined: Sat Sep 03, 2011 9:33 am

###

- Quote

Post by OgreBattle » Fri Jun 12, 2015 7:46 am

Does that greasemonkey plugin work on tampermonkey for chrome?
Top

nockermensch
  Duke
  Posts: 1896
  Joined: Fri Jan 06, 2012 1:11 pm
  Location: Rio: the Janeiro

###

- Quote

Post by nockermensch » Fri Jun 12, 2015 3:27 pm

> OgreBattle wrote:Does that greasemonkey plugin work on tampermonkey for chrome?

Code: Select all

    // ==UserScript==
    // @name         unsilvator
    // @namespace    http&#58;//your.homepage/
    // @version      0.1
    // @description  based on DSM's great idea
    // @author       nockermensch
    // @match        http&#58;//www.tgdmb.com/*
    // @grant        none
    // ==/UserScript==

    var authors = document.querySelectorAll&#40;'.row3'&#41;;
    var silvaThreads = &#91;&#93;;
    for&#40;var i = 0; i<authors.length; i++&#41; &#123;
        var author = authors&#91;i&#93;;
        if&#40;author.firstChild.firstChild.href.indexOf&#40;"profile.php?mode=viewprofile&u=1768"&#41; > 0&#41; &#123;
            silvaThreads.push&#40;author&#41;;
        &#125;
    &#125;
    while&#40;silvaThreads.length > 0&#41; &#123;
        var silvaThread = silvaThreads.pop&#40;&#41;;
        silvaThread.parentNode.parentNode.removeChild&#40;silvaThread.parentNode&#41;;
    &#125;

As it happens, I'm a chrome user too.
@ @ Nockermensch

> Koumei wrote:After all, in Firefox you keep tabs in your browser, but in SovietPutin's Russia, browser keeps tabs on you.

> Mord wrote:Chromatic Wolves are massively under-CRed. Its "Dood to stone" spell-like is a TPK waiting to happen if you run into it before anyone in the party has Dance of Sack or Shield of Farts.

Top

Krusk
  Knight-Baron
  Posts: 601
  Joined: Sat Oct 16, 2010 3:56 pm

###

- Quote

Post by Krusk » Mon Jul 06, 2015 2:12 am

I love that this thread is a thing
Top

TiaC
  Knight-Baron
  Posts: 968
  Joined: Thu Jun 20, 2013 7:09 am

###

- Quote

Post by TiaC » Sat Jul 11, 2015 10:03 pm

So, is there any good reason not to add "silva keep out" to every thread?

> virgil wrote:Lovecraft didn't later add a love triangle between Dagon, Chtulhu, & the Colour-Out-of-Space; only to have it broken up through cyber-bullying by the King in Yellow.

> FrankTrollman wrote:If your enemy is fucking Gravity, are you helping or hindering it by putting things on high shelves? I don't fucking know! That's not even a thing. Your enemy can't be Gravity, because that's stupid.

Top

Username17
  Serious Badass
  Posts: 29894
  Joined: Fri Mar 07, 2008 7:54 pm

###

- Quote

Post by Username17 » Sat Jul 11, 2015 10:15 pm

> TiaC wrote:So, is there any good reason not to add "silva keep out" to every thread?

There's a character limit to thread titles.
-Username17
Top

Kaelik
  ArchDemon of Rage
  Posts: 14491
  Joined: Fri Mar 07, 2008 7:54 pm

###

- Quote

Post by Kaelik » Sat Jul 11, 2015 10:28 pm

> FrankTrollman wrote:

> > TiaC wrote:So, is there any good reason not to add "silva keep out" to every thread?

> There's a character limit to thread titles.
> -Username17

Also, if we were all in such agreement (as we fucking should be) then we should just ban him. If everyone is ignoring all silva threads and asking silva to stay out of their threads, then instead of having newbies painfully learn the terror of silva over and over, and having his name everywhere on the sight, we could just ban him.
I mean, he don't have Elennsar stay out in every thread title.

> DSMatticus wrote:Kaelik gonna kaelik. Whatcha gonna do?

The U.S. isn't a democracy and if you think it is, you are a rube.
That's libertarians for you - anarchists who want police protection from their slaves.
Top

nockermensch
  Duke
  Posts: 1896
  Joined: Fri Jan 06, 2012 1:11 pm
  Location: Rio: the Janeiro

###

- Quote

Post by nockermensch » Mon Jul 13, 2015 6:53 pm

> Kaelik wrote:

> > FrankTrollman wrote:

> > > TiaC wrote:So, is there any good reason not to add "silva keep out" to every thread?

> > There's a character limit to thread titles.
> > -Username17

> Also, if we were all in such agreement (as we fucking should be) then we should just ban him. If everyone is ignoring all silva threads and asking silva to stay out of their threads, then instead of having newbies painfully learn the terror of silva over and over, and having his name everywhere on the sight, we could just ban him.
> I mean, he don't have Elennsar stay out in every thread title.

Well, there's this: http://www.tgdmb.com/viewtopic.php?t=56135
I don't want to keep bringing your attentions to my avatar picture, but it's fucking >2015 and people here keep talking to the troll.
@ @ Nockermensch

> Koumei wrote:After all, in Firefox you keep tabs in your browser, but in SovietPutin's Russia, browser keeps tabs on you.

> Mord wrote:Chromatic Wolves are massively under-CRed. Its "Dood to stone" spell-like is a TPK waiting to happen if you run into it before anyone in the party has Dance of Sack or Shield of Farts.

Top

Kaelik
  ArchDemon of Rage
  Posts: 14491
  Joined: Fri Mar 07, 2008 7:54 pm

###

- Quote

Post by Kaelik » Mon Jul 13, 2015 9:33 pm

> nockermensch wrote:

> > Kaelik wrote:

> > > FrankTrollman wrote:
> > > There's a character limit to thread titles.
> > > -Username17

> > Also, if we were all in such agreement (as we fucking should be) then we should just ban him. If everyone is ignoring all silva threads and asking silva to stay out of their threads, then instead of having newbies painfully learn the terror of silva over and over, and having his name everywhere on the sight, we could just ban him.
> > I mean, he don't have Elennsar stay out in every thread title.

> Well, there's this: http://www.tgdmb.com/viewtopic.php?t=56135
> I don't want to keep bringing your attentions to my avatar picture, but it's fucking >2015 and people here keep talking to the troll.

I know we aren't all in agreement, which is why I said should instead.

> DSMatticus wrote:Kaelik gonna kaelik. Whatcha gonna do?

The U.S. isn't a democracy and if you think it is, you are a rube.
That's libertarians for you - anarchists who want police protection from their slaves.
Top

OgreBattle
  King
  Posts: 6819
  Joined: Sat Sep 03, 2011 9:33 am

###

- Quote

Post by OgreBattle » Mon Jul 20, 2015 5:27 am

> nockermensch wrote:

> > OgreBattle wrote:Does that greasemonkey plugin work on tampermonkey for chrome?

> Code: Select all

>     // ==UserScript==
>     // @name         unsilvator
>     // @namespace    http&#58;//your.homepage/
>     // @version      0.1
>     // @description  based on DSM's great idea
>     // @author       nockermensch
>     // @match        http&#58;//www.tgdmb.com/*
>     // @grant        none
>     // ==/UserScript==

>     var authors = document.querySelectorAll&#40;'.row3'&#41;;
>     var silvaThreads = &#91;&#93;;
>     for&#40;var i = 0; i<authors.length; i++&#41; &#123;
>         var author = authors&#91;i&#93;;
>         if&#40;author.firstChild.firstChild.href.indexOf&#40;"profile.php?mode=viewprofile&u=1768"&#41; > 0&#41; &#123;
>             silvaThreads.push&#40;author&#41;;
>         &#125;
>     &#125;
>     while&#40;silvaThreads.length > 0&#41; &#123;
>         var silvaThread = silvaThreads.pop&#40;&#41;;
>         silvaThread.parentNode.parentNode.removeChild&#40;silvaThread.parentNode&#41;;
>     &#125;

> As it happens, I'm a chrome user too.

I've copy/pasted that into TamperMonkey's "Add New Script" option, hit "save", and it doesn't seem to work. Am I missing a step?
Top

nockermensch
  Duke
  Posts: 1896
  Joined: Fri Jan 06, 2012 1:11 pm
  Location: Rio: the Janeiro

###

- Quote

Post by nockermensch » Wed Jul 22, 2015 7:31 pm

> OgreBattle wrote: I've copy/pasted that into TamperMonkey's "Add New Script" option, hit "save", and it doesn't seem to work. Am I missing a step?

With the script installed, do you see a "1" or "2" next to the tampermonkey icon when you browse The Gaming Den? If you do, it means the script is working. I just tested it on a fresh tampermonkey install, and it works.
@ @ Nockermensch

> Koumei wrote:After all, in Firefox you keep tabs in your browser, but in SovietPutin's Russia, browser keeps tabs on you.

> Mord wrote:Chromatic Wolves are massively under-CRed. Its "Dood to stone" spell-like is a TPK waiting to happen if you run into it before anyone in the party has Dance of Sack or Shield of Farts.

Top

DSMatticus
  King
  Posts: 5271
  Joined: Thu Apr 14, 2011 5:32 am

###

- Quote

Post by DSMatticus » Wed Jul 22, 2015 7:54 pm

Code: Select all

    // @match        http&#58;//www.tgdmb.com/*

For FireFox's greasemonkey, each of the following four items is a separate address:

Code: Select all

    http&#58;//www.tgdmb.com/*
    http&#58;//tgdmb.com/*
    https&#58;//www.tgdmb.com/*
    https&#58;//tgdmb.com/*

I assume Chrome's TamperMonkey works the same way. If that is the problem, you can either adjust the script (or plugin settings) to match the way you access TGD or change the way you access TGD to match the script.
Erik had the same problem with my script upthread, because he is a dirty heathen.
Top
Post Reply

- Print view

Display:
Sort by:
Direction:

26 posts

- 1
- 2
- Next

Return to “About the Gaming Den”

Jump to

- Main
- ↳ About the Gaming Den
- ↳ In My Humble Opinion...
- ↳ I Gave the Mouse a Cookie...
- ↳ In The Trenches
- ↳ It's My Own Invention...
- ↳ MPSIMS