diff options
author | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-29 00:35:01 +0000 |
---|---|---|
committer | aa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-08-29 00:35:01 +0000 |
commit | 969894aba3265e77edafbc6556941ea693485cd8 (patch) | |
tree | e3906da6188b7831cfee8a60829989fa12ff2cd8 /chrome/browser/resources/ntp/apps.js | |
parent | acc2f3cca43414cdcc46c0e9eefdb9002350c212 (diff) | |
download | chromium_src-969894aba3265e77edafbc6556941ea693485cd8.zip chromium_src-969894aba3265e77edafbc6556941ea693485cd8.tar.gz chromium_src-969894aba3265e77edafbc6556941ea693485cd8.tar.bz2 |
Add the collapsed 'miniview' to the apps and most visisted sections. Also, fix the bug where the wrench disappears on hover.
BUG=53248,52199
Review URL: http://codereview.chromium.org/3236001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@57799 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/resources/ntp/apps.js')
-rw-r--r-- | chrome/browser/resources/ntp/apps.js | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/chrome/browser/resources/ntp/apps.js b/chrome/browser/resources/ntp/apps.js index 64b490f..61712e4 100644 --- a/chrome/browser/resources/ntp/apps.js +++ b/chrome/browser/resources/ntp/apps.js @@ -6,13 +6,19 @@ function getAppsCallback(data) { logEvent('recieved apps'); var appsSection = $('apps-section'); var appsSectionContent = $('apps-section-content'); + var appsMiniview = appsSection.getElementsByClassName('miniview')[0]; appsSectionContent.textContent = ''; + appsMiniview.textContent = ''; data.apps.forEach(function(app) { appsSectionContent.appendChild(apps.createElement(app)); }); appsSectionContent.appendChild(apps.createWebStoreElement()); + + data.apps.slice(0, MAX_MINIVIEW_ITEMS).forEach(function(app) { + appsMiniview.appendChild(apps.createMiniviewElement(app)); + }); } var apps = { @@ -41,7 +47,7 @@ var apps = { var left = rect.left + ((rect.width - width) >> 1); // Integer divide by 2. var top = rect.top + parseInt(cs.backgroundPositionY, 10); - chrome.send('launchApp', [this.id, launchType, + chrome.send('launchApp', [this.getAttribute("app_id"), launchType, String(left), String(top), String(width), String(height)]); return false; @@ -55,7 +61,7 @@ var apps = { front.className = 'front'; var a = front.appendChild(document.createElement('a')); - a.id = app['id']; + a.setAttribute('app_id', app['id']); a.xtitle = a.textContent = app['name']; a.href = app['launch_url']; @@ -68,7 +74,7 @@ var apps = { var a = front.firstChild; a.onclick = apps.handleClick_; - a.style.backgroundImage = url(app['icon']); + a.style.backgroundImage = url(app['icon_big']); if (hashParams['app-id'] == app['id']) { div.setAttribute('new', 'new'); // Delay changing the attribute a bit to let the page settle down a bit. @@ -111,6 +117,20 @@ var apps = { return div; }, + createMiniviewElement: function(app) { + var span = document.createElement('span'); + var a = span.appendChild(document.createElement('a')); + + a.setAttribute('app_id', app['id']); + a.textContent = app['name']; + a.href = app['launch_url']; + a.onclick = apps.handleClick_; + a.style.backgroundImage = url(app['icon_small']); + a.className = 'item'; + span.appendChild(a); + return span; + }, + createWebStoreElement: function() { return this.createElement_({ 'id': 'web-store-entry', |