This commit is contained in:
Mirco Wittrien 2021-07-27 18:25:02 +02:00
parent d1ffa34d8a
commit 8fe2892923
5 changed files with 55 additions and 38 deletions

View File

@ -5051,24 +5051,23 @@ module.exports = (_ => {
if (!this.props.value) return style; if (!this.props.value) return style;
style = Object.assign({}, style); style = Object.assign({}, style);
this.props.color = typeof this.props.getColor == "function" ? this.props.getColor(this.props.value) : this.props.color; this.props.color = typeof this.props.getColor == "function" ? this.props.getColor(this.props.value) : this.props.color;
style.borderColor = this.props.color; if (InternalComponents.LibraryComponents.Checkbox.Types) switch (this.props.type) {
if (InternalComponents.NativeSubComponents.Checkbox.Types) switch (this.props.type) { case InternalComponents.LibraryComponents.Checkbox.Types.DEFAULT:
case InternalComponents.NativeSubComponents.Checkbox.Types.DEFAULT:
style.borderColor = this.props.color; style.borderColor = this.props.color;
break; break;
case InternalComponents.NativeSubComponents.Checkbox.Types.GHOST: case InternalComponents.LibraryComponents.Checkbox.Types.GHOST:
let color = BDFDB.ColorUtils.setAlpha(this.props.color, 0.15, "RGB"); let color = BDFDB.ColorUtils.setAlpha(this.props.color, 0.15, "RGB");
style.backgroundColor = color; style.backgroundColor = color;
style.borderColor = color; style.borderColor = color;
break; break;
case InternalComponents.NativeSubComponents.Checkbox.Types.INVERTED: case InternalComponents.LibraryComponents.Checkbox.Types.INVERTED:
style.backgroundColor = this.props.color; style.backgroundColor = this.props.color;
style.borderColor = this.props.color; style.borderColor = this.props.color;
} }
return style; return style;
} }
getColor() { getColor() {
return this.props.value ? (InternalComponents.NativeSubComponents.Checkbox.Types && this.props.type === InternalComponents.NativeSubComponents.Checkbox.Types.INVERTED ? BDFDB.DiscordConstants.Colors.WHITE : this.props.color) : "transparent"; return this.props.value ? (InternalComponents.LibraryComponents.Checkbox.Types && this.props.type === InternalComponents.LibraryComponents.Checkbox.Types.INVERTED ? BDFDB.DiscordConstants.Colors.WHITE : this.props.color) : "transparent";
} }
handleChange(e) { handleChange(e) {
this.props.value = typeof this.props.getValue == "function" ? this.props.getValue(this.props.value, e) : !this.props.value; this.props.value = typeof this.props.getValue == "function" ? this.props.getValue(this.props.value, e) : !this.props.value;
@ -5101,7 +5100,7 @@ module.exports = (_ => {
}) })
}), }),
BDFDB.ReactUtils.createElement("div", { BDFDB.ReactUtils.createElement("div", {
className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.checkbox, this.props.shape, this.props.value && BDFDB.disCN.checkboxchecked), className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.checkbox, BDFDB.disCN["checkbox" + this.props.shape], this.props.value && BDFDB.disCN.checkboxchecked),
style: Object.assign({ style: Object.assign({
width: this.props.size, width: this.props.size,
height: this.props.size, height: this.props.size,
@ -5119,6 +5118,16 @@ module.exports = (_ => {
}); });
} }
}; };
InternalComponents.LibraryComponents.Checkbox.Types = {
DEFAULT: "DEFAULT",
GHOST: "GHOST",
INVERTED: "INVERTED"
};
InternalComponents.LibraryComponents.Checkbox.Shapes = {
BOX: "box",
ROUND: "round"
};
InternalBDFDB.setDefaultProps(InternalComponents.LibraryComponents.Checkbox, {type: InternalComponents.LibraryComponents.Checkbox.Types.INVERTED, shape: InternalComponents.LibraryComponents.Checkbox.Shapes.ROUND});
InternalComponents.LibraryComponents.Clickable = reactInitialized && class BDFDB_Clickable extends LibraryModules.React.Component { InternalComponents.LibraryComponents.Clickable = reactInitialized && class BDFDB_Clickable extends LibraryModules.React.Component {
handleClick(e) {if (typeof this.props.onClick == "function") this.props.onClick(e, this);} handleClick(e) {if (typeof this.props.onClick == "function") this.props.onClick(e, this);}

View File

@ -982,7 +982,8 @@
"verifiedBadge": "verifiedBadge-mH2YpO" "verifiedBadge": "verifiedBadge-mH2YpO"
}, },
"ShowHiddenChannels": { "ShowHiddenChannels": {
"accessModal": "accessModal-w5HjsV" "accessModal": "accessModal-w5HjsV",
"hiddenChannel": "hidden-9f2Dsa"
}, },
"SpotifyControls": { "SpotifyControls": {
"activityButton": "activityButton-5Fs4Aa", "activityButton": "activityButton-5Fs4Aa",
@ -1470,6 +1471,7 @@
"_showconnectionsicon": ["ShowConnections", "connectionIcon"], "_showconnectionsicon": ["ShowConnections", "connectionIcon"],
"_showconnectionsverifiedbadge": ["ShowConnections", "verifiedBadge"], "_showconnectionsverifiedbadge": ["ShowConnections", "verifiedBadge"],
"_showhiddenchannelsaccessmodal": ["ShowHiddenChannels", "accessModal"], "_showhiddenchannelsaccessmodal": ["ShowHiddenChannels", "accessModal"],
"_showhiddenchannelshiddenchannel": ["ShowHiddenChannels", "hiddenChannel"],
"_spellcheckerror": ["SpellCheck", "error"], "_spellcheckerror": ["SpellCheck", "error"],
"_spellcheckoverlay": ["SpellCheck", "overlay"], "_spellcheckoverlay": ["SpellCheck", "overlay"],
"_spotifycontrolsactivitybutton": ["SpotifyControls", "activityButton"], "_spotifycontrolsactivitybutton": ["SpotifyControls", "activityButton"],

View File

@ -2,7 +2,7 @@
* @name RevealAllSpoilers * @name RevealAllSpoilers
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.0.7 * @version 1.0.8
* @description Allows you to reveal all Spoilers within a Message/Status by holding the Ctrl Key and clicking a Spoiler * @description Allows you to reveal all Spoilers within a Message/Status by holding the Ctrl Key and clicking a Spoiler
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@ -17,14 +17,12 @@ module.exports = (_ => {
"info": { "info": {
"name": "RevealAllSpoilers", "name": "RevealAllSpoilers",
"author": "DevilBro", "author": "DevilBro",
"version": "1.0.7", "version": "1.0.8",
"description": "Allows you to reveal all Spoilers within a Message/Status by holding the Ctrl Key and clicking a Spoiler" "description": "Allows you to reveal all Spoilers within a Message/Status by holding the Ctrl Key and clicking a Spoiler"
}, },
"changeLog": { "changeLog": {
"improved": { "fixed": {
"Plugin Name": "Changed to clarify the Usage", "Replies": "No longer reveals spoilers within reply preview if revealing all spoilers within a message"
"Behaviour": "You no longer need to right click a message and press reveal all, simply hold Ctrl and click a Spoiler",
"About Me": "Also works on About Mes"
} }
} }
}; };
@ -97,7 +95,7 @@ module.exports = (_ => {
if (e2.methodArguments[0].ctrlKey) { if (e2.methodArguments[0].ctrlKey) {
BDFDB.ListenerUtils.stopEvent(e2.methodArguments[0]); BDFDB.ListenerUtils.stopEvent(e2.methodArguments[0]);
let parent = BDFDB.DOMUtils.getParent(BDFDB.dotCN.message, e2.methodArguments[0].target) || e2.methodArguments[0].target.parentElement; let parent = BDFDB.DOMUtils.getParent(BDFDB.dotCN.message, e2.methodArguments[0].target) || e2.methodArguments[0].target.parentElement;
if (parent) for (let spoiler of parent.querySelectorAll(BDFDB.dotCN.spoilerhidden)) spoiler.click(); if (parent) for (let spoiler of parent.querySelectorAll(BDFDB.dotCN.spoilerhidden)) if (!BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagerepliedmessagepreview, spoiler)) spoiler.click();
} }
}}, {force: true, noCache: true}); }}, {force: true, noCache: true});
} }

View File

@ -202,6 +202,7 @@ module.exports = (_ => {
before: { before: {
Channels: "render", Channels: "render",
ChannelCategoryItem: "type", ChannelCategoryItem: "type",
ChannelItem: "default",
VoiceUsers: "render" VoiceUsers: "render"
}, },
after: { after: {
@ -492,6 +493,8 @@ module.exports = (_ => {
processChannelItem (e) { processChannelItem (e) {
if (e.instance.props.channel && this.isChannelHidden(e.instance.props.channel.id)) { if (e.instance.props.channel && this.isChannelHidden(e.instance.props.channel.id)) {
if (!e.returnvalue) e.instance.props.className = BDFDB.DOMUtils.formatClassName(e.instance.props.className, BDFDB.disCN._showhiddenchannelshiddenchannel);
else {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "ChannelItemIcon"}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "ChannelItemIcon"});
let channelChildren = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelchildren]]}); let channelChildren = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelchildren]]});
if (channelChildren && channelChildren.props && channelChildren.props.children) { if (channelChildren && channelChildren.props && channelChildren.props.children) {
@ -521,6 +524,7 @@ module.exports = (_ => {
} }
} }
} }
}
processVoiceUsers (e) { processVoiceUsers (e) {
if (!this.settings.general.showVoiceUsers && this.isChannelHidden(e.instance.props.channel.id)) e.instance.props.voiceStates = []; if (!this.settings.general.showVoiceUsers && this.isChannelHidden(e.instance.props.channel.id)) e.instance.props.voiceStates = [];

View File

@ -2043,6 +2043,10 @@ a.metadataName-14STf- {
.checkbox-1ix_J3.checked-3_4uQ9[style*="border-color: hsl(235, "] { .checkbox-1ix_J3.checked-3_4uQ9[style*="border-color: hsl(235, "] {
border-color: rgb(var(--accentcolor)) !important; border-color: rgb(var(--accentcolor)) !important;
} }
.checkbox-1ix_J3 path[fill*="hsl(227, "],
.checkbox-1ix_J3 path[fill*="hsl(235, "] {
fill: rgb(var(--accentcolor)) !important;
}
.container-3auIfb { /* switch unchecked */ .container-3auIfb { /* switch unchecked */
background-color: rgb(114, 118, 125) !important; background-color: rgb(114, 118, 125) !important;