|
Post by Wormopolis on Jun 10, 2010 19:46:06 GMT -8
<script type="text/javascript"> <!-- // Avatar Gallery with categories v1.0 // By Wormopolis - www.wormocodes.com // request by rhondairv // do not repost- keep header intact
var avCats=[ //add in Categories Here ["funny","Funny Stuff"], //catID, description ["cosmic","Oddities"], ["dog","Doggies!"], ["cat","Kittehs!"], ["smiles","Smiley Faces"], ["worms","Everyone likes Worms"] //no comma last line! ];
var avList=[ ["poodle","http://www.freedigitalphotos.net/images/photos/cane.jpg","dog"], //avatar name, url, category(s) it belongs in ["blacklab","http://www.freedigitalphotos.net/images/photos/virgil_3.jpg","dog"], ["grumpydog","http://www.freedigitalphotos.net/images/photos/dog_portraits_028.JPG","dog,funny"], ["camokitteh","http://www.freedigitalphotos.net/images/photos/Camouflage_kitten.JPG","cat,funny"], ["greyNwhiteCAT","http://www.freedigitalphotos.net/images/photos/DSC_2127.jpg","cat"], ["cow","http://www.freedigitalphotos.net/images/photos/Cow0003.jpg","funny"], ["bluething","http://www.freedigitalphotos.net/images/photos/246_1.jpg","cosmic"], ["dancingGirls","http://www.freedigitalphotos.net/images/photos/28_2.jpg","cosmic,funny"], ["hookworm","http://comps.fotosearch.com/comp/ARP/ARP103/worm_~Worm.jpg","worms,funny"], ["appleworm","http://comps.fotosearch.com/comp/UNZ/UNZ216/worm-apple_~u19224929.jpg","worms"], ["gangster","http://www.33smiley.com/smiley5/baddies/14.gif","smiles"], ["package","http://www.33smiley.com/smiley/work/11.gif","smiles"] //no comma last line! ];
// NO NEED TO EDIT BELOW (unless you know what you are doing)
if (document.modifyForm) { //capture exiting avatar data if possible oldAvURL=document.modifyForm.avatarurl.value; oldAvH=document.modifyForm.avatarheight.value; oldAvW=document.modifyForm.avatarwidth.value;
// on with it... plcholder=document.modifyForm.avatar.parentNode.parentNode.parentNode; plcholder.style.display = plcholder.nextSibling.style.display = plcholder.nextSibling.nextSibling.style.display = plcholder.nextSibling.nextSibling.nextSibling.style.display = 'none'; avGalDv=document.createElement('div'); avGalDv.id='AVS_DIV'; avGalDv.style.width='400'; avGalDv.style.height='200'; avGalDv.style.border="#FFFFFF solid 1px"; avGalDv.style.backgroundColor="000000"; nwAvTbl=document.createElement('table'); nwAvTbl.width='100%'; nwAvTbl.insertRow(0); nwAvTbl.rows[0].insertCell(0); nwAvTbl.rows[0].insertCell(0); nwAvTbl.rows[0].cells[0].width='50%'; nwAvTbl.rows[0].cells[1].width='50%'; nwAvTbl.rows[0].cells[0].height=nwAvTbl.rows[0].cells[1].height='120px'; nwAvTbl.rows[0].cells[0].align=nwAvTbl.rows[0].cells[1].align='center'; nwAvTbl.rows[0].cells[0].align=nwAvTbl.rows[0].cells[1].vAlign='middle'; avImg=nwAvTbl.rows[0].cells[1].appendChild(document.createElement('img')); avImg.id="AVS_image"; avImg.src="http://s4.images.proboards.com/avatars/blank.gif"; avImg.width=avImg.height='100'; nwAvTbl.rows[0].cells[1].appendChild(document.createElement('br')); tmpfnt=nwAvTbl.rows[0].cells[1].appendChild(document.createElement('font')); tmpfnt.style.display='none'; tmpfnt.innerHTML="(shown at <span id='AVS_iw'>100</span>x<span id='AVS_ih'>100</span>)"; nwAvTbl.insertRow(-1); nwAvTbl.rows[1].insertCell(0); nwAvTbl.rows[1].cells[0].colSpan=2; tmp=document.createElement('input'); tmp.id='AVS_aw'; tmp.style.width='40'; nwAvTbl.rows[1].cells[0].appendChild(document.createTextNode('Width: ')); nwAvTbl.rows[1].cells[0].appendChild(tmp); nwAvTbl.rows[1].cells[0].appendChild(document.createTextNode(' ')); tmp=document.createElement('input'); tmp.id='AVS_ah'; tmp.style.width='40'; nwAvTbl.rows[1].cells[0].appendChild(document.createTextNode('Height: ')); nwAvTbl.rows[1].cells[0].appendChild(tmp); tmp=document.createElement('input'); tmp.type='button'; tmp.value='check'; tmp.id='AVS_chk'; tmp.style.width='50'; tmp.style.marginLeft='150'; tmp.keepit='AVS_default'; tmp.onclick=function() {updateExample(this.id); }; nwAvTbl.rows[1].cells[0].appendChild(tmp); nwAvTbl.rows[1].cells[0].appendChild(document.createElement('br')); nwAvTbl.rows[1].cells[0].appendChild(document.createTextNode('Or input your own URL: ')); tmp=document.createElement('input'); tmp.id='AVS_custURL'; tmp.style.width='250'; nwAvTbl.rows[1].cells[0].appendChild(tmp);
avGalDv.appendChild(nwAvTbl); nwrw=plcholder.parentNode.insertRow(plcholder.rowIndex); nwcl=nwrw.insertCell(0); nwcl.colSpan=3; nwcl.align='center'; nwcl.appendChild(avGalDv); document.getElementById('AVS_custURL').value=oldAvURL; document.getElementById('AVS_ah').value=oldAvH; document.getElementById('AVS_aw').value=oldAvW;
// build drop downs
function getSelector(nm) { potentials=document.getElementById('AVS_DIV').getElementsByTagName('select'); for (ss=1; ss<potentials.length; ss++) { if (potentials[ss].id!='AVS_'+nm) potentials[ss].style.display='none'; else potentials[ss].style.display=''; } } avTemplate=document.createElement('select');
catSelect=document.createElement('select'); tmp=document.createElement('option'); tmp.value="default"; tmp.innerHTML="default PB avatars"; catSelect.appendChild(tmp);
// get the default avs defAvs=avTemplate.cloneNode(true); defAvs.id="AVS_default"; for (da=0; da<modifyForm.avatar.options.length; da++) { tmp=document.createElement('option'); tmp.value="http://s4.images.proboards.com/avatars/"+modifyForm.avatar.options[da].value+'.gif'; tmp.innerHTML=modifyForm.avatar.options[da].value; defAvs.appendChild(tmp); }
function updateExample(srcid) { if (srcid!='AVS_chk') { document.getElementById('AVS_image').src=document.getElementById(srcid).value; document.getElementById('AVS_chk').keepit=srcid; } else { if(document.getElementById('AVS_custURL').value) { document.getElementById('AVS_image').src=document.getElementById('AVS_custURL').value; } else { backupplan=document.getElementById('AVS_chk').keepit; document.getElementById('AVS_image').src=document.getElementById(backupplan).value; } } tmpw=(document.getElementById('AVS_aw').value && parseInt(document.getElementById('AVS_aw').value)<=100 ? parseInt(document.getElementById('AVS_aw').value) : 100); tmph=(document.getElementById('AVS_ah').value && parseInt(document.getElementById('AVS_ah').value)<=100 ? parseInt(document.getElementById('AVS_ah').value) : 100); document.getElementById('AVS_image').width = document.getElementById('AVS_iw').innerHTML= tmpw; document.getElementById('AVS_image').height = document.getElementById('AVS_ih').innerHTML = tmph; document.getElementById('AVS_image').nextSibling.nextSibling.style.display=''; if(document.getElementById('AVS_image').src.match(/blank\.gif/)) document.getElementById('AVS_image').nextSibling.nextSibling.style.display='none'; }
updateExample('AVS_chk');
defAvs.onchange=function() {updateExample(this.id); }; nwAvTbl.rows[0].cells[0].appendChild(document.createElement('br')); nwAvTbl.rows[0].cells[0].appendChild(document.createTextNode('Category:')); nwAvTbl.rows[0].cells[0].appendChild(document.createElement('br')); nwAvTbl.rows[0].cells[0].appendChild(catSelect); nwAvTbl.rows[0].cells[0].appendChild(document.createElement('br')); nwAvTbl.rows[0].cells[0].appendChild(document.createElement('br')); nwAvTbl.rows[0].cells[0].appendChild(defAvs); nwrw=nwAvTbl.insertRow(0); nwcl=nwrw.insertCell(0); nwcl.colSpan=2; nwcl.align='center'; nwfnt=nwcl.appendChild(document.createElement('font')); nwfnt.size='3'; nwfnt.appendChild(document.createTextNode('Avatar Gallery'));
// get the rest of the categories
for (cc=0; cc<avCats.length; cc++) { tmp=document.createElement('option'); tmp.value=avCats[cc][0]; tmp.innerHTML=avCats[cc][1]; catSelect.appendChild(tmp); tmp2=avTemplate.cloneNode(true); tmp2.id="AVS_"+avCats[cc][0]; tmp2.onchange=function() {updateExample(this.id);}; tmp2.style.display='none'; tmp3=document.createElement('option'); tmp3.value="http://s4.images.proboards.com/avatars/blank.gif"; tmp3.innerHTML=''; tmp2.appendChild(tmp3); nwAvTbl.rows[1].cells[0].appendChild(tmp2); } catSelect.onchange=function() {getSelector(this.value);};
// create avs into assigned drop downs for (aa=0; aa<avList.length; aa++) { namehold=avList[aa][0]; urlhold=avList[aa][1]; cathold=avList[aa][2].split(','); for (bb=0; bb<cathold.length; bb++) { if (document.getElementById('AVS_'+cathold[bb])) { tmp=document.createElement('option'); tmp.value=urlhold; tmp.innerHTML=namehold; document.getElementById('AVS_'+cathold[bb]).appendChild(tmp); } } }
//lastly, attach function to submit event so it saves choice function updateAv() { document.modifyForm.avatarurl.value=document.getElementById('AVS_image').src; document.modifyForm.avatarheight.value=document.getElementById('AVS_ah').value; document.modifyForm.avatarwidth.value=document.getElementById('AVS_aw').value; }
if (document.addEventListener) { document.modifyForm.addEventListener('submit',updateAv,'true'); } else { document.modifyForm.attachEvent('onsubmit',updateAv); }
}
// --> </script>
main footer
|
|
|
Post by Wormopolis on Jun 10, 2010 22:18:51 GMT -8
I can add in a variable to discard the default PB avatars.. I left them in in case someone wanted to use one of them.
can you post what you edited (JUST the edited part, I dont need the whole code) so I can see how you did the array?
what "check" is for, is when you type in a custom URL, there is no other way I can figure to make it show an example. you can also click check if you change the dimensions, and it wil resize the example to the new dimensions (IF there isnt a custom URL typed in).
ranks isnt something easily obtained since its not a normal PB variable one can reference. its also not on the page anywhere. if you mean POST ranks, then I suppose an array could be added with how many posts can access certain categories, but keep in mind all someone has to do is get the URL of any avatar and put it in the custom box and presto they have that avatar now too.
|
|
|
Post by rhondairv on Jun 10, 2010 22:40:43 GMT -8
The variable would be nice Ok, I get about ''check'' now. When i say rank i mean like avatars that are just for admins or certain names i enter in the code. var avCats=[ //add in Categories Here ["Hookup","Hookup Avatars"], //catID, description ["Girly","Girly Avatars"] //no comma last line! ];
var avList=[ ["Bead Queen","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BeadQueen.gif","Hookup,Hookup Avatars"], //avatar name, url, category(s) it belongs in ["Hookie Fix","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/hookiefix.gif","Hookup,Hookup Avatars"], ["Sweet As Honey Hookies","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/sweethookies.gif","Hookup"], ["Healthy Hookies","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Healthy-Hookies.gif","Hookup"], ["Sad Spike","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/sadspike-1.gif","Hookup,Hookup Avatars"], ["Smile","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/smileteeth.gif","Hookup Avatars"], ["Snail Greeting","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/hookie-hi-flowers.gif","Hookup,Hookup Avatars"], ["Hookup Heart","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/HookupHeart.gif","Hookup,Hookup Avatars"], ["Unique Hookies","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/unique.gif","Hookup,Hookup Avatars"], ["SquarePants Hookie","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/mphav.gif","Hookup,Hookup Avatars"], ["Talented Hookies","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/talented.gif","Hookup,Hookup Avatars"], ["Tongue","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/ohyeah.gif","Hookup,Hookup Avatars"], ["Social Night","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/SocialNight.gif","Hookup,Hookup Avatars"], //avatar name, url, category(s) it belongs in ["Need New Posts","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/nonewposts.gif","Hookup,Hookup Avatars"], ["Turbo Chanrged","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/turbocharged.gif","Hookup,Hookup Avatars"], ["Hidding Hookie","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/hidding.gif","Hookup,Hookup Avatars"], ["Black Cat","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/HEY.gif","Hookup,Hookup Avatars"], ["Lurker","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/lurker.gif","Hookup,Hookup Avatars"], ["Serenity","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/hookupdol.gif","Hookup,Hookup Avatars"], ["All Teeth","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/happymouth.gif","Hookup,Hookup Avatars"], ["Love Socials","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/LovinHook.gif","Hookup,Hookup Avatars"], ["Too Long","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/2long.gif","Hookup,Hookup Avatars"], ["Owl Greeting","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Jumping-hookies.gif","Hookup,Hookup Avatars"], ["Leaving Hookup","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/LeavinHookup.gif","Hookup,Hookup Avatars"], ["Gimme More","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/MorePosts.gif","Hookup,Hookup Avatars"], ["Chatty","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Shout.gif","Hookup,Hookup Avatars"], ["Wormy","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Snakehookies.gif","Hookup,Hookup Avatars"], ["Cow Dance","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Happy.gif","Hookup,Hookup Avatars"], ["Sweet Mouse","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/HookieFriends.gif","Hookup,Hookup Avatars"], ["At Work","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/PCHookup.gif","Hookup,Hookup Avatars"], ["Tiger Love","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Hookies2.gif","Hookup,Hookup Avatars"], ["The Buzz","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Buzz.gif","Hookup,Hookup Avatars"], ["Balloon Ride","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/HiHookies-1.gif","Hookup,Hookup Avatars"], ["Badge Fairy","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BadgeFairy.gif","Hookup,Hookup Avatars"], ["Hookup Cupid","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/HookupAddict.gif","Hookup,Hookup Avatars"], ["Badge Queen","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BadgeQueen.gif","Hookup,Hookup Avatars"], ["Badge Day","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BadgeDay-1.gif","Hookup,Hookup Avatars"], ["Hookup Bests","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/hOOKIESrbEST.gif","Hookup,Hookup Avatars"], ["Badge Day 2","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BadgeDay.gif","Hookup,Hookup Avatars"], ["Post To Post","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Swingin.gif","Hookup,Hookup Avatars"], ["Beezy","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BEEsy.gif","Hookup,Hookup Avatars"], ["Hangin With Hookies","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Hangin.gif","Hookup,Hookup Avatars"], ["Welcome To Hookup","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Welcome.gif","Hookup,Hookup Avatars"], ["Kissy","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/HookiesKiss.gif","Hookup,Hookup Avatars"], ["Smile Hookies","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/SMILE.gif","Hookup,Hookup Avatars"], ["Hookup Bests","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/hOOKIESrbEST.gif","Hookup,Hookup Avatars"], ["Star Kiss","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/MPH.gif","Hookup,Hookup Avatars"], ["Spring Hi","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/HiHookies.gif","Hookup,Hookup Avatars"], ["Monkey Kiss","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Hookies.gif","Hookup,Hookup Avatars"], ["I Bee At All Socials","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/SocialBee.gif","Hookup,Hookup Avatars"], ["Nakie Mini","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/sal-tease.gif","Hookup,Hookup Avatars"], ["Hookie Heart","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/hookiesyellowlove.gif","Hookup,Hookup Avatars"], ["Hookie Heart 2","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/hookiesgreenlove.gif","Hookup,Hookup Avatars"], ["Hookie Heart 3","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/HookieHeart.gif","Hookup,Hookup Avatars"], ["Hookup Rho","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/rhoavatar.png","Hookup,Hookup Avatars"], ["Hello Kitty","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Cartoony/__hello_kitty___.png","Girly"], ["Confused","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Cartoony/ME.png","Girly"], ["Socks","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Girls/strippedsocks.png","Girly"], ["Pink Daisy","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Girls/avatar_3502_copy.png","Girly"], ["Welcome","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Country/caq3ba.png","Girly"], ["Wishing Well","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Country/garqw.png","Girly"], ["Country Heart","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Country/heart.png","Girly"], ["Country Bear","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/Country/lovebear.png","Girly"]//no comma last line! //no comma last line! ];
|
|
|
Post by Wormopolis on Jun 10, 2010 22:59:52 GMT -8
so for example:
["Bead Queen","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BeadQueen.gif","Hookup,Hookup Avatars"], //avatar name, url, category(s) it belongs in
for the categories you want this avatar to show in, you have Hookup, Hookup Avatars
you ONLY need the id of the category. not both the id and the name. if you wanted this avatar to show in both the categories you made, you would put
["Bead Queen","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BeadQueen.gif","Hookup,Girly"], //avatar name, url, category(s) it belongs in
if you only wanted it in Hookup category
["Bead Queen","http://i153.photobucket.com/albums/s240/EmoteCrazy/PogoHookUp/Avatars/BeadQueen.gif","Hookup"], //avatar name, url, category(s) it belongs in
that make sense.
I also added in some onFocus() handlers so that if you click the check button and it puts in whatever image you have in the cutomURL field, you just have to click on the drop down again and it will put in whatever is selected in the dropdown again. if you focus on the URL field, it will replace it with that if its got a value (wont do anything if it is blank). hopefully that will reduce the confusion. If you change dimensions, clicking on the drop down will now resize the example avatar as well.
added in variable to keep/discard default avatars. I cant really do much about a drop down extending too far down... that I know of. I have to see if there is a way to set a maximim height on a drop down. I dont know if that is possible.
go back and edit your array again with correct categories, and I will see what I can do.
|
|