Skip to content

Commit

Permalink
Update javascript assets from master
Browse files Browse the repository at this point in the history
  • Loading branch information
christophermanning committed Mar 24, 2013
1 parent 9ce97c3 commit 0ceda35
Show file tree
Hide file tree
Showing 9 changed files with 320 additions and 128 deletions.
Empty file.
Empty file.
12 changes: 8 additions & 4 deletions vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js 100755 → 100644
@@ -1,5 +1,5 @@
/*
* jQuery File Upload File Processing Plugin 1.2.1
* jQuery File Upload File Processing Plugin 1.2.3
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2012, Sebastian Tschan
Expand Down Expand Up @@ -62,9 +62,13 @@
// fileupload widget (via file input selection, drag & drop or add
// API call). See the basic file upload widget for more information:
add: function (e, data) {
$(this).fileupload('process', data).done(function () {
data.submit();
});
if (data.autoUpload || (data.autoUpload !== false &&
($(this).data('blueimp-fileupload') ||
$(this).data('fileupload')).options.autoUpload)) {
$(this).fileupload('process', data).done(function () {
data.submit();
});
}
}
},

Expand Down
36 changes: 22 additions & 14 deletions vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js 100755 → 100644
@@ -1,5 +1,5 @@
/*
* jQuery File Upload User Interface Plugin 7.3
* jQuery File Upload User Interface Plugin 7.4.1
* https://github.com/blueimp/jQuery-File-Upload
*
* Copyright 2010, Sebastian Tschan
Expand Down Expand Up @@ -263,7 +263,7 @@
// Callback for upload progress events:
progress: function (e, data) {
if (data.context) {
var progress = parseInt(data.loaded / data.total * 100, 10);
var progress = Math.floor(data.loaded / data.total * 100);
data.context.find('.progress')
.attr('aria-valuenow', progress)
.find('.bar').css(
Expand All @@ -275,7 +275,7 @@
// Callback for global upload progress events:
progressall: function (e, data) {
var $this = $(this),
progress = parseInt(data.loaded / data.total * 100, 10),
progress = Math.floor(data.loaded / data.total * 100),
globalProgressNode = $this.find('.fileupload-progress'),
extendedProgressNode = globalProgressNode
.find('.progress-extended');
Expand Down Expand Up @@ -422,7 +422,7 @@

_formatTime: function (seconds) {
var date = new Date(seconds * 1000),
days = parseInt(seconds / 86400, 10);
days = Math.floor(seconds / 86400);
days = days ? days + 'd ' : '';
return days +
('0' + date.getUTCHours()).slice(-2) + ':' +
Expand Down Expand Up @@ -519,6 +519,12 @@
// so we have to resolve manually:
dfd.resolveWith(node);
}
node.on('remove', function () {
// If the element is removed before the
// transition finishes, transition events are
// not triggered, resolve manually:
dfd.resolveWith(node);
});
},
{
maxWidth: options.previewMaxWidth,
Expand Down Expand Up @@ -607,7 +613,7 @@

_transition: function (node) {
var dfd = $.Deferred();
if ($.support.transition && node.hasClass('fade')) {
if ($.support.transition && node.hasClass('fade') && node.is(':visible')) {
node.bind(
$.support.transition.end,
function (e) {
Expand All @@ -632,27 +638,28 @@
this._on(fileUploadButtonBar.find('.start'), {
click: function (e) {
e.preventDefault();
filesList.find('.start button').click();
filesList.find('.start').click();
}
});
this._on(fileUploadButtonBar.find('.cancel'), {
click: function (e) {
e.preventDefault();
filesList.find('.cancel button').click();
filesList.find('.cancel').click();
}
});
this._on(fileUploadButtonBar.find('.delete'), {
click: function (e) {
e.preventDefault();
filesList.find('.delete input:checked')
.siblings('button').click();
filesList.find('.toggle:checked')
.closest('.template-download')
.find('.delete').click();
fileUploadButtonBar.find('.toggle')
.prop('checked', false);
}
});
this._on(fileUploadButtonBar.find('.toggle'), {
change: function (e) {
filesList.find('.delete input').prop(
filesList.find('.toggle').prop(
'checked',
$(e.currentTarget).is(':checked')
);
Expand All @@ -662,7 +669,8 @@

_destroyButtonBarEventHandlers: function () {
this._off(
this.element.find('.fileupload-buttonbar button'),
this.element.find('.fileupload-buttonbar')
.find('.start, .cancel, .delete'),
'click'
);
this._off(
Expand All @@ -674,9 +682,9 @@
_initEventHandlers: function () {
this._super();
this._on(this.options.filesContainer, {
'click .start button': this._startHandler,
'click .cancel button': this._cancelHandler,
'click .delete button': this._deleteHandler
'click .start': this._startHandler,
'click .cancel': this._cancelHandler,
'click .delete': this._deleteHandler
});
this._initButtonBarEventHandlers();
},
Expand Down

0 comments on commit 0ceda35

Please sign in to comment.