BetterDiscordAddons/Plugins/EditChannels/EditChannels.plugin.js

1373 lines
70 KiB
JavaScript
Raw Normal View History

2020-10-20 23:25:34 +02:00
/**
* @name EditChannels
2021-03-05 13:26:41 +01:00
* @author DevilBro
2020-10-20 23:25:34 +02:00
* @authorId 278543574059057154
2024-01-25 21:32:05 +01:00
* @version 4.5.8
2021-03-05 13:26:41 +01:00
* @description Allows you to locally edit Channels
2020-10-20 23:25:34 +02:00
* @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien
* @patreon https://www.patreon.com/MircoWittrien
2021-03-09 15:10:55 +01:00
* @website https://mwittrien.github.io/
* @source https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/EditChannels/
2021-03-10 09:17:37 +01:00
* @updateUrl https://mwittrien.github.io/BetterDiscordAddons/Plugins/EditChannels/EditChannels.plugin.js
2020-10-20 23:25:34 +02:00
*/
2018-10-11 10:21:26 +02:00
2020-09-19 20:49:33 +02:00
module.exports = (_ => {
2022-09-01 14:40:11 +02:00
const changeLog = {
2022-09-02 12:37:10 +02:00
2020-09-19 20:49:33 +02:00
};
2020-11-13 19:47:44 +01:00
2022-02-05 21:14:17 +01:00
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
2022-09-01 14:55:22 +02:00
constructor (meta) {for (let key in meta) this[key] = meta[key];}
getName () {return this.name;}
getAuthor () {return this.author;}
getVersion () {return this.version;}
getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
2021-02-01 17:13:13 +01:00
downloadLibrary () {
2023-11-18 18:31:04 +01:00
BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => {
if (!r || r.status != 200) throw new Error();
else return r.text();
}).then(b => {
if (!b) throw new Error();
else return require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"}));
}).catch(error => {
BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library");
2021-02-01 17:13:13 +01:00
});
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
load () {
2020-11-19 16:51:14 +01:00
if (!window.BDFDB_Global || !Array.isArray(window.BDFDB_Global.pluginQueue)) window.BDFDB_Global = Object.assign({}, window.BDFDB_Global, {pluginQueue: []});
2020-09-19 20:49:33 +02:00
if (!window.BDFDB_Global.downloadModal) {
window.BDFDB_Global.downloadModal = true;
2022-09-01 14:55:22 +02:00
BdApi.showConfirmationModal("Library Missing", `The Library Plugin needed for ${this.name} is missing. Please click "Download Now" to install it.`, {
2020-09-19 20:49:33 +02:00
confirmText: "Download Now",
cancelText: "Cancel",
onCancel: _ => {delete window.BDFDB_Global.downloadModal;},
2020-09-20 08:15:13 +02:00
onConfirm: _ => {
delete window.BDFDB_Global.downloadModal;
2021-02-01 17:13:13 +01:00
this.downloadLibrary();
2020-09-20 08:15:13 +02:00
}
2020-09-19 20:49:33 +02:00
});
}
2022-09-01 14:55:22 +02:00
if (!window.BDFDB_Global.pluginQueue.includes(this.name)) window.BDFDB_Global.pluginQueue.push(this.name);
2020-10-09 21:09:35 +02:00
}
2021-01-06 12:38:36 +01:00
start () {this.load();}
stop () {}
getSettingsPanel () {
2020-11-28 23:12:09 +01:00
let template = document.createElement("template");
2022-09-01 14:55:22 +02:00
template.innerHTML = `<div style="color: var(--header-primary); font-size: 16px; font-weight: 300; white-space: pre; line-height: 22px;">The Library Plugin needed for ${this.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`;
2021-02-01 17:13:13 +01:00
template.content.firstElementChild.querySelector("a").addEventListener("click", this.downloadLibrary);
2020-11-28 23:12:09 +01:00
return template.content.firstElementChild;
}
2020-10-09 21:09:35 +02:00
} : (([Plugin, BDFDB]) => {
2021-05-20 16:44:45 +02:00
var changedChannels = {};
2022-11-23 10:55:10 +01:00
var appTitleObserver;
2020-09-19 20:49:33 +02:00
2020-10-09 21:09:35 +02:00
return class EditChannels extends Plugin {
2021-01-06 12:38:36 +01:00
onLoad () {
2020-09-19 20:49:33 +02:00
this.defaults = {
2021-05-20 16:44:45 +02:00
general: {
changeChannelIcon: {value: true, description: "Change Color of Channel Icon"}
},
places: {
chatTextarea: {value: true, description: "Chat Textarea"},
2023-11-18 18:31:04 +01:00
chatWindow: {value: true, description: "Messages"},
mentions: {value: true, description: "Mentions"},
2021-05-20 16:44:45 +02:00
channelList: {value: true, description: "Channel/Group List"},
channelHeader: {value: true, description: "Channel/Group Header"},
2023-11-18 18:31:04 +01:00
recentDms: {value: true, description: "Group Notifications"},
2021-05-20 16:44:45 +02:00
recentMentions: {value: true, description: "Recent Mentions Popout"},
2023-11-18 18:31:04 +01:00
threads: {value: true, description: "Thread Overview"},
2021-05-20 16:44:45 +02:00
autocompletes: {value: true, description: "Autocomplete Menu"},
2023-11-18 18:31:04 +01:00
auditLog: {value: true, description: "Audit Log"},
inviteLog: {value: true, description: "Invite Log"},
2021-05-20 16:44:45 +02:00
quickSwitcher: {value: true, description: "Quick Switcher"},
searchResults: {value: true, description: "Search Results"},
searchPopout: {value: true, description: "Search Popout"},
2023-11-18 18:31:04 +01:00
appTitle: {value: true, description: "Discord App Title (Channels)"}
2020-09-19 20:49:33 +02:00
}
};
2020-02-04 08:20:40 +01:00
2022-11-04 20:53:39 +01:00
this.modulePatches = {
before: [
"AuditLogEntry",
"AutocompleteChannelResult",
2023-11-02 19:06:36 +01:00
"ChannelCallHeader",
2022-11-29 18:50:17 +01:00
"ChannelEmptyMessages",
2022-11-04 20:53:39 +01:00
"ChannelsList",
"ChannelTextAreaEditor",
"ChannelThreadItem",
2022-11-29 14:12:15 +01:00
"GuildInvites",
2022-11-04 20:53:39 +01:00
"MessageContent",
"QuickSwitchChannelResult",
"RecentsChannelHeader",
"SearchPopout",
"SystemMessageWrapper",
"ThreadMessageAccessories"
],
after: [
"AuditLogEntry",
"AutocompleteChannelResult",
2023-11-02 19:06:36 +01:00
"ChannelCallHeader",
"ChannelFloatingSidebar",
"ChannelItemIcon",
2022-11-04 20:53:39 +01:00
"ChannelThreadItem",
"DirectMessage",
"FocusRingScope",
"HeaderBarContainer",
"PrivateChannel",
"QuickSwitchChannelResult",
"RecentsChannelHeader",
"RichChannelMention",
"SearchResultsInner",
"SystemMessageThreadCreated",
"ThreadCard",
"ThreadMessageAccessories",
"ThreadSidebar"
]
2020-09-19 20:49:33 +02:00
};
2021-06-09 17:52:32 +02:00
this.patchPriority = 9;
2020-09-19 20:49:33 +02:00
this.css = `
2023-11-02 19:06:36 +01:00
${BDFDB.dotCN.mention}[style*="--edited-mention-color"] {
background-color: rgba(var(--edited-mention-color), .1) !important;
color: rgb(var(--edited-mention-color)) !important;
}
${BDFDB.dotCN.mention + BDFDB.dotCN.mentioninteractive}[style*="--edited-mention-color"]:hover {
background-color: rgba(var(--edited-mention-color), .3) !important;
color: rgb(var(--edited-mention-color)) !important;
}
2020-09-19 20:49:33 +02:00
`;
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
2022-11-23 10:55:10 +01:00
onStart () {
appTitleObserver = new MutationObserver(_ => this.changeAppTitle());
appTitleObserver.observe(document.head.querySelector("title"), {childList: true});
2022-08-29 13:46:12 +02:00
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.QuerySearchUtils, "queryChannels", {after: e => {
if (!e.methodArguments[0].query) return;
2023-06-06 08:48:41 +02:00
for (let id of BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuildIds().map(id => Object.keys(BDFDB.LibraryStores.ChannelStore.getMutableGuildChannelsForGuild(id))).flat()) {
2022-09-27 14:48:10 +02:00
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(id);
2022-08-29 13:46:12 +02:00
if (channel && !channel.isCategory()) {
2022-09-27 14:48:10 +02:00
let category = channel.parent_id && BDFDB.LibraryStores.ChannelStore.getChannel(channel.parent_id);
2022-09-27 20:05:55 +02:00
if (((changedChannels[id] && changedChannels[id].name && changedChannels[id].name.toLocaleLowerCase().indexOf(e.methodArguments[0].query.toLocaleLowerCase()) > -1) || (category && changedChannels[category.id] && changedChannels[category.id].name && changedChannels[category.id].name.toLocaleLowerCase().indexOf(e.methodArguments[0].query.toLocaleLowerCase()) > -1)) && !e.returnValue.find(n => n.record && n.record.id == id && (n.type == BDFDB.DiscordConstants.AutocompleterResultTypes.VOICE_CHANNEL || n.type == BDFDB.DiscordConstants.AutocompleterResultTypes.TEXT_CHANNEL))) e.returnValue.push({
2022-08-29 13:46:12 +02:00
comparator: channel.name,
record: channel,
score: 30000,
sortable: channel.name.toLocaleLowerCase(),
2022-09-27 20:05:55 +02:00
type: channel.isGuildVocal() ? BDFDB.DiscordConstants.AutocompleterResultTypes.VOICE_CHANNEL : BDFDB.DiscordConstants.AutocompleterResultTypes.TEXT_CHANNEL
2022-08-29 13:46:12 +02:00
});
}
2020-09-26 18:37:56 +02:00
}
}});
2020-02-04 08:20:40 +01:00
this.forceUpdateAll();
}
2020-09-19 20:49:33 +02:00
2021-01-06 12:38:36 +01:00
onStop () {
2022-11-23 10:55:10 +01:00
if (appTitleObserver) appTitleObserver.disconnect();
2020-06-08 20:50:04 +02:00
this.forceUpdateAll();
2020-02-04 08:20:40 +01:00
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
getSettingsPanel (collapseStates = {}) {
2021-05-20 16:44:45 +02:00
let settingsPanel;
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
collapseStates: collapseStates,
children: _ => {
let settingsItems = [];
settingsItems.push(Object.keys(this.defaults.general).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["general", key],
label: this.defaults.general[key].description,
value: this.settings.general[key]
})));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Change Channels in:",
children: Object.keys(this.defaults.places).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch",
plugin: this,
keys: ["places", key],
label: this.defaults.places[key].description,
value: this.settings.places[key]
}))
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
color: BDFDB.LibraryComponents.Button.Colors.RED,
label: "Reset all Channels",
onClick: _ => BDFDB.ModalUtils.confirm(this, this.labels.confirm_resetall, _ => {
BDFDB.DataUtils.remove(this, "channels");
this.forceUpdateAll();;
}),
children: BDFDB.LanguageUtils.LanguageStrings.RESET
}));
return settingsItems;
}
});
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
2021-01-06 12:38:36 +01:00
onSettingsClosed () {
2020-09-19 20:49:33 +02:00
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
this.forceUpdateAll();
}
2020-02-04 08:20:40 +01:00
}
2020-10-30 15:54:55 +01:00
forceUpdateAll (instant = false) {
2020-09-19 20:49:33 +02:00
changedChannels = BDFDB.DataUtils.load(this, "channels");
this.changeAppTitle();
BDFDB.PatchUtils.forceAllUpdates(this);
2022-05-26 15:01:24 +02:00
BDFDB.DiscordUtils.rerenderAll(instant);
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
2020-09-19 20:49:33 +02:00
onChannelContextMenu (e) {
2022-11-04 20:53:39 +01:00
if (!e.instance.props.channel) return;
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, {
2022-07-08 17:04:44 +02:00
label: this.labels.context_localchannelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_channelsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
action: _ => this.openChannelSettingsModal(e.instance.props.channel)
}),
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.submenu_resetsettings,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
2022-09-30 14:18:20 +02:00
color: BDFDB.DiscordConstants.MenuItemColors.DANGER,
2022-07-08 17:04:44 +02:00
disabled: !changedChannels[e.instance.props.channel.id],
action: event => {
let remove = _ => {
BDFDB.DataUtils.remove(this, "channels", e.instance.props.channel.id);
this.forceUpdateAll(true);
};
if (event.shiftKey) remove();
else BDFDB.ModalUtils.confirm(this, this.labels.confirm_reset, remove);
}
})
]
})
2022-11-04 20:53:39 +01:00
})
}));
}
onThreadContextMenu (e) {
this.onChannelContextMenu(e);
}
onGroupDMContextMenu (e) {
this.onChannelContextMenu(e);
2020-09-19 20:49:33 +02:00
}
2022-10-24 10:42:20 +02:00
processChannelTextAreaEditor (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.chatTextarea || e.instance.props.disabled || !e.instance.props.channel || !changedChannels[e.instance.props.channel.id] || e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.NORMAL_WITH_ACTIVITY && e.instance.props.type != BDFDB.DiscordConstants.ChannelTextAreaTypes.SIDEBAR) return;
if (changedChannels[e.instance.props.channel.id].name) e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${changedChannels[e.instance.props.channel.id].name}`);
2020-01-03 21:05:35 +01:00
}
2021-07-28 23:04:01 +02:00
2022-11-29 18:50:17 +01:00
processChannelEmptyMessages (e) {
if (!this.settings.places.chatWindow || !e.instance.props.channel || !changedChannels[e.instance.props.channel.id]) return;
e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
2021-07-28 23:04:01 +02:00
}
2021-07-28 23:39:25 +02:00
processSystemMessageWrapper (e) {
2022-11-04 20:53:39 +01:00
if (this.settings.places.chatWindow && e.instance.props.channel && changedChannels[e.instance.props.channel.id]) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
2021-07-28 23:39:25 +02:00
}
2022-11-04 20:53:39 +01:00
processSystemMessageThreadCreated (e) {
if (!this.settings.places.chatWindow || !e.instance.props.message || !e.instance.props.message.messageReference || !e.instance.props.message.messageReference.channel_id || !changedChannels[e.instance.props.message.messageReference.channel_id]) return;
let channelName = BDFDB.ObjectUtils.get(e, "returnvalue.props.children.2.props.children.0");
if (changedChannels[e.instance.props.message.messageReference.channel_id].name) channelName.props.children = [changedChannels[e.instance.props.message.messageReference.channel_id].name];
this.changeChannelColor(channelName, e.instance.props.message.messageReference.channel_id);
2021-07-28 23:39:25 +02:00
}
processThreadMessageAccessories (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.chatWindow || !e.instance.props.channel || !changedChannels[e.instance.props.channel.id]) return;
if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
else {
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.messagesystemname]]});
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id);
2021-07-28 23:39:25 +02:00
}
}
2020-01-03 21:05:35 +01:00
2020-09-19 20:49:33 +02:00
processAutocompleteChannelResult (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.autocompletes || !e.instance.props.channel) return;
if (!e.returnvalue) {
if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
}
else if (typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let modify = Object.assign({}, e.instance.props, e.instance.state);
let children = childrenRender(...args);
let icon = BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowIcon"});
if (icon) {
let iconType = icon.type;
icon.type = BDFDB.TimeUtils.suppress((...args2) => {
let iconChild = iconType(...args2);
if (iconChild.props && iconChild.props.children && typeof iconChild.props.children.type == "function") {
let iconChildType = iconChild.props.children.type;
iconChild.props.children.type = BDFDB.TimeUtils.suppress((...args3) => {
let iconSubChild = iconChildType(...args3);
this.changeChannelIconColor(iconSubChild, e.instance.props.channel.id, modify);
return iconSubChild;
}, "Error in Type of AutocompleteRowIcon Child!", this);
2022-08-29 13:46:12 +02:00
}
2022-11-04 20:53:39 +01:00
return iconChild;
}, "Error in Type of AutocompleteRowIcon!", this);
2022-08-22 22:43:09 +02:00
}
2022-11-04 20:53:39 +01:00
let channelName = BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowContentPrimary"});
if (channelName) this.changeChannelColor(channelName.props.children, e.instance.props.channel.id, modify);
let categoryName = e.instance.props.category && BDFDB.ReactUtils.findChild(children, {name: "AutocompleteRowContentSecondary"});
if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id, modify);
return children;
}, "Error in Children Render of AutocompleteChannelResult!", this);
2022-08-22 22:43:09 +02:00
}
2020-01-03 21:05:35 +01:00
}
2022-11-04 20:53:39 +01:00
processAuditLogEntry (e) {
if (!this.settings.places.auditLog) return;
2020-09-19 20:49:33 +02:00
let channel = BDFDB.ObjectUtils.get(e.instance, "props.log.options.channel");
2022-11-04 20:53:39 +01:00
if (!channel) return;
if (!e.returnvalue) e.instance.props.log.options.channel = this.getChannelData(channel.id);
else {
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["children", [["#" + channel.name]]]]});
if (channelName) this.changeChannelColor(channelName, channel.id);
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
}
2022-11-29 14:12:15 +01:00
processGuildInvites (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.inviteLog || !e.instance.props.invites) return;
e.instance.props.invites = Object.assign({}, e.instance.props.invites);
for (let id in e.instance.props.invites) e.instance.props.invites[id] = new BDFDB.DiscordObjects.Invite(Object.assign({}, e.instance.props.invites[id], {channel: this.getChannelData(e.instance.props.invites[id].channel.id)}));
2020-01-03 21:05:35 +01:00
}
2021-07-28 23:04:01 +02:00
2023-11-02 19:06:36 +01:00
processChannelFloatingSidebar (e) {
if (!this.settings.places.channelHeader) return;
let channel = e.instance.props && e.instance.props.children && e.instance.props.children[0] && e.instance.props.children[0].props && e.instance.props.children[0].props.channel;
if (!channel || channel.isDM()) return;
let headerBar = BDFDB.ReactUtils.findChild(e.instance.props.children, {name: "HeaderBar"});
if (!headerBar) return;
let channelName = BDFDB.ReactUtils.findChild(headerBar, {name: "HeaderBarTitle"});
if (channelName) {
channelName.props.children = this.getChannelData(channel.id).name;
this.changeChannelColor(channelName, channel.id);
}
let channelIcon = BDFDB.ReactUtils.findChild(headerBar, {name: "HeaderBarTitleIcon"});
if (channelIcon) this.changeChannelIconColor(channelIcon, channel.id);
}
processChannelCallHeader (e) {
if (!this.settings.places.channelHeader || !e.instance.props.channel || e.instance.props.channel.isDM()) return;
if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
else {
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "HeaderBarTitle"});
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id);
let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "HeaderBarTitleIcon"});
if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id);
}
}
2020-09-19 20:49:33 +02:00
processHeaderBarContainer (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.channelHeader) return;
2022-09-27 14:48:10 +02:00
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(e.instance.props.channelId);
2022-11-04 20:53:39 +01:00
if (!channel) return;
let thread;
if (BDFDB.ChannelUtils.isThread(channel)) {
thread = channel;
channel = BDFDB.LibraryStores.ChannelStore.getChannel(thread.parent_id);
}
if (!changedChannels[channel.id] && !(thread && changedChannels[thread.id])) return;
let channelNames = BDFDB.ReactUtils.findChild(e.returnvalue, {all: true, name: ["HeaderBarTitle", "HeaderBarChannelName"]});
if (channelNames.length) {
if (channelNames[0].props.children) {
if (changedChannels[channel.id] && changedChannels[channel.id].name) channelNames[0].props.children = channel.isGroupDM() ? this.getGroupName(channel.id) : this.getChannelData(channel.id).name;
this.changeChannelColor(channelNames[0], channel.id);
}
if (channelNames[0].props.channel) channelNames[0].props.channel = this.getChannelData(channel.id);
if (thread && channelNames[1].props.children) {
if (changedChannels[thread.id] && changedChannels[thread.id].name) channelNames[1].props.children = this.getChannelData(thread.id).name;
this.changeChannelColor(channelNames[1], thread.id);
2021-07-28 23:04:01 +02:00
}
2022-11-04 20:53:39 +01:00
}
let channelIcons = BDFDB.ReactUtils.findChild(e.returnvalue, {all: true, name: "HeaderBarTitleIcon"});
if (channelIcons.length) {
if (channelIcons[0].props.icon) {
let iconRender = channelIcons[0].props.icon;
channelIcons[0].props.icon = BDFDB.TimeUtils.suppress((...args) => {
let icon = iconRender(...args);
this.changeChannelIconColor(icon, channel.id);
return icon;
}, "Error in Channel Icon Render of HeaderBarContainer!", this);
}
if (thread && channelIcons[1].props.icon) {
let iconRender = channelIcons[1].props.icon;
channelIcons[1].props.icon = BDFDB.TimeUtils.suppress((...args) => {
let icon = iconRender(...args);
this.changeChannelIconColor(icon, thread.id);
return icon;
}, "Error in Thread Icon Render of HeaderBarContainer!", this);
2020-03-08 14:07:16 +01:00
}
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
}
2021-07-28 23:04:01 +02:00
processThreadSidebar (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.channelHeader || !changedChannels[e.instance.props.channelId]) return;
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {name: ["HeaderBarTitle", "HeaderBarChannelName"]});
if (channelName && channelName.props.children) {
if (changedChannels[e.instance.props.channelId].name) channelName.props.children = this.getChannelData(e.instance.props.channelId).name;
this.changeChannelColor(channelName, e.instance.props.channelId);
}
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {name: "HeaderBarTitleIcon"});
if (index > -1) {
let icon = BDFDB.ReactUtils.createElement(children[index].props.icon, {
className: BDFDB.disCN.channelheadericon
});
this.changeChannelIconColor(icon, e.instance.props.channelId);
children[index] = BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.channelheadericonwrapper,
children: icon
})
2021-07-28 23:04:01 +02:00
}
}
processThreadCard (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.threads || !changedChannels[e.instance.props.threadId]) return;
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.threadcardname]]});
if (channelName) {
if (changedChannels[e.instance.props.threadId].name) channelName.props.children = changedChannels[e.instance.props.threadId].name;
this.changeChannelColor(channelName, e.instance.props.threadId);
2021-07-28 23:04:01 +02:00
}
}
2020-01-03 21:05:35 +01:00
2022-11-04 20:53:39 +01:00
processFocusRingScope (e) {
if (!e.returnvalue || !e.returnvalue.props.className) return;
let change, hoveredEvents, channelId, nameClass, categoyClass, iconClass, modify = {};
2024-01-25 09:52:22 +01:00
if (this.settings.places.mentions && e.returnvalue.props.className.indexOf(BDFDB.disCN.mention) > -1 && e.instance.props["edited-mention-color"]) {
e.returnvalue.props.style = Object.assign({}, e.returnvalue.props.style, {"--edited-mention-color": e.instance.props["edited-mention-color"]});
2020-02-04 08:20:40 +01:00
}
2024-01-25 21:32:05 +01:00
if (this.settings.places.channelList && e.returnvalue.props.className.indexOf(BDFDB.disCN.categoryiconvisibility) > -1) {
change = true;
hoveredEvents = true;
channelId = (BDFDB.ReactUtils.findValue(e.returnvalue, "data-list-item-id") || "").split("___").pop();
nameClass = BDFDB.disCN.categoryname;
iconClass = BDFDB.disCN.categoryicon;
modify = {muted: BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), channelId)};
}
2023-11-02 19:06:36 +01:00
if (this.settings.places.channelList && e.returnvalue.props.className.indexOf(BDFDB.disCN.channeliconvisibility) > -1) {
change = true;
hoveredEvents = true;
channelId = (BDFDB.ReactUtils.findValue(e.returnvalue, "data-list-item-id") || "").split("___").pop();
nameClass = BDFDB.disCN.channelname;
modify = {muted: BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryStores.SelectedGuildStore.getGuildId(), channelId)};
}
2022-11-04 20:53:39 +01:00
else if (this.settings.places.searchPopout && e.returnvalue.props.className.indexOf(BDFDB.disCN.searchpopoutoption) > -1) {
change = true;
let channel = (BDFDB.ReactUtils.findValue(e.returnvalue._owner, "result", {up: true}) || {}).channel;
channelId = channel && channel.id;
nameClass = BDFDB.disCN.searchpopoutresultchannel;
categoyClass = BDFDB.disCN.searchpopoutsearchresultchannelcategory;
iconClass = BDFDB.disCN.searchpopoutsearchresultchannelicon;
}
if (change && channelId) {
if (hoveredEvents) {
2022-08-23 14:29:07 +02:00
let changeColors = (wrapper, props) => {
2022-11-04 20:53:39 +01:00
let color = this.chooseColor(this.getChannelDataColor(channelId), props);
let channelName = wrapper.querySelector(`.${nameClass} > *`);
let channelIcon = wrapper.querySelector(`.${iconClass}`);
2022-08-23 14:29:07 +02:00
if (channelName && channelName.firstElementChild) channelName.firstElementChild.style.setProperty("color", color);
if (channelIcon) {
for (let path of channelIcon.querySelectorAll('[path*="rgba("], [path*="rgb("]')) path.setAttribute("path", color);
for (let fill of channelIcon.querySelectorAll('[fill*="rgba("], [fill*="rgb("]')) fill.setAttribute("fill", color);
}
};
2022-11-04 20:53:39 +01:00
let onMouseEnter = e.instance.props.children.props.onMouseEnter, onMouseLeave = e.instance.props.children.props.onMouseLeave;
e.instance.props.children.props.onMouseEnter = BDFDB.TimeUtils.suppress(event => {
2022-08-23 14:29:07 +02:00
changeColors(event.currentTarget, {hovered: true});
return (onMouseEnter || (_ => {}))(event);
}, "Error in onMouseEnter of ChannelItem!", this);
2022-11-04 20:53:39 +01:00
e.instance.props.children.props.onMouseLeave = BDFDB.TimeUtils.suppress(event => {
changeColors(event.currentTarget, modify);
2022-08-23 14:29:07 +02:00
return (onMouseLeave || (_ => {}))(event);
}, "Error in onMouseLeave of ChannelItem!", this);
}
2022-11-04 20:53:39 +01:00
let name = nameClass && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", nameClass]]});
if (name) {
2023-11-02 19:06:36 +01:00
if (name.props && typeof name.props.children == "string") name.props.children = BDFDB.ReactUtils.createElement("span", {children: name.props.children});
2022-11-04 20:53:39 +01:00
name = name.props && name.props.children || name;
this.changeChannelColor(BDFDB.ArrayUtils.is(name) ? name.find(c => c.type == "strong") || name[0] : name, channelId, modify);
}
let icon = iconClass && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", iconClass]]});
if (icon) this.changeChannelIconColor(icon, channelId, modify);
let categoryId = (BDFDB.LibraryStores.ChannelStore.getChannel(channelId) || {}).parent_id;
if (categoryId) {
let categoryName = categoyClass && BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", categoyClass]]});
if (categoryName) {
categoryName.props.children = this.getChannelData(categoryId).name;
this.changeChannelColor(categoryName, categoryId, modify);
2021-01-10 14:34:13 +01:00
}
2020-09-19 20:49:33 +02:00
}
2020-01-03 21:05:35 +01:00
}
}
2022-11-04 20:53:39 +01:00
processChannelsList (e) {
if (!this.settings.places.channelList || !e.instance.props.guildChannels) return;
e.instance.props.guildChannels = new e.instance.props.guildChannels.constructor(e.instance.props.guild.id, e.instance.props.guildChannels.communitySection && e.instance.props.guildChannels.communitySection.communityRows || []);
2022-12-15 15:09:59 +01:00
for (let id in e.instance.props.guildChannels.categories) e.instance.props.guildChannels.categories[id].record = this.getChannelData(id, true, e.instance.props.guildChannels.categories[id].record);
2022-11-04 20:53:39 +01:00
let getChannelFromSectionRow = e.instance.props.guildChannels.getChannelFromSectionRow.bind(e.instance.props.guildChannels);
e.instance.props.guildChannels.getChannelFromSectionRow = BDFDB.TimeUtils.suppress((...args) => {
let returnValue = getChannelFromSectionRow(...args);
2022-11-05 16:16:32 +01:00
if (returnValue) {
2022-11-05 00:44:21 +01:00
returnValue = Object.assign({}, returnValue);
2022-12-09 15:53:48 +01:00
if (returnValue.channel && returnValue.channel.record) returnValue.channel.record = this.getChannelData(returnValue.channel.record.id, true, returnValue.channel.record);
if (returnValue.category && returnValue.category.record) returnValue.category.record = this.getChannelData(returnValue.category.record.id, true, returnValue.category.record);
2022-11-05 00:44:21 +01:00
}
2022-11-04 20:53:39 +01:00
return returnValue;
}, "Error in getChannelFromSectionRow of ChannelsList!", this);
}
2023-11-02 19:06:36 +01:00
processChannelItemIcon (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.channelList || !e.instance.props.channel) return;
let modify = BDFDB.ObjectUtils.extract(e.instance.props, "muted", "locked", "selected", "unread", "connected", "hovered");
2023-11-02 19:06:36 +01:00
if (e.returnvalue.props && typeof e.returnvalue.props.children == "function") {
let childrenRender = e.returnvalue.props.children;
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args2) => {
let renderedChildren = childrenRender(...args2);
2024-01-25 09:43:41 +01:00
this.changeChannelIconColor(renderedChildren.props.children[2] || renderedChildren.props.children, e.instance.props.channel.id, modify);
2023-11-02 19:06:36 +01:00
return renderedChildren;
}, "Error in Children Render of ChannelItem!", this);
2021-07-28 23:04:01 +02:00
}
2023-11-02 19:06:36 +01:00
else this.changeChannelIconColor(e.returnvalue, e.instance.props.channel.id, modify);
2021-07-28 23:04:01 +02:00
}
2022-11-04 20:53:39 +01:00
processChannelThreadItem (e) {
if (!this.settings.places.channelList || !e.instance.props.thread) return;
if (!e.returnvalue) e.instance.props.thread = this.getChannelData(e.instance.props.thread.id, true, e.instance.props.thread);
else {
let modify = BDFDB.ObjectUtils.extract(e.instance.props, "muted", "locked", "selected", "unread", "connected", "hovered");
2023-07-06 08:52:35 +02:00
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelname]]});
2022-11-04 20:53:39 +01:00
if (channelName) this.changeChannelColor(channelName, e.instance.props.thread.id, modify);
2021-01-09 22:06:27 +01:00
}
}
2022-11-04 20:53:39 +01:00
processDirectMessage (e) {
if (!this.settings.places.recentDms || !e.instance.props.channel || !e.instance.props.channel.isGroupDM()) return;
if (changedChannels[e.instance.props.channel.id] && changedChannels[e.instance.props.channel.id].name) {
let tooltip = BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ListItemTooltip"});
if (tooltip) tooltip.props.text = this.getGroupName(e.instance.props.channel.id);
}
let avatar = BDFDB.ReactUtils.findChild(e.returnvalue, {filter: c => c && c.props && !isNaN(parseInt(c.props.id))});
if (avatar && typeof avatar.props.children == "function") {
let childrenRender = avatar.props.children;
avatar.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = childrenRender(...args);
if (renderedChildren && renderedChildren.props) renderedChildren.props.icon = this.getGroupIcon(e.instance.props.channel.id);
return renderedChildren;
}, "Error in Avatar Render of DirectMessage!", this);
2021-11-12 16:30:05 +01:00
}
}
2022-11-04 20:53:39 +01:00
processPrivateChannel (e) {
if (!this.settings.places.channelList || !e.instance.props.channel || !e.instance.props.channel.isGroupDM()) return;
let wrapper = e.returnvalue && e.returnvalue.props.children && e.returnvalue.props.children.props && typeof e.returnvalue.props.children.props.children == "function" ? e.returnvalue.props.children : e.returnvalue;
if (typeof wrapper.props.children == "function") {
let process = returnvalue => {
const wrapper = returnvalue.props.avatar ? returnvalue : BDFDB.ReactUtils.findChild(returnvalue, {props: ["avatar"]});
if (!wrapper) return;
if (changedChannels[e.instance.props.channel.id] && changedChannels[e.instance.props.channel.id].name) {
wrapper.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)});
}
this.changeChannelColor(wrapper.props.name, e.instance.props.channel.id, BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "hovered", "selected", "hasUnreadMessages", "muted"));
wrapper.props.name = [wrapper.props.name];
if (wrapper.props.avatar) wrapper.props.avatar.props.src = this.getGroupIcon(e.instance.props.channel.id);
};
let childrenRender = wrapper.props.children;
wrapper.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = childrenRender(...args);
process(children);
return children;
}, "Error in Children Render of PrivateChannel!", this);
2021-11-12 16:30:05 +01:00
}
2022-11-04 20:53:39 +01:00
else process(wrapper);
2021-11-12 16:30:05 +01:00
}
2020-09-19 20:49:33 +02:00
processQuickSwitchChannelResult (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.quickSwitcher || !e.instance.props.channel) return;
if (!e.returnvalue) {
e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
if (e.instance.props.category) e.instance.props.category = this.getChannelData(e.instance.props.category.id);
}
else {
let modify = BDFDB.ObjectUtils.extract(e.instance.props, "focused", "unread", "mentions");
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.quickswitchresultmatch]]});
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.quickswitchresulticon]]});
if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, modify);
if (e.instance.props.category) {
let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.quickswitchresultnote]]});
if (categoryName) this.changeChannelColor(categoryName, e.instance.props.category.id);
2020-02-04 08:20:40 +01:00
}
2020-01-03 21:05:35 +01:00
}
}
2021-02-04 22:51:39 +01:00
2022-11-04 20:53:39 +01:00
processSearchPopout (e) {
if (!this.settings.places.searchPopout || !BDFDB.ArrayUtils.is(BDFDB.ObjectUtils.get(e, "instance.props.resultsState.autocompletes"))) return;
for (let autocomplete of e.instance.props.resultsState.autocompletes) if (autocomplete && BDFDB.ArrayUtils.is(autocomplete.results)) for (let result of autocomplete.results) if (result.channel) result.channel = this.getChannelData(result.channel.id);
2021-02-04 22:51:39 +01:00
}
processSearchResultsInner (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.searchResults) return;
let results = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["id", "search-results"]]});
if (results && BDFDB.ArrayUtils.is(results.props.children)) for (let group of results.props.children) {
let channelId = (BDFDB.ObjectUtils.get(group, "props.children.key") || "").split("-")[0];
let channelName = channelId && changedChannels[channelId] && BDFDB.ReactUtils.findChild(group, {props: [["className", BDFDB.disCN.searchresultschannelname]]});
if (channelName) {
if (changedChannels[channelId].name) channelName.props.children = "#" + changedChannels[channelId].name;
this.changeChannelColor(channelName, channelId);
2021-02-04 22:51:39 +01:00
}
}
}
2020-09-19 20:49:33 +02:00
processRecentsChannelHeader (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.recentMentions || !e.instance.props.channel) return;
if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
else {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.recentmentionschannelnamespan]]});
if (index > -1) {
this.changeChannelColor(children[index], e.instance.props.channel.id);
let icon = index > 0 && children[index-1];
if (icon && icon.props && icon.props.width) this.changeChannelIconColor(icon, e.instance.props.channel.id);
2020-09-19 20:49:33 +02:00
}
2020-01-03 21:05:35 +01:00
}
}
2020-09-19 20:49:33 +02:00
processMessageContent (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.mentions || !BDFDB.ArrayUtils.is(e.instance.props.content)) return;
2023-11-02 19:06:36 +01:00
for (let ele of e.instance.props.content) if (BDFDB.ReactUtils.isValidElement(ele) && ele.type) {
let children = ele.props && ele.props.className && ele.props.className.indexOf("channelMention") == 0 ? ele : ele.type.prototype && ele.type.prototype.renderTooltip && typeof ele.props.children == "function" && ele.props.children({});
if (!children || !children.props || !children.props.className || children.props.className.indexOf("channelMention") != 0) return;
let channelNameWrapper = BDFDB.ReactUtils.findChild(children, {props: ["iconType"]});
let channelName = channelNameWrapper && BDFDB.ReactUtils.findChild(channelNameWrapper, {type: "span"});
if (!channelNameWrapper || !channelName) return;
let guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
let channels = guildId && [].concat(BDFDB.LibraryStores.GuildChannelStore.getChannels(guildId).SELECTABLE, BDFDB.LibraryStores.GuildChannelStore.getChannels(guildId).VOCAL, Object.keys(BDFDB.LibraryStores.ActiveThreadsStore.getThreadsForGuild(guildId)).map(id => ({channel: BDFDB.LibraryStores.ChannelStore.getChannel(id)})));
if (!BDFDB.ArrayUtils.is(channels)) return;
for (let channelObj of channels) if (channelName.props.children == channelObj.channel.name && (channelNameWrapper.props.iconType == "text" && !channelObj.channel.isVocal() || channelNameWrapper.props.iconType == "voice" && channelObj.channel.isVocal())) {
let name = (changedChannels[channelObj.channel.id] || {}).name;
let color = this.getChannelDataColor(channelObj.channel.id);
if (name || color) {
if (typeof ele.props.children == "function") {
let renderChildren = ele.props.children;
ele.props.children = BDFDB.TimeUtils.suppress((...args) => {
let renderedChildren = renderChildren(...args);
this.changeMention(renderedChildren, {name, color});
return renderedChildren;
}, "Error in Children Render of ChannelMention in MessageContent!", this);
2020-01-03 21:05:35 +01:00
}
2023-11-02 19:06:36 +01:00
else this.changeMention(channelNameWrapper, {name, color}, ele);
2020-01-03 21:05:35 +01:00
}
2023-11-02 19:06:36 +01:00
break;
2020-01-03 21:05:35 +01:00
}
}
}
2020-12-04 22:38:52 +01:00
2021-02-24 17:32:17 +01:00
processRichChannelMention (e) {
2022-11-04 20:53:39 +01:00
if (!this.settings.places.mentions || !e.instance.props.id) return;
let name = (changedChannels[e.instance.props.id] || {}).name;
let color = this.getChannelDataColor(e.instance.props.id);
if (!name && !color) return;
if (typeof e.returnvalue.props.children == "function") {
let renderChildren = e.returnvalue.props.children;
e.returnvalue.props.children = BDFDB.TimeUtils.suppress((...args) => {
let children = renderChildren(...args);
this.changeMention(children, {name, color});
return children;
}, "Error in Children Render of RichChannelMention!", this);
}
else this.changeMention(e.returnvalue, {name, color});
}
changeAppTitle () {
if (!this.settings.places.appTitle) return;
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryStores.SelectedChannelStore.getChannelId());
let title = document.head.querySelector("title");
if (title && channel && (document.location.href || "").indexOf(channel.id) > -1 && changedChannels[channel.id] && changedChannels[channel.id].name) {
if (channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id));
else BDFDB.DOMUtils.setText(title, (BDFDB.ChannelUtils.isTextChannel(channel) ? "#" : "") + this.getChannelData(channel.id).name);
2020-12-04 22:38:52 +01:00
}
}
2023-11-02 19:06:36 +01:00
changeMention (mention, data, wrapper) {
2021-07-29 20:47:38 +02:00
if (!mention) return;
2020-12-04 22:38:52 +01:00
if (data.name) {
2021-07-28 23:04:01 +02:00
const changeMentionName = (child, name) => {
if (!child) return;
if (BDFDB.ArrayUtils.is(child)) for (let i in child) {
if (typeof child[i] == "string" && child[i][0] == "#") {
if (child[i] == "#") child[parseInt(i) + 1] = data.name;
else child[i] = "#" + data.name;
}
else changeMentionName(child[i]);
}
2022-11-04 20:53:39 +01:00
else if (child.props) {
if (child.props.iconType && typeof child.props.children == "string") child.props.children = data.name;
2023-11-02 19:06:36 +01:00
else if (child.props.iconType && BDFDB.ArrayUtils.is(child.props.children) && child.props.children.length == 1 && child.props.children[0] && child.props.children[0].props) child.props.children[0].props.children = data.name;
2022-11-04 20:53:39 +01:00
else if (child.props.iconType && BDFDB.ArrayUtils.is(child.props.children) && child.props.children.length == 1) child.props.children = [data.name];
else if (typeof child.props.children == "string" && child.props.children[0] == "#") child.props.children = "#" + data.name;
else if (BDFDB.ArrayUtils.is(child.props.children)) changeMentionName(child.props.children);
}
2020-12-04 22:38:52 +01:00
};
2021-07-28 23:04:01 +02:00
changeMentionName(mention);
2020-12-04 22:38:52 +01:00
}
2023-11-02 19:06:36 +01:00
if (data.color) {
wrapper = wrapper || mention;
wrapper.props.color = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data.color) ? data.color[0] : data.color, "INT");
wrapper.props["edited-mention-color"] = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data.color) ? data.color[0] : data.color, "RGBCOMP").slice(0, 3).join(",");
if (wrapper.props.children && wrapper.props.children.props) {
wrapper.props.children.props.color = wrapper.props.color;
wrapper.props.children.props["edited-mention-color"] = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data.color) ? data.color[0] : data.color, "RGBCOMP").slice(0, 3).join(",");
}
}
}
2020-09-19 20:49:33 +02:00
changeChannelColor (child, channelId, modify) {
2022-11-04 20:53:39 +01:00
if (!BDFDB.ReactUtils.isValidElement(child)) return;
let color = this.getChannelDataColor(channelId);
if (color) {
color = modify ? this.chooseColor(color, modify) : BDFDB.ColorUtils.convert(color, "RGBA");
let childProp = child.props.children ? "children" : "text";
let fontGradient = BDFDB.ObjectUtils.is(color);
if (fontGradient) child.props[childProp] = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextGradientElement, {
gradient: BDFDB.ColorUtils.createGradient(color),
children: child.props[childProp]
});
else child.props[childProp] = BDFDB.ReactUtils.createElement("span", {
style: {color: color},
children: child.props[childProp]
});
2020-07-08 16:32:07 +02:00
}
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
changeChannelIconColor (child, channelId, modify) {
2022-11-04 20:53:39 +01:00
if (!this.settings.general.changeChannelIcon) return;
2024-01-09 12:54:40 +01:00
let color = child && child.props && this.getChannelDataColor(channelId);
2022-11-04 20:53:39 +01:00
if (!color) return;
color = modify ? this.chooseColor(BDFDB.ObjectUtils.is(color) ? color[0] : color, modify) : BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA");
if (!color) return;
child.props.foreground = null;
child.props.color = color || "currentColor";
2023-11-02 19:06:36 +01:00
if (typeof child.props.children != "function") {
child.props.children = [child.props.children].flat(10).filter(n => n);
for (let c of child.props.children) {
if (c && c.props && c.props.fill == "currentColor") c.props.fill = color || "currentColor";
if (c && c.props && c.props.path == "currentColor") c.props.path = color || "currentColor";
}
2020-09-19 20:49:33 +02:00
}
2020-03-08 14:07:16 +01:00
}
2020-02-04 08:20:40 +01:00
2020-09-19 20:49:33 +02:00
chooseColor (color, config) {
2022-11-04 20:53:39 +01:00
if (!color) return null;
if (BDFDB.ObjectUtils.is(config)) {
if (config.focused || config.hovered || config.selected || config.connected) color = BDFDB.ColorUtils.change(color, 0.5);
else if (config.muted || config.locked) color = BDFDB.ColorUtils.change(color, -0.5);
else if (config.mentions || config.unread) color = BDFDB.ColorUtils.change(color, 0.5);
2020-01-03 21:05:35 +01:00
}
2022-11-04 20:53:39 +01:00
return BDFDB.ColorUtils.convert(color, "RGBA");
2020-01-03 21:05:35 +01:00
}
2020-09-19 20:49:33 +02:00
getChannelDataColor (channelId) {
2021-06-15 19:08:38 +02:00
if (changedChannels[channelId] && changedChannels[channelId].color) return changedChannels[channelId].color;
2022-09-27 14:48:10 +02:00
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
let category = channel && (BDFDB.ChannelUtils.isThread(channel) ? BDFDB.LibraryStores.ChannelStore.getChannel((BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryStores.ChannelStore.getChannel(channel.id).parent_id) || {}).parent_id) : BDFDB.LibraryStores.ChannelStore.getChannel(channel.parent_id));
2021-06-15 13:06:51 +02:00
if (category && changedChannels[category.id] && changedChannels[category.id].inheritColor && changedChannels[category.id].color) return changedChannels[category.id].color;
2020-09-19 20:49:33 +02:00
return null;
2020-02-04 08:20:40 +01:00
}
2020-06-08 20:50:04 +02:00
2021-06-15 13:06:51 +02:00
getChannelData (channelId, change = true, fallbackData) {
2022-09-27 14:48:10 +02:00
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
2021-06-15 13:06:51 +02:00
if (!channel && BDFDB.ObjectUtils.is(fallbackData) || channel && BDFDB.ObjectUtils.is(fallbackData) && channel.name != fallbackData.name) channel = fallbackData;
2020-09-19 20:49:33 +02:00
if (!channel) return new BDFDB.DiscordObjects.Channel({});
let data = change && changedChannels[channel.id];
if (data) {
2022-12-07 11:53:48 +01:00
let nativeObject = new (fallbackData && fallbackData.constructor || BDFDB.DiscordObjects.Channel)(channel);
2020-09-19 20:49:33 +02:00
nativeObject.name = data.name || nativeObject.name;
return nativeObject;
}
2022-12-09 15:53:48 +01:00
return fallbackData || (new BDFDB.DiscordObjects.Channel(channel));
2020-09-19 20:49:33 +02:00
}
2021-01-09 22:06:27 +01:00
2021-06-09 17:52:32 +02:00
getGroupName (channelId) {
let channel = this.getChannelData(channelId);
2021-01-09 22:06:27 +01:00
if (channel.name) return channel.name;
2022-09-27 16:53:10 +02:00
let recipients = channel.recipients.map(BDFDB.LibraryStores.UserStore.getUser).filter(n => n);
2021-01-09 22:06:27 +01:00
return recipients.length > 0 ? recipients.map(u => u.toString()).join(", ") : BDFDB.LanguageUtils.LanguageStrings.UNNAMED;
}
getGroupIcon (channelId, change = true) {
2022-09-27 14:48:10 +02:00
let channel = BDFDB.LibraryStores.ChannelStore.getChannel(channelId);
2021-01-09 22:06:27 +01:00
if (!channel) return "";
let data = change && changedChannels[channel.id];
if (data) {
if (data.removeIcon) return "";
else if (data.url) return data.url;
}
return BDFDB.LibraryModules.IconUtils.getChannelIconURL(channel);
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
openChannelSettingsModal (channel) {
let data = changedChannels[channel.id] || {};
2021-01-29 17:59:14 +01:00
let newData = Object.assign({}, data);
let iconInput;
2020-09-19 20:49:33 +02:00
BDFDB.ModalUtils.open(this, {
size: "MEDIUM",
header: this.labels.modal_header,
2021-01-23 18:50:24 +01:00
subHeader: channel.name,
2020-09-19 20:49:33 +02:00
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_channelname,
2021-01-29 17:59:14 +01:00
className: BDFDB.disCN.marginbottom20,
2020-09-19 20:49:33 +02:00
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
value: data.name,
placeholder: channel.name,
2021-01-29 17:59:14 +01:00
autoFocus: true,
2021-01-29 20:04:13 +01:00
onChange: value => {newData.name = value;}
2020-09-19 20:49:33 +02:00
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCN.dividerdefault
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
title: this.labels.modal_colorpicker1,
2020-09-19 20:49:33 +02:00
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ColorSwatches, {
color: data.color,
2021-01-29 20:04:13 +01:00
onColorChange: value => {newData.color = value;}
2020-09-19 20:49:33 +02:00
})
]
}),
2021-01-09 22:06:27 +01:00
!channel.isGroupDM() && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
2020-09-19 20:49:33 +02:00
type: "Switch",
2020-10-14 21:08:41 +02:00
margin: 20,
label: this.labels.modal_inheritcolor,
2022-11-22 01:30:30 +01:00
tag: BDFDB.LibraryComponents.FormComponents.FormTags.H5,
2021-01-09 22:06:27 +01:00
value: channel.isCategory() && data.inheritColor,
2021-01-29 17:59:14 +01:00
disabled: !channel.isCategory(),
2021-01-29 20:04:13 +01:00
onChange: value => {newData.inheritColor = value;}
2021-01-09 22:06:27 +01:00
}),
2021-01-10 14:34:13 +01:00
channel.isGroupDM() && BDFDB.ReactUtils.createElement("div", {
2021-01-09 22:06:27 +01:00
className: BDFDB.disCN.marginbottom20,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
className: BDFDB.disCNS.dividerdefault + BDFDB.disCN.marginbottom20
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
direction: BDFDB.LibraryComponents.Flex.Direction.HORIZONTAL,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormTitle, {
className: BDFDB.disCN.marginreset,
2022-11-22 01:30:30 +01:00
tag: BDFDB.LibraryComponents.FormComponents.FormTags.H5,
2021-01-09 22:06:27 +01:00
children: this.labels.modal_channelicon
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Switch",
margin: 0,
grow: 0,
label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
2022-11-22 01:30:30 +01:00
tag: BDFDB.LibraryComponents.FormComponents.FormTags.H5,
2021-01-09 22:06:27 +01:00
value: data.removeIcon,
2021-01-29 19:48:09 +01:00
onChange: value => {
2021-01-29 17:59:14 +01:00
newData.removeIcon = value;
if (value) {
delete iconInput.props.success;
delete iconInput.props.errorMessage;
iconInput.props.disabled = true;
BDFDB.ReactUtils.forceUpdate(iconInput);
}
else {
iconInput.props.disabled = false;
2022-11-29 18:50:17 +01:00
this.checkUrl(iconInput.props.value, iconInput).then(returnValue => newData.url = returnValue);
2021-01-09 22:06:27 +01:00
}
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
success: !data.removeIcon && data.url,
maxLength: 100000000000000000000,
value: data.url,
placeholder: BDFDB.DMUtils.getIcon(channel.id),
disabled: data.removeIcon,
2021-01-29 17:59:14 +01:00
ref: instance => {if (instance) iconInput = instance;},
2021-01-09 22:06:27 +01:00
onChange: (value, instance) => {
2022-11-29 18:50:17 +01:00
this.checkUrl(value, instance).then(returnValue => newData.url = returnValue);
2021-01-09 22:06:27 +01:00
}
})
]
2020-09-19 20:49:33 +02:00
})
],
buttons: [{
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
color: "BRAND",
close: true,
2021-01-29 17:59:14 +01:00
onClick: _ => {
if (newData.color != null && !BDFDB.ObjectUtils.is(newData.color)) {
if (newData.color[0] < 30 && newData.color[1] < 30 && newData.color[2] < 30) newData.color = BDFDB.ColorUtils.change(newData.color, 30);
else if (newData.color[0] > 225 && newData.color[1] > 225 && newData.color[2] > 225) newData.color = BDFDB.ColorUtils.change(newData.color, -30);
2020-09-19 20:49:33 +02:00
}
2021-01-29 17:59:14 +01:00
newData.url = !newData.removeIcon ? newData.url : "";
2020-09-19 20:49:33 +02:00
let changed = false;
2021-01-29 17:59:14 +01:00
if (Object.keys(newData).every(key => newData[key] == null || newData[key] == false) && (changed = true)) {
BDFDB.DataUtils.remove(this, "channels", channel.id);
}
else if (!BDFDB.equals(newData, data) && (changed = true)) {
BDFDB.DataUtils.save(newData, this, "channels", channel.id);
}
2020-10-30 15:54:55 +01:00
if (changed) this.forceUpdateAll(true);
2020-02-04 08:20:40 +01:00
}
2020-09-19 20:49:33 +02:00
}]
});
2020-02-04 08:20:40 +01:00
}
2021-01-09 22:06:27 +01:00
checkUrl (url, instance) {
2021-01-29 17:59:14 +01:00
return new Promise(callback => {
BDFDB.TimeUtils.clear(instance.checkTimeout);
url = url && url.trim();
if (!url || instance.props.disabled) {
delete instance.props.success;
delete instance.props.errorMessage;
callback("");
BDFDB.ReactUtils.forceUpdate(instance);
}
2022-12-01 21:38:21 +01:00
else if (url.indexOf("data:") == 0) {
instance.props.success = true;
delete instance.props.errorMessage;
callback(url);
}
2022-11-29 18:50:17 +01:00
else instance.checkTimeout = BDFDB.TimeUtils.timeout(_ => BDFDB.LibraryRequires.request(url, {agentOptions: {rejectUnauthorized: false}}, (error, response, result) => {
delete instance.checkTimeout;
if (instance.props.disabled) {
delete instance.props.success;
delete instance.props.errorMessage;
callback("");
}
else if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
instance.props.success = true;
delete instance.props.errorMessage;
callback(url);
}
else {
delete instance.props.success;
instance.props.errorMessage = this.labels.modal_invalidurl;
callback("");
}
BDFDB.ReactUtils.forceUpdate(instance);
}), 1000);
2021-01-29 17:59:14 +01:00
});
2021-01-09 22:06:27 +01:00
}
2020-07-26 17:02:25 +02:00
2021-01-06 12:38:36 +01:00
setLabelsByLanguage () {
2020-09-19 20:49:33 +02:00
switch (BDFDB.LanguageUtils.getLanguage().id) {
case "bg": // Bulgarian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Наистина ли искате да нулирате този канал?",
confirm_resetall: "Наистина ли искате да нулирате всички канали?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Настройки на местния канал",
modal_channelname: "Име на местния канал",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Икона",
modal_colorpicker1: "Локален цвят на канала",
modal_header: "Настройки на местния канал",
2020-12-22 20:38:51 +01:00
modal_inheritcolor: "Наследете цвета на подканали",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Невалиден адрес",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Промяна на настройките",
submenu_resetsettings: "Нулиране на канала"
2020-09-19 20:49:33 +02:00
};
case "da": // Danish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Er du sikker på, at du vil nulstille denne kanal?",
confirm_resetall: "Er du sikker på, at du vil nulstille alle kanaler?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Lokale kanalindstillinger",
modal_channelname: "Lokalt kanalnavn",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Ikon",
modal_colorpicker1: "Lokal kanalfarve",
modal_header: "Lokale kanalindstillinger",
modal_inheritcolor: "Arv farve til underkanaler",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Ugyldig URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Ændre indstillinger",
submenu_resetsettings: "Nulstil kanal"
2020-09-19 20:49:33 +02:00
};
case "de": // German
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Möchtest du diesen Kanal wirklich zurücksetzen?",
confirm_resetall: "Möchtest du wirklich alle Kanäle zurücksetzen?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Lokale Kanaleinstellungen",
modal_channelname: "Lokaler Kanalname",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Symbol",
modal_colorpicker1: "Lokale Kanalfarbe",
modal_header: "Lokale Kanaleinstellungen",
modal_inheritcolor: "Vererbung der Farbe an Unterkanäle",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Ungültige URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Einstellungen ändern",
submenu_resetsettings: "Kanal zurücksetzen"
2020-09-19 20:49:33 +02:00
};
case "el": // Greek
2020-09-19 20:49:33 +02:00
return {
2023-04-01 12:42:04 +02:00
confirm_reset: "Θέλετε την επαναφορά αυτού του καναλιού;",
confirm_resetall: "Θέλετε την επαναφορά όλων των καναλιών;",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Ρυθμίσεις Τοπικού Καναλιού",
2023-04-01 12:42:04 +02:00
modal_channelname: "Ονομασία Τοπικού Καναλιού",
modal_channelicon: "Εικονίδιο",
modal_colorpicker1: "Χρώμα Τοπικού Καναλιού",
modal_header: "Ρυθμίσεις Τοπικού Καναλιού",
modal_inheritcolor: "Εφαρμογή του χρώματος στα υπό-κανάλια",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Μη έγκυρη διεύθυνση URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Αλλαγή Ρυθμίσεων",
submenu_resetsettings: "Επαναφορά καναλιού"
2020-09-19 20:49:33 +02:00
};
case "es": // Spanish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "¿Estás seguro de que deseas restablecer este canal?",
confirm_resetall: "¿Está seguro de que desea restablecer todos los canales?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Configuración de canal local",
2020-12-22 20:38:51 +01:00
modal_channelname: "Nombre del canal local",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Icono",
2020-12-22 20:38:51 +01:00
modal_colorpicker1: "Color del canal local",
modal_header: "Configuración de canal local",
modal_inheritcolor: "Heredar color a subcanales",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "URL invalida",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Cambiar ajustes",
submenu_resetsettings: "Restablecer canal"
2020-09-19 20:49:33 +02:00
};
case "fi": // Finnish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Haluatko varmasti nollata tämän kanavan?",
confirm_resetall: "Haluatko varmasti nollata kaikki kanavat?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Paikallisen kanavan asetukset",
modal_channelname: "Paikallisen kanavan nimi",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Kuvake",
modal_colorpicker1: "Paikallisen kanavan väri",
modal_header: "Paikallisen kanavan asetukset",
modal_inheritcolor: "Peri väri alikanaville",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Virheellinen URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Vaihda asetuksia",
submenu_resetsettings: "Nollaa kanava"
2020-09-19 20:49:33 +02:00
};
case "fr": // French
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Voulez-vous vraiment réinitialiser cette salon?",
confirm_resetall: "Voulez-vous vraiment réinitialiser toutes les salons?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Paramètres de la salon",
2020-12-22 20:38:51 +01:00
modal_channelname: "Nom local de la salon",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Icône",
2020-12-22 20:38:51 +01:00
modal_colorpicker1: "Couleur locale de la salon",
modal_header: "Paramètres locaux de la salon",
modal_inheritcolor: "Hériter de la couleur aux sous-canaux",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "URL invalide",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Modifier les paramètres",
submenu_resetsettings: "Réinitialiser la salon"
2020-09-19 20:49:33 +02:00
};
case "hr": // Croatian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Jeste li sigurni da želite resetirati ovaj kanal?",
confirm_resetall: "Jeste li sigurni da želite resetirati sve kanale?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Postavke lokalnog kanala",
modal_channelname: "Naziv lokalnog kanala",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Ikona",
2020-12-22 20:38:51 +01:00
modal_colorpicker1: "Lokalna boja kanala",
modal_header: "Postavke lokalnog kanala",
modal_inheritcolor: "Naslijedi boju na podkanalima",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Neispravna poveznica",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Promijeniti postavke",
submenu_resetsettings: "Resetiraj kanal"
2020-09-19 20:49:33 +02:00
};
case "hu": // Hungarian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Biztosan vissza akarja állítani ezt a csatornát?",
confirm_resetall: "Biztosan visszaállítja az összes csatornát?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Helyi csatorna beállításai",
modal_channelname: "Helyi csatorna neve",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Ikon",
modal_colorpicker1: "Helyi csatorna színe",
modal_header: "Helyi csatorna beállításai",
modal_inheritcolor: "Örökli a színt az alcsatornákra",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Érvénytelen URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Beállítások megváltoztatása",
submenu_resetsettings: "Csatorna visszaállítása"
2020-09-19 20:49:33 +02:00
};
case "it": // Italian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Sei sicuro di voler ripristinare questo canale?",
confirm_resetall: "Sei sicuro di voler ripristinare tutti i canali?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Impostazioni del canale locale",
2020-12-22 20:38:51 +01:00
modal_channelname: "Nome canale locale",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Icona",
2020-12-22 20:38:51 +01:00
modal_colorpicker1: "Colore canale locale",
modal_header: "Impostazioni del canale locale",
modal_inheritcolor: "Eredita colore ai canali secondari",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "URL non valido",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Cambia impostazioni",
submenu_resetsettings: "Reimposta canale"
2020-09-19 20:49:33 +02:00
};
case "ja": // Japanese
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "このチャンネルをリセットしてもよろしいですか?",
confirm_resetall: "すべてのチャンネルをリセットしてもよろしいですか?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "ローカルチャンネル設定",
modal_channelname: "ローカルチャネル名",
2021-01-09 22:06:27 +01:00
modal_channelicon: "アイコン",
modal_colorpicker1: "ローカルチャンネルの色",
modal_header: "ローカルチャンネル設定",
modal_inheritcolor: "サブチャネルに色を継承する",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "無効なURL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "設定を変更する",
submenu_resetsettings: "チャネルをリセット"
2020-09-19 20:49:33 +02:00
};
case "ko": // Korean
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "이 채널을 재설정 하시겠습니까?",
confirm_resetall: "모든 채널을 재설정 하시겠습니까?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "로컬 채널 설정",
modal_channelname: "로컬 채널 이름",
2021-01-09 22:06:27 +01:00
modal_channelicon: "상",
modal_colorpicker1: "로컬 채널 색상",
modal_header: "로컬 채널 설정",
modal_inheritcolor: "하위 채널에 색상 상속",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "잘못된 URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "설정 변경",
submenu_resetsettings: "채널 재설정"
2020-09-19 20:49:33 +02:00
};
case "lt": // Lithuanian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Ar tikrai norite iš naujo nustatyti šį kanalą?",
confirm_resetall: "Ar tikrai norite iš naujo nustatyti visus kanalus?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Vietinio kanalo nustatymai",
modal_channelname: "Vietinio kanalo pavadinimas",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Piktograma",
modal_colorpicker1: "Vietinio kanalo spalva",
modal_header: "Vietinio kanalo nustatymai",
modal_inheritcolor: "Paveldėkite spalvas subkanalams",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Neteisingas URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Pakeisti nustatymus",
submenu_resetsettings: "Iš naujo nustatyti kanalą"
2020-09-19 20:49:33 +02:00
};
case "nl": // Dutch
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Weet u zeker dat u dit kanaal opnieuw wilt instellen?",
confirm_resetall: "Weet u zeker dat u alle kanalen opnieuw wilt instellen?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Lokale kanaalinstellingen",
modal_channelname: "Lokale kanaalnaam",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Icoon",
2020-12-22 20:38:51 +01:00
modal_colorpicker1: "Lokale kanaalkleur",
modal_header: "Lokale kanaalinstellingen",
2020-12-22 20:38:51 +01:00
modal_inheritcolor: "Overerf kleur naar subkanalen",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Ongeldige URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Instellingen veranderen",
submenu_resetsettings: "Kanaal resetten"
2020-09-19 20:49:33 +02:00
};
case "no": // Norwegian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Er du sikker på at du vil tilbakestille denne kanalen?",
confirm_resetall: "Er du sikker på at du vil tilbakestille alle kanaler?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Lokale kanalinnstillinger",
modal_channelname: "Lokalt kanalnavn",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Ikon",
modal_colorpicker1: "Lokal kanalfarge",
modal_header: "Lokale kanalinnstillinger",
modal_inheritcolor: "Arv farge til underkanaler",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Ugyldig URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Endre innstillinger",
submenu_resetsettings: "Tilbakestill kanal"
2020-09-19 20:49:33 +02:00
};
case "pl": // Polish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Czy na pewno chcesz zresetować ten kanał?",
confirm_resetall: "Czy na pewno chcesz zresetować wszystkie kanały?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Ustawienia kanału lokalnego",
modal_channelname: "Nazwa kanału lokalnego",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Ikona",
modal_colorpicker1: "Kolor kanału lokalnego",
modal_header: "Ustawienia kanału lokalnego",
modal_inheritcolor: "Dziedzicz kolor do kanałów podrzędnych",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Nieprawidłowy URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Zmień ustawienia",
submenu_resetsettings: "Resetuj kanał"
2020-09-19 20:49:33 +02:00
};
case "pt-BR": // Portuguese (Brazil)
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Tem certeza que deseja redefinir este canal?",
confirm_resetall: "Tem certeza de que deseja redefinir todos os canais?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Configurações de canal local",
modal_channelname: "Nome do canal local",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Ícone",
2020-12-22 20:38:51 +01:00
modal_colorpicker1: "Cor do Canal Local",
modal_header: "Configurações de canal local",
modal_inheritcolor: "Herdar cor para subcanais",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "URL inválida",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Mudar configurações",
submenu_resetsettings: "Reiniciar canal"
2020-09-19 20:49:33 +02:00
};
case "ro": // Romanian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Sigur doriți să resetați acest canal?",
confirm_resetall: "Sigur doriți să resetați toate canalele?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Setări canale locale",
modal_channelname: "Numele canalului local",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Pictogramă",
modal_colorpicker1: "Culoare canal local",
modal_header: "Setări canale locale",
modal_inheritcolor: "Moșteniți culoarea la sub-canale",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "URL invalid",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Schimbă setările",
submenu_resetsettings: "Resetați canalul"
2020-09-19 20:49:33 +02:00
};
case "ru": // Russian
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Вы уверены, что хотите сбросить этот канал?",
confirm_resetall: "Вы уверены, что хотите сбросить все каналы?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Настройки локального канала",
modal_channelname: "Имя локального канала",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Икона",
modal_colorpicker1: "Цвет локального канала",
modal_header: "Настройки локального канала",
modal_inheritcolor: "Наследовать цвет для субканалов",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Неверная ссылка",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Изменить настройки",
submenu_resetsettings: "Сбросить канал"
2020-09-19 20:49:33 +02:00
};
case "sv": // Swedish
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Är du säker på att du vill återställa den här kanalen?",
confirm_resetall: "Är du säker på att du vill återställa alla kanaler?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Lokala kanalinställningar",
modal_channelname: "Lokalt kanalnamn",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Ikon",
modal_colorpicker1: "Lokal kanalfärg",
modal_header: "Lokala kanalinställningar",
modal_inheritcolor: "Ärva färg till underkanaler",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Ogiltig URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Ändra inställningar",
submenu_resetsettings: "Återställ kanal"
2020-09-19 20:49:33 +02:00
};
case "th": // Thai
2020-09-19 20:49:33 +02:00
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "แน่ใจไหมว่าต้องการรีเซ็ตช่องนี้",
confirm_resetall: "แน่ใจไหมว่าต้องการรีเซ็ตช่องทั้งหมด",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "การตั้งค่าช่องท้องถิ่น",
modal_channelname: "ชื่อช่องท้องถิ่น",
2021-01-09 22:06:27 +01:00
modal_channelicon: "ไอคอน",
modal_colorpicker1: "ช่องท้องถิ่นสี",
modal_header: "การตั้งค่าช่องท้องถิ่น",
modal_inheritcolor: "สืบทอดสีไปยังช่องย่อย",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "URL ไม่ถูกต้อง",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "เปลี่ยนการตั้งค่า",
submenu_resetsettings: "รีเซ็ตช่อง"
};
case "tr": // Turkish
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Bu kanalı sıfırlamak istediğinizden emin misiniz?",
confirm_resetall: "Tüm kanalları sıfırlamak istediğinizden emin misiniz?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Yerel Kanal Ayarları",
modal_channelname: "Yerel Kanal Adı",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Simge",
modal_colorpicker1: "Yerel Kanal Rengi",
modal_header: "Yerel Kanal Ayarları",
modal_inheritcolor: "Renkleri Alt Kanallara Devral",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Geçersiz URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Ayarları değiştir",
submenu_resetsettings: "Kanalı Sıfırla"
};
case "uk": // Ukrainian
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Справді скинути цей канал?",
confirm_resetall: "Ви впевнені, що хочете скинути всі канали?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Налаштування локального каналу",
modal_channelname: "Назва місцевого каналу",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Піктограма",
modal_colorpicker1: "Колір локального каналу",
modal_header: "Налаштування локального каналу",
modal_inheritcolor: "Успадковувати колір для підканалів",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Недійсна URL-адреса",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Змінити налаштування",
submenu_resetsettings: "Скинути канал"
};
case "vi": // Vietnamese
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Bạn có chắc chắn muốn đặt lại kênh này không?",
confirm_resetall: "Bạn có chắc chắn muốn đặt lại tất cả các kênh không?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Cài đặt kênh cục bộ",
modal_channelname: "Tên kênh địa phương",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Biểu tượng",
modal_colorpicker1: "Màu kênh địa phương",
modal_header: "Cài đặt kênh cục bộ",
modal_inheritcolor: "Kế thừa màu cho các kênh phụ",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "URL không hợp lệ",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Thay đổi cài đặt",
submenu_resetsettings: "Đặt lại kênh"
};
2021-01-15 17:54:22 +01:00
case "zh-CN": // Chinese (China)
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "您确定要重置此频道吗?",
confirm_resetall: "您确定要重置所有频道吗?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "本地频道设置",
modal_channelname: "本地频道名称",
2021-01-09 22:06:27 +01:00
modal_channelicon: "图标",
modal_colorpicker1: "本地频道颜色",
modal_header: "本地频道设置",
modal_inheritcolor: "继承颜色到子通道",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "无效的网址",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "更改设置",
submenu_resetsettings: "重置频道"
};
2021-01-15 17:54:22 +01:00
case "zh-TW": // Chinese (Taiwan)
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "您確定要重置此頻道嗎?",
confirm_resetall: "您確定要重置所有頻道嗎?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "本地頻道設置",
modal_channelname: "本地頻道名稱",
2021-01-09 22:06:27 +01:00
modal_channelicon: "圖標",
modal_colorpicker1: "本地頻道顏色",
modal_header: "本地頻道設置",
modal_inheritcolor: "繼承顏色到子通道",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "無效的網址",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "更改設置",
submenu_resetsettings: "重置頻道"
};
default: // English
return {
2020-12-22 20:38:51 +01:00
confirm_reset: "Are you sure you want to reset this Channel?",
confirm_resetall: "Are you sure you want to reset all Channels?",
2024-01-25 09:43:41 +01:00
context_localchannelsettings: "Local Channel Settings",
modal_channelname: "Local Channel Name",
2021-01-09 22:06:27 +01:00
modal_channelicon: "Icon",
modal_colorpicker1: "Local Channel Color",
modal_header: "Local Channel Settings",
modal_inheritcolor: "Inherit Color to Sub-Channels",
2021-01-29 17:59:14 +01:00
modal_invalidurl: "Invalid URL",
2024-01-25 09:43:41 +01:00
submenu_channelsettings: "Change Settings",
submenu_resetsettings: "Reset Channel"
2020-09-19 20:49:33 +02:00
};
}
}
};
2022-09-01 14:40:11 +02:00
})(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
2020-12-15 17:45:31 +01:00
})();