| 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 'use strict'; | 5 'use strict'; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * Namespace for utility functions. | 8 * Namespace for utility functions. |
| 9 */ | 9 */ |
| 10 var filelist = {}; | 10 var filelist = {}; |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 }.bind(self), true); | 327 }.bind(self), true); |
| 328 self.list.shouldStartDragSelection = | 328 self.list.shouldStartDragSelection = |
| 329 self.shouldStartDragSelection_.bind(self); | 329 self.shouldStartDragSelection_.bind(self); |
| 330 | 330 |
| 331 /** | 331 /** |
| 332 * Obtains the index list of elements that are hit by the point or the | 332 * Obtains the index list of elements that are hit by the point or the |
| 333 * rectangle. | 333 * rectangle. |
| 334 * | 334 * |
| 335 * @param {number} x X coordinate value. | 335 * @param {number} x X coordinate value. |
| 336 * @param {number} y Y coordinate value. | 336 * @param {number} y Y coordinate value. |
| 337 * @param {=number} opt_width Width of the coordinate. | 337 * @param {number=} opt_width Width of the coordinate. |
| 338 * @param {=number} opt_height Height of the coordinate. | 338 * @param {number=} opt_height Height of the coordinate. |
| 339 * @return {Array.<number>} Index list of hit elements. | 339 * @return {Array.<number>} Index list of hit elements. |
| 340 */ | 340 */ |
| 341 self.list.getHitElements = function(x, y, opt_width, opt_height) { | 341 self.list.getHitElements = function(x, y, opt_width, opt_height) { |
| 342 var currentSelection = []; | 342 var currentSelection = []; |
| 343 var bottom = y + (opt_height || 0); | 343 var bottom = y + (opt_height || 0); |
| 344 for (var i = 0; i < this.selectionModel_.length; i++) { | 344 for (var i = 0; i < this.selectionModel_.length; i++) { |
| 345 var itemMetrics = this.getHeightsForIndex_(i); | 345 var itemMetrics = this.getHeightsForIndex_(i); |
| 346 if (itemMetrics.top < bottom && itemMetrics.top + itemMetrics.height >= y) | 346 if (itemMetrics.top < bottom && itemMetrics.top + itemMetrics.height >= y) |
| 347 currentSelection.push(i); | 347 currentSelection.push(i); |
| 348 } | 348 } |
| 349 return currentSelection; | 349 return currentSelection; |
| 350 }; | 350 }; |
| 351 }; | 351 }; |
| 352 | 352 |
| 353 /** | 353 /** |
| 354 * Sets date and time format. | 354 * Sets date and time format. |
| 355 * @param {boolean} use12hourClock True if 12 hours clock, False if 24 hours. | 355 * @param {boolean} use12hourClock True if 12 hours clock, False if 24 hours. |
| 356 */ | 356 */ |
| 357 FileTable.prototype.setDateTimeFormat = function(use12hourClock) { | 357 FileTable.prototype.setDateTimeFormat = function(use12hourClock) { |
| 358 this.timeFormatter_ = Intl.DateTimeFormat( | 358 this.timeFormatter_ = Intl.DateTimeFormat( |
| 359 [] /* default locale */, | 359 [] /* default locale */, |
| 360 {hour: 'numeric', minute: 'numeric', | 360 {hour: 'numeric', minute: 'numeric', hour12: use12hourClock}); |
| 361 hour12: use12hourClock}); | |
| 362 this.dateFormatter_ = Intl.DateTimeFormat( | 361 this.dateFormatter_ = Intl.DateTimeFormat( |
| 363 [] /* default locale */, | 362 [] /* default locale */, |
| 364 {year: 'numeric', month: 'short', day: 'numeric', | 363 { |
| 365 hour: 'numeric', minute: 'numeric', | 364 year: 'numeric', month: 'short', day: 'numeric', |
| 366 hour12: use12hourClock}); | 365 hour: 'numeric', minute: 'numeric', hour12: use12hourClock |
| 366 }); |
| 367 }; | 367 }; |
| 368 | 368 |
| 369 /** | 369 /** |
| 370 * Obtains if the drag selection should be start or not by referring the mouse | 370 * Obtains if the drag selection should be start or not by referring the mouse |
| 371 * event. | 371 * event. |
| 372 * @param {MouseEvent} event Drag start event. | 372 * @param {MouseEvent} event Drag start event. |
| 373 * @return {boolean} True if the mouse is hit to the background of the list. | 373 * @return {boolean} True if the mouse is hit to the background of the list. |
| 374 * @private | 374 * @private |
| 375 */ | 375 */ |
| 376 FileTable.prototype.shouldStartDragSelection_ = function(event) { | 376 FileTable.prototype.shouldStartDragSelection_ = function(event) { |
| (...skipping 372 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 749 return; | 749 return; |
| 750 | 750 |
| 751 if (externalProps.customIconUrl) | 751 if (externalProps.customIconUrl) |
| 752 iconDiv.style.backgroundImage = 'url(' + externalProps.customIconUrl + ')'; | 752 iconDiv.style.backgroundImage = 'url(' + externalProps.customIconUrl + ')'; |
| 753 else | 753 else |
| 754 iconDiv.style.backgroundImage = ''; // Back to the default image. | 754 iconDiv.style.backgroundImage = ''; // Back to the default image. |
| 755 | 755 |
| 756 if (li.classList.contains('directory')) | 756 if (li.classList.contains('directory')) |
| 757 iconDiv.classList.toggle('shared', externalProps.shared); | 757 iconDiv.classList.toggle('shared', externalProps.shared); |
| 758 }; | 758 }; |
| OLD | NEW |