diff options
Diffstat (limited to 'plugins/webbox/html/webbox.js')
-rw-r--r-- | plugins/webbox/html/webbox.js | 28 |
1 files changed, 18 insertions, 10 deletions
diff --git a/plugins/webbox/html/webbox.js b/plugins/webbox/html/webbox.js index cad32b1..963491d 100644 --- a/plugins/webbox/html/webbox.js +++ b/plugins/webbox/html/webbox.js @@ -80,10 +80,11 @@ function loadContents(dir) { type = ""; } - var selector = "<td class=\"selector\"></td>"; + var selector = "<td class=\"selector\""; if (filename != "..") { - selector = "<td class=\"selector\" onclick=\"toggleSelection('" + filename + "')\">☐</td>"; + selector += " onclick=\"toggleSelection('" + filename + "')\"><img src=\"webbox-html/checkbox.png\"/><img src=\"webbox-html/checkbox-checked.png\" hidden/"; } + selector += "></td>"; result += "<tr>" + selector + @@ -163,6 +164,16 @@ function getSelection(filename) { return false; } +function clearSelector(element) { + element.childNodes[0].style.display = 'block'; + element.childNodes[1].style.display = 'none'; +} + +function setSelector(element) { + element.childNodes[0].style.display = 'none'; + element.childNodes[1].style.display = 'block'; +} + function clearSelection(filename) { var row = getRow(filename); @@ -172,7 +183,7 @@ function clearSelection(filename) { } var selectorElement = row.getElementsByClassName("selector")[0]; - selectorElement.innerHTML = "☐"; + clearSelector(selectorElement); } function setSelection(filename) { @@ -188,7 +199,7 @@ function setSelection(filename) { } var selectorElement = row.getElementsByClassName("selector")[0]; - selectorElement.innerHTML = "☑"; + setSelector(selectorElement); } function toggleSelection(filename) { @@ -198,20 +209,17 @@ function toggleSelection(filename) { var row = getRow(filename); - var selector_sign; + var selectorElement = row.getElementsByClassName("selector")[0]; if (row.classList.contains("selectedrow")) { row.classList.remove("selectedrow"); numberOfSelectedRows--; - selector_sign = "☐" + clearSelector(selectorElement); } else { row.classList.add("selectedrow"); numberOfSelectedRows++; - selector_sign = "☑" + setSelector(selectorElement); } - - var selectorElement = row.getElementsByClassName("selector")[0]; - selectorElement.innerHTML = selector_sign; } function entryMouse(filename) { |