diff options
author | toasted-nutbread <toasted-nutbread@users.noreply.github.com> | 2022-05-20 18:08:20 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-20 18:08:20 -0400 |
commit | e498e2d029095e6f15417a3d7dfa693c497e54eb (patch) | |
tree | 9c3613e8b1ffb0be241bba9a53a03e5aabe41f8f /ext/js/display/display.js | |
parent | 31e20c889e467aa4ba64b0b5baf602adc1359371 (diff) |
Display notification updates (#2149)
* Expose container and node on DisplayNotification
* Add Display.createNotification
* Rename methods
* Rename fields
* Remove double newline
Diffstat (limited to 'ext/js/display/display.js')
-rw-r--r-- | ext/js/display/display.js | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/ext/js/display/display.js b/ext/js/display/display.js index aad54e1c..600df954 100644 --- a/ext/js/display/display.js +++ b/ext/js/display/display.js @@ -231,10 +231,6 @@ class Display extends EventDispatcher { return this._parentPopupId; } - get notificationContainer() { - return this._footerNotificationContainer; - } - get selectedIndex() { return this._index; } @@ -512,6 +508,19 @@ class Display extends EventDispatcher { return Number.isFinite(index) ? index : -1; } + /** + * Creates a new notification. + * @param {boolean} scannable Whether or not the notification should permit its content to be scanned. + * @returns {DisplayNotification} A new notification instance. + */ + createNotification(scannable) { + const node = this._displayGenerator.createEmptyFooterNotification(); + if (scannable) { + node.classList.add('click-scannable'); + } + return new DisplayNotification(this._footerNotificationContainer, node); + } + // Message handlers _onDirectMessage(data) { @@ -857,9 +866,7 @@ class Display extends EventDispatcher { if (tagNode === null) { return; } if (this._tagNotification === null) { - const node = this._displayGenerator.createEmptyFooterNotification(); - node.classList.add('click-scannable'); - this._tagNotification = new DisplayNotification(this._footerNotificationContainer, node); + this._tagNotification = this.createNotification(true); } const index = this.getElementDictionaryEntryIndex(tagNode); |