vForums Support Banner


Visit Base Classics - Gaming Chairs

 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Database of Codes/Hacks/Mods :: Avatar Anywhere - View Topic
Topic Rating: *****
Printable View
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Avatar Anywhere (8th Mar 08 at 11:20pm UTC)
Preview

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

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! {Smile}

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


Enjoy.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Avatar Anywhere (8th Mar 08 at 11:32pm UTC)
You know its coming.....Were is the preview? {Tongue Out}
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Avatar Anywhere (8th Mar 08 at 11:36pm UTC)
>.< Fine...
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Avatar Anywhere (8th Mar 08 at 11:39pm UTC)
<_> ^_-
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Avatar Anywhere (8th Mar 08 at 11:41pm UTC)
Added, not very good though... {Unsure}
dog199200
Guest
Re: Avatar Anywhere (8th Mar 08 at 11:44pm UTC)
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?
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Avatar Anywhere (8th Mar 08 at 11:47pm UTC)
No, but a code could be made to use the avatar as an on/off icon! {Tongue Out}
dog199200
Guest
Re: Avatar Anywhere (8th Mar 08 at 11:55pm UTC)
no its ok, i was just wondering to what extent that it could be used.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Avatar Anywhere (9th Mar 08 at 1:05am UTC)
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. {Tongue Out}
Cryhavoc_
Full Member
***

Just do it.

Posts: 238
Status: Offline
Gender: Male
Location: The wrong way.
Age: 32
Joined:  
Reputation: 0%  


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

Whens the wedding Wrighty boy? {Tongue Out}

Image

Fel!x
Full Member
***

[AVATAR]

Posts: 171
Status: Offline
Gender: Male
Location: Sydney
Age: 31
Joined:  
Reputation: 3%  


pmmsn
Re: Avatar Anywhere (9th Mar 08 at 5:16am UTC)
 
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. {Tongue Out}


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 =]

Image
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Avatar Anywhere (9th Mar 08 at 11:19am UTC)
 
Wrighty has a new soulmate: hidden_vars.

Whens the wedding Wrighty boy? {Tongue Out}


Tomorrow, you're the best man! {Smile}


Thanks Fel!x
ashkir
Full Member
***

[Avatar]

Posts: 1,159
Status: Offline
Gender: Male
Location: Cali!
Age: 35
Joined:  
Reputation: 42%  


pmtwitterskypemsnyahoo
Re: Avatar Anywhere (28th Jul 08 at 12:30am UTC)
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.
Nick
Very Senior Member
*****

[Avatar]

Posts: 3,012
Status: Offline
Gender: Male
Location: vForums
Age: 34
Joined:  
Reputation: 62%  


pmwww
Re: Avatar Anywhere (28th Jul 08 at 4:12am UTC)
 
 
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. {Tongue Out}


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.
 Printable View

All times are GMT+0 :: The current time is 7:40pm
Page generated in 1.2157 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums