# Greasemonkey script to add your own SDMB avatars

**URL:** <https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062>\
**Category:** About This Message Board\
**Created:** [September 29, 2011, 8:54pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062 "2011-09-29T20:54:41Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![Polerius](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Polerius](https://boards.straightdope.com/u/Polerius)\
**Post date:** [September 29, 2011, 8:54pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/1 "2011-09-29T20:54:41Z")

</div>

During recent discussions about whether or not to have SDMB avatars, I quickly put together a Greasemonkey script to enable you to assign an avatar to yourself and others.

See [this link](http://i.imgur.com/Irim2.jpg) for an example of how it looks.

The script is listed below. You need to edit the information in the ‘var avatars = {’ section to suit your needs.

If people post in this thread what image they want as their avatar, we can all use them.

```auto

// ==UserScript==
// @name SDMB Avatars
// @namespace Polerius
// @description SDMB Avatars
// @include http://boards.straightdope.com/sdmb/*
// ==/UserScript==

(function() 
 {
     var avatars = {
         'Polerius' : 'http://upload.wikimedia.org/wikipedia/commons/7/7a/1859-Martinique.web.jpg',
         'someotherusername' : 'http://url.of/avatar.jpg'
       };

     var allNameHeaders = document.getElementsByClassName('bigusername');

     for (var i = 0; i < allNameHeaders.length; i++)
     {
        var username = allNameHeaders*.innerHTML;

        if (username in avatars)
        {
          var img_src = avatars[username];
          var img_html = "<img src=\"" + img_src + "\" width=\"50px\" height=\"50px\" style=\"float: left; margin-right: 5px; border-width:0;\">";
          allNameHeaders*.innerHTML = img_html + allNameHeaders*.innerHTML;
        }
     }

 })();

```

---

<div class="post-metadata">

**Author:** ![Bosda\_Di\_Chi\_of\_Tricor](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bosda_di_chi_of_tricor/32/16845_2.png) [@Bosda\_Di\_Chi\_of\_Tricor](https://boards.straightdope.com/u/Bosda_Di_Chi_of_Tricor)\
**Post date:** [September 29, 2011, 9:05pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/2 "2011-09-29T21:05:46Z")

</div>

All of which means nothing to me.

---

<div class="post-metadata">

**Author:** ![Polerius](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Polerius](https://boards.straightdope.com/u/Polerius)\
**Post date:** [September 29, 2011, 9:10pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/3 "2011-09-29T21:10:33Z")

</div>

> [@Bosda\_Di\_Chi\_of\_Tricor](#):
>
> All of which means nothing to me.

Seriously, what is the purpose of you posting the above? What do you think you have accomplished by posting it?

---

<div class="post-metadata">

**Author:** ![Bosda\_Di\_Chi\_of\_Tricor](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/bosda_di_chi_of_tricor/32/16845_2.png) [@Bosda\_Di\_Chi\_of\_Tricor](https://boards.straightdope.com/u/Bosda_Di_Chi_of_Tricor)\
**Post date:** [September 29, 2011, 9:19pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/4 "2011-09-29T21:19:47Z")

</div>

> [@Polerius](#):
>
> Seriously, what is the purpose of you posting the above? What do you think you have accomplished by posting it?

I have pointed out that–[LIST=A]  
[li]I do not understand code.[/li][li]Others do not understand code[/li][li]You did a poor job explaining what this is & how to use it[/li][li]You have not indicated that this is official[/li][/LIST]

---

<div class="post-metadata">

**Author:** ![Skald\_the\_Rhymer](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Skald\_the\_Rhymer](https://boards.straightdope.com/u/Skald_the_Rhymer)\
**Post date:** [September 29, 2011, 9:22pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/5 "2011-09-29T21:22:55Z")

</div>

> [@Bosda\_Di\_Chi\_of\_Tricor](#):
>
> I have pointed out that–[LIST=A]  
> [li]I do not understand code.[/li][li]Others do not understand code[/li][li]You did a poor job explaining what this is & how to use it[/li][li]You have not indicated that this is official[/li][/LIST]

This is all true. I don’t do code, and even if I did I’d be wary of using code on the Dope that the admins hadn’t authorized. I don’t know enough about the issue to judge the risks of poor performance.

---

<div class="post-metadata">

**Author:** ![Polerius](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Polerius](https://boards.straightdope.com/u/Polerius)\
**Post date:** [September 29, 2011, 9:32pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/6 "2011-09-29T21:32:02Z")

</div>

> [@Bosda\_Di\_Chi\_of\_Tricor](#):
>
> I have pointed out that–[LIST=A]  
> [li]I do not understand code.[/li][li]Others do not understand code[/li][li]You did a poor job explaining what this is & how to use it[/li][li]You have not indicated that this is official[/li][/LIST]

If you don’t already know what a Greasemonkey script is, I can’t help you within the bounds of a simple OP. Just simply ignore this thread.

For those who do already know what a Greasemonkey script is, there is sufficient information in the OP for them to figure out what to do. This thread is meant for them.

As for “You have not indicated that this is official”, this is of course ridiculous, since as we all know the stance of the SDMB is to not officially support avatars. This is simply a DIY method of adding avatars, for people who know what a Greasemonkey script is and how to use it.

---

<div class="post-metadata">

**Author:** ![Polerius](https://avatars.discourse-cdn.com/v4/letter/p/d78d45/32.png) [@Polerius](https://boards.straightdope.com/u/Polerius)\
**Post date:** [September 29, 2011, 9:39pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/7 "2011-09-29T21:39:17Z")

</div>

> [@Skald\_the\_Rhymer](#):
>
> I’d be wary of using code on the Dope that the admins hadn’t authorized.

FYI, the code is not running on the Dope’s servers, it’s running in your browser only.

---

<div class="post-metadata">

**Author:** ![Lestrade](https://avatars.discourse-cdn.com/v4/letter/l/94ad74/32.png) [@Lestrade](https://boards.straightdope.com/u/Lestrade)\
**Post date:** [September 29, 2011, 10:33pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/8 "2011-09-29T22:33:05Z")

</div>

Very nice. Do you have a setting for avatars with more avatars?

Have you seen wierdaaron’s badger and optifixer scripts? He never approved the scripts for release, I think he lost interest. I sent him a PM, asking him to agree to releasing them.

---

<div class="post-metadata">

**Author:** ![Crazyhorse](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crazyhorse/32/31_2.png) [@Crazyhorse](https://boards.straightdope.com/u/Crazyhorse)\
**Post date:** [September 29, 2011, 10:55pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/9 "2011-09-29T22:55:25Z")

</div>

Thank you for this, but where would the central database of avatars be kept? In this thread?

Could this be tied into something like the [SDMB portrait gallery](http://www.nouilles.info/sdpix/index.html) so that if a given username already has an image hosted there it displays it with no other advance information being entered to the GM script?

I don’t foresee huge numbers of people flocking to this but if it had even 100+ names eventually it could be difficult for everyone to maintain their own accurate, up to date, list of locations of avatars all over the web. A central spot to host the images or at least the list of usernames / image paths would be even one more step closer to having it built right in to the board software.

---

<div class="post-metadata">

**Author:** ![tavalla](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/tavalla/32/89_2.png) [@tavalla](https://boards.straightdope.com/u/tavalla)\
**Post date:** [September 29, 2011, 11:23pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/10 "2011-09-29T23:23:14Z")

</div>

I don’t have particular skills with Greasemonkey but, from the looks of it, the user assigns whatever avatar they want to a username. So, I could pick any online image and give the script its URL, and assign that to a user. So, if I want **Polerius** to have a particular image (let’s say [this one](http://www.nckas.org/images/objects/polaris.jpg) of Polaris, since that’s pretty close to Polerius), any of Polerius’s posts will show with that Polaris pic as avatar.

You’ll have to get someone who knows Greasemonkey to explain how it handles sizing and the like, though.

---

<div class="post-metadata">

**Author:** ![Fenris](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/fenris/32/498_2.png) [@Fenris](https://boards.straightdope.com/u/Fenris)\
**Post date:** [September 29, 2011, 11:28pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/11 "2011-09-29T23:28:38Z")

</div>

> [@Bosda\_Di\_Chi\_of\_Tricor](#):
>
> All of which means nothing to me.

Dear Bosda,

You are cordially invited to a [pit thread](http://boards.straightdope.com/sdmb/showthread.php?t=626146) on the truculent, intemperate tone of your response to Polerius’s efforts as well as related issues.

* * *

Polerius, this looks cool. Thanks for the effort! 🙂

---

<div class="post-metadata">

**Author:** ![Joey\_P](https://avatars.discourse-cdn.com/v4/letter/j/919ad9/32.png) [@Joey\_P](https://boards.straightdope.com/u/Joey_P)\
**Post date:** [September 29, 2011, 11:41pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/12 "2011-09-29T23:41:03Z")

</div>

It took me a second to realize why Bosda got pitted for the comment he made at the beginning of the thread but I got it now…

Having said that I would still like to know how to implement this. I know we discussed doing this a while back and someone mentioned linking it to the gallery upon which a few people said they weren’t all that happy about that. Personally I pull up the gallery page all the time just to put a face with the name, I think it would be nice. OTOH, I’d hate to see people pull their pictures out of the gallery just because they don’t want them to show up as avatars. Perhaps (and I have no idea if this is possible) Arnold could put some sort of a marker on the page of people that want to opt out/in and the script could look for that marker and decide what to do based on that.

---

<div class="post-metadata">

**Author:** ![Skald\_the\_Rhymer](https://avatars.discourse-cdn.com/v4/letter/s/ecccb3/32.png) [@Skald\_the\_Rhymer](https://boards.straightdope.com/u/Skald_the_Rhymer)\
**Post date:** [September 29, 2011, 11:43pm UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/13 "2011-09-29T23:43:58Z")

</div>

> [@Polerius](#):
>
> FYI, the code is not running on the Dope’s servers, it’s running in your browser only.

Thanks for clearing that up. Obviously I know nothing of Greasemonkey.

---

<div class="post-metadata">

**Author:** ![Arnold\_Winkelried](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Arnold\_Winkelried](https://boards.straightdope.com/u/Arnold_Winkelried)\
**Post date:** [September 30, 2011, 1:13am UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/14 "2011-09-30T01:13:28Z")

</div>

> [@Crazyhorse](#):
>
> Could this be tied into something like the [SDMB portrait gallery](http://www.nouilles.info/sdpix/index.html) so that if a given username already has an image hosted there it displays it with no other advance information being entered to the GM script?

Remembering a fairly recent similar proposal, I (the gallery maintainer) would ask that this be implemented only for people in the gallery who consent to this type of use for their gallery photo.

---

<div class="post-metadata">

**Author:** ![AClockworkMelon](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aclockworkmelon/32/10803_2.png) [@AClockworkMelon](https://boards.straightdope.com/u/AClockworkMelon)\
**Post date:** [September 30, 2011, 1:18am UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/15 "2011-09-30T01:18:29Z")

</div>

Why is consent needed or even requested again? This isn’t anything official. It’s as if I went onto the gallery, printed out someone’s picture and then held it over the monitor whenever I saw that that person had posted (stolen analogy).

---

<div class="post-metadata">

**Author:** ![Crazyhorse](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crazyhorse/32/31_2.png) [@Crazyhorse](https://boards.straightdope.com/u/Crazyhorse)\
**Post date:** [September 30, 2011, 1:18am UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/16 "2011-09-30T01:18:37Z")

</div>

> [@Arnold\_Winkelried](#):
>
> Remembering a fairly recent similar proposal, I (the gallery maintainer) would ask that this be implemented only for people in the gallery who consent to this type of use for their gallery photo.

Absolutely. It should be an opt-in thing where nobody is added to the avatar list by default simply by posting an image to your gallery. Maybe a checkbox or something at the gallery side? (not that I would wish feature requests on you, but that might be one way)

---

<div class="post-metadata">

**Author:** ![Crazyhorse](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/crazyhorse/32/31_2.png) [@Crazyhorse](https://boards.straightdope.com/u/Crazyhorse)\
**Post date:** [September 30, 2011, 1:19am UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/17 "2011-09-30T01:19:59Z")

</div>

> [@AClockworkMelon](#):
>
> Why is consent needed or even requested again? This isn’t anything official. It’s as if I went onto the gallery, printed out someone’s picture and then held it over the monitor whenever I saw that that person had posted (stolen analogy).

I think just as a matter of courtesy, and that it might prevent someone from posting an image to the gallery if that meant it would automatically become their avatar.

---

<div class="post-metadata">

**Author:** ![Arnold\_Winkelried](https://avatars.discourse-cdn.com/v4/letter/a/3d9bf3/32.png) [@Arnold\_Winkelried](https://boards.straightdope.com/u/Arnold_Winkelried)\
**Post date:** [September 30, 2011, 1:30am UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/18 "2011-09-30T01:30:05Z")

</div>

> [@AClockworkMelon](#):
>
> Why is consent needed or even requested again? This isn’t anything official. It’s as if I went onto the gallery, printed out someone’s picture and then held it over the monitor whenever I saw that that person had posted (stolen analogy).

Obviously, once something is posted on the internet anyone can copy it and/or use it in any way they want. But if the content owner asks you not to use their content in a particular way, wouldn’t the right thing be to abide by their request?

---

<div class="post-metadata">

**Author:** ![Musicat](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/musicat/32/20189_2.png) [@Musicat](https://boards.straightdope.com/u/Musicat)\
**Post date:** [September 30, 2011, 1:32am UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/19 "2011-09-30T01:32:52Z")

</div>

> [@Polerius](#):
>
> If you don’t already know what a Greasemonkey script is, I can’t help you within the bounds of a simple OP. Just simply ignore this thread.

No problem. Done.

---

<div class="post-metadata">

**Author:** ![AClockworkMelon](https://sea3.discourse-cdn.com/straightdope/user_avatar/boards.straightdope.com/aclockworkmelon/32/10803_2.png) [@AClockworkMelon](https://boards.straightdope.com/u/AClockworkMelon)\
**Post date:** [September 30, 2011, 1:33am UTC](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062/20 "2011-09-30T01:33:39Z")

</div>

> [@Arnold\_Winkelried](#):
>
> Obviously, once something is posted on the internet anyone can copy it and/or use it in any way they want. But if the content owner asks you not to use their content in a particular way, wouldn’t the right thing be to abide by their request?

That’s not what I’m talking about. I’m talking about why it’s ethically necessary to get their permission to begin with. It’s like sending a text to someone in my address book to ask for permission to use a picture of that person for my cell phone’s caller ID in case they feel violated (about something they wouldn’t be affected by at all, positively or negatively and really wouldn’t have had any way of learning about unless I had gone out of my way to tell them).

As has been said, there isn’t some central SDMB avatar database. The pictures you’re using are only on YOUR computer. If you’ve browsed the SDMB portrait gallery, those pictures are there anyway. They’re already there. The only difference is that now you’re choosing when you see them. You might as well get me to ask permission whenever I try to view them in each of the different internet browsers available because, after all, they weren’t approved for use with Google Chrome or whatever.

[Next page](https://boards.straightdope.com/t/greasemonkey-script-to-add-your-own-sdmb-avatars/598062.md?page=2)
