function onLoad() {
    sectionsToWaitFor = 1;
    measureNavDots();

    newTabView = new NewTabView();

    if (!loadTimeData.getBoolean('showWebStoreIcon')) {
      var webStoreIcon = $('chrome-web-store-link');
      // Not all versions of the NTP have a footer, so this may not exist.
      if (webStoreIcon)
        webStoreIcon.hidden = true;
    } else {
      var webStoreLink = loadTimeData.getString('webStoreLink');
      var url = appendParam(webStoreLink, 'utm_source', 'chrome-ntp-launcher');
      $('chrome-web-store-link').href = url;
      $('chrome-web-store-link')
          .addEventListener('auxclick', onChromeWebStoreButtonClick);
      $('chrome-web-store-link')
          .addEventListener('click', onChromeWebStoreButtonClick);
    }

    // We need to wait for all the footer menu setup to be completed before
    // we can compute its layout.
    layoutFooter();

    if (loadTimeData.getString('login_status_message')) {
      loginBubble = new cr.ui.Bubble;
      loginBubble.anchorNode = $('login-container');
      loginBubble.arrowLocation = cr.ui.ArrowLocation.TOP_END;
      loginBubble.bubbleAlignment =
          cr.ui.BubbleAlignment.BUBBLE_EDGE_TO_ANCHOR_EDGE;
      loginBubble.deactivateToDismissDelay = 2000;
      loginBubble.closeButtonVisible = false;

      $('login-status-advanced').onclick = function() {
        chrome.send('showAdvancedLoginUI');
      };
      $('login-status-dismiss').onclick = loginBubble.hide.bind(loginBubble);

      var bubbleContent = $('login-status-bubble-contents');
      loginBubble.content = bubbleContent;

      // The anchor node won't be updated until updateLogin is called so don't
      // show the bubble yet.
      shouldShowLoginBubble = true;
    }

    $('login-container').addEventListener('click', showSyncLoginUI);
    if (loadTimeData.getBoolean('shouldShowSyncLogin'))
      chrome.send('initializeSyncLogin');

    doWhenAllSectionsReady(function() {
      // Tell the slider about the pages.
      newTabView.updateSliderCards();
      // Mark the current page.
      newTabView.cardSlider.currentCardValue.navigationDot.classList.add(
          'selected');

      cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true);
      document.documentElement.classList.remove('starting-up');

      startTime = Date.now();
    });
  }
/**
   * Invoked at startup once the DOM is available to initialize the app.
   */
Invoked at startup once the DOM is available to initialize the app.
Invoked at startup once the DOM is available to initialize the app .
function onLoad() {
    sectionsToWaitFor = 1;
    measureNavDots();
    newTabView = new NewTabView();
    if (!loadTimeData.getBoolean('showWebStoreIcon')) {
      var webStoreIcon = $('chrome-web-store-link');
      if (webStoreIcon)
        webStoreIcon.hidden = true;
    } else {
      var webStoreLink = loadTimeData.getString('webStoreLink');
      var url = appendParam(webStoreLink, 'utm_source', 'chrome-ntp-launcher');
      $('chrome-web-store-link').href = url;
      $('chrome-web-store-link')
          .addEventListener('auxclick', onChromeWebStoreButtonClick);
      $('chrome-web-store-link')
          .addEventListener('click', onChromeWebStoreButtonClick);
    }
    layoutFooter();
    if (loadTimeData.getString('login_status_message')) {
      loginBubble = new cr.ui.Bubble;
      loginBubble.anchorNode = $('login-container');
      loginBubble.arrowLocation = cr.ui.ArrowLocation.TOP_END;
      loginBubble.bubbleAlignment =
          cr.ui.BubbleAlignment.BUBBLE_EDGE_TO_ANCHOR_EDGE;
      loginBubble.deactivateToDismissDelay = 2000;
      loginBubble.closeButtonVisible = false;
      $('login-status-advanced').onclick = function() {
        chrome.send('showAdvancedLoginUI');
      };
      $('login-status-dismiss').onclick = loginBubble.hide.bind(loginBubble);
      var bubbleContent = $('login-status-bubble-contents');
      loginBubble.content = bubbleContent;
      shouldShowLoginBubble = true;
    }
    $('login-container').addEventListener('click', showSyncLoginUI);
    if (loadTimeData.getBoolean('shouldShowSyncLogin'))
      chrome.send('initializeSyncLogin');
    doWhenAllSectionsReady(function() {
      newTabView.updateSliderCards();
      newTabView.cardSlider.currentCardValue.navigationDot.classList.add(
          'selected');
      cr.dispatchSimpleEvent(document, 'ntpLoaded', true, true);
      document.documentElement.classList.remove('starting-up');
      startTime = Date.now();
    });
  }
function onLoad ( ) { sectionsToWaitFor = 1 ; measureNavDots ( ) ; newTabView = new NewTabView ( ) ; if ( ! loadTimeData . getBoolean ( 'showWebStoreIcon' ) ) { var webStoreIcon = $ ( 'chrome-web-store-link' ) ; if ( webStoreIcon ) webStoreIcon . hidden = true ; } else { var webStoreLink = loadTimeData . getString ( 'webStoreLink' ) ; var url = appendParam ( webStoreLink , 'utm_source' , 'chrome-ntp-launcher' ) ; $ ( 'chrome-web-store-link' ) . href = url ; $ ( 'chrome-web-store-link' ) . addEventListener ( 'auxclick' , onChromeWebStoreButtonClick ) ; $ ( 'chrome-web-store-link' ) . addEventListener ( 'click' , onChromeWebStoreButtonClick ) ; } layoutFooter ( ) ; if ( loadTimeData . getString ( 'login_status_message' ) ) { loginBubble = new cr . ui . Bubble ; loginBubble . anchorNode = $ ( 'login-container' ) ; loginBubble . arrowLocation = cr . ui . ArrowLocation . TOP_END ; loginBubble . bubbleAlignment = cr . ui . BubbleAlignment . BUBBLE_EDGE_TO_ANCHOR_EDGE ; loginBubble . deactivateToDismissDelay = 2000 ; loginBubble . closeButtonVisible = false ; $ ( 'login-status-advanced' ) . onclick = function ( ) { chrome . send ( 'showAdvancedLoginUI' ) ; } ; $ ( 'login-status-dismiss' ) . onclick = loginBubble . hide . bind ( loginBubble ) ; var bubbleContent = $ ( 'login-status-bubble-contents' ) ; loginBubble . content = bubbleContent ; shouldShowLoginBubble = true ; } $ ( 'login-container' ) . addEventListener ( 'click' , showSyncLoginUI ) ; if ( loadTimeData . getBoolean ( 'shouldShowSyncLogin' ) ) chrome . send ( 'initializeSyncLogin' ) ; doWhenAllSectionsReady ( function ( ) { newTabView . updateSliderCards ( ) ; newTabView . cardSlider . currentCardValue . navigationDot . classList . add ( 'selected' ) ; cr . dispatchSimpleEvent ( document , 'ntpLoaded' , true , true ) ; document . documentElement . classList . remove ( 'starting-up' ) ; startTime = Date . now ( ) ; } ) ; }
Invoked at startup once the DOM is available to initialize the app.
Invoked at startup once the DOM is available to initialize the app .
// Not all versions of the NTP have a footer, so this may not exist. // We need to wait for all the footer menu setup to be completed before // we can compute its layout. // The anchor node won't be updated until updateLogin is called so don't // show the bubble yet. // Tell the slider about the pages. // Mark the current page.