From 841a001f901bc967aebbff641c8e1152b569d8f4 Mon Sep 17 00:00:00 2001 From: meadowstream Date: Fri, 4 Jul 2014 14:09:14 -0400 Subject: [PATCH] fixed "press p to continue" text occurring in mobile browsers --- index.html | 2 +- js/main.js | 23 +++++++++-------------- js/view.js | 5 +++++ 3 files changed, 15 insertions(+), 15 deletions(-) diff --git a/index.html b/index.html index f754510..8a0fd11 100644 --- a/index.html +++ b/index.html @@ -55,7 +55,7 @@

-
diff --git a/js/main.js b/js/main.js index 89251f4..bf51520 100644 --- a/js/main.js +++ b/js/main.js @@ -1,5 +1,4 @@ var textShown = false; -var showingHelp = false; $(document).ready(function(){ scaleCanvas(); $('#startBtn').on('touchstart mousedown', function(){ @@ -10,9 +9,9 @@ $(document).ready(function(){ } setTimeout(function(){ - document.body.addEventListener('touchstart', function(e) { - handleClickTap(e.changedTouches[0].clientX); - }, false); + document.body.addEventListener('touchstart', function(e) { + handleClickTap(e.changedTouches[0].clientX); + }, false); }, 1); }); }); @@ -77,6 +76,7 @@ var settings; if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { settings = { + platform:"mobile", startDist:227, creationDt:40, baseScale:1.4, @@ -93,6 +93,7 @@ if(/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigat }; } else { settings = { + platform:"nonmobile", baseScale:1, startDist:340, creationDt:9, @@ -400,15 +401,9 @@ window.onblur = function (e) { } }; function showHelp(){ - if(gameState =1){ - pause(); - } - if(document.getElementById("helpScreen").style.display=="none" || document.getElementById("helpScreen").style.display === ""){ - document.getElementById("helpScreen").style.display = "block"; + if(gameState != 0){ + pause(); } - else if(document.getElementById("helpScreen").style.display=="block" ){ - document.getElementById("helpScreen").style.display = "none"; - - } - showingHelp = !showingHelp; + + $('#helpScreen').fadeToggle(150, "linear"); } diff --git a/js/view.js b/js/view.js index 01e67a1..05089b3 100644 --- a/js/view.js +++ b/js/view.js @@ -138,6 +138,11 @@ function showText(text){ var pt = document.getElementById("overlay"); pt.className = 'unfaded'; + + if (text == 'paused' && settings.platform == mobile) { + return; + } + pt.innerHTML = messages[text]; }