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

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

Issue 9320051: Fix JavaScript style in ntp4 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 10 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 /** 5 /**
6 * @fileoverview PageListView implementation. 6 * @fileoverview PageListView implementation.
7 * PageListView manages page list, dot list, switcher buttons and handles apps 7 * PageListView manages page list, dot list, switcher buttons and handles apps
8 * pages callbacks from backend. 8 * pages callbacks from backend.
9 * 9 *
10 * Note that you need to have AppLauncherHandler in your WebUI to use this code. 10 * Note that you need to have AppLauncherHandler in your WebUI to use this code.
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after
211 'MostVisitedPage should be added as first tile page'); 211 'MostVisitedPage should be added as first tile page');
212 this.mostVisitedPage = page; 212 this.mostVisitedPage = page;
213 } 213 }
214 214
215 // If we're appending an AppsPage and it's a temporary page, animate it. 215 // If we're appending an AppsPage and it's a temporary page, animate it.
216 var animate = page instanceof ntp4.AppsPage && 216 var animate = page instanceof ntp4.AppsPage &&
217 page.classList.contains('temporary'); 217 page.classList.contains('temporary');
218 // Make a deep copy of the dot template to add a new one. 218 // Make a deep copy of the dot template to add a new one.
219 var newDot = new ntp4.NavDot(page, title, titleIsEditable, animate); 219 var newDot = new ntp4.NavDot(page, title, titleIsEditable, animate);
220 page.navigationDot = newDot; 220 page.navigationDot = newDot;
221 this.dotList.insertBefore(newDot, opt_refNode ? opt_refNode.navigationDot 221 this.dotList.insertBefore(newDot,
222 : null); 222 opt_refNode ? opt_refNode.navigationDot :
Evan Stade 2012/02/02 23:48:42 my spidey sense tells me you don't need this line
Tyler Breisacher (Chromium) 2012/02/02 23:54:47 Done.
223 null);
223 // Set a tab index on the first dot. 224 // Set a tab index on the first dot.
224 if (this.dotList.dots.length == 1) 225 if (this.dotList.dots.length == 1)
225 newDot.tabIndex = 3; 226 newDot.tabIndex = 3;
226 227
227 this.eventTracker.add(page, 'pagelayout', this.onPageLayout_.bind(this)); 228 this.eventTracker.add(page, 'pagelayout', this.onPageLayout_.bind(this));
228 }, 229 },
229 230
230 /** 231 /**
231 * Called by chrome when an existing app has been disabled or 232 * Called by chrome when an existing app has been disabled or
232 * removed/uninstalled from chrome. 233 * removed/uninstalled from chrome.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 var page = this.cardSlider.currentCardValue; 476 var page = this.cardSlider.currentCardValue;
476 477
477 this.pageSwitcherStart.hidden = !page || 478 this.pageSwitcherStart.hidden = !page ||
478 (this.cardSlider.currentCard == 0); 479 (this.cardSlider.currentCard == 0);
479 this.pageSwitcherEnd.hidden = !page || 480 this.pageSwitcherEnd.hidden = !page ||
480 (this.cardSlider.currentCard == this.cardSlider.cardCount - 1); 481 (this.cardSlider.currentCard == this.cardSlider.cardCount - 1);
481 482
482 if (!page) 483 if (!page)
483 return; 484 return;
484 485
485 var pageSwitcherLeft = isRTL() ? this.pageSwitcherEnd 486 var pageSwitcherLeft = isRTL() ? this.pageSwitcherEnd :
486 : this.pageSwitcherStart; 487 this.pageSwitcherStart;
487 var pageSwitcherRight = isRTL() ? this.pageSwitcherStart 488 var pageSwitcherRight = isRTL() ? this.pageSwitcherStart :
488 : this.pageSwitcherEnd; 489 this.pageSwitcherEnd;
489 var scrollbarWidth = page.scrollbarWidth; 490 var scrollbarWidth = page.scrollbarWidth;
490 pageSwitcherLeft.style.width = 491 pageSwitcherLeft.style.width =
491 (page.sideMargin + 13) + 'px'; 492 (page.sideMargin + 13) + 'px';
492 pageSwitcherLeft.style.left = '0'; 493 pageSwitcherLeft.style.left = '0';
493 pageSwitcherRight.style.width = 494 pageSwitcherRight.style.width =
494 (page.sideMargin - scrollbarWidth + 13) + 'px'; 495 (page.sideMargin - scrollbarWidth + 13) + 'px';
495 pageSwitcherRight.style.right = scrollbarWidth + 'px'; 496 pageSwitcherRight.style.right = scrollbarWidth + 'px';
496 497
497 var offsetTop = page.querySelector('.tile-page-content').offsetTop + 'px'; 498 var offsetTop = page.querySelector('.tile-page-content').offsetTop + 'px';
498 pageSwitcherLeft.style.top = offsetTop; 499 pageSwitcherLeft.style.top = offsetTop;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 if (page.navigationDot) 648 if (page.navigationDot)
648 page.navigationDot.remove(opt_animate); 649 page.navigationDot.remove(opt_animate);
649 this.cardSlider.removeCard(page); 650 this.cardSlider.removeCard(page);
650 }, 651 },
651 }; 652 };
652 653
653 return { 654 return {
654 PageListView: PageListView 655 PageListView: PageListView
655 }; 656 };
656 }); 657 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698