append a small space before keywords popcorn-port
authorhamidouk
Wed, 11 Jan 2012 16:13:29 +0100
branchpopcorn-port
changeset 611 d931a7d12519
parent 610 7533dd920805
child 612 5292f847b43a
append a small space before keywords
src/js/widgets/createAnnotationWidget.js
--- a/src/js/widgets/createAnnotationWidget.js	Wed Jan 11 15:05:21 2012 +0100
+++ b/src/js/widgets/createAnnotationWidget.js	Wed Jan 11 16:13:29 2012 +0100
@@ -39,9 +39,12 @@
     this.selector.find("#" + id).click(function(keyword) { return function() {
       var contents = _this.selector.find(".Ldt-createAnnotation-Description").val();
       if (contents.indexOf(keyword) != -1) {
-        var newVal = contents.replace(keyword, "");        
+        var newVal = contents.replace(" " + keyword, "");        
       } else {
-        var newVal = contents + keyword;      
+        if (contents === "")
+          var newVal = keyword;
+        else
+          var newVal = contents + " " + keyword;      
       }
       
       _this.selector.find(".Ldt-createAnnotation-Description").val(newVal);
@@ -143,7 +146,7 @@
       // the other event handlers.
       textfield.bind("js_mod.tmp propertychange.tmp keyup.tmp input.tmp paste.tmp", IriSP.wrap(this, function() {
                       var contents = textfield.val();
-                      console.log(contents);
+                      
                       if (contents !== "") {
                         this.selector.find(".Ldt-createAnnotation-errorMessage").hide();
                         textfield.css("background-color", "");