Post by Schubaltz on Jun 15, 2007 13:22:11 GMT -5
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;
a.match(/(<img.+>)/i);
this.rankIcon = RegExp.$1.split(/<br>/i)[0];
if(!a.split(this.rankIcon)[1].split(/<br>member is/i)[0].match(/((<b>online<\/b>|offline)<br><br>)|^$/i))
this.custom = a.split(this.rankIcon)[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>";
}
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;
a.match(/(<img.+>)/i);
this.rankIcon = RegExp.$1.split(/<br>/i)[0];
if(!a.split(this.rankIcon)[1].split(/<br>member is/i)[0].match(/((<b>online<\/b>|offline)<br><br>)|^$/i))
this.custom = a.split(this.rankIcon)[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>";
}