diff options
author | Alex Vitkov <alexvitkov98@gmail.com> | 2021-02-13 00:01:53 +0200 |
---|---|---|
committer | Alex Vitkov <alexvitkov98@gmail.com> | 2021-02-13 00:01:53 +0200 |
commit | a6cedb9c67284ebdf7e475c1b9fdab63b5a44c79 (patch) | |
tree | 6bd5ebaa21f652de3bf918ce2cf7893e9ee2a59e /loggedin.js | |
parent | ae561431cb747e2d629cb714847251a6d075a0ca (diff) | |
download | fileup-a6cedb9c67284ebdf7e475c1b9fdab63b5a44c79.tar.gz |
Minor UI tweaks
Diffstat (limited to 'loggedin.js')
-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(); |