| 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 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 301 if (keyTextValue) { | 301 if (keyTextValue) { |
| 302 keyText.style.visibility = 'visible'; | 302 keyText.style.visibility = 'visible'; |
| 303 } else { | 303 } else { |
| 304 keyText.style.visibility = 'hidden'; | 304 keyText.style.visibility = 'hidden'; |
| 305 } | 305 } |
| 306 keyText.textContent = keyTextValue; | 306 keyText.textContent = keyTextValue; |
| 307 | 307 |
| 308 var shortcutText = document.getElementById(shortcutTextId(identifier, i)); | 308 var shortcutText = document.getElementById(shortcutTextId(identifier, i)); |
| 309 if (shortcutId) { | 309 if (shortcutId) { |
| 310 shortcutText.style.visibility = 'visible'; | 310 shortcutText.style.visibility = 'visible'; |
| 311 shortcutText.textContent = templateData[shortcutId]; | 311 shortcutText.textContent = loadTimeData.getString('shortcutId'); |
| 312 } else { | 312 } else { |
| 313 shortcutText.style.visibility = 'hidden'; | 313 shortcutText.style.visibility = 'hidden'; |
| 314 } | 314 } |
| 315 | 315 |
| 316 if (keyData.format) { | 316 if (keyData.format) { |
| 317 var format = keyData.format; | 317 var format = keyData.format; |
| 318 if (format == 'left' || format == 'right') { | 318 if (format == 'left' || format == 'right') { |
| 319 shortcutText.style.textAlign = format; | 319 shortcutText.style.textAlign = format; |
| 320 keyText.style.textAlign = format; | 320 keyText.style.textAlign = format; |
| 321 } | 321 } |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 405 instructions.style.top = ((BASE_INSTRUCTIONS.top - BASE_KEYBOARD.top) * | 405 instructions.style.top = ((BASE_INSTRUCTIONS.top - BASE_KEYBOARD.top) * |
| 406 height / BASE_KEYBOARD.height + minY) + 'px'; | 406 height / BASE_KEYBOARD.height + minY) + 'px'; |
| 407 instructions.style.width = (width * BASE_INSTRUCTIONS.width / | 407 instructions.style.width = (width * BASE_INSTRUCTIONS.width / |
| 408 BASE_KEYBOARD.width) + 'px'; | 408 BASE_KEYBOARD.width) + 'px'; |
| 409 instructions.style.height = (height * BASE_INSTRUCTIONS.height / | 409 instructions.style.height = (height * BASE_INSTRUCTIONS.height / |
| 410 BASE_KEYBOARD.height) + 'px'; | 410 BASE_KEYBOARD.height) + 'px'; |
| 411 | 411 |
| 412 var instructionsText = document.createElement('div'); | 412 var instructionsText = document.createElement('div'); |
| 413 instructionsText.id = 'instructions-text'; | 413 instructionsText.id = 'instructions-text'; |
| 414 instructionsText.className = 'keyboard-overlay-instructions-text'; | 414 instructionsText.className = 'keyboard-overlay-instructions-text'; |
| 415 instructionsText.innerHTML = templateData.keyboardOverlayInstructions; | 415 instructionsText.innerHTML = |
| 416 loadTimeData.getString('keyboardOverlayInstructions'); |
| 416 instructions.appendChild(instructionsText); | 417 instructions.appendChild(instructionsText); |
| 417 var instructionsHideText = document.createElement('div'); | 418 var instructionsHideText = document.createElement('div'); |
| 418 instructionsHideText.id = 'instructions-hide-text'; | 419 instructionsHideText.id = 'instructions-hide-text'; |
| 419 instructionsHideText.className = 'keyboard-overlay-instructions-hide-text'; | 420 instructionsHideText.className = 'keyboard-overlay-instructions-hide-text'; |
| 420 instructionsHideText.innerHTML = templateData.keyboardOverlayInstructionsHide; | 421 instructionsHideText.innerHTML = |
| 422 loadTimeData.getString('keyboardOverlayInstructionsHide'); |
| 421 instructions.appendChild(instructionsHideText); | 423 instructions.appendChild(instructionsHideText); |
| 422 var learnMoreLinkText = document.createElement('div'); | 424 var learnMoreLinkText = document.createElement('div'); |
| 423 learnMoreLinkText.id = 'learn-more-text'; | 425 learnMoreLinkText.id = 'learn-more-text'; |
| 424 learnMoreLinkText.className = 'keyboard-overlay-learn-more-text'; | 426 learnMoreLinkText.className = 'keyboard-overlay-learn-more-text'; |
| 425 learnMoreLinkText.addEventListener('click', learnMoreClicked); | 427 learnMoreLinkText.addEventListener('click', learnMoreClicked); |
| 426 var learnMoreLinkAnchor = document.createElement('a'); | 428 var learnMoreLinkAnchor = document.createElement('a'); |
| 427 learnMoreLinkAnchor.href = templateData.keyboardOverlayLearnMoreURL; | 429 learnMoreLinkAnchor.href = |
| 428 learnMoreLinkAnchor.textContent = templateData.keyboardOverlayLearnMore; | 430 loadTimeData.getString('keyboardOverlayLearnMoreURL'); |
| 431 learnMoreLinkAnchor.textContent = |
| 432 loadTimeData.getString('keyboardOverlayLearnMore'); |
| 429 learnMoreLinkText.appendChild(learnMoreLinkAnchor); | 433 learnMoreLinkText.appendChild(learnMoreLinkAnchor); |
| 430 instructions.appendChild(learnMoreLinkText); | 434 instructions.appendChild(learnMoreLinkText); |
| 431 keyboard.appendChild(instructions); | 435 keyboard.appendChild(instructions); |
| 432 } | 436 } |
| 433 | 437 |
| 434 /** | 438 /** |
| 435 * A callback function for the onload event of the body element. | 439 * A callback function for the onload event of the body element. |
| 436 */ | 440 */ |
| 437 function init() { | 441 function init() { |
| 438 document.addEventListener('keydown', handleKeyEvent); | 442 document.addEventListener('keydown', handleKeyEvent); |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 /** | 489 /** |
| 486 * Handles click events of the learn more link. | 490 * Handles click events of the learn more link. |
| 487 */ | 491 */ |
| 488 function learnMoreClicked(e) { | 492 function learnMoreClicked(e) { |
| 489 chrome.send('openLearnMorePage'); | 493 chrome.send('openLearnMorePage'); |
| 490 chrome.send('DialogClose'); | 494 chrome.send('DialogClose'); |
| 491 e.preventDefault(); | 495 e.preventDefault(); |
| 492 } | 496 } |
| 493 | 497 |
| 494 document.addEventListener('DOMContentLoaded', init); | 498 document.addEventListener('DOMContentLoaded', init); |
| OLD | NEW |