| OLD | NEW |
| (Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 Polymer({ |
| 6 is: 'history-item', |
| 7 |
| 8 properties: { |
| 9 timeAccessed_: { |
| 10 type: String, |
| 11 value: '' |
| 12 }, |
| 13 |
| 14 websiteTitle_: { |
| 15 type: String, |
| 16 value: '' |
| 17 }, |
| 18 |
| 19 // Domain is the website text shown on the history-item next to the title. |
| 20 // Gives the user some idea of which history items are different pages |
| 21 // belonging to the same site, and can be used to look for more items |
| 22 // from the same site. |
| 23 websiteDomain_: { |
| 24 type: String, |
| 25 value: '' |
| 26 }, |
| 27 |
| 28 // The website url is used to define where the link should take you if |
| 29 // you click on the title, and also to define which icon the history-item |
| 30 // should display. |
| 31 websiteUrl_: { |
| 32 type: String, |
| 33 value: '', |
| 34 observer: 'showIcon_' |
| 35 }, |
| 36 |
| 37 // If the website is a bookmarked page starred is true. |
| 38 starred: { |
| 39 type: Boolean, |
| 40 value: false, |
| 41 reflectToAttribute: true |
| 42 }, |
| 43 |
| 44 // The time in seconds of when the website was accessed. |
| 45 timestamp_: { |
| 46 type: Number, |
| 47 value: 0 |
| 48 }, |
| 49 |
| 50 selected: { |
| 51 type: Boolean, |
| 52 value: false, |
| 53 notify: true |
| 54 } |
| 55 }, |
| 56 |
| 57 /** |
| 58 * When a history-item is selected the toolbar is notified and increases |
| 59 * or decreases its count of selected items accordingly. |
| 60 * @private |
| 61 */ |
| 62 onCheckboxSelected_: function() { |
| 63 this.fire('history-checkbox-select', { |
| 64 countAddition: this.$.checkbox.checked ? 1 : -1 |
| 65 }); |
| 66 }, |
| 67 |
| 68 /** |
| 69 * When the url for the history-item is set, the icon associated with this |
| 70 * website is also set. |
| 71 * @private |
| 72 */ |
| 73 showIcon_: function() { |
| 74 this.$['website-icon'].style.backgroundImage = |
| 75 getFaviconImageSet(this.websiteUrl_); |
| 76 }, |
| 77 |
| 78 /** |
| 79 * Fires a custom event when the menu button is clicked. Sends the details of |
| 80 * the history item and where the menu should appear. |
| 81 */ |
| 82 onMenuButtonTap_: function(e) { |
| 83 var position = this.$['menu-button'].getBoundingClientRect(); |
| 84 |
| 85 this.fire('toggle-menu', { |
| 86 x: position.left, |
| 87 y: position.top, |
| 88 accessTime: this.timestamp_ |
| 89 }); |
| 90 |
| 91 // Stops the 'tap' event from closing the menu when it opens. |
| 92 e.stopPropagation(); |
| 93 } |
| 94 }); |
| OLD | NEW |