2020-10-20 23:25:34 +02:00
|
|
|
|
/**
|
|
|
|
|
* @name EditChannels
|
|
|
|
|
* @authorId 278543574059057154
|
|
|
|
|
* @invite Jx3TjNS
|
2020-11-19 16:45:36 +01:00
|
|
|
|
* @donate https://www.paypal.me/MircoWittrien
|
|
|
|
|
* @patreon https://www.patreon.com/MircoWittrien
|
|
|
|
|
* @website https://github.com/mwittrien/BetterDiscordAddons/tree/master/Plugins/EditChannels
|
|
|
|
|
* @source https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/Plugins/EditChannels/EditChannels.plugin.js
|
|
|
|
|
* @updateUrl https://raw.githubusercontent.com/mwittrien/BetterDiscordAddons/master/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 = (_ => {
|
2020-10-09 21:09:35 +02:00
|
|
|
|
const config = {
|
2020-09-19 20:49:33 +02:00
|
|
|
|
"info": {
|
|
|
|
|
"name": "EditChannels",
|
|
|
|
|
"author": "DevilBro",
|
2021-01-10 14:34:13 +01:00
|
|
|
|
"version": "4.2.3",
|
2020-10-16 10:25:30 +02:00
|
|
|
|
"description": "Allow you to rename and recolor channelnames"
|
2020-12-22 20:38:51 +01:00
|
|
|
|
},
|
|
|
|
|
"changeLog": {
|
|
|
|
|
"improved": {
|
2021-01-09 22:06:27 +01:00
|
|
|
|
"Groups": "You can now change the name/color/icon of group channels"
|
2021-01-10 14:34:13 +01:00
|
|
|
|
},
|
|
|
|
|
"fixed": {
|
|
|
|
|
"Categories": "Gradient works for categories again",
|
|
|
|
|
"Icons": "Colors icons properly again"
|
2020-12-22 20:38:51 +01:00
|
|
|
|
}
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-11-13 19:47:44 +01:00
|
|
|
|
|
2020-10-09 21:09:35 +02:00
|
|
|
|
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
|
2021-01-06 12:38:36 +01:00
|
|
|
|
getName () {return config.info.name;}
|
|
|
|
|
getAuthor () {return config.info.author;}
|
|
|
|
|
getVersion () {return config.info.version;}
|
|
|
|
|
getDescription () {return config.info.description;}
|
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;
|
|
|
|
|
BdApi.showConfirmationModal("Library Missing", `The library plugin needed for ${config.info.name} is missing. Please click "Download Now" to install it.`, {
|
|
|
|
|
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;
|
2020-11-19 16:45:36 +01:00
|
|
|
|
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => {
|
2020-10-20 23:25:34 +02:00
|
|
|
|
if (!e && b && b.indexOf(`* @name BDFDB`) > -1) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => {});
|
2020-09-20 08:15:13 +02:00
|
|
|
|
else BdApi.alert("Error", "Could not download BDFDB library plugin, try again some time later.");
|
|
|
|
|
});
|
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
if (!window.BDFDB_Global.pluginQueue.includes(config.info.name)) window.BDFDB_Global.pluginQueue.push(config.info.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");
|
|
|
|
|
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 ${config.info.name} is missing.\nPlease click <a style="font-weight: 500;">Download Now</a> to install it.</div>`;
|
|
|
|
|
template.content.firstElementChild.querySelector("a").addEventListener("click", _ => {
|
|
|
|
|
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => {
|
|
|
|
|
if (!e && b && b.indexOf(`* @name BDFDB`) > -1) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => {});
|
|
|
|
|
else BdApi.alert("Error", "Could not download BDFDB library plugin, try again some time later.");
|
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
return template.content.firstElementChild;
|
|
|
|
|
}
|
2020-10-09 21:09:35 +02:00
|
|
|
|
} : (([Plugin, BDFDB]) => {
|
2020-09-19 20:49:33 +02:00
|
|
|
|
var changedChannels = {}, settings = {};
|
|
|
|
|
|
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 = {
|
|
|
|
|
settings: {
|
2020-12-04 22:38:52 +01:00
|
|
|
|
changeChannelIcon: {value: true, inner: false, description: "Change color of Channel Icon"},
|
2020-11-19 16:51:14 +01:00
|
|
|
|
changeInChatTextarea: {value: true, inner: true, description: "Chat Textarea"},
|
|
|
|
|
changeInMentions: {value: true, inner: true, description: "Mentions"},
|
2021-01-09 22:06:27 +01:00
|
|
|
|
changeInChannelList: {value: true, inner: true, description: "Channel/Group List"},
|
|
|
|
|
changeInChannelHeader: {value: true, inner: true, description: "Channel/Group Header"},
|
|
|
|
|
changeInRecentDms: {value: true, inner: true, description: "Group Notifications"},
|
2020-11-19 16:51:14 +01:00
|
|
|
|
changeInRecentMentions: {value: true, inner: true, description: "Recent Mentions Popout"},
|
|
|
|
|
changeInAutoComplete: {value: true, inner: true, description: "Autocomplete Menu"},
|
|
|
|
|
changeInAuditLog: {value: true, inner: true, description: "Audit Log"},
|
|
|
|
|
changeInInviteLog: {value: true, inner: true, description: "Invite Log"},
|
|
|
|
|
changeInQuickSwitcher: {value: true, inner: true, description: "Quick Switcher"}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
}
|
|
|
|
|
};
|
2020-02-04 08:20:40 +01:00
|
|
|
|
|
2020-09-19 20:49:33 +02:00
|
|
|
|
this.patchedModules = {
|
|
|
|
|
before: {
|
|
|
|
|
ChannelEditorContainer: "render",
|
|
|
|
|
ChannelAutoComplete: "render",
|
|
|
|
|
AutocompleteChannelResult: "render",
|
|
|
|
|
AuditLog: "render",
|
|
|
|
|
SettingsInvites: "render",
|
|
|
|
|
HeaderBarContainer: "render",
|
2020-11-12 19:04:22 +01:00
|
|
|
|
ChannelCategoryItem: "type",
|
2020-10-30 15:54:55 +01:00
|
|
|
|
ChannelItem: "default",
|
2020-09-19 20:49:33 +02:00
|
|
|
|
QuickSwitchChannelResult: "render",
|
|
|
|
|
MessageContent: "type"
|
|
|
|
|
},
|
|
|
|
|
after: {
|
|
|
|
|
AutocompleteChannelResult: "render",
|
|
|
|
|
AuditLog: "render",
|
|
|
|
|
HeaderBarContainer: "render",
|
2020-11-12 19:04:22 +01:00
|
|
|
|
FocusRing: "default",
|
2020-10-30 15:54:55 +01:00
|
|
|
|
ChannelItem: "default",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
DirectMessage: "render",
|
|
|
|
|
PrivateChannel: "render",
|
2020-09-19 20:49:33 +02:00
|
|
|
|
QuickSwitchChannelResult: "render",
|
2020-12-04 22:38:52 +01:00
|
|
|
|
RecentsChannelHeader: "default",
|
|
|
|
|
ChannelMention: "ChannelMention"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
this.css = `
|
|
|
|
|
${BDFDB.dotCN.messagespopoutchannelname}:hover > span[style*="color"],
|
|
|
|
|
${BDFDB.dotCN.recentmentionschannelname}:hover > span[style*="color"] {
|
|
|
|
|
text-decoration: underline;
|
|
|
|
|
}
|
|
|
|
|
`;
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
|
2021-01-06 12:38:36 +01:00
|
|
|
|
onStart () {
|
2020-02-04 08:20:40 +01:00
|
|
|
|
let observer = new MutationObserver(_ => {this.changeAppTitle();});
|
2021-01-09 22:06:27 +01:00
|
|
|
|
BDFDB.ObserverUtils.connect(this, document.head.querySelector("title"), {name: "appTitleObserver", instance: observer}, {childList: true});
|
2020-02-04 08:20:40 +01:00
|
|
|
|
|
2020-09-26 18:37:56 +02:00
|
|
|
|
if (BDFDB.LibraryModules.AutocompleteOptions && BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS) BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.AutocompleteOptions.AUTOCOMPLETE_OPTIONS.CHANNELS, "queryResults", {after: e => {
|
|
|
|
|
let channelArray = [];
|
|
|
|
|
for (let id in changedChannels) if (changedChannels[id] && changedChannels[id].name) {
|
|
|
|
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(id);
|
|
|
|
|
let category = channel && channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
|
|
|
|
|
let catData = category && changedChannels[category.id] || {};
|
|
|
|
|
if (BDFDB.ChannelUtils.isTextChannel(channel) && channel.guild_id == e.methodArguments[0].guild_id) channelArray.push(Object.assign({
|
|
|
|
|
lowerCaseName: changedChannels[id].name.toLowerCase(),
|
|
|
|
|
lowerCaseCatName: catData && catData.name && catData.name.toLowerCase(),
|
|
|
|
|
channel,
|
|
|
|
|
category,
|
|
|
|
|
catData
|
|
|
|
|
}, changedChannels[id]));
|
|
|
|
|
}
|
|
|
|
|
channelArray = BDFDB.ArrayUtils.keySort(channelArray.filter(n => e.returnValue.channels.every(channel => channel.id != n.channel.id) && (n.lowerCaseName.indexOf(e.methodArguments[1]) != -1 || (n.lowerCaseCatName && n.lowerCaseCatName.indexOf(e.methodArguments[1]) != -1))), "lowerCaseName");
|
|
|
|
|
e.returnValue.channels = [].concat(e.returnValue.channels, channelArray.map(n => n.channel)).slice(0, BDFDB.DiscordConstants.MAX_AUTOCOMPLETE_RESULTS);
|
|
|
|
|
}});
|
|
|
|
|
|
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 () {
|
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 = {}) {
|
|
|
|
|
let settingsPanel, settingsItems = [];
|
|
|
|
|
|
|
|
|
|
for (let key in settings) if (!this.defaults.settings[key].inner) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
|
|
|
|
type: "Switch",
|
|
|
|
|
plugin: this,
|
|
|
|
|
keys: ["settings", key],
|
|
|
|
|
label: this.defaults.settings[key].description,
|
|
|
|
|
value: settings[key]
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}));
|
2020-12-15 10:35:30 +01:00
|
|
|
|
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
|
2020-11-19 16:45:36 +01:00
|
|
|
|
title: "Change Channels in:",
|
2020-09-19 20:49:33 +02:00
|
|
|
|
children: Object.keys(settings).map(key => this.defaults.settings[key].inner && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
|
|
|
|
|
type: "Switch",
|
|
|
|
|
plugin: this,
|
|
|
|
|
keys: ["settings", key],
|
|
|
|
|
label: this.defaults.settings[key].description,
|
|
|
|
|
value: settings[key]
|
|
|
|
|
}))
|
|
|
|
|
}));
|
|
|
|
|
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
|
|
|
|
|
type: "Button",
|
|
|
|
|
color: BDFDB.LibraryComponents.Button.Colors.RED,
|
|
|
|
|
label: "Reset all Channels",
|
|
|
|
|
onClick: _ => {
|
2020-12-22 20:38:51 +01:00
|
|
|
|
BDFDB.ModalUtils.confirm(this, this.labels.confirm_resetall, _ => {
|
2020-09-19 20:49:33 +02:00
|
|
|
|
BDFDB.DataUtils.remove(this, "channels");
|
|
|
|
|
this.forceUpdateAll();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
children: BDFDB.LanguageUtils.LanguageStrings.RESET
|
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, 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");
|
|
|
|
|
settings = BDFDB.DataUtils.get(this, "settings");
|
|
|
|
|
|
|
|
|
|
this.changeAppTitle();
|
|
|
|
|
BDFDB.PatchUtils.forceAllUpdates(this);
|
2020-10-30 15:54:55 +01:00
|
|
|
|
BDFDB.ChannelUtils.rerenderAll(instant);
|
2020-11-19 16:51:14 +01:00
|
|
|
|
BDFDB.ReactUtils.forceUpdate(BDFDB.ReactUtils.findOwner(document.querySelector(BDFDB.dotCN.app), {name: "Channel", unlimited: true}));
|
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) {
|
2021-01-09 22:06:27 +01:00
|
|
|
|
this.injectItem(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
onGroupDMContextMenu (e) {
|
|
|
|
|
this.injectItem(e);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
injectItem (e) {
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (e.instance.props.channel) {
|
|
|
|
|
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, {
|
2020-12-21 19:56:36 +01:00
|
|
|
|
label: this.labels.context_localchannelsettings,
|
2020-09-19 20:49:33 +02:00
|
|
|
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-submenu"),
|
|
|
|
|
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
|
|
|
|
|
children: [
|
|
|
|
|
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
2020-12-21 19:56:36 +01:00
|
|
|
|
label: this.labels.submenu_channelsettings,
|
2020-09-19 20:49:33 +02:00
|
|
|
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-change"),
|
|
|
|
|
action: _ => {
|
|
|
|
|
this.openChannelSettingsModal(e.instance.props.channel);
|
|
|
|
|
}
|
|
|
|
|
}),
|
|
|
|
|
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
|
2020-12-21 19:56:36 +01:00
|
|
|
|
label: this.labels.submenu_resetsettings,
|
2020-09-19 20:49:33 +02:00
|
|
|
|
id: BDFDB.ContextMenuUtils.createItemId(this.name, "settings-reset"),
|
2020-12-22 20:38:51 +01:00
|
|
|
|
color: BDFDB.LibraryComponents.MenuItems.Colors.DANGER,
|
2020-09-19 20:49:33 +02:00
|
|
|
|
disabled: !changedChannels[e.instance.props.channel.id],
|
2020-12-22 20:38:51 +01:00
|
|
|
|
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);
|
2020-09-19 20:49:33 +02:00
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processChannelEditorContainer (e) {
|
|
|
|
|
if (!e.instance.props.disabled && e.instance.props.channel && BDFDB.ChannelUtils.isTextChannel(e.instance.props.channel) && e.instance.props.type == BDFDB.DiscordConstants.TextareaTypes.NORMAL && settings.changeInChatTextarea) {
|
|
|
|
|
let data = changedChannels[e.instance.props.channel.id];
|
|
|
|
|
e.instance.props.placeholder = BDFDB.LanguageUtils.LanguageStringsFormat("TEXTAREA_PLACEHOLDER", `#${data && data.name || e.instance.props.channel.name}`);
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-09-19 20:49:33 +02:00
|
|
|
|
processAutocompleteChannelResult (e) {
|
|
|
|
|
if (e.instance.props.channel && settings.changeInAutoComplete) {
|
|
|
|
|
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 {
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.marginleft4]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id);
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.autocompleteicon]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, {alpha: 0.6});
|
|
|
|
|
if (e.instance.props.category) {
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.autocompletedescription]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2020-09-19 20:49:33 +02:00
|
|
|
|
processAuditLog (e) {
|
|
|
|
|
let channel = BDFDB.ObjectUtils.get(e.instance, "props.log.options.channel");
|
|
|
|
|
if (channel && settings.changeInAuditLog) {
|
|
|
|
|
if (!e.returnvalue) e.instance.props.log.options.channel = this.getChannelData(channel.id);
|
|
|
|
|
else {
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["children", [["#" + channel.name]]]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (channelName) this.changeChannelColor(channelName, channel.id);
|
|
|
|
|
}
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-09-19 20:49:33 +02:00
|
|
|
|
processSettingsInvites (e) {
|
|
|
|
|
if (BDFDB.ObjectUtils.is(e.instance.props.invites) && settings.changeInInviteLog) {
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
2020-09-19 20:49:33 +02:00
|
|
|
|
processHeaderBarContainer (e) {
|
|
|
|
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(e.instance.props.channelId);
|
2021-01-09 22:06:27 +01:00
|
|
|
|
if (channel && (BDFDB.ChannelUtils.isTextChannel(channel) || channel.isGroupDM()) && settings.changeInChannelHeader) {
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (!e.returnvalue) {
|
2021-01-09 22:06:27 +01:00
|
|
|
|
let channelName = BDFDB.ReactUtils.findChild(e.instance, {name: ["Title", "ChannelName"]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (channelName) {
|
2021-01-09 22:06:27 +01:00
|
|
|
|
if (channelName.props.children) {
|
|
|
|
|
channelName.props.children = channel.isGroupDM() ? this.getGroupName(channel.id) : this.getChannelData(channel.id).name;
|
|
|
|
|
this.changeChannelColor(channelName, channel.id);
|
|
|
|
|
}
|
|
|
|
|
if (channelName.props.channel) channelName.props.channel = this.getChannelData(channel.id);
|
2020-09-19 20:49:33 +02:00
|
|
|
|
}
|
2020-03-08 14:07:16 +01:00
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
else {
|
|
|
|
|
let [children, index] = BDFDB.ReactUtils.findParent(e.instance, {name: "Icon"});
|
|
|
|
|
if (index > -1) {
|
|
|
|
|
let icon = BDFDB.ReactUtils.createElement(children[index].props.icon, {
|
|
|
|
|
className: BDFDB.disCN.channelheadericon
|
|
|
|
|
});
|
|
|
|
|
this.changeChannelIconColor(icon, channel.id, {alpha: 0.6});
|
|
|
|
|
children[index] = BDFDB.ReactUtils.createElement("div", {
|
|
|
|
|
className: BDFDB.disCN.channelheadericonwrapper,
|
|
|
|
|
children: icon
|
|
|
|
|
})
|
|
|
|
|
}
|
2020-03-08 14:07:16 +01:00
|
|
|
|
}
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
|
|
|
|
|
2020-11-12 19:04:22 +01:00
|
|
|
|
processFocusRing (e) {
|
|
|
|
|
if (e.returnvalue && e.returnvalue.props && e.returnvalue.props.className && e.returnvalue.props.className.indexOf(BDFDB.disCN.categoryiconvisibility) > -1 && settings.changeInChannelList) {
|
|
|
|
|
let dataListId = BDFDB.ObjectUtils.get(e.returnvalue, "props.children.0.props.data-list-item-id");
|
|
|
|
|
if (dataListId) {
|
|
|
|
|
let channelId = dataListId.split("_").pop();
|
|
|
|
|
let modify = {muted: BDFDB.LibraryModules.MutedUtils.isGuildOrCategoryOrChannelMuted(BDFDB.LibraryModules.LastGuildStore.getGuildId(), channelId)};
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.categoryname]]});
|
2021-01-10 14:34:13 +01:00
|
|
|
|
if (categoryName) this.changeChannelColor(categoryName.props && categoryName.props.children || categoryName, channelId, modify);
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let categoryIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.categoryicon]]});
|
2020-11-12 19:04:22 +01:00
|
|
|
|
if (categoryIcon) this.changeChannelIconColor(categoryIcon, channelId, Object.assign({alpha: 0.6}, modify));
|
2020-09-19 20:49:33 +02:00
|
|
|
|
}
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
2020-11-12 19:04:22 +01:00
|
|
|
|
|
|
|
|
|
processChannelCategoryItem (e) {
|
|
|
|
|
if (e.instance.props.channel && settings.changeInChannelList) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
|
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
|
2020-09-19 20:49:33 +02:00
|
|
|
|
processChannelItem (e) {
|
|
|
|
|
if (e.instance.props.channel && settings.changeInChannelList) {
|
|
|
|
|
if (!e.returnvalue) e.instance.props.channel = this.getChannelData(e.instance.props.channel.id);
|
|
|
|
|
else {
|
|
|
|
|
let modify = BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "muted", "locked", "selected", "unread", "connected", "hovered");
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.channelname]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
|
2021-01-10 14:34:13 +01:00
|
|
|
|
let channelIcon = settings.changeChannelIcon && BDFDB.ReactUtils.findChild(e.returnvalue, {name: "ChannelItemIcon"});
|
|
|
|
|
if (channelIcon && typeof channelIcon.type == "function") {
|
|
|
|
|
let type = channelIcon.type;
|
|
|
|
|
channelIcon.type = (...args) => {
|
|
|
|
|
let returnValue = type(...args);
|
|
|
|
|
if (returnValue && typeof returnValue.props.children == "function") {
|
|
|
|
|
let childrenRender = returnValue.props.children;
|
|
|
|
|
returnValue.props.children = (...args2) => {
|
|
|
|
|
let renderedChildren = childrenRender(...args2);
|
|
|
|
|
this.changeChannelIconColor(renderedChildren.props.children, e.instance.props.channel.id, Object.assign({alpha: 0.6}, modify));
|
|
|
|
|
return renderedChildren;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
return returnValue;
|
|
|
|
|
};
|
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
2021-01-09 22:06:27 +01:00
|
|
|
|
|
|
|
|
|
processDirectMessage (e) {
|
|
|
|
|
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && settings.changeInRecentDms) {
|
|
|
|
|
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 = (...args) => {
|
|
|
|
|
let renderedChildren = childrenRender(...args);
|
|
|
|
|
if (renderedChildren && renderedChildren.props) renderedChildren.props.icon = this.getGroupIcon(e.instance.props.channel.id);
|
|
|
|
|
return renderedChildren;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
processPrivateChannel (e) {
|
|
|
|
|
if (e.instance.props.channel && e.instance.props.channel.isGroupDM() && settings.changeInChannelList) {
|
|
|
|
|
e.returnvalue.props.name = BDFDB.ReactUtils.createElement("span", {children: this.getGroupName(e.instance.props.channel.id)});
|
|
|
|
|
this.changeChannelColor(e.returnvalue.props.name, e.instance.props.channel.id, {modify: BDFDB.ObjectUtils.extract(Object.assign({}, e.instance.props, e.instance.state), "hovered", "selected", "hasUnreadMessages", "muted")});
|
|
|
|
|
e.returnvalue.props.name = [e.returnvalue.props.name];
|
|
|
|
|
e.returnvalue.props.avatar.props.src = this.getGroupIcon(e.instance.props.channel.id);
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
|
|
|
|
|
processQuickSwitchChannelResult (e) {
|
|
|
|
|
if (e.instance.props.channel && settings.changeInQuickSwitcher) {
|
|
|
|
|
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");
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let channelName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.quickswitchresultmatch]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (channelName) this.changeChannelColor(channelName, e.instance.props.channel.id, modify);
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let channelIcon = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.quickswitchresulticon]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (channelIcon) this.changeChannelIconColor(channelIcon, e.instance.props.channel.id, Object.assign({alpha: 0.6}, modify));
|
|
|
|
|
if (e.instance.props.category) {
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let categoryName = BDFDB.ReactUtils.findChild(e.returnvalue, {props: [["className", BDFDB.disCN.quickswitchresultnote]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
|
|
|
|
|
processRecentsChannelHeader (e) {
|
|
|
|
|
if (settings.changeInRecentMentions && BDFDB.ArrayUtils.is(e.returnvalue.props.children)) {
|
|
|
|
|
for (let child of e.returnvalue.props.children) if (child && child.props && child.props.channel && child.type.displayName == "ChannelName") {
|
|
|
|
|
child.props.channel = this.getChannelData(child.props.channel.id);
|
|
|
|
|
let oldType = child.type;
|
|
|
|
|
child.type = (...args) => {
|
|
|
|
|
let instance = oldType(...args);
|
2020-11-19 16:51:14 +01:00
|
|
|
|
let channelName = BDFDB.ReactUtils.findChild(instance, {props: [["className", BDFDB.disCN.recentmentionschannelname]]});
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (channelName) this.changeChannelColor(channelName, child.props.channel.id);
|
|
|
|
|
return instance;
|
|
|
|
|
};
|
|
|
|
|
child.type.displayName = oldType.displayName;
|
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2020-09-19 20:49:33 +02:00
|
|
|
|
processMessageContent (e) {
|
|
|
|
|
if (BDFDB.ArrayUtils.is(e.instance.props.content) && settings.changeInMentions) for (let ele of e.instance.props.content) {
|
|
|
|
|
if (BDFDB.ReactUtils.isValidElement(ele) && ele.type && ele.type.displayName == "Tooltip" && typeof ele.props.children == "function") {
|
|
|
|
|
let children = ele.props.children({});
|
|
|
|
|
if (children && children.type.displayName == "Mention" && children.props.children && typeof children.props.children[0] == "string" && children.props.children[0][0] == "#") {
|
|
|
|
|
let channelName = children.props.children[0].slice(1);
|
|
|
|
|
let guildId = BDFDB.LibraryModules.LastGuildStore.getGuildId();
|
|
|
|
|
let channels = guildId && (BDFDB.LibraryModules.GuildChannelStore.getChannels(guildId)[0] || BDFDB.LibraryModules.GuildChannelStore.getChannels(guildId).SELECTABLE);
|
|
|
|
|
if (Array.isArray(channels)) for (let channelObj of channels) {
|
|
|
|
|
if (channelName == channelObj.channel.name) {
|
|
|
|
|
let category = BDFDB.LibraryModules.ChannelStore.getChannel(channelObj.channel.parent_id);
|
|
|
|
|
if (!category || category && ele.props.text == category.name) {
|
|
|
|
|
if (category) {
|
|
|
|
|
let categoryData = changedChannels[category.id];
|
|
|
|
|
if (categoryData && categoryData.name) ele.props.text = categoryData.name;
|
|
|
|
|
}
|
|
|
|
|
let name = (changedChannels[channelObj.channel.id] || {}).name;
|
|
|
|
|
let color = this.getChannelDataColor(channelObj.channel.id);
|
|
|
|
|
if (name || color) {
|
|
|
|
|
let renderChildren = ele.props.children;
|
|
|
|
|
ele.props.children = (...args) => {
|
2020-12-04 22:38:52 +01:00
|
|
|
|
let children = renderChildren(...args);
|
|
|
|
|
this.changeMention(children, {name, color});
|
|
|
|
|
return children;
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
break;
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-12-04 22:38:52 +01:00
|
|
|
|
|
|
|
|
|
processChannelMention (e) {
|
|
|
|
|
if (e.instance.props.id && settings.changeInMentions) {
|
|
|
|
|
let name = (changedChannels[e.instance.props.id] || {}).name;
|
|
|
|
|
let color = this.getChannelDataColor(e.instance.props.id);
|
|
|
|
|
if (name || color) {
|
|
|
|
|
if (typeof e.returnvalue.props.children == "function") {
|
|
|
|
|
let renderChildren = e.returnvalue.props.children;
|
|
|
|
|
e.returnvalue.props.children = (...args) => {
|
|
|
|
|
let children = renderChildren(...args);
|
|
|
|
|
this.changeMention(children, {name, color});
|
|
|
|
|
return children;
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
else this.changeMention(e.returnvalue, {name, color});
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeMention (mention, data) {
|
|
|
|
|
if (data.name) {
|
|
|
|
|
if (typeof mention.props.children == "string") mention.props.children = "#" + data.name;
|
|
|
|
|
else if (BDFDB.ArrayUtils.is(mention.props.children)) {
|
|
|
|
|
if (mention.props.children[0] == "#") mention.props.children[1] = data.name;
|
|
|
|
|
else mention.props.children[0] = "#" + data.name;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (data.color) {
|
|
|
|
|
let color1_0 = BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(data.color) ? data.color[0] : data.color, "RGBA");
|
|
|
|
|
let color0_1 = mention.props.mentioned ? "transparent" : BDFDB.ColorUtils.setAlpha(color1_0, 0.1, "RGBA");
|
|
|
|
|
let color0_7 = mention.props.mentioned ? "transparent" : BDFDB.ColorUtils.setAlpha(color1_0, 0.7, "RGBA");
|
|
|
|
|
let white = mention.props.mentioned ? color1_0 : "#FFFFFF";
|
|
|
|
|
mention.props.style = Object.assign({}, mention.props.style, {
|
|
|
|
|
background: color0_1,
|
|
|
|
|
color: color1_0
|
|
|
|
|
});
|
|
|
|
|
let onMouseEnter = mention.props.onMouseEnter || ( _ => {});
|
|
|
|
|
mention.props.onMouseEnter = event => {
|
|
|
|
|
onMouseEnter(event);
|
|
|
|
|
event.target.style.setProperty("background", color0_7, "important");
|
|
|
|
|
event.target.style.setProperty("color", white, "important");
|
|
|
|
|
};
|
|
|
|
|
let onMouseLeave = mention.props.onMouseLeave || ( _ => {});
|
|
|
|
|
mention.props.onMouseLeave = event => {
|
|
|
|
|
onMouseLeave(event);
|
|
|
|
|
event.target.style.setProperty("background", color0_1, "important");
|
|
|
|
|
event.target.style.setProperty("color", color1_0, "important");
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-01-03 21:05:35 +01:00
|
|
|
|
|
2021-01-06 12:38:36 +01:00
|
|
|
|
changeAppTitle () {
|
2020-09-19 20:49:33 +02:00
|
|
|
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(BDFDB.LibraryModules.LastChannelStore.getChannelId());
|
|
|
|
|
let title = document.head.querySelector("title");
|
2021-01-09 22:06:27 +01:00
|
|
|
|
if (title) {
|
|
|
|
|
if (BDFDB.ChannelUtils.isTextChannel(channel)) BDFDB.DOMUtils.setText(title, "#" + this.getChannelData(channel.id, settings.changeAppTitle).name);
|
|
|
|
|
else if (channel.isGroupDM()) BDFDB.DOMUtils.setText(title, this.getGroupName(channel.id, settings.changeAppTitle));
|
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
changeChannelColor (child, channelId, modify) {
|
|
|
|
|
if (BDFDB.ReactUtils.isValidElement(child)) {
|
|
|
|
|
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) {
|
2021-01-10 14:34:13 +01:00
|
|
|
|
let color = child && this.getChannelDataColor(channelId);
|
2020-09-19 20:49:33 +02:00
|
|
|
|
if (color && settings.changeChannelIcon) {
|
|
|
|
|
color = modify ? this.chooseColor(BDFDB.ObjectUtils.is(color) ? color[0] : color, modify) : BDFDB.ColorUtils.convert(BDFDB.ObjectUtils.is(color) ? color[0] : color, "RGBA");
|
|
|
|
|
child.props.color = color || "currentColor";
|
|
|
|
|
if (color) child.props.foreground = null;
|
|
|
|
|
}
|
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) {
|
|
|
|
|
if (color) {
|
|
|
|
|
if (BDFDB.ObjectUtils.is(config)) {
|
|
|
|
|
if (config.mentions || config.focused || config.hovered || config.selected || config.unread || config.connected) color = BDFDB.ColorUtils.change(color, 0.5);
|
|
|
|
|
else if (config.muted || config.locked) color = BDFDB.ColorUtils.change(color, -0.5);
|
|
|
|
|
}
|
|
|
|
|
return BDFDB.ColorUtils.convert(color, "RGBA");
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
return null;
|
2020-01-03 21:05:35 +01:00
|
|
|
|
}
|
2020-09-19 20:49:33 +02:00
|
|
|
|
|
|
|
|
|
getChannelDataColor (channelId) {
|
|
|
|
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
|
|
|
|
if (!channel) return null;
|
|
|
|
|
let channelData = changedChannels[channel.id];
|
|
|
|
|
if (channelData && channelData.color) return channelData.color;
|
|
|
|
|
let category = channel.parent_id && BDFDB.LibraryModules.ChannelStore.getChannel(channel.parent_id);
|
|
|
|
|
if (category) {
|
|
|
|
|
let categoryData = changedChannels[category.id];
|
|
|
|
|
if (categoryData && categoryData.inheritColor && categoryData.color) return categoryData.color;
|
|
|
|
|
}
|
|
|
|
|
return null;
|
2020-02-04 08:20:40 +01:00
|
|
|
|
}
|
2020-06-08 20:50:04 +02:00
|
|
|
|
|
2020-09-19 20:49:33 +02:00
|
|
|
|
getChannelData (channelId, change = true) {
|
|
|
|
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
|
|
|
|
if (!channel) return new BDFDB.DiscordObjects.Channel({});
|
|
|
|
|
let data = change && changedChannels[channel.id];
|
|
|
|
|
if (data) {
|
|
|
|
|
let nativeObject = new BDFDB.DiscordObjects.Channel(channel);
|
|
|
|
|
nativeObject.name = data.name || nativeObject.name;
|
|
|
|
|
return nativeObject;
|
|
|
|
|
}
|
|
|
|
|
return new BDFDB.DiscordObjects.Channel(channel);
|
|
|
|
|
}
|
2021-01-09 22:06:27 +01:00
|
|
|
|
|
|
|
|
|
getGroupName (channelId, change = true) {
|
|
|
|
|
let channel = this.getChannelData(channelId, change);
|
|
|
|
|
if (channel.name) return channel.name;
|
|
|
|
|
let recipients = channel.recipients.map(BDFDB.LibraryModules.UserStore.getUser).filter(n => n);
|
|
|
|
|
return recipients.length > 0 ? recipients.map(u => u.toString()).join(", ") : BDFDB.LanguageUtils.LanguageStrings.UNNAMED;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
getGroupIcon (channelId, change = true) {
|
|
|
|
|
let channel = BDFDB.LibraryModules.ChannelStore.getChannel(channelId);
|
|
|
|
|
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] || {};
|
|
|
|
|
|
|
|
|
|
BDFDB.ModalUtils.open(this, {
|
|
|
|
|
size: "MEDIUM",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
header: this.labels.modal_header,
|
2020-09-19 20:49:33 +02:00
|
|
|
|
subheader: channel.name,
|
|
|
|
|
children: [
|
|
|
|
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
|
2020-12-21 19:56:36 +01:00
|
|
|
|
title: this.labels.modal_channelname,
|
2020-09-19 20:49:33 +02:00
|
|
|
|
className: BDFDB.disCN.marginbottom20 + " input-channelname",
|
|
|
|
|
children: [
|
|
|
|
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
|
|
|
|
|
value: data.name,
|
|
|
|
|
placeholder: channel.name,
|
|
|
|
|
autoFocus: true
|
|
|
|
|
}),
|
|
|
|
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormDivider, {
|
|
|
|
|
className: BDFDB.disCN.dividerdefault
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
}),
|
|
|
|
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.FormComponents.FormItem, {
|
2020-12-21 19:56:36 +01:00
|
|
|
|
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,
|
|
|
|
|
number: 1
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
}),
|
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
|
|
|
|
className: "input-inheritcolor",
|
|
|
|
|
margin: 20,
|
2020-12-21 19:56:36 +01:00
|
|
|
|
label: this.labels.modal_inheritcolor,
|
2020-09-19 20:49:33 +02:00
|
|
|
|
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
|
2021-01-09 22:06:27 +01:00
|
|
|
|
value: channel.isCategory() && data.inheritColor,
|
|
|
|
|
disabled: !channel.isCategory()
|
|
|
|
|
}),
|
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,
|
|
|
|
|
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
|
|
|
|
|
children: this.labels.modal_channelicon
|
|
|
|
|
}),
|
|
|
|
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
|
|
|
|
|
className: "input-removeicon",
|
|
|
|
|
type: "Switch",
|
|
|
|
|
margin: 0,
|
|
|
|
|
grow: 0,
|
|
|
|
|
label: BDFDB.LanguageUtils.LanguageStrings.REMOVE,
|
|
|
|
|
tag: BDFDB.LibraryComponents.FormComponents.FormTitle.Tags.H5,
|
|
|
|
|
value: data.removeIcon,
|
|
|
|
|
onChange: (value, instance) => {
|
|
|
|
|
let iconInputIns = BDFDB.ReactUtils.findOwner(BDFDB.ObjectUtils.get(instance, `${BDFDB.ReactUtils.instanceKey}.return.return`), {key: "CHANNELICON"});
|
|
|
|
|
if (iconInputIns) {
|
|
|
|
|
delete iconInputIns.props.success;
|
|
|
|
|
delete iconInputIns.props.errorMessage;
|
|
|
|
|
iconInputIns.props.disabled = value;
|
|
|
|
|
BDFDB.ReactUtils.forceUpdate(iconInputIns);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
]
|
|
|
|
|
}),
|
|
|
|
|
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
|
|
|
|
|
className: "input-channelicon",
|
|
|
|
|
key: "CHANNELICON",
|
|
|
|
|
success: !data.removeIcon && data.url,
|
|
|
|
|
maxLength: 100000000000000000000,
|
|
|
|
|
value: data.url,
|
|
|
|
|
placeholder: BDFDB.DMUtils.getIcon(channel.id),
|
|
|
|
|
disabled: data.removeIcon,
|
|
|
|
|
onChange: (value, instance) => {
|
|
|
|
|
this.checkUrl(value, instance);
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
]
|
2020-09-19 20:49:33 +02:00
|
|
|
|
})
|
|
|
|
|
],
|
|
|
|
|
buttons: [{
|
|
|
|
|
contents: BDFDB.LanguageUtils.LanguageStrings.SAVE,
|
|
|
|
|
color: "BRAND",
|
|
|
|
|
close: true,
|
|
|
|
|
click: modal => {
|
|
|
|
|
let oldData = Object.assign({}, data);
|
|
|
|
|
|
2021-01-09 22:06:27 +01:00
|
|
|
|
let channelNameInput = modal.querySelector(".input-channelname " + BDFDB.dotCN.input);
|
|
|
|
|
let inheritColorInput = modal.querySelector(".input-inheritcolor " + BDFDB.dotCN.switchinner);
|
|
|
|
|
let channelIconInput = modal.querySelector(".input-channelicon " + BDFDB.dotCN.input);
|
|
|
|
|
let removeIconInput = modal.querySelector(".input-removeicon " + BDFDB.dotCN.switchinner);
|
|
|
|
|
|
|
|
|
|
data.name = channelNameInput.value.trim() || null;
|
2020-09-19 20:49:33 +02:00
|
|
|
|
|
|
|
|
|
data.color = BDFDB.ColorUtils.getSwatchColor(modal, 1);
|
|
|
|
|
if (data.color != null && !BDFDB.ObjectUtils.is(data.color)) {
|
|
|
|
|
if (data.color[0] < 30 && data.color[1] < 30 && data.color[2] < 30) data.color = BDFDB.ColorUtils.change(data.color, 30);
|
|
|
|
|
else if (data.color[0] > 225 && data.color[1] > 225 && data.color[2] > 225) data.color = BDFDB.ColorUtils.change(data.color, -30);
|
|
|
|
|
}
|
2020-02-04 08:20:40 +01:00
|
|
|
|
|
2021-01-09 22:06:27 +01:00
|
|
|
|
data.inheritColor = inheritColorInput && inheritColorInput.checked;
|
|
|
|
|
data.removeIcon = removeIconInput && removeIconInput.checked;
|
|
|
|
|
data.url = channelIconInput && (!data.removeIcon && BDFDB.DOMUtils.containsClass(channelIconInput, BDFDB.disCN.inputsuccess) ? channelIconInput.value.trim() : null) || null;
|
2020-09-19 20:49:33 +02:00
|
|
|
|
|
|
|
|
|
let changed = false;
|
|
|
|
|
if (Object.keys(data).every(key => data[key] == null || data[key] == false) && (changed = true)) BDFDB.DataUtils.remove(this, "channels", channel.id);
|
|
|
|
|
else if (!BDFDB.equals(oldData, data) && (changed = true)) BDFDB.DataUtils.save(data, 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) {
|
|
|
|
|
BDFDB.TimeUtils.clear(instance.checkTimeout);
|
|
|
|
|
if (url == null || !url.trim()) {
|
|
|
|
|
delete instance.props.success;
|
|
|
|
|
delete instance.props.errorMessage;
|
|
|
|
|
instance.forceUpdate();
|
|
|
|
|
}
|
|
|
|
|
else instance.checkTimeout = BDFDB.TimeUtils.timeout(_ => {
|
|
|
|
|
BDFDB.LibraryRequires.request(url.trim(), (error, response, result) => {
|
|
|
|
|
if (response && response.headers["content-type"] && response.headers["content-type"].indexOf("image") != -1) {
|
|
|
|
|
instance.props.success = true;
|
|
|
|
|
delete instance.props.errorMessage;
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
delete instance.props.success;
|
|
|
|
|
instance.props.errorMessage = this.labels.modal_invalidurl;
|
|
|
|
|
}
|
|
|
|
|
delete instance.checkTimeout;
|
|
|
|
|
instance.forceUpdate();
|
|
|
|
|
});
|
|
|
|
|
}, 1000);
|
|
|
|
|
}
|
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) {
|
2020-12-21 19:56:36 +01:00
|
|
|
|
case "bg": // Bulgarian
|
2020-09-19 20:49:33 +02:00
|
|
|
|
return {
|
2020-12-22 20:38:51 +01:00
|
|
|
|
confirm_reset: "Наистина ли искате да нулирате този канал?",
|
|
|
|
|
confirm_resetall: "Наистина ли искате да нулирате всички канали?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Настройки на местния канал",
|
|
|
|
|
modal_channelname: "Име на местния канал",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Икона",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Локален цвят на канала",
|
|
|
|
|
modal_header: "Настройки на местния канал",
|
2020-12-22 20:38:51 +01:00
|
|
|
|
modal_inheritcolor: "Наследете цвета на подканали",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
submenu_channelsettings: "Промяна на настройките",
|
|
|
|
|
submenu_resetsettings: "Нулиране на канала"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Lokale kanalindstillinger",
|
|
|
|
|
modal_channelname: "Lokalt kanalnavn",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Ikon",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Lokal kanalfarve",
|
|
|
|
|
modal_header: "Lokale kanalindstillinger",
|
|
|
|
|
modal_inheritcolor: "Arv farve til underkanaler",
|
|
|
|
|
submenu_channelsettings: "Ændre indstillinger",
|
|
|
|
|
submenu_resetsettings: "Nulstil kanal"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Lokale Kanaleinstellungen",
|
|
|
|
|
modal_channelname: "Lokaler Kanalname",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Symbol",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Lokale Kanalfarbe",
|
|
|
|
|
modal_header: "Lokale Kanaleinstellungen",
|
|
|
|
|
modal_inheritcolor: "Vererbung der Farbe an Unterkanäle",
|
|
|
|
|
submenu_channelsettings: "Einstellungen ändern",
|
|
|
|
|
submenu_resetsettings: "Kanal zurücksetzen"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01:00
|
|
|
|
case "el": // Greek
|
2020-09-19 20:49:33 +02:00
|
|
|
|
return {
|
2020-12-22 20:38:51 +01:00
|
|
|
|
confirm_reset: "Είστε βέβαιοι ότι θέλετε να επαναφέρετε αυτό το κανάλι;",
|
|
|
|
|
confirm_resetall: "Είστε βέβαιοι ότι θέλετε να επαναφέρετε όλα τα κανάλια;",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Ρυθμίσεις τοπικού καναλιού",
|
|
|
|
|
modal_channelname: "Τοπικό όνομα καναλιού",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Εικόνισμα",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Τοπικό χρώμα καναλιού",
|
|
|
|
|
modal_header: "Ρυθμίσεις τοπικού καναλιού",
|
|
|
|
|
modal_inheritcolor: "Κληρονομήστε το χρώμα στα δευτερεύοντα κανάλια",
|
|
|
|
|
submenu_channelsettings: "Αλλαξε ρυθμίσεις",
|
|
|
|
|
submenu_resetsettings: "Επαναφορά καναλιού"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
|
|
|
|
context_localchannelsettings: "Configuración de canal local",
|
|
|
|
|
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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_inheritcolor: "Heredar color a subcanales",
|
|
|
|
|
submenu_channelsettings: "Cambiar ajustes",
|
|
|
|
|
submenu_resetsettings: "Restablecer canal"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Paikallisen kanavan asetukset",
|
|
|
|
|
modal_channelname: "Paikallisen kanavan nimi",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Kuvake",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Paikallisen kanavan väri",
|
|
|
|
|
modal_header: "Paikallisen kanavan asetukset",
|
|
|
|
|
modal_inheritcolor: "Peri väri alikanaville",
|
|
|
|
|
submenu_channelsettings: "Vaihda asetuksia",
|
|
|
|
|
submenu_resetsettings: "Nollaa kanava"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
|
|
|
|
context_localchannelsettings: "Paramètres de la salon",
|
|
|
|
|
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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
submenu_channelsettings: "Modifier les paramètres",
|
2020-12-22 20:38:51 +01:00
|
|
|
|
submenu_resetsettings: "Réinitialiser la salon"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_header: "Postavke lokalnog kanala",
|
|
|
|
|
modal_inheritcolor: "Naslijedi boju na podkanalima",
|
|
|
|
|
submenu_channelsettings: "Promijeniti postavke",
|
|
|
|
|
submenu_resetsettings: "Resetiraj kanal"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Helyi csatorna színe",
|
|
|
|
|
modal_header: "Helyi csatorna beállításai",
|
|
|
|
|
modal_inheritcolor: "Örökli a színt az alcsatornákra",
|
|
|
|
|
submenu_channelsettings: "Beállítások megváltoztatása",
|
|
|
|
|
submenu_resetsettings: "Csatorna visszaállítása"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
|
|
|
|
context_localchannelsettings: "Impostazioni del canale locale",
|
|
|
|
|
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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_inheritcolor: "Eredita colore ai canali secondari",
|
|
|
|
|
submenu_channelsettings: "Cambia impostazioni",
|
|
|
|
|
submenu_resetsettings: "Reimposta canale"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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: "すべてのチャンネルをリセットしてもよろしいですか?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "ローカルチャンネル設定",
|
|
|
|
|
modal_channelname: "ローカルチャネル名",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "アイコン",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "ローカルチャンネルの色",
|
|
|
|
|
modal_header: "ローカルチャンネル設定",
|
|
|
|
|
modal_inheritcolor: "サブチャネルに色を継承する",
|
|
|
|
|
submenu_channelsettings: "設定を変更する",
|
|
|
|
|
submenu_resetsettings: "チャネルをリセット"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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: "모든 채널을 재설정 하시겠습니까?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "로컬 채널 설정",
|
|
|
|
|
modal_channelname: "로컬 채널 이름",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "상",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "로컬 채널 색상",
|
|
|
|
|
modal_header: "로컬 채널 설정",
|
|
|
|
|
modal_inheritcolor: "하위 채널에 색상 상속",
|
|
|
|
|
submenu_channelsettings: "설정 변경",
|
|
|
|
|
submenu_resetsettings: "채널 재설정"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Vietinio kanalo nustatymai",
|
|
|
|
|
modal_channelname: "Vietinio kanalo pavadinimas",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Piktograma",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Vietinio kanalo spalva",
|
|
|
|
|
modal_header: "Vietinio kanalo nustatymai",
|
|
|
|
|
modal_inheritcolor: "Paveldėkite spalvas subkanalams",
|
|
|
|
|
submenu_channelsettings: "Pakeisti nustatymus",
|
|
|
|
|
submenu_resetsettings: "Iš naujo nustatyti kanalą"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_header: "Lokale kanaalinstellingen",
|
2020-12-22 20:38:51 +01:00
|
|
|
|
modal_inheritcolor: "Overerf kleur naar subkanalen",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
submenu_channelsettings: "Instellingen veranderen",
|
|
|
|
|
submenu_resetsettings: "Kanaal resetten"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Lokale kanalinnstillinger",
|
|
|
|
|
modal_channelname: "Lokalt kanalnavn",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Ikon",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Lokal kanalfarge",
|
|
|
|
|
modal_header: "Lokale kanalinnstillinger",
|
|
|
|
|
modal_inheritcolor: "Arv farge til underkanaler",
|
|
|
|
|
submenu_channelsettings: "Endre innstillinger",
|
|
|
|
|
submenu_resetsettings: "Tilbakestill kanal"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Kolor kanału lokalnego",
|
|
|
|
|
modal_header: "Ustawienia kanału lokalnego",
|
|
|
|
|
modal_inheritcolor: "Dziedzicz kolor do kanałów podrzędnych",
|
|
|
|
|
submenu_channelsettings: "Zmień ustawienia",
|
|
|
|
|
submenu_resetsettings: "Resetuj kanał"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_header: "Configurações de canal local",
|
|
|
|
|
modal_inheritcolor: "Herdar cor para subcanais",
|
|
|
|
|
submenu_channelsettings: "Mudar configurações",
|
|
|
|
|
submenu_resetsettings: "Reiniciar canal"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Setări canale locale",
|
|
|
|
|
modal_channelname: "Numele canalului local",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Pictogramă",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Culoare canal local",
|
|
|
|
|
modal_header: "Setări canale locale",
|
|
|
|
|
modal_inheritcolor: "Moșteniți culoarea la sub-canale",
|
|
|
|
|
submenu_channelsettings: "Schimbă setările",
|
|
|
|
|
submenu_resetsettings: "Resetați canalul"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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: "Вы уверены, что хотите сбросить все каналы?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Настройки локального канала",
|
|
|
|
|
modal_channelname: "Имя локального канала",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Икона",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Цвет локального канала",
|
|
|
|
|
modal_header: "Настройки локального канала",
|
|
|
|
|
modal_inheritcolor: "Наследовать цвет для субканалов",
|
|
|
|
|
submenu_channelsettings: "Изменить настройки",
|
|
|
|
|
submenu_resetsettings: "Сбросить канал"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Lokala kanalinställningar",
|
|
|
|
|
modal_channelname: "Lokalt kanalnamn",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Ikon",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Lokal kanalfärg",
|
|
|
|
|
modal_header: "Lokala kanalinställningar",
|
|
|
|
|
modal_inheritcolor: "Ärva färg till underkanaler",
|
|
|
|
|
submenu_channelsettings: "Ändra inställningar",
|
|
|
|
|
submenu_resetsettings: "Återställ kanal"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
2020-12-21 19:56:36 +01: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: "แน่ใจไหมว่าต้องการรีเซ็ตช่องทั้งหมด",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "การตั้งค่าช่องท้องถิ่น",
|
|
|
|
|
modal_channelname: "ชื่อช่องท้องถิ่น",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "ไอคอน",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "ช่องท้องถิ่นสี",
|
|
|
|
|
modal_header: "การตั้งค่าช่องท้องถิ่น",
|
|
|
|
|
modal_inheritcolor: "สืบทอดสีไปยังช่องย่อย",
|
|
|
|
|
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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Yerel Kanal Ayarları",
|
|
|
|
|
modal_channelname: "Yerel Kanal Adı",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Simge",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Yerel Kanal Rengi",
|
|
|
|
|
modal_header: "Yerel Kanal Ayarları",
|
|
|
|
|
modal_inheritcolor: "Renkleri Alt Kanallara Devral",
|
|
|
|
|
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: "Ви впевнені, що хочете скинути всі канали?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Налаштування локального каналу",
|
|
|
|
|
modal_channelname: "Назва місцевого каналу",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Піктограма",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Колір локального каналу",
|
|
|
|
|
modal_header: "Налаштування локального каналу",
|
|
|
|
|
modal_inheritcolor: "Успадковувати колір для підканалів",
|
|
|
|
|
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?",
|
2020-12-21 19:56:36 +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",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
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ụ",
|
|
|
|
|
submenu_channelsettings: "Thay đổi cài đặt",
|
|
|
|
|
submenu_resetsettings: "Đặt lại kênh"
|
|
|
|
|
};
|
|
|
|
|
case "zh": // Chinese
|
|
|
|
|
return {
|
2020-12-22 20:38:51 +01:00
|
|
|
|
confirm_reset: "您确定要重置此频道吗?",
|
|
|
|
|
confirm_resetall: "您确定要重置所有频道吗?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "本地频道设置",
|
|
|
|
|
modal_channelname: "本地频道名称",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "图标",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "本地频道颜色",
|
|
|
|
|
modal_header: "本地频道设置",
|
|
|
|
|
modal_inheritcolor: "继承颜色到子通道",
|
|
|
|
|
submenu_channelsettings: "更改设置",
|
|
|
|
|
submenu_resetsettings: "重置频道"
|
|
|
|
|
};
|
|
|
|
|
case "zh-TW": // Chinese (Traditional)
|
|
|
|
|
return {
|
2020-12-22 20:38:51 +01:00
|
|
|
|
confirm_reset: "您確定要重置此頻道嗎?",
|
|
|
|
|
confirm_resetall: "您確定要重置所有頻道嗎?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "本地頻道設置",
|
|
|
|
|
modal_channelname: "本地頻道名稱",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "圖標",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "本地頻道顏色",
|
|
|
|
|
modal_header: "本地頻道設置",
|
|
|
|
|
modal_inheritcolor: "繼承顏色到子通道",
|
|
|
|
|
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?",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
context_localchannelsettings: "Local Channel Settings",
|
|
|
|
|
modal_channelname: "Local Channel Name",
|
2021-01-09 22:06:27 +01:00
|
|
|
|
modal_channelicon: "Icon",
|
2020-12-21 19:56:36 +01:00
|
|
|
|
modal_colorpicker1: "Local Channel Color",
|
|
|
|
|
modal_header: "Local Channel Settings",
|
|
|
|
|
modal_inheritcolor: "Inherit Color to Sub-Channels",
|
|
|
|
|
submenu_channelsettings: "Change Settings",
|
|
|
|
|
submenu_resetsettings: "Reset Channel"
|
2020-09-19 20:49:33 +02:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
};
|
2020-10-09 21:09:35 +02:00
|
|
|
|
})(window.BDFDB_Global.PluginUtils.buildPlugin(config));
|
2020-12-15 17:45:31 +01:00
|
|
|
|
})();
|