Posted April 16, 2015

HypersomniacLive
The Reluctant Voter
Registered: Sep 2011
From Vatican City

flubbucket
"Intoning"
Registered: Dec 2012
From Micronesia
Posted April 17, 2015

It's on but no preview window (which was all I really used it for.)


My head still needs some rest, but I've been going to the neurologist for years and they've found nothing =D

adaliabooks
"Vell, Zaphod's just zis guy, you know?"
Registered: Jun 2013
From United Kingdom
Posted April 17, 2015
Testing shows the latest script is duplicating all the posts after each use.. (so the second time it does it twice, third time three times etc.)
Not sure why, will look into it and hopefully fix it.
Edit: And fixed. Problem with divs and class names, sorted now. Please use this script instead:
Edit2: As pointed out by Hyper, I forgot to mention that when you put page numbers in the boxes, for the whole thread the start page should be 0 not 1.
var $filterbar = $( '<div><p style="display: inline;">Username: </p><input type="text" value="" id="username_box" style="display: inline; margin-right: 10px;"><p style="display: inline;">First Page: </p><input type="text" value="" id="startpage_box" style="display: inline; margin-right: 10px;"><p style="display: inline;">End Page: </p><input type="text" value="" id="endpage_box" style="display: inline; margin-right: 10px;"><a id="filter_go" style="display: inline;">Go</a></div>' );
$( ".nav_bar_bottom" ).prepend($filterbar);
$( "#filter_go" ).on("click", function () {
jQuery('.spot_h').remove()
var endpage = parseInt($("#endpage_box").val());
var startpage = parseInt($("#startpage_box").val());
for (var i = endpage; i > startpage; i--)
{
var threadURL = "/forum/general/gog_forum_mafia_27_gameshow_showdown_the_game/page" + i + " .spot_h"
if (!$(".page" + i + "posts").length)
{
var $newdiv = $( "<div class='page" + i + "posts'/>" )
}
$( ".list_h" ).prepend($newdiv)
$( ".page" + i + "posts").load(threadURL, function() {
$( ".b_u_name" )
.contents()
.filter(function() {
return this.nodeType === 3;
})
.wrap( "<a></a>" )
.end()
jQuery('.b_u_name a:not(:contains(' + $("#username_box").val() + '))').parents('.spot_h').remove();
})
}
});
Not sure why, will look into it and hopefully fix it.
Edit: And fixed. Problem with divs and class names, sorted now. Please use this script instead:
Edit2: As pointed out by Hyper, I forgot to mention that when you put page numbers in the boxes, for the whole thread the start page should be 0 not 1.
var $filterbar = $( '<div><p style="display: inline;">Username: </p><input type="text" value="" id="username_box" style="display: inline; margin-right: 10px;"><p style="display: inline;">First Page: </p><input type="text" value="" id="startpage_box" style="display: inline; margin-right: 10px;"><p style="display: inline;">End Page: </p><input type="text" value="" id="endpage_box" style="display: inline; margin-right: 10px;"><a id="filter_go" style="display: inline;">Go</a></div>' );
$( ".nav_bar_bottom" ).prepend($filterbar);
$( "#filter_go" ).on("click", function () {
jQuery('.spot_h').remove()
var endpage = parseInt($("#endpage_box").val());
var startpage = parseInt($("#startpage_box").val());
for (var i = endpage; i > startpage; i--)
{
var threadURL = "/forum/general/gog_forum_mafia_27_gameshow_showdown_the_game/page" + i + " .spot_h"
if (!$(".page" + i + "posts").length)
{
var $newdiv = $( "<div class='page" + i + "posts'/>" )
}
$( ".list_h" ).prepend($newdiv)
$( ".page" + i + "posts").load(threadURL, function() {
$( ".b_u_name" )
.contents()
.filter(function() {
return this.nodeType === 3;
})
.wrap( "<a></a>" )
.end()
jQuery('.b_u_name a:not(:contains(' + $("#username_box").val() + '))').parents('.spot_h').remove();
})
}
});
Post edited April 17, 2015 by adaliabooks

HypersomniacLive
The Reluctant Voter
Registered: Sep 2011
From Vatican City
Posted April 17, 2015

Not sure why, will look into it and hopefully fix it.
Edit: And fixed. Problem with divs and class names, sorted now. Please use this script instead:
[...]

HypersomniacLive
The Reluctant Voter
Registered: Sep 2011
From Vatican City
Posted April 17, 2015

Not sure why, will look into it and hopefully fix it.
Edit: And fixed. Problem with divs and class names, sorted now. Please use this script instead:
[...]
The old one, where you had to run it for each player does not do this.
Have you notice this or something similar happening on Chrome?

adaliabooks
"Vell, Zaphod's just zis guy, you know?"
Registered: Jun 2013
From United Kingdom
Posted April 17, 2015

Not sure why, will look into it and hopefully fix it.
Edit: And fixed. Problem with divs and class names, sorted now. Please use this script instead:
[...]

The old one, where you had to run it for each player does not do this.
Have you notice this or something similar happening on Chrome?
Actually, thinking about it... are you putting 0 in for start page or 1?
It seems to be working fine for me, but I'm not sure I mentioned that the start page should be 0, it's obvious to me because I do stuff with programming and I know indices start with 0 but it may not be obvious to everyone.
I can change it if it's not intuitive to everyone...
Post edited April 17, 2015 by adaliabooks

HypersomniacLive
The Reluctant Voter
Registered: Sep 2011
From Vatican City
Posted April 17, 2015

Actually, thinking about it... are you putting 0 in for start page or 1?
It seems to be working fine for me, but I'm not sure I mentioned that the start page should be 0, it's obvious to me because I do stuff with programming and I know indices start with 0 but it may not be obvious to everyone.
I can change it if it's not intuitive to everyone...
Thanks for checking it out though. And perhaps make this point clear, just to be on the safe side.

adaliabooks
"Vell, Zaphod's just zis guy, you know?"
Registered: Jun 2013
From United Kingdom
Posted April 17, 2015

Thanks for checking it out though. And perhaps make this point clear, just to be on the safe side.
There shouldn't really be any problem that I can see, but if it does it again let me know :)
I'll put a note in the original post to say that.

HypersomniacLive
The Reluctant Voter
Registered: Sep 2011
From Vatican City
Posted April 17, 2015

There shouldn't really be any problem that I can see, but if it does it again let me know :)
I'll put a note in the original post to say that.
When I used the first version, all posts of a selected player showed, when I used the second version, the very first post was missing, and I only noticed it because I remembered seeing them earlier. So, it's possible that when I was on the first version I put 0 in the field, but may have switched to 1 when I was on the second version, I just can't remember what I did.
Hope I made more sense this time.
Good thing we're not having this sort of exchange in the mafia game thread, would get us in quite a bit of trouble. ;-P

adaliabooks
"Vell, Zaphod's just zis guy, you know?"
Registered: Jun 2013
From United Kingdom
Posted April 17, 2015

When I used the first version, all posts of a selected player showed, when I used the second version, the very first post was missing, and I only noticed it because I remembered seeing them earlier. So, it's possible that when I was on the first version I put 0 in the field, but may have switched to 1 when I was on the second version, I just can't remember what I did.
Hope I made more sense this time.
Good thing we're not having this sort of exchange in the mafia game thread, would get us in quite a bit of trouble. ;-P
Edit: And I'm not sure which is more difficult, finding liars or finding bugs, especially when you're just cobbling stuff together with little or no knowledge of what you're actually doing... XD (and that goes for both mafia and coding!)
Post edited April 17, 2015 by adaliabooks

HypersomniacLive
The Reluctant Voter
Registered: Sep 2011
From Vatican City
Posted April 18, 2015

Edit: And I'm not sure which is more difficult, finding liars or finding bugs, especially when you're just cobbling stuff together with little or no knowledge of what you're actually doing... XD (and that goes for both mafia and coding!)

adaliabooks
"Vell, Zaphod's just zis guy, you know?"
Registered: Jun 2013
From United Kingdom

adaliabooks
"Vell, Zaphod's just zis guy, you know?"
Registered: Jun 2013
From United Kingdom
Posted April 26, 2015

Anyway, the script is here: https://gist.github.com/adaliabooks/c72b36bc3d85aa5764a3
I think that's all you need....
It seems to be working for me, let me know if you have any problems with it.

JMich
A Horrible Human Person. If you need me, chat.
Registered: Apr 2011
From Greece
Posted April 26, 2015

adaliabooks
"Vell, Zaphod's just zis guy, you know?"
Registered: Jun 2013
From United Kingdom
Posted April 26, 2015

You can just PM me any bugs for now so as not to completely hijack this thread.