inherit
136163
0
May 9, 2024 7:30:40 GMT -8
ǻñî§ђ™
597
January 2009
anish
|
Post by ǻñî§ђ™ on Aug 29, 2011 12:17:11 GMT -8
I hope this is the right board. Anyway I'm making a posting page code and I need to get the board and thread id from the URL and store it in a variable, but I don't know how to do it. This is what I have:
var boardid = location.href.match(/board=RegExp.$1/i); var threadid = location.href.match(/thread=RegExp.$1/i);
I fail at regular expressions and I don't know how to get the board and thread id out of the url. I'm pretty sure it has something to do with regular expression, but I might be wrong.
|
|
inherit
134992
0
May 26, 2012 2:38:57 GMT -8
SubDevo
Creator of LSD...
3,861
December 2008
subdevo
|
Post by SubDevo on Aug 29, 2011 13:36:50 GMT -8
var boardid = (/board=(.+?)(&|$)/i.test(location.href))?RegExp.$1:""; var threadid = (/thread=(\d+)/i.test(location.href))?RegExp.$1:"";
Each variable will either contain the ID or it will be empty. As long as you are on the posting page (pb_action="display") then this will work fine...
|
|
inherit
136163
0
May 9, 2024 7:30:40 GMT -8
ǻñî§ђ™
597
January 2009
anish
|
Post by ǻñî§ђ™ on Aug 29, 2011 14:00:07 GMT -8
var boardid = (/board=(.+?)(&|$)/i.test(location.href))?RegExp.$1:""; var threadid = (/thread=(\d+)/i.test(location.href))?RegExp.$1:"";Each variable with either contain the ID or it will be empty. As long as you are on the posting page (pb_action="display") then this will work fine... Thank you so much Sub! I really appreciate that mate. Thanks EDIT: How would I get the post id as well? Sorry for being a pain.EDIT 2:figure it out
|
|