Post by ialex on May 24, 2008 23:41:37 GMT -8
This will allow each user to put their Xbox gamertag in their profile. An image will then appear in their mini profile linking to their Xbox profile.
Here is the image that will appear in the mini profile:
You may continue using it or change it via the URL at the top of the code.
Global Footer.
Cross Browser.
<script type="text/javascript">
<!--
/*Xbox Gamertag in Mini Profile - By iAlex - Open Source*/
var iXboxIcon="http://i305./nn226/iZando/XboxGamerTag.gif"; //Xbox mini profile icon
if(document.modifyForm){
var iAim=document.modifyForm.aim.parentNode.parentNode.parentNode;
var iXboxTr=iAim.cloneNode(true);
iXboxTr.childNodes[0].firstChild.innerHTML='Xbox Gamertag:';
iXboxTr.childNodes[1].firstChild.innerHTML='<input type="text" size="35" maxlength="25" id="iXboxInp" />';
iXboxTr.childNodes[2].firstChild.innerHTML='Your Xbox Gamertag here.';
iAim.parentNode.insertBefore(iXboxTr, iAim);
var iPerTe=document.modifyForm.personaltext;
var iXboxInp=document.getElementById('iXboxInp');
if(iPerTe.value.match(/\[Xb0:(.+?)\]/)){
iXboxInp.value=RegExp.$1;
iPerTe.value=iPerTe.value.replace(/\[Xb0:(.+?)\]/, '');
}
function iSaFa(){
if(iXboxInp.value!=""){
iPerTe.value=iPerTe.value+'[Xb0:'+iXboxInp.value+']';
}
}
if(document.addEventListener){
document.modifyForm.addEventListener('submit', iSaFa, false);
}
else{
document.modifyForm.attachEvent('onsubmit', iSaFa);
}
}
if(window.location.href.match(/action=(display|(user)?recent|viewprofile|calendarview|pmview)/) || window.location.href.match(/index.cgi$/) && (document.postForm||document.title.match(/\s-\sSearch/))){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" && iTd.item(i).vAlign=="top" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).innerHTML.match(/\[Xb0:(.+?)\]/)){
var iCentre=iTd.item(i).getElementsByTagName('center');
var iXboxSpan=document.createElement('span');
iXboxSpan.innerHTML='<a href="http://live.xbox.com/member/'+RegExp.$1+'" target="_blank"><img src="'+iXboxIcon+'" border="0" alt="Gamertag" title="Gamertag" /></a>';
iCentre.item(iCentre.length-1).appendChild(iXboxSpan);
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[Xb0:(.+?)\]/, '');
}
}
}
//-->
</script>
Here is the image that will appear in the mini profile:
You may continue using it or change it via the URL at the top of the code.
Global Footer.
Cross Browser.
<script type="text/javascript">
<!--
/*Xbox Gamertag in Mini Profile - By iAlex - Open Source*/
var iXboxIcon="http://i305./nn226/iZando/XboxGamerTag.gif"; //Xbox mini profile icon
if(document.modifyForm){
var iAim=document.modifyForm.aim.parentNode.parentNode.parentNode;
var iXboxTr=iAim.cloneNode(true);
iXboxTr.childNodes[0].firstChild.innerHTML='Xbox Gamertag:';
iXboxTr.childNodes[1].firstChild.innerHTML='<input type="text" size="35" maxlength="25" id="iXboxInp" />';
iXboxTr.childNodes[2].firstChild.innerHTML='Your Xbox Gamertag here.';
iAim.parentNode.insertBefore(iXboxTr, iAim);
var iPerTe=document.modifyForm.personaltext;
var iXboxInp=document.getElementById('iXboxInp');
if(iPerTe.value.match(/\[Xb0:(.+?)\]/)){
iXboxInp.value=RegExp.$1;
iPerTe.value=iPerTe.value.replace(/\[Xb0:(.+?)\]/, '');
}
function iSaFa(){
if(iXboxInp.value!=""){
iPerTe.value=iPerTe.value+'[Xb0:'+iXboxInp.value+']';
}
}
if(document.addEventListener){
document.modifyForm.addEventListener('submit', iSaFa, false);
}
else{
document.modifyForm.attachEvent('onsubmit', iSaFa);
}
}
if(window.location.href.match(/action=(display|(user)?recent|viewprofile|calendarview|pmview)/) || window.location.href.match(/index.cgi$/) && (document.postForm||document.title.match(/\s-\sSearch/))){
var iTd=document.getElementsByTagName('td');
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" && iTd.item(i).vAlign=="top" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).innerHTML.match(/\[Xb0:(.+?)\]/)){
var iCentre=iTd.item(i).getElementsByTagName('center');
var iXboxSpan=document.createElement('span');
iXboxSpan.innerHTML='<a href="http://live.xbox.com/member/'+RegExp.$1+'" target="_blank"><img src="'+iXboxIcon+'" border="0" alt="Gamertag" title="Gamertag" /></a>';
iCentre.item(iCentre.length-1).appendChild(iXboxSpan);
iTd.item(i).innerHTML=iTd.item(i).innerHTML.replace(/\[Xb0:(.+?)\]/, '');
}
}
}
//-->
</script>