From 088713a5557d86957870625a7fdc0d236c833374 Mon Sep 17 00:00:00 2001 From: Mario Date: Thu, 24 Jun 2021 08:15:44 +0000 Subject: Notification.requestPermission() only fires if wraped in click handler --- view/tpl/chat.tpl | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'view/tpl') diff --git a/view/tpl/chat.tpl b/view/tpl/chat.tpl index 7ef957b7e..2f224b3cf 100644 --- a/view/tpl/chat.tpl +++ b/view/tpl/chat.tpl @@ -110,7 +110,9 @@ $(document).ready(function() { $('#chatroom_bookmarks, #vcard').hide(); $('#chatroom_list, #chatroom_members').show(); adjustInlineTopBarHeight(); - chatNotificationInit(); + $('#toggle-notifications').one('click', function() { + chatNotificationInit(); + }); }); $(window).resize(function () { @@ -141,7 +143,7 @@ function load_chats() { $('#chat-top-spinner').hide(); } }); - + chat_timer = setTimeout(load_chats,10000); } @@ -218,7 +220,7 @@ var chat_notify_audio = {}; // Request notification access from the user // TODO: Check Hubzilla member config setting before requesting permission function chatNotificationInit() { - + if (!("Notification" in window)) { window.console.log("This browser does not support system notifications"); } @@ -258,8 +260,8 @@ var chat_issue_notification = function (theBody,theTitle) { } var n = new Notification(theTitle,options); n.onclick = function (event) { - setTimeout(n.close.bind(n), 300); - } + setTimeout(n.close.bind(n), 300); + } if(chat_notify_audio_enabled) { chat_notify_audio.play(); } -- cgit v1.2.3