Post by Jordan on Aug 11, 2009 19:47:39 GMT -8
Use this instead: support.proboards.com/index.cgi?board=codedatabase&action=display&thread=358392
Instead of having to use a different code for each social network such as Facebook, Twitter, Myspace, lastfm, Digg, Delicious etc. to add to your mini-profile, this all does it with one.
Editing: The first red number determines where the information will be stored with 0 = Mini Profile and 1 = Signature. Once this is set, do not change it or you will have to wipe everyone's personal or signature text. You typically only want to use the signature when you are running out of room in the personal text.
The next two lines are what show up on the Modify Profile page in the "Instant Messengers" section.
The fourth line is the URL the website uses to link to a profile. Place %id% where the username is supposed to be in the URL.
The last line is just the URL to your icon.
Global Footers
<script type="text/javascript"><!--
/*
Social Networks in MiniProfile
Created by Triad
support.proboards.com
*/
var Networks = {
facebook: [0,
"Facebook",
"Your Facebook profile id.",
"http://www.facebook.com/profile.php?id=%id%",
"http://img210.imageshack.us/img210/9975/ifacebookbn5.gif"
],
myspace: [0,
"MySpace",
"Your MySpace page.",
"http://www.myspace.com/%id%",
"http://img187.imageshack.us/img187/6584/imyspaceituptwocg3.png"
],
twitter: [0,
"Twitter",
"Your twitter account name.",
"http://twitter.com/%id%",
"http://allyourschat.com/image/twitter-mp.png"
]
};
var n_delimiter = "\x07";
if(location.href.match(/on=(displ|search2|viewpr|pmv|(user)?rece|cal\w+iew)/)){
for(var td = document.getElementsByTagName("td"), x = 6; x < td.length; x++){
if(td[x].width == "20%" && td[x].getElementsByTagName("center")[0]){
var c = td[x].getElementsByTagName("center")[td[x].getElementsByTagName("center").length-1];
var t = td[x].nextSibling.getElementsByTagName("td");
var Values = [
[null, 0],
[null, 0]
];
if(c.innerHTML.match(new RegExp("(" + n_delimiter + ".+" + n_delimiter + ")", "i"))){
var temp = RegExp.$1;
Values[0][0] = temp.replace(/\s/g, '').split(n_delimiter);
c.innerHTML = c.innerHTML.replace(temp, "");
}
for(y = t.length-1; y > 0; y--){
if((t[y].colSpan == "3" || t[y].colSpan == "2") && t[y].getElementsByTagName("font")[0]){
var sig = t[y].getElementsByTagName("font")[t[y].getElementsByTagName("font").length-1];
if(sig.innerHTML.match(new RegExp("([^" + n_delimiter + ",]+)?(" + n_delimiter + ".+" + n_delimiter + ")", "i"))){
var temp = RegExp.$2;
Values[1][0] = temp.replace(/\s/g, '').split(n_delimiter);
sig.innerHTML = sig.innerHTML.replace(temp, "");
break;
}
}
}
if(Values[0][0] == null && Values[1][0] == null)
continue;
for(key in Networks){
var value = "";
if(Values[Networks[key][0]][0] != null && Values[Networks[key][0]][1] < Values[Networks[key][0]][0].length)
value = Values[Networks[key][0]][0][++Values[Networks[key][0]][1]];
if(typeof(value) != "undefined" && value != "" && !value.match(new RegExp(n_delimiter, "i"))){
var _img = document.createElement("img");
_img.src = Networks[key][4];
_img.alt = Networks[key][1];
_img.title = Networks[key][1];
_img.border = 0;
var _a = document.createElement("a");
_a.href = Networks[key][3].replace(/%id%/i, value);
_a.target = "_blank";
_a.appendChild(_img);
c.appendChild(_a);
c.appendChild(document.createTextNode(" "));
}
}
}
}
} else if(document.modifyForm){
var form = document.modifyForm;
var tb = form.aim.parentNode.parentNode.parentNode.parentNode;
var p_data = s_data = null;
if(form.personaltext.value.match(new RegExp("(" + n_delimiter + ".+" + n_delimiter + ")", "i"))){
p_data = RegExp.$1.split(n_delimiter);
form.personaltext.value = form.personaltext.value.replace(RegExp.$1, "");
}
if(form.signature.value.match(new RegExp("(" + n_delimiter + ".+" + n_delimiter + ")", "i"))){
s_data = RegExp.$1.split(n_delimiter);
form.signature.value = form.signature.value.replace(RegExp.$1, "");
}
var p_counter = s_counter = 1;
for(key in Networks){
var value = "";
if(!Networks[key][0]){
if(p_data != null && p_counter < p_data.length){
if(p_data[p_counter] != "" && !p_data[p_counter].match(new RegExp(n_delimiter, "i")))
value = p_data[p_counter];
p_counter++;
}
} else if(s_data != null && s_counter < s_data.length){
if(s_data[s_counter] != "" && !s_data[s_counter].match(new RegExp(n_delimiter, "i")))
value = s_data[s_counter];
s_counter++;
}
var _input = document.createElement("input");
_input.type = "text";
_input.size = "35";
_input.id = key;
_input.value = value;
var _font_1 = document.createElement("font");
_font_1.size = "2";
_font_1.appendChild(document.createTextNode(Networks[key][1] + ":"));
var _font_2 = document.createElement("font");
_font_2.size= "1";
_font_2.appendChild(document.createTextNode(Networks[key][2]));
var _row = tb.insertRow(tb.rows.length);
var _cell = _row.insertCell(0);
_cell.width = "160";
_cell.appendChild(_font_1);
_cell = _row.insertCell(1);
_cell.width = "245";
_cell.appendChild(_input);
_cell = _row.insertCell(2);
_cell.width = "245";
_cell.appendChild(_font_2);
}
function insertData(){
var p_data = s_data = n_delimiter;
var p_fields = s_fields = "";
var p_empty = s_empty = true;
for(key in Networks){
if(!Networks[key][0]){
p_data += document.getElementById(key).value + n_delimiter;
if(document.getElementById(key).value.length > 0){
p_fields += Networks[key][1] + ",";
p_empty = false;
}
} else {
s_data += document.getElementById(key).value + n_delimiter;
if(document.getElementById(key).value.length > 0){
s_fields += Networks[key][1] + ",";
s_empty = false;
}
}
}
if(p_empty) p_data = "";
if(s_empty) s_data = "";
var p_length = form.personaltext.value.length + p_data.length;
var p_max = form.personaltext.maxLength;
if(p_length > p_max){
alert("You are " + (p_length - p_max) + " characters over the personal text's " + p_max + " character limit. Either remove any personal text you may be using or any of the following fields:\n\n" + p_fields.split(',').join('\n'));
return true;
}
var s_length = form.signature.value.length + s_data.length;
var s_max = 400;
if(form.signature.parentNode.parentNode.nextSibling.firstChild.firstChild.data.match(/([\d,]+)/i))
s_max = parseInt(RegExp.$1);
if(s_length > s_max){
alert("You are " + (s_length - s_max) + " characters over the signature's " + s_max + " character limit. Either remove any signature text you may be using or any of the following fields:\n\n" + s_fields.split(',').join('\n'));
return true;
}
form.personaltext.value += p_data;
form.signature.value += s_data;
form.submit();
}
var _input= document.createElement("input");
_input.type = "button";
_input.value = "Modify Profile";
_input.onclick = function(){
insertData();
}
for(var i = document.getElementsByTagName("input"), x = i.length - 1; x > -1; x--){
if(i[x].type == "submit" && i[x].value == "Modify Profile"){
i[x].parentNode.replaceChild(_input, i[x]);
break;
}
}
}
//--></script>
September 7, 2009: Updated script to allow user information anywhere in the URL instead of just the end. ~ Triad
August 13, 2009: Changed the delimiter and added option to change it with a variable. ~ Triad
Instead of having to use a different code for each social network such as Facebook, Twitter, Myspace, lastfm, Digg, Delicious etc. to add to your mini-profile, this all does it with one.
Editing: The first red number determines where the information will be stored with 0 = Mini Profile and 1 = Signature. Once this is set, do not change it or you will have to wipe everyone's personal or signature text. You typically only want to use the signature when you are running out of room in the personal text.
The next two lines are what show up on the Modify Profile page in the "Instant Messengers" section.
The fourth line is the URL the website uses to link to a profile. Place %id% where the username is supposed to be in the URL.
The last line is just the URL to your icon.
youtube: [0,Important Note: Always add new networks to the bottom of the Networks object. Do not change the order or the code will be mixed up and have one network link to another network in the mini-profile.
"YouTube",
"Your YouTube username.",
"www.youtube.com/user/%id%",
"imagehost.com/image.png"
]
Global Footers
<script type="text/javascript"><!--
/*
Social Networks in MiniProfile
Created by Triad
support.proboards.com
*/
var Networks = {
facebook: [0,
"Facebook",
"Your Facebook profile id.",
"http://www.facebook.com/profile.php?id=%id%",
"http://img210.imageshack.us/img210/9975/ifacebookbn5.gif"
],
myspace: [0,
"MySpace",
"Your MySpace page.",
"http://www.myspace.com/%id%",
"http://img187.imageshack.us/img187/6584/imyspaceituptwocg3.png"
],
twitter: [0,
"Twitter",
"Your twitter account name.",
"http://twitter.com/%id%",
"http://allyourschat.com/image/twitter-mp.png"
]
};
var n_delimiter = "\x07";
if(location.href.match(/on=(displ|search2|viewpr|pmv|(user)?rece|cal\w+iew)/)){
for(var td = document.getElementsByTagName("td"), x = 6; x < td.length; x++){
if(td[x].width == "20%" && td[x].getElementsByTagName("center")[0]){
var c = td[x].getElementsByTagName("center")[td[x].getElementsByTagName("center").length-1];
var t = td[x].nextSibling.getElementsByTagName("td");
var Values = [
[null, 0],
[null, 0]
];
if(c.innerHTML.match(new RegExp("(" + n_delimiter + ".+" + n_delimiter + ")", "i"))){
var temp = RegExp.$1;
Values[0][0] = temp.replace(/\s/g, '').split(n_delimiter);
c.innerHTML = c.innerHTML.replace(temp, "");
}
for(y = t.length-1; y > 0; y--){
if((t[y].colSpan == "3" || t[y].colSpan == "2") && t[y].getElementsByTagName("font")[0]){
var sig = t[y].getElementsByTagName("font")[t[y].getElementsByTagName("font").length-1];
if(sig.innerHTML.match(new RegExp("([^" + n_delimiter + ",]+)?(" + n_delimiter + ".+" + n_delimiter + ")", "i"))){
var temp = RegExp.$2;
Values[1][0] = temp.replace(/\s/g, '').split(n_delimiter);
sig.innerHTML = sig.innerHTML.replace(temp, "");
break;
}
}
}
if(Values[0][0] == null && Values[1][0] == null)
continue;
for(key in Networks){
var value = "";
if(Values[Networks[key][0]][0] != null && Values[Networks[key][0]][1] < Values[Networks[key][0]][0].length)
value = Values[Networks[key][0]][0][++Values[Networks[key][0]][1]];
if(typeof(value) != "undefined" && value != "" && !value.match(new RegExp(n_delimiter, "i"))){
var _img = document.createElement("img");
_img.src = Networks[key][4];
_img.alt = Networks[key][1];
_img.title = Networks[key][1];
_img.border = 0;
var _a = document.createElement("a");
_a.href = Networks[key][3].replace(/%id%/i, value);
_a.target = "_blank";
_a.appendChild(_img);
c.appendChild(_a);
c.appendChild(document.createTextNode(" "));
}
}
}
}
} else if(document.modifyForm){
var form = document.modifyForm;
var tb = form.aim.parentNode.parentNode.parentNode.parentNode;
var p_data = s_data = null;
if(form.personaltext.value.match(new RegExp("(" + n_delimiter + ".+" + n_delimiter + ")", "i"))){
p_data = RegExp.$1.split(n_delimiter);
form.personaltext.value = form.personaltext.value.replace(RegExp.$1, "");
}
if(form.signature.value.match(new RegExp("(" + n_delimiter + ".+" + n_delimiter + ")", "i"))){
s_data = RegExp.$1.split(n_delimiter);
form.signature.value = form.signature.value.replace(RegExp.$1, "");
}
var p_counter = s_counter = 1;
for(key in Networks){
var value = "";
if(!Networks[key][0]){
if(p_data != null && p_counter < p_data.length){
if(p_data[p_counter] != "" && !p_data[p_counter].match(new RegExp(n_delimiter, "i")))
value = p_data[p_counter];
p_counter++;
}
} else if(s_data != null && s_counter < s_data.length){
if(s_data[s_counter] != "" && !s_data[s_counter].match(new RegExp(n_delimiter, "i")))
value = s_data[s_counter];
s_counter++;
}
var _input = document.createElement("input");
_input.type = "text";
_input.size = "35";
_input.id = key;
_input.value = value;
var _font_1 = document.createElement("font");
_font_1.size = "2";
_font_1.appendChild(document.createTextNode(Networks[key][1] + ":"));
var _font_2 = document.createElement("font");
_font_2.size= "1";
_font_2.appendChild(document.createTextNode(Networks[key][2]));
var _row = tb.insertRow(tb.rows.length);
var _cell = _row.insertCell(0);
_cell.width = "160";
_cell.appendChild(_font_1);
_cell = _row.insertCell(1);
_cell.width = "245";
_cell.appendChild(_input);
_cell = _row.insertCell(2);
_cell.width = "245";
_cell.appendChild(_font_2);
}
function insertData(){
var p_data = s_data = n_delimiter;
var p_fields = s_fields = "";
var p_empty = s_empty = true;
for(key in Networks){
if(!Networks[key][0]){
p_data += document.getElementById(key).value + n_delimiter;
if(document.getElementById(key).value.length > 0){
p_fields += Networks[key][1] + ",";
p_empty = false;
}
} else {
s_data += document.getElementById(key).value + n_delimiter;
if(document.getElementById(key).value.length > 0){
s_fields += Networks[key][1] + ",";
s_empty = false;
}
}
}
if(p_empty) p_data = "";
if(s_empty) s_data = "";
var p_length = form.personaltext.value.length + p_data.length;
var p_max = form.personaltext.maxLength;
if(p_length > p_max){
alert("You are " + (p_length - p_max) + " characters over the personal text's " + p_max + " character limit. Either remove any personal text you may be using or any of the following fields:\n\n" + p_fields.split(',').join('\n'));
return true;
}
var s_length = form.signature.value.length + s_data.length;
var s_max = 400;
if(form.signature.parentNode.parentNode.nextSibling.firstChild.firstChild.data.match(/([\d,]+)/i))
s_max = parseInt(RegExp.$1);
if(s_length > s_max){
alert("You are " + (s_length - s_max) + " characters over the signature's " + s_max + " character limit. Either remove any signature text you may be using or any of the following fields:\n\n" + s_fields.split(',').join('\n'));
return true;
}
form.personaltext.value += p_data;
form.signature.value += s_data;
form.submit();
}
var _input= document.createElement("input");
_input.type = "button";
_input.value = "Modify Profile";
_input.onclick = function(){
insertData();
}
for(var i = document.getElementsByTagName("input"), x = i.length - 1; x > -1; x--){
if(i[x].type == "submit" && i[x].value == "Modify Profile"){
i[x].parentNode.replaceChild(_input, i[x]);
break;
}
}
}
//--></script>
September 7, 2009: Updated script to allow user information anywhere in the URL instead of just the end. ~ Triad
August 13, 2009: Changed the delimiter and added option to change it with a variable. ~ Triad