OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html i18n-values=" | 2 <html i18n-values=" |
3 dir:textdirection; | 3 dir:textdirection; |
4 bookmarkbarattached:bookmarkbarattached; | 4 bookmarkbarattached:bookmarkbarattached; |
5 hasattribution:hasattribution; | 5 hasattribution:hasattribution; |
6 anim:anim; | 6 anim:anim; |
7 syncispresent:syncispresent; | 7 syncispresent:syncispresent; |
8 customlogo:customlogo" | 8 customlogo:customlogo" |
9 install-animation-enabled="true"> | 9 install-animation-enabled="true"> |
10 <head> | 10 <head> |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 <link rel="stylesheet" href="ntp/apps.css"> | 60 <link rel="stylesheet" href="ntp/apps.css"> |
61 <link rel="stylesheet" href="shared/css/menu.css"> | 61 <link rel="stylesheet" href="shared/css/menu.css"> |
62 <script> | 62 <script> |
63 | 63 |
64 /** | 64 /** |
65 * Bitmask for the different UI sections. | 65 * Bitmask for the different UI sections. |
66 * This matches the Section enum in ../dom_ui/shown_sections_handler.h | 66 * This matches the Section enum in ../dom_ui/shown_sections_handler.h |
67 * @enum {number} | 67 * @enum {number} |
68 */ | 68 */ |
69 var Section = { | 69 var Section = { |
70 THUMB: 1, | 70 THUMB: 1 << 0, |
71 APPS: 64 | 71 APPS: 1 << 6 |
72 }; | 72 }; |
73 | 73 |
| 74 // These are used to hide sections and are part of the |shownSections| bitmask, |
| 75 // but are not sections themselves. |
| 76 var MINIMIZED_THUMB = 1 << (0 + 16); |
| 77 var MINIMIZED_RECENT = 1 << (2 + 16); |
| 78 var MINIMIZED_APPS = 1 << (6 + 16); |
| 79 |
74 var shownSections = templateData['shown_sections']; | 80 var shownSections = templateData['shown_sections']; |
75 | 81 |
76 // Until themes can clear the cache, force-reload the theme stylesheet. | 82 // Until themes can clear the cache, force-reload the theme stylesheet. |
77 document.write('<link id="themecss" rel="stylesheet" ' + | 83 document.write('<link id="themecss" rel="stylesheet" ' + |
78 'href="chrome://theme/css/newtab.css?' + | 84 'href="chrome://theme/css/newtab.css?' + |
79 Date.now() + '">'); | 85 Date.now() + '">'); |
80 | 86 |
81 function useSmallGrid() { | 87 function useSmallGrid() { |
82 return window.innerWidth <= 940; | 88 return window.innerWidth <= 940; |
83 } | 89 } |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
128 <div class="maxiview" id="apps-maxiview"></div> | 134 <div class="maxiview" id="apps-maxiview"></div> |
129 <div class="maxiview" id="most-visited-maxiview"></div> | 135 <div class="maxiview" id="most-visited-maxiview"></div> |
130 | 136 |
131 <div class="sections"> | 137 <div class="sections"> |
132 <!-- Start disabled. We only enable if we have at least one app. --> | 138 <!-- Start disabled. We only enable if we have at least one app. --> |
133 <div id="apps" class="section disabled" section="APPS"> | 139 <div id="apps" class="section disabled" section="APPS"> |
134 <h2> | 140 <h2> |
135 <img class="disclosure" img src="ntp/ntp_disclosure_triangle.png"> | 141 <img class="disclosure" img src="ntp/ntp_disclosure_triangle.png"> |
136 <div class="back"></div> | 142 <div class="back"></div> |
137 <span i18n-content="apps"></span> | 143 <span i18n-content="apps"></span> |
| 144 <button class="section-close-button"></button> |
138 </h2> | 145 </h2> |
139 <div class="miniview"></div> | 146 <div class="miniview"></div> |
140 </div> | 147 </div> |
141 | 148 |
142 <div id="most-visited" class="section" section="THUMB"> | 149 <div id="most-visited" class="section" section="THUMB"> |
143 <h2> | 150 <h2> |
144 <img class="disclosure" src="ntp/ntp_disclosure_triangle.png"> | 151 <img class="disclosure" src="ntp/ntp_disclosure_triangle.png"> |
145 <div class="back"></div> | 152 <div class="back"></div> |
146 <span i18n-content="mostvisited"></span> | 153 <span i18n-content="mostvisited"></span> |
147 <button id="most-visited-settings" i18n-content="restorethumbnails"> | 154 <button id="most-visited-settings" i18n-content="restorethumbnails"> |
148 </button> | 155 </button> |
| 156 <button class="section-close-button"></button> |
149 </h2> | 157 </h2> |
150 <div class="miniview"></div> | 158 <div class="miniview"></div> |
151 </div> | 159 </div> |
152 | 160 |
153 <!-- Start this section disabled because it might not have data, and looks | 161 <!-- Start this section disabled because it might not have data, and looks |
154 silly without any. --> | 162 silly without any. --> |
155 <div id="recently-closed" class="section hidden disabled" section="RECENT" | 163 <div id="recently-closed" class="section hidden disabled" section="RECENT" |
156 noexpand="true"> | 164 noexpand="true"> |
157 <h2> | 165 <h2> |
158 <div class="back"></div> | 166 <div class="back"></div> |
159 <span i18n-content="recentlyclosed"></span> | 167 <span i18n-content="recentlyclosed"></span> |
| 168 <button class="section-close-button"></button> |
160 </h2> | 169 </h2> |
161 <div class="miniview"></div> | 170 <div class="miniview"></div> |
162 </div> | 171 </div> |
163 | 172 |
164 <div id="sync-status" class="section disabled"> | 173 <div id="sync-status" class="section disabled"> |
165 <div> | 174 <div> |
166 <h3></h3> | 175 <h3></h3> |
167 <span></span> | 176 <span></span> |
168 </div> | 177 </div> |
169 </div> | 178 </div> |
170 </div> | 179 </div> |
| 180 |
| 181 <div id="closed-sections-bar"> |
| 182 <!-- The default visibility of these buttons needs to be the opposite of the |
| 183 default visibility of the corresponding sections. --> |
| 184 <button id="apps-button" |
| 185 menu="#apps-menu"> |
| 186 <span i18n-content="apps"></span> |
| 187 <img src="ntp/ntp_disclosure_triangle.png"> |
| 188 </button> |
| 189 <button id="most-visited-button" |
| 190 class="disabled" |
| 191 menu="#most-visited-menu"> |
| 192 <span i18n-content="mostvisited"></span> |
| 193 <img src="ntp/ntp_disclosure_triangle.png"> |
| 194 </button> |
| 195 <button id="recently-closed-button" |
| 196 menu="#recently-closed-menu"> |
| 197 <span i18n-content="recentlyclosed"></span> |
| 198 <img src="ntp/ntp_disclosure_triangle.png"> |
| 199 </button> |
| 200 </div> |
171 </div> <!-- main --> | 201 </div> <!-- main --> |
172 | 202 |
173 <div class="window-menu" id="window-tooltip"></div> | 203 <div class="window-menu" id="window-tooltip"></div> |
174 | 204 |
175 <command id="clear-all-blacklisted" i18n-values=".label:restorethumbnails"> | 205 <command id="clear-all-blacklisted" i18n-values=".label:restorethumbnails"> |
176 <command id="apps-launch-command"> | 206 <command id="apps-launch-command"> |
177 <command id="apps-options-command" i18n-values=".label:appoptions"> | 207 <command id="apps-options-command" i18n-values=".label:appoptions"> |
178 <command id="apps-uninstall-command" i18n-values=".label:appuninstall"> | 208 <command id="apps-uninstall-command" i18n-values=".label:appuninstall"> |
179 <command id="apps-launch-type-pinned" i18n-values=".label:applaunchtypepinned" | 209 <command id="apps-launch-type-pinned" i18n-values=".label:applaunchtypepinned" |
180 launch-type="0"> | 210 launch-type="0"> |
181 <command id="apps-launch-type-regular" i18n-values=".label:applaunchtyperegular" | 211 <command id="apps-launch-type-regular" i18n-values=".label:applaunchtyperegular" |
182 launch-type="1"> | 212 launch-type="1"> |
183 <command id="apps-launch-type-fullscreen" | 213 <command id="apps-launch-type-fullscreen" |
184 i18n-values=".label:applaunchtypefullscreen" launch-type="2"> | 214 i18n-values=".label:applaunchtypefullscreen" launch-type="2"> |
185 | 215 |
186 <menu id="app-context-menu"> | 216 <menu id="app-context-menu"> |
187 <button class="default" command="#apps-launch-command"></button> | 217 <button class="default" command="#apps-launch-command"></button> |
188 <hr> | 218 <hr> |
189 <button command="#apps-launch-type-regular" launch-type="1"></button> | 219 <button command="#apps-launch-type-regular" launch-type="1"></button> |
190 <button command="#apps-launch-type-pinned" launch-type="0"></button> | 220 <button command="#apps-launch-type-pinned" launch-type="0"></button> |
191 <button command="#apps-launch-type-fullscreen" launch-type="2"></button> | 221 <button command="#apps-launch-type-fullscreen" launch-type="2"></button> |
192 <hr> | 222 <hr> |
193 <button command="#apps-options-command"></button> | 223 <button command="#apps-options-command"></button> |
194 <button command="#apps-uninstall-command"></button> | 224 <button command="#apps-uninstall-command"></button> |
195 </menu> | 225 </menu> |
196 | 226 |
| 227 <!-- These are populated dynamically --> |
| 228 <menu id="apps-menu"></menu> |
| 229 <menu id="most-visited-menu"></menu> |
| 230 <menu id="recently-closed-menu"></menu> |
| 231 |
197 </body> | 232 </body> |
198 | 233 |
199 <script src="shared/js/i18n_template.js"></script> | 234 <script src="shared/js/i18n_template.js"></script> |
200 <script> | 235 <script> |
201 i18nTemplate.process(document, templateData); | 236 i18nTemplate.process(document, templateData); |
202 </script> | 237 </script> |
203 <script src="shared/js/local_strings.js"></script> | 238 <script src="shared/js/local_strings.js"></script> |
204 <script src="shared/js/class_list.js"></script> | 239 <script src="shared/js/class_list.js"></script> |
205 <script src="shared/js/parse_html_subset.js"></script> | 240 <script src="shared/js/parse_html_subset.js"></script> |
206 | 241 |
(...skipping 12 matching lines...) Expand all Loading... |
219 <script src="new_new_tab.js"></script> | 254 <script src="new_new_tab.js"></script> |
220 <script src="ntp/apps.js"></script> | 255 <script src="ntp/apps.js"></script> |
221 | 256 |
222 <script> | 257 <script> |
223 cr.ui.decorate('menu', cr.ui.Menu); | 258 cr.ui.decorate('menu', cr.ui.Menu); |
224 cr.ui.decorate('command', cr.ui.Command); | 259 cr.ui.decorate('command', cr.ui.Command); |
225 cr.ui.decorate('button[menu]', cr.ui.MenuButton); | 260 cr.ui.decorate('button[menu]', cr.ui.MenuButton); |
226 </script> | 261 </script> |
227 | 262 |
228 <script> | 263 <script> |
| 264 initializeSection('apps', MINIMIZED_APPS, Section.APPS); |
| 265 initializeSection('most-visited', MINIMIZED_THUMB, Section.THUMB); |
| 266 initializeSection('recently-closed', MINIMIZED_RECENT); |
| 267 |
229 updateSimpleSection('apps', Section.APPS); | 268 updateSimpleSection('apps', Section.APPS); |
230 updateSimpleSection('most-visited', Section.THUMB); | 269 updateSimpleSection('most-visited', Section.THUMB); |
| 270 var appsInitiallyVisible = !(shownSections & MINIMIZED_APPS); |
| 271 var mostVisitedInitiallyVisible = !(shownSections & MINIMIZED_THUMB); |
| 272 var recentlyClosedInitiallyVisible = !(shownSections & MINIMIZED_RECENT); |
| 273 // Apps and recently closed start as hidden in the HTML, most visited is |
| 274 // initially visible. Adapt to the change received from the prefs by forcing |
| 275 // all three sections to update. |
| 276 shownSections &= ~MINIMIZED_THUMB; |
| 277 shownSections |= MINIMIZED_APPS | MINIMIZED_RECENT; |
| 278 setSectionVisible('apps', Section.APPS, appsInitiallyVisible, MINIMIZED_APPS); |
| 279 setSectionVisible( |
| 280 'most-visited', Section.THUMB, |
| 281 mostVisitedInitiallyVisible, MINIMIZED_THUMB); |
| 282 setSectionVisible( |
| 283 'recently-closed', undefined, |
| 284 recentlyClosedInitiallyVisible, MINIMIZED_RECENT); |
231 layoutSections(); | 285 layoutSections(); |
232 </script> | 286 </script> |
233 </html> | 287 </html> |
OLD | NEW |