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

Side by Side Diff: chrome/browser/resources/local_ntp/local_ntp.js

Issue 412073002: Local NTP: prevent tiles from reloading on resize by moving them into single <div>. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 21 matching lines...) Expand all
32 // Applies drag focus style to the fakebox 32 // Applies drag focus style to the fakebox
33 FAKEBOX_DRAG_FOCUS: 'fakebox-drag-focused', 33 FAKEBOX_DRAG_FOCUS: 'fakebox-drag-focused',
34 FAVICON: 'mv-favicon', 34 FAVICON: 'mv-favicon',
35 HIDE_BLACKLIST_BUTTON: 'mv-x-hide', // hides blacklist button during animation 35 HIDE_BLACKLIST_BUTTON: 'mv-x-hide', // hides blacklist button during animation
36 HIDE_FAKEBOX_AND_LOGO: 'hide-fakebox-logo', 36 HIDE_FAKEBOX_AND_LOGO: 'hide-fakebox-logo',
37 HIDE_NOTIFICATION: 'mv-notice-hide', 37 HIDE_NOTIFICATION: 'mv-notice-hide',
38 // Vertically centers the most visited section for a non-Google provided page. 38 // Vertically centers the most visited section for a non-Google provided page.
39 NON_GOOGLE_PAGE: 'non-google-page', 39 NON_GOOGLE_PAGE: 'non-google-page',
40 PAGE: 'mv-page', // page tiles 40 PAGE: 'mv-page', // page tiles
41 PAGE_READY: 'mv-page-ready', // page tile when ready 41 PAGE_READY: 'mv-page-ready', // page tile when ready
42 ROW: 'mv-row', // tile row
43 RTL: 'rtl', // Right-to-left language text. 42 RTL: 'rtl', // Right-to-left language text.
44 THUMBNAIL: 'mv-thumb', 43 THUMBNAIL: 'mv-thumb',
45 THUMBNAIL_MASK: 'mv-mask', 44 THUMBNAIL_MASK: 'mv-mask',
46 TILE: 'mv-tile', 45 TILE: 'mv-tile',
47 TITLE: 'mv-title' 46 TITLE: 'mv-title'
48 }; 47 };
49 48
50 49
51 /** 50 /**
52 * Enum for HTML element ids. 51 * Enum for HTML element ids.
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 197
199 198
200 /** 199 /**
201 * The state of the NTP when a query is entered into the Fakebox. 200 * The state of the NTP when a query is entered into the Fakebox.
202 * @type {NTP_DISPOSE_STATE} 201 * @type {NTP_DISPOSE_STATE}
203 */ 202 */
204 var fakeboxInputBehavior = NTP_DISPOSE_STATE.HIDE_FAKEBOX_AND_LOGO; 203 var fakeboxInputBehavior = NTP_DISPOSE_STATE.HIDE_FAKEBOX_AND_LOGO;
205 204
206 205
207 /** 206 /**
207 * A counter to control the visibility of tile elements.
208 * @type {number}
209 */
210 var tileVisibilityCounter = 0;
beaudoin 2014/07/24 15:24:36 I'd prefer numHiddenTiles with a matching comment.
huangs 2014/07/24 19:33:11 Per discussion, numHiddenTiles will be off by one
211
212
213 /**
208 * Total tile width. Should be equal to mv-tile's width + 2 * border-width. 214 * Total tile width. Should be equal to mv-tile's width + 2 * border-width.
209 * @private {number} 215 * @private {number}
210 * @const 216 * @const
211 */ 217 */
212 var TILE_WIDTH = 140; 218 var TILE_WIDTH = 140;
213 219
214 220
215 /** 221 /**
216 * Margin between tiles. Should be equal to mv-tile's -webkit-margin-start. 222 * Margin between tiles. Should be equal to mv-tile's -webkit-margin-start.
217 * @private {number} 223 * @private {number}
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 328
323 var background = [convertToRGBAColor(info.backgroundColorRgba), 329 var background = [convertToRGBAColor(info.backgroundColorRgba),
324 info.imageUrl, 330 info.imageUrl,
325 info.imageTiling, 331 info.imageTiling,
326 info.imageHorizontalAlignment, 332 info.imageHorizontalAlignment,
327 info.imageVerticalAlignment].join(' ').trim(); 333 info.imageVerticalAlignment].join(' ').trim();
328 document.body.style.background = background; 334 document.body.style.background = background;
329 document.body.classList.toggle(CLASSES.ALTERNATE_LOGO, info.alternateLogo); 335 document.body.classList.toggle(CLASSES.ALTERNATE_LOGO, info.alternateLogo);
330 updateThemeAttribution(info.attributionUrl); 336 updateThemeAttribution(info.attributionUrl);
331 setCustomThemeStyle(info); 337 setCustomThemeStyle(info);
338
332 renderTiles(); 339 renderTiles();
333 } 340 }
334 341
335 342
336 /** 343 /**
337 * Updates the NTP style according to theme. 344 * Updates the NTP style according to theme.
338 * @param {Object=} opt_themeInfo The information about the theme. If it is 345 * @param {Object=} opt_themeInfo The information about the theme. If it is
339 * omitted the style will be reverted to the default. 346 * omitted the style will be reverted to the default.
340 * @private 347 * @private
341 */ 348 */
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 function convertToRGBAColor(color) { 432 function convertToRGBAColor(color) {
426 return 'rgba(' + color[0] + ',' + color[1] + ',' + color[2] + ',' + 433 return 'rgba(' + color[0] + ',' + color[1] + ',' + color[2] + ',' +
427 color[3] / 255 + ')'; 434 color[3] / 255 + ')';
428 } 435 }
429 436
430 437
431 /** 438 /**
432 * Handles a new set of Most Visited page data. 439 * Handles a new set of Most Visited page data.
433 */ 440 */
434 function onMostVisitedChange() { 441 function onMostVisitedChange() {
435 var pages = ntpApiHandle.mostVisited;
436
437 if (isBlacklisting) { 442 if (isBlacklisting) {
438 // Trigger the blacklist animation and re-render the tiles when it 443 // Trigger the blacklist animation. On completion, the handler will call
439 // completes. 444 // reloadAllTiles().
440 var lastBlacklistedTileElement = lastBlacklistedTile.elem; 445 var lastBlacklistedTileElement = lastBlacklistedTile.elem;
441 lastBlacklistedTileElement.addEventListener( 446 lastBlacklistedTileElement.addEventListener(
442 'webkitTransitionEnd', blacklistAnimationDone); 447 'webkitTransitionEnd', blacklistAnimationDone);
443 lastBlacklistedTileElement.classList.add(CLASSES.BLACKLIST); 448 lastBlacklistedTileElement.classList.add(CLASSES.BLACKLIST);
444 449
Mathieu 2014/07/24 15:11:25 remove extra new line
huangs 2014/07/24 19:33:11 Done.
445 } else { 450 } else {
446 // Otherwise render the tiles using the new data without animation.
447 tiles = [];
448 for (var i = 0; i < MAX_NUM_TILES_TO_SHOW; ++i) {
449 tiles.push(createTile(pages[i], i));
450 }
451 if (!userInitiatedMostVisitedChange) { 451 if (!userInitiatedMostVisitedChange) {
452 tilesContainer.hidden = true; 452 tilesContainer.hidden = true;
453 window.setTimeout(function() { 453 window.setTimeout(function() {
454 if (tilesContainer) { 454 if (tilesContainer) {
455 tilesContainer.hidden = false; 455 tilesContainer.hidden = false;
456 } 456 }
457 }, MOST_VISITED_PAINT_TIMEOUT_MSEC); 457 }, MOST_VISITED_PAINT_TIMEOUT_MSEC);
458 } 458 }
459 renderTiles(); 459 reloadAllTiles();
460 } 460 }
461 } 461 }
462 462
463 463
464 /** 464 /**
465 * Renders the current set of tiles. 465 * Fetches new data, creates, and renders tiles.
466 */
467 function reloadAllTiles() {
468 var pages = ntpApiHandle.mostVisited;
469
470 tiles = [];
471 deltaMostVisitedVisibility(1);
beaudoin 2014/07/24 15:24:36 I'd use just a ++ here and call the other decre
huangs 2014/07/24 19:33:12 Changed to Barrier.
472 for (var i = 0; i < MAX_NUM_TILES_TO_SHOW; ++i) {
473 tiles.push(createTile(pages[i], i));
474 }
475 renderTiles();
476 deltaMostVisitedVisibility(-1);
477 }
478
479
480 /**
481 * Adds the current list of tiles to DOM.
466 */ 482 */
467 function renderTiles() { 483 function renderTiles() {
468 var rows = tilesContainer.children; 484 removeChildren(tilesContainer);
469 for (var i = 0; i < rows.length; ++i) { 485 var renderedList = tilesContainer.querySelectorAll('.mv-tile');
470 removeChildren(rows[i]); 486 var size = Math.min(tiles.length, numColumnsShown * NUM_ROWS);
471 } 487 for (var i = 0; i < size; ++i) {
472 488 tilesContainer.appendChild(tiles[i].elem);
473 for (var i = 0, length = tiles.length;
474 i < Math.min(length, numColumnsShown * NUM_ROWS); ++i) {
475 rows[Math.floor(i / numColumnsShown)].appendChild(tiles[i].elem);
476 } 489 }
477 } 490 }
478 491
479 492
480 /** 493 /**
481 * Shows most visited tiles if all child iframes are loaded, and hides them 494 * Shows or hides rendered tiles, depending on the number of columns shown.
495 */
496 function showTiles() {
497 var renderedList = tilesContainer.querySelectorAll('.mv-tile');
498 var numVisible = Math.min(tiles.length, numColumnsShown * NUM_ROWS);
499 for (var i = 0; i < renderedList.length; ++i) {
500 renderedList[i].style.display = i < numVisible ? 'inline-block' : 'none';
501 }
502 }
503
504
505 /**
506 * Changes the visibility counter for most visited tiles by |delta|, and
Mathieu 2014/07/24 15:11:25 *Most Visited
huangs 2014/07/24 19:33:11 Done.
507 * makes the tiles visible once the count decreases to 0.
482 * otherwise. 508 * otherwise.
Mathieu 2014/07/24 15:11:25 fix comment
huangs 2014/07/24 19:33:11 Done.
509 * @param {number} delta The amount to change counter by, usually 1 or -1.
483 */ 510 */
484 function updateMostVisitedVisibility() { 511 function deltaMostVisitedVisibility(delta) {
Mathieu 2014/07/24 15:11:25 As discussed offline, reconsider if this function
huangs 2014/07/24 19:33:11 This function is needed: in onMostVisitedChange(),
485 var iframes = tilesContainer.querySelectorAll('iframe'); 512 tileVisibilityCounter += delta;
486 var ready = true; 513 if (tileVisibilityCounter === 0) {
487 for (var i = 0, numIframes = iframes.length; i < numIframes; i++) {
488 if (iframes[i].hidden) {
489 ready = false;
490 break;
491 }
492 }
493 if (ready) {
494 tilesContainer.hidden = false; 514 tilesContainer.hidden = false;
495 userInitiatedMostVisitedChange = false; 515 userInitiatedMostVisitedChange = false;
496 } 516 }
497 } 517 }
498 518
499 519
500 /** 520 /**
501 * Builds a URL to display a most visited tile component in an iframe. 521 * Builds a URL to display a most visited tile component in an iframe.
502 * @param {string} filename The desired most visited component filename. 522 * @param {string} filename The desired most visited component filename.
503 * @param {number} rid The restricted ID. 523 * @param {number} rid The restricted ID.
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
556 // begins loading RIDs n, n+1, ..., n+k-1; after the second event, these get 576 // begins loading RIDs n, n+1, ..., n+k-1; after the second event, these get
557 // destroyed and a new set begins loading RIDs n+k, n+k+1, ..., n+2k-1. 577 // destroyed and a new set begins loading RIDs n+k, n+k+1, ..., n+2k-1.
558 // Now due to crbug.com/68841, Chrome incorrectly loads the content for the 578 // Now due to crbug.com/68841, Chrome incorrectly loads the content for the
559 // first set of iframes into the most recent set of iframes. 579 // first set of iframes into the most recent set of iframes.
560 // 580 //
561 // Giving iframes distinct ids seems to cause some invalidation and prevent 581 // Giving iframes distinct ids seems to cause some invalidation and prevent
562 // associating the incorrect data. 582 // associating the incorrect data.
563 // 583 //
564 // TODO(jered): Find and fix the root (probably Blink) bug. 584 // TODO(jered): Find and fix the root (probably Blink) bug.
565 585
586 // Keep this id here. See comment above.
587 titleElement.id = 'title-' + rid;
588 titleElement.className = CLASSES.TITLE;
589 titleElement.hidden = true;
590 deltaMostVisitedVisibility(1);
beaudoin 2014/07/24 15:24:36 ++
huangs 2014/07/24 19:33:11 Acknowledged.
591 titleElement.onload = function() {
592 titleElement.hidden = false;
593 deltaMostVisitedVisibility(-1);
beaudoin 2014/07/24 15:24:36 decrementNumberOfVisibleTiles();
huangs 2014/07/24 19:33:11 Acknowledged.
594 };
566 titleElement.src = getMostVisitedIframeUrl( 595 titleElement.src = getMostVisitedIframeUrl(
567 MOST_VISITED_TITLE_IFRAME, rid, MOST_VISITED_COLOR, 596 MOST_VISITED_TITLE_IFRAME, rid, MOST_VISITED_COLOR,
568 MOST_VISITED_FONT_FAMILY, MOST_VISITED_FONT_SIZE, position); 597 MOST_VISITED_FONT_FAMILY, MOST_VISITED_FONT_SIZE, position);
569
570 // Keep this id here. See comment above.
571 titleElement.id = 'title-' + rid;
572 titleElement.hidden = true;
573 titleElement.onload = function() {
574 titleElement.hidden = false;
575 updateMostVisitedVisibility();
576 };
577 titleElement.className = CLASSES.TITLE;
578 tileElement.appendChild(titleElement); 598 tileElement.appendChild(titleElement);
579 599
580 // The iframe which renders either a thumbnail or domain element. 600 // The iframe which renders either a thumbnail or domain element.
581 var thumbnailElement = document.createElement('iframe'); 601 var thumbnailElement = document.createElement('iframe');
582 thumbnailElement.tabIndex = '-1'; 602 thumbnailElement.tabIndex = '-1';
603 // Keep this id here. See comment above.
604 thumbnailElement.id = 'thumb-' + rid;
605 thumbnailElement.className = CLASSES.THUMBNAIL;
606 thumbnailElement.hidden = true;
607 deltaMostVisitedVisibility(1);
beaudoin 2014/07/24 15:24:37 Same.
huangs 2014/07/24 19:33:12 Acknowledged.
608 thumbnailElement.onload = function() {
609 thumbnailElement.hidden = false;
610 tileElement.classList.add(CLASSES.PAGE_READY);
611 deltaMostVisitedVisibility(-1);
612 };
583 thumbnailElement.src = getMostVisitedIframeUrl( 613 thumbnailElement.src = getMostVisitedIframeUrl(
584 MOST_VISITED_THUMBNAIL_IFRAME, rid, MOST_VISITED_COLOR, 614 MOST_VISITED_THUMBNAIL_IFRAME, rid, MOST_VISITED_COLOR,
585 MOST_VISITED_FONT_FAMILY, MOST_VISITED_FONT_SIZE, position); 615 MOST_VISITED_FONT_FAMILY, MOST_VISITED_FONT_SIZE, position);
586
587 // Keep this id here. See comment above.
588 thumbnailElement.id = 'thumb-' + rid;
589 thumbnailElement.hidden = true;
590 thumbnailElement.onload = function() {
591 thumbnailElement.hidden = false;
592 tileElement.classList.add(CLASSES.PAGE_READY);
593 updateMostVisitedVisibility();
594 };
595 thumbnailElement.className = CLASSES.THUMBNAIL;
596 tileElement.appendChild(thumbnailElement); 616 tileElement.appendChild(thumbnailElement);
597 617
598 // A mask to darken the thumbnail on focus. 618 // A mask to darken the thumbnail on focus.
599 var maskElement = createAndAppendElement( 619 var maskElement = createAndAppendElement(
600 tileElement, 'div', CLASSES.THUMBNAIL_MASK); 620 tileElement, 'div', CLASSES.THUMBNAIL_MASK);
601 621
602 // The button used to blacklist this page. 622 // The button used to blacklist this page.
603 var blacklistButton = createAndAppendElement( 623 var blacklistButton = createAndAppendElement(
604 tileElement, 'div', CLASSES.BLACKLIST_BUTTON); 624 tileElement, 'div', CLASSES.BLACKLIST_BUTTON);
605 var blacklistFunction = generateBlacklistFunction(rid); 625 var blacklistFunction = generateBlacklistFunction(rid);
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 */ 689 */
670 function blacklistAnimationDone() { 690 function blacklistAnimationDone() {
671 showNotification(); 691 showNotification();
672 isBlacklisting = false; 692 isBlacklisting = false;
673 tilesContainer.classList.remove(CLASSES.HIDE_BLACKLIST_BUTTON); 693 tilesContainer.classList.remove(CLASSES.HIDE_BLACKLIST_BUTTON);
674 lastBlacklistedTile.elem.removeEventListener( 694 lastBlacklistedTile.elem.removeEventListener(
675 'webkitTransitionEnd', blacklistAnimationDone); 695 'webkitTransitionEnd', blacklistAnimationDone);
676 // Need to call explicitly to re-render the tiles, since the initial 696 // Need to call explicitly to re-render the tiles, since the initial
677 // onmostvisitedchange issued by the blacklist function only triggered 697 // onmostvisitedchange issued by the blacklist function only triggered
678 // the animation. 698 // the animation.
679 onMostVisitedChange(); 699 reloadAllTiles();
680 } 700 }
681 701
682 702
683 /** 703 /**
684 * Handles a click on the notification undo link by hiding the notification and 704 * Handles a click on the notification undo link by hiding the notification and
685 * informing Chrome. 705 * informing Chrome.
686 */ 706 */
687 function onUndo() { 707 function onUndo() {
688 userInitiatedMostVisitedChange = true; 708 userInitiatedMostVisitedChange = true;
689 hideNotification(); 709 hideNotification();
(...skipping 17 matching lines...) Expand all
707 /** 727 /**
708 * Re-renders the tiles if the number of columns has changed. As a temporary 728 * Re-renders the tiles if the number of columns has changed. As a temporary
709 * fix for crbug/240510, updates the width of the fakebox and most visited tiles 729 * fix for crbug/240510, updates the width of the fakebox and most visited tiles
710 * container. 730 * container.
711 */ 731 */
712 function onResize() { 732 function onResize() {
713 // If innerWidth is zero, then use the maximum snap size. 733 // If innerWidth is zero, then use the maximum snap size.
714 var innerWidth = window.innerWidth || 820; 734 var innerWidth = window.innerWidth || 820;
715 735
716 // These values should remain in sync with local_ntp.css. 736 // These values should remain in sync with local_ntp.css.
717 // TODO(jeremycho): Delete once the root cause of crbug/240510 is resolved. 737 // TODO(jeremycho): Delete once the root cause of crbug/240510 is resolved.
Mathieu 2014/07/24 15:11:25 this bug as been marked as fixed, I wonder if this
huangs 2014/07/24 19:33:11 Updated the routine and added comments.
718 var setWidths = function(tilesContainerWidth) { 738 var setWidths = function(tilesContainerWidth) {
719 tilesContainer.style.width = tilesContainerWidth + 'px'; 739 tilesContainer.style.width = tilesContainerWidth + 'px';
720 if (fakebox) 740 if (fakebox)
721 fakebox.style.width = (tilesContainerWidth - 2) + 'px'; 741 fakebox.style.width = (tilesContainerWidth - 22) + 'px';
722 }; 742 };
723 if (innerWidth >= 820) 743 if (innerWidth >= 820)
724 setWidths(620); 744 setWidths(640);
725 else if (innerWidth >= 660) 745 else if (innerWidth >= 660)
726 setWidths(460); 746 setWidths(480);
727 else 747 else
728 setWidths(300); 748 setWidths(320);
729 749
730 var tileRequiredWidth = TILE_WIDTH + TILE_MARGIN_START; 750 var tileRequiredWidth = TILE_WIDTH + TILE_MARGIN_START;
731 // Adds margin-start to the available width to compensate the extra margin 751 // Adds margin-start to the available width to compensate the extra margin
732 // counted above for the first tile (which does not have a margin-start). 752 // counted above for the first tile (which does not have a margin-start).
733 var availableWidth = innerWidth + TILE_MARGIN_START - 753 var availableWidth = innerWidth + TILE_MARGIN_START -
734 MIN_TOTAL_HORIZONTAL_PADDING; 754 MIN_TOTAL_HORIZONTAL_PADDING;
735 var numColumnsToShow = Math.floor(availableWidth / tileRequiredWidth); 755 var numColumnsToShow = Math.floor(availableWidth / tileRequiredWidth);
736 numColumnsToShow = Math.max(MIN_NUM_COLUMNS, 756 numColumnsToShow = Math.max(MIN_NUM_COLUMNS,
737 Math.min(MAX_NUM_COLUMNS, numColumnsToShow)); 757 Math.min(MAX_NUM_COLUMNS, numColumnsToShow));
738 if (numColumnsToShow != numColumnsShown) { 758 if (numColumnsToShow != numColumnsShown) {
739 numColumnsShown = numColumnsToShow; 759 numColumnsShown = numColumnsToShow;
740 renderTiles(); 760 showTiles();
741 } 761 }
742 } 762 }
743 763
744 764
745 /** 765 /**
746 * Returns the tile corresponding to the specified page RID. 766 * Returns the tile corresponding to the specified page RID.
747 * @param {number} rid The page RID being looked up. 767 * @param {number} rid The page RID being looked up.
748 * @return {Tile} The corresponding tile. 768 * @return {Tile} The corresponding tile.
749 */ 769 */
750 function getTileByRid(rid) { 770 function getTileByRid(rid) {
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 * Prepares the New Tab Page by adding listeners, rendering the current 937 * Prepares the New Tab Page by adding listeners, rendering the current
918 * theme, the most visited pages section, and Google-specific elements for a 938 * theme, the most visited pages section, and Google-specific elements for a
919 * Google-provided page. 939 * Google-provided page.
920 */ 940 */
921 function init() { 941 function init() {
922 tilesContainer = $(IDS.TILES); 942 tilesContainer = $(IDS.TILES);
923 notification = $(IDS.NOTIFICATION); 943 notification = $(IDS.NOTIFICATION);
924 attribution = $(IDS.ATTRIBUTION); 944 attribution = $(IDS.ATTRIBUTION);
925 ntpContents = $(IDS.NTP_CONTENTS); 945 ntpContents = $(IDS.NTP_CONTENTS);
926 946
927 for (var i = 0; i < NUM_ROWS; i++) {
928 var row = document.createElement('div');
929 row.classList.add(CLASSES.ROW);
930 tilesContainer.appendChild(row);
931 }
932
933 if (configData.isGooglePage) { 947 if (configData.isGooglePage) {
934 var logo = document.createElement('div'); 948 var logo = document.createElement('div');
935 logo.id = IDS.LOGO; 949 logo.id = IDS.LOGO;
936 950
937 fakebox = document.createElement('div'); 951 fakebox = document.createElement('div');
938 fakebox.id = IDS.FAKEBOX; 952 fakebox.id = IDS.FAKEBOX;
939 fakebox.innerHTML = 953 fakebox.innerHTML =
940 '<input id="' + IDS.FAKEBOX_INPUT + 954 '<input id="' + IDS.FAKEBOX_INPUT +
941 '" autocomplete="off" tabindex="-1" aria-hidden="true">' + 955 '" autocomplete="off" tabindex="-1" aria-hidden="true">' +
942 '<div id=cursor></div>'; 956 '<div id="cursor"></div>';
943 957
944 ntpContents.insertBefore(fakebox, ntpContents.firstChild); 958 ntpContents.insertBefore(fakebox, ntpContents.firstChild);
945 ntpContents.insertBefore(logo, ntpContents.firstChild); 959 ntpContents.insertBefore(logo, ntpContents.firstChild);
946 } else { 960 } else {
947 document.body.classList.add(CLASSES.NON_GOOGLE_PAGE); 961 document.body.classList.add(CLASSES.NON_GOOGLE_PAGE);
948 } 962 }
949 963
950 var notificationMessage = $(IDS.NOTIFICATION_MESSAGE); 964 var notificationMessage = $(IDS.NOTIFICATION_MESSAGE);
951 notificationMessage.textContent = 965 notificationMessage.textContent =
952 configData.translatedStrings.thumbnailRemovedNotification; 966 configData.translatedStrings.thumbnailRemovedNotification;
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after
1040 1054
1041 return { 1055 return {
1042 init: init, 1056 init: init,
1043 listen: listen 1057 listen: listen
1044 }; 1058 };
1045 } 1059 }
1046 1060
1047 if (!window.localNTPUnitTest) { 1061 if (!window.localNTPUnitTest) {
1048 LocalNTP().listen(); 1062 LocalNTP().listen();
1049 } 1063 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698