Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4810)

Unified Diff: chrome/browser/resources/ntp/most_visited.js

Issue 3236001: Add the collapsed 'miniview' to the apps and most visisted sections. (Closed)
Patch Set: more unnecessary changes Created 10 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/resources/ntp/most_visited.js
diff --git a/chrome/browser/resources/ntp/most_visited.js b/chrome/browser/resources/ntp/most_visited.js
index 23ea4b2f989e241b92b44a73e0f1834de5b7ade3..acb0200b73f6114697c032e9cafce501d55ca60b 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')) {
« chrome/browser/resources/ntp/apps.js ('K') | « chrome/browser/resources/ntp/apps.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698