card-mod-script 0.13.3 → 0.14.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (92) hide show
  1. checksums.yaml +4 -4
  2. data/assets/script/decko/components.js.coffee +3 -0
  3. data/assets/script/decko/decko.js.coffee +0 -15
  4. data/assets/script/decko/editor.js.coffee +3 -1
  5. data/assets/script/decko/filter.js.coffee +13 -6
  6. data/assets/script/decko/mod.js.coffee +2 -8
  7. data/assets/script/{script_pointer_config.js.coffee → decko/pointer_config.js.coffee} +1 -2
  8. data/assets/script/{script_pointer_list_editor.js.coffee → decko/pointer_list_editor.js.coffee} +0 -0
  9. data/assets/script/decko/slot.js.coffee +2 -2
  10. data/assets/script/decko/slot_ready.js.coffee +1 -0
  11. data/assets/script/decko/slotter.js.coffee +23 -31
  12. data/assets/script/decko/type_editor.js.coffee +21 -0
  13. data/assets/script/decko/upload.js.coffee +12 -5
  14. data/assets/script/manifest.yml +15 -2
  15. data/set/abstract/00_script.rb +30 -31
  16. data/set/abstract/01_asset_script.rb +0 -16
  17. data/set/abstract/{script_asset_list.rb → script_group.rb} +12 -13
  18. data/set/all/head_javascript.rb +4 -5
  19. data/set/right/script.rb +1 -14
  20. data/set/type/local_script_folder_group.rb +2 -2
  21. data/set/type/local_script_manifest_group.rb +1 -1
  22. data/set/type_plus_right/mod/script.rb +56 -0
  23. data/set/type_plus_right/set/script.rb +7 -0
  24. data/vendor/jquery_file_upload/LICENSE.txt +11 -12
  25. data/vendor/jquery_file_upload/README.md +189 -72
  26. data/vendor/jquery_file_upload/SECURITY.md +227 -0
  27. data/vendor/jquery_file_upload/VULNERABILITIES.md +118 -0
  28. data/vendor/jquery_file_upload/cors/postmessage.html +68 -58
  29. data/vendor/jquery_file_upload/cors/result.html +12 -10
  30. data/vendor/jquery_file_upload/css/jquery.fileupload-ui.css +24 -13
  31. data/vendor/jquery_file_upload/css/jquery.fileupload.css +3 -4
  32. data/vendor/jquery_file_upload/docker-compose.yml +55 -0
  33. data/vendor/jquery_file_upload/index.html +332 -230
  34. data/vendor/jquery_file_upload/js/cors/jquery.postmessage-transport.js +109 -109
  35. data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +81 -73
  36. data/vendor/jquery_file_upload/js/demo.js +75 -0
  37. data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +82 -94
  38. data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +321 -300
  39. data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +138 -146
  40. data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +737 -692
  41. data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +91 -97
  42. data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +82 -94
  43. data/vendor/jquery_file_upload/js/jquery.fileupload.js +1569 -1451
  44. data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +208 -205
  45. data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +397 -340
  46. data/vendor/jquery_file_upload/package-lock.json +6853 -0
  47. data/vendor/jquery_file_upload/package.json +71 -10
  48. data/vendor/jquery_file_upload/server/gae-python/app.yaml +11 -10
  49. data/vendor/jquery_file_upload/server/php/Dockerfile +23 -17
  50. data/vendor/jquery_file_upload/server/php/UploadHandler.php +206 -137
  51. data/vendor/jquery_file_upload/server/php/php.ini +5 -0
  52. data/vendor/jquery_file_upload/test/index.html +36 -159
  53. data/vendor/jquery_file_upload/test/unit.js +989 -0
  54. data/vendor/jquery_file_upload/test/vendor/chai.js +10854 -0
  55. data/vendor/jquery_file_upload/test/vendor/mocha.css +325 -0
  56. data/vendor/jquery_file_upload/test/vendor/mocha.js +18178 -0
  57. data/vendor/jquery_file_upload/wdio/LICENSE.txt +20 -0
  58. data/vendor/jquery_file_upload/wdio/assets/black+white-3x2.jpg +0 -0
  59. data/vendor/jquery_file_upload/wdio/assets/black+white-60x40.gif +0 -0
  60. data/vendor/jquery_file_upload/wdio/conf/chrome.js +40 -0
  61. data/vendor/jquery_file_upload/wdio/conf/firefox.js +25 -0
  62. data/vendor/jquery_file_upload/wdio/hooks/index.js +36 -0
  63. data/vendor/jquery_file_upload/wdio/test/pages/file-upload.js +79 -0
  64. data/vendor/jquery_file_upload/wdio/test/specs/01-file-upload.js +25 -0
  65. data/vendor/jquery_file_upload/wdio/wdio.conf.js +4 -0
  66. metadata +34 -52
  67. data/file/mod_script_script_decko_machine_output/file.js +0 -2685
  68. data/file/mod_script_script_jquery_machine_output/file.js +0 -12924
  69. data/lib/javascript/script_html5shiv_printshiv.js +0 -1
  70. data/set/self/script_html5shiv_printshiv.rb +0 -11
  71. data/set/self/script_mods.rb +0 -1
  72. data/set/type/mod_script_assets.rb +0 -21
  73. data/vendor/jquery_file_upload/CONTRIBUTING.md +0 -15
  74. data/vendor/jquery_file_upload/angularjs.html +0 -211
  75. data/vendor/jquery_file_upload/basic-plus.html +0 -226
  76. data/vendor/jquery_file_upload/basic.html +0 -136
  77. data/vendor/jquery_file_upload/bower-version-update.js +0 -16
  78. data/vendor/jquery_file_upload/bower.json +0 -64
  79. data/vendor/jquery_file_upload/css/jquery-ui-demo-ie8.css +0 -21
  80. data/vendor/jquery_file_upload/css/jquery-ui-demo.css +0 -67
  81. data/vendor/jquery_file_upload/css/style.css +0 -15
  82. data/vendor/jquery_file_upload/jquery-ui.html +0 -252
  83. data/vendor/jquery_file_upload/js/app.js +0 -101
  84. data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +0 -437
  85. data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +0 -161
  86. data/vendor/jquery_file_upload/js/main.js +0 -75
  87. data/vendor/jquery_file_upload/server/gae-go/app/main.go +0 -361
  88. data/vendor/jquery_file_upload/server/gae-go/app.yaml +0 -12
  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 +0 -2
  91. data/vendor/jquery_file_upload/server/php/docker-compose.yml +0 -9
  92. data/vendor/jquery_file_upload/test/test.js +0 -1292
@@ -9,118 +9,118 @@
9
9
  * https://opensource.org/licenses/MIT
10
10
  */
11
11
 
12
- /* global define, require, window, document */
12
+ /* global define, require */
13
13
 
14
- ;(function (factory) {
15
- 'use strict';
16
- if (typeof define === 'function' && define.amd) {
17
- // Register as an anonymous AMD module:
18
- define(['jquery'], factory);
19
- } else if (typeof exports === 'object') {
20
- // Node/CommonJS:
21
- factory(require('jquery'));
22
- } else {
23
- // Browser globals:
24
- factory(window.jQuery);
25
- }
26
- }(function ($) {
27
- 'use strict';
14
+ (function (factory) {
15
+ 'use strict';
16
+ if (typeof define === 'function' && define.amd) {
17
+ // Register as an anonymous AMD module:
18
+ define(['jquery'], factory);
19
+ } else if (typeof exports === 'object') {
20
+ // Node/CommonJS:
21
+ factory(require('jquery'));
22
+ } else {
23
+ // Browser globals:
24
+ factory(window.jQuery);
25
+ }
26
+ })(function ($) {
27
+ 'use strict';
28
28
 
29
- var counter = 0,
30
- names = [
31
- 'accepts',
32
- 'cache',
33
- 'contents',
34
- 'contentType',
35
- 'crossDomain',
36
- 'data',
37
- 'dataType',
38
- 'headers',
39
- 'ifModified',
40
- 'mimeType',
41
- 'password',
42
- 'processData',
43
- 'timeout',
44
- 'traditional',
45
- 'type',
46
- 'url',
47
- 'username'
48
- ],
49
- convert = function (p) {
50
- return p;
51
- };
29
+ var counter = 0,
30
+ names = [
31
+ 'accepts',
32
+ 'cache',
33
+ 'contents',
34
+ 'contentType',
35
+ 'crossDomain',
36
+ 'data',
37
+ 'dataType',
38
+ 'headers',
39
+ 'ifModified',
40
+ 'mimeType',
41
+ 'password',
42
+ 'processData',
43
+ 'timeout',
44
+ 'traditional',
45
+ 'type',
46
+ 'url',
47
+ 'username'
48
+ ],
49
+ convert = function (p) {
50
+ return p;
51
+ };
52
52
 
53
- $.ajaxSetup({
54
- converters: {
55
- 'postmessage text': convert,
56
- 'postmessage json': convert,
57
- 'postmessage html': convert
58
- }
59
- });
53
+ $.ajaxSetup({
54
+ converters: {
55
+ 'postmessage text': convert,
56
+ 'postmessage json': convert,
57
+ 'postmessage html': convert
58
+ }
59
+ });
60
60
 
61
- $.ajaxTransport('postmessage', function (options) {
62
- if (options.postMessage && window.postMessage) {
63
- var iframe,
64
- loc = $('<a>').prop('href', options.postMessage)[0],
65
- target = loc.protocol + '//' + loc.host,
66
- xhrUpload = options.xhr().upload;
67
- // IE always includes the port for the host property of a link
68
- // element, but not in the location.host or origin property for the
69
- // default http port 80 and https port 443, so we strip it:
70
- if (/^(http:\/\/.+:80)|(https:\/\/.+:443)$/.test(target)) {
71
- target = target.replace(/:(80|443)$/, '');
72
- }
73
- return {
74
- send: function (_, completeCallback) {
75
- counter += 1;
76
- var message = {
77
- id: 'postmessage-transport-' + counter
78
- },
79
- eventName = 'message.' + message.id;
80
- iframe = $(
81
- '<iframe style="display:none;" src="' +
82
- options.postMessage + '" name="' +
83
- message.id + '"></iframe>'
84
- ).bind('load', function () {
85
- $.each(names, function (i, name) {
86
- message[name] = options[name];
87
- });
88
- message.dataType = message.dataType.replace('postmessage ', '');
89
- $(window).bind(eventName, function (e) {
90
- e = e.originalEvent;
91
- var data = e.data,
92
- ev;
93
- if (e.origin === target && data.id === message.id) {
94
- if (data.type === 'progress') {
95
- ev = document.createEvent('Event');
96
- ev.initEvent(data.type, false, true);
97
- $.extend(ev, data);
98
- xhrUpload.dispatchEvent(ev);
99
- } else {
100
- completeCallback(
101
- data.status,
102
- data.statusText,
103
- {postmessage: data.result},
104
- data.headers
105
- );
106
- iframe.remove();
107
- $(window).unbind(eventName);
108
- }
109
- }
110
- });
111
- iframe[0].contentWindow.postMessage(
112
- message,
113
- target
114
- );
115
- }).appendTo(document.body);
116
- },
117
- abort: function () {
118
- if (iframe) {
119
- iframe.remove();
120
- }
61
+ $.ajaxTransport('postmessage', function (options) {
62
+ if (options.postMessage && window.postMessage) {
63
+ var iframe,
64
+ loc = $('<a></a>').prop('href', options.postMessage)[0],
65
+ target = loc.protocol + '//' + loc.host,
66
+ xhrUpload = options.xhr().upload;
67
+ // IE always includes the port for the host property of a link
68
+ // element, but not in the location.host or origin property for the
69
+ // default http port 80 and https port 443, so we strip it:
70
+ if (/^(http:\/\/.+:80)|(https:\/\/.+:443)$/.test(target)) {
71
+ target = target.replace(/:(80|443)$/, '');
72
+ }
73
+ return {
74
+ send: function (_, completeCallback) {
75
+ counter += 1;
76
+ var message = {
77
+ id: 'postmessage-transport-' + counter
78
+ },
79
+ eventName = 'message.' + message.id;
80
+ iframe = $(
81
+ '<iframe style="display:none;" src="' +
82
+ options.postMessage +
83
+ '" name="' +
84
+ message.id +
85
+ '"></iframe>'
86
+ )
87
+ .on('load', function () {
88
+ $.each(names, function (i, name) {
89
+ message[name] = options[name];
90
+ });
91
+ message.dataType = message.dataType.replace('postmessage ', '');
92
+ $(window).on(eventName, function (event) {
93
+ var e = event.originalEvent;
94
+ var data = e.data;
95
+ var ev;
96
+ if (e.origin === target && data.id === message.id) {
97
+ if (data.type === 'progress') {
98
+ ev = document.createEvent('Event');
99
+ ev.initEvent(data.type, false, true);
100
+ $.extend(ev, data);
101
+ xhrUpload.dispatchEvent(ev);
102
+ } else {
103
+ completeCallback(
104
+ data.status,
105
+ data.statusText,
106
+ { postmessage: data.result },
107
+ data.headers
108
+ );
109
+ iframe.remove();
110
+ $(window).off(eventName);
111
+ }
121
112
  }
122
- };
113
+ });
114
+ iframe[0].contentWindow.postMessage(message, target);
115
+ })
116
+ .appendTo(document.body);
117
+ },
118
+ abort: function () {
119
+ if (iframe) {
120
+ iframe.remove();
121
+ }
123
122
  }
124
- });
125
-
126
- }));
123
+ };
124
+ }
125
+ });
126
+ });
@@ -12,78 +12,86 @@
12
12
  * https://github.com/jaubourg/ajaxHooks/
13
13
  */
14
14
 
15
- /* global define, require, window, XDomainRequest */
15
+ /* global define, require, XDomainRequest */
16
16
 
17
- ;(function (factory) {
18
- 'use strict';
19
- if (typeof define === 'function' && define.amd) {
20
- // Register as an anonymous AMD module:
21
- define(['jquery'], factory);
22
- } else if (typeof exports === 'object') {
23
- // Node/CommonJS:
24
- factory(require('jquery'));
25
- } else {
26
- // Browser globals:
27
- factory(window.jQuery);
28
- }
29
- }(function ($) {
30
- 'use strict';
31
- if (window.XDomainRequest && !$.support.cors) {
32
- $.ajaxTransport(function (s) {
33
- if (s.crossDomain && s.async) {
34
- if (s.timeout) {
35
- s.xdrTimeout = s.timeout;
36
- delete s.timeout;
37
- }
38
- var xdr;
39
- return {
40
- send: function (headers, completeCallback) {
41
- var addParamChar = /\?/.test(s.url) ? '&' : '?';
42
- function callback(status, statusText, responses, responseHeaders) {
43
- xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
44
- xdr = null;
45
- completeCallback(status, statusText, responses, responseHeaders);
46
- }
47
- xdr = new XDomainRequest();
48
- // XDomainRequest only supports GET and POST:
49
- if (s.type === 'DELETE') {
50
- s.url = s.url + addParamChar + '_method=DELETE';
51
- s.type = 'POST';
52
- } else if (s.type === 'PUT') {
53
- s.url = s.url + addParamChar + '_method=PUT';
54
- s.type = 'POST';
55
- } else if (s.type === 'PATCH') {
56
- s.url = s.url + addParamChar + '_method=PATCH';
57
- s.type = 'POST';
58
- }
59
- xdr.open(s.type, s.url);
60
- xdr.onload = function () {
61
- callback(
62
- 200,
63
- 'OK',
64
- {text: xdr.responseText},
65
- 'Content-Type: ' + xdr.contentType
66
- );
67
- };
68
- xdr.onerror = function () {
69
- callback(404, 'Not Found');
70
- };
71
- if (s.xdrTimeout) {
72
- xdr.ontimeout = function () {
73
- callback(0, 'timeout');
74
- };
75
- xdr.timeout = s.xdrTimeout;
76
- }
77
- xdr.send((s.hasContent && s.data) || null);
78
- },
79
- abort: function () {
80
- if (xdr) {
81
- xdr.onerror = $.noop();
82
- xdr.abort();
83
- }
84
- }
85
- };
17
+ (function (factory) {
18
+ 'use strict';
19
+ if (typeof define === 'function' && define.amd) {
20
+ // Register as an anonymous AMD module:
21
+ define(['jquery'], factory);
22
+ } else if (typeof exports === 'object') {
23
+ // Node/CommonJS:
24
+ factory(require('jquery'));
25
+ } else {
26
+ // Browser globals:
27
+ factory(window.jQuery);
28
+ }
29
+ })(function ($) {
30
+ 'use strict';
31
+ if (window.XDomainRequest && !$.support.cors) {
32
+ $.ajaxTransport(function (s) {
33
+ if (s.crossDomain && s.async) {
34
+ if (s.timeout) {
35
+ s.xdrTimeout = s.timeout;
36
+ delete s.timeout;
37
+ }
38
+ var xdr;
39
+ return {
40
+ send: function (headers, completeCallback) {
41
+ var addParamChar = /\?/.test(s.url) ? '&' : '?';
42
+ /**
43
+ * Callback wrapper function
44
+ *
45
+ * @param {number} status HTTP status code
46
+ * @param {string} statusText HTTP status text
47
+ * @param {object} [responses] Content-type specific responses
48
+ * @param {string} [responseHeaders] Response headers string
49
+ */
50
+ function callback(status, statusText, responses, responseHeaders) {
51
+ xdr.onload = xdr.onerror = xdr.ontimeout = $.noop;
52
+ xdr = null;
53
+ completeCallback(status, statusText, responses, responseHeaders);
86
54
  }
87
- });
88
- }
89
- }));
55
+ xdr = new XDomainRequest();
56
+ // XDomainRequest only supports GET and POST:
57
+ if (s.type === 'DELETE') {
58
+ s.url = s.url + addParamChar + '_method=DELETE';
59
+ s.type = 'POST';
60
+ } else if (s.type === 'PUT') {
61
+ s.url = s.url + addParamChar + '_method=PUT';
62
+ s.type = 'POST';
63
+ } else if (s.type === 'PATCH') {
64
+ s.url = s.url + addParamChar + '_method=PATCH';
65
+ s.type = 'POST';
66
+ }
67
+ xdr.open(s.type, s.url);
68
+ xdr.onload = function () {
69
+ callback(
70
+ 200,
71
+ 'OK',
72
+ { text: xdr.responseText },
73
+ 'Content-Type: ' + xdr.contentType
74
+ );
75
+ };
76
+ xdr.onerror = function () {
77
+ callback(404, 'Not Found');
78
+ };
79
+ if (s.xdrTimeout) {
80
+ xdr.ontimeout = function () {
81
+ callback(0, 'timeout');
82
+ };
83
+ xdr.timeout = s.xdrTimeout;
84
+ }
85
+ xdr.send((s.hasContent && s.data) || null);
86
+ },
87
+ abort: function () {
88
+ if (xdr) {
89
+ xdr.onerror = $.noop();
90
+ xdr.abort();
91
+ }
92
+ }
93
+ };
94
+ }
95
+ });
96
+ }
97
+ });
@@ -0,0 +1,75 @@
1
+ /*
2
+ * jQuery File Upload Demo
3
+ * https://github.com/blueimp/jQuery-File-Upload
4
+ *
5
+ * Copyright 2010, Sebastian Tschan
6
+ * https://blueimp.net
7
+ *
8
+ * Licensed under the MIT license:
9
+ * https://opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* global $ */
13
+
14
+ $(function () {
15
+ 'use strict';
16
+
17
+ // Initialize the jQuery File Upload widget:
18
+ $('#fileupload').fileupload({
19
+ // Uncomment the following to send cross-domain cookies:
20
+ //xhrFields: {withCredentials: true},
21
+ url: 'server/php/'
22
+ });
23
+
24
+ // Enable iframe cross-domain access via redirect option:
25
+ $('#fileupload').fileupload(
26
+ 'option',
27
+ 'redirect',
28
+ window.location.href.replace(/\/[^/]*$/, '/cors/result.html?%s')
29
+ );
30
+
31
+ if (window.location.hostname === 'blueimp.github.io') {
32
+ // Demo settings:
33
+ $('#fileupload').fileupload('option', {
34
+ url: '//jquery-file-upload.appspot.com/',
35
+ // Enable image resizing, except for Android and Opera,
36
+ // which actually support image resizing, but fail to
37
+ // send Blob objects via XHR requests:
38
+ disableImageResize: /Android(?!.*Chrome)|Opera/.test(
39
+ window.navigator.userAgent
40
+ ),
41
+ maxFileSize: 999000,
42
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i
43
+ });
44
+ // Upload server status check for browsers with CORS support:
45
+ if ($.support.cors) {
46
+ $.ajax({
47
+ url: '//jquery-file-upload.appspot.com/',
48
+ type: 'HEAD'
49
+ }).fail(function () {
50
+ $('<div class="alert alert-danger"></div>')
51
+ .text('Upload server currently unavailable - ' + new Date())
52
+ .appendTo('#fileupload');
53
+ });
54
+ }
55
+ } else {
56
+ // Load existing files:
57
+ $('#fileupload').addClass('fileupload-processing');
58
+ $.ajax({
59
+ // Uncomment the following to send cross-domain cookies:
60
+ //xhrFields: {withCredentials: true},
61
+ url: $('#fileupload').fileupload('option', 'url'),
62
+ dataType: 'json',
63
+ context: $('#fileupload')[0]
64
+ })
65
+ .always(function () {
66
+ $(this).removeClass('fileupload-processing');
67
+ })
68
+ .done(function (result) {
69
+ $(this)
70
+ .fileupload('option', 'done')
71
+ // eslint-disable-next-line new-cap
72
+ .call(this, $.Event('done'), { result: result });
73
+ });
74
+ }
75
+ });
@@ -9,105 +9,93 @@
9
9
  * https://opensource.org/licenses/MIT
10
10
  */
11
11
 
12
- /* jshint nomen:false */
13
- /* global define, require, window, document */
12
+ /* global define, require */
14
13
 
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
- }
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')
56
25
  );
26
+ } else {
27
+ // Browser globals:
28
+ factory(window.jQuery, window.loadImage);
29
+ }
30
+ })(function ($, loadImage) {
31
+ 'use strict';
57
32
 
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: {
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
+ );
71
49
 
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
- },
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
+ },
100
58
 
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
- }
59
+ _audioElement: document.createElement('audio'),
108
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;
109
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
+ },
110
91
 
111
- });
112
-
113
- }));
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
+ });