commit
3c38ecdd97
|
@ -8,13 +8,14 @@
|
|||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import { DOM, BdUI, BdMenu, Modals, Reflection, Toasts } from 'ui';
|
||||
import { DOM, BdUI, BdMenu, Modals, Reflection, Toasts, Notifications } from 'ui';
|
||||
import BdCss from './styles/index.scss';
|
||||
import { Events, CssEditor, Globals, Settings, Database, Updater, ModuleManager, PluginManager, ThemeManager, ExtModuleManager, Vendor, WebpackModules, Patcher, MonkeyPatch, ReactComponents, ReactHelpers, ReactAutoPatcher, DiscordApi, BdWebApi, Connectivity, Cache } from 'modules';
|
||||
import { ClientLogger as Logger, ClientIPC, Utils } from 'common';
|
||||
import { BuiltinManager, EmoteModule, ReactDevtoolsModule, VueDevtoolsModule, TrackingProtection, E2EE } from 'builtin';
|
||||
import electron from 'electron';
|
||||
import path from 'path';
|
||||
import { setTimeout } from 'timers';
|
||||
|
||||
const tests = typeof PRODUCTION === 'undefined';
|
||||
const ignoreExternal = false;
|
||||
|
@ -27,7 +28,7 @@ class BetterDiscord {
|
|||
Logger.log('main', 'BetterDiscord starting');
|
||||
|
||||
this._bd = {
|
||||
DOM, BdUI, BdMenu, Modals, Reflection, Toasts,
|
||||
DOM, BdUI, BdMenu, Modals, Reflection, Toasts, Notifications,
|
||||
|
||||
Events, CssEditor, Globals, Settings, Database, Updater,
|
||||
ModuleManager, PluginManager, ThemeManager, ExtModuleManager,
|
||||
|
@ -90,6 +91,23 @@ class BetterDiscord {
|
|||
Events.emit('ready');
|
||||
Events.emit('discord-ready');
|
||||
BuiltinManager.initAll();
|
||||
|
||||
function showDummyNotif() { // eslint-disable-line no-inner-declarations
|
||||
Notifications.add('Dummy Notification', [
|
||||
{
|
||||
text: 'Show Again', onClick: function () {
|
||||
setTimeout(showDummyNotif, 5000);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
{
|
||||
text: 'Ignore', onClick: function () {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
]);
|
||||
}
|
||||
showDummyNotif();
|
||||
} catch (err) {
|
||||
Logger.err('main', ['FAILED TO LOAD!', err]);
|
||||
}
|
||||
|
|
|
@ -40,12 +40,10 @@
|
|||
.bd-profileBadgeDeveloper,
|
||||
.bd-profileBadgeWebdev,
|
||||
.bd-profileBadgeContributor {
|
||||
background-image: $logoSmallBw;
|
||||
filter: brightness(10);
|
||||
background-image: $logoSmallWw;
|
||||
|
||||
.theme-light [class*='topSectionNormal-'] .bd-profileBadgesProfileModal > &, // sass-lint:disable-line force-element-nesting class-name-format
|
||||
.theme-light :not(.bd-profileBadgesProfileModal) > & { // sass-lint:disable-line class-name-format
|
||||
background-image: $logoSmallLight;
|
||||
filter: none;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,3 +12,4 @@
|
|||
@import './layouts';
|
||||
@import './toasts';
|
||||
@import './badges';
|
||||
@import './notifications';
|
||||
|
|
|
@ -0,0 +1,115 @@
|
|||
.bd-notifications {
|
||||
position: absolute;
|
||||
right: -300px;
|
||||
bottom: 50px;
|
||||
z-index: 900000;
|
||||
|
||||
.bd-notificationContainer {
|
||||
position: relative;
|
||||
background: #202225;
|
||||
width: 280px;
|
||||
height: 130px;
|
||||
top: 30px;
|
||||
border-radius: 5px;
|
||||
box-shadow: 0 0 20px #202225;
|
||||
|
||||
.bd-notificationHeader {
|
||||
height: 10px;
|
||||
justify-content: flex-end;
|
||||
|
||||
.bd-notificationDismissBtn {
|
||||
cursor: pointer;
|
||||
opacity: 0;
|
||||
transform: scaleX(-1);
|
||||
margin: 8px;
|
||||
|
||||
&:hover {
|
||||
opacity: 1;
|
||||
background: rgba(0, 0, 0, .1);
|
||||
|
||||
.bd-materialDesignIcon {
|
||||
fill: #fff;
|
||||
}
|
||||
}
|
||||
|
||||
.bd-materialDesignIcon {
|
||||
fill: #aeaeae;
|
||||
display: flex;
|
||||
height: 20px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.bd-notificationDismissBtn {
|
||||
opacity: 1;
|
||||
}
|
||||
}
|
||||
|
||||
.bd-notificationBody {
|
||||
padding: 10px 25px;
|
||||
flex-grow: 1;
|
||||
|
||||
.bd-notificationText {
|
||||
color: #fff;
|
||||
font-size: 12px;
|
||||
}
|
||||
}
|
||||
|
||||
&.bd-active {
|
||||
animation: bd-notif-slidein 1s forwards;
|
||||
}
|
||||
|
||||
&.bd-closing {
|
||||
animation: bd-notif-slideout .5s;
|
||||
}
|
||||
}
|
||||
|
||||
.bd-notificationFooter {
|
||||
height: 20px;
|
||||
padding: 5px;
|
||||
justify-content: flex-end;
|
||||
|
||||
.bd-notificationBtn {
|
||||
cursor: pointer;
|
||||
height: 10px;
|
||||
line-height: 10px;
|
||||
font-size: 14px;
|
||||
font-weight: 500;
|
||||
color: #aeaeae;
|
||||
padding: 5px 10px;
|
||||
border-radius: 3px;
|
||||
background: rgba(0, 0, 0, .2);
|
||||
margin-left: 5px;
|
||||
|
||||
&:hover {
|
||||
background: rgba(0, 0, 0, .3);
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes bd-notif-slidein {
|
||||
0% {
|
||||
transform: translatex(0);
|
||||
}
|
||||
|
||||
50% {
|
||||
transform: translatex(-325px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translatex(-315px);
|
||||
}
|
||||
}
|
||||
|
||||
@keyframes bd-notif-slideout {
|
||||
0% {
|
||||
transform: translatex(-315px);
|
||||
}
|
||||
|
||||
100% {
|
||||
transform: translatex(0);
|
||||
}
|
||||
}
|
|
@ -2,6 +2,7 @@
|
|||
$logoSmallGw: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48c3ZnIHZlcnNpb249IjEuMSIgaWQ9IkltYWdlIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIiB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QuNmMtMzguNSw3My44LTkzLjgsMTM2LjItMTY0LjYsMTg1LjNjLTIyLjYsMTUuNy00Ni45LDMwLjEtNzIuNiw0My4xaDcyLjVjMzQ2LjIsMS45LDY3MS0xNzEuMiw2NzEtNTY3LjlWNzE2LjdDMTkzMy41LDMxMi4yLDE2MDguNywxMzUuMiwxMjYyLjUsMTM1LjJ6Ii8+PC9nPjwvc3ZnPg==');
|
||||
|
|
|
@ -12,7 +12,7 @@ import { Events, DiscordApi, Settings } from 'modules';
|
|||
import { remote } from 'electron';
|
||||
import DOM from './dom';
|
||||
import Vue from './vue';
|
||||
import { BdSettingsWrapper, BdModals, BdToasts } from './components';
|
||||
import { BdSettingsWrapper, BdModals, BdToasts, BdNotifications } from './components';
|
||||
|
||||
export default class {
|
||||
|
||||
|
@ -52,6 +52,7 @@ export default class {
|
|||
DOM.createElement('div', null, 'bd-settings').appendTo(DOM.bdBody);
|
||||
DOM.createElement('div', null, 'bd-modals').appendTo(DOM.bdModals);
|
||||
DOM.createElement('div', null, 'bd-toasts').appendTo(DOM.bdToasts);
|
||||
DOM.createElement('div', null, 'bd-notifications').appendTo(DOM.bdNotifications);
|
||||
DOM.createElement('bd-tooltips').appendTo(DOM.bdBody);
|
||||
|
||||
this.toasts = new (Vue.extend(BdToasts))({
|
||||
|
@ -66,6 +67,10 @@ export default class {
|
|||
el: '#bd-settings'
|
||||
});
|
||||
|
||||
this.notifications = new (Vue.extend(BdNotifications))({
|
||||
el: '#bd-notifications'
|
||||
});
|
||||
|
||||
return this.vueInstance;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
/**
|
||||
* BetterDiscord Notifications Component
|
||||
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
<template>
|
||||
<div class="bd-notifications">
|
||||
<div v-if="notifications.length" class="bd-notificationContainer bd-flex bd-flexCol bd-active" :class="{'bd-closing': dismissing}">
|
||||
<div class="bd-notificationHeader bd-flex">
|
||||
<div @click="this.dismissFirst" class="bd-notificationDismissBtn"><MiArrowLeft size="20"/></div>
|
||||
</div>
|
||||
<div class="bd-notificationBody bd-flex">
|
||||
<div class="bd-notificationText">{{notifications[0].text}}</div>
|
||||
</div>
|
||||
<div class="bd-notificationFooter bd-flex">
|
||||
<div class="bd-notificationBtn" v-for="(btn, index) in notifications[0].buttons" @click="() => buttonHandler(index)">
|
||||
{{btn.text}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
// Imports
|
||||
import { Notifications } from 'ui';
|
||||
import { MiArrowLeft } from './common';
|
||||
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
notifications: Notifications.stack,
|
||||
dismissing: false
|
||||
};
|
||||
},
|
||||
components: { MiArrowLeft },
|
||||
methods: {
|
||||
dismissFirst() {
|
||||
if (this.dismissing) return;
|
||||
this.dismissing = true;
|
||||
setTimeout(() => {
|
||||
Notifications.dismiss(0);
|
||||
this.dismissing = false;
|
||||
}, 500);
|
||||
},
|
||||
buttonHandler(index) {
|
||||
if (!this.notifications[0].buttons[index].onClick) return;
|
||||
if (this.notifications[0].buttons[index].onClick()) {
|
||||
this.dismissing = true;
|
||||
setTimeout(() => {
|
||||
Notifications.dismiss(0);
|
||||
this.dismissing = false;
|
||||
}, 500);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
|
@ -20,3 +20,4 @@ export { default as MiSuccess } from './materialicons/Success.vue';
|
|||
export { default as AccountCircle } from './materialicons/AccountCircle.vue';
|
||||
export { default as MiLock } from './materialicons/Lock.vue';
|
||||
export { default as MiImagePlus } from './materialicons/ImagePlus.vue';
|
||||
export { default as MiArrowLeft } from './materialicons/ArrowLeft.vue';
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
/**
|
||||
* BetterDiscord Material Design Icon
|
||||
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* Material Design Icons
|
||||
* Copyright (c) 2014 Google
|
||||
* Apache 2.0 LICENSE
|
||||
* https://www.apache.org/licenses/LICENSE-2.0.txt
|
||||
*/
|
||||
|
||||
<template>
|
||||
<span class="bd-materialDesignIcon">
|
||||
<svg :width="size || 24" :height="size || 24" viewBox="0 0 24 24">
|
||||
<path stroke-linejoin="round" d="M 20,11L 20,13L 7.98958,13L 13.4948,18.5052L 12.0806,19.9194L 4.16116,12L 12.0806,4.08058L 13.4948,5.49479L 7.98958,11L 20,11 Z " />
|
||||
</svg>
|
||||
</span>
|
||||
</template>
|
||||
<script>
|
||||
export default {
|
||||
props: ['size']
|
||||
}
|
||||
</script>
|
|
@ -2,3 +2,4 @@ export { default as BdSettingsWrapper } from './BdSettingsWrapper.vue';
|
|||
export { default as BdSettings } from './BdSettings.vue';
|
||||
export { default as BdModals } from './BdModals.vue';
|
||||
export { default as BdToasts } from './BdToasts.vue';
|
||||
export { default as BdNotifications } from './BdNotifications.vue';
|
||||
|
|
|
@ -184,9 +184,8 @@ export default class DOM {
|
|||
static get bdThemes() { return this.getElement('bd-themes') || this.createElement('bd-themes').appendTo(this.bdHead) }
|
||||
static get bdTooltips() { return this.getElement('bd-tooltips') || this.createElement('bd-tooltips').appendTo(this.bdBody) }
|
||||
static get bdModals() { return this.getElement('bd-modals') || this.createElement('bd-modals').appendTo(this.bdBody) }
|
||||
static get bdToasts() {
|
||||
return this.getElement('bd-toasts') || this.createElement('bd-toasts').appendTo(this.bdBody);
|
||||
}
|
||||
static get bdToasts() { return this.getElement('bd-toasts') || this.createElement('bd-toasts').appendTo(this.bdBody) }
|
||||
static get bdNotifications() { return this.getElement('bd-notifications') || this.createElement('bd-notifications').appendTo(this.bdBody) }
|
||||
|
||||
static getElement(e) {
|
||||
if (e instanceof BdNode) return e.element;
|
||||
|
|
|
@ -0,0 +1,41 @@
|
|||
/*
|
||||
* BetterDiscord Notifications
|
||||
* Copyright (c) 2015-present Jiiks/JsSucks - https://github.com/Jiiks / https://github.com/JsSucks
|
||||
* All rights reserved.
|
||||
* https://betterdiscord.net
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
import { Events } from 'modules';
|
||||
|
||||
export default class Notifications {
|
||||
|
||||
/**
|
||||
* Add a new notification to the stack.
|
||||
* Notifications should only be used for important things.
|
||||
* @param {String} text
|
||||
* @param {Object} [buttons] buttons to show { text: 'Text for the button', onClick: fn() { return true if notification should be dismissed } }
|
||||
*/
|
||||
static add(text, buttons = []) {
|
||||
this.stack.push({ text, buttons });
|
||||
}
|
||||
|
||||
/**
|
||||
* Notifications currently in the stack.
|
||||
* @type {Object[]}
|
||||
*/
|
||||
static get stack() {
|
||||
return this._stack || (this._stack = []);
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss a notification at index.
|
||||
* @param {Number} index Index of the notification
|
||||
*/
|
||||
static dismiss(index) {
|
||||
this.stack.splice(index, 1);
|
||||
}
|
||||
|
||||
}
|
|
@ -3,6 +3,7 @@ export { default as BdUI } from './bdui';
|
|||
export { default as BdMenu, BdMenuItems } from './bdmenu';
|
||||
export { default as Modals } from './modals';
|
||||
export { default as Toasts } from './toasts';
|
||||
export { default as Notifications } from './notifications';
|
||||
|
||||
export { default as VueInjector } from './vueinjector';
|
||||
export { default as Reflection } from './reflection';
|
||||
|
|
|
@ -37,7 +37,7 @@ export default class Logger {
|
|||
level = Logger.parseLevel(level);
|
||||
|
||||
message = typeof message === 'object' && message instanceof Array ? message : [message];
|
||||
console[level]('[%cBetter%cDiscord:%s]', 'color: #3E82E5', '', `${module}${level === 'debug' ? '|DBG' : ''}`, ...message);
|
||||
console[level]('[%cBetter%cDiscord:%s]', 'color: #3ecc9c', '', `${module}${level === 'debug' ? '|DBG' : ''}`, ...message);
|
||||
|
||||
const message_string = message.map(m => typeof m === 'string' ? m : node_utils.inspect(m, {showProxy: true})).join(' ');
|
||||
this.logs.push(`${level.toUpperCase()} : [${Logger.timestamp}|${module}] ${message_string}`);
|
||||
|
|
|
@ -1 +1,2 @@
|
|||
$bdicon: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IURPQ1RZUEUgc3ZnIFBVQkxJQyAiLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4iICJodHRwOi8vd3d3LnczLm9yZy9HcmFwaGljcy9TVkcvMS4xL0RURC9zdmcxMS5kdGQiPjxzdmcgdmVyc2lvbj0iMS4xIiBpZD0iQ2FscXVlXzEiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIHg9IjBweCIgeT0iMHB4IiB2aWV3Qm94PSIwIDAgMjAwMCAyMDAwIiBlbmFibGUtYmFja2dyb3VuZD0ibmV3IDAgMCAyMDAwIDIwMDAiIHhtbDpzcGFjZT0icHJlc2VydmUiPjxnPjxwYXRoIGZpbGw9IiMzRTgyRTUiIGQ9Ik0xNDAyLjIsNjMxLjdjLTkuNy0zNTMuNC0yODYuMi00OTYtNjQyLjYtNDk2SDY4LjR2NzE0LjFsNDQyLDM5OFY0OTAuN2gyNTdjMjc0LjUsMCwyNzQuNSwzNDQuOSwwLDM0NC45SDU5Ny42djMyOS41aDE2OS44YzI3NC41LDAsMjc0LjUsMzQ0LjgsMCwzNDQuOGgtNjk5djM1NC45aDY5MS4yYzM1Ni4zLDAsNjMyLjgtMTQyLjYsNjQyLjYtNDk2YzAtMTYyLjYtNDQuNS0yODQuMS0xMjIu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