summaryrefslogtreecommitdiffstats
path: root/chrome/browser/resources/ntp/most_visited.js
diff options
context:
space:
mode:
authoraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-29 00:35:01 +0000
committeraa@chromium.org <aa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-29 00:35:01 +0000
commit969894aba3265e77edafbc6556941ea693485cd8 (patch)
treee3906da6188b7831cfee8a60829989fa12ff2cd8 /chrome/browser/resources/ntp/most_visited.js
parentacc2f3cca43414cdcc46c0e9eefdb9002350c212 (diff)
downloadchromium_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/most_visited.js')
-rw-r--r--chrome/browser/resources/ntp/most_visited.js18
1 files changed, 17 insertions, 1 deletions
diff --git a/chrome/browser/resources/ntp/most_visited.js b/chrome/browser/resources/ntp/most_visited.js
index 23ea4b2..acb0200 100644
--- a/chrome/browser/resources/ntp/most_visited.js
+++ b/chrome/browser/resources/ntp/most_visited.js
@@ -41,8 +41,9 @@ var MostVisited = (function() {
return Array.prototype.indexOf.call(nodes, el);
}
- function MostVisited(el, useSmallGrid, visible) {
+ function MostVisited(el, miniview, useSmallGrid, visible) {
this.element = el;
+ this.miniview = miniview;
this.useSmallGrid_ = useSmallGrid;
this.visible_ = visible;
@@ -501,6 +502,7 @@ var MostVisited = (function() {
// On setting we need to update the items
this.data_ = data;
this.updateMostVisited_();
+ this.updateMiniview_();
},
updateMostVisited_: function() {
@@ -555,6 +557,20 @@ var MostVisited = (function() {
}
},
+ updateMiniview_: function() {
+ this.miniview.textContent = '';
+ var data = this.data.slice(0, MAX_MINIVIEW_ITEMS);
+ for (var i = 0, item; item = data[i]; i++) {
+ var span = document.createElement('span');
+ var a = span.appendChild(document.createElement('a'));
+ a.href = item.url;
+ a.textContent = item.title;
+ a.style.backgroundImage = url('chrome://favicon/' + item.url);
+ a.className = 'item';
+ this.miniview.appendChild(span);
+ }
+ },
+
handleClick_: function(e) {
var target = e.target;
if (target.classList.contains('pin')) {