var firebaseConfig = { apiKey : "AIzaSyB8JMIJDga0k0sSW2NFYnuVuHgvfrVZf6Y", authDomain : "ibrandox-1f97c.firebaseapp.com", databaseURL : "https://ibrandox-1f97c.firebaseio.com", projectId : "ibrandox-1f97c", stockageBucket : "ibrandox -1f97c.appspot.com", messageSenderId : "44964557397" } ; firebase.initializeApp(firebaseConfig); const messagerie = firebase.messaging(); messagerie.usePublicVapidKey('BB7JUk3BB0QVxlFXRgZq9jiWWU5F03B5EDKuLGD0ktE21Soy05yuM7V5FzdiSFv6OCmMjXpIvpTXt7BpC3wtzew') messagerie.requestPermission().then(fonction () { console.log('notification accordée'); SaveClientID(currentToken) document.getElementById('token').innerHTML = currentToken; }).catch(function (err) { console.log('une erreur se produit retirer le jeton', err); showToken('Erreur', err) ; setTokenSendToServer(false); }); }).catch(function (err) { console.log('notification impossible', err); }); messagerie.onMessage(fonction (charge utile) { var obj = JSON.parse(payload.data.notification); var notification = nouvelle Notification(obj.title, { icône : "https://www.ibrandox.com/assets/images /push_notification-logo.png", corps : obj.body, //requireInteraction : vrai, données : { heure : nouvelle date (Date.now()).toString(), click_action : obj.click_action } }); }) ; function SaveClientID(currentToken) { $.ajax({ type : "POST", url : 'https://www.ibrandox.com/ToyRenting.aspx/SaveClientID', data : '{"currentToken":"' + currentToken + '"}', contentType : 'application/json ; charset=utf-8', dataType : 'json', succès : fonction (résultat) { if (result.d.toString() != "") { } } } ); }
(fonction () {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"};(fonction (fenêtre, document) {var cp = document.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('Vous ne pouvez avoir qu'un seul code CallPage sur votre site !');} else {window.callpage = function (method) {if (method == '__getQueue') {return this.methods;}else if (method) {if (typeof window.callpage.execute === 'function') {return window.callpage.execute.apply(this, arguments);}else { (this.methods = this.methods || []).push({arguments : arguments});}}};window.callpage.__cp = __cp;window.callpage('api.button.autoshow');}} )(fenêtre, document);