There a way to extend 'ignore' to threads created too?
Moderator: Moderators
- OgreBattle
- King
- Posts: 6820
- Joined: Sat Sep 03, 2011 9:33 am
There a way to extend 'ignore' to threads created too?
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?
Is there a way for the ignore feature to extended so threads created by ignored people don't show up?
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.
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.
-
- King
- Posts: 5271
- Joined: Thu Apr 14, 2011 5:32 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.
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.
Code: Select all
// ==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);
}
}
}
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.
// @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!
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!
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.
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.
-
- King
- Posts: 5271
- Joined: Thu Apr 14, 2011 5:32 am
Solved, I think. Here's the new version:
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.
Code: Select all
// ==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++;
}
}
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.
You could also have reversed the order of your for loop. I.e.,
Code: Select all
...
for (var i = mslist.length; i >= 0; i--) {
...
-
- King
- Posts: 5271
- Joined: Thu Apr 14, 2011 5:32 am
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.
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.
-
- King
- Posts: 5271
- Joined: Thu Apr 14, 2011 5:32 am
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.
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.
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://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;
}
}
}
}
- OgreBattle
- King
- Posts: 6820
- Joined: Sat Sep 03, 2011 9:33 am
-
- King
- Posts: 5271
- Joined: Thu Apr 14, 2011 5:32 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.
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.
- nockermensch
- Duke
- Posts: 1898
- Joined: Fri Jan 06, 2012 1:11 pm
- Location: Rio: the Janeiro
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.
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.
- OgreBattle
- King
- Posts: 6820
- Joined: Sat Sep 03, 2011 9:33 am
- nockermensch
- Duke
- Posts: 1898
- Joined: Fri Jan 06, 2012 1:11 pm
- Location: Rio: the Janeiro
OgreBattle wrote:Does that greasemonkey plugin work on tampermonkey for chrome?
Code: Select all
// ==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);
}
@ @ 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.
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.
-
- Serious Badass
- Posts: 29894
- Joined: Fri Mar 07, 2008 7:54 pm
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.FrankTrollman wrote:There's a character limit to thread titles.TiaC wrote:So, is there any good reason not to add "silva keep out" to every thread?
-Username17
I mean, he don't have Elennsar stay out in every thread title.
The U.S. isn't a democracy and if you think it is, you are a rube.DSMatticus wrote:Kaelik gonna kaelik. Whatcha gonna do?
That's libertarians for you - anarchists who want police protection from their slaves.
- nockermensch
- Duke
- Posts: 1898
- Joined: Fri Jan 06, 2012 1:11 pm
- Location: Rio: the Janeiro
Well, there's this: http://www.tgdmb.com/viewtopic.php?t=56135Kaelik wrote: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.FrankTrollman wrote:There's a character limit to thread titles.TiaC wrote:So, is there any good reason not to add "silva keep out" to every thread?
-Username17
I mean, he don't have Elennsar stay out in every thread title.
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.
I know we aren't all in agreement, which is why I said should instead.nockermensch wrote:Well, there's this: http://www.tgdmb.com/viewtopic.php?t=56135Kaelik wrote: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.FrankTrollman wrote:
There's a character limit to thread titles.
-Username17
I mean, he don't have Elennsar stay out in every thread title.
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.
The U.S. isn't a democracy and if you think it is, you are a rube.DSMatticus wrote:Kaelik gonna kaelik. Whatcha gonna do?
That's libertarians for you - anarchists who want police protection from their slaves.
- OgreBattle
- King
- Posts: 6820
- Joined: Sat Sep 03, 2011 9:33 am
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?nockermensch wrote:OgreBattle wrote:Does that greasemonkey plugin work on tampermonkey for chrome?As it happens, I'm a chrome user too.Code: Select all
// ==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); }
- nockermensch
- Duke
- Posts: 1898
- Joined: Fri Jan 06, 2012 1:11 pm
- Location: Rio: the Janeiro
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.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?
@ @ 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.
-
- King
- Posts: 5271
- Joined: Thu Apr 14, 2011 5:32 am
Code: Select all
// @match http://www.tgdmb.com/*
Code: Select all
http://www.tgdmb.com/*
http://tgdmb.com/*
https://www.tgdmb.com/*
https://tgdmb.com/*
Erik had the same problem with my script upthread, because he is a dirty heathen.