OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 /** | 5 /** |
6 * @typedef {{domain: string, | 6 * @typedef {{domain: string, |
7 * visits: !Array<HistoryEntry>, | 7 * visits: !Array<HistoryEntry>, |
8 * rendered: boolean, | 8 * rendered: boolean, |
9 * expanded: boolean}} | 9 * expanded: boolean}} |
10 */ | 10 */ |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 if (this.historyData.length == 0) { | 96 if (this.historyData.length == 0) { |
97 this.groupedHistoryData_ = []; | 97 this.groupedHistoryData_ = []; |
98 return; | 98 return; |
99 } | 99 } |
100 | 100 |
101 if (this.range == HistoryRange.WEEK) { | 101 if (this.range == HistoryRange.WEEK) { |
102 // Group each day into a list of results. | 102 // Group each day into a list of results. |
103 var days = []; | 103 var days = []; |
104 var currentDayVisits = [this.historyData[0]]; | 104 var currentDayVisits = [this.historyData[0]]; |
105 | 105 |
106 var pushCurrentDay = function() { | 106 var pushCurrentDay = () => { |
107 days.push({ | 107 days.push({ |
108 title: this.searchedTerm ? currentDayVisits[0].dateShort : | 108 title: this.searchedTerm ? currentDayVisits[0].dateShort : |
109 currentDayVisits[0].dateRelativeDay, | 109 currentDayVisits[0].dateRelativeDay, |
110 domains: this.createHistoryDomains_(currentDayVisits), | 110 domains: this.createHistoryDomains_(currentDayVisits), |
111 }); | 111 }); |
112 }.bind(this); | 112 }; |
113 | 113 |
114 var visitsSameDay = function(a, b) { | 114 var visitsSameDay = (a, b) => { |
115 if (this.searchedTerm) | 115 if (this.searchedTerm) |
116 return a.dateShort == b.dateShort; | 116 return a.dateShort == b.dateShort; |
117 | 117 |
118 return a.dateRelativeDay == b.dateRelativeDay; | 118 return a.dateRelativeDay == b.dateRelativeDay; |
119 }.bind(this); | 119 }; |
120 | 120 |
121 for (var i = 1; i < this.historyData.length; i++) { | 121 for (var i = 1; i < this.historyData.length; i++) { |
122 var visit = this.historyData[i]; | 122 var visit = this.historyData[i]; |
123 if (!visitsSameDay(visit, currentDayVisits[0])) { | 123 if (!visitsSameDay(visit, currentDayVisits[0])) { |
124 pushCurrentDay(); | 124 pushCurrentDay(); |
125 currentDayVisits = []; | 125 currentDayVisits = []; |
126 } | 126 } |
127 currentDayVisits.push(visit); | 127 currentDayVisits.push(visit); |
128 } | 128 } |
129 pushCurrentDay(); | 129 pushCurrentDay(); |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
191 | 191 |
192 /** | 192 /** |
193 * @param {boolean} expanded | 193 * @param {boolean} expanded |
194 * @return {string} | 194 * @return {string} |
195 * @private | 195 * @private |
196 */ | 196 */ |
197 getDropdownIcon_: function(expanded) { | 197 getDropdownIcon_: function(expanded) { |
198 return expanded ? 'cr:expand-less' : 'cr:expand-more'; | 198 return expanded ? 'cr:expand-less' : 'cr:expand-more'; |
199 }, | 199 }, |
200 }); | 200 }); |
OLD | NEW |