Post by SubDevo on Sept 3, 2009 23:08:50 GMT -8
Profile Background Image User Selectable by SubDevo
Tested in IE, FF, Opera and Safari
This code allows all your members to choose their own image to use for the background of their profile. On the "Modify Profile" page, an extra area is added at the bottom of the "Account Preferences" section, for the user to put the URL to an image. EXAMPLE 1
This is optional of course. Now, this URL needs to be stored somewhere, so in this code, the URL is stored in the users Personal Text. The URL will NOT be visible in the miniprofile.
ProBoards limits the amount of characters in the personal text to 100.
So the URL plus your personal text cannot be more than 100 characters total.
When you click the "Modify Profile" button, the code will alert you if this is too long, and tells you how many characters you need to remove and then cancels the submission process so you may remove the extra text. If it is 100 characters or less, it will work normally! EXAMPLE 2
Nothing needs to be edited in the code!
Enjoy!!!
SubDevo
Location: Global Footer
<script type="text/Javascript">
<!--
/* Profile Background Image User Selectable by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
if(location.href.match(/=(display|(pm)?view|user|recent)/i)||document.title.match(/search/i)||document.postForm){
var td=pG(document,"td"); var nR=/\[pbg:(.+?)\]/i; var n="";
for(x=0;x<td.length;x++) {var tdI=td[x].innerHTML;
if(td[x].width=="20%"&&tdI.match(nR)){ n=td[x].nextSibling;
var bgI=RegExp.$1.replace(/\s/g,""); td[x].innerHTML=tdI.replace(nR,"");
}
}
}
if(n&&bgI&&location.href.match(/=viewprof/i)){n.style.backgroundImage="url("+bgI+")";}
}else if(document.modifyForm){
var tb=pG(document.modifyForm,"table");
var xU=document.modifyForm.email.parentNode.parentNode.parentNode.cloneNode(true);
var xI=pG(xU,"input")[0]; xI.id="profileimage"; xI.name=""; var xF=pG(xU,"font");
xF[0].innerHTML="Profile Image URL:";
xF[2].innerHTML="Enter the URL to an image to be used as your profile background in this box. (optional)";
tb[3].firstChild.appendChild(xU); var pt=document.modifyForm.personaltext; var pbg=pt.value.split("[pbg:");
if(pbg[1]){pt.value=pbg[0]; xI.value=pbg[1].replace("]","");}else{xI.value="";}
document.getElementsByName("profileaction")[0].onclick=function(){var bU=xI.value;var bT=pt.value+"[pbg:"+bU+"]";var vL=bT.length-100;if(bU){if(vL>0){alert("ERROR: Remove "+vL+" character(s) from your Personal Text or Profile Image URL.");return false;}else{pt.value=bT;}}}
} function pG(a,n){return (a.getElementsByTagName(n));}
// -->
</script>
Tested in IE, FF, Opera and Safari
This code allows all your members to choose their own image to use for the background of their profile. On the "Modify Profile" page, an extra area is added at the bottom of the "Account Preferences" section, for the user to put the URL to an image. EXAMPLE 1
This is optional of course. Now, this URL needs to be stored somewhere, so in this code, the URL is stored in the users Personal Text. The URL will NOT be visible in the miniprofile.
ProBoards limits the amount of characters in the personal text to 100.
So the URL plus your personal text cannot be more than 100 characters total.
When you click the "Modify Profile" button, the code will alert you if this is too long, and tells you how many characters you need to remove and then cancels the submission process so you may remove the extra text. If it is 100 characters or less, it will work normally! EXAMPLE 2
Nothing needs to be edited in the code!
Enjoy!!!
SubDevo
Location: Global Footer
<script type="text/Javascript">
<!--
/* Profile Background Image User Selectable by SubDevo */
/* Global Footer - Please leave this header intact. Do not repost. */
/* interoceandesigns.proboards.com or lsdp.proboards.com */
if(location.href.match(/=(display|(pm)?view|user|recent)/i)||document.title.match(/search/i)||document.postForm){
var td=pG(document,"td"); var nR=/\[pbg:(.+?)\]/i; var n="";
for(x=0;x<td.length;x++) {var tdI=td[x].innerHTML;
if(td[x].width=="20%"&&tdI.match(nR)){ n=td[x].nextSibling;
var bgI=RegExp.$1.replace(/\s/g,""); td[x].innerHTML=tdI.replace(nR,"");
}
}
}
if(n&&bgI&&location.href.match(/=viewprof/i)){n.style.backgroundImage="url("+bgI+")";}
}else if(document.modifyForm){
var tb=pG(document.modifyForm,"table");
var xU=document.modifyForm.email.parentNode.parentNode.parentNode.cloneNode(true);
var xI=pG(xU,"input")[0]; xI.id="profileimage"; xI.name=""; var xF=pG(xU,"font");
xF[0].innerHTML="Profile Image URL:";
xF[2].innerHTML="Enter the URL to an image to be used as your profile background in this box. (optional)";
tb[3].firstChild.appendChild(xU); var pt=document.modifyForm.personaltext; var pbg=pt.value.split("[pbg:");
if(pbg[1]){pt.value=pbg[0]; xI.value=pbg[1].replace("]","");}else{xI.value="";}
document.getElementsByName("profileaction")[0].onclick=function(){var bU=xI.value;var bT=pt.value+"[pbg:"+bU+"]";var vL=bT.length-100;if(bU){if(vL>0){alert("ERROR: Remove "+vL+" character(s) from your Personal Text or Profile Image URL.");return false;}else{pt.value=bT;}}}
} function pG(a,n){return (a.getElementsByTagName(n));}
// -->
</script>