summaryrefslogtreecommitdiffhomepage
path: root/plugins
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2020-05-11 09:04:32 +0200
committerRoland Reichwein <mail@reichwein.it>2020-05-11 09:04:32 +0200
commit2715d8e5910304d89a5a1666726aac3b777ad16c (patch)
treedc35f4e0f08fc149ae9a78d00180a6031902682e /plugins
parent416049602fdbca6346a0e79e676cebbfbd65e905 (diff)
Select only via checkbox
Diffstat (limited to 'plugins')
-rw-r--r--plugins/webbox/html/webbox.js80
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 + "')\">&#9744;</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() {