diff options
Diffstat (limited to 'frontend/permissionrequest.js')
| -rw-r--r-- | frontend/permissionrequest.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/frontend/permissionrequest.js b/frontend/permissionrequest.js new file mode 100644 index 0000000..1a90109 --- /dev/null +++ b/frontend/permissionrequest.js @@ -0,0 +1,25 @@ +const notif = document.getElementById("notif-panel"); +const notbtn = document.getElementById("notbtn"); + +(async function () { + cookie = await cookieStore.get("subscription_endpoint"); + if (cookie) { + notif.style.display = "none"; + } +})(); + +notbtn.addEventListener("click", () => requestPermission()); +async function requestPermission() { + const sub_result = await subscribe(); + + if (!sub_result) { + return; + } + + notif.style.display = "none"; + + // this is disgusting + if (typeof startbtn !== 'undefined') { + startbtn.disabled = false; + } +} |
