This commit is contained in:
Mirco Wittrien 2022-05-24 14:54:41 +02:00
parent 00995fdc52
commit 185bc4e958
3 changed files with 59 additions and 16 deletions

View File

@ -2,7 +2,7 @@
* @name BDFDB
* @author DevilBro
* @authorId 278543574059057154
* @version 2.3.7
* @version 2.3.8
* @description Required Library for DevilBro's Plugins
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -19,7 +19,7 @@ module.exports = (_ => {
"info": {
"name": "BDFDB",
"author": "DevilBro",
"version": "2.3.7",
"version": "2.3.8",
"description": "Required Library for DevilBro's Plugins"
},
"rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js"
@ -4808,7 +4808,7 @@ module.exports = (_ => {
},
onClick: this.props.disabled ? null : e => {
if (!this.props.action) return false;
!this.props.persisting && !hasPopout && this.props.onClose();
!this.props.persisting && !hasPopout && this.props.onClose && this.props.onClose();
this.props.action(e, this);
},
onMouseEnter: this.props.disabled ? null : e => {
@ -4821,6 +4821,12 @@ module.exports = (_ => {
},
"aria-disabled": this.props.disabled,
children: [
this.props.icon && this.props.showIconFirst && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuiconcontainerleft,
children: BDFDB.ReactUtils.createElement(this.props.icon, {
className: BDFDB.disCN.menuicon
})
}),
typeof this.props.render == "function" ? this.props.render(this) : this.props.render,
(this.props.label || this.props.subtext) && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menulabel,
@ -4836,12 +4842,16 @@ module.exports = (_ => {
className: BDFDB.disCN.menuhintcontainer,
children: typeof this.props.hint == "function" ? this.props.hint(this) : this.props.hint
}),
this.props.icon && BDFDB.ReactUtils.createElement("div", {
this.props.icon && !this.props.showIconFirst && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuiconcontainer,
children: BDFDB.ReactUtils.createElement(this.props.icon, {
className: BDFDB.disCN.menuicon
})
}),
this.props.input && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuiconcontainer,
children: this.props.input
}),
this.props.imageUrl && BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.menuimagecontainer,
children: BDFDB.ReactUtils.createElement("img", {
@ -4878,12 +4888,8 @@ module.exports = (_ => {
isFocused: this.state.hovered && !this.props.disabled
}));
return isItem ? item : BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Clickable, {
onMouseEnter: e => {
this.setState({hovered: true});
},
onMouseLeave: e => {
this.setState({hovered: false});
},
onMouseEnter: e => this.setState({hovered: true}),
onMouseLeave: e => this.setState({hovered: false}),
children: item
});
}
@ -6625,8 +6631,16 @@ module.exports = (_ => {
BDFDB.ReactUtils.forceUpdate(this);
}
render() {
return BDFDB.ReactUtils.createElement(Internal.NativeSubComponents.MenuCheckboxItem, Object.assign({}, this.props, {
checked: this.props.state && this.props.state.checked,
return BDFDB.ReactUtils.createElement(Internal.MenuItem, Object.assign({}, this.props, {
input: this.props.state && this.props.state.checked ? BDFDB.ReactUtils.createElement(Internal.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.menuicon,
background: BDFDB.disCN.menucheckbox,
foreground: BDFDB.disCN.menucheck,
name: Internal.LibraryComponents.SvgIcon.Names.CHECKBOX
}) : BDFDB.ReactUtils.createElement(Internal.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.menuicon,
name: Internal.LibraryComponents.SvgIcon.Names.CHECKBOX_EMPTY
}),
action: this.handleClick.bind(this)
}));
}

View File

@ -299,6 +299,7 @@
"Upload": {"class": "uploadmodal"},
"UserHook": {"class": "auditloguserhook"},
"UserMention": {"strings": ["inlinePreview", "getAvatarURL", "userId", "default.getName"]},
"UserPopoutAvatar": {"props": ["UserPopoutAvatar"]},
"UserProfileModal": {"lazyLoaded": true},
"UserProfileModalHeader": {"lazyLoaded": true},
"UserSettingsAppearance": {"class": "usersettingsappearancepreview"}
@ -2474,6 +2475,7 @@
"menuhintcontainer": ["Menu", "hintContainer"],
"menuicon": ["Menu", "icon"],
"menuiconcontainer": ["Menu", "iconContainer"],
"menuiconcontainerleft": ["Menu", "iconContainerLeft"],
"menuimage": ["Menu", "image"],
"menuimagecontainer": ["Menu", "imageContainer"],
"menuitem": ["Menu", "item"],

View File

@ -2,7 +2,7 @@
* @name GameActivityToggle
* @author DevilBro
* @authorId 278543574059057154
* @version 1.1.2
* @version 1.1.3
* @description Adds a Quick-Toggle Game Activity Button
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
@ -17,12 +17,12 @@ module.exports = (_ => {
"info": {
"name": "GameActivityToggle",
"author": "DevilBro",
"version": "1.1.2",
"version": "1.1.3",
"description": "Adds a Quick-Toggle Game Activity Button"
},
"changeLog": {
"fixed": {
"Account Switcher Overflow": "Fixed Issue, where the settings button would overflow in the account details, when the account switcher experiment was enabled, NOW FOR REAL"
"improved": {
"Menu Item Option": "Now allows you to add a Context Menu Item to the new User Account Popup in the bottom left"
}
}
};
@ -99,6 +99,8 @@ module.exports = (_ => {
this.defaults = {
general: {
showButton: {value: true, description: "Show Quick Toggle Button"},
showItem: {value: false, description: "Show Quick Toggle Item"},
playEnable: {value: true, description: "Play Enable Sound"},
playDisable: {value: true, description: "Play Disable Sound"}
},
@ -109,6 +111,9 @@ module.exports = (_ => {
};
this.patchedModules = {
before: {
Menu: "default"
},
after: {
Account: "render"
}
@ -206,7 +211,29 @@ module.exports = (_ => {
});
}
processMenu (e) {
if (!this.settings.general.showItem || e.instance.props.navId != "account") return;
let [_, oldIndex] = BDFDB.ContextMenuUtils.findItem(e.instance, {id: BDFDB.ContextMenuUtils.createItemId(this.name, "activity-toggle")});
if (oldIndex == -1) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.instance, {id: ["custom-status", "set-custom-status", "edit-custom-status"]});
if (index > -1) {
let isChecked = BDFDB.DiscordUtils.getSettings("ShowCurrentGame");
children.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuCheckboxItem, {
label: BDFDB.LanguageUtils.LanguageStrings.ACTIVITY_STATUS,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "activity-toggle"),
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
icon: BDFDB.LibraryComponents.SvgIcon.Names.GAMEPAD
}),
showIconFirst: true,
checked: isChecked,
action: _ => this.toggle()
}));
}
}
}
processAccount (e) {
if (!this.settings.general.showButton) return;
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "PanelButton"});
if (index > -1) {
e.returnvalue.props.className = BDFDB.DOMUtils.formatClassName(e.returnvalue.props.className, BDFDB.disCN._gameactivitytoggleadded);