1 var firebaseConfig = { 2 apiKey: "AIzaSyAGX6JmmxLd6Tl01E5Z5DEG5bk9ak8iT-U", 3 authDomain: "nadlancenter-b34d2.firebaseapp.com", 4 projectId: "nadlancenter-b34d2", 5 storageBucket: "nadlancenter-b34d2.appspot.com", 6 messagingSenderId: "823780630015", 7 appId: "1:823780630015:web:7e51bc95ecc97585321bca", 8 measurementId: "G-F0B23HGDDY" 9}; 10 firebase.initializeApp(firebaseConfig); 11 12 // Get the messaging instance 13 var messaging = firebase.messaging(); 14 15 // Request permission to show notifications 16 17 messaging.requestPermission().then(function () { 18 // Get the device token 19 messaging.getToken() 20 .then(function (token) { 21 22 if (!localStorage.getItem("push_token") || localStorage.getItem("push_token") != token) 23 { 24 localStorage.setItem("push_token", token); 25 window.api_call({ url: "save_push_token", data: { token: token} }); 26 } 27 28 29 }).catch(function () { }); 30 }) 31 .catch(function () { 32 if (localStorage.getItem("push_token") && localStorage.getItem("push_token") != "") 33 { 34 var tok = localStorage.getItem("push_token"); 35 localStorage.removeItem("push_token"); 36 window.api_call({ url: "delete_push_token", data: { token: tok} }); 37 38 } 39 }); 40 41 42if ('serviceWorker' in navigator) { 43 navigator.serviceWorker.register('firebase-messaging-sw.js') 44 .then(function(registration) { 45 console.log('Service Worker registered with scope:', registration.scope); 46 }) 47 .catch(function(error) { 48 console.error('Failed to register Service Worker:', error); 49 }); 50} 51navigator.serviceWorker.addEventListener('message', function(event) { 52 if(event && event.data && event.data.firebaseMessaging && event.data.firebaseMessaging.payload && event.data.firebaseMessaging.payload.notification && event.data.firebaseMessaging.payload.notification.click_action) 53 { 54 document.location = event.data.firebaseMessaging.payload.notification.click_action; 55 } 56}); 57 58 59 60 61 62 63
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.