card-mod-script 0.14.2 → 0.15.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/data/real.yml +50 -0
- data/lib/ansi2html.rb +69 -0
- data/lib/card/mod/script.rb +1 -0
- data/set/abstract/00_script.rb +4 -4
- data/set/abstract/02_coffee_script.rb +9 -1
- data/set/all/head_javascript.rb +13 -22
- data/set/right/script.rb +1 -1
- data/set/type/coffee_script.rb +6 -0
- data/set/type/java_script.rb +6 -0
- data/set/type/local_script_folder_group.rb +2 -0
- data/set/type/local_script_manifest_group.rb +2 -0
- data/set/type_plus_right/mod/script.rb +1 -5
- data/set/type_plus_right/set/script.rb +3 -1
- metadata +13 -119
- data/assets/script/decko/autosave.js.coffee +0 -30
- data/assets/script/decko/bridge.js.coffee +0 -31
- data/assets/script/decko/card_menu.js.coffee +0 -26
- data/assets/script/decko/components.js.coffee +0 -49
- data/assets/script/decko/decko.js.coffee +0 -82
- data/assets/script/decko/doubleclick.js.coffee +0 -30
- data/assets/script/decko/editor.js.coffee +0 -57
- data/assets/script/decko/filter.js.coffee +0 -183
- data/assets/script/decko/filter_items.js.coffee +0 -128
- data/assets/script/decko/filter_links.js.coffee +0 -81
- data/assets/script/decko/follow.js.coffee +0 -22
- data/assets/script/decko/layout.js.coffee +0 -76
- data/assets/script/decko/link_editor.js.coffee +0 -61
- data/assets/script/decko/mod.js.coffee +0 -79
- data/assets/script/decko/modal.js.coffee +0 -113
- data/assets/script/decko/name_editor.js.coffee +0 -40
- data/assets/script/decko/navbox.js.coffee +0 -74
- data/assets/script/decko/nest_editor.js.coffee +0 -166
- data/assets/script/decko/nest_editor_name.js.coffee +0 -102
- data/assets/script/decko/nest_editor_options.js.coffee +0 -93
- data/assets/script/decko/nest_editor_rules.js.coffee +0 -3
- data/assets/script/decko/overlay.js.coffee +0 -54
- data/assets/script/decko/pointer_config.js.coffee +0 -79
- data/assets/script/decko/pointer_list_editor.js.coffee +0 -67
- data/assets/script/decko/recaptcha.js.coffee +0 -19
- data/assets/script/decko/selectable_filtered_content.js.coffee +0 -12
- data/assets/script/decko/slot.js.coffee +0 -182
- data/assets/script/decko/slot_ready.js.coffee +0 -12
- data/assets/script/decko/slotter.js.coffee +0 -268
- data/assets/script/decko/type_editor.js.coffee +0 -21
- data/assets/script/decko/upload.js.coffee +0 -64
- data/assets/script/jquery-ui.min.js +0 -13
- data/assets/script/jquery.autosize.js +0 -274
- data/assets/script/manifest.yml +0 -57
- data/db/migrate_core_cards/20200804112348_add_mod_script_assets_type.rb +0 -30
- data/vendor/jquery_file_upload/LICENSE.txt +0 -20
- data/vendor/jquery_file_upload/README.md +0 -224
- data/vendor/jquery_file_upload/SECURITY.md +0 -227
- data/vendor/jquery_file_upload/VULNERABILITIES.md +0 -118
- data/vendor/jquery_file_upload/cors/postmessage.html +0 -85
- data/vendor/jquery_file_upload/cors/result.html +0 -26
- data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +0 -22
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +0 -17
- data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +0 -68
- data/vendor/jquery_file_upload/css/jquery.fileupload.css +0 -36
- data/vendor/jquery_file_upload/docker-compose.yml +0 -55
- data/vendor/jquery_file_upload/img/loading.gif +0 -0
- data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
- data/vendor/jquery_file_upload/index.html +0 -357
- data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +0 -126
- data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +0 -97
- data/vendor/jquery_file_upload/js/demo.js +0 -75
- data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +0 -101
- data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +0 -347
- data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +0 -170
- data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +0 -759
- data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +0 -119
- data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +0 -101
- data/vendor/jquery_file_upload/js/jquery.fileupload.js +0 -1604
- data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +0 -227
- data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +0 -805
- data/vendor/jquery_file_upload/package-lock.json +0 -6853
- data/vendor/jquery_file_upload/package.json +0 -116
- data/vendor/jquery_file_upload/server/gae-python/app.yaml +0 -18
- data/vendor/jquery_file_upload/server/gae-python/main.py +0 -204
- data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
- data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +0 -2
- data/vendor/jquery_file_upload/server/php/Dockerfile +0 -44
- data/vendor/jquery_file_upload/server/php/UploadHandler.php +0 -1480
- data/vendor/jquery_file_upload/server/php/index.php +0 -15
- data/vendor/jquery_file_upload/server/php/php.ini +0 -5
- data/vendor/jquery_file_upload/test/index.html +0 -49
- data/vendor/jquery_file_upload/test/unit.js +0 -989
- data/vendor/jquery_file_upload/test/vendor/chai.js +0 -10854
- data/vendor/jquery_file_upload/test/vendor/mocha.css +0 -325
- data/vendor/jquery_file_upload/test/vendor/mocha.js +0 -18178
- data/vendor/jquery_file_upload/wdio/LICENSE.txt +0 -20
- 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 +0 -40
- data/vendor/jquery_file_upload/wdio/conf/firefox.js +0 -25
- data/vendor/jquery_file_upload/wdio/hooks/index.js +0 -36
- data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +0 -79
- data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +0 -25
- data/vendor/jquery_file_upload/wdio/wdio.conf.js +0 -4
- data/vendor/jquery_rails/CHANGELOG.md +0 -359
- data/vendor/jquery_rails/CONTRIBUTING.md +0 -132
- data/vendor/jquery_rails/Gemfile +0 -22
- data/vendor/jquery_rails/MIT-LICENSE +0 -21
- data/vendor/jquery_rails/README.md +0 -75
- data/vendor/jquery_rails/Rakefile +0 -59
- data/vendor/jquery_rails/VERSIONS.md +0 -62
- data/vendor/jquery_rails/jquery-rails.gemspec +0 -26
- data/vendor/jquery_rails/lib/jquery/assert_select.rb +0 -149
- data/vendor/jquery_rails/lib/jquery/rails/engine.rb +0 -6
- data/vendor/jquery_rails/lib/jquery/rails/version.rb +0 -9
- data/vendor/jquery_rails/lib/jquery/rails.rb +0 -8
- data/vendor/jquery_rails/lib/jquery-rails.rb +0 -1
- data/vendor/jquery_rails/test/assert_select_jquery_test.rb +0 -85
- data/vendor/jquery_rails/test/test_helper.rb +0 -6
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +0 -11008
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +0 -5
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +0 -1
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +0 -9814
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +0 -4
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +0 -1
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +0 -10364
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +0 -2
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +0 -1
- data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +0 -555
@@ -1,101 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery File Upload Audio Preview Plugin
|
3
|
-
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
-
*
|
5
|
-
* Copyright 2013, Sebastian Tschan
|
6
|
-
* https://blueimp.net
|
7
|
-
*
|
8
|
-
* Licensed under the MIT license:
|
9
|
-
* https://opensource.org/licenses/MIT
|
10
|
-
*/
|
11
|
-
|
12
|
-
/* global define, require */
|
13
|
-
|
14
|
-
(function (factory) {
|
15
|
-
'use strict';
|
16
|
-
if (typeof define === 'function' && define.amd) {
|
17
|
-
// Register as an anonymous AMD module:
|
18
|
-
define(['jquery', 'load-image', './jquery.fileupload-process'], factory);
|
19
|
-
} else if (typeof exports === 'object') {
|
20
|
-
// Node/CommonJS:
|
21
|
-
factory(
|
22
|
-
require('jquery'),
|
23
|
-
require('blueimp-load-image/js/load-image'),
|
24
|
-
require('./jquery.fileupload-process')
|
25
|
-
);
|
26
|
-
} else {
|
27
|
-
// Browser globals:
|
28
|
-
factory(window.jQuery, window.loadImage);
|
29
|
-
}
|
30
|
-
})(function ($, loadImage) {
|
31
|
-
'use strict';
|
32
|
-
|
33
|
-
// Prepend to the default processQueue:
|
34
|
-
$.blueimp.fileupload.prototype.options.processQueue.unshift(
|
35
|
-
{
|
36
|
-
action: 'loadAudio',
|
37
|
-
// Use the action as prefix for the "@" options:
|
38
|
-
prefix: true,
|
39
|
-
fileTypes: '@',
|
40
|
-
maxFileSize: '@',
|
41
|
-
disabled: '@disableAudioPreview'
|
42
|
-
},
|
43
|
-
{
|
44
|
-
action: 'setAudio',
|
45
|
-
name: '@audioPreviewName',
|
46
|
-
disabled: '@disableAudioPreview'
|
47
|
-
}
|
48
|
-
);
|
49
|
-
|
50
|
-
// The File Upload Audio Preview plugin extends the fileupload widget
|
51
|
-
// with audio preview functionality:
|
52
|
-
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
53
|
-
options: {
|
54
|
-
// The regular expression for the types of audio files to load,
|
55
|
-
// matched against the file type:
|
56
|
-
loadAudioFileTypes: /^audio\/.*$/
|
57
|
-
},
|
58
|
-
|
59
|
-
_audioElement: document.createElement('audio'),
|
60
|
-
|
61
|
-
processActions: {
|
62
|
-
// Loads the audio file given via data.files and data.index
|
63
|
-
// as audio element if the browser supports playing it.
|
64
|
-
// Accepts the options fileTypes (regular expression)
|
65
|
-
// and maxFileSize (integer) to limit the files to load:
|
66
|
-
loadAudio: function (data, options) {
|
67
|
-
if (options.disabled) {
|
68
|
-
return data;
|
69
|
-
}
|
70
|
-
var file = data.files[data.index],
|
71
|
-
url,
|
72
|
-
audio;
|
73
|
-
if (
|
74
|
-
this._audioElement.canPlayType &&
|
75
|
-
this._audioElement.canPlayType(file.type) &&
|
76
|
-
($.type(options.maxFileSize) !== 'number' ||
|
77
|
-
file.size <= options.maxFileSize) &&
|
78
|
-
(!options.fileTypes || options.fileTypes.test(file.type))
|
79
|
-
) {
|
80
|
-
url = loadImage.createObjectURL(file);
|
81
|
-
if (url) {
|
82
|
-
audio = this._audioElement.cloneNode(false);
|
83
|
-
audio.src = url;
|
84
|
-
audio.controls = true;
|
85
|
-
data.audio = audio;
|
86
|
-
return data;
|
87
|
-
}
|
88
|
-
}
|
89
|
-
return data;
|
90
|
-
},
|
91
|
-
|
92
|
-
// Sets the audio element as a property of the file object:
|
93
|
-
setAudio: function (data, options) {
|
94
|
-
if (data.audio && !options.disabled) {
|
95
|
-
data.files[data.index][options.name || 'preview'] = data.audio;
|
96
|
-
}
|
97
|
-
return data;
|
98
|
-
}
|
99
|
-
}
|
100
|
-
});
|
101
|
-
});
|
@@ -1,347 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery File Upload Image Preview & Resize Plugin
|
3
|
-
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
-
*
|
5
|
-
* Copyright 2013, Sebastian Tschan
|
6
|
-
* https://blueimp.net
|
7
|
-
*
|
8
|
-
* Licensed under the MIT license:
|
9
|
-
* https://opensource.org/licenses/MIT
|
10
|
-
*/
|
11
|
-
|
12
|
-
/* global define, require */
|
13
|
-
|
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')
|
39
|
-
);
|
40
|
-
} else {
|
41
|
-
// Browser globals:
|
42
|
-
factory(window.jQuery, window.loadImage);
|
43
|
-
}
|
44
|
-
})(function ($, loadImage) {
|
45
|
-
'use strict';
|
46
|
-
|
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
|
-
);
|
121
|
-
|
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
|
-
},
|
156
|
-
|
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]);
|
181
|
-
},
|
182
|
-
options
|
183
|
-
)
|
184
|
-
) {
|
185
|
-
return data;
|
186
|
-
}
|
187
|
-
return dfd.promise();
|
188
|
-
},
|
189
|
-
|
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
|
-
},
|
240
|
-
|
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
|
-
);
|
262
|
-
}
|
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]);
|
272
|
-
},
|
273
|
-
options.type || file.type,
|
274
|
-
options.quality
|
275
|
-
);
|
276
|
-
} else {
|
277
|
-
return data;
|
278
|
-
}
|
279
|
-
return dfd.promise();
|
280
|
-
},
|
281
|
-
|
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
|
-
},
|
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);
|
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
|
-
},
|
326
|
-
|
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
|
-
},
|
335
|
-
|
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
|
-
});
|
@@ -1,170 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery File Upload Processing Plugin
|
3
|
-
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
-
*
|
5
|
-
* Copyright 2012, Sebastian Tschan
|
6
|
-
* https://blueimp.net
|
7
|
-
*
|
8
|
-
* Licensed under the MIT license:
|
9
|
-
* https://opensource.org/licenses/MIT
|
10
|
-
*/
|
11
|
-
|
12
|
-
/* global define, require */
|
13
|
-
|
14
|
-
(function (factory) {
|
15
|
-
'use strict';
|
16
|
-
if (typeof define === 'function' && define.amd) {
|
17
|
-
// Register as an anonymous AMD module:
|
18
|
-
define(['jquery', './jquery.fileupload'], factory);
|
19
|
-
} else if (typeof exports === 'object') {
|
20
|
-
// Node/CommonJS:
|
21
|
-
factory(require('jquery'), require('./jquery.fileupload'));
|
22
|
-
} else {
|
23
|
-
// Browser globals:
|
24
|
-
factory(window.jQuery);
|
25
|
-
}
|
26
|
-
})(function ($) {
|
27
|
-
'use strict';
|
28
|
-
|
29
|
-
var originalAdd = $.blueimp.fileupload.prototype.options.add;
|
30
|
-
|
31
|
-
// The File Upload Processing plugin extends the fileupload widget
|
32
|
-
// with file processing functionality:
|
33
|
-
$.widget('blueimp.fileupload', $.blueimp.fileupload, {
|
34
|
-
options: {
|
35
|
-
// The list of processing actions:
|
36
|
-
processQueue: [
|
37
|
-
/*
|
38
|
-
{
|
39
|
-
action: 'log',
|
40
|
-
type: 'debug'
|
41
|
-
}
|
42
|
-
*/
|
43
|
-
],
|
44
|
-
add: function (e, data) {
|
45
|
-
var $this = $(this);
|
46
|
-
data.process(function () {
|
47
|
-
return $this.fileupload('process', data);
|
48
|
-
});
|
49
|
-
originalAdd.call(this, e, data);
|
50
|
-
}
|
51
|
-
},
|
52
|
-
|
53
|
-
processActions: {
|
54
|
-
/*
|
55
|
-
log: function (data, options) {
|
56
|
-
console[options.type](
|
57
|
-
'Processing "' + data.files[data.index].name + '"'
|
58
|
-
);
|
59
|
-
}
|
60
|
-
*/
|
61
|
-
},
|
62
|
-
|
63
|
-
_processFile: function (data, originalData) {
|
64
|
-
var that = this,
|
65
|
-
// eslint-disable-next-line new-cap
|
66
|
-
dfd = $.Deferred().resolveWith(that, [data]),
|
67
|
-
chain = dfd.promise();
|
68
|
-
this._trigger('process', null, data);
|
69
|
-
$.each(data.processQueue, function (i, settings) {
|
70
|
-
var func = function (data) {
|
71
|
-
if (originalData.errorThrown) {
|
72
|
-
// eslint-disable-next-line new-cap
|
73
|
-
return $.Deferred().rejectWith(that, [originalData]).promise();
|
74
|
-
}
|
75
|
-
return that.processActions[settings.action].call(
|
76
|
-
that,
|
77
|
-
data,
|
78
|
-
settings
|
79
|
-
);
|
80
|
-
};
|
81
|
-
chain = chain[that._promisePipe](func, settings.always && func);
|
82
|
-
});
|
83
|
-
chain
|
84
|
-
.done(function () {
|
85
|
-
that._trigger('processdone', null, data);
|
86
|
-
that._trigger('processalways', null, data);
|
87
|
-
})
|
88
|
-
.fail(function () {
|
89
|
-
that._trigger('processfail', null, data);
|
90
|
-
that._trigger('processalways', null, data);
|
91
|
-
});
|
92
|
-
return chain;
|
93
|
-
},
|
94
|
-
|
95
|
-
// Replaces the settings of each processQueue item that
|
96
|
-
// are strings starting with an "@", using the remaining
|
97
|
-
// substring as key for the option map,
|
98
|
-
// e.g. "@autoUpload" is replaced with options.autoUpload:
|
99
|
-
_transformProcessQueue: function (options) {
|
100
|
-
var processQueue = [];
|
101
|
-
$.each(options.processQueue, function () {
|
102
|
-
var settings = {},
|
103
|
-
action = this.action,
|
104
|
-
prefix = this.prefix === true ? action : this.prefix;
|
105
|
-
$.each(this, function (key, value) {
|
106
|
-
if ($.type(value) === 'string' && value.charAt(0) === '@') {
|
107
|
-
settings[key] =
|
108
|
-
options[
|
109
|
-
value.slice(1) ||
|
110
|
-
(prefix
|
111
|
-
? prefix + key.charAt(0).toUpperCase() + key.slice(1)
|
112
|
-
: key)
|
113
|
-
];
|
114
|
-
} else {
|
115
|
-
settings[key] = value;
|
116
|
-
}
|
117
|
-
});
|
118
|
-
processQueue.push(settings);
|
119
|
-
});
|
120
|
-
options.processQueue = processQueue;
|
121
|
-
},
|
122
|
-
|
123
|
-
// Returns the number of files currently in the processing queue:
|
124
|
-
processing: function () {
|
125
|
-
return this._processing;
|
126
|
-
},
|
127
|
-
|
128
|
-
// Processes the files given as files property of the data parameter,
|
129
|
-
// returns a Promise object that allows to bind callbacks:
|
130
|
-
process: function (data) {
|
131
|
-
var that = this,
|
132
|
-
options = $.extend({}, this.options, data);
|
133
|
-
if (options.processQueue && options.processQueue.length) {
|
134
|
-
this._transformProcessQueue(options);
|
135
|
-
if (this._processing === 0) {
|
136
|
-
this._trigger('processstart');
|
137
|
-
}
|
138
|
-
$.each(data.files, function (index) {
|
139
|
-
var opts = index ? $.extend({}, options) : options,
|
140
|
-
func = function () {
|
141
|
-
if (data.errorThrown) {
|
142
|
-
// eslint-disable-next-line new-cap
|
143
|
-
return $.Deferred().rejectWith(that, [data]).promise();
|
144
|
-
}
|
145
|
-
return that._processFile(opts, data);
|
146
|
-
};
|
147
|
-
opts.index = index;
|
148
|
-
that._processing += 1;
|
149
|
-
that._processingQueue = that._processingQueue[that._promisePipe](
|
150
|
-
func,
|
151
|
-
func
|
152
|
-
).always(function () {
|
153
|
-
that._processing -= 1;
|
154
|
-
if (that._processing === 0) {
|
155
|
-
that._trigger('processstop');
|
156
|
-
}
|
157
|
-
});
|
158
|
-
});
|
159
|
-
}
|
160
|
-
return this._processingQueue;
|
161
|
-
},
|
162
|
-
|
163
|
-
_create: function () {
|
164
|
-
this._super();
|
165
|
-
this._processing = 0;
|
166
|
-
// eslint-disable-next-line new-cap
|
167
|
-
this._processingQueue = $.Deferred().resolveWith(this).promise();
|
168
|
-
}
|
169
|
-
});
|
170
|
-
});
|