gallery/app/assets/javascripts/upload.js

39 lines
1.2 KiB
JavaScript
Executable File

//https://github.com/blueimp/jQuery-File-Upload
$(function () {
'use strict';
// Initialize the jQuery File Upload widget:
$('#fileupload').fileupload({
acceptFileTypes:/(\.|\/)(jpe?g|png)$/i,
headers:{
'X-CSRF-Token': $('meta[name="csrf-token"]').attr("content")
}
});
$('#fileupload').bind("fileuploadadd",function(e,data){$(".fileupload-content").css("background-image","none");})
// Load existing files:
/* $.getJSON($('#fileupload form').prop('action'),{albumid:pagevars['id']}, function (files) {
var fu = $('#fileupload').data('fileupload');
fu._adjustMaxNumberOfFiles(-files.length);
fu._renderDownload(files)
.appendTo($('#fileupload .files'))
.fadeIn(function () {
// Fix for IE7 and lower:
$(this).show();
});
});
*/
// Open download dialogs via iframes,
// to prevent aborting current uploads:
$('#fileupload .files').delegate(
'a:not([target^=_blank])',
'click',
function (e) {
e.preventDefault();
$('<iframe style="display:none;"></iframe>')
.prop('src', this.href)
.appendTo('body');
}
);
});