Author: jruchaud Date: 2015-04-16 08:54:51 +0000 (Thu, 16 Apr 2015) New Revision: 1212 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1212 Log: Plug db Modified: wit/css/select.css wit/js/main.js Modified: wit/css/select.css =================================================================== --- wit/css/select.css 2015-04-16 08:20:10 UTC (rev 1211) +++ wit/css/select.css 2015-04-16 08:54:51 UTC (rev 1212) @@ -1,10 +1,12 @@ .selection { background-color: #f8f8f8; - /*border: 1px solid #AAA;*/ border-radius: 4px; cursor: text; - min-height: 32px; + overflow-x: scroll; + overflow-y: hidden; + height: 50px; + -webkit-user-select: none; } @@ -12,7 +14,6 @@ list-style: outside none none; margin: 0px; padding: 0px 5px; - width: 100%; display: inline-block; overflow: hidden; @@ -25,7 +26,7 @@ border: 1px solid #AAA; border-radius: 4px; cursor: default; - float: left; + display: inline-block; margin-right: 5px; margin-top: 5px; padding: 0px 5px; @@ -40,7 +41,7 @@ } .selection li.input { - float: left; + display: inline-block; } .selection li input { Modified: wit/js/main.js =================================================================== --- wit/js/main.js 2015-04-16 08:20:10 UTC (rev 1211) +++ wit/js/main.js 2015-04-16 08:54:51 UTC (rev 1212) @@ -14,13 +14,14 @@ inputTagNode.parentNode.insertAdjacentHTML("beforebegin", templateTag.replace("{{value}}", this.value)); this.value = ""; - time = null; + stopTime(); } } tagsNode.onclick = function(e) { if (e.target.classList.contains("remove")) { tagsNode.removeChild(e.target.parentNode); + stopTime(); } else { inputTagNode.focus(); @@ -34,7 +35,24 @@ } stopNode.onclick = function(e) { - //console.log("time", performance.now() - time); + stopTime(); +} + +var stopTime = function() { + if (!time) { + return; + } + + var tags = []; + + var children = tagsNode.children; + for (var i = 0, l = children.length - 1; i < l; i ++) { // -1 without input + var tag = children[i].childNodes[1].nodeValue; + tags.push(tag); + } + + db.insertLog(tags, time, new Date()); + time = null; }
participants (1)
-
jruchaud@users.nuiton.org