Skip to content

Commit

Permalink
[ui:contextmenu] correction of separator
Browse files Browse the repository at this point in the history
  • Loading branch information
nao-pon committed Aug 4, 2016
1 parent 0e46ed1 commit 110607b
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions js/ui/contextmenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,10 @@ $.fn.elfindercontextmenu = function(fm) {
},

create = function(type, targets) {
var sep = false,
cmdMap = {}, disabled = [], isCwd = (targets[0].indexOf(fm.cwd().volumeid, 0) === 0),
selcnt = 0;
var sep = false,
insSep = false,
cmdMap = {}, disabled = [], isCwd = (targets[0].indexOf(fm.cwd().volumeid, 0) === 0),
selcnt = 0;

if (self.data('cmdMaps')) {
$.each(self.data('cmdMaps'), function(i, v){
Expand Down Expand Up @@ -149,8 +150,10 @@ $.fn.elfindercontextmenu = function(fm) {
$.each(types[type]||[], function(i, name) {
var cmd, node, submenu, hover;

if (name == '|') {
sep = true;
if (name === '|') {
if (sep) {
insSep = true;
}
return;
}

Expand Down Expand Up @@ -273,11 +276,12 @@ $.fn.elfindercontextmenu = function(fm) {
node.children('span.elfinder-button-icon').addClass('elfinder-button-icon-' + cmd.extendsCmd);
}

if (sep) {
if (insSep) {
menu.append('<div class="elfinder-contextmenu-separator"/>');
}
menu.append(node);
sep = false;
sep = true;
insSep = false;
}

if (cmd && typeof cmd.__disabled !== 'undefined') {
Expand Down

0 comments on commit 110607b

Please sign in to comment.