This commit is contained in:
Mirco Wittrien 2019-02-03 22:11:35 +01:00
parent d4297c0c31
commit 08b79c7d69
4 changed files with 23 additions and 26 deletions

View File

@ -16,7 +16,7 @@ class EditUsers {
"ChannelTextArea":"componentDidMount",
"NameTag":"componentDidMount",
"AuditLog":"componentDidMount",
"FluxContainer(TypingUsers)":"componentDidUpdate",
"TypingUsers":"componentDidUpdate",
"MessageUsername":"componentDidMount",
"DirectMessage":"componentDidMount",
"CallAvatar":"componentDidMount",
@ -364,8 +364,6 @@ class EditUsers {
BDFDB.removeEles(BDFDB.dotCNS.tooltips + ".notice-tooltip");
});
BDFDB.addChildEventListener(userSettingsModal, "click", ".btn-save", e => {
e.preventDefault();
name = usernameinput.value.trim();
name = name ? name : null;
@ -442,8 +440,7 @@ class EditUsers {
let autocompletemenu = textarea.parentElement.querySelector(BDFDB.dotCN.autocomplete);
if (autocompletemenu && (e.which == 9 || e.which == 13)) {
if (BDFDB.containsClass(autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected).parentElement, "autocompleteEditUsersRow")) {
e.originalEvent.preventDefault();
e.originalEvent.stopPropagation();
BDFDB.stopEvent(e);
this.swapWordWithMention(textarea);
}
}
@ -451,8 +448,7 @@ class EditUsers {
let autocompleteitems = autocompletemenu.querySelectorAll(BDFDB.dotCN.autocompleteselectable + ":not(.autocompleteEditUsersSelector)");
let selected = autocompletemenu.querySelector(BDFDB.dotCN.autocompleteselected);
if (BDFDB.containsClass(selected, "autocompleteEditUsersSelector") || autocompleteitems[e.which == 38 ? 0 : (autocompleteitems.length-1)] == selected) {
e.originalEvent.preventDefault();
e.originalEvent.stopPropagation();
BDFDB.stopEvent(e);
let next = this.getNextSelection(autocompletemenu, null, e.which == 38 ? false : true);
BDFDB.removeClass(selected, BDFDB.disCN.autocompleteselected);
BDFDB.addClass(selected, BDFDB.disCN.autocompleteselector);
@ -510,7 +506,7 @@ class EditUsers {
}
}
processFluxContainerTypingUsers (instance, wrapper) {
processTypingUsers (instance, wrapper) {
let users = !instance.state.typingUsers ? [] : Object.keys(instance.state.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !this.RelationshipUtils.isBlocked(id)).map(id => this.UserUtils.getUser(id)).filter(id => id != null);
wrapper.querySelectorAll(BDFDB.dotCNS.typing + "strong").forEach((username, i) => {
if (users[i] && username) this.changeName2(users[i], username);

View File

@ -12,7 +12,7 @@ class RemoveNicknames {
initConstructor () {
this.patchModules = {
"NameTag":"componentDidMount",
"FluxContainer(TypingUsers)":"componentDidUpdate",
"TypingUsers":"componentDidUpdate",
"MessageUsername":"componentDidMount",
"Clickable":"componentDidMount",
"StandardSidebarView":"componentWillUnmount"
@ -38,7 +38,8 @@ class RemoveNicknames {
let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this); ;
BDFDB.initElements(settingspanel, this);
;
return settingspanel;
}
@ -46,17 +47,17 @@ class RemoveNicknames {
load () {}
start () {
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!libraryScript || performance.now() - libraryScript.getAttribute("date") > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
var libraryScript = document.querySelector('head script[src="https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js"]');
if (!libraryScript || performance.now() - libraryScript.getAttribute("date") > 600000) {
if (libraryScript) libraryScript.remove();
libraryScript = document.createElement("script");
libraryScript.setAttribute("type", "text/javascript");
libraryScript.setAttribute("src", "https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js");
libraryScript.setAttribute("date", performance.now());
libraryScript.addEventListener("load", () => {if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();});
document.head.appendChild(libraryScript);
}
else if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) this.initialize();
this.startTimeout = setTimeout(() => {this.initialize();}, 30000);
}
@ -117,7 +118,7 @@ class RemoveNicknames {
}
}
processFluxContainerTypingUsers (instance, wrapper) {
processTypingUsers (instance, wrapper) {
let users = !instance.state.typingUsers ? [] : Object.keys(instance.state.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !this.RelationshipUtils.isBlocked(id)).map(id => this.UserUtils.getUser(id)).filter(id => id != null);
wrapper.querySelectorAll("strong").forEach((username, i) => {
if (users[i] && username) BDFDB.setInnerText(username, this.getNewName(users[i]));

View File

@ -9,7 +9,7 @@ module.exports = (Plugin, Api, Vendor) => {
"ChannelTextArea":"componentDidMount",
"NameTag":"componentDidMount",
"AuditLog":"componentDidMount",
"FluxContainer(TypingUsers)":"componentDidUpdate",
"TypingUsers":"componentDidUpdate",
"MessageUsername":"componentDidMount",
"DirectMessage":"componentDidMount",
"CallAvatar":"componentDidMount",
@ -479,7 +479,7 @@ module.exports = (Plugin, Api, Vendor) => {
}
}
processFluxContainerTypingUsers (instance, wrapper) {
processTypingUsers (instance, wrapper) {
let users = !instance.state.typingUsers ? [] : Object.keys(instance.state.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !this.RelationshipUtils.isBlocked(id)).map(id => this.UserUtils.getUser(id)).filter(id => id != null);
wrapper.querySelectorAll(BDFDB.dotCNS.typing + "strong").forEach((username, i) => {
if (users[i] && username) this.changeName2(users[i], username);

View File

@ -5,7 +5,7 @@ module.exports = (Plugin, Api, Vendor) => {
initConstructor () {
this.patchModules = {
"NameTag":"componentDidMount",
"FluxContainer(TypingUsers)":"componentDidUpdate",
"TypingUsers":"componentDidUpdate",
"MessageUsername":"componentDidMount",
"Clickable":"componentDidMount"
};
@ -98,7 +98,7 @@ module.exports = (Plugin, Api, Vendor) => {
}
}
processFluxContainerTypingUsers (instance, wrapper) {
processTypingUsers (instance, wrapper) {
let users = !instance.state.typingUsers ? [] : Object.keys(instance.state.typingUsers).filter(id => id != BDFDB.myData.id).filter(id => !this.RelationshipUtils.isBlocked(id)).map(id => this.UserUtils.getUser(id)).filter(id => id != null);
wrapper.querySelectorAll("strong").forEach((username, i) => {
if (users[i] && username) BDFDB.setInnerText(username, this.getNewName(users[i]));