# HG changeset patch # User cavaliet # Date 1310136954 -7200 # Node ID 80023516532ff4c9a17f7e513013df8d63cc7a60 # Parent c6c4ace0d674d8fb2898383f5f1f5e889f36d3bc Enter key to add tag. diff -r c6c4ace0d674 -r 80023516532f web/hdabo/static/hdabo/js/hdabo.js --- a/web/hdabo/static/hdabo/js/hdabo.js Fri Jul 08 13:32:34 2011 +0200 +++ b/web/hdabo/static/hdabo/js/hdabo.js Fri Jul 08 16:55: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());