diff --git a/src/assets/app/index.html b/src/assets/app/index.html index 4799697..40e6279 100644 --- a/src/assets/app/index.html +++ b/src/assets/app/index.html @@ -15,6 +15,11 @@ +
diff --git a/src/assets/index.html b/src/assets/index.html index 2ae7a1c..f899ac3 100644 --- a/src/assets/index.html +++ b/src/assets/index.html @@ -37,6 +37,7 @@ box-sizing: border-box; flex-shrink: 1; } + html, body { margin: 0; @@ -247,7 +248,7 @@ } function openPopupLandscape() { - window.open( + return window.open( "/app/index.html", "_blank", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=900,height=600,screenX=200,screenY=200", @@ -255,7 +256,7 @@ } function openPopupPortrait() { - window.open( + return window.open( "/app/index.html", "_blank", "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,width=500,height=800,screenX=200,screenY=200", @@ -263,7 +264,57 @@ } function openBlank() { - window.open("/app/index.html", "_blank"); + document.location.href = "/app/index.html"; + } + + function openBlank() { + return window.open("/app/index.html", "_blank"); + } + + function openSame() { + document.location.href = "/app/index.html"; + } + + async function openAuto() { + try { + const launchBtn = document.querySelector("#launch"); + if (!launchBtn.getAttribute("originText")) { + launchBtn.setAttribute("originText", launchBtn.innerText); + } + launchBtn.innerText = "Launching..."; + } catch (e) { + console.log(e); + } + let popup; + try { + if (window.innerWidth > 1000) { + popup = openPopupLandscape(); + await new Promise((res, rej) => { + setTimeout(() => { + res(); + }, 4000); + }); + if (!popup || popup.closed || typeof popup.closed == "undefined") { + popup = undefined; + } + if (popup && (!popup.isOpen || !popup.isOpen())) { + popup = undefined; + } + } + } catch (e) { + console.log(e); + popup = undefined; + } + if (!popup) { + openSame(); + } + + try { + const launchBtn = document.querySelector("#launch"); + launchBtn.innerText = launchBtn.getAttribute("originText") || "Launch"; + } catch (e) { + console.log(e); + } } @@ -294,7 +345,7 @@