jquery-file-upload 0.0.1

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 (34) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +18 -0
  3. data/Gemfile +14 -0
  4. data/LICENSE +21 -0
  5. data/README.md +12 -0
  6. data/app/assets/images/jquery-file-upload/loading.gif +0 -0
  7. data/app/assets/images/jquery-file-upload/progressbar.gif +0 -0
  8. data/app/assets/javascripts/jquery-file-upload/cors/jquery.postmessage-transport.js +120 -0
  9. data/app/assets/javascripts/jquery-file-upload/cors/jquery.xdr-transport.js +89 -0
  10. data/app/assets/javascripts/jquery-file-upload/jquery.fileupload-image.js +321 -0
  11. data/app/assets/javascripts/jquery-file-upload/jquery.fileupload-jquery-ui.js +155 -0
  12. data/app/assets/javascripts/jquery-file-upload/jquery.fileupload-process.js +175 -0
  13. data/app/assets/javascripts/jquery-file-upload/jquery.fileupload-ui.js +710 -0
  14. data/app/assets/javascripts/jquery-file-upload/jquery.fileupload-validate.js +122 -0
  15. data/app/assets/javascripts/jquery-file-upload/jquery.fileupload.js +1466 -0
  16. data/app/assets/javascripts/jquery-file-upload/jquery.iframe-transport.js +217 -0
  17. data/app/assets/javascripts/jquery-file-upload/vendor/jquery.ui.widget.js +563 -0
  18. data/app/assets/javascripts/jquery-file-upload.js.coffee +1 -0
  19. data/app/assets/javascripts/jquery.fileupload-angular.js +429 -0
  20. data/app/assets/javascripts/jquery.fileupload-audio.js +112 -0
  21. data/app/assets/javascripts/jquery.fileupload-video.js +112 -0
  22. data/app/assets/stylesheets/jquery-file-upload/jquery.fileupload-noscript.css +22 -0
  23. data/app/assets/stylesheets/jquery-file-upload/jquery.fileupload-ui-noscript.css +17 -0
  24. data/app/assets/stylesheets/jquery-file-upload/jquery.fileupload-ui.css +57 -0
  25. data/app/assets/stylesheets/jquery-file-upload/jquery.fileupload.css +36 -0
  26. data/app/views/jquery-file-upload/basic_plus_ui/_download.html.erb +43 -0
  27. data/app/views/jquery-file-upload/basic_plus_ui/_form.html.slim +38 -0
  28. data/app/views/jquery-file-upload/basic_plus_ui/_upload.html.erb +32 -0
  29. data/jquery-file-upload.gemspec +19 -0
  30. data/lib/jquery-file-upload/configuration.rb +13 -0
  31. data/lib/jquery-file-upload/engine.rb +6 -0
  32. data/lib/jquery-file-upload/version.rb +3 -0
  33. data/lib/jquery-file-upload.rb +15 -0
  34. metadata +89 -0
@@ -0,0 +1,122 @@
1
+ /*
2
+ * jQuery File Upload Validation Plugin 1.1.3
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
+ * http://www.opensource.org/licenses/MIT
10
+ */
11
+
12
+ /* global define, require, window */
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
+ './jquery.fileupload-process'
21
+ ], factory);
22
+ } else if (typeof exports === 'object') {
23
+ // Node/CommonJS:
24
+ factory(require('jquery'));
25
+ } else {
26
+ // Browser globals:
27
+ factory(
28
+ window.jQuery
29
+ );
30
+ }
31
+ }(function ($) {
32
+ 'use strict';
33
+
34
+ // Append to the default processQueue:
35
+ $.blueimp.fileupload.prototype.options.processQueue.push(
36
+ {
37
+ action: 'validate',
38
+ // Always trigger this action,
39
+ // even if the previous action was rejected:
40
+ always: true,
41
+ // Options taken from the global options map:
42
+ acceptFileTypes: '@',
43
+ maxFileSize: '@',
44
+ minFileSize: '@',
45
+ maxNumberOfFiles: '@',
46
+ disabled: '@disableValidation'
47
+ }
48
+ );
49
+
50
+ // The File Upload Validation plugin extends the fileupload widget
51
+ // with file validation functionality:
52
+ $.widget('blueimp.fileupload', $.blueimp.fileupload, {
53
+
54
+ options: {
55
+ /*
56
+ // The regular expression for allowed file types, matches
57
+ // against either file type or file name:
58
+ acceptFileTypes: /(\.|\/)(gif|jpe?g|png)$/i,
59
+ // The maximum allowed file size in bytes:
60
+ maxFileSize: 10000000, // 10 MB
61
+ // The minimum allowed file size in bytes:
62
+ minFileSize: undefined, // No minimal file size
63
+ // The limit of files to be uploaded:
64
+ maxNumberOfFiles: 10,
65
+ */
66
+
67
+ // Function returning the current number of files,
68
+ // has to be overriden for maxNumberOfFiles validation:
69
+ getNumberOfFiles: $.noop,
70
+
71
+ // Error and info messages:
72
+ messages: {
73
+ maxNumberOfFiles: 'Maximum number of files exceeded',
74
+ acceptFileTypes: 'File type not allowed',
75
+ maxFileSize: 'File is too large',
76
+ minFileSize: 'File is too small'
77
+ }
78
+ },
79
+
80
+ processActions: {
81
+
82
+ validate: function (data, options) {
83
+ if (options.disabled) {
84
+ return data;
85
+ }
86
+ var dfd = $.Deferred(),
87
+ settings = this.options,
88
+ file = data.files[data.index],
89
+ fileSize;
90
+ if (options.minFileSize || options.maxFileSize) {
91
+ fileSize = file.size;
92
+ }
93
+ if ($.type(options.maxNumberOfFiles) === 'number' &&
94
+ (settings.getNumberOfFiles() || 0) + data.files.length >
95
+ options.maxNumberOfFiles) {
96
+ file.error = settings.i18n('maxNumberOfFiles');
97
+ } else if (options.acceptFileTypes &&
98
+ !(options.acceptFileTypes.test(file.type) ||
99
+ options.acceptFileTypes.test(file.name))) {
100
+ file.error = settings.i18n('acceptFileTypes');
101
+ } else if (fileSize > options.maxFileSize) {
102
+ file.error = settings.i18n('maxFileSize');
103
+ } else if ($.type(fileSize) === 'number' &&
104
+ fileSize < options.minFileSize) {
105
+ file.error = settings.i18n('minFileSize');
106
+ } else {
107
+ delete file.error;
108
+ }
109
+ if (file.error || data.files.error) {
110
+ data.files.error = true;
111
+ dfd.rejectWith(this, [data]);
112
+ } else {
113
+ dfd.resolveWith(this, [data]);
114
+ }
115
+ return dfd.promise();
116
+ }
117
+
118
+ }
119
+
120
+ });
121
+
122
+ }));