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 // To avoid creating tons of unnecessary nodes. We assume we cannot fit more | |
6 // than this many items in the miniview. | |
7 var MAX_MINIVIEW_ITEMS = 15; | |
8 | |
5 var loading = true; | 9 var loading = true; |
6 | 10 |
7 function updateSimpleSection(id, section) { | 11 function updateSimpleSection(id, section) { |
8 if (shownSections & section) | 12 if (shownSections & section) |
9 $(id).classList.remove('hidden'); | 13 $(id).classList.remove('hidden'); |
10 else | 14 else |
11 $(id).classList.add('hidden'); | 15 $(id).classList.add('hidden'); |
12 } | 16 } |
13 | 17 |
14 function recentlyClosedTabs(data) { | 18 function recentlyClosedTabs(data) { |
(...skipping 850 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
865 var span = document.createElement('span'); | 869 var span = document.createElement('span'); |
866 span.className = 'link-color'; | 870 span.className = 'link-color'; |
867 while (el.hasChildNodes()) { | 871 while (el.hasChildNodes()) { |
868 span.appendChild(el.firstChild); | 872 span.appendChild(el.firstChild); |
869 } | 873 } |
870 el.appendChild(span); | 874 el.appendChild(span); |
871 } | 875 } |
872 | 876 |
873 updateAttribution(); | 877 updateAttribution(); |
874 | 878 |
875 var mostVisited = new MostVisited($('most-visited'), | 879 var mostVisited = new MostVisited( |
876 useSmallGrid(), | 880 $('most-visited'), |
877 shownSections & Section.THUMB); | 881 $('most-visited-section').getElementsByClassName('miniview')[0], |
arv (Not doing code reviews)
2010/08/31 20:54:22
document.querySelector('#most-visited-section .min
| |
882 useSmallGrid(), | |
883 shownSections & Section.THUMB); | |
878 | 884 |
879 function mostVisitedPages(data, firstRun) { | 885 function mostVisitedPages(data, firstRun) { |
880 logEvent('received most visited pages'); | 886 logEvent('received most visited pages'); |
881 | 887 |
882 mostVisited.data = data; | 888 mostVisited.data = data; |
883 mostVisited.layout(); | 889 mostVisited.layout(); |
884 | 890 |
885 loading = false; | 891 loading = false; |
886 | 892 |
887 // Remove class name in a timeout so that changes done in this JS thread are | 893 // Remove class name in a timeout so that changes done in this JS thread are |
888 // not animated. | 894 // not animated. |
889 window.setTimeout(function() { | 895 window.setTimeout(function() { |
890 mostVisited.ensureSmallGridCorrect(); | 896 mostVisited.ensureSmallGridCorrect(); |
891 document.body.classList.remove('loading'); | 897 document.body.classList.remove('loading'); |
892 }, 1); | 898 }, 1); |
893 | 899 |
894 // Only show the first run notification if first run. | 900 // Only show the first run notification if first run. |
895 if (firstRun) { | 901 if (firstRun) { |
896 showFirstRunNotification(); | 902 showFirstRunNotification(); |
897 } | 903 } |
898 } | 904 } |
OLD | NEW |