| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <include src="keyboard_overlay_data.js"/> | 5 <include src="keyboard_overlay_data.js"/> |
| 6 <include src="keyboard_overlay_accessibility_helper.js"/> | 6 <include src="keyboard_overlay_accessibility_helper.js"/> |
| 7 | 7 |
| 8 var BASE_KEYBOARD = { | 8 var BASE_KEYBOARD = { |
| 9 top: 0, | 9 top: 0, |
| 10 left: 0, | 10 left: 0, |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 /** | 124 /** |
| 125 * Returns shortcut data. | 125 * Returns shortcut data. |
| 126 * @return {Object} Keyboard shortcut data. | 126 * @return {Object} Keyboard shortcut data. |
| 127 */ | 127 */ |
| 128 function getShortcutData() { | 128 function getShortcutData() { |
| 129 if (shortcutDataCache) | 129 if (shortcutDataCache) |
| 130 return shortcutDataCache; | 130 return shortcutDataCache; |
| 131 | 131 |
| 132 shortcutDataCache = keyboardOverlayData['shortcut']; | 132 shortcutDataCache = keyboardOverlayData['shortcut']; |
| 133 | 133 |
| 134 var searchKeyIsModifier = | 134 var keepNonSearchShortcuts = |
| 135 loadTimeData.getString('keyboardSearchKeyActsAsFunctionKey') == 'true'; | 135 loadTimeData.getString('keyboardKeepNonSearchKeyShortcuts') == 'true'; |
| 136 if (searchKeyIsModifier) { | 136 if (!keepNonSearchShortcuts) { |
| 137 // TODO(mazda): Clean this up and move these out to the data js. | 137 // TODO(mazda): Clean this up and move these out to the data js. |
| 138 var searchModifierRemoveShortcuts = { | 138 var searchModifierRemoveShortcuts = { |
| 139 'backspace<>ALT': 'keyboardOverlayDelete', | 139 'backspace<>ALT': 'keyboardOverlayDelete', |
| 140 'down<>ALT': 'keyboardOverlayPageDown', | 140 'down<>ALT': 'keyboardOverlayPageDown', |
| 141 'down<>ALT<>CTRL': 'keyboardOverlayEnd', | 141 'down<>ALT<>CTRL': 'keyboardOverlayEnd', |
| 142 'up<>ALT': 'keyboardOverlayPageUp', | 142 'up<>ALT': 'keyboardOverlayPageUp', |
| 143 'up<>ALT<>CTRL': 'keyboardOverlayHome' | 143 'up<>ALT<>CTRL': 'keyboardOverlayHome' |
| 144 }; | 144 }; |
| 145 var searchModifierAddShortcuts = { | |
| 146 '1<>SEARCH': 'keyboardOverlayF1', | |
| 147 '2<>SEARCH': 'keyboardOverlayF2', | |
| 148 '3<>SEARCH': 'keyboardOverlayF3', | |
| 149 '4<>SEARCH': 'keyboardOverlayF4', | |
| 150 '5<>SEARCH': 'keyboardOverlayF5', | |
| 151 '6<>SEARCH': 'keyboardOverlayF6', | |
| 152 '7<>SEARCH': 'keyboardOverlayF7', | |
| 153 '8<>SEARCH': 'keyboardOverlayF8', | |
| 154 '9<>SEARCH': 'keyboardOverlayF9', | |
| 155 '0<>SEARCH': 'keyboardOverlayF10', | |
| 156 '-<>SEARCH': 'keyboardOverlayF11', | |
| 157 '=<>SEARCH': 'keyboardOverlayF12', | |
| 158 'F1<>SEARCH': 'keyboardOverlayF1', | |
| 159 'F2<>SEARCH': 'keyboardOverlayF2', | |
| 160 'F3<>SEARCH': 'keyboardOverlayF3', | |
| 161 'F4<>SEARCH': 'keyboardOverlayF4', | |
| 162 'F5<>SEARCH': 'keyboardOverlayF5', | |
| 163 'F6<>SEARCH': 'keyboardOverlayF6', | |
| 164 'F7<>SEARCH': 'keyboardOverlayF7', | |
| 165 'F8<>SEARCH': 'keyboardOverlayF8', | |
| 166 'F9<>SEARCH': 'keyboardOverlayF9', | |
| 167 'F10<>SEARCH': 'keyboardOverlayF10', | |
| 168 'F11<>SEARCH': 'keyboardOverlayF11', | |
| 169 'F12<>SEARCH': 'keyboardOverlayF12', | |
| 170 'back<>SEARCH': 'keyboardOverlayF1', | |
| 171 'forward<>SEARCH': 'keyboardOverlayF2', | |
| 172 'reload<>SEARCH': 'keyboardOverlayF3', | |
| 173 'maximize<>SEARCH': 'keyboardOverlayF4', | |
| 174 'switch window<>SEARCH': 'keyboardOverlayF5', | |
| 175 'bright down<>SEARCH': 'keyboardOverlayF6', | |
| 176 'bright up<>SEARCH': 'keyboardOverlayF7', | |
| 177 'mute<>SEARCH': 'keyboardOverlayF8', | |
| 178 'vol. down<>SEARCH': 'keyboardOverlayF9', | |
| 179 'vol. up<>SEARCH': 'keyboardOverlayF10', | |
| 180 'backspace<>SEARCH': 'keyboardOverlayDelete', | |
| 181 'down<>SEARCH': 'keyboardOverlayPageDown', | |
| 182 'right<>SEARCH': 'keyboardOverlayEnd', | |
| 183 'up<>SEARCH': 'keyboardOverlayPageUp', | |
| 184 'left<>SEARCH': 'keyboardOverlayHome', | |
| 185 '.<>SEARCH': 'keyboardOverlayInsert' | |
| 186 }; | |
| 187 | 145 |
| 188 for (var key in searchModifierRemoveShortcuts) | 146 for (var key in searchModifierRemoveShortcuts) |
| 189 delete shortcutDataCache[key]; | 147 delete shortcutDataCache[key]; |
| 190 for (var key in searchModifierAddShortcuts) | |
| 191 shortcutDataCache[key] = searchModifierAddShortcuts[key]; | |
| 192 } | 148 } |
| 193 | 149 |
| 194 return shortcutDataCache; | 150 return shortcutDataCache; |
| 195 } | 151 } |
| 196 | 152 |
| 197 /** | 153 /** |
| 198 * Returns the keyboard overlay ID. | 154 * Returns the keyboard overlay ID. |
| 199 * @return {string} Keyboard overlay ID. | 155 * @return {string} Keyboard overlay ID. |
| 200 */ | 156 */ |
| 201 function getKeyboardOverlayId() { | 157 function getKeyboardOverlayId() { |
| (...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 586 instructions.style.top = ((BASE_INSTRUCTIONS.top - BASE_KEYBOARD.top) * | 542 instructions.style.top = ((BASE_INSTRUCTIONS.top - BASE_KEYBOARD.top) * |
| 587 height / BASE_KEYBOARD.height + minY) + 'px'; | 543 height / BASE_KEYBOARD.height + minY) + 'px'; |
| 588 instructions.style.width = (width * BASE_INSTRUCTIONS.width / | 544 instructions.style.width = (width * BASE_INSTRUCTIONS.width / |
| 589 BASE_KEYBOARD.width) + 'px'; | 545 BASE_KEYBOARD.width) + 'px'; |
| 590 instructions.style.height = (height * BASE_INSTRUCTIONS.height / | 546 instructions.style.height = (height * BASE_INSTRUCTIONS.height / |
| 591 BASE_KEYBOARD.height) + 'px'; | 547 BASE_KEYBOARD.height) + 'px'; |
| 592 | 548 |
| 593 var instructionsText = document.createElement('div'); | 549 var instructionsText = document.createElement('div'); |
| 594 instructionsText.id = 'instructions-text'; | 550 instructionsText.id = 'instructions-text'; |
| 595 instructionsText.className = 'keyboard-overlay-instructions-text'; | 551 instructionsText.className = 'keyboard-overlay-instructions-text'; |
| 596 var searchKeyIsModifier = | 552 instructionsText.innerHTML = |
| 597 loadTimeData.getString('keyboardSearchKeyActsAsFunctionKey') == 'true'; | 553 loadTimeData.getString('keyboardOverlayInstructions'); |
| 598 if (searchKeyIsModifier) { | |
| 599 instructionsText.innerHTML = | |
| 600 loadTimeData.getString('keyboardOverlayInstructionsWithSearch'); | |
| 601 } else { | |
| 602 instructionsText.innerHTML = | |
| 603 loadTimeData.getString('keyboardOverlayInstructions'); | |
| 604 } | |
| 605 instructions.appendChild(instructionsText); | 554 instructions.appendChild(instructionsText); |
| 606 var instructionsHideText = document.createElement('div'); | 555 var instructionsHideText = document.createElement('div'); |
| 607 instructionsHideText.id = 'instructions-hide-text'; | 556 instructionsHideText.id = 'instructions-hide-text'; |
| 608 instructionsHideText.className = 'keyboard-overlay-instructions-hide-text'; | 557 instructionsHideText.className = 'keyboard-overlay-instructions-hide-text'; |
| 609 instructionsHideText.innerHTML = | 558 instructionsHideText.innerHTML = |
| 610 loadTimeData.getString('keyboardOverlayInstructionsHide'); | 559 loadTimeData.getString('keyboardOverlayInstructionsHide'); |
| 611 instructions.appendChild(instructionsHideText); | 560 instructions.appendChild(instructionsHideText); |
| 612 var learnMoreLinkText = document.createElement('div'); | 561 var learnMoreLinkText = document.createElement('div'); |
| 613 learnMoreLinkText.id = 'learn-more-text'; | 562 learnMoreLinkText.id = 'learn-more-text'; |
| 614 learnMoreLinkText.className = 'keyboard-overlay-learn-more-text'; | 563 learnMoreLinkText.className = 'keyboard-overlay-learn-more-text'; |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 684 * Handles click events of the learn more link. | 633 * Handles click events of the learn more link. |
| 685 * @param {Event} e Mouse click event. | 634 * @param {Event} e Mouse click event. |
| 686 */ | 635 */ |
| 687 function learnMoreClicked(e) { | 636 function learnMoreClicked(e) { |
| 688 chrome.send('openLearnMorePage'); | 637 chrome.send('openLearnMorePage'); |
| 689 chrome.send('DialogClose'); | 638 chrome.send('DialogClose'); |
| 690 e.preventDefault(); | 639 e.preventDefault(); |
| 691 } | 640 } |
| 692 | 641 |
| 693 document.addEventListener('DOMContentLoaded', init); | 642 document.addEventListener('DOMContentLoaded', init); |
| OLD | NEW |