card-mod-machines 0.11.3 → 0.11.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/file/all_script_machine_output/file.js +72 -70
- data/file/all_style_machine_output/file.css +2 -2
- metadata +12 -88
- data/vendor/jquery_file_upload/CONTRIBUTING.md +0 -15
- data/vendor/jquery_file_upload/LICENSE.txt +0 -21
- data/vendor/jquery_file_upload/README.md +0 -107
- 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/cors/postmessage.html +0 -75
- data/vendor/jquery_file_upload/cors/result.html +0 -24
- 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/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 -57
- data/vendor/jquery_file_upload/css/jquery.fileupload.css +0 -37
- data/vendor/jquery_file_upload/css/style.css +0 -15
- 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 -255
- 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/cors/jquery.postmessage-transport.js +0 -126
- data/vendor/jquery_file_upload/js/cors/jquery.xdr-transport.js +0 -89
- data/vendor/jquery_file_upload/js/jquery.fileupload-angular.js +0 -437
- data/vendor/jquery_file_upload/js/jquery.fileupload-audio.js +0 -113
- data/vendor/jquery_file_upload/js/jquery.fileupload-image.js +0 -326
- data/vendor/jquery_file_upload/js/jquery.fileupload-jquery-ui.js +0 -161
- data/vendor/jquery_file_upload/js/jquery.fileupload-process.js +0 -178
- data/vendor/jquery_file_upload/js/jquery.fileupload-ui.js +0 -714
- data/vendor/jquery_file_upload/js/jquery.fileupload-validate.js +0 -125
- data/vendor/jquery_file_upload/js/jquery.fileupload-video.js +0 -113
- data/vendor/jquery_file_upload/js/jquery.fileupload.js +0 -1486
- data/vendor/jquery_file_upload/js/jquery.iframe-transport.js +0 -224
- data/vendor/jquery_file_upload/js/main.js +0 -75
- data/vendor/jquery_file_upload/js/vendor/jquery.ui.widget.js +0 -748
- data/vendor/jquery_file_upload/package.json +0 -55
- data/vendor/jquery_file_upload/server/gae-go/app.yaml +0 -12
- data/vendor/jquery_file_upload/server/gae-go/app/main.go +0 -361
- 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/gae-python/app.yaml +0 -17
- 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 -38
- data/vendor/jquery_file_upload/server/php/UploadHandler.php +0 -1411
- data/vendor/jquery_file_upload/server/php/docker-compose.yml +0 -9
- data/vendor/jquery_file_upload/server/php/index.php +0 -15
- data/vendor/jquery_file_upload/test/index.html +0 -172
- data/vendor/jquery_file_upload/test/test.js +0 -1292
- 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-rails.rb +0 -1
- data/vendor/jquery_rails/lib/jquery/assert_select.rb +0 -149
- data/vendor/jquery_rails/lib/jquery/rails.rb +0 -8
- 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/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,89 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery XDomainRequest Transport Plugin
|
3
|
-
* https://github.com/blueimp/jQuery-File-Upload
|
4
|
-
*
|
5
|
-
* Copyright 2011, Sebastian Tschan
|
6
|
-
* https://blueimp.net
|
7
|
-
*
|
8
|
-
* Licensed under the MIT license:
|
9
|
-
* https://opensource.org/licenses/MIT
|
10
|
-
*
|
11
|
-
* Based on Julian Aubourg's ajaxHooks xdr.js:
|
12
|
-
* https://github.com/jaubourg/ajaxHooks/
|
13
|
-
*/
|
14
|
-
|
15
|
-
/* global define, require, window, XDomainRequest */
|
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
|
-
};
|
86
|
-
}
|
87
|
-
});
|
88
|
-
}
|
89
|
-
}));
|
@@ -1,437 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* jQuery File Upload AngularJS 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, angular, require */
|
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
|
-
'angular',
|
22
|
-
'./jquery.fileupload-image',
|
23
|
-
'./jquery.fileupload-audio',
|
24
|
-
'./jquery.fileupload-video',
|
25
|
-
'./jquery.fileupload-validate'
|
26
|
-
], factory);
|
27
|
-
} else if (typeof exports === 'object') {
|
28
|
-
// Node/CommonJS:
|
29
|
-
factory(
|
30
|
-
require('jquery'),
|
31
|
-
require('angular'),
|
32
|
-
require('./jquery.fileupload-image'),
|
33
|
-
require('./jquery.fileupload-audio'),
|
34
|
-
require('./jquery.fileupload-video'),
|
35
|
-
require('./jquery.fileupload-validate')
|
36
|
-
);
|
37
|
-
} else {
|
38
|
-
factory();
|
39
|
-
}
|
40
|
-
}(function () {
|
41
|
-
'use strict';
|
42
|
-
|
43
|
-
angular.module('blueimp.fileupload', [])
|
44
|
-
|
45
|
-
// The fileUpload service provides configuration options
|
46
|
-
// for the fileUpload directive and default handlers for
|
47
|
-
// File Upload events:
|
48
|
-
.provider('fileUpload', function () {
|
49
|
-
var scopeEvalAsync = function (expression) {
|
50
|
-
var scope = angular.element(this)
|
51
|
-
.fileupload('option', 'scope');
|
52
|
-
// Schedule a new $digest cycle if not already inside of one
|
53
|
-
// and evaluate the given expression:
|
54
|
-
scope.$evalAsync(expression);
|
55
|
-
},
|
56
|
-
addFileMethods = function (scope, data) {
|
57
|
-
var files = data.files,
|
58
|
-
file = files[0];
|
59
|
-
angular.forEach(files, function (file, index) {
|
60
|
-
file._index = index;
|
61
|
-
file.$state = function () {
|
62
|
-
return data.state();
|
63
|
-
};
|
64
|
-
file.$processing = function () {
|
65
|
-
return data.processing();
|
66
|
-
};
|
67
|
-
file.$progress = function () {
|
68
|
-
return data.progress();
|
69
|
-
};
|
70
|
-
file.$response = function () {
|
71
|
-
return data.response();
|
72
|
-
};
|
73
|
-
});
|
74
|
-
file.$submit = function () {
|
75
|
-
if (!file.error) {
|
76
|
-
return data.submit();
|
77
|
-
}
|
78
|
-
};
|
79
|
-
file.$cancel = function () {
|
80
|
-
return data.abort();
|
81
|
-
};
|
82
|
-
},
|
83
|
-
$config;
|
84
|
-
$config = this.defaults = {
|
85
|
-
handleResponse: function (e, data) {
|
86
|
-
var files = data.result && data.result.files;
|
87
|
-
if (files) {
|
88
|
-
data.scope.replace(data.files, files);
|
89
|
-
} else if (data.errorThrown ||
|
90
|
-
data.textStatus === 'error') {
|
91
|
-
data.files[0].error = data.errorThrown ||
|
92
|
-
data.textStatus;
|
93
|
-
}
|
94
|
-
},
|
95
|
-
add: function (e, data) {
|
96
|
-
if (e.isDefaultPrevented()) {
|
97
|
-
return false;
|
98
|
-
}
|
99
|
-
var scope = data.scope,
|
100
|
-
filesCopy = [];
|
101
|
-
angular.forEach(data.files, function (file) {
|
102
|
-
filesCopy.push(file);
|
103
|
-
});
|
104
|
-
scope.$parent.$applyAsync(function () {
|
105
|
-
addFileMethods(scope, data);
|
106
|
-
var method = scope.option('prependFiles') ?
|
107
|
-
'unshift' : 'push';
|
108
|
-
Array.prototype[method].apply(scope.queue, data.files);
|
109
|
-
});
|
110
|
-
data.process(function () {
|
111
|
-
return scope.process(data);
|
112
|
-
}).always(function () {
|
113
|
-
scope.$parent.$applyAsync(function () {
|
114
|
-
addFileMethods(scope, data);
|
115
|
-
scope.replace(filesCopy, data.files);
|
116
|
-
});
|
117
|
-
}).then(function () {
|
118
|
-
if ((scope.option('autoUpload') ||
|
119
|
-
data.autoUpload) &&
|
120
|
-
data.autoUpload !== false) {
|
121
|
-
data.submit();
|
122
|
-
}
|
123
|
-
});
|
124
|
-
},
|
125
|
-
done: function (e, data) {
|
126
|
-
if (e.isDefaultPrevented()) {
|
127
|
-
return false;
|
128
|
-
}
|
129
|
-
var that = this;
|
130
|
-
data.scope.$apply(function () {
|
131
|
-
data.handleResponse.call(that, e, data);
|
132
|
-
});
|
133
|
-
},
|
134
|
-
fail: function (e, data) {
|
135
|
-
if (e.isDefaultPrevented()) {
|
136
|
-
return false;
|
137
|
-
}
|
138
|
-
var that = this,
|
139
|
-
scope = data.scope;
|
140
|
-
if (data.errorThrown === 'abort') {
|
141
|
-
scope.clear(data.files);
|
142
|
-
return;
|
143
|
-
}
|
144
|
-
scope.$apply(function () {
|
145
|
-
data.handleResponse.call(that, e, data);
|
146
|
-
});
|
147
|
-
},
|
148
|
-
stop: scopeEvalAsync,
|
149
|
-
processstart: scopeEvalAsync,
|
150
|
-
processstop: scopeEvalAsync,
|
151
|
-
getNumberOfFiles: function () {
|
152
|
-
var scope = this.scope;
|
153
|
-
return scope.queue.length - scope.processing();
|
154
|
-
},
|
155
|
-
dataType: 'json',
|
156
|
-
autoUpload: false
|
157
|
-
};
|
158
|
-
this.$get = [
|
159
|
-
function () {
|
160
|
-
return {
|
161
|
-
defaults: $config
|
162
|
-
};
|
163
|
-
}
|
164
|
-
];
|
165
|
-
})
|
166
|
-
|
167
|
-
// Format byte numbers to readable presentations:
|
168
|
-
.provider('formatFileSizeFilter', function () {
|
169
|
-
var $config = {
|
170
|
-
// Byte units following the IEC format
|
171
|
-
// http://en.wikipedia.org/wiki/Kilobyte
|
172
|
-
units: [
|
173
|
-
{size: 1000000000, suffix: ' GB'},
|
174
|
-
{size: 1000000, suffix: ' MB'},
|
175
|
-
{size: 1000, suffix: ' KB'}
|
176
|
-
]
|
177
|
-
};
|
178
|
-
this.defaults = $config;
|
179
|
-
this.$get = function () {
|
180
|
-
return function (bytes) {
|
181
|
-
if (!angular.isNumber(bytes)) {
|
182
|
-
return '';
|
183
|
-
}
|
184
|
-
var unit = true,
|
185
|
-
i = 0,
|
186
|
-
prefix,
|
187
|
-
suffix;
|
188
|
-
while (unit) {
|
189
|
-
unit = $config.units[i];
|
190
|
-
prefix = unit.prefix || '';
|
191
|
-
suffix = unit.suffix || '';
|
192
|
-
if (i === $config.units.length - 1 || bytes >= unit.size) {
|
193
|
-
return prefix + (bytes / unit.size).toFixed(2) + suffix;
|
194
|
-
}
|
195
|
-
i += 1;
|
196
|
-
}
|
197
|
-
};
|
198
|
-
};
|
199
|
-
})
|
200
|
-
|
201
|
-
// The FileUploadController initializes the fileupload widget and
|
202
|
-
// provides scope methods to control the File Upload functionality:
|
203
|
-
.controller('FileUploadController', [
|
204
|
-
'$scope', '$element', '$attrs', '$window', 'fileUpload','$q',
|
205
|
-
function ($scope, $element, $attrs, $window, fileUpload, $q) {
|
206
|
-
var uploadMethods = {
|
207
|
-
progress: function () {
|
208
|
-
return $element.fileupload('progress');
|
209
|
-
},
|
210
|
-
active: function () {
|
211
|
-
return $element.fileupload('active');
|
212
|
-
},
|
213
|
-
option: function (option, data) {
|
214
|
-
if (arguments.length === 1) {
|
215
|
-
return $element.fileupload('option', option);
|
216
|
-
}
|
217
|
-
$element.fileupload('option', option, data);
|
218
|
-
},
|
219
|
-
add: function (data) {
|
220
|
-
return $element.fileupload('add', data);
|
221
|
-
},
|
222
|
-
send: function (data) {
|
223
|
-
return $element.fileupload('send', data);
|
224
|
-
},
|
225
|
-
process: function (data) {
|
226
|
-
return $element.fileupload('process', data);
|
227
|
-
},
|
228
|
-
processing: function (data) {
|
229
|
-
return $element.fileupload('processing', data);
|
230
|
-
}
|
231
|
-
};
|
232
|
-
$scope.disabled = !$window.jQuery.support.fileInput;
|
233
|
-
$scope.queue = $scope.queue || [];
|
234
|
-
$scope.clear = function (files) {
|
235
|
-
var queue = this.queue,
|
236
|
-
i = queue.length,
|
237
|
-
file = files,
|
238
|
-
length = 1;
|
239
|
-
if (angular.isArray(files)) {
|
240
|
-
file = files[0];
|
241
|
-
length = files.length;
|
242
|
-
}
|
243
|
-
while (i) {
|
244
|
-
i -= 1;
|
245
|
-
if (queue[i] === file) {
|
246
|
-
return queue.splice(i, length);
|
247
|
-
}
|
248
|
-
}
|
249
|
-
};
|
250
|
-
$scope.replace = function (oldFiles, newFiles) {
|
251
|
-
var queue = this.queue,
|
252
|
-
file = oldFiles[0],
|
253
|
-
i,
|
254
|
-
j;
|
255
|
-
for (i = 0; i < queue.length; i += 1) {
|
256
|
-
if (queue[i] === file) {
|
257
|
-
for (j = 0; j < newFiles.length; j += 1) {
|
258
|
-
queue[i + j] = newFiles[j];
|
259
|
-
}
|
260
|
-
return;
|
261
|
-
}
|
262
|
-
}
|
263
|
-
};
|
264
|
-
$scope.applyOnQueue = function (method) {
|
265
|
-
var list = this.queue.slice(0),
|
266
|
-
i,
|
267
|
-
file,
|
268
|
-
promises = [];
|
269
|
-
for (i = 0; i < list.length; i += 1) {
|
270
|
-
file = list[i];
|
271
|
-
if (file[method]) {
|
272
|
-
promises.push(file[method]());
|
273
|
-
}
|
274
|
-
}
|
275
|
-
return $q.all(promises);
|
276
|
-
};
|
277
|
-
$scope.submit = function () {
|
278
|
-
return this.applyOnQueue('$submit');
|
279
|
-
};
|
280
|
-
$scope.cancel = function () {
|
281
|
-
return this.applyOnQueue('$cancel');
|
282
|
-
};
|
283
|
-
// Add upload methods to the scope:
|
284
|
-
angular.extend($scope, uploadMethods);
|
285
|
-
// The fileupload widget will initialize with
|
286
|
-
// the options provided via "data-"-parameters,
|
287
|
-
// as well as those given via options object:
|
288
|
-
$element.fileupload(angular.extend(
|
289
|
-
{scope: $scope},
|
290
|
-
fileUpload.defaults
|
291
|
-
)).on('fileuploadadd', function (e, data) {
|
292
|
-
data.scope = $scope;
|
293
|
-
}).on('fileuploadfail', function (e, data) {
|
294
|
-
if (data.errorThrown === 'abort') {
|
295
|
-
return;
|
296
|
-
}
|
297
|
-
if (data.dataType &&
|
298
|
-
data.dataType.indexOf('json') === data.dataType.length - 4) {
|
299
|
-
try {
|
300
|
-
data.result = angular.fromJson(data.jqXHR.responseText);
|
301
|
-
} catch (ignore) {}
|
302
|
-
}
|
303
|
-
}).on([
|
304
|
-
'fileuploadadd',
|
305
|
-
'fileuploadsubmit',
|
306
|
-
'fileuploadsend',
|
307
|
-
'fileuploaddone',
|
308
|
-
'fileuploadfail',
|
309
|
-
'fileuploadalways',
|
310
|
-
'fileuploadprogress',
|
311
|
-
'fileuploadprogressall',
|
312
|
-
'fileuploadstart',
|
313
|
-
'fileuploadstop',
|
314
|
-
'fileuploadchange',
|
315
|
-
'fileuploadpaste',
|
316
|
-
'fileuploaddrop',
|
317
|
-
'fileuploaddragover',
|
318
|
-
'fileuploadchunksend',
|
319
|
-
'fileuploadchunkdone',
|
320
|
-
'fileuploadchunkfail',
|
321
|
-
'fileuploadchunkalways',
|
322
|
-
'fileuploadprocessstart',
|
323
|
-
'fileuploadprocess',
|
324
|
-
'fileuploadprocessdone',
|
325
|
-
'fileuploadprocessfail',
|
326
|
-
'fileuploadprocessalways',
|
327
|
-
'fileuploadprocessstop'
|
328
|
-
].join(' '), function (e, data) {
|
329
|
-
$scope.$parent.$applyAsync(function () {
|
330
|
-
if ($scope.$emit(e.type, data).defaultPrevented) {
|
331
|
-
e.preventDefault();
|
332
|
-
}
|
333
|
-
});
|
334
|
-
}).on('remove', function () {
|
335
|
-
// Remove upload methods from the scope,
|
336
|
-
// when the widget is removed:
|
337
|
-
var method;
|
338
|
-
for (method in uploadMethods) {
|
339
|
-
if (uploadMethods.hasOwnProperty(method)) {
|
340
|
-
delete $scope[method];
|
341
|
-
}
|
342
|
-
}
|
343
|
-
});
|
344
|
-
// Observe option changes:
|
345
|
-
$scope.$watch(
|
346
|
-
$attrs.fileUpload,
|
347
|
-
function (newOptions) {
|
348
|
-
if (newOptions) {
|
349
|
-
$element.fileupload('option', newOptions);
|
350
|
-
}
|
351
|
-
}
|
352
|
-
);
|
353
|
-
}
|
354
|
-
])
|
355
|
-
|
356
|
-
// Provide File Upload progress feedback:
|
357
|
-
.controller('FileUploadProgressController', [
|
358
|
-
'$scope', '$attrs', '$parse',
|
359
|
-
function ($scope, $attrs, $parse) {
|
360
|
-
var fn = $parse($attrs.fileUploadProgress),
|
361
|
-
update = function () {
|
362
|
-
var progress = fn($scope);
|
363
|
-
if (!progress || !progress.total) {
|
364
|
-
return;
|
365
|
-
}
|
366
|
-
$scope.num = Math.floor(
|
367
|
-
progress.loaded / progress.total * 100
|
368
|
-
);
|
369
|
-
};
|
370
|
-
update();
|
371
|
-
$scope.$watch(
|
372
|
-
$attrs.fileUploadProgress + '.loaded',
|
373
|
-
function (newValue, oldValue) {
|
374
|
-
if (newValue !== oldValue) {
|
375
|
-
update();
|
376
|
-
}
|
377
|
-
}
|
378
|
-
);
|
379
|
-
}
|
380
|
-
])
|
381
|
-
|
382
|
-
// Display File Upload previews:
|
383
|
-
.controller('FileUploadPreviewController', [
|
384
|
-
'$scope', '$element', '$attrs',
|
385
|
-
function ($scope, $element, $attrs) {
|
386
|
-
$scope.$watch(
|
387
|
-
$attrs.fileUploadPreview + '.preview',
|
388
|
-
function (preview) {
|
389
|
-
$element.empty();
|
390
|
-
if (preview) {
|
391
|
-
$element.append(preview);
|
392
|
-
}
|
393
|
-
}
|
394
|
-
);
|
395
|
-
}
|
396
|
-
])
|
397
|
-
|
398
|
-
.directive('fileUpload', function () {
|
399
|
-
return {
|
400
|
-
controller: 'FileUploadController',
|
401
|
-
scope: true
|
402
|
-
};
|
403
|
-
})
|
404
|
-
|
405
|
-
.directive('fileUploadProgress', function () {
|
406
|
-
return {
|
407
|
-
controller: 'FileUploadProgressController',
|
408
|
-
scope: true
|
409
|
-
};
|
410
|
-
})
|
411
|
-
|
412
|
-
.directive('fileUploadPreview', function () {
|
413
|
-
return {
|
414
|
-
controller: 'FileUploadPreviewController'
|
415
|
-
};
|
416
|
-
})
|
417
|
-
|
418
|
-
// Enhance the HTML5 download attribute to
|
419
|
-
// allow drag&drop of files to the desktop:
|
420
|
-
.directive('download', function () {
|
421
|
-
return function (scope, elm) {
|
422
|
-
elm.on('dragstart', function (e) {
|
423
|
-
try {
|
424
|
-
e.originalEvent.dataTransfer.setData(
|
425
|
-
'DownloadURL',
|
426
|
-
[
|
427
|
-
'application/octet-stream',
|
428
|
-
elm.prop('download'),
|
429
|
-
elm.prop('href')
|
430
|
-
].join(':')
|
431
|
-
);
|
432
|
-
} catch (ignore) {}
|
433
|
-
});
|
434
|
-
};
|
435
|
-
});
|
436
|
-
|
437
|
-
}));
|