| 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-list', | 6 is: 'history-list', |
| 7 | 7 |
| 8 properties: { | 8 properties: { |
| 9 // The search term for the current query. Set when the query returns. | 9 // The search term for the current query. Set when the query returns. |
| 10 searchedTerm: { | 10 searchedTerm: { |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 */ | 87 */ |
| 88 addNewResults: function(historyResults) { | 88 addNewResults: function(historyResults) { |
| 89 var results = historyResults.slice(); | 89 var results = historyResults.slice(); |
| 90 /** @type {IronScrollThresholdElement} */(this.$['scroll-threshold']) | 90 /** @type {IronScrollThresholdElement} */(this.$['scroll-threshold']) |
| 91 .clearTriggers(); | 91 .clearTriggers(); |
| 92 | 92 |
| 93 if (this.lastSearchedTerm_ != this.searchedTerm) { | 93 if (this.lastSearchedTerm_ != this.searchedTerm) { |
| 94 this.resultLoadingDisabled_ = false; | 94 this.resultLoadingDisabled_ = false; |
| 95 if (this.historyData_) | 95 if (this.historyData_) |
| 96 this.splice('historyData_', 0, this.historyData_.length); | 96 this.splice('historyData_', 0, this.historyData_.length); |
| 97 this.fire('unselect-all'); |
| 97 this.lastSearchedTerm_ = this.searchedTerm; | 98 this.lastSearchedTerm_ = this.searchedTerm; |
| 98 } | 99 } |
| 99 | 100 |
| 100 if (this.historyData_) { | 101 if (this.historyData_) { |
| 101 // If we have previously received data, push the new items onto the | 102 // If we have previously received data, push the new items onto the |
| 102 // existing array. | 103 // existing array. |
| 103 results.unshift('historyData_'); | 104 results.unshift('historyData_'); |
| 104 this.push.apply(this, results); | 105 this.push.apply(this, results); |
| 105 } else { | 106 } else { |
| 106 // The first time we receive data, use set() to ensure the iron-list is | 107 // The first time we receive data, use set() to ensure the iron-list is |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 * @private | 238 * @private |
| 238 */ | 239 */ |
| 239 isCardEnd_: function(item, i, length) { | 240 isCardEnd_: function(item, i, length) { |
| 240 if (length == 0 || i > length - 1) | 241 if (length == 0 || i > length - 1) |
| 241 return false; | 242 return false; |
| 242 return i == length - 1 || | 243 return i == length - 1 || |
| 243 this.historyData_[i].dateRelativeDay != | 244 this.historyData_[i].dateRelativeDay != |
| 244 this.historyData_[i + 1].dateRelativeDay; | 245 this.historyData_[i + 1].dateRelativeDay; |
| 245 }, | 246 }, |
| 246 }); | 247 }); |
| OLD | NEW |