OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 function getAppsCallback(data) { | 5 function getAppsCallback(data) { |
6 logEvent('received apps'); | 6 logEvent('received apps'); |
7 var appsSection = $('apps'); | 7 var appsSection = $('apps'); |
8 var appsSectionContent = $('apps-maxiview'); | 8 var appsSectionContent = $('apps-maxiview'); |
9 var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; | 9 var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; |
10 appsSectionContent.textContent = ''; | 10 var appsPromo = $('apps-promo'); |
| 11 |
11 appsMiniview.textContent = ''; | 12 appsMiniview.textContent = ''; |
| 13 while (appsSectionContent.lastChild != appsPromo) { |
| 14 appsSectionContent.removeChild(appsSectionContent.lastChild); |
| 15 } |
12 | 16 |
13 clearClosedMenu(apps.menu); | 17 clearClosedMenu(apps.menu); |
14 if (data.apps.length == 0) { | 18 if (data.apps.length == 0) { |
15 appsSection.classList.add('disabled'); | 19 appsSection.classList.add('disabled'); |
16 layoutSections(); | 20 layoutSections(); |
17 } else { | 21 } else { |
18 data.apps.forEach(function(app) { | 22 data.apps.forEach(function(app) { |
19 appsSectionContent.appendChild(apps.createElement(app)); | 23 appsSectionContent.appendChild(apps.createElement(app)); |
20 }); | 24 }); |
21 | 25 |
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
268 a.setAttribute('app-id', app['id']); | 272 a.setAttribute('app-id', app['id']); |
269 a.textContent = app['name']; | 273 a.textContent = app['name']; |
270 a.href = app['launch_url']; | 274 a.href = app['launch_url']; |
271 a.onclick = handleClick; | 275 a.onclick = handleClick; |
272 a.style.backgroundImage = url(app['icon_small']); | 276 a.style.backgroundImage = url(app['icon_small']); |
273 a.className = 'item'; | 277 a.className = 'item'; |
274 return a; | 278 return a; |
275 }, | 279 }, |
276 | 280 |
277 createWebStoreElement: function() { | 281 createWebStoreElement: function() { |
278 return createElement({ | 282 var elm = createElement({ |
279 'id': 'web-store-entry', | 283 'id': 'web-store-entry', |
280 'name': localStrings.getString('web_store_title'), | 284 'name': localStrings.getString('web_store_title'), |
281 'launch_url': localStrings.getString('web_store_url') | 285 'launch_url': localStrings.getString('web_store_url') |
282 }); | 286 }); |
| 287 elm.setAttribute('app-id', 'web-store-entry'); |
| 288 return elm; |
283 } | 289 } |
284 }; | 290 }; |
285 })(); | 291 })(); |
OLD | NEW |