Pronoun Assistant v1.0
This commit is contained in:
parent
831f5dea69
commit
4895e666b9
|
@ -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,29 +90,25 @@ 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.
|
let userID = jNode.attr("href").split("/users/")[1];
|
||||||
if (window.location.host.startsWith("chat.")) {
|
if (!users.hasOwnProperty(userID)) {
|
||||||
waitForKeyElements("a.signature", function(jNode) {
|
users[userID] = [];
|
||||||
let userID = jNode.attr("href").split("/users/")[1];
|
users[userID].push(jNode);
|
||||||
if (!users.hasOwnProperty(userID)) {
|
// Read chat profile
|
||||||
users[userID] = [];
|
$.get("https://chat.stackexchange.com/users/thumbs/" + userID + "?showUsage=true", function(data) {
|
||||||
users[userID].push(jNode);
|
let pronouns = data.user_message == null ? "" : getPronouns(data.user_message);
|
||||||
// Read chat profile
|
users[userID].forEach(function (element) {
|
||||||
$.get("https://chat.stackexchange.com/users/thumbs/" + userID + "?showUsage=true", function(data) {
|
showPronouns(element, pronouns);
|
||||||
let pronouns = data.user_message == null ? "" : getPronouns(data.user_message);
|
|
||||||
users[userID].forEach(function (element) {
|
|
||||||
showPronouns(element, pronouns);
|
|
||||||
});
|
|
||||||
users[userID] = pronouns;
|
|
||||||
});
|
});
|
||||||
} else if (typeof users[userID] == 'string') {
|
users[userID] = pronouns;
|
||||||
showPronouns(jNode, users[userID]);
|
});
|
||||||
} else {
|
} else if (typeof users[userID] == 'string') {
|
||||||
users[userID].push(jNode);
|
showPronouns(jNode, users[userID]);
|
||||||
}
|
} else {
|
||||||
});
|
users[userID].push(jNode);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue