diff options
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/webbox/html/webbox.js | 80 |
1 files changed, 24 insertions, 56 deletions
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 = "<td class=\"selector\" onclick=\"toggleSelection('" + listElements[i].textContent + "')\">☐</td>"; } - var mouseupdown = - "onmousedown=\"entryMouseDown('" + listElements[i].textContent + "')\" " + - "onmouseup=\"entryMouseUp('" + listElements[i].textContent + "')\""; + var mouse_click = + "onclick=\"entryMouse('" + listElements[i].textContent + "')\""; result += "<tr>" + selector + - "<td class=\"type\" " + mouseupdown + ">" + type + "</td>" + - "<td class=\"name\" " + mouseupdown + ">" + listElements[i].textContent + "</td></tr>"; + "<td class=\"type\" " + mouse_click + ">" + type + "</td>" + + "<td class=\"name\" " + mouse_click + ">" + listElements[i].textContent + "</td></tr>"; } } @@ -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() { |