From adfa36a4fd9c8994e69d3ae2fb0fcc0e188d7516 Mon Sep 17 00:00:00 2001 From: poslop Date: Fri, 24 Mar 2023 15:23:01 -0500 Subject: [PATCH] done --- .../BetterDiscord/plugins/0BDFDB.config.json | 12 +- .../BetterDiscord/plugins/0BDFDB.data.json | 88 ++-- .../BetterDiscord/plugins/0BDFDB.plugin.js | 197 ++++++--- .config/BetterDiscord/plugins/0BDFDB.raw.css | 7 +- .../plugins/ImageUtilities.config.json | 3 +- .../plugins/ImageUtilities.plugin.js | 404 ++++++++++-------- .../plugins/InvisibleTyping.config.json | 8 - .../plugins/InvisibleTyping.plugin.js | 0 .../plugins/NotificationSounds.config.json | 14 + .../plugins/NotificationSounds.plugin.js | 120 +++--- .../BetterDiscord/plugins/PinDMs.config.json | 12 +- .../BetterDiscord/plugins/PinDMs.plugin.js | 0 .../plugins/PluginRepo.plugin.js | 4 +- 13 files changed, 493 insertions(+), 376 deletions(-) mode change 100755 => 100644 .config/BetterDiscord/plugins/InvisibleTyping.config.json mode change 100755 => 100644 .config/BetterDiscord/plugins/InvisibleTyping.plugin.js mode change 100755 => 100644 .config/BetterDiscord/plugins/PinDMs.config.json mode change 100755 => 100644 .config/BetterDiscord/plugins/PinDMs.plugin.js diff --git a/.config/BetterDiscord/plugins/0BDFDB.config.json b/.config/BetterDiscord/plugins/0BDFDB.config.json index cb55890..2356107 100644 --- a/.config/BetterDiscord/plugins/0BDFDB.config.json +++ b/.config/BetterDiscord/plugins/0BDFDB.config.json @@ -1,13 +1,13 @@ { "all": { "changeLogs": { - "BDFDB": "3.0.7", + "BDFDB": "3.2.0", "CreationDate": "1.4.6", "EditRoles": "1.1.4", - "ImageUtilities": "5.1.4", - "NotificationSounds": "3.7.6", + "ImageUtilities": "5.1.9", + "NotificationSounds": "3.7.8", "PinDMs": "1.9.7", - "PluginRepo": "2.4.5" + "PluginRepo": "2.4.6" }, "choices": { "toastPosition": "right" @@ -19,8 +19,8 @@ "useChromium": false }, "hashes": { - "0BDFDB.data.json": "05d61fe50fa9df357b274a55feb4d7d0e35056f6", - "0BDFDB.raw.css": "a1c4a8b6f28c4765c6af2853ddf13a35922a2b9e" + "0BDFDB.data.json": "a6567d782bfade3434800f57ac73d037d233a5b2", + "0BDFDB.raw.css": "26087554c644b93f1f9d6c64e7a7918b6ec66dfe" } } } \ No newline at end of file diff --git a/.config/BetterDiscord/plugins/0BDFDB.data.json b/.config/BetterDiscord/plugins/0BDFDB.data.json index 05d61fe..a6567d7 100644 --- a/.config/BetterDiscord/plugins/0BDFDB.data.json +++ b/.config/BetterDiscord/plugins/0BDFDB.data.json @@ -57,7 +57,7 @@ "ChannelTextAreaTypes": ["CREATE_FORUM_POST", "PROFILE_BIO_INPUT", "FORUM_CHANNEL_GUIDELINES"], "ChannelTypes": ["GUILD_TEXT", "GUILD_STORE", "DM"], "ChannelTypeGroups": ["GUILD_TEXTUAL", "GUILD_VOCAL", "ALL_DMS"], - "Colors": ["SPOTIFY", "STATUS_RED"], + "Colors": ["SPOTIFY", "RED_100", "BLUE"], "ColorVariables": ["status-danger", "background-primary"], "ComponentActions": ["INSERT_TEXT", "TEXTAREA_FOCUS"], "EmojiSprites": ["DiversityPerRow", "PickerPerRow"], @@ -93,6 +93,7 @@ "ApplicationAssetUtils": {"strings": ["ApplicationAssetUtils", "getAssetImage"], "exported": false, "value": "exports", "map": { "getAssetImage": ["ApplicationAssetUtils", "getAssetImage"] }}, + "AppUtils": {"props": ["clipboard", "os"]}, "ArrayUtils": {"props": ["isArrayLike", "zipObject"]}, "ChannelUtils": {"props": ["selectChannel", "selectPrivateChannel"]}, "ChatRestrictionUtils": {"strings": ["openWarningPopout", "userCanUsePremiumMessageLength"], "exported": false, "value": "exports", "map": { @@ -140,7 +141,8 @@ }}, "MediaEngineUtils": {"props": ["setOutputDevice", "setInputDevice"]}, "MemberDisplayUtils": {"strings": ["getUserProfile", "getGuildMemberProfile", "_userProfile"], "exported": false, "value": "exports", "map": { - "getDisplayProfile": [");return null"] + "getDisplayProfile": ["getUserProfile"], + "getUserProfile": ["function(){return"] }}, "MentionUtils": {"strings": ["rawMessage", "mention_everyone", "mentionUsers"], "exported": false, "value": "exports", "map": { "isRawMessageMentioned": ["rawMessage", "mention_everyone", "mentionUsers"] @@ -237,12 +239,12 @@ "Checkbox": {"props": ["Aligns", "Shapes", "Types"]}, "Clickable": {"strings": [".ENTER", "preventDefault", ").handleKeyPress"]}, "KeybindRecorder": {"strings": [".RECORDING", ".DEFAULT", "toggleRecordMode"]}, - "PopoutContainer": {"props": ["Positions", "Align", "Animation", "defaultProps"]}, + "PopoutContainer": {"props": ["Animation", "defaultProps"]}, "RadioGroup": {"strings": ["itemInfoClassName", "hasSelection", ".radioItemIconClassName"]}, "SearchBar": {"strings": [").inputRef", ".containerRef", ".handleOnChange"]}, "SearchableSelect": {"strings": ["serialize", "haspopup", ".maxVisibleItems"], "exported": false, "value": "exports", "funcStrings": [".onChange,", ".jsx)", "isSelected:function"]}, "Slider": {"strings": [".stickToMarkers", "sortedMarkers"]}, - "TabBar": {"props": ["Looks", "Header", "Panel"]}, + "TabBar": {"props": ["Item", "Header", "Panel"]}, "Table": {"props": ["SortDirection", "defaultProps"]}, "TextArea": {"strings": ["onKeyDown=function", "defaultDirty"]}, "TextInput": {"strings": ["onFocus=function", "MAXIMUM_LENGTH_ERROR", "translate3d"], "exported": false, "value": "exports", "funcStrings": ["MAXIMUM_LENGTH_ERROR"]}, @@ -251,13 +253,15 @@ "LibraryComponents": { "Anchor": {"strings": ["anchorUnderlineOnHover", "noreferrer noopener"]}, "Animations": {"props": ["Controller", "Spring"]}, - "AppReferencePositionLayer": {"strings": ["\"onMount\"", "\"onUnmount\""]}, + "AppReferencePositionLayer": {"strings": [".LayerProvider,", ".LayerContainer,", ".layerContext,"], "funcStrings": [",{children:(", "({ref:"]}, + "AvatarConstants": {"strings": ["\"SIZE_20\"", "\"SIZE_32\""], "exported": false, "value": "exports", "map": { + "Sizes": ["\"SIZE_20\"", "\"SIZE_32\""] + }}, "Avatars": {"strings": ["\"statusColor\"", "ONLINE", "isMobile"], "exported": false, "value": "exports", "map": { "AnimatedAvatar": ["compare"], - "Avatar": ["statusColor"], - "Sizes": ["SIZE_32"] + "Avatar": ["statusColor"] }}, - "Badges": {"strings": ["baseShapeRound", "textBadge"], "exported": false, "value": "exports", "map": { + "Badges": {"strings": ["disableColor", "baseShapeRound", "textBadge"], "exported": false, "value": "exports", "map": { "BadgeShapes": ["baseShapeRoundRight", "baseShapeRoundLeft"], "IconBadge": [".iconBadge"], "NumberBadge": [".numberBadge"], @@ -298,7 +302,7 @@ "createLayer": [".createContext"], "LayerContainer": [".layerContainer", "missing parent"] }}, - "LazyImage": {"strings": ["LOADING", "visibilityObserver"]}, + "LazyImage": {"protos": ["loadImage", "getRatio", "getSrc"]}, "ListHeader": {"strings": [".container", "\"h2\"", "[\"aria-label\"]"]}, "Mask": {"props": "Masks"}, "Menu": {"strings": ["Menu API only allows Items and groups of Items as children"], "funcStrings": ["keyboardModeEnabled"]}, @@ -327,15 +331,14 @@ "LinkButton": [".apply(this"] }}, "RoleMention": {"strings": ["rolePopout", "inlinePreview"], "funcStrings": ["inlinePreview"]}, - "Scrollers": {"strings": [".fade", ".auto", "paddingFix", "getScrollerNode"], "exported": false, "value": "exports"}, - "SpinnerComponents": {"strings": ["WANDERING_CUBES", "CHASING_DOTS"], "exported": false, "value": "exports", "map": { - "Spinner": ["LOADING"], - "Types": ["WANDERING_CUBES", "CHASING_DOTS"] + "Scrollers": {"strings": ["().thin", "().none", "().auto", "().fade)}"], "exported": false, "value": "exports"}, + "SpinnerComponents": {"strings": ["WANDERING_CUBES", "wanderingCubes", ".spinningCircleInner"], "exported": false, "value": "exports", "map": { + "Spinner": [".spinningCircleInner"], + "Types": ["WANDERING_CUBES", "wanderingCubes"] }}, - "StatusComponents": {"strings": ["{mask", ".mask,", "UNKNOWN"], "exported": false, "value": "exports", "map": { - "AnimatedStatus": ["useSpring"], - "Status": [".mask,"], - "Types": ["UNKNOWN", "INVISIBLE"] + "StatusComponents": {"strings": ["().status}", ".isMobile", ".ONLINE"], "exported": false, "value": "exports", "map": { + "Status": ["().status}", ".isMobile", ".ONLINE"], + "Types": ["\"online\"", "\"unknown\""] }}, "Text": {"strings": ["lineClamp:", ".selectable", ".defaultColor"]}, "TextElement": {"strings": [".strong,", ".STANDARD"]}, @@ -450,11 +453,11 @@ "InviteGuildName": {"strings": [".guild;return", "().guildName", "().guildNameWrapper"]}, "LayerProvider": {"strings": ["layerContainerElement", "getContextValue"]}, "LayersProvider": {"strings": ["._currentlyTransitioningKeys", "._keysToEnter", "._keyChildMapping"]}, - "LazyImage": {"protos": ["loadImage", "getWidth", "getSrc"]}, + "LazyImage": {"protos": ["loadImage", "getRatio", "getSrc"]}, "LazyImageZoomable": {"strings": ["renderLinkComponent", "onCloseImage"]}, "ListItemTooltip": {"strings": [".listItemWrapper", "tooltipClassName", "disableWrapper"]}, "MemberListItem": {"protos": ["renderOwner", "renderDecorators", "renderPremium"]}, - "Mention": {"strings": [".iconType", ".color,", "CHANNEL_BROWSER_TITLE"]}, + "Mention": {"strings": [".iconType", ".color,", "),backgroundColor:"]}, "Menu": {"strings": ["\"empty\"", "getItemProps", "isUsingKeyboardNavigation"]}, "Message": {"strings": ["childrenMessageContent", "childrenRepliedMessage", "zalgo", ".buttonContainer"]}, "MessageAccessories": {"protos": ["renderGiftCodes", "renderEmbeds", "renderActivityInvite"]}, @@ -468,7 +471,7 @@ "MessageSearchResultContextMenu": {"strings": ["MESSAGE_ACTIONS_MENU_LABEL", "navId:\"message"], "nonStrings": ["getGuildId"]}, "MessageTimestamp": {"strings": [".timestampVisibleOnHover", "MESSAGE_EDITED_TIMESTAMP", ".timestampTooltip"], "noSearch": true}, "MessageToolbar": {"strings": ["Messages.MORE", "hasDeveloperMode", "emojiPicker:", "Messages.MESSAGE_TODOS_MARK_AS_DONE"], "noSearch": true}, - "MessageUsername": {"strings": ["\"username\"", "colorString", "compact", "WINDOW_CENTER"]}, + "MessageUsername": {"strings": ["\"username\"", "colorString", "compact"]}, "ModalCarousel": {"strings": [".gotoNext", "currentIndex", "gotoPrevThrottled"]}, "ModalHeader": {"strings": [".headerIdIsManaged", ".header,", "Direction.HORIZONTAL"]}, "ModalFooter": {"strings": [".footerSeparator", ".separator", "Direction.HORIZONTAL_REVERSE"]}, @@ -521,7 +524,7 @@ "StandardSidebarView": {"strings": ["standardSidebarView", ".sidebarTheme", "mobileSidebarHeader"]}, "SystemMessageThreadCreated": {"strings": ["threadOnClick:", ".SYSTEM_MESSAGE_THREAD_CREATED", "viewThreadsOnClick:"]}, "SystemMessageWrapper": {"strings": ["unknown message type", "\"SystemMessage\""]}, - "TabBar": {"props": ["Types", "Looks", "Item", "Panel"]}, + "TabBar": {"props": ["Item", "Header", "Panel"]}, "TextChannelEmptyMessage": {"strings": ["MANAGE_CHANNELS", ".BEGINNING_CHANNEL_DESCRIPTION", "topicHook:"]}, "ThreadCard": {"strings": [".threadId", ".gotoThread", ".container", ".threadName"]}, "ThreadCardDescription": {"strings": [".Messages.THREAD_BROWSER_STARTED_BY", ".bullet", ".lastMessageId"]}, @@ -541,8 +544,8 @@ "UserBannerMask": {"strings": [".overrideAvatarDecorationURL", "hasBannerImage:", "foreignObject"]}, "UserBioSection": {"strings": [".isUsingGuildBio", "aboutMeGuildIcon", "GUILD_IDENTITY_BIO_TOAST"]}, "UserConnectionsSection": {"strings": [".applicationRoleConnections)", ".CONNECTIONS_ROLE_POPOUT_VIEW_ALL"]}, - "UserInfo": {"strings": [".botTag", "isMobile:", ".discordTag"]}, "UserGenericContextMenu": {"strings": ["USER_ACTIONS_MENU_LABEL", "navId:\"user", ".USER_GENERIC_MENU"]}, + "UserInfo": {"strings": [".botTag", "isMobile:", ".discordTag"]}, "UserMemberContextMenu": {"strings": ["USER_ACTIONS_MENU_LABEL", "navId:\"user", ".GUILD_CHANNEL_USER_MENU"]}, "UserMemberSince": {"strings": [".memberSinceContainer", ".USER_PROFILE_DISCORD_MEMBER_SINCE"]}, "UserMemberSinceSection": {"strings": [".userId", "headingClassName", "().title", ".guildMember"]}, @@ -560,6 +563,7 @@ "UserRolesSection": {"strings": [".rolePillBorder", "numRoles", "roleClassName"]}, "UserSummaryItem": {"protos": ["renderMoreUsers", "renderUsers", "renderIcon"]}, "UserSettingsAppearance": {"protos": ["renderTheme", "renderDisplayMode", "renderMessageGroupSpacingSlider"]}, + "UserTheme": {"strings": [".profileColors", "useDefaultClientTheme:"], "noSearch": true}, "VideoBackground": {"strings": [".backgroundSrc", ".pulseSpeakingIndicator", ".avatarWrapper"]}, "VoiceUser": {"protos": ["renderPrioritySpeaker", "renderIcons", "renderAvatar"]}, "VoiceUsers": {"strings": ["hidePreview", "previewIsOpen", "previewUserIdAfterDelay"]} @@ -1341,6 +1345,12 @@ "userPopoutNote": "note-6O4w9y", "voiceDraggable": "draggable-1KoBzC" }, + "ModalCarousel": { + "carouselModal": "carouselModal-1eUFoq", + "nav": "nav-3QIE8_", + "navNext": "navNext-1mR5ku nav-3QIE8_", + "navPrev": "navPrev-1L-o1J nav-3QIE8_" + }, "Toast": { "avatar": "avatar-3xmbmC", "bar": "bar-95Sdw1", @@ -1379,6 +1389,7 @@ "ApplicationStore": {"props": ["applicationStore", "navigation"]}, "AppOuter": {"props": ["app", "mobileApp"]}, "Attachment": {"props": ["wrapper", "video", "metadataDownload"]}, + "AttachmentCover": {"props": ["cover", "icon", "iconWrapper"]}, "AuditLog": {"props": ["auditLog", "divider"]}, "AuthBox": {"props": ["authBox"]}, "Autocomplete": {"props": ["autocomplete", "autocompleteRow"]}, @@ -1463,8 +1474,7 @@ "GuildSettingsEmoji": {"props": ["emojiRow", "emojiAliasPlaceholder"]}, "GuildSettingsInvite": {"props": ["countdownColumn", "inviteSettingsInviteRow"]}, "GuildSettingsMember": {"props": ["member", "membersFilterPopout"]}, - "GuildsListItem": {"props": ["listItemWrapper", "listItemTooltip"]}, - "GuildsInboxIcon": {"props": ["iconButton", "selected"]}, + "GuildsListItem": {"props": ["listItemWrapper", "listItemTooltip"], "length": 6, "smaller": true}, "GuildsItems": {"props": ["circleIcon", "guildsError"]}, "GuildsWrapper": {"props": ["scroller", "unreadMentionsBar", "wrapper"]}, "HeaderBar": {"props": ["container", "children", "toolbar"]}, @@ -1479,7 +1489,6 @@ "IconDirection": {"props": ["directionDown", "directionUp"]}, "ImageAssets": {"props": ["pngImage", "stickerAsset"]}, "ImageModal": {"props": ["image", "modal"], "length": 4, "smaller": true}, - "ImageModalNavigation": {"props": ["nav", "navPrev", "navNext"]}, "ImageMosaic": {"props": ["lazyImg", "oneByOneGridSingle"]}, "ImageWrapper": {"props": ["clickable", "imageWrapperBackground"]}, "Input": {"props": ["inputMini", "inputDefault"]}, @@ -1526,7 +1535,6 @@ "MessageToolbar": {"props": ["container", "icon", "isHeader"]}, "MessageToolbarItems": {"props": ["wrapper", "button", "separator"]}, "Modal": {"props": ["root", "small", "medium"]}, - "ModalCarousel": {"props": ["carouselModal", "carousel"]}, "ModalCarouselWrapper": {"props": ["modalCarouselWrapper", "zoomedCarouselModalRoot"]}, "ModalDivider": {"props": ["divider"], "length": 1}, "ModalItems": {"props": ["guildName", "checkboxContainer"]}, @@ -1561,7 +1569,7 @@ "RecentMentions": {"props": ["recentMentionsPopout"]}, "RecentMentionsHeader": {"props": ["channelName", "channelHeader", "dmIcon"]}, "Role": {"props": ["roleName", "roleRemoveIcon"]}, - "RoleCircle": {"props": ["roleCircle", "flex"]}, + "RoleCircle": {"props": ["roleCircle", "dot"]}, "RoleIcon": {"props": ["clickable", "roleIcon"], "length": 4, "smaller": true}, "Roles": {"props": ["rolePill", "roles", "rolePillBorder"]}, "Scrollbar": {"props": ["scrollbar", "scrollbarGhost"]}, @@ -1616,7 +1624,7 @@ "UserSettingsSocialLinks": {"props": ["socialLinks", "link"]}, "UserSummaryItem": {"props": ["avatarContainerMasked", "container"]}, "UserTheme": {"props": ["userPopoutOuter", "userProfileOuter"]}, - "Video": {"props": ["video", "fullScreen"]}, + "Video": {"props": ["video", "fullScreen", "chatSidebarOpen"]}, "VoiceChannel": {"props": ["avatarSpeaking", "voiceUser"]}, "VoiceChannelLimit": {"props": ["total", "users", "wrapper"]}, "VoiceChannelList": {"props": ["list", "collapsed"]}, @@ -1877,7 +1885,11 @@ "applayers": ["AppInner", "layers"], "applicationstore": ["ApplicationStore", "applicationStore"], "attachment": ["Attachment", "wrapper"], + "attachmentcontrolshidden": ["Attachment", "wrapperControlsHidden"], + "attachmentcover": ["AttachmentCover", "cover"], + "attachmentcovericon": ["AttachmentCover", "icon"], "attachmentvideo": ["Attachment", "video"], + "attachmentvideocontrols": ["Attachment", "videoControls"], "auditlog": ["AuditLog", "auditLog"], "auditlogoverflowellipsis": ["AuditLog", "overflowEllipsis"], "auditlogtimestamp": ["AuditLog", "timestamp"], @@ -2407,6 +2419,7 @@ "guildfoldericonwrapperexpanded": ["GuildFolder", "expandedFolderIconWrapper"], "guildfolderwrapper": ["GuildFolder", "wrapper"], "guildheader": ["GuildHeader", "container"], + "guildheaderbanneranimatedhoverlayer": ["GuildHeader", "animatedBannerHoverLayer"], "guildheaderbannerimage": ["GuildHeader", "bannerImage"], "guildheaderbannerimagecontainer": ["GuildHeader", "animatedContainer"], "guildheaderbannervisible": ["GuildHeader", "bannerVisible"], @@ -2422,9 +2435,6 @@ "guildiconchildwrapper": ["GuildIcon", "childWrapper"], "guildiconselected": ["GuildIcon", "selected"], "guildiconwrapper": ["GuildIcon", "wrapper"], - "guildinboxicon": ["GuildsInboxIcon", "iconButton"], - "guildinboxiconmask": ["GuildsInboxIcon", "iconMask"], - "guildinboxiconselected": ["GuildsInboxIcon", "selected"], "guildinner": ["Guild", "wrapper"], "guildinnerwrapper": ["GuildsItems", "listItemWrapper"], "guildlistitem": ["GuildsListItem", "listItemWrapper"], @@ -2529,9 +2539,9 @@ "imageplaceholderoverlay": ["ImageWrapper", "imagePlaceholderOverlay"], "imagemodal": ["ImageModal", "modal"], "imagemodalimage": ["ImageModal", "image"], - "imagemodalnavbutton": ["ImageModalNavigation", "nav"], - "imagemodalnavbuttonprev": ["ImageModalNavigation", "navPrev"], - "imagemodalnavbuttonnext": ["ImageModalNavigation", "navNext"], + "imagemodalnavbutton": ["ModalCarousel", "nav"], + "imagemodalnavbuttonprev": ["ModalCarousel", "navPrev"], + "imagemodalnavbuttonnext": ["ModalCarousel", "navNext"], "imagemosaicattachmentscontainer": ["ImageMosaic", "mediaAttachmentsContainer"], "imagemosaiconebyonegridsingle": ["ImageMosaic", "oneByOneGridSingle"], "imagesticker": ["ImageAssets", "stickerAsset"], @@ -3114,7 +3124,6 @@ "settingsitemrole": ["ItemRole", "role"], "settingsitemroleinner": ["ItemRole", "roleInner"], "settingsitemselected": ["Item", "selected"], - "settingsitemside": ["Item", "side"], "settingsitemthemed": ["Item", "themed"], "settingspanel": ["BDFDB", "settingsPanel"], "settingspanellist": ["BDFDB", "settingsPanelList"], @@ -3198,7 +3207,9 @@ "tabbarcontainer": ["UserProfile", "tabBarContainer"], "tabbarcontainerbottom": ["BDFDB", "tabBarContainerBottom"], "tabbaritem": ["UserProfile", "tabBarItem"], + "tabbarside": ["Item", "side"], "tabbartop": ["Item", "top"], + "tabbartoppill": ["Item", "topPill"], "table": ["BDFDB", "table"], "tablebodycell": ["BDFDB", "tableBodyCell"], "tableheadercell": ["BDFDB", "tableHeaderCell"], @@ -5529,11 +5540,8 @@ "148234730523852800": {"active": true, "tier": "t2", "text": "", "color": "", "id": "inbroso (MaEp)"}, "105509397211406336": {"active": true, "tier": "t2", "text": "", "color": "", "id": "samtino (SgJeff)"}, "323494393828999168": {"active": true, "tier": "t2", "text": "", "color": "", "id": "polak (SzKu)"}, - "226444377482985473": {"active": true, "tier": "t3", "text": "xoxo", "color": "", "id": "seivag (zij)"}, - "507464069100601363": {"active": true, "tier": "t2", "text": "", "color": "", "id": "Cracky (MiPo)"}, "620397524494057513": {"active": true, "tier": "t2", "text": "", "color": "", "id": "FUSL"}, - "798499176220327966": {"active": true, "tier": "t2", "text": "", "color": "", "id": "void (JaUt)"}, - "1027026862708379849": {"active": true, "tier": "t3", "text": "Mr. Morale", "color": "", "id": "strix (A1C)"} + "798499176220327966": {"active": true, "tier": "t2", "text": "", "color": "", "id": "void (JaUt)"} }, "BDFDB_Patron_Tiers": { "t1": { @@ -5549,4 +5557,4 @@ "text": "BDFDB Special Supporter" } } -} \ No newline at end of file +} diff --git a/.config/BetterDiscord/plugins/0BDFDB.plugin.js b/.config/BetterDiscord/plugins/0BDFDB.plugin.js index 518e9a6..eac61a4 100644 --- a/.config/BetterDiscord/plugins/0BDFDB.plugin.js +++ b/.config/BetterDiscord/plugins/0BDFDB.plugin.js @@ -2,7 +2,7 @@ * @name BDFDB * @author DevilBro * @authorId 278543574059057154 - * @version 3.0.7 + * @version 3.2.0 * @description Required Library for DevilBro's Plugins * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -1094,14 +1094,16 @@ module.exports = (_ => { const requestLibraryHashes = tryAgain => { requestFunction("https://api.github.com/repos/mwittrien/BetterDiscordAddons/contents/Library/_res/", {headers: {"user-agent": "node.js"}, timeout: 60000}, (e, r, b) => { if ((e || !b || r.statusCode != 200) && tryAgain) return BDFDB.TimeUtils.timeout(_ => requestLibraryHashes(), 10000); - try { - b = JSON.parse(b); - libHashes[cssFileName] = (b.find(n => n && n.name == cssFileName) || {}).sha; - libHashes[dataFileName] = (b.find(n => n && n.name == dataFileName) || {}).sha; - BDFDB.DataUtils.save(libHashes, BDFDB, "hashes"); + else { + try { + b = JSON.parse(b); + libHashes[cssFileName] = (b.find(n => n && n.name == cssFileName) || {}).sha; + libHashes[dataFileName] = (b.find(n => n && n.name == dataFileName) || {}).sha; + BDFDB.DataUtils.save(libHashes, BDFDB, "hashes"); + } + catch (err) {} requestLibraryData(true); } - catch (err) {requestLibraryData(true);} }); }; const requestLibraryData = tryAgain => { @@ -1687,7 +1689,7 @@ module.exports = (_ => { let icon = data.config.avatar ? BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Avatars.Avatar, { src: data.config.avatar, - size: Internal.LibraryComponents.Avatars.Sizes.SIZE_24 + size: Internal.LibraryComponents.AvatarConstants.Sizes.SIZE_24 }) : ((data.config.icon || data.config.type && Internal.DiscordConstants.ToastIcons[data.config.type]) ? BDFDB.ReactUtils.createElement(Internal.LibraryComponents.SvgIcon, { name: data.config.type && Internal.DiscordConstants.ToastIcons[data.config.type] && Internal.LibraryComponents.SvgIcon.Names[Internal.DiscordConstants.ToastIcons[data.config.type]], iconSVG: data.config.icon, @@ -2463,14 +2465,14 @@ module.exports = (_ => { } return parent.props.children; } - MyReact.createElement = function (component, props = {}, errorWrap = false) { + MyReact.createElement = function (component, props = {}, errorWrap = false, ignoreErrors = false) { if (component && component.defaultProps) for (let key in component.defaultProps) if (props[key] == null) props[key] = component.defaultProps[key]; try { let child = Internal.LibraryModules.React.createElement(component || "div", props) || null; if (errorWrap) return Internal.LibraryModules.React.createElement(Internal.ErrorBoundary, {key: child && child.key || ""}, child) || null; else return child; } - catch (err) {BDFDB.LogUtils.error(["Could not create React Element!", err]);} + catch (err) {!ignoreErrors && BDFDB.LogUtils.error(["Could not create React Element!", err]);} return null; }; MyReact.objectToReact = function (obj) { @@ -2845,7 +2847,7 @@ module.exports = (_ => { if (!BDFDB.ObjectUtils.is(node)) return null; return node[Object.keys(node).find(key => key.startsWith("__reactInternalInstance") || key.startsWith("__reactFiber"))]; }; - MyReact.render = function (component, node) { + MyReact.render = function (component, node, ignoreErrors = false) { if (!BDFDB.ReactUtils.isValidElement(component) || !Node.prototype.isPrototypeOf(node)) return; try { Internal.LibraryModules.ReactDOM.render(component, node); @@ -2858,15 +2860,15 @@ module.exports = (_ => { })); observer.observe(document.body, {subtree: true, childList: true}); } - catch (err) {BDFDB.LogUtils.error(["Could not render React Element!", err]);} + catch (err) {!ignoreErrors && BDFDB.LogUtils.error(["Could not render React Element!", err]);} }; - MyReact.hookCall = function (callback, args) { + MyReact.hookCall = function (callback, args, ignoreErrors = false) { if (typeof callback != "function") return null; let returnValue = null, tempNode = document.createElement("div"); BDFDB.ReactUtils.render(BDFDB.ReactUtils.createElement(_ => { returnValue = callback(args); return null; - }), tempNode); + }, {}, false, ignoreErrors), tempNode, ignoreErrors); BDFDB.ReactUtils.unmountComponentAtNode(tempNode); return returnValue; }; @@ -2942,15 +2944,17 @@ module.exports = (_ => { BDFDB.UserUtils.getStatusColor = function (status, useColor) { if (!Internal.DiscordConstants.Colors) return null; status = typeof status == "string" ? status.toLowerCase() : null; + let color = ""; switch (status) { - case "online": return useColor ? Internal.DiscordConstants.Colors.STATUS_GREEN_600 : "var(--status-positive)"; - case "idle": return useColor ? Internal.DiscordConstants.Colors.STATUS_YELLOW : "var(--status-warning)"; - case "dnd": return useColor ? Internal.DiscordConstants.Colors.STATUS_RED : "var(--status-danger)"; - case "playing": return useColor ? Internal.DiscordConstants.Colors.BRAND : "var(--bdfdb-blurple)"; - case "listening": return Internal.DiscordConstants.Colors.SPOTIFY; - case "streaming": return Internal.DiscordConstants.Colors.TWITCH; - default: return Internal.DiscordConstants.Colors.STATUS_GREY; + case "online": color = (useColor ? Internal.DiscordConstants.Colors.GREEN_360 : "var(--status-positive)"); break; + case "idle": color = (useColor ? Internal.DiscordConstants.Colors.YELLOW_300 : "var(--status-warning)"); break; + case "dnd": color = (useColor ? Internal.DiscordConstants.Colors.RED_400 : "var(--status-danger)"); break; + case "playing": color = (useColor ? Internal.DiscordConstants.Colors.BRAND : "var(--bdfdb-blurple)"); break; + case "listening": color = Internal.DiscordConstants.Colors.SPOTIFY; break; + case "streaming": color = Internal.DiscordConstants.Colors.TWITCH; break; + default: color = Internal.DiscordConstants.Colors.PRIMARY_400; break; } + return (color || Internal.DiscordConstants.Colors.GREEN_360).replace(/calc\(.+\s*\*\s*([0-9\.\%]+)\)/g, "$1"); }; BDFDB.UserUtils.getActivity = function (id = BDFDB.UserUtils.me.id) { for (let activity of Internal.LibraryStores.PresenceStore.getActivities(id)) if (activity.type != Internal.DiscordConstants.ActivityTypes.CUSTOM_STATUS) return activity; @@ -3119,11 +3123,12 @@ module.exports = (_ => { BDFDB.ColorUtils = {}; BDFDB.ColorUtils.convert = function (color, conv, type) { if (BDFDB.ObjectUtils.is(color)) { - var newColor = {}; + let newColor = {}; for (let pos in color) newColor[pos] = BDFDB.ColorUtils.convert(color[pos], conv, type); return newColor; } else { + if (typeof color == "string") color = color.replace(/calc\(.+\s*\*\s*([0-9\.\%]+)\)/g, "$1"); conv = conv === undefined || !conv ? conv = "RGBCOMP" : conv.toUpperCase(); type = type === undefined || !type || !["RGB", "RGBA", "RGBCOMP", "HSL", "HSLA", "HSLCOMP", "HEX", "HEXA", "INT"].includes(type.toUpperCase()) ? BDFDB.ColorUtils.getType(color) : type.toUpperCase(); if (conv == "RGBCOMP") { @@ -3153,16 +3158,10 @@ module.exports = (_ => { case "HSL": var hslComp = processHSL(color.replace(/\s/g, "").slice(4, -1).split(",")); var r, g, b, m, c, x, p, q; - var h = hslComp[0] / 360, l = parseInt(hslComp[1]) / 100, s = parseInt(hslComp[2]) / 100; m = Math.floor(h * 6); c = h * 6 - m; x = s * (1 - l); p = s * (1 - c * l); q = s * (1 - (1 - c) * l); - switch (m % 6) { - case 0: r = s, g = q, b = x; break; - case 1: r = p, g = s, b = x; break; - case 2: r = x, g = s, b = q; break; - case 3: r = x, g = p, b = s; break; - case 4: r = q, g = x, b = s; break; - case 5: r = s, g = x, b = p; break; - } - return [Math.round(r * 255), Math.round(g * 255), Math.round(b * 255)]; + var h = hslComp[0], s = processPercentage(hslComp[1]), l = processPercentage(hslComp[2]); + var a = s * Math.min(l, 1-l); + var f = (n, k = (n+h / 30) % 12) => parseInt((l - a * Math.max(Math.min(k-3, 9-k, 1), -1)) * 255); + return [f(0), f(8), f(4)]; case "HSLA": var hslComp = color.replace(/\s/g, "").slice(5, -1).split(","); return BDFDB.ColorUtils.convert(`hsl(${hslComp.slice(0, 3).join(",")})`, "RGBCOMP").concat(processA(hslComp.pop())); @@ -3240,12 +3239,48 @@ module.exports = (_ => { } } return null; - function processC(c) {if (c == null) {return 255;} else {c = parseInt(c.toString().replace(/[^0-9\-]/g, ""));return isNaN(c) || c > 255 ? 255 : c < 0 ? 0 : c;}}; - function processRGB(comp) {return [].concat(comp).map(c => {return processC(c);});}; - function processA(a) {if (a == null) {return 1;} else {a = a.toString();a = (a.indexOf("%") > -1 ? 0.01 : 1) * parseFloat(a.replace(/[^0-9\.\-]/g, ""));return isNaN(a) || a > 1 ? 1 : a < 0 ? 0 : a;}}; - function processSL(sl) {if (sl == null) {return "100%";} else {sl = parseFloat(sl.toString().replace(/[^0-9\.\-]/g, ""));return (isNaN(sl) || sl > 100 ? 100 : sl < 0 ? 0 : sl) + "%";}}; - function processHSL(comp) {comp = [].concat(comp);let h = parseFloat(comp.shift().toString().replace(/[^0-9\.\-]/g, ""));h = isNaN(h) || h > 360 ? 360 : h < 0 ? 0 : h;return [h].concat(comp.map(sl => {return processSL(sl);}));}; - function processINT(c) {if (c == null) {return 16777215;} else {c = parseInt(c.toString().replace(/[^0-9]/g, ""));return isNaN(c) || c > 16777215 ? 16777215 : c < 0 ? 0 : c;}}; + function processC (c) { + if (c == null) return 255; + else { + c = parseInt(c.toString().replace(/[^0-9\-]/g, "")); + return isNaN(c) || c > 255 ? 255 : c < 0 ? 0 : c; + } + }; + function processRGB (comp) { + return [].concat(comp).map(processC); + }; + function processA (a) { + if (a == null) return 1; + else { + a = a.toString(); + a = (a.indexOf("%") > -1 ? 0.01 : 1) * parseFloat(a.replace(/[^0-9\.\-]/g, "")); + return isNaN(a) || a > 1 ? 1 : a < 0 ? 0 : a; + } + }; + function processPercentage (p) { + if (p == null) return 1; + else return p.indexOf("%") > -1 ? parseFloat(p)/100 : p; + }; + function processSL (sl) { + if (sl == null) return "100%"; + else { + sl = parseFloat(sl.toString().replace(/[^0-9\.\-]/g, "")); + return (isNaN(sl) || sl > 100 ? 100 : sl < 0 ? 0 : sl) + "%"; + } + }; + function processHSL (comp) { + comp = [].concat(comp); + let h = parseFloat(comp.shift().toString().replace(/[^0-9\.\-]/g, "")); + h = isNaN(h) || h > 360 ? 360 : h < 0 ? 0 : h; + return [h].concat(comp.map(processSL)); + }; + function processINT (c) { + if (c == null) return 16777215; + else { + c = parseInt(c.toString().replace(/[^0-9]/g, "")); + return isNaN(c) || c > 16777215 ? 16777215 : c < 0 ? 0 : c; + } + }; }; BDFDB.ColorUtils.setAlpha = function (color, a, conv) { if (BDFDB.ObjectUtils.is(color)) { @@ -3336,12 +3371,13 @@ module.exports = (_ => { return parseInt(compare) < Math.sqrt(0.299 * color[0]**2 + 0.587 * color[1]**2 + 0.144 * color[2]**2); }; BDFDB.ColorUtils.getType = function (color) { - if (color != null) { + if (color !== null) { if (typeof color === "object" && (color.length == 3 || color.length == 4)) { if (isRGB(color)) return "RGBCOMP"; else if (isHSL(color)) return "HSLCOMP"; } else if (typeof color === "string") { + color = color.replace(/calc\(.+\s*\*\s*([0-9\.\%]+)\)/g, "$1"); if (/^#[a-f\d]{3}$|^#[a-f\d]{6}$/i.test(color)) return "HEX"; else if (/^#[a-f\d]{4}$|^#[a-f\d]{8}$/i.test(color)) return "HEXA"; else { @@ -3815,11 +3851,11 @@ module.exports = (_ => { }); }; - const MappedMenuItems = {}, RealMenuItems = BDFDB.ModuleUtils.find(m => { + var MappedMenuItems = {}, RealMenuItems = BDFDB.ModuleUtils.find(m => { if (!m || typeof m != "function") return false; let string = m.toString(); return string.endsWith("{return null}}") && string.indexOf("(){return null}") > -1 && string.indexOf("catch(") == -1; - }); + }) || BDFDB.ModuleUtils.findByString("(){return null}function"); if (!RealMenuItems) { RealMenuItems = {}; BDFDB.LogUtils.error(["could not find Module for MenuItems"]); @@ -4560,7 +4596,7 @@ module.exports = (_ => { render() { if (this.state.hasError) return Internal.LibraryModules.React.createElement("span", { style: { - background: Internal.DiscordConstants.Colors.PRIMARY_DARK, + background: Internal.DiscordConstants.Colors.PRIMARY, borderRadius: 5, color: "var(--status-danger)", fontSize: 12, @@ -4575,6 +4611,17 @@ module.exports = (_ => { } }; + Internal.NativeSubComponents = new Proxy(NativeSubComponents, { + get: function (_, item) { + if (NativeSubComponents[item]) return NativeSubComponents[item]; + if (!InternalData.NativeSubComponents[item]) return "div"; + + Internal.findModuleViaData(NativeSubComponents, InternalData.NativeSubComponents, item); + + return NativeSubComponents[item] ? NativeSubComponents[item] : "div"; + } + }); + CustomComponents.AutoFocusCatcher = reactInitialized && class BDFDB_AutoFocusCatcher extends Internal.LibraryModules.React.Component { render() { const style = {padding: 0, margin: 0, border: "none", width: 0, maxWidth: 0, height: 0, maxHeight: 0, visibility: "hidden"}; @@ -4725,7 +4772,7 @@ module.exports = (_ => { children: [ !this.props.noRemove ? BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Clickable, { "aria-label": BDFDB.LanguageUtils.LanguageStrings.REMOVE, - className: BDFDB.disCNS.hovercardremovebutton + BDFDB.disCNS.hovercardremovebuttondefault, + className: BDFDB.disCNS.hovercardremovebutton + BDFDB.disCN.hovercardremovebuttondefault, onClick: e => { if (typeof this.props.onRemove == "function") this.props.onRemove(e, this); BDFDB.ListenerUtils.stopEvent(e); @@ -6135,7 +6182,7 @@ module.exports = (_ => { handleClick(e) {if (typeof this.props.onClick == "function") this.props.onClick(e, this);} handleContextMenu(e) {if (typeof this.props.onContextMenu == "function") this.props.onContextMenu(e, this);} render() { - let color = BDFDB.ColorUtils.convert(this.props.role.colorString, "RGB") || Internal.DiscordConstants.Colors.PRIMARY_DARK_300; + let color = BDFDB.ColorUtils.convert(this.props.role.colorString, "RGB") || Internal.DiscordConstants.Colors.PRIMARY_300; return BDFDB.ReactUtils.createElement("li", { className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN.userrole, this.props.className), style: {borderColor: BDFDB.ColorUtils.setAlpha(color, 0.6)}, @@ -6558,6 +6605,22 @@ module.exports = (_ => { }); } }; + CustomComponents.PopoutContainer.Align = { + BOTTOM: "bottom", + CENTER: "center", + LEFT: "left", + RIGHT: "right", + TOP: "top" + }; + CustomComponents.PopoutContainer.Positions = { + BOTTOM: "bottom", + CENTER: "center", + LEFT: "left", + RIGHT: "right", + TOP: "top", + WINDOW_CENTER: "window_center" + }; + CustomComponents.PopoutContainer.ObjectProperties = ["Animation"]; Internal.setDefaultProps(CustomComponents.PopoutContainer, {wrap: true}); CustomComponents.PopoutCSSAnimator = function (props) { @@ -7170,7 +7233,7 @@ module.exports = (_ => { let mini = props.size == Internal.LibraryComponents.Switch.Sizes.MINI; return BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Animations.animated.div, { - className: BDFDB.DOMUtils.formatClassName(props.className, BDFDB.disCN.switch, mini && BDFDB.disCN.switchmini), + className: BDFDB.DOMUtils.formatClassName(props.className, BDFDB.disCN.switch, mini && BDFDB.disCN.switchmini, "default-colors"), onMouseDown: _ => { return !props.disabled && state[1](true); }, @@ -7284,7 +7347,7 @@ module.exports = (_ => { }; Internal.setDefaultProps(CustomComponents.Switch, { size: CustomComponents.Switch.Sizes.DEFAULT, - uncheckedColor: Internal.DiscordConstants.Colors.PRIMARY_DARK_400, + uncheckedColor: Internal.DiscordConstants.Colors.PRIMARY_400, checkedColor: Internal.DiscordConstants.Colors.BRAND }); @@ -7311,6 +7374,19 @@ module.exports = (_ => { }), "itemClassName", "items", "renderItem")); } }; + CustomComponents.TabBar.Types = { + SIDE: "side", + TOP: "top", + TOP_PILL: "top-pill" + }; + CustomComponents.TabBar.Looks = { + 0: "GREY", + 1: "BRAND", + 2: "CUSTOM", + GREY: 0, + BRAND: 1, + CUSTOM: 2 + }; CustomComponents.Table = reactInitialized && class BDFDB_Table extends Internal.LibraryModules.React.Component { render() { @@ -7604,6 +7680,14 @@ module.exports = (_ => { }); } }; + CustomComponents.TooltipContainer.Positions = { + BOTTOM: "bottom", + CENTER: "center", + LEFT: "left", + RIGHT: "right", + TOP: "top", + WINDOW_CENTER: "window_center" + }; CustomComponents.UserPopoutContainer = reactInitialized && class BDFDB_UserPopoutContainer extends Internal.LibraryModules.React.Component { render() { @@ -7667,17 +7751,6 @@ module.exports = (_ => { } }; - Internal.NativeSubComponents = new Proxy(NativeSubComponents, { - get: function (_, item) { - if (NativeSubComponents[item]) return NativeSubComponents[item]; - if (!InternalData.NativeSubComponents[item]) return "div"; - - Internal.findModuleViaData(NativeSubComponents, InternalData.NativeSubComponents, item); - - return NativeSubComponents[item] ? NativeSubComponents[item] : "div"; - } - }); - Internal.LibraryComponents = new Proxy(LibraryComponents, { get: function (_, item) { if (LibraryComponents[item]) return LibraryComponents[item]; @@ -7693,6 +7766,7 @@ module.exports = (_ => { if (key == "defaultProps") LibraryComponents[item][key] = Object.assign({}, LibraryComponents[item][key], NativeComponent[key]); else if (!LibraryComponents[item][key]) LibraryComponents[item][key] = NativeComponent[key]; } + if (LibraryComponents[item].ObjectProperties) for (let key of LibraryComponents[item].ObjectProperties) if (!LibraryComponents[item][key]) LibraryComponents[item][key] = {}; } return LibraryComponents[item] ? LibraryComponents[item] : "div"; } @@ -7722,8 +7796,9 @@ module.exports = (_ => { }); } - for (let type of Object.keys(RealMenuItems)) { - let children = BDFDB.ObjectUtils.get(BDFDB.ReactUtils.hookCall(Internal.LibraryComponents.Menu, {hideScroller: true, children: BDFDB.ReactUtils.createElement(RealMenuItems[type], {})}), "props.children.props.children.props.children"); + const RealFilteredMenuItems = Object.keys(RealMenuItems).filter(type => typeof RealMenuItems[type] == "function" && RealMenuItems[type].toString().replace(/[\n\t\r]/g, "").endsWith("{return null}")); + for (let type of RealFilteredMenuItems) { + let children = BDFDB.ObjectUtils.get(BDFDB.ReactUtils.hookCall(Internal.LibraryComponents.Menu, {hideScroller: true, children: BDFDB.ReactUtils.createElement(RealMenuItems[type], {})}, true), "props.children.props.children.props.children"); let menuItem = (BDFDB.ArrayUtils.is(children) ? children : []).flat(10).filter(n => n)[0]; if (menuItem) { let menuItemsProps = BDFDB.ReactUtils.findValue(menuItem, "menuItemProps"); @@ -7745,7 +7820,7 @@ module.exports = (_ => { } } } - LibraryComponents.MenuItems = new Proxy(RealMenuItems, { + LibraryComponents.MenuItems = new Proxy(RealFilteredMenuItems.reduce((a, v) => ({ ...a, [v]: v}), {}) , { get: function (_, item) { if (RealMenuItems[item]) return RealMenuItems[item]; if (CustomComponents.MenuItems[item]) return CustomComponents.MenuItems[item]; @@ -7856,7 +7931,7 @@ module.exports = (_ => { } if (role) { if (avatar.type == "img") avatar = BDFDB.ReactUtils.createElement(Internal.LibraryComponents.Avatars.Avatar, Object.assign({}, avatar.props, { - size: Internal.LibraryComponents.Avatars.Sizes.SIZE_40 + size: Internal.LibraryComponents.AvatarConstants.Sizes.SIZE_40 })); delete avatar.props.className; let newProps = { diff --git a/.config/BetterDiscord/plugins/0BDFDB.raw.css b/.config/BetterDiscord/plugins/0BDFDB.raw.css index a1c4a8b..2608755 100644 --- a/.config/BetterDiscord/plugins/0BDFDB.raw.css +++ b/.config/BetterDiscord/plugins/0BDFDB.raw.css @@ -604,7 +604,7 @@ img:not([src]), img[src=""], img[src="null"] { filter: grayscale(0.2); } [REPLACE_CLASS_settingspanel] [REPLACE_CLASS_hovercardwrapper] { - width: calc(100% - 22px); + width: calc(100% - 32px); } [REPLACE_CLASS_hovercardwrapper][REPLACE_CLASS_hovercard] { padding: 10px 0; @@ -744,7 +744,7 @@ img:not([src]), img[src=""], img[src="null"] { display: flex; align-items: center; flex: 1 0 auto; - margin-right: 10px; + margin-right: 20px; margin-left: 10px; } [REPLACE_CLASS_settingstableheaderoptions] { @@ -778,6 +778,9 @@ img:not([src]), img[src=""], img[src="null"] { padding: 0 10px; margin-bottom: 10px; } +[REPLACE_CLASS_settingstablecard][REPLACE_CLASS_cardprimaryoutline] { + border: 1px solid var(--background-tertiary); +} [REPLACE_CLASS_settingstablecardlabel] { display: flex; align-items: center; diff --git a/.config/BetterDiscord/plugins/ImageUtilities.config.json b/.config/BetterDiscord/plugins/ImageUtilities.config.json index 2774a74..f597832 100755 --- a/.config/BetterDiscord/plugins/ImageUtilities.config.json +++ b/.config/BetterDiscord/plugins/ImageUtilities.config.json @@ -73,7 +73,8 @@ "zoomSettings": { "lensSize": 1459, "pixelMode": false, - "zoomLevel": 1.6000000000000014 + "zoomLevel": 1.6000000000000014, + "zoomSpeed": 0.1 } } } \ No newline at end of file diff --git a/.config/BetterDiscord/plugins/ImageUtilities.plugin.js b/.config/BetterDiscord/plugins/ImageUtilities.plugin.js index 45143fa..205987d 100755 --- a/.config/BetterDiscord/plugins/ImageUtilities.plugin.js +++ b/.config/BetterDiscord/plugins/ImageUtilities.plugin.js @@ -2,7 +2,7 @@ * @name ImageUtilities * @author DevilBro * @authorId 278543574059057154 - * @version 5.1.4 + * @version 5.1.9 * @description Adds several Utilities for Images/Videos (Gallery, Download, Reverse Search, Zoom, Copy, etc.) * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -74,22 +74,22 @@ module.exports = (_ => { }; const fileTypes = { - "3gp": {copyable: false, searchable: false, video: true, signs: [[0x66, 0x74, 0x79, 0x70, 0x33, 0x67]]}, - "avi": {copyable: false, searchable: false, video: true, signs: [[0x41, 0x56, 0x49, 0x20]]}, - "flv": {copyable: false, searchable: false, video: true, signs: [[0x46, 0x4C, 0x56]]}, - "jpeg": {copyable: true, searchable: true, video: false, signs: [[0xFF, 0xD8, 0xFF, 0xEE]]}, - "jpg": {copyable: true, searchable: true, video: false, signs: [[0xFF, 0xD8, 0xFF, 0xDB], [0xFF, 0xD8, 0xFF, 0xE0], [0xFF, 0xD8, 0xFF, 0xE1]]}, - "gif": {copyable: false, searchable: true, video: false, signs: [[0x47, 0x49, 0x46, 0x38, 0x37, 0x61], [0x47, 0x49, 0x46, 0x38, 0x39, 0x61]]}, - "mov": {copyable: false, searchable: false, video: true, signs: [[null, null, null, null, 0x6D, 0x6F, 0x6F, 0x76], [null, null, null, null, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]]}, - "mp4": {copyable: false, searchable: false, video: true, signs: [[null, null, null, null, 0x66, 0x74, 0x79, 0x70]]}, - "mpeg-1": {copyable: false, searchable: false, video: true, signs: [[0x00, 0x00, 0x01, 0xBA]]}, - "mpeg-2": {copyable: false, searchable: false, video: true, signs: [[0x00, 0x00, 0x01, 0xB3]]}, - "ogg": {copyable: false, searchable: false, video: true, signs: [[0x4F, 0x67, 0x67, 0x53]]}, - "png": {copyable: true, searchable: true, video: false, signs: [[0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]]}, - "svg": {copyable: false, searchable: false, video: false, signs: [[0x3C]]}, - "webm": {copyable: false, searchable: false, video: true, signs: [[0x1A, 0x45, 0xDF, 0xA3]]}, - "webp": {copyable: false, searchable: true, video: false, signs: [[0x52, 0x49, 0x46, 0x46, null, null, null, null, 0x57, 0x45, 0x42, 0x50]]}, - "wmv": {copyable: false, searchable: false, video: true, signs: [[0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11], [0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C]]} + "3gp": {copyable: false, searchable: false, gif: false, video: true, signs: [[0x66, 0x74, 0x79, 0x70, 0x33, 0x67]]}, + "avi": {copyable: false, searchable: false, gif: false, video: true, signs: [[0x41, 0x56, 0x49, 0x20]]}, + "flv": {copyable: false, searchable: false, gif: false, video: true, signs: [[0x46, 0x4C, 0x56]]}, + "jpeg": {copyable: true, searchable: true, gif: false, video: false, signs: [[0xFF, 0xD8, 0xFF, 0xEE]]}, + "jpg": {copyable: true, searchable: true, gif: false, video: false, signs: [[0xFF, 0xD8, 0xFF, 0xDB], [0xFF, 0xD8, 0xFF, 0xE0], [0xFF, 0xD8, 0xFF, 0xE1]]}, + "gif": {copyable: false, searchable: true, gif: true, video: false, signs: [[0x47, 0x49, 0x46, 0x38, 0x37, 0x61], [0x47, 0x49, 0x46, 0x38, 0x39, 0x61]]}, + "mov": {copyable: false, searchable: false, gif: false, video: true, signs: [[null, null, null, null, 0x6D, 0x6F, 0x6F, 0x76], [null, null, null, null, 0x66, 0x74, 0x79, 0x70, 0x71, 0x74, 0x20, 0x20]]}, + "mp4": {copyable: false, searchable: false, gif: false, video: true, signs: [[null, null, null, null, 0x66, 0x74, 0x79, 0x70]]}, + "mpeg-1": {copyable: false, searchable: false, gif: false, video: true, signs: [[0x00, 0x00, 0x01, 0xBA]]}, + "mpeg-2": {copyable: false, searchable: false, gif: false, video: true, signs: [[0x00, 0x00, 0x01, 0xB3]]}, + "ogg": {copyable: false, searchable: false, gif: false, video: true, signs: [[0x4F, 0x67, 0x67, 0x53]]}, + "png": {copyable: true, searchable: true, gif: false, video: false, signs: [[0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A]]}, + "svg": {copyable: false, searchable: false, gif: false, video: false, signs: [[0x3C]]}, + "webm": {copyable: false, searchable: false, gif: false, video: true, signs: [[0x1A, 0x45, 0xDF, 0xA3]]}, + "webp": {copyable: false, searchable: true, gif: false, video: false, signs: [[0x52, 0x49, 0x46, 0x46, null, null, null, null, 0x57, 0x45, 0x42, 0x50]]}, + "wmv": {copyable: false, searchable: false, gif: false, video: true, signs: [[0x30, 0x26, 0xB2, 0x75, 0x8E, 0x66, 0xCF, 0x11], [0xA6, 0xD9, 0x00, 0xAA, 0x00, 0x62, 0xCE, 0x6C]]} }; const LazyImageSiblingComponent = class LazyImageSibling extends BdApi.React.Component { @@ -116,11 +116,11 @@ module.exports = (_ => { className: BDFDB.DOMUtils.formatClassName(BDFDB.disCN._imageutilitiessibling, this.props.className), onClick: event => { BDFDB.ListenerUtils.stopEvent(event); - _this.switchImages(this.props.offset); + _this.switchImages(this.props.offset, _this.isValid(this.props.url, "video")); }, children: [ this.props.loadedImage || BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SpinnerComponents.Spinner, { - type: BDFDB.LibraryComponents.SpinnerComponents.Types.SPINNING_CIRCLE + type: BDFDB.LibraryComponents.SpinnerComponents.Types.WANDERING_CUBES }), BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { className: BDFDB.disCNS._imageutilitiesswitchicon + BDFDB.disCN.svgicon, @@ -133,12 +133,12 @@ module.exports = (_ => { const ImageDetailsComponent = class ImageDetails extends BdApi.React.Component { componentDidMount() { + BDFDB.DOMUtils.addClass(BDFDB.DOMUtils.getParent(BDFDB.dotCN.imagemosaiconebyonegridsingle, BDFDB.ReactUtils.findDOMNode(this)), BDFDB.disCN._imageutilitiesimagedetailsadded); this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(this, `${BDFDB.ReactUtils.instanceKey}.return`), "attachment", {up: true}); BDFDB.ReactUtils.forceUpdate(this); } componentDidUpdate() { if ((!this.props.attachment || !this.props.attachment.size) && !this.props.loaded) { - BDFDB.DOMUtils.addClass(BDFDB.DOMUtils.getParent(BDFDB.dotCN.imagemosaiconebyonegridsingle, BDFDB.ReactUtils.findDOMNode(this)), BDFDB.disCN._imageutilitiesimagedetailsadded); this.props.loaded = true; this.props.attachment = BDFDB.ReactUtils.findValue(BDFDB.ObjectUtils.get(this, `${BDFDB.ReactUtils.instanceKey}.return`), "attachment", {up: true}); BDFDB.ReactUtils.forceUpdate(this); @@ -214,8 +214,9 @@ module.exports = (_ => { galleryFilter: {}, zoomSettings: { pixelMode: {value: false, label: "Uses Pixel Lens instead of a Blur Lens"}, + 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"}, - lensSize: {value: 200, digits: 0, minValue: 50, maxValue: 5000, unit: "px", label: "context_lenssize"} + zoomSpeed: {value: 0.1, digits: 2, minValue: 0.01, maxValue: 1, unit: "", label: "context_zoomspeed"} }, rescaleSettings: { messages: {value: "NONE", description: "Messages"}, @@ -234,18 +235,18 @@ module.exports = (_ => { }, engines: { _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}, - Bing: {value: true, name: "Bing", url: "https://www.bing.com/images/search?q=imgurl:" + imgUrlReplaceString + "&view=detailv2&iss=sbi&FORM=IRSBIQ"}, - Google: {value: true, name: "Google", url: "https://www.google.com/searchbyimage?sbisrc=1&image_url=" + imgUrlReplaceString}, - GoogleLens: {value: true, name: "Google Lens", url: "https://lens.google.com/uploadbyurl?url=" + imgUrlReplaceString}, - ImgOps: {value: true, name: "ImgOps", raw: true, url: "https://imgops.com/specialized+reverse/" + imgUrlReplaceString}, - IQDB: {value: true, name: "IQDB", url: "https://iqdb.org/?url=" + imgUrlReplaceString}, - Reddit: {value: true, name: "Reddit", url: "http://karmadecay.com/search?q=" + imgUrlReplaceString}, - SauceNAO: {value: true, name: "SauceNAO", url: "https://saucenao.com/search.php?db=999&url=" + imgUrlReplaceString}, - Sogou: {value: true, name: "Sogou", url: "http://pic.sogou.com/ris?flag=1&drag=0&query=" + imgUrlReplaceString + "&flag=1"}, - TinEye: {value: true, name: "TinEye", url: "https://tineye.com/search?url=" + imgUrlReplaceString}, - WhatAnime: {value: true, name: "WhatAnime", url: "https://trace.moe/?url=" + imgUrlReplaceString}, - Yandex: {value: true, name: "Yandex", url: "https://yandex.com/images/search?url=" + imgUrlReplaceString + "&rpt=imageview"} + Baidu: {value: true, name: "Baidu", url: "http://image.baidu.com/pcdutu?queryImageUrl=" + imgUrlReplaceString}, + Bing: {value: true, name: "Bing", url: "https://www.bing.com/images/search?q=imgurl:" + imgUrlReplaceString + "&view=detailv2&iss=sbi&FORM=IRSBIQ"}, + Google: {value: true, name: "Google", url: "https://www.google.com/searchbyimage?sbisrc=1&image_url=" + imgUrlReplaceString}, + GoogleLens: {value: true, name: "Google Lens", url: "https://lens.google.com/uploadbyurl?url=" + imgUrlReplaceString}, + ImgOps: {value: true, name: "ImgOps", raw: true, url: "https://imgops.com/specialized+reverse/" + imgUrlReplaceString}, + IQDB: {value: true, name: "IQDB", url: "https://iqdb.org/?url=" + imgUrlReplaceString}, + Reddit: {value: true, name: "Reddit", url: "http://karmadecay.com/search?q=" + imgUrlReplaceString}, + SauceNAO: {value: true, name: "SauceNAO", url: "https://saucenao.com/search.php?db=999&url=" + imgUrlReplaceString}, + Sogou: {value: true, name: "Sogou", url: "http://pic.sogou.com/ris?flag=1&drag=0&query=" + imgUrlReplaceString + "&flag=1"}, + TinEye: {value: true, name: "TinEye", url: "https://tineye.com/search?url=" + imgUrlReplaceString}, + WhatAnime: {value: true, name: "WhatAnime", url: "https://trace.moe/?url=" + imgUrlReplaceString}, + Yandex: {value: true, name: "Yandex", url: "https://yandex.com/images/search?url=" + imgUrlReplaceString + "&rpt=imageview"} } }; @@ -254,11 +255,13 @@ module.exports = (_ => { this.modulePatches = { before: [ "ImageModal", + "ImageVideoModal", "MessageAccessories", "Spoiler" ], after: [ "ImageModal", + "ImageVideoModal", "LazyImage", "LazyImageZoomable", "ModalCarousel", @@ -278,7 +281,7 @@ module.exports = (_ => { this.css = ` ${BDFDB.dotCNS._imageutilitiesimagedetailsadded + BDFDB.dotCN.imagewrapper} { - border-radius: 8px; !important; + border-radius: 8px !important; height: calc(100% - 1rem - 16px) !important; max-height: unset !important; } @@ -315,12 +318,24 @@ module.exports = (_ => { ${BDFDB.dotCN._imageutilitiesimagedetails} > span { max-width: 100px; } - ${BDFDB.dotCN._imageutilitiesgallery}, - ${BDFDB.dotCN._imageutilitiesdetailsadded} { + ${BDFDB.dotCNS._imageutilitiesgallery + BDFDB.dotCN.modal}, + ${BDFDB.dotCNS._imageutilitiesdetailsadded + BDFDB.dotCN.modal} { transform: unset !important; filter: unset !important; backdrop-filter: unset !important; } + ${BDFDB.dotCN._imageutilitiesgallery} ~ ${BDFDB.dotCN.imagemodalnavbutton} { + display: none; + } + ${BDFDB.dotCNS.imagemodal + BDFDB.dotCNS.attachment + BDFDB.dotCN.attachmentvideocontrols}, + ${BDFDB.dotCNS.imagemodal + BDFDB.dotCN.attachment + BDFDB.dotCNS.attachmentcontrolshidden + BDFDB.dotCN.attachmentvideocontrols}:hover { + bottom: -10px; + transform: unset !important; + transition: bottom 0.3s ease; + } + ${BDFDB.dotCNS.imagemodal + BDFDB.dotCN.attachment + BDFDB.dotCNS.attachmentcontrolshidden + BDFDB.dotCN.attachmentvideocontrols} { + bottom: -42px; + } ${BDFDB.dotCNS.imagemodal + BDFDB.notCN._imageutilitiessibling} > ${BDFDB.dotCN.imagewrapper} { display: flex; justify-content: center; @@ -369,6 +384,7 @@ module.exports = (_ => { } ${BDFDB.dotCNS._imageutilitiessibling + BDFDB.dotCN.spinner} { position: absolute; + width: 32px; } ${BDFDB.dotCNS._imageutilitiesprevious + BDFDB.dotCN.spinner} { right: 21px; @@ -418,7 +434,7 @@ module.exports = (_ => { } onStart () { - BDFDB.ListenerUtils.add(this, document.body, "click", BDFDB.dotCNS.message + BDFDB.dotCNS.imagewrapper + BDFDB.dotCNC.imageoriginallink + BDFDB.dotCNS.message + BDFDB.dotCNS.imagewrapper + "img", e => this.cacheClickedImage(e.target)); + BDFDB.ListenerUtils.add(this, document.body, "click", [BDFDB.dotCN.imageoriginallink, "img", BDFDB.dotCN.attachmentcover, BDFDB.dotCN.attachmentcovericon, "video"].map(n => BDFDB.dotCNS.message + BDFDB.dotCNS.imagewrapper + n).join(", "), e => this.cacheClickedImage(e.target)); this.forceUpdateAll(); } @@ -677,9 +693,9 @@ module.exports = (_ => { onGuildContextMenu (e) { if (!this.settings.places.guildIcons || !e.instance.props.guild) return; - if (BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildheader, e.instance.props.target) || BDFDB.DOMUtils.getParent(BDFDB.dotCN.guildchannels, e.instance.props.target) && !e.instance.props.target.className && e.instance.props.target.parentElement.firstElementChild == e.instance.props.target) { + 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); - 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], 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")], BDFDB.LanguageUtils.LibraryStrings.guildbanner); } 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); } @@ -703,24 +719,21 @@ module.exports = (_ => { onMessageContextMenu (e) { if (!e.instance.props.message || !e.instance.props.channel || !e.instance.props.target) return; - if (e.instance.props.attachment) this.injectItem(e, [{original: e.instance.props.attachment.url, file: e.instance.props.attachment.proxy_url}], null, true); + 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); + 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); + 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.emojiold, "emote", false) && this.settings.places.emojis) this.injectItem(e, [{file: target.src, alternativeName: target.getAttribute("data-name")}], null, true); + } + 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); + } else { - 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, 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); - 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); - 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.emojiold, "emote", false) && this.settings.places.emojis) this.injectItem(e, [{file: target.src, alternativeName: target.getAttribute("data-name")}], null, true); - } - 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); - } - else { - const reaction = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagereaction, target); - if (reaction && this.settings.places.emojis) { - const emoji = reaction.querySelector(BDFDB.dotCN.emojiold); - if (emoji) this.injectItem(e, [{file: emoji.src, alternativeName: emoji.getAttribute("data-name")}], null, true); - } + const reaction = BDFDB.DOMUtils.getParent(BDFDB.dotCN.messagereaction, target); + if (reaction && this.settings.places.emojis) { + const emoji = reaction.querySelector(BDFDB.dotCN.emojiold); + if (emoji) this.injectItem(e, [{file: emoji.src, alternativeName: emoji.getAttribute("data-name")}], null, true); } } } @@ -766,10 +779,8 @@ module.exports = (_ => { filterUrls (...urls) { let addedUrls = []; return urls.filter(n => this.isValid(n && n.file || n)).map(n => { - let srcUrl = (n.file || n).replace(/^url\(|\)$|"|'/g, "").replace(/\?size\=\d+$/, "?size=4096").replace(/\?size\=\d+&/, "?size=4096&").replace(/[\?\&](height|width)=\d+/g, "").split("%3A")[0]; - if (srcUrl.startsWith("https://cdn.discordapp.com/") && !srcUrl.endsWith("?size=4096") && srcUrl.indexOf("?size=4096&") == -1) srcUrl += "?size=4096"; - let originalUrl = (n.original || n.file || n).replace(/^url\(|\)$|"|'/g, "").replace(/\?size\=\d+$/, "?size=4096").replace(/\?size\=\d+&/, "?size=4096&").replace(/[\?\&](height|width)=\d+/g, "").split("%3A")[0]; - if (originalUrl.startsWith("https://cdn.discordapp.com/") && !originalUrl.endsWith("?size=4096") && originalUrl.indexOf("?size=4096&") == -1) originalUrl += "?size=4096"; + let srcUrl = (n.file || n).replace(/^url\(|\)$|"|'/g, ""); + let originalUrl = (n.original || n.file || n).replace(/^url\(|\)$|"|'/g, ""); let fileUrl = srcUrl; if (fileUrl.indexOf("https://images-ext-1.discordapp.net/external/") > -1 || fileUrl.indexOf("https://images-ext-2.discordapp.net/external/") > -1) { if (fileUrl.split("/https/").length > 1) fileUrl = "https://" + fileUrl.split("/https/").pop(); @@ -803,16 +814,21 @@ module.exports = (_ => { let enabledEngines = BDFDB.ObjectUtils.filter(this.settings.engines, n => n); let enginesWithoutAll = BDFDB.ObjectUtils.filter(enabledEngines, n => n != "_all", true); let engineKeys = Object.keys(enginesWithoutAll); + let locations = Object.keys(ownLocations).filter(n => ownLocations[n].enabled); + let isVideo = this.isValid(urlData.file, "video"); let type = isVideo ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE; + return BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { children: [ BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: BDFDB.LanguageUtils.LanguageStrings.COPY_LINK, id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-link"), action: _ => { - BDFDB.LibraryModules.WindowUtils.copy(urlData.original.split("?size")[0]); + let url = urlData.original.split("?width")[0].split("?height")[0].split("?size")[0]; + url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url; + BDFDB.LibraryModules.WindowUtils.copy(url); BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"}); } }), @@ -820,7 +836,9 @@ module.exports = (_ => { label: BDFDB.LanguageUtils.LanguageStrings.COPY_MEDIA_LINK, id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-media-link"), action: _ => { - BDFDB.LibraryModules.WindowUtils.copy(urlData.file.split("?size")[0]); + let url = urlData.file.split("?width")[0].split("?height")[0].split("?size")[0]; + url = url.indexOf("discordapp.com/avatars/") > 0 || url.indexOf("discordapp.com/icons/") > 0 ? `${url}?size=4096` : url; + BDFDB.LibraryModules.WindowUtils.copy(url); BDFDB.NotificationUtils.toast(BDFDB.LanguageUtils.LanguageStrings.LINK_COPIED, {type: "success"}); } }), @@ -832,7 +850,7 @@ module.exports = (_ => { !this.isValid(urlData.file, "copyable") ? null : BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: this.labels.context_copy.replace("{{var0}}", type), id: BDFDB.ContextMenuUtils.createItemId(this.name, "copy-file"), - action: _ => this.copyFile(urlData.src) + action: _ => this.copyFile({url: urlData.src, fallbackUrl: urlData.file || urlData.original}) }), !document.querySelector(BDFDB.dotCN.imagemodal) && BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuItem, { label: this.labels.context_view.replace("{{var0}}", type), @@ -840,33 +858,28 @@ module.exports = (_ => { action: _ => { const imageThrowaway = document.createElement(isVideo ? "video" : "img"); imageThrowaway.addEventListener(isVideo ? "loadedmetadata" : "load", function() { + _this.cacheClickedImage(target); BDFDB.LibraryModules.ModalUtils.openModal(modalData => { - _this.cacheClickedImage(target); return BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ModalComponents.ModalRoot, Object.assign({ className: BDFDB.disCN.imagemodal }, modalData, { size: BDFDB.LibraryComponents.ModalComponents.ModalSize.DYNAMIC, "aria-label": BDFDB.LanguageUtils.LanguageStrings.IMAGE, - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ImageModal, { - animated: !!isVideo, + children: isVideo ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ImageVideoModal, { + src: imageThrowaway.src, + poster: this.getPosterUrl(imageThrowaway.src), + width: this.videoWidth, + naturalWidth: this.videoWidth, + height: this.videoHeight, + naturalHeight: this.videoHeight, + renderLinkComponent: props => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, props) + }) : BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ImageModal, { src: imageThrowaway.src, original: urlData.original, - width: isVideo ? this.videoWidth : this.width, - height: isVideo ? this.videoHeight : this.height, + width: this.width, + height: this.height, className: BDFDB.disCN.imagemodalimage, - shouldAnimate: true, - renderLinkComponent: props => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, props), - children: !isVideo ? null : (videoData => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Video, { - ignoreMaxSize: true, - poster: _this.getPosterUrl(urlData.src || urlData.file), - src: urlData.src || urlData.file, - width: videoData.size.width, - height: videoData.size.height, - naturalWidth: this.videoWidth, - naturalHeight: this.videoHeight, - play: true, - playOnHover: !!BDFDB.LibraryStores.AccessibilityStore.useReducedMotion - })) + renderLinkComponent: props => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Anchor, props) }) }), true); }); @@ -922,7 +935,22 @@ module.exports = (_ => { }); } - processImageModal (e) { + processModalCarousel (e) { + if (!this.settings.viewerSettings.galleryMode || !BDFDB.ReactUtils.findParent(e.returnvalue, {name: ["ImageVideoModal", "ImageModal"]})) return; + e.returnvalue.props.className = ""; + e.returnvalue.props.children[0] = null; + e.returnvalue.props.children[2] = null; + if (e.returnvalue.props.children[1] && switchedImageProps) { + e.returnvalue.props.children[1].props = Object.assign(e.returnvalue.props.children[1].props, switchedImageProps); + switchedImageProps = null; + } + } + + processImageVideoModal (e) { + this.processImageModal(e, true); + } + + processImageModal (e, filterForVideos) { if (!e.returnvalue) { if (switchedImageProps) { e.instance.props = Object.assign(e.instance.props, switchedImageProps); @@ -931,11 +959,10 @@ module.exports = (_ => { } else { let url = this.getImageSrc(viewedImage && viewedImage.proxy_url || typeof e.instance.props.children == "function" && e.instance.props.children(Object.assign({}, e.instance.props, {size: e.instance.props})).props.src || e.instance.props.src); - let isVideo = this.isValid(url, "video"); let [children, index] = BDFDB.ReactUtils.findParent(e.returnvalue, {props: [["className", BDFDB.disCN.downloadlink]]}); if (index > -1) { - let type = isVideo ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE; + let type = filterForVideos ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE; let openContext = event => BDFDB.ContextMenuUtils.open(this, event, BDFDB.ContextMenuUtils.createItem(BDFDB.LibraryComponents.MenuItems.MenuGroup, { children: Object.keys(this.defaults.zoomSettings).map(type => { let isBoolean = typeof this.defaults.zoomSettings[type].value == "boolean"; @@ -1018,7 +1045,7 @@ module.exports = (_ => { children: this.labels.context_copy.replace("{{var0}}", type), onClick: event => { BDFDB.ListenerUtils.stopEvent(event); - this.copyFile(url); + this.copyFile({url: url}); } }) ], @@ -1040,7 +1067,7 @@ module.exports = (_ => { } }) ], - this.settings.viewerSettings.zoomMode && !isVideo && [ + this.settings.viewerSettings.zoomMode && !filterForVideos && !this.isValid(e.instance.props.src, "gif") && [ BDFDB.ReactUtils.createElement("span", { className: BDFDB.disCN.downloadlink, children: "|", @@ -1061,9 +1088,9 @@ module.exports = (_ => { className: BDFDB.disCN._imageutilitiesdetailswrapper, children: [ e.instance.props.alt && {label: "Alt", text: e.instance.props.alt}, - {label: "Source", text: url}, + {label: "Source", text: url.split("?width")[0].split("?height")[0].split("?size")[0]}, {label: "Size", text: `${e.instance.props.width}x${e.instance.props.height}px`}, - cachedImages && cachedImages.amount && cachedImages.amount > 1 && {label: "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, { className: BDFDB.disCN._imageutilitiesdetails, children: [ @@ -1107,7 +1134,7 @@ module.exports = (_ => { let messages = [], index = -1; if (result) { messages = result.body.flat(10).reverse(); - cachedImages = {all: this.filterMessagesForImages(messages, viewedImage)}; + cachedImages = {all: this.filterMessagesForImages(messages, viewedImage, filterForVideos)}; index = this.getImageIndex(cachedImages.all, viewedImage); } if (index > -1) cachedImages = Object.assign(cachedImages, { @@ -1149,8 +1176,8 @@ module.exports = (_ => { this.addListener("keydown", "Gallery", event => { if (!firedEvents.includes("Gallery")) { firedEvents.push("Gallery"); - if (event.keyCode == 37) this.switchImages(-1); - else if (event.keyCode == 39) this.switchImages(1); + if (event.keyCode == 37) this.switchImages(-1, filterForVideos); + else if (event.keyCode == 39) this.switchImages(1, filterForVideos); } }); this.addListener("keyup", "Gallery", _ => BDFDB.ArrayUtils.remove(firedEvents, "Gallery", true)); @@ -1160,13 +1187,6 @@ module.exports = (_ => { } } - processModalCarousel (e) { - if (!this.settings.viewerSettings.galleryMode || !BDFDB.ReactUtils.findParent(e.returnvalue, {name: "ImageModal"})) return; - e.returnvalue.props.className = ""; - e.returnvalue.props.children[0] = null; - e.returnvalue.props.children[2] = null; - } - processLazyImage (e) { if (e.node) { if (e.instance.props.resized) { @@ -1199,25 +1219,24 @@ module.exports = (_ => { BDFDB.TimeUtils.clear(viewedImageTimeout); let modal = BDFDB.DOMUtils.getParent(BDFDB.dotCN.modal, e.node); if (modal) { - modal.className = BDFDB.DOMUtils.formatClassName(modal.className, this.settings.viewerSettings.galleryMode && BDFDB.disCN._imageutilitiesgallery, this.settings.viewerSettings.details && BDFDB.disCN._imageutilitiesdetailsadded); + modal.parentElement.className = BDFDB.DOMUtils.formatClassName(modal.parentElement.className, this.settings.viewerSettings.galleryMode && BDFDB.disCN._imageutilitiesgallery, this.settings.viewerSettings.details && BDFDB.disCN._imageutilitiesdetailsadded); if (this.settings.viewerSettings.galleryMode) { BDFDB.DOMUtils.addClass(modal, BDFDB.disCN.imagemodal); BDFDB.DOMUtils.removeClass(modal, BDFDB.disCN.modalcarouselmodal, BDFDB.disCN.modalcarouselmodalzoomed); } } - let isVideo = typeof e.instance.props.children == "function"; - if (isVideo && !BDFDB.LibraryStores.AccessibilityStore.useReducedMotion) e.node.style.setProperty("pointer-events", "none"); - if (this.settings.viewerSettings.zoomMode && !isVideo && !BDFDB.DOMUtils.containsClass(e.node.parentElement, BDFDB.disCN._imageutilitiessibling)) { + 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)) { e.node.style.setProperty("cursor", "zoom-in"); e.node.addEventListener("mousedown", event => { if (event.which != 1 || e.node.querySelector("video")) return; - BDFDB.ListenerUtils.stopEvent(event); let vanishObserver; + let zoomLevel = this.settings.zoomSettings.zoomLevel; let imgRects = BDFDB.DOMUtils.getRects(e.node.firstElementChild); - let lens = BDFDB.DOMUtils.create(`
<${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 * this.settings.zoomSettings.zoomLevel}px; height: ${imgRects.height * this.settings.zoomSettings.zoomLevel}px; position: fixed !important;${this.settings.zoomSettings.pixelMode ? " image-rendering: pixelated !important;" : ""}"${e.node.firstElementChild.tagName == "VIDEO" ? " loop autoplay" : ""}>
`); + let lens = BDFDB.DOMUtils.create(`
<${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" : ""}>
`); let pane = lens.firstElementChild.firstElementChild; let backdrop = BDFDB.DOMUtils.create(`
`); let appMount = document.querySelector(BDFDB.dotCN.appmount); @@ -1239,14 +1258,14 @@ module.exports = (_ => { lens.style.setProperty("height", this.settings.zoomSettings.lensSize + "px", "important"); lens.style.setProperty("clip-path", `circle(${(this.settings.zoomSettings.lensSize/2) + 2}px at center)`, "important"); lens.firstElementChild.style.setProperty("clip-path", `circle(${this.settings.zoomSettings.lensSize/2}px at center)`, "important"); - pane.style.setProperty("left", imgRects.left + ((this.settings.zoomSettings.zoomLevel - 1) * (imgRects.left - x - halfW)) + "px", "important"); - pane.style.setProperty("top", imgRects.top + ((this.settings.zoomSettings.zoomLevel - 1) * (imgRects.top - y - halfH)) + "px", "important"); - pane.style.setProperty("width", imgRects.width * this.settings.zoomSettings.zoomLevel + "px", "important"); - pane.style.setProperty("height", imgRects.height * this.settings.zoomSettings.zoomLevel + "px", "important"); + pane.style.setProperty("left", imgRects.left + ((zoomLevel - 1) * (imgRects.left - x - halfW)) + "px", "important"); + pane.style.setProperty("top", imgRects.top + ((zoomLevel - 1) * (imgRects.top - y - halfH)) + "px", "important"); + pane.style.setProperty("width", imgRects.width * zoomLevel + "px", "important"); + pane.style.setProperty("height", imgRects.height * zoomLevel + "px", "important"); }; lens.update(); - for (let ele of [e.node, document.querySelector(BDFDB.dotCN.modalcarouselwrapper)]) if (ele) ele.style.setProperty("pointer-events", "none", "important"); + for (let ele of [e.node, document.querySelector(BDFDB.dotCN.imagemodal)]) if (ele) ele.style.setProperty("pointer-events", "none", "important"); let dragging = event2 => { event = event2; @@ -1254,7 +1273,7 @@ module.exports = (_ => { }; let releasing = event2 => { BDFDB.ListenerUtils.stopEvent(event2); - for (let ele of [e.node, document.querySelector(BDFDB.dotCN.modalcarouselwrapper)]) if (ele) ele.style.removeProperty("pointer-events"); + for (let ele of [e.node, document.querySelector(BDFDB.dotCN.imagemodal)]) if (ele) ele.style.removeProperty("pointer-events"); this.cleanupListeners("Zoom"); document.removeEventListener("mousemove", dragging); document.removeEventListener("mouseup", releasing); @@ -1269,12 +1288,12 @@ module.exports = (_ => { this.addListener("wheel", "Zoom", event2 => { if (!document.contains(e.node)) this.cleanupListeners("Zoom"); else { - if (event2.deltaY < 0 && (this.settings.zoomSettings.zoomLevel + 0.1) <= this.defaults.zoomSettings.zoomLevel.maxValue) { - this.settings.zoomSettings.zoomLevel += 0.1; + if (event2.deltaY < 0 && (zoomLevel + this.settings.zoomSettings.zoomSpeed * zoomLevel) <= this.defaults.zoomSettings.zoomLevel.maxValue) { + zoomLevel += this.settings.zoomSettings.zoomSpeed * zoomLevel; lens.update(); } - else if (event2.deltaY > 0 && (this.settings.zoomSettings.zoomLevel - 0.1) >= this.defaults.zoomSettings.zoomLevel.minValue) { - this.settings.zoomSettings.zoomLevel -= 0.1; + else if (event2.deltaY > 0 && (zoomLevel - this.settings.zoomSettings.zoomSpeed * zoomLevel) >= this.defaults.zoomSettings.zoomLevel.minValue) { + zoomLevel -= this.settings.zoomSettings.zoomSpeed * zoomLevel; lens.update(); } } @@ -1283,12 +1302,12 @@ module.exports = (_ => { if (!document.contains(e.node)) this.cleanupListeners("Zoom"); else if (!firedEvents.includes("Zoom")) { firedEvents.push("Zoom"); - if (event2.keyCode == 187 && (this.settings.zoomSettings.zoomLevel + 0.5) <= this.defaults.zoomSettings.zoomLevel.maxValue) { - this.settings.zoomSettings.zoomLevel += 0.5; + if (event2.keyCode == 187 && (zoomLevel + zoomLevel * 0.5) <= this.defaults.zoomSettings.zoomLevel.maxValue) { + zoomLevel += zoomLevel * 0.5; lens.update(); } - else if (event2.keyCode == 189 && (this.settings.zoomSettings.zoomLevel - 0.5) >= this.defaults.zoomSettings.zoomLevel.minValue) { - this.settings.zoomSettings.zoomLevel -= 0.5; + else if (event2.keyCode == 189 && (zoomLevel - zoomLevel * 0.5) >= this.defaults.zoomSettings.zoomLevel.minValue) { + zoomLevel -= zoomLevel * 0.5; lens.update(); } } @@ -1443,10 +1462,11 @@ module.exports = (_ => { cacheClickedImage (target) { if (!target) return; - const image = (BDFDB.DOMUtils.getParent(BDFDB.dotCN.imagewrapper, target) || target).querySelector("img") || target; + const image = (BDFDB.DOMUtils.getParent(BDFDB.dotCN.imagewrapper, target) || target).querySelector("img, video") || target; if (!image) return; const message = BDFDB.ReactUtils.findValue(image, "message", {up: true}); if (!message) return; + BDFDB.DOMUtils.hide(document.querySelectorAll(BDFDB.dotCN.tooltip)); firstViewedImage = {messageId: message.id, channelId: message.channel_id, proxy_url: image.src}; viewedImage = firstViewedImage; if (cachedImages) cachedImages.index = this.getImageIndex(cachedImages.all, viewedImage); @@ -1456,65 +1476,60 @@ module.exports = (_ => { }, 1000); } - downloadFile (urls, path, alternativeName, fallbackToRequest) { - if (!urls) return BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE).replace("{{var1}}", path || "PC"), {type: "danger"}); + requestFile (urls, onLoad, onError, config = {}) { + if (!urls || typeof onLoad != "function") return typeof onError == "function" && onError(); let url = urls.url.startsWith("/assets") ? (window.location.origin + urls.url) : urls.url; - if (!fallbackToRequest) BDFDB.DiscordUtils.requestFileData(url, {timeout: 3000}, (error, buffer) => { + 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) => { if (error || !buffer) { - if (urls.fallbackUrl && urls.url != urls.fallbackUrl) this.downloadFile({url: urls.fallbackUrl, oldUrl: urls.url}, path, alternativeName); - else this.downloadFile({url: urls.oldUrl || urls.url, fallbackUrl: urls.oldUrl ? urls.url : undefined}, path, alternativeName, true); - } - else { - let extension = this.getFileExtension(new Uint8Array(buffer)); - if (!extension) BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE).replace("{{var1}}", path || "PC"), {type: "danger"}); - else { - 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 (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 { - let hrefURL = window.URL.createObjectURL(new Blob([buffer], {type: this.getMimeType(extension)})); - let tempLink = document.createElement("a"); - tempLink.href = hrefURL; - tempLink.download = `${(alternativeName || url.split("/").pop().split(".").slice(0, -1).join(".") || "unknown").slice(0, 35)}.${extension}`; - tempLink.click(); - window.URL.revokeObjectURL(hrefURL); - } - } + if (isResized) this.requestFile(urls, onLoad, onError, {orignalSizeChecked: true}); + else if (urls.fallbackUrl && urls.url != urls.fallbackUrl) this.requestFile({url: urls.fallbackUrl, oldUrl: urls.url}, onLoad, onError); + else this.requestFile({url: urls.oldUrl || urls.url, fallbackUrl: urls.oldUrl ? urls.url : undefined}, onLoad, onError, {fallbackToRequest: true}); } + else onLoad(url, buffer); }); - else BDFDB.LibraryRequires.request(url, {agentOptions: {rejectUnauthorized: false}, headers: {"Content-Type": "application/json"}}, (error, response, 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 (urls.fallbackUrl && urls.url != urls.fallbackUrl) this.downloadFile({url: urls.fallbackUrl}, path, alternativeName, true); - else BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE).replace("{{var1}}", path || "PC"), {type: "danger"}); - } - else { - let extension = this.getFileExtension(new Uint8Array(buffer)); - if (!extension) BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE).replace("{{var1}}", path || "PC"), {type: "danger"}); - else { - 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 (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 { - let hrefURL = window.URL.createObjectURL(new Blob([buffer], {type: this.getMimeType(extension)})); - let tempLink = document.createElement("a"); - tempLink.href = hrefURL; - tempLink.download = `${(alternativeName || url.split("/").pop().split(".").slice(0, -1).join(".") || "unknown").slice(0, 35)}.${extension}`; - tempLink.click(); - window.URL.revokeObjectURL(hrefURL); - } - } + if (isResized) this.requestFile(urls, onLoad, onError, {orignalSizeChecked: true, fallbackToRequest: true}); + else if (urls.fallbackUrl && urls.url != urls.fallbackUrl) this.requestFile({url: urls.fallbackUrl}, onLoad, onError, {fallbackToRequest: true}); + else if (typeof onError == "function") onError(); } + else onLoad(url, buffer); }); } - copyFile (url) { - let type = this.isValid(url, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE; - BDFDB.LibraryModules.WindowUtils.copyImage(url); - BDFDB.NotificationUtils.toast(this.labels.toast_copy_success.replace("{{var0}}", type), {type: "success"}); + downloadFile (urls, path, alternativeName) { + this.requestFile(urls, (url, buffer) => { + let extension = this.getFileExtension(new Uint8Array(buffer)); + if (!extension) BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE).replace("{{var1}}", path || "PC"), {type: "danger"}); + else { + 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 (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 { + let hrefURL = window.URL.createObjectURL(new Blob([buffer], {type: this.getMimeType(extension)})); + let tempLink = document.createElement("a"); + tempLink.href = hrefURL; + tempLink.download = `${(alternativeName || url.split("/").pop().split(".").slice(0, -1).join(".") || "unknown").slice(0, 35)}.${extension}`; + tempLink.click(); + window.URL.revokeObjectURL(hrefURL); + } + } + }, _ => { + BDFDB.NotificationUtils.toast(this.labels.toast_save_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE).replace("{{var1}}", path || "PC"), {type: "danger"}); + }); + } + + copyFile (urls) { + this.requestFile(urls, (url, buffer) => { + let type = this.isValid(url, "video") ? BDFDB.LanguageUtils.LanguageStrings.VIDEO : BDFDB.LanguageUtils.LanguageStrings.IMAGE; + 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_failed.replace("{{var0}}", BDFDB.LanguageUtils.LanguageStrings.IMAGE), {type: "danger"}); + }); } getDownloadLocation () { @@ -1548,24 +1563,26 @@ module.exports = (_ => { getImageSrc (img) { if (!img) return null; - return (typeof img == "string" ? img : (img.proxy_url || img.src || (typeof img.querySelector == "function" && img.querySelector("canvas") ? img.querySelector("canvas").src : ""))).split("?width=")[0]; + return (typeof img == "string" ? img : (img.proxy_url || img.src || (typeof img.querySelector == "function" && img.querySelector("canvas") ? img.querySelector("canvas").src : ""))); } getImageIndex (messages, img) { - return messages.findIndex(i => i.messageId == img.messageId && (messages.filter(n => n.messageId == i.messageId).length < 2 || i.url && img.proxy_url.indexOf(i.url) > -1 || i.proxy_url && img.proxy_url.indexOf(i.proxy_url) > -1)); + return messages.findIndex(i => i.messageId == img.messageId && (messages.filter(n => n.messageId == i.messageId).length < 2 || i.url && img.proxy_url && img.proxy_url.indexOf(i.url) > -1 || i.proxy_url && img.proxy_url && img.proxy_url.indexOf(i.proxy_url) > -1)); } - filterMessagesForImages (messages, img) { + filterMessagesForImages (messages, img, filterForVideos) { return messages.filter(m => m && m.channel_id == img.channelId && !BDFDB.LibraryStores.RelationshipStore.isBlocked(m.author.id) && (firstViewedImage && m.id == firstViewedImage.messageId || m.id == img.messageId || m.embeds.filter(e => e.image || e.thumbnail || e.video).length || m.attachments.filter(a => !a.filename.startsWith("SPOILER_")).length)).map(m => [m.attachments, m.embeds].flat(10).filter(n => n).map(i => Object.assign({messageId: m.id, channelId: img.channelId}, i, i.image, i.thumbnail, i.video))).flat(10).filter(n => { if (!n) return false; + let type = (n.type || n.content_type || "").split("/")[0]; + if (type && (filterForVideos && type != "video" || !filterForVideos && type == "video")) return false; if (!n.content_type || img.proxy_url == n.proxy_url || img.proxy_url == n.url || img.proxy_url == n.href) return true; let extension = (n.content_type.split("/")[1] || "").split("+")[0] || ""; - if (extension && this.settings.galleryFilter[extension] === false) return false; + if (extension && (!fileTypes[extension] || this.settings.galleryFilter[extension] === false)) return false; return true; }); } - switchImages (offset) { + switchImages (offset, filterForVideos) { const newIndex = parseInt(cachedImages.index) + parseInt(offset); if (newIndex < 0 || newIndex > (cachedImages.amount - 1)) return; @@ -1587,7 +1604,7 @@ module.exports = (_ => { }).then(result => { if (result && viewedImage) { const messages = result.body.flat(10).reverse(); - Object.assign(cachedImages, {all: this.filterForCopies([].concat(cachedImages.all, this.filterMessagesForImages(messages, viewedImage)))}); + Object.assign(cachedImages, {all: this.filterForCopies([].concat(cachedImages.all, this.filterMessagesForImages(messages, viewedImage, filterForVideos)))}); const index = this.getImageIndex(cachedImages.all, viewedImage); cachedImages = Object.assign(cachedImages, { channelId: viewedImage.channelId, @@ -1614,7 +1631,7 @@ module.exports = (_ => { }).then(result => { if (result && viewedImage) { const messages = result.body.flat(10).reverse(); - Object.assign(cachedImages, {all: this.filterForCopies([].concat(this.filterMessagesForImages(messages, viewedImage), cachedImages.all))}); + Object.assign(cachedImages, {all: this.filterForCopies([].concat(this.filterMessagesForImages(messages, viewedImage, filterForVideos), cachedImages.all))}); const index = this.getImageIndex(cachedImages.all, viewedImage); cachedImages = Object.assign(cachedImages, { channelId: viewedImage.channelId, @@ -1638,7 +1655,7 @@ module.exports = (_ => { height: thisViewedImage.height, children: !isVideo ? null : (videoData => BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Video, { ignoreMaxSize: true, - poster: thisViewedImage.proxy_url.replace("https://cdn.discordapp.com", "https://media.discordapp.net").split("?size=")[0] + "?format=jpeg", + poster: this.getPosterUrl(thisViewedImage.proxy_url), src: thisViewedImage.proxy_url, width: videoData.size.width, height: videoData.size.height, @@ -1657,7 +1674,7 @@ module.exports = (_ => { filterForCopies (messages) { let filtered = []; - for (let message of messages) if (!filtered.find(n => n.messageId == message.messageId)) filtered.push(message); + for (let message of messages) if (!filtered.find(n => n.messageId == message.messageId && n.id == message.id)) filtered.push(message); return filtered; } @@ -1686,6 +1703,7 @@ module.exports = (_ => { context_copy: "Копирайте {{var0}}", context_imageactions: "Действия с изображения", context_lenssize: "Размер на обектива", + context_zoomspeed: "Скорост на мащабиране", context_saveas: "Запазете {{var0}} като ...", context_searchwith: "Търсете {{var0}} с ...", context_videoactions: "Видео действия", @@ -1701,6 +1719,7 @@ module.exports = (_ => { context_copy: "Zkopírovat {{var0}}", context_imageactions: "Akce s obrázky", context_lenssize: "Velikost lupy", + context_zoomspeed: "Rychlost zoomu", context_saveas: "Uložit {{var0}} jako...", context_searchwith: "Hledat {{var0}} pomocí...", context_videoactions: "Video akce", @@ -1716,6 +1735,7 @@ module.exports = (_ => { context_copy: "Kopiér {{var0}}", context_imageactions: "Billedhandlinger", context_lenssize: "Objektivstørrelse", + context_zoomspeed: "Zoomhastighed", context_saveas: "Gem {{var0}} som ...", context_searchwith: "Søg i {{var0}} med ...", context_videoactions: "Videohandlinger", @@ -1731,6 +1751,7 @@ module.exports = (_ => { context_copy: "{{var0}} kopieren", context_imageactions: "Bildaktionen", context_lenssize: "Linsengröße", + context_zoomspeed: "Zoomgeschwindigkeit", context_saveas: "{{var0}} speichern als ...", context_searchwith: "{{var0}} suchen mit ...", context_videoactions: "Videoaktionen", @@ -1746,6 +1767,7 @@ module.exports = (_ => { context_copy: "Αντιγραφή {{var0}}", context_imageactions: "Ενέργειες εικόνας", context_lenssize: "Μέγεθος φακού", + context_zoomspeed: "Ταχύτητα ζουμ", context_saveas: "Αποθήκευση {{var0}} ως ...", context_searchwith: "Αναζήτηση {{var0}} με ...", context_videoactions: "Ενέργειες βίντεο", @@ -1761,6 +1783,7 @@ module.exports = (_ => { context_copy: "Copiar {{var0}}", context_imageactions: "Acciones de imagen", context_lenssize: "Tamaño de la lente", + context_zoomspeed: "Velocidad de zoom", context_saveas: "Guardar {{var0}} como ...", context_searchwith: "Buscar {{var0}} con ...", context_videoactions: "Acciones de vídeo", @@ -1776,6 +1799,7 @@ module.exports = (_ => { context_copy: "Kopioi {{var0}}", context_imageactions: "Kuvatoiminnot", context_lenssize: "Linssin koko", + context_zoomspeed: "Zoomausnopeus", context_saveas: "Tallenna {{var0}} nimellä ...", context_searchwith: "Tee haku {{var0}} ...", context_videoactions: "Videotoiminnot", @@ -1791,6 +1815,7 @@ module.exports = (_ => { context_copy: "Copier {{var0}}", context_imageactions: "Actions sur les images", context_lenssize: "Taille de l'objectif", + context_zoomspeed: "Vitesse de zoom", context_saveas: "Enregistrer {{var0}} sous ...", context_searchwith: "Rechercher {{var0}} avec ...", context_videoactions: "Actions vidéo", @@ -1806,6 +1831,7 @@ module.exports = (_ => { context_copy: "कॉपी {{var0}}", context_imageactions: "छवि क्रियाएँ", context_lenssize: "लेंस का आकार", + context_zoomspeed: "ज़ूम गति", context_saveas: "{{var0}} को इस रूप में सेव करें...", context_searchwith: "इसके साथ {{var0}} खोजें ...", context_videoactions: "वीडियो क्रिया", @@ -1821,6 +1847,7 @@ module.exports = (_ => { context_copy: "Kopiraj {{var0}}", context_imageactions: "Radnje slike", context_lenssize: "Veličina leće", + context_zoomspeed: "Brzina zumiranja", context_saveas: "Spremi {{var0}} kao ...", context_searchwith: "Traži {{var0}} sa ...", context_videoactions: "Video radnje", @@ -1836,6 +1863,7 @@ module.exports = (_ => { context_copy: "{{var0}} másolása", context_imageactions: "Képműveletek", context_lenssize: "Lencse mérete", + context_zoomspeed: "Zoom sebesség", context_saveas: "{{var0}} mentése másként ...", context_searchwith: "Keresés a következőben: {{var0}} a következővel:", context_videoactions: "Videóműveletek", @@ -1851,6 +1879,7 @@ module.exports = (_ => { context_copy: "Copia {{var0}}", context_imageactions: "Azioni immagine", context_lenssize: "Dimensione della lente", + context_zoomspeed: "Velocità dello zoom", context_saveas: "Salva {{var0}} come ...", context_searchwith: "Cerca {{var0}} con ...", context_videoactions: "Azioni video", @@ -1866,6 +1895,7 @@ module.exports = (_ => { context_copy: "{{var0}} をコピーします", context_imageactions: "画像アクション", context_lenssize: "レンズサイズ", + context_zoomspeed: "ズーム速度", context_saveas: "{{var0}} を...として保存します", context_searchwith: "{{var0}} を...で検索", context_videoactions: "ビデオ アクション", @@ -1881,6 +1911,7 @@ module.exports = (_ => { context_copy: "{{var0}} 복사", context_imageactions: "이미지 작업", context_lenssize: "렌즈 크기", + context_zoomspeed: "줌 속도", context_saveas: "{{var0}} 을 다른 이름으로 저장 ...", context_searchwith: "{{var0}} 검색 ...", context_videoactions: "비디오 작업", @@ -1896,6 +1927,7 @@ module.exports = (_ => { context_copy: "Kopijuoti {{var0}}", context_imageactions: "Vaizdo veiksmai", context_lenssize: "Objektyvo dydis", + context_zoomspeed: "Priartinimo greitis", context_saveas: "Išsaugoti '{{var0}}' kaip ...", context_searchwith: "Ieškoti {{var0}} naudojant ...", context_videoactions: "Vaizdo įrašų veiksmai", @@ -1911,6 +1943,7 @@ module.exports = (_ => { context_copy: "Kopieer {{var0}}", context_imageactions: "Afbeeldingsacties", context_lenssize: "Lens Maat", + context_zoomspeed: "Zoom snelheid", context_saveas: "Bewaar {{var0}} als ...", context_searchwith: "Zoek {{var0}} met ...", context_videoactions: "Video-acties", @@ -1926,6 +1959,7 @@ module.exports = (_ => { context_copy: "Kopier {{var0}}", context_imageactions: "Bildehandlinger", context_lenssize: "Linsestørrelse", + context_zoomspeed: "Zoomhastighet", context_saveas: "Lagre {{var0}} som ...", context_searchwith: "Søk på {{var0}} med ...", context_videoactions: "Videohandlinger", @@ -1941,6 +1975,7 @@ module.exports = (_ => { context_copy: "Kopiuj {{var0}}", context_imageactions: "Działania związane z obrazem", context_lenssize: "Rozmiar soczewki", + context_zoomspeed: "Szybkość zoomu", context_saveas: "Zapisz {{var0}} jako ...", context_searchwith: "Wyszukaj {{var0}} za pomocą ...", context_videoactions: "Akcje wideo", @@ -1956,6 +1991,7 @@ module.exports = (_ => { context_copy: "Copiar {{var0}}", context_imageactions: "Ações de imagem", context_lenssize: "Tamanho da lente", + context_zoomspeed: "Velocidade do zoom", context_saveas: "Salvar {{var0}} como ...", context_searchwith: "Pesquisar {{var0}} com ...", context_videoactions: "Ações de vídeo", @@ -1971,6 +2007,7 @@ module.exports = (_ => { context_copy: "Copiați {{var0}}", context_imageactions: "Acțiuni de imagine", context_lenssize: "Dimensiunea obiectivului", + context_zoomspeed: "Viteza de zoom", context_saveas: "Salvați {{var0}} ca ...", context_searchwith: "Căutați {{var0}} cu ...", context_videoactions: "Acțiuni video", @@ -1986,6 +2023,7 @@ module.exports = (_ => { context_copy: "Скопируйте {{var0}}", context_imageactions: "Действия с изображением", context_lenssize: "Размер линзы", + context_zoomspeed: "Скорость масштабирования", context_saveas: "Сохранить {{var0}} как ...", context_searchwith: "Искать {{var0}} с помощью ...", context_videoactions: "Действия с видео", @@ -2001,6 +2039,7 @@ module.exports = (_ => { context_copy: "Kopiera {{var0}}", context_imageactions: "Bildåtgärder", context_lenssize: "Linsstorlek", + context_zoomspeed: "Zoomhastighet", context_saveas: "Spara {{var0}} som ...", context_searchwith: "Sök {{var0}} med ...", context_videoactions: "Videoåtgärder", @@ -2016,6 +2055,7 @@ module.exports = (_ => { context_copy: "คัดลอก{{var0}}", context_imageactions: "การทำงานของรูปภาพ", context_lenssize: "ขนาดเลนส์", + context_zoomspeed: "ความเร็วในการซูม", context_saveas: "บันทึก{{var0}}เป็น ...", context_searchwith: "ค้นหา{{var0}} ้วย ...", context_videoactions: "การกระทำของวิดีโอ", @@ -2031,6 +2071,7 @@ module.exports = (_ => { context_copy: "{{var0}} kopyala", context_imageactions: "Görüntü Eylemleri", context_lenssize: "Lens Boyutu", + context_zoomspeed: "yakınlaştırma hızı", context_saveas: "{{var0}} farklı kaydet ...", context_searchwith: "{{var0}} şununla ara ...", context_videoactions: "Video Eylemleri", @@ -2046,6 +2087,7 @@ module.exports = (_ => { context_copy: "Копіювати {{var0}}", context_imageactions: "Дії із зображеннями", context_lenssize: "Розмір лінзи", + context_zoomspeed: "Швидкість масштабування", context_saveas: "Збережіть {{var0}} як ...", context_searchwith: "Шукати {{var0}} за допомогою ...", context_videoactions: "Відео дії", @@ -2061,6 +2103,7 @@ module.exports = (_ => { context_copy: "Sao chép {{var0}}", context_imageactions: "Hành động hình ả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_searchwith: "Tìm kiếm {{var0}} bằng ...", context_videoactions: "Hành động video", @@ -2076,6 +2119,7 @@ module.exports = (_ => { context_copy: "复制 {{var0}}", context_imageactions: "图像动作", context_lenssize: "缩放尺寸", + context_zoomspeed: "变焦速度", context_saveas: "将 {{var0}} 另存到...", context_searchwith: "搜索 {{var0}} 使用...", context_videoactions: "视频动作", @@ -2091,6 +2135,7 @@ module.exports = (_ => { context_copy: "複製 {{var0}}", context_imageactions: "圖像動作", context_lenssize: "縮放尺寸", + context_zoomspeed: "变焦速度", context_saveas: "將 {{var0}} 另存到...", context_searchwith: "搜尋 {{var0}} 使用...", context_videoactions: "視頻動作", @@ -2106,6 +2151,7 @@ module.exports = (_ => { context_copy: "Copy {{var0}}", context_imageactions: "Image Actions", context_lenssize: "Lens Size", + context_zoomspeed: "Zoom speed", context_saveas: "Save {{var0}} as ...", context_searchwith: "Search {{var0}} with ...", context_videoactions: "Video Actions", @@ -2120,4 +2166,4 @@ module.exports = (_ => { } }; })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog)); -})(); +})(); \ No newline at end of file diff --git a/.config/BetterDiscord/plugins/InvisibleTyping.config.json b/.config/BetterDiscord/plugins/InvisibleTyping.config.json old mode 100755 new mode 100644 index 022fe37..5ab6e1e --- a/.config/BetterDiscord/plugins/InvisibleTyping.config.json +++ b/.config/BetterDiscord/plugins/InvisibleTyping.config.json @@ -1,13 +1,5 @@ { - "currentVersionInfo": { - "version": "1.2.2", - "hasShownChangelog": true - }, "settings": { - "exclude": [ - "671439465377562624" - ], - "autoEnable": true, "latestUsedVersion": "1.3.3" } } \ No newline at end of file diff --git a/.config/BetterDiscord/plugins/InvisibleTyping.plugin.js b/.config/BetterDiscord/plugins/InvisibleTyping.plugin.js old mode 100755 new mode 100644 diff --git a/.config/BetterDiscord/plugins/NotificationSounds.config.json b/.config/BetterDiscord/plugins/NotificationSounds.config.json index 25cedd9..7c3f508 100755 --- a/.config/BetterDiscord/plugins/NotificationSounds.config.json +++ b/.config/BetterDiscord/plugins/NotificationSounds.config.json @@ -257,6 +257,20 @@ "mute": false, "sound": "---", "volume": 100 + }, + "highfive_clap": { + "category": "---", + "focus": false, + "mute": false, + "sound": "---", + "volume": 100 + }, + "highfive_whistle": { + "category": "---", + "focus": false, + "mute": false, + "sound": "---", + "volume": 100 } }, "volumes": { diff --git a/.config/BetterDiscord/plugins/NotificationSounds.plugin.js b/.config/BetterDiscord/plugins/NotificationSounds.plugin.js index 04354f6..60d1c17 100644 --- a/.config/BetterDiscord/plugins/NotificationSounds.plugin.js +++ b/.config/BetterDiscord/plugins/NotificationSounds.plugin.js @@ -2,7 +2,7 @@ * @name NotificationSounds * @author DevilBro * @authorId 278543574059057154 - * @version 3.7.6 + * @version 3.7.8 * @description Allows you to replace the native Sounds with custom Sounds * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -86,8 +86,8 @@ module.exports = (_ => { const WebAudioSound = class WebAudioSound { constructor (type) { this.name = type; - this._src = audios[choices[type].category][choices[type].sound] || types[type].src; - this._volume = choices[type].volume / 100; + this._src = choices[type] && audios[choices[type].category][choices[type].sound] || types[type] && types[type].src || BDFDB.LibraryModules.SoundParser(`./${type}.mp3`); + this._volume = (choices[type] ? choices[type].volume : 100) / 100; } loop () { this._ensureAudio().then(audio => { @@ -178,15 +178,18 @@ module.exports = (_ => { name: name, src: src, mute: id.startsWith("call_") ? null : false, + streamMute: false, force: id == "message1" ? false : null, focus: id == "message1" ? true : false }; if (id == "message1") { types[id].mute = true; + types[id].streamMute = false; for (let subType in message1Types) types[subType] = { name: message1Types[subType].name, src: BDFDB.LibraryModules.SoundParser(message1Types[subType].src), mute: true, + streamMute: false, force: message1Types[subType].force, focus: message1Types[subType].focus } @@ -286,8 +289,8 @@ module.exports = (_ => { cancel(); BDFDB.PatchUtils.patch(this, e.returnValue.constructor.prototype, ["play", "loop"], {instead: e2 => { let type = e2.instance && e2.instance.name; + let loop = e2.originalMethodName == "loop"; if (type && choices[type]) { - let loop = e2.originalMethodName == "loop"; e2.stopOriginalMethodCall(); BDFDB.TimeUtils.timeout(_ => { if (type == "message1") { @@ -302,21 +305,13 @@ module.exports = (_ => { else this.playAudio(type, loop); }); } - else e2.callOriginalMethodAfterwards(); + else this.playAudio(type, loop); }}); BDFDB.PatchUtils.patch(this, e.returnValue.constructor.prototype, "stop", {after: e2 => { let type = e2.instance && e2.instance.name; if (type && createdAudios[type]) createdAudios[type].stop(); }}); } - return; - let type = e.methodArguments[0]; - if (type && choices[type]) { - let audio = new WebAudioSound(type); - createdAudios[type] = audio; - return audio; - } - else BDFDB.LogUtils.warn(`Could not create Sound for "${type}".`, this); }}, {noCache: true}); BDFDB.LibraryModules.SoundUtils.createSound("call_calling"); } @@ -444,61 +439,45 @@ module.exports = (_ => { BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsLabel, { label: types[type].name }), - types[type].force != null ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "Switch", - mini: true, - grow: 0, - label: "Force Play", - labelChildren: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { - text: "Plays the Sound even if the Channel, the Message was sent in, is muted", - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { - name: BDFDB.LibraryComponents.SvgIcon.Names.QUESTIONMARK, - style: {marginLeft: 4, marginRight: -2}, - width: 14, - height: 14 - }) - }), - value: choices[type].force, - onChange: value => { - choices[type].force = value; - this.saveChoice(type, false); - } - }) : null, - types[type].focus != null ? BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "Switch", - mini: true, - grow: 0, - label: "Focus Mute", - labelChildren: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.TooltipContainer, { - text: "Does not play the Sound when the Channel, the Message was sent in, is currently opened", - children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { - name: BDFDB.LibraryComponents.SvgIcon.Names.QUESTIONMARK, - style: {marginLeft: 4, marginRight: -2}, - width: 14, - height: 14 - }) - }), - value: choices[type].focus, - onChange: value => { - choices[type].focus = value; - this.saveChoice(type, false); - } - }) : null, - types[type].mute !== null && BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SettingsItem, { - type: "Switch", - mini: true, - grow: 0, - label: "Mute in", - labelChildren: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.StatusComponents.Status, { - style: {marginLeft: 6}, - size: 12, - status: BDFDB.LibraryComponents.StatusComponents.Types.DND - }), - value: choices[type].mute, - onChange: value => { - choices[type].mute = value; - this.saveChoice(type, false); - } + ["force", "focus", "mute", "streamMute"].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, { + 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: "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, { + label: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.Flex, { + children: n.label + }), + hint: n.hint, + id: BDFDB.ContextMenuUtils.createItemId(this.name, type, n.key), + checked: types[type][n.key], + action: state => { + choices[type][n.key] = state; + this.saveChoice(type, false); + } + })).filter(n => n) + })), + children: BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.SvgIcon, { + width: 20, + height: 20, + name: BDFDB.LibraryComponents.SvgIcon.Names.COG + }) }) ].filter(n => n) }), @@ -696,6 +675,7 @@ module.exports = (_ => { sound: "---", volume: 100, mute: types[type].mute, + streamMute: types[type].streamMute, focus: types[type].focus }; choices[type] = choice; @@ -726,7 +706,7 @@ module.exports = (_ => { dontPlayAudio (type) { let status = BDFDB.UserUtils.getStatus(); - return choices[type].mute && (status == "dnd" || status == "streaming"); + return choices[type] && (choices[type].mute && status == "dnd" || choices[type].streamMute && status == "streaming"); } fireEvent (type) { @@ -735,7 +715,7 @@ module.exports = (_ => { } isSoundUsedAnywhere (type) { - return 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" && /\d$/.test(type)); } }; })(window.BDFDB_Global.PluginUtils.buildPlugin(changeLog)); diff --git a/.config/BetterDiscord/plugins/PinDMs.config.json b/.config/BetterDiscord/plugins/PinDMs.config.json old mode 100755 new mode 100644 index f6fa6bf..a94e274 --- a/.config/BetterDiscord/plugins/PinDMs.config.json +++ b/.config/BetterDiscord/plugins/PinDMs.config.json @@ -8,15 +8,13 @@ "pinned": { "662731831908761636": { "channelList": { - "6103412714032048": { - "id": "6103412714032048", - "name": "Pins", + "1741875717362926": { + "id": "1741875717362926", + "name": "Pinned Direct Messages #1", "dms": [ - "851263280551165977", - "709081938622939166", - "736308155964850176", + "815678838809296926", "740325591684874305", - "815678838809296926" + "709081938622939166" ], "pos": 0, "collapsed": false, diff --git a/.config/BetterDiscord/plugins/PinDMs.plugin.js b/.config/BetterDiscord/plugins/PinDMs.plugin.js old mode 100755 new mode 100644 diff --git a/.config/BetterDiscord/plugins/PluginRepo.plugin.js b/.config/BetterDiscord/plugins/PluginRepo.plugin.js index 0ce5844..d72000d 100644 --- a/.config/BetterDiscord/plugins/PluginRepo.plugin.js +++ b/.config/BetterDiscord/plugins/PluginRepo.plugin.js @@ -2,7 +2,7 @@ * @name PluginRepo * @author DevilBro * @authorId 278543574059057154 - * @version 2.4.5 + * @version 2.4.6 * @description Allows you to download all Plugins from BD's Website within Discord * @invite Jx3TjNS * @donate https://www.paypal.me/MircoWittrien @@ -370,7 +370,7 @@ module.exports = (_ => { style: { borderRadius: 3, textTransform: "uppercase", - background: BDFDB.DiscordConstants.Colors.STATUS_YELLOW + background: BDFDB.DiscordConstants.Colors.YELLOW }, text: BDFDB.LanguageUtils.LanguageStrings.NEW })