Post by Todge on Nov 2, 2008 12:01:29 GMT -8
This will allow a member to have a second avatar in any post they make. The second avatar will appear below the member's main avatar.
Put it in either the Global Footer, or the footer of any board(s) you want it to apply to.
Put it in either the Global Footer, or the footer of any board(s) you want it to apply to.
<script type="text/javascript">
<!--
/*
Second, post specific, avatar..
Copyright © 2008
Please keep this header intact
*/
// Add option to post area..
if(document.postForm && pb_username != 'Guest')
{
var avTR = document.createElement('TR');
var avTD1 = document.createElement('TD');
var avTD2 = document.createElement('TD');
avTD1.setAttribute('CLASS','windowbg2');
avTD1.className = 'windowbg2';
avTD2.setAttribute('CLASS','windowbg2');
avTD2.className = 'windowbg2';
avTD1.innerHTML = '<font size="2">Add Avatar:</font>';
avTD2.innerHTML = '<input id="avatar" name="avatar" size="72" maxlength="80" type="text" title="Please ensure the maximum width of avatar is 100 pixels">';
avTR.appendChild(avTD1);
avTR.appendChild(avTD2);
var messageRow = document.postForm.message.parentNode.parentNode.parentNode;
messageRow.parentNode.insertBefore(avTR,messageRow);
function addAvatar()
{
var avatar = document.getElementById('avatar');
if(avatar.value.match('http://'))
{
document.postForm.message.value = '[url='+avatar.value+'] [/url]'+document.postForm.message.value;
}}
document.postForm.onsubmit = addAvatar;
}
// Remove avatar from quoted/modified posts..
if(document.postForm && document.postForm.message.value.match(/\] \[\/url\]/))
{
if(document.location.href.match('modifypost'))
{
var avatar = document.getElementById('avatar');
avatar.value = document.postForm.message.value.split('=')[1].split('] ')[0];
}
document.postForm.message.value = document.postForm.message.value.replace(/\[url=(.)+\] \[\/url\]/,'');
}
// Add avatar to posters mini profile..
if(document.location.href.match('action=display'))
{
var avPost = document.getElementsByTagName('font');
for(a=0; a<avPost.length; a++)
{
if(avPost[a].innerHTML.match('- google_ad_section_start -') && avPost[a].getElementsByTagName('a').length > 0)
{
var newAvatar = avPost[a].innerHTML.split('"')[1];
var avPostTR = avPost[a].parentNode;
while(avPostTR.parentNode.firstChild.width != '20%')
{
avPostTR = avPostTR.parentNode;
}
avPostTR = avPostTR.parentNode.firstChild.getElementsByTagName('center')[0];
var newAv = new Image();
newAv.src = newAvatar;
avPostTR.insertBefore(newAv,avPostTR.firstChild.nextSibling);
avPostTR.insertBefore(document.createElement('BR'),avPostTR.firstChild.nextSibling);
}}}
// -->
</script>