This commit is contained in:
Booteille 2024-10-31 16:27:53 +01:00
parent 14f1267c5a
commit 460d689c4c
No known key found for this signature in database
GPG Key ID: 0AB6C6CA01272646
1 changed files with 22 additions and 20 deletions

View File

@ -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();
}
});