From 460d689c4c96e745ac72d97a435fc92c239e9161 Mon Sep 17 00:00:00 2001 From: Booteille Date: Thu, 31 Oct 2024 16:27:53 +0100 Subject: [PATCH] Cleanup --- .../default/public/js/lufi-notifications.js | 42 ++++++++++--------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/themes/default/public/js/lufi-notifications.js b/themes/default/public/js/lufi-notifications.js index a3616aa..16ea174 100644 --- a/themes/default/public/js/lufi-notifications.js +++ b/themes/default/public/js/lufi-notifications.js @@ -1,26 +1,28 @@ function notify(title, body) { - if (!'Notification' in window || typeof(Notification) === 'undefined') { - console.log(`This browser does not support desktop notification, cannot send following message: ${title} ${body}`); - return; - } + if (!"Notification" in window || typeof Notification === "undefined") { + console.log( + `This browser does not support desktop notification, cannot send following message: ${title} ${body}` + ); + return; + } - if (Notification.permission !== "granted") { - Notification.requestPermission(); - } else { - let options = { - body: body, - icon: '/img/lufi196.png' - }; - let n = new Notification(title, options); - } + if (Notification.permission !== "granted") { + Notification.requestPermission(); + } else { + let options = { + body: body, + icon: "/img/lufi196.png", + }; + new Notification(title, options); + } } -document.addEventListener('DOMContentLoaded', function () { - if (!'Notification' in window || typeof(Notification) === 'undefined') { - return; - } +document.addEventListener("DOMContentLoaded", function () { + if (!"Notification" in window || typeof Notification === "undefined") { + return; + } - if (Notification.permission !== "granted") { - Notification.requestPermission(); - } + if (Notification.permission !== "granted") { + Notification.requestPermission(); + } });