jquery-file-upload 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,112 +0,0 @@
1
- /*
2
- * jQuery File Upload Audio Preview Plugin 1.0.4
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
- /* 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('load-image')
29
- );
30
- } else {
31
- // Browser globals:
32
- factory(
33
- window.jQuery,
34
- window.loadImage
35
- );
36
- }
37
- }(function ($, loadImage) {
38
- 'use strict';
39
-
40
- // Prepend to the default processQueue:
41
- $.blueimp.fileupload.prototype.options.processQueue.unshift(
42
- {
43
- action: 'loadAudio',
44
- // Use the action as prefix for the "@" options:
45
- prefix: true,
46
- fileTypes: '@',
47
- maxFileSize: '@',
48
- disabled: '@disableAudioPreview'
49
- },
50
- {
51
- action: 'setAudio',
52
- name: '@audioPreviewName',
53
- disabled: '@disableAudioPreview'
54
- }
55
- );
56
-
57
- // The File Upload Audio Preview plugin extends the fileupload widget
58
- // with audio preview functionality:
59
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
60
-
61
- options: {
62
- // The regular expression for the types of audio files to load,
63
- // matched against the file type:
64
- loadAudioFileTypes: /^audio\/.*$/
65
- },
66
-
67
- _audioElement: document.createElement('audio'),
68
-
69
- processActions: {
70
-
71
- // Loads the audio file given via data.files and data.index
72
- // as audio element if the browser supports playing it.
73
- // Accepts the options fileTypes (regular expression)
74
- // and maxFileSize (integer) to limit the files to load:
75
- loadAudio: function (data, options) {
76
- if (options.disabled) {
77
- return data;
78
- }
79
- var file = data.files[data.index],
80
- url,
81
- audio;
82
- if (this._audioElement.canPlayType &&
83
- this._audioElement.canPlayType(file.type) &&
84
- ($.type(options.maxFileSize) !== 'number' ||
85
- file.size <= options.maxFileSize) &&
86
- (!options.fileTypes ||
87
- options.fileTypes.test(file.type))) {
88
- url = loadImage.createObjectURL(file);
89
- if (url) {
90
- audio = this._audioElement.cloneNode(false);
91
- audio.src = url;
92
- audio.controls = true;
93
- data.audio = audio;
94
- return data;
95
- }
96
- }
97
- return data;
98
- },
99
-
100
- // Sets the audio element as a property of the file object:
101
- setAudio: function (data, options) {
102
- if (data.audio && !options.disabled) {
103
- data.files[data.index][options.name || 'preview'] = data.audio;
104
- }
105
- return data;
106
- }
107
-
108
- }
109
-
110
- });
111
-
112
- }));
@@ -1,112 +0,0 @@
1
- /*
2
- * jQuery File Upload Video Preview Plugin 1.0.4
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
- /* 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('load-image')
29
- );
30
- } else {
31
- // Browser globals:
32
- factory(
33
- window.jQuery,
34
- window.loadImage
35
- );
36
- }
37
- }(function ($, loadImage) {
38
- 'use strict';
39
-
40
- // Prepend to the default processQueue:
41
- $.blueimp.fileupload.prototype.options.processQueue.unshift(
42
- {
43
- action: 'loadVideo',
44
- // Use the action as prefix for the "@" options:
45
- prefix: true,
46
- fileTypes: '@',
47
- maxFileSize: '@',
48
- disabled: '@disableVideoPreview'
49
- },
50
- {
51
- action: 'setVideo',
52
- name: '@videoPreviewName',
53
- disabled: '@disableVideoPreview'
54
- }
55
- );
56
-
57
- // The File Upload Video Preview plugin extends the fileupload widget
58
- // with video preview functionality:
59
- $.widget('blueimp.fileupload', $.blueimp.fileupload, {
60
-
61
- options: {
62
- // The regular expression for the types of video files to load,
63
- // matched against the file type:
64
- loadVideoFileTypes: /^video\/.*$/
65
- },
66
-
67
- _videoElement: document.createElement('video'),
68
-
69
- processActions: {
70
-
71
- // Loads the video file given via data.files and data.index
72
- // as video element if the browser supports playing it.
73
- // Accepts the options fileTypes (regular expression)
74
- // and maxFileSize (integer) to limit the files to load:
75
- loadVideo: function (data, options) {
76
- if (options.disabled) {
77
- return data;
78
- }
79
- var file = data.files[data.index],
80
- url,
81
- video;
82
- if (this._videoElement.canPlayType &&
83
- this._videoElement.canPlayType(file.type) &&
84
- ($.type(options.maxFileSize) !== 'number' ||
85
- file.size <= options.maxFileSize) &&
86
- (!options.fileTypes ||
87
- options.fileTypes.test(file.type))) {
88
- url = loadImage.createObjectURL(file);
89
- if (url) {
90
- video = this._videoElement.cloneNode(false);
91
- video.src = url;
92
- video.controls = true;
93
- data.video = video;
94
- return data;
95
- }
96
- }
97
- return data;
98
- },
99
-
100
- // Sets the video element as a property of the file object:
101
- setVideo: function (data, options) {
102
- if (data.video && !options.disabled) {
103
- data.files[data.index][options.name || 'preview'] = data.video;
104
- }
105
- return data;
106
- }
107
-
108
- }
109
-
110
- });
111
-
112
- }));