1// Firebase Messaging Service Worker 2self.addEventListener("push", (event) => { 3 try { 4 const data = event.data.json(); 5 if ( 6 !data.notification || 7 !data.notification.title || 8 !data.notification.body 9 ) { 10 return; 11 } 12 13 fetch("https://www.matchendirect.fr/cgi/ajax/pn_click.php", { 14 method: "POST", 15 headers: { "Content-Type": "application/json" }, 16 body: JSON.stringify({ 17 title: data.notification.title || "", 18 body: data.notification.body || "", 19 url_match: data.notification.click_action || "https://www.matchendirect.fr", 20 id_match: data.data.id_match || 0, 21 type: "send", 22 }), 23 }); 24 25 const notificationOptions = { 26 body: data.notification.body, 27 icon: data.notification.image || "/android-chrome-192x192.png", 28 data: { 29 title: data.notification.title || "", 30 body: data.notification.body || "", 31 url: data.notification.click_action || "https://www.matchendirect.fr", 32 id_match: data.data.id_match || 0, 33 type: "send" 34 }, 35 }; 36 37 event.waitUntil( 38 self.registration.showNotification( 39 data.notification.title, 40 notificationOptions 41 ) 42 ); 43 } catch (error) { 44 console.error("Push Notification Error:", error); 45 } 46}); 47 48self.addEventListener("notificationclick", (event) => { 49 try { 50 const url = event.notification.data.url; 51 52 const logClick = fetch( 53 "https://www.matchendirect.fr/cgi/ajax/pn_click.php", 54 { 55 method: "POST", 56 headers: { "Content-Type": "application/json" }, 57 body: JSON.stringify({ 58 title: event.notification.data.title || "", 59 body: event.notification.data.body || "", 60 url_match: url || "", 61 id_match: event.notification.data.id_match || 0, 62 type: "click" 63 }), 64 } 65 ); 66 67 event.waitUntil( 68 Promise.all([ 69 clients.matchAll({ type: "window" }).then((clientList) => { 70 for (const client of clientList) { 71 if (client.url === url && "focus" in client) return client.focus(); 72 } 73 return clients.openWindow(url); 74 }), 75 logClick, 76 ]) 77 ); 78 } catch (error) { 79 console.error("Push Notification Click Error:", error); 80 } 81}); 82 83self.addEventListener("install", function (event) { 84 console.log("med service worker installed"); 85}); 86 87self.addEventListener("activate", function (event) { 88 console.log("med service worker activated"); 89}); 90 91self.addEventListener("fetch", function (event) {}); 92 93self.addEventListener("message", (event) => { 94 if (event.data && event.data.type === "SKIP_WAITING") { 95 self.skipWaiting(); 96 } 97});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.