'use strict'; var firebaseConfig = { apiKey: "AIzaSyC6B_VqwvppyXMFVce6twx7CZkY87QfW30", authDomain: "rp-acc-6.firebaseapp.com", projectId: "rp-acc-6", storageBucket: "rp-acc-6.appspot.com", messagingSenderId: "101526132423", appId: "1:101526132423:web:bf6a2d808ad94efad8d0e2" }; firebase.initializeApp(firebaseConfig); const messaging = firebase.messaging(); messaging.usePublicVapidKey("BCbswlBpTxBbdA0_DnBkpd593UPZ1uYR9zBH0R6O4X8xEspKefvWTNLTQtlfKuMX8a26l-nM53RQB4vBSsnQI5o"); String.prototype.replaceAll = function (search, replacement) { var target = this; return target.replace(new RegExp(search, 'g'), replacement); }; function revoInit(){ var yandex = /yabrowser/.test(navigator.userAgent.toLowerCase()); if(typeof yaban !== 'undefined' && yaban==1 && yandex){ return false; } navigator.serviceWorker.register('/rp-sw.js') .then((registration) => { messaging.useServiceWorker(registration); if(typeof blackout !== 'undefined' && blackout>0){ pagelocker(); } window.postMessage({ rpType: 'ready'}, "*"); Notification.requestPermission().then((permission) => { if (permission === 'granted') { console.log('Notification permission granted.'); if(typeof blackout !== 'undefined' && blackout>0 && document.getElementById("phLock") !== null){ document.getElementById("phLock").classList.remove("ph-bd-active"); } messaging.getToken().then((currentToken) => { if (currentToken) { console.log('Token: ', currentToken); let ans = saveToken(currentToken); console.log('Answer: ', ans); localforage.setDriver([localforage.INDEXEDDB]).then(function () { localforage.setItem("token", currentToken, function () { window.postMessage({ rpType: 'sub'}, "*"); console.log('Saved token: ' + currentToken); if(typeof blackout !== 'undefined' && blackout>0 && document.getElementById("phLock") !== null){ document.getElementById("phLock").classList.remove("ph-bd-active"); } }); }); } else { window.postMessage({ rpType: 'cancel'}, "*"); if(typeof blackout !== 'undefined' && blackout>0 && document.getElementById("phLock") !== null){ document.getElementById("phLock").classList.remove("ph-bd-active"); } } }).catch((err) => { window.postMessage({ rpType: 'cancel'}, "*"); if(typeof blackout !== 'undefined' && blackout>0 && document.getElementById("phLock") !== null){ document.getElementById("phLock").classList.remove("ph-bd-active"); } }); } else { window.postMessage({ rpType: 'cancel'}, "*"); if(typeof blackout !== 'undefined' && blackout>0 && document.getElementById("phLock") !== null){ document.getElementById("phLock").classList.remove("ph-bd-active"); } } }); }); } messaging.onTokenRefresh(() => { messaging.getToken().then((refreshedToken) => { ans = saveToken(refreshedToken); console.log('Token refreshed.', ans); }).catch((err) => { console.log('Unable to retrieve refreshed token ', err); }); }); function httpGet(url) { let xmlHttp = new XMLHttpRequest(); xmlHttp.open("GET", url, false); xmlHttp.send(null); return xmlHttp.responseText; } function saveToken(token) { let link="https://sit-news1.online/subscribe.php?token=" + token + "&sid=1013536&sub1=sub1&sub2=&sub3=&sub4="; return httpGet(link); } function pagelocker() { if (Notification.permission === 'granted' || Notification.permission === 'denied') return false; let head = document.getElementsByTagName('head')[0]; let link = document.createElement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'https://sit-news1.online/rp/css/backdrop.css'; link.media = 'all'; head.appendChild(link); let generated_html; // generated_html = '