jquery-fileupload-requirejs-rails 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/MIT-LICENSE +20 -0
- data/README.md +3 -0
- data/Rakefile +27 -0
- data/app/assets/images/loading.gif +0 -0
- data/app/assets/images/progressbar.gif +0 -0
- data/app/assets/javascripts/jquery-fileupload/basic.js +4 -0
- data/app/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js +111 -0
- data/app/assets/javascripts/jquery-fileupload/cors/jquery.xdr-transport.js +80 -0
- data/app/assets/javascripts/jquery-fileupload/index.js +9 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js +210 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js +782 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.fileupload.js +1156 -0
- data/app/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js +179 -0
- data/app/assets/javascripts/jquery-fileupload/locale.js +29 -0
- data/app/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js +91 -0
- data/app/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js +533 -0
- data/app/assets/javascripts/jquery-fileupload/vendor/load-image.js +121 -0
- data/app/assets/javascripts/jquery-fileupload/vendor/tmpl.js +86 -0
- data/app/assets/stylesheets/jquery.fileupload-ui.scss +84 -0
- data/lib/jquery-fileupload-requirejs-rails.rb +4 -0
- data/lib/jquery-fileupload-requirejs-rails/engine.rb +4 -0
- data/lib/jquery-fileupload-requirejs-rails/version.rb +3 -0
- data/lib/tasks/jquery-fileupload-requirejs-rails_tasks.rake +4 -0
- metadata +170 -0
@@ -0,0 +1,121 @@
|
|
1
|
+
/*
|
2
|
+
* JavaScript Load Image 1.2.1
|
3
|
+
* https://github.com/blueimp/JavaScript-Load-Image
|
4
|
+
*
|
5
|
+
* Copyright 2011, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*/
|
11
|
+
|
12
|
+
/*jslint nomen: true */
|
13
|
+
/*global window, document, URL, webkitURL, Blob, File, FileReader, define */
|
14
|
+
|
15
|
+
(function ($) {
|
16
|
+
'use strict';
|
17
|
+
|
18
|
+
// Loads an image for a given File object.
|
19
|
+
// Invokes the callback with an img or optional canvas
|
20
|
+
// element (if supported by the browser) as parameter:
|
21
|
+
var loadImage = function (file, callback, options) {
|
22
|
+
var img = document.createElement('img'),
|
23
|
+
url,
|
24
|
+
oUrl;
|
25
|
+
img.onerror = callback;
|
26
|
+
img.onload = function () {
|
27
|
+
if (oUrl && !(options && options.noRevoke)) {
|
28
|
+
loadImage.revokeObjectURL(oUrl);
|
29
|
+
}
|
30
|
+
callback(loadImage.scale(img, options));
|
31
|
+
};
|
32
|
+
if ((window.Blob && file instanceof Blob) ||
|
33
|
+
// Files are also Blob instances, but some browsers
|
34
|
+
// (Firefox 3.6) support the File API but not Blobs:
|
35
|
+
(window.File && file instanceof File)) {
|
36
|
+
url = oUrl = loadImage.createObjectURL(file);
|
37
|
+
} else {
|
38
|
+
url = file;
|
39
|
+
}
|
40
|
+
if (url) {
|
41
|
+
img.src = url;
|
42
|
+
return img;
|
43
|
+
}
|
44
|
+
return loadImage.readFile(file, function (url) {
|
45
|
+
img.src = url;
|
46
|
+
});
|
47
|
+
},
|
48
|
+
// The check for URL.revokeObjectURL fixes an issue with Opera 12,
|
49
|
+
// which provides URL.createObjectURL but doesn't properly implement it:
|
50
|
+
urlAPI = (window.createObjectURL && window) ||
|
51
|
+
(window.URL && URL.revokeObjectURL && URL) ||
|
52
|
+
(window.webkitURL && webkitURL);
|
53
|
+
|
54
|
+
// Scales the given image (img or canvas HTML element)
|
55
|
+
// using the given options.
|
56
|
+
// Returns a canvas object if the browser supports canvas
|
57
|
+
// and the canvas option is true or a canvas object is passed
|
58
|
+
// as image, else the scaled image:
|
59
|
+
loadImage.scale = function (img, options) {
|
60
|
+
options = options || {};
|
61
|
+
var canvas = document.createElement('canvas'),
|
62
|
+
width = img.width,
|
63
|
+
height = img.height,
|
64
|
+
scale = Math.max(
|
65
|
+
(options.minWidth || width) / width,
|
66
|
+
(options.minHeight || height) / height
|
67
|
+
);
|
68
|
+
if (scale > 1) {
|
69
|
+
width = parseInt(width * scale, 10);
|
70
|
+
height = parseInt(height * scale, 10);
|
71
|
+
}
|
72
|
+
scale = Math.min(
|
73
|
+
(options.maxWidth || width) / width,
|
74
|
+
(options.maxHeight || height) / height
|
75
|
+
);
|
76
|
+
if (scale < 1) {
|
77
|
+
width = parseInt(width * scale, 10);
|
78
|
+
height = parseInt(height * scale, 10);
|
79
|
+
}
|
80
|
+
if (img.getContext || (options.canvas && canvas.getContext)) {
|
81
|
+
canvas.width = width;
|
82
|
+
canvas.height = height;
|
83
|
+
canvas.getContext('2d')
|
84
|
+
.drawImage(img, 0, 0, width, height);
|
85
|
+
return canvas;
|
86
|
+
}
|
87
|
+
img.width = width;
|
88
|
+
img.height = height;
|
89
|
+
return img;
|
90
|
+
};
|
91
|
+
|
92
|
+
loadImage.createObjectURL = function (file) {
|
93
|
+
return urlAPI ? urlAPI.createObjectURL(file) : false;
|
94
|
+
};
|
95
|
+
|
96
|
+
loadImage.revokeObjectURL = function (url) {
|
97
|
+
return urlAPI ? urlAPI.revokeObjectURL(url) : false;
|
98
|
+
};
|
99
|
+
|
100
|
+
// Loads a given File object via FileReader interface,
|
101
|
+
// invokes the callback with a data url:
|
102
|
+
loadImage.readFile = function (file, callback) {
|
103
|
+
if (window.FileReader && FileReader.prototype.readAsDataURL) {
|
104
|
+
var fileReader = new FileReader();
|
105
|
+
fileReader.onload = function (e) {
|
106
|
+
callback(e.target.result);
|
107
|
+
};
|
108
|
+
fileReader.readAsDataURL(file);
|
109
|
+
return fileReader;
|
110
|
+
}
|
111
|
+
return false;
|
112
|
+
};
|
113
|
+
|
114
|
+
if (typeof define === 'function' && define.amd) {
|
115
|
+
define(function () {
|
116
|
+
return loadImage;
|
117
|
+
});
|
118
|
+
} else {
|
119
|
+
$.loadImage = loadImage;
|
120
|
+
}
|
121
|
+
}(this));
|
@@ -0,0 +1,86 @@
|
|
1
|
+
/*
|
2
|
+
* JavaScript Templates 2.1.0
|
3
|
+
* https://github.com/blueimp/JavaScript-Templates
|
4
|
+
*
|
5
|
+
* Copyright 2011, Sebastian Tschan
|
6
|
+
* https://blueimp.net
|
7
|
+
*
|
8
|
+
* Licensed under the MIT license:
|
9
|
+
* http://www.opensource.org/licenses/MIT
|
10
|
+
*
|
11
|
+
* Inspired by John Resig's JavaScript Micro-Templating:
|
12
|
+
* http://ejohn.org/blog/javascript-micro-templating/
|
13
|
+
*/
|
14
|
+
|
15
|
+
/*jslint evil: true, regexp: true */
|
16
|
+
/*global document, define */
|
17
|
+
|
18
|
+
(function ($) {
|
19
|
+
"use strict";
|
20
|
+
var tmpl = function (str, data) {
|
21
|
+
var f = !/[^\w\-\.:]/.test(str) ? tmpl.cache[str] = tmpl.cache[str] ||
|
22
|
+
tmpl(tmpl.load(str)) :
|
23
|
+
new Function(
|
24
|
+
tmpl.arg + ',tmpl',
|
25
|
+
"var _e=tmpl.encode" + tmpl.helper + ",_s='" +
|
26
|
+
str.replace(tmpl.regexp, tmpl.func) +
|
27
|
+
"';return _s;"
|
28
|
+
);
|
29
|
+
return data ? f(data, tmpl) : function (data) {
|
30
|
+
return f(data, tmpl);
|
31
|
+
};
|
32
|
+
};
|
33
|
+
tmpl.cache = {};
|
34
|
+
tmpl.load = function (id) {
|
35
|
+
return document.getElementById(id).innerHTML;
|
36
|
+
};
|
37
|
+
tmpl.regexp = /([\s'\\])(?![^%]*%\})|(?:\{%(=|#)([\s\S]+?)%\})|(\{%)|(%\})/g;
|
38
|
+
tmpl.func = function (s, p1, p2, p3, p4, p5) {
|
39
|
+
if (p1) { // whitespace, quote and backspace in interpolation context
|
40
|
+
return {
|
41
|
+
"\n": "\\n",
|
42
|
+
"\r": "\\r",
|
43
|
+
"\t": "\\t",
|
44
|
+
" " : " "
|
45
|
+
}[s] || "\\" + s;
|
46
|
+
}
|
47
|
+
if (p2) { // interpolation: {%=prop%}, or unescaped: {%#prop%}
|
48
|
+
if (p2 === "=") {
|
49
|
+
return "'+_e(" + p3 + ")+'";
|
50
|
+
}
|
51
|
+
return "'+(" + p3 + "||'')+'";
|
52
|
+
}
|
53
|
+
if (p4) { // evaluation start tag: {%
|
54
|
+
return "';";
|
55
|
+
}
|
56
|
+
if (p5) { // evaluation end tag: %}
|
57
|
+
return "_s+='";
|
58
|
+
}
|
59
|
+
};
|
60
|
+
tmpl.encReg = /[<>&"'\x00]/g;
|
61
|
+
tmpl.encMap = {
|
62
|
+
"<" : "<",
|
63
|
+
">" : ">",
|
64
|
+
"&" : "&",
|
65
|
+
"\"" : """,
|
66
|
+
"'" : "'"
|
67
|
+
};
|
68
|
+
tmpl.encode = function (s) {
|
69
|
+
return String(s || "").replace(
|
70
|
+
tmpl.encReg,
|
71
|
+
function (c) {
|
72
|
+
return tmpl.encMap[c] || "";
|
73
|
+
}
|
74
|
+
);
|
75
|
+
};
|
76
|
+
tmpl.arg = "o";
|
77
|
+
tmpl.helper = ",print=function(s,e){_s+=e&&(s||'')||_e(s);}" +
|
78
|
+
",include=function(s,d){_s+=tmpl(s,d);}";
|
79
|
+
if (typeof define === "function" && define.amd) {
|
80
|
+
define(function () {
|
81
|
+
return tmpl;
|
82
|
+
});
|
83
|
+
} else {
|
84
|
+
$.tmpl = tmpl;
|
85
|
+
}
|
86
|
+
}(this));
|
@@ -0,0 +1,84 @@
|
|
1
|
+
@charset 'UTF-8';
|
2
|
+
/*
|
3
|
+
* jQuery File Upload UI Plugin CSS 6.3
|
4
|
+
* https://github.com/blueimp/jQuery-File-Upload
|
5
|
+
*
|
6
|
+
* Copyright 2010, Sebastian Tschan
|
7
|
+
* https://blueimp.net
|
8
|
+
*
|
9
|
+
* Licensed under the MIT license:
|
10
|
+
* http://www.opensource.org/licenses/MIT
|
11
|
+
*/
|
12
|
+
|
13
|
+
.fileinput-button {
|
14
|
+
position: relative;
|
15
|
+
overflow: hidden;
|
16
|
+
float: left;
|
17
|
+
margin-right: 4px;
|
18
|
+
}
|
19
|
+
.fileinput-button input {
|
20
|
+
position: absolute;
|
21
|
+
top: 0;
|
22
|
+
right: 0;
|
23
|
+
margin: 0;
|
24
|
+
border: solid transparent;
|
25
|
+
border-width: 0 0 100px 200px;
|
26
|
+
opacity: 0;
|
27
|
+
filter: alpha(opacity=0);
|
28
|
+
-moz-transform: translate(-300px, 0) scale(4);
|
29
|
+
direction: ltr;
|
30
|
+
cursor: pointer;
|
31
|
+
}
|
32
|
+
.fileupload-buttonbar .btn,
|
33
|
+
.fileupload-buttonbar .toggle {
|
34
|
+
margin-bottom: 5px;
|
35
|
+
}
|
36
|
+
.files .progress {
|
37
|
+
width: 200px;
|
38
|
+
}
|
39
|
+
.progress-animated .bar {
|
40
|
+
background: image-url('progressbar.gif') !important;
|
41
|
+
filter: none;
|
42
|
+
}
|
43
|
+
.fileupload-loading {
|
44
|
+
position: absolute;
|
45
|
+
left: 50%;
|
46
|
+
width: 128px;
|
47
|
+
height: 128px;
|
48
|
+
background: image-url('loading.gif') center no-repeat;
|
49
|
+
display: none;
|
50
|
+
}
|
51
|
+
.fileupload-processing .fileupload-loading {
|
52
|
+
display: block;
|
53
|
+
}
|
54
|
+
|
55
|
+
/* Fix for IE 6: */
|
56
|
+
* html .fileinput-button {
|
57
|
+
line-height: 22px;
|
58
|
+
margin: 1px -3px 0 0;
|
59
|
+
}
|
60
|
+
|
61
|
+
/* Fix for IE 7: */
|
62
|
+
* + html .fileinput-button {
|
63
|
+
margin: 1px 0 0 0;
|
64
|
+
}
|
65
|
+
|
66
|
+
@media (max-width: 480px) {
|
67
|
+
.files .btn span {
|
68
|
+
display: none;
|
69
|
+
}
|
70
|
+
.files .preview * {
|
71
|
+
width: 40px;
|
72
|
+
}
|
73
|
+
.files .name * {
|
74
|
+
width: 80px;
|
75
|
+
display: inline-block;
|
76
|
+
word-wrap: break-word;
|
77
|
+
}
|
78
|
+
.files .progress {
|
79
|
+
width: 20px;
|
80
|
+
}
|
81
|
+
.files .delete {
|
82
|
+
width: 60px;
|
83
|
+
}
|
84
|
+
}
|
metadata
ADDED
@@ -0,0 +1,170 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: jquery-fileupload-requirejs-rails
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Bogumil Wrona
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-05-08 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: railties
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '3.1'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.1'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: actionpack
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: '3.1'
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '3.1'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: requirejs-rails
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: jquery-rails
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ! '>='
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0'
|
70
|
+
type: :runtime
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ! '>='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: jqueryui-requirejs-rails
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
81
|
+
none: false
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
type: :runtime
|
87
|
+
prerelease: false
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
89
|
+
none: false
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rails
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '3.1'
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '3.1'
|
110
|
+
description: jQuery File Upload by Sebastian Tschan integrated with requirejs-rails
|
111
|
+
email:
|
112
|
+
- b.wrona@cre8newmedia.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files: []
|
116
|
+
files:
|
117
|
+
- app/assets/images/loading.gif
|
118
|
+
- app/assets/images/progressbar.gif
|
119
|
+
- app/assets/javascripts/jquery-fileupload/basic.js
|
120
|
+
- app/assets/javascripts/jquery-fileupload/cors/jquery.postmessage-transport.js
|
121
|
+
- app/assets/javascripts/jquery-fileupload/cors/jquery.xdr-transport.js
|
122
|
+
- app/assets/javascripts/jquery-fileupload/index.js
|
123
|
+
- app/assets/javascripts/jquery-fileupload/jquery.fileupload-fp.js
|
124
|
+
- app/assets/javascripts/jquery-fileupload/jquery.fileupload-ui.js
|
125
|
+
- app/assets/javascripts/jquery-fileupload/jquery.fileupload.js
|
126
|
+
- app/assets/javascripts/jquery-fileupload/jquery.iframe-transport.js
|
127
|
+
- app/assets/javascripts/jquery-fileupload/locale.js
|
128
|
+
- app/assets/javascripts/jquery-fileupload/vendor/canvas-to-blob.js
|
129
|
+
- app/assets/javascripts/jquery-fileupload/vendor/jquery.ui.widget.js
|
130
|
+
- app/assets/javascripts/jquery-fileupload/vendor/load-image.js
|
131
|
+
- app/assets/javascripts/jquery-fileupload/vendor/tmpl.js
|
132
|
+
- app/assets/stylesheets/jquery.fileupload-ui.scss
|
133
|
+
- lib/jquery-fileupload-requirejs-rails/engine.rb
|
134
|
+
- lib/jquery-fileupload-requirejs-rails/version.rb
|
135
|
+
- lib/jquery-fileupload-requirejs-rails.rb
|
136
|
+
- lib/tasks/jquery-fileupload-requirejs-rails_tasks.rake
|
137
|
+
- MIT-LICENSE
|
138
|
+
- Rakefile
|
139
|
+
- README.md
|
140
|
+
homepage: https://github.com/bogwro/jquery-fileupload-requirejs-rails
|
141
|
+
licenses: []
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
none: false
|
148
|
+
requirements:
|
149
|
+
- - ! '>='
|
150
|
+
- !ruby/object:Gem::Version
|
151
|
+
version: '0'
|
152
|
+
segments:
|
153
|
+
- 0
|
154
|
+
hash: 4173153806107742894
|
155
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
|
+
none: false
|
157
|
+
requirements:
|
158
|
+
- - ! '>='
|
159
|
+
- !ruby/object:Gem::Version
|
160
|
+
version: '0'
|
161
|
+
segments:
|
162
|
+
- 0
|
163
|
+
hash: 4173153806107742894
|
164
|
+
requirements: []
|
165
|
+
rubyforge_project:
|
166
|
+
rubygems_version: 1.8.25
|
167
|
+
signing_key:
|
168
|
+
specification_version: 3
|
169
|
+
summary: jQuery File Upload integrated with RequireJS
|
170
|
+
test_files: []
|