Академический Документы
Профессиональный Документы
Культура Документы
/*global spawnpic*/
spawnpic = {};
(function() {
spawnpic = {
// private property
photo: null,
info: {
name: null,
photo: null,
gender: null,
age: null,
status: null,
location: null,
seek: null,
since: null
},
regexp: {
name: /controlpanel_header">([\s\s]*?)<a\s*name="controlpanel/i,
photo: /imgblock200"><a[\s\s]*?>([\s\s]*?)<\/a><\/div>/i,
gender: /q">([\s]*male)/i,
age: /male,\s*([\d]*),/i,
status: /male,\s*[\d]*,\s*([\s\s]*?)<\/span>/i,
location:
/location\:\s*<\/span><a[\s\s]*?>([\s\s]*?)<\/a><\/li>/i,
seek: /interested\s*in\:\s*<\/span>([\s\s]*?)<\/li>/i,
since: /member\s*since\:\s*<\/span>([\w]*?[\s][\d]*?)<\/li>/i
},
init: function() {
try {
spawnpic.ajaxrequest("get", "http://" + location.hostname +
"/" + pageviewerid, true, null, spawnpic.viewer, null);
} catch(e) {}
},
viewer: function(mypic) {
if (mypic.replace(/^\s*|\s*$/g, "") === "") {
alert("vmp error: unable to parse user details!");
return;
} else if (mypic) {
for (var val in spawnpic.info) {
try {
spawnpic.info[val] = new
regexp(spawnpic.regexp[val]).exec(mypic)[1].replace(/^(\d)$/, "0$1");
} catch(e) {
spawnpic.info[val] = "";
}
}
var seek = spawnpic.info.seek;
switch (spawnpic.info.seek) {
case "":
seek = "just looking around";
break;
}
spawnpic.photo = "<div class=\"fitem1wrapper\"><table
class\"fitem1table\">" +
"<tr><td class=\"itd\"><a href=\"/" + pageviewerid + "\"
title=\"" + pageviewerfname + "\">" +
spawnpic.info.photo.replace(/<img /gi, "<img width=\"100\"
height=\"100\" ") + "</a></td>" +
"<td class=\"dtd\"><ul class=\"data\"><div
class=\"title\">" +
"<li><a href=\"/" + pageviewerid + "\">" +
spawnpic.info.name + "</a><br>" +
pageviewerid.replace(/^\s*[\d]*?/gi, "friendster id: ") +
"<br>" +
spawnpic.info.gender + ", " + spawnpic.info.age + ", " +
spawnpic.info.status.replace(/<[\s]*?>/g, "") + "<br>" +
"interested in: " + seek + "<br>" +
spawnpic.info.since.replace(/^\s*[\w]*?/gi, "member since:
") + "<br>" +
spawnpic.info.location.replace(/^\s*[\s\s]*?/gi, "location:
") + "</li>" +
"</div></ul></td></tr></table></div>";
addbox("hello " + spawnpic.info.name, spawnpic.photo,
"spawnpic", /commonbox[\s]*?friends/i);
}
},