OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <include src="../uber/uber_utils.js"> | 5 <include src="../uber/uber_utils.js"> |
6 <include src="history_focus_manager.js"> | 6 <include src="history_focus_manager.js"> |
7 | 7 |
8 /////////////////////////////////////////////////////////////////////////////// | 8 /////////////////////////////////////////////////////////////////////////////// |
9 // Globals: | 9 // Globals: |
10 /** @const */ var RESULTS_PER_PAGE = 150; | 10 /** @const */ var RESULTS_PER_PAGE = 150; |
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 * - useMonthDate: Whether or not the full date should be inserted (used for | 176 * - useMonthDate: Whether or not the full date should be inserted (used for |
177 * monthly view). | 177 * monthly view). |
178 * @return {Node} A DOM node to represent the history entry or search result. | 178 * @return {Node} A DOM node to represent the history entry or search result. |
179 */ | 179 */ |
180 Visit.prototype.getResultDOM = function(propertyBag) { | 180 Visit.prototype.getResultDOM = function(propertyBag) { |
181 var isSearchResult = propertyBag.isSearchResult || false; | 181 var isSearchResult = propertyBag.isSearchResult || false; |
182 var addTitleFavicon = propertyBag.addTitleFavicon || false; | 182 var addTitleFavicon = propertyBag.addTitleFavicon || false; |
183 var useMonthDate = propertyBag.useMonthDate || false; | 183 var useMonthDate = propertyBag.useMonthDate || false; |
184 var focusless = propertyBag.focusless || false; | 184 var focusless = propertyBag.focusless || false; |
185 var node = createElementWithClassName('li', 'entry'); | 185 var node = createElementWithClassName('li', 'entry'); |
186 var time = createElementWithClassName('label', 'time'); | 186 var time = createElementWithClassName('span', 'time'); |
187 var entryBox = createElementWithClassName('div', 'entry-box'); | 187 var entryBox = createElementWithClassName('div', 'entry-box'); |
188 var domain = createElementWithClassName('div', 'domain'); | 188 var domain = createElementWithClassName('div', 'domain'); |
189 | 189 |
190 this.id_ = this.model_.nextVisitId_++; | 190 this.id_ = this.model_.nextVisitId_++; |
191 var self = this; | 191 var self = this; |
192 | 192 |
193 // Only create the checkbox if it can be used either to delete an entry or to | 193 // Only create the checkbox if it can be used either to delete an entry or to |
194 // block/allow it. | 194 // block/allow it. |
195 if (this.model_.editingEntriesAllowed) { | 195 if (this.model_.editingEntriesAllowed) { |
196 var checkbox = document.createElement('input'); | 196 var checkbox = document.createElement('input'); |
197 checkbox.type = 'checkbox'; | 197 checkbox.type = 'checkbox'; |
198 checkbox.id = 'checkbox-' + this.id_; | 198 checkbox.id = 'checkbox-' + this.id_; |
| 199 checkbox.setAttribute('aria-label', |
| 200 loadTimeData.getString('removeFromHistory')); |
199 checkbox.time = this.date.getTime(); | 201 checkbox.time = this.date.getTime(); |
200 checkbox.addEventListener('click', checkboxClicked); | 202 checkbox.addEventListener('click', checkboxClicked); |
201 time.setAttribute('for', checkbox.id); | |
202 entryBox.appendChild(checkbox); | 203 entryBox.appendChild(checkbox); |
203 | 204 |
204 if (focusless) | 205 if (focusless) |
205 checkbox.tabIndex = -1; | 206 checkbox.tabIndex = -1; |
206 | 207 |
207 if (!isMobileVersion()) { | 208 if (!isMobileVersion()) { |
208 // Clicking anywhere in the entryBox will check/uncheck the checkbox. | 209 // Clicking anywhere in the entryBox will check/uncheck the checkbox. |
209 entryBox.setAttribute('for', checkbox.id); | 210 entryBox.setAttribute('for', checkbox.id); |
210 entryBox.addEventListener('mousedown', entryBoxMousedown); | 211 entryBox.addEventListener('mousedown', entryBoxMousedown); |
211 entryBox.addEventListener('click', entryBoxClick); | 212 entryBox.addEventListener('click', entryBoxClick); |
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2271 historyView.reload(); | 2272 historyView.reload(); |
2272 } | 2273 } |
2273 | 2274 |
2274 // Add handlers to HTML elements. | 2275 // Add handlers to HTML elements. |
2275 document.addEventListener('DOMContentLoaded', load); | 2276 document.addEventListener('DOMContentLoaded', load); |
2276 | 2277 |
2277 // This event lets us enable and disable menu items before the menu is shown. | 2278 // This event lets us enable and disable menu items before the menu is shown. |
2278 document.addEventListener('canExecute', function(e) { | 2279 document.addEventListener('canExecute', function(e) { |
2279 e.canExecute = true; | 2280 e.canExecute = true; |
2280 }); | 2281 }); |
OLD | NEW |