Please login or register. Welcome to the Studio, guest!


Quick Links:


newBookmarkLockedFalling

Aaron

Aaron Avatar
Bad Wolf

****
Dedicated Studio Member

859


November 2006
Description: Grabs mini-profile information and places it in an object.

function PBProfile(a) {
var b = a.getElementsByTagName("b")[0], c = a.getElementsByTagName("center")[a.getElementsByTagName("center").length - 1].innerHTML;
a = a.innerHTML;
this.name = b.innerHTML;
this.rank = b.nextSibling.nextSibling.data;
if(a.match(/alt="?\*"?/i)) {
a.match(/(<img.+>)/i);
this.rankIcon = RegExp.$1.split(/<br>/i)[0];
}
if(!a.split(this.rankIcon || this.rank)[1].split(/<br>member is/i)[0].match(/((<b>online<\/b>|offline)<br><br>)|^$/i))
this.custom = a.split(this.rankIcon || this.rank)[1].split(/<br>member is/i)[0].replace(/<br>/i, "");
a.match(/member is (off|<b>on)line/i);
this.status = RegExp.$1.replace(/<b>/i, "") + "line";
if(c.match(/alt="?\[avatar\]"?/))
this.avatar = c.split(/<br>/i)[0];
if(c.match(/([^>]+)<br>/i)) if(RegExp.$1 != " ")
this.personal = RegExp.$1;
if(c.match(/<br>(<a.+|<img.+) </i))
this.msng = RegExp.$1;
if(!this.msng && c.match(/>(<a.{8}|<scr)(<br)?/i))
this.contact = RegExp.$1 + c.split(RegExp.$1)[1];
else if(this.msng && c.split(this.msng)[1])
this.contact = c.split(this.msng)[1].replace(/<br> ?/g, "");
a.match(/joined: (... \d{4})/i);
this.joined = RegExp.$1;
if(a.match(/gender: (f?e?male)/i))
this.gender = RegExp.$1;
a.match(/posts: (,?\d+)+/i);
this.posts = RegExp.$1;
if(a.match(/location: ([^<]+)/i))
this.location = RegExp.$1;
if(a.match(/karma: (.+)/i))
this.karma = RegExp.$1;
}


Example:

for(var i = document.getElementsByTagName("td"), x = 0; x < i.length; x ++)
if(i[x].width == "20%" && i[x].innerHTML.match(/posts/i)) {
var $e = new PBProfile(i[x]); // argument MUST be mini-profile cell
i[x].innerHTML = "<div>" + $e.name + "</div>";
}



Last Edit: Aug 4, 2007 20:58:49 GMT by Aaron

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Just wanna point out that using this, you can not use the center UBBC in the custom title.

Aaron

Aaron Avatar
Bad Wolf

****
Dedicated Studio Member

859


November 2006
You'll also get problems if a member group doesn't have rank icons. :P

Anyway, fixed that one. >_> :P

Chris

Chris Avatar

******
Head Coder

19,519


June 2005
Then make a work around. :P Can't be THAT hard.

Aaron

Aaron Avatar
Bad Wolf

****
Dedicated Studio Member

859


November 2006
Nope, just split this.rank instead. But i'm lazy, i'll do it later. :P

Edit: There, that should work. I just don't feel like checking right now.




Last Edit: Aug 4, 2007 20:59:39 GMT by Aaron

newBookmarkLockedFalling