1importScripts('/project_data/firebase-config.js'); 2importScripts('/project_data/vars.js'); 3importScripts('/js/firebase/firebase-app.js'); 4importScripts('/js/firebase/firebase-messaging.js'); 5importScripts('/js/sw/analytics.js'); 6 7self.analytics.trackingId = trackingId; 8 9firebase.initializeApp(firebaseConfig); 10const messaging = firebase.messaging(); 11 12messaging.setBackgroundMessageHandler(function(payload) { 13 console.log('[firebase-messaging-sw.js] Received background message ', payload); 14 15 const notificationTitle = payload['title']; 16 const notificationOptions = { 17 body: payload['body'], 18 image: payload['image'], 19 icon: payload['icon'] 20 }; 21 22 return self.registration.showNotification(notificationTitle, 23 notificationOptions); 24}); 25 26self.addEventListener('push', function(event) { 27 console.log('%c%s', 'color: green; font-weight:700;', "push", event); 28 29 const data = event.data.json(); 30 31 console.log( "push::PushMessageData: ", event.data.text() ); 32 33 let url = 'url unknown'; 34 let articleId = 'article_id_unknown'; 35 let projectName = idsite; 36 if (data.hasOwnProperty('notification') && data.notification.hasOwnProperty('click_action')) { 37 url = data.notification.click_action; 38 let match = url.match(/(\d{6,})/g); 39 if (match && match[1]) { 40 articleId = match[1]; 41 } 42 } 43 event.waitUntil( 44 self.analytics.trackEvent('Pushes showed', url) 45 ); 46 fetch(`https://a.sputniknews.com/ping?idsite=${projectName}&url=${url}&_id=&_idts=&localtime=&h_id=&r=&events[0][ectgry]=webpush&events[0][srcaid]=${articleId}&events[0][etype]=show`); 47});
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.