blob: 5c9fc5dbc40ab9874c30bdd091fa729b300ac645 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
document.getElementById("startbtn").addEventListener("click", () => {
start();
});
const urlParams = new URLSearchParams(window.location.search);
data.machine_id = urlParams.get('machine');
console.log(urlParams);
startUpdateMachines();
const notbtn = document.getElementById("notbtn");
const startbtn = document.getElementById("startbtn");
notbtn.addEventListener("click", () => requestPermission())
async function requestPermission() {
console.log("Requesting permission...");
const onesignal_result = await OneSignal.Notifications.requestPermission();
if (onesignal_result) {
notif.remove();
startbtn.disabled = false;
}
}
const notif = document.getElementById("notif-panel");
if (OneSignal.Notifications.permission) {
notif.remove();
startbtn.disabled = false;
}
|