|
Post by Wormopolis on Oct 30, 2011 19:17:35 GMT -8
browsers tested: IE and FF placement: global footer
strips PB size limitations off of avatars and applies a new restriction/
<script type="text/javascript"> <!-- // Avatar Resize v1.51 // By Wormopolis - www.wormocodes.com // Keep header intact - do not repost // Original concept by California
var maxAvHeight=110; var maxAvWidth=110;
// as well as....
var membergroupsGetSpecialTreatment=true; //set true if you want certain member groups to have custom sizes
var membergroupAvSizeArray=new Array(); membergroupAvSizeArray[1]=[200,200]; //membergroupAvSizeArray[membergroup ID]=[max Height,max Width] membergroupAvSizeArray[2]=[150,150]; membergroupAvSizeArray[3]=[120,120];
function avResize(pic, amxh, amxw) { if (pic.height > amxh) {pic.width=pic.style.width = (pic.width * amxh/ pic.height); pic.height=pic.style.height=amxh;} if (pic.width> amxw) {pic.height=pic.style.height = (pic.height * amxw/ pic.width); pic.width=pic.style.width=amxw;} }
for (avpic=document.getElementsByTagName('img'), aa=0; aa<avpic.length; aa++) { if (avpic[aa].alt=='[avatar]') { var mxw=maxAvWidth; var mxh=maxAvHeight; if (membergroupsGetSpecialTreatment) { var mpcell=avpic[aa].parentNode.parentNode; if (mpcell.getElementsByTagName('b')[0] && mpcell.getElementsByTagName('b')[0].firstChild && mpcell.getElementsByTagName('b')[0].firstChild.className) { var grid=mpcell.getElementsByTagName('b')[0].firstChild.className.match(/group(\d+)/)[1]; if (grid && membergroupAvSizeArray[grid]) { mxh=membergroupAvSizeArray[grid][0]; mxw=membergroupAvSizeArray[grid][1];} } } nwav=document.createElement('span'); nwav.innerHTML='<img onload="avResize(this,'+ mxh + ',' + mxw +')" alt="[avatar]" src="' + avpic[aa].src + '">'; avpic[aa].parentNode.replaceChild(nwav.firstChild, avpic[aa]); } }
// --> </script>
|
|
|
Post by Wormopolis on Feb 6, 2012 20:30:24 GMT -8
version update 1.5: added in ablility to have certain usergroups have different max values
|
|
|
Post by Wormopolis on May 12, 2012 20:49:06 GMT -8
version update 1.51: had it replace with an image instead of a span with an image.
|
|