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 /** | 5 /** |
6 * Namespace for utility functions. | 6 * Namespace for utility functions. |
7 */ | 7 */ |
8 var filelist = {}; | 8 var filelist = {}; |
9 | 9 |
10 /** | 10 /** |
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 var stopEventPropagation = function(event) { | 546 var stopEventPropagation = function(event) { |
547 if (!event.shiftKey) | 547 if (!event.shiftKey) |
548 event.stopPropagation(); | 548 event.stopPropagation(); |
549 }; | 549 }; |
550 input.setAttribute('type', 'checkbox'); | 550 input.setAttribute('type', 'checkbox'); |
551 input.setAttribute('tabindex', -1); | 551 input.setAttribute('tabindex', -1); |
552 input.classList.add('common'); | 552 input.classList.add('common'); |
553 input.addEventListener('mousedown', stopEventPropagation); | 553 input.addEventListener('mousedown', stopEventPropagation); |
554 input.addEventListener('mouseup', stopEventPropagation); | 554 input.addEventListener('mouseup', stopEventPropagation); |
555 | 555 |
556 var self = this; | 556 input.addEventListener( |
557 input.addEventListener('click', function(event) { | 557 'click', |
558 // Revert default action and swallow the event | 558 /** |
559 // if this is a multiple click or Shift is pressed. | 559 * @this {HTMLInputElement} |
560 if (event.detail > 1 || event.shiftKey) { | 560 */ |
561 this.checked = !this.checked; | 561 function(event) { |
562 stopEventPropagation(event); | 562 // Revert default action and swallow the event |
563 } | 563 // if this is a multiple click or Shift is pressed. |
564 }); | 564 if (event.detail > 1 || event.shiftKey) { |
| 565 this.checked = !this.checked; |
| 566 stopEventPropagation(event); |
| 567 } |
| 568 }); |
565 }; | 569 }; |
566 | 570 |
567 /** | 571 /** |
568 * Decorates selection checkbox. | 572 * Decorates selection checkbox. |
569 * @param {HTMLInputElement} input Element to decorate. | 573 * @param {HTMLInputElement} input Element to decorate. |
570 * @param {Entry} entry Corresponding entry. | 574 * @param {Entry} entry Corresponding entry. |
571 * @param {cr.ui.List} list Owner list. | 575 * @param {cr.ui.List} list Owner list. |
572 */ | 576 */ |
573 filelist.decorateSelectionCheckbox = function(input, entry, list) { | 577 filelist.decorateSelectionCheckbox = function(input, entry, list) { |
574 filelist.decorateCheckbox(input); | 578 filelist.decorateCheckbox(input); |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
682 break; | 686 break; |
683 } | 687 } |
684 } | 688 } |
685 if (url) { | 689 if (url) { |
686 iconDiv.style.backgroundImage = 'url(' + url + ')'; | 690 iconDiv.style.backgroundImage = 'url(' + url + ')'; |
687 } else { | 691 } else { |
688 iconDiv.style.backgroundImage = null; | 692 iconDiv.style.backgroundImage = null; |
689 } | 693 } |
690 } | 694 } |
691 }; | 695 }; |
OLD | NEW |