| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 | 4 |
| 5 /** | 5 /** |
| 6 * @fileoverview The ChromeVox panel and menus. | 6 * @fileoverview The ChromeVox panel and menus. |
| 7 */ | 7 */ |
| 8 | 8 |
| 9 goog.provide('Panel'); | 9 goog.provide('Panel'); |
| 10 | 10 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 $('options').addEventListener('click', Panel.onOptions, false); | 123 $('options').addEventListener('click', Panel.onOptions, false); |
| 124 $('close').addEventListener('click', Panel.onClose, false); | 124 $('close').addEventListener('click', Panel.onClose, false); |
| 125 | 125 |
| 126 $('tutorial_next').addEventListener('click', Panel.onTutorialNext, false); | 126 $('tutorial_next').addEventListener('click', Panel.onTutorialNext, false); |
| 127 $('tutorial_previous').addEventListener( | 127 $('tutorial_previous').addEventListener( |
| 128 'click', Panel.onTutorialPrevious, false); | 128 'click', Panel.onTutorialPrevious, false); |
| 129 $('close_tutorial').addEventListener('click', Panel.onCloseTutorial, false); | 129 $('close_tutorial').addEventListener('click', Panel.onCloseTutorial, false); |
| 130 | 130 |
| 131 document.addEventListener('keydown', Panel.onKeyDown, false); | 131 document.addEventListener('keydown', Panel.onKeyDown, false); |
| 132 document.addEventListener('mouseup', Panel.onMouseUp, false); | 132 document.addEventListener('mouseup', Panel.onMouseUp, false); |
| 133 window.addEventListener('blur', Panel.closeMenusAndRestoreFocus, false); |
| 133 | 134 |
| 134 Panel.searchInput_.addEventListener('blur', Panel.onSearchInputBlur, false); | 135 Panel.searchInput_.addEventListener('blur', Panel.onSearchInputBlur, false); |
| 135 }; | 136 }; |
| 136 | 137 |
| 137 /** | 138 /** |
| 138 * Update the display based on prefs. | 139 * Update the display based on prefs. |
| 139 */ | 140 */ |
| 140 Panel.updateFromPrefs = function() { | 141 Panel.updateFromPrefs = function() { |
| 141 if (Panel.searching_) { | 142 if (Panel.searching_) { |
| 142 this.speechContainer_.hidden = true; | 143 this.speechContainer_.hidden = true; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 return; | 247 return; |
| 247 | 248 |
| 248 this.mode_ = mode; | 249 this.mode_ = mode; |
| 249 | 250 |
| 250 if (this.mode_ == Panel.Mode.FULLSCREEN_MENUS || | 251 if (this.mode_ == Panel.Mode.FULLSCREEN_MENUS || |
| 251 this.mode_ == Panel.Mode.FULLSCREEN_TUTORIAL) { | 252 this.mode_ == Panel.Mode.FULLSCREEN_TUTORIAL) { |
| 252 // Change the url fragment to 'fullscreen', which signals the native | 253 // Change the url fragment to 'fullscreen', which signals the native |
| 253 // host code to make the window fullscreen and give it focus. | 254 // host code to make the window fullscreen and give it focus. |
| 254 window.location = '#fullscreen'; | 255 window.location = '#fullscreen'; |
| 255 } else if (this.mode_ == Panel.Mode.FOCUSED) { | 256 } else if (this.mode_ == Panel.Mode.FOCUSED) { |
| 256 // // Change the url fragment to 'focus', which signals the native | 257 // Change the url fragment to 'focus', which signals the native |
| 257 // host code to give the window focus. | 258 // host code to give the window focus. |
| 258 window.location = '#focus'; | 259 window.location = '#focus'; |
| 259 } else { | 260 } else { |
| 260 // Remove the url fragment, which signals the native host code to | 261 // Remove the url fragment, which signals the native host code to |
| 261 // collapse the panel to its normal size and cause it to lose focus. | 262 // collapse the panel to its normal size and cause it to lose focus. |
| 262 window.location = '#'; | 263 window.location = '#'; |
| 263 } | 264 } |
| 264 | 265 |
| 265 $('main').hidden = (this.mode_ == Panel.Mode.FULLSCREEN_TUTORIAL); | 266 $('main').hidden = (this.mode_ == Panel.Mode.FULLSCREEN_TUTORIAL); |
| 266 $('menus_background').hidden = (this.mode_ != Panel.Mode.FULLSCREEN_MENUS); | 267 $('menus_background').hidden = (this.mode_ != Panel.Mode.FULLSCREEN_MENUS); |
| (...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 783 }; | 784 }; |
| 784 | 785 |
| 785 /** | 786 /** |
| 786 * Open the tutorial. | 787 * Open the tutorial. |
| 787 */ | 788 */ |
| 788 Panel.onTutorial = function() { | 789 Panel.onTutorial = function() { |
| 789 // Change the url fragment to 'fullscreen', which signals the native | 790 // Change the url fragment to 'fullscreen', which signals the native |
| 790 // host code to make the window fullscreen, revealing the menus. | 791 // host code to make the window fullscreen, revealing the menus. |
| 791 Panel.setMode(Panel.Mode.FULLSCREEN_TUTORIAL); | 792 Panel.setMode(Panel.Mode.FULLSCREEN_TUTORIAL); |
| 792 | 793 |
| 793 Panel.tutorial_.firstPage(); | 794 Panel.tutorial_.lastViewedPage(); |
| 794 }; | 795 }; |
| 795 | 796 |
| 796 /** | 797 /** |
| 797 * Move to the next page in the tutorial. | 798 * Move to the next page in the tutorial. |
| 798 */ | 799 */ |
| 799 Panel.onTutorialNext = function() { | 800 Panel.onTutorialNext = function() { |
| 800 Panel.tutorial_.nextPage(); | 801 Panel.tutorial_.nextPage(); |
| 801 }; | 802 }; |
| 802 | 803 |
| 803 /** | 804 /** |
| (...skipping 20 matching lines...) Expand all Loading... |
| 824 }, false); | 825 }, false); |
| 825 | 826 |
| 826 window.addEventListener('hashchange', function() { | 827 window.addEventListener('hashchange', function() { |
| 827 if (location.hash == '#fullscreen' || location.hash == '#focus') { | 828 if (location.hash == '#fullscreen' || location.hash == '#focus') { |
| 828 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; | 829 this.originalStickyState_ = cvox.ChromeVox.isStickyPrefOn; |
| 829 cvox.ChromeVox.isStickyPrefOn = false; | 830 cvox.ChromeVox.isStickyPrefOn = false; |
| 830 } else { | 831 } else { |
| 831 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; | 832 cvox.ChromeVox.isStickyPrefOn = this.originalStickyState_; |
| 832 } | 833 } |
| 833 }, false); | 834 }, false); |
| OLD | NEW |