From 2715d8e5910304d89a5a1666726aac3b777ad16c Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Mon, 11 May 2020 09:04:32 +0200 Subject: Select only via checkbox --- plugins/webbox/html/webbox.js | 80 +++++++++++++------------------------------ 1 file changed, 24 insertions(+), 56 deletions(-) (limited to 'plugins') diff --git a/plugins/webbox/html/webbox.js b/plugins/webbox/html/webbox.js index a85c0c6..c242037 100644 --- a/plugins/webbox/html/webbox.js +++ b/plugins/webbox/html/webbox.js @@ -54,13 +54,12 @@ function loadContents(dir) { selector = "☐"; } - var mouseupdown = - "onmousedown=\"entryMouseDown('" + listElements[i].textContent + "')\" " + - "onmouseup=\"entryMouseUp('" + listElements[i].textContent + "')\""; + var mouse_click = + "onclick=\"entryMouse('" + listElements[i].textContent + "')\""; result += "" + selector + - "" + type + "" + - "" + listElements[i].textContent + ""; + "" + type + "" + + "" + listElements[i].textContent + ""; } } @@ -125,10 +124,6 @@ function getSelectedFiles() { return result; } -// As long as this is 1, the mouse was pressed less than 1 second ago -var mouseShortFlag = 0; -var mouseTimeout = undefined; - function getSelection(filename) { var row = getRow(filename); @@ -189,59 +184,32 @@ function toggleSelection(filename) { selectorElement.innerHTML = selector_sign; } -function mouseTimeoutFunction(filename) { - mouseShortFlag = 0; - toggleSelection(filename); -} - -function entryMouseDown(filename) { - if (mouseTimeout !== undefined) { - clearTimeout(mouseTimeout); - } - - if (numberOfSelectedRows > 0) { - toggleSelection(filename); - } else { - mouseShortFlag = 1; - mouseTimeout = setTimeout(function(){ mouseTimeoutFunction(filename); }, 1000); - } -} - -function entryMouseUp(filename) { - if (mouseTimeout !== undefined) { - clearTimeout(mouseTimeout); - } - - // short click: download / change dir - if (mouseShortFlag) { - var type = getFileType(filename); - if (type == "file") { - download(filename); - } else if (type == "dir") { - if (filename == "..") { - if (!currentDir.includes("/")) { - // error: this shouldn't happen - alert("Bad path " + currentDir + " for " + filename); - return; - } - currentDir = currentDir.substr(0, currentDir.lastIndexOf("/")); - - if (currentDir == "") { - currentDir = "/"; - } - - setCurrentDir(currentDir); +function entryMouse(filename) { + var type = getFileType(filename); + if (type == "file") { + download(filename); + } else if (type == "dir") { + if (filename == "..") { + if (!currentDir.includes("/")) { + // error: this shouldn't happen + alert("Bad path " + currentDir + " for " + filename); return; } + currentDir = currentDir.substr(0, currentDir.lastIndexOf("/")); - if (!currentDir.endsWith("/")) { - currentDir += "/"; + if (currentDir == "") { + currentDir = "/"; } - setCurrentDir(currentDir + filename); + + setCurrentDir(currentDir); + return; } - } - mouseShortFlag = 0; + if (!currentDir.endsWith("/")) { + currentDir += "/"; + } + setCurrentDir(currentDir + filename); + } } function showDialog() { -- cgit v1.2.3