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

Side by Side Diff: chrome/browser/resources/ntp4/bookmarks_page.js

Issue 7833021: [ntp4] Add a 'Manage Bookmarks' link at the top of the Bookmarks page. Also right-align links. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 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 (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 215 matching lines...) Expand 10 before | Expand all | Expand 10 after
226 226
227 /** 227 /**
228 * Initialize the bookmarks page object. 228 * Initialize the bookmarks page object.
229 */ 229 */
230 initialize: function() { 230 initialize: function() {
231 this.classList.add('bookmarks-page'); 231 this.classList.add('bookmarks-page');
232 232
233 // insert the bookmark titles header which is unique to bookmark pages. 233 // insert the bookmark titles header which is unique to bookmark pages.
234 this.insertBefore($('bookmarks-title-wrapper'), this.firstChild); 234 this.insertBefore($('bookmarks-title-wrapper'), this.firstChild);
235 235
236 // insert a container for a link to a Bookmarks Manager page. 236 // insert the top & bottom links for the Bookmarks Manager page.
Evan Stade 2011/09/05 01:59:20 Insert
csilv 2011/09/06 05:33:33 Done.
237 var link = document.createElement('a'); 237 var pageContent = this.querySelector('.tile-page-content');
238 link.className = 'bookmarks-manager-link'; 238 var topWrapper = $('bookmarks-top-link-wrapper');
239 link.textContent = localStrings.getString('bookmarksManagerLinkTitle'); 239 pageContent.insertBefore(topWrapper, pageContent.firstChild);
240 var container = document.createElement('div'); 240 topWrapper.hidden = false;
241 container.className = 'bookmarks-manager-link-container'; 241 pageContent.appendChild($('bookmarks-bottom-link-wrapper'));
242 container.hidden = true;
243 container.appendChild(link);
244 this.querySelector('.tile-page-content').appendChild(container);
245 }, 242 },
246 243
247 /** 244 /**
248 * Build the bookmark titles bar (ie, navigation hiearchy). 245 * Build the bookmark titles bar (ie, navigation hiearchy).
249 * @param {Array} items The parent hiearchy of the current folder. 246 * @param {Array} items The parent hiearchy of the current folder.
250 * @private 247 * @private
251 */ 248 */
252 updateBookmarkTitles_: function(items) { 249 updateBookmarkTitles_: function(items) {
253 var wrapper = $('bookmarks-title-wrapper'); 250 var wrapper = $('bookmarks-title-wrapper');
254 var title = wrapper.querySelector('.section-title'); 251 var title = wrapper.querySelector('.section-title');
(...skipping 16 matching lines...) Expand all
271 * Build the bookmark tiles. 268 * Build the bookmark tiles.
272 * @param {Array} items The contents of the current folder. 269 * @param {Array} items The contents of the current folder.
273 * @private 270 * @private
274 */ 271 */
275 updateBookmarkTiles_: function(items) { 272 updateBookmarkTiles_: function(items) {
276 this.removeAllTiles(); 273 this.removeAllTiles();
277 var tile_count = Math.min(items.length, MAX_BOOKMARK_TILES); 274 var tile_count = Math.min(items.length, MAX_BOOKMARK_TILES);
278 for (var i = 0; i < tile_count; i++) 275 for (var i = 0; i < tile_count; i++)
279 this.appendTile(new Bookmark(items[i]), false); 276 this.appendTile(new Bookmark(items[i]), false);
280 277
281 var container = this.querySelector('.bookmarks-manager-link-container'); 278 var wrapper = $('bookmarks-bottom-link-wrapper');
282 if (items.length > MAX_BOOKMARK_TILES) { 279 if (items.length > MAX_BOOKMARK_TILES) {
283 var link = container.querySelector('.bookmarks-manager-link'); 280 var link = wrapper.querySelector('a');
284 link.href = 'chrome://bookmarks/#' + this.id; 281 link.href = 'chrome://bookmarks/#' + this.id;
285 container.hidden = false; 282 wrapper.hidden = false;
286 } else { 283 } else {
287 container.hidden = true; 284 wrapper.hidden = true;
288 } 285 }
289 }, 286 },
290 287
291 /** 288 /**
292 * Determine whether a bookmark ID matches a folder in the current 289 * Determine whether a bookmark ID matches a folder in the current
293 * hierarchy. 290 * hierarchy.
294 * @param {string} id The bookmark ID to search for. 291 * @param {string} id The bookmark ID to search for.
295 * @private 292 * @private
296 */ 293 */
297 isBookmarkInParentHierarchy_: function(id) { 294 isBookmarkInParentHierarchy_: function(id) {
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
480 tile.stripeColor = color; 477 tile.stripeColor = color;
481 }; 478 };
482 479
483 return { 480 return {
484 BookmarksPage: BookmarksPage, 481 BookmarksPage: BookmarksPage,
485 initBookmarkChevron: initBookmarkChevron, 482 initBookmarkChevron: initBookmarkChevron,
486 }; 483 };
487 }); 484 });
488 485
489 window.addEventListener('load', ntp4.initBookmarkChevron); 486 window.addEventListener('load', ntp4.initBookmarkChevron);
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698