| 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 var appsPromo = $('apps-promo'); | 10 var appsPromo = $('apps-promo'); |
| 11 | 11 |
| 12 appsMiniview.textContent = ''; | 12 appsMiniview.textContent = ''; |
| 13 while (appsSectionContent.lastChild != appsPromo) { | 13 while (appsSectionContent.lastChild != appsPromo) { |
| 14 appsSectionContent.removeChild(appsSectionContent.lastChild); | 14 appsSectionContent.removeChild(appsSectionContent.lastChild); |
| 15 } | 15 } |
| 16 | 16 |
| 17 data.apps.sort(function(a,b) { |
| 18 return a.app_launch_index - b.app_launch_index |
| 19 }); |
| 20 |
| 17 clearClosedMenu(apps.menu); | 21 clearClosedMenu(apps.menu); |
| 18 if (data.apps.length == 0) { | 22 if (data.apps.length == 0) { |
| 19 appsSection.classList.add('disabled'); | 23 appsSection.classList.add('disabled'); |
| 20 layoutSections(); | 24 layoutSections(); |
| 21 } else { | 25 } else { |
| 22 data.apps.forEach(function(app) { | 26 data.apps.forEach(function(app) { |
| 23 appsSectionContent.appendChild(apps.createElement(app)); | 27 appsSectionContent.appendChild(apps.createElement(app)); |
| 24 }); | 28 }); |
| 25 | 29 |
| 26 appsSectionContent.appendChild(apps.createWebStoreElement()); | 30 appsSectionContent.appendChild(apps.createWebStoreElement()); |
| (...skipping 255 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 282 var elm = createElement({ | 286 var elm = createElement({ |
| 283 'id': 'web-store-entry', | 287 'id': 'web-store-entry', |
| 284 'name': localStrings.getString('web_store_title'), | 288 'name': localStrings.getString('web_store_title'), |
| 285 'launch_url': localStrings.getString('web_store_url') | 289 'launch_url': localStrings.getString('web_store_url') |
| 286 }); | 290 }); |
| 287 elm.setAttribute('app-id', 'web-store-entry'); | 291 elm.setAttribute('app-id', 'web-store-entry'); |
| 288 return elm; | 292 return elm; |
| 289 } | 293 } |
| 290 }; | 294 }; |
| 291 })(); | 295 })(); |
| OLD | NEW |