fileuploader-rails 3.0.0 → 3.0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +8 -7
- data/lib/fileuploader-rails/version.rb +1 -1
- data/vendor/assets/javascripts/fineuploader.jquery.js +2124 -0
- data/vendor/assets/javascripts/fineuploader.js +1976 -0
- metadata +6 -13
- data/vendor/assets/javascripts/fineuploader/button.js +0 -102
- data/vendor/assets/javascripts/fineuploader/handler.base.js +0 -120
- data/vendor/assets/javascripts/fineuploader/handler.form.js +0 -197
- data/vendor/assets/javascripts/fineuploader/handler.xhr.js +0 -168
- data/vendor/assets/javascripts/fineuploader/header.js +0 -12
- data/vendor/assets/javascripts/fineuploader/jquery-plugin.js +0 -148
- data/vendor/assets/javascripts/fineuploader/uploader.basic.js +0 -483
- data/vendor/assets/javascripts/fineuploader/uploader.js +0 -575
- data/vendor/assets/javascripts/fineuploader/util.js +0 -319
@@ -1,319 +0,0 @@
|
|
1
|
-
var qq = function(element) {
|
2
|
-
"use strict";
|
3
|
-
|
4
|
-
return {
|
5
|
-
hide: function() {
|
6
|
-
element.style.display = 'none';
|
7
|
-
return this;
|
8
|
-
},
|
9
|
-
|
10
|
-
/** Returns the function which detaches attached event */
|
11
|
-
attach: function(type, fn) {
|
12
|
-
if (element.addEventListener){
|
13
|
-
element.addEventListener(type, fn, false);
|
14
|
-
} else if (element.attachEvent){
|
15
|
-
element.attachEvent('on' + type, fn);
|
16
|
-
}
|
17
|
-
return function() {
|
18
|
-
qq(element).detach(type, fn);
|
19
|
-
};
|
20
|
-
},
|
21
|
-
|
22
|
-
detach: function(type, fn) {
|
23
|
-
if (element.removeEventListener){
|
24
|
-
element.removeEventListener(type, fn, false);
|
25
|
-
} else if (element.attachEvent){
|
26
|
-
element.detachEvent('on' + type, fn);
|
27
|
-
}
|
28
|
-
return this;
|
29
|
-
},
|
30
|
-
|
31
|
-
contains: function(descendant) {
|
32
|
-
// compareposition returns false in this case
|
33
|
-
if (element == descendant) {
|
34
|
-
return true;
|
35
|
-
}
|
36
|
-
|
37
|
-
if (element.contains){
|
38
|
-
return element.contains(descendant);
|
39
|
-
} else {
|
40
|
-
return !!(descendant.compareDocumentPosition(element) & 8);
|
41
|
-
}
|
42
|
-
},
|
43
|
-
|
44
|
-
/**
|
45
|
-
* Insert this element before elementB.
|
46
|
-
*/
|
47
|
-
insertBefore: function(elementB) {
|
48
|
-
elementB.parentNode.insertBefore(element, elementB);
|
49
|
-
return this;
|
50
|
-
},
|
51
|
-
|
52
|
-
remove: function() {
|
53
|
-
element.parentNode.removeChild(element);
|
54
|
-
return this;
|
55
|
-
},
|
56
|
-
|
57
|
-
/**
|
58
|
-
* Sets styles for an element.
|
59
|
-
* Fixes opacity in IE6-8.
|
60
|
-
*/
|
61
|
-
css: function(styles) {
|
62
|
-
if (styles.opacity != null){
|
63
|
-
if (typeof element.style.opacity != 'string' && typeof(element.filters) != 'undefined'){
|
64
|
-
styles.filter = 'alpha(opacity=' + Math.round(100 * styles.opacity) + ')';
|
65
|
-
}
|
66
|
-
}
|
67
|
-
qq.extend(element.style, styles);
|
68
|
-
|
69
|
-
return this;
|
70
|
-
},
|
71
|
-
|
72
|
-
hasClass: function(name) {
|
73
|
-
var re = new RegExp('(^| )' + name + '( |$)');
|
74
|
-
return re.test(element.className);
|
75
|
-
},
|
76
|
-
|
77
|
-
addClass: function(name) {
|
78
|
-
if (!qq(element).hasClass(name)){
|
79
|
-
element.className += ' ' + name;
|
80
|
-
}
|
81
|
-
return this;
|
82
|
-
},
|
83
|
-
|
84
|
-
removeClass: function(name) {
|
85
|
-
var re = new RegExp('(^| )' + name + '( |$)');
|
86
|
-
element.className = element.className.replace(re, ' ').replace(/^\s+|\s+$/g, "");
|
87
|
-
return this;
|
88
|
-
},
|
89
|
-
|
90
|
-
getByClass: function(className) {
|
91
|
-
if (element.querySelectorAll){
|
92
|
-
return element.querySelectorAll('.' + className);
|
93
|
-
}
|
94
|
-
|
95
|
-
var result = [];
|
96
|
-
var candidates = element.getElementsByTagName("*");
|
97
|
-
var len = candidates.length;
|
98
|
-
|
99
|
-
for (var i = 0; i < len; i++){
|
100
|
-
if (qq(candidates[i]).hasClass(className)){
|
101
|
-
result.push(candidates[i]);
|
102
|
-
}
|
103
|
-
}
|
104
|
-
return result;
|
105
|
-
},
|
106
|
-
|
107
|
-
children: function() {
|
108
|
-
var children = [],
|
109
|
-
child = element.firstChild;
|
110
|
-
|
111
|
-
while (child){
|
112
|
-
if (child.nodeType == 1){
|
113
|
-
children.push(child);
|
114
|
-
}
|
115
|
-
child = child.nextSibling;
|
116
|
-
}
|
117
|
-
|
118
|
-
return children;
|
119
|
-
},
|
120
|
-
|
121
|
-
setText: function(text) {
|
122
|
-
element.innerText = text;
|
123
|
-
element.textContent = text;
|
124
|
-
return this;
|
125
|
-
},
|
126
|
-
|
127
|
-
clearText: function() {
|
128
|
-
return qq(element).setText("");
|
129
|
-
}
|
130
|
-
};
|
131
|
-
};
|
132
|
-
|
133
|
-
qq.log = function(message, level) {
|
134
|
-
if (window.console) {
|
135
|
-
if (!level || level === 'info') {
|
136
|
-
window.console.log(message);
|
137
|
-
}
|
138
|
-
else
|
139
|
-
{
|
140
|
-
if (window.console[level]) {
|
141
|
-
window.console[level](message);
|
142
|
-
}
|
143
|
-
else {
|
144
|
-
window.console.log('<' + level + '> ' + message);
|
145
|
-
}
|
146
|
-
}
|
147
|
-
}
|
148
|
-
};
|
149
|
-
|
150
|
-
qq.isObject = function(variable) {
|
151
|
-
"use strict";
|
152
|
-
return variable !== null && variable && typeof(variable) === "object" && variable.constructor === Object;
|
153
|
-
};
|
154
|
-
|
155
|
-
qq.extend = function (first, second, extendNested) {
|
156
|
-
"use strict";
|
157
|
-
var prop;
|
158
|
-
for (prop in second) {
|
159
|
-
if (second.hasOwnProperty(prop)) {
|
160
|
-
if (extendNested && qq.isObject(second[prop])) {
|
161
|
-
if (first[prop] === undefined) {
|
162
|
-
first[prop] = {};
|
163
|
-
}
|
164
|
-
qq.extend(first[prop], second[prop], true);
|
165
|
-
}
|
166
|
-
else {
|
167
|
-
first[prop] = second[prop];
|
168
|
-
}
|
169
|
-
}
|
170
|
-
}
|
171
|
-
};
|
172
|
-
|
173
|
-
/**
|
174
|
-
* Searches for a given element in the array, returns -1 if it is not present.
|
175
|
-
* @param {Number} [from] The index at which to begin the search
|
176
|
-
*/
|
177
|
-
qq.indexOf = function(arr, elt, from){
|
178
|
-
if (arr.indexOf) return arr.indexOf(elt, from);
|
179
|
-
|
180
|
-
from = from || 0;
|
181
|
-
var len = arr.length;
|
182
|
-
|
183
|
-
if (from < 0) from += len;
|
184
|
-
|
185
|
-
for (; from < len; from++){
|
186
|
-
if (from in arr && arr[from] === elt){
|
187
|
-
return from;
|
188
|
-
}
|
189
|
-
}
|
190
|
-
return -1;
|
191
|
-
};
|
192
|
-
|
193
|
-
qq.getUniqueId = (function(){
|
194
|
-
var id = 0;
|
195
|
-
return function(){ return id++; };
|
196
|
-
})();
|
197
|
-
|
198
|
-
//
|
199
|
-
// Browsers and platforms detection
|
200
|
-
|
201
|
-
qq.ie = function(){ return navigator.userAgent.indexOf('MSIE') != -1; }
|
202
|
-
qq.ie10 = function(){ return navigator.userAgent.indexOf('MSIE 10') != -1; }
|
203
|
-
qq.safari = function(){ return navigator.vendor != undefined && navigator.vendor.indexOf("Apple") != -1; }
|
204
|
-
qq.chrome = function(){ return navigator.vendor != undefined && navigator.vendor.indexOf('Google') != -1; }
|
205
|
-
qq.firefox = function(){ return (navigator.userAgent.indexOf('Mozilla') != -1 && navigator.vendor != undefined && navigator.vendor == ''); }
|
206
|
-
qq.windows = function(){ return navigator.platform == "Win32"; }
|
207
|
-
|
208
|
-
//
|
209
|
-
// Events
|
210
|
-
|
211
|
-
qq.preventDefault = function(e){
|
212
|
-
if (e.preventDefault){
|
213
|
-
e.preventDefault();
|
214
|
-
} else{
|
215
|
-
e.returnValue = false;
|
216
|
-
}
|
217
|
-
};
|
218
|
-
|
219
|
-
/**
|
220
|
-
* Creates and returns element from html string
|
221
|
-
* Uses innerHTML to create an element
|
222
|
-
*/
|
223
|
-
qq.toElement = (function(){
|
224
|
-
var div = document.createElement('div');
|
225
|
-
return function(html){
|
226
|
-
div.innerHTML = html;
|
227
|
-
var element = div.firstChild;
|
228
|
-
div.removeChild(element);
|
229
|
-
return element;
|
230
|
-
};
|
231
|
-
})();
|
232
|
-
|
233
|
-
/**
|
234
|
-
* obj2url() takes a json-object as argument and generates
|
235
|
-
* a querystring. pretty much like jQuery.param()
|
236
|
-
*
|
237
|
-
* how to use:
|
238
|
-
*
|
239
|
-
* `qq.obj2url({a:'b',c:'d'},'http://any.url/upload?otherParam=value');`
|
240
|
-
*
|
241
|
-
* will result in:
|
242
|
-
*
|
243
|
-
* `http://any.url/upload?otherParam=value&a=b&c=d`
|
244
|
-
*
|
245
|
-
* @param Object JSON-Object
|
246
|
-
* @param String current querystring-part
|
247
|
-
* @return String encoded querystring
|
248
|
-
*/
|
249
|
-
qq.obj2url = function(obj, temp, prefixDone){
|
250
|
-
var uristrings = [],
|
251
|
-
prefix = '&',
|
252
|
-
add = function(nextObj, i){
|
253
|
-
var nextTemp = temp
|
254
|
-
? (/\[\]$/.test(temp)) // prevent double-encoding
|
255
|
-
? temp
|
256
|
-
: temp+'['+i+']'
|
257
|
-
: i;
|
258
|
-
if ((nextTemp != 'undefined') && (i != 'undefined')) {
|
259
|
-
uristrings.push(
|
260
|
-
(typeof nextObj === 'object')
|
261
|
-
? qq.obj2url(nextObj, nextTemp, true)
|
262
|
-
: (Object.prototype.toString.call(nextObj) === '[object Function]')
|
263
|
-
? encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj())
|
264
|
-
: encodeURIComponent(nextTemp) + '=' + encodeURIComponent(nextObj)
|
265
|
-
);
|
266
|
-
}
|
267
|
-
};
|
268
|
-
|
269
|
-
if (!prefixDone && temp) {
|
270
|
-
prefix = (/\?/.test(temp)) ? (/\?$/.test(temp)) ? '' : '&' : '?';
|
271
|
-
uristrings.push(temp);
|
272
|
-
uristrings.push(qq.obj2url(obj));
|
273
|
-
} else if ((Object.prototype.toString.call(obj) === '[object Array]') && (typeof obj != 'undefined') ) {
|
274
|
-
// we wont use a for-in-loop on an array (performance)
|
275
|
-
for (var i = 0, len = obj.length; i < len; ++i){
|
276
|
-
add(obj[i], i);
|
277
|
-
}
|
278
|
-
} else if ((typeof obj != 'undefined') && (obj !== null) && (typeof obj === "object")){
|
279
|
-
// for anything else but a scalar, we will use for-in-loop
|
280
|
-
for (var i in obj){
|
281
|
-
add(obj[i], i);
|
282
|
-
}
|
283
|
-
} else {
|
284
|
-
uristrings.push(encodeURIComponent(temp) + '=' + encodeURIComponent(obj));
|
285
|
-
}
|
286
|
-
|
287
|
-
if (temp) {
|
288
|
-
return uristrings.join(prefix);
|
289
|
-
} else {
|
290
|
-
return uristrings.join(prefix)
|
291
|
-
.replace(/^&/, '')
|
292
|
-
.replace(/%20/g, '+');
|
293
|
-
}
|
294
|
-
};
|
295
|
-
|
296
|
-
/**
|
297
|
-
* A generic module which supports object disposing in dispose() method.
|
298
|
-
* */
|
299
|
-
qq.DisposeSupport = {
|
300
|
-
_disposers: [],
|
301
|
-
|
302
|
-
/** Run all registered disposers */
|
303
|
-
dispose: function() {
|
304
|
-
var disposer;
|
305
|
-
while (disposer = this._disposers.shift()) {
|
306
|
-
disposer();
|
307
|
-
}
|
308
|
-
},
|
309
|
-
|
310
|
-
/** Add disposer to the collection */
|
311
|
-
addDisposer: function(disposeFunction) {
|
312
|
-
this._disposers.push(disposeFunction);
|
313
|
-
},
|
314
|
-
|
315
|
-
/** Attach event handler and register de-attacher as a disposer */
|
316
|
-
_attach: function() {
|
317
|
-
this.addDisposer(qq(arguments[0]).attach.apply(this, Array.prototype.slice.call(arguments, 1)));
|
318
|
-
}
|
319
|
-
};
|