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 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 pushCurrentDay(); | 119 pushCurrentDay(); |
120 | 120 |
121 this.groupedHistoryData_ = days; | 121 this.groupedHistoryData_ = days; |
122 } else if (this.range == HistoryRange.MONTH) { | 122 } else if (this.range == HistoryRange.MONTH) { |
123 // Group each all visits into a single list. | 123 // Group each all visits into a single list. |
124 this.groupedHistoryData_ = [{ | 124 this.groupedHistoryData_ = [{ |
125 title: this.queryStartTime + ' – ' + this.queryEndTime, | 125 title: this.queryStartTime + ' – ' + this.queryEndTime, |
126 domains: this.createHistoryDomains_(this.historyData) | 126 domains: this.createHistoryDomains_(this.historyData) |
127 }]; | 127 }]; |
128 } | 128 } |
| 129 |
| 130 this.addItemIndexes(); |
| 131 }, |
| 132 |
| 133 addItemIndexes: function() { |
| 134 var index = 0; |
| 135 this.groupedHistoryData_.forEach(function(group) { |
| 136 group.domains.forEach(function(domain) { |
| 137 domain.visits.forEach(function(visit) { |
| 138 visit.index = index++; |
| 139 }); |
| 140 }); |
| 141 }); |
129 }, | 142 }, |
130 | 143 |
131 /** | 144 /** |
132 * @param {{model:Object, currentTarget:IronCollapseElement}} e | 145 * @param {{model:Object, currentTarget:IronCollapseElement}} e |
133 */ | 146 */ |
134 toggleDomainExpanded_: function(e) { | 147 toggleDomainExpanded_: function(e) { |
135 var collapse = e.currentTarget.parentNode.querySelector('iron-collapse'); | 148 var collapse = e.currentTarget.parentNode.querySelector('iron-collapse'); |
136 e.model.set('domain.rendered', true); | 149 e.model.set('domain.rendered', true); |
137 | 150 |
138 // Give the history-items time to render. | 151 // Give the history-items time to render. |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 | 195 |
183 /** | 196 /** |
184 * @param {boolean} expanded | 197 * @param {boolean} expanded |
185 * @return {string} | 198 * @return {string} |
186 * @private | 199 * @private |
187 */ | 200 */ |
188 getDropdownIcon_: function(expanded) { | 201 getDropdownIcon_: function(expanded) { |
189 return expanded ? 'cr:expand-less' : 'cr:expand-more'; | 202 return expanded ? 'cr:expand-less' : 'cr:expand-more'; |
190 }, | 203 }, |
191 }); | 204 }); |
OLD | NEW |