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

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: fixes 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 : null);
223 // Set a tab index on the first dot. 223 // Set a tab index on the first dot.
224 if (this.dotList.dots.length == 1) 224 if (this.dotList.dots.length == 1)
225 newDot.tabIndex = 3; 225 newDot.tabIndex = 3;
226 226
227 this.eventTracker.add(page, 'pagelayout', this.onPageLayout_.bind(this)); 227 this.eventTracker.add(page, 'pagelayout', this.onPageLayout_.bind(this));
228 }, 228 },
229 229
230 /** 230 /**
231 * Called by chrome when an existing app has been disabled or 231 * Called by chrome when an existing app has been disabled or
232 * removed/uninstalled from chrome. 232 * removed/uninstalled from chrome.
(...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 var page = this.cardSlider.currentCardValue; 475 var page = this.cardSlider.currentCardValue;
476 476
477 this.pageSwitcherStart.hidden = !page || 477 this.pageSwitcherStart.hidden = !page ||
478 (this.cardSlider.currentCard == 0); 478 (this.cardSlider.currentCard == 0);
479 this.pageSwitcherEnd.hidden = !page || 479 this.pageSwitcherEnd.hidden = !page ||
480 (this.cardSlider.currentCard == this.cardSlider.cardCount - 1); 480 (this.cardSlider.currentCard == this.cardSlider.cardCount - 1);
481 481
482 if (!page) 482 if (!page)
483 return; 483 return;
484 484
485 var pageSwitcherLeft = isRTL() ? this.pageSwitcherEnd 485 var pageSwitcherLeft = isRTL() ? this.pageSwitcherEnd :
486 : this.pageSwitcherStart; 486 this.pageSwitcherStart;
487 var pageSwitcherRight = isRTL() ? this.pageSwitcherStart 487 var pageSwitcherRight = isRTL() ? this.pageSwitcherStart :
488 : this.pageSwitcherEnd; 488 this.pageSwitcherEnd;
489 var scrollbarWidth = page.scrollbarWidth; 489 var scrollbarWidth = page.scrollbarWidth;
490 pageSwitcherLeft.style.width = 490 pageSwitcherLeft.style.width =
491 (page.sideMargin + 13) + 'px'; 491 (page.sideMargin + 13) + 'px';
492 pageSwitcherLeft.style.left = '0'; 492 pageSwitcherLeft.style.left = '0';
493 pageSwitcherRight.style.width = 493 pageSwitcherRight.style.width =
494 (page.sideMargin - scrollbarWidth + 13) + 'px'; 494 (page.sideMargin - scrollbarWidth + 13) + 'px';
495 pageSwitcherRight.style.right = scrollbarWidth + 'px'; 495 pageSwitcherRight.style.right = scrollbarWidth + 'px';
496 496
497 var offsetTop = page.querySelector('.tile-page-content').offsetTop + 'px'; 497 var offsetTop = page.querySelector('.tile-page-content').offsetTop + 'px';
498 pageSwitcherLeft.style.top = offsetTop; 498 pageSwitcherLeft.style.top = offsetTop;
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 if (page.navigationDot) 647 if (page.navigationDot)
648 page.navigationDot.remove(opt_animate); 648 page.navigationDot.remove(opt_animate);
649 this.cardSlider.removeCard(page); 649 this.cardSlider.removeCard(page);
650 }, 650 },
651 }; 651 };
652 652
653 return { 653 return {
654 PageListView: PageListView 654 PageListView: PageListView
655 }; 655 };
656 }); 656 });
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp4/nav_dot.js ('k') | chrome/browser/resources/ntp4/page_switcher.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698