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

Side by Side Diff: chrome/browser/resources/ntp/most_visited.js

Issue 3292003: De-suck the NTP a bit more: (Closed) Base URL: git://codf21.jail/chromium.git
Patch Set: Fix unit test Created 10 years, 3 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/ntp/apps.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 // Dependencies that we should remove/formalize: 5 // Dependencies that we should remove/formalize:
6 // ../shared/js/class_list.js 6 // ../shared/js/class_list.js
7 // util.js 7 // util.js
8 // 8 //
9 // afterTransition 9 // afterTransition
10 // chrome.send 10 // chrome.send
(...skipping 543 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 var faviconUrl = d.faviconUrl || 'chrome://favicon/' + d.url; 554 var faviconUrl = d.faviconUrl || 'chrome://favicon/' + d.url;
555 titleDiv.style.backgroundImage = url(faviconUrl); 555 titleDiv.style.backgroundImage = url(faviconUrl);
556 titleDiv.dir = d.direction; 556 titleDiv.dir = d.direction;
557 } 557 }
558 }, 558 },
559 559
560 updateMiniview_: function() { 560 updateMiniview_: function() {
561 this.miniview.textContent = ''; 561 this.miniview.textContent = '';
562 var data = this.data.slice(0, MAX_MINIVIEW_ITEMS); 562 var data = this.data.slice(0, MAX_MINIVIEW_ITEMS);
563 for (var i = 0, item; item = data[i]; i++) { 563 for (var i = 0, item; item = data[i]; i++) {
564 if (item.filler) {
565 continue;
566 }
567
564 var span = document.createElement('span'); 568 var span = document.createElement('span');
565 var a = span.appendChild(document.createElement('a')); 569 var a = span.appendChild(document.createElement('a'));
566 a.href = item.url; 570 a.href = item.url;
567 a.textContent = item.title; 571 a.textContent = item.title;
568 a.style.backgroundImage = url('chrome://favicon/' + item.url); 572 a.style.backgroundImage = url('chrome://favicon/' + item.url);
569 a.className = 'item'; 573 a.className = 'item';
570 this.miniview.appendChild(span); 574 this.miniview.appendChild(span);
575
576 if ((a.offsetLeft + a.offsetWidth) > this.miniview.offsetWidth) {
577 this.miniview.removeChild(span);
578 return;
579 }
571 } 580 }
572 }, 581 },
573 582
574 handleClick_: function(e) { 583 handleClick_: function(e) {
575 var target = e.target; 584 var target = e.target;
576 if (target.classList.contains('pin')) { 585 if (target.classList.contains('pin')) {
577 this.togglePinned_(getItem(target)); 586 this.togglePinned_(getItem(target));
578 e.preventDefault(); 587 e.preventDefault();
579 } else if (target.classList.contains('remove')) { 588 } else if (target.classList.contains('remove')) {
580 this.blacklist(getItem(target)); 589 this.blacklist(getItem(target));
(...skipping 15 matching lines...) Expand all
596 handleKeyDown_: function(e) { 605 handleKeyDown_: function(e) {
597 if (!IS_MAC && e.keyCode == 46 || // Del 606 if (!IS_MAC && e.keyCode == 46 || // Del
598 IS_MAC && e.metaKey && e.keyCode == 8) { // Cmd + Backspace 607 IS_MAC && e.metaKey && e.keyCode == 8) { // Cmd + Backspace
599 this.blacklist(e.target); 608 this.blacklist(e.target);
600 } 609 }
601 } 610 }
602 }; 611 };
603 612
604 return MostVisited; 613 return MostVisited;
605 })(); 614 })();
OLDNEW
« no previous file with comments | « chrome/browser/resources/ntp/apps.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698