From 647c0618ce307b06d744ce9e13936fd03b688c16 Mon Sep 17 00:00:00 2001 From: 8chan Date: Sat, 14 Mar 2015 00:03:54 -0700 Subject: [PATCH] Fix Notification.requestPermission on first run --- js/auto-reload.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/auto-reload.js b/js/auto-reload.js index 528dd68d..fd78181e 100644 --- a/js/auto-reload.js +++ b/js/auto-reload.js @@ -58,7 +58,11 @@ $(document).ready(function(){ var setting = $(this).parent().attr('id'); if ($(this).is(':checked')) { - Notification.requestPermission(); + Notification.requestPermission(function(permission){ + if (permission === "granted") { + localStorage[setting] = 'true'; + } + }); if (Notification.permission === "granted") { localStorage[setting] = 'true'; }