Fabian Topfstedt avatar Fabian Topfstedt committed ce03822 Merge

Comments (0)

Files changed (3)

 
 setup(
     name='django-taggit-autosuggest',
-    version='0.1',
+    version='0.2',
     description='Autosuggestions for django-taggit',
     long_description=long_description,
     author='Fabian Topfstedt',

taggit_autosuggest/static/jquery-autosuggest/css/autoSuggest-grappelli.css

 /* AutoSuggest CSS - Version 1.2 */
-fieldset.module .tags{
+.grp-row.grp-cells-1.tags {
     overflow: visible;
 }
-fieldset.module .row:before, fieldset.module .row:after {  content: "\0020"; display: block; height: 0; visibility: hidden;	 } 
-fieldset.module .row:after { clear: both; }
-fieldset.module .row { zoom: 1; }
 
 ul.as-selections {
 	list-style-type: none;

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

  * www.drewwilson.com
  * code.drewwilson.com/entry/autosuggest-jquery-plugin
  *
- * Version 1.4   -   Updated: Mar. 23, 2010
+ * Forked by Wu Yuntao
+ * github.com/wuyuntao/jquery-autosuggest
+ *
+ * Version 1.6.2
  *
  * This Plug-In will auto-complete or auto-suggest completed search queries
  * for you as you type. You can add multiple selections and remove them on
  * the fly. It supports keybord navigation (UP + DOWN + RETURN), as well
  * as multiple AutoSuggest fields on the same page.
  *
- * Inspied by the Autocomplete plugin by: Jörn Zaefferer
+ * Inspired by the Autocomplete plugin by: Joern Zaefferer
  * and the Facelist plugin by: Ian Tearle (iantearle.com)
  *
  * This AutoSuggest jQuery plug-in is dual licensed under the MIT and GPL licenses:
  *   http://www.opensource.org/licenses/mit-license.php
  *   http://www.gnu.org/licenses/gpl.html
  */
- (function($){$.fn.autoSuggest=function(data,options){var defaults={asHtmlID:false,startText:"Enter Name Here",emptyText:"No Results Found",preFill:{},limitText:"No More Selections Are Allowed",selectedItemProp:"value",selectedValuesProp:"value",searchObjProps:"value",queryParam:"q",retrieveLimit:false,extraParams:"",matchCase:false,minChars:1,keyDelay:400,resultsHighlight:true,neverSubmit:false,selectionLimit:false,showResultList:true,start:function(){},selectionClick:function(elem){},selectionAdded:function(elem){},selectionRemoved:function(elem){elem.remove();},formatList:false,beforeRetrieve:function(string){return string;},retrieveComplete:function(data){return data;},resultClick:function(data){},resultsComplete:function(){}};var opts=$.extend(defaults,options);var d_type="object";var d_count=0;if(typeof data=="string"){d_type="string";var req_string=data;}else{var org_data=data;for(k in data)if(data.hasOwnProperty(k))d_count++;}
-if((d_type=="object"&&d_count>0)||d_type=="string"){return this.each(function(x){if(!opts.asHtmlID){x=x+""+Math.floor(Math.random()*100);var x_id="as-input-"+x;}else{x=opts.asHtmlID;var x_id=x;}
-opts.start.call(this);var input=$(this);input.attr("autocomplete","off").addClass("as-input").attr("id",x_id).val(opts.startText);var input_focus=false;input.wrap('<ul class="as-selections" id="as-selections-'+x+'"></ul>').wrap('<li class="as-original" id="as-original-'+x+'"></li>');var selections_holder=$("#as-selections-"+x);var org_li=$("#as-original-"+x);var results_holder=$('<div class="as-results" id="as-results-'+x+'"></div>').hide();var results_ul=$('<ul class="as-list"></ul>');var values_input=$('<input type="hidden" class="as-values" name="as_values_'+x+'" id="as-values-'+x+'" />');var prefill_value="";if(typeof opts.preFill=="string"){var vals=opts.preFill.split(",");for(var i=0;i<vals.length;i++){var v_data={};v_data[opts.selectedValuesProp]=vals[i];if(vals[i]!=""){add_selected_item(v_data,"000"+i);}}
-prefill_value=opts.preFill;}else{prefill_value="";var prefill_count=0;for(k in opts.preFill)if(opts.preFill.hasOwnProperty(k))prefill_count++;if(prefill_count>0){for(var i=0;i<prefill_count;i++){var new_v=opts.preFill[i][opts.selectedValuesProp];if(new_v==undefined){new_v="";}
-prefill_value=prefill_value+new_v+",";if(new_v!=""){add_selected_item(opts.preFill[i],"000"+i);}}}}
-if(prefill_value!=""){input.val("");var lastChar=prefill_value.substring(prefill_value.length-1);if(lastChar!=","){prefill_value=prefill_value+",";}
-values_input.val(","+prefill_value);$("li.as-selection-item",selections_holder).addClass("blur").removeClass("selected");}
-input.after(values_input);selections_holder.click(function(){input_focus=true;input.focus();}).mousedown(function(){input_focus=false;}).after(results_holder);var timeout=null;var prev="";var totalSelections=0;var tab_press=false;input.focus(function(){if($(this).val()==opts.startText&&values_input.val()==""){$(this).val("");}else if(input_focus){$("li.as-selection-item",selections_holder).removeClass("blur");if($(this).val()!=""){results_ul.css("width",selections_holder.outerWidth());results_holder.show();}}
-input_focus=true;return true;}).blur(function(){if($(this).val()==""&&values_input.val()==""&&prefill_value==""){$(this).val(opts.startText);}else if(input_focus){$("li.as-selection-item",selections_holder).addClass("blur").removeClass("selected");results_holder.hide();}}).keydown(function(e){lastKeyPressCode=e.keyCode;first_focus=false;switch(e.keyCode){case 38:e.preventDefault();moveSelection("up");break;case 40:e.preventDefault();moveSelection("down");break;case 8:if(input.val()==""){var last=values_input.val().split(",");last=last[last.length-2];selections_holder.children().not(org_li.prev()).removeClass("selected");if(org_li.prev().hasClass("selected")){values_input.val(values_input.val().replace(","+last+",",","));opts.selectionRemoved.call(this,org_li.prev());}else{opts.selectionClick.call(this,org_li.prev());org_li.prev().addClass("selected");}}
-if(input.val().length==1){results_holder.hide();prev="";}
-if($(":visible",results_holder).length>0){if(timeout){clearTimeout(timeout);}
-timeout=setTimeout(function(){keyChange();},opts.keyDelay);}
-break;case 9:case 188:tab_press=true;var i_input=input.val().replace(/(,)/g,"");if(i_input!=""&&values_input.val().search(","+i_input+",")<0&&i_input.length>=opts.minChars){e.preventDefault();var n_data={};n_data[opts.selectedItemProp]=i_input;n_data[opts.selectedValuesProp]=i_input;var lis=$("li",selections_holder).length;add_selected_item(n_data,"00"+(lis+1));input.val("");}
-case 13:tab_press=false;var active=$("li.active:first",results_holder);if(active.length>0){active.click();results_holder.hide();}
-if(opts.neverSubmit||active.length>0){e.preventDefault();}
-break;default:if(opts.showResultList){if(opts.selectionLimit&&$("li.as-selection-item",selections_holder).length>=opts.selectionLimit){results_ul.html('<li class="as-message">'+opts.limitText+'</li>');results_holder.show();}else{if(timeout){clearTimeout(timeout);}
-timeout=setTimeout(function(){keyChange();},opts.keyDelay);}}
-break;}});function keyChange(){if(lastKeyPressCode==46||(lastKeyPressCode>8&&lastKeyPressCode<32)){return results_holder.hide();}
-var string=input.val().replace(/[\\]+|[\/]+/g,"");if(string==prev)return;prev=string;if(string.length>=opts.minChars){selections_holder.addClass("loading");if(d_type=="string"){var limit="";if(opts.retrieveLimit){limit="&limit="+encodeURIComponent(opts.retrieveLimit);}
-if(opts.beforeRetrieve){string=opts.beforeRetrieve.call(this,string);}
-$.getJSON(req_string+"?"+opts.queryParam+"="+encodeURIComponent(string)+limit+opts.extraParams,function(data){d_count=0;var new_data=opts.retrieveComplete.call(this,data);for(k in new_data)if(new_data.hasOwnProperty(k))d_count++;processData(new_data,string);});}else{if(opts.beforeRetrieve){string=opts.beforeRetrieve.call(this,string);}
-processData(org_data,string);}}else{selections_holder.removeClass("loading");results_holder.hide();}}
-var num_count=0;function processData(data,query){if(!opts.matchCase){query=query.toLowerCase();}
-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();}
-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);}
-results_ul.append(formatted);delete this_data;matchCount++;if(opts.retrieveLimit&&opts.retrieveLimit==matchCount){break;}}}
-selections_holder.removeClass("loading");if(matchCount<=0){results_ul.html('<li class="as-message">'+opts.emptyText+'</li>');}
-results_ul.css("width",selections_holder.outerWidth());results_holder.show();opts.resultsComplete.call(this);}
-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);
+(function(a){a.fn.autoSuggest=function(h,e){var i={asHtmlID:false,startText:"Enter Name Here",usePlaceholder:false,emptyText:"No Results Found",preFill:{},limitText:"No More Selections Are Allowed",selectedItemProp:"value",selectedValuesProp:"value",searchObjProps:"value",queryParam:"q",retrieveLimit:false,extraParams:"",matchCase:false,minChars:1,keyDelay:400,resultsHighlight:true,neverSubmit:false,selectionLimit:false,showResultList:true,showResultListWhenNoMatch:false,canGenerateNewSelections:true,start:function(){},selectionClick:function(j){},selectionAdded:function(j){},selectionRemoved:function(j){j.remove()},formatList:false,beforeRetrieve:function(j){return j},retrieveComplete:function(j){return j},resultClick:function(j){},resultsComplete:function(){}};var g=a.extend(i,e);function d(j){var l=0;for(k in j){if(j.hasOwnProperty(k)){l++}}return l}function c(){var j=g.extraParams;if(a.isFunction(j)){return j()}return j}var b;var f=null;if(typeof h=="function"){b=h}else{if(typeof h=="string"){b=function(m,l){var j="";if(g.retrieveLimit){j="&limit="+encodeURIComponent(g.retrieveLimit)}f=a.getJSON(h+"?"+g.queryParam+"="+encodeURIComponent(m)+j+c(),function(o){var n=g.retrieveComplete.call(this,o);l(n,m)})}}else{if(typeof h=="object"&&d(h)>0){b=function(l,j){j(h,l)}}}}if(b){return this.each(function(z){if(!g.asHtmlID){z=z+""+Math.floor(Math.random()*100);var m="as-input-"+z}else{z=g.asHtmlID;var m=z}g.start.call(this,{add:function(x){K(x,"u"+a("li",G).length).addClass("blur")},remove:function(x){M.val(M.val().replace(","+x+",",","));G.find('li[data-value = "'+x+'"]').remove()}});var B=a(this);B.attr("autocomplete","off").addClass("as-input").attr("id",m);if(g.usePlaceholder){B.attr("placeholder",g.startText)}else{B.val(g.startText)}var F=false;B.wrap('<ul class="as-selections" id="as-selections-'+z+'"></ul>').wrap('<li class="as-original" id="as-original-'+z+'"></li>');var G=a("#as-selections-"+z);var v=a("#as-original-"+z);var o=a('<div class="as-results" id="as-results-'+z+'"></div>').hide();var p=a('<ul class="as-list"></ul>');var M=a('<input type="hidden" class="as-values" name="as_values_'+z+'" id="as-values-'+z+'" />');var u="";if(typeof g.preFill=="string"){var C=g.preFill.split(",");for(var I=0;I<C.length;I++){var n={};n[g.selectedValuesProp]=C[I];if(C[I]!=""){K(n,"000"+I)}}u=g.preFill}else{u="";var N=0;for(k in g.preFill){if(g.preFill.hasOwnProperty(k)){N++}}if(N>0){for(var I=0;I<N;I++){var D=g.preFill[I][g.selectedValuesProp];if(D==undefined){D=""}u=u+D+",";if(D!=""){K(g.preFill[I],"000"+I)}}}}if(u!=""){B.val("");var A=u.substring(u.length-1);if(A!=","){u=u+","}M.val(","+u);a("li.as-selection-item",G).addClass("blur").removeClass("selected")}B.after(M);G.click(function(){F=true;B.focus()}).mousedown(function(){F=false}).after(o);var J=null;var y=null;var E="";var q=0;var r=false;var H=null;B.focus(function(){if(!g.usePlaceholder&&a(this).val()==g.startText&&M.val()==""){a(this).val("")}else{if(F){a("li.as-selection-item",G).removeClass("blur");if(a(this).val()!=""){p.css("width",G.outerWidth());o.show()}}}if(J){clearInterval(J)}J=setInterval(function(){if(g.showResultList){if(g.selectionLimit&&a("li.as-selection-item",G).length>=g.selectionLimit){p.html('<li class="as-message">'+g.limitText+"</li>");o.show()}else{l()}}},g.keyDelay);F=true;if(g.minChars==0){L(a(this).val())}return true}).blur(function(){if(!g.usePlaceholder&&a(this).val()==""&&M.val()==""&&u==""&&g.minChars>0){a(this).val(g.startText)}else{if(F){a("li.as-selection-item",G).addClass("blur").removeClass("selected");o.hide()}}if(J){clearInterval(J)}}).keydown(function(S){H=S.keyCode;first_focus=false;switch(S.keyCode){case 38:S.preventDefault();w("up");break;case 40:S.preventDefault();w("down");break;case 8:if(B.val()==""){var O=M.val().split(",");O=O[O.length-2];G.children().not(v.prev()).removeClass("selected");if(v.prev().hasClass("selected")){M.val(M.val().replace(","+O+",",","));g.selectionRemoved.call(this,v.prev())}else{g.selectionClick.call(this,v.prev());v.prev().addClass("selected")}}if(B.val().length==1){o.hide();E="";j()}if(a(":visible",o).length>0){if(y){clearTimeout(y)}y=setTimeout(function(){l()},g.keyDelay)}break;case 9:case 188:if(g.canGenerateNewSelections){r=true;var Q=B.val().replace(/(,)/g,"");var R=a("li.active:first",o);if(Q!==""&&M.val().search(","+Q+",")<0&&Q.length>=g.minChars&&R.length===0){S.preventDefault();var P={};P[g.selectedItemProp]=Q;P[g.selectedValuesProp]=Q;var x=a("li",G).length;K(P,"00"+(x+1));B.val("");j();break}}case 13:r=false;var R=a("li.active:first",o);if(R.length>0){R.click();o.hide()}if(g.neverSubmit||R.length>0){S.preventDefault()}break;case 27:case 16:case 20:j();o.hide();break}});function l(){var x=B.val().replace(/[\\]+|[\/]+/g,"");if(x==E){return}E=x;if(x.length>=g.minChars){G.addClass("loading");L(x)}else{G.removeClass("loading");o.hide()}}function L(x){if(g.beforeRetrieve){x=g.beforeRetrieve.call(this,x)}j();b(x,s)}var t=0;function s(Q,W){if(!g.matchCase){W=W.toLowerCase()}W=W.replace("(","\\(","g").replace(")","\\)","g");var Y=0;o.html(p.html("")).hide();var aa=d(Q);for(var R=0;R<aa;R++){var S=R;t++;var T=false;if(g.searchObjProps=="value"){var V=Q[S].value}else{var V="";var U=g.searchObjProps.split(",");for(var X=0;X<U.length;X++){var x=a.trim(U[X]);V=V+Q[S][x]+" "}}if(V){if(!g.matchCase){V=V.toLowerCase()}if(V.search(W)!=-1&&M.val().search(","+Q[S][g.selectedValuesProp]+",")==-1){T=true}}if(T){var P=a('<li class="as-result-item" id="as-result-item-'+S+'"></li>').click(function(){var ad=a(this).data("data");var ab=ad.num;if(a("#as-selection-"+ab,G).length<=0&&!r){var ac=ad.attributes;B.val("").focus();E="";K(ac,ab);g.resultClick.call(this,ad);o.hide()}r=false}).mousedown(function(){F=false}).mouseover(function(){a("li",p).removeClass("active");a(this).addClass("active")}).data("data",{attributes:Q[S],num:t});var Z=a.extend({},Q[S]);if(!g.matchCase){var O=new RegExp("(?![^&;]+;)(?!<[^<>]*)("+W+")(?![^<>]*>)(?![^&;]+;)","gi")}else{var O=new RegExp("(?![^&;]+;)(?!<[^<>]*)("+W+")(?![^<>]*>)(?![^&;]+;)","g")}if(g.resultsHighlight&&W.length>0){Z[g.selectedItemProp]=Z[g.selectedItemProp].replace(O,"<em>$1</em>")}if(!g.formatList){P=P.html(Z[g.selectedItemProp])}else{P=g.formatList.call(this,Z,P)}p.append(P);delete Z;Y++;if(g.retrieveLimit&&g.retrieveLimit==Y){break}}}G.removeClass("loading");if(Y<=0){p.html('<li class="as-message">'+g.emptyText+"</li>")}p.css("width",G.outerWidth());if(Y>0||!g.showResultListWhenNoMatch){o.show()}g.resultsComplete.call(this)}function K(P,x){M.val((M.val()||",")+P[g.selectedValuesProp]+",");var O=a('<li class="as-selection-item" id="as-selection-'+x+'" data-value="'+P[g.selectedValuesProp]+'"></li>').click(function(){g.selectionClick.call(this,a(this));G.children().removeClass("selected");a(this).addClass("selected")}).mousedown(function(){F=false});var Q=a('<a class="as-close">&times;</a>').click(function(){M.val(M.val().replace(","+P[g.selectedValuesProp]+",",","));g.selectionRemoved.call(this,O);F=true;B.focus();return false});v.before(O.html(P[g.selectedItemProp]).prepend(Q));g.selectionAdded.call(this,v.prev(),P[g.selectedValuesProp]);return v.prev()}function w(P){if(a(":visible",o).length>0){var x=a("li",o);if(P=="down"){var Q=x.eq(0)}else{var Q=x.filter(":last")}var O=a("li.active:first",o);if(O.length>0){if(P=="down"){Q=O.next()}else{Q=O.prev()}}x.removeClass("active");Q.addClass("active")}}function j(){if(f){f.abort();f=null}}})}}})(django.jQuery);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.