Remove no longer needed special handling for Firefox

The highlighting was removed in Firefox when the cursor was no longer
moving to handle the behaviour of reporting a file drag and then
providing no files in the drop event. That behaviour (which was only
present in Firefox 48 and 49) is already handled with the "dropnofiles"
callback, so that special handling is no longer needed.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
This commit is contained in:
Daniel Calviño Sánchez 2018-06-08 19:07:19 +02:00
parent d8251344c1
commit 463d92c339
1 changed files with 8 additions and 15 deletions

View File

@ -1131,23 +1131,8 @@ OC.Uploader.prototype = _.extend({
self.log('progress handle fileuploadfail', e, data); self.log('progress handle fileuploadfail', e, data);
self.trigger('fail', e, data); self.trigger('fail', e, data);
}); });
var disableDropState = function() {
$('#app-content').removeClass('file-drag');
$('.dropping-to-dir').removeClass('dropping-to-dir');
$('.dir-drop').removeClass('dir-drop');
$('.icon-filetype-folder-drag-accept').removeClass('icon-filetype-folder-drag-accept');
};
var disableClassOnFirefox = _.debounce(function() {
disableDropState();
}, 100);
fileupload.on('fileuploaddragover', function(e){ fileupload.on('fileuploaddragover', function(e){
$('#app-content').addClass('file-drag'); $('#app-content').addClass('file-drag');
// dropping a folder in firefox doesn't cause a drop event
// this is simulated by simply invoke disabling all classes
// once no dragover event isn't noticed anymore
if (/Firefox/i.test(navigator.userAgent)) {
disableClassOnFirefox();
}
$('#emptycontent .icon-folder').addClass('icon-filetype-folder-drag-accept'); $('#emptycontent .icon-folder').addClass('icon-filetype-folder-drag-accept');
var filerow = $(e.delegatedEvent.target).closest('tr'); var filerow = $(e.delegatedEvent.target).closest('tr');
@ -1164,6 +1149,14 @@ OC.Uploader.prototype = _.extend({
filerow.find('.thumbnail').addClass('icon-filetype-folder-drag-accept'); filerow.find('.thumbnail').addClass('icon-filetype-folder-drag-accept');
} }
}); });
var disableDropState = function() {
$('#app-content').removeClass('file-drag');
$('.dropping-to-dir').removeClass('dropping-to-dir');
$('.dir-drop').removeClass('dir-drop');
$('.icon-filetype-folder-drag-accept').removeClass('icon-filetype-folder-drag-accept');
};
fileupload.on('fileuploaddragleave fileuploaddrop', disableDropState); fileupload.on('fileuploaddragleave fileuploaddrop', disableDropState);
// In some browsers the "drop" event can be triggered with no // In some browsers the "drop" event can be triggered with no