fine_uploader 3.1.1 → 3.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,10 +1,9 @@
1
1
  /**
2
- * http://github.com/Valums-File-Uploader/file-uploader
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
- * Original version: 1.0 © 2010 Andrew Valums ( andrew(at)valums.com )
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 MIT license, GNU GPL 2 or later, GNU LGPL 2 or later, see license.txt.
8
+ * Licensed under GNU GPL v3, see license.txt.
10
9
  */
@@ -0,0 +1,6 @@
1
+ (function() {
2
+ var match = /(\{.+\}).+/.exec(document.body.innerHTML);
3
+ if (match) {
4
+ parent.postMessage(match[1], '*');
5
+ }
6
+ }());
@@ -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(new qq.FineUploaderBasic()._options.callbacks, function(prop, func) {
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 args = Array.prototype.slice.call(arguments);
67
- return $callbackEl.triggerHandler(name, args);
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
+ };