jquery-fileupload-rails 0.4.1 → 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +38 -16
- data/{vendor → app}/assets/images/loading.gif +0 -0
- data/{vendor → app}/assets/images/progressbar.gif +0 -0
- data/app/assets/javascripts/jquery-fileupload/angularjs.js +12 -0
- data/app/assets/javascripts/jquery-fileupload/basic-plus.js +11 -0
- data/app/assets/javascripts/jquery-fileupload/basic.js +3 -0
- data/{vendor → app}/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js +4 -4
- data/{vendor → app}/assets/javascripts/jquery-fileupload/cors/jquery.xdr-transport.js +1 -2
- data/app/assets/javascripts/jquery-fileupload/index.js +13 -0
- data/app/assets/javascripts/jquery-fileupload/jquery-ui.js +13 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-angular.js +429 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-audio.js +106 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-image.js +315 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-jquery-ui.js +152 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-process.js +172 -0
- data/{vendor → app}/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js +178 -273
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-validate.js +119 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-video.js +106 -0
- data/{vendor → app}/assets/javascripts/jquery-fileupload/jquery.fileupload.js +481 -188
- data/{vendor → app}/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js +43 -14
- data/{vendor → app}/assets/javascripts/jquery-fileupload/locale.js +0 -0
- data/{vendor → app}/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js +9 -5
- data/{vendor → app}/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js +72 -44
- data/app/assets/javascripts/jquery-fileupload/vendor/load-image.all.min.js +1 -0
- data/{vendor → app}/assets/javascripts/jquery-fileupload/vendor/tmpl.js +9 -8
- data/app/assets/stylesheets/jquery.fileupload-noscript.scss +22 -0
- data/app/assets/stylesheets/jquery.fileupload-ui-noscript.scss +17 -0
- data/app/assets/stylesheets/jquery.fileupload-ui.scss +57 -0
- data/app/assets/stylesheets/jquery.fileupload.scss +36 -0
- data/lib/jquery/fileupload/rails/version.rb +1 -1
- metadata +43 -39
- data/vendor/assets/javascripts/jquery-fileupload/basic.js +0 -4
- data/vendor/assets/javascripts/jquery-fileupload/index.js +0 -9
- data/vendor/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js +0 -223
- data/vendor/assets/javascripts/jquery-fileupload/vendor/load-image.js +0 -121
- data/vendor/assets/stylesheets/jquery.fileupload-ui.scss +0 -84
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* jQuery Iframe Transport Plugin 1.
|
2
|
+
* jQuery Iframe Transport Plugin 1.8.2
|
3
3
|
* https://github.com/blueimp/jQuery-File-Upload
|
4
4
|
*
|
5
5
|
* Copyright 2011, Sebastian Tschan
|
@@ -9,8 +9,7 @@
|
|
9
9
|
* http://www.opensource.org/licenses/MIT
|
10
10
|
*/
|
11
11
|
|
12
|
-
/*
|
13
|
-
/*global define, window, document */
|
12
|
+
/* global define, window, document */
|
14
13
|
|
15
14
|
(function (factory) {
|
16
15
|
'use strict';
|
@@ -27,7 +26,7 @@
|
|
27
26
|
// Helper variable to create unique names for the transport iframes:
|
28
27
|
var counter = 0;
|
29
28
|
|
30
|
-
// The iframe transport accepts
|
29
|
+
// The iframe transport accepts four additional options:
|
31
30
|
// options.fileInput: a jQuery collection of file input fields
|
32
31
|
// options.paramName: the parameter name for the file form data,
|
33
32
|
// overrides the name property of the file input field(s),
|
@@ -35,9 +34,16 @@
|
|
35
34
|
// options.formData: an array of objects with name and value properties,
|
36
35
|
// equivalent to the return data of .serializeArray(), e.g.:
|
37
36
|
// [{name: 'a', value: 1}, {name: 'b', value: 2}]
|
37
|
+
// options.initialIframeSrc: the URL of the initial iframe src,
|
38
|
+
// by default set to "javascript:false;"
|
38
39
|
$.ajaxTransport('iframe', function (options) {
|
39
40
|
if (options.async) {
|
40
|
-
|
41
|
+
// javascript:false as initial iframe src
|
42
|
+
// prevents warning popups on HTTPS in IE6:
|
43
|
+
/*jshint scripturl: true */
|
44
|
+
var initialIframeSrc = options.initialIframeSrc || 'javascript:false;',
|
45
|
+
/*jshint scripturl: false */
|
46
|
+
form,
|
41
47
|
iframe,
|
42
48
|
addParamChar;
|
43
49
|
return {
|
@@ -56,14 +62,13 @@
|
|
56
62
|
options.url = options.url + addParamChar + '_method=PATCH';
|
57
63
|
options.type = 'POST';
|
58
64
|
}
|
59
|
-
// javascript:false as initial iframe src
|
60
|
-
// prevents warning popups on HTTPS in IE6.
|
61
65
|
// IE versions below IE8 cannot set the name property of
|
62
66
|
// elements that have already been added to the DOM,
|
63
67
|
// so we set the name along with the iframe HTML markup:
|
68
|
+
counter += 1;
|
64
69
|
iframe = $(
|
65
|
-
'<iframe src="
|
66
|
-
|
70
|
+
'<iframe src="' + initialIframeSrc +
|
71
|
+
'" name="iframe-transport-' + counter + '"></iframe>'
|
67
72
|
).bind('load', function () {
|
68
73
|
var fileInputClones,
|
69
74
|
paramNames = $.isArray(options.paramName) ?
|
@@ -94,9 +99,14 @@
|
|
94
99
|
);
|
95
100
|
// Fix for IE endless progress bar activity bug
|
96
101
|
// (happens on form submits to iframe targets):
|
97
|
-
$('<iframe src="
|
102
|
+
$('<iframe src="' + initialIframeSrc + '"></iframe>')
|
98
103
|
.appendTo(form);
|
99
|
-
|
104
|
+
window.setTimeout(function () {
|
105
|
+
// Removing the form in a setTimeout call
|
106
|
+
// allows Chrome's developer tools to display
|
107
|
+
// the response result
|
108
|
+
form.remove();
|
109
|
+
}, 0);
|
100
110
|
});
|
101
111
|
form
|
102
112
|
.prop('target', iframe.prop('name'))
|
@@ -132,6 +142,8 @@
|
|
132
142
|
.prop('enctype', 'multipart/form-data')
|
133
143
|
// enctype must be set as encoding for IE:
|
134
144
|
.prop('encoding', 'multipart/form-data');
|
145
|
+
// Remove the HTML5 form attribute from the input(s):
|
146
|
+
options.fileInput.removeAttr('form');
|
135
147
|
}
|
136
148
|
form.submit();
|
137
149
|
// Insert the file input fields at their original location
|
@@ -139,7 +151,10 @@
|
|
139
151
|
if (fileInputClones && fileInputClones.length) {
|
140
152
|
options.fileInput.each(function (index, input) {
|
141
153
|
var clone = $(fileInputClones[index]);
|
142
|
-
|
154
|
+
// Restore the original name and form properties:
|
155
|
+
$(input)
|
156
|
+
.prop('name', clone.prop('name'))
|
157
|
+
.attr('form', clone.attr('form'));
|
143
158
|
clone.replaceWith(input);
|
144
159
|
});
|
145
160
|
}
|
@@ -153,7 +168,7 @@
|
|
153
168
|
// concat is used to avoid the "Script URL" JSLint error:
|
154
169
|
iframe
|
155
170
|
.unbind('load')
|
156
|
-
.prop('src',
|
171
|
+
.prop('src', initialIframeSrc);
|
157
172
|
}
|
158
173
|
if (form) {
|
159
174
|
form.remove();
|
@@ -164,7 +179,15 @@
|
|
164
179
|
});
|
165
180
|
|
166
181
|
// The iframe transport returns the iframe content document as response.
|
167
|
-
// The following adds converters from iframe to text, json, html,
|
182
|
+
// The following adds converters from iframe to text, json, html, xml
|
183
|
+
// and script.
|
184
|
+
// Please note that the Content-Type for JSON responses has to be text/plain
|
185
|
+
// or text/html, if the browser doesn't include application/json in the
|
186
|
+
// Accept header, else IE will show a download dialog.
|
187
|
+
// The Content-Type for XML responses on the other hand has to be always
|
188
|
+
// application/xml or text/xml, so IE properly parses the XML response.
|
189
|
+
// See also
|
190
|
+
// https://github.com/blueimp/jQuery-File-Upload/wiki/Setup#content-type-negotiation
|
168
191
|
$.ajaxSetup({
|
169
192
|
converters: {
|
170
193
|
'iframe text': function (iframe) {
|
@@ -176,6 +199,12 @@
|
|
176
199
|
'iframe html': function (iframe) {
|
177
200
|
return iframe && $(iframe[0].body).html();
|
178
201
|
},
|
202
|
+
'iframe xml': function (iframe) {
|
203
|
+
var xmlDoc = iframe && iframe[0];
|
204
|
+
return xmlDoc && $.isXMLDoc(xmlDoc) ? xmlDoc :
|
205
|
+
$.parseXML((xmlDoc.XMLDocument && xmlDoc.XMLDocument.xml) ||
|
206
|
+
$(xmlDoc.body).html());
|
207
|
+
},
|
179
208
|
'iframe script': function (iframe) {
|
180
209
|
return iframe && $.globalEval($(iframe[0].body).text());
|
181
210
|
}
|
File without changes
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* JavaScript Canvas to Blob 2.0.
|
2
|
+
* JavaScript Canvas to Blob 2.0.5
|
3
3
|
* https://github.com/blueimp/JavaScript-Canvas-to-Blob
|
4
4
|
*
|
5
5
|
* Copyright 2012, Sebastian Tschan
|
@@ -72,12 +72,16 @@
|
|
72
72
|
};
|
73
73
|
if (window.HTMLCanvasElement && !CanvasPrototype.toBlob) {
|
74
74
|
if (CanvasPrototype.mozGetAsFile) {
|
75
|
-
CanvasPrototype.toBlob = function (callback, type) {
|
76
|
-
|
75
|
+
CanvasPrototype.toBlob = function (callback, type, quality) {
|
76
|
+
if (quality && CanvasPrototype.toDataURL && dataURLtoBlob) {
|
77
|
+
callback(dataURLtoBlob(this.toDataURL(type, quality)));
|
78
|
+
} else {
|
79
|
+
callback(this.mozGetAsFile('blob', type));
|
80
|
+
}
|
77
81
|
};
|
78
82
|
} else if (CanvasPrototype.toDataURL && dataURLtoBlob) {
|
79
|
-
CanvasPrototype.toBlob = function (callback, type) {
|
80
|
-
callback(dataURLtoBlob(this.toDataURL(type)));
|
83
|
+
CanvasPrototype.toBlob = function (callback, type, quality) {
|
84
|
+
callback(dataURLtoBlob(this.toDataURL(type, quality)));
|
81
85
|
};
|
82
86
|
}
|
83
87
|
}
|
@@ -1,36 +1,52 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
/*! jQuery UI - v1.11.1 - 2014-09-17
|
2
|
+
* http://jqueryui.com
|
3
|
+
* Includes: widget.js
|
4
|
+
* Copyright 2014 jQuery Foundation and other contributors; Licensed MIT */
|
5
|
+
|
6
|
+
(function( factory ) {
|
7
|
+
if ( typeof define === "function" && define.amd ) {
|
8
|
+
|
9
|
+
// AMD. Register as an anonymous module.
|
10
|
+
define([ "jquery" ], factory );
|
11
|
+
} else {
|
12
|
+
|
13
|
+
// Browser globals
|
14
|
+
factory( jQuery );
|
15
|
+
}
|
16
|
+
}(function( $ ) {
|
17
|
+
/*!
|
18
|
+
* jQuery UI Widget 1.11.1
|
19
|
+
* http://jqueryui.com
|
4
20
|
*
|
5
|
-
* Copyright
|
21
|
+
* Copyright 2014 jQuery Foundation and other contributors
|
6
22
|
* Released under the MIT license.
|
7
23
|
* http://jquery.org/license
|
8
24
|
*
|
9
25
|
* http://api.jqueryui.com/jQuery.widget/
|
10
26
|
*/
|
11
27
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
}
|
31
|
-
|
32
|
-
|
33
|
-
};
|
28
|
+
|
29
|
+
var widget_uuid = 0,
|
30
|
+
widget_slice = Array.prototype.slice;
|
31
|
+
|
32
|
+
$.cleanData = (function( orig ) {
|
33
|
+
return function( elems ) {
|
34
|
+
var events, elem, i;
|
35
|
+
for ( i = 0; (elem = elems[i]) != null; i++ ) {
|
36
|
+
try {
|
37
|
+
|
38
|
+
// Only trigger remove when necessary to save time
|
39
|
+
events = $._data( elem, "events" );
|
40
|
+
if ( events && events.remove ) {
|
41
|
+
$( elem ).triggerHandler( "remove" );
|
42
|
+
}
|
43
|
+
|
44
|
+
// http://bugs.jquery.com/ticket/8235
|
45
|
+
} catch( e ) {}
|
46
|
+
}
|
47
|
+
orig( elems );
|
48
|
+
};
|
49
|
+
})( $.cleanData );
|
34
50
|
|
35
51
|
$.widget = function( name, base, prototype ) {
|
36
52
|
var fullName, existingConstructor, constructor, basePrototype,
|
@@ -115,7 +131,7 @@ $.widget = function( name, base, prototype ) {
|
|
115
131
|
// TODO: remove support for widgetEventPrefix
|
116
132
|
// always use the name + a colon as the prefix, e.g., draggable:start
|
117
133
|
// don't prefix for widgets that aren't DOM-based
|
118
|
-
widgetEventPrefix: existingConstructor ? basePrototype.widgetEventPrefix : name
|
134
|
+
widgetEventPrefix: existingConstructor ? (basePrototype.widgetEventPrefix || name) : name
|
119
135
|
}, proxiedPrototype, {
|
120
136
|
constructor: constructor,
|
121
137
|
namespace: namespace,
|
@@ -143,10 +159,12 @@ $.widget = function( name, base, prototype ) {
|
|
143
159
|
}
|
144
160
|
|
145
161
|
$.widget.bridge( name, constructor );
|
162
|
+
|
163
|
+
return constructor;
|
146
164
|
};
|
147
165
|
|
148
166
|
$.widget.extend = function( target ) {
|
149
|
-
var input =
|
167
|
+
var input = widget_slice.call( arguments, 1 ),
|
150
168
|
inputIndex = 0,
|
151
169
|
inputLength = input.length,
|
152
170
|
key,
|
@@ -175,7 +193,7 @@ $.widget.bridge = function( name, object ) {
|
|
175
193
|
var fullName = object.prototype.widgetFullName || name;
|
176
194
|
$.fn[ name ] = function( options ) {
|
177
195
|
var isMethodCall = typeof options === "string",
|
178
|
-
args =
|
196
|
+
args = widget_slice.call( arguments, 1 ),
|
179
197
|
returnValue = this;
|
180
198
|
|
181
199
|
// allow multiple hashes to be passed on init
|
@@ -187,6 +205,10 @@ $.widget.bridge = function( name, object ) {
|
|
187
205
|
this.each(function() {
|
188
206
|
var methodValue,
|
189
207
|
instance = $.data( this, fullName );
|
208
|
+
if ( options === "instance" ) {
|
209
|
+
returnValue = instance;
|
210
|
+
return false;
|
211
|
+
}
|
190
212
|
if ( !instance ) {
|
191
213
|
return $.error( "cannot call methods on " + name + " prior to initialization; " +
|
192
214
|
"attempted to call method '" + options + "'" );
|
@@ -206,7 +228,10 @@ $.widget.bridge = function( name, object ) {
|
|
206
228
|
this.each(function() {
|
207
229
|
var instance = $.data( this, fullName );
|
208
230
|
if ( instance ) {
|
209
|
-
instance.option( options || {} )
|
231
|
+
instance.option( options || {} );
|
232
|
+
if ( instance._init ) {
|
233
|
+
instance._init();
|
234
|
+
}
|
210
235
|
} else {
|
211
236
|
$.data( this, fullName, new object( options, this ) );
|
212
237
|
}
|
@@ -233,7 +258,7 @@ $.Widget.prototype = {
|
|
233
258
|
_createWidget: function( options, element ) {
|
234
259
|
element = $( element || this.defaultElement || this )[ 0 ];
|
235
260
|
this.element = $( element );
|
236
|
-
this.uuid =
|
261
|
+
this.uuid = widget_uuid++;
|
237
262
|
this.eventNamespace = "." + this.widgetName + this.uuid;
|
238
263
|
this.options = $.widget.extend( {},
|
239
264
|
this.options,
|
@@ -276,9 +301,6 @@ $.Widget.prototype = {
|
|
276
301
|
// all event bindings should go through this._on()
|
277
302
|
this.element
|
278
303
|
.unbind( this.eventNamespace )
|
279
|
-
// 1.9 BC for #7810
|
280
|
-
// TODO remove dual storage
|
281
|
-
.removeData( this.widgetName )
|
282
304
|
.removeData( this.widgetFullName )
|
283
305
|
// support: jquery <1.6.3
|
284
306
|
// http://bugs.jquery.com/ticket/9413
|
@@ -324,12 +346,12 @@ $.Widget.prototype = {
|
|
324
346
|
curOption = curOption[ parts[ i ] ];
|
325
347
|
}
|
326
348
|
key = parts.pop();
|
327
|
-
if (
|
349
|
+
if ( arguments.length === 1 ) {
|
328
350
|
return curOption[ key ] === undefined ? null : curOption[ key ];
|
329
351
|
}
|
330
352
|
curOption[ key ] = value;
|
331
353
|
} else {
|
332
|
-
if (
|
354
|
+
if ( arguments.length === 1 ) {
|
333
355
|
return this.options[ key ] === undefined ? null : this.options[ key ];
|
334
356
|
}
|
335
357
|
options[ key ] = value;
|
@@ -354,20 +376,23 @@ $.Widget.prototype = {
|
|
354
376
|
|
355
377
|
if ( key === "disabled" ) {
|
356
378
|
this.widget()
|
357
|
-
.toggleClass( this.widgetFullName + "-disabled
|
358
|
-
|
359
|
-
|
360
|
-
|
379
|
+
.toggleClass( this.widgetFullName + "-disabled", !!value );
|
380
|
+
|
381
|
+
// If the widget is becoming disabled, then nothing is interactive
|
382
|
+
if ( value ) {
|
383
|
+
this.hoverable.removeClass( "ui-state-hover" );
|
384
|
+
this.focusable.removeClass( "ui-state-focus" );
|
385
|
+
}
|
361
386
|
}
|
362
387
|
|
363
388
|
return this;
|
364
389
|
},
|
365
390
|
|
366
391
|
enable: function() {
|
367
|
-
return this.
|
392
|
+
return this._setOptions({ disabled: false });
|
368
393
|
},
|
369
394
|
disable: function() {
|
370
|
-
return this.
|
395
|
+
return this._setOptions({ disabled: true });
|
371
396
|
},
|
372
397
|
|
373
398
|
_on: function( suppressDisabledCheck, element, handlers ) {
|
@@ -387,7 +412,6 @@ $.Widget.prototype = {
|
|
387
412
|
element = this.element;
|
388
413
|
delegateElement = this.widget();
|
389
414
|
} else {
|
390
|
-
// accept selectors, DOM elements
|
391
415
|
element = delegateElement = $( element );
|
392
416
|
this.bindings = this.bindings.add( element );
|
393
417
|
}
|
@@ -412,7 +436,7 @@ $.Widget.prototype = {
|
|
412
436
|
handler.guid || handlerProxy.guid || $.guid++;
|
413
437
|
}
|
414
438
|
|
415
|
-
var match = event.match( /^(\w
|
439
|
+
var match = event.match( /^([\w:-]*)\s*(.*)$/ ),
|
416
440
|
eventName = match[1] + instance.eventNamespace,
|
417
441
|
selector = match[2];
|
418
442
|
if ( selector ) {
|
@@ -527,4 +551,8 @@ $.each( { show: "fadeIn", hide: "fadeOut" }, function( method, defaultEffect ) {
|
|
527
551
|
};
|
528
552
|
});
|
529
553
|
|
554
|
+
var widget = $.widget;
|
555
|
+
|
556
|
+
|
557
|
+
|
530
558
|
}));
|
@@ -0,0 +1 @@
|
|
1
|
+
!function(a){"use strict";var b=function(a,c,d){var e,f,g=document.createElement("img");if(g.onerror=c,g.onload=function(){!f||d&&d.noRevoke||b.revokeObjectURL(f),c&&c(b.scale(g,d))},b.isInstanceOf("Blob",a)||b.isInstanceOf("File",a))e=f=b.createObjectURL(a),g._type=a.type;else{if("string"!=typeof a)return!1;e=a,d&&d.crossOrigin&&(g.crossOrigin=d.crossOrigin)}return e?(g.src=e,g):b.readFile(a,function(a){var b=a.target;b&&b.result?g.src=b.result:c&&c(a)})},c=window.createObjectURL&&window||window.URL&&URL.revokeObjectURL&&URL||window.webkitURL&&webkitURL;b.isInstanceOf=function(a,b){return Object.prototype.toString.call(b)==="[object "+a+"]"},b.transformCoordinates=function(){},b.getTransformedOptions=function(a,b){var c,d,e,f,g=b.aspectRatio;if(!g)return b;c={};for(d in b)b.hasOwnProperty(d)&&(c[d]=b[d]);return c.crop=!0,e=a.naturalWidth||a.width,f=a.naturalHeight||a.height,e/f>g?(c.maxWidth=f*g,c.maxHeight=f):(c.maxWidth=e,c.maxHeight=e/g),c},b.renderImageToCanvas=function(a,b,c,d,e,f,g,h,i,j){return a.getContext("2d").drawImage(b,c,d,e,f,g,h,i,j),a},b.hasCanvasOption=function(a){return a.canvas||a.crop||a.aspectRatio},b.scale=function(a,c){c=c||{};var d,e,f,g,h,i,j,k,l,m=document.createElement("canvas"),n=a.getContext||b.hasCanvasOption(c)&&m.getContext,o=a.naturalWidth||a.width,p=a.naturalHeight||a.height,q=o,r=p,s=function(){var a=Math.max((f||q)/q,(g||r)/r);a>1&&(q*=a,r*=a)},t=function(){var a=Math.min((d||q)/q,(e||r)/r);1>a&&(q*=a,r*=a)};return n&&(c=b.getTransformedOptions(a,c),j=c.left||0,k=c.top||0,c.sourceWidth?(h=c.sourceWidth,void 0!==c.right&&void 0===c.left&&(j=o-h-c.right)):h=o-j-(c.right||0),c.sourceHeight?(i=c.sourceHeight,void 0!==c.bottom&&void 0===c.top&&(k=p-i-c.bottom)):i=p-k-(c.bottom||0),q=h,r=i),d=c.maxWidth,e=c.maxHeight,f=c.minWidth,g=c.minHeight,n&&d&&e&&c.crop?(q=d,r=e,l=h/i-d/e,0>l?(i=e*h/d,void 0===c.top&&void 0===c.bottom&&(k=(p-i)/2)):l>0&&(h=d*i/e,void 0===c.left&&void 0===c.right&&(j=(o-h)/2))):((c.contain||c.cover)&&(f=d=d||f,g=e=e||g),c.cover?(t(),s()):(s(),t())),n?(m.width=q,m.height=r,b.transformCoordinates(m,c),b.renderImageToCanvas(m,a,j,k,h,i,0,0,q,r)):(a.width=q,a.height=r,a)},b.createObjectURL=function(a){return c?c.createObjectURL(a):!1},b.revokeObjectURL=function(a){return c?c.revokeObjectURL(a):!1},b.readFile=function(a,b,c){if(window.FileReader){var d=new FileReader;if(d.onload=d.onerror=b,c=c||"readAsDataURL",d[c])return d[c](a),d}return!1},"function"==typeof define&&define.amd?define(function(){return b}):a.loadImage=b}(this),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";if(window.navigator&&window.navigator.platform&&/iP(hone|od|ad)/.test(window.navigator.platform)){var b=a.renderImageToCanvas;a.detectSubsampling=function(a){var b,c;return a.width*a.height>1048576?(b=document.createElement("canvas"),b.width=b.height=1,c=b.getContext("2d"),c.drawImage(a,-a.width+1,0),0===c.getImageData(0,0,1,1).data[3]):!1},a.detectVerticalSquash=function(a,b){var c,d,e,f,g,h=a.naturalHeight||a.height,i=document.createElement("canvas"),j=i.getContext("2d");for(b&&(h/=2),i.width=1,i.height=h,j.drawImage(a,0,0),c=j.getImageData(0,0,1,h).data,d=0,e=h,f=h;f>d;)g=c[4*(f-1)+3],0===g?e=f:d=f,f=e+d>>1;return f/h||1},a.renderImageToCanvas=function(c,d,e,f,g,h,i,j,k,l){if("image/jpeg"===d._type){var m,n,o,p,q=c.getContext("2d"),r=document.createElement("canvas"),s=1024,t=r.getContext("2d");if(r.width=s,r.height=s,q.save(),m=a.detectSubsampling(d),m&&(e/=2,f/=2,g/=2,h/=2),n=a.detectVerticalSquash(d,m),m||1!==n){for(f*=n,k=Math.ceil(s*k/g),l=Math.ceil(s*l/h/n),j=0,p=0;h>p;){for(i=0,o=0;g>o;)t.clearRect(0,0,s,s),t.drawImage(d,e,f,g,h,-o,-p,g,h),q.drawImage(r,0,0,s,s,i,j,k,l),o+=s,i+=k;p+=s,j+=l}return q.restore(),c}}return b(c,d,e,f,g,h,i,j,k,l)}}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";var b=a.hasCanvasOption,c=a.transformCoordinates,d=a.getTransformedOptions;a.hasCanvasOption=function(c){return b.call(a,c)||c.orientation},a.transformCoordinates=function(b,d){c.call(a,b,d);var e=b.getContext("2d"),f=b.width,g=b.height,h=d.orientation;if(h&&!(h>8))switch(h>4&&(b.width=g,b.height=f),h){case 2:e.translate(f,0),e.scale(-1,1);break;case 3:e.translate(f,g),e.rotate(Math.PI);break;case 4:e.translate(0,g),e.scale(1,-1);break;case 5:e.rotate(.5*Math.PI),e.scale(1,-1);break;case 6:e.rotate(.5*Math.PI),e.translate(0,-g);break;case 7:e.rotate(.5*Math.PI),e.translate(f,-g),e.scale(-1,1);break;case 8:e.rotate(-.5*Math.PI),e.translate(-f,0)}},a.getTransformedOptions=function(b,c){var e,f,g=d.call(a,b,c),h=g.orientation;if(!h||h>8||1===h)return g;e={};for(f in g)g.hasOwnProperty(f)&&(e[f]=g[f]);switch(g.orientation){case 2:e.left=g.right,e.right=g.left;break;case 3:e.left=g.right,e.top=g.bottom,e.right=g.left,e.bottom=g.top;break;case 4:e.top=g.bottom,e.bottom=g.top;break;case 5:e.left=g.top,e.top=g.left,e.right=g.bottom,e.bottom=g.right;break;case 6:e.left=g.top,e.top=g.right,e.right=g.bottom,e.bottom=g.left;break;case 7:e.left=g.bottom,e.top=g.right,e.right=g.top,e.bottom=g.left;break;case 8:e.left=g.bottom,e.top=g.left,e.right=g.top,e.bottom=g.right}return g.orientation>4&&(e.maxWidth=g.maxHeight,e.maxHeight=g.maxWidth,e.minWidth=g.minHeight,e.minHeight=g.minWidth,e.sourceWidth=g.sourceHeight,e.sourceHeight=g.sourceWidth),e}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image"],a):a(window.loadImage)}(function(a){"use strict";var b=window.Blob&&(Blob.prototype.slice||Blob.prototype.webkitSlice||Blob.prototype.mozSlice);a.blobSlice=b&&function(){var a=this.slice||this.webkitSlice||this.mozSlice;return a.apply(this,arguments)},a.metaDataParsers={jpeg:{65505:[]}},a.parseMetaData=function(b,c,d){d=d||{};var e=this,f=d.maxMetaDataSize||262144,g={},h=!(window.DataView&&b&&b.size>=12&&"image/jpeg"===b.type&&a.blobSlice);(h||!a.readFile(a.blobSlice.call(b,0,f),function(b){if(b.target.error)return console.log(b.target.error),void c(g);var f,h,i,j,k=b.target.result,l=new DataView(k),m=2,n=l.byteLength-4,o=m;if(65496===l.getUint16(0)){for(;n>m&&(f=l.getUint16(m),f>=65504&&65519>=f||65534===f);){if(h=l.getUint16(m+2)+2,m+h>l.byteLength){console.log("Invalid meta data: Invalid segment size.");break}if(i=a.metaDataParsers.jpeg[f])for(j=0;j<i.length;j+=1)i[j].call(e,l,m,h,g,d);m+=h,o=m}!d.disableImageHead&&o>6&&(g.imageHead=k.slice?k.slice(0,o):new Uint8Array(k).subarray(0,o))}else console.log("Invalid JPEG file: Missing JPEG marker.");c(g)},"readAsArrayBuffer"))&&c(g)}}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-meta"],a):a(window.loadImage)}(function(a){"use strict";a.ExifMap=function(){return this},a.ExifMap.prototype.map={Orientation:274},a.ExifMap.prototype.get=function(a){return this[a]||this[this.map[a]]},a.getExifThumbnail=function(a,b,c){var d,e,f;if(!c||b+c>a.byteLength)return void console.log("Invalid Exif data: Invalid thumbnail data.");for(d=[],e=0;c>e;e+=1)f=a.getUint8(b+e),d.push((16>f?"0":"")+f.toString(16));return"data:image/jpeg,%"+d.join("%")},a.exifTagTypes={1:{getValue:function(a,b){return a.getUint8(b)},size:1},2:{getValue:function(a,b){return String.fromCharCode(a.getUint8(b))},size:1,ascii:!0},3:{getValue:function(a,b,c){return a.getUint16(b,c)},size:2},4:{getValue:function(a,b,c){return a.getUint32(b,c)},size:4},5:{getValue:function(a,b,c){return a.getUint32(b,c)/a.getUint32(b+4,c)},size:8},9:{getValue:function(a,b,c){return a.getInt32(b,c)},size:4},10:{getValue:function(a,b,c){return a.getInt32(b,c)/a.getInt32(b+4,c)},size:8}},a.exifTagTypes[7]=a.exifTagTypes[1],a.getExifValue=function(b,c,d,e,f,g){var h,i,j,k,l,m,n=a.exifTagTypes[e];if(!n)return void console.log("Invalid Exif data: Invalid tag type.");if(h=n.size*f,i=h>4?c+b.getUint32(d+8,g):d+8,i+h>b.byteLength)return void console.log("Invalid Exif data: Invalid data offset.");if(1===f)return n.getValue(b,i,g);for(j=[],k=0;f>k;k+=1)j[k]=n.getValue(b,i+k*n.size,g);if(n.ascii){for(l="",k=0;k<j.length&&(m=j[k],"\x00"!==m);k+=1)l+=m;return l}return j},a.parseExifTag=function(b,c,d,e,f){var g=b.getUint16(d,e);f.exif[g]=a.getExifValue(b,c,d,b.getUint16(d+2,e),b.getUint32(d+4,e),e)},a.parseExifTags=function(a,b,c,d,e){var f,g,h;if(c+6>a.byteLength)return void console.log("Invalid Exif data: Invalid directory offset.");if(f=a.getUint16(c,d),g=c+2+12*f,g+4>a.byteLength)return void console.log("Invalid Exif data: Invalid directory size.");for(h=0;f>h;h+=1)this.parseExifTag(a,b,c+2+12*h,d,e);return a.getUint32(g,d)},a.parseExifData=function(b,c,d,e,f){if(!f.disableExif){var g,h,i,j=c+10;if(1165519206===b.getUint32(c+4)){if(j+8>b.byteLength)return void console.log("Invalid Exif data: Invalid segment size.");if(0!==b.getUint16(c+8))return void console.log("Invalid Exif data: Missing byte alignment offset.");switch(b.getUint16(j)){case 18761:g=!0;break;case 19789:g=!1;break;default:return void console.log("Invalid Exif data: Invalid byte alignment marker.")}if(42!==b.getUint16(j+2,g))return void console.log("Invalid Exif data: Missing TIFF marker.");h=b.getUint32(j+4,g),e.exif=new a.ExifMap,h=a.parseExifTags(b,j,j+h,g,e),h&&!f.disableExifThumbnail&&(i={exif:{}},h=a.parseExifTags(b,j,j+h,g,i),i.exif[513]&&(e.exif.Thumbnail=a.getExifThumbnail(b,j+i.exif[513],i.exif[514]))),e.exif[34665]&&!f.disableExifSub&&a.parseExifTags(b,j,j+e.exif[34665],g,e),e.exif[34853]&&!f.disableExifGps&&a.parseExifTags(b,j,j+e.exif[34853],g,e)}}},a.metaDataParsers.jpeg[65505].push(a.parseExifData)}),function(a){"use strict";"function"==typeof define&&define.amd?define(["load-image","load-image-exif"],a):a(window.loadImage)}(function(a){"use strict";a.ExifMap.prototype.tags={256:"ImageWidth",257:"ImageHeight",34665:"ExifIFDPointer",34853:"GPSInfoIFDPointer",40965:"InteroperabilityIFDPointer",258:"BitsPerSample",259:"Compression",262:"PhotometricInterpretation",274:"Orientation",277:"SamplesPerPixel",284:"PlanarConfiguration",530:"YCbCrSubSampling",531:"YCbCrPositioning",282:"XResolution",283:"YResolution",296:"ResolutionUnit",273:"StripOffsets",278:"RowsPerStrip",279:"StripByteCounts",513:"JPEGInterchangeFormat",514:"JPEGInterchangeFormatLength",301:"TransferFunction",318:"WhitePoint",319:"PrimaryChromaticities",529:"YCbCrCoefficients",532:"ReferenceBlackWhite",306:"DateTime",270:"ImageDescription",271:"Make",272:"Model",305:"Software",315:"Artist",33432:"Copyright",36864:"ExifVersion",40960:"FlashpixVersion",40961:"ColorSpace",40962:"PixelXDimension",40963:"PixelYDimension",42240:"Gamma",37121:"ComponentsConfiguration",37122:"CompressedBitsPerPixel",37500:"MakerNote",37510:"UserComment",40964:"RelatedSoundFile",36867:"DateTimeOriginal",36868:"DateTimeDigitized",37520:"SubSecTime",37521:"SubSecTimeOriginal",37522:"SubSecTimeDigitized",33434:"ExposureTime",33437:"FNumber",34850:"ExposureProgram",34852:"SpectralSensitivity",34855:"PhotographicSensitivity",34856:"OECF",34864:"SensitivityType",34865:"StandardOutputSensitivity",34866:"RecommendedExposureIndex",34867:"ISOSpeed",34868:"ISOSpeedLatitudeyyy",34869:"ISOSpeedLatitudezzz",37377:"ShutterSpeedValue",37378:"ApertureValue",37379:"BrightnessValue",37380:"ExposureBias",37381:"MaxApertureValue",37382:"SubjectDistance",37383:"MeteringMode",37384:"LightSource",37385:"Flash",37396:"SubjectArea",37386:"FocalLength",41483:"FlashEnergy",41484:"SpatialFrequencyResponse",41486:"FocalPlaneXResolution",41487:"FocalPlaneYResolution",41488:"FocalPlaneResolutionUnit",41492:"SubjectLocation",41493:"ExposureIndex",41495:"SensingMethod",41728:"FileSource",41729:"SceneType",41730:"CFAPattern",41985:"CustomRendered",41986:"ExposureMode",41987:"WhiteBalance",41988:"DigitalZoomRatio",41989:"FocalLengthIn35mmFilm",41990:"SceneCaptureType",41991:"GainControl",41992:"Contrast",41993:"Saturation",41994:"Sharpness",41995:"DeviceSettingDescription",41996:"SubjectDistanceRange",42016:"ImageUniqueID",42032:"CameraOwnerName",42033:"BodySerialNumber",42034:"LensSpecification",42035:"LensMake",42036:"LensModel",42037:"LensSerialNumber",0:"GPSVersionID",1:"GPSLatitudeRef",2:"GPSLatitude",3:"GPSLongitudeRef",4:"GPSLongitude",5:"GPSAltitudeRef",6:"GPSAltitude",7:"GPSTimeStamp",8:"GPSSatellites",9:"GPSStatus",10:"GPSMeasureMode",11:"GPSDOP",12:"GPSSpeedRef",13:"GPSSpeed",14:"GPSTrackRef",15:"GPSTrack",16:"GPSImgDirectionRef",17:"GPSImgDirection",18:"GPSMapDatum",19:"GPSDestLatitudeRef",20:"GPSDestLatitude",21:"GPSDestLongitudeRef",22:"GPSDestLongitude",23:"GPSDestBearingRef",24:"GPSDestBearing",25:"GPSDestDistanceRef",26:"GPSDestDistance",27:"GPSProcessingMethod",28:"GPSAreaInformation",29:"GPSDateStamp",30:"GPSDifferential",31:"GPSHPositioningError"},a.ExifMap.prototype.stringValues={ExposureProgram:{0:"Undefined",1:"Manual",2:"Normal program",3:"Aperture priority",4:"Shutter priority",5:"Creative program",6:"Action program",7:"Portrait mode",8:"Landscape mode"},MeteringMode:{0:"Unknown",1:"Average",2:"CenterWeightedAverage",3:"Spot",4:"MultiSpot",5:"Pattern",6:"Partial",255:"Other"},LightSource:{0:"Unknown",1:"Daylight",2:"Fluorescent",3:"Tungsten (incandescent light)",4:"Flash",9:"Fine weather",10:"Cloudy weather",11:"Shade",12:"Daylight fluorescent (D 5700 - 7100K)",13:"Day white fluorescent (N 4600 - 5400K)",14:"Cool white fluorescent (W 3900 - 4500K)",15:"White fluorescent (WW 3200 - 3700K)",17:"Standard light A",18:"Standard light B",19:"Standard light C",20:"D55",21:"D65",22:"D75",23:"D50",24:"ISO studio tungsten",255:"Other"},Flash:{0:"Flash did not fire",1:"Flash fired",5:"Strobe return light not detected",7:"Strobe return light detected",9:"Flash fired, compulsory flash mode",13:"Flash fired, compulsory flash mode, return light not detected",15:"Flash fired, compulsory flash mode, return light detected",16:"Flash did not fire, compulsory flash mode",24:"Flash did not fire, auto mode",25:"Flash fired, auto mode",29:"Flash fired, auto mode, return light not detected",31:"Flash fired, auto mode, return light detected",32:"No flash function",65:"Flash fired, red-eye reduction mode",69:"Flash fired, red-eye reduction mode, return light not detected",71:"Flash fired, red-eye reduction mode, return light detected",73:"Flash fired, compulsory flash mode, red-eye reduction mode",77:"Flash fired, compulsory flash mode, red-eye reduction mode, return light not detected",79:"Flash fired, compulsory flash mode, red-eye reduction mode, return light detected",89:"Flash fired, auto mode, red-eye reduction mode",93:"Flash fired, auto mode, return light not detected, red-eye reduction mode",95:"Flash fired, auto mode, return light detected, red-eye reduction mode"},SensingMethod:{1:"Undefined",2:"One-chip color area sensor",3:"Two-chip color area sensor",4:"Three-chip color area sensor",5:"Color sequential area sensor",7:"Trilinear sensor",8:"Color sequential linear sensor"},SceneCaptureType:{0:"Standard",1:"Landscape",2:"Portrait",3:"Night scene"},SceneType:{1:"Directly photographed"},CustomRendered:{0:"Normal process",1:"Custom process"},WhiteBalance:{0:"Auto white balance",1:"Manual white balance"},GainControl:{0:"None",1:"Low gain up",2:"High gain up",3:"Low gain down",4:"High gain down"},Contrast:{0:"Normal",1:"Soft",2:"Hard"},Saturation:{0:"Normal",1:"Low saturation",2:"High saturation"},Sharpness:{0:"Normal",1:"Soft",2:"Hard"},SubjectDistanceRange:{0:"Unknown",1:"Macro",2:"Close view",3:"Distant view"},FileSource:{3:"DSC"},ComponentsConfiguration:{0:"",1:"Y",2:"Cb",3:"Cr",4:"R",5:"G",6:"B"},Orientation:{1:"top-left",2:"top-right",3:"bottom-right",4:"bottom-left",5:"left-top",6:"right-top",7:"right-bottom",8:"left-bottom"}},a.ExifMap.prototype.getText=function(a){var b=this.get(a);switch(a){case"LightSource":case"Flash":case"MeteringMode":case"ExposureProgram":case"SensingMethod":case"SceneCaptureType":case"SceneType":case"CustomRendered":case"WhiteBalance":case"GainControl":case"Contrast":case"Saturation":case"Sharpness":case"SubjectDistanceRange":case"FileSource":case"Orientation":return this.stringValues[a][b];case"ExifVersion":case"FlashpixVersion":return String.fromCharCode(b[0],b[1],b[2],b[3]);case"ComponentsConfiguration":return this.stringValues[a][b[0]]+this.stringValues[a][b[1]]+this.stringValues[a][b[2]]+this.stringValues[a][b[3]];case"GPSVersionID":return b[0]+"."+b[1]+"."+b[2]+"."+b[3]}return String(b)},function(a){var b,c=a.tags,d=a.map;for(b in c)c.hasOwnProperty(b)&&(d[c[b]]=b)}(a.ExifMap.prototype),a.ExifMap.prototype.getAll=function(){var a,b,c={};for(a in this)this.hasOwnProperty(a)&&(b=this.tags[a],b&&(c[b]=this.getText(b)));return c}});
|
@@ -1,5 +1,5 @@
|
|
1
1
|
/*
|
2
|
-
* JavaScript Templates 2.1
|
2
|
+
* JavaScript Templates 2.4.1
|
3
3
|
* https://github.com/blueimp/JavaScript-Templates
|
4
4
|
*
|
5
5
|
* Copyright 2011, Sebastian Tschan
|
@@ -12,7 +12,7 @@
|
|
12
12
|
* http://ejohn.org/blog/javascript-micro-templating/
|
13
13
|
*/
|
14
14
|
|
15
|
-
/*jslint evil: true, regexp: true */
|
15
|
+
/*jslint evil: true, regexp: true, unparam: true */
|
16
16
|
/*global document, define */
|
17
17
|
|
18
18
|
(function ($) {
|
@@ -34,21 +34,21 @@
|
|
34
34
|
tmpl.load = function (id) {
|
35
35
|
return document.getElementById(id).innerHTML;
|
36
36
|
};
|
37
|
-
tmpl.regexp = /([\s'\\])(?![
|
37
|
+
tmpl.regexp = /([\s'\\])(?!(?:[^{]|\{(?!%))*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g;
|
38
38
|
tmpl.func = function (s, p1, p2, p3, p4, p5) {
|
39
|
-
if (p1) { // whitespace, quote and backspace in
|
39
|
+
if (p1) { // whitespace, quote and backspace in HTML context
|
40
40
|
return {
|
41
41
|
"\n": "\\n",
|
42
42
|
"\r": "\\r",
|
43
43
|
"\t": "\\t",
|
44
44
|
" " : " "
|
45
|
-
}[
|
45
|
+
}[p1] || "\\" + p1;
|
46
46
|
}
|
47
47
|
if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%}
|
48
48
|
if (p2 === "=") {
|
49
49
|
return "'+_e(" + p3 + ")+'";
|
50
50
|
}
|
51
|
-
return "'+(" + p3 + "
|
51
|
+
return "'+(" + p3 + "==null?'':" + p3 + ")+'";
|
52
52
|
}
|
53
53
|
if (p4) { // evaluation start tag: {%
|
54
54
|
return "';";
|
@@ -66,7 +66,8 @@
|
|
66
66
|
"'" : "'"
|
67
67
|
};
|
68
68
|
tmpl.encode = function (s) {
|
69
|
-
|
69
|
+
/*jshint eqnull:true */
|
70
|
+
return (s == null ? "" : "" + s).replace(
|
70
71
|
tmpl.encReg,
|
71
72
|
function (c) {
|
72
73
|
return tmpl.encMap[c] || "";
|
@@ -74,7 +75,7 @@
|
|
74
75
|
);
|
75
76
|
};
|
76
77
|
tmpl.arg = "o";
|
77
|
-
tmpl.helper = ",print=function(s,e){_s+=e
|
78
|
+
tmpl.helper = ",print=function(s,e){_s+=e?(s==null?'':s):_e(s);}" +
|
78
79
|
",include=function(s,d){_s+=tmpl(s,d);}";
|
79
80
|
if (typeof define === "function" && define.amd) {
|
80
81
|
define(function () {
|
@@ -0,0 +1,22 @@
|
|
1
|
+
@charset "UTF-8";
|
2
|
+
/*
|
3
|
+
* jQuery File Upload Plugin NoScript CSS 1.2.0
|
4
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
5
|
+
*
|
6
|
+
* Copyright 2013, Sebastian Tschan
|
7
|
+
* https://blueimp.net
|
8
|
+
*
|
9
|
+
* Licensed under the MIT license:
|
10
|
+
* http://www.opensource.org/licenses/MIT
|
11
|
+
*/
|
12
|
+
|
13
|
+
.fileinput-button input {
|
14
|
+
position: static;
|
15
|
+
opacity: 1;
|
16
|
+
filter: none;
|
17
|
+
font-size: inherit;
|
18
|
+
direction: inherit;
|
19
|
+
}
|
20
|
+
.fileinput-button span {
|
21
|
+
display: none;
|
22
|
+
}
|