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 cr.define('ntp4', function() { | 5 cr.define('ntp4', function() { |
6 'use strict'; | 6 'use strict'; |
7 | 7 |
8 var localStrings = new LocalStrings; | 8 var localStrings = new LocalStrings; |
9 | 9 |
10 /** | 10 /** |
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 * Build the bookmark tiles. | 292 * Build the bookmark tiles. |
293 * @param {Array} items The contents of the current folder. | 293 * @param {Array} items The contents of the current folder. |
294 * @private | 294 * @private |
295 */ | 295 */ |
296 updateBookmarkTiles_: function(items) { | 296 updateBookmarkTiles_: function(items) { |
297 this.removeAllTiles(); | 297 this.removeAllTiles(); |
298 var tile_count = Math.min(items.length, MAX_BOOKMARK_TILES); | 298 var tile_count = Math.min(items.length, MAX_BOOKMARK_TILES); |
299 for (var i = 0; i < tile_count; i++) | 299 for (var i = 0; i < tile_count; i++) |
300 this.appendTile(new Bookmark(items[i]), false); | 300 this.appendTile(new Bookmark(items[i]), false); |
301 | 301 |
302 var link = $('bookmarks-top-link-wrapper').querySelector('a'); | 302 var folder_id = this.id == ROOT_NODE_ID ? BOOKMARKS_BAR_ID : this.id; |
303 link.href = 'chrome://bookmarks/#' + this.id; | 303 var top_link = $('bookmarks-top-link-wrapper').querySelector('a'); |
| 304 top_link.href = 'chrome://bookmarks/#' + folder_id; |
304 | 305 |
305 var wrapper = $('bookmarks-bottom-link-wrapper'); | 306 var wrapper = $('bookmarks-bottom-link-wrapper'); |
306 if (items.length > MAX_BOOKMARK_TILES) { | 307 if (items.length > MAX_BOOKMARK_TILES) { |
307 var link = wrapper.querySelector('a'); | 308 var bottom_link = wrapper.querySelector('a'); |
308 link.href = 'chrome://bookmarks/#' + this.id; | 309 bottom_link.href = 'chrome://bookmarks/#' + folder_id; |
309 wrapper.hidden = false; | 310 wrapper.hidden = false; |
310 } else { | 311 } else { |
311 wrapper.hidden = true; | 312 wrapper.hidden = true; |
312 } | 313 } |
313 | 314 |
314 if (this.id === ROOT_NODE_ID && !tile_count && !cr.isChromeOS) | 315 if (this.id === ROOT_NODE_ID && !tile_count && !cr.isChromeOS) |
315 this.showImportPromo_(); | 316 this.showImportPromo_(); |
316 }, | 317 }, |
317 | 318 |
318 /** | 319 /** |
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
633 tile.stripeColor = color; | 634 tile.stripeColor = color; |
634 } | 635 } |
635 | 636 |
636 return { | 637 return { |
637 BookmarksPage: BookmarksPage, | 638 BookmarksPage: BookmarksPage, |
638 initBookmarkChevron: initBookmarkChevron, | 639 initBookmarkChevron: initBookmarkChevron, |
639 }; | 640 }; |
640 }); | 641 }); |
641 | 642 |
642 window.addEventListener('load', ntp4.initBookmarkChevron); | 643 window.addEventListener('load', ntp4.initBookmarkChevron); |
OLD | NEW |