fixes
This commit is contained in:
parent
e65704e124
commit
c40acb5f0e
File diff suppressed because one or more lines are too long
|
@ -4462,6 +4462,7 @@ var BDFDB = {myPlugins: BDFDB && BDFDB.myPlugins ? BDFDB.myPlugins : {}, BDv2Api
|
|||
guildfolderexpandendbackgroundcollapsed: ['GuildFolder', 'collapsed'],
|
||||
guildfolderexpandendbackgroundhover: ['GuildFolder', 'hover'],
|
||||
guildfolderexpandedguilds: ['GuildFolder', 'expandedGuilds'],
|
||||
guildfolderguildicon: ['GuildFolder', 'guildIcon'],
|
||||
guildfoldericonwrapper: ['GuildFolder', 'folderIconWrapper'],
|
||||
guildfoldericonwrapperclosed: ['GuildFolder', 'closedFolderIconWrapper'],
|
||||
guildfoldericonwrapperexpanded: ['GuildFolder', 'expandedFolderIconWrapper'],
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
class DisplayServersAsChannels {
|
||||
getName () {return "DisplayServersAsChannels";}
|
||||
|
||||
getVersion () {return "1.2.7";}
|
||||
getVersion () {return "1.2.8";}
|
||||
|
||||
getAuthor () {return "DevilBro";}
|
||||
|
||||
|
@ -11,11 +11,13 @@ class DisplayServersAsChannels {
|
|||
|
||||
constructor () {
|
||||
this.changelog = {
|
||||
"added":[["Width settings","Added the option to change the width of the changed server list"]]
|
||||
"fixed":[["Light Theme Update","Fixed bugs for the Light Theme Update, which broke 99% of my plugins"]]
|
||||
};
|
||||
|
||||
this.patchModules = {
|
||||
"Guilds":"componentDidMount",
|
||||
"Guild":["componentDidMount","componentDidUpdate"],
|
||||
"GuildFolder":["componentDidMount","componentDidUpdate"],
|
||||
"StandardSidebarView":"componentWillUnmount"
|
||||
};
|
||||
}
|
||||
|
@ -72,7 +74,7 @@ class DisplayServersAsChannels {
|
|||
document.head.appendChild(libraryScript);
|
||||
this.libLoadTimeout = setTimeout(() => {
|
||||
libraryScript.remove();
|
||||
require("request")("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
BDFDB.LibraryRequires.request("https://mwittrien.github.io/BetterDiscordAddons/Plugins/BDFDB.js", (error, response, body) => {
|
||||
if (body) {
|
||||
libraryScript = document.createElement("script");
|
||||
libraryScript.setAttribute("id", "BDFDBLibraryScript");
|
||||
|
@ -133,7 +135,7 @@ class DisplayServersAsChannels {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
processGuilds (instance, wrapper) {
|
||||
processGuilds (instance, wrapper, returnvalue) {
|
||||
var observer = new MutationObserver((changes, _) => {changes.forEach((change, i) => {if (change.addedNodes) {change.addedNodes.forEach((node) => {
|
||||
if (node && BDFDB.containsClass(node, BDFDB.disCN.guildouter) && !node.querySelector(BDFDB.dotCN.guildserror)) {
|
||||
if (BDFDB.containsClass(node, "folder")) this.changeServer(this.getFolderObject(node));
|
||||
|
@ -154,30 +156,48 @@ class DisplayServersAsChannels {
|
|||
document.querySelectorAll(BDFDB.dotCN.guildbuttonpill + " + *").forEach(guildbuttoncontainer => {this.changeButton(guildbuttoncontainer);});
|
||||
document.querySelectorAll(BDFDB.dotCN.guildserror).forEach(guildserror => {this.changeError(guildserror);});
|
||||
}
|
||||
|
||||
processGuild (instance, wrapper, returnvalue) {
|
||||
if (instance && wrapper) this.changeServer(Object.assign({div:wrapper}, instance.props.guild));
|
||||
}
|
||||
|
||||
processGuildFolder (instance, wrapper, returnvalue) {
|
||||
if (instance && wrapper) this.changeFolder(Object.assign({div:wrapper}, instance.props));
|
||||
}
|
||||
|
||||
processStandardSidebarView (instance, wrapper) {
|
||||
processStandardSidebarView (instance, wrapper, returnvalue) {
|
||||
if (this.SettingsUpdated) {
|
||||
delete this.SettingsUpdated;
|
||||
this.addCSS();
|
||||
}
|
||||
}
|
||||
|
||||
changeFolder (info) {
|
||||
if (!info || !info.div) return;
|
||||
var guildfoldericonwrapper = info.div.querySelector(BDFDB.dotCNC.guildfoldericonwrapperexpanded + BDFDB.dotCN.guildfoldericonwrapperclosed);
|
||||
if (guildfoldericonwrapper) {
|
||||
BDFDB.removeEles(guildfoldericonwrapper.parentElement.querySelectorAll(".DSAC-name"));
|
||||
guildfoldericonwrapper.parentElement.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">${BDFDB.encodeToHTML(info.folderName || BDFDB.LanguageStrings.GUILD_FOLDER_NAME)}</div>`), guildfoldericonwrapper);
|
||||
}
|
||||
this.changeSVG(info.div);
|
||||
}
|
||||
|
||||
changeServer (info) {
|
||||
if (!info || !info.div) return;
|
||||
var guildbadgewrapper = info.div.querySelector(BDFDB.dotCN.guildbadgewrapper);
|
||||
if (guildbadgewrapper) {
|
||||
BDFDB.removeEles(guildbadgewrapper.parentElement.querySelectorAll(".DSAC-verification-badge, .DSAC-name"));
|
||||
var guildsvg = info.div.querySelector(BDFDB.dotCN.guildsvg);
|
||||
if (guildsvg) {
|
||||
BDFDB.removeEles(guildsvg.parentElement.querySelectorAll(".DSAC-verification-badge, .DSAC-name"));
|
||||
if (info.features && info.features.has("VERIFIED")) {
|
||||
guildbadgewrapper.parentElement.insertBefore(BDFDB.htmlToElement(this.verificationBadgeMarkup), guildbadgewrapper);
|
||||
guildsvg.parentElement.insertBefore(BDFDB.htmlToElement(this.verificationBadgeMarkup), guildsvg);
|
||||
}
|
||||
guildbadgewrapper.parentElement.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">${BDFDB.encodeToHTML(info.name || info.folderName || "")}</div>`), guildbadgewrapper);
|
||||
guildsvg.parentElement.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">${BDFDB.encodeToHTML(info.name || info.folderName || "")}</div>`), guildsvg);
|
||||
}
|
||||
this.changeSVG(info.div);
|
||||
}
|
||||
|
||||
changeHome (div) {
|
||||
if (!div) return;
|
||||
var homebutton = div.querySelector(BDFDB.dotCN.homebutton);
|
||||
var homebutton = div.querySelector(BDFDB.dotCN.guildiconchildwrapper);
|
||||
if (homebutton) {
|
||||
BDFDB.removeEles(homebutton.querySelectorAll(".DSAC-name"));
|
||||
homebutton.insertBefore(BDFDB.htmlToElement(`<div class="DSAC-name">${BDFDB.encodeToHTML(BDFDB.LanguageStrings.HOME)}</div>`), homebutton.firstElementChild);
|
||||
|
@ -228,6 +248,10 @@ class DisplayServersAsChannels {
|
|||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guilds + BDFDB.dotCN.scroller}::-webkit-scrollbar-thumb {
|
||||
background-color: rgb(22, 24, 27);
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolder} {
|
||||
background-color: transparent !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderwrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter} {
|
||||
box-sizing: border-box;
|
||||
padding-left: 5px;
|
||||
|
@ -238,14 +262,57 @@ class DisplayServersAsChannels {
|
|||
min-height: 16px !important;
|
||||
margin: 2px 0 !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpill} + * ${BDFDB.dotCN.guildicon},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpill} + * ${BDFDB.dotCN.guildiconacronym} {
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandedguilds} {
|
||||
height: auto !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground} {
|
||||
top: 0 !important;
|
||||
right: 0 !important;
|
||||
bottom: 0 !important;
|
||||
left: 8px !important;
|
||||
width: unset !important;
|
||||
border-radius: 3px;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed} + ${BDFDB.dotCN.guildouter} {
|
||||
padding-left: 0 !important;
|
||||
margin-left: 0 !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed} + ${BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + ${BDFDB.dotCN.guildinner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed} + ${BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildinner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed} + ${BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildsvg},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed} + ${BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildiconwrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed} + ${BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * foreignObject,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed} + ${BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildfolder},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed} + ${BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildfoldericonwrapper} {
|
||||
width: ${listwidth - 18}px !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapper} {
|
||||
border-radius: 3px;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapper} {
|
||||
display: flex !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapperexpanded},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapperclosed} {
|
||||
display: flex !important;
|
||||
width: unset !important;
|
||||
flex: 0 1 auto !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapper} .DSAC-name {
|
||||
width: unset !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCNS.guildfoldericonwrapperclosed + BDFDB.dotCN.guildfolderguildicon} {
|
||||
margin: 0 2px !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildfolderexpandendbackground + BDFDB.dotCN.guildfolderexpandendbackgroundcollapsed},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCNS.guildcontainer + BDFDB.dotCN.guildicon},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCNS.guildcontainer + BDFDB.dotCN.guildiconacronym} {
|
||||
display: none !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guilds} > div[style*="height"]:not([class]) {
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildsscroller} > div[style*="height"]:not([class]) {
|
||||
margin-top: 8px;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guilds} > div[style*="height"]:not([class]) + div[style*="height"]:not([class]) {
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildsscroller} > div[style*="height"]:not([class]) + div[style*="height"]:not([class]) {
|
||||
margin-top: 0px;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.dmpill} + * {
|
||||
|
@ -255,6 +322,10 @@ class DisplayServersAsChannels {
|
|||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + ${BDFDB.dotCN.guildinner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildinner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildiconwrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfolder},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapperexpanded},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapperclosed},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildbuttoninner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildserror},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildplaceholder} {
|
||||
|
@ -266,6 +337,7 @@ class DisplayServersAsChannels {
|
|||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCNS.guildcontainer},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildsvg},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildiconwrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * foreignObject,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildbuttoninner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildplaceholder} {
|
||||
width: ${listwidth - 15}px !important;
|
||||
|
@ -276,8 +348,24 @@ class DisplayServersAsChannels {
|
|||
width: ${listwidth - 18}px !important;
|
||||
display: flex !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCN.guildouter} {
|
||||
margin: 2px 0 2px 4px !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCNS.guildcontainer},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildsvg},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildiconwrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * foreignObject,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfolder},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildbuttoninner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildplaceholder} {
|
||||
width: ${listwidth - 25}px !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + ${BDFDB.dotCN.guildinner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildfolderwrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildinner},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildfoldericonwrapper} {
|
||||
width: ${listwidth - 28}px !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * foreignObject {
|
||||
width: ${listwidth - 15}px !important;
|
||||
mask: none;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} {
|
||||
|
@ -292,7 +380,7 @@ class DisplayServersAsChannels {
|
|||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * {
|
||||
margin-left: 3px;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.homebutton},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildiconchildwrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildbuttoninner} {
|
||||
display: flex;
|
||||
justify-content: flex-start;
|
||||
|
@ -302,8 +390,10 @@ class DisplayServersAsChannels {
|
|||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildbuttoninner} svg {
|
||||
margin-right: 3px;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.homebutton} svg {
|
||||
margin-right: 8px;
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildiconchildwrapper} svg {
|
||||
position: absolute;
|
||||
top: 6px;
|
||||
right: 8px;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildserror} {
|
||||
border-radius: 3px;
|
||||
|
@ -344,21 +434,24 @@ class DisplayServersAsChannels {
|
|||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildserror} .DSAC-name {
|
||||
margin-left: 4px;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.homebutton} .DSAC-name,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildiconchildwrapper} .DSAC-name,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildbuttoninner} .DSAC-name {
|
||||
color: currentColor;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.homebutton} .DSAC-name {
|
||||
margin-top: 2px;
|
||||
}
|
||||
.DSAC-styled #bd-pub-li,
|
||||
.DSAC-styled #bd-pub-button,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildiconchildwrapper},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter}.RANbutton-frame,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter} .RANbutton-inner,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter} .RANbutton {
|
||||
width: ${listwidth - 10}px !important;
|
||||
height: 32px !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter} .RANbutton-inner {
|
||||
width: ${listwidth - 15}px !important;
|
||||
}
|
||||
.DSAC-styled #bd-pub-button,
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCNS.guildouter + BDFDB.dotCN.guildpillwrapper + BDFDB.notCN.dmpill} + * ${BDFDB.dotCN.guildiconchildwrapper + BDFDB.notCN.guildiconacronym},
|
||||
.DSAC-styled ${BDFDB.dotCNS.guildswrapper + BDFDB.dotCN.guildouter} .RANbutton {
|
||||
border-radius: 3px !important;
|
||||
display: block !important;
|
||||
|
@ -419,6 +512,18 @@ class DisplayServersAsChannels {
|
|||
.DSAC-styled .serverfolders-dragpreview ${BDFDB.dotCN.guildiconacronym},
|
||||
.DSAC-styled .serverfolders-dragpreview ${BDFDB.dotCN.guildicon} {
|
||||
display: none;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCN.appcontainer} {
|
||||
display: flex !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCN.guildswrapper} {
|
||||
position: static !important;
|
||||
contain: unset !important;
|
||||
}
|
||||
.DSAC-styled ${BDFDB.dotCN.chatbase} {
|
||||
position: static !important;
|
||||
contain: unset !important;
|
||||
width: 100% !important;
|
||||
}`);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -31,19 +31,9 @@ class MessageUtilities {
|
|||
this.keys = ["key1","key2"];
|
||||
this.defaults = {
|
||||
settings: {
|
||||
"clearOnEscape": {value:true, description:"Clear chat input when Escape is pressed:"},
|
||||
"Edit_Message": {value:true},
|
||||
"Delete_Message": {value:true},
|
||||
"Pin/Unpin_Message": {value:true},
|
||||
"React_to_Message": {value:true},
|
||||
"Copy_Raw": {value:true},
|
||||
"Copy_Link": {value:true},
|
||||
"__Note_Message": {value:false},
|
||||
"__Translate_Message": {value:false},
|
||||
"__Quote_Message": {value:false},
|
||||
"__Citate_Message": {value:false},
|
||||
"__Reveal_Spoilers": {value:false}
|
||||
"clearOnEscape": {value:true, description:"Clear chat input when Escape is pressed:"}
|
||||
},
|
||||
toasts: {},
|
||||
bindings: {
|
||||
"Edit_Message": {name:"Edit Message", func:this.doEdit, value:{click:1, key1:0, key2:0}},
|
||||
"Delete_Message": {name:"Delete Message", func:this.doDelete, value:{click:0, key1:46, key2:0}},
|
||||
|
@ -55,14 +45,20 @@ class MessageUtilities {
|
|||
"__Translate_Message": {name:"Translate Message (Google Translate Option)", func:this.doTranslate, value:{click:0, key1:20, key2:0}, plugin:"GoogleTranslateOption"},
|
||||
"__Quote_Message": {name:"Quote Message (Quoter)", func:this.doQuote, value:{click:0, key1:17, key2:87}, plugin:"Quoter"},
|
||||
"__Citate_Message": {name:"Quote Message (Citador)", func:this.doCitate, value:{click:0, key1:17, key2:78}, plugin:"Citador"},
|
||||
"__Reveal_Spoilers": {name:"Reveal All Spoilers (RevealAllSpoilersOption)", func:this.doReveal, value:{click:0, key1:17, key2:82}, plugin:"RevealAllSpoilersOption"}
|
||||
"__Reveal_Spoilers": {name:"Reveal All Spoilers (RevealAllSpoilersOption)", func:this.doReveal, value:{click:0, key1:17, key2:74}, plugin:"RevealAllSpoilersOption"}
|
||||
}
|
||||
};
|
||||
for (let type in this.defaults.bindings) {
|
||||
let nativeaction = type.indexOf("__") != 0;
|
||||
this.defaults.settings[type] = {value:nativeaction};
|
||||
if (nativeaction) this.defaults.toasts[type] = {value:type != "Edit_Message" && type != "React_to_Message"};
|
||||
}
|
||||
}
|
||||
|
||||
getSettingsPanel () {
|
||||
if (!global.BDFDB || typeof BDFDB != "object" || !BDFDB.loaded || !this.started) return;
|
||||
let settings = BDFDB.getAllData(this, "settings");
|
||||
let toasts = BDFDB.getAllData(this, "toasts");
|
||||
let bindings = BDFDB.getAllData(this, "bindings");
|
||||
let settingshtml = `<div class="${this.name}-settings BDFDB-settings"><div class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.size18 + BDFDB.disCNS.height24 + BDFDB.disCNS.weightnormal + BDFDB.disCN.marginbottom8}">${this.name}</div><div class="BDFDB-settings-inner">`;
|
||||
for (let key in settings) {
|
||||
|
@ -70,7 +66,8 @@ class MessageUtilities {
|
|||
}
|
||||
for (let action in bindings) {
|
||||
if (!this.defaults.bindings[action].plugin || BDFDB.isPluginEnabled(this.defaults.bindings[action].plugin)) {
|
||||
settingshtml += `<div class="${action}-key-settings"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.bindings[action].name}:</h3><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${action}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[action] ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">`;
|
||||
settingshtml += `<div class="${BDFDB.disCNS.modaldivider + BDFDB.disCN.marginbottom4}"></div>`;
|
||||
settingshtml += `<div class="${action}-key-settings"><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;"><h3 class="${BDFDB.disCNS.titledefault + BDFDB.disCNS.marginreset + BDFDB.disCNS.weightmedium + BDFDB.disCNS.size16 + BDFDB.disCNS.height24 + BDFDB.disCN.flexchild}" style="flex: 1 1 auto;">${this.defaults.bindings[action].name}:</h3>${toasts[action] != undefined ? `<h5 class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin}" style="flex: 0 0 auto;">Toast:</h5><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="toasts ${action}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${toasts[action] ? " checked" : ""}></div>` : ''}<h5 class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin}" style="flex: 0 0 auto;">Enabled:</h5><div class="${BDFDB.disCNS.flexchild + BDFDB.disCNS.switchenabled + BDFDB.disCNS.switch + BDFDB.disCNS.switchvalue + BDFDB.disCNS.switchsizedefault + BDFDB.disCNS.switchsize + BDFDB.disCN.switchthemedefault}" style="flex: 0 0 auto;"><input type="checkbox" value="settings ${action}" class="${BDFDB.disCNS.switchinnerenabled + BDFDB.disCN.switchinner} settings-switch"${settings[action] ? " checked" : ""}></div></div><div class="${BDFDB.disCNS.flex + BDFDB.disCNS.horizontal + BDFDB.disCNS.directionrow + BDFDB.disCNS.justifystart + BDFDB.disCNS.aligncenter + BDFDB.disCNS.nowrap + BDFDB.disCN.marginbottom8}" style="flex: 1 1 auto;">`;
|
||||
for (let click of this.clicks) {
|
||||
settingshtml += `<div class="${BDFDB.disCN.flexchild}" style="flex: 1 1 20%;"><h5 class="${BDFDB.disCNS.h5 + BDFDB.disCNS.title + BDFDB.disCNS.size12 + BDFDB.disCNS.height16 + BDFDB.disCNS.weightsemibold + BDFDB.disCNS.h5defaultmargin + BDFDB.disCN.marginbottom4}">${click}:</h5>${BDFDB.createSelectMenu(this.createSelectChoice(bindings[action][click]), bindings[action][click], action + " " + click)}</div>`;
|
||||
}
|
||||
|
@ -265,7 +262,7 @@ class MessageUtilities {
|
|||
let {messagediv, pos, message} = this.getMessageData(e.currentTarget);
|
||||
if (messagediv && pos > -1 && message) {
|
||||
BDFDB.stopEvent(e);
|
||||
this.defaults.bindings[priorityaction].func.bind(this)({messagediv, pos, message});
|
||||
this.defaults.bindings[priorityaction].func.bind(this)({messagediv, pos, message}, priorityaction);
|
||||
}
|
||||
}
|
||||
this.cancelEvent(name);
|
||||
|
@ -279,69 +276,86 @@ class MessageUtilities {
|
|||
return valid;
|
||||
}
|
||||
|
||||
doDelete ({messagediv, pos, message}) {
|
||||
doDelete ({messagediv, pos, message}, action) {
|
||||
let deletelink = messagediv.parentElement.querySelector(BDFDB.dotCNS.messagelocalbotmessage + BDFDB.dotCN.anchor);
|
||||
if (deletelink) deletelink.click();
|
||||
else {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if ((channel && BDFDB.isUserAllowedTo("MANAGE_MESSAGES")) || message.author.id == BDFDB.myData.id && message.type != 1 && message.type != 2 && message.type != 3) {
|
||||
BDFDB.LibraryModules.MessageUtils.deleteMessage(message.channel_id, message.id, message.state != "SENT");
|
||||
if (BDFDB.getData(action, this, "toasts")) BDFDB.showToast("Message has been deleted", {type:"success"});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doEdit ({messagediv, pos, message}) {
|
||||
doEdit ({messagediv, pos, message}, action) {
|
||||
if (message.author.id == BDFDB.myData.id && !messagediv.querySelector("textarea")) {
|
||||
BDFDB.LibraryModules.MessageUtils.startEditMessage(message.channel_id, message.id, message.content);
|
||||
if (BDFDB.getData(action, this, "toasts")) BDFDB.showToast("Started editing.", {type:"success"});
|
||||
}
|
||||
}
|
||||
|
||||
doOpenReact ({messagediv, pos, message}) {
|
||||
doOpenReact ({messagediv, pos, message}, action) {
|
||||
let reactButton = messagediv.querySelector(BDFDB.dotCN.emojipickerbutton);
|
||||
if (reactButton) reactButton.click();
|
||||
if (reactButton) {
|
||||
reactButton.click();
|
||||
if (BDFDB.getData(action, this, "toasts")) BDFDB.showToast("Reaction popout has been opened.", {type:"success"});
|
||||
}
|
||||
}
|
||||
|
||||
doPinUnPin ({messagediv, pos, message}) {
|
||||
doPinUnPin ({messagediv, pos, message}, action) {
|
||||
if (message.state == "SENT") {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel && (channel.type == 1 || channel.type == 3 || BDFDB.isUserAllowedTo("MANAGE_MESSAGES")) && message.type == 0) {
|
||||
if (message.pinned) BDFDB.LibraryModules.MessagePinUtils.unpinMessage(channel, message.id);
|
||||
else BDFDB.LibraryModules.MessagePinUtils.pinMessage(channel, message.id);
|
||||
if (message.pinned) {
|
||||
BDFDB.LibraryModules.MessagePinUtils.unpinMessage(channel, message.id);
|
||||
if (BDFDB.getData(action, this, "toasts")) BDFDB.showToast("Message has been unpinned.", {type:"error"});
|
||||
}
|
||||
else {
|
||||
BDFDB.LibraryModules.MessagePinUtils.pinMessage(channel, message.id);
|
||||
if (BDFDB.getData(action, this, "toasts")) BDFDB.showToast("Message has been pinned.", {type:"success"});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
doCopyRaw ({messagediv, pos, message}) {
|
||||
if (message.content) BDFDB.LibraryRequires.electron.clipboard.write({text:message.content});
|
||||
doCopyRaw ({messagediv, pos, message}, action) {
|
||||
if (message.content) {
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({text:message.content});
|
||||
if (BDFDB.getData(action, this, "toasts")) BDFDB.showToast("Raw message content has been copied.", {type:"success"});
|
||||
}
|
||||
}
|
||||
|
||||
doCopyLink ({messagediv, pos, message}) {
|
||||
doCopyLink ({messagediv, pos, message}, action) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) BDFDB.LibraryRequires.electron.clipboard.write({text:`https://discordapp.com/channels/${channel.guild_id}/${channel.id}/${message.id}`});
|
||||
if (channel) {
|
||||
BDFDB.LibraryRequires.electron.clipboard.write({text:`https://discordapp.com/channels/${channel.guild_id}/${channel.id}/${message.id}`});
|
||||
if (BDFDB.getData(action, this, "toasts")) BDFDB.showToast("Messagelink has been copied.", {type:"success"});
|
||||
}
|
||||
}
|
||||
|
||||
doNote ({messagediv, pos, message}) {
|
||||
doNote ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Note_Message.plugin)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) BDFDB.getPlugin(this.defaults.bindings.__Note_Message.plugin).addMessageToNotes(message, messagediv, channel);
|
||||
}
|
||||
}
|
||||
|
||||
doTranslate ({messagediv, pos, message}) {
|
||||
doTranslate ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Translate_Message.plugin)) {
|
||||
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(message.channel_id);
|
||||
if (channel) BDFDB.getPlugin(this.defaults.bindings.__Translate_Message.plugin).translateMessage(message, messagediv, channel);
|
||||
}
|
||||
}
|
||||
|
||||
doQuote ({messagediv, pos, message}) {
|
||||
doQuote ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Quote_Message.plugin)) {
|
||||
let quoteButton = messagediv.querySelector(".btn-quote");
|
||||
if (quoteButton) quoteButton.click();
|
||||
}
|
||||
}
|
||||
|
||||
doCitate ({messagediv, pos, message}) {
|
||||
doCitate ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Citate_Message.plugin)) {
|
||||
console.log(messagediv.parentElement);
|
||||
let citarButton = messagediv.parentElement.querySelector(".citar-btn");
|
||||
|
@ -349,7 +363,7 @@ class MessageUtilities {
|
|||
}
|
||||
}
|
||||
|
||||
doReveal ({messagediv, pos, message}) {
|
||||
doReveal ({messagediv, pos, message}, action) {
|
||||
if (BDFDB.isPluginEnabled(this.defaults.bindings.__Reveal_Spoilers.plugin)) {
|
||||
BDFDB.getPlugin(this.defaults.bindings.__Reveal_Spoilers.plugin).revealAllSpoilers(messagediv);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue