| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 Polymer({ | 5 Polymer({ |
| 6 is: 'history-card', | 6 is: 'history-card', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // The date of these history items. | 9 // The date of these history items. |
| 10 historyDate: { | 10 historyDate: { |
| 11 type: String, | 11 type: String, |
| 12 value: '' | 12 value: '' |
| 13 }, | 13 }, |
| 14 // The list of history results that were accessed for a particular day in | 14 // The list of history results that were accessed for a particular day in |
| 15 // reverse chronological order. | 15 // reverse chronological order. |
| 16 historyItems: { | 16 historyItems: { |
| 17 type: Array, | 17 type: Array, |
| 18 value: function() { return []; } | 18 value: function() { return []; } |
| 19 } | 19 } |
| 20 }, | 20 }, |
| 21 | 21 |
| 22 /** | 22 /** |
| 23 * Check whether the time difference between the given historyItem and the | 23 * Check whether the time difference between the given historyItem and the |
| 24 * next one is large enough for a spacer to be required. | 24 * next one is large enough for a spacer to be required. |
| 25 * @param {number} index The index number of the first item being compared. | 25 * @param {number} index The index number of the first item being compared. |
| 26 * @param {number} itemsLength The number of items on the card. Used to force |
| 27 * needsTimeGap_ to run for every item if an item is deleted from the card. |
| 26 * @return {boolean} Whether or not time gap separator is required. | 28 * @return {boolean} Whether or not time gap separator is required. |
| 27 * @private | 29 * @private |
| 28 */ | 30 */ |
| 29 needsTimeGap_: function(index) { | 31 needsTimeGap_: function(index, itemsLength) { |
| 30 var items = this.historyItems; | 32 var items = this.historyItems; |
| 31 return index + 1 < items.length && | 33 return index + 1 < items.length && |
| 32 items[index].time - items[index + 1].time > BROWSING_GAP_TIME; | 34 items[index].time - items[index + 1].time > BROWSING_GAP_TIME; |
| 33 } | 35 } |
| 34 }); | 36 }); |
| OLD | NEW |