From 269f02a7b613741f4331d3e2006fd23b41306759 Mon Sep 17 00:00:00 2001 From: Mirco Wittrien Date: Tue, 26 Jan 2021 21:14:48 +0100 Subject: [PATCH] stuff --- Library/0BDFDB.plugin.js | 231 ++++++++++++------ Library/_res/BDFDB.data.json | 4 +- .../FriendNotifications.plugin.js | 23 +- .../GoogleTranslateOption.plugin.js | 152 ++++++++++-- .../ReadAllNotificationsButton.plugin.js | 216 +++++++++++++--- Plugins/SpellCheck/SpellCheck.plugin.js | 24 +- 6 files changed, 503 insertions(+), 147 deletions(-) diff --git a/Library/0BDFDB.plugin.js b/Library/0BDFDB.plugin.js index f3046bcca6..9e50d8106b 100644 --- a/Library/0BDFDB.plugin.js +++ b/Library/0BDFDB.plugin.js @@ -16,10 +16,15 @@ module.exports = (_ => { "info": { "name": "BDFDB", "author": "DevilBro", - "version": "1.3.1", + "version": "1.3.2", "description": "Give other plugins utility functions" }, - "rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js" + "rawUrl": "https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", + "changeLog": { + "improved": { + "New Toast API": "Changed Toast API to add new functionalities and styles" + } + } }; const DiscordObjects = {}; @@ -1084,126 +1089,193 @@ module.exports = (_ => { } } }; - + + var Toasts = [], NotificationBars = []; + var ToastQueues = {}, DesktopNotificationQueue = {queue: [], running: false}; const ToastIcons = { info: "INFO", danger: "CLOSE_CIRCLE", success: "CHECKMARK_CIRCLE", warning: "WARNING" }; - var Toasts = [], NotificationBars = [], DesktopNotificationQueue = {queue: [], running: false}; + const ToastOrientations = { + center: "toastscenter", + left: "toastsleft", + right: "toastsright" + }; + for (let key in ToastOrientations) ToastQueues[ToastOrientations[key]] = {queue: [], full: false}; + BDFDB.NotificationUtils = {}; - BDFDB.NotificationUtils.toast = function (text, config = {}) { - if (!text) return; - let app = document.querySelector(BDFDB.dotCN.app) || document.body; - if (!app) return; + BDFDB.NotificationUtils.toast = function (children, config = {}) { + if (!children) return; + let app = document.querySelector(BDFDB.dotCN.appmount) || document.body; + if (!app) return; + let orientation = config.orientation && ToastOrientations[config.orientation] || ToastOrientations.right; + + const runQueue = _ => { + if (ToastQueues[orientation].full) return; + let data = ToastQueues[orientation].queue.shift(); + if (!data) return; + let id = BDFDB.NumberUtils.generateId(Toasts); - let toasts = document.querySelector(BDFDB.dotCN.toasts); + let toasts = document.querySelector(BDFDB.dotCN.toasts + BDFDB.dotCN[orientation]); if (!toasts) { - let leftSideRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.channels + " + div")); - let rightSideRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCNC.memberswrap + BDFDB.dotCN.peoplesnowplayingcolumn)); - let bottomRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.chatform)); - let left = leftSideRects && typeof leftSideRects.left == "number" && leftSideRects.left || 310; - let right = rightSideRects && typeof rightSideRects.width == "number" && rightSideRects.width || 240; - let bottom = bottomRects && typeof bottomRects.height == "number" && (bottomRects.height + 10) || 85; - toasts = BDFDB.DOMUtils.create(`
`); + toasts = BDFDB.DOMUtils.create(`
`); app.appendChild(toasts); } - let toast = BDFDB.DOMUtils.create(`
`); - let toastText = toast.querySelector(BDFDB.dotCN.toasttext); - if (config.id) toast.id = config.id.split(" ").join(""); - if (config.className) BDFDB.DOMUtils.addClass(toast, config.className); - if (config.textClassName) BDFDB.DOMUtils.addClass(toastText, config.textClassName); - if (config.css) BDFDB.DOMUtils.appendLocalStyle("BDFDBcustomToast" + id, config.css); - if (config.style) toast.style = config.style; - (toast.setText = newText => { - if (!newText) return; - if (config.html) toastText.innerHTML = text; - else toastText.innerHTML = BDFDB.StringUtils.htmlEscape(text); - })(text); + if (data.config.id) data.toast.id = data.config.id.split(" ").join(""); + if (data.config.className) BDFDB.DOMUtils.addClass(data.toast, data.config.className); + if (data.config.css) BDFDB.DOMUtils.appendLocalStyle("BDFDBcustomToast" + id, data.config.css); + if (data.config.style) data.toast.style = Object.assign({}, data.toast.style, data.config.style); let type = null; - if (config.type && (type = BDFDB.disCN["toast" + config.type]) != null) BDFDB.DOMUtils.addClass(toast, type); + if (data.config.type && (type = BDFDB.disCN["toast" + data.config.type]) != null) BDFDB.DOMUtils.addClass(data.toast, type); if (!type) { - let comp = BDFDB.ColorUtils.convert(config.color, "RGBCOMP"); + let comp = BDFDB.ColorUtils.convert(data.config.color, "RGBCOMP"); if (comp) { let backgroundColor = BDFDB.ColorUtils.convert(comp, "HEX"); let fontColor = comp[0] > 180 && comp[1] > 180 && comp[2] > 180 ? "#000" : "#FFF"; - toast.style.setProperty("background-color", backgroundColor); - toast.style.setProperty("color", fontColor); - BDFDB.DOMUtils.addClass(toast, BDFDB.disCN.toastcustom); + data.toast.style.setProperty("background-color", backgroundColor); + data.toast.style.setProperty("color", fontColor); + BDFDB.DOMUtils.addClass(data.toast, BDFDB.disCN.toastcustom); } - else BDFDB.DOMUtils.addClass(toast, BDFDB.disCN.toastdefault); + else BDFDB.DOMUtils.addClass(data.toast, BDFDB.disCN.toastdefault); } - let iconMarkup = config.avatar || config.icon || config.type && ToastIcons[config.type] && InternalComponents.LibraryComponents.SvgIcon.Names[ToastIcons[config.type]]?.icon.replace("%%width", 18).replace("%%height", 18).replace("%%color", "currentColor"); - if (iconMarkup) { - let icon = document.createElement("div"), iconInner = BDFDB.DOMUtils.create(iconMarkup); - if (iconInner.nodeType == Node.TEXT_NODE) icon.style.setProperty("background", `url(${iconMarkup}) center/cover no-repeat`); - else icon.appendChild(iconInner); - BDFDB.DOMUtils.addClass(icon, BDFDB.disCN.toasticon, config.iconClassName, config.avatar && BDFDB.disCN.toastavatar); - toast.insertBefore(icon, toastText); + + let disableInteractions = data.config.disableInteractions && typeof data.config.onClick != "function"; + if (disableInteractions) data.toast.style.setProperty("pointer-events", "none", "important"); + else { + BDFDB.DOMUtils.addClass(data.toast, BDFDB.disCN.toastclosable); + data.toast.addEventListener("click", _ => { + if (typeof data.config.onClick == "function") data.config.onClick(); + data.toast.close(); + }); } - - toasts.appendChild(toast); - let disableInteractions = config.disableInteractions && typeof config.onClick != "function"; - if (disableInteractions) toast.style.setProperty("pointer-events", "none", "important"); - else toast.addEventListener("click", _ => { - if (typeof config.onClick == "function") config.onClick(); - toast.close(); - }); + toasts.appendChild(data.toast); - let timeout = typeof config.timeout == "number" && !disableInteractions ? config.timeout : 3000; + let timeout = typeof data.config.timeout == "number" && !disableInteractions ? data.config.timeout : 3000; + timeout = (timeout > 0 ? timeout : 600000) + 300; let closeTimeout = BDFDB.TimeUtils.timeout(_ => { - toast.close(); - }, timeout > 0 ? timeout : 600000); - toast.close = _ => { - BDFDB.TimeUtils.clear(closeTimeout); - if (document.contains(toast)) { - BDFDB.DOMUtils.addClass(toast, BDFDB.disCN.toastclosing); - toast.style.setProperty("pointer-events", "none", "important"); + data.toast.close(); + }, timeout); + BDFDB.TimeUtils.timeout(_ => {BDFDB.DOMUtils.removeClass(data.toast, BDFDB.disCN.toastopening);}); + data.toast.close = _ => { + clearTimeout(closeTimeout); + if (document.contains(data.toast)) { + BDFDB.DOMUtils.addClass(data.toast, BDFDB.disCN.toastclosing); + data.toast.style.setProperty("pointer-events", "none", "important"); BDFDB.TimeUtils.timeout(_ => { - if (typeof config.onClose == "function") config.onClose(); + if (typeof data.config.onClose == "function") data.config.onClose(); BDFDB.ArrayUtils.remove(Toasts, id); BDFDB.DOMUtils.removeLocalStyle("BDFDBcustomToast" + id); - toast.remove(); + data.toast.remove(); if (!toasts.querySelectorAll(BDFDB.dotCN.toast).length) toasts.remove(); - }, 3000); + }, 300); } + ToastQueues[orientation].full = false; + runQueue(); }; - return toast; + + let icon = data.config.avatar ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.AvatarComponents.default, { + src: data.config.avatar, + size: BDFDB.LibraryComponents.AvatarComponents.Sizes.SIZE_24 + }) : ((data.config.icon || data.config.type && ToastIcons[data.config.type]) ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { + name: data.config.type && ToastIcons[data.config.type] && BDFDB.LibraryComponents.SvgIcon.Names[ToastIcons[data.config.type]], + iconSVG: data.config.icon, + width: 18, + height: 18, + nativeClass: true + }) : null); + BDFDB.ReactUtils.render(BDFDB.ReactUtils.createElement(class BDFDB_Toast extends BDFDB.ReactUtils.Component { + componentDidMount() { + data.toast.update = newChildren => { + if (!newChildren) return; + this.props.children = newChildren; + BDFDB.ReactUtils.forceUpdate(this); + }; + this._start = performance.now(); + this._progress = BDFDB.TimeUtils.interval(_ => {BDFDB.ReactUtils.forceUpdate(this);}, 10); + } + componentWillUnmount() { + BDFDB.TimeUtils.clear(this._progress); + } + render() { + return BDFDB.ReactUtils.createElement(BDFDB.ReactUtils.Fragment, { + children: [ + BDFDB.ReactUtils.createElement("div", { + className: BDFDB.disCN.toastinner, + children: [ + icon && BDFDB.ReactUtils.createElement("div", { + className: BDFDB.DOMUtils.formatClassName(data.config.avatar && BDFDB.disCN.toastavatar, BDFDB.disCN.toasticon, data.config.iconClassName), + children: icon + }), + BDFDB.ReactUtils.createElement("div", { + className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.toasttext, data.config.textClassName), + children: this.props.children + }), + !disableInteractions && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { + className: BDFDB.disCN.toastcloseicon, + name: BDFDB.LibraryComponents.SvgIcon.Names.CLOSE, + width: 16, + height: 16 + }) + ].filter(n => n) + }), + BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Animations.animated.div, { + className: BDFDB.disCN.toastbar, + style: {right: `${100 - (performance.now() - this._start) * 100 / timeout}%`} + }) + ] + }); + } + }, {children: data.children}), data.toast); + + ToastQueues[orientation].full = (BDFDB.ArrayUtils.sum(Array.from(toasts.childNodes).map(c => { + let height = BDFDB.DOMUtils.getRects(c).height; + return height > 46 ? height : 46; + })) - 92) > BDFDB.DOMUtils.getRects(app).height; + + if (typeof data.config.onShow == "function") data.config.onShow(); }; - BDFDB.NotificationUtils.desktop = function (parsedContent, parsedOptions = {}) { + + let toast = BDFDB.DOMUtils.create(`
`); + toast.update = _ => {}; + ToastQueues[orientation].queue.push({children, config, toast}); + runQueue(); + return toast; + }; + BDFDB.NotificationUtils.desktop = function (content, config = {}) { + if (!content) return; + const queue = _ => { - DesktopNotificationQueue.queue.push({parsedContent, parsedOptions}); + DesktopNotificationQueue.queue.push({content, config}); runQueue(); }; const runQueue = _ => { - if (!DesktopNotificationQueue.running) { - let notification = DesktopNotificationQueue.queue.shift(); - if (notification) notify(notification.parsedContent, notification.parsedOptions); - } - }; - const notify = (content, config) => { + if (DesktopNotificationQueue.running) return; + let data = DesktopNotificationQueue.queue.shift(); + if (!data) return; + DesktopNotificationQueue.running = true; - let muted = config.silent; - config.silent = config.silent || config.sound ? true : false; + let muted = data.config.silent; + data.config.silent = data.config.silent || data.config.sound ? true : false; let audio = new Audio(); - if (!muted && config.sound) { - audio.src = config.sound; + if (!muted && data.config.sound) { + audio.src = data.config.sound; audio.play(); } - let notification = new Notification(content, config); + let notification = new Notification(data.content, data.config); - let disableInteractions = config.disableInteractions && typeof config.onClick != "function"; + let disableInteractions = data.config.disableInteractions && typeof data.config.onClick != "function"; if (disableInteractions) notification.onclick = _ => {}; else notification.onclick = _ => { - if (typeof config.onClick == "function") config.onClick(); + if (typeof data.config.onClick == "function") data.config.onClick(); notification.close(); }; - let timeout = typeof config.timeout == "number" && !disableInteractions ? config.timeout : 3000; + let timeout = typeof data.config.timeout == "number" && !disableInteractions ? data.config.timeout : 3000; let closeTimeout = BDFDB.TimeUtils.timeout(_ => { notification.close(); }, timeout > 0 ? timeout : 600000); @@ -1212,9 +1284,10 @@ module.exports = (_ => { BDFDB.TimeUtils.clear(closeTimeout); audio.pause(); DesktopNotificationQueue.running = false; - BDFDB.TimeUtils.timeout(_ => {runQueue();}, 1000); + BDFDB.TimeUtils.timeout(runQueue, 1000); } }; + if (!("Notification" in window)) {} else if (Notification.permission === "granted") queue(); else if (Notification.permission !== "denied") Notification.requestPermission(function (response) {if (response === "granted") queue();}); @@ -7163,7 +7236,7 @@ module.exports = (_ => { w = isNaN(w) || !isFinite(w) ? p : w; w *= BDFDB.DOMUtils.getRects(ele.firstElementChild).width / (BDFDB.DOMUtils.getRects(ele).width * 2); LibraryModules.AnimationUtils.parallel([LibraryModules.AnimationUtils.timing(Animation, {toValue: p, duration: Math.sqrt(w**2) * 4000 / (parseInt(this.props.speed) || 1)})]).start(); - } + }; } }, onClick: e => { diff --git a/Library/_res/BDFDB.data.json b/Library/_res/BDFDB.data.json index 41be830b81..85e493b9e9 100644 --- a/Library/_res/BDFDB.data.json +++ b/Library/_res/BDFDB.data.json @@ -960,8 +960,8 @@ "right": "right-Eka_pI", "success": "colorSuccess-6GreWs", "text": "text-28VADE", - "toast": "toast-g4bfgI bd-toast", - "toasts": "toasts-tApoHv bd-toasts", + "toast": "toast-g4bfgI", + "toasts": "toasts-tApoHv", "warning": "colorWarning-qZNMsx" } }, diff --git a/Plugins/FriendNotifications/FriendNotifications.plugin.js b/Plugins/FriendNotifications/FriendNotifications.plugin.js index 6f04439c0d..0e0329de72 100644 --- a/Plugins/FriendNotifications/FriendNotifications.plugin.js +++ b/Plugins/FriendNotifications/FriendNotifications.plugin.js @@ -14,12 +14,12 @@ module.exports = (_ => { "info": { "name": "FriendNotifications", "author": "DevilBro", - "version": "1.6.0", + "version": "1.6.1", "description": "Get a notification when a Friend or a User, you choose to observe, changes their status" }, "changeLog": { "improved": { - "Activities": "No longer shows status changes for users that still got the same activity" + "New Toast API": "" } } }; @@ -785,20 +785,21 @@ module.exports = (_ => { }); } else if (!document.querySelector(`.friendnotifications-${id}-toast`)) { - BDFDB.NotificationUtils.toast(toastString, { + BDFDB.NotificationUtils.toast(BDFDB.ReactUtils.elementToReact(BDFDB.DOMUtils.create(toastString)), { className: `friendnotifications-${status.name}-toast friendnotifications-${id}-toast`, - html: true, timeout: toastTime, avatar: avatar, color: BDFDB.UserUtils.getStatusColor(status.name, true), - onClick: openChannel + onClick: openChannel, + onShow: _ => { + let notificationSound = notificationSounds["toast" + status.name] || {}; + if (!notificationSound.mute && notificationSound.song) { + let audio = new Audio(); + audio.src = notificationSound.song; + audio.play(); + } + } }); - let notificationSound = notificationSounds["toast" + status.name] || {}; - if (!notificationSound.mute && notificationSound.song) { - let audio = new Audio(); - audio.src = notificationSound.song; - audio.play(); - } } } } diff --git a/Plugins/GoogleTranslateOption/GoogleTranslateOption.plugin.js b/Plugins/GoogleTranslateOption/GoogleTranslateOption.plugin.js index 689edf59bd..537edfc51a 100644 --- a/Plugins/GoogleTranslateOption/GoogleTranslateOption.plugin.js +++ b/Plugins/GoogleTranslateOption/GoogleTranslateOption.plugin.js @@ -14,8 +14,13 @@ module.exports = (_ => { "info": { "name": "GoogleTranslateOption", "author": "DevilBro", - "version": "2.1.3", + "version": "2.1.4", "description": "Add a Google Translate option to your context menu, which shows a preview of the translated text and on click will open the selected text in Google Translate. Also adds a translation button to your textareas, which will automatically translate the text for you before it is being send" + }, + "changeLog": { + "improved": { + "New Toast API": "" + } } }; @@ -641,13 +646,10 @@ module.exports = (_ => { } translateText (text, type, callback) { - let toast = null, finishTranslation = translation => { + let toast = null, toastInterval, finishTranslation = translation => { isTranslating = false; if (translation) translation = this.addExceptions(translation, excepts); - if (toast) { - BDFDB.TimeUtils.clear(toast.interval); - toast.close(); - } + if (toast) toast.close(); callback(translation == text ? "" : translation, input, output); }; let [newText, excepts, translate] = this.removeExceptions(text.trim(), type); @@ -655,13 +657,25 @@ module.exports = (_ => { let output = Object.assign({}, languages[this.getLanguageChoice("output", type)]); if (translate && input.id != output.id) { let timer = 0; - toast = BDFDB.NotificationUtils.toast("Translating. Please wait", {timeout: 0}); - toast.interval = BDFDB.TimeUtils.interval(_ => { + let loadingString = `${this.labels.toast_translating} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`; + let currentLoadingString = loadingString; + toast = BDFDB.NotificationUtils.toast(loadingString, { + timeout: 0, + orientation: "center" + }); + toastInterval = BDFDB.TimeUtils.interval(_ => { if (timer++ > 40) { finishTranslation(""); - BDFDB.NotificationUtils.toast("Failed to translate text. Try another Translate Engine.", {type: "danger"}); + BDFDB.NotificationUtils.toast(`${this.labels.toast_translating_failed} - ${this.labels.toast_translating_tryanother}`, { + type: "danger", + orientation: "center", + onClose: _ => {BDFDB.TimeUtils.clear(toastInterval);} + }); + } + else { + currentLoadingString = currentLoadingString.endsWith(".....") ? loadingString : currentLoadingString + "."; + toast.update(currentLoadingString); } - else toast.textContent = toast.textContent.indexOf(".....") > -1 ? "Translating. Please wait" : toast.textContent + "."; }, 500); let specialCase = this.checkForSpecialCase(newText, input); if (specialCase) { @@ -727,8 +741,14 @@ module.exports = (_ => { catch (err) {callback("");} } else { - if (response.statusCode == 429) BDFDB_Global.NotificationUtils.toast("Failed to translate text. Request Limit per Hour is reached. Choose another Translate Engine.", {type: "danger"}); - else BDFDB.NotificationUtils.toast("Failed to translate text. Translation Server might be down. Try another Translate Engine.", {type: "danger"}); + if (response.statusCode == 429) BDFDB.NotificationUtils.toast(`${this.labels.toast_translating_failed}. ${this.labels.toast_translating_tryanother}. Request Limit per Hour is reached.`, { + type: "danger", + orientation: "center" + }); + else BDFDB.NotificationUtils.toast(`${this.labels.toast_translating_failed}. ${this.labels.toast_translating_tryanother}. Translation Server might be down.`, { + type: "danger", + orientation: "center" + }); callback(""); } }); @@ -764,7 +784,10 @@ module.exports = (_ => { catch (err) {callback("");} } else { - BDFDB.NotificationUtils.toast("Failed to translate text. Translation Server is down or API-key outdated. Try another Translate Engine.", {type: "danger"}); + BDFDB.NotificationUtils.toast(`${this.labels.toast_translating_failed}. ${this.labels.toast_translating_tryanother}. Translation Server is down or API-key outdated.`, { + type: "danger", + orientation: "center" + }); callback(""); } }); @@ -800,11 +823,17 @@ module.exports = (_ => { else callback(""); } if (result && result.indexOf('code="408"') > -1) { - BDFDB.NotificationUtils.toast("Failed to translate text. Monthly rate limit reached. Choose another Translate Engine", {type: "danger"}); + BDFDB.NotificationUtils.toast(`${this.labels.toast_translating_failed}. ${this.labels.toast_translating_tryanother}. Monthly rate limit reached.`, { + type: "danger", + orientation: "center" + }); callback(""); } else { - BDFDB.NotificationUtils.toast("Failed to translate text. Translation Server is down or API-key outdated. Try another Translate Engine.", {type: "danger"}); + BDFDB.NotificationUtils.toast(`${this.labels.toast_translating_failed}. ${this.labels.toast_translating_tryanother}. Translation Server is down or API-key outdated.`, { + type: "danger", + orientation: "center" + }); callback(""); } }); @@ -832,7 +861,10 @@ module.exports = (_ => { catch (err) {callback("");} } else { - BDFDB.NotificationUtils.toast("Failed to translate text. Translation Server is down, daily limited reached or API-key outdated. Try another Translate Engine.", {type: "danger"}); + BDFDB.NotificationUtils.toast(`${this.labels.toast_translating_failed}. ${this.labels.toast_translating_tryanother}. Translation Server is down, daily limited reached or API-key outdated.`, { + type: "danger", + orientation: "center" + }); callback(""); } }); @@ -891,7 +923,10 @@ module.exports = (_ => { } } } - else BDFDB.NotificationUtils.toast("Invalid binary format. Only use 0s and 1s.", {type: "danger"}); + else BDFDB.NotificationUtils.toast("Invalid binary format. Only use 0s and 1s.", { + type: "danger", + orientation: "center" + }); return string; } @@ -970,6 +1005,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Превод на съобщението", popout_translateoption: "Превод", popout_untranslateoption: "Непревод", + toast_translating: "Превод", + toast_translating_failed: "Преводът не бе успешен", + toast_translating_tryanother: "Опитайте друг преводач", translated_watermark: "преведено" }; case "da": // Danish @@ -979,6 +1017,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Ikke-oversat besked", popout_translateoption: "Oversætte", popout_untranslateoption: "Untranslate", + toast_translating: "Oversætter", + toast_translating_failed: "Kunne ikke oversætte", + toast_translating_tryanother: "Prøv en anden oversætter", translated_watermark: "oversat" }; case "de": // German @@ -988,6 +1029,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Nachricht unübersetzen", popout_translateoption: "Übersetzen", popout_untranslateoption: "Unübersetzen", + toast_translating: "Übersetzen", + toast_translating_failed: "Übersetzung fehlgeschlagen", + toast_translating_tryanother: "Versuch einen anderen Übersetzer", translated_watermark: "übersetzt" }; case "el": // Greek @@ -997,6 +1041,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Μη μετάφραση μηνύματος", popout_translateoption: "Μεταφράζω", popout_untranslateoption: "Μη μετάφραση", + toast_translating: "Μετάφραση", + toast_translating_failed: "Αποτυχία μετάφρασης", + toast_translating_tryanother: "Δοκιμάστε έναν άλλο Μεταφραστή", translated_watermark: "μεταφρασμένο" }; case "es": // Spanish @@ -1006,6 +1053,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Mensaje sin traducir", popout_translateoption: "Traducir", popout_untranslateoption: "No traducir", + toast_translating: "Traductorio", + toast_translating_failed: "No se pudo traducir", + toast_translating_tryanother: "Prueba con otro traductor", translated_watermark: "traducido" }; case "fi": // Finnish @@ -1015,6 +1065,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Käännä viesti", popout_translateoption: "Kääntää", popout_untranslateoption: "Käännä", + toast_translating: "Kääntäminen", + toast_translating_failed: "Käännös epäonnistui", + toast_translating_tryanother: "Kokeile toista kääntäjää", translated_watermark: "käännetty" }; case "fr": // French @@ -1024,6 +1077,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Message non traduit", popout_translateoption: "Traduire", popout_untranslateoption: "Non traduit", + toast_translating: "Traduction en cours", + toast_translating_failed: "Échec de la traduction", + toast_translating_tryanother: "Essayez un autre traducteur", translated_watermark: "traduit" }; case "hr": // Croatian @@ -1033,6 +1089,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Prevedi poruku", popout_translateoption: "Prevedi", popout_untranslateoption: "Neprevedi", + toast_translating: "Prevođenje", + toast_translating_failed: "Prijevod nije uspio", + toast_translating_tryanother: "Pokušajte s drugim prevoditeljem", translated_watermark: "prevedeno" }; case "hu": // Hungarian @@ -1042,6 +1101,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Az üzenet lefordítása", popout_translateoption: "fordít", popout_untranslateoption: "Fordítás le", + toast_translating: "Fordítás", + toast_translating_failed: "Nem sikerült lefordítani", + toast_translating_tryanother: "Próbálkozzon másik fordítóval", translated_watermark: "lefordított" }; case "it": // Italian @@ -1051,6 +1113,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Annulla traduzione messaggio", popout_translateoption: "Tradurre", popout_untranslateoption: "Non tradurre", + toast_translating: "Tradurre", + toast_translating_failed: "Impossibile tradurre", + toast_translating_tryanother: "Prova un altro traduttore", translated_watermark: "tradotto" }; case "ja": // Japanese @@ -1060,6 +1125,9 @@ module.exports = (_ => { context_messageuntranslateoption: "メッセージの翻訳解除", popout_translateoption: "翻訳する", popout_untranslateoption: "翻訳しない", + toast_translating: "翻訳", + toast_translating_failed: "翻訳に失敗しました", + toast_translating_tryanother: "別の翻訳者を試す", translated_watermark: "翻訳済み" }; case "ko": // Korean @@ -1069,6 +1137,9 @@ module.exports = (_ => { context_messageuntranslateoption: "메시지 번역 취소", popout_translateoption: "옮기다", popout_untranslateoption: "번역 취소", + toast_translating: "번역 중", + toast_translating_failed: "번역하지 못했습니다.", + toast_translating_tryanother: "다른 번역기 시도", translated_watermark: "번역" }; case "lt": // Lithuanian @@ -1078,6 +1149,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Išversti pranešimą", popout_translateoption: "Išversti", popout_untranslateoption: "Neišversti", + toast_translating: "Vertimas", + toast_translating_failed: "Nepavyko išversti", + toast_translating_tryanother: "Išbandykite kitą vertėją", translated_watermark: "išverstas" }; case "nl": // Dutch @@ -1087,6 +1161,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Bericht onvertalen", popout_translateoption: "Vertalen", popout_untranslateoption: "Onvertalen", + toast_translating: "Vertalen", + toast_translating_failed: "Kan niet vertalen", + toast_translating_tryanother: "Probeer een andere vertaler", translated_watermark: "vertaald" }; case "no": // Norwegian @@ -1096,6 +1173,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Ikke oversett melding", popout_translateoption: "Oversette", popout_untranslateoption: "Ikke oversett", + toast_translating: "Oversetter", + toast_translating_failed: "Kunne ikke oversette", + toast_translating_tryanother: "Prøv en annen oversetter", translated_watermark: "oversatt" }; case "pl": // Polish @@ -1105,6 +1185,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Nieprzetłumacz wiadomość", popout_translateoption: "Tłumaczyć", popout_untranslateoption: "Nie przetłumacz", + toast_translating: "Tłumaczenie", + toast_translating_failed: "Nie udało się przetłumaczyć", + toast_translating_tryanother: "Wypróbuj innego tłumacza", translated_watermark: "przetłumaczony" }; case "pt-BR": // Portuguese (Brazil) @@ -1114,6 +1197,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Mensagem não traduzida", popout_translateoption: "Traduzir", popout_untranslateoption: "Não traduzido", + toast_translating: "Traduzindo", + toast_translating_failed: "Falha ao traduzir", + toast_translating_tryanother: "Tente outro tradutor", translated_watermark: "traduzido" }; case "ro": // Romanian @@ -1123,6 +1209,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Untraduceți mesajul", popout_translateoption: "Traduceți", popout_untranslateoption: "Netradus", + toast_translating: "Traducere", + toast_translating_failed: "Nu s-a putut traduce", + toast_translating_tryanother: "Încercați un alt traducător", translated_watermark: "tradus" }; case "ru": // Russian @@ -1132,6 +1221,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Непереведенное сообщение", popout_translateoption: "Переведите", popout_untranslateoption: "Неперевести", + toast_translating: "Идет перевод", + toast_translating_failed: "Не удалось перевести", + toast_translating_tryanother: "Попробуйте другой переводчик", translated_watermark: "переведено" }; case "sv": // Swedish @@ -1141,6 +1233,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Untranslate meddelande", popout_translateoption: "Översätt", popout_untranslateoption: "Untranslate", + toast_translating: "Översätter", + toast_translating_failed: "Det gick inte att översätta", + toast_translating_tryanother: "Prova en annan översättare", translated_watermark: "översatt" }; case "th": // Thai @@ -1150,6 +1245,9 @@ module.exports = (_ => { context_messageuntranslateoption: "ยกเลิกการแปลข้อความ", popout_translateoption: "แปลภาษา", popout_untranslateoption: "ไม่แปล", + toast_translating: "กำลังแปล", + toast_translating_failed: "แปลไม่สำเร็จ", + toast_translating_tryanother: "ลองใช้นักแปลคนอื่น", translated_watermark: "แปล" }; case "tr": // Turkish @@ -1159,6 +1257,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Çeviriyi Kaldır Mesajı", popout_translateoption: "Çevirmek", popout_untranslateoption: "Çevirmeyi kaldır", + toast_translating: "Çeviri", + toast_translating_failed: "Tercüme edilemedi", + toast_translating_tryanother: "Başka bir Çevirmen deneyin", translated_watermark: "tercüme" }; case "uk": // Ukrainian @@ -1168,6 +1269,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Неперекладене повідомлення", popout_translateoption: "Перекласти", popout_untranslateoption: "Неперекласти", + toast_translating: "Переклад", + toast_translating_failed: "Не вдалося перекласти", + toast_translating_tryanother: "Спробуйте іншого перекладача", translated_watermark: "переклав" }; case "vi": // Vietnamese @@ -1177,6 +1281,9 @@ module.exports = (_ => { context_messageuntranslateoption: "Thư chưa dịch", popout_translateoption: "Phiên dịch", popout_untranslateoption: "Chưa dịch", + toast_translating: "Phiên dịch", + toast_translating_failed: "Không dịch được", + toast_translating_tryanother: "Thử một Trình dịch khác", translated_watermark: "đã dịch" }; case "zh-CN": // Chinese (China) @@ -1186,6 +1293,9 @@ module.exports = (_ => { context_messageuntranslateoption: "取消翻译消息", popout_translateoption: "翻译", popout_untranslateoption: "取消翻译", + toast_translating: "正在翻译", + toast_translating_failed: "翻译失败", + toast_translating_tryanother: "尝试其他翻译器", translated_watermark: "已翻译" }; case "zh-TW": // Chinese (Taiwan) @@ -1195,15 +1305,21 @@ module.exports = (_ => { context_messageuntranslateoption: "取消翻譯訊息", popout_translateoption: "翻譯", popout_untranslateoption: "取消翻譯", + toast_translating: "正在翻譯", + toast_translating_failed: "翻譯失敗", + toast_translating_tryanother: "嘗試其他翻譯器", translated_watermark: "已翻譯" }; default: // English return { - context_googletranslateoption: "Search translation", + context_googletranslateoption: "Search Translation", context_messagetranslateoption: "Translate Message", context_messageuntranslateoption: "Untranslate Message", popout_translateoption: "Translate", popout_untranslateoption: "Untranslate", + toast_translating: "Translating", + toast_translating_failed: "Failed to translate", + toast_translating_tryanother: "Try another Translator", translated_watermark: "translated" }; } diff --git a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js index 29f5c3a872..382211bef0 100644 --- a/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js +++ b/Plugins/ReadAllNotificationsButton/ReadAllNotificationsButton.plugin.js @@ -14,8 +14,13 @@ module.exports = (_ => { "info": { "name": "ReadAllNotificationsButton", "author": "DevilBro", - "version": "1.6.4", + "version": "1.6.5", "description": "Add a button to clear all notifications" + }, + "changeLog": { + "improved": { + "New Toast API": "" + } } }; @@ -234,7 +239,7 @@ module.exports = (_ => { if (settings.includeDMs) BDFDB.DMUtils.markAsRead(BDFDB.DMUtils.getAll()); }; if (!settings.confirmClear) clear(); - else BDFDB.ModalUtils.confirm(this, `Are you sure you want to mark all Notifications as read?`, clear); + else BDFDB.ModalUtils.confirm(this, this.labels.modal_confirmnotifications, clear); }, onContextMenu: event => { BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { @@ -301,22 +306,32 @@ module.exports = (_ => { }), onClick: _ => { let clear = _ => { - if (clearing) return BDFDB.NotificationUtils.toast("Already clearing some recent mentions, please wait...", {type: "danger"}); + if (clearing) return BDFDB.NotificationUtils.toast(`${this.labels.toast_alreadyclearing} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`, {type: "danger"}); let messages = [].concat(e.instance.props.messages).filter(n => n); if (messages.length) { clearing = true; - let toast = BDFDB.NotificationUtils.toast("Clearing all recent mentions, please wait...", {timeout: 0}); + let toastInterval; + let loadingString = `${this.labels.toast_clearing} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`; + let currentLoadingString = loadingString; + let toast = BDFDB.NotificationUtils.toast(currentLoadingString, { + timeout: 0, + onClose: _ => {BDFDB.TimeUtils.clear(toastInterval);} + }); + toastInterval = BDFDB.TimeUtils.interval(_ => { + currentLoadingString = currentLoadingString.endsWith(".....") ? loadingString : currentLoadingString + "."; + toast.update(currentLoadingString); + }, 500); for (let i = 0; i < messages.length; i++) BDFDB.TimeUtils.timeout(_ => { BDFDB.LibraryModules.RecentMentionUtils.deleteRecentMention(messages[i].id); if (i == messages.length - 1) { clearing = false; toast.close(); - BDFDB.NotificationUtils.toast("Cleared all recent mentions.", {type: "success"}); + BDFDB.NotificationUtils.toast(this.labels.toastcleared, {type: "success"}); } }, i * 1000); } }; - if (settings.confirmClear) BDFDB.ModalUtils.confirm(this, `Are you sure you want to mark all mentions as read?`, clear); + if (settings.confirmClear) BDFDB.ModalUtils.confirm(this, this.labels.modal_confirmmentions, clear); else clear(); } }) @@ -350,7 +365,12 @@ module.exports = (_ => { context_guilds: "Всички сървъри", context_mutedguilds: "Приглушени сървъри", context_pingedguilds: "Pinged сървъри", - context_unreadguilds: "Непрочетени сървъри" + context_unreadguilds: "Непрочетени сървъри", + modal_confirmmentions: "Наистина ли искате да изтриете всички непрочетени споменавания?", + modal_confirmnotifications: "Наистина ли искате да изтриете всички непрочетени известия?", + toast_alreadyclearing: "Изтрива някои споменавания вече", + toast_cleared: "Всички последни споменавания бяха изтрити", + toast_clearing: "Изчиства всички скорошни споменавания" }; case "da": // Danish return { @@ -358,7 +378,12 @@ module.exports = (_ => { context_guilds: "Alle servere", context_mutedguilds: "Dæmpede servere", context_pingedguilds: "Pingede servere", - context_unreadguilds: "Ulæste servere" + context_unreadguilds: "Ulæste servere", + modal_confirmmentions: "Er du sikker på, at du vil slette alle ulæste omtaler?", + modal_confirmnotifications: "Er du sikker på, at du vil slette alle ulæste meddelelser?", + toast_alreadyclearing: "Sletter allerede nogle omtaler", + toast_cleared: "Alle nylige omtaler er blevet slettet", + toast_clearing: "Rydder alle nylige omtaler" }; case "de": // German return { @@ -366,7 +391,12 @@ module.exports = (_ => { context_guilds: "Alle Server", context_mutedguilds: "Stummgeschaltete Server", context_pingedguilds: "Gepingte Server", - context_unreadguilds: "Ungelesene Server" + context_unreadguilds: "Ungelesene Server", + modal_confirmmentions: "Möchten Sie wirklich alle ungelesenen Erwähnungen löschen?", + modal_confirmnotifications: "Möchten Sie wirklich alle ungelesenen Benachrichtigungen löschen?", + toast_alreadyclearing: "Löscht bereits einige Erwähnungen", + toast_cleared: "Alle kürzlich Erwähnungen wurden gelöscht", + toast_clearing: "Löscht alle letzten Erwähnungen" }; case "el": // Greek return { @@ -374,7 +404,12 @@ module.exports = (_ => { context_guilds: "Όλοι οι διακομιστές", context_mutedguilds: "Σίγαση διακομιστών", context_pingedguilds: "Διακομιστές Ping", - context_unreadguilds: "Μη αναγνωσμένοι διακομιστές" + context_unreadguilds: "Μη αναγνωσμένοι διακομιστές", + modal_confirmmentions: "Είστε βέβαιοι ότι θέλετε να διαγράψετε όλες τις μη αναγνωσμένες αναφορές;", + modal_confirmnotifications: "Είστε βέβαιοι ότι θέλετε να διαγράψετε όλες τις μη αναγνωσμένες ειδοποιήσεις;", + toast_alreadyclearing: "Διαγράφει ήδη κάποιες αναφορές", + toast_cleared: "Όλες οι πρόσφατες αναφορές έχουν διαγραφεί", + toast_clearing: "Διαγράφει όλες τις πρόσφατες αναφορές" }; case "es": // Spanish return { @@ -382,7 +417,12 @@ module.exports = (_ => { context_guilds: "Todos los servidores", context_mutedguilds: "Servidores silenciados", context_pingedguilds: "Servidores con ping", - context_unreadguilds: "Servidores no leídos" + context_unreadguilds: "Servidores no leídos", + modal_confirmmentions: "¿Estás seguro de que deseas eliminar todas las menciones no leídas?", + modal_confirmnotifications: "¿Está seguro de que desea eliminar todas las notificaciones no leídas?", + toast_alreadyclearing: "Elimina algunas menciones ya", + toast_cleared: "Se han eliminado todas las menciones recientes", + toast_clearing: "Borra todas las menciones recientes" }; case "fi": // Finnish return { @@ -390,7 +430,12 @@ module.exports = (_ => { context_guilds: "Kaikki palvelimet", context_mutedguilds: "Mykistetyt palvelimet", context_pingedguilds: "Pinged-palvelimet", - context_unreadguilds: "Lukemattomat palvelimet" + context_unreadguilds: "Lukemattomat palvelimet", + modal_confirmmentions: "Haluatko varmasti poistaa kaikki lukemattomat maininnat?", + modal_confirmnotifications: "Haluatko varmasti poistaa kaikki lukemattomat ilmoitukset?", + toast_alreadyclearing: "Poistaa jo joitain mainintoja", + toast_cleared: "Kaikki viimeisimmät maininnat on poistettu", + toast_clearing: "Tyhjentää kaikki viimeisimmät maininnat" }; case "fr": // French return { @@ -398,7 +443,12 @@ module.exports = (_ => { context_guilds: "Tous les serveurs", context_mutedguilds: "Serveurs muets", context_pingedguilds: "Serveurs ping", - context_unreadguilds: "Serveurs non lus" + context_unreadguilds: "Serveurs non lus", + modal_confirmmentions: "Voulez-vous vraiment supprimer toutes les mentions non lues?", + modal_confirmnotifications: "Voulez-vous vraiment supprimer toutes les notifications non lues?", + toast_alreadyclearing: "Supprime déjà certaines mentions", + toast_cleared: "Toutes les mentions récentes ont été supprimées", + toast_clearing: "Efface toutes les mentions récentes" }; case "hr": // Croatian return { @@ -406,7 +456,12 @@ module.exports = (_ => { context_guilds: "Svi poslužitelji", context_mutedguilds: "Prigušeni poslužitelji", context_pingedguilds: "Pingirani poslužitelji", - context_unreadguilds: "Nepročitani poslužitelji" + context_unreadguilds: "Nepročitani poslužitelji", + modal_confirmmentions: "Jeste li sigurni da želite izbrisati sva nepročitana spominjanja?", + modal_confirmnotifications: "Jeste li sigurni da želite izbrisati sve nepročitane obavijesti?", + toast_alreadyclearing: "Briše već spomenute", + toast_cleared: "Sva nedavna spominjanja su izbrisana", + toast_clearing: "Briše sva nedavna spominjanja" }; case "hu": // Hungarian return { @@ -414,7 +469,12 @@ module.exports = (_ => { context_guilds: "Minden szerver", context_mutedguilds: "Némított szerverek", context_pingedguilds: "Pingelt szerverek", - context_unreadguilds: "Olvasatlan szerverek" + context_unreadguilds: "Olvasatlan szerverek", + modal_confirmmentions: "Biztosan törli az összes olvasatlan említést?", + modal_confirmnotifications: "Biztosan törli az összes olvasatlan értesítést?", + toast_alreadyclearing: "Néhány említést már töröl", + toast_cleared: "Az összes közelmúltbeli említést törölték", + toast_clearing: "Törli az összes közelmúltbeli említést" }; case "it": // Italian return { @@ -422,7 +482,12 @@ module.exports = (_ => { context_guilds: "Tutti i server", context_mutedguilds: "Server disattivati", context_pingedguilds: "Server sottoposti a ping", - context_unreadguilds: "Server non letti" + context_unreadguilds: "Server non letti", + modal_confirmmentions: "Sei sicuro di voler eliminare tutte le menzioni non lette?", + modal_confirmnotifications: "Sei sicuro di voler eliminare tutte le notifiche non lette?", + toast_alreadyclearing: "Elimina già alcune menzioni", + toast_cleared: "Tutte le menzioni recenti sono state eliminate", + toast_clearing: "Cancella tutte le menzioni recenti" }; case "ja": // Japanese return { @@ -430,7 +495,12 @@ module.exports = (_ => { context_guilds: "すべてのサーバー", context_mutedguilds: "ミュートされたサーバー", context_pingedguilds: "pingされたサーバー", - context_unreadguilds: "未読サーバー" + context_unreadguilds: "未読サーバー", + modal_confirmmentions: "未読のメンションをすべて削除してもよろしいですか?", + modal_confirmnotifications: "未読の通知をすべて削除してもよろしいですか?", + toast_alreadyclearing: "すでにいくつかの言及を削除します", + toast_cleared: "最近の言及はすべて削除されました", + toast_clearing: "最近の言及をすべてクリアします" }; case "ko": // Korean return { @@ -438,7 +508,12 @@ module.exports = (_ => { context_guilds: "모든 서버", context_mutedguilds: "음소거 된 서버", context_pingedguilds: "핑된 서버", - context_unreadguilds: "읽지 않은 서버" + context_unreadguilds: "읽지 않은 서버", + modal_confirmmentions: "읽지 않은 모든 멘션을 삭제 하시겠습니까?", + modal_confirmnotifications: "읽지 않은 모든 알림을 삭제 하시겠습니까?", + toast_alreadyclearing: "이미 일부 멘션을 삭제합니다.", + toast_cleared: "모든 최근 멘션이 삭제되었습니다.", + toast_clearing: "최근 멘션을 모두 지 웁니다." }; case "lt": // Lithuanian return { @@ -446,7 +521,12 @@ module.exports = (_ => { context_guilds: "Visi serveriai", context_mutedguilds: "Nutildyti serveriai", context_pingedguilds: "„Pinged“ serveriai", - context_unreadguilds: "Neskaityti serveriai" + context_unreadguilds: "Neskaityti serveriai", + modal_confirmmentions: "Ar tikrai norite ištrinti visus neperskaitytus paminėjimus?", + modal_confirmnotifications: "Ar tikrai norite ištrinti visus neperskaitytus pranešimus?", + toast_alreadyclearing: "Kai kurie paminėjimai jau ištrinami", + toast_cleared: "Visi naujausi paminėjimai buvo ištrinti", + toast_clearing: "Išvalo visus naujausius paminėjimus" }; case "nl": // Dutch return { @@ -454,7 +534,12 @@ module.exports = (_ => { context_guilds: "Alle servers", context_mutedguilds: "Gedempte servers", context_pingedguilds: "Gepingde servers", - context_unreadguilds: "Ongelezen servers" + context_unreadguilds: "Ongelezen servers", + modal_confirmmentions: "Weet u zeker dat u alle ongelezen vermeldingen wilt verwijderen?", + modal_confirmnotifications: "Weet u zeker dat u alle ongelezen meldingen wilt verwijderen?", + toast_alreadyclearing: "Verwijdert al enkele vermeldingen", + toast_cleared: "Alle recente vermeldingen zijn verwijderd", + toast_clearing: "Wist alle recente vermeldingen" }; case "no": // Norwegian return { @@ -462,7 +547,12 @@ module.exports = (_ => { context_guilds: "Alle servere", context_mutedguilds: "Dempede servere", context_pingedguilds: "Pingede servere", - context_unreadguilds: "Uleste servere" + context_unreadguilds: "Uleste servere", + modal_confirmmentions: "Er du sikker på at du vil slette alle uleste omtaler?", + modal_confirmnotifications: "Er du sikker på at du vil slette alle uleste varsler?", + toast_alreadyclearing: "Sletter allerede noen omtaler", + toast_cleared: "Alle nylige omtaler er slettet", + toast_clearing: "Fjerner alle nylige omtaler" }; case "pl": // Polish return { @@ -470,7 +560,12 @@ module.exports = (_ => { context_guilds: "Wszystkie serwery", context_mutedguilds: "Wyciszone serwery", context_pingedguilds: "Serwery pingowane", - context_unreadguilds: "Nieprzeczytane serwery" + context_unreadguilds: "Nieprzeczytane serwery", + modal_confirmmentions: "Czy na pewno chcesz usunąć wszystkie nieprzeczytane wzmianki?", + modal_confirmnotifications: "Czy na pewno chcesz usunąć wszystkie nieprzeczytane powiadomienia?", + toast_alreadyclearing: "Usuwa już niektóre wzmianki", + toast_cleared: "Wszystkie ostatnie wzmianki zostały usunięte", + toast_clearing: "Usuwa wszystkie ostatnie wzmianki" }; case "pt-BR": // Portuguese (Brazil) return { @@ -478,7 +573,12 @@ module.exports = (_ => { context_guilds: "Todos os servidores", context_mutedguilds: "Servidores Silenciados", context_pingedguilds: "Servidores com ping", - context_unreadguilds: "Servidores não lidos" + context_unreadguilds: "Servidores não lidos", + modal_confirmmentions: "Tem certeza de que deseja excluir todas as menções não lidas?", + modal_confirmnotifications: "Tem certeza de que deseja excluir todas as notificações não lidas?", + toast_alreadyclearing: "Exclui algumas menções já", + toast_cleared: "Todas as menções recentes foram excluídas", + toast_clearing: "Limpa todas as menções recentes" }; case "ro": // Romanian return { @@ -486,7 +586,12 @@ module.exports = (_ => { context_guilds: "Toate serverele", context_mutedguilds: "Servere mutate", context_pingedguilds: "Servere pinged", - context_unreadguilds: "Servere necitite" + context_unreadguilds: "Servere necitite", + modal_confirmmentions: "Sigur doriți să ștergeți toate mențiunile necitite?", + modal_confirmnotifications: "Sigur doriți să ștergeți toate notificările necitite?", + toast_alreadyclearing: "Șterge deja câteva mențiuni", + toast_cleared: "Toate mențiunile recente au fost șterse", + toast_clearing: "Șterge toate mențiunile recente" }; case "ru": // Russian return { @@ -494,7 +599,12 @@ module.exports = (_ => { context_guilds: "Все серверы", context_mutedguilds: "Отключенные серверы", context_pingedguilds: "Проверенные серверы", - context_unreadguilds: "Непрочитанные серверы" + context_unreadguilds: "Непрочитанные серверы", + modal_confirmmentions: "Вы уверены, что хотите удалить все непрочитанные упоминания?", + modal_confirmnotifications: "Вы действительно хотите удалить все непрочитанные уведомления?", + toast_alreadyclearing: "Удаляет уже некоторые упоминания", + toast_cleared: "Все недавние упоминания были удалены", + toast_clearing: "Удаляет все недавние упоминания" }; case "sv": // Swedish return { @@ -502,7 +612,12 @@ module.exports = (_ => { context_guilds: "Alla servrar", context_mutedguilds: "Dämpade servrar", context_pingedguilds: "Pingade servrar", - context_unreadguilds: "Olästa servrar" + context_unreadguilds: "Olästa servrar", + modal_confirmmentions: "Är du säker på att du vill ta bort alla olästa omnämnanden?", + modal_confirmnotifications: "Är du säker på att du vill ta bort alla olästa aviseringar?", + toast_alreadyclearing: "Raderar några omnämnanden redan", + toast_cleared: "Alla nya omnämnanden har tagits bort", + toast_clearing: "Rensar alla senaste omnämnanden" }; case "th": // Thai return { @@ -510,7 +625,12 @@ module.exports = (_ => { context_guilds: "เซิร์ฟเวอร์ทั้งหมด", context_mutedguilds: "เซิร์ฟเวอร์ที่ปิดเสียง", context_pingedguilds: "เซิร์ฟเวอร์ Pinged", - context_unreadguilds: "เซิร์ฟเวอร์ที่ยังไม่ได้อ่าน" + context_unreadguilds: "เซิร์ฟเวอร์ที่ยังไม่ได้อ่าน", + modal_confirmmentions: "แน่ใจไหมว่าต้องการลบข้อความที่ยังไม่ได้อ่านทั้งหมด", + modal_confirmnotifications: "แน่ใจไหมว่าต้องการลบการแจ้งเตือนที่ยังไม่ได้อ่านทั้งหมด", + toast_alreadyclearing: "ลบการกล่าวถึงบางส่วนแล้ว", + toast_cleared: "ลบการกล่าวถึงล่าสุดทั้งหมดแล้ว", + toast_clearing: "ล้างการพูดถึงล่าสุดทั้งหมด" }; case "tr": // Turkish return { @@ -518,7 +638,12 @@ module.exports = (_ => { context_guilds: "Tüm Sunucular", context_mutedguilds: "Sessiz Sunucular", context_pingedguilds: "Ping Gönderilen Sunucular", - context_unreadguilds: "Okunmamış Sunucular" + context_unreadguilds: "Okunmamış Sunucular", + modal_confirmmentions: "Okunmamış tüm bahisleri silmek istediğinizden emin misiniz?", + modal_confirmnotifications: "Okunmamış tüm bildirimleri silmek istediğinizden emin misiniz?", + toast_alreadyclearing: "Zaten bazı bahsetmeleri siler", + toast_cleared: "Son bahsedenlerin tümü silindi", + toast_clearing: "Tüm son bahsedilenleri temizler" }; case "uk": // Ukrainian return { @@ -526,7 +651,12 @@ module.exports = (_ => { context_guilds: "Усі сервери", context_mutedguilds: "Приглушені сервери", context_pingedguilds: "Pinged сервери", - context_unreadguilds: "Непрочитані сервери" + context_unreadguilds: "Непрочитані сервери", + modal_confirmmentions: "Ви впевнені, що хочете видалити всі непрочитані згадки?", + modal_confirmnotifications: "Ви впевнені, що хочете видалити всі непрочитані сповіщення?", + toast_alreadyclearing: "Видаляє деякі згадки вже", + toast_cleared: "Усі останні згадування були видалені", + toast_clearing: "Очищає всі останні згадування" }; case "vi": // Vietnamese return { @@ -534,7 +664,12 @@ module.exports = (_ => { context_guilds: "Tất cả máy chủ", context_mutedguilds: "Máy chủ bị tắt tiếng", context_pingedguilds: "Máy chủ Pinged", - context_unreadguilds: "Máy chủ chưa đọc" + context_unreadguilds: "Máy chủ chưa đọc", + modal_confirmmentions: "Bạn có chắc chắn muốn xóa tất cả các đề cập chưa đọc không?", + modal_confirmnotifications: "Bạn có chắc chắn muốn xóa tất cả các thông báo chưa đọc không?", + toast_alreadyclearing: "Đã xóa một số đề cập", + toast_cleared: "Tất cả các đề cập gần đây đã bị xóa", + toast_clearing: "Xóa tất cả các đề cập gần đây" }; case "zh-CN": // Chinese (China) return { @@ -542,7 +677,12 @@ module.exports = (_ => { context_guilds: "所有服务器", context_mutedguilds: "静音服务器", context_pingedguilds: "绑定服务器", - context_unreadguilds: "未读服务器" + context_unreadguilds: "未读服务器", + modal_confirmmentions: "您确定要删除所有未读的提及吗?", + modal_confirmnotifications: "您确定要删除所有未读的通知吗?", + toast_alreadyclearing: "已删除一些提及", + toast_cleared: "最近所有提及的内容均已删除", + toast_clearing: "清除所有最近提及的内容" }; case "zh-TW": // Chinese (Taiwan) return { @@ -550,7 +690,12 @@ module.exports = (_ => { context_guilds: "所有服務器", context_mutedguilds: "靜音服務器", context_pingedguilds: "綁定服務器", - context_unreadguilds: "未讀服務器" + context_unreadguilds: "未讀服務器", + modal_confirmmentions: "您確定要刪除所有未讀的提及嗎?", + modal_confirmnotifications: "您確定要刪除所有未讀的通知嗎?", + toast_alreadyclearing: "已刪除一些提及", + toast_cleared: "最近所有提及的內容均已刪除", + toast_clearing: "清除所有最近提及的內容" }; default: // English return { @@ -558,7 +703,12 @@ module.exports = (_ => { context_guilds: "All Servers", context_mutedguilds: "Muted Servers", context_pingedguilds: "Pinged Servers", - context_unreadguilds: "Unread Servers" + context_unreadguilds: "Unread Servers", + modal_confirmmentions: "Are you sure you want to delete all unread Mentions?", + modal_confirmnotifications: "Are you sure you want to delete all unread Notifications?", + toast_alreadyclearing: "Already clearing some Mentions", + toast_cleared: "All recent Mentions have been cleared", + toast_clearing: "Clearing all recent Mentions" }; } } diff --git a/Plugins/SpellCheck/SpellCheck.plugin.js b/Plugins/SpellCheck/SpellCheck.plugin.js index bd0f4e63e6..9011acf17f 100644 --- a/Plugins/SpellCheck/SpellCheck.plugin.js +++ b/Plugins/SpellCheck/SpellCheck.plugin.js @@ -16,6 +16,11 @@ module.exports = (_ => { "author": "DevilBro", "version": "1.5.4", "description": "Add a Spellcheck to all Textareas. Select a Word and Right Click it to add it to your Dictionary" + }, + "changeLog": { + "improved": { + "New Toast API": "" + } } }; @@ -332,9 +337,14 @@ module.exports = (_ => { if (languages[lang]) { let ownDictionary = BDFDB.DataUtils.load(this, "owndics", lang) || []; let loadingString = `${this.labels.toast_dictionary.replace("{{var0}}", this.getLanguageName(languages[lang]))} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`; - languageToasts[key] = BDFDB.NotificationUtils.toast(loadingString, {timeout: 0}); + let currentLoadingString = loadingString; + languageToasts[key] = BDFDB.NotificationUtils.toast(loadingString, { + timeout: 0, + orientation: "center" + }); languageToasts[key].interval = BDFDB.TimeUtils.interval(_ => { - languageToasts[key].textContent = languageToasts[key].textContent.endsWith(".....") ? loadingString : languageToasts[key].textContent + "."; + currentLoadingString = currentLoadingString.endsWith(".....") ? loadingString : currentLoadingString + "."; + languageToasts[key].update(currentLoadingString); }, 500); languageToasts[key].lang = lang @@ -344,7 +354,10 @@ module.exports = (_ => { let parse = (error, response, body, download) => { this.killLanguageToast(key); if (error || (response && body.toLowerCase().indexOf("") > -1)) { - BDFDB.NotificationUtils.toast(this.labels.toast_dictionary_fail.replace("{{var0}}", this.getLanguageName(languages[lang])), {type: "danger"}); + BDFDB.NotificationUtils.toast(this.labels.toast_dictionary_fail.replace("{{var0}}", this.getLanguageName(languages[lang])), { + type: "danger", + orientation: "center" + }); } else if (response && languageToasts[key].lang == lang) { if (download) { @@ -353,7 +366,10 @@ module.exports = (_ => { } langDictionaries[key] = body.toLowerCase().replace(/\r/g, "").split("\n"); dictionaries[key] = this.formatDictionary(langDictionaries[key].concat(ownDictionary)); - BDFDB.NotificationUtils.toast(this.labels.toast_dictionary_success.replace("{{var0}}", this.getLanguageName(languages[lang])), {type: "success"}); + BDFDB.NotificationUtils.toast(this.labels.toast_dictionary_success.replace("{{var0}}", this.getLanguageName(languages[lang])), { + type: "success", + orientation: "center" + }); } };