aboutsummaryrefslogtreecommitdiffstats
path: root/library/cropperjs/docs/js/main.js
diff options
context:
space:
mode:
Diffstat (limited to 'library/cropperjs/docs/js/main.js')
-rw-r--r--library/cropperjs/docs/js/main.js7
1 files changed, 5 insertions, 2 deletions
diff --git a/library/cropperjs/docs/js/main.js b/library/cropperjs/docs/js/main.js
index d74afbd60..b54ad6453 100644
--- a/library/cropperjs/docs/js/main.js
+++ b/library/cropperjs/docs/js/main.js
@@ -1,5 +1,4 @@
window.onload = function () {
-
'use strict';
var Cropper = window.Cropper;
@@ -49,6 +48,7 @@ window.onload = function () {
var cropper = new Cropper(image, options);
var originalImageURL = image.src;
var uploadedImageType = 'image/jpeg';
+ var uploadedImageName = 'cropped.jpg';
var uploadedImageURL;
// Tooltip
@@ -67,6 +67,7 @@ window.onload = function () {
// Download
if (typeof download.download === 'undefined') {
download.className += ' disabled';
+ download.title = 'Your browser does not support download';
}
// Options
@@ -206,6 +207,7 @@ window.onload = function () {
$('#getCroppedCanvasModal').modal().find('.modal-body').html(result);
if (!download.disabled) {
+ download.download = uploadedImageName;
download.href = result.toDataURL(uploadedImageType);
}
}
@@ -237,7 +239,7 @@ window.onload = function () {
document.body.onkeydown = function (event) {
var e = event || window.event;
- if (!cropper || this.scrollTop > 300) {
+ if (e.target !== this || !cropper || this.scrollTop > 300) {
return;
}
@@ -277,6 +279,7 @@ window.onload = function () {
if (/^image\/\w+/.test(file.type)) {
uploadedImageType = file.type;
+ uploadedImageName = file.name;
if (uploadedImageURL) {
URL.revokeObjectURL(uploadedImageURL);