Skip to content

Commit 31fab19

Browse files
committed
updated .js rolled-back
1 parent 57a67b8 commit 31fab19

8 files changed

+450
-1188
lines changed

fileupload/static/js/cors/jquery.postmessage-transport.js

-117
This file was deleted.

fileupload/static/js/cors/jquery.xdr-transport.js

-87
This file was deleted.

fileupload/static/js/jquery.fileupload-fp.js

+17-21
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* jQuery File Upload File Processing Plugin 1.2.1
2+
* jQuery File Upload File Processing Plugin 1.0
33
* https://github.com/blueimp/jQuery-File-Upload
44
*
55
* Copyright 2012, Sebastian Tschan
@@ -32,9 +32,9 @@
3232
}(function ($, loadImage) {
3333
'use strict';
3434

35-
// The File Upload FP version extends the fileupload widget
35+
// The File Upload IP version extends the basic fileupload widget
3636
// with file processing functionality:
37-
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
37+
$.widget('blueimpFP.fileupload', $.blueimp.fileupload, {
3838

3939
options: {
4040
// The list of file processing actions:
@@ -70,7 +70,7 @@
7070

7171
processActions: {
7272
// Loads the image given via data.files and data.index
73-
// as img element if the browser supports canvas.
73+
// as canvas element.
7474
// Accepts the options fileTypes (regular expression)
7575
// and maxFileSize (integer) to limit the files to load:
7676
load: function (data, options) {
@@ -85,32 +85,28 @@
8585
options.fileTypes.test(file.type))) {
8686
loadImage(
8787
file,
88-
function (img) {
89-
if (!img.src) {
90-
return dfd.rejectWith(that, [data]);
91-
}
92-
data.img = img;
88+
function (canvas) {
89+
data.canvas = canvas;
9390
dfd.resolveWith(that, [data]);
94-
}
91+
},
92+
{canvas: true}
9593
);
9694
} else {
9795
dfd.rejectWith(that, [data]);
9896
}
9997
return dfd.promise();
10098
},
101-
// Resizes the image given as data.img and updates
102-
// data.canvas with the resized image as canvas element.
99+
// Resizes the image given as data.canvas and updates
100+
// data.canvas with the resized image.
103101
// Accepts the options maxWidth, maxHeight, minWidth and
104102
// minHeight to scale the given image:
105103
resize: function (data, options) {
106-
var img = data.img,
107-
canvas;
108-
options = $.extend({canvas: true}, options);
109-
if (img) {
110-
canvas = loadImage.scale(img, options);
111-
if (canvas.width !== img.width ||
112-
canvas.height !== img.height) {
104+
if (data.canvas) {
105+
var canvas = loadImage.scale(data.canvas, options);
106+
if (canvas.width !== data.canvas.width ||
107+
canvas.height !== data.canvas.height) {
113108
data.canvas = canvas;
109+
data.processed = true;
114110
}
115111
}
116112
return data;
@@ -119,7 +115,7 @@
119115
// inplace at data.index of data.files:
120116
save: function (data, options) {
121117
// Do nothing if no processing has happened:
122-
if (!data.canvas) {
118+
if (!data.canvas || !data.processed) {
123119
return data;
124120
}
125121
var that = this,
@@ -212,7 +208,7 @@
212208
},
213209

214210
_create: function () {
215-
this._super();
211+
$.blueimp.fileupload.prototype._create.call(this);
216212
this._processing = 0;
217213
this._processingQueue = $.Deferred().resolveWith(this)
218214
.promise();

0 commit comments

Comments
 (0)