From 9f814bb89bff8ab7066a23fdcdbb5b2ff4ddd080 Mon Sep 17 00:00:00 2001 From: Miodec Date: Wed, 27 Jan 2021 18:42:12 +0000 Subject: [PATCH] clearing all notifications on shift --- src/js/notification-center.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/src/js/notification-center.js b/src/js/notification-center.js index c0f3be1fe..e2aa5b9e6 100644 --- a/src/js/notification-center.js +++ b/src/js/notification-center.js @@ -16,6 +16,7 @@ class Notification { this.customTitle = customTitle; this.customIcon = customIcon; this.id = id++; + return this; } //level //0 - notice @@ -88,7 +89,13 @@ class Notification { } ); $(`#notificationCenter .notif[id='${this.id}']`).click((e) => { - this.hide(); + if (e.shiftKey) { + notificationHistory.forEach((n) => { + n.hide(); + }); + } else { + this.hide(); + } }); } ); @@ -125,7 +132,7 @@ class Notification { } export function add(message, level, duration, customTitle, customIcon) { - notificationHistory.push( - new Notification(message, level, duration, customTitle, customIcon).show() - ); + let not = new Notification(message, level, duration, customTitle, customIcon); + not.show(); + notificationHistory.push(not); }