Skip to content

Commit 20103d3

Browse files
committed
Added missing dependencies
1 parent 29722ed commit 20103d3

File tree

4 files changed

+288
-0
lines changed

4 files changed

+288
-0
lines changed

vendor/assets/javascripts/jquery-fileupload/index.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
//=require jquery-fileupload/vendor/jquery.ui.widget
2+
//=require jquery-fileupload/vendor/load-image
3+
//=require jquery-fileupload/vendor/canvas-to-blob
4+
//=require jquery-fileupload/vendor/tmpl
25
//=require jquery-fileupload/jquery.iframe-transport
36
//=require jquery-fileupload/jquery.fileupload
47
//=require jquery-fileupload/jquery.fileupload-ip
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* JavaScript Canvas to Blob 1.0.1
3+
* https://github.com/blueimp/JavaScript-Canvas-to-Blob
4+
*
5+
* Copyright 2012, Sebastian Tschan
6+
* https://blueimp.net
7+
*
8+
* Licensed under the MIT license:
9+
* http://www.opensource.org/licenses/MIT
10+
*
11+
* Based on stackoverflow user Stoive's code snippet:
12+
* http://stackoverflow.com/q/4998908
13+
*/
14+
15+
/*jslint nomen: true, regexp: true */
16+
/*global window, atob, ArrayBuffer, Uint8Array, define */
17+
18+
(function ($) {
19+
'use strict';
20+
21+
var BlobBuilder = window.MozBlobBuilder ||
22+
window.WebKitBlobBuilder || window.BlobBuilder,
23+
blobTypes = /^image\/(jpeg|png)$/,
24+
25+
// Converts a canvas element to a Blob or File object:
26+
canvasToBlob = function (canvas, callback, options) {
27+
options = options || {};
28+
if (canvas.toBlob) {
29+
canvas.toBlob(callback, options.type);
30+
return true;
31+
} else if (canvas.mozGetAsFile) {
32+
var name = options.name;
33+
callback(canvas.mozGetAsFile(
34+
(blobTypes.test(options.type) && name) ||
35+
((name && name.replace(/\..+$/, '')) || 'blob') + '.png',
36+
options.type
37+
));
38+
return true;
39+
} else if (canvas.toDataURL && BlobBuilder && window.atob &&
40+
window.ArrayBuffer && window.Uint8Array) {
41+
callback(canvasToBlob.dataURItoBlob(
42+
canvas.toDataURL(options.type)
43+
));
44+
return true;
45+
}
46+
return false;
47+
};
48+
49+
// Converts a dataURI to a Blob:
50+
canvasToBlob.dataURItoBlob = function (dataURI) {
51+
var byteString,
52+
arrayBuffer,
53+
intArray,
54+
i,
55+
bb,
56+
mimeString;
57+
if (dataURI.split(',')[0].indexOf('base64') >= 0) {
58+
// Convert base64 to raw binary data held in a string:
59+
byteString = atob(dataURI.split(',')[1]);
60+
} else {
61+
// Convert base64/URLEncoded data component to raw binary data:
62+
byteString = decodeURIComponent(dataURI.split(',')[1]);
63+
}
64+
// Write the bytes of the string to an ArrayBuffer:
65+
arrayBuffer = new ArrayBuffer(byteString.length);
66+
intArray = new Uint8Array(arrayBuffer);
67+
for (i = 0; i < byteString.length; i += 1) {
68+
intArray[i] = byteString.charCodeAt(i);
69+
}
70+
// Write the ArrayBuffer to a blob:
71+
bb = new BlobBuilder();
72+
bb.append(arrayBuffer);
73+
// Separate out the mime component:
74+
mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
75+
return bb.getBlob(mimeString);
76+
};
77+
78+
if (typeof define !== 'undefined' && define.amd) {
79+
define(function () {
80+
return canvasToBlob;
81+
});
82+
} else {
83+
$.canvasToBlob = canvasToBlob;
84+
}
85+
}(this));
Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
/*
2+
* JavaScript Load Image 1.1.4
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) {
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+
} else {
44+
return loadImage.readFile(file, function (url) {
45+
img.src = url;
46+
});
47+
}
48+
},
49+
urlAPI = (window.createObjectURL && window) ||
50+
(window.URL && URL) || (window.webkitURL && webkitURL);
51+
52+
// Scales the given image (img HTML element)
53+
// using the given options.
54+
// Returns a canvas object if the canvas option is true
55+
// and the browser supports canvas, else the scaled image:
56+
loadImage.scale = function (img, options) {
57+
options = options || {};
58+
var canvas = document.createElement('canvas'),
59+
scale = Math.max(
60+
(options.minWidth || img.width) / img.width,
61+
(options.minHeight || img.height) / img.height
62+
);
63+
if (scale > 1) {
64+
img.width = parseInt(img.width * scale, 10);
65+
img.height = parseInt(img.height * scale, 10);
66+
}
67+
scale = Math.min(
68+
(options.maxWidth || img.width) / img.width,
69+
(options.maxHeight || img.height) / img.height
70+
);
71+
if (scale < 1) {
72+
img.width = parseInt(img.width * scale, 10);
73+
img.height = parseInt(img.height * scale, 10);
74+
}
75+
if (!options.canvas || !canvas.getContext) {
76+
return img;
77+
}
78+
canvas.width = img.width;
79+
canvas.height = img.height;
80+
canvas.getContext('2d')
81+
.drawImage(img, 0, 0, img.width, img.height);
82+
return canvas;
83+
};
84+
85+
loadImage.createObjectURL = function (file) {
86+
return urlAPI ? urlAPI.createObjectURL(file) : false;
87+
};
88+
89+
loadImage.revokeObjectURL = function (url) {
90+
return urlAPI ? urlAPI.revokeObjectURL(url) : false;
91+
};
92+
93+
// Loads a given File object via FileReader interface,
94+
// invokes the callback with a data url:
95+
loadImage.readFile = function (file, callback) {
96+
if (window.FileReader && FileReader.prototype.readAsDataURL) {
97+
var fileReader = new FileReader();
98+
fileReader.onload = function (e) {
99+
callback(e.target.result);
100+
};
101+
fileReader.readAsDataURL(file);
102+
return fileReader;
103+
}
104+
return false;
105+
};
106+
107+
if (typeof define !== 'undefined' && define.amd) {
108+
define(function () {
109+
return loadImage;
110+
});
111+
} else {
112+
$.loadImage = loadImage;
113+
}
114+
}(this));
Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
"<" : "&lt;",
63+
">" : "&gt;",
64+
"&" : "&amp;",
65+
"\"" : "&quot;",
66+
"'" : "&#39;"
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 commit comments

Comments
 (0)