Allow drag&drop for setting bot avatar image.

(imported from commit e480c1a5efdd08621e80ef3e8653beb5a9f095d8)
This commit is contained in:
Steve Howell 2013-06-25 13:55:22 -04:00
parent 2d888dbb23
commit bb4aafb7b0
1 changed files with 10 additions and 0 deletions

View File

@ -52,6 +52,16 @@ $(function () {
control.replaceWith(new_control);
}
$('#bot_avatar_file_input').on('drop', function(e) {
var files = e.dataTransfer.files;
if (files === null || files === undefined || files.length === 0) {
return false;
}
this.files = files;
e.preventDefault();
return false;
});
$('#bot_avatar_file_input').change(function(e) {
if (e.target.files.length === 0) {
$('#bot_avatar_file_input_error').hide();