From 9fa00515500c1a7d5d2452be69dd33ff0e62c0c6 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 18 May 2012 13:20:02 +0200 Subject: Ugly implementation of inline-title edit on double click. --- proto.js | 100 ++++++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 80 insertions(+), 20 deletions(-) (limited to 'proto.js') diff --git a/proto.js b/proto.js index f3cece5..92f90fc 100644 --- a/proto.js +++ b/proto.js @@ -57,6 +57,30 @@ var BrowserDetect = { BrowserDetect.init(); +function createId(boardid, taskid) +{ + return "b" + boardid + "_t" + taskid; +} + +function idFromStr(str) +{ + return str.substring(str.search('t') + 1, str.length); +} + +function getElementsByClass(searchClass, domNode, tagName) { + if (domNode == null) domNode = document; + if (tagName == null) tagName = '*'; + var el = new Array(); + var tags = domNode.getElementsByTagName(tagName); + var tcl = " "+searchClass+" "; + for(i=0,j=0; i Date: Fri, 18 May 2012 13:48:09 +0200 Subject: Remove annoying and broken opacity. --- proto.js | 1 - 1 file changed, 1 deletion(-) (limited to 'proto.js') diff --git a/proto.js b/proto.js index 92f90fc..b6ecf25 100644 --- a/proto.js +++ b/proto.js @@ -253,7 +253,6 @@ function deleteTask(id) { } function drag(target, e) { - e.target.style.opacity = '0.4'; e.dataTransfer.setData('Text', target.id); e.stopPropagation(); // <--- this fixes the drag target problem } -- cgit v1.2.3 From 7b669ca2dd286de7875fd208b6e6047c8bfd4a1e Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 18 May 2012 14:39:37 +0200 Subject: Close title editor when leaving focus if title was not yet changed. --- proto.js | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'proto.js') diff --git a/proto.js b/proto.js index b6ecf25..5c7a1d5 100644 --- a/proto.js +++ b/proto.js @@ -67,20 +67,6 @@ function idFromStr(str) return str.substring(str.search('t') + 1, str.length); } -function getElementsByClass(searchClass, domNode, tagName) { - if (domNode == null) domNode = document; - if (tagName == null) tagName = '*'; - var el = new Array(); - var tags = domNode.getElementsByTagName(tagName); - var tcl = " "+searchClass+" "; - for(i=0,j=0; i Date: Fri, 18 May 2012 14:52:20 +0200 Subject: Simple but messy hide/show functionality on child nodes. --- proto.js | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) (limited to 'proto.js') 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 +} -- cgit v1.2.3