Commits

Anonymous committed 013255a

removed autosuggest function causing double tag adding on tab search result

  • Participants
  • Parent commits 7622029

Comments (0)

Files changed (1)

File taggit_autosuggest/static/jquery-autosuggest/js/jquery.autoSuggest.minified.js

 var matchCount=0;results_holder.html(results_ul.html("")).hide();for(var i=0;i<d_count;i++){var num=i;num_count++;var forward=false;if(opts.searchObjProps=="value"){var str=data[num].value;}else{var str="";var names=opts.searchObjProps.split(",");for(var y=0;y<names.length;y++){var name=$.trim(names[y]);str=str+data[num][name]+" ";}}
 if(str){if(!opts.matchCase){str=str.toLowerCase();}
 if(str.search(query)!=-1&&values_input.val().search(","+data[num][opts.selectedValuesProp]+",")==-1){forward=true;}}
-if(forward){var formatted=$('<li class="as-result-item" id="as-result-item-'+num+'"></li>').click(function(){var raw_data=$(this).data("data");var number=raw_data.num;if($("#as-selection-"+number,selections_holder).length<=0&&!tab_press){var data=raw_data.attributes;input.val("").focus();prev="";add_selected_item(data,number);opts.resultClick.call(this,raw_data);results_holder.hide();}
+if(forward){var formatted=$('<li class="as-result-item" id="as-result-item-'+num+'"></li>').click(function(){var raw_data=$(this).data("data");var number=raw_data.num;if($("#as-selection-"+number,selections_holder).length<=0&&!tab_press){var data=raw_data.attributes;input.val("").focus();prev="";/*add_selected_item(data,number);*/opts.resultClick.call(this,raw_data);results_holder.hide();}
 tab_press=false;}).mousedown(function(){input_focus=false;}).mouseover(function(){$("li",results_ul).removeClass("active");$(this).addClass("active");}).data("data",{attributes:data[num],num:num_count});var this_data=$.extend({},data[num]);if(!opts.matchCase){var regx=new RegExp("(?![^&;]+;)(?!<[^<>]*)("+query+")(?![^<>]*>)(?![^&;]+;)","gi");}else{var regx=new RegExp("(?![^&;]+;)(?!<[^<>]*)("+query+")(?![^<>]*>)(?![^&;]+;)","g");}
 if(opts.resultsHighlight){this_data[opts.selectedItemProp]=this_data[opts.selectedItemProp].replace(regx,"<em>$1</em>");}
 if(!opts.formatList){formatted=formatted.html(this_data[opts.selectedItemProp]);}else{formatted=opts.formatList.call(this,this_data,formatted);}
 function add_selected_item(data,num){values_input.val(values_input.val()+data[opts.selectedValuesProp]+",");var item=$('<li class="as-selection-item" id="as-selection-'+num+'"></li>').click(function(){opts.selectionClick.call(this,$(this));selections_holder.children().removeClass("selected");$(this).addClass("selected");}).mousedown(function(){input_focus=false;});var close=$('<a class="as-close">×</a>').click(function(){values_input.val(values_input.val().replace(","+data[opts.selectedValuesProp]+",",","));opts.selectionRemoved.call(this,item);input_focus=true;input.focus();return false;});org_li.before(item.html(data[opts.selectedItemProp]).prepend(close));opts.selectionAdded.call(this,org_li.prev());}
 function moveSelection(direction){if($(":visible",results_holder).length>0){var lis=$("li",results_holder);if(direction=="down"){var start=lis.eq(0);}else{var start=lis.filter(":last");}
 var active=$("li.active:first",results_holder);if(active.length>0){if(direction=="down"){start=active.next();}else{start=active.prev();}}
-lis.removeClass("active");start.addClass("active");}}});}}})(django.jQuery);
+lis.removeClass("active");start.addClass("active");}}});}}})(django.jQuery);