mirror of
https://github.com/Studio-42/elFinder
synced 2026-06-08 12:37:09 +00:00
29 lines
662 B
JavaScript
29 lines
662 B
JavaScript
"use strict";
|
|
/**
|
|
* @class elFinder toolbar's button tor upload file
|
|
*
|
|
* @author Dmitry (dio) Levashov
|
|
**/
|
|
$.fn.elfinderuploadbutton = function(cmd) {
|
|
return this.each(function() {
|
|
var button = $(this).elfinderbutton(cmd)
|
|
.unbind('click'),
|
|
form = $('<form/>').appendTo(button),
|
|
input = $('<input type="file" multiple="true"/>')
|
|
.change(function() {
|
|
var _input = $(this);
|
|
if (_input.val()) {
|
|
cmd.exec({input : _input.remove()[0]});
|
|
input.clone(true).appendTo(form);
|
|
}
|
|
});
|
|
|
|
form.append(input.clone(true));
|
|
|
|
cmd.change(function() {
|
|
form[cmd.disabled() ? 'hide' : 'show']();
|
|
})
|
|
.change();
|
|
});
|
|
}
|