OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 // File Description: | 5 // File Description: |
6 // Contains all the necessary functions for rendering the NTP on mobile | 6 // Contains all the necessary functions for rendering the NTP on mobile |
7 // devices. | 7 // devices. |
8 | 8 |
9 /** | 9 /** |
10 * The event type used to determine when a touch starts. | 10 * The event type used to determine when a touch starts. |
(...skipping 2135 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2146 function updatePaneOnHash() { | 2146 function updatePaneOnHash() { |
2147 var paneIndex = getPaneIndexFromHash(); | 2147 var paneIndex = getPaneIndexFromHash(); |
2148 var pane = panes[paneIndex]; | 2148 var pane = panes[paneIndex]; |
2149 | 2149 |
2150 if (currentPane) | 2150 if (currentPane) |
2151 currentPane.classList.remove('selected'); | 2151 currentPane.classList.remove('selected'); |
2152 pane.classList.add('selected'); | 2152 pane.classList.add('selected'); |
2153 currentPane = pane; | 2153 currentPane = pane; |
2154 currentPaneIndex = paneIndex; | 2154 currentPaneIndex = paneIndex; |
2155 | 2155 |
2156 document.documentElement.scrollTop = 0; | 2156 setScrollTopForDocument(document, 0); |
2157 | 2157 |
2158 var panelPrefix = sectionPrefixes[paneIndex]; | 2158 var panelPrefix = sectionPrefixes[paneIndex]; |
2159 var title = templateData[panelPrefix + '_document_title']; | 2159 var title = templateData[panelPrefix + '_document_title']; |
2160 if (!title) | 2160 if (!title) |
2161 title = templateData['title']; | 2161 title = templateData['title']; |
2162 document.title = title; | 2162 document.title = title; |
2163 | 2163 |
2164 sendNTPTitleLoadedNotification(); | 2164 sendNTPTitleLoadedNotification(); |
2165 | 2165 |
2166 // TODO (dtrainor): Could potentially add logic to reset the bookmark state | 2166 // TODO (dtrainor): Could potentially add logic to reset the bookmark state |
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2723 // NTP Entry point. | 2723 // NTP Entry point. |
2724 ///////////////////////////////////////////////////////////////////////////// | 2724 ///////////////////////////////////////////////////////////////////////////// |
2725 | 2725 |
2726 /* | 2726 /* |
2727 * Handles initializing the UI when the page has finished loading. | 2727 * Handles initializing the UI when the page has finished loading. |
2728 */ | 2728 */ |
2729 window.addEventListener('DOMContentLoaded', function(evt) { | 2729 window.addEventListener('DOMContentLoaded', function(evt) { |
2730 ntp.init(); | 2730 ntp.init(); |
2731 $('content-area').style.display = 'block'; | 2731 $('content-area').style.display = 'block'; |
2732 }); | 2732 }); |
OLD | NEW |