stuff
This commit is contained in:
parent
422f4c9806
commit
e3b2f380bd
|
@ -2,7 +2,7 @@
|
||||||
* @name BDFDB
|
* @name BDFDB
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 2.2.1
|
* @version 2.2.2
|
||||||
* @description Required Library for DevilBro's Plugins
|
* @description Required Library for DevilBro's Plugins
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -19,7 +19,7 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "BDFDB",
|
"name": "BDFDB",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "2.2.1",
|
"version": "2.2.2",
|
||||||
"description": "Required Library for DevilBro's Plugins"
|
"description": "Required Library for DevilBro's Plugins"
|
||||||
},
|
},
|
||||||
"rawUrl": `https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js`
|
"rawUrl": `https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js`
|
||||||
|
@ -6589,7 +6589,7 @@ module.exports = (_ => {
|
||||||
render() {
|
render() {
|
||||||
let value = this.props.state && this.props.state.value || 0;
|
let value = this.props.state && this.props.state.value || 0;
|
||||||
return BDFDB.ReactUtils.createElement(Internal.NativeSubComponents.MenuControlItem, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
|
return BDFDB.ReactUtils.createElement(Internal.NativeSubComponents.MenuControlItem, BDFDB.ObjectUtils.exclude(Object.assign({}, this.props, {
|
||||||
label: typeof this.props.renderLabel == "function" ? this.props.renderLabel(Math.round(value * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits)) : this.props.label,
|
label: typeof this.props.renderLabel == "function" ? this.props.renderLabel(Math.round(value * Math.pow(10, this.props.digits)) / Math.pow(10, this.props.digits), this) : this.props.label,
|
||||||
control: (menuItemProps, ref) => {
|
control: (menuItemProps, ref) => {
|
||||||
return BDFDB.ReactUtils.createElement("div", {
|
return BDFDB.ReactUtils.createElement("div", {
|
||||||
className: BDFDB.disCN.menuslidercontainer,
|
className: BDFDB.disCN.menuslidercontainer,
|
||||||
|
@ -7204,7 +7204,7 @@ module.exports = (_ => {
|
||||||
children: [
|
children: [
|
||||||
BDFDB.ReactUtils.createElement("div", {
|
BDFDB.ReactUtils.createElement("div", {
|
||||||
className: BDFDB.disCN.settingstablecardlabel,
|
className: BDFDB.disCN.settingstablecardlabel,
|
||||||
children: this.props.renderLabel(props)
|
children: this.props.renderLabel(props, this)
|
||||||
}),
|
}),
|
||||||
BDFDB.ReactUtils.createElement("div", {
|
BDFDB.ReactUtils.createElement("div", {
|
||||||
className: BDFDB.disCN.settingstablecardconfigs,
|
className: BDFDB.disCN.settingstablecardconfigs,
|
||||||
|
@ -8362,12 +8362,12 @@ module.exports = (_ => {
|
||||||
Internal.patchContextMenu = function (plugin, type, module) {
|
Internal.patchContextMenu = function (plugin, type, module) {
|
||||||
if (!module || !module.default) return;
|
if (!module || !module.default) return;
|
||||||
plugin = plugin == BDFDB && Internal || plugin;
|
plugin = plugin == BDFDB && Internal || plugin;
|
||||||
const caller = `on${InternalData.ModuleUtilsConfig.ContextMenuTypesMap[type] || type}`;
|
const mappedType = InternalData.ModuleUtilsConfig.ContextMenuTypesMap[type] || type;
|
||||||
if (!InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type]) {
|
if (!InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType]) {
|
||||||
const call = (args, props, returnValue, name) => {
|
const call = (args, props, returnValue, name) => {
|
||||||
if (!returnValue || !returnValue.props || !returnValue.props.children || returnValue.props.children.__BDFDBPatchesCalled && returnValue.props.children.__BDFDBPatchesCalled[plugin.name]) return;
|
if (!returnValue || !returnValue.props || !returnValue.props.children || returnValue.props.children.__BDFDBPatchesCalled && returnValue.props.children.__BDFDBPatchesCalled[plugin.name]) return;
|
||||||
returnValue.props.children.__BDFDBPatchesCalled = Object.assign({}, returnValue.props.children.__BDFDBPatchesCalled, {[plugin.name]: true});
|
returnValue.props.children.__BDFDBPatchesCalled = Object.assign({}, returnValue.props.children.__BDFDBPatchesCalled, {[plugin.name]: true});
|
||||||
return plugin[caller]({
|
return plugin[`on${mappedType}`]({
|
||||||
arguments: args,
|
arguments: args,
|
||||||
instance: {props: props},
|
instance: {props: props},
|
||||||
returnvalue: returnValue,
|
returnvalue: returnValue,
|
||||||
|
@ -8377,7 +8377,7 @@ module.exports = (_ => {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
|
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
|
||||||
if (typeof plugin[caller] != "function") return;
|
if (typeof plugin[`on${mappedType}`] != "function") return;
|
||||||
else if (e.returnValue && e.returnValue.props.children !== undefined) {
|
else if (e.returnValue && e.returnValue.props.children !== undefined) {
|
||||||
if (e.returnValue.props.navId) {
|
if (e.returnValue.props.navId) {
|
||||||
e.returnValue.props.children = [e.returnValue.props.children].flat(10);
|
e.returnValue.props.children = [e.returnValue.props.children].flat(10);
|
||||||
|
@ -8400,22 +8400,30 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else BDFDB.PatchUtils.patch(plugin, e.returnValue, "type", {after: e2 => {
|
else BDFDB.PatchUtils.patch(plugin, e.returnValue, "type", {after: e2 => {
|
||||||
if (e2.returnValue && typeof plugin[caller] == "function") call(e2.methodArguments, e2.methodArguments[0], e2.returnValue, module.default.displayName);
|
if (e2.returnValue && typeof plugin[`on${mappedType}`] == "function") call(e2.methodArguments, e2.methodArguments[0], e2.returnValue, module.default.displayName);
|
||||||
}}, {noCache: true});
|
}}, {noCache: true});
|
||||||
}}, {name: type});
|
}}, {name: type});
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
const getProps = (props, key) => {
|
const getProps = (props, keys) => {
|
||||||
const store = `${Internal.LibraryModules.StringUtils.upperCaseFirstChar(key)}Store`;
|
let newProps = Object.assign({}, BDFDB.ObjectUtils.is(props) ? props : typeof props == "string" ? {id: props} : {});
|
||||||
const getter = `get${Internal.LibraryModules.StringUtils.upperCaseFirstChar(key)}`;
|
for (const key of [keys].flat(10).filter(n => n)) {
|
||||||
return Object.assign({}, BDFDB.ObjectUtils.is(props) ? props : typeof props == "string" ? {id: props} : {}, {[key]: (props && props[key] || Internal.LibraryModules[store] && typeof Internal.LibraryModules[store][getter] == "function" && Internal.LibraryModules[store][getter](props && props.id || props))});
|
const store = `${Internal.LibraryModules.StringUtils.upperCaseFirstChar(key)}Store`;
|
||||||
|
const getter = `get${Internal.LibraryModules.StringUtils.upperCaseFirstChar(key)}`;
|
||||||
|
const value = props && props[key] || Internal.LibraryModules[store] && typeof Internal.LibraryModules[store][getter] == "function" && Internal.LibraryModules[store][getter](props && props.id || props);
|
||||||
|
if (value) {
|
||||||
|
newProps = Object.assign(newProps, {[key]: value});
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return newProps;
|
||||||
};
|
};
|
||||||
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
|
BDFDB.PatchUtils.patch(plugin, module, "default", {after: e => {
|
||||||
if (typeof plugin[caller] != "function") return;
|
if (typeof plugin[`on${mappedType}`] != "function") return;
|
||||||
e.returnValue = [e.returnValue].flat(10).filter(n => n);
|
e.returnValue = [e.returnValue].flat(10).filter(n => n);
|
||||||
return plugin[caller]({
|
return plugin[`on${mappedType}`]({
|
||||||
arguments: e.methodArguments,
|
arguments: e.methodArguments,
|
||||||
instance: {props: InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type].key && getProps(e.methodArguments[0], InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type].key) || e.methodArguments[0]},
|
instance: {props: InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType].keys && getProps(e.methodArguments[0], InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType].keys) || e.methodArguments[0]},
|
||||||
returnvalue: e.returnValue,
|
returnvalue: e.returnValue,
|
||||||
component: module,
|
component: module,
|
||||||
methodname: "default",
|
methodname: "default",
|
||||||
|
@ -8458,10 +8466,8 @@ module.exports = (_ => {
|
||||||
const returnValue = exports.default({});
|
const returnValue = exports.default({});
|
||||||
if (returnValue && returnValue.props && returnValue.props.object == BDFDB.DiscordConstants.AnalyticsObjects.CONTEXT_MENU) {
|
if (returnValue && returnValue.props && returnValue.props.object == BDFDB.DiscordConstants.AnalyticsObjects.CONTEXT_MENU) {
|
||||||
for (const type in PluginStores.contextChunkObserver) {
|
for (const type in PluginStores.contextChunkObserver) {
|
||||||
const name = PluginStores.contextChunkObserver[type].filter(returnValue.props.children.type);
|
if (PluginStores.contextChunkObserver[type].filter(returnValue.props.children)) {
|
||||||
if (name) {
|
exports.__BDFDB_ContextMenuWrapper_Patch_Name = exports.__BDFDB_ContextMenu_Patch_Name;
|
||||||
exports.__BDFDB_ContextMenu_Patch_Name = name;
|
|
||||||
exports.__BDFDB_ContextMenuWrapper_Patch_Name = name;
|
|
||||||
found = true;
|
found = true;
|
||||||
if (PluginStores.contextChunkObserver[type].modules.indexOf(exports) == -1) PluginStores.contextChunkObserver[type].modules.push(exports);
|
if (PluginStores.contextChunkObserver[type].modules.indexOf(exports) == -1) PluginStores.contextChunkObserver[type].modules.push(exports);
|
||||||
for (const plugin of PluginStores.contextChunkObserver[type].query) Internal.patchContextMenu(plugin, type, exports);
|
for (const plugin of PluginStores.contextChunkObserver[type].query) Internal.patchContextMenu(plugin, type, exports);
|
||||||
|
@ -8471,9 +8477,7 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!found) for (const type in PluginStores.contextChunkObserver) {
|
if (!found) for (const type in PluginStores.contextChunkObserver) {
|
||||||
const name = PluginStores.contextChunkObserver[type].filter(exports.default);
|
if (PluginStores.contextChunkObserver[type].filter(exports)) {
|
||||||
if (name) {
|
|
||||||
exports.__BDFDB_ContextMenu_Patch_Name = name;
|
|
||||||
if (PluginStores.contextChunkObserver[type].modules.indexOf(exports) == -1) PluginStores.contextChunkObserver[type].modules.push(exports);
|
if (PluginStores.contextChunkObserver[type].modules.indexOf(exports) == -1) PluginStores.contextChunkObserver[type].modules.push(exports);
|
||||||
for (const plugin of PluginStores.contextChunkObserver[type].query) Internal.patchContextMenu(plugin, type, exports);
|
for (const plugin of PluginStores.contextChunkObserver[type].query) Internal.patchContextMenu(plugin, type, exports);
|
||||||
break;
|
break;
|
||||||
|
@ -8513,10 +8517,36 @@ module.exports = (_ => {
|
||||||
if (InternalData.ModuleUtilsConfig.ContextMenuTypes) for (let type of InternalData.ModuleUtilsConfig.ContextMenuTypes) {
|
if (InternalData.ModuleUtilsConfig.ContextMenuTypes) for (let type of InternalData.ModuleUtilsConfig.ContextMenuTypes) {
|
||||||
type = `${type}ContextMenu`;
|
type = `${type}ContextMenu`;
|
||||||
if (!PluginStores.contextChunkObserver[type]) {
|
if (!PluginStores.contextChunkObserver[type]) {
|
||||||
|
const mappedType = InternalData.ModuleUtilsConfig.ContextMenuTypesMap[type] || type;
|
||||||
PluginStores.contextChunkObserver[type] = {query: [], modules: []};
|
PluginStores.contextChunkObserver[type] = {query: [], modules: []};
|
||||||
if (!InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type]) PluginStores.contextChunkObserver[type].filter = m => m && (m.displayName && m.displayName.endsWith("ContextMenu") && `${InternalData.ModuleUtilsConfig.ContextMenuTypes.find(t => m.displayName.indexOf(t) > -1)}ContextMenu` == type || m.__BDFDB_ContextMenuWrapper_Patch_Name && m.__BDFDB_ContextMenuWrapper_Patch_Name.endsWith("ContextMenu") && `${InternalData.ModuleUtilsConfig.ContextMenuTypes.find(t => m.__BDFDB_ContextMenuWrapper_Patch_Name.indexOf(t) > -1)}ContextMenu` == type) && type;
|
if (!InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType]) PluginStores.contextChunkObserver[type].filter = m => {
|
||||||
else PluginStores.contextChunkObserver[type].filter = m => m && (m.displayName && InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type].items.indexOf(m.displayName) > -1 && m.displayName || InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[type].items.find(item => InternalData.ModuleUtilsConfig.Finder[item] && InternalData.ModuleUtilsConfig.Finder[item].strings && Internal.hasModuleStrings(m, InternalData.ModuleUtilsConfig.Finder[item].strings)));
|
if (!m || !(m.default || m.type)) return;
|
||||||
PluginStores.contextChunkObserver[type].modules = BDFDB.ModuleUtils.find(PluginStores.contextChunkObserver[type].filter, {all: true});
|
const d = m.default || m.type;
|
||||||
|
if (d.displayName && d.displayName.endsWith("ContextMenu") && `${InternalData.ModuleUtilsConfig.ContextMenuTypes.find(t => d.displayName.indexOf(t) > -1)}ContextMenu` == type) {
|
||||||
|
m.__BDFDB_ContextMenu_Patch_Name = type;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if (m.__BDFDB_ContextMenuWrapper_Patch_Name && m.__BDFDB_ContextMenuWrapper_Patch_Name.endsWith("ContextMenu") && `${InternalData.ModuleUtilsConfig.ContextMenuTypes.find(t => m.__BDFDB_ContextMenuWrapper_Patch_Name.indexOf(t) > -1)}ContextMenu` == type) {
|
||||||
|
m.__BDFDB_ContextMenu_Patch_Name = type;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
else PluginStores.contextChunkObserver[type].filter = m => {
|
||||||
|
if (!m || !(m.default || m.type)) return;
|
||||||
|
const d = m.default || m.type;
|
||||||
|
if (d.displayName && InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType].items.indexOf(d.displayName) > -1) {
|
||||||
|
m.__BDFDB_ContextMenu_Patch_Name = d.displayName;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
const subType = InternalData.ModuleUtilsConfig.ContextMenuSubItemsMap[mappedType].items.find(item => InternalData.ModuleUtilsConfig.Finder[item] && InternalData.ModuleUtilsConfig.Finder[item].strings && Internal.hasModuleStrings(d, InternalData.ModuleUtilsConfig.Finder[item].strings));
|
||||||
|
if (subType) {
|
||||||
|
m.__BDFDB_ContextMenu_Patch_Name = subType;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
PluginStores.contextChunkObserver[type].modules = BDFDB.ModuleUtils.find(PluginStores.contextChunkObserver[type].filter, {useExport: false, all: true}).map(m => m.exports).filter(n => n);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name EditUsers
|
* @name EditUsers
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 4.5.2
|
* @version 4.5.3
|
||||||
* @description Allows you to locally edit Users
|
* @description Allows you to locally edit Users
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,13 +17,8 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "EditUsers",
|
"name": "EditUsers",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "4.5.2",
|
"version": "4.5.3",
|
||||||
"description": "Allows you to locally edit Users"
|
"description": "Allows you to locally edit Users"
|
||||||
},
|
|
||||||
"changeLog": {
|
|
||||||
"fixed": {
|
|
||||||
"PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -387,6 +382,18 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onUserContextMenu (e) {
|
onUserContextMenu (e) {
|
||||||
|
if (e.instance.props.channel && e.instance.props.channel.isDM()) {
|
||||||
|
const user = BDFDB.LibraryModules.UserStore.getUser(e.instance.props.channel.getRecipientId());
|
||||||
|
if (user && this.settings.places.contextMenu && e.subType == "useMuteChannelItem") {
|
||||||
|
let userName = this.getUserData(user.id).username;
|
||||||
|
if (userName != user.username) {
|
||||||
|
let [muteChildren, muteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "mute-channel"});
|
||||||
|
if (muteIndex > -1) muteChildren[muteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("MUTE_CHANNEL", `@${userName}`);
|
||||||
|
let [unmuteChildren, unmuteIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "unmute-channel"});
|
||||||
|
if (unmuteIndex > -1) unmuteChildren[unmuteIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("UNMUTE_CHANNEL", `@${userName}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (e.instance.props.user) {
|
if (e.instance.props.user) {
|
||||||
if (this.settings.places.contextMenu && e.subType == "useUserManagementItems") {
|
if (this.settings.places.contextMenu && e.subType == "useUserManagementItems") {
|
||||||
let userName = this.getUserData(e.instance.props.user.id).username;
|
let userName = this.getUserData(e.instance.props.user.id).username;
|
||||||
|
@ -401,7 +408,7 @@ module.exports = (_ => {
|
||||||
if (banIndex > -1) banChildren[banIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("BAN_USER", userName);
|
if (banIndex > -1) banChildren[banIndex].props.label = BDFDB.LanguageUtils.LanguageStringsFormat("BAN_USER", userName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (e.subType == "useUserRolesItems") {
|
if (e.subType == "useBlockUserItem") {
|
||||||
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
||||||
e.returnvalue.push(this.createContextMenuEntry(e.instance.props.user));
|
e.returnvalue.push(this.createContextMenuEntry(e.instance.props.user));
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name ImageUtilities
|
* @name ImageUtilities
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 4.5.9
|
* @version 4.6.0
|
||||||
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
|
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "ImageUtilities",
|
"name": "ImageUtilities",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "4.5.9",
|
"version": "4.6.0",
|
||||||
"description": "Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)"
|
"description": "Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -220,6 +220,9 @@ module.exports = (_ => {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
}
|
}
|
||||||
${BDFDB.dotCN._imageutilitiesimagedetails} > a {
|
${BDFDB.dotCN._imageutilitiesimagedetails} > a {
|
||||||
|
max-width: 300px;
|
||||||
|
}
|
||||||
|
span + ${BDFDB.dotCN._imageutilitiesimagedetails} > a {
|
||||||
max-width: 200px;
|
max-width: 200px;
|
||||||
}
|
}
|
||||||
${BDFDB.dotCN._imageutilitiesimagedetails} > span {
|
${BDFDB.dotCN._imageutilitiesimagedetails} > span {
|
||||||
|
@ -306,21 +309,12 @@ module.exports = (_ => {
|
||||||
});
|
});
|
||||||
|
|
||||||
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MediaComponentUtils, "renderImageComponent", {
|
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.MediaComponentUtils, "renderImageComponent", {
|
||||||
before: e => {
|
|
||||||
if (this.settings.general.showInDescription && e.methodArguments[0].original && e.methodArguments[0].src.indexOf("https://media.discordapp.net/attachments") == 0 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedmedia) == -1 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedthumbnail) == -1 && BDFDB.ReactUtils.findChild(e.returnValue, {name: ["LazyImageZoomable", "LazyImage"]})) {
|
|
||||||
e.thisObject.props.alt = e.thisObject.props.alt || "__BDFDB__PLACEHOLDER__";
|
|
||||||
e.thisObject.props.injectDescription = true;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
after: e => {
|
after: e => {
|
||||||
if (e.thisObject.props.injectDescription) {
|
if (this.settings.general.showInDescription && e.methodArguments[0].original && e.methodArguments[0].src.indexOf("https://media.discordapp.net/attachments") == 0 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedmedia) == -1 && (e.methodArguments[0].className || "").indexOf(BDFDB.disCN.embedthumbnail) == -1 && BDFDB.ReactUtils.findChild(e.returnValue, {name: ["LazyImageZoomable", "LazyImage"]})) {
|
||||||
let altText = BDFDB.ReactUtils.findChild(e.returnValue, {props: [["className", BDFDB.disCN.imagealttext]]});
|
e.returnValue.props.children[1] = BDFDB.ReactUtils.createElement("span", {
|
||||||
if (!altText) return;
|
className: BDFDB.disCN.imagealttext,
|
||||||
altText.props.children = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
|
|
||||||
children: [
|
children: [
|
||||||
altText.props.children == "__BDFDB__PLACEHOLDER__" ? null : BDFDB.ReactUtils.createElement("span", {
|
e.returnValue.props.children[1],
|
||||||
children: altText.props.children
|
|
||||||
}),
|
|
||||||
BDFDB.ReactUtils.createElement(ImageDetailsComponent, {
|
BDFDB.ReactUtils.createElement(ImageDetailsComponent, {
|
||||||
original: e.methodArguments[0].original,
|
original: e.methodArguments[0].original,
|
||||||
attachment: {
|
attachment: {
|
||||||
|
@ -545,13 +539,9 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
onDMContextMenu (e) {
|
|
||||||
if (e.instance.props.user && this.settings.places.userAvatars) this.injectItem(e, (e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096, true));
|
|
||||||
}
|
|
||||||
|
|
||||||
onUserContextMenu (e) {
|
onUserContextMenu (e) {
|
||||||
if (e.instance.props.user && this.settings.places.userAvatars && e.subType == "useUserRolesItems") {
|
if (e.instance.props.user && this.settings.places.userAvatars && e.subType == "useBlockUserItem") {
|
||||||
let validUrls = this.filterUrls((e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096, true));
|
let validUrls = this.filterUrls((e.instance.props.user.getAvatarURL(null, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(null, 4096, true), (e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(e.instance.props.guildId, 4096, true));
|
||||||
if (!validUrls.length) return;
|
if (!validUrls.length) return;
|
||||||
|
|
||||||
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
||||||
|
@ -568,9 +558,7 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
|
|
||||||
onNativeContextMenu (e) {
|
onNativeContextMenu (e) {
|
||||||
if (e.type == "NativeImageContextMenu" && (e.instance.props.href || e.instance.props.src)) {
|
if (e.type == "NativeImageContextMenu" && (e.instance.props.href || e.instance.props.src)) this.injectItem(e, e.instance.props.href || e.instance.props.src);
|
||||||
this.injectItem(e, e.instance.props.href || e.instance.props.src);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onMessageContextMenu (e) {
|
onMessageContextMenu (e) {
|
||||||
|
@ -651,7 +639,19 @@ module.exports = (_ => {
|
||||||
|
|
||||||
createSubMenus (instance, validUrls) {
|
createSubMenus (instance, validUrls) {
|
||||||
return validUrls.length == 1 ? this.createUrlMenu(instance, validUrls[0]) : validUrls.map((urlData, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
return validUrls.length == 1 ? this.createUrlMenu(instance, validUrls[0]) : validUrls.map((urlData, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: urlData.fileType.toUpperCase(),
|
label: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
|
||||||
|
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
|
||||||
|
children: [
|
||||||
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.AvatarComponents.default, {
|
||||||
|
src: urlData.src || urlData.file,
|
||||||
|
size: BDFDB.LibraryComponents.AvatarComponents.Sizes.SIZE_40
|
||||||
|
}),
|
||||||
|
BDFDB.ReactUtils.createElement("span", {
|
||||||
|
style: {marginLeft: 12},
|
||||||
|
children: urlData.fileType.toUpperCase()
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}),
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "subitem", i),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "subitem", i),
|
||||||
children: this.createUrlMenu(instance, urlData)
|
children: this.createUrlMenu(instance, urlData)
|
||||||
}));
|
}));
|
||||||
|
@ -696,7 +696,6 @@ module.exports = (_ => {
|
||||||
label: this.labels.context_view.replace("{{var0}}", type),
|
label: this.labels.context_view.replace("{{var0}}", type),
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "view-file"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "view-file"),
|
||||||
action: _ => {
|
action: _ => {
|
||||||
console.log(urlData);
|
|
||||||
let img = document.createElement(isVideo ? "video" : "img");
|
let img = document.createElement(isVideo ? "video" : "img");
|
||||||
img.addEventListener(isVideo ? "loadedmetadata" : "load", function() {
|
img.addEventListener(isVideo ? "loadedmetadata" : "load", function() {
|
||||||
BDFDB.LibraryModules.ModalUtils.openModal(modalData => {
|
BDFDB.LibraryModules.ModalUtils.openModal(modalData => {
|
||||||
|
@ -781,7 +780,6 @@ module.exports = (_ => {
|
||||||
if (clickedImage) e.instance.props.cachedImage = clickedImage;
|
if (clickedImage) e.instance.props.cachedImage = clickedImage;
|
||||||
let url = this.getImageSrc(e.instance.props.cachedImage && e.instance.props.cachedImage.src ? e.instance.props.cachedImage : e.instance.props.src);
|
let url = this.getImageSrc(e.instance.props.cachedImage && e.instance.props.cachedImage.src ? e.instance.props.cachedImage : e.instance.props.src);
|
||||||
url = this.getImageSrc(typeof e.instance.props.children == "function" && e.instance.props.children(Object.assign({}, e.instance.props, {size: e.instance.props})).props.src) || url;
|
url = this.getImageSrc(typeof e.instance.props.children == "function" && e.instance.props.children(Object.assign({}, e.instance.props, {size: e.instance.props})).props.src) || url;
|
||||||
console.log(url);
|
|
||||||
let isVideo = this.isValid(url, "video");
|
let isVideo = this.isValid(url, "video");
|
||||||
let messages = this.getMessageGroupOfImage(url);
|
let messages = this.getMessageGroupOfImage(url);
|
||||||
if (e.returnvalue) {
|
if (e.returnvalue) {
|
||||||
|
@ -793,12 +791,28 @@ module.exports = (_ => {
|
||||||
children: Object.keys(this.defaults.zoomSettings).map(type => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSliderItem, Object.assign({
|
children: Object.keys(this.defaults.zoomSettings).map(type => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSliderItem, Object.assign({
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, type),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, type),
|
||||||
value: this.settings.zoomSettings[type],
|
value: this.settings.zoomSettings[type],
|
||||||
renderLabel: value => {
|
renderLabel: (value, instance) => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
|
||||||
return (this.labels[this.defaults.zoomSettings[type].label] || BDFDB.LanguageUtils.LanguageStrings[this.defaults.zoomSettings[type].label]) + ": " + value + this.defaults.zoomSettings[type].unit;
|
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
|
||||||
},
|
children: [
|
||||||
onValueRender: value => {
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
|
||||||
return value + this.defaults.zoomSettings[type].unit;
|
children: `${this.labels[this.defaults.zoomSettings[type].label] || BDFDB.LanguageUtils.LanguageStrings[this.defaults.zoomSettings[type].label]}:`
|
||||||
},
|
}),
|
||||||
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
|
||||||
|
type: "number",
|
||||||
|
size: BDFDB.LibraryComponents.TextInput.Sizes.MINI,
|
||||||
|
style: {width: 70},
|
||||||
|
min: 1,
|
||||||
|
max: this.defaults.zoomSettings[type].maxValue,
|
||||||
|
value: this.settings.zoomSettings[type],
|
||||||
|
onChange: value => value && value >= this.defaults.zoomSettings[type].minValue && instance.handleValueChange(BDFDB.NumberUtils.mapRange([this.defaults.zoomSettings[type].minValue, this.defaults.zoomSettings[type].maxValue], [0, 100], value))
|
||||||
|
}),
|
||||||
|
BDFDB.ReactUtils.createElement("span", {
|
||||||
|
style: {width: 20},
|
||||||
|
children: this.defaults.zoomSettings[type].unit
|
||||||
|
})
|
||||||
|
]
|
||||||
|
}),
|
||||||
|
onValueRender: value => `${value}${this.defaults.zoomSettings[type].unit}`,
|
||||||
onValueChange: value => {
|
onValueChange: value => {
|
||||||
this.settings.zoomSettings[type] = value;
|
this.settings.zoomSettings[type] = value;
|
||||||
BDFDB.DataUtils.save(this.settings.zoomSettings, this, "zoomSettings");
|
BDFDB.DataUtils.save(this.settings.zoomSettings, this, "zoomSettings");
|
||||||
|
@ -880,7 +894,6 @@ module.exports = (_ => {
|
||||||
else this.loadImage(e.instance, data.next, "next");
|
else this.loadImage(e.instance, data.next, "next");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
console.log(e);
|
|
||||||
if (this.settings.general.addDetails) e.returnvalue.props.children.push(BDFDB.ReactUtils.createElement("div", {
|
if (this.settings.general.addDetails) e.returnvalue.props.children.push(BDFDB.ReactUtils.createElement("div", {
|
||||||
className: BDFDB.disCN._imageutilitiesdetailswrapper,
|
className: BDFDB.disCN._imageutilitiesdetailswrapper,
|
||||||
children: [
|
children: [
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name PinDMs
|
* @name PinDMs
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.8.9
|
* @version 1.9.0
|
||||||
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
|
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,13 +17,8 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "PinDMs",
|
"name": "PinDMs",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "1.8.9",
|
"version": "1.9.0",
|
||||||
"description": "Allows you to pin DMs, making them appear at the top of your DMs/ServerList"
|
"description": "Allows you to pin DMs, making them appear at the top of your DMs/ServerList"
|
||||||
},
|
|
||||||
"changeLog": {
|
|
||||||
"fixed": {
|
|
||||||
"PlatformIndicators": "Fixed Plugin Issue with PlatformIndicators that broke Features in the DM List"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -257,31 +252,25 @@ module.exports = (_ => {
|
||||||
BDFDB.DiscordUtils.rerenderAll();
|
BDFDB.DiscordUtils.rerenderAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
onDMContextMenu (e) {
|
onUserContextMenu (e) {
|
||||||
if (e.instance.props.user) {
|
if (e.instance.props.channel && e.subType == "useCloseDMItem") e.returnvalue.unshift(this.createItem(e.instance.props.channel.id));
|
||||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"});
|
|
||||||
if (index > -1) {
|
|
||||||
let id = BDFDB.LibraryModules.ChannelStore.getDMFromUserId(e.instance.props.user.id);
|
|
||||||
if (id) this.injectItem(e.instance, id, children, index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onGroupDMContextMenu (e) {
|
onGroupDMContextMenu (e) {
|
||||||
if (e.instance.props.channel) {
|
if (e.instance.props.channel) {
|
||||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon"});
|
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon"});
|
||||||
if (index > -1) this.injectItem(e.instance, e.instance.props.channel.id, children, index + 1);
|
if (index > -1) children.splice(index + 1, 0, this.createItem(e.instance.props.channel.id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
injectItem (instance, id, children, index) {
|
createItem (id) {
|
||||||
if (!id) return;
|
if (!id) return;
|
||||||
let pinnedInGuild = this.isPinnedInGuilds(id);
|
let pinnedInGuild = this.isPinnedInGuilds(id);
|
||||||
|
|
||||||
let categories = this.sortAndUpdateCategories("channelList", true);
|
let categories = this.sortAndUpdateCategories("channelList", true);
|
||||||
let currentCategory = this.getChannelListCategory(id);
|
let currentCategory = this.getChannelListCategory(id);
|
||||||
|
|
||||||
children.splice(index, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
return BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: this.labels.context_pindm,
|
label: this.labels.context_pindm,
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-pin"),
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "submenu-pin"),
|
||||||
children: [
|
children: [
|
||||||
|
@ -339,7 +328,7 @@ module.exports = (_ => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
].filter(n => n)
|
].filter(n => n)
|
||||||
}));
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
processPrivateChannelsList (e) {
|
processPrivateChannelsList (e) {
|
||||||
|
|
|
@ -124,7 +124,7 @@ module.exports = (_ => {
|
||||||
label: [
|
label: [
|
||||||
BDFDB.ReactUtils.createElement("span", {
|
BDFDB.ReactUtils.createElement("span", {
|
||||||
className: BDFDB.disCN.username,
|
className: BDFDB.disCN.username,
|
||||||
children: this.props.user.username,
|
children: this.props.user.nick || this.props.user.username,
|
||||||
style: {color: this.props.user.colorString}
|
style: {color: this.props.user.colorString}
|
||||||
}),
|
}),
|
||||||
!this.props.user.discriminator ? null : BDFDB.ReactUtils.createElement("span", {
|
!this.props.user.discriminator ? null : BDFDB.ReactUtils.createElement("span", {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
* @name UserNotes
|
* @name UserNotes
|
||||||
* @author DevilBro
|
* @author DevilBro
|
||||||
* @authorId 278543574059057154
|
* @authorId 278543574059057154
|
||||||
* @version 1.0.8
|
* @version 1.0.9
|
||||||
* @description Allows you to write User Notes locally
|
* @description Allows you to write User Notes locally
|
||||||
* @invite Jx3TjNS
|
* @invite Jx3TjNS
|
||||||
* @donate https://www.paypal.me/MircoWittrien
|
* @donate https://www.paypal.me/MircoWittrien
|
||||||
|
@ -17,7 +17,7 @@ module.exports = (_ => {
|
||||||
"info": {
|
"info": {
|
||||||
"name": "UserNotes",
|
"name": "UserNotes",
|
||||||
"author": "DevilBro",
|
"author": "DevilBro",
|
||||||
"version": "1.0.8",
|
"version": "1.0.9",
|
||||||
"description": "Allows you to write User Notes locally"
|
"description": "Allows you to write User Notes locally"
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -92,21 +92,8 @@ module.exports = (_ => {
|
||||||
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, settingsItems);
|
||||||
}
|
}
|
||||||
|
|
||||||
onDMContextMenu (e) {
|
|
||||||
if (e.instance.props.user) {
|
|
||||||
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
|
|
||||||
children.splice(index > -1 ? index : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
|
||||||
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
|
||||||
label: this.labels.user_note,
|
|
||||||
id: BDFDB.ContextMenuUtils.createItemId(this.name, "user-note"),
|
|
||||||
action: _ => this.openNotesModal(e.instance.props.user)
|
|
||||||
})
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
onUserContextMenu (e) {
|
onUserContextMenu (e) {
|
||||||
if (e.instance.props.user && e.subType == "useUserRolesItems") {
|
if (e.instance.props.user && e.subType == "useBlockUserItem") {
|
||||||
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
if (e.returnvalue.length) e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuSeparator, {}));
|
||||||
e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
e.returnvalue.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
||||||
label: this.labels.user_note,
|
label: this.labels.user_note,
|
||||||
|
|
Loading…
Reference in New Issue