summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBent Bisballe Nyeng <deva@aasimon.org>2012-05-18 14:52:20 +0200
committerBent Bisballe Nyeng <deva@aasimon.org>2012-05-18 14:52:20 +0200
commit9818ab31e050f9389e4ebf76ed3aea4c07a1e893 (patch)
tree1823140d31e961c680f567cacdb79000fed06a26
parent7b669ca2dd286de7875fd208b6e6047c8bfd4a1e (diff)
Simple but messy hide/show functionality on child nodes.
-rw-r--r--proto.js24
1 files changed, 21 insertions, 3 deletions
diff --git a/proto.js b/proto.js
index 5c7a1d5..b8873fe 100644
--- a/proto.js
+++ b/proto.js
@@ -183,6 +183,7 @@ try {
task.name = "task";
task.setAttribute("class", "task");
task.setAttribute("ondblclick", "editTitle(this, event)");
+ task.setAttribute("onclick", "showHideChildren(this, event)");
task.setAttribute("ondrop", "drop(this, event)");
task.setAttribute("ondragover", "return false");
task.setAttribute("draggable", true);
@@ -254,6 +255,23 @@ function drop(target, e) {
socket_task.send("move " + idFromStr(id) + " " + idFromStr(target.id) + ";");
}
+function showHideChildren(target, e)
+{
+ e.stopPropagation();
+ updateid = idFromStr(target.id);
+ if(target.style.backgroundColor != "red") {
+ target.style.backgroundColor = "red";
+ for(var i = 1; i < target.childNodes.length; i++) {
+ target.childNodes[i].style.display = "none";
+ }
+ } else {
+ target.style.backgroundColor = "grey";
+ for(var i = 1; i < target.childNodes.length; i++) {
+ target.childNodes[i].style.display = "block";
+ }
+ }
+}
+
//
// Butt ugly.. but hey! it works...
//
@@ -285,8 +303,8 @@ function onLostFocusHandler(target, e)
function editTitle(target, e)
{
e.stopPropagation();
- updateid = idFromStr(target.id)
- if(updateid < 10) return;
+ updateid = idFromStr(target.id);
+ if(updateid < 10) return;
var inp = document.createElement("input");
var txtdiv = document.getElementById(target.id + "_txt");
divtxt = txtdiv;
@@ -300,4 +318,4 @@ function editTitle(target, e)
lineedit = inp;
txtdiv.appendChild(inp);
inp.focus();
-} \ No newline at end of file
+}