removed callback stacking issues
This commit is contained in:
parent
0eba942db5
commit
4b9e179db9
2 changed files with 25 additions and 8 deletions
|
@ -126,13 +126,14 @@ function initialize(a) {
|
|||
|
||||
window.gameState;
|
||||
setStartScreen();
|
||||
|
||||
if (a != 1) {
|
||||
window.onblur = function (e) {
|
||||
if (gameState==1) {
|
||||
pause();
|
||||
}
|
||||
};
|
||||
|
||||
$('#startBtn').off();
|
||||
$('#startBtn').on('touchstart mousedown', function(){
|
||||
if (importing == 1) {
|
||||
init(1);
|
||||
|
@ -142,14 +143,22 @@ function initialize(a) {
|
|||
|
||||
setTimeout(function(){
|
||||
if(settings.platform == "mobile"){
|
||||
document.body.addEventListener('touchstart', function(e) {
|
||||
handleClickTap(e.changedTouches[0].clientX);
|
||||
}, false);
|
||||
try {
|
||||
document.body.removeEventListener('touchstart', handleTap ,false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
document.body.addEventListener('touchstart', handleTap, false);
|
||||
}
|
||||
else {
|
||||
document.body.addEventListener('mousedown', function(e) {
|
||||
handleClickTap(e.clientX);
|
||||
}, false);
|
||||
try {
|
||||
document.body.removeEventListener('mousedown', handleClick ,false);
|
||||
} catch (e) {
|
||||
|
||||
}
|
||||
|
||||
document.body.addEventListener('mousedown', handleClick, false);
|
||||
}
|
||||
}, 1);
|
||||
});
|
||||
|
@ -172,3 +181,11 @@ function initialize(a) {
|
|||
ga('send', 'pageview');
|
||||
}
|
||||
}
|
||||
|
||||
function handleTap(e) {
|
||||
handleClickTap(e.changedTouches[0].clientX);
|
||||
}
|
||||
|
||||
function handleClick(e) {
|
||||
handleClickTap(e.clientX);
|
||||
}
|
|
@ -104,7 +104,7 @@ function showText(text){
|
|||
var allZ = 1;
|
||||
var i;
|
||||
for (i = 0; i < 3; i++) {
|
||||
if (highscores[i] != undefined && highscores[i] != 0) {
|
||||
if (highscores[i] !== undefined && highscores[i] != 0) {
|
||||
messages['gameover'] += "<tr> <th class='tg-031e'>1.</th> <th class='tg-031e'>"+highscores[i] + " pts</th> </tr>";
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue