diff options
Diffstat (limited to 'proto.js')
-rw-r--r-- | proto.js | 58 |
1 files changed, 21 insertions, 37 deletions
@@ -161,15 +161,13 @@ try { var observeid = msg[0]; var cmd = msg[1]; + var id = msg[2]; - if(cmd == "del") { - var id = msg[2]; + if(cmd == "remove") { var task = document.getElementById("task_" + id); - //todo: remove from parent not board - board.removeChild(task); + task.parentNode.removeChild(task); } else if(cmd == "move") { - var id = msg[2]; var parent_id = msg[3]; var task = document.getElementById("task_" + id); if(parent_id != -1) { @@ -179,19 +177,11 @@ try { else { board.appendChild(task); } - // task.parentNode.removeChild(task); - // board.removeChild(task); - // parent_task.appendChild(task); - // task.style.left = left + "px"; - // task.style.top = top + "px"; } else if(cmd == "create") { - var id = msg[2]; var parent_id = msg[3]; - // var title = msg[3]; - // var description = msg[4]; - var task = document.createElement("div"); + task.name = "task"; task.setAttribute("class", "task"); task.setAttribute("ondrop", "drop(this, event)"); @@ -203,24 +193,23 @@ try { task.id = "task_" + id; - // var taskText = document.createTextNode(title + ": " + description + " :" + task.id); var taskText = document.createTextNode('[' + task.id + ']'); taskText.id = "txt"; task.appendChild(taskText); - // task.style.position = "absolute"; - // task.style.left = left + "px"; - // task.style.top = top + "px"; - // task.setAttribute("onMouseDown", "dragged = '" + id + "';"); - - // var dlButton = document.createElement("input"); - // dlButton.type = "button"; - // dlButton.value = "Remove"; - // dlButton.onclick = "deleteTask(document.getElementById(" + task.id + ").id"; - // dlButton.setAttribute("onclick", "deleteTask(" + id +")"); - // task.appendChild(dlButton); - - // board.appendChild(task); + //task.style.position = "absolute"; + //task.style.left = left + "px"; + //task.style.top = top + "px"; + //task.setAttribute("onMouseDown", "dragged = '" + id + "';"); + + //var dlButton = document.createElement("input"); + //dlButton.type = "button"; + //dlButton.value = "Remove"; + //dlButton.onclick = "deleteTask(document.getElementById(" + task.id + ").id"; + //dlButton.setAttribute("onclick", "deleteTask(" + id +")"); + //task.appendChild(dlButton); + + //board.appendChild(task); var parent_task = document.getElementById("task_" + parent_id); @@ -232,20 +221,15 @@ try { } } else if(cmd == "update") { - - var id = msg[2]; var title = msg[3]; - var description = 'N/A';//msg[3]; - var task = document.getElementById("task_" + id); - - var taskText = document.createTextNode(title + ": " + description + " :" + task.id); + var taskText = document.createTextNode(title); task.appendChild(taskText); } f++; - // document.getElementById("box").style.top = i[3] + "px"; - // document.getElementById("box").style.left = i[2] + "px"; - // document.getElementById("box").style.display = "block"; + //document.getElementById("box").style.top = i[3] + "px"; + //document.getElementById("box").style.left = i[2] + "px"; + //document.getElementById("box").style.display = "block"; } } |