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 // 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 Loading... |
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 Loading... |
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 })(); |
OLD | NEW |