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

View File

@ -12,7 +12,7 @@ class RemoveNicknames {
initConstructor () { initConstructor () {
this.patchModules = { this.patchModules = {
"NameTag":"componentDidMount", "NameTag":"componentDidMount",
"FluxContainer(TypingUsers)":"componentDidUpdate", "TypingUsers":"componentDidUpdate",
"MessageUsername":"componentDidMount", "MessageUsername":"componentDidMount",
"Clickable":"componentDidMount", "Clickable":"componentDidMount",
"StandardSidebarView":"componentWillUnmount" "StandardSidebarView":"componentWillUnmount"
@ -38,7 +38,8 @@ class RemoveNicknames {
let settingspanel = BDFDB.htmlToElement(settingshtml); let settingspanel = BDFDB.htmlToElement(settingshtml);
BDFDB.initElements(settingspanel, this); ; BDFDB.initElements(settingspanel, this);
;
return settingspanel; return settingspanel;
} }
@ -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); 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) => { wrapper.querySelectorAll("strong").forEach((username, i) => {
if (users[i] && username) BDFDB.setInnerText(username, this.getNewName(users[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", "ChannelTextArea":"componentDidMount",
"NameTag":"componentDidMount", "NameTag":"componentDidMount",
"AuditLog":"componentDidMount", "AuditLog":"componentDidMount",
"FluxContainer(TypingUsers)":"componentDidUpdate", "TypingUsers":"componentDidUpdate",
"MessageUsername":"componentDidMount", "MessageUsername":"componentDidMount",
"DirectMessage":"componentDidMount", "DirectMessage":"componentDidMount",
"CallAvatar":"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); 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) => { wrapper.querySelectorAll(BDFDB.dotCNS.typing + "strong").forEach((username, i) => {
if (users[i] && username) this.changeName2(users[i], username); if (users[i] && username) this.changeName2(users[i], username);

View File

@ -5,7 +5,7 @@ module.exports = (Plugin, Api, Vendor) => {
initConstructor () { initConstructor () {
this.patchModules = { this.patchModules = {
"NameTag":"componentDidMount", "NameTag":"componentDidMount",
"FluxContainer(TypingUsers)":"componentDidUpdate", "TypingUsers":"componentDidUpdate",
"MessageUsername":"componentDidMount", "MessageUsername":"componentDidMount",
"Clickable":"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); 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) => { wrapper.querySelectorAll("strong").forEach((username, i) => {
if (users[i] && username) BDFDB.setInnerText(username, this.getNewName(users[i])); if (users[i] && username) BDFDB.setInnerText(username, this.getNewName(users[i]));