asdkjlfhlaskjdhf
This commit is contained in:
@@ -1,7 +1,3 @@
|
||||
// Simple notification helpers for the chat client.
|
||||
|
||||
const APP_NAME = "COMS";
|
||||
|
||||
function supportsNotifications() {
|
||||
return typeof Notification !== "undefined";
|
||||
}
|
||||
@@ -12,9 +8,6 @@ function stripHtml(input) {
|
||||
return div.textContent || div.innerText || "";
|
||||
}
|
||||
|
||||
/**
|
||||
* Ask for permission if not already granted/denied.
|
||||
*/
|
||||
function primeNotifications() {
|
||||
if (!supportsNotifications()) return;
|
||||
if (Notification.permission === "default") {
|
||||
@@ -34,14 +27,10 @@ function showNotification(title, body) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Notify the user of a system notice.
|
||||
* @param {string} content - HTML or text content of the notice.
|
||||
*/
|
||||
function notifyNotice(content) {
|
||||
const text = stripHtml(content);
|
||||
if (!text) return;
|
||||
showNotification(`${APP_NAME} notice`, text);
|
||||
showNotification(`COMS`, text);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -53,7 +42,7 @@ function notifyDirectReply(authorName, content) {
|
||||
const text = stripHtml(content);
|
||||
if (!text) return;
|
||||
const name = authorName || "Anon";
|
||||
showNotification(`${name} replied to your thread`, text);
|
||||
showNotification(`${name} replied`, text);
|
||||
}
|
||||
|
||||
export { primeNotifications, notifyNotice, notifyDirectReply };
|
||||
|
||||
Reference in New Issue
Block a user