ui: allow disabling notifications globally
This commit is contained in:
parent
30ee07c52b
commit
abf943da5f
9 changed files with 34 additions and 1 deletions
|
|
@ -211,6 +211,13 @@ var menuEntries = [
|
|||
if (fullscreen.isEnabled) fullscreen.toggle()
|
||||
},
|
||||
shortcut: 'f11'
|
||||
},
|
||||
{
|
||||
label: locales('notifications'),
|
||||
class: ()=>{return 'toggle ' + (notifications.visible ? 'on' : 'off')},
|
||||
action: ()=>{
|
||||
notifications.setVisibility(!notifications.visible)
|
||||
}
|
||||
}
|
||||
|
||||
]
|
||||
|
|
|
|||
|
|
@ -63,6 +63,9 @@ class Notifications extends UiWidget {
|
|||
this.toasts = []
|
||||
|
||||
this.loop = null
|
||||
this.visible = undefined
|
||||
|
||||
this.setVisibility(ENV.notifications != 0)
|
||||
|
||||
this.container.addEventListener('fast-click', (e)=>{
|
||||
for (var toast of this.toasts) {
|
||||
|
|
@ -124,6 +127,13 @@ class Notifications extends UiWidget {
|
|||
}
|
||||
|
||||
|
||||
setVisibility(v) {
|
||||
|
||||
this.visible = v
|
||||
this.container.style.display = v ? '' : 'none'
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = new Notifications({selector: '#notifications'})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue