This commit is contained in:
Mirco Wittrien 2019-03-07 23:56:18 +01:00
parent 58bd5c4637
commit 96ff298082
3 changed files with 50 additions and 45 deletions

View File

@ -3,7 +3,7 @@
class EditUsers {
getName () {return "EditUsers";}
getVersion () {return "3.2.9";}
getVersion () {return "3.3.0";}
getAuthor () {return "DevilBro";}
@ -11,7 +11,7 @@ class EditUsers {
initConstructor () {
this.changelog = {
"fixed":[["Typing Users","The plugin now properly changes the names in the typing users list"]]
"fixed":[["Changes","Fixed for the new server classes"]]
};
this.labels = {};
@ -265,7 +265,7 @@ class EditUsers {
if (global.BDFDB && typeof BDFDB === "object" && BDFDB.loaded) {
let data = BDFDB.loadAllData(this, "users");
BDFDB.removeAllData(this, "users");
BDFDB.WebModules.forceAllUpdates(this);
try {BDFDB.WebModules.forceAllUpdates(this);} catch (err) {}
BDFDB.saveAllData(data, this, "users");
BDFDB.removeEles(".autocompleteEditUsers", ".autocompleteEditUsersRow");
@ -309,14 +309,14 @@ class EditUsers {
let userContextSubMenu = BDFDB.htmlToElement(this.userContextSubMenuMarkup);
let useritem = userContextSubMenu.querySelector(".usersettings-item");
useritem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
BDFDB.closeContextMenu(menu);
this.showUserSettings(instance.props.user);
});
if (BDFDB.loadData(instance.props.user.id, this, "users")) {
let resetitem = userContextSubMenu.querySelector(".resetsettings-item");
BDFDB.removeClass(resetitem, BDFDB.disCN.contextmenuitemdisabled);
resetitem.addEventListener("click", () => {
instance._reactInternalFiber.return.memoizedProps.closeContextMenu();
BDFDB.closeContextMenu(menu);
BDFDB.removeData(instance.props.user.id, this, "users");
BDFDB.WebModules.forceAllUpdates(this);
});
@ -969,7 +969,7 @@ class EditUsers {
else if (BDFDB.getParentEle(BDFDB.dotCN.textareawrapchat, wrapper)) key = "changeInChatTextarea";
else if (BDFDB.getParentEle(BDFDB.dotCN.voiceuser, wrapper)) key = "changeInVoiceChat";
else if (BDFDB.getParentEle(BDFDB.dotCN.members, wrapper)) key = "changeInMemberList";
else if (BDFDB.getParentEle(BDFDB.dotCN.dms, wrapper)) key = "changeInRecentDms";
else if (BDFDB.getParentEle(BDFDB.dotCN.dmguild, wrapper)) key = "changeInRecentDms";
else if (BDFDB.getParentEle(BDFDB.dotCN.dmchannels, wrapper)) key = "changeInDmsList";
else if (BDFDB.getParentEle(BDFDB.dotCN.channelheaderheaderbar, wrapper)) key = "changeInDmHeader";
else if (BDFDB.getParentEle(BDFDB.dotCN.callavatarwrapper, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.callincoming, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.callcurrentcontainer, wrapper) || BDFDB.getParentEle(BDFDB.dotCN.pictureinpicture, wrapper)) key = "changeInDmCalls";

View File

@ -3,7 +3,7 @@
class PinDMs {
getName () {return "PinDMs";}
getVersion () {return "1.3.7";}
getVersion () {return "1.3.8";}
getAuthor () {return "DevilBro";}
@ -11,8 +11,7 @@ class PinDMs {
initConstructor () {
this.changelog = {
"added":[["Pin Icon","Added the option to disable the 'Pin' icon for pinned DMs in the server list"]],
"fixed":[["Pin Icon","Repositioned the pin icon in a way that it doesn't cover the audio/video icon"]]
"fixed":[["Changes","Fixed for the new server classes"]]
};
this.patchModules = {
@ -74,35 +73,35 @@ class PinDMs {
</div>`;
this.recentDMMarkup =
`<div class="${BDFDB.disCN.guild} pinned" style="transform: translateX(0px);">
`<div class="${BDFDB.disCN.dmguild} pinned" style="opacity: 1; height: 60px; transform: scale(1);">
<div class="${BDFDB.disCN.guildinner}" draggable="false" style="border-radius: 25px;">
<div class="${BDFDB.disCNS.avatarwrapper + BDFDB.disCNS.avatarsmall + BDFDB.disCNS.guildavatar + BDFDB.disCN.avatarsizesmall}">
<a draggable="false" class="${BDFDB.disCNS.guildavatarinner + BDFDB.disCNS.avatarinner + BDFDB.disCN.avatarstopanimation}"></a>
<div class="${BDFDB.disCNS.avatarwrapper + BDFDB.disCNS.avatarsmall + BDFDB.disCNS.dmguildavatar + BDFDB.disCN.avatarsizesmall}">
<a draggable="false" class="${BDFDB.disCNS.dmguildavatarinner + BDFDB.disCNS.avatarinner + BDFDB.disCN.avatarstopanimation}"></a>
</div>
</div>
<div class="${BDFDB.disCNS.badge + BDFDB.disCN.badgewrapper}" style="display: none !important;">0</div>
<div class="${BDFDB.disCNS.dmguildbadge + BDFDB.disCN.badgewrapper}" style="display: none !important;">0</div>
</div>`;
this.css = `
${BDFDB.dotCN.dmchannel}.pindms-dragpreview,
${BDFDB.dotCN.guild}.pindms-dragpreview {
${BDFDB.dotCN.dmguild}.pindms-dragpreview {
pointer-events: none !important;
position: absolute !important;
opacity: 0.5 !important;
z-index: 10000 !important;
}
${BDFDB.dotCN.guild}.pindms-dragpreview:before,
${BDFDB.dotCN.guild}.pindms-dragpreview:after,
${BDFDB.dotCN.guild}.pindms-dragpreview ${BDFDB.dotCN.badge} {
${BDFDB.dotCN.dmguild}.pindms-dragpreview:before,
${BDFDB.dotCN.dmguild}.pindms-dragpreview:after,
${BDFDB.dotCN.dmguild}.pindms-dragpreview ${BDFDB.dotCN.dmguildbadge} {
display: none !important;
}
${BDFDB.dotCN.guild}.pindms-dragpreview ${BDFDB.dotCN.avataricon} {
${BDFDB.dotCN.dmguild}.pindms-dragpreview ${BDFDB.dotCN.dmguildavatar} {
background-color: transparent !important;
overflow: hidden !important;
}`;
this.pinIconCSS = `
${BDFDB.dotCN.guild}.pinned:before {
${BDFDB.dotCN.dmguild}.pinned:before {
background-position: 50%;
background-repeat: no-repeat;
background-size: 16px;
@ -112,16 +111,16 @@ class PinDMs {
overflow: hidden;
pointer-events: none;
position: absolute;
width: 24px;
left: -6px;
top: -6px;
width: 24px;
z-index: 1;
background-image: url('data:image/svg+xml; utf8, <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="-90 -80 700 700" xml:space="preserve" style="transform: scale(-1, 1);"><g fill="#FFF"><path d="M291.31,402.761L109.241,220.693C79.073,190.525,30.166,190.526,0,220.692l291.31,291.31C321.474,481.835,321.476,432.927,291.31,402.761z"/><polygon points="273.104,111.449 154.758,211.589 300.412,357.242 400.55,238.898"/><path d="M500.688,175.174L336.827,11.313c-15.085-15.085-39.539-15.083-54.621,0c-15.082,15.082-15.082,39.538,0,54.62 l163.861,163.861c15.083,15.085,39.539,15.085,54.621,0.001C515.773,214.712,515.773,190.257,500.688,175.174z"/><polygon points="91.032,366.346 0,512 145.655,420.967"/></g></svg>');
}
${BDFDB.dotCNS.themelight + BDFDB.dotCN.guild}.pinned:before {
${BDFDB.dotCNS.themelight + BDFDB.dotCN.dmguild}.pinned:before {
background-color: #202225;
}
${BDFDB.dotCNS.themedark + BDFDB.dotCN.guild}.pinned:before {
${BDFDB.dotCNS.themedark + BDFDB.dotCN.dmguild}.pinned:before {
background-color: #202225;
}`
@ -224,7 +223,7 @@ class PinDMs {
this.unhideNativeDM(info.id);
if (info.div) info.div.removeEventListener("contextmenu", info.div.PinDMsContextMenuListener);
}
BDFDB.removeEles(BDFDB.dotCNS.dms + BDFDB.dotCN.guild + ".pinned", ".pindms-dragpreview");
BDFDB.removeEles(BDFDB.dotCN.dmguild + ".pinned", ".pindms-dragpreview");
BDFDB.unloadMessage(this);
}
@ -311,7 +310,7 @@ class PinDMs {
BDFDB.removeEles(pinguilditem);
unpinguilditem.addEventListener("click", () => {
BDFDB.closeContextMenu(target);
BDFDB.removeEles(document.querySelector(`${BDFDB.dotCNS.dms + BDFDB.dotCN.guild}.pinned[channelid="${id}"]`));
BDFDB.removeEles(document.querySelector(`${BDFDB.dotCN.dmguild}.pinned[channelid="${id}"]`));
this.unhideNativeDM(id);
BDFDB.removeData(id, this, "pinnedRecents");
this.updatePinnedPositions("pinnedRecents");
@ -322,8 +321,7 @@ class PinDMs {
}
processGuilds (instance, wrapper) {
let dms = wrapper.querySelector(BDFDB.dotCN.dms);
if (dms) for (let id of this.sortAndUpdate("pinnedRecents")) this.addPinnedRecent(id);
for (let id of this.sortAndUpdate("pinnedRecents")) this.addPinnedRecent(id);
}
processPrivateChannel (instance, wrapper) {
@ -525,14 +523,14 @@ class PinDMs {
}
addPinnedRecent (id) {
let dms = document.querySelector(BDFDB.dotCN.dms);
if (dms && !dms.querySelector(`${BDFDB.dotCN.guild}.pinned[channelid="${id}"]`)) {
let anker = document.querySelector(`${BDFDB.dotCNS.guilds + BDFDB.dotCN.friendsonline}`);
if (anker && !document.querySelector(`${BDFDB.dotCN.dmguild}.pinned[channelid="${id}"]`)) {
let info = this.ChannelUtils.getChannel(id);
if (info) {
let dmdiv = BDFDB.htmlToElement(this.recentDMMarkup);
let user = info.type == 1 ? this.UserUtils.getUser(info.recipients[0]) : null;
dmdiv.setAttribute("channelid", id);
dms.insertBefore(dmdiv, dms.firstElementChild);
anker.parentElement.insertBefore(dmdiv, anker.nextSibling);
let avatar = dmdiv.querySelector(BDFDB.dotCN.avatarinner);
let dmname = info.name;
if (!dmname && info.recipients.length > 0) {
@ -568,8 +566,6 @@ class PinDMs {
if (Math.sqrt((x - e2.pageX)**2) > 20 || Math.sqrt((y - e2.pageY)**2) > 20) {
document.removeEventListener("mousemove", mousemove);
document.removeEventListener("mouseup", mouseup);
let dmswrap = document.querySelector(`${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.dms}`);
if (!dmswrap) return;
let hovele = null;
let placeholder = BDFDB.htmlToElement(`<div class="${BDFDB.disCNS.guild + BDFDB.disCN.guildplaceholder} dmplaceholder"></div>`);
let dragpreview = this.createDragPreview(dmdiv, e);
@ -577,8 +573,8 @@ class PinDMs {
BDFDB.removeEles(placeholder);
BDFDB.toggleEles(dmdiv, false);
this.updateDragPreview(dragpreview, e3);
hovele = BDFDB.getParentEle(BDFDB.dotCNS.dms + BDFDB.dotCN.guild + ".pinned", e3.target);
if (hovele) dmswrap.insertBefore(placeholder, hovele.nextSibling);
hovele = BDFDB.getParentEle(BDFDB.dotCN.dmguild + ".pinned", e3.target);
if (hovele) hovele.parentElement.insertBefore(placeholder, hovele.nextSibling);
};
let releasing = e3 => {
document.removeEventListener("mousemove", dragging);
@ -586,7 +582,7 @@ class PinDMs {
BDFDB.removeEles(placeholder, dragpreview);
BDFDB.toggleEles(dmdiv, true);
if (hovele) {
dmswrap.insertBefore(dmdiv, hovele.nextSibling);
hovele.parentElement.insertBefore(dmdiv, hovele.nextSibling);
this.updatePinnedPositions("pinnedRecents");
}
};
@ -631,23 +627,23 @@ class PinDMs {
updatePinnedPositions (type) {
let newPinned = {}, oldPinned = BDFDB.loadAllData(this, type);
let pins = Array.from(document.querySelectorAll(type == "pinnedRecents" ? `${BDFDB.dotCNS.dms + BDFDB.dotCN.guild}.pinned` : `${BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel}.pinned`)).map(div => {return div.getAttribute("channelid");}).reverse();
let pins = Array.from(document.querySelectorAll(type == "pinnedRecents" ? `${BDFDB.dotCN.dmguild}.pinned` : `${BDFDB.dotCNS.dmchannels + BDFDB.dotCN.dmchannel}.pinned`)).map(div => {return div.getAttribute("channelid");}).reverse();
for (let i in pins) if (pins[i]) newPinned[pins[i]] = parseInt(i);
for (let id in oldPinned) if (newPinned[id] == undefined) newPinned[id] = Object.keys(newPinned).length;
BDFDB.saveAllData(newPinned, this, type);
}
updatePinnedRecent (id, unmouted = false) {
let pinneddmdiv = document.querySelector(`${BDFDB.dotCNS.dms + BDFDB.dotCN.guild}.pinned[channelid="${id}"]`);
let pinneddmdiv = document.querySelector(`${BDFDB.dotCN.dmguild}.pinned[channelid="${id}"]`);
if (Node.prototype.isPrototypeOf(pinneddmdiv)) {
let dmdiv = BDFDB.getDmDiv(id);
let count = this.UnreadUtils.getUnreadCount(id);
let badge = pinneddmdiv.querySelector(BDFDB.dotCN.badge);
let badge = pinneddmdiv.querySelector(BDFDB.dotCN.dmguildbadge);
BDFDB.toggleEles(badge, count > 0);
BDFDB.toggleClass(pinneddmdiv, "has-new-messages", count > 0);
badge.innerText = count;
BDFDB.toggleClass(pinneddmdiv, BDFDB.disCN.guildaudio, !unmouted && Node.prototype.isPrototypeOf(dmdiv) && BDFDB.containsClass(dmdiv, BDFDB.disCN.guildaudio));
BDFDB.toggleClass(pinneddmdiv, BDFDB.disCN.guildvideo, !unmouted && Node.prototype.isPrototypeOf(dmdiv) && BDFDB.containsClass(dmdiv, BDFDB.disCN.guildvideo));
BDFDB.toggleClass(pinneddmdiv, BDFDB.disCN.dmguildaudio, !unmouted && Node.prototype.isPrototypeOf(dmdiv) && BDFDB.containsClass(dmdiv, BDFDB.disCN.dmguildaudio));
BDFDB.toggleClass(pinneddmdiv, BDFDB.disCN.dmguildvideo, !unmouted && Node.prototype.isPrototypeOf(dmdiv) && BDFDB.containsClass(dmdiv, BDFDB.disCN.dmguildvideo));
}
}
@ -670,7 +666,7 @@ class PinDMs {
addHoverBehaviour (div) {
/* based on stuff from Zerebos */
let divinner = div.querySelector(BDFDB.dotCN.guildinner);
let divicon = div.querySelector(BDFDB.dotCN.guildicon);
let divicon = div.querySelector(BDFDB.dotCN.dmguildavatarinner);
let backgroundColor = new this.Animations.Value(0);
backgroundColor
.interpolate({

View File

@ -3,7 +3,7 @@
class ReadAllNotificationsButton {
getName () {return "ReadAllNotificationsButton";}
getVersion () {return "1.4.2";}
getVersion () {return "1.4.3";}
getAuthor () {return "DevilBro";}
@ -11,12 +11,13 @@ class ReadAllNotificationsButton {
initConstructor () {
this.changelog = {
"improved":[["Clear Mentions","Added an option to add the 'Clear Mentions' button in the recent mentions popout"]]
"fixed":[["Changes","Fixed for the new server classes"]]
};
this.patchModules = {
"Guilds":"componentDidMount",
"RecentMentions":"componentDidMount"
"RecentMentions":"componentDidMount",
"DirectMessage":"componentDidMount"
};
this.RANcontextMenuMarkup =
@ -168,6 +169,12 @@ class ReadAllNotificationsButton {
}
}
processDirectMessage (instance, wrapper, methodnames) {
let ranbutton = document.querySelector(".RANbutton-frame");
let guildseparator = wrapper.parentElement.parentElement.querySelector(BDFDB.dotCN.guildseparator);
if (ranbutton && guildseparator) guildseparator.parentElement.insertBefore(ranbutton, guildseparator);
}
processRecentMentions (instance, wrapper) {
BDFDB.removeEles(".RAMbutton");
if (instance.props && instance.props.popoutName == "RECENT_MENTIONS_POPOUT" && BDFDB.getData("addClearButton", this, "settings")) {
@ -188,7 +195,9 @@ class ReadAllNotificationsButton {
instance.loadMore();
setTimeout(() => {this.clearMentions(instance, wrapper);},3000);
}
}setLabelsByLanguage () {
}
setLabelsByLanguage () {
switch (BDFDB.getDiscordLanguage().id) {
case "hr": //croatian
return {