Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(238)

Side by Side Diff: chrome/renderer/resources/offline.js

Issue 1116693003: Interstitial page bug fixes (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/security_warnings/interstitial_v2_mobile.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 (function() { 4 (function() {
5 'use strict'; 5 'use strict';
6 /** 6 /**
7 * T-Rex runner. 7 * T-Rex runner.
8 * @param {string} outerContainerId Outer containing element id. 8 * @param {string} outerContainerId Outer containing element id.
9 * @param {Object} opt_config 9 * @param {Object} opt_config
10 * @constructor 10 * @constructor
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 } 688 }
689 }, 689 },
690 690
691 /** 691 /**
692 * Returns whether the event was a left click on canvas. 692 * Returns whether the event was a left click on canvas.
693 * On Windows right click is registered as a click. 693 * On Windows right click is registered as a click.
694 * @param {Event} e 694 * @param {Event} e
695 * @return {boolean} 695 * @return {boolean}
696 */ 696 */
697 isLeftClickOnCanvas: function(e) { 697 isLeftClickOnCanvas: function(e) {
698 return e.button && e.button < 2 && e.type == Runner.events.MOUSEUP && 698 return e.button != null && e.button < 2 &&
699 e.target == this.canvas; 699 e.type == Runner.events.MOUSEUP && e.target == this.canvas;
700 }, 700 },
edwardjung 2015/04/30 10:27:00 e.button primary button click returns 0, so it fai
701 701
702 /** 702 /**
703 * RequestAnimationFrame wrapper. 703 * RequestAnimationFrame wrapper.
704 */ 704 */
705 raq: function() { 705 raq: function() {
706 if (!this.drawPending) { 706 if (!this.drawPending) {
707 this.drawPending = true; 707 this.drawPending = true;
708 this.raqId = requestAnimationFrame(this.update.bind(this)); 708 this.raqId = requestAnimationFrame(this.update.bind(this));
709 } 709 }
710 }, 710 },
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
786 this.update(); 786 this.update();
787 } 787 }
788 }, 788 },
789 789
790 /** 790 /**
791 * Pause the game if the tab is not in focus. 791 * Pause the game if the tab is not in focus.
792 */ 792 */
793 onVisibilityChange: function(e) { 793 onVisibilityChange: function(e) {
794 if (document.hidden || document.webkitHidden || e.type == 'blur') { 794 if (document.hidden || document.webkitHidden || e.type == 'blur') {
795 this.stop(); 795 this.stop();
796 } else { 796 } else if (!this.crashed) {
797 this.tRex.reset();
edwardjung 2015/04/30 10:27:00 Reset the jump if window is refocused.
797 this.play(); 798 this.play();
798 } 799 }
799 }, 800 },
800 801
801 /** 802 /**
802 * Play a sound. 803 * Play a sound.
803 * @param {SoundBuffer} soundBuffer 804 * @param {SoundBuffer} soundBuffer
804 */ 805 */
805 playSound: function(soundBuffer) { 806 playSound: function(soundBuffer) {
806 if (soundBuffer) { 807 if (soundBuffer) {
(...skipping 1660 matching lines...) Expand 10 before | Expand all | Expand 10 after
2467 2468
2468 /** 2469 /**
2469 * Add a new cloud to the horizon. 2470 * Add a new cloud to the horizon.
2470 */ 2471 */
2471 addCloud: function() { 2472 addCloud: function() {
2472 this.clouds.push(new Cloud(this.canvas, this.spritePos.CLOUD, 2473 this.clouds.push(new Cloud(this.canvas, this.spritePos.CLOUD,
2473 this.dimensions.WIDTH)); 2474 this.dimensions.WIDTH));
2474 } 2475 }
2475 }; 2476 };
2476 })(); 2477 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/security_warnings/interstitial_v2_mobile.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698