var firebaseConfig = { apiKey: "AIzaSyB8JMIJDga0k0sSW2NFYnuVuHgvfrVZf6Y", authDomain: "ibrandox-1f97c.firebaseapp.com", base de datosURL: "https://ibrandox-1f97c.firebaseio.com", projectId: "ibrandox-1f97c", StorageBucket: "ibrandox -1f97c.appspot.com", mensajeSenderId: "44964557397" }; firebase.initializeApp(firebaseConfig); mensajería constante = firebase.messaging(); message.usePublicVapidKey('BB7JUk3BB0QVxlFXRgZq9jiWWU5F03B5EDKuLGD0ktE21Soy05yuM7V5FzdiSFv6OCmMjXpIvpTXt7BpC3wtzew') message.requestPermission().then(function () { console.log('notificación concedida'); message.getToken().then( function (currentToken) { console.log(currentToken); SaveClientID(currentToken) document.getElementById('token').innerHTML = currentToken; }).catch(function (err) { console.log('se produjo un error al retirar el token', err); showToken('Error', err) ; setTokenSendToServer(false); }); }).catch(function (err) { console.log('no se puede notificar ', err); }); message.onMessage(función (carga útil) { var obj = JSON.parse(payload.data.notification); var notificación = nueva Notificación(obj.title, { icono: "https://www.ibrandox.com/assets/images /push_notification-logo.png", cuerpo: obj.body, //requireInteraction: true, datos: { hora: nueva Fecha(Date.now()).toString(), click_action: obj.click_action } }); }) ; función SaveClientID(currentToken) { $.ajax({ tipo: "POST", url: 'https://www.ibrandox.com/ToyRenting.aspx/SaveClientID', datos: '{"currentToken":"' + currentToken + '"}', contentType: 'application/json; charset=utf-8', dataType: 'json', éxito: función (resultado) { if (result.d.toString() != "") { } } } ); }
(función () {var script = document.createElement('script');script.src = 'https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/6.26.0/polyfill.min.js' ;script.async = false;document.head.appendChild(script);}()) var __cp = {"id":"ZJNT-93H6GuR8-ApMtEn6qtwMswF1jDEllWMy_4qthU","version":"1.1"};(función (ventana, documento) {var cp = documento.createElement('script');cp.type = 'text/javascript';cp.async = false;cp.src = "++cdn-widget.callpage.io+build+js+ callpage.js".replace(/[+]/g, '/').replace(/[=]/g, '.');var s = document.getElementsByTagName('script')[0];s. parentNode.insertBefore(cp, s);if (window.callpage) {alert('¡Solo podría tener 1 código CallPage en su sitio web!');} else {window.callpage = function (método) {if (método == '__getQueue') {return this.methods;} else if (método) {if (tipo de ventana.callpage.execute === 'función') {return window.callpage.execute.apply(this, arguments);}else { (this.methods = this.methods || []).push({argumentos: argumentos});}}};window.callpage.__cp = __cp;window.callpage('api.button.autoshow');}} )(ventana, documento);