| 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 cr.define('md_history', function() { | 5 cr.define('md_history', function() { |
| 6 var HistoryItem = Polymer({ | 6 var HistoryItem = Polymer({ |
| 7 is: 'history-item', | 7 is: 'history-item', |
| 8 | 8 |
| 9 properties: { | 9 properties: { |
| 10 // Underlying HistoryEntry data for this item. Contains read-only fields | 10 // Underlying HistoryEntry data for this item. Contains read-only fields |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 numberOfItems: {type: Number}, | 31 numberOfItems: {type: Number}, |
| 32 | 32 |
| 33 // The path of this history item inside its parent. | 33 // The path of this history item inside its parent. |
| 34 path: String, | 34 path: String, |
| 35 }, | 35 }, |
| 36 | 36 |
| 37 /** | 37 /** |
| 38 * When a history-item is selected the toolbar is notified and increases | 38 * When a history-item is selected the toolbar is notified and increases |
| 39 * or decreases its count of selected items accordingly. | 39 * or decreases its count of selected items accordingly. |
| 40 * @param {MouseEvent} e |
| 40 * @private | 41 * @private |
| 41 */ | 42 */ |
| 42 onCheckboxSelected_: function() { | 43 onCheckboxSelected_: function(e) { |
| 43 // TODO(calamity): Fire this event whenever |selected| changes. | 44 // TODO(calamity): Fire this event whenever |selected| changes. |
| 44 this.fire('history-checkbox-select', { | 45 this.fire('history-checkbox-select', { |
| 45 element: this, | 46 element: this, |
| 46 countAddition: this.$.checkbox.checked ? 1 : -1 | 47 shiftKey: e.shiftKey, |
| 47 }); | 48 }); |
| 49 e.preventDefault(); |
| 48 }, | 50 }, |
| 49 | 51 |
| 50 /** | 52 /** |
| 53 * @param {MouseEvent} e |
| 54 * @private |
| 55 */ |
| 56 onCheckboxMousedown_: function(e) { |
| 57 // Prevent shift clicking a checkbox from selecting text. |
| 58 if (e.shiftKey) |
| 59 e.preventDefault(); |
| 60 }, |
| 61 |
| 62 /** |
| 51 * Remove bookmark of current item when bookmark-star is clicked. | 63 * Remove bookmark of current item when bookmark-star is clicked. |
| 52 * @private | 64 * @private |
| 53 */ | 65 */ |
| 54 onRemoveBookmarkTap_: function() { | 66 onRemoveBookmarkTap_: function() { |
| 55 if (!this.item.starred) | 67 if (!this.item.starred) |
| 56 return; | 68 return; |
| 57 | 69 |
| 58 if (this.$$('#bookmark-star') == this.root.activeElement) | 70 if (this.$$('#bookmark-star') == this.root.activeElement) |
| 59 this.$['menu-button'].focus(); | 71 this.$['menu-button'].focus(); |
| 60 | 72 |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 | 149 |
| 138 if (searchedTerm) | 150 if (searchedTerm) |
| 139 return currentItem.dateShort != nextItem.dateShort; | 151 return currentItem.dateShort != nextItem.dateShort; |
| 140 | 152 |
| 141 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && | 153 return currentItem.time - nextItem.time > BROWSING_GAP_TIME && |
| 142 currentItem.dateRelativeDay == nextItem.dateRelativeDay; | 154 currentItem.dateRelativeDay == nextItem.dateRelativeDay; |
| 143 }; | 155 }; |
| 144 | 156 |
| 145 return { HistoryItem: HistoryItem }; | 157 return { HistoryItem: HistoryItem }; |
| 146 }); | 158 }); |
| OLD | NEW |