OLD | NEW |
---|---|
(Empty) | |
1 <!doctype html> | |
2 <html i18n-values="dir:textdirection; | |
Dan Beam
2017/04/11 00:31:12
don't use i18n-values, but use $i18n{} and $i18nRa
msramek
2017/04/11 19:04:27
Done.
For the record, the majority of this file i
| |
3 hascustombackground:hasCustomBackground; | |
4 bookmarkbarattached:bookmarkbarattached; | |
5 lang:language"> | |
6 <head> | |
7 <meta charset="utf-8"> | |
8 <title i18n-content="title"></title> | |
9 <meta name="viewport" content="width=device-width"> | |
10 <link rel="stylesheet" href="chrome://resources/css/text_defaults_md.css"> | |
11 <link rel="stylesheet" href="md_incognito_tab.css"> | |
12 <script> | |
13 // Until themes can clear the cache, force-reload the theme stylesheet. | |
14 document.write('<link id="incognitothemecss" rel="stylesheet" ' + | |
15 'href="chrome://theme/css/incognito_new_tab_theme.css?' + | |
16 Date.now() + '">'); | |
17 </script> | |
18 </head> | |
19 <body> | |
20 <div class="content"> | |
21 <div class="icon"></div> | |
22 <h1 i18n-content="incognitoTabHeading"></h1> | |
23 <p id="subtitle"> | |
24 <span i18n-content="incognitoTabDescription"></span> | |
25 <a class="learn-more-button" i18n-content="learnMore" | |
26 i18n-values=".href:learnMoreLink"></a> | |
27 </p> | |
28 <div> | |
29 <div id="firstBulletpoints" class="bulletpoints" | |
30 i18n-values=".innerHTML:incognitoTabFeatures"></div> | |
31 <div id="secondBulletpoints" class="bulletpoints" | |
32 i18n-values=".innerHTML:incognitoTabWarning"></div> | |
33 <div class="clearer"></div> | |
34 </div> | |
35 <a class="learn-more-button" i18n-content="learnMore" | |
36 i18n-values=".href:learnMoreLink"></a> | |
37 </div> | |
38 </body> | |
39 <script src="chrome://resources/js/cr.js"></script> | |
40 <script> | |
Dan Beam
2017/04/11 00:31:12
prefer not to use inline scripts, it violates some
msramek
2017/04/11 19:04:27
Done. Extracted to a new file.
| |
41 cr.define('ntp', function() { | |
42 'use strict'; | |
43 /** | |
44 * Set whether the bookmarks bar is attached or not. | |
45 * @param {boolean} attached Whether the bar is attached or not. | |
46 */ | |
47 function setBookmarkBarAttached(attached) { | |
48 document.documentElement.setAttribute('bookmarkbarattached', !!attached); | |
49 } | |
50 | |
51 /** @param {!{hasCustomBackground: boolean}} themeData */ | |
52 function themeChanged(themeData) { | |
53 document.documentElement.setAttribute('hascustombackground', | |
54 themeData.hasCustomBackground); | |
55 document.getElementById('incognitothemecss').href = | |
Dan Beam
2017/04/11 00:31:12
can you use $() instead of document.getElementById
msramek
2017/04/11 19:04:27
Done, but including util.js for a one-line method
| |
56 'chrome://theme/css/incognito_new_tab_theme.css?' + Date.now(); | |
57 } | |
58 | |
59 return { | |
60 setBookmarkBarAttached: setBookmarkBarAttached, | |
61 themeChanged: themeChanged, | |
62 }; | |
63 }); | |
64 | |
65 window.addEventListener('load', function() { | |
66 /* Let the width of two lists of bulletpoints in a horizontal alignment | |
67 * determine the maximum content width. */ | |
68 var b1 = document.getElementById("firstBulletpoints"); | |
69 var b2 = document.getElementById("secondBulletpoints"); | |
70 var c = document.querySelector(".content") | |
71 c.style.maxWidth = (b1.offsetWidth + b2.offsetWidth + 40 /* margin */) + "px"; | |
72 }); | |
73 </script> | |
74 </html> | |
OLD | NEW |