Seditio Source
Root |
./othercms/xenForo 2.2.8/js/xf/service_worker.min.js
'use strict';self.addEventListener("push",function(d){if(self.Notification&&"granted"===self.Notification.permission){try{var a=d.data.json()}catch(b){console.warn("Received push notification but payload not in the expected format.",b);console.warn("Received data:",d.data.text());return}if(a&&a.title&&a.body){a.last_count=0;var c={body:a.body,dir:a.dir||"ltr",data:a};a.badge&&(c.badge=a.badge);a.icon&&(c.icon=a.icon);if(a.tag&&a.tag_phrase){c.tag=a.tag;c.renotify=!0;var e=self.registration.getNotifications({tag:a.tag}).then(function(b){if(b=
b[b.length-1])b=parseInt(b.data.last_count,10)+1,c.data.last_count=b,c.body=c.body+" "+a.tag_phrase.replace("{count}",b.toString());return self.registration.showNotification(a.title,c)})}else e=self.registration.showNotification(a.title,c);d.waitUntil(e)}else console.warn("Received push notification but no payload data or required fields missing.",a)}});self.addEventListener("notificationclick",function(d){var a=d.notification;a.close();a.data.url&&d.waitUntil(clients.openWindow(a.data.url))});