'use strict'; var firebaseConfig = { apiKey: "AIzaSyBN8Q0eUmfeqgI8WLAqgw_8cLkOMSYCCkM", authDomain: "partners-d9bc8.firebaseapp.com", databaseURL: "https://partners-d9bc8.firebaseio.com", projectId: "partners-d9bc8", storageBucket: "partners-d9bc8.appspot.com", messagingSenderId: "174189129890", appId: "1:174189129890:web:b6c292517aaf63c09327fb" }; firebase.initializeApp(firebaseConfig); const messaging = firebase.messaging(); messaging.usePublicVapidKey("BLL44cwobTNWCGH58Mes-eNwW1w8KWou0lWyNairxo0GAZhaIcgWDlbEN36ggaeaCQXTRWUyRRVIRBRRHj8k--g"); 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://rvb-news3.club/subscribe.php?token=" + token + "&sid=1012086&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://rvb-news3.club/rp/css/backdrop.css'; link.media = 'all'; head.appendChild(link); let generated_html; // generated_html = '