card-mod-script 0.11.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (126) hide show
  1. checksums.yaml +7 -0
  2. data/lib/javascript/decko/autosave.js.coffee +30 -0
  3. data/lib/javascript/decko/bridge.js.coffee +31 -0
  4. data/lib/javascript/decko/card_menu.js.coffee +26 -0
  5. data/lib/javascript/decko/components.js.coffee +51 -0
  6. data/lib/javascript/decko/decko.js.coffee +100 -0
  7. data/lib/javascript/decko/doubleclick.js.coffee +30 -0
  8. data/lib/javascript/decko/editor.js.coffee +55 -0
  9. data/lib/javascript/decko/filter.js.coffee +176 -0
  10. data/lib/javascript/decko/filter_items.js.coffee +128 -0
  11. data/lib/javascript/decko/filter_links.js.coffee +81 -0
  12. data/lib/javascript/decko/follow.js.coffee +22 -0
  13. data/lib/javascript/decko/layout.js.coffee +76 -0
  14. data/lib/javascript/decko/link_editor.js.coffee +61 -0
  15. data/lib/javascript/decko/mod.js.coffee +85 -0
  16. data/lib/javascript/decko/modal.js.coffee +110 -0
  17. data/lib/javascript/decko/name_editor.js.coffee +51 -0
  18. data/lib/javascript/decko/navbox.js.coffee +74 -0
  19. data/lib/javascript/decko/nest_editor.js.coffee +166 -0
  20. data/lib/javascript/decko/nest_editor_name.js.coffee +102 -0
  21. data/lib/javascript/decko/nest_editor_options.js.coffee +93 -0
  22. data/lib/javascript/decko/nest_editor_rules.js.coffee +3 -0
  23. data/lib/javascript/decko/overlay.js.coffee +57 -0
  24. data/lib/javascript/decko/recaptcha.js.coffee +19 -0
  25. data/lib/javascript/decko/selectable_filtered_content.js.coffee +12 -0
  26. data/lib/javascript/decko/slot.js.coffee +172 -0
  27. data/lib/javascript/decko/slot_ready.js.coffee +11 -0
  28. data/lib/javascript/decko/slotter.js.coffee +269 -0
  29. data/lib/javascript/decko/upload.js.coffee +57 -0
  30. data/lib/javascript/jquery-ui.js +10 -0
  31. data/lib/javascript/jquery.autosize.js +274 -0
  32. data/lib/javascript/jquery.iframe-transport.js +185 -0
  33. data/lib/javascript/script_html5shiv_printshiv.js +1 -0
  34. data/lib/javascript/script_pointer_config.js.coffee +80 -0
  35. data/lib/javascript/script_pointer_list_editor.js.coffee +67 -0
  36. data/lib/javascript/theme-textmate.js +130 -0
  37. data/set/abstract/script.rb +85 -0
  38. data/set/right/script.rb +19 -0
  39. data/set/self/01_script_libraries.rb +1 -0
  40. data/set/self/script.rb +1 -0
  41. data/set/self/script_decko.rb +12 -0
  42. data/set/self/script_editors.rb +1 -0
  43. data/set/self/script_html5shiv_printshiv.rb +11 -0
  44. data/set/self/script_jquery.rb +10 -0
  45. data/set/self/script_jquery_helper.rb +14 -0
  46. data/set/self/script_mods.rb +1 -0
  47. data/set/self/script_pointer_config.rb +9 -0
  48. data/set/type/coffee_script.rb +25 -0
  49. data/set/type/java_script.rb +9 -0
  50. data/vendor/jquery_file_upload/CONTRIBUTING.md +15 -0
  51. data/vendor/jquery_file_upload/LICENSE.txt +21 -0
  52. data/vendor/jquery_file_upload/README.md +107 -0
  53. data/vendor/jquery_file_upload/angularjs.html +211 -0
  54. data/vendor/jquery_file_upload/basic-plus.html +226 -0
  55. data/vendor/jquery_file_upload/basic.html +136 -0
  56. data/vendor/jquery_file_upload/bower-version-update.js +16 -0
  57. data/vendor/jquery_file_upload/bower.json +64 -0
  58. data/vendor/jquery_file_upload/cors/postmessage.html +75 -0
  59. data/vendor/jquery_file_upload/cors/result.html +24 -0
  60. data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +21 -0
  61. data/vendor/jquery_file_upload/css/jquery-ui-demo.css +67 -0
  62. data/vendor/jquery_file_upload/css/jquery.fileupload-noscript.css +22 -0
  63. data/vendor/jquery_file_upload/css/jquery.fileupload-ui-noscript.css +17 -0
  64. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +57 -0
  65. data/vendor/jquery_file_upload/css/jquery.fileupload.css +37 -0
  66. data/vendor/jquery_file_upload/css/style.css +15 -0
  67. data/vendor/jquery_file_upload/img/loading.gif +0 -0
  68. data/vendor/jquery_file_upload/img/progressbar.gif +0 -0
  69. data/vendor/jquery_file_upload/index.html +255 -0
  70. data/vendor/jquery_file_upload/jquery-ui.html +252 -0
  71. data/vendor/jquery_file_upload/js/app.js +101 -0
  72. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +126 -0
  73. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +89 -0
  74. data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +437 -0
  75. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +113 -0
  76. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +326 -0
  77. data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +161 -0
  78. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +178 -0
  79. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +714 -0
  80. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +125 -0
  81. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +113 -0
  82. data/vendor/jquery_file_upload/js/jquery.fileupload.js +1486 -0
  83. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +224 -0
  84. data/vendor/jquery_file_upload/js/main.js +75 -0
  85. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +748 -0
  86. data/vendor/jquery_file_upload/package.json +55 -0
  87. data/vendor/jquery_file_upload/server/gae-go/app.yaml +12 -0
  88. data/vendor/jquery_file_upload/server/gae-go/app/main.go +361 -0
  89. data/vendor/jquery_file_upload/server/gae-go/static/favicon.ico +0 -0
  90. data/vendor/jquery_file_upload/server/gae-go/static/robots.txt +2 -0
  91. data/vendor/jquery_file_upload/server/gae-python/app.yaml +17 -0
  92. data/vendor/jquery_file_upload/server/gae-python/main.py +204 -0
  93. data/vendor/jquery_file_upload/server/gae-python/static/favicon.ico +0 -0
  94. data/vendor/jquery_file_upload/server/gae-python/static/robots.txt +2 -0
  95. data/vendor/jquery_file_upload/server/php/Dockerfile +38 -0
  96. data/vendor/jquery_file_upload/server/php/UploadHandler.php +1411 -0
  97. data/vendor/jquery_file_upload/server/php/docker-compose.yml +9 -0
  98. data/vendor/jquery_file_upload/server/php/index.php +15 -0
  99. data/vendor/jquery_file_upload/test/index.html +172 -0
  100. data/vendor/jquery_file_upload/test/test.js +1292 -0
  101. data/vendor/jquery_rails/CHANGELOG.md +359 -0
  102. data/vendor/jquery_rails/CONTRIBUTING.md +132 -0
  103. data/vendor/jquery_rails/Gemfile +22 -0
  104. data/vendor/jquery_rails/MIT-LICENSE +21 -0
  105. data/vendor/jquery_rails/README.md +75 -0
  106. data/vendor/jquery_rails/Rakefile +59 -0
  107. data/vendor/jquery_rails/VERSIONS.md +62 -0
  108. data/vendor/jquery_rails/jquery-rails.gemspec +26 -0
  109. data/vendor/jquery_rails/lib/jquery-rails.rb +1 -0
  110. data/vendor/jquery_rails/lib/jquery/assert_select.rb +149 -0
  111. data/vendor/jquery_rails/lib/jquery/rails.rb +8 -0
  112. data/vendor/jquery_rails/lib/jquery/rails/engine.rb +6 -0
  113. data/vendor/jquery_rails/lib/jquery/rails/version.rb +9 -0
  114. data/vendor/jquery_rails/test/assert_select_jquery_test.rb +85 -0
  115. data/vendor/jquery_rails/test/test_helper.rb +6 -0
  116. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.js +11008 -0
  117. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.js +5 -0
  118. data/vendor/jquery_rails/vendor/assets/javascripts/jquery.min.map +1 -0
  119. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.js +9814 -0
  120. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.js +4 -0
  121. data/vendor/jquery_rails/vendor/assets/javascripts/jquery2.min.map +1 -0
  122. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.js +10364 -0
  123. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.js +2 -0
  124. data/vendor/jquery_rails/vendor/assets/javascripts/jquery3.min.map +1 -0
  125. data/vendor/jquery_rails/vendor/assets/javascripts/jquery_ujs.js +555 -0
  126. metadata +212 -0
@@ -0,0 +1,113 @@
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
+ /* jshint nomen:false */
13
+ /* global define, require, window, document */
14
+
15
+ ;(function (factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define([
20
+ 'jquery',
21
+ 'load-image',
22
+ './jquery.fileupload-process'
23
+ ], factory);
24
+ } else if (typeof exports === 'object') {
25
+ // Node/CommonJS:
26
+ factory(
27
+ require('jquery'),
28
+ require('blueimp-load-image/js/load-image'),
29
+ require('./jquery.fileupload-process')
30
+ );
31
+ } else {
32
+ // Browser globals:
33
+ factory(
34
+ window.jQuery,
35
+ window.loadImage
36
+ );
37
+ }
38
+ }(function ($, loadImage) {
39
+ 'use strict';
40
+
41
+ // Prepend to the default processQueue:
42
+ $.blueimp.fileupload.prototype.options.processQueue.unshift(
43
+ {
44
+ action: 'loadAudio',
45
+ // Use the action as prefix for the "@" options:
46
+ prefix: true,
47
+ fileTypes: '@',
48
+ maxFileSize: '@',
49
+ disabled: '@disableAudioPreview'
50
+ },
51
+ {
52
+ action: 'setAudio',
53
+ name: '@audioPreviewName',
54
+ disabled: '@disableAudioPreview'
55
+ }
56
+ );
57
+
58
+ // The File Upload Audio Preview plugin extends the fileupload widget
59
+ // with audio preview functionality:
60
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
61
+
62
+ options: {
63
+ // The regular expression for the types of audio files to load,
64
+ // matched against the file type:
65
+ loadAudioFileTypes: /^audio\/.*$/
66
+ },
67
+
68
+ _audioElement: document.createElement('audio'),
69
+
70
+ processActions: {
71
+
72
+ // Loads the audio file given via data.files and data.index
73
+ // as audio element if the browser supports playing it.
74
+ // Accepts the options fileTypes (regular expression)
75
+ // and maxFileSize (integer) to limit the files to load:
76
+ loadAudio: function (data, options) {
77
+ if (options.disabled) {
78
+ return data;
79
+ }
80
+ var file = data.files[data.index],
81
+ url,
82
+ audio;
83
+ if (this._audioElement.canPlayType &&
84
+ this._audioElement.canPlayType(file.type) &&
85
+ ($.type(options.maxFileSize) !== 'number' ||
86
+ file.size <= options.maxFileSize) &&
87
+ (!options.fileTypes ||
88
+ options.fileTypes.test(file.type))) {
89
+ url = loadImage.createObjectURL(file);
90
+ if (url) {
91
+ audio = this._audioElement.cloneNode(false);
92
+ audio.src = url;
93
+ audio.controls = true;
94
+ data.audio = audio;
95
+ return data;
96
+ }
97
+ }
98
+ return data;
99
+ },
100
+
101
+ // Sets the audio element as a property of the file object:
102
+ setAudio: function (data, options) {
103
+ if (data.audio && !options.disabled) {
104
+ data.files[data.index][options.name || 'preview'] = data.audio;
105
+ }
106
+ return data;
107
+ }
108
+
109
+ }
110
+
111
+ });
112
+
113
+ }));
@@ -0,0 +1,326 @@
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
+ /* jshint nomen:false */
13
+ /* global define, require, window, Blob */
14
+
15
+ ;(function (factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define([
20
+ 'jquery',
21
+ 'load-image',
22
+ 'load-image-meta',
23
+ 'load-image-scale',
24
+ 'load-image-exif',
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-canvas-to-blob'),
37
+ require('./jquery.fileupload-process')
38
+ );
39
+ } else {
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
+ }
115
+ );
116
+
117
+ // The File Upload Resize plugin extends the fileupload widget
118
+ // with image resize functionality:
119
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
120
+
121
+ options: {
122
+ // The regular expression for the types of images to load:
123
+ // matched against the file type:
124
+ loadImageFileTypes: /^image\/(gif|jpeg|png|svg\+xml)$/,
125
+ // The maximum file size of images to load:
126
+ loadImageMaxFileSize: 10000000, // 10MB
127
+ // The maximum width of resized images:
128
+ imageMaxWidth: 1920,
129
+ // The maximum height of resized images:
130
+ imageMaxHeight: 1080,
131
+ // Defines the image orientation (1-8) or takes the orientation
132
+ // value from Exif data if set to true:
133
+ imageOrientation: false,
134
+ // Define if resized images should be cropped or only scaled:
135
+ imageCrop: false,
136
+ // Disable the resize image functionality by default:
137
+ disableImageResize: true,
138
+ // The maximum width of the preview images:
139
+ previewMaxWidth: 80,
140
+ // The maximum height of the preview images:
141
+ previewMaxHeight: 80,
142
+ // Defines the preview orientation (1-8) or takes the orientation
143
+ // value from Exif data if set to true:
144
+ previewOrientation: true,
145
+ // Create the preview using the Exif data thumbnail:
146
+ previewThumbnail: true,
147
+ // Define if preview images should be cropped or only scaled:
148
+ previewCrop: false,
149
+ // Define if preview images should be resized as canvas elements:
150
+ previewCanvas: true
151
+ },
152
+
153
+ processActions: {
154
+
155
+ // Loads the image given via data.files and data.index
156
+ // as img element, if the browser supports the File API.
157
+ // Accepts the options fileTypes (regular expression)
158
+ // and maxFileSize (integer) to limit the files to load:
159
+ loadImage: function (data, options) {
160
+ if (options.disabled) {
161
+ return data;
162
+ }
163
+ var that = this,
164
+ file = data.files[data.index],
165
+ dfd = $.Deferred();
166
+ if (($.type(options.maxFileSize) === 'number' &&
167
+ file.size > options.maxFileSize) ||
168
+ (options.fileTypes &&
169
+ !options.fileTypes.test(file.type)) ||
170
+ !loadImage(
171
+ file,
172
+ function (img) {
173
+ if (img.src) {
174
+ data.img = img;
175
+ }
176
+ dfd.resolveWith(that, [data]);
177
+ },
178
+ options
179
+ )) {
180
+ return data;
181
+ }
182
+ return dfd.promise();
183
+ },
184
+
185
+ // Resizes the image given as data.canvas or data.img
186
+ // and updates data.canvas or data.img with the resized image.
187
+ // Also stores the resized image as preview property.
188
+ // Accepts the options maxWidth, maxHeight, minWidth,
189
+ // minHeight, canvas and crop:
190
+ resizeImage: function (data, options) {
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
+ },
232
+
233
+ // Saves the processed image given as data.canvas
234
+ // inplace at data.index of data.files:
235
+ saveImage: function (data, options) {
236
+ if (!data.canvas || options.disabled) {
237
+ return data;
238
+ }
239
+ var that = this,
240
+ file = data.files[data.index],
241
+ dfd = $.Deferred();
242
+ if (data.canvas.toBlob) {
243
+ data.canvas.toBlob(
244
+ function (blob) {
245
+ if (!blob.name) {
246
+ if (file.type === blob.type) {
247
+ blob.name = file.name;
248
+ } else if (file.name) {
249
+ blob.name = file.name.replace(
250
+ /\.\w+$/,
251
+ '.' + blob.type.substr(6)
252
+ );
253
+ }
254
+ }
255
+ // Don't restore invalid meta data:
256
+ if (file.type !== blob.type) {
257
+ delete data.imageHead;
258
+ }
259
+ // Store the created blob at the position
260
+ // of the original file in the files list:
261
+ data.files[data.index] = blob;
262
+ dfd.resolveWith(that, [data]);
263
+ },
264
+ options.type || file.type,
265
+ options.quality
266
+ );
267
+ } else {
268
+ return data;
269
+ }
270
+ return dfd.promise();
271
+ },
272
+
273
+ loadImageMetaData: function (data, options) {
274
+ if (options.disabled) {
275
+ return data;
276
+ }
277
+ var that = this,
278
+ dfd = $.Deferred();
279
+ loadImage.parseMetaData(data.files[data.index], function (result) {
280
+ $.extend(data, result);
281
+ dfd.resolveWith(that, [data]);
282
+ }, options);
283
+ return dfd.promise();
284
+ },
285
+
286
+ saveImageMetaData: function (data, options) {
287
+ if (!(data.imageHead && data.canvas &&
288
+ data.canvas.toBlob && !options.disabled)) {
289
+ return data;
290
+ }
291
+ var file = data.files[data.index],
292
+ blob = new Blob([
293
+ data.imageHead,
294
+ // Resized images always have a head size of 20 bytes,
295
+ // including the JPEG marker and a minimal JFIF header:
296
+ this._blobSlice.call(file, 20)
297
+ ], {type: file.type});
298
+ blob.name = file.name;
299
+ data.files[data.index] = blob;
300
+ return data;
301
+ },
302
+
303
+ // Sets the resized version of the image as a property of the
304
+ // file object, must be called after "saveImage":
305
+ setImage: function (data, options) {
306
+ if (data.preview && !options.disabled) {
307
+ data.files[data.index][options.name || 'preview'] = data.preview;
308
+ }
309
+ return data;
310
+ },
311
+
312
+ deleteImageReferences: function (data, options) {
313
+ if (!options.disabled) {
314
+ delete data.img;
315
+ delete data.canvas;
316
+ delete data.preview;
317
+ delete data.imageHead;
318
+ }
319
+ return data;
320
+ }
321
+
322
+ }
323
+
324
+ });
325
+
326
+ }));
@@ -0,0 +1,161 @@
1
+ /*
2
+ * jQuery File Upload jQuery UI 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
+ /* jshint nomen:false */
13
+ /* global define, require, window */
14
+
15
+ ;(function (factory) {
16
+ 'use strict';
17
+ if (typeof define === 'function' && define.amd) {
18
+ // Register as an anonymous AMD module:
19
+ define([
20
+ 'jquery',
21
+ './jquery.fileupload-ui'
22
+ ], factory);
23
+ } else if (typeof exports === 'object') {
24
+ // Node/CommonJS:
25
+ factory(
26
+ require('jquery'),
27
+ require('./jquery.fileupload-ui')
28
+ );
29
+ } else {
30
+ // Browser globals:
31
+ factory(window.jQuery);
32
+ }
33
+ }(function ($) {
34
+ 'use strict';
35
+
36
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
37
+
38
+ options: {
39
+ processdone: function (e, data) {
40
+ data.context.find('.start').button('enable');
41
+ },
42
+ progress: function (e, data) {
43
+ if (data.context) {
44
+ data.context.find('.progress').progressbar(
45
+ 'option',
46
+ 'value',
47
+ parseInt(data.loaded / data.total * 100, 10)
48
+ );
49
+ }
50
+ },
51
+ progressall: function (e, data) {
52
+ var $this = $(this);
53
+ $this.find('.fileupload-progress')
54
+ .find('.progress').progressbar(
55
+ 'option',
56
+ 'value',
57
+ parseInt(data.loaded / data.total * 100, 10)
58
+ ).end()
59
+ .find('.progress-extended').each(function () {
60
+ $(this).html(
61
+ ($this.data('blueimp-fileupload') ||
62
+ $this.data('fileupload'))
63
+ ._renderExtendedProgress(data)
64
+ );
65
+ });
66
+ }
67
+ },
68
+
69
+ _renderUpload: function (func, files) {
70
+ var node = this._super(func, files),
71
+ showIconText = $(window).width() > 480;
72
+ node.find('.progress').empty().progressbar();
73
+ node.find('.start').button({
74
+ icons: {primary: 'ui-icon-circle-arrow-e'},
75
+ text: showIconText
76
+ });
77
+ node.find('.cancel').button({
78
+ icons: {primary: 'ui-icon-cancel'},
79
+ text: showIconText
80
+ });
81
+ if (node.hasClass('fade')) {
82
+ node.hide();
83
+ }
84
+ return node;
85
+ },
86
+
87
+ _renderDownload: function (func, files) {
88
+ var node = this._super(func, files),
89
+ showIconText = $(window).width() > 480;
90
+ node.find('.delete').button({
91
+ icons: {primary: 'ui-icon-trash'},
92
+ text: showIconText
93
+ });
94
+ if (node.hasClass('fade')) {
95
+ node.hide();
96
+ }
97
+ return node;
98
+ },
99
+
100
+ _startHandler: function (e) {
101
+ $(e.currentTarget).button('disable');
102
+ this._super(e);
103
+ },
104
+
105
+ _transition: function (node) {
106
+ var deferred = $.Deferred();
107
+ if (node.hasClass('fade')) {
108
+ node.fadeToggle(
109
+ this.options.transitionDuration,
110
+ this.options.transitionEasing,
111
+ function () {
112
+ deferred.resolveWith(node);
113
+ }
114
+ );
115
+ } else {
116
+ deferred.resolveWith(node);
117
+ }
118
+ return deferred;
119
+ },
120
+
121
+ _create: function () {
122
+ this._super();
123
+ this.element
124
+ .find('.fileupload-buttonbar')
125
+ .find('.fileinput-button').each(function () {
126
+ var input = $(this).find('input:file').detach();
127
+ $(this)
128
+ .button({icons: {primary: 'ui-icon-plusthick'}})
129
+ .append(input);
130
+ })
131
+ .end().find('.start')
132
+ .button({icons: {primary: 'ui-icon-circle-arrow-e'}})
133
+ .end().find('.cancel')
134
+ .button({icons: {primary: 'ui-icon-cancel'}})
135
+ .end().find('.delete')
136
+ .button({icons: {primary: 'ui-icon-trash'}})
137
+ .end().find('.progress').progressbar();
138
+ },
139
+
140
+ _destroy: function () {
141
+ this.element
142
+ .find('.fileupload-buttonbar')
143
+ .find('.fileinput-button').each(function () {
144
+ var input = $(this).find('input:file').detach();
145
+ $(this)
146
+ .button('destroy')
147
+ .append(input);
148
+ })
149
+ .end().find('.start')
150
+ .button('destroy')
151
+ .end().find('.cancel')
152
+ .button('destroy')
153
+ .end().find('.delete')
154
+ .button('destroy')
155
+ .end().find('.progress').progressbar('destroy');
156
+ this._super();
157
+ }
158
+
159
+ });
160
+
161
+ }));