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 1312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1323 1, | 1323 1, |
1324 (Math.max(0, -boundedScrollPosition)) + 10 / 30); | 1324 (Math.max(0, -boundedScrollPosition)) + 10 / 30); |
1325 | 1325 |
1326 overflowRightMask.style.opacity = | 1326 overflowRightMask.style.opacity = |
1327 Math.min( | 1327 Math.min( |
1328 1, | 1328 1, |
1329 (Math.max(0, boundedScrollPosition - maxRightScroll) + 10) / 30); | 1329 (Math.max(0, boundedScrollPosition - maxRightScroll) + 10) / 30); |
1330 | 1330 |
1331 // Set the position of the title. | 1331 // Set the position of the title. |
1332 if (titleWidth < containerWidth) { | 1332 if (titleWidth < containerWidth) { |
1333 title.style.left = '0px'; | 1333 // left-align on LTR and right-align on RTL. |
| 1334 title.style.left = ''; |
1334 } else { | 1335 } else { |
1335 title.style.left = boundedScrollPosition + 'px'; | 1336 title.style.left = boundedScrollPosition + 'px'; |
1336 } | 1337 } |
1337 } | 1338 } |
1338 | 1339 |
1339 /** | 1340 /** |
1340 * Initializes a scrolling title element. | 1341 * Initializes a scrolling title element. |
1341 * @param {Element} wrapperEl The wrapper element of the scrolling title. | 1342 * @param {Element} wrapperEl The wrapper element of the scrolling title. |
1342 */ | 1343 */ |
1343 function initializeTitleScroller(wrapperEl) { | 1344 function initializeTitleScroller(wrapperEl) { |
(...skipping 1320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2664 // NTP Entry point. | 2665 // NTP Entry point. |
2665 ///////////////////////////////////////////////////////////////////////////// | 2666 ///////////////////////////////////////////////////////////////////////////// |
2666 | 2667 |
2667 /* | 2668 /* |
2668 * Handles initializing the UI when the page has finished loading. | 2669 * Handles initializing the UI when the page has finished loading. |
2669 */ | 2670 */ |
2670 window.addEventListener('DOMContentLoaded', function(evt) { | 2671 window.addEventListener('DOMContentLoaded', function(evt) { |
2671 ntp.init(); | 2672 ntp.init(); |
2672 $('content-area').style.display = 'block'; | 2673 $('content-area').style.display = 'block'; |
2673 }); | 2674 }); |
OLD | NEW |