This commit is contained in:
poslop
2024-04-30 15:32:45 -05:00
parent a21e33aeb6
commit 7d153f28e0
23 changed files with 1781 additions and 1490 deletions

View File

@@ -1,13 +1,13 @@
{ {
"all": { "all": {
"changeLogs": { "changeLogs": {
"BDFDB": "3.2.0", "BDFDB": "3.5.9",
"CreationDate": "1.4.6", "CreationDate": "1.4.6",
"EditRoles": "1.1.4", "EditRoles": "1.1.7",
"ImageUtilities": "5.1.9", "ImageUtilities": "5.4.0",
"NotificationSounds": "3.7.8", "NotificationSounds": "3.9.2",
"PinDMs": "1.9.7", "PinDMs": "2.0.3",
"PluginRepo": "2.4.6" "PluginRepo": "2.5.5"
}, },
"choices": { "choices": {
"toastPosition": "right" "toastPosition": "right"
@@ -19,8 +19,8 @@
"useChromium": false "useChromium": false
}, },
"hashes": { "hashes": {
"0BDFDB.data.json": "a6567d782bfade3434800f57ac73d037d233a5b2", "0BDFDB.data.json": "4476361c3ca209217e9e539dfb2af7b406e061d8",
"0BDFDB.raw.css": "26087554c644b93f1f9d6c64e7a7918b6ec66dfe" "0BDFDB.raw.css": "8c083e2a87a82aded5f3b2e27fb8b2f816b5f74a"
} }
} }
} }

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -565,6 +565,7 @@ img:not([src]), img[src=""], img[src="null"] {
[REPLACE_CLASS_selectwrapper] [REPLACE_CLASS_select] { [REPLACE_CLASS_selectwrapper] [REPLACE_CLASS_select] {
flex: 1 1 auto; flex: 1 1 auto;
} }
[REPLACE_CLASS_selectwrapper] [REPLACE_CLASS_selectouter],
[REPLACE_CLASS_selectwrapper] [REPLACE_CLASS_selectsearchinput] { [REPLACE_CLASS_selectwrapper] [REPLACE_CLASS_selectsearchinput] {
width: 100%; width: 100%;
} }
@@ -1061,7 +1062,7 @@ input[REPLACE_CLASS_input][REPLACE_CLASS_inputerror] {
border-top: unset; border-top: unset;
border-bottom: 1px solid hsla(0,0%,100%,.1); border-bottom: 1px solid hsla(0,0%,100%,.1);
} }
[REPLACE_CLASS_modalwrapper] [REPLACE_CLASS_tabbarcontainer] { [REPLACE_CLASS_modal] [REPLACE_CLASS_tabbarcontainer] {
background: rgba(0, 0, 0, 0.1); background: rgba(0, 0, 0, 0.1);
border: none; border: none;
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.05); box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.05);
@@ -1069,7 +1070,7 @@ input[REPLACE_CLASS_input][REPLACE_CLASS_inputerror] {
margin: 0; margin: 0;
padding: 16px 16px 0 16px; padding: 16px 16px 0 16px;
} }
[REPLACE_CLASS_themedark] [REPLACE_CLASS_modalwrapper] [REPLACE_CLASS_tabbarcontainer] { [REPLACE_CLASS_themedark] [REPLACE_CLASS_modal] [REPLACE_CLASS_tabbarcontainer] {
background: rgba(0, 0, 0, 0.2); background: rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.1); box-shadow: 0 2px 3px 0 rgba(0, 0, 0, 0.1);
} }
@@ -1129,7 +1130,7 @@ input[REPLACE_CLASS_input][REPLACE_CLASS_inputerror] {
pointer-events: none; pointer-events: none;
} }
[REPLACE_CLASS__repomodalsettings] { [REPLACE_CLASS__repomodalsettings] {
padding: 0 16px 16px 16px; padding: 0 16px 16px 16px;
} }
[REPLACE_CLASS__repochangelogbutton] { [REPLACE_CLASS__repochangelogbutton] {
position: fixed; position: fixed;
@@ -1158,6 +1159,13 @@ input[REPLACE_CLASS_input][REPLACE_CLASS_inputerror] {
[REPLACE_CLASS__repolistscroller] { [REPLACE_CLASS__repolistscroller] {
padding-top: 0; padding-top: 0;
} }
[REPLACE_CLASS__repolistheader] [REPLACE_CLASS_tabbarcontainer] {
display: flex;
align-items: flex-start;
}
[REPLACE_CLASS__repolistheader] [REPLACE_CLASS_quickselectwrapper] {
line-height: 20px;
}
[REPLACE_CLASS__repoentry] [REPLACE_CLASS__repofooter] { [REPLACE_CLASS__repoentry] [REPLACE_CLASS__repofooter] {
display: flex; display: flex;
align-items: center; align-items: center;
@@ -1260,6 +1268,9 @@ input[REPLACE_CLASS_input][REPLACE_CLASS_inputerror] {
padding-top: 4px; padding-top: 4px;
} }
[REPLACE_CLASS_tooltiprow]:has([REPLACE_CLASS_usersummarycontainer]:empty) {
display: none;
}
[REPLACE_CLASS_tooltipnote] { [REPLACE_CLASS_tooltipnote] {
color: var(--text-muted); color: var(--text-muted);
font-size: 11px; font-size: 11px;
@@ -1269,8 +1280,7 @@ input[REPLACE_CLASS_input][REPLACE_CLASS_inputerror] {
[REPLACE_CLASS_tooltiplistitem][REPLACE_CLASS_tooltipcustom] { [REPLACE_CLASS_tooltiplistitem][REPLACE_CLASS_tooltipcustom] {
color: #fff; color: #fff;
} }
[REPLACE_CLASS_tooltip] [REPLACE_CLASS_tooltipcontent]:empty, [REPLACE_CLASS_tooltip]:has([REPLACE_CLASS_tooltipcontent]:empty) {
[REPLACE_CLASS_tooltip] [REPLACE_CLASS_tooltipcontent]:empty > * {
display: none !important; display: none !important;
} }
[REPLACE_CLASS_tooltip][REPLACE_CLASS_tooltipcustom] [REPLACE_CLASS_tooltipnote], [REPLACE_CLASS_tooltip][REPLACE_CLASS_tooltipcustom] [REPLACE_CLASS_tooltipnote],

View File

@@ -2,7 +2,7 @@
* @name EditRoles * @name EditRoles
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.1.4 * @version 1.1.7
* @description Allows you to locally edit Roles * @description Allows you to locally edit Roles
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -91,8 +91,8 @@ module.exports = (_ => {
if (guild) { if (guild) {
let colorRole, iconRole; let colorRole, iconRole;
for (let id of e.returnValue.roles) { for (let id of e.returnValue.roles) {
if (guild.roles[id] && guild.roles[id].colorString && (!colorRole || colorRole.position < guild.roles[id].position)) colorRole = guild.roles[id]; if (guild.roles[id] && (guild.roles[id].colorString || changedRoles[id] && changedRoles[id].color) && (!colorRole || colorRole.position < guild.roles[id].position)) colorRole = guild.roles[id];
if (guild.roles[id] && guild.roles[id].icon && (!iconRole || iconRole.position < guild.roles[id].position)) iconRole = guild.roles[id]; if (guild.roles[id] && (guild.roles[id].icon || changedRoles[id] && changedRoles[id].icon) && (!iconRole || iconRole.position < guild.roles[id].position)) iconRole = guild.roles[id];
} }
let color = colorRole && changedRoles[colorRole.id] && changedRoles[colorRole.id].color; let color = colorRole && changedRoles[colorRole.id] && changedRoles[colorRole.id].color;
if (color) e.returnValue = Object.assign({}, e.returnValue, {colorString: BDFDB.ColorUtils.convert(color, "HEX")}); if (color) e.returnValue = Object.assign({}, e.returnValue, {colorString: BDFDB.ColorUtils.convert(color, "HEX")});
@@ -177,6 +177,7 @@ module.exports = (_ => {
} }
onDeveloperContextMenu (e) { onDeveloperContextMenu (e) {
if (e.instance.props.label != BDFDB.LanguageUtils.LanguageStrings.COPY_ID_ROLE) return;
let guild = this.getGuildFromRoleId(e.instance.props.id); let guild = this.getGuildFromRoleId(e.instance.props.id);
if (guild) e.returnvalue.props.children = [ if (guild) e.returnvalue.props.children = [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
@@ -225,7 +226,7 @@ module.exports = (_ => {
processRichRoleMention (e) { processRichRoleMention (e) {
if (!e.instance.props.id || !changedRoles[e.instance.props.id]) return; if (!e.instance.props.id || !changedRoles[e.instance.props.id]) return;
e.returnvalue.props.color = changedRoles[e.instance.props.id].color ? BDFDB.ColorUtils.convert(changedRoles[e.instance.props.id].color, "int") : e.returnvalue.props.color; e.returnvalue.props.color = changedRoles[e.instance.props.id].color ? BDFDB.ColorUtils.convert(changedRoles[e.instance.props.id].color, "int") : e.returnvalue.props.color;
e.returnvalue.props.children[1] = changedRoles[e.instance.props.id].name || e.returnvalue.props.children[1]; e.returnvalue.props.children[2] = changedRoles[e.instance.props.id].name || e.returnvalue.props.children[1];
} }
processAutocompleteRoleResult (e) { processAutocompleteRoleResult (e) {
@@ -260,7 +261,7 @@ module.exports = (_ => {
} }
getGuildFromRoleId (roleId) { getGuildFromRoleId (roleId) {
return BDFDB.LibraryModules.SortedGuildUtils.getFlattenedGuilds().find(g => g.roles[roleId]); return BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuildIds().map(BDFDB.LibraryStores.GuildStore.getGuild).find(g => g.roles[roleId]);
} }
changeRolesInGuild (guild, useNative) { changeRolesInGuild (guild, useNative) {
@@ -289,7 +290,7 @@ module.exports = (_ => {
BDFDB.DataUtils.remove(this, "roles", id); BDFDB.DataUtils.remove(this, "roles", id);
} }
else { else {
for (let guild of BDFDB.LibraryModules.SortedGuildUtils.getFlattenedGuilds()) if (cachedRoles[guild.id]) guild.roles = cachedRoles[guild.id]; for (let guild of BDFDB.LibraryStores.SortedGuildStore.getFlattenedGuildIds().map(BDFDB.LibraryStores.GuildStore.getGuild)) if (cachedRoles[guild.id]) guild.roles = cachedRoles[guild.id];
cachedRoles = {}; cachedRoles = {};
BDFDB.DataUtils.remove(this, "roles"); BDFDB.DataUtils.remove(this, "roles");
} }
@@ -417,6 +418,11 @@ module.exports = (_ => {
callback(""); callback("");
BDFDB.ReactUtils.forceUpdate(instance); BDFDB.ReactUtils.forceUpdate(instance);
} }
else if (url.indexOf("data:") == 0) {
instance.props.success = true;
delete instance.props.errorMessage;
callback(url);
}
else instance.checkTimeout = BDFDB.TimeUtils.timeout(_ => { else instance.checkTimeout = BDFDB.TimeUtils.timeout(_ => {
BDFDB.LibraryRequires.request(url, {agentOptions: {rejectUnauthorized: false}}, (error, response, result) => { BDFDB.LibraryRequires.request(url, {agentOptions: {rejectUnauthorized: false}}, (error, response, result) => {
delete instance.checkTimeout; delete instance.checkTimeout;
@@ -474,10 +480,10 @@ module.exports = (_ => {
return { return {
confirm_reset: "Είστε βέβαιοι ότι θέλετε να επαναφέρετε αυτόν τον ρόλο;", confirm_reset: "Είστε βέβαιοι ότι θέλετε να επαναφέρετε αυτόν τον ρόλο;",
confirm_resetall: "Είστε βέβαιοι ότι θέλετε να επαναφέρετε όλους τους ρόλους;", confirm_resetall: "Είστε βέβαιοι ότι θέλετε να επαναφέρετε όλους τους ρόλους;",
context_localrolesettings: "Ρυθμίσεις τοπικού ρόλου", context_localrolesettings: "Ρυθμίσεις ρόλου {τοπικά)",
modal_header: "Ρυθμίσεις τοπικού ρόλου", modal_header: "Ρυθμίσεις ρόλου (τοπικά)",
submenu_resetsettings: "Επαναφορά ρόλου", submenu_resetsettings: "Επαναφορά ρόλου",
submenu_rolesettings: "Αλλαξε ρυθμίσεις" submenu_rolesettings: "Αλλαγή ρυθμίσεων"
}; };
case "es": // Spanish case "es": // Spanish
return { return {

View File

@@ -48,6 +48,7 @@
"userAvatars": true, "userAvatars": true,
"groupIcons": true, "groupIcons": true,
"guildIcons": true, "guildIcons": true,
"streamPreviews": true,
"emojis": true "emojis": true
}, },
"rescaleSettings": { "rescaleSettings": {
@@ -71,6 +72,7 @@
"jumpTo": true "jumpTo": true
}, },
"zoomSettings": { "zoomSettings": {
"clickMode": false,
"lensSize": 1459, "lensSize": 1459,
"pixelMode": false, "pixelMode": false,
"zoomLevel": 1.6000000000000014, "zoomLevel": 1.6000000000000014,

View File

@@ -2,7 +2,7 @@
* @name ImageUtilities * @name ImageUtilities
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 5.1.9 * @version 5.4.0
* @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.) * @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.)
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -25,9 +25,14 @@ module.exports = (_ => {
getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
downloadLibrary () { downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => {
if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); if (!r || r.status != 200) throw new Error();
else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); 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");
}); });
} }
@@ -65,8 +70,6 @@ module.exports = (_ => {
var cachedImages; var cachedImages;
var eventTypes = {}; var eventTypes = {};
const imgUrlReplaceString = "DEVILBRO_BD_REVERSEIMAGESEARCH_REPLACE_IMAGEURL";
const rescaleOptions = { const rescaleOptions = {
NONE: "No Resize", NONE: "No Resize",
ORIGINAL: "Resize to Original Size", ORIGINAL: "Resize to Original Size",
@@ -205,7 +208,7 @@ module.exports = (_ => {
}, },
viewerSettings: { viewerSettings: {
zoomMode: {value: true, description: "Enables Zoom Mode to zoom into Images while holding down your Mouse"}, zoomMode: {value: true, description: "Enables Zoom Mode to zoom into Images while holding down your Mouse"},
galleryMode: {value: true, description: "Enables Gallery Mode to quick-switch between Images"}, galleryMode: {value: true, description: "Enables Gallery Mode to quick-switch between Images"},
details: {value: true, description: "Adds Image Details (Name, Size, Amount)"}, details: {value: true, description: "Adds Image Details (Name, Size, Amount)"},
copyImage: {value: true, description: "Adds a 'Copy Image' Option"}, copyImage: {value: true, description: "Adds a 'Copy Image' Option"},
saveImage: {value: true, description: "Adds a 'Save Image as' Option"}, saveImage: {value: true, description: "Adds a 'Save Image as' Option"},
@@ -214,39 +217,41 @@ module.exports = (_ => {
galleryFilter: {}, galleryFilter: {},
zoomSettings: { zoomSettings: {
pixelMode: {value: false, label: "Uses Pixel Lens instead of a Blur Lens"}, pixelMode: {value: false, label: "Uses Pixel Lens instead of a Blur Lens"},
clickMode: {value: false, label: "Click Image to zoom instead of holding the Mouse Button"},
lensSize: {value: 200, digits: 0, minValue: 50, maxValue: 5000, unit: "px", label: "context_lenssize"}, lensSize: {value: 200, digits: 0, minValue: 50, maxValue: 5000, unit: "px", label: "context_lenssize"},
zoomLevel: {value: 2, digits: 1, minValue: 1, maxValue: 20, unit: "x", label: "ACCESSIBILITY_ZOOM_LEVEL_LABEL"}, zoomLevel: {value: 2, digits: 1, minValue: 1, maxValue: 20, unit: "x", label: "ACCESSIBILITY_ZOOM_LEVEL_LABEL"},
zoomSpeed: {value: 0.1, digits: 2, minValue: 0.01, maxValue: 1, unit: "", label: "context_zoomspeed"} zoomSpeed: {value: 0.1, digits: 2, minValue: 0.01, maxValue: 1, unit: "", label: "context_zoomspeed"}
}, },
rescaleSettings: { rescaleSettings: {
messages: {value: "NONE", description: "Messages"}, messages: {value: "NONE", description: "Messages"},
imageViewer: {value: "NONE", description: "Image Viewer"} imageViewer: {value: "NONE", description: "Image Viewer"}
}, },
detailsSettings: { detailsSettings: {
footnote: {value: true, description: "in the Image Description"}, footnote: {value: true, description: "in the Image Description"},
tooltip: {value: false, description: "as a Hover Tooltip"}, tooltip: {value: false, description: "as a Hover Tooltip"},
tooltipDelay: {value: 0, min: 0, description: "Image Tooltip Delay (in ms)"} tooltipDelay: {value: 0, min: 0, description: "Image Tooltip Delay (in ms)"}
}, },
places: { places: {
userAvatars: {value: true, description: "User Avatars"}, userAvatars: {value: true, description: "User Avatars"},
groupIcons: {value: true, description: "Group Icons"}, groupIcons: {value: true, description: "Group Icons"},
guildIcons: {value: true, description: "Server Icons"}, guildIcons: {value: true, description: "Server Icons"},
streamPreviews: {value: true, description: "Stream Previews"},
emojis: {value: true, description: "Custom Emojis/Emotes"} emojis: {value: true, description: "Custom Emojis/Emotes"}
}, },
engines: { engines: {
_all: {value: true, name: BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL, url: null}, _all: {value: true, name: BDFDB.LanguageUtils.LanguageStrings.FORM_LABEL_ALL, url: null},
Baidu: {value: true, name: "Baidu", url: "http://image.baidu.com/pcdutu?queryImageUrl=" + imgUrlReplaceString}, Baidu: {value: true, name: "Baidu", url: "http://image.baidu.com/pcdutu?queryImageUrl="},
Bing: {value: true, name: "Bing", url: "https://www.bing.com/images/search?q=imgurl:" + imgUrlReplaceString + "&view=detailv2&iss=sbi&FORM=IRSBIQ"}, Bing: {value: true, name: "Bing", url: "https://www.bing.com/images/search?view=detailv2&iss=sbi&FORM=IRSBIQ&q=imgurl:"},
Google: {value: true, name: "Google", url: "https://www.google.com/searchbyimage?sbisrc=1&image_url=" + imgUrlReplaceString}, Google: {value: true, name: "Google", url: "https://www.google.com/searchbyimage?sbisrc=cr_1&image_url="},
GoogleLens: {value: true, name: "Google Lens", url: "https://lens.google.com/uploadbyurl?url=" + imgUrlReplaceString}, GoogleLens: {value: true, name: "Google Lens", url: "https://lens.google.com/uploadbyurl?url="},
ImgOps: {value: true, name: "ImgOps", raw: true, url: "https://imgops.com/specialized+reverse/" + imgUrlReplaceString}, ImgOps: {value: true, name: "ImgOps", raw: true, url: "https://imgops.com/specialized+reverse/"},
IQDB: {value: true, name: "IQDB", url: "https://iqdb.org/?url=" + imgUrlReplaceString}, IQDB: {value: true, name: "IQDB", url: "https://iqdb.org/?url="},
Reddit: {value: true, name: "Reddit", url: "http://karmadecay.com/search?q=" + imgUrlReplaceString}, Reddit: {value: true, name: "Reddit", url: "http://karmadecay.com/search?q="},
SauceNAO: {value: true, name: "SauceNAO", url: "https://saucenao.com/search.php?db=999&url=" + imgUrlReplaceString}, SauceNAO: {value: true, name: "SauceNAO", url: "https://saucenao.com/search.php?db=999&url="},
Sogou: {value: true, name: "Sogou", url: "http://pic.sogou.com/ris?flag=1&drag=0&query=" + imgUrlReplaceString + "&flag=1"}, Sogou: {value: true, name: "Sogou", url: "http://pic.sogou.com/ris?flag=1&drag=0&flag=1&query="},
TinEye: {value: true, name: "TinEye", url: "https://tineye.com/search?url=" + imgUrlReplaceString}, TinEye: {value: true, name: "TinEye", url: "https://tineye.com/search?url="},
WhatAnime: {value: true, name: "WhatAnime", url: "https://trace.moe/?url=" + imgUrlReplaceString}, WhatAnime: {value: true, name: "WhatAnime", url: "https://trace.moe/?url="},
Yandex: {value: true, name: "Yandex", url: "https://yandex.com/images/search?url=" + imgUrlReplaceString + "&rpt=imageview"} Yandex: {value: true, name: "Yandex", url: "https://yandex.com/images/search?rpt=imageview&url="}
} }
}; };
@@ -280,10 +285,14 @@ module.exports = (_ => {
}; };
this.css = ` this.css = `
${BDFDB.dotCN._imageutilitiesimagedetailsadded} {
max-height: unset !important;
}
${BDFDB.dotCNS._imageutilitiesimagedetailsadded + BDFDB.dotCN.imagewrapper} { ${BDFDB.dotCNS._imageutilitiesimagedetailsadded + BDFDB.dotCN.imagewrapper} {
border-radius: 8px !important; border-radius: 8px !important;
height: calc(100% - 1rem - 16px) !important; height: calc(100% - 1rem - 16px) !important;
max-height: unset !important; max-height: unset !important;
margin-left: unset !important;
} }
${BDFDB.dotCNS._imageutilitiesimagedetailsadded + BDFDB.dotCN.imagealttextcontainer} { ${BDFDB.dotCNS._imageutilitiesimagedetailsadded + BDFDB.dotCN.imagealttextcontainer} {
bottom: calc(1rem + 16px) !important; bottom: calc(1rem + 16px) !important;
@@ -695,16 +704,22 @@ module.exports = (_ => {
if (!this.settings.places.guildIcons || !e.instance.props.guild) return; if (!this.settings.places.guildIcons || !e.instance.props.guild) return;
if (BDFDB.DOMUtils.getParent(BDFDB.dotCNC.guildheader + BDFDB.dotCN.guildchannels, e.instance.props.target) && (!e.instance.props.target.className && e.instance.props.target.parentElement.firstElementChild == e.instance.props.target) || (e.instance.props.target.className && e.instance.props.target.className.indexOf(BDFDB.disCN.guildheaderbanneranimatedhoverlayer) > -1)) { if (BDFDB.DOMUtils.getParent(BDFDB.dotCNC.guildheader + BDFDB.dotCN.guildchannels, e.instance.props.target) && (!e.instance.props.target.className && e.instance.props.target.parentElement.firstElementChild == e.instance.props.target) || (e.instance.props.target.className && e.instance.props.target.className.indexOf(BDFDB.disCN.guildheaderbanneranimatedhoverlayer) > -1)) {
let banner = BDFDB.GuildUtils.getBanner(e.instance.props.guild.id); let banner = BDFDB.GuildUtils.getBanner(e.instance.props.guild.id);
if (banner) this.injectItem(e, [banner.replace(/\.webp|\.gif/, ".png"), e.instance.props.guild.banner && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.guild.banner) && banner.replace(/\.webp|\.png/, ".gif")], BDFDB.LanguageUtils.LibraryStrings.guildbanner); if (banner) this.injectItem(e, [banner.replace(/\.webp|\.gif/, ".png"), e.instance.props.guild.banner && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.guild.banner) && banner.replace(/\.webp|\.png/, ".gif")], {prefix: BDFDB.LanguageUtils.LibraryStrings.guildbanner, id: "banner"});
} }
else if (!BDFDB.DOMUtils.getParent(BDFDB.dotCN.channels, e.instance.props.target)) this.injectItem(e, [(e.instance.props.guild.getIconURL(4096) || "").replace(/\.webp|\.gif/, ".png"), e.instance.props.guild.icon && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.guild.icon) && e.instance.props.guild.getIconURL(4096, true)], BDFDB.LanguageUtils.LibraryStrings.guildicon); else if (!BDFDB.DOMUtils.getParent(BDFDB.dotCN.channels, e.instance.props.target)) this.injectItem(e, [(e.instance.props.guild.getIconURL(4096) || "").replace(/\.webp|\.gif/, ".png"), e.instance.props.guild.icon && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.guild.icon) && e.instance.props.guild.getIconURL(4096, true)], {prefix: BDFDB.LanguageUtils.LibraryStrings.guildicon, id: "icon"});
} }
onUserContextMenu (e) { onUserContextMenu (e) {
if (!this.settings.places.userAvatars || !e.instance.props.user) return; if (this.settings.places.userAvatars && e.instance.props.user) {
const guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId(); const guildId = BDFDB.LibraryStores.SelectedGuildStore.getGuildId();
const member = BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, e.instance.props.user.id); const member = BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, e.instance.props.user.id);
this.injectItem(e, [(e.instance.props.user.getAvatarURL(null, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(null, 4096, true), (e.instance.props.user.getAvatarURL(guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), member && member.avatar && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(member.avatar) && e.instance.props.user.getAvatarURL(guildId, 4096, true)]); this.injectItem(e, [(e.instance.props.user.getAvatarURL(null, 4096) || "").replace(/\.webp|\.gif/, ".png"), BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(e.instance.props.user.avatar) && e.instance.props.user.getAvatarURL(null, 4096, true), (e.instance.props.user.getAvatarURL(guildId, 4096) || "").replace(/\.webp|\.gif/, ".png"), member && member.avatar && BDFDB.LibraryModules.IconUtils.isAnimatedIconHash(member.avatar) && e.instance.props.user.getAvatarURL(guildId, 4096, true)]);
}
if (this.settings.places.streamPreviews && e.instance.props.user) {
let stream = BDFDB.LibraryStores.ApplicationStreamingStore.getAnyStreamForUser(e.instance.props.user.id);
let previewUrl = stream && BDFDB.LibraryStores.ApplicationStreamPreviewStore.getPreviewURL(stream.guildId, stream.channelId, stream.ownerId);
if (previewUrl) this.injectItem(e, [previewUrl], {id: "stream", label: this.labels.context_streamactions});
}
} }
onGroupDMContextMenu (e) { onGroupDMContextMenu (e) {
@@ -720,20 +735,20 @@ module.exports = (_ => {
onMessageContextMenu (e) { onMessageContextMenu (e) {
if (!e.instance.props.message || !e.instance.props.channel || !e.instance.props.target) return; if (!e.instance.props.message || !e.instance.props.channel || !e.instance.props.target) return;
const target = e.instance.props.target.tagName == "A" && BDFDB.DOMUtils.containsClass(e.instance.props.target, BDFDB.disCN.imageoriginallink) && e.instance.props.target.parentElement.querySelector("img") || (BDFDB.DOMUtils.getParent(BDFDB.dotCN.messageattachment, e.instance.props.target) || e.instance.props.target).querySelector("img, video") || e.instance.props.target; const target = e.instance.props.target.tagName == "A" && BDFDB.DOMUtils.containsClass(e.instance.props.target, BDFDB.disCN.imageoriginallink) && e.instance.props.target.parentElement.querySelector("img") || (BDFDB.DOMUtils.getParent(BDFDB.dotCN.messageattachment, e.instance.props.target) || e.instance.props.target).querySelector("img, video") || e.instance.props.target;
if (target.tagName == "A" && e.instance.props.message.embeds && e.instance.props.message.embeds[0] && (e.instance.props.message.embeds[0].type == "image" || e.instance.props.message.embeds[0].type == "video" || e.instance.props.message.embeds[0].type == "gifv")) this.injectItem(e, [target.href], null, true); if (target.tagName == "A" && e.instance.props.message.embeds && e.instance.props.message.embeds[0] && (e.instance.props.message.embeds[0].type == "image" || e.instance.props.message.embeds[0].type == "video" || e.instance.props.message.embeds[0].type == "gifv")) this.injectItem(e, [target.href], {isNative: true});
else if (target.tagName == "IMG" && target.complete && target.naturalHeight) { else if (target.tagName == "IMG" && target.complete && target.naturalHeight) {
if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.imagewrapper, target) || BDFDB.DOMUtils.containsClass(target, BDFDB.disCN.imagesticker)) this.injectItem(e, [{file: target.src, original: this.getTargetLink(e.instance.props.target) || this.getTargetLink(target)}], null, true); if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.imagewrapper, target) || BDFDB.DOMUtils.containsClass(target, BDFDB.disCN.imagesticker)) this.injectItem(e, [{file: target.src, original: this.getTargetLink(e.instance.props.target) || this.getTargetLink(target)}], {isNative: true});
else if (BDFDB.DOMUtils.containsClass(target, BDFDB.disCN.embedauthoricon) && this.settings.places.userAvatars) this.injectItem(e, [target.src], null, true); else if (BDFDB.DOMUtils.containsClass(target, BDFDB.disCN.embedauthoricon) && this.settings.places.userAvatars) this.injectItem(e, [target.src], {isNative: true});
else if (BDFDB.DOMUtils.containsClass(target, BDFDB.disCN.emojiold, "emote", false) && this.settings.places.emojis) this.injectItem(e, [{file: target.src, alternativeName: target.getAttribute("data-name")}], null, true); else if (BDFDB.DOMUtils.containsClass(target, BDFDB.disCN.emojiold, "emote", false) && this.settings.places.emojis) this.injectItem(e, [{file: target.src, alternativeName: target.getAttribute("data-name")}], {isNative: true});
} }
else if (target.tagName == "VIDEO") { else if (target.tagName == "VIDEO") {
if (BDFDB.DOMUtils.containsClass(target, BDFDB.disCN.embedvideo) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.attachmentvideo, target)) this.injectItem(e, [{file: target.src, original: this.getTargetLink(e.instance.props.target) || this.getTargetLink(target)}], null, true); if (BDFDB.DOMUtils.containsClass(target, BDFDB.disCN.embedvideo) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.attachmentvideo, target)) this.injectItem(e, [{file: target.src, original: this.getTargetLink(e.instance.props.target) || this.getTargetLink(target)}], {isNative: true});
} }
else { else {
const reaction = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagereaction, target); const reaction = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagereaction, target);
if (reaction && this.settings.places.emojis) { if (reaction && this.settings.places.emojis) {
const emoji = reaction.querySelector(BDFDB.dotCN.emojiold); const emoji = reaction.querySelector(BDFDB.dotCN.emojiold);
if (emoji) this.injectItem(e, [{file: emoji.src, alternativeName: emoji.getAttribute("data-name")}], null, true); if (emoji) this.injectItem(e, [{file: emoji.src, alternativeName: emoji.getAttribute("data-name")}], {isNative: true});
} }
} }
} }
@@ -745,14 +760,13 @@ module.exports = (_ => {
return href || src; return href || src;
} }
injectItem (e, urls, prefix, isNative = false) { injectItem (e, urls, config = {}) {
let validUrls = this.filterUrls(...urls); let validUrls = this.filterUrls(...urls);
if (!validUrls.length) return; if (!validUrls.length) return;
let [nativeParent, nativeIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "copy-native-link", group: true}); let [nativeParent, nativeIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "copy-native-link", group: true});
if (nativeIndex > -1) { if (nativeIndex > -1) {
if (validUrls.length == 1) isNative = true; if (validUrls.length == 1) config.isNative = true;
nativeParent.splice(nativeIndex, 1); nativeParent.splice(nativeIndex, 1);
nativeIndex -= 1;
} }
for (let id of ["open-native-link", "copy-image", "save-image"]) { for (let id of ["open-native-link", "copy-image", "save-image"]) {
let [removeParent, removeIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: id, group: true}); let [removeParent, removeIndex] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: id, group: true});
@@ -762,15 +776,15 @@ module.exports = (_ => {
let subMenu = this.createSubMenus({ let subMenu = this.createSubMenus({
instance: e.instance, instance: e.instance,
urls: validUrls, urls: validUrls,
prefix: prefix, prefix: config.prefix,
target: e.instance.props.target target: e.instance.props.target
}); });
let [children, index] = isNative && nativeIndex > -1 ? [nativeParent, nativeIndex] : BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true}); let [children, index] = config.isNative && nativeIndex > -1 ? [nativeParent, nativeIndex] : BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "devmode-copy-id", group: true});
children.splice(index > -1 ? index : children.length, 0, isNative ? subMenu : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { children.splice(index > -1 ? index : children.length, 0, config.isNative && nativeIndex > -1 ? subMenu : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { children: BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.isValid(validUrls[0].file, "video") ? this.labels.context_videoactions : this.labels.context_imageactions, label: config.label || (this.isValid(validUrls[0].file, "video") ? this.labels.context_videoactions : this.labels.context_imageactions),
id: BDFDB.ContextMenuUtils.createItemId(this.name, "main-subitem"), id: BDFDB.ContextMenuUtils.createItemId(this.name, config.id, "main-subitem"),
children: subMenu children: subMenu
}) })
})); }));
@@ -794,8 +808,14 @@ module.exports = (_ => {
isValid (url, type) { isValid (url, type) {
if (!url) return false; if (!url) return false;
const file = url && (BDFDB.LibraryModules.URLParser.parse(url).pathname || "").split("%3A")[0].toLowerCase(); if (url && url.indexOf("data:") == 0 && url.indexOf("base64") > -1) {
return file && (!type && (url.indexOf("discord.com/streams/guild:") > -1 || url.indexOf("discordapp.com/streams/guild:") > -1 || url.indexOf("discordapp.net/streams/guild:") > -1 || url.startsWith("https://images-ext-1.discordapp.net/") || url.startsWith("https://images-ext-2.discordapp.net/") || Object.keys(fileTypes).some(t => file.endsWith(`/${t}`) || file.endsWith(`.${t}`))) || type && Object.keys(fileTypes).filter(t => fileTypes[t][type]).some(t => file.endsWith(`/${t}`) || file.endsWith(`.${t}`))); const fileType = (url.split("/")[1] || "").split(";")[0];
return !type && fileTypes[fileType] || type && type != "searchable" && fileTypes[fileType] && fileTypes[fileType][type];
}
else {
const file = url && (BDFDB.LibraryModules.URLParser.parse(url).pathname || "").split("%3A")[0].toLowerCase();
return file && (!type && (url.indexOf("discord.com/streams/guild:") > -1 || url.indexOf("discordapp.com/streams/guild:") > -1 || url.indexOf("discordapp.net/streams/guild:") > -1 || url.startsWith("https://images-ext-1.discordapp.net/") || url.startsWith("https://images-ext-2.discordapp.net/") || Object.keys(fileTypes).some(t => file.endsWith(`/${t}`) || file.endsWith(`.${t}`))) || ((type == "copyable" || type == "searchable") && (url.indexOf("discord.com/streams/guild:") > -1 || url.indexOf("discordapp.com/streams/guild:") > -1 || url.indexOf("discordapp.net/streams/guild:") > -1)) || type && Object.keys(fileTypes).filter(t => fileTypes[t][type]).some(t => file.endsWith(`/${t}`) || file.endsWith(`.${t}`)));
}
} }
getPosterUrl (url) { getPosterUrl (url) {
@@ -822,11 +842,12 @@ module.exports = (_ => {
return BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { return BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [ children: [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { urlData.original && urlData.original.indexOf("data:") != 0 && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_LINK, label: BDFDB.LanguageUtils.LanguageStrings.COPY_LINK,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-link"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-link"),
action: _ => { action: _ => {
let url = urlData.original.split("?width")[0].split("?height")[0].split("?size")[0]; let url = this.removeSizeInUrl(urlData.original);
url = this.removeFormatInUrl(url);
url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url; url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url;
BDFDB.LibraryModules.WindowUtils.copy(url); BDFDB.LibraryModules.WindowUtils.copy(url);
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"}); BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
@@ -836,13 +857,14 @@ module.exports = (_ => {
label: BDFDB.LanguageUtils.LanguageStrings.COPY_MEDIA_LINK, label: BDFDB.LanguageUtils.LanguageStrings.COPY_MEDIA_LINK,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-media-link"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-media-link"),
action: _ => { action: _ => {
let url = urlData.file.split("?width")[0].split("?height")[0].split("?size")[0]; let url = this.removeSizeInUrl(urlData.file);
url = this.removeFormatInUrl(url);
url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url; url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url;
BDFDB.LibraryModules.WindowUtils.copy(url); BDFDB.LibraryModules.WindowUtils.copy(url);
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"}); BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"});
} }
}), }),
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { urlData.original && urlData.original.indexOf("data:") != 0 && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: BDFDB.LanguageUtils.LanguageStrings.OPEN_LINK, label: BDFDB.LanguageUtils.LanguageStrings.OPEN_LINK,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "open-link"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "open-link"),
action: _ => BDFDB.DiscordUtils.openLink(urlData.original) action: _ => BDFDB.DiscordUtils.openLink(urlData.original)
@@ -850,7 +872,7 @@ module.exports = (_ => {
!this.isValid(urlData.file, "copyable") ? null : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { !this.isValid(urlData.file, "copyable") ? null : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_copy.replace("{{var0}}", type), label: this.labels.context_copy.replace("{{var0}}", type),
id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-file"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-file"),
action: _ => this.copyFile({url: urlData.src, fallbackUrl: urlData.file || urlData.original}) action: _ => this.copyFile({url: urlData.original, fallbackUrl: urlData.src})
}), }),
!document.querySelector(BDFDB.dotCN.imagemodal) && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { !document.querySelector(BDFDB.dotCN.imagemodal) && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_view.replace("{{var0}}", type), label: this.labels.context_view.replace("{{var0}}", type),
@@ -867,7 +889,7 @@ module.exports = (_ => {
"aria-label": BDFDB.LanguageUtils.LanguageStrings.IMAGE, "aria-label": BDFDB.LanguageUtils.LanguageStrings.IMAGE,
children: isVideo ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ImageVideoModal, { children: isVideo ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ImageVideoModal, {
src: imageThrowaway.src, src: imageThrowaway.src,
poster: this.getPosterUrl(imageThrowaway.src), poster: _this.getPosterUrl(imageThrowaway.src),
width: this.videoWidth, width: this.videoWidth,
naturalWidth: this.videoWidth, naturalWidth: this.videoWidth,
height: this.videoHeight, height: this.videoHeight,
@@ -890,12 +912,12 @@ module.exports = (_ => {
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
label: this.labels.context_saveas.replace("{{var0}}", type), label: this.labels.context_saveas.replace("{{var0}}", type),
id: BDFDB.ContextMenuUtils.createItemId(this.name, "download-file-as"), id: BDFDB.ContextMenuUtils.createItemId(this.name, "download-file-as"),
action: _ => this.downloadFile({url: urlData.src, fallbackUrl: urlData.file || urlData.original}, null, urlData.alternativeName), action: _ => this.downloadFile({url: urlData.original, fallbackUrl: urlData.src}, null, urlData.alternativeName),
children: locations.length && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { children: locations.length && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: locations.map((name, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { children: locations.map((name, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "download", name, i), id: BDFDB.ContextMenuUtils.createItemId(this.name, "download", name, i),
label: name, label: name,
action: _ => this.downloadFile({url: urlData.src, fallbackUrl: urlData.file || urlData.original}, ownLocations[name].location, urlData.alternativeName) action: _ => this.downloadFile({url: urlData.original, fallbackUrl: urlData.src}, ownLocations[name].location, urlData.alternativeName)
})) }))
}) })
}), }),
@@ -905,7 +927,7 @@ module.exports = (_ => {
persisting: true, persisting: true,
action: event => { action: event => {
if (!event.shiftKey) BDFDB.ContextMenuUtils.close(instance); if (!event.shiftKey) BDFDB.ContextMenuUtils.close(instance);
BDFDB.DiscordUtils.openLink(this.defaults.engines[engineKeys[0]].url.replace(imgUrlReplaceString, encodeURIComponent(urlData.original)), { BDFDB.DiscordUtils.openLink(this.defaults.engines[engineKeys[0]].url + encodeURIComponent(urlData.original), {
minimized: event.shiftKey minimized: event.shiftKey
}); });
} }
@@ -922,7 +944,7 @@ module.exports = (_ => {
color: key == "_all" ? BDFDB.DiscordConstants.MenuItemColors.DANGER : BDFDB.DiscordConstants.MenuItemColors.DEFAULT, color: key == "_all" ? BDFDB.DiscordConstants.MenuItemColors.DANGER : BDFDB.DiscordConstants.MenuItemColors.DEFAULT,
persisting: true, persisting: true,
action: event => { action: event => {
const open = (url, k) => BDFDB.DiscordUtils.openLink(this.defaults.engines[k].url.replace(imgUrlReplaceString, this.defaults.engines[k].raw ? url : encodeURIComponent(url)), {minimized: event.shiftKey}); const open = (url, k) => BDFDB.DiscordUtils.openLink(this.defaults.engines[k].url + (this.defaults.engines[k].raw ? url : encodeURIComponent(url)), {minimized: event.shiftKey});
if (!event.shiftKey) BDFDB.ContextMenuUtils.close(instance); if (!event.shiftKey) BDFDB.ContextMenuUtils.close(instance);
if (key == "_all") { if (key == "_all") {
for (let key2 in enginesWithoutAll) open(urlData.original, key2); for (let key2 in enginesWithoutAll) open(urlData.original, key2);
@@ -1020,7 +1042,7 @@ module.exports = (_ => {
children: this.labels.context_saveas.replace("{{var0}}", type), children: this.labels.context_saveas.replace("{{var0}}", type),
onClick: event => { onClick: event => {
BDFDB.ListenerUtils.stopEvent(event); BDFDB.ListenerUtils.stopEvent(event);
this.downloadFile({url: url}); this.downloadFile({url: e.instance.props.original, fallbackUrl: url});
}, },
onContextMenu: event => { onContextMenu: event => {
let locations = Object.keys(ownLocations).filter(n => ownLocations[n].enabled); let locations = Object.keys(ownLocations).filter(n => ownLocations[n].enabled);
@@ -1028,7 +1050,7 @@ module.exports = (_ => {
children: locations.map((name, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { children: locations.map((name, i) => BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "download", name, i), id: BDFDB.ContextMenuUtils.createItemId(this.name, "download", name, i),
label: name, label: name,
action: _ => this.downloadFile({url: url}, ownLocations[name].location) action: _ => this.downloadFile({url: e.instance.props.original, fallbackUrl: url}, ownLocations[name].location)
})) }))
})); }));
} }
@@ -1045,7 +1067,7 @@ module.exports = (_ => {
children: this.labels.context_copy.replace("{{var0}}", type), children: this.labels.context_copy.replace("{{var0}}", type),
onClick: event => { onClick: event => {
BDFDB.ListenerUtils.stopEvent(event); BDFDB.ListenerUtils.stopEvent(event);
this.copyFile({url: url}); this.copyFile({url: e.instance.props.original, fallbackUrl: url});
} }
}) })
], ],
@@ -1088,7 +1110,7 @@ module.exports = (_ => {
className: BDFDB.disCN._imageutilitiesdetailswrapper, className: BDFDB.disCN._imageutilitiesdetailswrapper,
children: [ children: [
e.instance.props.alt && {label: "Alt", text: e.instance.props.alt}, e.instance.props.alt && {label: "Alt", text: e.instance.props.alt},
{label: "Source", text: url.split("?width")[0].split("?height")[0].split("?size")[0]}, {label: "Source", text: this.removeSizeInUrl(this.removeFormatInUrl(url))},
{label: "Size", text: `${e.instance.props.width}x${e.instance.props.height}px`}, {label: "Size", text: `${e.instance.props.width}x${e.instance.props.height}px`},
cachedImages && cachedImages.amount && cachedImages.amount > 1 && {label: filterForVideos ? "Video" : "Image", text: `${cachedImages.index + 1 || 1} of ${cachedImages.amount}`} cachedImages && cachedImages.amount && cachedImages.amount > 1 && {label: filterForVideos ? "Video" : "Image", text: `${cachedImages.index + 1 || 1} of ${cachedImages.amount}`}
].filter(n => n).map(data => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextElement, { ].filter(n => n).map(data => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TextElement, {
@@ -1189,6 +1211,7 @@ module.exports = (_ => {
processLazyImage (e) { processLazyImage (e) {
if (e.node) { if (e.node) {
if (!e.instance.props.src.split("?")[0].endsWith(".gif") && !e.instance.props.animated && !e.instance.props.children) for (let ele of [e.node.src && e.node, ...e.node.querySelectorAll("[src]")].filter(n => n)) ele.src = this.removeFormatInUrl(ele.src);
if (e.instance.props.resized) { if (e.instance.props.resized) {
for (let selector of ["embedfull", "embedinlinemedia", "embedgridcontainer", "imagemosaicattachmentscontainer", "imagemosaiconebyonegridsingle"]) { for (let selector of ["embedfull", "embedinlinemedia", "embedgridcontainer", "imagemosaicattachmentscontainer", "imagemosaiconebyonegridsingle"]) {
let parent = BDFDB.DOMUtils.getParent(BDFDB.dotCN[selector], e.node); let parent = BDFDB.DOMUtils.getParent(BDFDB.dotCN[selector], e.node);
@@ -1201,9 +1224,9 @@ module.exports = (_ => {
ele.style.setProperty("height", e.instance.props.height + "px"); ele.style.setProperty("height", e.instance.props.height + "px");
ele.style.setProperty("max-height", e.instance.props.height + "px"); ele.style.setProperty("max-height", e.instance.props.height + "px");
} }
for (let ele of [e.node.src && e.node, ...e.node.querySelectorAll("[src]")].filter(n => n)) ele.src = ele.src.split("?width")[0].split("?height")[0].split("?size")[0]; for (let ele of [e.node.src && e.node, ...e.node.querySelectorAll("[src]")].filter(n => n)) ele.src = this.removeSizeInUrl(ele.src);
if (e.instance.state.readyState != BDFDB.LibraryComponents.ImageComponents.ImageReadyStates.READY) { if (e.instance.state.readyState != BDFDB.DiscordConstants.ImageReadyStates.READY) {
e.instance.state.readyState = BDFDB.LibraryComponents.ImageComponents.ImageReadyStates.READY; e.instance.state.readyState = BDFDB.DiscordConstants.ImageReadyStates.READY;
BDFDB.ReactUtils.forceUpdate(e.instance); BDFDB.ReactUtils.forceUpdate(e.instance);
} }
} }
@@ -1229,7 +1252,8 @@ module.exports = (_ => {
if (this.isValid(e.instance.props.src, "gif")) e.node.style.setProperty("pointer-events", "none"); if (this.isValid(e.instance.props.src, "gif")) e.node.style.setProperty("pointer-events", "none");
if (this.settings.viewerSettings.zoomMode && typeof e.instance.props.children != "function" && !BDFDB.DOMUtils.containsClass(e.node.parentElement, BDFDB.disCN._imageutilitiessibling)) { if (this.settings.viewerSettings.zoomMode && typeof e.instance.props.children != "function" && !BDFDB.DOMUtils.containsClass(e.node.parentElement, BDFDB.disCN._imageutilitiessibling)) {
e.node.style.setProperty("cursor", "zoom-in"); e.node.style.setProperty("cursor", "zoom-in");
e.node.addEventListener("mousedown", event => { e.node.addEventListener(this.settings.zoomSettings.clickMode ? "click" : "mousedown", event => {
BDFDB.ListenerUtils.stopEvent(event);
if (event.which != 1 || e.node.querySelector("video")) return; if (event.which != 1 || e.node.querySelector("video")) return;
let vanishObserver; let vanishObserver;
@@ -1238,7 +1262,7 @@ module.exports = (_ => {
let imgRects = BDFDB.DOMUtils.getRects(e.node.firstElementChild); let imgRects = BDFDB.DOMUtils.getRects(e.node.firstElementChild);
let lens = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN._imageutilitieslense}" style="border-radius: 50% !important; pointer-events: none !important; z-index: 10000 !important; width: ${this.settings.zoomSettings.lensSize}px !important; height: ${this.settings.zoomSettings.lensSize}px !important; position: fixed !important;"><div style="position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;"><${e.node.firstElementChild.tagName} src="${!this.isValid(e.instance.props.src, "video") ? e.instance.props.src : this.getPosterUrl(e.instance.props.src)}" style="width: ${imgRects.width * zoomLevel}px; height: ${imgRects.height * zoomLevel}px; position: fixed !important;${this.settings.zoomSettings.pixelMode ? " image-rendering: pixelated !important;" : ""}"${e.node.firstElementChild.tagName == "VIDEO" ? " loop autoplay" : ""}></${e.node.firstElementChild.tagName}></div></div>`); let lens = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN._imageutilitieslense}" style="border-radius: 50% !important; pointer-events: none !important; z-index: 10000 !important; width: ${this.settings.zoomSettings.lensSize}px !important; height: ${this.settings.zoomSettings.lensSize}px !important; position: fixed !important;"><div style="position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important;"><${e.node.firstElementChild.tagName} src="${!this.isValid(e.instance.props.src, "video") ? e.instance.props.src : this.getPosterUrl(e.instance.props.src)}" style="width: ${imgRects.width * zoomLevel}px; height: ${imgRects.height * zoomLevel}px; position: fixed !important;${this.settings.zoomSettings.pixelMode ? " image-rendering: pixelated !important;" : ""}"${e.node.firstElementChild.tagName == "VIDEO" ? " loop autoplay" : ""}></${e.node.firstElementChild.tagName}></div></div>`);
let pane = lens.firstElementChild.firstElementChild; let pane = lens.firstElementChild.firstElementChild;
let backdrop = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN._imageutilitieslensebackdrop}" style="background: rgba(0, 0, 0, 0.3) !important; position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; pointer-events: none !important; z-index: 8000 !important;"></div>`); let backdrop = BDFDB.DOMUtils.create(`<div class="${BDFDB.disCN._imageutilitieslensebackdrop}" style="background: rgba(0, 0, 0, 0.3) !important; position: absolute !important; top: 0 !important; right: 0 !important; bottom: 0 !important; left: 0 !important; pointer-events: all !important; z-index: 8000 !important;"></div>`);
let appMount = document.querySelector(BDFDB.dotCN.appmount); let appMount = document.querySelector(BDFDB.dotCN.appmount);
appMount.appendChild(lens); appMount.appendChild(lens);
appMount.appendChild(backdrop); appMount.appendChild(backdrop);
@@ -1265,15 +1289,12 @@ module.exports = (_ => {
}; };
lens.update(); lens.update();
for (let ele of [e.node, document.querySelector(BDFDB.dotCN.imagemodal)]) if (ele) ele.style.setProperty("pointer-events", "none", "important");
let dragging = event2 => { let dragging = event2 => {
event = event2; event = event2;
lens.update(); lens.update();
}; };
let releasing = event2 => { let releasing = event2 => {
BDFDB.ListenerUtils.stopEvent(event2); BDFDB.ListenerUtils.stopEvent(event2);
for (let ele of [e.node, document.querySelector(BDFDB.dotCN.imagemodal)]) if (ele) ele.style.removeProperty("pointer-events");
this.cleanupListeners("Zoom"); this.cleanupListeners("Zoom");
document.removeEventListener("mousemove", dragging); document.removeEventListener("mousemove", dragging);
document.removeEventListener("mouseup", releasing); document.removeEventListener("mouseup", releasing);
@@ -1340,7 +1361,7 @@ module.exports = (_ => {
e.instance.props.resized = true; e.instance.props.resized = true;
} }
} }
if (this.settings.rescaleSettings.messages != "NONE" && (!e.instance.props.className || e.instance.props.className.indexOf(BDFDB.disCN.embedthumbnail) == -1) && (!e.instance.props.containerClassName || e.instance.props.containerClassName.indexOf(BDFDB.disCN.embedthumbnail) == -1 && e.instance.props.containerClassName.indexOf(BDFDB.disCN.embedvideoimagecomponent) == -1) && BDFDB.ReactUtils.findOwner(reactInstance, {name: "LazyImageZoomable", up: true}) && (e.instance.props.mediaLayoutType != "MOSAIC" || (BDFDB.ReactUtils.findValue(reactInstance, "attachments", {up: true}) || []).length < 2)) { if (this.settings.rescaleSettings.messages != "NONE" && [e.instance.props.className, e.instance.props.containerClassName].every(n => [BDFDB.disCN.embedvideoimagecomponent, BDFDB.disCN.embedthumbnail].every(m => (n || "").indexOf(m) == -1)) && BDFDB.ReactUtils.findOwner(reactInstance, {name: "LazyImageZoomable", up: true}) && (e.instance.props.mediaLayoutType != "MOSAIC" || (BDFDB.ReactUtils.findValue(reactInstance, "message", {up: true}) || {attachments: []}).attachments.filter(n => n.content_type.startsWith("image")).length < 2)) {
let aRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount)); let aRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.appmount));
let mRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCNC.messageaccessory + BDFDB.dotCN.messagecontents)); let mRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCNC.messageaccessory + BDFDB.dotCN.messagecontents));
let mwRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.messagewrapper)); let mwRects = BDFDB.DOMUtils.getRects(document.querySelector(BDFDB.dotCN.messagewrapper));
@@ -1370,7 +1391,7 @@ module.exports = (_ => {
processLazyImageZoomable (e) { processLazyImageZoomable (e) {
if (!e.instance.props.original || e.instance.props.src.indexOf("https://media.discordapp.net/attachments") != 0) return; if (!e.instance.props.original || e.instance.props.src.indexOf("https://media.discordapp.net/attachments") != 0) return;
if (this.settings.detailsSettings.tooltip || this.settings.detailsSettings.footnote && e.instance.props.mediaLayoutType == "MOSAIC" && (BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(e, `instance.${BDFDB.ReactUtils.instanceKey}`), "attachments", {up: true}) || []).length > 1) { if (this.settings.detailsSettings.tooltip || this.settings.detailsSettings.footnote && e.instance.props.mediaLayoutType == "MOSAIC" && (BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(e, `instance.${BDFDB.ReactUtils.instanceKey}`), "message", {up: true}) || {attachments: []}).attachments.filter(n => n.content_type.startsWith("image")).length > 1) {
const attachment = BDFDB.ReactUtils.findValue(e.instance, "attachment", {up: true}); const attachment = BDFDB.ReactUtils.findValue(e.instance, "attachment", {up: true});
if (attachment) { if (attachment) {
const onMouseEnter = e.returnvalue.props.onMouseEnter; const onMouseEnter = e.returnvalue.props.onMouseEnter;
@@ -1387,7 +1408,7 @@ module.exports = (_ => {
}, "Error in onMouseEnter of LazyImageZoomable!"); }, "Error in onMouseEnter of LazyImageZoomable!");
} }
} }
if (this.settings.detailsSettings.footnote && (e.instance.props.className || "").indexOf(BDFDB.disCN.embedmedia) == -1 && (e.instance.props.className || "").indexOf(BDFDB.disCN.embedthumbnail) == -1 && (e.instance.props.mediaLayoutType != "MOSAIC" || (BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(e, `instance.${BDFDB.ReactUtils.instanceKey}`), "attachments", {up: true}) || []).length < 2)) { if (this.settings.detailsSettings.footnote && [e.instance.props.className, e.instance.props.containerClassName].every(n => [BDFDB.disCN.embedmedia, BDFDB.disCN.embedthumbnail].every(m => (n || "").indexOf(m) == -1)) && (e.instance.props.mediaLayoutType != "MOSAIC" || (BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(e, `instance.${BDFDB.ReactUtils.instanceKey}`), "message", {up: true}) || {attachments: []}).attachments.filter(n => n.content_type.startsWith("image")).length < 2)) {
e.returnvalue = BDFDB.ReactUtils.createElement("div", { e.returnvalue = BDFDB.ReactUtils.createElement("div", {
children: [ children: [
e.returnvalue, e.returnvalue,
@@ -1398,7 +1419,7 @@ module.exports = (_ => {
width: 0, width: 0,
filename: "unknown.png" filename: "unknown.png"
} }
}) }, true)
] ]
}); });
} }
@@ -1478,20 +1499,16 @@ module.exports = (_ => {
requestFile (urls, onLoad, onError, config = {}) { requestFile (urls, onLoad, onError, config = {}) {
if (!urls || typeof onLoad != "function") return typeof onError == "function" && onError(); if (!urls || typeof onLoad != "function") return typeof onError == "function" && onError();
let url = urls.url.startsWith("/assets") ? (window.location.origin + urls.url) : urls.url; let url = (urls.url && urls.url.startsWith("/assets") ? (window.location.origin + urls.url) : urls.url || "");
let isResized = !config.orignalSizeChecked && (url.indexOf("?width=") > -1 || url.indexOf("?height=") > -1 || url.indexOf("?size=") > -1); let isResized = !config.orignalSizeChecked && (url.indexOf("?width=") > -1 || url.indexOf("?height=") > -1 || url.indexOf("?size=") > -1);
if (!config.fallbackToRequest) BDFDB.DiscordUtils.requestFileData(isResized ? url.split("?width")[0].split("?height")[0].split("?size")[0] : url, {timeout: 3000}, (error, buffer) => { url = isResized ? this.removeSizeInUrl(url) : url;
if (error || !buffer) { let isFormatted = (url.indexOf("?format=") > -1);
if (isResized) this.requestFile(urls, onLoad, onError, {orignalSizeChecked: true}); url = isFormatted ? this.removeFormatInUrl(url) : url;
else if (urls.fallbackUrl && urls.url != urls.fallbackUrl) this.requestFile({url: urls.fallbackUrl, oldUrl: urls.url}, onLoad, onError); url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url;
else this.requestFile({url: urls.oldUrl || urls.url, fallbackUrl: urls.oldUrl ? urls.url : undefined}, onLoad, onError, {fallbackToRequest: true}); BDFDB.LibraryRequires.request(url, {toBuffer: true}, (error, response, buffer) => {
}
else onLoad(url, buffer);
});
else BDFDB.LibraryRequires.request(isResized ? url.split("?width")[0].split("?height")[0].split("?size")[0] : url, {agentOptions: {rejectUnauthorized: false}, headers: {"Content-Type": "application/json"}}, (error, response, buffer) => {
if (error || response.statusCode != 200 || response.headers["content-type"].indexOf("text/html") > -1) { if (error || response.statusCode != 200 || response.headers["content-type"].indexOf("text/html") > -1) {
if (isResized) this.requestFile(urls, onLoad, onError, {orignalSizeChecked: true, fallbackToRequest: true}); if (isResized) this.requestFile(urls, onLoad, onError, {orignalSizeChecked: true});
else if (urls.fallbackUrl && urls.url != urls.fallbackUrl) this.requestFile({url: urls.fallbackUrl}, onLoad, onError, {fallbackToRequest: true}); else if (urls.fallbackUrl && urls.url != urls.fallbackUrl) this.requestFile({url: urls.fallbackUrl}, onLoad, onError);
else if (typeof onError == "function") onError(); else if (typeof onError == "function") onError();
} }
else onLoad(url, buffer); else onLoad(url, buffer);
@@ -1504,7 +1521,7 @@ module.exports = (_ => {
if (!extension) BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE).replace("{{var1}}", path || "PC"), {type: "danger"}); if (!extension) BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE).replace("{{var1}}", path || "PC"), {type: "danger"});
else { else {
let type = fileTypes[extension].video ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE; let type = fileTypes[extension].video ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE;
if (path) BDFDB.LibraryRequires.fs.writeFile(this.getFileName(path, (alternativeName || url.split("/").pop().split(".").slice(0, -1).join(".") || "unknown").slice(0, 35), extension, 0), Buffer.from(buffer), error => { if (path) BDFDB.LibraryRequires.fs.writeFile(this.getFileName(path, (alternativeName || url.split("/").pop().split(".").slice(0, -1).join(".") || "unknown").slice(0, 35), extension, 0), new Uint8Array(buffer), error => {
if (error) BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", type).replace("{{var1}}", path), {type: "danger"}); if (error) BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", type).replace("{{var1}}", path), {type: "danger"});
else BDFDB.NotificationUtils.toast(this.labels.toast_save_success.replace("{{var0}}", type).replace("{{var1}}", path), {type: "success"}); else BDFDB.NotificationUtils.toast(this.labels.toast_save_success.replace("{{var0}}", type).replace("{{var1}}", path), {type: "success"});
}); });
@@ -1523,7 +1540,7 @@ module.exports = (_ => {
} }
copyFile (urls) { copyFile (urls) {
this.requestFile(urls, (url, buffer) => { this.requestFile(urls, url => {
let type = this.isValid(url, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE; let type = this.isValid(url, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE;
BDFDB.LibraryModules.WindowUtils.copyImage(url); BDFDB.LibraryModules.WindowUtils.copyImage(url);
BDFDB.NotificationUtils.toast(this.labels.toast_copy_success.replace("{{var0}}", type), {type: "success"}); BDFDB.NotificationUtils.toast(this.labels.toast_copy_success.replace("{{var0}}", type), {type: "success"});
@@ -1678,6 +1695,14 @@ module.exports = (_ => {
return filtered; return filtered;
} }
removeSizeInUrl (url) {
return (url || "").split(/[&?]width=/)[0].split(/[&?]height=/)[0].split(/[&?]size=/)[0].split(/[&?]width=/)[0].split(/[&?]height=/)[0].split(/[&?]size=/)[0];
}
removeFormatInUrl (url) {
return (url || "").replace(/format\=[A-z]+(\&){0,1}/g, "");
}
addListener (eventType, type, callback) { addListener (eventType, type, callback) {
if (!type || !eventType || typeof callback != "function") return; if (!type || !eventType || typeof callback != "function") return;
if (!eventTypes[type]) eventTypes[type] = []; if (!eventTypes[type]) eventTypes[type] = [];
@@ -1701,13 +1726,14 @@ module.exports = (_ => {
case "bg": // Bulgarian case "bg": // Bulgarian
return { return {
context_copy: "Копирайте {{var0}}", context_copy: "Копирайте {{var0}}",
context_imageactions: "Действия с изображения", context_imageactions: "Действия с изображения",
context_lenssize: "Размер на обектива", context_lenssize: "Размер на обектива",
context_zoomspeed: "Скорост на мащабиране",
context_saveas: "Запазете {{var0}} като ...", context_saveas: "Запазете {{var0}} като ...",
context_searchwith: "Търсете {{var0}} с ...", context_searchwith: "Търсете {{var0}} с ...",
context_videoactions: "Видео действия", context_streamactions: "Действия за визуализация на потока",
context_videoactions: "Видео действия",
context_view: "Преглед {{var0}}", context_view: "Преглед {{var0}}",
context_zoomspeed: "Скорост на мащабиране",
submenu_disabled: "Всички инвалиди", submenu_disabled: "Всички инвалиди",
toast_copy_failed: "{{var0}} не можа да бъде копиран в клипборда", toast_copy_failed: "{{var0}} не можа да бъде копиран в клипборда",
toast_copy_success: "{{var0}} беше копиран в клипборда", toast_copy_success: "{{var0}} беше копиран в клипборда",
@@ -1717,13 +1743,14 @@ module.exports = (_ => {
case "cs": // Czech case "cs": // Czech
return { return {
context_copy: "Zkopírovat {{var0}}", context_copy: "Zkopírovat {{var0}}",
context_imageactions: "Akce s obrázky", context_imageactions: "Akce s obrázky",
context_lenssize: "Velikost lupy", context_lenssize: "Velikost lupy",
context_zoomspeed: "Rychlost zoomu",
context_saveas: "Uložit {{var0}} jako...", context_saveas: "Uložit {{var0}} jako...",
context_searchwith: "Hledat {{var0}} pomocí...", context_searchwith: "Hledat {{var0}} pomocí...",
context_videoactions: "Video akce", context_streamactions: "Akce náhledu streamu",
context_videoactions: "Video akce",
context_view: "Zobrazit {{var0}}", context_view: "Zobrazit {{var0}}",
context_zoomspeed: "Rychlost zoomu",
submenu_disabled: "Vše zakázáno", submenu_disabled: "Vše zakázáno",
toast_copy_failed: "{{var0}} nemohl být zkopírován do schránky", toast_copy_failed: "{{var0}} nemohl být zkopírován do schránky",
toast_copy_success: "{{var0}} byl zkopírován do schránky", toast_copy_success: "{{var0}} byl zkopírován do schránky",
@@ -1733,13 +1760,14 @@ module.exports = (_ => {
case "da": // Danish case "da": // Danish
return { return {
context_copy: "Kopiér {{var0}}", context_copy: "Kopiér {{var0}}",
context_imageactions: "Billedhandlinger", context_imageactions: "Billedhandlinger",
context_lenssize: "Objektivstørrelse", context_lenssize: "Objektivstørrelse",
context_zoomspeed: "Zoomhastighed",
context_saveas: "Gem {{var0}} som ...", context_saveas: "Gem {{var0}} som ...",
context_searchwith: "Søg i {{var0}} med ...", context_searchwith: "Søg i {{var0}} med ...",
context_videoactions: "Videohandlinger", context_streamactions: "Stream forhåndsvisningshandlinger",
context_videoactions: "Videohandlinger",
context_view: "Se {{var0}}", context_view: "Se {{var0}}",
context_zoomspeed: "Zoomhastighed",
submenu_disabled: "Alle handicappede", submenu_disabled: "Alle handicappede",
toast_copy_failed: "{{var0}} kunne ikke kopieres til udklipsholderen", toast_copy_failed: "{{var0}} kunne ikke kopieres til udklipsholderen",
toast_copy_success: "{{var0}} blev kopieret til udklipsholderen", toast_copy_success: "{{var0}} blev kopieret til udklipsholderen",
@@ -1749,13 +1777,14 @@ module.exports = (_ => {
case "de": // German case "de": // German
return { return {
context_copy: "{{var0}} kopieren", context_copy: "{{var0}} kopieren",
context_imageactions: "Bildaktionen", context_imageactions: "Bildaktionen",
context_lenssize: "Linsengröße", context_lenssize: "Linsengröße",
context_zoomspeed: "Zoomgeschwindigkeit",
context_saveas: "{{var0}} speichern als ...", context_saveas: "{{var0}} speichern als ...",
context_searchwith: "{{var0}} suchen mit ...", context_searchwith: "{{var0}} suchen mit ...",
context_videoactions: "Videoaktionen", context_streamactions: "Stream-Vorschau-Aktionen",
context_videoactions: "Videoaktionen",
context_view: "{{var0}} ansehen", context_view: "{{var0}} ansehen",
context_zoomspeed: "Zoomgeschwindigkeit",
submenu_disabled: "Alle deaktiviert", submenu_disabled: "Alle deaktiviert",
toast_copy_failed: "{{var0}} konnte nicht in die Zwischenablage kopiert werden", toast_copy_failed: "{{var0}} konnte nicht in die Zwischenablage kopiert werden",
toast_copy_success: "{{var0}} wurde in die Zwischenablage kopiert", toast_copy_success: "{{var0}} wurde in die Zwischenablage kopiert",
@@ -1765,13 +1794,14 @@ module.exports = (_ => {
case "el": // Greek case "el": // Greek
return { return {
context_copy: "Αντιγραφή {{var0}}", context_copy: "Αντιγραφή {{var0}}",
context_imageactions: "Ενέργειες εικόνας", context_imageactions: "Ενέργειες εικόνας",
context_lenssize: "Μέγεθος φακού", context_lenssize: "Μέγεθος φακού",
context_zoomspeed: "Ταχύτητα ζουμ",
context_saveas: "Αποθήκευση {{var0}} ως ...", context_saveas: "Αποθήκευση {{var0}} ως ...",
context_searchwith: "Αναζήτηση {{var0}} με ...", context_searchwith: "Αναζήτηση {{var0}} με ...",
context_videoactions: "Ενέργειες βίντεο", context_streamactions: "Ενέργειες προεπισκόπησης ροής",
context_videoactions: "Ενέργειες βίντεο",
context_view: "Προβολή {{var0}}", context_view: "Προβολή {{var0}}",
context_zoomspeed: "Ταχύτητα ζουμ",
submenu_disabled: "Όλα τα άτομα με ειδικές ανάγκες", submenu_disabled: "Όλα τα άτομα με ειδικές ανάγκες",
toast_copy_failed: "Δεν ήταν δυνατή η αντιγραφή του {{var0}} στο πρόχειρο", toast_copy_failed: "Δεν ήταν δυνατή η αντιγραφή του {{var0}} στο πρόχειρο",
toast_copy_success: "Το {{var0}} αντιγράφηκε στο πρόχειρο", toast_copy_success: "Το {{var0}} αντιγράφηκε στο πρόχειρο",
@@ -1781,13 +1811,14 @@ module.exports = (_ => {
case "es": // Spanish case "es": // Spanish
return { return {
context_copy: "Copiar {{var0}}", context_copy: "Copiar {{var0}}",
context_imageactions: "Acciones de imagen", context_imageactions: "Acciones de imagen",
context_lenssize: "Tamaño de la lente", context_lenssize: "Tamaño de la lente",
context_zoomspeed: "Velocidad de zoom",
context_saveas: "Guardar {{var0}} como ...", context_saveas: "Guardar {{var0}} como ...",
context_searchwith: "Buscar {{var0}} con ...", context_searchwith: "Buscar {{var0}} con ...",
context_videoactions: "Acciones de vídeo", context_streamactions: "Acciones de vista previa de transmisión",
context_videoactions: "Acciones de vídeo",
context_view: "Ver {{var0}}", context_view: "Ver {{var0}}",
context_zoomspeed: "Velocidad de zoom",
submenu_disabled: "Todos discapacitados", submenu_disabled: "Todos discapacitados",
toast_copy_failed: "{{var0}} no se pudo copiar al portapapeles", toast_copy_failed: "{{var0}} no se pudo copiar al portapapeles",
toast_copy_success: "{{var0}} se copió en el portapapeles", toast_copy_success: "{{var0}} se copió en el portapapeles",
@@ -1797,13 +1828,14 @@ module.exports = (_ => {
case "fi": // Finnish case "fi": // Finnish
return { return {
context_copy: "Kopioi {{var0}}", context_copy: "Kopioi {{var0}}",
context_imageactions: "Kuvatoiminnot", context_imageactions: "Kuvatoiminnot",
context_lenssize: "Linssin koko", context_lenssize: "Linssin koko",
context_zoomspeed: "Zoomausnopeus",
context_saveas: "Tallenna {{var0}} nimellä ...", context_saveas: "Tallenna {{var0}} nimellä ...",
context_searchwith: "Tee haku {{var0}} ...", context_searchwith: "Tee haku {{var0}} ...",
context_videoactions: "Videotoiminnot", context_streamactions: "Streamin esikatselutoiminnot",
context_videoactions: "Videotoiminnot",
context_view: "Näytä {{var0}}", context_view: "Näytä {{var0}}",
context_zoomspeed: "Zoomausnopeus",
submenu_disabled: "Kaikki vammaiset", submenu_disabled: "Kaikki vammaiset",
toast_copy_failed: "Kohdetta {{var0}} ei voitu kopioida leikepöydälle", toast_copy_failed: "Kohdetta {{var0}} ei voitu kopioida leikepöydälle",
toast_copy_success: "{{var0}} kopioitiin leikepöydälle", toast_copy_success: "{{var0}} kopioitiin leikepöydälle",
@@ -1813,13 +1845,14 @@ module.exports = (_ => {
case "fr": // French case "fr": // French
return { return {
context_copy: "Copier {{var0}}", context_copy: "Copier {{var0}}",
context_imageactions: "Actions sur les images", context_imageactions: "Actions sur les images",
context_lenssize: "Taille de l'objectif", context_lenssize: "Taille de l'objectif",
context_zoomspeed: "Vitesse de zoom",
context_saveas: "Enregistrer {{var0}} sous ...", context_saveas: "Enregistrer {{var0}} sous ...",
context_searchwith: "Rechercher {{var0}} avec ...", context_searchwith: "Rechercher {{var0}} avec ...",
context_videoactions: "Actions vidéo", context_streamactions: "Actions d'aperçu de flux",
context_videoactions: "Actions vidéo",
context_view: "Afficher {{var0}}", context_view: "Afficher {{var0}}",
context_zoomspeed: "Vitesse de zoom",
submenu_disabled: "Tout désactivé", submenu_disabled: "Tout désactivé",
toast_copy_failed: "{{var0}} n'a pas pu être copié dans le presse-papiers", toast_copy_failed: "{{var0}} n'a pas pu être copié dans le presse-papiers",
toast_copy_success: "{{var0}} a été copié dans le presse-papiers", toast_copy_success: "{{var0}} a été copié dans le presse-papiers",
@@ -1829,13 +1862,14 @@ module.exports = (_ => {
case "hi": // Hindi case "hi": // Hindi
return { return {
context_copy: "कॉपी {{var0}}", context_copy: "कॉपी {{var0}}",
context_imageactions: "छवि क्रियाएँ", context_imageactions: "छवि क्रियाएँ",
context_lenssize: "लेंस का आकार", context_lenssize: "लेंस का आकार",
context_zoomspeed: "ज़ूम गति",
context_saveas: "{{var0}} को इस रूप में सेव करें...", context_saveas: "{{var0}} को इस रूप में सेव करें...",
context_searchwith: "इसके साथ {{var0}} खोजें ...", context_searchwith: "इसके साथ {{var0}} खोजें ...",
context_videoactions: "वीडियो क्रिया", context_streamactions: "स्ट्रीम पूर्वावलोकन क्रियाएं",
context_videoactions: "वीडियो क्रिया",
context_view: "देखें {{var0}}", context_view: "देखें {{var0}}",
context_zoomspeed: "ज़ूम गति",
submenu_disabled: "सभी अक्षम", submenu_disabled: "सभी अक्षम",
toast_copy_failed: "{{var0}} को क्लिपबोर्ड पर कॉपी नहीं किया जा सका", toast_copy_failed: "{{var0}} को क्लिपबोर्ड पर कॉपी नहीं किया जा सका",
toast_copy_success: "{{var0}} को क्लिपबोर्ड पर कॉपी किया गया था", toast_copy_success: "{{var0}} को क्लिपबोर्ड पर कॉपी किया गया था",
@@ -1845,13 +1879,14 @@ module.exports = (_ => {
case "hr": // Croatian case "hr": // Croatian
return { return {
context_copy: "Kopiraj {{var0}}", context_copy: "Kopiraj {{var0}}",
context_imageactions: "Radnje slike", context_imageactions: "Radnje slike",
context_lenssize: "Veličina leće", context_lenssize: "Veličina leće",
context_zoomspeed: "Brzina zumiranja",
context_saveas: "Spremi {{var0}} kao ...", context_saveas: "Spremi {{var0}} kao ...",
context_searchwith: "Traži {{var0}} sa ...", context_searchwith: "Traži {{var0}} sa ...",
context_videoactions: "Video radnje", context_streamactions: "Radnje pregleda streama",
context_videoactions: "Video radnje",
context_view: "Pogledajte {{var0}}", context_view: "Pogledajte {{var0}}",
context_zoomspeed: "Brzina zumiranja",
submenu_disabled: "Svi invalidi", submenu_disabled: "Svi invalidi",
toast_copy_failed: "{{var0}} nije moguće kopirati u međuspremnik", toast_copy_failed: "{{var0}} nije moguće kopirati u međuspremnik",
toast_copy_success: "{{var0}} je kopirano u međuspremnik", toast_copy_success: "{{var0}} je kopirano u međuspremnik",
@@ -1861,13 +1896,14 @@ module.exports = (_ => {
case "hu": // Hungarian case "hu": // Hungarian
return { return {
context_copy: "{{var0}} másolása", context_copy: "{{var0}} másolása",
context_imageactions: "Képműveletek", context_imageactions: "Képműveletek",
context_lenssize: "Lencse mérete", context_lenssize: "Lencse mérete",
context_zoomspeed: "Zoom sebesség",
context_saveas: "{{var0}} mentése másként ...", context_saveas: "{{var0}} mentése másként ...",
context_searchwith: "Keresés a következőben: {{var0}} a következővel:", context_searchwith: "Keresés a következőben: {{var0}} a következővel:",
context_videoactions: "Videóműveletek", context_streamactions: "Stream előnézeti műveletek",
context_videoactions: "Videóműveletek",
context_view: "Megtekintés: {{var0}}", context_view: "Megtekintés: {{var0}}",
context_zoomspeed: "Zoom sebesség",
submenu_disabled: "Minden fogyatékkal él", submenu_disabled: "Minden fogyatékkal él",
toast_copy_failed: "A {{var0}} fájl nem másolható a vágólapra", toast_copy_failed: "A {{var0}} fájl nem másolható a vágólapra",
toast_copy_success: "A {{var0}} elemet a vágólapra másolta", toast_copy_success: "A {{var0}} elemet a vágólapra másolta",
@@ -1877,13 +1913,14 @@ module.exports = (_ => {
case "it": // Italian case "it": // Italian
return { return {
context_copy: "Copia {{var0}}", context_copy: "Copia {{var0}}",
context_imageactions: "Azioni immagine", context_imageactions: "Azioni immagine",
context_lenssize: "Dimensione della lente", context_lenssize: "Dimensione della lente",
context_zoomspeed: "Velocità dello zoom",
context_saveas: "Salva {{var0}} come ...", context_saveas: "Salva {{var0}} come ...",
context_searchwith: "Cerca {{var0}} con ...", context_searchwith: "Cerca {{var0}} con ...",
context_videoactions: "Azioni video", context_streamactions: "Azioni di anteprima del flusso",
context_videoactions: "Azioni video",
context_view: "Visualizza {{var0}}", context_view: "Visualizza {{var0}}",
context_zoomspeed: "Velocità dello zoom",
submenu_disabled: "Tutti disabilitati", submenu_disabled: "Tutti disabilitati",
toast_copy_failed: "{{var0}} non può essere copiato negli appunti", toast_copy_failed: "{{var0}} non può essere copiato negli appunti",
toast_copy_success: "{{var0}} è stato copiato negli appunti", toast_copy_success: "{{var0}} è stato copiato negli appunti",
@@ -1893,13 +1930,14 @@ module.exports = (_ => {
case "ja": // Japanese case "ja": // Japanese
return { return {
context_copy: "{{var0}} をコピーします", context_copy: "{{var0}} をコピーします",
context_imageactions: "画像アクション", context_imageactions: "画像アクション",
context_lenssize: "レンズサイズ", context_lenssize: "レンズサイズ",
context_zoomspeed: "ズーム速度",
context_saveas: "{{var0}} を...として保存します", context_saveas: "{{var0}} を...として保存します",
context_searchwith: "{{var0}} を...で検索", context_searchwith: "{{var0}} を...で検索",
context_videoactions: "ビデオ アクション", context_streamactions: "ストリーム プレビュー アクション",
context_videoactions: "ビデオ アクション",
context_view: "{{var0}} を表示", context_view: "{{var0}} を表示",
context_zoomspeed: "ズーム速度",
submenu_disabled: "すべて無効", submenu_disabled: "すべて無効",
toast_copy_failed: "{{var0}} をクリップボードにコピーできませんでした", toast_copy_failed: "{{var0}} をクリップボードにコピーできませんでした",
toast_copy_success: "{{var0}} がクリップボードにコピーされました", toast_copy_success: "{{var0}} がクリップボードにコピーされました",
@@ -1909,13 +1947,14 @@ module.exports = (_ => {
case "ko": // Korean case "ko": // Korean
return { return {
context_copy: "{{var0}} 복사", context_copy: "{{var0}} 복사",
context_imageactions: "이미지 작업", context_imageactions: "이미지 작업",
context_lenssize: "렌즈 크기", context_lenssize: "렌즈 크기",
context_zoomspeed: "줌 속도",
context_saveas: "{{var0}} 을 다른 이름으로 저장 ...", context_saveas: "{{var0}} 을 다른 이름으로 저장 ...",
context_searchwith: "{{var0}} 검색 ...", context_searchwith: "{{var0}} 검색 ...",
context_videoactions: "비디오 작업", context_streamactions: "스트림 미리보기 작업",
context_videoactions: "비디오 작업",
context_view: "{{var0}} 보기", context_view: "{{var0}} 보기",
context_zoomspeed: "줌 속도",
submenu_disabled: "모두 비활성화 됨", submenu_disabled: "모두 비활성화 됨",
toast_copy_failed: "{{var0}} 을 클립 보드에 복사 할 수 없습니다.", toast_copy_failed: "{{var0}} 을 클립 보드에 복사 할 수 없습니다.",
toast_copy_success: "{{var0}} 이 클립 보드에 복사되었습니다.", toast_copy_success: "{{var0}} 이 클립 보드에 복사되었습니다.",
@@ -1925,13 +1964,14 @@ module.exports = (_ => {
case "lt": // Lithuanian case "lt": // Lithuanian
return { return {
context_copy: "Kopijuoti {{var0}}", context_copy: "Kopijuoti {{var0}}",
context_imageactions: "Vaizdo veiksmai", context_imageactions: "Vaizdo veiksmai",
context_lenssize: "Objektyvo dydis", context_lenssize: "Objektyvo dydis",
context_zoomspeed: "Priartinimo greitis",
context_saveas: "Išsaugoti '{{var0}}' kaip ...", context_saveas: "Išsaugoti '{{var0}}' kaip ...",
context_searchwith: "Ieškoti {{var0}} naudojant ...", context_searchwith: "Ieškoti {{var0}} naudojant ...",
context_videoactions: "Vaizdo įrašų veiksmai", context_streamactions: "Srauto peržiūros veiksmai",
context_videoactions: "Vaizdo įrašų veiksmai",
context_view: "Žiūrėti {{var0}}", context_view: "Žiūrėti {{var0}}",
context_zoomspeed: "Priartinimo greitis",
submenu_disabled: "Visi neįgalūs", submenu_disabled: "Visi neįgalūs",
toast_copy_failed: "{{var0}} nepavyko nukopijuoti į mainų sritį", toast_copy_failed: "{{var0}} nepavyko nukopijuoti į mainų sritį",
toast_copy_success: "{{var0}} buvo nukopijuota į mainų sritį", toast_copy_success: "{{var0}} buvo nukopijuota į mainų sritį",
@@ -1941,13 +1981,14 @@ module.exports = (_ => {
case "nl": // Dutch case "nl": // Dutch
return { return {
context_copy: "Kopieer {{var0}}", context_copy: "Kopieer {{var0}}",
context_imageactions: "Afbeeldingsacties", context_imageactions: "Afbeeldingsacties",
context_lenssize: "Lens Maat", context_lenssize: "Lens Maat",
context_zoomspeed: "Zoom snelheid",
context_saveas: "Bewaar {{var0}} als ...", context_saveas: "Bewaar {{var0}} als ...",
context_searchwith: "Zoek {{var0}} met ...", context_searchwith: "Zoek {{var0}} met ...",
context_videoactions: "Video-acties", context_streamactions: "Stream Preview-acties",
context_videoactions: "Video-acties",
context_view: "Bekijk {{var0}}", context_view: "Bekijk {{var0}}",
context_zoomspeed: "Zoom snelheid",
submenu_disabled: "Allemaal uitgeschakeld", submenu_disabled: "Allemaal uitgeschakeld",
toast_copy_failed: "{{var0}} kan niet naar het klembord worden gekopieerd", toast_copy_failed: "{{var0}} kan niet naar het klembord worden gekopieerd",
toast_copy_success: "{{var0}} is naar het klembord gekopieerd", toast_copy_success: "{{var0}} is naar het klembord gekopieerd",
@@ -1957,13 +1998,14 @@ module.exports = (_ => {
case "no": // Norwegian case "no": // Norwegian
return { return {
context_copy: "Kopier {{var0}}", context_copy: "Kopier {{var0}}",
context_imageactions: "Bildehandlinger", context_imageactions: "Bildehandlinger",
context_lenssize: "Linsestørrelse", context_lenssize: "Linsestørrelse",
context_zoomspeed: "Zoomhastighet",
context_saveas: "Lagre {{var0}} som ...", context_saveas: "Lagre {{var0}} som ...",
context_searchwith: "Søk på {{var0}} med ...", context_searchwith: "Søk på {{var0}} med ...",
context_videoactions: "Videohandlinger", context_streamactions: "Strøm forhåndsvisningshandlinger",
context_videoactions: "Videohandlinger",
context_view: "Vis {{var0}}", context_view: "Vis {{var0}}",
context_zoomspeed: "Zoomhastighet",
submenu_disabled: "Alle funksjonshemmede", submenu_disabled: "Alle funksjonshemmede",
toast_copy_failed: "{{var0}} kunne ikke kopieres til utklippstavlen", toast_copy_failed: "{{var0}} kunne ikke kopieres til utklippstavlen",
toast_copy_success: "{{var0}} ble kopiert til utklippstavlen", toast_copy_success: "{{var0}} ble kopiert til utklippstavlen",
@@ -1973,13 +2015,14 @@ module.exports = (_ => {
case "pl": // Polish case "pl": // Polish
return { return {
context_copy: "Kopiuj {{var0}}", context_copy: "Kopiuj {{var0}}",
context_imageactions: "Działania związane z obrazem", context_imageactions: "Działania związane z obrazem",
context_lenssize: "Rozmiar soczewki", context_lenssize: "Rozmiar soczewki",
context_zoomspeed: "Szybkość zoomu",
context_saveas: "Zapisz {{var0}} jako ...", context_saveas: "Zapisz {{var0}} jako ...",
context_searchwith: "Wyszukaj {{var0}} za pomocą ...", context_searchwith: "Wyszukaj {{var0}} za pomocą ...",
context_videoactions: "Akcje wideo", context_streamactions: "Akcje podglądu strumienia",
context_videoactions: "Akcje wideo",
context_view: "Wyświetl {{var0}}", context_view: "Wyświetl {{var0}}",
context_zoomspeed: "Szybkość zoomu",
submenu_disabled: "Wszystkie wyłączone", submenu_disabled: "Wszystkie wyłączone",
toast_copy_failed: "Nie można skopiować {{var0}} do schowka", toast_copy_failed: "Nie można skopiować {{var0}} do schowka",
toast_copy_success: "{{var0}} został skopiowany do schowka", toast_copy_success: "{{var0}} został skopiowany do schowka",
@@ -1989,13 +2032,14 @@ module.exports = (_ => {
case "pt-BR": // Portuguese (Brazil) case "pt-BR": // Portuguese (Brazil)
return { return {
context_copy: "Copiar {{var0}}", context_copy: "Copiar {{var0}}",
context_imageactions: "Ações de imagem", context_imageactions: "Ações de imagem",
context_lenssize: "Tamanho da lente", context_lenssize: "Tamanho da lente",
context_zoomspeed: "Velocidade do zoom",
context_saveas: "Salvar {{var0}} como ...", context_saveas: "Salvar {{var0}} como ...",
context_searchwith: "Pesquisar {{var0}} com ...", context_searchwith: "Pesquisar {{var0}} com ...",
context_videoactions: "Ações de vídeo", context_streamactions: "Ações de visualização de fluxo",
context_videoactions: "Ações de vídeo",
context_view: "Visualizar {{var0}}", context_view: "Visualizar {{var0}}",
context_zoomspeed: "Velocidade do zoom",
submenu_disabled: "Todos desativados", submenu_disabled: "Todos desativados",
toast_copy_failed: "{{var0}} não pôde ser copiado para a área de transferência", toast_copy_failed: "{{var0}} não pôde ser copiado para a área de transferência",
toast_copy_success: "{{var0}} foi copiado para a área de transferência", toast_copy_success: "{{var0}} foi copiado para a área de transferência",
@@ -2005,13 +2049,14 @@ module.exports = (_ => {
case "ro": // Romanian case "ro": // Romanian
return { return {
context_copy: "Copiați {{var0}}", context_copy: "Copiați {{var0}}",
context_imageactions: "Acțiuni de imagine", context_imageactions: "Acțiuni de imagine",
context_lenssize: "Dimensiunea obiectivului", context_lenssize: "Dimensiunea obiectivului",
context_zoomspeed: "Viteza de zoom",
context_saveas: "Salvați {{var0}} ca ...", context_saveas: "Salvați {{var0}} ca ...",
context_searchwith: "Căutați {{var0}} cu ...", context_searchwith: "Căutați {{var0}} cu ...",
context_videoactions: "Acțiuni video", context_streamactions: "Acțiuni de previzualizare în flux",
context_videoactions: "Acțiuni video",
context_view: "Vizualizați {{var0}}", context_view: "Vizualizați {{var0}}",
context_zoomspeed: "Viteza de zoom",
submenu_disabled: "Toate sunt dezactivate", submenu_disabled: "Toate sunt dezactivate",
toast_copy_failed: "{{var0}} nu a putut fi copiat în clipboard", toast_copy_failed: "{{var0}} nu a putut fi copiat în clipboard",
toast_copy_success: "{{var0}} a fost copiat în clipboard", toast_copy_success: "{{var0}} a fost copiat în clipboard",
@@ -2021,13 +2066,14 @@ module.exports = (_ => {
case "ru": // Russian case "ru": // Russian
return { return {
context_copy: "Скопируйте {{var0}}", context_copy: "Скопируйте {{var0}}",
context_imageactions: "Действия с изображением", context_imageactions: "Действия с изображением",
context_lenssize: "Размер линзы", context_lenssize: "Размер линзы",
context_zoomspeed: "Скорость масштабирования",
context_saveas: "Сохранить {{var0}} как ...", context_saveas: "Сохранить {{var0}} как ...",
context_searchwith: "Искать {{var0}} с помощью ...", context_searchwith: "Искать {{var0}} с помощью ...",
context_videoactions: "Действия с видео", context_streamactions: "Действия предварительного просмотра трансляции",
context_videoactions: "Действия с видео",
context_view: "Посмотреть {{var0}}", context_view: "Посмотреть {{var0}}",
context_zoomspeed: "Скорость масштабирования",
submenu_disabled: "Все отключены", submenu_disabled: "Все отключены",
toast_copy_failed: "{{var0}} не удалось скопировать в буфер обмена", toast_copy_failed: "{{var0}} не удалось скопировать в буфер обмена",
toast_copy_success: "{{var0}} скопирован в буфер обмена", toast_copy_success: "{{var0}} скопирован в буфер обмена",
@@ -2037,13 +2083,14 @@ module.exports = (_ => {
case "sv": // Swedish case "sv": // Swedish
return { return {
context_copy: "Kopiera {{var0}}", context_copy: "Kopiera {{var0}}",
context_imageactions: "Bildåtgärder", context_imageactions: "Bildåtgärder",
context_lenssize: "Linsstorlek", context_lenssize: "Linsstorlek",
context_zoomspeed: "Zoomhastighet",
context_saveas: "Spara {{var0}} som ...", context_saveas: "Spara {{var0}} som ...",
context_searchwith: "Sök {{var0}} med ...", context_searchwith: "Sök {{var0}} med ...",
context_videoactions: "Videoåtgärder", context_streamactions: "Streama förhandsgranskningsåtgärder",
context_videoactions: "Videoåtgärder",
context_view: "Visa {{var0}}", context_view: "Visa {{var0}}",
context_zoomspeed: "Zoomhastighet",
submenu_disabled: "Alla funktionshindrade", submenu_disabled: "Alla funktionshindrade",
toast_copy_failed: "{{var0}} kunde inte kopieras till Urklipp", toast_copy_failed: "{{var0}} kunde inte kopieras till Urklipp",
toast_copy_success: "{{var0}} kopierades till Urklipp", toast_copy_success: "{{var0}} kopierades till Urklipp",
@@ -2053,13 +2100,14 @@ module.exports = (_ => {
case "th": // Thai case "th": // Thai
return { return {
context_copy: "คัดลอก{{var0}}", context_copy: "คัดลอก{{var0}}",
context_imageactions: "การทำงานของรูปภาพ", context_imageactions: "การทำงานของรูปภาพ",
context_lenssize: "ขนาดเลนส์", context_lenssize: "ขนาดเลนส์",
context_zoomspeed: "ความเร็วในการซูม",
context_saveas: "บันทึก{{var0}}เป็น ...", context_saveas: "บันทึก{{var0}}เป็น ...",
context_searchwith: "ค้นหา{{var0}} ้วย ...", context_searchwith: "ค้นหา{{var0}} ้วย ...",
context_videoactions: "การกระทำของวิดีโอ", context_streamactions: "การดำเนินการแสดงตัวอย่างสตรีม",
context_videoactions: "การกระทำของวิดีโอ",
context_view: "ดู{{var0}}", context_view: "ดู{{var0}}",
context_zoomspeed: "ความเร็วในการซูม",
submenu_disabled: "ปิดใช้งานทั้งหมด", submenu_disabled: "ปิดใช้งานทั้งหมด",
toast_copy_failed: "ไม่สามารถคัดลอก{{var0}}ไปยังคลิปบอร์ดได้", toast_copy_failed: "ไม่สามารถคัดลอก{{var0}}ไปยังคลิปบอร์ดได้",
toast_copy_success: "คัดลอก{{var0}}ไปยังคลิปบอร์ดแล้ว", toast_copy_success: "คัดลอก{{var0}}ไปยังคลิปบอร์ดแล้ว",
@@ -2069,13 +2117,14 @@ module.exports = (_ => {
case "tr": // Turkish case "tr": // Turkish
return { return {
context_copy: "{{var0}} kopyala", context_copy: "{{var0}} kopyala",
context_imageactions: "Görüntü Eylemleri", context_imageactions: "Görüntü Eylemleri",
context_lenssize: "Lens Boyutu", context_lenssize: "Lens Boyutu",
context_zoomspeed: "yakınlaştırma hızı",
context_saveas: "{{var0}} farklı kaydet ...", context_saveas: "{{var0}} farklı kaydet ...",
context_searchwith: "{{var0}} şununla ara ...", context_searchwith: "{{var0}} şununla ara ...",
context_videoactions: "Video Eylemleri", context_streamactions: "Akış Önizleme İşlemleri",
context_videoactions: "Video Eylemleri",
context_view: "{{var0}} görüntüle", context_view: "{{var0}} görüntüle",
context_zoomspeed: "yakınlaştırma hızı",
submenu_disabled: "Hepsi devre dışı", submenu_disabled: "Hepsi devre dışı",
toast_copy_failed: "{{var0}} panoya kopyalanamadı", toast_copy_failed: "{{var0}} panoya kopyalanamadı",
toast_copy_success: "{{var0}} panoya kopyalandı", toast_copy_success: "{{var0}} panoya kopyalandı",
@@ -2085,13 +2134,14 @@ module.exports = (_ => {
case "uk": // Ukrainian case "uk": // Ukrainian
return { return {
context_copy: "Копіювати {{var0}}", context_copy: "Копіювати {{var0}}",
context_imageactions: "Дії із зображеннями", context_imageactions: "Дії із зображеннями",
context_lenssize: "Розмір лінзи", context_lenssize: "Розмір лінзи",
context_zoomspeed: "Швидкість масштабування",
context_saveas: "Збережіть {{var0}} як ...", context_saveas: "Збережіть {{var0}} як ...",
context_searchwith: "Шукати {{var0}} за допомогою ...", context_searchwith: "Шукати {{var0}} за допомогою ...",
context_videoactions: "Відео дії", context_streamactions: "Дії попереднього перегляду потоку",
context_videoactions: "Відео дії",
context_view: "Переглянути {{var0}}", context_view: "Переглянути {{var0}}",
context_zoomspeed: "Швидкість масштабування",
submenu_disabled: "Всі інваліди", submenu_disabled: "Всі інваліди",
toast_copy_failed: "Не вдалося скопіювати {{var0}} у буфер обміну", toast_copy_failed: "Не вдалося скопіювати {{var0}} у буфер обміну",
toast_copy_success: "{{var0}} скопійовано в буфер обміну", toast_copy_success: "{{var0}} скопійовано в буфер обміну",
@@ -2101,13 +2151,14 @@ module.exports = (_ => {
case "vi": // Vietnamese case "vi": // Vietnamese
return { return {
context_copy: "Sao chép {{var0}}", context_copy: "Sao chép {{var0}}",
context_imageactions: "Hành động hình ảnh", context_imageactions: "Hành động hình ảnh",
context_lenssize: "Kích thước ống kính", context_lenssize: "Kích thước ống kính",
context_zoomspeed: "tốc độ thu phóng",
context_saveas: "Lưu {{var0}} dưới dạng ...", context_saveas: "Lưu {{var0}} dưới dạng ...",
context_searchwith: "Tìm kiếm {{var0}} bằng ...", context_searchwith: "Tìm kiếm {{var0}} bằng ...",
context_videoactions: "Hành động video", context_streamactions: "Tác vụ xem trước luồng",
context_videoactions: "Hành động video",
context_view: "Xem {{var0}}", context_view: "Xem {{var0}}",
context_zoomspeed: "tốc độ thu phóng",
submenu_disabled: "Tất cả đã bị vô hiệu hóa", submenu_disabled: "Tất cả đã bị vô hiệu hóa",
toast_copy_failed: "Không thể sao chép {{var0}} vào khay nhớ tạm", toast_copy_failed: "Không thể sao chép {{var0}} vào khay nhớ tạm",
toast_copy_success: "{{var0}} đã được sao chép vào khay nhớ tạm", toast_copy_success: "{{var0}} đã được sao chép vào khay nhớ tạm",
@@ -2117,13 +2168,14 @@ module.exports = (_ => {
case "zh-CN": // Chinese (China) case "zh-CN": // Chinese (China)
return { return {
context_copy: "复制 {{var0}}", context_copy: "复制 {{var0}}",
context_imageactions: "图像动作", context_imageactions: "图像动作",
context_lenssize: "缩放尺寸", context_lenssize: "缩放尺寸",
context_zoomspeed: "变焦速度",
context_saveas: "将 {{var0}} 另存到...", context_saveas: "将 {{var0}} 另存到...",
context_searchwith: "搜索 {{var0}} 使用...", context_searchwith: "搜索 {{var0}} 使用...",
context_videoactions: "视频动作", context_streamactions: "流预览操作",
context_videoactions: "视频动作",
context_view: "查看 {{var0}}", context_view: "查看 {{var0}}",
context_zoomspeed: "变焦速度",
submenu_disabled: "全部禁用", submenu_disabled: "全部禁用",
toast_copy_failed: "{{var0}} 无法复制到剪贴板", toast_copy_failed: "{{var0}} 无法复制到剪贴板",
toast_copy_success: "{{var0}} 已复制到剪贴板", toast_copy_success: "{{var0}} 已复制到剪贴板",
@@ -2133,13 +2185,14 @@ module.exports = (_ => {
case "zh-TW": // Chinese (Taiwan) case "zh-TW": // Chinese (Taiwan)
return { return {
context_copy: "複製 {{var0}}", context_copy: "複製 {{var0}}",
context_imageactions: "圖像動作", context_imageactions: "圖像動作",
context_lenssize: "縮放尺寸", context_lenssize: "縮放尺寸",
context_zoomspeed: "变焦速度",
context_saveas: "將 {{var0}} 另存到...", context_saveas: "將 {{var0}} 另存到...",
context_searchwith: "搜尋 {{var0}} 使用...", context_searchwith: "搜尋 {{var0}} 使用...",
context_videoactions: "視頻動作", context_streamactions: "流預覽操作",
context_videoactions: "視頻動作",
context_view: "預覽 {{var0}}", context_view: "預覽 {{var0}}",
context_zoomspeed: "变焦速度",
submenu_disabled: "全部關閉", submenu_disabled: "全部關閉",
toast_copy_failed: "{{var0}} 無法複製到剪貼簿", toast_copy_failed: "{{var0}} 無法複製到剪貼簿",
toast_copy_success: "{{var0}} 已複製到剪貼簿", toast_copy_success: "{{var0}} 已複製到剪貼簿",
@@ -2149,13 +2202,14 @@ module.exports = (_ => {
default: // English default: // English
return { return {
context_copy: "Copy {{var0}}", context_copy: "Copy {{var0}}",
context_imageactions: "Image Actions", context_imageactions: "Image Actions",
context_lenssize: "Lens Size", context_lenssize: "Lens size",
context_zoomspeed: "Zoom speed",
context_saveas: "Save {{var0}} as ...", context_saveas: "Save {{var0}} as ...",
context_searchwith: "Search {{var0}} with ...", context_searchwith: "Search {{var0}} with ...",
context_videoactions: "Video Actions", context_streamactions: "Stream Preview Actions",
context_videoactions: "Video Actions",
context_view: "View {{var0}}", context_view: "View {{var0}}",
context_zoomspeed: "Zoom speed",
submenu_disabled: "All disabled", submenu_disabled: "All disabled",
toast_copy_failed: "{{var0}} could not be copied to the Clipboard", toast_copy_failed: "{{var0}} could not be copied to the Clipboard",
toast_copy_success: "{{var0}} was copied to the Clipboard", toast_copy_success: "{{var0}} was copied to the Clipboard",

View File

@@ -1,5 +1,8 @@
{ {
"settings": { "settings": {
"latestUsedVersion": "1.3.3" "latestUsedVersion": "1.3.3",
"exclude": [
"709081938622939166"
]
} }
} }

View File

@@ -271,6 +271,94 @@
"mute": false, "mute": false,
"sound": "---", "sound": "---",
"volume": 100 "volume": 100
},
"clip_save": {
"category": "---",
"focus": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
},
"activities-rocket-time": {
"category": "---",
"focus": false,
"invisibleMute": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
},
"activity_end": {
"category": "---",
"focus": false,
"invisibleMute": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
},
"activity_launch": {
"category": "---",
"focus": false,
"invisibleMute": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
},
"activity_user_join": {
"category": "---",
"focus": false,
"invisibleMute": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
},
"activity_user_left": {
"category": "---",
"focus": false,
"invisibleMute": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
},
"clip_error": {
"category": "---",
"focus": false,
"invisibleMute": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
},
"hang_status_select": {
"category": "---",
"focus": false,
"invisibleMute": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
},
"call_ringing_snowsgiving": {
"category": "---",
"focus": false,
"invisibleMute": false,
"mute": null,
"sound": "---",
"streamMute": false,
"volume": 100
},
"message3": {
"category": "---",
"invisibleMute": false,
"mute": false,
"sound": "---",
"streamMute": false,
"volume": 100
} }
}, },
"volumes": { "volumes": {

View File

@@ -2,7 +2,7 @@
* @name NotificationSounds * @name NotificationSounds
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 3.7.8 * @version 3.9.2
* @description Allows you to replace the native Sounds with custom Sounds * @description Allows you to replace the native Sounds with custom Sounds
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -14,7 +14,12 @@
module.exports = (_ => { module.exports = (_ => {
const changeLog = { const changeLog = {
"added": {
"Current Channel": "Added Option to change the sound for the current channel notification, (note: Discord added an option in the THEIR notification settings to play a different sound when a message is sent in the current channel, you need to have this enabled in order to be able to change the sound in the plugin settings"
},
"fixed": {
"Current Channel": "No longer plays notification sounds for current channels, if the option is disabled"
}
}; };
return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class { return !window.BDFDB_Global || (!window.BDFDB_Global.loaded && !window.BDFDB_Global.started) ? class {
@@ -25,9 +30,14 @@ module.exports = (_ => {
getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
downloadLibrary () { downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => {
if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); if (!r || r.status != 200) throw new Error();
else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); 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");
}); });
} }
@@ -67,13 +77,24 @@ module.exports = (_ => {
let types = {}; let types = {};
const message1Types = { const message1Types = {
dm: {src: "./message3.mp3", name: "Message (Direct Message)", force: null, focus: true}, dm: {src: "./message3.mp3", name: "Message (Direct Message)"},
groupdm: {src: "./message3.mp3", name: "Message (Group Message)", force: null, focus: true}, groupdm: {src: "./message3.mp3", name: "Message (Group Message)"},
mentioned: {src: "./message2.mp3", name: "Message Mentioned", force: false, focus: true}, mentioned: {src: "./message2.mp3", name: "Message Mentioned"},
reply: {src: "./message2.mp3", name: "Message Mentioned (reply)", force: false, focus: true}, reply: {src: "./message2.mp3", name: "Message Mentioned (reply)"},
role: {src: "./mention1.mp3", name: "Message Mentioned (role)", force: false, focus: true}, role: {src: "./mention1.mp3", name: "Message Mentioned (role)"},
everyone: {src: "./mention2.mp3", name: "Message Mentioned (@everyone)", force: false, focus: true}, everyone: {src: "./mention2.mp3", name: "Message Mentioned (@everyone)"},
here: {src: "./mention3.mp3", name: "Message Mentioned (@here)", force: false, focus: true} here: {src: "./mention3.mp3", name: "Message Mentioned (@here)"}
};
const namePrefixes = {
"user_join": "Voice Channel",
"user_leave": "Voice Channel",
"user_moved": "Voice Channel"
};
const nameSynonymes = {
"message3": "Message (Current Channel)",
"reconnect": "Invited To Speak"
}; };
const defaultAudios = { const defaultAudios = {
@@ -101,6 +122,16 @@ module.exports = (_ => {
audio.play(); audio.play();
}); });
} }
playWithListener (duration) {
return new Promise((callback, errorCallback) => {
this._ensureAudio().then(audio => {
if (!duration && duration !== 0) errorCallback(new Error("sound has no duration"));
audio.loop = false;
audio.play();
setTimeout(_ => callback(true), duration);
});
});
}
pause () { pause () {
this._audio.then(audio => { this._audio.then(audio => {
audio.pause(); audio.pause();
@@ -152,7 +183,7 @@ module.exports = (_ => {
this.defaults = { this.defaults = {
volumes: { volumes: {
globalVolume: {value: 100, description: "Global Notification Sounds Volume"} globalVolume: {value: 100, description: "Global Notification Sounds Volume"}
} }
}; };
@@ -163,7 +194,7 @@ module.exports = (_ => {
const soundKeys = BDFDB.LibraryModules.SoundParser.keys(); const soundKeys = BDFDB.LibraryModules.SoundParser.keys();
for (let key of soundKeys) { for (let key of soundKeys) {
const id = key.replace("./", "").replace(".mp3", ""); const id = key.replace("./", "").replace(".mp3", "");
const name = id == "reconnect" ? "Invited To Speak" : id.replace("ddr-", "HotKeys_").replace("ptt_", "Push2Talk_").split("_").map(BDFDB.StringUtils.upperCaseFirstChar).join(" ").replace(/1$/g, ""); const name = [namePrefixes[id], (nameSynonymes[id] || id).replace("ddr-", "HotKeys_").replace("ptt_", "Push2Talk_").split(/[_-]/)].flat(10).filter(n => n).map(BDFDB.StringUtils.upperCaseFirstChar).join(" ").replace(/1$/g, "");
const src = BDFDB.LibraryModules.SoundParser(key); const src = BDFDB.LibraryModules.SoundParser(key);
let soundPackName = id.split("_")[0]; let soundPackName = id.split("_")[0];
@@ -179,19 +210,18 @@ module.exports = (_ => {
src: src, src: src,
mute: id.startsWith("call_") ? null : false, mute: id.startsWith("call_") ? null : false,
streamMute: false, streamMute: false,
force: id == "message1" ? false : null, invisibleMute: false
focus: id == "message1" ? true : false
}; };
if (id == "message1") { if (id == "message1") {
types[id].mute = true; types[id].mute = true;
types[id].streamMute = false; types[id].streamMute = false;
types[id].invisibleMute = false;
for (let subType in message1Types) types[subType] = { for (let subType in message1Types) types[subType] = {
name: message1Types[subType].name, name: message1Types[subType].name,
src: BDFDB.LibraryModules.SoundParser(message1Types[subType].src), src: BDFDB.LibraryModules.SoundParser(message1Types[subType].src),
mute: true, mute: true,
streamMute: false, streamMute: false,
force: message1Types[subType].force, invisibleMute: false
focus: message1Types[subType].focus
} }
} }
} }
@@ -225,53 +255,54 @@ module.exports = (_ => {
const message = e.methodArguments[0].message; const message = e.methodArguments[0].message;
const guildId = message.guild_id || null; const guildId = message.guild_id || null;
if (message.author.id != BDFDB.UserUtils.me.id && !BDFDB.LibraryStores.RelationshipStore.isBlocked(message.author.id)) { if (message.author.id != BDFDB.UserUtils.me.id && !BDFDB.LibraryStores.RelationshipStore.isBlocked(message.author.id)) {
const isCurrent = BDFDB.LibraryStores.SelectedChannelStore.getChannelId() == message.channel_id;
const channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id); const channel = BDFDB.LibraryStores.ChannelStore.getChannel(message.channel_id);
const isGroupDM = channel.isGroupDM(); const isGroupDM = channel.isGroupDM();
const muted = BDFDB.ChannelUtils.isThread(channel) ? BDFDB.LibraryStores.JoinedThreadsStore.isMuted(channel.id) : BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildId, channel.id); const isThread = BDFDB.ChannelUtils.isThread(channel);
const focused = document.hasFocus() && BDFDB.LibraryStores.SelectedChannelStore.getChannelId() == channel.id; if (isThread && BDFDB.LibraryStores.JoinedThreadsStore.isMuted(channel.id) || !isThread && BDFDB.LibraryStores.UserGuildSettingsStore.isGuildOrCategoryOrChannelMuted(guildId, channel.id)) return;
if (!guildId && !muted && !(choices[isGroupDM ? "groupdm" : "dm"].focus && focused)) { if (!guildId) {
this.fireEvent(isGroupDM ? "groupdm" : "dm"); this.fireEvent(isGroupDM ? "groupdm" : "dm");
this.playAudio(isGroupDM ? "groupdm" : "dm"); !BDFDB.LibraryStores.NotificationSettingsStore.getNotifyMessagesInSelectedChannel() && !document.hasFocus() && this.playAudio(isGroupDM ? "groupdm" : "dm");
return; return;
} }
else if (guildId) { else if (guildId) {
if (BDFDB.LibraryModules.MentionUtils.isRawMessageMentioned({rawMessage: message, userId: BDFDB.UserUtils.me.id})) { if (BDFDB.LibraryModules.MentionUtils.isRawMessageMentioned({rawMessage: message, userId: BDFDB.UserUtils.me.id})) {
if (message.mentions.length && !this.isSuppressMentionsEnabled(guildId, channel.id)) for (const mention of message.mentions) if (mention.id == BDFDB.UserUtils.me.id) { if (message.mentions.length && !this.isSuppressMentionsEnabled(guildId, channel.id)) for (const mention of message.mentions) if (mention.id == BDFDB.UserUtils.me.id) {
if (message.message_reference && !message.interaction && (!muted || choices.reply.force) && !(choices.reply.focus && focused)) { if (message.message_reference && !message.interaction) {
this.fireEvent("reply"); this.fireEvent("reply");
this.playAudio("reply"); !isCurrent && this.playAudio("reply");
return; return;
} }
if (!message.message_reference && (!muted || choices.mentioned.force) && !(choices.mentioned.focus && focused)) { if (!message.message_reference) {
this.fireEvent("mentioned"); this.fireEvent("mentioned");
this.playAudio("mentioned"); !isCurrent && this.playAudio("mentioned");
return; return;
} }
} }
if (message.mention_roles.length && !BDFDB.LibraryStores.UserGuildSettingsStore.isSuppressRolesEnabled(guildId, channel.id) && (!muted || choices.role.force) && !(choices.role.focus && focused)) { if (message.mention_roles.length && !BDFDB.LibraryStores.UserGuildSettingsStore.isSuppressRolesEnabled(guildId, channel.id)) {
const member = BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, BDFDB.UserUtils.me.id); const member = BDFDB.LibraryStores.GuildMemberStore.getMember(guildId, BDFDB.UserUtils.me.id);
if (member && member.roles.length) for (const roleId of message.mention_roles) if (member.roles.includes(roleId)) { if (member && member.roles.length) for (const roleId of message.mention_roles) if (member.roles.includes(roleId)) {
this.fireEvent("role"); this.fireEvent("role");
this.playAudio("role"); !isCurrent && this.playAudio("role");
return; return;
} }
} }
if (message.mention_everyone && !BDFDB.LibraryStores.UserGuildSettingsStore.isSuppressEveryoneEnabled(guildId, channel.id)) { if (message.mention_everyone && !BDFDB.LibraryStores.UserGuildSettingsStore.isSuppressEveryoneEnabled(guildId, channel.id)) {
if (message.content.indexOf("@everyone") > -1 && (!muted || choices.everyone.force) && !(choices.everyone.focus && focused)) { if (message.content.indexOf("@everyone") > -1) {
this.fireEvent("everyone"); this.fireEvent("everyone");
this.playAudio("everyone"); !isCurrent && this.playAudio("everyone");
return; return;
} }
if (message.content.indexOf("@here") > -1 && (!muted || choices.here.force) && !(choices.here.focus && focused)) { if (message.content.indexOf("@here") > -1) {
this.fireEvent("here"); this.fireEvent("here");
this.playAudio("here"); !isCurrent && this.playAudio("here");
return; return;
} }
} }
} }
if (BDFDB.LibraryStores.UserGuildSettingsStore.allowAllMessages(channel) && (!muted || choices.message1.force) && !(choices.message1.focus && focused)) { if (BDFDB.LibraryStores.UserGuildSettingsStore.allowAllMessages(channel) && !(isThread && !BDFDB.LibraryStores.JoinedThreadsStore.hasJoined(channel.id))) {
this.fireEvent("message1"); this.fireEvent("message1");
this.playAudio("message1"); !isCurrent && this.playAudio("message1");
return; return;
} }
} }
@@ -287,25 +318,22 @@ module.exports = (_ => {
let cancel = BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "createSound", {after: e => { let cancel = BDFDB.PatchUtils.patch(this, BDFDB.LibraryModules.SoundUtils, "createSound", {after: e => {
if (e.returnValue && e.returnValue.constructor && e.returnValue.constructor.prototype && typeof e.returnValue.constructor.prototype.play == "function") { if (e.returnValue && e.returnValue.constructor && e.returnValue.constructor.prototype && typeof e.returnValue.constructor.prototype.play == "function") {
cancel(); cancel();
BDFDB.PatchUtils.patch(this, e.returnValue.constructor.prototype, ["play", "loop"], {instead: e2 => { BDFDB.PatchUtils.patch(this, e.returnValue.constructor.prototype, ["play", "loop", "playWithListener"], {instead: e2 => {
let type = e2.instance && e2.instance.name; let type = e2.instance && e2.instance.name;
let loop = e2.originalMethodName == "loop";
if (type && choices[type]) { if (type && choices[type]) {
e2.stopOriginalMethodCall(); e2.stopOriginalMethodCall();
BDFDB.TimeUtils.timeout(_ => { if (type == "message1") BDFDB.TimeUtils.timeout(_ => {
if (type == "message1") { let called = false;
let called = false; for (let subType of [type].concat(Object.keys(message1Types))) if (firedEvents[subType]) {
for (let subType of [type].concat(Object.keys(message1Types))) if (firedEvents[subType]) { delete firedEvents[subType];
delete firedEvents[subType]; called = true;
called = true; break;
break;
}
if (!called) this.playAudio(type, loop);
} }
else this.playAudio(type, loop); if (!called) return this.playAudio(type, e2.originalMethodName, e2.instance.duration);
}); });
else return this.playAudio(type, e2.originalMethodName, e2.instance.duration);
} }
else this.playAudio(type, loop); else return this.playAudio(type, e2.originalMethodName, e2.instance.duration);
}}); }});
BDFDB.PatchUtils.patch(this, e.returnValue.constructor.prototype, "stop", {after: e2 => { BDFDB.PatchUtils.patch(this, e.returnValue.constructor.prototype, "stop", {after: e2 => {
let type = e2.instance && e2.instance.name; let type = e2.instance && e2.instance.name;
@@ -404,7 +432,7 @@ module.exports = (_ => {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Button, {
style: {marginBottom: 1}, style: {marginBottom: 1},
onClick: _ => { onClick: _ => {
for (let input of settingsPanel.props._node.querySelectorAll(".input-newsound " + BDFDB.dotCN.input)) if (!input.value || input.value.length == 0 || input.value.trim().length == 0) return BDFDB.NotificationUtils.toast("Fill out all fields to add a new sound", {type: "danger"}); for (let input of settingsPanel.props._node.querySelectorAll(".input-newsound " + BDFDB.dotCN.input)) if (!input.value || input.value.length == 0 || input.value.trim().length == 0) return BDFDB.NotificationUtils.toast("Fill out all Fields to add a new Sound", {type: "danger"});
let category = settingsPanel.props._node.querySelector(".input-category " + BDFDB.dotCN.input).value.trim(); let category = settingsPanel.props._node.querySelector(".input-category " + BDFDB.dotCN.input).value.trim();
let sound = settingsPanel.props._node.querySelector(".input-sound " + BDFDB.dotCN.input).value.trim(); let sound = settingsPanel.props._node.querySelector(".input-sound " + BDFDB.dotCN.input).value.trim();
let source = settingsPanel.props._node.querySelector(".input-source " + BDFDB.dotCN.input).value.trim(); let source = settingsPanel.props._node.querySelector(".input-source " + BDFDB.dotCN.input).value.trim();
@@ -415,9 +443,9 @@ module.exports = (_ => {
} }
BDFDB.NotificationUtils.toast("Use a valid direct link to a video or audio source, they usually end on something like .mp3, .mp4 or .wav", {type: "danger"}); BDFDB.NotificationUtils.toast("Use a valid direct link to a video or audio source, they usually end on something like .mp3, .mp4 or .wav", {type: "danger"});
}); });
else BDFDB.LibraryRequires.fs.readFile(source, "", (error, buffer) => { else BDFDB.LibraryRequires.fs.readFile(source, "base64", (error, body) => {
if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists", {type: "danger"}); if (error) BDFDB.NotificationUtils.toast("Could not fetch file. Please make sure the file exists.", {type: "danger"});
else return successSavedAudio({category, sound, source: `data:audio/mpeg;base64,${Buffer.from(buffer).toString("base64")}`}); else return successSavedAudio({category, sound, source: `data:audio/mpeg;base64,${body}`});
}); });
}, },
children: BDFDB.LanguageUtils.LanguageStrings.SAVE children: BDFDB.LanguageUtils.LanguageStrings.SAVE
@@ -430,7 +458,7 @@ module.exports = (_ => {
settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, { settingsItems.push(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.CollapseContainer, {
title: "Sound Configuration", title: "Sound Configuration",
collapseStates: collapseStates, collapseStates: collapseStates,
children: Object.keys(types).map(type => [ children: Object.keys(types).map(type => type == "message3" && !BDFDB.LibraryStores.NotificationSettingsStore.getNotifyMessagesInSelectedChannel() ? null : [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
className: BDFDB.disCN.marginbottom8, className: BDFDB.disCN.marginbottom8,
align: BDFDB.LibraryComponents.Flex.Align.CENTER, align: BDFDB.LibraryComponents.Flex.Align.CENTER,
@@ -439,34 +467,20 @@ module.exports = (_ => {
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsLabel, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsLabel, {
label: types[type].name label: types[type].name
}), }),
["force", "focus", "mute", "streamMute"].some(n => types[type][n] !== null) && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, { ["mute", "streamMute", "invisibleMute"].some(n => types[type][n] !== null) && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Clickable, {
onClick: event => BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { onClick: event => BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: [ children: [
{key: "force", label: "Force Play", hint: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: "Plays the Message Sound even if the Channel of the Message is muted",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
name: BDFDB.LibraryComponents.SvgIcon.Names.QUESTIONMARK,
width: 18,
height: 18
})
})},
{key: "focus", label: "Focus Mute", hint: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, {
text: "Does not play the Message Sound when the Channel of the Message is currently opened",
children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, {
name: BDFDB.LibraryComponents.SvgIcon.Names.QUESTIONMARK,
width: 18,
height: 18
})
})},
{key: "mute", label: ["Mute in", BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.StatusComponents.Status, {style: {marginLeft: 6}, size: 12, status: BDFDB.LibraryComponents.StatusComponents.Types.DND})]}, {key: "mute", label: ["Mute in", BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.StatusComponents.Status, {style: {marginLeft: 6}, size: 12, status: BDFDB.LibraryComponents.StatusComponents.Types.DND})]},
{key: "streamMute", label: ["Mute while", BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.StatusComponents.Status, {style: {marginLeft: 6}, size: 12, status: BDFDB.LibraryComponents.StatusComponents.Types.STREAMING})]}, {key: "invisibleMute", label: ["Mute in", BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.StatusComponents.Status, {style: {marginLeft: 6}, size: 12, status: BDFDB.LibraryComponents.StatusComponents.Types.INVISIBLE})]},
{key: "streamMute", label: ["Mute while", BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.StatusComponents.Status, {style: {marginLeft: 6}, size: 12, status: BDFDB.LibraryComponents.StatusComponents.Types.STREAMING})]}
].map(n => types[type][n.key] !== null && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuCheckboxItem, { ].map(n => types[type][n.key] !== null && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuCheckboxItem, {
label: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, { label: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, {
align: BDFDB.LibraryComponents.Flex.Align.CENTER,
children: n.label children: n.label
}), }),
hint: n.hint, hint: n.hint,
id: BDFDB.ContextMenuUtils.createItemId(this.name, type, n.key), id: BDFDB.ContextMenuUtils.createItemId(this.name, type, n.key),
checked: types[type][n.key], checked: choices[type][n.key],
action: state => { action: state => {
choices[type][n.key] = state; choices[type][n.key] = state;
this.saveChoice(type, false); this.saveChoice(type, false);
@@ -676,7 +690,7 @@ module.exports = (_ => {
volume: 100, volume: 100,
mute: types[type].mute, mute: types[type].mute,
streamMute: types[type].streamMute, streamMute: types[type].streamMute,
focus: types[type].focus invisibleMute: types[type].invisibleMute
}; };
choices[type] = choice; choices[type] = choice;
this.saveChoice(type, false); this.saveChoice(type, false);
@@ -692,11 +706,11 @@ module.exports = (_ => {
} }
} }
playAudio (type, loop = false) { playAudio (type, functionCall = "play", duration = 0) {
if (this.dontPlayAudio(type) || BDFDB.LibraryStores.StreamerModeStore.disableSounds) return; if (this.dontPlayAudio(type) || BDFDB.LibraryStores.StreamerModeStore.disableSounds) return;
if (createdAudios[type]) createdAudios[type].stop(); if (createdAudios[type]) createdAudios[type].stop();
createdAudios[type] = new WebAudioSound(type); createdAudios[type] = new WebAudioSound(type);
createdAudios[type][loop ? "loop" : "play"](); return createdAudios[type][typeof createdAudios[type][functionCall] == "function" ? functionCall : "play"](duration);
} }
isSuppressMentionsEnabled (guildId, channelId) { isSuppressMentionsEnabled (guildId, channelId) {
@@ -706,7 +720,7 @@ module.exports = (_ => {
dontPlayAudio (type) { dontPlayAudio (type) {
let status = BDFDB.UserUtils.getStatus(); let status = BDFDB.UserUtils.getStatus();
return choices[type] && (choices[type].mute && status == "dnd" || choices[type].streamMute && status == "streaming"); return choices[type] && (choices[type].mute && status == "dnd" || choices[type].streamMute && status == "streaming" || choices[type].invisibleMute && (status == "offline" || status == "invisible"));
} }
fireEvent (type) { fireEvent (type) {
@@ -715,7 +729,7 @@ module.exports = (_ => {
} }
isSoundUsedAnywhere (type) { isSoundUsedAnywhere (type) {
return type && type.indexOf("poggermode_") != 0 && type != "human_man" && type != "robot_man" && type != "discodo" && type != "overlayunlock" && type != "call_ringing_beat" && !(type != "message1" && /\d$/.test(type)); return type && type.indexOf("poggermode_") != 0 && type != "human_man" && type != "robot_man" && type != "discodo" && type != "overlayunlock" && type != "call_ringing_beat" && !(type != "message1" && type != "message3" && /\d$/.test(type));
} }
}; };
})(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog)); })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog));

View File

@@ -10,7 +10,7 @@
"channelList": { "channelList": {
"1741875717362926": { "1741875717362926": {
"id": "1741875717362926", "id": "1741875717362926",
"name": "Pinned Direct Messages #1", "name": "",
"dms": [ "dms": [
"815678838809296926", "815678838809296926",
"740325591684874305", "740325591684874305",

View File

@@ -2,7 +2,7 @@
* @name PinDMs * @name PinDMs
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 1.9.7 * @version 2.0.3
* @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList * @description Allows you to pin DMs, making them appear at the top of your DMs/ServerList
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -59,6 +59,8 @@ module.exports = (_ => {
var hoveredCategory, draggedCategory, releasedCategory; var hoveredCategory, draggedCategory, releasedCategory;
var hoveredChannel, draggedChannel, releasedChannel; var hoveredChannel, draggedChannel, releasedChannel;
var channelListIsRenderendering;
return class PinDMs extends Plugin { return class PinDMs extends Plugin {
onLoad () { onLoad () {
this.defaults = { this.defaults = {
@@ -89,8 +91,7 @@ module.exports = (_ => {
"PrivateChannelsList" "PrivateChannelsList"
], ],
componentDidMount: [ componentDidMount: [
"DirectMessage", "DirectMessage"
"PrivateChannel"
], ],
componentWillUnmount: [ componentWillUnmount: [
"DirectMessage" "DirectMessage"
@@ -259,7 +260,7 @@ module.exports = (_ => {
onUserContextMenu (e) { onUserContextMenu (e) {
if (e.instance.props.channel && !e.instance.props.channel.guild_id) { if (e.instance.props.channel && !e.instance.props.channel.guild_id) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"}); let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "close-dm"});
children.splice(index > -1 ? index : children.length, 0, this.createItem(e.instance.props.channel.id)); children.splice(index > -1 ? index : children.length, 0, this.createItem(e.instance, e.instance.props.channel.id));
} }
} }
@@ -267,12 +268,12 @@ module.exports = (_ => {
if (e.instance.props.channel) { if (e.instance.props.channel) {
let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon", group: true}); let [children, index] = BDFDB.ContextMenuUtils.findItem(e.returnvalue, {id: "change-icon", group: true});
children.splice(index > -1 ? index + 1 : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { children.splice(index > -1 ? index + 1 : children.length, 0, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, {
children: this.createItem(e.instance.props.channel.id) children: this.createItem(e.instance, e.instance.props.channel.id)
})); }));
} }
} }
createItem (id) { createItem (instance, id) {
if (!id) return; if (!id) return;
let pinnedInGuild = this.isPinnedInGuilds(id); let pinnedInGuild = this.isPinnedInGuilds(id);
@@ -312,6 +313,7 @@ module.exports = (_ => {
label: category.name || this.labels.header_pinneddms, label: category.name || this.labels.header_pinneddms,
id: BDFDB.ContextMenuUtils.createItemId(this.name, "pin-channellist", category.id), id: BDFDB.ContextMenuUtils.createItemId(this.name, "pin-channellist", category.id),
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(instance);
if (currentCategory) this.removeFromCategory(id, currentCategory, "channelList"); if (currentCategory) this.removeFromCategory(id, currentCategory, "channelList");
this.addToCategory(id, category, "channelList"); this.addToCategory(id, category, "channelList");
} }
@@ -324,6 +326,7 @@ module.exports = (_ => {
id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"), id: BDFDB.ContextMenuUtils.createItemId(this.name, pinnedInGuild ? "unpin-serverlist" : "pin-serverlist"),
color: pinnedInGuild ? BDFDB.DiscordConstants.MenuItemColors.DANGER : BDFDB.DiscordConstants.MenuItemColors.DEFAULT, color: pinnedInGuild ? BDFDB.DiscordConstants.MenuItemColors.DANGER : BDFDB.DiscordConstants.MenuItemColors.DEFAULT,
action: _ => { action: _ => {
BDFDB.ContextMenuUtils.close(instance);
if (!pinnedInGuild) this.addPin(id, "guildList"); if (!pinnedInGuild) this.addPin(id, "guildList");
else this.removePin(id, "guildList"); else this.removePin(id, "guildList");
} }
@@ -381,7 +384,7 @@ module.exports = (_ => {
}, after: e2 => { }, after: e2 => {
if (e2.methodArguments[0] != 0) { if (e2.methodArguments[0] != 0) {
let id = e.instance.props.privateChannelIds[e2.methodArguments[1]]; let id = e.instance.props.privateChannelIds[e2.methodArguments[1]];
e2.returnValue = e.instance.props.channels[id] ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PrivateChannelItems[e.instance.props.channels[id].isMultiUserDM() ? "GroupDM" : "DirectMessage"], Object.assign({ e2.returnValue = e.instance.props.channels[id] ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.PrivateChannelItems.DirectMessage, Object.assign({
key: id, key: id,
channel: e.instance.props.channels[id], channel: e.instance.props.channels[id],
selected: e.instance.props.selectedChannelId == id selected: e.instance.props.selectedChannelId == id
@@ -522,7 +525,7 @@ module.exports = (_ => {
if (!this.settings.preCategories[category.id]) return; if (!this.settings.preCategories[category.id]) return;
this.settings.preCategories[category.id].enabled = false; this.settings.preCategories[category.id].enabled = false;
BDFDB.DataUtils.save(this.settings.preCategories, this, "preCategories"); BDFDB.DataUtils.save(this.settings.preCategories, this, "preCategories");
this.updateContainer("channelList"); this.updateContainer("channelList", true);
} }
}) : [ }) : [
BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
@@ -538,7 +541,7 @@ module.exports = (_ => {
let newData = this.getPinnedChannels("channelList"); let newData = this.getPinnedChannels("channelList");
delete newData[category.id]; delete newData[category.id];
this.savePinnedChannels(newData, "channelList"); this.savePinnedChannels(newData, "channelList");
this.updateContainer("channelList"); this.updateContainer("channelList", true);
} }
}) })
] ]
@@ -606,65 +609,6 @@ module.exports = (_ => {
if (!e.instance.props.channel || this.getPredefinedCategory(e.instance.props.channel.id)) return; if (!e.instance.props.channel || this.getPredefinedCategory(e.instance.props.channel.id)) return;
let category = this.getChannelListCategory(e.instance.props.channel.id); let category = this.getChannelListCategory(e.instance.props.channel.id);
if (!category) return; if (!category) return;
if (e.node) {
BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsdmchannelpinned);
e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
if (this.settings.recentOrder.channelList) return;
e.node.setAttribute("draggable", false);
e.node.PinDMsMouseDownListener = event => {
if (!this.started) e.node.removeEventListener("mousedown", e.node.PinDMsMouseDownListener);
else {
event = event.nativeEvent || event;
let mouseMove = event2 => {
if (Math.sqrt((event.pageX - event2.pageX)**2) > 20 || Math.sqrt((event.pageY - event2.pageY)**2) > 20) {
BDFDB.ListenerUtils.stopEvent(event);
draggedChannel = e.instance.props.channel.id;
this.updateContainer("channelList");
let dragPreview = this.createDragPreview(e.node, event2);
document.removeEventListener("mousemove", mouseMove);
document.removeEventListener("mouseup", mouseUp);
let dragging = event3 => {
this.updateDragPreview(dragPreview, event3);
let maybeHoveredChannel = null;
let categoryNode = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmspinnedchannelsheadercontainer, event3.target);
if (categoryNode) {
let hoveredCategoryId = categoryNode.getAttribute("categoryid");
if (hoveredCategoryId && hoveredCategoryId == category.id) maybeHoveredChannel = "header_" + category.id;
}
else {
let placeholder = BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelplaceholder, event3.target);
maybeHoveredChannel = (BDFDB.ReactUtils.findValue(BDFDB.DOMUtils.getParent(BDFDB.dotCN._pindmsdmchannelpinned, placeholder ? placeholder.previousSibling : event3.target), "channel", {up: true}) || {}).id;
let maybeHoveredCategory = maybeHoveredChannel && this.getChannelListCategory(maybeHoveredChannel);
if (!maybeHoveredCategory || maybeHoveredCategory.id != category.id) maybeHoveredChannel = null;
};
let update = maybeHoveredChannel != hoveredChannel;
if (maybeHoveredChannel) hoveredChannel = maybeHoveredChannel;
else hoveredChannel = null;
if (update) this.updateContainer("channelList");
};
let releasing = event3 => {
BDFDB.DOMUtils.remove(dragPreview);
if (hoveredChannel) releasedChannel = hoveredChannel;
else draggedChannel = null;
hoveredChannel = null;
this.updateContainer("channelList");
document.removeEventListener("mousemove", dragging);
document.removeEventListener("mouseup", releasing);
};
document.addEventListener("mousemove", dragging);
document.addEventListener("mouseup", releasing);
}
};
let mouseUp = _ => {
document.removeEventListener("mousemove", mouseMove);
document.removeEventListener("mouseup", mouseUp);
};
document.addEventListener("mousemove", mouseMove);
document.addEventListener("mouseup", mouseUp);
}
};
e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener);
}
if (e.returnvalue) { if (e.returnvalue) {
let process = returnvalue => { let process = returnvalue => {
let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {name: "CloseButton"}); let [children, index] = BDFDB.ReactUtils.findParent(returnvalue, {name: "CloseButton"});
@@ -717,7 +661,6 @@ module.exports = (_ => {
icon: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_PIN icon: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_PIN
}); });
} }
if (this.getChannelListCategory(e.instance.props.channel.id)) this.updateContainer("channelList");
} }
} }
} }
@@ -751,7 +694,7 @@ module.exports = (_ => {
if (!category.dms.includes(id)) category.dms.unshift(id); if (!category.dms.includes(id)) category.dms.unshift(id);
this.savePinnedChannels(Object.assign({}, this.getPinnedChannels(type), {[category.id]: category}), type); this.savePinnedChannels(Object.assign({}, this.getPinnedChannels(type), {[category.id]: category}), type);
if (wasEmpty && category.dms.length) category.collapsed = false; if (wasEmpty && category.dms.length) category.collapsed = false;
this.updateContainer(type); this.updateContainer(type, true);
} }
removeFromCategory (id, category, type) { removeFromCategory (id, category, type) {
@@ -759,7 +702,7 @@ module.exports = (_ => {
BDFDB.ArrayUtils.remove(category.dms, id, true); BDFDB.ArrayUtils.remove(category.dms, id, true);
if (!this.filterDMs(category.dms).length) category.collapsed = true; if (!this.filterDMs(category.dms).length) category.collapsed = true;
this.savePinnedChannels(Object.assign({}, this.getPinnedChannels(type), {[category.id]: category}), type); this.savePinnedChannels(Object.assign({}, this.getPinnedChannels(type), {[category.id]: category}), type);
this.updateContainer(type); this.updateContainer(type, true);
} }
getChannelListCategory (id) { getChannelListCategory (id) {
@@ -819,7 +762,7 @@ module.exports = (_ => {
if (dms.length > 1 && this.settings.recentOrder[type]) { if (dms.length > 1 && this.settings.recentOrder[type]) {
let timestamps = BDFDB.LibraryStores.PrivateChannelSortStore.getPrivateChannelIds().reduce((newObj, channelId) => (newObj[channelId] = BDFDB.LibraryStores.ReadStateStore.lastMessageId(channelId), newObj), {}); let timestamps = BDFDB.LibraryStores.PrivateChannelSortStore.getPrivateChannelIds().reduce((newObj, channelId) => (newObj[channelId] = BDFDB.LibraryStores.ReadStateStore.lastMessageId(channelId), newObj), {});
return [].concat(dms).sort(function (x, y) { return [].concat(dms).sort(function (x, y) {
const xT = parseFloat(timestamps[x]), yT = parseFloat(timestamps[y]); const xT = !timestamps[x] ? 0 : parseFloat(timestamps[x]), yT = !timestamps[y] ? 0 : parseFloat(timestamps[y]);
return xT > yT ? -1 : xT < yT ? 1 : 0; return xT > yT ? -1 : xT < yT ? 1 : 0;
}); });
} }
@@ -900,11 +843,15 @@ module.exports = (_ => {
return this.getPinnedChannels("guildList")[id] != undefined; return this.getPinnedChannels("guildList")[id] != undefined;
} }
updateContainer (type) { updateContainer (type, force) {
switch (type) { switch (type) {
case "channelList": case "channelList":
BDFDB.PatchUtils.forceAllUpdates(this, "PrivateChannelsList"); /* DOES NOT WORK */ if (force) {
if (!Object.keys(this.settings.preCategories).every(type => this.settings.preCategories[type].enabled) && BDFDB.ObjectUtils.isEmpty(this.getPinnedChannels(type))) this.forceUpdateAll(); if (!channelListIsRenderendering) BDFDB.DiscordUtils.rerenderAll(true);
channelListIsRenderendering = true;
BDFDB.TimeUtils.timeout(_ => channelListIsRenderendering = false, 3000);
}
else BDFDB.PatchUtils.forceAllUpdates(this, "PrivateChannelsList");
break; break;
case "guildList": case "guildList":
BDFDB.DiscordUtils.rerenderAll(true); BDFDB.DiscordUtils.rerenderAll(true);
@@ -1007,10 +954,10 @@ module.exports = (_ => {
context_addtonewcategory: "Προσθήκη σε νέα κατηγορία", context_addtonewcategory: "Προσθήκη σε νέα κατηγορία",
context_disablepredefined: "Απενεργοποίηση προκαθορισμένης κατηγορίας", context_disablepredefined: "Απενεργοποίηση προκαθορισμένης κατηγορίας",
context_pinchannel: "Καρφίτσωμα στη λίστα καναλιών", context_pinchannel: "Καρφίτσωμα στη λίστα καναλιών",
context_pindm: "Καρφιτσώστε το άμεσο μήνυμα", context_pindm: "Καρφίτσωμα του άμεσου μηνύματος",
context_pinguild: "Καρφίτσωμα στη λίστα διακομιστών", context_pinguild: "Καρφίτσωμα στη λίστα διακομιστών",
context_unpinchannel: "Αποσύνδεση από τη λίστα καναλιών", context_unpinchannel: "Ξεκαρφίτσωμα από τη λίστα καναλιών",
context_unpinguild: "Αποσύνδεση από τη λίστα διακομιστών", context_unpinguild: "Ξεκαρφίτσωμα από τη λίστα διακομιστών",
header_pinneddms: "Καρφιτσωμένα άμεσα μηνύματα", header_pinneddms: "Καρφιτσωμένα άμεσα μηνύματα",
modal_colorpicker1: "Χρώμα κατηγορίας" modal_colorpicker1: "Χρώμα κατηγορίας"
}; };

View File

@@ -1,6 +1,6 @@
{ {
"all": { "all": {
"cached": "2 7 8 9 11 14 15 17 28 29 30 59 60 61 62 63 64 65 66 67 68 70 71 73 74 75 76 77 80 81 82 83 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 101 102 104 105 106 108 109 110 111 116 120 122 126 127 131 132 133 134 137 138 139 146 157 158 159 160 162 164 171 173 176 179 181 182 183 184 185 186 188 189 190 193 195 196 197 200 201 220 228 234 237 238 240 245 247 253 262 272 274 278 284 287 291 292 293 295 301 306 312 314 317 318 323 331 336 337 338 340 344 349 350 351 352 353 354 356 364 366 368 377 379 381 382 383 390 395 401 404 420 421 429 438 442 476 479 489 509 518 520 523 525 535 538 539 547 554 566 577 579 589 592 593 598 599 606 608 611 614 620 621 627 638 644 645 669 670 671 679 686 692 693 694 699 708 760 762 772 798 802 805 806 807 819 827 843 856 859 867", "cached": "2 7 8 9 11 14 15 17 28 29 30 59 60 61 62 63 64 65 66 67 70 71 73 74 75 76 77 80 81 82 83 85 86 87 88 89 91 92 93 94 95 96 97 98 99 100 101 102 104 105 106 108 109 110 111 120 126 127 131 132 134 137 138 139 146 157 158 159 160 162 171 173 176 179 181 182 183 184 185 186 188 189 190 193 195 196 197 200 201 228 237 238 240 245 262 274 278 287 291 292 293 295 306 312 314 317 318 323 331 344 350 351 352 353 354 356 366 368 377 379 381 382 383 390 395 401 404 420 421 429 438 442 476 479 489 509 518 520 523 525 535 539 547 554 577 579 589 592 593 598 599 606 608 611 614 620 621 627 638 644 645 670 671 679 686 692 693 694 699 708 760 762 772 798 802 805 806 807 819 827 843 845 850 856 859 867 878 881 882 883 930 936 938 953 954 970 971 979 989 990 996 1000 1005 1010 1016 1023",
"filters": { "filters": {
"updated": true, "updated": true,
"outdated": true, "outdated": true,

View File

@@ -2,7 +2,7 @@
* @name PluginRepo * @name PluginRepo
* @author DevilBro * @author DevilBro
* @authorId 278543574059057154 * @authorId 278543574059057154
* @version 2.4.6 * @version 2.5.5
* @description Allows you to download all Plugins from BD's Website within Discord * @description Allows you to download all Plugins from BD's Website within Discord
* @invite Jx3TjNS * @invite Jx3TjNS
* @donate https://www.paypal.me/MircoWittrien * @donate https://www.paypal.me/MircoWittrien
@@ -25,9 +25,14 @@ module.exports = (_ => {
getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;} getDescription () {return `The Library Plugin needed for ${this.name} is missing. Open the Plugin Settings to download it. \n\n${this.description}`;}
downloadLibrary () { downloadLibrary () {
require("request").get("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js", (e, r, b) => { BdApi.Net.fetch("https://mwittrien.github.io/BetterDiscordAddons/Library/0BDFDB.plugin.js").then(r => {
if (!e && b && r.statusCode == 200) require("fs").writeFile(require("path").join(BdApi.Plugins.folder, "0BDFDB.plugin.js"), b, _ => BdApi.showToast("Finished downloading BDFDB Library", {type: "success"})); if (!r || r.status != 200) throw new Error();
else BdApi.alert("Error", "Could not download BDFDB Library Plugin. Try again later or download it manually from GitHub: https://mwittrien.github.io/downloader/?library"); 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");
}); });
} }
@@ -60,7 +65,7 @@ module.exports = (_ => {
var list; var list;
var loading, cachedPlugins, grabbedPlugins, updateInterval; var loading, cachedPlugins, grabbedPlugins, updateInterval, errorState;
var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated; var searchString, searchTimeout, forcedSort, forcedOrder, showOnlyOutdated;
var favorites = []; var favorites = [];
@@ -94,8 +99,8 @@ module.exports = (_ => {
NAME: "Name", NAME: "Name",
AUTHORNAME: "Author", AUTHORNAME: "Author",
VERSION: "Version", VERSION: "Version",
DESCRIPTION: "Description", DESCRIPTION: "Description",
RELEASEDATE: "Release Date", RELEASEDATE: "Release Date",
STATE: "Update State", STATE: "Update State",
DOWNLOADS: "Downloads", DOWNLOADS: "Downloads",
LIKES: "Likes", LIKES: "Likes",
@@ -124,7 +129,7 @@ module.exports = (_ => {
let plugins = grabbedPlugins.map(plugin => { let plugins = grabbedPlugins.map(plugin => {
if (plugin.failed) return; if (plugin.failed) return;
const installedPlugin = _this.getInstalledPlugin(plugin); const installedPlugin = _this.getInstalledPlugin(plugin);
const state = installedPlugin ? (plugin.version && _this.compareVersions(plugin.version, _this.getString(installedPlugin.version)) ? pluginStates.OUTDATED : pluginStates.INSTALLED) : pluginStates.DOWNLOADABLE; const state = installedPlugin ? (plugin.version && _this.compareVersions(plugin.version, _this.getString(installedPlugin.plugin && installedPlugin.plugin.version || installedPlugin.version)) ? pluginStates.OUTDATED : pluginStates.INSTALLED) : pluginStates.DOWNLOADABLE;
return Object.assign(plugin, { return Object.assign(plugin, {
search: [plugin.name, plugin.version, plugin.authorname, plugin.description, plugin.tags].flat(10).filter(n => typeof n == "string").join(" ").toUpperCase(), search: [plugin.name, plugin.version, plugin.authorname, plugin.description, plugin.tags].flat(10).filter(n => typeof n == "string").join(" ").toUpperCase(),
description: plugin.description || "No Description found", description: plugin.description || "No Description found",
@@ -133,10 +138,10 @@ module.exports = (_ => {
state: state state: state
}); });
}).filter(n => n); }).filter(n => n);
if (!this.props.updated) plugins = plugins.filter(plugin => plugin.state != pluginStates.INSTALLED); if (!this.props.updated) plugins = plugins.filter(plugin => plugin.state != pluginStates.INSTALLED);
if (!this.props.outdated) plugins = plugins.filter(plugin => plugin.state != pluginStates.OUTDATED); if (!this.props.outdated) plugins = plugins.filter(plugin => plugin.state != pluginStates.OUTDATED);
if (!this.props.downloadable) plugins = plugins.filter(plugin => plugin.state != pluginStates.DOWNLOADABLE); if (!this.props.downloadable) plugins = plugins.filter(plugin => plugin.state != pluginStates.DOWNLOADABLE);
if (searchString) { if (searchString) {
let usedSearchString = searchString.toUpperCase(); let usedSearchString = searchString.toUpperCase();
let spacelessUsedSearchString = usedSearchString.replace(/\s/g, ""); let spacelessUsedSearchString = usedSearchString.replace(/\s/g, "");
plugins = plugins.filter(plugin => plugin.search.indexOf(usedSearchString) > -1 || plugin.search.indexOf(spacelessUsedSearchString) > -1); plugins = plugins.filter(plugin => plugin.search.indexOf(usedSearchString) > -1 || plugin.search.indexOf(spacelessUsedSearchString) > -1);
@@ -151,6 +156,16 @@ module.exports = (_ => {
if (!this.props.tab) this.props.tab = "Plugins"; if (!this.props.tab) this.props.tab = "Plugins";
const entries = (!loading.is && grabbedPlugins.length ? this.filterPlugins() : []); const entries = (!loading.is && grabbedPlugins.length ? this.filterPlugins() : []);
const emptyState = errorState ? {
lightSrc: "/assets/d6dfb89ab06b62044dbb.svg",
darkSrc: "/assets/8eeb59bba0a61cbffc41.svg",
text: "Could not load Plugin Store due to an Issue with the BD Website"
} : !entries.length && !this.props.updated && !this.props.outdated && !this.props.downloadable ? {
text: `You disabled all Filter Options in the "${BDFDB.LanguageUtils.LanguageStrings.SETTINGS}" Tab`
} : !entries.length && searchString ? {
lightSrc: "/assets/75081bdaad2d359c1469.svg",
darkSrc: "/assets/45cd76fed34c8e398cc8.svg"
} : !entries.length ? {} : null;
return BDFDB.ReactUtils.createElement("div", { return BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN._repo, className: BDFDB.disCN._repo,
@@ -196,7 +211,7 @@ module.exports = (_ => {
onClick: _ => { onClick: _ => {
if (loading.is) return; if (loading.is) return;
loading = {is: false, timeout: null, amount: 0}; loading = {is: false, timeout: null, amount: 0};
_this.loadPlugins(); _this.loadPlugins(true);
} }
}) })
] ]
@@ -277,7 +292,7 @@ module.exports = (_ => {
children: `${BDFDB.LanguageUtils.LibraryStringsFormat("loading", "Plugin Repo")} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}` children: `${BDFDB.LanguageUtils.LibraryStringsFormat("loading", "Plugin Repo")} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`
}) })
] ]
}) : BDFDB.ReactUtils.createElement("div", { }) : emptyState ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.EmptyStateImage, emptyState) : BDFDB.ReactUtils.createElement("div", {
className: BDFDB.disCN.discoverycards, className: BDFDB.disCN.discoverycards,
children: entries.map(plugin => BDFDB.ReactUtils.createElement(RepoCardComponent, { children: entries.map(plugin => BDFDB.ReactUtils.createElement(RepoCardComponent, {
data: plugin data: plugin
@@ -290,7 +305,7 @@ module.exports = (_ => {
render: false, render: false,
children: [ children: [
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsPanelList, {
title: "Show following Plugins", title: "Shows following Plugins",
children: Object.keys(_this.defaults.filters).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, { children: Object.keys(_this.defaults.filters).map(key => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsSaveItem, {
type: "Switch", type: "Switch",
plugin: _this, plugin: _this,
@@ -484,13 +499,13 @@ module.exports = (_ => {
this.props.downloading = true; this.props.downloading = true;
let loadingToast = BDFDB.NotificationUtils.toast(`${BDFDB.LanguageUtils.LibraryStringsFormat("loading", this.props.data.name)} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`, {timeout: 0, ellipsis: true}); let loadingToast = BDFDB.NotificationUtils.toast(`${BDFDB.LanguageUtils.LibraryStringsFormat("loading", this.props.data.name)} - ${BDFDB.LanguageUtils.LibraryStrings.please_wait}`, {timeout: 0, ellipsis: true});
let autoloadKey = this.props.data.state == pluginStates.OUTDATED ? "startUpdated" : "startDownloaded"; let autoloadKey = this.props.data.state == pluginStates.OUTDATED ? "startUpdated" : "startDownloaded";
BDFDB.DiscordUtils.requestFileData(this.props.data.rawSourceUrl, {timeout: 10000}, (error, buffer) => { BDFDB.LibraryRequires.request(this.props.data.rawSourceUrl, (error, response, body) => {
if (error || !buffer) { if (error || !body) {
delete this.props.downloading; delete this.props.downloading;
loadingToast.close(); loadingToast.close();
BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Plugin "${this.props.data.name}"`), {type: "danger"}); BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("download_fail", `Plugin "${this.props.data.name}"`), {type: "danger"});
} }
else BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), this.props.data.rawSourceUrl.split("/").pop()), Buffer.from(buffer).toString(), error2 => { else BDFDB.LibraryRequires.fs.writeFile(BDFDB.LibraryRequires.path.join(BDFDB.BDUtils.getPluginsFolder(), this.props.data.rawSourceUrl.split("/").pop()), body, error2 => {
delete this.props.downloading; delete this.props.downloading;
loadingToast.close(); loadingToast.close();
if (error2) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("save_fail", `Plugin "${this.props.data.name}"`), {type: "danger"}); if (error2) BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LibraryStringsFormat("save_fail", `Plugin "${this.props.data.name}"`), {type: "danger"});
@@ -584,8 +599,8 @@ module.exports = (_ => {
startUpdated: {value: false, autoload: true, description: "Starts updated Plugins after Download"} startUpdated: {value: false, autoload: true, description: "Starts updated Plugins after Download"}
}, },
filters: { filters: {
updated: {value: true, description: "Updated"}, updated: {value: true, description: "Updated"},
outdated: {value: true, description: "Outdated"}, outdated: {value: true, description: "Outdated"},
downloadable: {value: true, description: "Downloadable"}, downloadable: {value: true, description: "Downloadable"},
} }
}; };
@@ -636,13 +651,15 @@ module.exports = (_ => {
onUserSettingsCogContextMenu (e) { onUserSettingsCogContextMenu (e) {
BDFDB.TimeUtils.timeout(_ => { BDFDB.TimeUtils.timeout(_ => {
let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["label", ["BandagedBD", "BetterDiscord"]]]}); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["label", ["BandagedBD", "BetterDiscord"]]]});
if (index > -1 && BDFDB.ArrayUtils.is(children[index].props.children)) children[index].props.children.push(BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { if (index > -1 && BDFDB.ArrayUtils.is(children[index].props.children)) {
label: "Plugin Repo", let item = BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, {
id: BDFDB.ContextMenuUtils.createItemId(this.name, "repo"), label: "Plugin Repo",
action: _ => { id: BDFDB.ContextMenuUtils.createItemId(this.name, "repo"),
BDFDB.LibraryModules.UserSettingsUtils.open("pluginrepo"); action: _ => BDFDB.LibraryModules.UserSettingsUtils.open("pluginrepo")
} });
})); if (children[index].props.children.find(n => n && n.props && n.props.id == "themerepo-repo")) children[index].props.children.splice(children[index].props.children.length-1, 0, item);
else children[index].props.children.push(item);
}
}); });
} }
@@ -680,7 +697,7 @@ module.exports = (_ => {
if (e.instance.props && e.instance.props.section == "pluginrepo") e.instance.props.contentType = "custom"; if (e.instance.props && e.instance.props.section == "pluginrepo") e.instance.props.contentType = "custom";
} }
loadPlugins () { loadPlugins (forceBanner) {
BDFDB.DOMUtils.remove(BDFDB.dotCN._pluginrepoloadingicon); BDFDB.DOMUtils.remove(BDFDB.dotCN._pluginrepoloadingicon);
cachedPlugins = BDFDB.DataUtils.load(this, "cached"); cachedPlugins = BDFDB.DataUtils.load(this, "cached");
cachedPlugins = (typeof cachedPlugins == "string" ? cachedPlugins.split(" ") : []).map(n => parseInt(n)).filter(n => !isNaN(n)); cachedPlugins = (typeof cachedPlugins == "string" ? cachedPlugins.split(" ") : []).map(n => parseInt(n)).filter(n => !isNaN(n));
@@ -701,7 +718,7 @@ module.exports = (_ => {
BDFDB.LogUtils.log("Finished fetching Plugins", this); BDFDB.LogUtils.log("Finished fetching Plugins", this);
BDFDB.ReactUtils.forceUpdate(list); BDFDB.ReactUtils.forceUpdate(list);
if (this.settings.general.notifyOutdated && outdatedEntries > 0) { if ((this.settings.general.notifyOutdated || forceBanner) && outdatedEntries > 0) {
let notice = document.querySelector(BDFDB.dotCN._pluginrepooutdatednotice); let notice = document.querySelector(BDFDB.dotCN._pluginrepooutdatednotice);
if (notice) notice.close(); if (notice) notice.close();
BDFDB.NotificationUtils.notice(this.labels.notice_outdated_plugins.replace("{{var0}}", outdatedEntries), { BDFDB.NotificationUtils.notice(this.labels.notice_outdated_plugins.replace("{{var0}}", outdatedEntries), {
@@ -754,20 +771,17 @@ module.exports = (_ => {
delete plugin.release_date; delete plugin.release_date;
delete plugin.latest_source_url; delete plugin.latest_source_url;
delete plugin.thumbnail_url; delete plugin.thumbnail_url;
BDFDB.DiscordUtils.requestFileData(plugin.rawSourceUrl, {timeout: 10000}, (error, buffer) => { BDFDB.LibraryRequires.request(plugin.rawSourceUrl, (error, response, body) => {
if (error || !buffer) plugin.failed = true; if (error || !body || body.indexOf("404: Not Found") == 0) plugin.failed = true;
else { else {
let body = Buffer.from(buffer).toString(); const META = body.split("*/")[0];
if (body && body.indexOf("404: Not Found") != 0) { plugin.name = BDFDB.StringUtils.upperCaseFirstChar((/@name\s+([^\t^\r^\n]+)|\/\/\**META.*["']name["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1] || plugin.name || "");
const META = body.split("*/")[0]; plugin.authorname = (/@author\s+(.+)|\/\/\**META.*["']author["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1] || plugin.author.display_name || plugin.author;
plugin.name = BDFDB.StringUtils.upperCaseFirstChar((/@name\s+([^\t^\r^\n]+)|\/\/\**META.*["']name["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1] || plugin.name || ""); const version = (/@version\s+(.+)|\/\/\**META.*["']version["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1];
plugin.authorname = (/@author\s+(.+)|\/\/\**META.*["']author["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1] || plugin.author.display_name || plugin.author; if (version) {
const version = (/@version\s+(.+)|\/\/\**META.*["']version["']\s*:\s*["'](.+?)["']/i.exec(META) || []).filter(n => n)[1]; plugin.version = version;
if (version) { const installedPlugin = this.getInstalledPlugin(plugin);
plugin.version = version; if (installedPlugin && this.compareVersions(version, this.getString(installedPlugin.plugin && installedPlugin.plugin.version || installedPlugin.version))) outdatedEntries++;
const installedPlugin = this.getInstalledPlugin(plugin);
if (installedPlugin && this.compareVersions(version, this.getString(installedPlugin.version))) outdatedEntries++;
}
} }
if (!cachedPlugins.includes(plugin.id)) newEntries++; if (!cachedPlugins.includes(plugin.id)) newEntries++;
} }
@@ -783,7 +797,7 @@ module.exports = (_ => {
} }
}; };
BDFDB.LibraryRequires.request("https://api.betterdiscord.app/v1/store/plugins", (error, response, body) => { BDFDB.TimeUtils.timeout(_ => BDFDB.LibraryRequires.request("https://api.betterdiscord.app/v1/store/plugins", {bdVersion: true}, (error, response, body) => {
if (!error && body && response.statusCode == 200) try { if (!error && body && response.statusCode == 200) try {
grabbedPlugins = BDFDB.ArrayUtils.keySort(JSON.parse(body).filter(n => n), "name"); grabbedPlugins = BDFDB.ArrayUtils.keySort(JSON.parse(body).filter(n => n), "name");
BDFDB.DataUtils.save(BDFDB.ArrayUtils.numSort(grabbedPlugins.map(n => n.id)).join(" "), this, "cached"); BDFDB.DataUtils.save(BDFDB.ArrayUtils.numSort(grabbedPlugins.map(n => n.id)).join(" "), this, "cached");
@@ -813,9 +827,16 @@ module.exports = (_ => {
for (let i = 0; i <= 20; i++) checkPlugin(); for (let i = 0; i <= 20; i++) checkPlugin();
} }
catch (err) {BDFDB.NotificationUtils.toast("Failed to load Plugin Store", {type: "danger"});} catch (err) {BDFDB.NotificationUtils.toast("Failed to load Plugin Store", {type: "danger"});}
if (response && response.statusCode == 403) BDFDB.NotificationUtils.toast("Failed to fetch Plugin Store from the Website Api due to DDoS Protection", {type: "danger"}); let status = {};
else if (response && response.statusCode == 404) BDFDB.NotificationUtils.toast("Failed to fetch Plugin Store from the Website Api due to Connection Issue", {type: "danger"}); if (response && response.statusCode == 403) status = {code: response.statusCode, reason: " due to DDoS Protection"};
}); else if (response && response.statusCode == 404) status = {code: response.statusCode, reason: " due to DDoS Protection"};
else if (response && response.statusCode == 502) status = {code: response.statusCode, reason: ", because the API is down"};
if (status.code) {
BDFDB.NotificationUtils.toast("Failed to fetch Plugin Store from the Website API" + status.reason, {type: "danger"});
errorState = status.code;
}
else errorState = null;
}), 10000);
} }
getLoadingTooltipText () { getLoadingTooltipText () {
@@ -839,15 +860,15 @@ module.exports = (_ => {
getInstalledPlugin (plugin) { getInstalledPlugin (plugin) {
if (!plugin || typeof plugin.authorname != "string") return; if (!plugin || typeof plugin.authorname != "string") return;
const iPlugin = BDFDB.BDUtils.getPlugin(plugin.name, false, true); const iPlugin = BDFDB.BDUtils.getPlugin(plugin.name, false, true);
if (iPlugin && plugin.authorname.toUpperCase() == this.getString(iPlugin.author).toUpperCase()) return iPlugin; if (iPlugin && (plugin.authorname.toUpperCase().indexOf(this.getString(iPlugin.author).toUpperCase()) > -1 || this.getString(iPlugin.author).toUpperCase().indexOf(plugin.authorname.toUpperCase()) > -1)) return iPlugin;
else if (plugin.rawSourceUrl && window.BdApi && BdApi.Plugins && typeof BdApi.Plugins.getAll == "function") { else if (plugin.rawSourceUrl && window.BdApi && BdApi.Plugins && typeof BdApi.Plugins.getAll == "function") {
const filename = plugin.rawSourceUrl.split("/").pop(); const filename = plugin.rawSourceUrl.split("/").pop();
for (let p of BdApi.Plugins.getAll()) if (p.filename == filename && plugin.authorname.toUpperCase() == this.getString(p.author).toUpperCase()) return p; for (let p of BdApi.Plugins.getAll()) if (p.filename == filename && (plugin.authorname.toUpperCase().indexOf(this.getString(p.author).toUpperCase()) > -1 || this.getString(p.author).toUpperCase().indexOf(plugin.authorname.toUpperCase()) > -1)) return p;
} }
} }
checkForNewPlugins () { checkForNewPlugins () {
BDFDB.LibraryRequires.request("https://api.betterdiscord.app/v1/store/plugins", (error, response, body) => { BDFDB.LibraryRequires.request("https://api.betterdiscord.app/v1/store/plugins", {bdVersion: true}, (error, response, body) => {
if (!error && body) try { if (!error && body) try {
if (JSON.parse(body).filter(n => n).length != grabbedPlugins.length) { if (JSON.parse(body).filter(n => n).length != grabbedPlugins.length) {
loading = {is: false, timeout: null, amount: 0}; loading = {is: false, timeout: null, amount: 0};
@@ -884,9 +905,9 @@ module.exports = (_ => {
case "el": // Greek case "el": // Greek
return { return {
list: "Λίστα", list: "Λίστα",
notice_failed_plugins: "Δεν ήταν δυνατή η φόρτωση ορισμένων Plugins [{{var0}}] ", notice_failed_plugins: "Δεν ήταν δυνατή η φόρτωση ορισμένων Πρόσθετων [{{var0}}] ",
notice_new_plugins: "Προστέθηκαν νέα Plugins [{{var0}}] στο Plugin Repo", notice_new_plugins: "Προστέθηκαν νέα Πρόσθετα [{{var0}}] στο Αποθετήριο Προσθέτων",
notice_outdated_plugins: "Ορισμένα Plugins [{{var0}}] είναι παλιά" notice_outdated_plugins: "Ορισμένα Πρόσθετα [{{var0}}] είναι παλαιά"
}; };
case "es": // Spanish case "es": // Spanish
return { return {

View File

@@ -7,7 +7,7 @@
* @Source https://github.com/ClearVision/ClearVision-v6 * @Source https://github.com/ClearVision/ClearVision-v6
* @website https://betterdiscord.app/theme/ClearVision * @website https://betterdiscord.app/theme/ClearVision
*/ */
@import url("https://clearvision.gitlab.io/v6/main.css"); @import url("https://clearvision.github.io/ClearVision-v6/main.css");
@import url('https://fonts.googleapis.com/css2?family=Consolas'); @import url('https://fonts.googleapis.com/css2?family=Consolas');
@import url('https://fonts.googleapis.com/css2?family=Whitney'); @import url('https://fonts.googleapis.com/css2?family=Whitney');
:root { :root {

View File

@@ -87,7 +87,7 @@ bindsym $mod+Return exec --no-startup-id alacritty
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# start dmenu (a program launcher) # start dmenu (a program launcher)
bindsym $mod+d exec --no-startup-id rofi -display-run ">" -show run bindsym $mod+d exec --no-startup-id rofi -display-drun ">" -modi drun -show drun
# A more modern dmenu replacement is rofi: # A more modern dmenu replacement is rofi:
# bindcode $mod+40 exec "rofi -modi drun,run -show drun" # bindcode $mod+40 exec "rofi -modi drun,run -show drun"

View File

@@ -1 +1 @@
{"gtk2_hidpi": true, "OPTION_GTK3_CURRENT_VERSION_ONLY": false, "OPTION_EXPORT_CINNAMON_THEME": false, "default_path": "/home/poslop/.themes"} {"gtk2_hidpi": true, "self.OPTIONS.GTK3_CURRENT_VERSION_ONLY": true, "self.OPTIONS.EXPORT_CINNAMON_THEME": false, "default_path": "/home/poslop/.themes", "OPTION_GTK3_CURRENT_VERSION_ONLY": false, "OPTION_EXPORT_CINNAMON_THEME": false}

View File

@@ -1 +1 @@
{"window_width": 1892, "window_height": 962, "preset_list_minimal_width": 150, "preset_list_width": 150, "preset_list_sections_expanded": {"presets": true, "plugins": true, "user": true}} {"window_width": 936, "window_height": 958, "preset_list_minimal_width": 150, "preset_list_width": 150, "preset_list_sections_expanded": {"presets": true, "plugins": true, "user": true}}

View File

@@ -84,7 +84,7 @@ type = internal/battery
; format-low once this charge percentage is reached ; format-low once this charge percentage is reached
; Default: 10 ; Default: 10
; New in version 3.6.0 ; New in version 3.6.0
low-at = 20 low-at = 25
; Use the following command to list batteries and adapters: ; Use the following command to list batteries and adapters:
; $ ls -1 /sys/class/power_supply/ ; $ ls -1 /sys/class/power_supply/
@@ -93,17 +93,24 @@ adapter = ACAD
format-charging = <label-charging> format-charging = <label-charging>
format-discharging = <label-discharging> format-discharging = <label-discharging>
format-low = <label-low>
label-charging = %percentage_raw%% label-charging = %percentage_raw%%
label-discharging = %percentage_raw%% label-discharging = %percentage_raw%%
label-low = %percentage_raw%% label-low = %percentage%%
format-charging-prefix = "BAT " format-charging-prefix = "CHRG "
format-charging-prefix-foreground = ${colors.primary} format-charging-prefix-foreground = ${colors.primary}
format-discharging-prefix = "BAT " format-discharging-prefix = "BAT "
format-discharging-prefix-foreground = ${colors.primary} format-discharging-prefix-foreground = ${colors.primary}
format-full-prefix = "BAT "
format-full-prefix-foreground = ${colors.primary}
format-low-prefix = "LOW "
format-low-prefix-foreground = ff8585
poll-interval = 5 poll-interval = 5
[module/xworkspaces] [module/xworkspaces]
@@ -209,7 +216,7 @@ format-prefix-foreground = ${colors.primary}
[module/backlight] [module/backlight]
type = internal/backlight type = internal/backlight
; $ ls -1 /sys/class/backlight/ ; $ ls -1 /sys/class/backlight/
card = amdgpu_bl0 card = amdgpu_bl1
use-actual-brightness = true use-actual-brightness = true

View File

@@ -28,7 +28,7 @@ wheel_scroll_lines=3
geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x5\0\0\0\x1*\0\0\ax\0\0\x3<\0\0\x5\x1\0\0\x1+\0\0\aw\0\0\x3;\0\0\0\0\0\0\0\0\a\x80\0\0\x5\x1\0\0\x1+\0\0\aw\0\0\x3;)" geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x5\0\0\0\x1*\0\0\ax\0\0\x3<\0\0\x5\x1\0\0\x1+\0\0\aw\0\0\x3;\0\0\0\0\0\0\0\0\a\x80\0\0\x5\x1\0\0\x1+\0\0\aw\0\0\x3;)"
[SettingsWindow] [SettingsWindow]
geometry="@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x5\a\0\0\0=\0\0\aq\0\0\x4)\0\0\x5\b\0\0\0>\0\0\ap\0\0\x4(\0\0\0\0\0\0\0\0\a\x80\0\0\x5\b\0\0\0>\0\0\ap\0\0\x4()" geometry=@ByteArray(\x1\xd9\xd0\xcb\0\x3\0\0\0\0\x3\xc7\0\0\0>\0\0\ap\0\0\x4(\0\0\x3\xc8\0\0\0?\0\0\ao\0\0\x4'\0\0\0\0\0\0\0\0\a\x80\0\0\x3\xc8\0\0\0?\0\0\ao\0\0\x4')
[Troubleshooting] [Troubleshooting]
force_raster_widgets=1 force_raster_widgets=1

View File

@@ -18,7 +18,7 @@ configuration {
/* drun-match-fields: "name,generic,exec,categories,keywords";*/ /* drun-match-fields: "name,generic,exec,categories,keywords";*/
/* drun-categories: ;*/ /* drun-categories: ;*/
/* drun-show-actions: false;*/ /* drun-show-actions: false;*/
/* drun-display-format: "{name} [<span weight='light' size='small'><i>({generic})</i></span>]";*/ drun-display-format: "{name}";
/* drun-url-launcher: "xdg-open";*/ /* drun-url-launcher: "xdg-open";*/
/* disable-history: false;*/ /* disable-history: false;*/
/* ignored-prefixes: "";*/ /* ignored-prefixes: "";*/

View File

@@ -6,3 +6,4 @@ export QSYS_ROOTDIR="/home/poslop/.cache/yay/quartus-free/pkg/quartus-free-quart
export DISCORD_TOKEN=ODAwNDQ2NDI4NTU1OTAzMDE3.Gp5hQe.lRy1jG5BBFwSjPmRJ36gs1dKciuR4L6xc4lgZg export DISCORD_TOKEN=ODAwNDQ2NDI4NTU1OTAzMDE3.Gp5hQe.lRy1jG5BBFwSjPmRJ36gs1dKciuR4L6xc4lgZg
. "$HOME/.cargo/env"

12
.zshrc
View File

@@ -99,18 +99,24 @@ source $ZSH/oh-my-zsh.sh
# Example aliases # Example aliases
# alias zshconfig="mate ~/.zshrc" # alias zshconfig="mate ~/.zshrc"
# alias ohmyzsh="mate ~/.oh-my-zsh" # alias ohmyzsh="mate ~/.oh-my-zsh"
export PATH=$PATH:/home/poslop/.spicetify export PATH=$PATH:/home/poslop/.spicetify
alias bctl=bluetoothctl
alias dots='/usr/bin/git --git-dir=$HOME/.git --work-tree=$HOME' alias dots='/usr/bin/git --git-dir=$HOME/.git --work-tree=$HOME'
alias bctl=bluetoothctl
export wf='94:DB:56:1A:FB:7F' export wf='94:DB:56:1A:FB:7F'
export wh='94:DB:56:F7:8A:40' export wh='94:DB:56:F7:8A:40'
export sony='AC:BF:71:48:4D:D9'
export QSYS_ROOTDIR="/home/poslop/.cache/yay/quartus-free/pkg/quartus-free-quartus/opt/intelFPGA/21.1/quartus/sopc_builder/bin"
export PATH="/home/poslop/.cargo/bin:$PATH" export PATH="/home/poslop/.cargo/bin:$PATH"
alias ecan="ssh -p 60052 poslop@goku.ecansol.com" alias ecan="ssh -p 60052 mindustry@goku.ecansol.com"
# Spoons!21 # Spoons!21
export X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR="/usr/bin/openssl" export X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_LIB_DIR="/usr/bin/openssl"
export X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR="/usr/include/openssl/" export X86_64_UNKNOWN_LINUX_MUSL_OPENSSL_INCLUDE_DIR="/usr/include/openssl/"
alias rm='rmtrash'
alias rmdir='rmdirtrash'
alias sudo='sudo '