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