fine_uploader 3.1.1 → 3.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE.txt +1 -3
- data/Vendorfile +16 -5
- data/lib/fine_uploader/version.rb +1 -1
- data/vendor/assets/javascripts/fine_uploader/ajax.requester.js +184 -0
- data/vendor/assets/javascripts/fine_uploader/button.js +62 -58
- data/vendor/assets/javascripts/fine_uploader/deletefile.ajax.requester.js +44 -0
- data/vendor/assets/javascripts/fine_uploader/dnd.js +2 -0
- data/vendor/assets/javascripts/fine_uploader/handler.base.js +164 -92
- data/vendor/assets/javascripts/fine_uploader/handler.form.js +220 -133
- data/vendor/assets/javascripts/fine_uploader/handler.xhr.js +594 -132
- data/vendor/assets/javascripts/fine_uploader/header.js +3 -4
- data/vendor/assets/javascripts/fine_uploader/iframe.xss.response.js +6 -0
- data/vendor/assets/javascripts/fine_uploader/jquery-plugin.js +13 -4
- data/vendor/assets/javascripts/fine_uploader/paste.js +49 -0
- data/vendor/assets/javascripts/fine_uploader/promise.js +45 -0
- data/vendor/assets/javascripts/fine_uploader/uploader.basic.js +547 -175
- data/vendor/assets/javascripts/fine_uploader/uploader.js +197 -42
- data/vendor/assets/javascripts/fine_uploader/util.js +117 -12
- data/vendor/assets/javascripts/fine_uploader/window.receive.message.js +32 -0
- data/vendor/assets/javascripts/fine_uploader.js +17 -0
- data/vendor/assets/stylesheets/fine_uploader.css.scss +6 -7
- metadata +9 -2
@@ -1,10 +1,9 @@
|
|
1
1
|
/**
|
2
|
-
* http://github.com/
|
2
|
+
* http://github.com/Widen/fine-uploader
|
3
3
|
*
|
4
4
|
* Multiple file upload component with progress-bar, drag-and-drop, support for all modern browsers.
|
5
5
|
*
|
6
|
-
*
|
7
|
-
* Current Maintainer (2.0+): © 2012, Ray Nicholus ( fineuploader(at)garstasio.com )
|
6
|
+
* Copyright © 2013, Widen Enterprises info@fineupoader.com
|
8
7
|
*
|
9
|
-
* Licensed under
|
8
|
+
* Licensed under GNU GPL v3, see license.txt.
|
10
9
|
*/
|
@@ -53,9 +53,10 @@
|
|
53
53
|
//implement all callbacks defined in Fine Uploader as functions that trigger appropriately names events and
|
54
54
|
// return the result of executing the bound handler back to Fine Uploader
|
55
55
|
addCallbacks = function(transformedOpts) {
|
56
|
-
var callbacks = transformedOpts.callbacks = {}
|
56
|
+
var callbacks = transformedOpts.callbacks = {},
|
57
|
+
uploaderInst = new qq.FineUploaderBasic();
|
57
58
|
|
58
|
-
$.each(
|
59
|
+
$.each(uploaderInst._options.callbacks, function(prop, func) {
|
59
60
|
var name, $callbackEl;
|
60
61
|
|
61
62
|
name = /^on(\w+)/.exec(prop)[1];
|
@@ -63,8 +64,16 @@
|
|
63
64
|
$callbackEl = $el;
|
64
65
|
|
65
66
|
callbacks[prop] = function() {
|
66
|
-
var
|
67
|
-
|
67
|
+
var origFunc = func,
|
68
|
+
args = Array.prototype.slice.call(arguments),
|
69
|
+
jqueryHandlerResult = $callbackEl.triggerHandler(name, args);
|
70
|
+
|
71
|
+
if (jqueryHandlerResult === undefined &&
|
72
|
+
$.inArray(prop, uploaderInst.getPromissoryCallbackNames()) >= 0) {
|
73
|
+
return origFunc();
|
74
|
+
}
|
75
|
+
|
76
|
+
return jqueryHandlerResult;
|
68
77
|
};
|
69
78
|
});
|
70
79
|
};
|
@@ -0,0 +1,49 @@
|
|
1
|
+
/*globals qq*/
|
2
|
+
qq.PasteSupport = function(o) {
|
3
|
+
"use strict";
|
4
|
+
|
5
|
+
var options, detachPasteHandler;
|
6
|
+
|
7
|
+
options = {
|
8
|
+
targetElement: null,
|
9
|
+
callbacks: {
|
10
|
+
log: function(message, level) {},
|
11
|
+
pasteReceived: function(blob) {}
|
12
|
+
}
|
13
|
+
};
|
14
|
+
|
15
|
+
function isImage(item) {
|
16
|
+
return item.type &&
|
17
|
+
item.type.indexOf("image/") === 0;
|
18
|
+
}
|
19
|
+
|
20
|
+
function registerPasteHandler() {
|
21
|
+
qq(options.targetElement).attach("paste", function(event) {
|
22
|
+
var clipboardData = event.clipboardData;
|
23
|
+
|
24
|
+
if (clipboardData) {
|
25
|
+
qq.each(clipboardData.items, function(idx, item) {
|
26
|
+
if (isImage(item)) {
|
27
|
+
var blob = item.getAsFile();
|
28
|
+
options.callbacks.pasteReceived(blob);
|
29
|
+
}
|
30
|
+
});
|
31
|
+
}
|
32
|
+
});
|
33
|
+
}
|
34
|
+
|
35
|
+
function unregisterPasteHandler() {
|
36
|
+
if (detachPasteHandler) {
|
37
|
+
detachPasteHandler();
|
38
|
+
}
|
39
|
+
}
|
40
|
+
|
41
|
+
qq.extend(options, o);
|
42
|
+
registerPasteHandler();
|
43
|
+
|
44
|
+
return {
|
45
|
+
reset: function() {
|
46
|
+
unregisterPasteHandler();
|
47
|
+
}
|
48
|
+
};
|
49
|
+
};
|
@@ -0,0 +1,45 @@
|
|
1
|
+
/*globals qq*/
|
2
|
+
qq.Promise = function() {
|
3
|
+
"use strict";
|
4
|
+
|
5
|
+
var successValue, failureValue,
|
6
|
+
successCallback, failureCallback,
|
7
|
+
state = 0;
|
8
|
+
|
9
|
+
return {
|
10
|
+
then: function(onSuccess, onFailure) {
|
11
|
+
if (state === 0) {
|
12
|
+
successCallback = onSuccess;
|
13
|
+
failureCallback = onFailure;
|
14
|
+
}
|
15
|
+
else if (state === -1 && onFailure) {
|
16
|
+
onFailure(failureValue);
|
17
|
+
}
|
18
|
+
else if (onSuccess) {
|
19
|
+
onSuccess(successValue);
|
20
|
+
}
|
21
|
+
},
|
22
|
+
|
23
|
+
success: function(val) {
|
24
|
+
state = 1;
|
25
|
+
successValue = val;
|
26
|
+
|
27
|
+
if (successCallback) {
|
28
|
+
successCallback(val);
|
29
|
+
}
|
30
|
+
|
31
|
+
return this;
|
32
|
+
},
|
33
|
+
|
34
|
+
failure: function(val) {
|
35
|
+
state = -1;
|
36
|
+
failureValue = val;
|
37
|
+
|
38
|
+
if (failureCallback) {
|
39
|
+
failureCallback(val);
|
40
|
+
}
|
41
|
+
|
42
|
+
return this;
|
43
|
+
}
|
44
|
+
};
|
45
|
+
};
|