Merge with 80023516532ff4c9a17f7e513013df8d63cc7a60
authorymh <ymh.work@gmail.com>
Fri, 08 Jul 2011 18:13:54 +0200
changeset 80 15fb85252d88
parent 79 949e319fbaa0 (current diff)
parent 77 80023516532f (diff)
child 81 955f1b6fa9c5
Merge with 80023516532ff4c9a17f7e513013df8d63cc7a60
--- a/web/hdabo/static/hdabo/js/hdabo.js	Fri Jul 08 18:13:36 2011 +0200
+++ b/web/hdabo/static/hdabo/js/hdabo.js	Fri Jul 08 18:13:54 2011 +0200
@@ -157,6 +157,7 @@
 
 function init_datasheet_events()
 {
+    var select_done = false;
     // Wikipedia search management (new tag)
     $("#wp_search").autocomplete({
         source: function( request, response ) {
@@ -183,6 +184,7 @@
         select: function(event, ui) { 
             // Since the event still did not update wp_search's val, we force it.
             $("#wp_search").val(ui.item.label);
+            select_done = true;
             $("#ok_search").click();
         },
         minLength: 2,
@@ -193,6 +195,12 @@
             $( this ).removeClass( "ui-corner-top" ).addClass( "ui-corner-all" );
         }
     });
+    $('#wp_search').keyup(function(e){
+        if((e.keyCode==13) && ($("#wp_search").val()!="") && (select_done==false)){
+            add_tag($("#wp_search").val());
+        }
+        select_done = false;
+    });
     $("#ok_search").click(function(){
         if($("#wp_search").val()!=""){
             add_tag($("#wp_search").val());