BetterDiscordAddons/Plugins/PersonalPins/PersonalPins.plugin.js

1135 lines
56 KiB
JavaScript
Raw Normal View History

2020-10-20 23:25:34 +02:00
/**
* @name PersonalPins
2021-03-05 13:26:41 +01:00
* @author DevilBro
2020-10-20 23:25:34 +02:00
* @authorId 278543574059057154
2024-02-15 05:50:08 +01:00
* @version 2.1.9
2021-03-05 13:26:41 +01:00
* @description Allows you to locally pin Messages
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/PersonalPins/
2021-03-10 09:17:37 +01:00
* @updateUrl https://mwittrien.github.io/BetterDiscordAddons/Plugins/PersonalPins/PersonalPins.plugin.js
2020-10-20 23:25:34 +02:00
*/
2018-12-28 14:28:50 +01: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-07-11 23:28:30 +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-03-11 21:27:03 +01:00
let _this;
2023-12-20 15:37:45 +01:00
const pinIconGeneral = `<svg name="Note" width="24" height="24" viewBox="0 0 24 24"><mask/><path fill="currentColor" mask="url(#pinIconMask)" d="m 7.2380955,2 c -0.957664,0 -0.952381,0.952381 -0.952381,0.952381 v 0.9523809 h -0.952381 c -1.5828506,0 -2.857143,1.2742924 -2.857143,2.8571429 V 7.7142857 H 21.52381 V 6.7619048 c 0,-1.5828505 -1.274292,-2.8571429 -2.857143,-2.8571429 H 17.714286 V 2.952381 c 0,0 0.0053,-0.952381 -0.952381,-0.952381 -0.957664,0 -0.952381,0.952381 -0.952381,0.952381 V 3.9047619 H 8.1904765 V 2.952381 c 0,0 0.0053,-0.952381 -0.952381,-0.952381 z m -4.761905,7.619048 v 9.523809 C 2.4761905,20.725708 3.7504829,22 5.3333335,22 H 18.666667 c 1.582851,0 2.857143,-1.274292 2.857143,-2.857143 V 9.619048 Z m 3.809524,2.5 H 17.714286 c 0,0 0.952381,-0.009 0.952381,0.952381 0,0.961422 -0.952381,0.952381 -0.952381,0.952381 H 6.2857145 c 0,0 -0.952381,0.009 -0.952381,-0.952381 0,-0.961423 0.952381,-0.952381 0.952381,-0.952381 z m 0,4.761904 H 17.714286 c 0,0 0.952381,-0.009 0.952381,0.952381 0,0.961424 -0.952381,0.952381 -0.952381,0.952381 H 6.2857145 c 0,0 -0.952381,0.009 -0.952381,-0.952381 0,-0.961423 0.952381,-0.952381 0.952381,-0.952381 z"/><extra/></svg>`;
2021-01-21 16:15:24 +01:00
const pinIconMask = `<mask id="pinIconMask" fill="black"><path fill="white" d="M 0 0 H 24 V 24 H 0 Z"/><path fill="black" d="M24 12 H 12 V 24 H 24 Z"/></mask>`;
2020-09-19 20:49:33 +02:00
const pinIcon = pinIconGeneral.replace(`<extra/>`, ``).replace(`<mask/>`, ``).replace(` mask="url(#pinIconMask)"`, ``);
2021-01-21 16:21:08 +01:00
const pinIconDelete = pinIconGeneral.replace(`<extra/>`, `<path fill="none" stroke="#f04747" stroke-width="2" d="m 14.702359,14.702442 8.596228,8.596148 m 0,-8.597139 -8.59722,8.596147 z"/>`).replace(`<mask/>`, pinIconMask);
const pinIconUpdate = pinIconGeneral.replace(`<extra/>`, `<path fill="#43b581" d="M 24,18.375879 V 14 l -1.470407,1.468882 C 21.626418,14.562588 20.378506,14 18.996922,14 16.232873,14 14,16.238045 14,19 c 0,2.761955 2.231994,5 4.996043,5 2.32873,0 4.280186,-1.594585 4.833347,-3.750879 h -1.301556 c -0.516226,1.455696 -1.89781,2.5 -3.53355,2.5 -2.073696,0 -3.752528,-1.678973 -3.752528,-3.750879 0,-2.071906 1.678832,-3.750879 3.751649,-3.750879 1.034209,0 1.962887,0.430731 2.641808,1.109353 L 19.6178,18.372363 H 24 Z"/>`).replace(`<mask/>`, pinIconMask);
2020-09-19 20:49:33 +02:00
const filterKeys = ["channel", "server", "all"];
const sortKeys = ["notetime", "messagetime"];
const orderKeys = ["ascending", "descending"];
2020-09-23 09:29:56 +02:00
2021-03-11 21:27:03 +01:00
const popoutProps = {};
2021-05-17 12:44:34 +02:00
let notes = {};
2022-06-17 18:52:53 +02:00
2021-03-11 21:27:03 +01:00
const NotesPopoutComponent = class NotesPopout extends BdApi.React.Component {
containsSearchkey(data, key, searchKey) {
let value = BDFDB.ObjectUtils.get(data, key);
return value && value.toUpperCase().indexOf(searchKey) > -1;
2020-09-19 20:49:33 +02:00
}
2021-03-11 21:27:03 +01:00
filterMessages() {
2021-05-17 12:44:34 +02:00
let messages = [], updateData = false;
2020-09-19 20:49:33 +02:00
for (let guild_id in notes) for (let channel_id in notes[guild_id]) for (let message_idPOS in notes[guild_id][channel_id]) {
let message = JSON.parse(notes[guild_id][channel_id][message_idPOS].message);
message.author = new BDFDB.DiscordObjects.User(message.author);
2022-11-06 12:08:58 +01:00
if (message.interaction && message.interaction.user) message.interaction.user = new BDFDB.DiscordObjects.User(message.interaction.user);
2020-09-19 20:49:33 +02:00
message.timestamp = new BDFDB.DiscordObjects.Timestamp(message.timestamp);
2024-02-15 05:50:08 +01:00
message.timestamp = message.timestamp && message.timestamp._d || message.timestamp;
2020-09-19 20:49:33 +02:00
message.editedTimestamp = message.editedTimestamp && new BDFDB.DiscordObjects.Timestamp(message.editedTimestamp);
2024-02-15 05:50:08 +01:00
message.editedTimestamp = message.editedTimestamp && message.editedTimestamp._d || message.editedTimestamp;
2020-09-19 20:49:33 +02:00
if (message.customRenderedContent && message.customRenderedContent.content.length) message.customRenderedContent.content = BDFDB.ReactUtils.objectToReact(message.customRenderedContent.content);
for (let embed of message.embeds) {
embed.color = typeof embed.color != "string" ? null : embed.color;
embed.timestamp = embed.timestamp && new BDFDB.DiscordObjects.Timestamp(embed.timestamp);
2024-02-15 05:50:08 +01:00
embed.timestamp = embed.timestamp && embed.timestamp._d || embed.timestamp;
2020-09-19 20:49:33 +02:00
}
message.embeds = message.embeds.filter(n => !(n && n.type == "gifv"));
message.reactions = [];
message = new BDFDB.DiscordObjects.Message(message);
let channel = notes[guild_id][channel_id][message_idPOS].channel && new BDFDB.DiscordObjects.Channel(JSON.parse(notes[guild_id][channel_id][message_idPOS].channel));
if (!channel) {
2022-09-27 14:48:10 +02:00
channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
2020-09-19 20:49:33 +02:00
if (channel) {
updateData = true;
notes[guild_id][channel_id][message_idPOS].channel = JSON.stringify(channel);
}
}
2021-08-11 18:30:42 +02:00
if (!BDFDB.MessageUtils.isSystemMessage(message)) messages.push({
2020-09-19 20:49:33 +02:00
note: notes[guild_id][channel_id][message_idPOS],
2021-08-11 18:30:42 +02:00
channel_id: channel_id,
guild_id: guild_id,
message: message,
channel: channel,
2020-09-19 20:49:33 +02:00
messagetime: notes[guild_id][channel_id][message_idPOS].timestamp,
notetime: notes[guild_id][channel_id][message_idPOS].addedat
});
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
if (updateData) BDFDB.DataUtils.save(notes, _this, "notes");
2021-06-05 20:29:06 +02:00
let allCount = messages.length;
2022-09-27 20:19:49 +02:00
let currentChannel = BDFDB.LibraryStores.ChannelStore.getChannel(BDFDB.LibraryStores.SelectedChannelStore.getChannelId()) || {};
2021-03-11 21:27:03 +01:00
switch (popoutProps.selectedFilter.value) {
2020-09-19 20:49:33 +02:00
case "channel":
2021-08-11 18:30:42 +02:00
messages = messages.filter(m => m.channel_id == currentChannel.id);
2020-09-19 20:49:33 +02:00
break;
case "server":
2021-08-11 18:30:42 +02:00
messages = messages.filter(m => m.guild_id == (currentChannel.guild_id || BDFDB.DiscordConstants.ME));
2020-09-19 20:49:33 +02:00
break;
case "allservers":
messages = messages;
break;
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
let searchKey = popoutProps.searchKey.toUpperCase();
if (searchKey) {
2023-06-20 09:23:42 +02:00
let searchValues = ["content", "author.globalName", "author.username", "rawDescription", "author.name"];
2022-06-17 18:52:53 +02:00
messages = messages.filter(m => m.note.tags && m.note.tags.some(tag => tag.indexOf(searchKey.toUpperCase()) > -1) || searchValues.some(key => this.containsSearchkey(m.message, key, searchKey) || m.message.embeds.some(embed => this.containsSearchkey(embed, key, searchKey))));
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
BDFDB.ArrayUtils.keySort(messages, popoutProps.selectedSort.value);
if (popoutProps.selectedOrder.value != "descending") messages.reverse();
2021-06-05 20:29:06 +02:00
return [messages, allCount];
2020-02-04 08:20:40 +01:00
}
2021-03-11 21:27:03 +01:00
renderMessage(note, message, channel) {
2020-09-19 20:49:33 +02:00
if (!message || !channel) return null;
2020-10-06 12:40:59 +02:00
let channelName = channel.name;
2022-09-27 14:48:10 +02:00
let guild = channel.guild_id && BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id);
2020-09-19 20:49:33 +02:00
let role = guild && BDFDB.LibraryModules.PermissionRoleUtils.getHighestRole(guild, message.author.id);
if (role) message.colorString = role.colorString;
2021-03-11 21:27:03 +01:00
if (popoutProps.selectedFilter.value != "channel" && !channelName && channel.recipients.length > 0) {
2020-09-19 20:49:33 +02:00
for (let dmuser_id of channel.recipients) {
2023-06-20 09:23:42 +02:00
let user = (BDFDB.LibraryStores.UserStore.getUser(dmuser_id) || {});
2020-10-06 12:40:59 +02:00
channelName = channelName ? channelName + ", @" : channelName;
2023-06-20 09:23:42 +02:00
channelName = channelName + (user.globalName || user.username || BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER);
2020-09-19 20:49:33 +02:00
}
2020-02-04 08:20:40 +01:00
}
2021-05-17 12:44:34 +02:00
return [
2022-06-17 18:52:53 +02:00
popoutProps.selectedFilter.value != "channel" && BDFDB.ReactUtils.createElement("div", {
2021-05-17 12:44:34 +02:00
className: BDFDB.disCN.messagespopoutchannelseparator,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
tag: "span",
className: BDFDB.disCN.messagespopoutchannelname,
2021-06-11 21:37:11 +02:00
onClick: _ => {
2022-09-27 14:48:10 +02:00
if (!channel.guild_id || BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id)) BDFDB.LibraryModules.HistoryUtils.transitionTo(BDFDB.DiscordConstants.Routes.CHANNEL(channel.guild_id, channel.id));
2021-06-11 21:37:11 +02:00
},
2021-05-17 12:44:34 +02:00
children: channelName ? ((channel.guild_id ? "#" : "@") + channelName) : "???"
}),
popoutProps.selectedFilter.value == "all" ? BDFDB.ReactUtils.createElement("span", {
className: BDFDB.disCN.messagespopoutguildname,
2022-09-27 14:48:10 +02:00
children: channel.guild_id ? (BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id) || {}).name || BDFDB.LanguageUtils.LanguageStrings.GUILD_UNAVAILABLE_HEADER : BDFDB.LanguageUtils.LanguageStrings.DIRECT_MESSAGES
2021-05-17 12:44:34 +02:00
}) : null
]
2022-06-17 18:52:53 +02:00
}),
BDFDB.ReactUtils.createElement("div", {
2021-05-17 12:44:34 +02:00
className: BDFDB.disCN.messagespopoutgroupwrapper,
key: message.id,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MessageGroup, {
className: BDFDB.disCN.messagespopoutgroupcozy,
message: message,
channel: channel,
onContextMenu: e => BDFDB.MessageUtils.openMenu(message, e, true)
2022-11-06 12:08:58 +01:00
}, true),
2021-05-17 12:44:34 +02:00
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.messagespopoutactionbuttons,
children: [
2022-09-27 14:48:10 +02:00
(!channel.guild_id || BDFDB.LibraryStores.GuildStore.getGuild(channel.guild_id)) && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
2021-05-17 12:44:34 +02:00
className: BDFDB.disCN.messagespopoutjumpbutton,
onClick: _ => BDFDB.LibraryModules.HistoryUtils.transitionTo(BDFDB.DiscordConstants.Routes.CHANNEL(channel.guild_id, channel.id, message.id)),
children: BDFDB.ReactUtils.createElement("div", {
children: BDFDB.LanguageUtils.LanguageStrings.JUMP
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCN.messagespopoutjumpbutton,
onClick: _ => {
if (message.content || message.attachments.length > 1) {
let text = message.content || "";
for (let attachment of message.attachments) if (attachment.url) text += ((text ? "\n" : "") + attachment.url);
2022-10-14 09:01:48 +02:00
BDFDB.LibraryModules.WindowUtils.copy(text);
2021-05-17 12:44:34 +02:00
}
else if (message.attachments.length == 1 && message.attachments[0].url) {
2022-10-24 10:37:12 +02:00
BDFDB.LibraryModules.WindowUtils.copyImage(message.attachments[0].url);
2021-05-17 12:44:34 +02:00
}
},
children: BDFDB.ReactUtils.createElement("div", {
children: BDFDB.LanguageUtils.LanguageStrings.COPY
})
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
look: BDFDB.LibraryComponents.Button.Looks.BLANK,
size: BDFDB.LibraryComponents.Button.Sizes.NONE,
onClick: _ => {
_this.removeNoteData(note);
BDFDB.ReactUtils.forceUpdate(this);
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.messagespopoutclosebutton,
name: BDFDB.LibraryComponents.SvgIcon.Names.CLOSE
})
2020-09-19 20:49:33 +02:00
})
2021-05-17 12:44:34 +02:00
]
2022-06-17 18:52:53 +02:00
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
wrap: BDFDB.LibraryComponents.Flex.Wrap.WRAP,
justify: BDFDB.LibraryComponents.Flex.Justify.END,
children: [note.tags].flat(10).filter(n => n).map(label => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.TextBadge, {
className: BDFDB.disCN._personalpinsmessagetag,
color: "var(--background-tertiary)",
onClick: _ => {
BDFDB.ArrayUtils.remove(note.tags, label, true);
BDFDB.DataUtils.save(notes, _this, "notes");
BDFDB.ReactUtils.forceUpdate(this);
},
text: [
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._personalpinsmessagetagname,
children: label
}),
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._personalpinsmessagetagdelete,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
name: BDFDB.LibraryComponents.SvgIcon.Names.CLOSE,
width: 14,
height: 14,
nativeClass: true,
})
})
]
})).concat(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PopoutContainer, {
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Badges.TextBadge, {
className: BDFDB.disCNS._personalpinsmessagetag + BDFDB.disCN._personalpinsmessagetagadd,
color: "var(--background-tertiary)",
text: "+"
}),
animation: BDFDB.LibraryComponents.PopoutContainer.Animation.SCALE,
position: BDFDB.LibraryComponents.PopoutContainer.Positions.TOP,
align: BDFDB.LibraryComponents.PopoutContainer.Align.CENTER,
arrow: true,
onOpen: instance => BDFDB.DOMUtils.addClass(instance.domElementRef.current, BDFDB.disCN._personalpinsmessagetagaddactive),
onClose: instance => BDFDB.DOMUtils.removeClass(instance.domElementRef.current, BDFDB.disCN._personalpinsmessagetagaddactive),
renderPopout: instance => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextInput, {
onKeyDown: (event, textInstance) => {
let tag = textInstance.props.value && textInstance.props.value.toUpperCase();
if (tag && event.which == 13 && (!note.tags || note.tags.indexOf(tag) == -1)) {
instance.toggle();
if (!note.tags) note.tags = [];
note.tags.push(tag);
BDFDB.DataUtils.save(notes, _this, "notes");
BDFDB.ReactUtils.forceUpdate(this);
}
}
})
}))
2021-05-17 12:44:34 +02:00
})
]
})
];
2020-09-19 20:49:33 +02:00
}
2021-03-11 21:27:03 +01:00
render() {
let searchTimeout;
2021-06-05 20:29:06 +02:00
const [messages, allCount] = this.filterMessages();
2021-03-11 21:27:03 +01:00
return BDFDB.ReactUtils.createElement(BDFDB.ReactUtils.Fragment, {
children: [
BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCNS.messagespopouttabbarheader + BDFDB.disCN.messagespopoutheader,
style: {paddingBottom: 4},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
direction: BDFDB.LibraryComponents.Flex.Direction.VERTICAL,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom4,
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex.Child, {
className: BDFDB.disCN.messagespopouttitle,
2021-06-05 20:29:06 +02:00
children: `${_this.labels.popout_note} - ${messages.length}/${allCount}`
2021-03-11 21:27:03 +01:00
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SearchBar, {
query: popoutProps.searchKey,
onChange: value => {
BDFDB.TimeUtils.clear(searchTimeout);
searchTimeout = BDFDB.TimeUtils.timeout(_ => {
popoutProps.searchKey = value;
BDFDB.ReactUtils.forceUpdate(this);
}, 1000);
},
onClear: _ => {
popoutProps.searchKey = "";
BDFDB.ReactUtils.forceUpdate(this);
}
})
]
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TabBar, {
className: BDFDB.disCN.messagespopouttabbar,
itemClassName: BDFDB.disCN.messagespopouttabbartab,
itemSelectedClassName: BDFDB.disCN.messagespopouttabbartabactive,
type: BDFDB.LibraryComponents.TabBar.Types.TOP_PILL,
selectedItem: popoutProps.selectedFilter.value,
items: filterKeys.map(option => _this.getPopoutValue(option, "filter")),
onItemSelect: option => {
popoutProps.selectedFilter = _this.getPopoutValue(option, "filter");
BDFDB.ReactUtils.forceUpdate(this);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.QuickSelect, {
label: BDFDB.LanguageUtils.LibraryStrings.sort_by + ":",
value: popoutProps.selectedSort,
options: sortKeys.map(option => _this.getPopoutValue(option, "sort")),
onChange: option => {
popoutProps.selectedSort = _this.getPopoutValue(option, "sort");
BDFDB.ReactUtils.forceUpdate(this);
}
}),
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.QuickSelect, {
label: BDFDB.LanguageUtils.LibraryStrings.order + ":",
value: popoutProps.selectedOrder,
options: orderKeys.map(option => _this.getPopoutValue(option, "order")),
onChange: option => {
popoutProps.selectedOrder = _this.getPopoutValue(option, "order");
BDFDB.ReactUtils.forceUpdate(this);
}
})
]
})
]
})
}),
2021-05-17 12:44:34 +02:00
messages.length ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PaginatedList, {
2021-03-11 21:27:03 +01:00
className: BDFDB.disCN.messagespopout,
2021-05-17 12:44:34 +02:00
items: messages,
amount: 25,
copyToBottom: true,
renderItem: messageData => this.renderMessage(messageData.note, messageData.message, messageData.channel).flat(10).filter(n => n)
2022-10-01 18:59:37 +02:00
}) : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MessagesPopoutComponents.EmptyState, {
2021-05-17 12:44:34 +02:00
msg: BDFDB.LanguageUtils.LanguageStrings.AUTOCOMPLETE_NO_RESULTS_HEADER,
image: BDFDB.DiscordUtils.getTheme() == BDFDB.disCN.themelight ? "/assets/03c7541028afafafd1a9f6a81cb7f149.svg" : "/assets/6793e022dc1b065b21f12d6df02f91bd.svg"
2021-03-11 21:27:03 +01:00
})
]
});
}
};
return class PersonalPins extends Plugin {
onLoad () {
_this = this;
this.defaults = {
choices: {
2023-11-18 18:31:04 +01:00
defaultFilter: {value: filterKeys[0], options: filterKeys, type: "filter", description: "Default choice tab"},
2021-03-11 21:27:03 +01:00
defaultSort: {value: sortKeys[0], options: sortKeys, type: "sort", description: "Default sort choice"},
defaultOrder: {value: orderKeys[0], options: orderKeys, type: "order", description: "Default order choice"},
}
};
2022-10-24 10:37:12 +02:00
this.modulePatches = {
before: [
"HeaderBar"
],
after: [
"MessageActionsContextMenu",
"MessageToolbar"
]
2021-03-11 21:27:03 +01:00
};
2022-06-17 18:52:53 +02:00
this.css = `
${BDFDB.dotCN._personalpinsmessagetag} {
margin: 0 3px 4px 3px;
cursor: pointer;
}
${BDFDB.dotCN._personalpinsmessagetag}:hover ${BDFDB.dotCN._personalpinsmessagetagname} {
height: 0;
visibility: hidden;
}
${BDFDB.dotCNS._personalpinsmessagetag + BDFDB.dotCN._personalpinsmessagetagdelete} {
visibility: hidden;
}
${BDFDB.dotCN._personalpinsmessagetag}:hover ${BDFDB.dotCN._personalpinsmessagetagdelete} {
visibility: visible;
}
${BDFDB.dotCN._personalpinsmessagetag + BDFDB.notCN._personalpinsmessagetagadd}:hover {
2022-12-11 17:51:38 +01:00
background-color: var(--status-danger) !important;
2022-06-17 18:52:53 +02:00
}
${BDFDB.dotCN._personalpinsmessagetagadd} {
font-size: 16px;
}
${BDFDB.dotCN._personalpinsmessagetagadd + BDFDB.dotCN._personalpinsmessagetagaddactive} {
background-color: var(--bdfdb-blurple) !important;
}
`;
2021-03-11 21:27:03 +01:00
}
onStart () {
2021-05-17 12:44:34 +02:00
notes = BDFDB.DataUtils.load(this, "notes");
2021-08-13 18:43:07 +02:00
BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.DispatchApiUtils, "dispatch", {after: e => {
2022-08-01 22:55:52 +02:00
if (BDFDB.ObjectUtils.is(e.methodArguments[0]) && e.methodArguments[0].type == "MESSAGE_DELETE") {
2021-08-13 18:43:07 +02:00
let note = this.getNoteData({id: e.methodArguments[0].id, channel_id: e.methodArguments[0].channelId});
if (note) this.removeNoteData(note, true);
}
}});
2022-05-25 10:32:24 +02:00
BDFDB.DiscordUtils.rerenderAll();
2021-03-11 21:27:03 +01:00
}
onStop () {
2022-05-25 10:32:24 +02:00
BDFDB.DiscordUtils.rerenderAll();
2021-03-11 21:27:03 +01:00
}
getSettingsPanel (collapseStates = {}) {
let settingsPanel;
return settingsPanel = BDFDB.PluginUtils.createSettingsPanel(this, {
collapseStates: collapseStates,
children: _ => {
let settingsItems = [];
for (let key in this.settings.choices) settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Select",
plugin: this,
keys: ["choices", key],
label: this.defaults.choices[key].description,
basis: "50%",
value: this.settings.choices[key],
options: (this.defaults.choices[key].options || []).map(option => this.getPopoutValue(option, this.defaults.choices[key].type)),
searchable: true
}));
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, {
type: "Button",
color: BDFDB.LibraryComponents.Button.Colors.RED,
2021-05-17 12:44:34 +02:00
label: "Delete all Notes",
onClick: _ => BDFDB.ModalUtils.confirm(this, "Are you sure you want to delete all pinned Notes?", _ => {
notes = {};
BDFDB.DataUtils.remove(this, "notes");
}),
2021-03-11 21:27:03 +01:00
children: BDFDB.LanguageUtils.LanguageStrings.DELETE
}));
return settingsItems;
}
});
}
onSettingsClosed () {
if (this.SettingsUpdated) {
delete this.SettingsUpdated;
2022-05-25 10:32:24 +02:00
BDFDB.DiscordUtils.rerenderAll();
2021-03-11 21:27:03 +01:00
}
}
onMessageContextMenu (e) {
if (e.instance.props.message && e.instance.props.channel) {
let note = this.getNoteData(e.instance.props.message, e.instance.props.channel);
let hint = BDFDB.BDUtils.isPluginEnabled("MessageUtilities") ? BDFDB.BDUtils.getPlugin("MessageUtilities").getActiveShortcutString("__Note_Message") : null;
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: ["pin", "unpin"]});
2023-10-02 11:28:41 +02:00
if (index == -1) [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: ["edit", "add-reaction", "add-reaction-1", "quote"]});
2021-03-11 21:27:03 +01:00
children.splice(index > -1 ? index + 1: 0, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: note ? this.labels.context_unpinoption : this.labels.context_pinoption,
id: BDFDB.ContextMenuUtils.createItemId(this.name, note ? "unpin-note" : "pin-note"),
hint: hint && (_ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuHint, {
hint: hint
})),
2022-02-25 16:12:53 +01:00
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
icon: note ? pinIconDelete : pinIcon
}),
2021-03-11 21:27:03 +01:00
action: _ => this.addMessageToNotes(e.instance.props.message, e.instance.props.channel)
}));
if (this.isNoteOutdated(note, e.instance.props.message)) children.splice(index > -1 ? index + 1: 0, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_updateoption,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "update-note"),
2022-02-25 16:12:53 +01:00
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
icon: pinIconUpdate
}),
2021-03-11 21:27:03 +01:00
action: _ => this.updateNoteData(note, e.instance.props.message)
}));
}
}
2022-10-24 10:37:12 +02:00
processMessageActionsContextMenu (e) {
2021-03-11 21:27:03 +01:00
if (e.instance.props.message && e.instance.props.channel) {
let note = this.getNoteData(e.instance.props.message, e.instance.props.channel);
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: ["pin", "unpin"]});
children.splice(index + 1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: note ? this.labels.context_unpinoption : this.labels.context_pinoption,
id: BDFDB.ContextMenuUtils.createItemId(this.name, note ? "unpin-note" : "pin-note"),
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
icon: note ? pinIconDelete : pinIcon
}),
action: _ => this.addMessageToNotes(e.instance.props.message, e.instance.props.channel)
}));
if (this.isNoteOutdated(note, e.instance.props.message)) children.splice(index + 1, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_updateoption,
id: "update-note",
icon: _ => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.MenuItems.MenuIcon, {
icon: pinIconUpdate
}),
action: _ => this.updateNoteData(note, e.instance.props.message)
}));
}
}
2022-10-24 10:37:12 +02:00
processMessageToolbar (e) {
2023-02-03 21:18:05 +01:00
if (!e.instance.props.message || !e.instance.props.channel) return;
let expanded = !BDFDB.LibraryStores.AccessibilityStore.keyboardModeEnabled && !e.instance.props.showEmojiPicker && !e.instance.props.showEmojiBurstPicker && !e.instance.props.showMoreUtilities && BDFDB.ListenerUtils.isPressed(16);
if (!expanded) return;
let note = this.getNoteData(e.instance.props.message, e.instance.props.channel);
e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(class extends BdApi.React.Component {
render() {
return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
key: note ? "unpin-note" : "pin-note",
text: _ => note ? _this.labels.context_unpinoption : _this.labels.context_pinoption,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCN.messagetoolbarbutton,
onClick: _ => {
_this.addMessageToNotes(e.instance.props.message, e.instance.props.channel);
note = _this.getNoteData(e.instance.props.message, e.instance.props.channel);
BDFDB.ReactUtils.forceUpdate(this);
},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.messagetoolbaricon,
iconSVG: note ? pinIconDelete : pinIcon
2021-05-18 20:09:05 +02:00
})
2021-03-11 21:27:03 +01:00
})
})
2023-02-03 21:18:05 +01:00
}
}));
if (this.isNoteOutdated(note, e.instance.props.message)) e.returnvalue.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
key: "update-note",
text: this.labels.context_updateoption,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCN.messagetoolbarbutton,
onClick: _ => this.updateNoteData(note, e.instance.props.message),
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCN.messagetoolbaricon,
iconSVG: pinIconUpdate
})
})
}));
2021-03-11 21:27:03 +01:00
}
2022-05-25 10:32:24 +02:00
processHeaderBar (e) {
2022-10-24 10:37:12 +02:00
if (!e.instance.props.toolbar) return;
2022-10-24 14:34:09 +02:00
let [children, index] = BDFDB.ReactUtils.findParent(e.instance.props.toolbar, {props: [["className", BDFDB.disCN.channelheadersearch]]});
if (index > -1) children.splice(index, 0, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PopoutContainer, {
2021-03-11 21:27:03 +01:00
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: this.labels.popout_note,
tooltipConfig: {type: "bottom"},
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
className: BDFDB.disCNS.channelheadericonwrapper + BDFDB.disCN.channelheadericonclickable,
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
className: BDFDB.disCNS.channelheadericon,
2023-12-21 11:01:01 +01:00
nativeClass: true,
2021-03-11 21:27:03 +01:00
iconSVG: pinIcon
})
})
}),
popoutClassName: BDFDB.disCN.messagespopoutwrap,
animation: BDFDB.LibraryComponents.PopoutContainer.Animation.SCALE,
position: BDFDB.LibraryComponents.PopoutContainer.Positions.BOTTOM,
align: BDFDB.LibraryComponents.PopoutContainer.Align.RIGHT,
2021-12-10 00:10:32 +01:00
width: 750,
2021-03-11 21:27:03 +01:00
maxHeight: "calc(100vh - 100px)",
onClose: instance => BDFDB.DOMUtils.removeClass(instance.domElementRef.current, BDFDB.disCN.channelheadericonselected),
renderPopout: instance => {
BDFDB.DOMUtils.addClass(instance.domElementRef.current, BDFDB.disCN.channelheadericonselected);
popoutProps.selectedFilter = popoutProps.selectedFilter || this.getPopoutValue(this.settings.choices.defaultFilter || filterKeys[0], "filter");
popoutProps.selectedSort = popoutProps.selectedSort || this.getPopoutValue(this.settings.choices.defaultSort || sortKeys[0], "sort");
popoutProps.selectedOrder = popoutProps.selectedOrder || this.getPopoutValue(this.settings.choices.defaultOrder || orderKeys[0], "order");
popoutProps.searchKey = popoutProps.searchKey || "";
2022-11-06 12:08:58 +01:00
return BDFDB.ReactUtils.createElement(NotesPopoutComponent, {}, true);
2021-03-11 21:27:03 +01:00
}
}));
}
getPopoutValue (key, type) {
return {
label: type == "order" ? BDFDB.LanguageUtils.LibraryStrings[key] : this.labels[`popout_${type}_${key}`],
value: key
};
}
2019-01-26 22:45:19 +01:00
2020-09-19 20:49:33 +02:00
addMessageToNotes (message, channel) {
if (!message) return;
2022-09-27 14:48:10 +02:00
channel = channel || BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
2020-09-19 20:49:33 +02:00
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
notes[guild_id] = notes[guild_id] || {};
notes[guild_id][channel.id] = notes[guild_id][channel.id] || {}
if (!notes[guild_id][channel.id][message.id]) {
notes[guild_id][channel.id][message.id] = {
addedat: new Date().getTime(),
channel: JSON.stringify(channel),
id: message.id,
message: JSON.stringify(message),
2024-02-15 05:50:08 +01:00
timestamp: (message.timestamp._i || message.timestamp).getTime()
2020-09-19 20:49:33 +02:00
};
BDFDB.DataUtils.save(notes, this, "notes");
BDFDB.NotificationUtils.toast(this.labels.toast_noteadd, {type: "success"});
2020-09-19 20:49:33 +02:00
}
else this.removeNoteData(notes[guild_id][channel.id][message.id]);
}
isNoteOutdated (note, message) {
2024-04-18 19:33:32 +02:00
let noteMessage = note && JSON.parse(note.message), keys = ["content", "embeds", "attachment", "item"];
2021-05-17 12:44:34 +02:00
return noteMessage && !BDFDB.equals(BDFDB.ObjectUtils.extract(noteMessage, keys), BDFDB.ObjectUtils.extract(message, keys));
2020-02-04 08:20:40 +01:00
}
2019-11-09 12:53:04 +01:00
2020-09-19 20:49:33 +02:00
getNoteData (message, channel) {
if (!message) return;
2022-09-27 14:48:10 +02:00
channel = channel || BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
2020-09-19 20:49:33 +02:00
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
return notes[guild_id] && notes[guild_id][channel.id] && notes[guild_id][channel.id][message.id];
}
2019-01-26 22:45:19 +01:00
2022-06-17 18:52:53 +02:00
updateNoteData (note, newMessage) {
2020-09-19 20:49:33 +02:00
let message = JSON.parse(note.message);
let channel = JSON.parse(note.channel);
if (!message || !channel) return;
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
2022-06-17 18:52:53 +02:00
notes[guild_id][channel.id][note.id].message = JSON.stringify(newMessage);
2020-09-19 20:49:33 +02:00
BDFDB.DataUtils.save(notes, this, "notes");
BDFDB.NotificationUtils.toast(this.labels.toast_noteupdate, {type: "info"});
2020-09-19 20:49:33 +02:00
}
2019-01-26 22:45:19 +01:00
2021-08-13 18:43:07 +02:00
removeNoteData (note, noToast = false) {
2020-09-19 20:49:33 +02:00
let message = JSON.parse(note.message);
let channel = JSON.parse(note.channel);
if (!message || !channel) return;
let guild_id = channel.guild_id || BDFDB.DiscordConstants.ME;
delete notes[guild_id][channel.id][note.id];
if (BDFDB.ObjectUtils.isEmpty(notes[guild_id][channel.id])) {
delete notes[guild_id][channel.id];
if (BDFDB.ObjectUtils.isEmpty(notes[guild_id])) delete notes[guild_id];
}
BDFDB.DataUtils.save(notes, this, "notes");
2021-08-13 18:43:07 +02:00
if (!noToast) BDFDB.NotificationUtils.toast(this.labels.toast_noteremove, {type: "danger"});
2020-02-04 08:20:40 +01:00
}
2020-07-11 23:28:30 +02:00
2020-02-04 08:20:40 +01: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 {
context_pinoption: "Запишете съобщението",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Премахване на бележката",
context_updateoption: "Бележката за актуализация",
popout_filter_all: "Всички сървъри",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Канал",
popout_filter_server: "Сървър",
popout_note: "Бележки",
popout_pinoption: "Забележка",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Дата на съобщението",
popout_sort_notetime: "Дата на бележка",
toast_noteadd: "Съобщението е добавено към бележника",
toast_noteremove: "Съобщението е премахнато от бележника",
toast_noteupdate: "Актуализира съобщението в бележника"
2020-09-19 20:49:33 +02:00
};
2021-05-30 17:21:18 +02:00
case "cs": // Czech
return {
context_pinoption: "Poznamenat zprávu",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Odebrat poznámku",
context_updateoption: "Aktualizovat poznámku",
2021-05-30 17:21:18 +02:00
popout_filter_all: "Všechny servery",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanál",
popout_filter_server: "Server",
2021-05-30 17:21:18 +02:00
popout_note: "Poznámky",
popout_pinoption: "Poznámka",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Datum zprávy",
popout_sort_notetime: "Datum poznámky",
2021-05-30 17:21:18 +02:00
toast_noteadd: "Zpráva přidána do poznámek",
toast_noteremove: "Zpráva odebrána z poznámek",
toast_noteupdate: "Zpráva v poznámkách aktualizována"
};
case "da": // Danish
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Skriv beskeden ned",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Fjern noten",
context_updateoption: "Opdater noten",
popout_filter_all: "Alle servere",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanal",
popout_filter_server: "Server",
popout_note: "Noter",
popout_pinoption: "Bemærk",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Meddelelsesdato",
popout_sort_notetime: "Bemærkdato",
toast_noteadd: "Besked føjet til notesbog",
toast_noteremove: "Besked fjernet fra notesbog",
toast_noteupdate: "Opdateret meddelelsen i notesbogen"
2020-09-19 20:49:33 +02:00
};
case "de": // German
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Nachricht notieren",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Notiz entfernen",
context_updateoption: "Notiz aktualisieren",
popout_filter_all: "Alle Server",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanal",
popout_filter_server: "Server",
popout_note: "Notizen",
popout_pinoption: "Notieren",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Nachrichtendatum",
popout_sort_notetime: "Notizdatum",
toast_noteadd: "Nachricht zum Notizbuch hinzugefügt",
toast_noteremove: "Nachricht aus dem Notizbuch entfernt",
toast_noteupdate: "Nachricht im Notizbuch aktualisiert"
2020-09-19 20:49:33 +02:00
};
case "el": // Greek
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Γράψτε το μήνυμα",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Αφαιρέστε τη σημείωση",
context_updateoption: "Ενημέρωση τη σημείωση",
popout_filter_all: "Όλοι οι διακομιστές",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Κανάλι",
popout_filter_server: "Υπηρέτης",
popout_note: "Σημειώσεις",
popout_pinoption: "Σημείωση",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Ημερομηνία μηνύματος",
popout_sort_notetime: "Σημείωση ημερομηνίας",
toast_noteadd: "Το μήνυμα προστέθηκε στο σημειωματάριο",
toast_noteremove: "Το μήνυμα καταργήθηκε από το σημειωματάριο",
toast_noteupdate: "Ενημερώθηκε το μήνυμα στο σημειωματάριο"
2020-09-19 20:49:33 +02:00
};
case "es": // Spanish
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Escribe el mensaje",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Eliminar la nota",
context_updateoption: "Actualiza la nota",
popout_filter_all: "Todos los servidores",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Canal",
popout_filter_server: "Servidor",
popout_note: "Notas",
popout_pinoption: "Nota",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Fecha del mensaje",
popout_sort_notetime: "Fecha della nota",
toast_noteadd: "Mensaje agregado al cuaderno",
toast_noteremove: "Mensaje eliminado de la libreta",
toast_noteupdate: "Se actualizó el mensaje en el cuaderno."
2020-09-19 20:49:33 +02:00
};
case "fi": // Finnish
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Kirjoita viesti muistiin",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Poista muistiinpano",
context_updateoption: "Päivitä muistiinpano",
popout_filter_all: "Kaikki palvelimet",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanava",
popout_filter_server: "Palvelin",
popout_note: "Muistiinpanoja",
popout_pinoption: "Merkintä",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Viestin päivämäärä",
popout_sort_notetime: "Muistiinpanon päivämäärä",
toast_noteadd: "Viesti lisättiin muistikirjaan",
toast_noteremove: "Viesti poistettu muistikirjasta",
toast_noteupdate: "Päivitetty muistikirjan viesti"
2020-09-19 20:49:33 +02:00
};
case "fr": // French
2020-09-19 20:49:33 +02:00
return {
2021-03-26 12:46:07 +01:00
context_pinoption: "Noter le message",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Supprimer la note",
context_updateoption: "Mettre à jour la note",
popout_filter_all: "Tous les serveurs",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Salon",
popout_filter_server: "Serveur",
2021-03-26 12:46:07 +01:00
popout_note: "Notes",
popout_pinoption: "Note",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Date du message",
popout_sort_notetime: "Date de la note",
2021-03-26 12:46:07 +01:00
toast_noteadd: "Message ajouté au carnet",
toast_noteremove: "Message supprimé du carnet",
toast_noteupdate: "Mise à jour du message dans le carnet"
2020-09-19 20:49:33 +02:00
};
2021-05-30 17:21:18 +02:00
case "hi": // Hindi
return {
context_pinoption: "नोट संदेश",
2024-02-15 05:50:08 +01:00
context_unpinoption: "नोट हटाएं",
context_updateoption: "अद्यतन नोट",
2021-05-30 17:21:18 +02:00
popout_filter_all: "सभी सर्वर",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "चैनल",
popout_filter_server: "सर्वर",
2021-05-30 17:21:18 +02:00
popout_note: "टिप्पणियाँ",
popout_pinoption: "ध्यान दें",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "संदेश दिनांक",
popout_sort_notetime: "नोट दिनांक",
2021-05-30 17:21:18 +02:00
toast_noteadd: "संदेश नोटबुक में जोड़ा गया",
toast_noteremove: "नोटबुक से संदेश हटाया गया",
toast_noteupdate: "नोटबुक में संदेश अपडेट किया गया"
};
case "hr": // Croatian
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Zapišite poruku",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Izbriši bilješku",
context_updateoption: "Ažurirajte bilješku",
popout_filter_all: "Svi poslužitelji",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanal",
popout_filter_server: "Poslužitelju",
popout_note: "Bilješke",
popout_pinoption: "Bilješka",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Datum poruke",
popout_sort_notetime: "Datum bilješke",
toast_noteadd: "Poruka dodana u bilježnicu",
toast_noteremove: "Poruka uklonjena iz bilježnice",
toast_noteupdate: "Ažurirana je poruka u bilježnici"
2020-09-19 20:49:33 +02:00
};
case "hu": // Hungarian
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Írja le az üzenetet",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Törölje a jegyzetet",
context_updateoption: "Frissítse a jegyzetet",
popout_filter_all: "Minden szerver",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Csatorna",
popout_filter_server: "Szerver",
popout_note: "Jegyzetek",
popout_pinoption: "Jegyzet",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Üzenet dátuma",
popout_sort_notetime: "Jegyzet dátuma",
toast_noteadd: "Üzenet hozzáadva a jegyzetfüzethez",
toast_noteremove: "Üzenet eltávolítva a jegyzetfüzetből",
toast_noteupdate: "Frissítette az üzenetet a jegyzetfüzetben"
2020-09-19 20:49:33 +02:00
};
case "it": // Italian
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Annota il messaggio",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Elimina la nota",
context_updateoption: "Aggiorna la nota",
popout_filter_all: "Tutti i server",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Canale",
popout_filter_server: "Server",
popout_note: "Appunti",
popout_pinoption: "Nota",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Messaggio data",
popout_sort_notetime: "Nota data",
toast_noteadd: "Messaggio aggiunto al taccuino",
toast_noteremove: "Messaggio rimosso dal taccuino",
toast_noteupdate: "Aggiornato il messaggio nel taccuino"
2020-09-19 20:49:33 +02:00
};
case "ja": // Japanese
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "メッセージを書き留めます",
2024-02-15 05:50:08 +01:00
context_unpinoption: "メモを削除します",
context_updateoption: "メモを更新する",
popout_filter_all: "すべてのサーバー",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "チャネル",
popout_filter_server: "サーバ",
popout_note: "ノート",
popout_pinoption: "注意",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "メッセージの日付",
popout_sort_notetime: "メモ日",
toast_noteadd: "ノートブックにメッセージを追加",
toast_noteremove: "ノートブックからメッセージが削除されました",
toast_noteupdate: "ノートブックのメッセージを更新しました"
2020-09-19 20:49:33 +02:00
};
case "ko": // Korean
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "메시지를 적어",
2024-02-15 05:50:08 +01:00
context_unpinoption: "메모 삭제",
context_updateoption: "메모 업데이트",
popout_filter_all: "모든 서버",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "채널",
popout_filter_server: "섬기는 사람",
popout_note: "메모",
popout_pinoption: "노트",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "메시지 날짜",
popout_sort_notetime: "메모 날짜",
toast_noteadd: "노트북에 추가 된 메시지",
toast_noteremove: "노트북에서 메시지가 제거되었습니다.",
toast_noteupdate: "노트북의 메시지를 업데이트했습니다."
2020-09-19 20:49:33 +02:00
};
case "lt": // Lithuanian
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Užrašykite žinutę",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Ištrinkite užrašą",
context_updateoption: "Atnaujinkite užrašą",
popout_filter_all: "Visi serveriai",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanalą",
popout_filter_server: "Serverio",
popout_note: "Pastabos",
popout_pinoption: "Pastaba",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Pranešimo data",
popout_sort_notetime: "Užrašo data",
toast_noteadd: "Pranešimas pridėtas prie užrašų knygelės",
toast_noteremove: "Pranešimas pašalintas iš užrašų knygelės",
toast_noteupdate: "Atnaujino pranešimą užrašų knygutėje"
2020-09-19 20:49:33 +02:00
};
case "nl": // Dutch
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Schrijf het bericht op",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Verwijder de notitie",
context_updateoption: "Werk de notitie bij",
popout_filter_all: "Alle servers",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanaal",
popout_filter_server: "Server",
popout_note: "Notities",
popout_pinoption: "Notitie",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Datum bericht",
popout_sort_notetime: "Datum notitie",
toast_noteadd: "Bericht toegevoegd aan notitieblok",
toast_noteremove: "Bericht verwijderd uit notitieblok",
toast_noteupdate: "Het bericht in het notitieblok bijgewerkt"
2020-09-19 20:49:33 +02:00
};
case "no": // Norwegian
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Skriv ned meldingen",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Slett notatet",
context_updateoption: "Oppdater notatet",
popout_filter_all: "Alle servere",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanal",
popout_filter_server: "Server",
popout_note: "Notater",
popout_pinoption: "Merk",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Meldingsdato",
popout_sort_notetime: "Merkdato",
toast_noteadd: "Melding lagt til notatbok",
toast_noteremove: "Melding fjernet fra notatblokken",
toast_noteupdate: "Oppdaterte meldingen i notatboken"
2020-09-19 20:49:33 +02:00
};
case "pl": // Polish
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Zapisz wiadomość",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Usuń notatkę",
context_updateoption: "Zaktualizuj notatkę",
popout_filter_all: "Wszystkie serwery",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanał",
popout_filter_server: "Serwer",
popout_note: "Notatki",
popout_pinoption: "Uwaga",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Data wiadomości",
popout_sort_notetime: "Data notatki",
toast_noteadd: "Wiadomość dodana do notatnika",
toast_noteremove: "Wiadomość została usunięta z notatnika",
toast_noteupdate: "Zaktualizowano wiadomość w notatniku"
2020-09-19 20:49:33 +02:00
};
case "pt-BR": // Portuguese (Brazil)
2020-09-19 20:49:33 +02:00
return {
2021-03-25 16:38:03 +01:00
context_pinoption: "Anotar mensagem",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Desanotar mensagem",
context_updateoption: "Atualizar nota",
popout_filter_all: "Todos os servidores",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Canal",
popout_filter_server: "Servidor",
popout_note: "Notas",
popout_pinoption: "Nota",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Data da mensagem",
popout_sort_notetime: "Data da nota",
toast_noteadd: "Mensagem adicionada ao caderno",
2021-03-25 16:38:52 +01:00
toast_noteremove: "Mensagem removida do caderno",
2021-03-25 16:38:03 +01:00
toast_noteupdate: "Atualizou a mensagem no caderno"
2020-09-19 20:49:33 +02:00
};
case "ro": // Romanian
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Notează mesajul",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Ștergeți nota",
context_updateoption: "Actualizați nota",
popout_filter_all: "Toate serverele",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Canal",
popout_filter_server: "Server",
popout_note: "Note",
popout_pinoption: "Notă",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Mesajului data",
popout_sort_notetime: "Notați data",
toast_noteadd: "Mesaj adăugat în caiet",
toast_noteremove: "Mesaj eliminat din caiet",
toast_noteupdate: "Am actualizat mesajul din caiet"
2020-09-19 20:49:33 +02:00
};
case "ru": // Russian
2020-09-19 20:49:33 +02:00
return {
2021-07-03 15:11:39 +02:00
context_pinoption: "Сохранить сообщение",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Удалить из сохранённых",
context_updateoption: "Обновить в сохранённых",
2021-07-03 15:11:39 +02:00
popout_filter_all: "Все сервера",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Канал",
popout_filter_server: "Сервер",
2021-07-03 15:11:39 +02:00
popout_note: "Сохранённые сообщения",
popout_pinoption: "Запись",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Дата отправки",
popout_sort_notetime: "Дата сохранения",
2021-07-03 15:11:39 +02:00
toast_noteadd: "Сообщение сохранено",
toast_noteremove: "Сообщение удалено из сохранённых",
toast_noteupdate: "Сообщение обновлено в сохранённых"
2020-09-19 20:49:33 +02:00
};
case "sv": // Swedish
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "Skriv ner meddelandet",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Radera anteckningen",
context_updateoption: "Uppdatera anteckningen",
popout_filter_all: "Alla servrar",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanal",
popout_filter_server: "Server",
popout_note: "Anteckningar",
popout_pinoption: "Notera",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Meddelandedatum",
popout_sort_notetime: "Noteradatum",
toast_noteadd: "Meddelande tillagt anteckningsbok",
toast_noteremove: "Meddelandet har tagits bort från anteckningsboken",
toast_noteupdate: "Uppdaterat meddelandet i anteckningsboken"
2020-09-19 20:49:33 +02:00
};
case "th": // Thai
2020-09-19 20:49:33 +02:00
return {
context_pinoption: "จดข้อความ",
2024-02-15 05:50:08 +01:00
context_unpinoption: "ลบบันทึก",
context_updateoption: "อัปเดตบันทึก",
popout_filter_all: "เซิร์ฟเวอร์ทั้งหมด",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "ช่อง",
popout_filter_server: "เซิร์ฟเวอร์",
popout_note: "หมายเหตุ",
popout_pinoption: "บันทึก",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "วันที่ส่งข้อความ",
popout_sort_notetime: "วันที่หมายเหตุ",
toast_noteadd: "เพิ่มข้อความในสมุดบันทึกแล้ว",
toast_noteremove: "ข้อความถูกลบออกจากสมุดบันทึก",
toast_noteupdate: "อัปเดตข้อความในสมุดบันทึก"
};
case "tr": // Turkish
return {
context_pinoption: "Mesajı yazın",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Notu silin",
context_updateoption: "Notu güncelleyin",
popout_filter_all: "Tüm sunucular",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kanal",
popout_filter_server: "Sunucu",
popout_note: "Notlar",
popout_pinoption: "Not",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Mesaj tarihi",
popout_sort_notetime: "Not tarihi",
toast_noteadd: "Not defterine mesaj eklendi",
toast_noteremove: "Mesaj not defterinden kaldırıldı",
toast_noteupdate: "Defterdeki mesaj güncellendi"
};
case "uk": // Ukrainian
return {
context_pinoption: "Запишіть повідомлення",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Видаліть нотатку",
context_updateoption: "Оновіть нотатку",
popout_filter_all: "Усі сервери",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Каналу",
popout_filter_server: "Сервер",
popout_note: "Нотатки",
popout_pinoption: "Примітка",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Дата повідомлення",
popout_sort_notetime: "Дата примітки",
toast_noteadd: "Повідомлення додано до блокнота",
toast_noteremove: "Повідомлення видалено з блокнота",
toast_noteupdate: "Оновлено повідомлення в блокноті"
};
case "vi": // Vietnamese
return {
context_pinoption: "Viết lại tin nhắn",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Xóa ghi chú",
context_updateoption: "Cập nhật ghi chú",
popout_filter_all: "Tất cả các máy chủ",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Kênh",
popout_filter_server: "Người phục vụ",
popout_note: "Ghi chú",
popout_pinoption: "Ghi chú",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Ngày nhắn tin",
popout_sort_notetime: "Ghi chú ngày",
toast_noteadd: "Đã thêm tin nhắn vào sổ tay",
toast_noteremove: "Đã xóa tin nhắn khỏi sổ ghi chép",
toast_noteupdate: "Đã cập nhật tin nhắn trong sổ tay"
};
2021-01-15 17:54:22 +01:00
case "zh-CN": // Chinese (China)
return {
context_pinoption: "写下消息",
2024-02-15 05:50:08 +01:00
context_unpinoption: "删除笔记",
context_updateoption: "更新笔记",
popout_filter_all: "所有服务器",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "渠道",
popout_filter_server: "服务器",
popout_note: "笔记",
popout_pinoption: "注意",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "留言日期",
popout_sort_notetime: "备注日期",
toast_noteadd: "邮件已添加到笔记本",
toast_noteremove: "邮件已从笔记本中删除",
toast_noteupdate: "更新了笔记本中的消息"
};
2021-01-15 17:54:22 +01:00
case "zh-TW": // Chinese (Taiwan)
return {
context_pinoption: "寫下消息",
2024-02-15 05:50:08 +01:00
context_unpinoption: "刪除筆記",
context_updateoption: "更新筆記",
popout_filter_all: "所有服務器",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "渠道",
popout_filter_server: "服務器",
popout_note: "筆記",
popout_pinoption: "注意",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "留言日期",
popout_sort_notetime: "備註日期",
toast_noteadd: "郵件已添加到筆記本",
toast_noteremove: "郵件已從筆記本中刪除",
toast_noteupdate: "更新了筆記本中的消息"
};
default: // English
return {
context_pinoption: "Note Message",
2024-02-15 05:50:08 +01:00
context_unpinoption: "Remove Note",
context_updateoption: "Update Note",
popout_filter_all: "All Servers",
2024-02-15 05:50:08 +01:00
popout_filter_channel: "Channel",
popout_filter_server: "Server",
popout_note: "Notes",
popout_pinoption: "Note",
2024-02-15 05:50:08 +01:00
popout_sort_messagetime: "Message Date",
popout_sort_notetime: "Note Date",
toast_noteadd: "Message added to Notebook",
toast_noteremove: "Message removed from Notebook",
2021-01-24 12:23:01 +01:00
toast_noteupdate: "Updated the Message in the Notebook"
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-09-01 14:40:11 +02:00
})(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));
2022-12-11 17:51:38 +01:00
})();