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

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

Issue 2804823002: Revamp the Incognito NTP on Desktop (Closed)
Patch Set: Addressed comments. Created 3 years, 8 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Handle the bookmark bar and theme change requests from the C++ side.
6 var ntp = {
7 /** @param {string} attached */
8 setBookmarkBarAttached: function(attached) {
9 document.documentElement.setAttribute('bookmarkbarattached', attached);
10 },
11
12 /** @param {!{hasCustomBackground: boolean}} themeData */
13 themeChanged: function(themeData) {
14 document.documentElement.setAttribute('hascustombackground',
15 themeData.hasCustomBackground);
16 $('incognitothemecss').href =
17 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now();
18 },
19 };
20
21 // Let the width of two lists of bulletpoints in a horizontal alignment
22 // determine the maximum content width.
23 window.addEventListener('load', function() {
24 var bulletpoints = document.querySelectorAll('.bulletpoints');
25 var content = document.querySelector('.content');
26
27 var maxWidth = (bulletpoints[0].offsetWidth + bulletpoints[1].offsetWidth +
28 40 /* margin */ + 2 /* offsetWidths may be rounded down */);
29
30 // Limit the maximum width to 600px. That might force the two lists
31 // of bulletpoints under each other, in which case we must swap the left
32 // and right margin.
33 if (maxWidth > 600) {
34 maxWidth = 600;
35
36 bulletpoints[1].classList.add('tooWide');
37 }
38
39 content.style.maxWidth = maxWidth + "px";
40 });
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698