Post by ialex on Sept 6, 2007 3:19:32 GMT -8
This code will allow each user to put there Myspace URL into their profile. An Icon will then appear in their mini profile linking to their Myspace URL.
This is the mini profile icon that will be used:
You can continue using that one, or change it to your own, by editing the Image URL address at the top of the code.
Editing Profile Preview: Click
Mini Profile Preview: Click
Cross Browser.
Global Footer.
Proboards.
<script type="text/javascript">
<!--
/*Myspace Icon in Profile - By iAlex - Open Source*/
var iMySpaceIcon="http://img187.imageshack.us/img187/6584/imyspaceituptwocg3.png"; //Myspace Mini Profile Icon
if(document.modifyForm){
var iTable=document.modifyForm.aim.parentNode.parentNode.parentNode;
var iDiv=iTable.cloneNode(true);
iDiv.childNodes[0].firstChild.innerHTML='Myspace:';
iDiv.childNodes[1].innerHTML='<input type="text" size="35" maxlength="75" id="iMySpaceInput" />';
iDiv.childNodes[2].firstChild.innerHTML='Your Myspace URL here.';
iTable.parentNode.insertBefore(iDiv, iTable);
var iSignature=document.modifyForm.signature;
var iMySpace=document.getElementById('iMySpaceInput');
if(iSignature.value.match(/\[My5:(.+?)?\]/)){
iMySpace.value=RegExp.$1;
iSignature.value=iSignature.value.replace(/\[My5:(.+?)?\]/g,'');
}
function iMySpaceSubmit(){
if(iMySpace.value!=""){
iSignature.value=iSignature.value+'[My5:'+iMySpace.value+']';
}
}
if(document.addEventListener){
document.modifyForm.addEventListener('submit', iMySpaceSubmit, false);
}else{
document.modifyForm.attachEvent('onsubmit', iMySpaceSubmit);
}
}
if(location.href.match(/action=(display|(user)?recent|viewprofile|calendarview|search2|pmview)/) || location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){
var iTd=document.getElementsByTagName('td');
for(i=0;i<iTd.length;i++){
if(iTd.item(i).width=="20%" && iTd.item(i).vAlign=="top" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i+1).innerHTML.match(/\[My5:(.+?)?\]/)){
var iMySpaceSpan=document.createElement('span');
iMySpaceSpan.innerHTML='<a href="'+RegExp.$1+'" target="_blank"><img src="'+iMySpaceIcon+'" border="0"></a>';
var iMyCenter=iTd.item(i).getElementsByTagName('center');
iMyCenter.item(iMyCenter.length-1).appendChild(iMySpaceSpan);
iTd.item(i+1).innerHTML=iTd.item(i+1).innerHTML.replace(/\[My5:(.+?)?\]/g, '');
}
}
}
//-->
</script>
Enjoy! Feel free to make any suggestions or report any bugs.
This is the mini profile icon that will be used:
You can continue using that one, or change it to your own, by editing the Image URL address at the top of the code.
Editing Profile Preview: Click
Mini Profile Preview: Click
Cross Browser.
Global Footer.
Proboards.
<script type="text/javascript">
<!--
/*Myspace Icon in Profile - By iAlex - Open Source*/
var iMySpaceIcon="http://img187.imageshack.us/img187/6584/imyspaceituptwocg3.png"; //Myspace Mini Profile Icon
if(document.modifyForm){
var iTable=document.modifyForm.aim.parentNode.parentNode.parentNode;
var iDiv=iTable.cloneNode(true);
iDiv.childNodes[0].firstChild.innerHTML='Myspace:';
iDiv.childNodes[1].innerHTML='<input type="text" size="35" maxlength="75" id="iMySpaceInput" />';
iDiv.childNodes[2].firstChild.innerHTML='Your Myspace URL here.';
iTable.parentNode.insertBefore(iDiv, iTable);
var iSignature=document.modifyForm.signature;
var iMySpace=document.getElementById('iMySpaceInput');
if(iSignature.value.match(/\[My5:(.+?)?\]/)){
iMySpace.value=RegExp.$1;
iSignature.value=iSignature.value.replace(/\[My5:(.+?)?\]/g,'');
}
function iMySpaceSubmit(){
if(iMySpace.value!=""){
iSignature.value=iSignature.value+'[My5:'+iMySpace.value+']';
}
}
if(document.addEventListener){
document.modifyForm.addEventListener('submit', iMySpaceSubmit, false);
}else{
document.modifyForm.attachEvent('onsubmit', iMySpaceSubmit);
}
}
if(location.href.match(/action=(display|(user)?recent|viewprofile|calendarview|search2|pmview)/) || location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){
var iTd=document.getElementsByTagName('td');
for(i=0;i<iTd.length;i++){
if(iTd.item(i).width=="20%" && iTd.item(i).vAlign=="top" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i+1).innerHTML.match(/\[My5:(.+?)?\]/)){
var iMySpaceSpan=document.createElement('span');
iMySpaceSpan.innerHTML='<a href="'+RegExp.$1+'" target="_blank"><img src="'+iMySpaceIcon+'" border="0"></a>';
var iMyCenter=iTd.item(i).getElementsByTagName('center');
iMyCenter.item(iMyCenter.length-1).appendChild(iMySpaceSpan);
iTd.item(i+1).innerHTML=iTd.item(i+1).innerHTML.replace(/\[My5:(.+?)?\]/g, '');
}
}
}
//-->
</script>
Enjoy! Feel free to make any suggestions or report any bugs.