|
Post by Wormopolis on Jun 5, 2010 22:45:21 GMT -8
give this a shot:
<script type="text/javascript"> <!-- // 2nd avatar v1.0 // by Wormopolis - request by rhondairv // keep header intact
// no need to edit below, unless you know what you are doing
if (document.modifyForm) { whold=hhold=urlhold=''; if (modifyForm.signature.value.match(/\[av2:(.*?)x(.*?)\](.*?)\[\/av2\]/)) { whold=RegExp.$1; hhold=RegExp.$2; urlhold=RegExp.$3; modifyForm.signature.value=modifyForm.signature.value.replace(/\[av2:(.*?)x(.*?)\](.*?)\[\/av2\]/,''); }
nwrw1=modifyForm.avatarurl.parentNode.parentNode.parentNode.cloneNode(true); nwrw2=modifyForm.avatarwidth.parentNode.parentNode.parentNode.cloneNode(true); nwrw3=modifyForm.avatarheight.parentNode.parentNode.parentNode.cloneNode(true); nwrw1.firstChild.firstChild.innerHTML="2nd "+nwrw1.firstChild.firstChild.innerHTML; nwrw2.firstChild.firstChild.innerHTML="2nd "+nwrw2.firstChild.firstChild.innerHTML; nwrw3.firstChild.firstChild.innerHTML="2nd "+nwrw3.firstChild.firstChild.innerHTML; nwrw1.firstChild.nextSibling.nextSibling.firstChild.innerHTML="FOR THE SECOND AVATAR<br>"+nwrw1.firstChild.nextSibling.nextSibling.firstChild.innerHTML; nwrw1.firstChild.nextSibling.firstChild.firstChild.name= nwrw1.firstChild.nextSibling.firstChild.firstChild.id='avatarurl2'; nwrw2.firstChild.nextSibling.firstChild.firstChild.name= nwrw2.firstChild.nextSibling.firstChild.firstChild.id='avatarwidth2'; nwrw3.firstChild.nextSibling.firstChild.firstChild.name= nwrw3.firstChild.nextSibling.firstChild.firstChild.id='avatarheight2'; nwrw2.firstChild.nextSibling.firstChild.firstChild.value=whold; nwrw3.firstChild.nextSibling.firstChild.firstChild.value=hhold; nwrw1.firstChild.nextSibling.firstChild.firstChild.value=urlhold;
spot=modifyForm.avatarheight.parentNode.parentNode.parentNode; spot.parentNode.insertBefore(nwrw3, spot.nextSibling); spot.parentNode.insertBefore(nwrw2, spot.nextSibling); spot.parentNode.insertBefore(nwrw1, spot.nextSibling);
function addAv2() { if (modifyForm.avatarurl2.value) { nwstrng='[av2:'+modifyForm.avatarwidth2.value+'x'+ modifyForm.avatarheight2.value+']'+ modifyForm.avatarurl2.value+'[/av2]'; modifyForm.signature.value=nwstrng+modifyForm.signature.value; } }
if (document.modifyForm.addEventListener) { document.modifyForm.addEventListener('submit',addAv2,true); } else { document.modifyForm.attachEvent('onsubmit',addAv2); }
}
if (pb_action.match(/(display|viewprofile|search2)/i) || location.href.match(/action=display/)) { for (tds=document.getElementsByTagName('td'), chk=0; chk<tds.length; chk++) { if (tds[chk].width=='20%' && tds[chk].className.match(/windowbg/) && tds[chk].vAlign=='top' && tds[chk].nextSibling.innerHTML.match(/\[av2:(.*?)x(.*?)\](.*?)\[\/av2\]/)) { rwtmp=tds[chk].nextSibling.getElementsByTagName('font'); hitcell=rwtmp[rwtmp.length-1]; if (hitcell.innerHTML.match(/\[av2:(.*?)x(.*?)\](.*?)\[\/av2\]/)) { avholdurl=RegExp.$3; avholdwidth=RegExp.$1; avholdheight=RegExp.$2; hitcell.innerHTML=hitcell.innerHTML.replace(/\[av2:(.*?)x(.*?)\](.*?)\[\/av2\]/,''); plc=tds[chk].getElementsByTagName('center')[0].getElementsByTagName('br')[0]; newAv=document.createElement('img'); newAv.src=avholdurl; if (avholdwidth) newAv.width=avholdwidth; if (avholdheight) newAv.height=avholdheight; plc.parentNode.insertBefore(newAv, plc.nextSibling); } } } }
// --> </script>
|
|
|
Post by rhondairv on Jun 6, 2010 11:01:23 GMT -8
works PERFECTLY!! Awesome job!!!!!
|
|
|
Post by Wormopolis on Jun 6, 2010 14:04:25 GMT -8
excellent!
|
|
|
Post by rhondairv on Jun 18, 2010 23:34:58 GMT -8
Found a glitch. It hides the ability to add a 2nd avatar. The avatar you have stays but you can't change it. The fields disappear.
|
|
|
Post by Wormopolis on Jun 19, 2010 1:53:39 GMT -8
did this happen after the avatar gallery was added?
|
|
|
Post by rhondairv on Jun 19, 2010 11:28:10 GMT -8
As far as i noticed. We used the 2nd avatar a few times. Last night i went to use it (1st since the gallery was added) and there was no place to add/change the 2nd avatar. The 2nd avatar was always in the profile/mini profile so i never noticed a problem til last night. I took off the gallery and then i could change the 2nd avatar again.
|
|
|
Post by Wormopolis on Jun 19, 2010 13:36:09 GMT -8
ok. not a huge problem. first thing to try: swap the order of the codes. see if that brings it back.
|
|
|
Post by rhondairv on Jun 19, 2010 14:51:55 GMT -8
Fixed. Sorry about that. I feel a bit embarrassed i didn't try that 1st.
|
|
|
Post by Wormopolis on Jun 19, 2010 17:54:08 GMT -8
dont be embarrassed. it wouldnt be the first time code order jumbled things up. its always a risk when you have multiple codes running on the same thing.
see what happens if you try a bunch of mini-profile codes together.
|
|