Post by maboroshi on Feb 11, 2014 16:01:08 GMT -8
Would it be possible for someone to update this code for v5? It seems to have gone in my old global footer.
<script type="text/javascript">
<!--
/*Personal Avatars - By iAlex - Open Source*/
var iAvatarPic="http://img142.imageshack.us/img142/6149/iavatarubbcgk5.gif"; //Custom Avatar UBBC
var iTd=document.getElementsByTagName('td');
var iLink=document.getElementsByTagName('a');
var iInp=document.getElementsByTagName('input');
function iAddLink(){
var iSpanLink=document.createElement('span');
iSpanLink.innerHTML=' - <a href="/index.cgi?action=personalavatars">Personal Avatars</a>';
var i=iTd.length;
while(--i){
if(iTd.item(i).colSpan=="2" && iTd.item(i).firstChild && iTd.item(i).firstChild.nodeName.match(/font/i) && iTd.item(i).firstChild.size=="2" && iTd.item(i).firstChild.firstChild && iTd.item(i).firstChild.firstChild.nodeName.match(/b/i) && iTd.item(i).firstChild.firstChild.innerHTML.match(/^Member's\sBio\s-/)){
iTd.item(i).firstChild.firstChild.appendChild(iSpanLink);
break;
}
}
}
function iAddField(){
var iAvatarDiv=document.getElementById('iAddAvatarDiv');
var iAvatarAdd=document.createElement('div');
iAvatarAdd.innerHTML='<table width="75%" align="center" class="bordercolor" cellpadding="4" cellspacing="1"><tr><td width="20%" align="center" valign="middle" class="windowbg">Avatar Name: <input type="text" style="width: 100%" name="iAvName" maxlength="20" /></td><td width="35%" align="center" valign="middle" class="windowbg2">Avatar URL: <input type="text" maxlength="150" style="width: 100%" name="iAvURL" /></td><td width="20%" valign="middle" align="center" class="windowbg"><input type="submit" value="Remove Avatar" onclick="iRemoveAvatar(this)" /></td></tr></table><b'+'r />';
iAvatarDiv.appendChild(iAvatarAdd);
}
function iRemoveAvatar(iAvatarSub){
var iAvatarSubParent = iAvatarSub.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
var iRemoveConfirm=confirm('Are you sure that you wish to remove this avatar?');
(iRemoveConfirm==true)? iAvatarSubParent.removeChild(iAvatarSub.parentNode.parentNode.parentNode.parentNode.parentNode) : '';
}
function iSaveAvatar(iSubmit){
iSubmit.nextSibling.nextSibling.disabled=true;
iSubmit.disabled=true;
if(document.cookie.match(/iPersonalAvatar/)){
var iDate=new Date();
iDate.setTime(iDate.getTime()-1);
document.cookie='iPersonalAvatar=gone;expires='+iDate.toGMTString();
}
var i=iInp.length;
while(i--){
if(iInp.item(i).name=="iAvName" && iInp.item(i+1) && iInp.item(i+1).name=="iAvURL" && iInp.item(i).value!="" && iInp.item(i+1).value!=""){
var iAlreadyPersonal=(document.cookie.match(/iPersonalAvatar=iPerStart((.+?))?iPerEnd/))? RegExp.$1.replace(/;/g, '%3B').replace(/'/g, '').replace(/"/g, '').replace(/</g, '%3c').replace(/>/g, '%3e') : '';
document.cookie='iPersonalAvatar=iPerStartiAvaStart='+iInp.item(i).value.replace(/;/g, '%3B').replace(/'/g, '').replace(/"/g, '').replace(/</g, '%3c').replace(/>/g, '%3e').replace(/iPersonalAvatar/g, '').replace(/iPerStart/g, '').replace(/iPerEnd/g, '').replace(/iAvaStart/g, '').replace(/iAvaMid/g, '').replace(/iAvaEnd/g, '')+'iAvaMid'+iInp.item(i+1).value.replace(/;/g, '%3B').replace(/'/g, '').replace(/"/g, '').replace(/</g, '%3c').replace(/>/g, '%3e').replace(/iPersonalAvatar/g, '').replace(/iPerStart/g, '').replace(/iPerEnd/g, '').replace(/iAvaStart/g, '').replace(/iAvaMid/g, '').replace(/iAvaEnd/g, '')+'iAvaEnd'+iAlreadyPersonal+'iPerEnd;expires=Sat, 20 Jan 3000 12:12:12 UTC; path=/;'
}
}
window.location='/index.cgi?action=viewprofile';
}
function iAvatarPage(){
var iSpanNav=document.createElement('span');
iSpanNav.innerHTML=' :: Personal Avatars';
document.title=document.title.replace(/An Error Has Occurred/, 'Personal Avatars');
document.getElementsByTagName('font').item(1).innerHTML='&'+'#'+'17'+'1; Personal Avatars &'+'#'+'18'+'7;';
var i=iLink.length;
var a=iTd.length;
while(--i){
if(iLink.item(i).className.match(/^nav$/) && iLink.item(i).parentNode && iLink.item(i).parentNode.nodeName.match(/td/i) && iLink.item(i).parentNode.vAlign=="top" && iLink.item(i).parentNode.width=="100%"){
iLink.item(i).parentNode.replaceChild(iSpanNav, iLink.item(i).nextSibling);
break;
}
}
while(--a){
if(iTd.item(a).width=="100%" && iTd.item(a).className.match(/titlebg/) && iTd.item(a).firstChild && iTd.item(a).firstChild.nodeName.match(/font/i) && iTd.item(a).firstChild.firstChild && iTd.item(a).firstChild.firstChild.nodeName.match(/b/i) && iTd.item(a).firstChild.firstChild.innerHTML.match(/^An Error Has Occurred$/)){
iTd.item(a).firstChild.firstChild.innerHTML='Personal Avatars';
iTd.item(a).parentNode.nextSibling.firstChild.firstChild.innerHTML='Welcome to your Personal Avatar selection page. From this page you will be able to add, remove and modify your personal avatars. The avatars that you save in this page will be available for you to use from a drop down menu whenever you post a message. If you select an avatar when posting a message, then that picture will be your avatar for that particular message only. Your personal avatars will be saved via your internet cookies, so, any deletion of your temporary internet files, will, unfortunately, mean you will have to re-add your personal avatars to this page.<b'+'r /><b'+'r /><b'+'r /><div id="iAddAvatarDiv"></div><b'+'r /><b'+'r /><input type="submit" value="Save Changes" onclick="iSaveAvatar(this)" /> <input type="submit" value="Add Avatar Field" onclick="iAddField()" />';
break;
}
}
}
function iAvatarCookie(){
if(document.cookie.match(/iPersonalAvatar=iPerStart((.+?))?iPerEnd/)){
var iAvatarDiv=document.getElementById('iAddAvatarDiv');
var iCookieIt=RegExp.$1.replace(/%3B/g, ';').replace(/%3c/g, '<').replace(/%3e/g, '>');
iAvatarCookieHold=iCookieIt.replace(/iAvaStart=/g, '<div><table width="75%" align="center" class="bordercolor" cellpadding="4" cellspacing="1"><tr><td width="20%" align="center" valign="middle" class="windowbg">Avatar Name: <input type="text" style="width: 100%" maxlength="20" name="iAvName" value="').replace(/iAvaMid/g, '" /></td><td width="35%" align="center" valign="middle" class="windowbg2">Avatar URL: <input type="text" style="width: 100%" name="iAvURL" maxlength="150" value="').replace(/iAvaEnd/g, '" /></td><td width="20%" valign="middle" align="center" class="windowbg"><input type="submit" value="Remove Avatar" onclick="iRemoveAvatar(this)" /></td></tr></table><b'+'r /></div>');
var iAvatarAdd=document.createElement('div');
iAvatarAdd.innerHTML=iAvatarCookieHold;
iAvatarDiv.appendChild(iAvatarAdd);
}
}
function iDropAvatar(iAvatarURL){
var iMessage=document.postForm.message;
iMessage.value=iMessage.value.replace(/\[avatar\]((.+?))?\[\/avatar\]/ig, '');
iMessage.value=iMessage.value+'[avatar]'+iAvatarURL+'[/avatar]';
document.getElementById('iAvatarSelect').selectedIndex=0;
}
function iAddSelect(){
var iMes=document.postForm.message.parentNode.parentNode.previousSibling;
var iPicSpan=document.createElement('span');
iPicSpan.innerHTML='<a href="javascript: iDropAvatar(\'\')"><img src="'+iAvatarPic+'" title="Avatar" alt="Avatar" border="0" /></a>';
var iColorSelect=document.postForm.color;
iColorSelect.parentNode.parentNode.firstChild.appendChild(iPicSpan);
iColorSelect.style.position='relative';
iColorSelect.style.bottom='8px';
if(document.cookie.match(/iPersonalAvatar=iPerStart((.+?))?iPerEnd/)){
iCookieIt=RegExp.$1.replace(/%3B/g, ';').replace(/%3c/g, '<').replace(/%3e/g, '>').replace(/iAvaStart=(.+?)iAvaMid(.+?)iAvaEnd/g, '<option value="$2">$1</option>');
var iAvatarMesDiv=document.createElement('div');
iAvatarMesDiv.innerHTML='<b'+'r /><b'+'r /><select onchange="iDropAvatar(this.options[this.selectedIndex].value)" id="iAvatarSelect"><option value="" selected="1">Personal Avatars</option>'+iCookieIt+'</select>';
iMes.appendChild(iAvatarMesDiv);
}
}
function iApplyAvatar(){
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).vAlign=="top" && iTd.item(i).align=="left" && iTd.item(i).innerHTML.match(/<br\s?\/?>member is/i) && iTd.item(i+1) && iTd.item(i+1).width=="80%" && iTd.item(i+1).innerHTML.match(/\[avatar\]((.+?))?\[\/avatar\]/i)){
var iAvatarDiv=document.createElement('div');
iAvatarDiv.innerHTML='<img src="'+RegExp.$1+'" alt="[avatar]" title="[avatar]" border="0" />';
var iAvCenter=iTd.item(i).getElementsByTagName('center');
if(iAvCenter.item(iAvCenter.length-1).innerHTML.match(/\[avatar\]/)){
iAvCenter.item(iAvCenter.length-1).replaceChild(iAvatarDiv, iAvCenter.item(iAvCenter.length-1).getElementsByTagName('img').item(0));
}
else{
iAvCenter.item(iAvCenter.length-1).insertBefore(iAvatarDiv, iAvCenter.item(iAvCenter.length-1).firstChild);
}
if(iAvatarDiv.firstChild.width>100){
iAvatarDiv.firstChild.width='100';
}
if(iAvatarDiv.firstChild.height>100){
iAvatarDiv.firstChild.height='100';
}
iTd.item(i+1).innerHTML=iTd.item(i+1).innerHTML.replace(/\[avatar\]((.+?))?\[\/avatar\]/gi, '');
}
}
}
if(window.location.href.match(/action=viewprofile$/) && pb_username!="Guest" || window.location.href.match('action=viewprofile&user='+pb_username+'$')){
iAddLink();
}
if(window.location.href.match(/action=personalavatars$/) && pb_username!="Guest"){
iAvatarPage();
iAvatarCookie();
}
if(document.postForm && document.postForm.color && document.postForm.message && pb_username!="Guest"){
iAddSelect();
}
if(window.location.href.match(/action=(display|(user)?recent|calendarview|search2|pmview)/) || window.location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){
iApplyAvatar();
}
//-->
</script>
<!--
/*Personal Avatars - By iAlex - Open Source*/
var iAvatarPic="http://img142.imageshack.us/img142/6149/iavatarubbcgk5.gif"; //Custom Avatar UBBC
var iTd=document.getElementsByTagName('td');
var iLink=document.getElementsByTagName('a');
var iInp=document.getElementsByTagName('input');
function iAddLink(){
var iSpanLink=document.createElement('span');
iSpanLink.innerHTML=' - <a href="/index.cgi?action=personalavatars">Personal Avatars</a>';
var i=iTd.length;
while(--i){
if(iTd.item(i).colSpan=="2" && iTd.item(i).firstChild && iTd.item(i).firstChild.nodeName.match(/font/i) && iTd.item(i).firstChild.size=="2" && iTd.item(i).firstChild.firstChild && iTd.item(i).firstChild.firstChild.nodeName.match(/b/i) && iTd.item(i).firstChild.firstChild.innerHTML.match(/^Member's\sBio\s-/)){
iTd.item(i).firstChild.firstChild.appendChild(iSpanLink);
break;
}
}
}
function iAddField(){
var iAvatarDiv=document.getElementById('iAddAvatarDiv');
var iAvatarAdd=document.createElement('div');
iAvatarAdd.innerHTML='<table width="75%" align="center" class="bordercolor" cellpadding="4" cellspacing="1"><tr><td width="20%" align="center" valign="middle" class="windowbg">Avatar Name: <input type="text" style="width: 100%" name="iAvName" maxlength="20" /></td><td width="35%" align="center" valign="middle" class="windowbg2">Avatar URL: <input type="text" maxlength="150" style="width: 100%" name="iAvURL" /></td><td width="20%" valign="middle" align="center" class="windowbg"><input type="submit" value="Remove Avatar" onclick="iRemoveAvatar(this)" /></td></tr></table><b'+'r />';
iAvatarDiv.appendChild(iAvatarAdd);
}
function iRemoveAvatar(iAvatarSub){
var iAvatarSubParent = iAvatarSub.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode;
var iRemoveConfirm=confirm('Are you sure that you wish to remove this avatar?');
(iRemoveConfirm==true)? iAvatarSubParent.removeChild(iAvatarSub.parentNode.parentNode.parentNode.parentNode.parentNode) : '';
}
function iSaveAvatar(iSubmit){
iSubmit.nextSibling.nextSibling.disabled=true;
iSubmit.disabled=true;
if(document.cookie.match(/iPersonalAvatar/)){
var iDate=new Date();
iDate.setTime(iDate.getTime()-1);
document.cookie='iPersonalAvatar=gone;expires='+iDate.toGMTString();
}
var i=iInp.length;
while(i--){
if(iInp.item(i).name=="iAvName" && iInp.item(i+1) && iInp.item(i+1).name=="iAvURL" && iInp.item(i).value!="" && iInp.item(i+1).value!=""){
var iAlreadyPersonal=(document.cookie.match(/iPersonalAvatar=iPerStart((.+?))?iPerEnd/))? RegExp.$1.replace(/;/g, '%3B').replace(/'/g, '').replace(/"/g, '').replace(/</g, '%3c').replace(/>/g, '%3e') : '';
document.cookie='iPersonalAvatar=iPerStartiAvaStart='+iInp.item(i).value.replace(/;/g, '%3B').replace(/'/g, '').replace(/"/g, '').replace(/</g, '%3c').replace(/>/g, '%3e').replace(/iPersonalAvatar/g, '').replace(/iPerStart/g, '').replace(/iPerEnd/g, '').replace(/iAvaStart/g, '').replace(/iAvaMid/g, '').replace(/iAvaEnd/g, '')+'iAvaMid'+iInp.item(i+1).value.replace(/;/g, '%3B').replace(/'/g, '').replace(/"/g, '').replace(/</g, '%3c').replace(/>/g, '%3e').replace(/iPersonalAvatar/g, '').replace(/iPerStart/g, '').replace(/iPerEnd/g, '').replace(/iAvaStart/g, '').replace(/iAvaMid/g, '').replace(/iAvaEnd/g, '')+'iAvaEnd'+iAlreadyPersonal+'iPerEnd;expires=Sat, 20 Jan 3000 12:12:12 UTC; path=/;'
}
}
window.location='/index.cgi?action=viewprofile';
}
function iAvatarPage(){
var iSpanNav=document.createElement('span');
iSpanNav.innerHTML=' :: Personal Avatars';
document.title=document.title.replace(/An Error Has Occurred/, 'Personal Avatars');
document.getElementsByTagName('font').item(1).innerHTML='&'+'#'+'17'+'1; Personal Avatars &'+'#'+'18'+'7;';
var i=iLink.length;
var a=iTd.length;
while(--i){
if(iLink.item(i).className.match(/^nav$/) && iLink.item(i).parentNode && iLink.item(i).parentNode.nodeName.match(/td/i) && iLink.item(i).parentNode.vAlign=="top" && iLink.item(i).parentNode.width=="100%"){
iLink.item(i).parentNode.replaceChild(iSpanNav, iLink.item(i).nextSibling);
break;
}
}
while(--a){
if(iTd.item(a).width=="100%" && iTd.item(a).className.match(/titlebg/) && iTd.item(a).firstChild && iTd.item(a).firstChild.nodeName.match(/font/i) && iTd.item(a).firstChild.firstChild && iTd.item(a).firstChild.firstChild.nodeName.match(/b/i) && iTd.item(a).firstChild.firstChild.innerHTML.match(/^An Error Has Occurred$/)){
iTd.item(a).firstChild.firstChild.innerHTML='Personal Avatars';
iTd.item(a).parentNode.nextSibling.firstChild.firstChild.innerHTML='Welcome to your Personal Avatar selection page. From this page you will be able to add, remove and modify your personal avatars. The avatars that you save in this page will be available for you to use from a drop down menu whenever you post a message. If you select an avatar when posting a message, then that picture will be your avatar for that particular message only. Your personal avatars will be saved via your internet cookies, so, any deletion of your temporary internet files, will, unfortunately, mean you will have to re-add your personal avatars to this page.<b'+'r /><b'+'r /><b'+'r /><div id="iAddAvatarDiv"></div><b'+'r /><b'+'r /><input type="submit" value="Save Changes" onclick="iSaveAvatar(this)" /> <input type="submit" value="Add Avatar Field" onclick="iAddField()" />';
break;
}
}
}
function iAvatarCookie(){
if(document.cookie.match(/iPersonalAvatar=iPerStart((.+?))?iPerEnd/)){
var iAvatarDiv=document.getElementById('iAddAvatarDiv');
var iCookieIt=RegExp.$1.replace(/%3B/g, ';').replace(/%3c/g, '<').replace(/%3e/g, '>');
iAvatarCookieHold=iCookieIt.replace(/iAvaStart=/g, '<div><table width="75%" align="center" class="bordercolor" cellpadding="4" cellspacing="1"><tr><td width="20%" align="center" valign="middle" class="windowbg">Avatar Name: <input type="text" style="width: 100%" maxlength="20" name="iAvName" value="').replace(/iAvaMid/g, '" /></td><td width="35%" align="center" valign="middle" class="windowbg2">Avatar URL: <input type="text" style="width: 100%" name="iAvURL" maxlength="150" value="').replace(/iAvaEnd/g, '" /></td><td width="20%" valign="middle" align="center" class="windowbg"><input type="submit" value="Remove Avatar" onclick="iRemoveAvatar(this)" /></td></tr></table><b'+'r /></div>');
var iAvatarAdd=document.createElement('div');
iAvatarAdd.innerHTML=iAvatarCookieHold;
iAvatarDiv.appendChild(iAvatarAdd);
}
}
function iDropAvatar(iAvatarURL){
var iMessage=document.postForm.message;
iMessage.value=iMessage.value.replace(/\[avatar\]((.+?))?\[\/avatar\]/ig, '');
iMessage.value=iMessage.value+'[avatar]'+iAvatarURL+'[/avatar]';
document.getElementById('iAvatarSelect').selectedIndex=0;
}
function iAddSelect(){
var iMes=document.postForm.message.parentNode.parentNode.previousSibling;
var iPicSpan=document.createElement('span');
iPicSpan.innerHTML='<a href="javascript: iDropAvatar(\'\')"><img src="'+iAvatarPic+'" title="Avatar" alt="Avatar" border="0" /></a>';
var iColorSelect=document.postForm.color;
iColorSelect.parentNode.parentNode.firstChild.appendChild(iPicSpan);
iColorSelect.style.position='relative';
iColorSelect.style.bottom='8px';
if(document.cookie.match(/iPersonalAvatar=iPerStart((.+?))?iPerEnd/)){
iCookieIt=RegExp.$1.replace(/%3B/g, ';').replace(/%3c/g, '<').replace(/%3e/g, '>').replace(/iAvaStart=(.+?)iAvaMid(.+?)iAvaEnd/g, '<option value="$2">$1</option>');
var iAvatarMesDiv=document.createElement('div');
iAvatarMesDiv.innerHTML='<b'+'r /><b'+'r /><select onchange="iDropAvatar(this.options[this.selectedIndex].value)" id="iAvatarSelect"><option value="" selected="1">Personal Avatars</option>'+iCookieIt+'</select>';
iMes.appendChild(iAvatarMesDiv);
}
}
function iApplyAvatar(){
var i=iTd.length;
while(--i){
if(iTd.item(i).width=="20%" && iTd.item(i).className.match(/windowbg(2)?/) && iTd.item(i).vAlign=="top" && iTd.item(i).align=="left" && iTd.item(i).innerHTML.match(/<br\s?\/?>member is/i) && iTd.item(i+1) && iTd.item(i+1).width=="80%" && iTd.item(i+1).innerHTML.match(/\[avatar\]((.+?))?\[\/avatar\]/i)){
var iAvatarDiv=document.createElement('div');
iAvatarDiv.innerHTML='<img src="'+RegExp.$1+'" alt="[avatar]" title="[avatar]" border="0" />';
var iAvCenter=iTd.item(i).getElementsByTagName('center');
if(iAvCenter.item(iAvCenter.length-1).innerHTML.match(/\[avatar\]/)){
iAvCenter.item(iAvCenter.length-1).replaceChild(iAvatarDiv, iAvCenter.item(iAvCenter.length-1).getElementsByTagName('img').item(0));
}
else{
iAvCenter.item(iAvCenter.length-1).insertBefore(iAvatarDiv, iAvCenter.item(iAvCenter.length-1).firstChild);
}
if(iAvatarDiv.firstChild.width>100){
iAvatarDiv.firstChild.width='100';
}
if(iAvatarDiv.firstChild.height>100){
iAvatarDiv.firstChild.height='100';
}
iTd.item(i+1).innerHTML=iTd.item(i+1).innerHTML.replace(/\[avatar\]((.+?))?\[\/avatar\]/gi, '');
}
}
}
if(window.location.href.match(/action=viewprofile$/) && pb_username!="Guest" || window.location.href.match('action=viewprofile&user='+pb_username+'$')){
iAddLink();
}
if(window.location.href.match(/action=personalavatars$/) && pb_username!="Guest"){
iAvatarPage();
iAvatarCookie();
}
if(document.postForm && document.postForm.color && document.postForm.message && pb_username!="Guest"){
iAddSelect();
}
if(window.location.href.match(/action=(display|(user)?recent|calendarview|search2|pmview)/) || window.location.href.match(/index.cgi$/) && document.title.match(/Preview/) && document.postForm){
iApplyAvatar();
}
//-->
</script>