|
1 | 1 | /* |
2 | | - * jQuery File Upload User Interface Plugin 7.3 |
| 2 | + * jQuery File Upload User Interface Plugin 7.4.1 |
3 | 3 | * https://github.com/blueimp/jQuery-File-Upload |
4 | 4 | * |
5 | 5 | * Copyright 2010, Sebastian Tschan |
|
263 | 263 | // Callback for upload progress events: |
264 | 264 | progress: function (e, data) { |
265 | 265 | if (data.context) { |
266 | | - var progress = parseInt(data.loaded / data.total * 100, 10); |
| 266 | + var progress = Math.floor(data.loaded / data.total * 100); |
267 | 267 | data.context.find('.progress') |
268 | 268 | .attr('aria-valuenow', progress) |
269 | 269 | .find('.bar').css( |
|
275 | 275 | // Callback for global upload progress events: |
276 | 276 | progressall: function (e, data) { |
277 | 277 | var $this = $(this), |
278 | | - progress = parseInt(data.loaded / data.total * 100, 10), |
| 278 | + progress = Math.floor(data.loaded / data.total * 100), |
279 | 279 | globalProgressNode = $this.find('.fileupload-progress'), |
280 | 280 | extendedProgressNode = globalProgressNode |
281 | 281 | .find('.progress-extended'); |
|
422 | 422 |
|
423 | 423 | _formatTime: function (seconds) { |
424 | 424 | var date = new Date(seconds * 1000), |
425 | | - days = parseInt(seconds / 86400, 10); |
| 425 | + days = Math.floor(seconds / 86400); |
426 | 426 | days = days ? days + 'd ' : ''; |
427 | 427 | return days + |
428 | 428 | ('0' + date.getUTCHours()).slice(-2) + ':' + |
|
519 | 519 | // so we have to resolve manually: |
520 | 520 | dfd.resolveWith(node); |
521 | 521 | } |
| 522 | + node.on('remove', function () { |
| 523 | + // If the element is removed before the |
| 524 | + // transition finishes, transition events are |
| 525 | + // not triggered, resolve manually: |
| 526 | + dfd.resolveWith(node); |
| 527 | + }); |
522 | 528 | }, |
523 | 529 | { |
524 | 530 | maxWidth: options.previewMaxWidth, |
|
607 | 613 |
|
608 | 614 | _transition: function (node) { |
609 | 615 | var dfd = $.Deferred(); |
610 | | - if ($.support.transition && node.hasClass('fade')) { |
| 616 | + if ($.support.transition && node.hasClass('fade') && node.is(':visible')) { |
611 | 617 | node.bind( |
612 | 618 | $.support.transition.end, |
613 | 619 | function (e) { |
|
632 | 638 | this._on(fileUploadButtonBar.find('.start'), { |
633 | 639 | click: function (e) { |
634 | 640 | e.preventDefault(); |
635 | | - filesList.find('.start button').click(); |
| 641 | + filesList.find('.start').click(); |
636 | 642 | } |
637 | 643 | }); |
638 | 644 | this._on(fileUploadButtonBar.find('.cancel'), { |
639 | 645 | click: function (e) { |
640 | 646 | e.preventDefault(); |
641 | | - filesList.find('.cancel button').click(); |
| 647 | + filesList.find('.cancel').click(); |
642 | 648 | } |
643 | 649 | }); |
644 | 650 | this._on(fileUploadButtonBar.find('.delete'), { |
645 | 651 | click: function (e) { |
646 | 652 | e.preventDefault(); |
647 | | - filesList.find('.delete input:checked') |
648 | | - .siblings('button').click(); |
| 653 | + filesList.find('.toggle:checked') |
| 654 | + .closest('.template-download') |
| 655 | + .find('.delete').click(); |
649 | 656 | fileUploadButtonBar.find('.toggle') |
650 | 657 | .prop('checked', false); |
651 | 658 | } |
652 | 659 | }); |
653 | 660 | this._on(fileUploadButtonBar.find('.toggle'), { |
654 | 661 | change: function (e) { |
655 | | - filesList.find('.delete input').prop( |
| 662 | + filesList.find('.toggle').prop( |
656 | 663 | 'checked', |
657 | 664 | $(e.currentTarget).is(':checked') |
658 | 665 | ); |
|
662 | 669 |
|
663 | 670 | _destroyButtonBarEventHandlers: function () { |
664 | 671 | this._off( |
665 | | - this.element.find('.fileupload-buttonbar button'), |
| 672 | + this.element.find('.fileupload-buttonbar') |
| 673 | + .find('.start, .cancel, .delete'), |
666 | 674 | 'click' |
667 | 675 | ); |
668 | 676 | this._off( |
|
674 | 682 | _initEventHandlers: function () { |
675 | 683 | this._super(); |
676 | 684 | this._on(this.options.filesContainer, { |
677 | | - 'click .start button': this._startHandler, |
678 | | - 'click .cancel button': this._cancelHandler, |
679 | | - 'click .delete button': this._deleteHandler |
| 685 | + 'click .start': this._startHandler, |
| 686 | + 'click .cancel': this._cancelHandler, |
| 687 | + 'click .delete': this._deleteHandler |
680 | 688 | }); |
681 | 689 | this._initButtonBarEventHandlers(); |
682 | 690 | }, |
|
0 commit comments