vForums Support Banner Image



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Database of Codes/Hacks/Mods :: View Topic - Avatar Anywhere
Printable View
Wrighty
Very Senior Member
*****

[Avatar]

Posts: 3,269
Status: Offline
Gender: Male
Joined: 16th Dec 2007
Reputation: 16%  



Avatar Anywhere (9th Mar 08 at 12:20am)
Preview

This code allows you to display the user's avatar anywhere that you so wish. It's rather awesome to be honest! Smiley

Global Header:

<script type="text/javascript">
/*Avatar Anywhere
Coded By Wrighty*/

var functions = {
    av: document.createElement('img'),
    save: function(prefix, item, place){
        if(get(place,'name')[0].value.match('{'+prefix+': (.+?)}')){
            get(place,'name')[0].value = get(place,'name')[0].value.replace(RegExp.$1, item);
        }else{
            get(place,'name')[0].value += '{'+prefix+': '+item+'}';
        }
    },
    load: function(prefix){
        if(vf_hiddenvars.match('{'+prefix+': (.+?)}')){
            return RegExp.$1.replace(/(\[|\])/g,'');
        }else{
            return '';
        }
    },
    build: function(){
        with(this.av){
            src = this.load('av-url');
            height = this.load('av-height');
            width = this.load('av-width');
        }
        get('av_hold','id').appendChild(this.av);
    }
}
</script>


Global Footer:
<script type="text/javascript">
/*Avatar Anywhere
Coded By Wrighty*/
if(location.href.match(/\/modify_profile\/user\/(.+?)($|\/$)/) && RegExp.$1 == vf_username){
    var f = document.profile_form
    if(document.addEventListener){
        f.addEventListener('submit', function(){ functions.save('av-url','['+get("avatar_url","name")[0].value+']','hidden'); functions.save('av-width', '['+get("avatar_width","name")[0].value+']', 'hidden'); functions.save('av-height', '['+get("avatar_height","name")[0].value+']', 'hidden');} , false);
    }else{
        f.attachEvent('onsubmit', function(){ functions.save('av-url','['+get("avatar_url","name")[0].value+']','hidden'); functions.save('av-width', '['+get("avatar_width","name")[0].value+']', 'hidden'); functions.save('av-height', '['+get("avatar_height","name")[0].value+']', 'hidden');});

    }
}
functions.build();
</script>



Now, to decide where to put the avatar, we use a simple 'div' with id: 'av_hold'. The code will then put the avatar in that div with the correct height and width too! Smiley

<div id='av_hold'></div>


Enjoy.
Back to Top - Link to Post - Last edit: 9th Mar 08 at 12:40am by Wrighty

Image
Darkmage
Senior Member
****
I will never be a MEMORY!!!

[Avatar]
I'm like a Ninja! I lurk in the shadows behind you, one swift attack will bring you down.

Posts: 1,719
Status: Offline
Gender: Male
Location: In the Shadows.
Age: 18
Joined: 25th Nov 2007
Reputation: 8%  



Re: Avatar Anywhere (9th Mar 08 at 12:32am)
You know its coming.....Were is the preview? Smiley
Back to Top - Link to Post


Image
Image
Image

Wrighty
Very Senior Member
*****

[Avatar]

Posts: 3,269
Status: Offline
Gender: Male
Joined: 16th Dec 2007
Reputation: 16%  



Re: Avatar Anywhere (9th Mar 08 at 12:36am)
>.< Fine...
Back to Top - Link to Post

Image
Darkmage
Senior Member
****
I will never be a MEMORY!!!

[Avatar]
I'm like a Ninja! I lurk in the shadows behind you, one swift attack will bring you down.

Posts: 1,719
Status: Offline
Gender: Male
Location: In the Shadows.
Age: 18
Joined: 25th Nov 2007
Reputation: 8%  



Re: Avatar Anywhere (9th Mar 08 at 12:39am)
<_> ^_-
Back to Top - Link to Post


Image
Image
Image

Wrighty
Very Senior Member
*****

[Avatar]

Posts: 3,269
Status: Offline
Gender: Male
Joined: 16th Dec 2007
Reputation: 16%  



Re: Avatar Anywhere (9th Mar 08 at 12:41am)
Added, not very good though... Smiley
Back to Top - Link to Post

Image
Dwight
Senior Member
****

[Avatar]
I'm an evil turkey!!!

Posts: 994
Status: Offline
Gender: Male
Location: Behind You
Age: 16
Joined: 21st Jan 2008
Reputation: 5%  



Re: Avatar Anywhere (9th Mar 08 at 12:44am)
wondering, this may sound a little weird but could it even be used an a place where you put in a url such as the on/off icon places?
Back to Top - Link to Post

Image
Image
Image
Wrighty
Very Senior Member
*****

[Avatar]

Posts: 3,269
Status: Offline
Gender: Male
Joined: 16th Dec 2007
Reputation: 16%  



Re: Avatar Anywhere (9th Mar 08 at 12:47am)
No, but a code could be made to use the avatar as an on/off icon! Smiley
Back to Top - Link to Post

Image
Dwight
Senior Member
****

[Avatar]
I'm an evil turkey!!!

Posts: 994
Status: Offline
Gender: Male
Location: Behind You
Age: 16
Joined: 21st Jan 2008
Reputation: 5%  



Re: Avatar Anywhere (9th Mar 08 at 12:55am)
no its ok, i was just wondering to what extent that it could be used.
Back to Top - Link to Post

Image
Image
Image
Darkmage
Senior Member
****
I will never be a MEMORY!!!

[Avatar]
I'm like a Ninja! I lurk in the shadows behind you, one swift attack will bring you down.

Posts: 1,719
Status: Offline
Gender: Male
Location: In the Shadows.
Age: 18
Joined: 25th Nov 2007
Reputation: 8%  



Re: Avatar Anywhere (9th Mar 08 at 2:05am)
it looks ok I guess, but pointless, you can just add Html Tags from Photobucket or image shack. and put it any were in the head/foot of any board, even the board Description. Smiley
Back to Top - Link to Post - Last edit: 9th Mar 08 at 2:06am by Darkmage


Image
Image
Image

Cryhavoc_
Full Member
***

Just do it.

Posts: 238
Status: Offline
Gender: Male
Location: The wrong way.
Age: 15
Joined: 3rd Jan 2008
Reputation: 0%  



Re: Avatar Anywhere (9th Mar 08 at 2:49am)
Wrighty has a new soulmate: hidden_vars.

Whens the wedding Wrighty boy? Smiley
Back to Top - Link to Post

Image

Fel!x
Full Member
***

[AVATAR]

Posts: 168
Status: Offline
Gender: Male
Location: Sydney
Age: 15
Joined: 1st Jan 2008
Reputation: 3%  



Re: Avatar Anywhere (9th Mar 08 at 6:16am)
 
it looks ok I guess, but pointless, you can just add Html Tags from Photobucket or image shack. and put it any were in the head/foot of any board, even the board Description. Smiley



But this code makes it so whoever is logged in's avatar appears, if you logged in you'd see your avatar in that place while I'd see mine. If you wanted everyone to see your avatar you could do what you said ;]


Nice code Wrighty, could come in handy very soon =]
Back to Top - Link to Post

Image
Wrighty
Very Senior Member
*****

[Avatar]

Posts: 3,269
Status: Offline
Gender: Male
Joined: 16th Dec 2007
Reputation: 16%  



Re: Avatar Anywhere (9th Mar 08 at 12:19pm)
 
Wrighty has a new soulmate: hidden_vars.

Whens the wedding Wrighty boy? Smiley



Tomorrow, you're the best man! Smiley


Thanks Fel!x
Back to Top - Link to Post

Image
Ash.
Full Member
***

[Avatar]

Posts: 477
Status: Offline
Joined: 5th Jan 2008
Reputation: 11%  



Re: Avatar Anywhere (28th Jul 08 at 1:30am)
Nice concept of a code. o_o. I can see people using JavaScript to make their own Welcome Table and using this to be a part of it. o_o.

Bloody brilliant, mate.
Back to Top - Link to Post

Image

Free Quality Avatars! Hotlinking Allowed!
Darkmage
Senior Member
****
I will never be a MEMORY!!!

[Avatar]
I'm like a Ninja! I lurk in the shadows behind you, one swift attack will bring you down.

Posts: 1,719
Status: Offline
Gender: Male
Location: In the Shadows.
Age: 18
Joined: 25th Nov 2007
Reputation: 8%  



Re: Avatar Anywhere (28th Jul 08 at 5:12am)
 
 
it looks ok I guess, but pointless, you can just add Html Tags from Photobucket or image shack. and put it any were in the head/foot of any board, even the board Description. Smiley



But this code makes it so whoever is logged in's avatar appears, if you logged in you'd see your avatar in that place while I'd see mine. If you wanted everyone to see your avatar you could do what you said ;]


Nice code Wrighty, could come in handy very soon =]



For that point, then that's alright.
Back to Top - Link to Post


Image
Image
Image

Printable View

All times are GMT+1 :: The current time is 10:58am
Page generated in 0.7157 seconds
with 22 Database Queries and 17 cache files
This Forum is Powered By vForums
Create a Forum for Free