From 3582befdcd779e674855e58d63b06711ef6989bf Mon Sep 17 00:00:00 2001 From: AUTOMATIC <16777216c@gmail.com> Date: Thu, 22 Sep 2022 13:15:33 +0300 Subject: move Notification.requestPermission() entirely to javascript to possibly fix problem with secure context people are having on non-localhost --- javascript/notification.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'javascript/notification.js') 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; -- cgit v1.2.3