diff --git a/client/src/index.js b/client/src/index.js index 060eb804..b1ed10e6 100644 --- a/client/src/index.js +++ b/client/src/index.js @@ -8,14 +8,17 @@ * LICENSE file in the root directory of this source tree. */ -import { DOM, BdUI } from 'ui'; +import { DOM, BdUI, ProfileBadges } from 'ui'; import BdCss from './styles/index.scss'; import { Events, CssEditor, Globals, PluginManager, ThemeManager } from 'modules'; import { ClientLogger as Logger } from 'common'; +import { default as WebpackModules } from './modules/webpackmodules'; + class BetterDiscord { constructor() { + ProfileBadges.init(); // Not final way to do it DOM.injectStyle(BdCss, 'bdmain'); Events.on('global-ready', this.globalReady.bind(this)); } @@ -27,6 +30,7 @@ class BetterDiscord { } globalReady() { + BdUI.initUiEvents(); this.vueInstance = BdUI.injectUi(); (async () => { this.init(); diff --git a/client/src/modules/modules.js b/client/src/modules/modules.js index 1e5537cb..28626124 100644 --- a/client/src/modules/modules.js +++ b/client/src/modules/modules.js @@ -4,4 +4,5 @@ export { default as CssEditor } from './csseditor'; export { default as PluginManager } from './pluginmanager'; export { default as ThemeManager } from './thememanager'; export { default as Globals } from './globals'; -export { default as Vendor } from './vendor'; \ No newline at end of file +export { default as Vendor } from './vendor'; +export { default as WebpackModules } from './webpackmodules'; diff --git a/client/src/styles/partials/index.scss b/client/src/styles/partials/index.scss index d40d30a0..b2d7157c 100644 --- a/client/src/styles/partials/index.scss +++ b/client/src/styles/partials/index.scss @@ -5,5 +5,6 @@ @import './sidebarview/index.scss'; @import './bdsettings/index.scss'; @import './generic/index.scss'; +@import './profilebadges.scss'; @import './discordoverrides.scss'; diff --git a/client/src/styles/partials/profilebadges.scss b/client/src/styles/partials/profilebadges.scss new file mode 100644 index 00000000..9af642ed --- /dev/null +++ b/client/src/styles/partials/profilebadges.scss @@ -0,0 +1,30 @@ +.bd-profile-badges-wrap { + display: flex; + margin-top: 8px; + flex: 1 1 auto; +} + +.bd-profile-badges { + display: flex; +} + +.bd-profile-badge { + background-position: 50%; + background-repeat: no-repeat; + background-size: cover; + cursor: pointer; + height: 16px; + margin-right: 6px; +} + +.bd-profile-badge-developer, +.bd-profile-badge-contributor { + background-image: $logoSmallBw; + width: 16px; + filter: brightness(10); + + .theme-light [class*="topSectionNormal-"] & { + background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FscXVlXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjAwMCAyMDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAyMDAwIDIwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwYXRoIGZpbGw9IiMzRTgyRTUiIGQ9Ik0xNDAyLjIsNjMxLjdjLTkuNy0zNTMuNC0yODYuMi00OTYtNjQyLjYtNDk2SDY4LjR2NzE0LjFsNDQyLDM5OFY0OTAuN2gyNTdjMjc0LjUsMCwyNzQuNSwzNDQuOSwwLDM0NC45SDU5Ny42djMyOS41aDE2OS44YzI3NC41LDAsMjc0LjUsMzQ0LjgsMCwzNDQuOGgtNjk5djM1NC45aDY5MS4yYzM1Ni4zLDAsNjMyLjgtMTQyLjYsNjQyLjYtNDk2YzAtMTYyLjYtNDQuNS0yODQuMS0xMjIuOS0zNjguNkMxMzU3LjcsOTE1LjgsMTQwMi4yLDc5NC4zLDE0MDIuMiw2MzEuN3oiLz48cGF0aCBmaWxsPSIjYmJiYmJiIiBkPSJNMTI2Mi41LDEzNS4yTDEyNjIuNSwxMzUuMmwtNzYuOCwwYzI2LjYsMTMuMyw1MS43LDI4LjEsNzUsNDQuM2M3MC43LDQ5LjEsMTI2LjEsMTExLjUsMTY0LjYsMTg1LjNjMzkuOSw3Ni42LDYxLjUsMTY1LjYsNjQuMywyNjQuNmwwLDEuMnYxLjJjMCwxNDEuMSwwLDU5Ni4xLDAsNzM3LjF2MS4ybDAsMS4yYy0yLjcsOTktMjQuMywxODgtNjQuMywyNjQuNmMtMzguNSw3My44LTkzLjgsMTM2LjItMTY0LjYsMTg1LjNjLTIyLjYsMTUuNy00Ni45LDMwLjEtNzIuNiw0My4xaDcyLjVjMzQ2LjIsMS45LDY3MS0xNzEuMiw2NzEtNTY3LjlWNzE2LjdDMTkzMy41LDMxMi4yLDE2MDguNywxMzUuMiwxMjYyLjUsMTM1LjJ6Ii8+PC9nPjwvc3ZnPg=='); + filter: none; + } +} diff --git a/client/src/ui/bdui.js b/client/src/ui/bdui.js index 48d5a690..8cbd57e0 100644 --- a/client/src/ui/bdui.js +++ b/client/src/ui/bdui.js @@ -9,19 +9,35 @@ */ import Dom from './dom'; -import Vue from 'vue'; +import Vue from './vue'; import VTooltip from 'v-tooltip'; import { BdSettingsWrapper } from './components'; +import { Events, WebpackModules } from 'modules'; +import { Utils } from 'common'; export default class { + + static initUiEvents() { + //this.profilePopupModule.open + const defer = setInterval(() => { + if (!this.profilePopupModule) return; + clearInterval(defer); + this.profilePopupModule.open = Utils.overload(this.profilePopupModule.open, userid => { + Events.emit('ui-event', { + event: 'profile-popup-open', + data: { userid } + }); + }); + }, 100); + + } + + static get profilePopupModule() { + return WebpackModules.getModuleByProps(['fetchMutualFriends', 'setSection']); + } + static injectUi() { - Vue.use(VTooltip, { - defaultContainer: 'bdtooltips', - defaultClass: 'bd-tooltip', - defaultTargetClass: 'bd-has-tooltip', - defaultInnerSelector: '.bd-tooltip-inner', - defaultTemplate: '