Chromium Code Reviews| Index: components/neterror/resources/offline.js |
| diff --git a/components/neterror/resources/offline.js b/components/neterror/resources/offline.js |
| index 79ffa5c4da8945302dbeb334c82e94d4ae0e2aff..19efc2be8574adb919231b2107c28a0598ad0b4a 100644 |
| --- a/components/neterror/resources/offline.js |
| +++ b/components/neterror/resources/offline.js |
| @@ -20,7 +20,6 @@ function Runner(outerContainerId, opt_config) { |
| this.outerContainerEl = document.querySelector(outerContainerId); |
| this.containerEl = null; |
| this.snackbarEl = null; |
| - this.detailsButton = this.outerContainerEl.querySelector('#details-button'); |
| this.config = opt_config || Runner.config; |
| @@ -661,9 +660,10 @@ Runner.prototype = { |
| e.preventDefault(); |
| } |
| - if (e.target != this.detailsButton) { |
| - if (!this.crashed && (Runner.keycodes.JUMP[e.keyCode] || |
| - e.type == Runner.events.TOUCHSTART)) { |
| + if (!this.crashed && !this.paused) { |
|
mmenke
2017/03/21 18:59:58
Removing the e.target != this.detailsButton doesn'
edwardjung
2017/03/23 10:31:46
In the past yes, but we no longer have the details
|
| + if (Runner.keycodes.JUMP[e.keyCode] || |
| + e.type == Runner.events.TOUCHSTART) { |
| + // Starting the game for the first time. |
|
mmenke
2017/03/21 18:59:58
One more question: Should this also call e.preven
edwardjung
2017/03/23 10:31:46
Good point. The vast majority of the time the page
|
| if (!this.playing) { |
| this.loadSounds(); |
| this.playing = true; |
| @@ -672,28 +672,24 @@ Runner.prototype = { |
| errorPageController.trackEasterEgg(); |
| } |
| } |
| - // Play sound effect and jump on starting the game for the first time. |
| + // Start jump. |
| if (!this.tRex.jumping && !this.tRex.ducking) { |
| this.playSound(this.soundFx.BUTTON_PRESS); |
| this.tRex.startJump(this.currentSpeed); |
| } |
| + } else if (this.playing && Runner.keycodes.DUCK[e.keyCode]) { |
| + e.preventDefault(); |
| + if (this.tRex.jumping) { |
| + // Speed drop, activated only when jump key is not pressed. |
| + this.tRex.setSpeedDrop(); |
| + } else if (!this.tRex.jumping && !this.tRex.ducking) { |
| + // Duck. |
| + this.tRex.setDuck(true); |
| + } |
| } |
| - |
| - if (this.crashed && e.type == Runner.events.TOUCHSTART && |
| - e.currentTarget == this.containerEl) { |
| - this.restart(); |
| - } |
| - } |
| - |
| - if (this.playing && !this.crashed && Runner.keycodes.DUCK[e.keyCode]) { |
| - e.preventDefault(); |
| - if (this.tRex.jumping) { |
| - // Speed drop, activated only when jump key is not pressed. |
| - this.tRex.setSpeedDrop(); |
| - } else if (!this.tRex.jumping && !this.tRex.ducking) { |
| - // Duck. |
| - this.tRex.setDuck(true); |
| - } |
| + } else if (this.crashed && e.type == Runner.events.TOUCHSTART && |
| + e.currentTarget == this.containerEl) { |
|
mmenke
2017/03/21 18:59:59
nit: Fix indentation (Align after (, or use 4-spa
edwardjung
2017/03/23 10:31:46
Done.
|
| + this.restart(); |
| } |
| }, |
| @@ -812,6 +808,7 @@ Runner.prototype = { |
| this.playCount++; |
| this.runningTime = 0; |
| this.playing = true; |
| + this.paused = false; |
| this.crashed = false; |
| this.distanceRan = 0; |
| this.setSpeed(this.config.SPEED); |