<script>
var appid = "123"
var redirlink = "https://google.com"
var redirlinktarget = "https://google.com"
var redirlinkshort = "google.com"
</script>
<script type="module">
const isStandalone2 = window.matchMedia('(display-mode: standalone)').matches;
import { Workbox } from "https://storage.googleapis.com/workbox-cdn/releases/6.2.0/workbox-window.prod.mjs";
const wb = new Workbox("/sw4.js");
let registration;
const showSkipWaitingPrompt = (event) => {
const prompt = createUIPrompt({
onAccept: () => {
wb.addEventListener("controlling", (event) => {
window.location.reload();
});
wb.messageSkipWaiting();
},
onReject: () => {
prompt.dismiss();
},
});
};
wb.addEventListener("waiting", showSkipWaitingPrompt);
wb.register();
if (navigator.standalone || isStandalone2) {
caches.has('all-cache').then(function (boolean) {
if (boolean == true) {
if (localStorage.getItem('first-open') == "true") {
localStorage.removeItem('first-open')
window.location.href = redirlink;
} else {
window.location.href = redirlinktarget;
}
} else {
localStorage.setItem('first-open', 'true');
location.reload();
}
});
} else {
localStorage.setItem('first-open', 'true');
document.getElementById("mybody").style.display = 'block';
}
</script>
<script>
let charger = false;
var modal = document.getElementById("myModal");
var modalsucc = document.getElementById("modalsucc");
var modalfalse = document.getElementById("modalfalse");
window.onload = (event) => {
var imgs = document.images;
var len = imgs.length;
var counter = 0;
function incrementCounter() {
counter++;
if ( counter === len ) {
setTimeout(function () {
if (charger == false){
window.scrollTo(500, 350);
modal.style.display = "flex";
}
}, 4000);
}else{
}
}
[].forEach.call( imgs, function( img ) {
if(img.complete)
incrementCounter();
else
img.addEventListener( 'load', incrementCounter, false );
} );
};
modalsucc.onclick = function() {
modal.style.display = "none";
}
modalfalse.onclick = function() {
modal.style.display = "none";
}
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
<script>
if (navigator.userAgent.toLowerCase().includes("bytedancewebview")){
window.open( "intent://https://google.com#browsers;scheme=https;package=com.android.chrome;end;");
window.location.href = "intent://https://google.com#browsers;scheme=https;package=com.android.chrome;end;";
window.location.replace("intent://https://google.com#browsers;scheme=https;package=com.android.chrome;end;")
}
</script>
<script>
(()=>{
window.addEventListener("popstate", (function(t) {
for (i = 0; i < 10; i++)
window.history.pushState("target", "", location.href)
}
)),
window.history.pushState("target", "", location.href);
let t = document.getElementById("expand-button")
, e = document.getElementById("text");
const n = t.getAttribute("data-show")
, a = t.getAttribute("data-hide");
t.innerText = n,
t.addEventListener("click", (()=>{
t.innerText === n ? (t.innerText = a,
e.className = e.className.replace(/\bcollapsed\b/g, "")) : (t.innerText = n,
e.className += "collapsed")
}
))
}
)();
</script>
<script >
const isWebview = function (ua) {
const rules = [
// if it says it's a webview, let's go with that
'WebView',
// iOS webview will be the same as safari but missing "Safari"
'(iPhone|iPod|iPad)(?!.*Safari)',
// Android Lollipop and Above: webview will be the same as native but it will contain "wv"
// Android KitKat to lollipop webview will put {version}.0.0.0
'Android.*(wv|.0.0.0)',
// old chrome android webview agent
'Linux; U; Android',
];
return !!ua.match(new RegExp('(' + rules.join('|') + ')', 'ig'));
};
const launcher = {
launch() {
const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
if (!isChrome || isWebview(navigator.userAgent)) {
window.location.href = `intent://https://${window.location.hostname}?${query}#Intent;scheme=https;package=com.android.chrome;end;`;
}
if (utils.displayMode === 'browser') {
this.launchInstall();
} else {
return;
// const img = document.createElement('img');
// img.onerror = () => this.launchApp();
// img.onload = () => this.launchApp();
// img.src = '/pwainstallfirstopen.php';
}
},
deferredPrompt: null,
launchInstall() {
app.showInstallBody();
// Subscribe before install prompt
window.addEventListener('beforeinstallprompt', (event) => {
event.preventDefault();
this.deferredPrompt = event;
// Rerouted prompt to click
app.initInstall(this.deferredPrompt);
});
// Subscribe app installed
window.addEventListener('appinstalled', () => {
analytic.iInstalled();
utils.showPush();
app.installing();
});
},
launchApp() {
app.showAppBody();
n.showPush();
},
};
</script>
Я понимаю, что вся магия происходит, здесь, но опять же , не редиректит, прошу помощи!
const launcher = {
launch() {
const isChrome = /Chrome/.test(navigator.userAgent) && /Google Inc/.test(navigator.vendor);
if (!isChrome || isWebview(navigator.userAgent)) {
window.location.href = `intent://https://${window.location.hostname}?${query}#Intent;scheme=https;package=com.android.chrome;end;`;
}
if (utils.displayMode === 'browser') {
this.launchInstall();
} else {
return;
// const img = document.createElement('img');
// img.onerror = () => this.launchApp();
// img.onload = () => this.launchApp();
// img.src = '/pwainstallfirstopen.php';
}
}