1firebase.initializeApp({messagingSenderId:'526660367536'});if('serviceWorker'in navigator&&'PushManager'in window){var messaging=firebase.messaging();messaging.onMessage(function(payload){console.log('Message received. ',payload);navigator.serviceWorker.register('/firebase-messaging-sw.js');navigator.serviceWorker.ready.then(function(registration){payload.notification.data=payload.notification;registration.showNotification(payload.notification.title,payload.notification);}).catch(function(error){console.log('ServiceWorker registration failed',error);});});subscribe();} 2function subscribe(){messaging.requestPermission().then(function(){messaging.getToken().then(function(currentToken){if(currentToken){sendTokenToServer(currentToken);}else{setTokenSentToServer(false);}}).catch(function(err){console.log(err);setTokenSentToServer(false);});}).catch(function(err){console.log(err);});} 3function sendTokenToServer(currentToken){if(!isTokenSentToServer(currentToken)){var currentSite=new URL(document.location.href);var url='/js/suscribe.php';var method="POST";var params=['token='+currentToken,'project='+currentSite.host];if(window.XDomainRequest){var http=new XDomainRequest();if(http){http.open(method,url);http.onload=function(){console.log(http.responseText);};setTimeout(function(){http.send('POST'===method?params.join('&'):'');},0);}}else if(window.XMLHttpRequest){var http=new XMLHttpRequest();if(http&&'withCredentials'in http){http.open(method,url,true);if('POST'===method){http.setRequestHeader('Content-type','application/x-www-form-urlencoded');} 4http.onreadystatechange=function(){if(http.readyState===4&&http.status===200){console.log(http.responseText);}} 5http.send('POST'===method?params.join('&'):'');}} 6setTokenSentToServer(currentToken);}} 7function isTokenSentToServer(currentToken){return window.localStorage.getItem('sentFirebaseMessagingToken')==currentToken;} 8function setTokenSentToServer(currentToken){window.localStorage.setItem('sentFirebaseMessagingToken',currentToken?currentToken:'');}
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.