42

Screenshot / Code Snippet

chat room signatures with pronouns

About

It's hard to miss these days - the Code of Conduct is about to change. It will emphasize the importance of using the correct pronoun when referring to a user in third person. This most often comes up in chat, and some users already have information about which pronouns to use in the 'about' field in their chat profile, especially when that is not already clear from their username and/or avatar. Version 2.0 of the script performs the same feat on Q&A pages, but uses the Q&A profile instead.

In the Teachers' Lounge, an idea was proposed to pull that information from the user profile into the chatroom itself through a userscript. Stack Exchange Chat hasn't received updates in quite a while, so it isn't likely to be implemented soon. A userscript like this is the next best thing.

Installation / configuration

It's a userscript which means you need a userscript manager installed in your browser if you don't have one already. Just Google for Violentmonkey or Tampermonkey, how to install them depends on your browser.

The script itself can be installed via this link; source code can be found here.

After installation, you can reload this very page and check my usercard to verify if the script has been installed:

usercard with 'Script successfully installed' message

To edit your chat profile to add your own pronouns, go to chat, click your username in the top bar and then the edit link for the 'about' field:
chat profile with edit link
Editing your Q&A profile works similarly, but you can also click this link, change your profile and click "Save and copy changes to all public communities".

The script looks (case-insensitive) for the following ways of specifying pronouns:

  • A link to Pronoun Island, e.g. 'http://my.pronoun.is/he'
  • An explicit specification starting with 'Pronouns:' and ending with a period, newline, or just the end of the text, e.g. 'Pronouns: they/them.'
  • Pronouns joined by forward slashes, e.g. 'she/her'; a full list of supported pronouns can be found here which is sourced from Pronoun Island. If your pronouns aren't in the list, feel free to mention them here or make a pull request. Do note that some of the pronouns listed here are likely to yield false positives because they're specialized terminology (e.g. vi/vim).

Platform

Tested with Violentmonkey in Firefox and Tampermonkey in Chrome on macOS, but it's likely to work on all browsers and platforms. (Please let me know if it doesn't!)

Contact

Post a comment or answer here, or create an issue/pull request on GitHub.

19
  • 2
    Love the idea of this tool! I had already added my pronouns via a link to pronoun.is in my 'about' ("Clearly a dragon. my.pronoun.is/she ") a little while ago. Might it be an idea to add functionality to support that link specifically?
    – Elva
    Commented Oct 3, 2019 at 14:33
  • Thank you, that's a good idea (I think somebody mentioned it in chat as well), I'll have a look.
    – Glorfindel
    Commented Oct 3, 2019 at 14:38
  • 1
    For those of us using GreaseMonkey, we can replace GM_addStyle with greasemonkey.win-start.de/patterns/add-css.html and we'll need to add an @require for jquery.
    – Matt Ellen
    Commented Oct 3, 2019 at 15:23
  • @Elva this is now supported in v1.1. I did notice that when I click on such a link (added by the script) in chat, it disappears. I'm working on that ...
    – Glorfindel
    Commented Oct 3, 2019 at 20:45
  • @MattEllen I'd expect GreaseMonkey to support GM_addStyle; it does start with GM. If you have any idea how to fix it while keeping the script cross-user-manager-compatible, I'd really appreciate it.
    – Glorfindel
    Commented Oct 3, 2019 at 20:47
  • @glorfindel apparently the latest version of greasemonkey removed that function πŸ€·β€β™‚οΈ that's all the wiki says. I can have a look over the weekend. The thing I linked to might be cross browser compatibile
    – Matt Ellen
    Commented Oct 3, 2019 at 21:43
  • 1
    @Glorfindel When I click the "script can be installed via" link, Chrome tells me "Apps, extensions, and user scripts cannot be added from this website". Any suggestions? (and sorry if this is a novice question...) Commented Oct 4, 2019 at 0:51
  • 1
    @LarrySnyder610 you'd have to install a userscript manager first, like Tampermonkey or Violentmonkey. Most people coming here are familiar with userscripts and how they work, but it's definitely an oversight on my part and I'll update the installation instructions. Thank you!
    – Glorfindel
    Commented Oct 4, 2019 at 6:56
  • I downloaded this just now, it's my first userscript. On Firefox Mac with Tampermonkey, this doesn't seem to change anythingβ€”can I see a screenshot of what parts of the page should change? Commented Oct 5, 2019 at 3:39
  • Oh they just weren't formatted right. Commented Oct 5, 2019 at 3:44
  • Could you tell me what you mean by 'not formatted right'? Do you have a screenshot?
    – Glorfindel
    Commented Oct 5, 2019 at 8:01
  • I'd suggested this on another post and was finally told this was a thing. Upvoted! Commented Oct 10, 2019 at 19:33
  • 1
    Yes, too much chance for false positives. I suppose some software developers have the text vi/vim in their profile but that does not mean they're pronouns...
    – Glorfindel
    Commented Oct 12, 2019 at 13:19
  • 1
    It makes lookups to every chat user / Q&A user on that page. So your profiles influence how other users with the script view your usercard. I now realize that's a lot of calls on a Q&A page, which tend to get loaded quite often (contrary to a chatroom, the only place where v1 of the script was active). I'll probably build some additional caching this week.
    – Glorfindel
    Commented Oct 14, 2019 at 18:18
  • 2
    @Someone perhaps, but we should avoid false positives at all costs: stackapps.com/questions/8440/…
    – Glorfindel
    Commented Sep 19, 2023 at 17:15

9 Answers 9

12

Can you implement some kind of support for those of us who are fine with any pronoun, i.e., have no preference?

I realise I could probably write something like

don’t/care

into my profile, but that would be weird for those who visit my profile and are not aware of this script.

1
  • 4
    This is now supported in v1.1: you could write e.g. 'Pronouns: whatever you prefer.'
    – Glorfindel
    Commented Oct 3, 2019 at 20:44
10

/

Strip out the http://my.pronoun.is/ portion of the pronoun tag under the username, seeing as how you can't click on it anyway.

3
  • 1
    You're right, something has to be done about this (and there's already somebody who submitted a pull request on this topic). My preference would be to have a clickable, well formatted link to the site.
    – Glorfindel
    Commented Oct 15, 2019 at 7:04
  • 1
    Fixed in v2.3, in chat the link is stripped (since I couldn't make nested <a> elements work), in Q&A the link is make clickable.
    – Glorfindel
    Commented Oct 18, 2019 at 7:44
  • I see "Rebecca J. Stones my.pronoun.is/she 1 min ago". Commented Feb 3, 2020 at 13:25
4

Clicking the name of someone in chat breaks the userscript (pronouns no longer appear). To make it more generic, DOM updated to chat, and to main sites (.post-layout, comments, etc.) break the userscript.

1
  • 1
    Fixed in v2.3 of the script. Somehow, it didn't occur in the Teachers' Lounge, but I was able to reproduce it in another chatroom.
    – Glorfindel
    Commented Oct 18, 2019 at 7:44
4

Seems like there are similar requests for users' info on Chat.SO that fails due to CORS-blocking. You might want to disable the script for Chat.SO so we don't make unneccessary requests that fail, or implement a workaround using GM_xmlhttpRequest.

Workaround I made: https://github.com/samliew/SO-mod-userscripts/blob/3dd96fbfbce5405dca852a5180bb5463c2274ce6/lib/common.js#L339

4
  • oh wait, just dynamically set the location.hostname, and don't hard-code to chat.stackexchange.com Commented Oct 4, 2019 at 11:07
  • I realized this as well, I always make mistakes like this. chat.stackexchange.com is hardcoded ...
    – Glorfindel
    Commented Oct 4, 2019 at 11:07
  • @Glorfindel want me to make a patch? Commented Oct 4, 2019 at 11:08
  • 2
    This is now fixed in v1.2.
    – Glorfindel
    Commented Oct 4, 2019 at 11:16
3

Can this be made to work on the transcript? It doesn't, currently.

Pronoun doesn't show on transcript

1
  • 7
    I considered that, but I'm not sure if it's really useful. You need somebody's pronouns when you want to post a message, and that can only be done in the room itself, so the Pronoun Assistant will activate by then.
    – Glorfindel
    Commented Oct 5, 2019 at 8:00
2

DonAntonio's math.SE profile contains:

... at least shortly, her/his downvote, making it clear ...

This is interpreted as "her/his" pronouns.

2
  • 1
    Since that's a relatively uncommon combination (the same holds for 'his/her', 'him/her', 'her/him', 'she/he', 'he/she'), I wonder if it would make sense to exclude those six from the 'automatic detection'. If a user still wants that specification, he/she can always use the explicit 'Pronouns:' option.
    – Glorfindel
    Commented Feb 14, 2020 at 13:45
  • 2
    Thank you for reporting this, it has been solved in v2.8. Since pronoun information is cached for 24 hours, it might take a while before you see the results.
    – Glorfindel
    Commented Feb 28, 2020 at 21:53
2

Currently, the script only searches a user's chat profile for pronouns to use when in chat. This means that users who only list their pronouns in their main site profiles don't have any listed in chat (for example, chat vs main). Could it be possible to scrape a user's parent site profile for any pronouns, if none are listed in their chat profile?

1
// If we're on a Q&A site, also cache all changes to the `users` object to save on API calls

Can I purge this cache manually, e.g. after changing the About me entry and/or is there an automatic expiration period? (I implemented such in my user flair once [but it didn't work in FF then]).

2
  • 2
    Good question. My original idea was to cache them for an hour or so, but I can't see any expiration in ArtOfCode's code (he wrote that part). I'll ping him.
    – Glorfindel
    Commented Oct 20, 2019 at 13:05
  • 3
    There's no automatic expiration, no - I didn't think of that. I'll see if that can be added. For now, if you run delete localStorage.stackPronounAssistant_users in your browser console, that should purge the cache.
    – ArtOfCode
    Commented Oct 20, 2019 at 18:16
0

Referring to v2.7 of the script the @matches and @includes can be adapted to:

// @include /^https:\/\/(\w*\.+)?(stack|ask|code|server|super|math)\w*\.(com|net)\/questions\/?.*$/
// Matches:             |<none> ||      ⬑– Domains that don't follow |  | TLDs  || Paths        |
//                      | meta. ||      the <something>.stackexchange|           | + possible   |
//                      |       ||      scheme...                    |           |   fragment   |
//                      |⬑–––––––⬑–––– ...and those that do.        |

// @exclude /^https:\/\/(\w*\.+)?(stack|ask|code|server|super|math)\w*\.(com|net)\/questions\/ask\/?.*$/
// Matches:             |<none> ||      ⬑– Domains that don't follow |  | TLDs  || Path              |
//                      | meta. ||      the <something>.stackexchange|           |+ possible fragment|
//                      |       ||      scheme...                    |
//                      |⬑–––––––⬑–––– ...and those that do.        |
//              ---- extend bracket expression(s) above for new site(s) ----

Such:

  • the script's meta data are way shorter (well, apart from the comments, but still :),
  • it is activated on SE main Q&A domains and meta and chat sub-domains,
  • @excludes do work on .../ask pages on sites that don't follow the <something>.stackexchange.<TLD> scheme, too (which don't work for those, atm),
  • it can be easily adapted for new domains by extending the bracket expression(s).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .