card-mod-script 0.13.3 → 0.14.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/script/decko/components.js.coffee +3 -0
- data/assets/script/decko/decko.js.coffee +0 -15
- data/assets/script/decko/editor.js.coffee +3 -1
- data/assets/script/decko/filter.js.coffee +13 -6
- data/assets/script/decko/mod.js.coffee +2 -8
- data/assets/script/{script_pointer_config.js.coffee → decko/pointer_config.js.coffee} +1 -2
- data/assets/script/{script_pointer_list_editor.js.coffee → decko/pointer_list_editor.js.coffee} +0 -0
- data/assets/script/decko/slot.js.coffee +2 -2
- data/assets/script/decko/slot_ready.js.coffee +1 -0
- data/assets/script/decko/slotter.js.coffee +23 -31
- data/assets/script/decko/type_editor.js.coffee +21 -0
- data/assets/script/decko/upload.js.coffee +12 -5
- data/assets/script/manifest.yml +15 -2
- data/set/abstract/00_script.rb +30 -31
- data/set/abstract/01_asset_script.rb +0 -16
- data/set/abstract/{script_asset_list.rb → script_group.rb} +12 -13
- data/set/all/head_javascript.rb +4 -5
- data/set/right/script.rb +1 -14
- data/set/type/local_script_folder_group.rb +2 -2
- data/set/type/local_script_manifest_group.rb +1 -1
- data/set/type_plus_right/mod/script.rb +56 -0
- data/set/type_plus_right/set/script.rb +7 -0
- data/vendor/jquery_file_upload/LICENSE.txt +11 -12
- data/vendor/jquery_file_upload/README.md +189 -72
- data/vendor/jquery_file_upload/SECURITY.md +227 -0
- data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
- data/vendor/jquery_file_upload/cors/postmessage.html +68 -58
- data/vendor/jquery_file_upload/cors/result.html +12 -10
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +24 -13
- data/vendor/jquery_file_upload/css/jquery.fileupload.css +3 -4
- data/vendor/jquery_file_upload/docker-compose.yml +55 -0
- data/vendor/jquery_file_upload/index.html +332 -230
- data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +109 -109
- data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +81 -73
- data/vendor/jquery_file_upload/js/demo.js +75 -0
- data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +82 -94
- data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +321 -300
- data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +138 -146
- data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +737 -692
- data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +91 -97
- data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +82 -94
- data/vendor/jquery_file_upload/js/jquery.fileupload.js +1569 -1451
- data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +208 -205
- data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +397 -340
- data/vendor/jquery_file_upload/package-lock.json +6853 -0
- data/vendor/jquery_file_upload/package.json +71 -10
- data/vendor/jquery_file_upload/server/gae-python/app.yaml +11 -10
- data/vendor/jquery_file_upload/server/php/Dockerfile +23 -17
- data/vendor/jquery_file_upload/server/php/UploadHandler.php +206 -137
- data/vendor/jquery_file_upload/server/php/php.ini +5 -0
- data/vendor/jquery_file_upload/test/index.html +36 -159
- data/vendor/jquery_file_upload/test/unit.js +989 -0
- data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
- data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
- data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
- data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
- data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
- data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
- data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
- data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
- data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
- data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
- data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
- data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
- metadata +34 -52
- data/file/mod_script_script_decko_machine_output/file.js +0 -2685
- data/file/mod_script_script_jquery_machine_output/file.js +0 -12924
- data/lib/javascript/script_html5shiv_printshiv.js +0 -1
- data/set/self/script_html5shiv_printshiv.rb +0 -11
- data/set/self/script_mods.rb +0 -1
- data/set/type/mod_script_assets.rb +0 -21
- data/vendor/jquery_file_upload/CONTRIBUTING.md +0 -15
- data/vendor/jquery_file_upload/angularjs.html +0 -211
- data/vendor/jquery_file_upload/basic-plus.html +0 -226
- data/vendor/jquery_file_upload/basic.html +0 -136
- data/vendor/jquery_file_upload/bower-version-update.js +0 -16
- data/vendor/jquery_file_upload/bower.json +0 -64
- data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +0 -21
- data/vendor/jquery_file_upload/css/jquery-ui-demo.css +0 -67
- data/vendor/jquery_file_upload/css/style.css +0 -15
- data/vendor/jquery_file_upload/jquery-ui.html +0 -252
- data/vendor/jquery_file_upload/js/app.js +0 -101
- data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +0 -437
- data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +0 -161
- data/vendor/jquery_file_upload/js/main.js +0 -75
- data/vendor/jquery_file_upload/server/gae-go/app/main.go +0 -361
- data/vendor/jquery_file_upload/server/gae-go/app.yaml +0 -12
- data/vendor/jquery_file_upload/server/gae-go/static/favicon.ico +0 -0
- data/vendor/jquery_file_upload/server/gae-go/static/robots.txt +0 -2
- data/vendor/jquery_file_upload/server/php/docker-compose.yml +0 -9
- data/vendor/jquery_file_upload/test/test.js +0 -1292
@@ -9,318 +9,339 @@
|
|
9
9
|
* https://opensource.org/licenses/MIT
|
10
10
|
*/
|
11
11
|
|
12
|
-
/*
|
13
|
-
/* global define, require, window, Blob */
|
12
|
+
/* global define, require */
|
14
13
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
// Browser globals:
|
41
|
-
factory(
|
42
|
-
window.jQuery,
|
43
|
-
window.loadImage
|
44
|
-
);
|
45
|
-
}
|
46
|
-
}(function ($, loadImage) {
|
47
|
-
'use strict';
|
48
|
-
|
49
|
-
// Prepend to the default processQueue:
|
50
|
-
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
51
|
-
{
|
52
|
-
action: 'loadImageMetaData',
|
53
|
-
disableImageHead: '@',
|
54
|
-
disableExif: '@',
|
55
|
-
disableExifThumbnail: '@',
|
56
|
-
disableExifSub: '@',
|
57
|
-
disableExifGps: '@',
|
58
|
-
disabled: '@disableImageMetaDataLoad'
|
59
|
-
},
|
60
|
-
{
|
61
|
-
action: 'loadImage',
|
62
|
-
// Use the action as prefix for the "@" options:
|
63
|
-
prefix: true,
|
64
|
-
fileTypes: '@',
|
65
|
-
maxFileSize: '@',
|
66
|
-
noRevoke: '@',
|
67
|
-
disabled: '@disableImageLoad'
|
68
|
-
},
|
69
|
-
{
|
70
|
-
action: 'resizeImage',
|
71
|
-
// Use "image" as prefix for the "@" options:
|
72
|
-
prefix: 'image',
|
73
|
-
maxWidth: '@',
|
74
|
-
maxHeight: '@',
|
75
|
-
minWidth: '@',
|
76
|
-
minHeight: '@',
|
77
|
-
crop: '@',
|
78
|
-
orientation: '@',
|
79
|
-
forceResize: '@',
|
80
|
-
disabled: '@disableImageResize'
|
81
|
-
},
|
82
|
-
{
|
83
|
-
action: 'saveImage',
|
84
|
-
quality: '@imageQuality',
|
85
|
-
type: '@imageType',
|
86
|
-
disabled: '@disableImageResize'
|
87
|
-
},
|
88
|
-
{
|
89
|
-
action: 'saveImageMetaData',
|
90
|
-
disabled: '@disableImageMetaDataSave'
|
91
|
-
},
|
92
|
-
{
|
93
|
-
action: 'resizeImage',
|
94
|
-
// Use "preview" as prefix for the "@" options:
|
95
|
-
prefix: 'preview',
|
96
|
-
maxWidth: '@',
|
97
|
-
maxHeight: '@',
|
98
|
-
minWidth: '@',
|
99
|
-
minHeight: '@',
|
100
|
-
crop: '@',
|
101
|
-
orientation: '@',
|
102
|
-
thumbnail: '@',
|
103
|
-
canvas: '@',
|
104
|
-
disabled: '@disableImagePreview'
|
105
|
-
},
|
106
|
-
{
|
107
|
-
action: 'setImage',
|
108
|
-
name: '@imagePreviewName',
|
109
|
-
disabled: '@disableImagePreview'
|
110
|
-
},
|
111
|
-
{
|
112
|
-
action: 'deleteImageReferences',
|
113
|
-
disabled: '@disableImageReferencesDeletion'
|
114
|
-
}
|
14
|
+
(function (factory) {
|
15
|
+
'use strict';
|
16
|
+
if (typeof define === 'function' && define.amd) {
|
17
|
+
// Register as an anonymous AMD module:
|
18
|
+
define([
|
19
|
+
'jquery',
|
20
|
+
'load-image',
|
21
|
+
'load-image-meta',
|
22
|
+
'load-image-scale',
|
23
|
+
'load-image-exif',
|
24
|
+
'load-image-orientation',
|
25
|
+
'canvas-to-blob',
|
26
|
+
'./jquery.fileupload-process'
|
27
|
+
], factory);
|
28
|
+
} else if (typeof exports === 'object') {
|
29
|
+
// Node/CommonJS:
|
30
|
+
factory(
|
31
|
+
require('jquery'),
|
32
|
+
require('blueimp-load-image/js/load-image'),
|
33
|
+
require('blueimp-load-image/js/load-image-meta'),
|
34
|
+
require('blueimp-load-image/js/load-image-scale'),
|
35
|
+
require('blueimp-load-image/js/load-image-exif'),
|
36
|
+
require('blueimp-load-image/js/load-image-orientation'),
|
37
|
+
require('blueimp-canvas-to-blob'),
|
38
|
+
require('./jquery.fileupload-process')
|
115
39
|
);
|
40
|
+
} else {
|
41
|
+
// Browser globals:
|
42
|
+
factory(window.jQuery, window.loadImage);
|
43
|
+
}
|
44
|
+
})(function ($, loadImage) {
|
45
|
+
'use strict';
|
116
46
|
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
if (options.disabled || !(data.canvas || data.img)) {
|
192
|
-
return data;
|
193
|
-
}
|
194
|
-
options = $.extend({canvas: true}, options);
|
195
|
-
var that = this,
|
196
|
-
dfd = $.Deferred(),
|
197
|
-
img = (options.canvas && data.canvas) || data.img,
|
198
|
-
resolve = function (newImg) {
|
199
|
-
if (newImg && (newImg.width !== img.width ||
|
200
|
-
newImg.height !== img.height ||
|
201
|
-
options.forceResize)) {
|
202
|
-
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
|
203
|
-
}
|
204
|
-
data.preview = newImg;
|
205
|
-
dfd.resolveWith(that, [data]);
|
206
|
-
},
|
207
|
-
thumbnail;
|
208
|
-
if (data.exif) {
|
209
|
-
if (options.orientation === true) {
|
210
|
-
options.orientation = data.exif.get('Orientation');
|
211
|
-
}
|
212
|
-
if (options.thumbnail) {
|
213
|
-
thumbnail = data.exif.get('Thumbnail');
|
214
|
-
if (thumbnail) {
|
215
|
-
loadImage(thumbnail, resolve, options);
|
216
|
-
return dfd.promise();
|
217
|
-
}
|
218
|
-
}
|
219
|
-
// Prevent orienting the same image twice:
|
220
|
-
if (data.orientation) {
|
221
|
-
delete options.orientation;
|
222
|
-
} else {
|
223
|
-
data.orientation = options.orientation;
|
224
|
-
}
|
225
|
-
}
|
226
|
-
if (img) {
|
227
|
-
resolve(loadImage.scale(img, options));
|
228
|
-
return dfd.promise();
|
229
|
-
}
|
230
|
-
return data;
|
231
|
-
},
|
47
|
+
// Prepend to the default processQueue:
|
48
|
+
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
49
|
+
{
|
50
|
+
action: 'loadImageMetaData',
|
51
|
+
maxMetaDataSize: '@',
|
52
|
+
disableImageHead: '@',
|
53
|
+
disableMetaDataParsers: '@',
|
54
|
+
disableExif: '@',
|
55
|
+
disableExifOffsets: '@',
|
56
|
+
includeExifTags: '@',
|
57
|
+
excludeExifTags: '@',
|
58
|
+
disableIptc: '@',
|
59
|
+
disableIptcOffsets: '@',
|
60
|
+
includeIptcTags: '@',
|
61
|
+
excludeIptcTags: '@',
|
62
|
+
disabled: '@disableImageMetaDataLoad'
|
63
|
+
},
|
64
|
+
{
|
65
|
+
action: 'loadImage',
|
66
|
+
// Use the action as prefix for the "@" options:
|
67
|
+
prefix: true,
|
68
|
+
fileTypes: '@',
|
69
|
+
maxFileSize: '@',
|
70
|
+
noRevoke: '@',
|
71
|
+
disabled: '@disableImageLoad'
|
72
|
+
},
|
73
|
+
{
|
74
|
+
action: 'resizeImage',
|
75
|
+
// Use "image" as prefix for the "@" options:
|
76
|
+
prefix: 'image',
|
77
|
+
maxWidth: '@',
|
78
|
+
maxHeight: '@',
|
79
|
+
minWidth: '@',
|
80
|
+
minHeight: '@',
|
81
|
+
crop: '@',
|
82
|
+
orientation: '@',
|
83
|
+
forceResize: '@',
|
84
|
+
disabled: '@disableImageResize',
|
85
|
+
imageSmoothingQuality: '@imageSmoothingQuality'
|
86
|
+
},
|
87
|
+
{
|
88
|
+
action: 'saveImage',
|
89
|
+
quality: '@imageQuality',
|
90
|
+
type: '@imageType',
|
91
|
+
disabled: '@disableImageResize'
|
92
|
+
},
|
93
|
+
{
|
94
|
+
action: 'saveImageMetaData',
|
95
|
+
disabled: '@disableImageMetaDataSave'
|
96
|
+
},
|
97
|
+
{
|
98
|
+
action: 'resizeImage',
|
99
|
+
// Use "preview" as prefix for the "@" options:
|
100
|
+
prefix: 'preview',
|
101
|
+
maxWidth: '@',
|
102
|
+
maxHeight: '@',
|
103
|
+
minWidth: '@',
|
104
|
+
minHeight: '@',
|
105
|
+
crop: '@',
|
106
|
+
orientation: '@',
|
107
|
+
thumbnail: '@',
|
108
|
+
canvas: '@',
|
109
|
+
disabled: '@disableImagePreview'
|
110
|
+
},
|
111
|
+
{
|
112
|
+
action: 'setImage',
|
113
|
+
name: '@imagePreviewName',
|
114
|
+
disabled: '@disableImagePreview'
|
115
|
+
},
|
116
|
+
{
|
117
|
+
action: 'deleteImageReferences',
|
118
|
+
disabled: '@disableImageReferencesDeletion'
|
119
|
+
}
|
120
|
+
);
|
232
121
|
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
266
|
-
|
267
|
-
} else {
|
268
|
-
return data;
|
269
|
-
}
|
270
|
-
return dfd.promise();
|
271
|
-
},
|
122
|
+
// The File Upload Resize plugin extends the fileupload widget
|
123
|
+
// with image resize functionality:
|
124
|
+
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
125
|
+
options: {
|
126
|
+
// The regular expression for the types of images to load:
|
127
|
+
// matched against the file type:
|
128
|
+
loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/,
|
129
|
+
// The maximum file size of images to load:
|
130
|
+
loadImageMaxFileSize: 10000000, // 10MB
|
131
|
+
// The maximum width of resized images:
|
132
|
+
imageMaxWidth: 1920,
|
133
|
+
// The maximum height of resized images:
|
134
|
+
imageMaxHeight: 1080,
|
135
|
+
// Defines the image orientation (1-8) or takes the orientation
|
136
|
+
// value from Exif data if set to true:
|
137
|
+
imageOrientation: true,
|
138
|
+
// Define if resized images should be cropped or only scaled:
|
139
|
+
imageCrop: false,
|
140
|
+
// Disable the resize image functionality by default:
|
141
|
+
disableImageResize: true,
|
142
|
+
// The maximum width of the preview images:
|
143
|
+
previewMaxWidth: 80,
|
144
|
+
// The maximum height of the preview images:
|
145
|
+
previewMaxHeight: 80,
|
146
|
+
// Defines the preview orientation (1-8) or takes the orientation
|
147
|
+
// value from Exif data if set to true:
|
148
|
+
previewOrientation: true,
|
149
|
+
// Create the preview using the Exif data thumbnail:
|
150
|
+
previewThumbnail: true,
|
151
|
+
// Define if preview images should be cropped or only scaled:
|
152
|
+
previewCrop: false,
|
153
|
+
// Define if preview images should be resized as canvas elements:
|
154
|
+
previewCanvas: true
|
155
|
+
},
|
272
156
|
|
273
|
-
|
274
|
-
|
275
|
-
|
276
|
-
|
277
|
-
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
157
|
+
processActions: {
|
158
|
+
// Loads the image given via data.files and data.index
|
159
|
+
// as img element, if the browser supports the File API.
|
160
|
+
// Accepts the options fileTypes (regular expression)
|
161
|
+
// and maxFileSize (integer) to limit the files to load:
|
162
|
+
loadImage: function (data, options) {
|
163
|
+
if (options.disabled) {
|
164
|
+
return data;
|
165
|
+
}
|
166
|
+
var that = this,
|
167
|
+
file = data.files[data.index],
|
168
|
+
// eslint-disable-next-line new-cap
|
169
|
+
dfd = $.Deferred();
|
170
|
+
if (
|
171
|
+
($.type(options.maxFileSize) === 'number' &&
|
172
|
+
file.size > options.maxFileSize) ||
|
173
|
+
(options.fileTypes && !options.fileTypes.test(file.type)) ||
|
174
|
+
!loadImage(
|
175
|
+
file,
|
176
|
+
function (img) {
|
177
|
+
if (img.src) {
|
178
|
+
data.img = img;
|
179
|
+
}
|
180
|
+
dfd.resolveWith(that, [data]);
|
284
181
|
},
|
182
|
+
options
|
183
|
+
)
|
184
|
+
) {
|
185
|
+
return data;
|
186
|
+
}
|
187
|
+
return dfd.promise();
|
188
|
+
},
|
285
189
|
|
286
|
-
|
287
|
-
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
|
294
|
-
|
295
|
-
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
|
300
|
-
|
301
|
-
|
190
|
+
// Resizes the image given as data.canvas or data.img
|
191
|
+
// and updates data.canvas or data.img with the resized image.
|
192
|
+
// Also stores the resized image as preview property.
|
193
|
+
// Accepts the options maxWidth, maxHeight, minWidth,
|
194
|
+
// minHeight, canvas and crop:
|
195
|
+
resizeImage: function (data, options) {
|
196
|
+
if (options.disabled || !(data.canvas || data.img)) {
|
197
|
+
return data;
|
198
|
+
}
|
199
|
+
// eslint-disable-next-line no-param-reassign
|
200
|
+
options = $.extend({ canvas: true }, options);
|
201
|
+
var that = this,
|
202
|
+
// eslint-disable-next-line new-cap
|
203
|
+
dfd = $.Deferred(),
|
204
|
+
img = (options.canvas && data.canvas) || data.img,
|
205
|
+
resolve = function (newImg) {
|
206
|
+
if (
|
207
|
+
newImg &&
|
208
|
+
(newImg.width !== img.width ||
|
209
|
+
newImg.height !== img.height ||
|
210
|
+
options.forceResize)
|
211
|
+
) {
|
212
|
+
data[newImg.getContext ? 'canvas' : 'img'] = newImg;
|
213
|
+
}
|
214
|
+
data.preview = newImg;
|
215
|
+
dfd.resolveWith(that, [data]);
|
216
|
+
},
|
217
|
+
thumbnail,
|
218
|
+
thumbnailBlob;
|
219
|
+
if (data.exif && options.thumbnail) {
|
220
|
+
thumbnail = data.exif.get('Thumbnail');
|
221
|
+
thumbnailBlob = thumbnail && thumbnail.get('Blob');
|
222
|
+
if (thumbnailBlob) {
|
223
|
+
options.orientation = data.exif.get('Orientation');
|
224
|
+
loadImage(thumbnailBlob, resolve, options);
|
225
|
+
return dfd.promise();
|
226
|
+
}
|
227
|
+
}
|
228
|
+
if (data.orientation) {
|
229
|
+
// Prevent orienting the same image twice:
|
230
|
+
delete options.orientation;
|
231
|
+
} else {
|
232
|
+
data.orientation = options.orientation || loadImage.orientation;
|
233
|
+
}
|
234
|
+
if (img) {
|
235
|
+
resolve(loadImage.scale(img, options, data));
|
236
|
+
return dfd.promise();
|
237
|
+
}
|
238
|
+
return data;
|
239
|
+
},
|
302
240
|
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
|
241
|
+
// Saves the processed image given as data.canvas
|
242
|
+
// inplace at data.index of data.files:
|
243
|
+
saveImage: function (data, options) {
|
244
|
+
if (!data.canvas || options.disabled) {
|
245
|
+
return data;
|
246
|
+
}
|
247
|
+
var that = this,
|
248
|
+
file = data.files[data.index],
|
249
|
+
// eslint-disable-next-line new-cap
|
250
|
+
dfd = $.Deferred();
|
251
|
+
if (data.canvas.toBlob) {
|
252
|
+
data.canvas.toBlob(
|
253
|
+
function (blob) {
|
254
|
+
if (!blob.name) {
|
255
|
+
if (file.type === blob.type) {
|
256
|
+
blob.name = file.name;
|
257
|
+
} else if (file.name) {
|
258
|
+
blob.name = file.name.replace(
|
259
|
+
/\.\w+$/,
|
260
|
+
'.' + blob.type.substr(6)
|
261
|
+
);
|
308
262
|
}
|
309
|
-
|
263
|
+
}
|
264
|
+
// Don't restore invalid meta data:
|
265
|
+
if (file.type !== blob.type) {
|
266
|
+
delete data.imageHead;
|
267
|
+
}
|
268
|
+
// Store the created blob at the position
|
269
|
+
// of the original file in the files list:
|
270
|
+
data.files[data.index] = blob;
|
271
|
+
dfd.resolveWith(that, [data]);
|
310
272
|
},
|
273
|
+
options.type || file.type,
|
274
|
+
options.quality
|
275
|
+
);
|
276
|
+
} else {
|
277
|
+
return data;
|
278
|
+
}
|
279
|
+
return dfd.promise();
|
280
|
+
},
|
311
281
|
|
312
|
-
|
313
|
-
|
314
|
-
|
315
|
-
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
|
320
|
-
|
282
|
+
loadImageMetaData: function (data, options) {
|
283
|
+
if (options.disabled) {
|
284
|
+
return data;
|
285
|
+
}
|
286
|
+
var that = this,
|
287
|
+
// eslint-disable-next-line new-cap
|
288
|
+
dfd = $.Deferred();
|
289
|
+
loadImage.parseMetaData(
|
290
|
+
data.files[data.index],
|
291
|
+
function (result) {
|
292
|
+
$.extend(data, result);
|
293
|
+
dfd.resolveWith(that, [data]);
|
294
|
+
},
|
295
|
+
options
|
296
|
+
);
|
297
|
+
return dfd.promise();
|
298
|
+
},
|
321
299
|
|
300
|
+
saveImageMetaData: function (data, options) {
|
301
|
+
if (
|
302
|
+
!(
|
303
|
+
data.imageHead &&
|
304
|
+
data.canvas &&
|
305
|
+
data.canvas.toBlob &&
|
306
|
+
!options.disabled
|
307
|
+
)
|
308
|
+
) {
|
309
|
+
return data;
|
310
|
+
}
|
311
|
+
var that = this,
|
312
|
+
file = data.files[data.index],
|
313
|
+
// eslint-disable-next-line new-cap
|
314
|
+
dfd = $.Deferred();
|
315
|
+
if (data.orientation === true && data.exifOffsets) {
|
316
|
+
// Reset Exif Orientation data:
|
317
|
+
loadImage.writeExifData(data.imageHead, data, 'Orientation', 1);
|
322
318
|
}
|
319
|
+
loadImage.replaceHead(file, data.imageHead, function (blob) {
|
320
|
+
blob.name = file.name;
|
321
|
+
data.files[data.index] = blob;
|
322
|
+
dfd.resolveWith(that, [data]);
|
323
|
+
});
|
324
|
+
return dfd.promise();
|
325
|
+
},
|
323
326
|
|
324
|
-
|
327
|
+
// Sets the resized version of the image as a property of the
|
328
|
+
// file object, must be called after "saveImage":
|
329
|
+
setImage: function (data, options) {
|
330
|
+
if (data.preview && !options.disabled) {
|
331
|
+
data.files[data.index][options.name || 'preview'] = data.preview;
|
332
|
+
}
|
333
|
+
return data;
|
334
|
+
},
|
325
335
|
|
326
|
-
|
336
|
+
deleteImageReferences: function (data, options) {
|
337
|
+
if (!options.disabled) {
|
338
|
+
delete data.img;
|
339
|
+
delete data.canvas;
|
340
|
+
delete data.preview;
|
341
|
+
delete data.imageHead;
|
342
|
+
}
|
343
|
+
return data;
|
344
|
+
}
|
345
|
+
}
|
346
|
+
});
|
347
|
+
});
|