Chromium Code Reviews| 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 /** | 6 /** |
| 7 * @fileoverview The local InstantExtended NTP. | 7 * @fileoverview The local InstantExtended NTP. |
| 8 */ | 8 */ |
| 9 | 9 |
| 10 | 10 |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 86 /** | 86 /** |
| 87 * Enum for classnames. | 87 * Enum for classnames. |
| 88 * @enum {string} | 88 * @enum {string} |
| 89 * @const | 89 * @const |
| 90 */ | 90 */ |
| 91 var CLASSES = { | 91 var CLASSES = { |
| 92 ALTERNATE_LOGO: 'alternate-logo', // Shows white logo if required by theme | 92 ALTERNATE_LOGO: 'alternate-logo', // Shows white logo if required by theme |
| 93 DARK: 'dark', | 93 DARK: 'dark', |
| 94 DEFAULT_THEME: 'default-theme', | 94 DEFAULT_THEME: 'default-theme', |
| 95 DELAYED_HIDE_NOTIFICATION: 'mv-notice-delayed-hide', | 95 DELAYED_HIDE_NOTIFICATION: 'mv-notice-delayed-hide', |
| 96 FAKEBOX_DISABLE: 'fakebox-disable', // Makes fakebox non-interactive | |
| 97 FAKEBOX_FOCUS: 'fakebox-focused', // Applies focus styles to the fakebox | 96 FAKEBOX_FOCUS: 'fakebox-focused', // Applies focus styles to the fakebox |
| 98 // Applies drag focus style to the fakebox | 97 // Applies drag focus style to the fakebox |
| 99 FAKEBOX_DRAG_FOCUS: 'fakebox-drag-focused', | 98 FAKEBOX_DRAG_FOCUS: 'fakebox-drag-focused', |
| 100 HIDE_FAKEBOX_AND_LOGO: 'hide-fakebox-logo', | 99 HIDE_FAKEBOX_AND_LOGO: 'hide-fakebox-logo', |
| 101 HIDE_NOTIFICATION: 'mv-notice-hide', | 100 HIDE_NOTIFICATION: 'mv-notice-hide', |
| 102 LEFT_ALIGN_ATTRIBUTION: 'left-align-attribution', | 101 LEFT_ALIGN_ATTRIBUTION: 'left-align-attribution', |
| 103 // Vertically centers the most visited section for a non-Google provided page. | 102 // Vertically centers the most visited section for a non-Google provided page. |
| 104 NON_GOOGLE_PAGE: 'non-google-page', | 103 NON_GOOGLE_PAGE: 'non-google-page', |
| 105 RTL: 'rtl' // Right-to-left language text. | 104 RTL: 'rtl' // Right-to-left language text. |
| 106 }; | 105 }; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 133 * Enum for keycodes. | 132 * Enum for keycodes. |
| 134 * @enum {number} | 133 * @enum {number} |
| 135 * @const | 134 * @const |
| 136 */ | 135 */ |
| 137 var KEYCODE = { | 136 var KEYCODE = { |
| 138 ENTER: 13 | 137 ENTER: 13 |
| 139 }; | 138 }; |
| 140 | 139 |
| 141 | 140 |
| 142 /** | 141 /** |
| 143 * Enum for the state of the NTP when it is disposed. | |
| 144 * @enum {number} | |
| 145 * @const | |
| 146 */ | |
| 147 var NTP_DISPOSE_STATE = { | |
| 148 NONE: 0, // Preserve the NTP appearance and functionality | |
| 149 DISABLE_FAKEBOX: 1, | |
| 150 HIDE_FAKEBOX_AND_LOGO: 2 | |
| 151 }; | |
| 152 | |
| 153 | |
| 154 /** | |
| 155 * The notification displayed when a page is blacklisted. | 142 * The notification displayed when a page is blacklisted. |
| 156 * @type {Element} | 143 * @type {Element} |
| 157 */ | 144 */ |
| 158 var notification; | 145 var notification; |
| 159 | 146 |
| 160 | 147 |
| 161 /** | 148 /** |
| 162 * The container for the theme attribution. | 149 * The container for the theme attribution. |
| 163 * @type {Element} | 150 * @type {Element} |
| 164 */ | 151 */ |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 203 var ntpApiHandle; | 190 var ntpApiHandle; |
| 204 | 191 |
| 205 | 192 |
| 206 /** | 193 /** |
| 207 * The browser embeddedSearch.searchBox object. | 194 * The browser embeddedSearch.searchBox object. |
| 208 * @type {Object} | 195 * @type {Object} |
| 209 */ | 196 */ |
| 210 var searchboxApiHandle; | 197 var searchboxApiHandle; |
| 211 | 198 |
| 212 | 199 |
| 213 /** | |
| 214 * The state of the NTP when a query is entered into the Omnibox. | |
| 215 * @type {NTP_DISPOSE_STATE} | |
| 216 */ | |
| 217 var omniboxInputBehavior = NTP_DISPOSE_STATE.NONE; | |
| 218 | |
| 219 | |
| 220 /** | |
| 221 * The state of the NTP when a query is entered into the Fakebox. | |
| 222 * @type {NTP_DISPOSE_STATE} | |
| 223 */ | |
| 224 var fakeboxInputBehavior = NTP_DISPOSE_STATE.HIDE_FAKEBOX_AND_LOGO; | |
|
Marc Treib
2017/02/03 09:16:58
These two were effectively constants. I just inlin
| |
| 225 | |
| 226 | |
| 227 /** @type {number} @const */ | 200 /** @type {number} @const */ |
| 228 var MAX_NUM_TILES_TO_SHOW = 8; | 201 var MAX_NUM_TILES_TO_SHOW = 8; |
| 229 | 202 |
| 230 | 203 |
| 231 /** @type {number} @const */ | 204 /** @type {number} @const */ |
| 232 var MIN_NUM_COLUMNS = 2; | 205 var MIN_NUM_COLUMNS = 2; |
| 233 | 206 |
| 234 | 207 |
| 235 /** @type {number} @const */ | 208 /** @type {number} @const */ |
| 236 var MAX_NUM_COLUMNS = 4; | 209 var MAX_NUM_COLUMNS = 4; |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 325 renderTheme(); | 298 renderTheme(); |
| 326 } | 299 } |
| 327 | 300 |
| 328 | 301 |
| 329 /** | 302 /** |
| 330 * Updates the NTP style according to theme. | 303 * Updates the NTP style according to theme. |
| 331 * @param {Object=} opt_themeInfo The information about the theme. If it is | 304 * @param {Object=} opt_themeInfo The information about the theme. If it is |
| 332 * omitted the style will be reverted to the default. | 305 * omitted the style will be reverted to the default. |
| 333 * @private | 306 * @private |
| 334 */ | 307 */ |
| 308 // TODO(treib): We actually never call this without a themeInfo. Should we? | |
| 335 function setCustomThemeStyle(opt_themeInfo) { | 309 function setCustomThemeStyle(opt_themeInfo) { |
| 336 var customStyleElement = $(IDS.CUSTOM_THEME_STYLE); | 310 var customStyleElement = $(IDS.CUSTOM_THEME_STYLE); |
| 337 var head = document.head; | 311 var head = document.head; |
| 338 if (opt_themeInfo && !opt_themeInfo.usingDefaultTheme) { | 312 if (opt_themeInfo && !opt_themeInfo.usingDefaultTheme) { |
| 339 ntpContents.classList.remove(CLASSES.DEFAULT_THEME); | 313 ntpContents.classList.remove(CLASSES.DEFAULT_THEME); |
| 340 var themeStyle = | 314 var themeStyle = |
| 341 '#attribution {' + | 315 '#attribution {' + |
| 342 ' color: ' + convertToRGBAColor(opt_themeInfo.textColorLightRgba) + ';' + | 316 ' color: ' + convertToRGBAColor(opt_themeInfo.textColorLightRgba) + ';' + |
| 343 '}' + | 317 '}' + |
| 344 '#mv-msg {' + | 318 '#mv-msg {' + |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 412 * @private | 386 * @private |
| 413 */ | 387 */ |
| 414 function setAttributionVisibility_(show) { | 388 function setAttributionVisibility_(show) { |
| 415 if (attribution) { | 389 if (attribution) { |
| 416 attribution.style.display = show ? '' : 'none'; | 390 attribution.style.display = show ? '' : 'none'; |
| 417 } | 391 } |
| 418 } | 392 } |
| 419 | 393 |
| 420 | 394 |
| 421 /** | 395 /** |
| 422 * Converts an Array of color components into RRGGBBAA format. | |
| 423 * @param {Array<number>} color Array of rgba color components. | |
| 424 * @return {string} Color string in RRGGBBAA format. | |
| 425 * @private | |
| 426 */ | |
| 427 function convertToRRGGBBAAColor(color) { | |
|
Marc Treib
2017/02/03 09:16:59
Never called
| |
| 428 return color.map(function(t) { | |
| 429 return ('0' + t.toString(16)).slice(-2); // To 2-digit, 0-padded hex. | |
| 430 }).join(''); | |
| 431 } | |
| 432 | |
| 433 | |
| 434 /** | |
| 435 * Converts an Array of color components into RGBA format "rgba(R,G,B,A)". | 396 * Converts an Array of color components into RGBA format "rgba(R,G,B,A)". |
| 436 * @param {Array<number>} color Array of rgba color components. | 397 * @param {Array<number>} color Array of rgba color components. |
| 437 * @return {string} CSS color in RGBA format. | 398 * @return {string} CSS color in RGBA format. |
| 438 * @private | 399 * @private |
| 439 */ | 400 */ |
| 440 function convertToRGBAColor(color) { | 401 function convertToRGBAColor(color) { |
| 441 return 'rgba(' + color[0] + ',' + color[1] + ',' + color[2] + ',' + | 402 return 'rgba(' + color[0] + ',' + color[1] + ',' + color[2] + ',' + |
| 442 color[3] / 255 + ')'; | 403 color[3] / 255 + ')'; |
| 443 } | 404 } |
| 444 | 405 |
| (...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 559 | 520 |
| 560 | 521 |
| 561 /** | 522 /** |
| 562 * Handles new input by disposing the NTP, according to where the input was | 523 * Handles new input by disposing the NTP, according to where the input was |
| 563 * entered. | 524 * entered. |
| 564 */ | 525 */ |
| 565 function onInputStart() { | 526 function onInputStart() { |
| 566 if (fakebox && isFakeboxFocused()) { | 527 if (fakebox && isFakeboxFocused()) { |
| 567 setFakeboxFocus(false); | 528 setFakeboxFocus(false); |
| 568 setFakeboxDragFocus(false); | 529 setFakeboxDragFocus(false); |
| 569 disposeNtp(true); | 530 setFakeboxAndLogoVisibility(false); |
| 570 } else if (!isFakeboxFocused()) { | |
| 571 disposeNtp(false); | |
|
Marc Treib
2017/02/03 09:16:59
disposeNtp(false) didn't do anything, see below
| |
| 572 } | 531 } |
| 573 } | 532 } |
| 574 | 533 |
| 575 | 534 |
| 576 /** | 535 /** |
| 577 * Disposes the NTP, according to where the input was entered. | |
| 578 * @param {boolean} wasFakeboxInput True if the input was in the fakebox. | |
| 579 */ | |
| 580 function disposeNtp(wasFakeboxInput) { | |
| 581 var behavior = wasFakeboxInput ? fakeboxInputBehavior : omniboxInputBehavior; | |
| 582 if (behavior == NTP_DISPOSE_STATE.DISABLE_FAKEBOX) | |
|
Marc Treib
2017/02/03 09:16:58
This could never happen (DISABLE_FAKEBOX is unused
| |
| 583 setFakeboxActive(false); | |
| 584 else if (behavior == NTP_DISPOSE_STATE.HIDE_FAKEBOX_AND_LOGO) | |
| 585 setFakeboxAndLogoVisibility(false); | |
|
Marc Treib
2017/02/03 09:16:59
This was inlined in onInputStart
| |
| 586 } | |
| 587 | |
| 588 | |
| 589 /** | |
| 590 * Restores the NTP (re-enables the fakebox and unhides the logo.) | 536 * Restores the NTP (re-enables the fakebox and unhides the logo.) |
| 591 */ | 537 */ |
| 592 function restoreNtp() { | 538 function onInputCancel() { |
| 593 setFakeboxActive(true); | |
|
Marc Treib
2017/02/03 09:16:59
Pointless, because it's never called with false
| |
| 594 setFakeboxAndLogoVisibility(true); | 539 setFakeboxAndLogoVisibility(true); |
| 595 } | 540 } |
| 596 | 541 |
| 597 | 542 |
| 598 /** | 543 /** |
| 599 * @param {boolean} focus True to focus the fakebox. | 544 * @param {boolean} focus True to focus the fakebox. |
| 600 */ | 545 */ |
| 601 function setFakeboxFocus(focus) { | 546 function setFakeboxFocus(focus) { |
| 602 document.body.classList.toggle(CLASSES.FAKEBOX_FOCUS, focus); | 547 document.body.classList.toggle(CLASSES.FAKEBOX_FOCUS, focus); |
| 603 } | 548 } |
| 604 | 549 |
| 605 /** | 550 /** |
| 606 * @param {boolean} focus True to show a dragging focus to the fakebox. | 551 * @param {boolean} focus True to show a dragging focus to the fakebox. |
| 607 */ | 552 */ |
| 608 function setFakeboxDragFocus(focus) { | 553 function setFakeboxDragFocus(focus) { |
| 609 document.body.classList.toggle(CLASSES.FAKEBOX_DRAG_FOCUS, focus); | 554 document.body.classList.toggle(CLASSES.FAKEBOX_DRAG_FOCUS, focus); |
| 610 } | 555 } |
| 611 | 556 |
| 612 /** | 557 /** |
| 613 * @return {boolean} True if the fakebox has focus. | 558 * @return {boolean} True if the fakebox has focus. |
| 614 */ | 559 */ |
| 615 function isFakeboxFocused() { | 560 function isFakeboxFocused() { |
| 616 return document.body.classList.contains(CLASSES.FAKEBOX_FOCUS) || | 561 return document.body.classList.contains(CLASSES.FAKEBOX_FOCUS) || |
| 617 document.body.classList.contains(CLASSES.FAKEBOX_DRAG_FOCUS); | 562 document.body.classList.contains(CLASSES.FAKEBOX_DRAG_FOCUS); |
| 618 } | 563 } |
| 619 | 564 |
| 620 | 565 |
| 621 /** | 566 /** |
| 622 * @param {boolean} enable True to enable the fakebox. | |
| 623 */ | |
| 624 function setFakeboxActive(enable) { | |
| 625 document.body.classList.toggle(CLASSES.FAKEBOX_DISABLE, !enable); | |
| 626 } | |
| 627 | |
| 628 | |
| 629 /** | |
| 630 * @param {!Event} event The click event. | 567 * @param {!Event} event The click event. |
| 631 * @return {boolean} True if the click occurred in an enabled fakebox. | 568 * @return {boolean} True if the click occurred in an enabled fakebox. |
| 632 */ | 569 */ |
| 633 function isFakeboxClick(event) { | 570 function isFakeboxClick(event) { |
| 634 return fakebox.contains(event.target) && | 571 return fakebox.contains(event.target); |
| 635 !document.body.classList.contains(CLASSES.FAKEBOX_DISABLE); | |
|
Marc Treib
2017/02/03 09:16:58
This class is never set
| |
| 636 } | 572 } |
| 637 | 573 |
| 638 | 574 |
| 639 /** | 575 /** |
| 640 * @param {boolean} show True to show the fakebox and logo. | 576 * @param {boolean} show True to show the fakebox and logo. |
| 641 */ | 577 */ |
| 642 function setFakeboxAndLogoVisibility(show) { | 578 function setFakeboxAndLogoVisibility(show) { |
| 643 document.body.classList.toggle(CLASSES.HIDE_FAKEBOX_AND_LOGO, !show); | 579 document.body.classList.toggle(CLASSES.HIDE_FAKEBOX_AND_LOGO, !show); |
| 644 } | 580 } |
| 645 | 581 |
| 646 | 582 |
| 647 /** | 583 /** |
| 648 * Shortcut for document.getElementById. | |
| 649 * @param {string} id of the element. | |
| 650 * @return {HTMLElement} with the id. | |
| 651 */ | |
| 652 function $(id) { | |
|
Marc Treib
2017/02/03 09:16:58
There's an exact duplicate above
| |
| 653 return document.getElementById(id); | |
| 654 } | |
| 655 | |
| 656 | |
| 657 /** | |
| 658 * Utility function which creates an element with an optional classname and | |
| 659 * appends it to the specified parent. | |
| 660 * @param {Element} parent The parent to append the new element. | |
| 661 * @param {string} name The name of the new element. | |
| 662 * @param {string=} opt_class The optional classname of the new element. | |
| 663 * @return {Element} The new element. | |
| 664 */ | |
| 665 function createAndAppendElement(parent, name, opt_class) { | |
|
Marc Treib
2017/02/03 09:16:58
There was only one caller, which turned out to be
| |
| 666 var child = document.createElement(name); | |
| 667 if (opt_class) | |
| 668 child.classList.add(opt_class); | |
| 669 parent.appendChild(child); | |
| 670 return child; | |
| 671 } | |
| 672 | |
| 673 | |
| 674 /** | |
| 675 * @param {!Element} element The element to register the handler for. | 584 * @param {!Element} element The element to register the handler for. |
| 676 * @param {number} keycode The keycode of the key to register. | 585 * @param {number} keycode The keycode of the key to register. |
| 677 * @param {!Function} handler The key handler to register. | 586 * @param {!Function} handler The key handler to register. |
| 678 */ | 587 */ |
| 679 function registerKeyHandler(element, keycode, handler) { | 588 function registerKeyHandler(element, keycode, handler) { |
| 680 element.addEventListener('keydown', function(event) { | 589 element.addEventListener('keydown', function(event) { |
| 681 if (event.keyCode == keycode) | 590 if (event.keyCode == keycode) |
| 682 handler(event); | 591 handler(event); |
| 683 }); | 592 }); |
| 684 } | 593 } |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 709 lastBlacklistedTile = args.tid; | 618 lastBlacklistedTile = args.tid; |
| 710 | 619 |
| 711 ntpApiHandle.deleteMostVisitedItem(args.tid); | 620 ntpApiHandle.deleteMostVisitedItem(args.tid); |
| 712 } | 621 } |
| 713 // TODO(treib): Should we also handle the 'loaded' message from the iframe | 622 // TODO(treib): Should we also handle the 'loaded' message from the iframe |
| 714 // here? We could hide the page until it arrives, to avoid flicker. | 623 // here? We could hide the page until it arrives, to avoid flicker. |
| 715 } | 624 } |
| 716 | 625 |
| 717 | 626 |
| 718 /** | 627 /** |
| 719 * Prepares the New Tab Page by adding listeners, rendering the current | 628 * Prepares the New Tab Page by adding listeners, the most visited pages |
| 720 * theme, the most visited pages section, and Google-specific elements for a | 629 * section, and Google-specific elements for a Google-provided page. |
| 721 * Google-provided page. | |
| 722 */ | 630 */ |
| 723 function init() { | 631 function init() { |
| 724 notification = $(IDS.NOTIFICATION); | 632 notification = $(IDS.NOTIFICATION); |
| 725 attribution = $(IDS.ATTRIBUTION); | 633 attribution = $(IDS.ATTRIBUTION); |
| 726 ntpContents = $(IDS.NTP_CONTENTS); | 634 ntpContents = $(IDS.NTP_CONTENTS); |
| 727 | 635 |
| 728 if (configData.isGooglePage) { | 636 if (configData.isGooglePage) { |
| 729 var logo = document.createElement('div'); | 637 var logo = document.createElement('div'); |
| 730 logo.id = IDS.LOGO; | 638 logo.id = IDS.LOGO; |
| 731 logo.title = 'Google'; | 639 logo.title = 'Google'; |
| (...skipping 20 matching lines...) Expand all Loading... | |
| 752 notificationMessage.textContent = | 660 notificationMessage.textContent = |
| 753 configData.translatedStrings.thumbnailRemovedNotification; | 661 configData.translatedStrings.thumbnailRemovedNotification; |
| 754 | 662 |
| 755 var undoLink = $(IDS.UNDO_LINK); | 663 var undoLink = $(IDS.UNDO_LINK); |
| 756 undoLink.addEventListener('click', onUndo); | 664 undoLink.addEventListener('click', onUndo); |
| 757 registerKeyHandler(undoLink, KEYCODE.ENTER, onUndo); | 665 registerKeyHandler(undoLink, KEYCODE.ENTER, onUndo); |
| 758 undoLink.textContent = configData.translatedStrings.undoThumbnailRemove; | 666 undoLink.textContent = configData.translatedStrings.undoThumbnailRemove; |
| 759 | 667 |
| 760 var restoreAllLink = $(IDS.RESTORE_ALL_LINK); | 668 var restoreAllLink = $(IDS.RESTORE_ALL_LINK); |
| 761 restoreAllLink.addEventListener('click', onRestoreAll); | 669 restoreAllLink.addEventListener('click', onRestoreAll); |
| 762 registerKeyHandler(restoreAllLink, KEYCODE.ENTER, onUndo); | 670 registerKeyHandler(restoreAllLink, KEYCODE.ENTER, onRestoreAll); |
| 763 restoreAllLink.textContent = | 671 restoreAllLink.textContent = |
| 764 configData.translatedStrings.restoreThumbnailsShort; | 672 configData.translatedStrings.restoreThumbnailsShort; |
| 765 | 673 |
| 766 $(IDS.ATTRIBUTION_TEXT).textContent = | 674 $(IDS.ATTRIBUTION_TEXT).textContent = |
| 767 configData.translatedStrings.attributionIntro; | 675 configData.translatedStrings.attributionIntro; |
| 768 | 676 |
| 769 var notificationCloseButton = $(IDS.NOTIFICATION_CLOSE_BUTTON); | 677 $(IDS.NOTIFICATION_CLOSE_BUTTON).addEventListener('click', hideNotification); |
| 770 createAndAppendElement( | |
| 771 notificationCloseButton, 'div', CLASSES.BLACKLIST_BUTTON_INNER); | |
|
Marc Treib
2017/02/03 09:16:59
No idea what this was supposed to do. The class do
| |
| 772 notificationCloseButton.addEventListener('click', hideNotification); | |
| 773 | 678 |
| 774 window.addEventListener('resize', onResize); | 679 window.addEventListener('resize', onResize); |
| 775 updateContentWidth(); | 680 updateContentWidth(); |
| 776 | 681 |
| 777 var topLevelHandle = getEmbeddedSearchApiHandle(); | 682 var topLevelHandle = getEmbeddedSearchApiHandle(); |
| 778 | 683 |
| 779 ntpApiHandle = topLevelHandle.newTabPage; | 684 ntpApiHandle = topLevelHandle.newTabPage; |
| 780 ntpApiHandle.onthemechange = onThemeChange; | 685 ntpApiHandle.onthemechange = onThemeChange; |
| 781 ntpApiHandle.onmostvisitedchange = onMostVisitedChange; | 686 ntpApiHandle.onmostvisitedchange = onMostVisitedChange; |
| 782 | 687 |
| 783 ntpApiHandle.oninputstart = onInputStart; | 688 ntpApiHandle.oninputstart = onInputStart; |
| 784 ntpApiHandle.oninputcancel = restoreNtp; | 689 ntpApiHandle.oninputcancel = onInputCancel; |
| 785 | 690 |
| 786 if (ntpApiHandle.isInputInProgress) | 691 if (ntpApiHandle.isInputInProgress) |
| 787 onInputStart(); | 692 onInputStart(); |
| 788 | 693 |
| 789 searchboxApiHandle = topLevelHandle.searchBox; | 694 searchboxApiHandle = topLevelHandle.searchBox; |
| 790 | 695 |
| 791 if (fakebox) { | 696 if (fakebox) { |
| 792 // Listener for updating the key capture state. | 697 // Listener for updating the key capture state. |
| 793 document.body.onmousedown = function(event) { | 698 document.body.onmousedown = function(event) { |
| 794 if (isFakeboxClick(event)) | 699 if (isFakeboxClick(event)) |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 872 | 777 |
| 873 return { | 778 return { |
| 874 init: init, | 779 init: init, |
| 875 listen: listen | 780 listen: listen |
| 876 }; | 781 }; |
| 877 } | 782 } |
| 878 | 783 |
| 879 if (!window.localNTPUnitTest) { | 784 if (!window.localNTPUnitTest) { |
| 880 LocalNTP().listen(); | 785 LocalNTP().listen(); |
| 881 } | 786 } |
| OLD | NEW |