aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--javascript/notification.js12
-rw-r--r--modules/ui.py4
2 files changed, 14 insertions, 2 deletions
diff --git a/javascript/notification.js b/javascript/notification.js
index 4711c279..e8159a7e 100644
--- a/javascript/notification.js
+++ b/javascript/notification.js
@@ -2,7 +2,19 @@
let lastHeadImg = null;
+notificationButton = null
+
onUiUpdate(function(){
+ if(notificationButton == null){
+ notificationButton = gradioApp().getElementById('request_notifications')
+
+ if(notificationButton != null){
+ notificationButton.addEventListener('click', function (evt) {
+ Notification.requestPermission();
+ },true);
+ }
+ }
+
const galleryPreviews = gradioApp().querySelectorAll('img.h-full.w-full.overflow-hidden');
if (galleryPreviews == null) return;
diff --git a/modules/ui.py b/modules/ui.py
index ca611f8f..8925fbcb 100644
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -857,12 +857,12 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo):
outputs=[result]
)
- request_notifications = gr.Button(value='Request browser notifications')
+ request_notifications = gr.Button(value='Request browser notifications', elem_id="request_notifications")
request_notifications.click(
fn=lambda: None,
inputs=[],
outputs=[],
- _js='() => Notification.requestPermission()'
+ _js='function(){}'
)
interfaces = [