From 1c37b7e170cc79b8803440a5c658a35b28333db9 Mon Sep 17 00:00:00 2001
From: Zheng Lin Lei
Date: Thu, 26 Oct 2023 10:26:33 +0200
Subject: [PATCH 1/4] Fixed iPhone top layer #56
---
css/style.css | 2 +-
css/style.css.map | 2 +-
index.html | 2 +-
js/pwa/pwa.js | 46 ++++++++++++++++++++++++++++++----------------
js/pwa/pwa.min.js | 2 +-
js/script.js | 12 ++++++++++++
js/script.min.js | 5 ++++-
scss/style.scss | 16 +++++++++++++++-
8 files changed, 65 insertions(+), 22 deletions(-)
diff --git a/css/style.css b/css/style.css
index 7117317..6927012 100644
--- a/css/style.css
+++ b/css/style.css
@@ -1 +1 @@
-*{margin:0;padding:0;color:#fff;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Source Code Pro",monospace;text-align:center;cursor:pointer;-webkit-text-size-adjust:none}body #Stackblock{position:fixed;top:0;left:0;z-index:-1}body .point-result{position:fixed;top:calc(20vh + 50px);z-index:99;left:50%;transform:translateX(-50%);transition:.8s}body .point-result.active{top:40px}body .combo-extra-point{position:fixed;top:200px;left:50%;transform:translateX(-50%);transition:.3s;opacity:0}body .combo-extra-point.active{animation:extraPointFlash 1s ease-out}body .combo-strike{font-weight:800;font-size:54px;position:fixed;top:50vh;left:50vw;transform:translate(-50%, 15vh);transition:.3s;opacity:0}body .combo-strike.open{transform:translate(-50%, 10vh) scale(1.7) rotate(-10deg);opacity:1}body .result-area{transition:.4s;top:0;left:0;position:fixed;width:100vw;height:100vh;background-color:rgba(0,0,0,.8);display:flex;justify-content:center}body .result-area.disable{opacity:0}body .result-area header{margin-top:20vh;position:relative;transition:1s}body .result-area header .best{display:none}body .result-area header.new .best,body .result-area header.new .color-shape{display:block}body .result-area header.new .score{display:none}body .result-area header .color-shape{height:5px;display:none;width:100%;margin-top:5px;background:linear-gradient(90deg, #42c2f1 0%, #fbda4f 25%, #ab63df 50%, #5fc581 75%, #42c2f1 100%);background-size:200%;animation:moveGradient 3s linear infinite}@keyframes moveGradient{0%{background-position:0% 0%}100%{background-position:-200% 0%}}body .result-area footer.flash-text{position:absolute;bottom:20vh;animation:flash 1s infinite ease}body .result-area footer.flash-text .mobile-version{display:none}@media screen and (max-width: 700px){body .result-area footer.flash-text .mobile-version{display:block}body .result-area footer.flash-text .desktop-version{display:none}}body #click-event{width:100vw;height:100vh;z-index:2;position:fixed;top:0;left:0}body #pwa-install{position:fixed;top:30px;left:50%;transform:translateX(-50%) translateY(calc(-100% - 35px));background-color:#fff;z-index:2;padding:10px;border-radius:5px;display:flex;justify-content:space-between;grid-gap:20px;height:60px;flex-wrap:nowrap;overflow:hidden}body #pwa-install.display{animation:scrollDown .3s ease forwards}body #pwa-install .pwa-install-action{flex:1;justify-content:space-between;display:flex;flex-direction:column}body #pwa-install .pwa-install-text>*{font-size:12px;color:#000;text-align:start}body #pwa-install .pwa-install-text>*.pwa-install-description{font-size:10px;color:#999}body #pwa-install .pwa-install-icon>img{width:60px;border-radius:5px;height:60px}body #pwa-install .pwa-install-button{display:flex;justify-content:space-between;align-items:end}body #pwa-install .pwa-install-button button{border:none;background-color:#42c2f1;color:#fff;padding:7px 15px;border-radius:5px;cursor:pointer;font-size:10px;transition:.3s;font-weight:bold}body #pwa-install .pwa-install-button button:hover{background-color:#5fc581}body #pwa-install .pwa-install-button a{visibility:hidden;color:#727272;text-decoration:underline;font-size:10px;margin-bottom:5px}body #pwa-install .pwa-install-button a:hover{color:#4a4a4a}body #pwa-install .pwa-install-button a.display{visibility:visible}body #noti-popup{position:fixed;bottom:30px;left:50%;transform:translateX(-50%) translateY(calc(100% + 35px));background-color:#000;z-index:2;font-size:12px;border-radius:5px;overflow:hidden;padding:10px;padding-bottom:11px}body #noti-popup.display{animation:scrollUp 5.1s linear}body #noti-popup.display .loader{animation:loaderBack 5s linear}body #noti-popup #noti-pop-text{display:block}body #noti-popup .loader{width:100%;position:absolute;left:0;bottom:0;height:1px;background-color:#fff}body #pwa-install,body #noti-popup{width:100vw;max-width:270px}body #record-share{position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);z-index:99;border-radius:5px;overflow:hidden;background-color:#fff;transition:.5s;display:none}body #record-share.display{display:block;animation:jumpShaking .5s}body #record-share:hover{transform:translate(-50%, -50%) rotate(-5deg) scale(1.1)}body #record-share *{color:#000}body #record-share img{width:35vw;height:35vw;min-width:140px;min-height:140px;max-width:200px;max-height:200px;-o-object-fit:cover;object-fit:cover}@media screen and (max-height: 700px)and (min-width: 800px){body #record-share img{width:28vw;height:28vw;max-height:180px;min-width:180px}}@media(hover: none)or (max-width: 800px){body #record-share.display{animation:jumpShakingTouch .5s forwards}}body #record-share small{display:block;padding:10px;font-size:10px}@keyframes flash{50%{opacity:0}100%{opacity:1}}@keyframes extraPointFlash{60%{top:100px;opacity:1}100%{top:90px;opacity:0}}@keyframes scrollDown{100%{transform:translateX(-50%) translateY(0%)}}@keyframes scrollUp{5%{transform:translateX(-50%) translateY(0%)}95%{transform:translateX(-50%) translateY(0%)}100%{transform:translateX(-50%) translateY(calc(100% + 35px))}}@keyframes loaderBack{100%{width:0%}}@keyframes jumpShaking{0%{transform:translate(-50%, -50%)}25%{transform:translate(-50%, calc(-50% - 9px))}35%{transform:translate(-50%, calc(-50% - 9px)) rotate(-5deg)}55%{transform:translate(-50%, calc(-50% - 9px)) rotate(5deg)}65%{transform:translate(-50%, calc(-50% - 9px)) rotate(-5deg)}75%{transform:translate(-50%, calc(-50% - 9px)) rotate(5deg)}100%{transform:translate(-50%, -50%)}}@keyframes jumpShakingTouch{0%{transform:translate(-50%, -50%)}25%{transform:translate(-50%, calc(-50% - 9px))}35%{transform:translate(-50%, calc(-50% - 9px)) rotate(-5deg)}55%{transform:translate(-50%, calc(-50% - 9px)) rotate(5deg)}65%{transform:translate(-50%, calc(-50% - 9px)) rotate(-5deg)}75%{transform:translate(-50%, calc(-50% - 9px)) rotate(5deg)}100%{transform:translate(-50%, -50%) rotate(-5deg) scale(1.1)}}/*# sourceMappingURL=style.css.map */
\ No newline at end of file
+*{margin:0;padding:0;color:#fff;-webkit-touch-callout:none;-webkit-user-select:none;-moz-user-select:none;user-select:none;-webkit-tap-highlight-color:rgba(0,0,0,0);-webkit-tap-highlight-color:rgba(0,0,0,0)}body{font-family:"Source Code Pro",monospace;text-align:center;height:100vh;width:100vw;cursor:pointer;-webkit-text-size-adjust:none;transition:.4s}body #Stackblock{position:fixed;top:0;left:0;z-index:-1}body .point-result{position:fixed;top:calc(20vh + 50px);z-index:99;left:50%;transform:translateX(-50%);transition:.8s}body .point-result.active{top:40px}body .combo-extra-point{position:fixed;top:200px;left:50%;transform:translateX(-50%);transition:.3s;opacity:0}body .combo-extra-point.active{animation:extraPointFlash 1s ease-out}body .combo-strike{font-weight:800;font-size:54px;position:fixed;top:50vh;left:50vw;transform:translate(-50%, 15vh);transition:.3s;opacity:0}body .combo-strike.open{transform:translate(-50%, 10vh) scale(1.7) rotate(-10deg);opacity:1}body .result-area{transition:.4s;top:0;left:0;position:fixed;width:100vw;height:100vh;background-color:rgba(0,0,0,.8);display:flex;justify-content:center}body .result-area.disable{opacity:0}body .result-area header{margin-top:20vh;position:relative;transition:1s}body .result-area header .best{display:none}body .result-area header.new .best,body .result-area header.new .color-shape{display:block}body .result-area header.new .score{display:none}body .result-area header .color-shape{height:5px;display:none;width:100%;margin-top:5px;background:linear-gradient(90deg, #42c2f1 0%, #fbda4f 25%, #ab63df 50%, #5fc581 75%, #42c2f1 100%);background-size:200%;animation:moveGradient 3s linear infinite}@keyframes moveGradient{0%{background-position:0% 0%}100%{background-position:-200% 0%}}body .result-area footer.flash-text{position:absolute;bottom:20vh;animation:flash 1s infinite ease}body .result-area footer.flash-text .mobile-version{display:none}@media screen and (max-width: 700px){body .result-area footer.flash-text .mobile-version{display:block}body .result-area footer.flash-text .desktop-version{display:none}}body #click-event{width:100vw;height:100vh;z-index:2;position:fixed;top:0;left:0}body #pwa-install{position:fixed;top:30px;left:50%;transform:translateX(-50%) translateY(calc(-100% - 35px));background-color:#fff;z-index:2;padding:10px;border-radius:5px;display:flex;justify-content:space-between;grid-gap:20px;height:60px;flex-wrap:nowrap;overflow:hidden}body #pwa-install.display{animation:scrollDown .3s ease forwards}body #pwa-install .pwa-install-action{flex:1;justify-content:space-between;display:flex;flex-direction:column}body #pwa-install .pwa-install-text>*{font-size:12px;color:#000;text-align:start}body #pwa-install .pwa-install-text>*.pwa-install-description{font-size:10px;color:#999}body #pwa-install .pwa-install-text>*.pwa-install-description img{margin-left:5px;display:inline-block;transform:translateY(2px)}body #pwa-install .pwa-install-icon>img{width:60px;border-radius:5px;height:60px}body #pwa-install .pwa-install-button{display:flex;justify-content:space-between;align-items:end}body #pwa-install .pwa-install-button button{border:none;background-color:#42c2f1;color:#fff;padding:7px 15px;border-radius:5px;cursor:pointer;font-size:10px;transition:.3s;font-weight:bold}body #pwa-install .pwa-install-button button:hover{background-color:#5fc581}body #pwa-install .pwa-install-button a.pwa-install-btn-apple{font-size:10px;padding:2px;color:#0070c9;text-decoration:none}body #pwa-install .pwa-install-button a#pwa-dismiss-btn{visibility:hidden;color:#727272;text-decoration:underline;font-size:10px;margin-bottom:5px}body #pwa-install .pwa-install-button a#pwa-dismiss-btn:hover{color:#4a4a4a}body #pwa-install .pwa-install-button a#pwa-dismiss-btn.display{visibility:visible}body #noti-popup{position:fixed;bottom:30px;left:50%;transform:translateX(-50%) translateY(calc(100% + 35px));background-color:#000;z-index:2;font-size:12px;border-radius:5px;overflow:hidden;padding:10px;padding-bottom:11px}body #noti-popup.display{animation:scrollUp 5.1s linear}body #noti-popup.display .loader{animation:loaderBack 5s linear}body #noti-popup #noti-pop-text{display:block}body #noti-popup .loader{width:100%;position:absolute;left:0;bottom:0;height:1px;background-color:#fff}body #pwa-install,body #noti-popup{width:100vw;max-width:270px}body #record-share{position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);z-index:99;border-radius:5px;overflow:hidden;background-color:#fff;transition:.5s;display:none}body #record-share.display{display:block;animation:jumpShaking .5s}body #record-share:hover{transform:translate(-50%, -50%) rotate(-5deg) scale(1.1)}body #record-share *{color:#000}body #record-share img{width:35vw;height:35vw;min-width:140px;min-height:140px;max-width:200px;max-height:200px;-o-object-fit:cover;object-fit:cover}@media screen and (max-height: 700px)and (min-width: 800px){body #record-share img{width:28vw;height:28vw;max-height:180px;min-width:180px}}@media(hover: none)or (max-width: 800px){body #record-share.display{animation:jumpShakingTouch .5s forwards}}body #record-share small{display:block;padding:10px;font-size:10px}@keyframes flash{50%{opacity:0}100%{opacity:1}}@keyframes extraPointFlash{60%{top:100px;opacity:1}100%{top:90px;opacity:0}}@keyframes scrollDown{100%{transform:translateX(-50%) translateY(0%)}}@keyframes scrollUp{5%{transform:translateX(-50%) translateY(0%)}95%{transform:translateX(-50%) translateY(0%)}100%{transform:translateX(-50%) translateY(calc(100% + 35px))}}@keyframes loaderBack{100%{width:0%}}@keyframes jumpShaking{0%{transform:translate(-50%, -50%)}25%{transform:translate(-50%, calc(-50% - 9px))}35%{transform:translate(-50%, calc(-50% - 9px)) rotate(-5deg)}55%{transform:translate(-50%, calc(-50% - 9px)) rotate(5deg)}65%{transform:translate(-50%, calc(-50% - 9px)) rotate(-5deg)}75%{transform:translate(-50%, calc(-50% - 9px)) rotate(5deg)}100%{transform:translate(-50%, -50%)}}@keyframes jumpShakingTouch{0%{transform:translate(-50%, -50%)}25%{transform:translate(-50%, calc(-50% - 9px))}35%{transform:translate(-50%, calc(-50% - 9px)) rotate(-5deg)}55%{transform:translate(-50%, calc(-50% - 9px)) rotate(5deg)}65%{transform:translate(-50%, calc(-50% - 9px)) rotate(-5deg)}75%{transform:translate(-50%, calc(-50% - 9px)) rotate(5deg)}100%{transform:translate(-50%, -50%) rotate(-5deg) scale(1.1)}}/*# sourceMappingURL=style.css.map */
\ No newline at end of file
diff --git a/css/style.css.map b/css/style.css.map
index 1fcf189..2b1c354 100644
--- a/css/style.css.map
+++ b/css/style.css.map
@@ -1 +1 @@
-{"version":3,"sources":["../scss/style.scss"],"names":[],"mappings":"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","file":"style.css"}
\ No newline at end of file
+{"version":3,"sources":["../scss/style.scss"],"names":[],"mappings":"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","file":"style.css"}
\ No newline at end of file
diff --git a/index.html b/index.html
index b2ef048..9d07f71 100644
--- a/index.html
+++ b/index.html
@@ -3,7 +3,7 @@
-
+
diff --git a/js/pwa/pwa.js b/js/pwa/pwa.js
index 4567d2b..aad8849 100644
--- a/js/pwa/pwa.js
+++ b/js/pwa/pwa.js
@@ -1,11 +1,31 @@
let deferredPrompt, enableDownload = false, installBtn, installRejector;
+// Check environment
+function checkEnvironment() {
+ let active;
+ if (window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone === true || localStorage.getItem('PWA_installed') === "true") {
+ localStorage.setItem("PWA_installed", 'true');
+ active = localStorage.getItem("PWA_installed");
+ } else {
+ localStorage.removeItem("PWA_installed");
+ document.querySelector("#pwa-install").classList.remove("display");
+ active= false;
+ }
+
+ return active;
+}
+
window.addEventListener("load", () => {
console.log("PWA ready!");
let activeDownload = localStorage.getItem("PWA_installed");
let installDismissed = localStorage.getItem("installDismissed");
installBtn = document.querySelector("#pwa-install-btn");
installRejector = document.querySelector("#pwa-dismiss-btn"); //cool variable name
+ installRejector.addEventListener("click", ()=>{
+ localStorage.setItem("installDismissed", 'true');
+ document.querySelector("#pwa-install").classList.remove("display");
+ });
+
window.addEventListener('beforeinstallprompt', (e) => {
// Prevent the mini-infobar from appearing on mobile
e.preventDefault();
@@ -14,25 +34,11 @@ window.addEventListener("load", () => {
console.log("Prepared");
// Check installation
- if(!activeDownload){
- // REMOVED: window.matchMedia('(display-mode: full-screen)').matches ----> Full-screen doesn't that user has downloaded the PWA
- if (window.matchMedia('(display-mode: standalone)').matches || window.navigator.standalone === true || localStorage.getItem('PWA_installed') === "true") {
- localStorage.setItem("PWA_installed", 'true');
- activeDownload = localStorage.getItem("PWA_installed");
- } else {
- localStorage.removeItem("PWA_installed");
- document.querySelector("#pwa-install").classList.remove("display");
- activeDownload = false;
- }
- }
+ if(!activeDownload)
+ activeDownload = checkEnvironment();
if((!activeDownload || activeDownload == 'false') && (!installDismissed || installDismissed == 'false')) {
enableDownload = true;
-
- installRejector.addEventListener("click", ()=>{
- localStorage.setItem("installDismissed", 'true');
- document.querySelector("#pwa-install").classList.remove("display");
- });
installBtn.addEventListener("click", () => {
console.log("Installing...");
@@ -54,6 +60,14 @@ window.addEventListener("load", () => {
}
});
+ // IOS
+ if(navigator.userAgent.match(/(iPad|iPhone|iPod)/g) && navigator.userAgent.match(/(Safari)/g)) {
+ // Set to true to force download
+ enableDownload = true;
+ // Check other conditions
+ enableDownload = !checkEnvironment();
+ }
+
window.addEventListener('appinstalled', (event) => {
deferredPrompt = null;
console.log('👍', 'appinstalled', event);
diff --git a/js/pwa/pwa.min.js b/js/pwa/pwa.min.js
index 5c8bd3b..8712db1 100644
--- a/js/pwa/pwa.min.js
+++ b/js/pwa/pwa.min.js
@@ -1 +1 @@
-let deferredPrompt,enableDownload=!1,installBtn,installRejector;window.addEventListener("load",()=>{console.log("PWA ready!");let l=localStorage.getItem("PWA_installed"),t=localStorage.getItem("installDismissed");installBtn=document.querySelector("#pwa-install-btn"),installRejector=document.querySelector("#pwa-dismiss-btn"),window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),deferredPrompt=e,console.log("Prepared"),(l=l||(window.matchMedia("(display-mode: standalone)").matches||!0===window.navigator.standalone||"true"===localStorage.getItem("PWA_installed")?(localStorage.setItem("PWA_installed","true"),localStorage.getItem("PWA_installed")):(localStorage.removeItem("PWA_installed"),document.querySelector("#pwa-install").classList.remove("display"),!1)))&&"false"!=l||t&&"false"!=t?console.log("Installed before or install dismissed"):(enableDownload=!0,installRejector.addEventListener("click",()=>{localStorage.setItem("installDismissed","true"),document.querySelector("#pwa-install").classList.remove("display")}),installBtn.addEventListener("click",()=>{console.log("Installing..."),deferredPrompt.prompt(),deferredPrompt.userChoice.then(e=>{"accepted"===e.outcome?console.log("User accepted the install prompt"):console.log("User dismissed the install prompt")}),enableDownload=!1}))}),window.addEventListener("appinstalled",e=>{deferredPrompt=null,console.log("👍","appinstalled",e),localStorage.setItem("PWA_installed","true")})});
\ No newline at end of file
+let deferredPrompt,enableDownload=!1,installBtn,installRejector;function checkEnvironment(){let e;return e=window.matchMedia("(display-mode: standalone)").matches||!0===window.navigator.standalone||"true"===localStorage.getItem("PWA_installed")?(localStorage.setItem("PWA_installed","true"),localStorage.getItem("PWA_installed")):(localStorage.removeItem("PWA_installed"),document.querySelector("#pwa-install").classList.remove("display"),!1)}window.addEventListener("load",()=>{console.log("PWA ready!");let t=localStorage.getItem("PWA_installed"),l=localStorage.getItem("installDismissed");installBtn=document.querySelector("#pwa-install-btn"),(installRejector=document.querySelector("#pwa-dismiss-btn")).addEventListener("click",()=>{localStorage.setItem("installDismissed","true"),document.querySelector("#pwa-install").classList.remove("display")}),window.addEventListener("beforeinstallprompt",e=>{e.preventDefault(),deferredPrompt=e,console.log("Prepared"),(t=t||checkEnvironment())&&"false"!=t||l&&"false"!=l?console.log("Installed before or install dismissed"):(enableDownload=!0,installBtn.addEventListener("click",()=>{console.log("Installing..."),deferredPrompt.prompt(),deferredPrompt.userChoice.then(e=>{"accepted"===e.outcome?console.log("User accepted the install prompt"):console.log("User dismissed the install prompt")}),enableDownload=!1}))}),navigator.userAgent.match(/(iPad|iPhone|iPod)/g)&&navigator.userAgent.match(/(Safari)/g)&&(enableDownload=!0,enableDownload=!checkEnvironment()),window.addEventListener("appinstalled",e=>{deferredPrompt=null,console.log("👍","appinstalled",e),localStorage.setItem("PWA_installed","true")})});
\ No newline at end of file
diff --git a/js/script.js b/js/script.js
index 3c7b2b2..faf0080 100644
--- a/js/script.js
+++ b/js/script.js
@@ -88,6 +88,16 @@ let stackBoxArr = [], outBoxArr = [];
window.addEventListener('load', ()=>{
+ // CHECK USER BROSWER AND OS
+ // IF OS == ios AND BROWSER == safari
+ if(GAME_.platform === 'ios' && navigator.userAgent.match(/(Safari)/g)){
+ document.querySelector('.pwa-install-title').innerText = "Apple StackBlock.io";
+ document.querySelector('.pwa-install-description').innerHTML = `Download the APP in `;
+ document.querySelector('.pwa-install-button').innerHTML = `
+ Not now
+ See more
+ `;
+ }
// DOM TAB
let resultTabDom = document.querySelector('.result-area');
let pointDom = document.querySelector('.point-result');
@@ -98,6 +108,7 @@ window.addEventListener('load', ()=>{
let eventLayer = document.querySelector('#click-event');
// RECORD SHARE
let recordShare = document.querySelector('#record-share');
+
/* ==========================================
= FUNCTIONS
============================================*/
@@ -109,6 +120,7 @@ window.addEventListener('load', ()=>{
if (hslDark) hex = hslToHex(colorDesign[GAME_.designPalette][0] + 120 + (stackBoxArr.length), colorDesign[GAME_.designPalette][1], 10);
// Change theme-color
document.querySelector('meta[name="theme-color"]').setAttribute("content", hex);
+ document.body.style.backgroundColor = hex;
// Change msapplication-TileColor only with supported platforms
if (GAME_.platform === 'windows')
// Windows 8 and Related
diff --git a/js/script.min.js b/js/script.min.js
index e7a886a..c6e13a2 100644
--- a/js/script.min.js
+++ b/js/script.min.js
@@ -1 +1,4 @@
-let GAME_={platform:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?"ios":navigator.userAgent.match(/(Android)/g)?"android":navigator.userAgent.match(/(Windows)/g)?"windows":navigator.userAgent.match(/(Mac)/g)?"mac":navigator.userAgent.match(/(Linux)/g)?"linux":"unknown",status:!1,fpsCtrl:{forceLag:!1,fps:60,mFps:0,fpsInterval:0,now:0,then:0,delta:0,lagWarning:{enable:!0,lastWarning:0}},end:!1,active:!1,score:0,combo:0,gamesPlayed:0,bestResult:window.localStorage.getItem("bestResult")?window.localStorage.getItem("bestResult"):0,newRecord:!1,designPalette:0,screenshot:{service:!0,enable:!1,frames:0,callback:null,blob:null},botMode:!1,confetti:{range:[30,50]},zoomOut:{service:!0,enable:!1,frames:0,finished:!1}};const colorDesign=[[30,70,50],[120,80,60],[224,68,62],[251,50,60],[339,62,48],[231,50,47],[165,30,68]],boxSize={x:3,y:1,z:3,range:10},c_width=10,cameraPos={width:c_width,height:c_width*(window.innerHeight/window.innerWidth),near:1,far:100,size:700{try{var e=stackBoxArr[stackBoxArr.length-1],t=stackBoxArr[stackBoxArr.length-2],o=e.direction,r=e.threejs.position[o]-t.threejs.position[o],n=Math.abs(r),s="x"===o?e.width:e.depth,a=(s-n)/s;(i||.95)<=a&&(fncStart(),c)&&console.log(a)}catch(e){fncStart()}},e||20)}window.addEventListener("load",()=>{let c=document.querySelector(".result-area"),l=document.querySelector(".point-result"),d=document.querySelector(".score-tab"),h=document.querySelector(".combo-strike"),m=document.querySelector(".combo-extra-point");var e=document.querySelector("#click-event");let p=document.querySelector("#record-share");function A(e=!1){let t=u(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2]);scene.background=new THREE.Color(t),e&&(t=u(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],10)),document.querySelector('meta[name="theme-color"]').setAttribute("content",t),"windows"===GAME_.platform&&document.querySelector('meta[name="msapplication-TileColor"]').setAttribute("content",t)}function g(e){l.innerHTML=e}function E(e,t,o,r,n){e=M(e,boxSize.y*stackBoxArr.length,t,o,r,!1);e.direction=n,e.positive=!0,stackBoxArr.push(e)}function M(e,t,o,r,n,s=!1){var a=s?4*(stackBoxArr.length-1):4*stackBoxArr.length,a=new THREE.Color(u(colorDesign[GAME_.designPalette][0]+a,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2])),i=new THREE.BoxGeometry(r,boxSize.y,n),a=new THREE.MeshLambertMaterial({color:a}),c=new THREE.Mesh(i,a),l=(c.position.set(e,t,o),new CANNON.Box(new CANNON.Vec3(r/2,boxSize.y/2,n/2))),s=new CANNON.Body({mass:s?5:0,shape:l});return s.position.set(e,t,o),world.addBody(s),scene.add(c),{threejs:c,geometry:i,material:a,cannonjs:s,x:e,y:t,z:o,width:r,depth:n}}function u(t,e,o){o=101{e=(e+t/30)%12,e=o-r*Math.max(Math.min(e-3,9-e,1),-1);return Math.round(255*e).toString(16).padStart(2,"0")};return"#"+e(0)+e(8)+e(4)}function w(){camera.right=cameraPos.width/cameraPos.size,camera.left=cameraPos.width/-cameraPos.size,camera.top=cameraPos.height/cameraPos.size,camera.bottom=cameraPos.height/-cameraPos.size,camera.updateProjectionMatrix()}function f(){return"now"in window?now():("now"in performance&&"performance"in window?performance:Date).now()}function t(e){document.querySelector("#noti-popup").classList.remove("display"),document.querySelector("#noti-popup-text").innerText=e,document.querySelector("#noti-popup").classList.add("display"),setTimeout(()=>document.querySelector("#noti-popup").classList.remove("display"),5200)}(world=new CANNON.World).gravity.set(0,-9.8,0),world.broadphase=new CANNON.NaiveBroadphase,world.solver.interations=40,g(GAME_.bestResult),scene=new THREE.Scene,A(hslDark=!0),E(0,0,boxSize.x,boxSize.z,"x");var o=new THREE.AmbientLight(16777215,.6),o=(scene.add(o),new THREE.DirectionalLight(16777215,.6));function r(){var e,t;GAME_.end?(stackBoxArr[stackBoxArr.length-1].threejs.position.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.position),stackBoxArr[stackBoxArr.length-1].threejs.quaternion.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.quaternion),GAME_.zoomOut.enable&&(cameraPos.size-=.02,w(),GAME_.zoomOut.frames++,20<=GAME_.zoomOut.frames)&&(GAME_.zoomOut.enable=!1,GAME_.zoomOut.frames=0,GAME_.zoomOut.finished=!0)):(t=(e=stackBoxArr[stackBoxArr.length-1]).positive?.15:-.15,e.threejs.position[e.direction]>=boxSize.range-5&&(e.positive=!1),e.threejs.position[e.direction]<=-(boxSize.range-5)&&(e.positive=!0),e.threejs.position[e.direction]+=t,e.cannonjs.position[e.direction]+=t,camera.position.y{e.threejs.position.copy(e.cannonjs.position),e.threejs.quaternion.copy(e.cannonjs.quaternion)}),renderer.render(scene,camera),GAME_.screenshot.enable&&(5<=GAME_.screenshot.frames?GAME_.zoomOut.finished&&(DrawCanvasCopy(renderer.domElement,e=>{e.fillStyle="rgba(0, 0, 0, 0.2)",e.fillRect(0,0,e.canvas.width,e.canvas.height),e.fillStyle="#ffffff",e.font="32px monospace";var t="NEW RECORD",o=e.measureText(t).width;e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2-100),e.font="bold 64px monospace",t=GAME_.score,o=e.measureText(t).width,e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2+50),GAME_.botMode&&(e.save(),e.translate(e.canvas.width/2,e.canvas.height/2+50),e.rotate(-Math.PI/8),e.fillStyle="rgba(255, 0, 0, 0.6)",e.font="bold 64px monospace",o=e.measureText(t="FAKE").width,e.fillText(t,-o/2,0),e.strokeStyle="rgba(255, 0, 0, 0.5)",e.lineWidth=5,e.strokeRect(-(o/2+10),-51.152,o+20,56.152),e.restore())},e=>{var t=document.createElement("img");const o=URL.createObjectURL(e);t.onload=()=>{URL.revokeObjectURL(o)},t.src=o,GAME_.screenshot.blob=e,GAME_.screenshot.callback(t)}),GAME_.screenshot.enable=!1,GAME_.screenshot.frames=0):GAME_.screenshot.frames++)}function _(){requestAnimationFrame(_),GAME_.fpsCtrl.now=f(),GAME_.fpsCtrl.elapsed=GAME_.fpsCtrl.now-GAME_.fpsCtrl.then,GAME_.fpsCtrl.elapsed>GAME_.fpsCtrl.fpsInterval&&(GAME_.fpsCtrl.mFps=Math.round(1e3/GAME_.fpsCtrl.elapsed)-(GAME_.fpsCtrl.forceLag?30:0),GAME_.fpsCtrl.mFps{var e,t,o,r,n,s,a,i;GAME_.status?(o=stackBoxArr[stackBoxArr.length-1],n=stackBoxArr[stackBoxArr.length-2],r=o.direction,n=o.threejs.position[r]-n.threejs.position[r],i=Math.abs(n),0<(s=(a="x"===r?o.width:o.depth)-i)?(a=s/a,i<.2?([9,19,29,39,49].includes(GAME_.combo)&&(m.classList.add("active"),setTimeout(()=>{m.classList.remove("active")},1100),GAME_.score+=10),GAME_.combo+=1,h.innerHTML="x"+GAME_.combo,h.classList.add("open"),setTimeout(()=>{h.classList.remove("open")},700)):GAME_.combo&&(GAME_.combo=0),e="x"===r?s:o.width,t="z"===r?s:o.depth,o.width=e,o.depth=t,o.threejs.scale[r]=a,o.threejs.position[r]-=n/2,o.cannonjs.position[r]-=n/2,a=new CANNON.Box(new CANNON.Vec3(e/2,boxSize.y/2,t/2)),o.cannonjs.shapes=[],o.cannonjs.addShape(a),.01<=i&&(a=Math.sign(n)*(s/2+i/2),n={x:"x"===r?o.threejs.position.x+a:o.threejs.position.x,z:"z"===r?o.threejs.position.z+a:o.threejs.position.z,width:"x"===r?i:e,depth:"z"===r?i:t},s=n.z,a=n.width,i=n.depth,n=M(n=n.x,boxSize.y*(stackBoxArr.length-1),s,a,i,!0),outBoxArr.push(n)),E("x"===r?o.threejs.position.x:-(boxSize.range-1),"z"===r?o.threejs.position.z:-(boxSize.range-1),e,t,"x"===r?"z":"x"),GAME_.score++,g(GAME_.score)):(GAME_.end=!0,world.remove(o.cannonjs),s=new CANNON.Box(new CANNON.Vec3(o.width/2,boxSize.y/2,o.depth/2)),(a=new CANNON.Body({mass:5,shape:s})).position.set(o.threejs.position.x,o.threejs.position.y,o.threejs.position.z),world.addBody(a),o.cannonjs=a,c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.status=!1,GAME_.score>GAME_.bestResult&&(playConfetti(GAME_.confetti.range[0],GAME_.confetti.range[1]),GAME_.botMode||(GAME_.bestResult=GAME_.score,window.localStorage.setItem("bestResult",GAME_.score)),d.classList.add("new"),GAME_.newRecord=!0,GAME_.screenshot.service)&&(GAME_.screenshot.callback=e=>{p.replaceChild(e,p.querySelector("img")),p.classList.add("display")},GAME_.screenshot.enable=!0),GAME_.zoomOut.service&&(GAME_.zoomOut.enable=!0),i=localStorage.getItem("installDismissed")??!1,!enableDownload||"false"!=i&&i||(document.querySelector("#pwa-install").classList.add("display"),0{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),outBoxArr.forEach(e=>{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),stackBoxArr=[],outBoxArr=[],GAME_.score=0,GAME_.combo=0,A(),E(0,0,boxSize.x,boxSize.z,"x"),document.querySelector("#pwa-install").classList.remove("display"),p.classList.remove("display"),document.querySelector("#noti-popup").classList.remove("display")):(GAME_.fpsCtrl.fps=GAME_.fpsCtrl.forceLag?GAME_.fpsCtrl.fps/2:GAME_.fpsCtrl.fps,GAME_.fpsCtrl.fpsInterval=1e3/GAME_.fpsCtrl.fps,GAME_.fpsCtrl.then=f(),_(),GAME_.active=!0,d.querySelector(".score").innerHTML="SCORE"),g(GAME_.score),E(0,0,boxSize.x,boxSize.z,"z"),c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.newRecord&&(GAME_.newRecord=!1,d.classList.remove("new")),GAME_.status=!0,GAME_.end=!1),A(hslDark=GAME_.end)};o="ontouchstart"in window||navigator.msMaxTouchPoints?"touchstart":"mousedown";e.addEventListener(o,fncStart);let n=!0;window.addEventListener("keydown",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(e.preventDefault(),n&&(n=!1,fncStart()))}),window.addEventListener("keyup",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(n=!0)}),window.addEventListener("resize",e=>{cameraPos.height=c_width*(window.innerHeight/window.innerWidth),cameraPos.size=700{await Blob2Share(GAME_.screenshot.blob)||t("Unable to share. Take screenshot 📸")})});
\ No newline at end of file
+let GAME_={platform:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?"ios":navigator.userAgent.match(/(Android)/g)?"android":navigator.userAgent.match(/(Windows)/g)?"windows":navigator.userAgent.match(/(Mac)/g)?"mac":navigator.userAgent.match(/(Linux)/g)?"linux":"unknown",status:!1,fpsCtrl:{forceLag:!1,fps:60,mFps:0,fpsInterval:0,now:0,then:0,delta:0,lagWarning:{enable:!0,lastWarning:0}},end:!1,active:!1,score:0,combo:0,gamesPlayed:0,bestResult:window.localStorage.getItem("bestResult")?window.localStorage.getItem("bestResult"):0,newRecord:!1,designPalette:0,screenshot:{service:!0,enable:!1,frames:0,callback:null,blob:null},botMode:!1,confetti:{range:[30,50]},zoomOut:{service:!0,enable:!1,frames:0,finished:!1}};const colorDesign=[[30,70,50],[120,80,60],[224,68,62],[251,50,60],[339,62,48],[231,50,47],[165,30,68]],boxSize={x:3,y:1,z:3,range:10},c_width=10,cameraPos={width:c_width,height:c_width*(window.innerHeight/window.innerWidth),near:1,far:100,size:700{try{var e=stackBoxArr[stackBoxArr.length-1],t=stackBoxArr[stackBoxArr.length-2],o=e.direction,r=e.threejs.position[o]-t.threejs.position[o],n=Math.abs(r),a="x"===o?e.width:e.depth,s=(a-n)/a;(i||.95)<=s&&(fncStart(),c)&&console.log(s)}catch(e){fncStart()}},e||20)}window.addEventListener("load",()=>{"ios"===GAME_.platform&&navigator.userAgent.match(/(Safari)/g)&&(document.querySelector(".pwa-install-title").innerText="Apple StackBlock.io",document.querySelector(".pwa-install-description").innerHTML='Download the APP in ',document.querySelector(".pwa-install-button").innerHTML=`
+ Not now
+ See more
+ `);let c=document.querySelector(".result-area"),l=document.querySelector(".point-result"),d=document.querySelector(".score-tab"),p=document.querySelector(".combo-strike"),h=document.querySelector(".combo-extra-point");var e=document.querySelector("#click-event");let m=document.querySelector("#record-share");function A(e=!1){let t=w(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2]);scene.background=new THREE.Color(t),e&&(t=w(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],10)),document.querySelector('meta[name="theme-color"]').setAttribute("content",t),document.body.style.backgroundColor=t,"windows"===GAME_.platform&&document.querySelector('meta[name="msapplication-TileColor"]').setAttribute("content",t)}function g(e){l.innerHTML=e}function E(e,t,o,r,n){e=u(e,boxSize.y*stackBoxArr.length,t,o,r,!1);e.direction=n,e.positive=!0,stackBoxArr.push(e)}function u(e,t,o,r,n,a=!1){var s=a?4*(stackBoxArr.length-1):4*stackBoxArr.length,s=new THREE.Color(w(colorDesign[GAME_.designPalette][0]+s,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2])),i=new THREE.BoxGeometry(r,boxSize.y,n),s=new THREE.MeshLambertMaterial({color:s}),c=new THREE.Mesh(i,s),l=(c.position.set(e,t,o),new CANNON.Box(new CANNON.Vec3(r/2,boxSize.y/2,n/2))),a=new CANNON.Body({mass:a?5:0,shape:l});return a.position.set(e,t,o),world.addBody(a),scene.add(c),{threejs:c,geometry:i,material:s,cannonjs:a,x:e,y:t,z:o,width:r,depth:n}}function w(t,e,o){o=101{e=(e+t/30)%12,e=o-r*Math.max(Math.min(e-3,9-e,1),-1);return Math.round(255*e).toString(16).padStart(2,"0")};return"#"+e(0)+e(8)+e(4)}function M(){camera.right=cameraPos.width/cameraPos.size,camera.left=cameraPos.width/-cameraPos.size,camera.top=cameraPos.height/cameraPos.size,camera.bottom=cameraPos.height/-cameraPos.size,camera.updateProjectionMatrix()}function f(){return"now"in window?now():("now"in performance&&"performance"in window?performance:Date).now()}function t(e){document.querySelector("#noti-popup").classList.remove("display"),document.querySelector("#noti-popup-text").innerText=e,document.querySelector("#noti-popup").classList.add("display"),setTimeout(()=>document.querySelector("#noti-popup").classList.remove("display"),5200)}(world=new CANNON.World).gravity.set(0,-9.8,0),world.broadphase=new CANNON.NaiveBroadphase,world.solver.interations=40,g(GAME_.bestResult),scene=new THREE.Scene,A(hslDark=!0),E(0,0,boxSize.x,boxSize.z,"x");var o=new THREE.AmbientLight(16777215,.6),o=(scene.add(o),new THREE.DirectionalLight(16777215,.6));function r(){var e,t;GAME_.end?(stackBoxArr[stackBoxArr.length-1].threejs.position.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.position),stackBoxArr[stackBoxArr.length-1].threejs.quaternion.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.quaternion),GAME_.zoomOut.enable&&(cameraPos.size-=.02,M(),GAME_.zoomOut.frames++,20<=GAME_.zoomOut.frames)&&(GAME_.zoomOut.enable=!1,GAME_.zoomOut.frames=0,GAME_.zoomOut.finished=!0)):(t=(e=stackBoxArr[stackBoxArr.length-1]).positive?.15:-.15,e.threejs.position[e.direction]>=boxSize.range-5&&(e.positive=!1),e.threejs.position[e.direction]<=-(boxSize.range-5)&&(e.positive=!0),e.threejs.position[e.direction]+=t,e.cannonjs.position[e.direction]+=t,camera.position.y{e.threejs.position.copy(e.cannonjs.position),e.threejs.quaternion.copy(e.cannonjs.quaternion)}),renderer.render(scene,camera),GAME_.screenshot.enable&&(5<=GAME_.screenshot.frames?GAME_.zoomOut.finished&&(DrawCanvasCopy(renderer.domElement,e=>{e.fillStyle="rgba(0, 0, 0, 0.2)",e.fillRect(0,0,e.canvas.width,e.canvas.height),e.fillStyle="#ffffff",e.font="32px monospace";var t="NEW RECORD",o=e.measureText(t).width;e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2-100),e.font="bold 64px monospace",t=GAME_.score,o=e.measureText(t).width,e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2+50),GAME_.botMode&&(e.save(),e.translate(e.canvas.width/2,e.canvas.height/2+50),e.rotate(-Math.PI/8),e.fillStyle="rgba(255, 0, 0, 0.6)",e.font="bold 64px monospace",o=e.measureText(t="FAKE").width,e.fillText(t,-o/2,0),e.strokeStyle="rgba(255, 0, 0, 0.5)",e.lineWidth=5,e.strokeRect(-(o/2+10),-51.152,o+20,56.152),e.restore())},e=>{var t=document.createElement("img");const o=URL.createObjectURL(e);t.onload=()=>{URL.revokeObjectURL(o)},t.src=o,GAME_.screenshot.blob=e,GAME_.screenshot.callback(t)}),GAME_.screenshot.enable=!1,GAME_.screenshot.frames=0):GAME_.screenshot.frames++)}function _(){requestAnimationFrame(_),GAME_.fpsCtrl.now=f(),GAME_.fpsCtrl.elapsed=GAME_.fpsCtrl.now-GAME_.fpsCtrl.then,GAME_.fpsCtrl.elapsed>GAME_.fpsCtrl.fpsInterval&&(GAME_.fpsCtrl.mFps=Math.round(1e3/GAME_.fpsCtrl.elapsed)-(GAME_.fpsCtrl.forceLag?30:0),GAME_.fpsCtrl.mFps{var e,t,o,r,n,a,s,i;GAME_.status?(o=stackBoxArr[stackBoxArr.length-1],n=stackBoxArr[stackBoxArr.length-2],r=o.direction,n=o.threejs.position[r]-n.threejs.position[r],i=Math.abs(n),0<(a=(s="x"===r?o.width:o.depth)-i)?(s=a/s,i<.2?([9,19,29,39,49].includes(GAME_.combo)&&(h.classList.add("active"),setTimeout(()=>{h.classList.remove("active")},1100),GAME_.score+=10),GAME_.combo+=1,p.innerHTML="x"+GAME_.combo,p.classList.add("open"),setTimeout(()=>{p.classList.remove("open")},700)):GAME_.combo&&(GAME_.combo=0),e="x"===r?a:o.width,t="z"===r?a:o.depth,o.width=e,o.depth=t,o.threejs.scale[r]=s,o.threejs.position[r]-=n/2,o.cannonjs.position[r]-=n/2,s=new CANNON.Box(new CANNON.Vec3(e/2,boxSize.y/2,t/2)),o.cannonjs.shapes=[],o.cannonjs.addShape(s),.01<=i&&(s=Math.sign(n)*(a/2+i/2),n={x:"x"===r?o.threejs.position.x+s:o.threejs.position.x,z:"z"===r?o.threejs.position.z+s:o.threejs.position.z,width:"x"===r?i:e,depth:"z"===r?i:t},a=n.z,s=n.width,i=n.depth,n=u(n=n.x,boxSize.y*(stackBoxArr.length-1),a,s,i,!0),outBoxArr.push(n)),E("x"===r?o.threejs.position.x:-(boxSize.range-1),"z"===r?o.threejs.position.z:-(boxSize.range-1),e,t,"x"===r?"z":"x"),GAME_.score++,g(GAME_.score)):(GAME_.end=!0,world.remove(o.cannonjs),a=new CANNON.Box(new CANNON.Vec3(o.width/2,boxSize.y/2,o.depth/2)),(s=new CANNON.Body({mass:5,shape:a})).position.set(o.threejs.position.x,o.threejs.position.y,o.threejs.position.z),world.addBody(s),o.cannonjs=s,c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.status=!1,GAME_.score>GAME_.bestResult&&(playConfetti(GAME_.confetti.range[0],GAME_.confetti.range[1]),GAME_.botMode||(GAME_.bestResult=GAME_.score,window.localStorage.setItem("bestResult",GAME_.score)),d.classList.add("new"),GAME_.newRecord=!0,GAME_.screenshot.service)&&(GAME_.screenshot.callback=e=>{m.replaceChild(e,m.querySelector("img")),m.classList.add("display")},GAME_.screenshot.enable=!0),GAME_.zoomOut.service&&(GAME_.zoomOut.enable=!0),i=localStorage.getItem("installDismissed")??!1,!enableDownload||"false"!=i&&i||(document.querySelector("#pwa-install").classList.add("display"),0{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),outBoxArr.forEach(e=>{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),stackBoxArr=[],outBoxArr=[],GAME_.score=0,GAME_.combo=0,A(),E(0,0,boxSize.x,boxSize.z,"x"),document.querySelector("#pwa-install").classList.remove("display"),m.classList.remove("display"),document.querySelector("#noti-popup").classList.remove("display")):(GAME_.fpsCtrl.fps=GAME_.fpsCtrl.forceLag?GAME_.fpsCtrl.fps/2:GAME_.fpsCtrl.fps,GAME_.fpsCtrl.fpsInterval=1e3/GAME_.fpsCtrl.fps,GAME_.fpsCtrl.then=f(),_(),GAME_.active=!0,d.querySelector(".score").innerHTML="SCORE"),g(GAME_.score),E(0,0,boxSize.x,boxSize.z,"z"),c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.newRecord&&(GAME_.newRecord=!1,d.classList.remove("new")),GAME_.status=!0,GAME_.end=!1),A(hslDark=GAME_.end)};o="ontouchstart"in window||navigator.msMaxTouchPoints?"touchstart":"mousedown";e.addEventListener(o,fncStart);let n=!0;window.addEventListener("keydown",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(e.preventDefault(),n&&(n=!1,fncStart()))}),window.addEventListener("keyup",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(n=!0)}),window.addEventListener("resize",e=>{cameraPos.height=c_width*(window.innerHeight/window.innerWidth),cameraPos.size=700{await Blob2Share(GAME_.screenshot.blob)||t("Unable to share. Take screenshot 📸")})});
\ No newline at end of file
diff --git a/scss/style.scss b/scss/style.scss
index 1ad5d01..10c84f5 100644
--- a/scss/style.scss
+++ b/scss/style.scss
@@ -16,8 +16,11 @@
body{
font-family: 'Source Code Pro', monospace;
text-align: center;
+ height: 100vh;
+ width: 100vw;
cursor: pointer;
-webkit-text-size-adjust: none;
+ transition: .4s;
#Stackblock {
position: fixed;
@@ -176,6 +179,11 @@ body{
&.pwa-install-description {
font-size: 10px;
color: #999;
+ img {
+ margin-left: 5px;
+ display: inline-block;
+ transform: translateY(2px);
+ }
}
}
.pwa-install-icon > img {
@@ -203,7 +211,13 @@ body{
background-color: #5fc581;
}
}
- a {
+ a.pwa-install-btn-apple {
+ font-size: 10px;
+ padding: 2px;
+ color: #0070c9;
+ text-decoration: none;
+ }
+ a#pwa-dismiss-btn {
visibility: hidden;
color: rgb(114, 114, 114);
text-decoration: underline;
From 60bb1a615ea9acc0741973b4d91f399996d604c8 Mon Sep 17 00:00:00 2001
From: Zheng Lin Lei
Date: Thu, 26 Oct 2023 11:29:23 +0200
Subject: [PATCH 2/4] Added Landscape control
---
js/script.js | 47 +++++++++++++++++++++++++++++++++++++++++------
js/script.min.js | 4 ++--
2 files changed, 43 insertions(+), 8 deletions(-)
diff --git a/js/script.js b/js/script.js
index faf0080..dc83ca1 100644
--- a/js/script.js
+++ b/js/script.js
@@ -224,6 +224,38 @@ window.addEventListener('load', ()=>{
return Date.now();
}
+ function matchLadscape() {
+ // If it's landscape change in viewport-fit from contaion to cover
+ let content = document.querySelector('meta[name="viewport"]').getAttribute("content");
+
+ // Check if browser support matchMedia
+ if ('matchMedia' in window) {
+ if (window.matchMedia("(orientation: landscape)").matches) {
+ document.querySelector('meta[name="viewport"]').setAttribute("content", content.replace("contain", "cover"));
+ } else {
+ document.querySelector('meta[name="viewport"]').setAttribute("content", content.replace("cover", "contain"));
+ }
+ } else {
+ // If not supported, check if it's landscape
+ if (window.innerHeight > window.innerWidth) {
+ document.querySelector('meta[name="viewport"]').setAttribute("content", content.replace("contain", "cover"));
+ } else {
+ document.querySelector('meta[name="viewport"]').setAttribute("content", content.replace("cover", "contain"));
+ }
+ }
+ }
+
+ function resizeCanvas() {
+ // Resize canvas
+ cameraPos.height = c_width * (window.innerHeight/window.innerWidth);
+ cameraPos.size = (window.innerWidth > 700)? 1 : 2;
+ refreshCameraView()
+
+ // Resize canvas
+ renderer.setSize(window.innerWidth, window.innerHeight);
+ renderer.render(scene, camera);
+ }
+
function alertLog(text){
// Reset
document.querySelector('#noti-popup').classList.remove('display');
@@ -727,6 +759,9 @@ window.addEventListener('load', ()=>{
}
}
+ // Change orientation
+ // matchLadscape(); -----> Don't really need it now
+
let supportsTouch = 'ontouchstart' in window || navigator.msMaxTouchPoints;
let eventType = supportsTouch ? 'touchstart' : 'mousedown';
eventLayer.addEventListener(eventType, fncStart); // ADD FNC
@@ -754,14 +789,14 @@ window.addEventListener('load', ()=>{
});
// Window resize (For mobile devices when scroll or hide toolbar)
- window.addEventListener('resize', (e) => {
- cameraPos.height = c_width * (window.innerHeight/window.innerWidth);
- cameraPos.size = (window.innerWidth > 700)? 1 : 2;
- refreshCameraView()
+ window.addEventListener('resize', (e) => resizeCanvas());
+ // Window Orientation Change
+ window.addEventListener('orientationchange', (e) => {
+ // Change orientation
+ // matchLadscape(); ----> Works better without this function
// Resize canvas
- renderer.setSize(window.innerWidth, window.innerHeight);
- renderer.render(scene, camera);
+ resizeCanvas();
});
// SHARE RECORD
diff --git a/js/script.min.js b/js/script.min.js
index c6e13a2..c6073ff 100644
--- a/js/script.min.js
+++ b/js/script.min.js
@@ -1,4 +1,4 @@
-let GAME_={platform:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?"ios":navigator.userAgent.match(/(Android)/g)?"android":navigator.userAgent.match(/(Windows)/g)?"windows":navigator.userAgent.match(/(Mac)/g)?"mac":navigator.userAgent.match(/(Linux)/g)?"linux":"unknown",status:!1,fpsCtrl:{forceLag:!1,fps:60,mFps:0,fpsInterval:0,now:0,then:0,delta:0,lagWarning:{enable:!0,lastWarning:0}},end:!1,active:!1,score:0,combo:0,gamesPlayed:0,bestResult:window.localStorage.getItem("bestResult")?window.localStorage.getItem("bestResult"):0,newRecord:!1,designPalette:0,screenshot:{service:!0,enable:!1,frames:0,callback:null,blob:null},botMode:!1,confetti:{range:[30,50]},zoomOut:{service:!0,enable:!1,frames:0,finished:!1}};const colorDesign=[[30,70,50],[120,80,60],[224,68,62],[251,50,60],[339,62,48],[231,50,47],[165,30,68]],boxSize={x:3,y:1,z:3,range:10},c_width=10,cameraPos={width:c_width,height:c_width*(window.innerHeight/window.innerWidth),near:1,far:100,size:700{try{var e=stackBoxArr[stackBoxArr.length-1],t=stackBoxArr[stackBoxArr.length-2],o=e.direction,r=e.threejs.position[o]-t.threejs.position[o],n=Math.abs(r),a="x"===o?e.width:e.depth,s=(a-n)/a;(i||.95)<=s&&(fncStart(),c)&&console.log(s)}catch(e){fncStart()}},e||20)}window.addEventListener("load",()=>{"ios"===GAME_.platform&&navigator.userAgent.match(/(Safari)/g)&&(document.querySelector(".pwa-install-title").innerText="Apple StackBlock.io",document.querySelector(".pwa-install-description").innerHTML='Download the APP in ',document.querySelector(".pwa-install-button").innerHTML=`
+let GAME_={platform:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?"ios":navigator.userAgent.match(/(Android)/g)?"android":navigator.userAgent.match(/(Windows)/g)?"windows":navigator.userAgent.match(/(Mac)/g)?"mac":navigator.userAgent.match(/(Linux)/g)?"linux":"unknown",status:!1,fpsCtrl:{forceLag:!1,fps:60,mFps:0,fpsInterval:0,now:0,then:0,delta:0,lagWarning:{enable:!0,lastWarning:0}},end:!1,active:!1,score:0,combo:0,gamesPlayed:0,bestResult:window.localStorage.getItem("bestResult")?window.localStorage.getItem("bestResult"):0,newRecord:!1,designPalette:0,screenshot:{service:!0,enable:!1,frames:0,callback:null,blob:null},botMode:!1,confetti:{range:[30,50]},zoomOut:{service:!0,enable:!1,frames:0,finished:!1}};const colorDesign=[[30,70,50],[120,80,60],[224,68,62],[251,50,60],[339,62,48],[231,50,47],[165,30,68]],boxSize={x:3,y:1,z:3,range:10},c_width=10,cameraPos={width:c_width,height:c_width*(window.innerHeight/window.innerWidth),near:1,far:100,size:700{try{var e=stackBoxArr[stackBoxArr.length-1],t=stackBoxArr[stackBoxArr.length-2],o=e.direction,n=e.threejs.position[o]-t.threejs.position[o],r=Math.abs(n),a="x"===o?e.width:e.depth,s=(a-r)/a;(i||.95)<=s&&(fncStart(),c)&&console.log(s)}catch(e){fncStart()}},e||20)}window.addEventListener("load",()=>{"ios"===GAME_.platform&&navigator.userAgent.match(/(Safari)/g)&&(document.querySelector(".pwa-install-title").innerText="Apple StackBlock.io",document.querySelector(".pwa-install-description").innerHTML='Download the APP in ',document.querySelector(".pwa-install-button").innerHTML=`
Not now
See more
- `);let c=document.querySelector(".result-area"),l=document.querySelector(".point-result"),d=document.querySelector(".score-tab"),p=document.querySelector(".combo-strike"),h=document.querySelector(".combo-extra-point");var e=document.querySelector("#click-event");let m=document.querySelector("#record-share");function A(e=!1){let t=w(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2]);scene.background=new THREE.Color(t),e&&(t=w(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],10)),document.querySelector('meta[name="theme-color"]').setAttribute("content",t),document.body.style.backgroundColor=t,"windows"===GAME_.platform&&document.querySelector('meta[name="msapplication-TileColor"]').setAttribute("content",t)}function g(e){l.innerHTML=e}function E(e,t,o,r,n){e=u(e,boxSize.y*stackBoxArr.length,t,o,r,!1);e.direction=n,e.positive=!0,stackBoxArr.push(e)}function u(e,t,o,r,n,a=!1){var s=a?4*(stackBoxArr.length-1):4*stackBoxArr.length,s=new THREE.Color(w(colorDesign[GAME_.designPalette][0]+s,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2])),i=new THREE.BoxGeometry(r,boxSize.y,n),s=new THREE.MeshLambertMaterial({color:s}),c=new THREE.Mesh(i,s),l=(c.position.set(e,t,o),new CANNON.Box(new CANNON.Vec3(r/2,boxSize.y/2,n/2))),a=new CANNON.Body({mass:a?5:0,shape:l});return a.position.set(e,t,o),world.addBody(a),scene.add(c),{threejs:c,geometry:i,material:s,cannonjs:a,x:e,y:t,z:o,width:r,depth:n}}function w(t,e,o){o=101{e=(e+t/30)%12,e=o-r*Math.max(Math.min(e-3,9-e,1),-1);return Math.round(255*e).toString(16).padStart(2,"0")};return"#"+e(0)+e(8)+e(4)}function M(){camera.right=cameraPos.width/cameraPos.size,camera.left=cameraPos.width/-cameraPos.size,camera.top=cameraPos.height/cameraPos.size,camera.bottom=cameraPos.height/-cameraPos.size,camera.updateProjectionMatrix()}function f(){return"now"in window?now():("now"in performance&&"performance"in window?performance:Date).now()}function t(e){document.querySelector("#noti-popup").classList.remove("display"),document.querySelector("#noti-popup-text").innerText=e,document.querySelector("#noti-popup").classList.add("display"),setTimeout(()=>document.querySelector("#noti-popup").classList.remove("display"),5200)}(world=new CANNON.World).gravity.set(0,-9.8,0),world.broadphase=new CANNON.NaiveBroadphase,world.solver.interations=40,g(GAME_.bestResult),scene=new THREE.Scene,A(hslDark=!0),E(0,0,boxSize.x,boxSize.z,"x");var o=new THREE.AmbientLight(16777215,.6),o=(scene.add(o),new THREE.DirectionalLight(16777215,.6));function r(){var e,t;GAME_.end?(stackBoxArr[stackBoxArr.length-1].threejs.position.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.position),stackBoxArr[stackBoxArr.length-1].threejs.quaternion.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.quaternion),GAME_.zoomOut.enable&&(cameraPos.size-=.02,M(),GAME_.zoomOut.frames++,20<=GAME_.zoomOut.frames)&&(GAME_.zoomOut.enable=!1,GAME_.zoomOut.frames=0,GAME_.zoomOut.finished=!0)):(t=(e=stackBoxArr[stackBoxArr.length-1]).positive?.15:-.15,e.threejs.position[e.direction]>=boxSize.range-5&&(e.positive=!1),e.threejs.position[e.direction]<=-(boxSize.range-5)&&(e.positive=!0),e.threejs.position[e.direction]+=t,e.cannonjs.position[e.direction]+=t,camera.position.y{e.threejs.position.copy(e.cannonjs.position),e.threejs.quaternion.copy(e.cannonjs.quaternion)}),renderer.render(scene,camera),GAME_.screenshot.enable&&(5<=GAME_.screenshot.frames?GAME_.zoomOut.finished&&(DrawCanvasCopy(renderer.domElement,e=>{e.fillStyle="rgba(0, 0, 0, 0.2)",e.fillRect(0,0,e.canvas.width,e.canvas.height),e.fillStyle="#ffffff",e.font="32px monospace";var t="NEW RECORD",o=e.measureText(t).width;e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2-100),e.font="bold 64px monospace",t=GAME_.score,o=e.measureText(t).width,e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2+50),GAME_.botMode&&(e.save(),e.translate(e.canvas.width/2,e.canvas.height/2+50),e.rotate(-Math.PI/8),e.fillStyle="rgba(255, 0, 0, 0.6)",e.font="bold 64px monospace",o=e.measureText(t="FAKE").width,e.fillText(t,-o/2,0),e.strokeStyle="rgba(255, 0, 0, 0.5)",e.lineWidth=5,e.strokeRect(-(o/2+10),-51.152,o+20,56.152),e.restore())},e=>{var t=document.createElement("img");const o=URL.createObjectURL(e);t.onload=()=>{URL.revokeObjectURL(o)},t.src=o,GAME_.screenshot.blob=e,GAME_.screenshot.callback(t)}),GAME_.screenshot.enable=!1,GAME_.screenshot.frames=0):GAME_.screenshot.frames++)}function _(){requestAnimationFrame(_),GAME_.fpsCtrl.now=f(),GAME_.fpsCtrl.elapsed=GAME_.fpsCtrl.now-GAME_.fpsCtrl.then,GAME_.fpsCtrl.elapsed>GAME_.fpsCtrl.fpsInterval&&(GAME_.fpsCtrl.mFps=Math.round(1e3/GAME_.fpsCtrl.elapsed)-(GAME_.fpsCtrl.forceLag?30:0),GAME_.fpsCtrl.mFps{var e,t,o,r,n,a,s,i;GAME_.status?(o=stackBoxArr[stackBoxArr.length-1],n=stackBoxArr[stackBoxArr.length-2],r=o.direction,n=o.threejs.position[r]-n.threejs.position[r],i=Math.abs(n),0<(a=(s="x"===r?o.width:o.depth)-i)?(s=a/s,i<.2?([9,19,29,39,49].includes(GAME_.combo)&&(h.classList.add("active"),setTimeout(()=>{h.classList.remove("active")},1100),GAME_.score+=10),GAME_.combo+=1,p.innerHTML="x"+GAME_.combo,p.classList.add("open"),setTimeout(()=>{p.classList.remove("open")},700)):GAME_.combo&&(GAME_.combo=0),e="x"===r?a:o.width,t="z"===r?a:o.depth,o.width=e,o.depth=t,o.threejs.scale[r]=s,o.threejs.position[r]-=n/2,o.cannonjs.position[r]-=n/2,s=new CANNON.Box(new CANNON.Vec3(e/2,boxSize.y/2,t/2)),o.cannonjs.shapes=[],o.cannonjs.addShape(s),.01<=i&&(s=Math.sign(n)*(a/2+i/2),n={x:"x"===r?o.threejs.position.x+s:o.threejs.position.x,z:"z"===r?o.threejs.position.z+s:o.threejs.position.z,width:"x"===r?i:e,depth:"z"===r?i:t},a=n.z,s=n.width,i=n.depth,n=u(n=n.x,boxSize.y*(stackBoxArr.length-1),a,s,i,!0),outBoxArr.push(n)),E("x"===r?o.threejs.position.x:-(boxSize.range-1),"z"===r?o.threejs.position.z:-(boxSize.range-1),e,t,"x"===r?"z":"x"),GAME_.score++,g(GAME_.score)):(GAME_.end=!0,world.remove(o.cannonjs),a=new CANNON.Box(new CANNON.Vec3(o.width/2,boxSize.y/2,o.depth/2)),(s=new CANNON.Body({mass:5,shape:a})).position.set(o.threejs.position.x,o.threejs.position.y,o.threejs.position.z),world.addBody(s),o.cannonjs=s,c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.status=!1,GAME_.score>GAME_.bestResult&&(playConfetti(GAME_.confetti.range[0],GAME_.confetti.range[1]),GAME_.botMode||(GAME_.bestResult=GAME_.score,window.localStorage.setItem("bestResult",GAME_.score)),d.classList.add("new"),GAME_.newRecord=!0,GAME_.screenshot.service)&&(GAME_.screenshot.callback=e=>{m.replaceChild(e,m.querySelector("img")),m.classList.add("display")},GAME_.screenshot.enable=!0),GAME_.zoomOut.service&&(GAME_.zoomOut.enable=!0),i=localStorage.getItem("installDismissed")??!1,!enableDownload||"false"!=i&&i||(document.querySelector("#pwa-install").classList.add("display"),0{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),outBoxArr.forEach(e=>{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),stackBoxArr=[],outBoxArr=[],GAME_.score=0,GAME_.combo=0,A(),E(0,0,boxSize.x,boxSize.z,"x"),document.querySelector("#pwa-install").classList.remove("display"),m.classList.remove("display"),document.querySelector("#noti-popup").classList.remove("display")):(GAME_.fpsCtrl.fps=GAME_.fpsCtrl.forceLag?GAME_.fpsCtrl.fps/2:GAME_.fpsCtrl.fps,GAME_.fpsCtrl.fpsInterval=1e3/GAME_.fpsCtrl.fps,GAME_.fpsCtrl.then=f(),_(),GAME_.active=!0,d.querySelector(".score").innerHTML="SCORE"),g(GAME_.score),E(0,0,boxSize.x,boxSize.z,"z"),c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.newRecord&&(GAME_.newRecord=!1,d.classList.remove("new")),GAME_.status=!0,GAME_.end=!1),A(hslDark=GAME_.end)};o="ontouchstart"in window||navigator.msMaxTouchPoints?"touchstart":"mousedown";e.addEventListener(o,fncStart);let n=!0;window.addEventListener("keydown",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(e.preventDefault(),n&&(n=!1,fncStart()))}),window.addEventListener("keyup",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(n=!0)}),window.addEventListener("resize",e=>{cameraPos.height=c_width*(window.innerHeight/window.innerWidth),cameraPos.size=700{await Blob2Share(GAME_.screenshot.blob)||t("Unable to share. Take screenshot 📸")})});
\ No newline at end of file
+ `);let c=document.querySelector(".result-area"),l=document.querySelector(".point-result"),d=document.querySelector(".score-tab"),p=document.querySelector(".combo-strike"),h=document.querySelector(".combo-extra-point");var e=document.querySelector("#click-event");let m=document.querySelector("#record-share");function A(e=!1){let t=w(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2]);scene.background=new THREE.Color(t),e&&(t=w(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],10)),document.querySelector('meta[name="theme-color"]').setAttribute("content",t),document.body.style.backgroundColor=t,"windows"===GAME_.platform&&document.querySelector('meta[name="msapplication-TileColor"]').setAttribute("content",t)}function g(e){l.innerHTML=e}function E(e,t,o,n,r){e=u(e,boxSize.y*stackBoxArr.length,t,o,n,!1);e.direction=r,e.positive=!0,stackBoxArr.push(e)}function u(e,t,o,n,r,a=!1){var s=a?4*(stackBoxArr.length-1):4*stackBoxArr.length,s=new THREE.Color(w(colorDesign[GAME_.designPalette][0]+s,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2])),i=new THREE.BoxGeometry(n,boxSize.y,r),s=new THREE.MeshLambertMaterial({color:s}),c=new THREE.Mesh(i,s),l=(c.position.set(e,t,o),new CANNON.Box(new CANNON.Vec3(n/2,boxSize.y/2,r/2))),a=new CANNON.Body({mass:a?5:0,shape:l});return a.position.set(e,t,o),world.addBody(a),scene.add(c),{threejs:c,geometry:i,material:s,cannonjs:a,x:e,y:t,z:o,width:n,depth:r}}function w(t,e,o){o=101{e=(e+t/30)%12,e=o-n*Math.max(Math.min(e-3,9-e,1),-1);return Math.round(255*e).toString(16).padStart(2,"0")};return"#"+e(0)+e(8)+e(4)}function M(){camera.right=cameraPos.width/cameraPos.size,camera.left=cameraPos.width/-cameraPos.size,camera.top=cameraPos.height/cameraPos.size,camera.bottom=cameraPos.height/-cameraPos.size,camera.updateProjectionMatrix()}function f(){return"now"in window?now():("now"in performance&&"performance"in window?performance:Date).now()}function t(){cameraPos.height=c_width*(window.innerHeight/window.innerWidth),cameraPos.size=700document.querySelector("#noti-popup").classList.remove("display"),5200)}(world=new CANNON.World).gravity.set(0,-9.8,0),world.broadphase=new CANNON.NaiveBroadphase,world.solver.interations=40,g(GAME_.bestResult),scene=new THREE.Scene,A(hslDark=!0),E(0,0,boxSize.x,boxSize.z,"x");var n=new THREE.AmbientLight(16777215,.6),n=(scene.add(n),new THREE.DirectionalLight(16777215,.6));function r(){var e,t;GAME_.end?(stackBoxArr[stackBoxArr.length-1].threejs.position.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.position),stackBoxArr[stackBoxArr.length-1].threejs.quaternion.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.quaternion),GAME_.zoomOut.enable&&(cameraPos.size-=.02,M(),GAME_.zoomOut.frames++,20<=GAME_.zoomOut.frames)&&(GAME_.zoomOut.enable=!1,GAME_.zoomOut.frames=0,GAME_.zoomOut.finished=!0)):(t=(e=stackBoxArr[stackBoxArr.length-1]).positive?.15:-.15,e.threejs.position[e.direction]>=boxSize.range-5&&(e.positive=!1),e.threejs.position[e.direction]<=-(boxSize.range-5)&&(e.positive=!0),e.threejs.position[e.direction]+=t,e.cannonjs.position[e.direction]+=t,camera.position.y{e.threejs.position.copy(e.cannonjs.position),e.threejs.quaternion.copy(e.cannonjs.quaternion)}),renderer.render(scene,camera),GAME_.screenshot.enable&&(5<=GAME_.screenshot.frames?GAME_.zoomOut.finished&&(DrawCanvasCopy(renderer.domElement,e=>{e.fillStyle="rgba(0, 0, 0, 0.2)",e.fillRect(0,0,e.canvas.width,e.canvas.height),e.fillStyle="#ffffff",e.font="32px monospace";var t="NEW RECORD",o=e.measureText(t).width;e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2-100),e.font="bold 64px monospace",t=GAME_.score,o=e.measureText(t).width,e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2+50),GAME_.botMode&&(e.save(),e.translate(e.canvas.width/2,e.canvas.height/2+50),e.rotate(-Math.PI/8),e.fillStyle="rgba(255, 0, 0, 0.6)",e.font="bold 64px monospace",o=e.measureText(t="FAKE").width,e.fillText(t,-o/2,0),e.strokeStyle="rgba(255, 0, 0, 0.5)",e.lineWidth=5,e.strokeRect(-(o/2+10),-51.152,o+20,56.152),e.restore())},e=>{var t=document.createElement("img");const o=URL.createObjectURL(e);t.onload=()=>{URL.revokeObjectURL(o)},t.src=o,GAME_.screenshot.blob=e,GAME_.screenshot.callback(t)}),GAME_.screenshot.enable=!1,GAME_.screenshot.frames=0):GAME_.screenshot.frames++)}function _(){requestAnimationFrame(_),GAME_.fpsCtrl.now=f(),GAME_.fpsCtrl.elapsed=GAME_.fpsCtrl.now-GAME_.fpsCtrl.then,GAME_.fpsCtrl.elapsed>GAME_.fpsCtrl.fpsInterval&&(GAME_.fpsCtrl.mFps=Math.round(1e3/GAME_.fpsCtrl.elapsed)-(GAME_.fpsCtrl.forceLag?30:0),GAME_.fpsCtrl.mFps{var e,t,o,n,r,a,s,i;GAME_.status?(o=stackBoxArr[stackBoxArr.length-1],r=stackBoxArr[stackBoxArr.length-2],n=o.direction,r=o.threejs.position[n]-r.threejs.position[n],i=Math.abs(r),0<(a=(s="x"===n?o.width:o.depth)-i)?(s=a/s,i<.2?([9,19,29,39,49].includes(GAME_.combo)&&(h.classList.add("active"),setTimeout(()=>{h.classList.remove("active")},1100),GAME_.score+=10),GAME_.combo+=1,p.innerHTML="x"+GAME_.combo,p.classList.add("open"),setTimeout(()=>{p.classList.remove("open")},700)):GAME_.combo&&(GAME_.combo=0),e="x"===n?a:o.width,t="z"===n?a:o.depth,o.width=e,o.depth=t,o.threejs.scale[n]=s,o.threejs.position[n]-=r/2,o.cannonjs.position[n]-=r/2,s=new CANNON.Box(new CANNON.Vec3(e/2,boxSize.y/2,t/2)),o.cannonjs.shapes=[],o.cannonjs.addShape(s),.01<=i&&(s=Math.sign(r)*(a/2+i/2),r={x:"x"===n?o.threejs.position.x+s:o.threejs.position.x,z:"z"===n?o.threejs.position.z+s:o.threejs.position.z,width:"x"===n?i:e,depth:"z"===n?i:t},a=r.z,s=r.width,i=r.depth,r=u(r=r.x,boxSize.y*(stackBoxArr.length-1),a,s,i,!0),outBoxArr.push(r)),E("x"===n?o.threejs.position.x:-(boxSize.range-1),"z"===n?o.threejs.position.z:-(boxSize.range-1),e,t,"x"===n?"z":"x"),GAME_.score++,g(GAME_.score)):(GAME_.end=!0,world.remove(o.cannonjs),a=new CANNON.Box(new CANNON.Vec3(o.width/2,boxSize.y/2,o.depth/2)),(s=new CANNON.Body({mass:5,shape:a})).position.set(o.threejs.position.x,o.threejs.position.y,o.threejs.position.z),world.addBody(s),o.cannonjs=s,c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.status=!1,GAME_.score>GAME_.bestResult&&(playConfetti(GAME_.confetti.range[0],GAME_.confetti.range[1]),GAME_.botMode||(GAME_.bestResult=GAME_.score,window.localStorage.setItem("bestResult",GAME_.score)),d.classList.add("new"),GAME_.newRecord=!0,GAME_.screenshot.service)&&(GAME_.screenshot.callback=e=>{m.replaceChild(e,m.querySelector("img")),m.classList.add("display")},GAME_.screenshot.enable=!0),GAME_.zoomOut.service&&(GAME_.zoomOut.enable=!0),i=localStorage.getItem("installDismissed")??!1,!enableDownload||"false"!=i&&i||(document.querySelector("#pwa-install").classList.add("display"),0{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),outBoxArr.forEach(e=>{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),stackBoxArr=[],outBoxArr=[],GAME_.score=0,GAME_.combo=0,A(),E(0,0,boxSize.x,boxSize.z,"x"),document.querySelector("#pwa-install").classList.remove("display"),m.classList.remove("display"),document.querySelector("#noti-popup").classList.remove("display")):(GAME_.fpsCtrl.fps=GAME_.fpsCtrl.forceLag?GAME_.fpsCtrl.fps/2:GAME_.fpsCtrl.fps,GAME_.fpsCtrl.fpsInterval=1e3/GAME_.fpsCtrl.fps,GAME_.fpsCtrl.then=f(),_(),GAME_.active=!0,d.querySelector(".score").innerHTML="SCORE"),g(GAME_.score),E(0,0,boxSize.x,boxSize.z,"z"),c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.newRecord&&(GAME_.newRecord=!1,d.classList.remove("new")),GAME_.status=!0,GAME_.end=!1),A(hslDark=GAME_.end)};n="ontouchstart"in window||navigator.msMaxTouchPoints?"touchstart":"mousedown";e.addEventListener(n,fncStart);let a=!0;window.addEventListener("keydown",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(e.preventDefault(),a&&(a=!1,fncStart()))}),window.addEventListener("keyup",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(a=!0)}),window.addEventListener("resize",e=>t()),window.addEventListener("orientationchange",e=>{t()}),m.addEventListener(n,async()=>{await Blob2Share(GAME_.screenshot.blob)||o("Unable to share. Take screenshot 📸")})});
\ No newline at end of file
From 27ddaa04ac45e51fa2f5ceb57801d992f2549aa8 Mon Sep 17 00:00:00 2001
From: ZhengLinLei
Date: Wed, 8 Nov 2023 19:43:48 +0100
Subject: [PATCH 3/4] Fixed iPhone record share #67
---
js/lib/png2share.js | 10 +++++++---
js/lib/png2share.min.js | 2 +-
js/script.js | 2 +-
js/script.min.js | 4 ++--
4 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/js/lib/png2share.js b/js/lib/png2share.js
index 18d5a43..36d84b8 100644
--- a/js/lib/png2share.js
+++ b/js/lib/png2share.js
@@ -82,17 +82,21 @@ const DrawCanvasCopy = (canvas, callback, callbackBlob) => {
// Stackblock: https://stackoverflow.com/questions/68362603/share-image-via-social-media-from-pwa
//
// Convert blob to image share
-const Blob2Share = async(blob) => {
+const Blob2Share = async(blob, emptyText = false) => {
let tries = 0, maxTries = 3;
if (!('share' in navigator) || !('canShare' in navigator)) {
return false;
}
const files = [new File([blob], 'newRecord.png', { type: blob.type })];
const shareData = {
- text: 'Play with me. In Stackblock.io',
- title: 'Stackblock.io',
files,
};
+ // Add only if it's not IOS
+ if(!emptyText) {
+ shareData.title = 'Stackblock.io';
+ shareData.text = 'Play with me. In Stackblock.io';
+ }
+
if (navigator.canShare(shareData)) {
while(true) {
try {
diff --git a/js/lib/png2share.min.js b/js/lib/png2share.min.js
index 02a9299..bef0be4 100644
--- a/js/lib/png2share.min.js
+++ b/js/lib/png2share.min.js
@@ -1 +1 @@
-function getPixels3d(e){var t=e.canvas,a=t.height,n=t.width,n=new Uint8Array(n*a*4);return e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,n),n}function getPixels2d(e){var t=e.canvas,a=t.height,t=t.width;return e.getImageData(0,0,t,a).data}const Webgl2canvas=(e,t)=>{var a,t=t?t.canvas||t:document.createElement("canvas"),n=t.getContext("2d");return e=e instanceof WebGLRenderingContext?e:e.getContext("webgl2")||e.getContext("webgl")||e.getContext("experimental-webgl"),t.width=e.canvas.width,t.height=e.canvas.height,(a=n.getImageData(0,0,t.width,t.height)).data.set(new Uint8ClampedArray(getPixels3d(e).buffer)),n.putImageData(a,0,0),n.translate(0,t.height),n.scale(1,-1),n.drawImage(t,0,0),n.setTransform(1,0,0,1,0,0),t},DrawCanvasCopy=(e,t,a)=>{e=Webgl2canvas(e);t(e.getContext("2d")),e.toBlob(a),e.remove()},Blob2Share=async e=>{let t=0;if(!("share"in navigator&&"canShare"in navigator))return!1;var a={text:"Play with me. In Stackblock.io",title:"Stackblock.io",files:[new File([e],"newRecord.png",{type:e.type})]};if(!navigator.canShare(a))return console.warn("Sharing not supported",a),!1;for(;;)try{return await navigator.share(a),!0}catch(e){if("AbortError"===e.name&&"aborterror"===e.name.toLowerCase())return!0;if(3<=t)return!1;t++}},Blob2Download=e=>{var t=document.createElement("a"),e=window.URL.createObjectURL(e);t.href=e,t.download="StackBlock_newRecord.png",t.click(),window.URL.revokeObjectURL(e),t.remove()};
\ No newline at end of file
+function getPixels3d(e){var t=e.canvas,a=t.height,n=t.width,n=new Uint8Array(n*a*4);return e.readPixels(0,0,t.width,t.height,e.RGBA,e.UNSIGNED_BYTE,n),n}function getPixels2d(e){var t=e.canvas,a=t.height,t=t.width;return e.getImageData(0,0,t,a).data}const Webgl2canvas=(e,t)=>{var a,t=t?t.canvas||t:document.createElement("canvas"),n=t.getContext("2d");return e=e instanceof WebGLRenderingContext?e:e.getContext("webgl2")||e.getContext("webgl")||e.getContext("experimental-webgl"),t.width=e.canvas.width,t.height=e.canvas.height,(a=n.getImageData(0,0,t.width,t.height)).data.set(new Uint8ClampedArray(getPixels3d(e).buffer)),n.putImageData(a,0,0),n.translate(0,t.height),n.scale(1,-1),n.drawImage(t,0,0),n.setTransform(1,0,0,1,0,0),t},DrawCanvasCopy=(e,t,a)=>{e=Webgl2canvas(e);t(e.getContext("2d")),e.toBlob(a),e.remove()},Blob2Share=async(e,t=!1)=>{let a=0;if(!("share"in navigator&&"canShare"in navigator))return!1;var n={files:[new File([e],"newRecord.png",{type:e.type})]};if(t||(n.title="Stackblock.io",n.text="Play with me. In Stackblock.io"),!navigator.canShare(n))return console.warn("Sharing not supported",n),!1;for(;;)try{return await navigator.share(n),!0}catch(e){if("AbortError"===e.name&&"aborterror"===e.name.toLowerCase())return!0;if(3<=a)return!1;a++}},Blob2Download=e=>{var t=document.createElement("a"),e=window.URL.createObjectURL(e);t.href=e,t.download="StackBlock_newRecord.png",t.click(),window.URL.revokeObjectURL(e),t.remove()};
\ No newline at end of file
diff --git a/js/script.js b/js/script.js
index 56c3740..4d21f05 100644
--- a/js/script.js
+++ b/js/script.js
@@ -815,7 +815,7 @@ window.addEventListener('load', ()=>{
// SHARE RECORD
recordShare.addEventListener(eventType, async () => {
- if(!(await Blob2Share(GAME_.screenshot.blob))){
+ if(!(await Blob2Share(GAME_.screenshot.blob, (GAME_.platform == 'ios' ? true : false)))){
// Blob2Download(GAME_.screenshot.blob); ---> We don't want surprise downloads
alertLog("Unable to share. Take screenshot 📸");
}
diff --git a/js/script.min.js b/js/script.min.js
index c6073ff..89ffa87 100644
--- a/js/script.min.js
+++ b/js/script.min.js
@@ -1,4 +1,4 @@
-let GAME_={platform:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?"ios":navigator.userAgent.match(/(Android)/g)?"android":navigator.userAgent.match(/(Windows)/g)?"windows":navigator.userAgent.match(/(Mac)/g)?"mac":navigator.userAgent.match(/(Linux)/g)?"linux":"unknown",status:!1,fpsCtrl:{forceLag:!1,fps:60,mFps:0,fpsInterval:0,now:0,then:0,delta:0,lagWarning:{enable:!0,lastWarning:0}},end:!1,active:!1,score:0,combo:0,gamesPlayed:0,bestResult:window.localStorage.getItem("bestResult")?window.localStorage.getItem("bestResult"):0,newRecord:!1,designPalette:0,screenshot:{service:!0,enable:!1,frames:0,callback:null,blob:null},botMode:!1,confetti:{range:[30,50]},zoomOut:{service:!0,enable:!1,frames:0,finished:!1}};const colorDesign=[[30,70,50],[120,80,60],[224,68,62],[251,50,60],[339,62,48],[231,50,47],[165,30,68]],boxSize={x:3,y:1,z:3,range:10},c_width=10,cameraPos={width:c_width,height:c_width*(window.innerHeight/window.innerWidth),near:1,far:100,size:700{try{var e=stackBoxArr[stackBoxArr.length-1],t=stackBoxArr[stackBoxArr.length-2],o=e.direction,n=e.threejs.position[o]-t.threejs.position[o],r=Math.abs(n),a="x"===o?e.width:e.depth,s=(a-r)/a;(i||.95)<=s&&(fncStart(),c)&&console.log(s)}catch(e){fncStart()}},e||20)}window.addEventListener("load",()=>{"ios"===GAME_.platform&&navigator.userAgent.match(/(Safari)/g)&&(document.querySelector(".pwa-install-title").innerText="Apple StackBlock.io",document.querySelector(".pwa-install-description").innerHTML='Download the APP in ',document.querySelector(".pwa-install-button").innerHTML=`
+let GAME_={platform:navigator.userAgent.match(/(iPad|iPhone|iPod)/g)?"ios":navigator.userAgent.match(/(Android)/g)?"android":navigator.userAgent.match(/(Windows)/g)?"windows":navigator.userAgent.match(/(Mac)/g)?"mac":navigator.userAgent.match(/(Linux)/g)?"linux":"unknown",status:!1,fpsCtrl:{forceLag:!1,fps:60,mFps:0,fpsInterval:0,now:0,then:0,delta:0,lagWarning:{enable:!0,lastWarning:0,frames:0,framesMax:180}},end:!1,active:!1,score:0,combo:0,gamesPlayed:0,bestResult:window.localStorage.getItem("bestResult")?window.localStorage.getItem("bestResult"):0,newRecord:!1,designPalette:0,screenshot:{service:!0,enable:!1,frames:0,framesMax:5,callback:null,blob:null},botMode:!1,confetti:{range:[30,50]},zoomOut:{service:!0,enable:!1,frames:0,framesMax:20,finished:!1}};const colorDesign=[[30,70,50],[120,80,60],[224,68,62],[251,50,60],[339,62,48],[231,50,47],[165,30,68]],boxSize={x:3,y:1,z:3,range:10},c_width=10,cameraPos={width:c_width,height:c_width*(window.innerHeight/window.innerWidth),near:1,far:100,size:700{try{var e=stackBoxArr[stackBoxArr.length-1],t=stackBoxArr[stackBoxArr.length-2],o=e.direction,r=e.threejs.position[o]-t.threejs.position[o],n=Math.abs(r),a="x"===o?e.width:e.depth,s=(a-n)/a;(i||.95)<=s&&(fncStart(),c)&&console.log(s)}catch(e){fncStart()}},e||20)}window.addEventListener("load",()=>{"ios"===GAME_.platform&&navigator.userAgent.match(/(Safari)/g)&&(document.querySelector(".pwa-install-title").innerText="Apple StackBlock.io",document.querySelector(".pwa-install-description").innerHTML='Download the APP in ',document.querySelector(".pwa-install-button").innerHTML=`
Not now
See more
- `);let c=document.querySelector(".result-area"),l=document.querySelector(".point-result"),d=document.querySelector(".score-tab"),p=document.querySelector(".combo-strike"),h=document.querySelector(".combo-extra-point");var e=document.querySelector("#click-event");let m=document.querySelector("#record-share");function A(e=!1){let t=w(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2]);scene.background=new THREE.Color(t),e&&(t=w(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],10)),document.querySelector('meta[name="theme-color"]').setAttribute("content",t),document.body.style.backgroundColor=t,"windows"===GAME_.platform&&document.querySelector('meta[name="msapplication-TileColor"]').setAttribute("content",t)}function g(e){l.innerHTML=e}function E(e,t,o,n,r){e=u(e,boxSize.y*stackBoxArr.length,t,o,n,!1);e.direction=r,e.positive=!0,stackBoxArr.push(e)}function u(e,t,o,n,r,a=!1){var s=a?4*(stackBoxArr.length-1):4*stackBoxArr.length,s=new THREE.Color(w(colorDesign[GAME_.designPalette][0]+s,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2])),i=new THREE.BoxGeometry(n,boxSize.y,r),s=new THREE.MeshLambertMaterial({color:s}),c=new THREE.Mesh(i,s),l=(c.position.set(e,t,o),new CANNON.Box(new CANNON.Vec3(n/2,boxSize.y/2,r/2))),a=new CANNON.Body({mass:a?5:0,shape:l});return a.position.set(e,t,o),world.addBody(a),scene.add(c),{threejs:c,geometry:i,material:s,cannonjs:a,x:e,y:t,z:o,width:n,depth:r}}function w(t,e,o){o=101{e=(e+t/30)%12,e=o-n*Math.max(Math.min(e-3,9-e,1),-1);return Math.round(255*e).toString(16).padStart(2,"0")};return"#"+e(0)+e(8)+e(4)}function M(){camera.right=cameraPos.width/cameraPos.size,camera.left=cameraPos.width/-cameraPos.size,camera.top=cameraPos.height/cameraPos.size,camera.bottom=cameraPos.height/-cameraPos.size,camera.updateProjectionMatrix()}function f(){return"now"in window?now():("now"in performance&&"performance"in window?performance:Date).now()}function t(){cameraPos.height=c_width*(window.innerHeight/window.innerWidth),cameraPos.size=700document.querySelector("#noti-popup").classList.remove("display"),5200)}(world=new CANNON.World).gravity.set(0,-9.8,0),world.broadphase=new CANNON.NaiveBroadphase,world.solver.interations=40,g(GAME_.bestResult),scene=new THREE.Scene,A(hslDark=!0),E(0,0,boxSize.x,boxSize.z,"x");var n=new THREE.AmbientLight(16777215,.6),n=(scene.add(n),new THREE.DirectionalLight(16777215,.6));function r(){var e,t;GAME_.end?(stackBoxArr[stackBoxArr.length-1].threejs.position.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.position),stackBoxArr[stackBoxArr.length-1].threejs.quaternion.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.quaternion),GAME_.zoomOut.enable&&(cameraPos.size-=.02,M(),GAME_.zoomOut.frames++,20<=GAME_.zoomOut.frames)&&(GAME_.zoomOut.enable=!1,GAME_.zoomOut.frames=0,GAME_.zoomOut.finished=!0)):(t=(e=stackBoxArr[stackBoxArr.length-1]).positive?.15:-.15,e.threejs.position[e.direction]>=boxSize.range-5&&(e.positive=!1),e.threejs.position[e.direction]<=-(boxSize.range-5)&&(e.positive=!0),e.threejs.position[e.direction]+=t,e.cannonjs.position[e.direction]+=t,camera.position.y{e.threejs.position.copy(e.cannonjs.position),e.threejs.quaternion.copy(e.cannonjs.quaternion)}),renderer.render(scene,camera),GAME_.screenshot.enable&&(5<=GAME_.screenshot.frames?GAME_.zoomOut.finished&&(DrawCanvasCopy(renderer.domElement,e=>{e.fillStyle="rgba(0, 0, 0, 0.2)",e.fillRect(0,0,e.canvas.width,e.canvas.height),e.fillStyle="#ffffff",e.font="32px monospace";var t="NEW RECORD",o=e.measureText(t).width;e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2-100),e.font="bold 64px monospace",t=GAME_.score,o=e.measureText(t).width,e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2+50),GAME_.botMode&&(e.save(),e.translate(e.canvas.width/2,e.canvas.height/2+50),e.rotate(-Math.PI/8),e.fillStyle="rgba(255, 0, 0, 0.6)",e.font="bold 64px monospace",o=e.measureText(t="FAKE").width,e.fillText(t,-o/2,0),e.strokeStyle="rgba(255, 0, 0, 0.5)",e.lineWidth=5,e.strokeRect(-(o/2+10),-51.152,o+20,56.152),e.restore())},e=>{var t=document.createElement("img");const o=URL.createObjectURL(e);t.onload=()=>{URL.revokeObjectURL(o)},t.src=o,GAME_.screenshot.blob=e,GAME_.screenshot.callback(t)}),GAME_.screenshot.enable=!1,GAME_.screenshot.frames=0):GAME_.screenshot.frames++)}function _(){requestAnimationFrame(_),GAME_.fpsCtrl.now=f(),GAME_.fpsCtrl.elapsed=GAME_.fpsCtrl.now-GAME_.fpsCtrl.then,GAME_.fpsCtrl.elapsed>GAME_.fpsCtrl.fpsInterval&&(GAME_.fpsCtrl.mFps=Math.round(1e3/GAME_.fpsCtrl.elapsed)-(GAME_.fpsCtrl.forceLag?30:0),GAME_.fpsCtrl.mFps{var e,t,o,n,r,a,s,i;GAME_.status?(o=stackBoxArr[stackBoxArr.length-1],r=stackBoxArr[stackBoxArr.length-2],n=o.direction,r=o.threejs.position[n]-r.threejs.position[n],i=Math.abs(r),0<(a=(s="x"===n?o.width:o.depth)-i)?(s=a/s,i<.2?([9,19,29,39,49].includes(GAME_.combo)&&(h.classList.add("active"),setTimeout(()=>{h.classList.remove("active")},1100),GAME_.score+=10),GAME_.combo+=1,p.innerHTML="x"+GAME_.combo,p.classList.add("open"),setTimeout(()=>{p.classList.remove("open")},700)):GAME_.combo&&(GAME_.combo=0),e="x"===n?a:o.width,t="z"===n?a:o.depth,o.width=e,o.depth=t,o.threejs.scale[n]=s,o.threejs.position[n]-=r/2,o.cannonjs.position[n]-=r/2,s=new CANNON.Box(new CANNON.Vec3(e/2,boxSize.y/2,t/2)),o.cannonjs.shapes=[],o.cannonjs.addShape(s),.01<=i&&(s=Math.sign(r)*(a/2+i/2),r={x:"x"===n?o.threejs.position.x+s:o.threejs.position.x,z:"z"===n?o.threejs.position.z+s:o.threejs.position.z,width:"x"===n?i:e,depth:"z"===n?i:t},a=r.z,s=r.width,i=r.depth,r=u(r=r.x,boxSize.y*(stackBoxArr.length-1),a,s,i,!0),outBoxArr.push(r)),E("x"===n?o.threejs.position.x:-(boxSize.range-1),"z"===n?o.threejs.position.z:-(boxSize.range-1),e,t,"x"===n?"z":"x"),GAME_.score++,g(GAME_.score)):(GAME_.end=!0,world.remove(o.cannonjs),a=new CANNON.Box(new CANNON.Vec3(o.width/2,boxSize.y/2,o.depth/2)),(s=new CANNON.Body({mass:5,shape:a})).position.set(o.threejs.position.x,o.threejs.position.y,o.threejs.position.z),world.addBody(s),o.cannonjs=s,c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.status=!1,GAME_.score>GAME_.bestResult&&(playConfetti(GAME_.confetti.range[0],GAME_.confetti.range[1]),GAME_.botMode||(GAME_.bestResult=GAME_.score,window.localStorage.setItem("bestResult",GAME_.score)),d.classList.add("new"),GAME_.newRecord=!0,GAME_.screenshot.service)&&(GAME_.screenshot.callback=e=>{m.replaceChild(e,m.querySelector("img")),m.classList.add("display")},GAME_.screenshot.enable=!0),GAME_.zoomOut.service&&(GAME_.zoomOut.enable=!0),i=localStorage.getItem("installDismissed")??!1,!enableDownload||"false"!=i&&i||(document.querySelector("#pwa-install").classList.add("display"),0{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),outBoxArr.forEach(e=>{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),stackBoxArr=[],outBoxArr=[],GAME_.score=0,GAME_.combo=0,A(),E(0,0,boxSize.x,boxSize.z,"x"),document.querySelector("#pwa-install").classList.remove("display"),m.classList.remove("display"),document.querySelector("#noti-popup").classList.remove("display")):(GAME_.fpsCtrl.fps=GAME_.fpsCtrl.forceLag?GAME_.fpsCtrl.fps/2:GAME_.fpsCtrl.fps,GAME_.fpsCtrl.fpsInterval=1e3/GAME_.fpsCtrl.fps,GAME_.fpsCtrl.then=f(),_(),GAME_.active=!0,d.querySelector(".score").innerHTML="SCORE"),g(GAME_.score),E(0,0,boxSize.x,boxSize.z,"z"),c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.newRecord&&(GAME_.newRecord=!1,d.classList.remove("new")),GAME_.status=!0,GAME_.end=!1),A(hslDark=GAME_.end)};n="ontouchstart"in window||navigator.msMaxTouchPoints?"touchstart":"mousedown";e.addEventListener(n,fncStart);let a=!0;window.addEventListener("keydown",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(e.preventDefault(),a&&(a=!1,fncStart()))}),window.addEventListener("keyup",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(a=!0)}),window.addEventListener("resize",e=>t()),window.addEventListener("orientationchange",e=>{t()}),m.addEventListener(n,async()=>{await Blob2Share(GAME_.screenshot.blob)||o("Unable to share. Take screenshot 📸")})});
\ No newline at end of file
+ `);let c=document.querySelector(".result-area"),l=document.querySelector(".point-result"),d=document.querySelector(".score-tab"),p=document.querySelector(".combo-strike"),m=document.querySelector(".combo-extra-point");var e=document.querySelector("#click-event");let h=document.querySelector("#record-share");function A(e=!1){let t=u(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2]);scene.background=new THREE.Color(t),e&&(t=u(colorDesign[GAME_.designPalette][0]+120+stackBoxArr.length,colorDesign[GAME_.designPalette][1],10)),document.querySelector('meta[name="theme-color"]').setAttribute("content",t),document.body.style.backgroundColor=t,"windows"===GAME_.platform&&document.querySelector('meta[name="msapplication-TileColor"]').setAttribute("content",t)}function g(e){l.innerHTML=e}function E(e,t,o,r,n){e=M(e,boxSize.y*stackBoxArr.length,t,o,r,!1);e.direction=n,e.positive=!0,stackBoxArr.push(e)}function M(e,t,o,r,n,a=!1){var s=a?4*(stackBoxArr.length-1):4*stackBoxArr.length,s=new THREE.Color(u(colorDesign[GAME_.designPalette][0]+s,colorDesign[GAME_.designPalette][1],colorDesign[GAME_.designPalette][2])),i=new THREE.BoxGeometry(r,boxSize.y,n),s=new THREE.MeshLambertMaterial({color:s}),c=new THREE.Mesh(i,s),l=(c.position.set(e,t,o),new CANNON.Box(new CANNON.Vec3(r/2,boxSize.y/2,n/2))),a=new CANNON.Body({mass:a?5:0,shape:l});return a.position.set(e,t,o),world.addBody(a),scene.add(c),{threejs:c,geometry:i,material:s,cannonjs:a,x:e,y:t,z:o,width:r,depth:n}}function u(t,e,o){o=101{e=(e+t/30)%12,e=o-r*Math.max(Math.min(e-3,9-e,1),-1);return Math.round(255*e).toString(16).padStart(2,"0")};return"#"+e(0)+e(8)+e(4)}function f(){camera.right=cameraPos.width/cameraPos.size,camera.left=cameraPos.width/-cameraPos.size,camera.top=cameraPos.height/cameraPos.size,camera.bottom=cameraPos.height/-cameraPos.size,camera.updateProjectionMatrix()}function w(){return"now"in window?now():("now"in performance&&"performance"in window?performance:Date).now()}function t(){cameraPos.height=c_width*(window.innerHeight/window.innerWidth),cameraPos.size=700document.querySelector("#noti-popup").classList.remove("display"),5200)}(world=new CANNON.World).gravity.set(0,-9.8,0),world.broadphase=new CANNON.NaiveBroadphase,world.solver.interations=40,g(GAME_.bestResult),scene=new THREE.Scene,A(hslDark=!0),E(0,0,boxSize.x,boxSize.z,"x");var r=new THREE.AmbientLight(16777215,.6),r=(scene.add(r),new THREE.DirectionalLight(16777215,.6));function n(){var e,t;GAME_.end?(stackBoxArr[stackBoxArr.length-1].threejs.position.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.position),stackBoxArr[stackBoxArr.length-1].threejs.quaternion.copy(stackBoxArr[stackBoxArr.length-1].cannonjs.quaternion),GAME_.zoomOut.enable&&(cameraPos.size-=.02,f(),GAME_.zoomOut.frames++,GAME_.zoomOut.frames>=GAME_.zoomOut.framesMax)&&(GAME_.zoomOut.enable=!1,GAME_.zoomOut.frames=0,GAME_.zoomOut.finished=!0)):(t=(e=stackBoxArr[stackBoxArr.length-1]).positive?.15:-.15,e.threejs.position[e.direction]>=boxSize.range-5&&(e.positive=!1),e.threejs.position[e.direction]<=-(boxSize.range-5)&&(e.positive=!0),e.threejs.position[e.direction]+=t,e.cannonjs.position[e.direction]+=t,camera.position.y{e.threejs.position.copy(e.cannonjs.position),e.threejs.quaternion.copy(e.cannonjs.quaternion)}),renderer.render(scene,camera),GAME_.screenshot.enable&&(GAME_.screenshot.frames>=GAME_.screenshot.framesMax?GAME_.zoomOut.finished&&(DrawCanvasCopy(renderer.domElement,e=>{e.fillStyle="rgba(0, 0, 0, 0.2)",e.fillRect(0,0,e.canvas.width,e.canvas.height),e.fillStyle="#ffffff",e.font="32px monospace";var t="NEW RECORD",o=e.measureText(t).width;e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2-100),e.font="bold 64px monospace",t=GAME_.score,o=e.measureText(t).width,e.fillText(t,e.canvas.width/2-o/2,e.canvas.height/2+50),GAME_.botMode&&(e.save(),e.translate(e.canvas.width/2,e.canvas.height/2+50),e.rotate(-Math.PI/8),e.fillStyle="rgba(255, 0, 0, 0.6)",e.font="bold 64px monospace",o=e.measureText(t="FAKE").width,e.fillText(t,-o/2,0),e.strokeStyle="rgba(255, 0, 0, 0.5)",e.lineWidth=5,e.strokeRect(-(o/2+10),-51.152,o+20,56.152),e.restore())},e=>{var t=document.createElement("img");const o=URL.createObjectURL(e);t.onload=()=>{URL.revokeObjectURL(o)},t.src=o,GAME_.screenshot.blob=e,GAME_.screenshot.callback(t)}),GAME_.screenshot.enable=!1,GAME_.screenshot.frames=0):GAME_.screenshot.frames++)}function _(){requestAnimationFrame(_),GAME_.fpsCtrl.now=w(),GAME_.fpsCtrl.elapsed=GAME_.fpsCtrl.now-GAME_.fpsCtrl.then,GAME_.fpsCtrl.elapsed>GAME_.fpsCtrl.fpsInterval&&(GAME_.fpsCtrl.mFps=Math.round(1e3/GAME_.fpsCtrl.elapsed)-(GAME_.fpsCtrl.forceLag?30:0),GAME_.fpsCtrl.mFps=GAME_.fpsCtrl.lagWarning.framesMax?(GAME_.fpsCtrl.lagWarning.lastWarning+3e4{var e,t,o,r,n,a,s,i;GAME_.status?(o=stackBoxArr[stackBoxArr.length-1],n=stackBoxArr[stackBoxArr.length-2],r=o.direction,n=o.threejs.position[r]-n.threejs.position[r],i=Math.abs(n),0<(a=(s="x"===r?o.width:o.depth)-i)?(s=a/s,i<.2?([9,19,29,39,49].includes(GAME_.combo)&&(m.classList.add("active"),setTimeout(()=>{m.classList.remove("active")},1100),GAME_.score+=10),GAME_.combo+=1,p.innerHTML="x"+GAME_.combo,p.classList.add("open"),setTimeout(()=>{p.classList.remove("open")},700)):GAME_.combo&&(GAME_.combo=0),e="x"===r?a:o.width,t="z"===r?a:o.depth,o.width=e,o.depth=t,o.threejs.scale[r]=s,o.threejs.position[r]-=n/2,o.cannonjs.position[r]-=n/2,s=new CANNON.Box(new CANNON.Vec3(e/2,boxSize.y/2,t/2)),o.cannonjs.shapes=[],o.cannonjs.addShape(s),.01<=i&&(s=Math.sign(n)*(a/2+i/2),n={x:"x"===r?o.threejs.position.x+s:o.threejs.position.x,z:"z"===r?o.threejs.position.z+s:o.threejs.position.z,width:"x"===r?i:e,depth:"z"===r?i:t},a=n.z,s=n.width,i=n.depth,n=M(n=n.x,boxSize.y*(stackBoxArr.length-1),a,s,i,!0),outBoxArr.push(n)),E("x"===r?o.threejs.position.x:-(boxSize.range-1),"z"===r?o.threejs.position.z:-(boxSize.range-1),e,t,"x"===r?"z":"x"),GAME_.score++,g(GAME_.score)):(GAME_.end=!0,world.remove(o.cannonjs),a=new CANNON.Box(new CANNON.Vec3(o.width/2,boxSize.y/2,o.depth/2)),(s=new CANNON.Body({mass:5,shape:a})).position.set(o.threejs.position.x,o.threejs.position.y,o.threejs.position.z),world.addBody(s),o.cannonjs=s,c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.status=!1,GAME_.score>GAME_.bestResult&&(playConfetti(GAME_.confetti.range[0],GAME_.confetti.range[1]),GAME_.botMode||(GAME_.bestResult=GAME_.score,window.localStorage.setItem("bestResult",GAME_.score)),d.classList.add("new"),GAME_.newRecord=!0,GAME_.screenshot.service)&&(GAME_.screenshot.callback=e=>{h.replaceChild(e,h.querySelector("img")),h.classList.add("display")},GAME_.screenshot.enable=!0),GAME_.zoomOut.service&&(GAME_.zoomOut.enable=!0),i=localStorage.getItem("installDismissed")??!1,!enableDownload||"false"!=i&&i||(document.querySelector("#pwa-install").classList.add("display"),0{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),outBoxArr.forEach(e=>{scene.remove(e.threejs),e.geometry.dispose(),e.material.dispose(),world.removeBody(e.cannonjs)}),stackBoxArr=[],outBoxArr=[],GAME_.score=0,GAME_.combo=0,A(),E(0,0,boxSize.x,boxSize.z,"x"),document.querySelector("#pwa-install").classList.remove("display"),h.classList.remove("display"),document.querySelector("#noti-popup").classList.remove("display")):(GAME_.fpsCtrl.fps=GAME_.fpsCtrl.forceLag?GAME_.fpsCtrl.fps/2:GAME_.fpsCtrl.fps,GAME_.fpsCtrl.fpsInterval=1e3/GAME_.fpsCtrl.fps,GAME_.fpsCtrl.then=w(),_(),GAME_.active=!0,d.querySelector(".score").innerHTML="SCORE"),g(GAME_.score),E(0,0,boxSize.x,boxSize.z,"z"),c.classList.toggle("disable"),l.classList.toggle("active"),GAME_.newRecord&&(GAME_.newRecord=!1,d.classList.remove("new")),GAME_.status=!0,GAME_.end=!1),A(hslDark=GAME_.end)};r="ontouchstart"in window||navigator.msMaxTouchPoints?"touchstart":"mousedown";e.addEventListener(r,fncStart);let a=!0;window.addEventListener("keydown",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(e.preventDefault(),a&&(a=!1,fncStart()))}),window.addEventListener("keyup",function(e){32!==e.keyCode&&40!==e.keyCode&&" "!==e.key||(a=!0)}),window.addEventListener("resize",e=>t()),window.addEventListener("orientationchange",e=>{t()}),h.addEventListener(r,async()=>{await Blob2Share(GAME_.screenshot.blob,"ios"==GAME_.platform)||o("Unable to share. Take screenshot 📸")})});
\ No newline at end of file
From 878e331d2efbffd0d5804b3285bc2abbb73da5be Mon Sep 17 00:00:00 2001
From: Zheng Lin Lei
Date: Thu, 9 Nov 2023 09:16:12 +0100
Subject: [PATCH 4/4] Release v0.1.7
---
CHANGELOG | 12 +++++++++++-
README.md | 2 +-
index.html | 2 +-
sw.js | 2 +-
4 files changed, 14 insertions(+), 4 deletions(-)
diff --git a/CHANGELOG b/CHANGELOG
index 1468723..69cbf0e 100644
--- a/CHANGELOG
+++ b/CHANGELOG
@@ -1,4 +1,14 @@
-v0.1.6 -> 15/10/2023 -----------------------------------> TAG: v0.1.6-beta; v0.1.6-beta.1
+v0.1.6 -> 09/11/2023 -----------------------------------> TAG: v0.1.6.7
+ * Today is my birthday 🎉 *
+ - Fixed Apple Canvas resize and notch problem
+ - Added FPS counter
+ - Added low fps warning
+ - Added iPhone APP install popup
+ - Changed Images folder-name
+ - Added windows 8 support
+ - Fixed iPhone record image share
+
+v0.1.6 -> 15/10/2023 -----------------------------------> TAG: v0.1.6-beta; v0.1.6-beta.1; v0.1.6-beta.2
- Changed PWA
- Added PWA install popup
- Changed playBot() function test
diff --git a/README.md b/README.md
index 322b874..a9d729c 100644
--- a/README.md
+++ b/README.md
@@ -26,7 +26,7 @@ Live web preview [here](https://zhenglinlei.github.io/stackblock.io)
-
+
diff --git a/index.html b/index.html
index 95d8601..6c33c27 100644
--- a/index.html
+++ b/index.html
@@ -82,7 +82,7 @@ BEST SCORE