Pronoun Assistant v1.0

This commit is contained in:
Glorfindel 2019-10-03 15:33:41 +02:00
parent 831f5dea69
commit 4895e666b9
1 changed files with 27 additions and 37 deletions

View File

@ -6,26 +6,20 @@
// @contributor ArtOfCode // @contributor ArtOfCode
// @updateURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/pronoun-assistant/pronoun-assistant.user.js // @updateURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/pronoun-assistant/pronoun-assistant.user.js
// @downloadURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/pronoun-assistant/pronoun-assistant.user.js // @downloadURL https://raw.githubusercontent.com/Glorfindel83/SE-Userscripts/master/pronoun-assistant/pronoun-assistant.user.js
// @version 0.3 // @supportURL https://stackapps.com/questions/8440/pronoun-assistant
// @match *://*.stackexchange.com/* // @version 1.0
// @match *://*.stackoverflow.com/* // @match *://chat.stackexchange.com/rooms/*
// @match *://*.superuser.com/* // @match *://chat.stackoverflow.com/rooms/*
// @match *://*.serverfault.com/* // @match *://chat.meta.stackexchange.com/rooms/*
// @match *://*.askubuntu.com/*
// @match *://*.stackapps.com/*
// @match *://*.mathoverflow.net/*
// @exclude *://api.stackexchange.com/*
// @exclude *://blog.*.com/*
// @exclude *://data.stackexchange.com/*
// @exclude *://elections.stackexchange.com/*
// @exclude *://openid.stackexchange.com/*
// @exclude *://stackexchange.com/*
// @grant GM_addStyle // @grant GM_addStyle
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js // @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// ==/UserScript== // ==/UserScript==
/* global $ */ /* global $ */
// NICETOHAVE: on main/meta sites as well; right now, there are very few users
// who have indicated their pronouns in their main/meta profile.
GM_addStyle(` GM_addStyle(`
.tiny-signature { .tiny-signature {
display: inline-flex; display: inline-flex;
@ -96,13 +90,10 @@ function getPronouns(aboutMe) {
if (isOnlyPronouns) if (isOnlyPronouns)
return match[1]; return match[1];
} }
return "" return "";
} }
// NICETOHAVE: on main/meta sites as well; right now, there are very few users waitForKeyElements("a.signature", function(jNode) {
// who have indicated their pronouns in their main/meta profile.
if (window.location.host.startsWith("chat.")) {
waitForKeyElements("a.signature", function(jNode) {
let userID = jNode.attr("href").split("/users/")[1]; let userID = jNode.attr("href").split("/users/")[1];
if (!users.hasOwnProperty(userID)) { if (!users.hasOwnProperty(userID)) {
users[userID] = []; users[userID] = [];
@ -120,5 +111,4 @@ if (window.location.host.startsWith("chat.")) {
} else { } else {
users[userID].push(jNode); users[userID].push(jNode);
} }
}); });
}