The Gaming Den Forum Index The Gaming Den
Welcome to the Gaming Den.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Google
 Search WWW   Search tgdmb.com 
There a way to extend 'ignore' to threads created too?
Goto page 1, 2  Next
 
Post new topic   Reply to topic    The Gaming Den Forum Index -> About the Gaming Den
View previous topic :: View next topic  
Author Message
OgreBattle
Prince


Joined: 03 Sep 2011
Posts: 4777

PostPosted: Tue May 05, 2015 2:37 am    Post subject: There a way to extend 'ignore' to threads created too? Reply with quote Add User to Ignore List

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?
Back to top
View user's profile Send private message
erik
Prince


Joined: 07 Mar 2008
Posts: 4779

PostPosted: Tue May 05, 2015 4:05 am    Post subject: Reply with quote Add User to Ignore List

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.
Back to top
View user's profile Send private message
DSMatticus
Prince


Joined: 14 Apr 2011
Posts: 4788

PostPosted: Tue May 05, 2015 6:12 am    Post subject: Reply with quote Add User to Ignore List

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:

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

var mslist = document.getElementsByTagName("a");

for (var i = 0; i < mslist.length; i++) {
    var ms = mslist[i];
    if (ms.getAttribute("href") == "profile.php?mode=viewprofile&u=1768") {
      if (ms.parentNode.parentNode.getAttribute("class") == "row3") {
         var ds = ms.parentNode.parentNode.parentNode;
         ds.parentNode.removeChild(ds);
      }
    }
}


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
Back to top
View user's profile Send private message
Koumei
Serious Badass


Joined: 07 Mar 2008
Posts: 12624
Location: South Ausfailia

PostPosted: Tue May 05, 2015 9:56 am    Post subject: Reply with quote Add User to Ignore List

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.
Back to top
View user's profile Send private message
erik
Prince


Joined: 07 Mar 2008
Posts: 4779

PostPosted: Tue May 05, 2015 11:15 pm    Post subject: Reply with quote Add User to Ignore List

// @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!
Back to top
View user's profile Send private message
Dean
Duke


Joined: 12 May 2008
Posts: 1698

PostPosted: Wed May 06, 2015 12:30 am    Post subject: Reply with quote Add User to Ignore List

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.
Back to top
View user's profile Send private message
Starmaker
Duke


Joined: 07 Mar 2008
Posts: 2287
Location: Redmonton

PostPosted: Wed May 06, 2015 6:31 pm    Post subject: Reply with quote Add User to Ignore List

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.
Back to top
View user's profile Send private message Visit poster's website
DSMatticus
Prince


Joined: 14 Apr 2011
Posts: 4788

PostPosted: Wed May 06, 2015 8:16 pm    Post subject: Reply with quote Add User to Ignore List

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

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

var mslist = document.getElementsByTagName("a");

var i = 0;
while (i < mslist.length) {
    var ms = mslist[i];
   var increment = 1;
    if (ms.parentNode.parentNode.getAttribute("class") == "row3") {
      if (ms.getAttribute("href") == "profile.php?mode=viewprofile&u=1768") {
         var ds = ms.parentNode.parentNode.parentNode;
         ds.parentNode.removeChild(ds);
         increment = 0;
      }
    }
   if (increment == 1) {
      i++;
   }
}

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
Back to top
View user's profile Send private message
Pixels
Knight


Joined: 14 Jun 2010
Posts: 349

PostPosted: Wed May 06, 2015 8:47 pm    Post subject: Reply with quote Add User to Ignore List

You could also have reversed the order of your for loop. I.e.,
Code:
...
for (var i = mslist.length; i >= 0; i--) {
...
Back to top
View user's profile Send private message
DSMatticus
Prince


Joined: 14 Apr 2011
Posts: 4788

PostPosted: Wed May 06, 2015 9:33 pm    Post subject: Reply with quote Add User to Ignore List

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
Back to top
View user's profile Send private message
DSMatticus
Prince


Joined: 14 Apr 2011
Posts: 4788

PostPosted: Sat May 09, 2015 6:44 pm    Post subject: Reply with quote Add User to Ignore List

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:

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

var mslist = document.getElementsByTagName("a");

for (var i = 0; i < mslist.length; i ++) {
   var ms = mslist[i];
    if (ms.parentNode.parentNode.getAttribute("class") == "row3") {
      if (ms.getAttribute("href") == "profile.php?mode=viewprofile&u=1768") {
         var ds = ms.parentNode.parentNode.parentNode;
         var oldLength = mslist.length;
         ds.parentNode.removeChild(ds);
         var newLength = mslist.length;
         i = (i - (oldLength - newLength)) - 1;
         if (i < 0) {
            i = 0;
         }
      }
    }
}


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.
Back to top
View user's profile Send private message
OgreBattle
Prince


Joined: 03 Sep 2011
Posts: 4777

PostPosted: Tue Jun 02, 2015 6:59 am    Post subject: Reply with quote Add User to Ignore List

So does the latest thing DSMatticus posted work?
Back to top
View user's profile Send private message
DSMatticus
Prince


Joined: 14 Apr 2011
Posts: 4788

PostPosted: Tue Jun 02, 2015 8:49 am    Post subject: Reply with quote Add User to Ignore List

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
Back to top
View user's profile Send private message
nockermensch
Duke


Joined: 06 Jan 2012
Posts: 1548
Location: Rio: the Janeiro

PostPosted: Mon Jun 08, 2015 8:24 pm    Post subject: Reply with quote Add User to Ignore List

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.
_________________
@ @ Nockermensch

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


Last edited by nockermensch on Mon Jun 08, 2015 8:26 pm; edited 1 time in total
Back to top
View user's profile Send private message
OgreBattle
Prince


Joined: 03 Sep 2011
Posts: 4777

PostPosted: Fri Jun 12, 2015 7:46 am    Post subject: Reply with quote Add User to Ignore List

Does that greasemonkey plugin work on tampermonkey for chrome?
Back to top
View user's profile Send private message
nockermensch
Duke


Joined: 06 Jan 2012
Posts: 1548
Location: Rio: the Janeiro

PostPosted: Fri Jun 12, 2015 3:27 pm    Post subject: Reply with quote Add User to Ignore List

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


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

var authors = document.querySelectorAll('.row3');
var silvaThreads = [];
for(var i = 0; i<authors.length; i++) {
    var author = authors[i];
    if(author.firstChild.firstChild.href.indexOf("profile.php?mode=viewprofile&u=1768") > 0) {
        silvaThreads.push(author);
    }
}
while(silvaThreads.length > 0) {
    var silvaThread = silvaThreads.pop();
    silvaThread.parentNode.parentNode.removeChild(silvaThread.parentNode);
}

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.
Back to top
View user's profile Send private message
Krusk
Knight


Joined: 16 Oct 2010
Posts: 487

PostPosted: Mon Jul 06, 2015 2:12 am    Post subject: Reply with quote Add User to Ignore List

I love that this thread is a thing
Back to top
View user's profile Send private message
TiaC
Knight-Baron


Joined: 20 Jun 2013
Posts: 900

PostPosted: Sat Jul 11, 2015 10:03 pm    Post subject: Reply with quote Add User to Ignore List

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.
Back to top
View user's profile Send private message
FrankTrollman
Serious Badass


Joined: 07 Mar 2008
Posts: 26687

PostPosted: Sat Jul 11, 2015 10:15 pm    Post subject: Reply with quote Add User to Ignore List

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.

-Frank
Back to top
View user's profile Send private message
Kaelik
ArchDemon of Rage


Joined: 07 Mar 2008
Posts: 11868

PostPosted: Sat Jul 11, 2015 10:28 pm    Post subject: Reply with quote Add User to Ignore List

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.

-Frank


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?
That's libertarians for you - anarchists who want police protection from their slaves.
Click here to see the hidden message (It might contain spoilers)
Back to top
View user's profile Send private message AIM Address
nockermensch
Duke


Joined: 06 Jan 2012
Posts: 1548
Location: Rio: the Janeiro

PostPosted: Mon Jul 13, 2015 6:53 pm    Post subject: Reply with quote Add User to Ignore List

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.

-Frank


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.
Back to top
View user's profile Send private message
Kaelik
ArchDemon of Rage


Joined: 07 Mar 2008
Posts: 11868

PostPosted: Mon Jul 13, 2015 9:33 pm    Post subject: Reply with quote Add User to Ignore List

nockermensch wrote:
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.

-Frank


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?
That's libertarians for you - anarchists who want police protection from their slaves.
Click here to see the hidden message (It might contain spoilers)
Back to top
View user's profile Send private message AIM Address
OgreBattle
Prince


Joined: 03 Sep 2011
Posts: 4777

PostPosted: Mon Jul 20, 2015 5:27 am    Post subject: Reply with quote Add User to Ignore List

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


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

var authors = document.querySelectorAll('.row3');
var silvaThreads = [];
for(var i = 0; i<authors.length; i++) {
    var author = authors[i];
    if(author.firstChild.firstChild.href.indexOf("profile.php?mode=viewprofile&u=1768") > 0) {
        silvaThreads.push(author);
    }
}
while(silvaThreads.length > 0) {
    var silvaThread = silvaThreads.pop();
    silvaThread.parentNode.parentNode.removeChild(silvaThread.parentNode);
}

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?
Back to top
View user's profile Send private message
nockermensch
Duke


Joined: 06 Jan 2012
Posts: 1548
Location: Rio: the Janeiro

PostPosted: Wed Jul 22, 2015 7:31 pm    Post subject: Reply with quote Add User to Ignore List

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.
Back to top
View user's profile Send private message
DSMatticus
Prince


Joined: 14 Apr 2011
Posts: 4788

PostPosted: Wed Jul 22, 2015 7:54 pm    Post subject: Reply with quote Add User to Ignore List

Code:
// @match        http://www.tgdmb.com/*

For FireFox's greasemonkey, each of the following four items is a separate address:
Code:
http://www.tgdmb.com/*
http://tgdmb.com/*
https://www.tgdmb.com/*
https://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.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    The Gaming Den Forum Index -> About the Gaming Den All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum




Powered by phpBB © 2001, 2005 phpBB Group