diff options
-rw-r--r-- | loggedin.js | 39 |
1 files changed, 25 insertions, 14 deletions
diff --git a/loggedin.js b/loggedin.js index be1b04d..c84f650 100644 --- a/loggedin.js +++ b/loggedin.js @@ -218,7 +218,7 @@ function add_file_visuals(fileview) { var img = document.createElement('img'); var filename = document.createElement('div'); - if (fileview.is_directory!=0) { + if (fileview.is_directory) { img.src="/mimeicons/directory.png"; visuals.onclick = () => { pwd.push(fileview.filename); @@ -229,20 +229,22 @@ function add_file_visuals(fileview) { } visuals.oncontextmenu = (e) => { - context(e, [ - ['Open', () => { - if (is_directory) { - pwd.push(fileview.filename); - load_dir(); - } else { - alert('not implemented'); - } - }], - ['Rename', () => { rename_file(fileview.filename); }], - ['Share', () => {alert('not implemented')}], - ['Delete', () => { delete_file(fileview.filename); }], - ]); + if (!dragging) { + context(e, [ + ['Open', () => { + if (fileview.is_directory) { pwd.push(fileview.filename); + load_dir(); + } else { + alert('not implemented'); + } + }], + ['Rename', () => { rename_file(fileview.filename); }], + ['Share', () => {alert('not implemented')}], + ['Delete', () => { delete_file(fileview.filename); }], + ]); + } e.preventDefault(); + e.stopPropagation(); } visuals.ondragstart = (e) => { @@ -321,4 +323,13 @@ document.body.onmouseup = (e) => { end_drag(); } +document.body.oncontextmenu = (e) => { + if (dragging) { + end_drag(); + e.preventDefault(); + } + if (context_menu) + context_menu.remove(); +} + load_dir(); |