Skip to content

Commit

Permalink
[js] UX/Perf tiny tune
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Feb 10, 2016
1 parent 89d8668 commit d09694e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 11 deletions.
6 changes: 4 additions & 2 deletions js/elFinder.js
Original file line number Diff line number Diff line change
Expand Up @@ -685,8 +685,7 @@ window.elFinder = function(node, opts) {
this.draggable = {
appendTo : 'body',
addClasses : true,
delay : 30,
distance : 8,
distance : 4,
revert : true,
refreshPositions : false,
cursor : 'crosshair',
Expand Down Expand Up @@ -783,6 +782,9 @@ window.elFinder = function(node, opts) {
tolerance : 'pointer',
accept : '.elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename',
hoverClass : this.res('class', 'adroppable'),
classes : { // Deprecated hoverClass jQueryUI>=1.12.0
'ui-droppable-hover': this.res('class', 'adroppable')
},
autoDisable: true, // elFinder original, see jquery.elfinder.js
drop : function(e, ui) {
var dst = $(this),
Expand Down
25 changes: 16 additions & 9 deletions js/ui/cwd.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,10 +352,12 @@ $.fn.elfindercwd = function(fm, options) {
* @return void
*/
unselectAll = function() {
selectLock = false;
selectedFiles = [];
cwd.find('[id].'+clSelected).trigger(evtUnselect);
trigger();
if (selectedFiles.length) {
selectLock = false;
selectedFiles = [];
cwd.find('[id].'+clSelected).trigger(evtUnselect);
trigger();
}
},

/**
Expand Down Expand Up @@ -434,7 +436,6 @@ $.fn.elfindercwd = function(fm, options) {
selectableOption = {
filter : fileSelector,
stop : trigger,
delay : 250,
selected : function(e, ui) { $(ui.selected).trigger(evtSelect); },
unselected : function(e, ui) { $(ui.unselected).trigger(evtUnselect); }
},
Expand Down Expand Up @@ -901,10 +902,10 @@ $.fn.elfindercwd = function(fm, options) {
// fix ui.selectable bugs and add shift+click support
.on('click.'+fm.namespace, fileSelector, function(e) {
var p = this.id ? $(this) : $(this).parents('[id]:first'),
prev = p.prevAll('.'+clSelected+':first'),
next = p.nextAll('.'+clSelected+':first'),
pl = prev.length,
nl = next.length,
prev,
next,
pl,
nl,
sib;

if (cwd.data('longtap')) {
Expand All @@ -914,6 +915,12 @@ $.fn.elfindercwd = function(fm, options) {

e.stopImmediatePropagation();

if (e.shiftKey) {
prev = p.prevAll('.'+clSelected+':first');
next = p.nextAll('.'+clSelected+':first');
pl = prev.length;
nl = next.length;
}
if (e.shiftKey && (pl || nl)) {
sib = pl ? p.prevUntil('#'+prev.attr('id')) : p.nextUntil('#'+next.attr('id'));
sib.add(p).trigger(evtSelect);
Expand Down
3 changes: 3 additions & 0 deletions js/ui/places.js
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,9 @@ $.fn.elfinderplaces = function(fm, opts) {
tolerance : 'pointer',
accept : '.elfinder-cwd-file-wrapper,.elfinder-tree-dir,.elfinder-cwd-file',
hoverClass : fm.res('class', 'adroppable'),
classes : { // Deprecated hoverClass jQueryUI>=1.12.0
'ui-droppable-hover': fm.res('class', 'adroppable')
},
over : function(e, ui) {
var helper = ui.helper,
dir = $.map(helper.data('files'), function(h) { return (fm.file(h).mime === 'directory' && !dirs[h])? h : null});
Expand Down

0 comments on commit d09694e

Please sign in to comment.