From ba15ea940b189852737d189e89ee022a2d37b57d Mon Sep 17 00:00:00 2001
From: zhitomirskiyi <ilya@joindiaspora.com>
Date: Tue, 29 Mar 2011 13:14:47 -0700
Subject: [PATCH] autosuggest on tags now works, bumped up the version of the
 autocomplete plugin

---
 app/controllers/profiles_controller.rb        |  10 +-
 app/controllers/tags_controller.rb            |  20 +-
 app/views/conversations/new.haml              |   2 +-
 app/views/profiles/_edit_public.html.haml     |  27 +-
 .../javascripts/vendor/jquery.autoSuggest.js  | 353 +-----------------
 5 files changed, 44 insertions(+), 368 deletions(-)

diff --git a/app/controllers/profiles_controller.rb b/app/controllers/profiles_controller.rb
index 9125e4630b..b293a0474d 100644
--- a/app/controllers/profiles_controller.rb
+++ b/app/controllers/profiles_controller.rb
@@ -8,11 +8,19 @@ class ProfilesController < ApplicationController
     @person = current_user.person
     @aspect  = :person_edit
     @profile = @person.profile
+
+    @tags = @profile.tags
+    @tags_array = []
+    @tags.each do |obj| 
+      @tags_array << { :name => ("#"+obj.name),
+        :value => ("#"+obj.name)}
+      end
   end
 
   def update
-     # upload and set new profile photo
+    # upload and set new profile photo
     params[:profile] ||= {}
+    params[:profile][:tag_string] = (params[:as_values_tags]) ? params[:as_values_tags].gsub(',',' ') : ""
     params[:profile][:searchable] ||= false
     params[:profile][:photo] = Photo.where(:author_id => current_user.person.id,
                                            :id => params[:photo_id]).first if params[:photo_id]
diff --git a/app/controllers/tags_controller.rb b/app/controllers/tags_controller.rb
index 576f05f7fc..d5bbd50d85 100644
--- a/app/controllers/tags_controller.rb
+++ b/app/controllers/tags_controller.rb
@@ -12,22 +12,26 @@ class TagsController < ApplicationController
   respond_to :json, :only => [:index]
   
   def index
-    pp params
+    params[:q].gsub!("#", "")
     if params[:q].length > 1
-      @tags = ActsAsTaggableOn::Tag.named_like(params[:q])
-      @hash = @tags.inject([]) do |memo, obj| 
-        memo << { :name => obj.name,
-        :value => ("#"+obj.name)}
+      @tags = ActsAsTaggableOn::Tag.named_like(params[:q]).limit(params[:limit] || 10)
+      @array = []
+      @tags.each do |obj| 
+        @array << { :name => ("#"+obj.name),
+          :value => ("#"+obj.name)}
+      end
+
+     if @array.empty?
+        @array << { :name => params[:q],
+          :value => ("#"+params[:q])}
       end
 
       respond_to do |format|
         format.json{
-          json = { :items => @hash}.to_json
-          render(:json => json, :status => 201)
+          render(:json => @array.to_json, :status => 201)
         }
       end
     else
-      pp "not!"
       render :nothing => true
     end
   end
diff --git a/app/views/conversations/new.haml b/app/views/conversations/new.haml
index 7f392d9a0b..bd1e9d59d8 100644
--- a/app/views/conversations/new.haml
+++ b/app/views/conversations/new.haml
@@ -10,7 +10,7 @@
     autocompleteInput.autoSuggest(data, {
       selectedItemProp: "name",
       searchObjProps: "name",
-      asHtmlID: "tag_ids",
+      asHtmlID: "contact_ids",
       keyDelay: 0,
       startText: '',
       emptyText: '#{t('.no_results')}',
diff --git a/app/views/profiles/_edit_public.html.haml b/app/views/profiles/_edit_public.html.haml
index f1b8e48119..b51f395bf9 100644
--- a/app/views/profiles/_edit_public.html.haml
+++ b/app/views/profiles/_edit_public.html.haml
@@ -7,20 +7,36 @@
 
 :javascript
   $(document).ready(function () {
-    var autocompleteInput = $("#profile_tag_string");
+    var data = $.parseJSON( $('#tags_json').val() ),
+        autocompleteInput = $("#profile_tag_string");
 
+
+    
     autocompleteInput.autoSuggest("#{tags_path}", {
       selectedItemProp: "name",
       searchObjProps: "name",
-      asHtmlID: "tag_ids",
+      asHtmlID: "tags",
+      neverSubmit: true,
+      retriveLimit: 10,
+      selectionLimit: 5,
+      minChars: 2,
       keyDelay: 0,
-      startText: '',
+      startText: "#{t('profiles.edit.your_tags_placeholder')}",
       emptyText: '#{t('.no_results')}',
+      preFill: data
       });
 
-    autocompleteInput.focus();
+    autocompleteInput.bind('keydown', function(evt){
+      if(evt.keyCode == 13 || evt.keyCode == 32){
+        if( $('li.as-result-item.active').length == 0 ){
+          $('li.as-result-item').first().click();
+        }
+      }
+    });
   });
 
+
+= hidden_field_tag :tags_json, @tags_array.to_json
 %h3
   = t('profiles.edit.your_public_profile')
 
@@ -33,8 +49,7 @@
 
 %h4
   = t('profiles.edit.your_tags')
-  = text_field_tag 'profile[tag_string]', profile.tag_string, :placeholder => t('profiles.edit.your_tags_placeholder')
-
+  = text_field_tag 'profile[tag_string]', ""
 %h4
   = t('profiles.edit.your_photo')
   = render 'photos/new_profile_photo', :aspect => aspect, :person => person
diff --git a/public/javascripts/vendor/jquery.autoSuggest.js b/public/javascripts/vendor/jquery.autoSuggest.js
index bafd35cbcf..755b4ef127 100644
--- a/public/javascripts/vendor/jquery.autoSuggest.js
+++ b/public/javascripts/vendor/jquery.autoSuggest.js
@@ -18,355 +18,4 @@
  *   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", //name of object property
-			selectedValuesProp: "value", //name of object property
-			searchObjProps: "value", //comma separated list of object property names
-			queryParam: "q",
-			retrieveLimit: false, //number for 'limit' param on ajax request
-			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, //callback function
-		  	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); //this ensures there will be unique IDs on the page if autoSuggest() is called multiple times
-					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;
-				
-				// Setup basic elements and render them to the DOM
-				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="'+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;
-				
-				// Handle input field events
-				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) {
-					// track last key pressed
-					lastKeyPressCode = e.keyCode;
-					first_focus = false;
-					switch(e.keyCode) {
-						case 38: // up
-							e.preventDefault();
-							moveSelection("up");
-							break;
-						case 40: // down
-							e.preventDefault();
-							moveSelection("down");
-							break;
-						case 8:  // delete
-							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 or comma
-							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 9: // tab
-              if(input.val() == ''){
-                break;
-              }
-						case 13: case 188: // return, comma
-							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() {
-					// ignore if the following keys are pressed: [del] [shift] [capslock]
-					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">&times;</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");
-					}
-				}
-									
-			});
-		}
-	}
-})(jQuery);  	
+eval(function(p,a,c,k,e,d){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--){d[e(c)]=k[c]||e(c)}k=[function(e){return d[e]}];e=function(){return'\\w+'};c=1};while(c--){if(k[c]){p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c])}}return p}('(6($){$.2O.2P=6(7,2f){4 2g={1R:m,1o:"2Q 2H 31",2i:"1Y 2X 2Y",D:{},2h:"1Y 2G 2I 2J 35",Z:"1a",N:"1a",1y:"1a",2B:"q",15:m,2E:"",1e:m,1V:1,1C:2V,2t:G,2d:m,1I:m,20:G,R:6(){},1B:6(1q){},2w:6(1q){},1P:6(1q){1q.36()},1M:m,18:6(h){K h},2z:6(7){K 7},2u:6(7){},2m:6(){}};4 3=$.2q(2g,2f);4 14="26";4 12=0;5(2b 7=="h"){14="h";4 2C=7}s{4 2F=7;O(k 1E 7)5(7.1F(k))12++}5((14=="26"&&12>0)||14=="h"){K d.2W(6(x){5(!3.1R){x=x+""+29.2U(29.2Z()*30);4 1U="c-l-"+x}s{x=3.1R;4 1U=x}3.R.v(d);4 l=$(d);l.1X("34","33").F("c-l").1X("L",1U).b(3.1o);4 C=m;l.25(\'<1g A="c-1W" L="c-1W-\'+x+\'"></1g>\').25(\'<f A="c-1O" L="c-1O-\'+x+\'"></f>\');4 n=$("#c-1W-"+x);4 J=$("#c-1O-"+x);4 j=$(\'<1Z A="c-22" L="c-22-\'+x+\'"></1Z>\').E();4 I=$(\'<1g A="c-2L"></1g>\');4 p=$(\'<l 2S="2M" A="c-2c" 1z="2N\'+x+\'" L="c-2c-\'+x+\'" />\');4 u="";5(2b 3.D=="h"){4 1f=3.D.1t(",");O(4 i=0;i<1f.o;i++){4 1L={};1L[3.N]=1f[i];5(1f[i]!=""){17(1L,"27"+i)}}u=3.D}s{u="";4 1d=0;O(k 1E 3.D)5(3.D.1F(k))1d++;5(1d>0){O(4 i=0;i<1d;i++){4 16=3.D[i][3.N];5(16==37){16=""}u=u+16+",";5(16!=""){17(3.D[i],"27"+i)}}}}5(u!=""){l.b("");4 2e=u.3o(u.o-1);5(2e!=","){u=u+","}p.b(","+u);$("f.c-Q-z",n).F("1i").B("M")}l.28(p);n.1b(6(){C=G;l.1p()}).1v(6(){C=m}).28(j);4 P=3t;4 t="";4 3u=0;4 19=m;l.1p(6(){5($(d).b()==3.1o&&p.b()==""){$(d).b("")}s 5(C){$("f.c-Q-z",n).B("1i");5($(d).b()!=""){I.2k("2l",n.2x());j.1H()}}C=G;K G}).1i(6(){5($(d).b()==""&&p.b()==""&&u==""){$(d).b(3.1o)}s 5(C){$("f.c-Q-z",n).F("1i").B("M");j.E()}}).3m(6(e){1k=e.2a;3d=m;3e(e.2a){T 38:e.1m();1A("3n");V;T 3b:e.1m();1A("1T");V;T 8:5(l.b()==""){4 S=p.b().1t(",");S=S[S.o-2];n.2y().39(J.t()).B("M");5(J.t().3a("M")){p.b(p.b().1c(","+S+",",","));3.1P.v(d,J.t())}s{3.1B.v(d,J.t());J.t().F("M")}}5(l.b().o==1){j.E();t=""}5($(":2D",j).o>0){5(P){21(P)}P=23(6(){1D()},3.1C)}V;T 9:T 3f:19=G;4 U=l.b().1c(/(,)/g,"");5(U!=""&&p.b().1x(","+U+",")<0&&U.o>=3.1V){e.1m();4 1n={};1n[3.Z]=U;1n[3.N]=U;4 W=$("f",n).o;17(1n,"3l"+(W+1));l.b("")}T 13:19=m;4 r=$("f.r:24",j);5(r.o>0){r.1b();j.E()}5(3.2d||r.o>0){e.1m()}V;3k:5(3.20){5(3.1I&&$("f.c-Q-z",n).o>=3.1I){I.10(\'<f A="c-2j">\'+3.2h+\'</f>\');j.1H()}s{5(P){21(P)}P=23(6(){1D()},3.1C)}}V}});6 1D(){5(1k==3h||(1k>8&&1k<32)){K j.E()}4 h=l.b().1c(/[\\\\]+|[\\/]+/g,"");5(h==t)K;t=h;5(h.o>=3.1V){n.F("1N");5(14=="h"){4 1j="";5(3.15){1j="&1j="+2A(3.15)}5(3.18){h=3.18.v(d,h)}$.3i(2C+"?"+3.2B+"="+2A(h)+1j+3.2E,6(7){12=0;4 1l=3.2z.v(d,7);O(k 1E 1l)5(1l.1F(k))12++;1J(1l,h)})}s{5(3.18){h=3.18.v(d,h)}1J(2F,h)}}s{n.B("1N");j.E()}}4 1S=0;6 1J(7,Y){5(!3.1e){Y=Y.2o()}4 1r=0;j.10(I.10("")).E();O(4 i=0;i<12;i++){4 w=i;1S++;4 1w=m;5(3.1y=="1a"){4 H=7[w].1a}s{4 H="";4 1u=3.1y.1t(",");O(4 y=0;y<1u.o;y++){4 1z=$.3c(1u[y]);H=H+7[w][1z]+" "}}5(H){5(!3.1e){H=H.2o()}5(H.1x(Y)!=-1&&p.b().1x(","+7[w][3.N]+",")==-1){1w=G}}5(1w){4 11=$(\'<f A="c-2p-z" L="c-2p-z-\'+w+\'"></f>\').1b(6(){4 1h=$(d).7("7");4 1G=1h.w;5($("#c-Q-"+1G,n).o<=0&&!19){4 7=1h.2s;l.b("").1p();t="";17(7,1G);3.2u.v(d,1h);j.E()}19=m}).1v(6(){C=m}).3r(6(){$("f",I).B("r");$(d).F("r")}).7("7",{2s:7[w],w:1S});4 X=$.2q({},7[w]);5(!3.1e){4 1Q=2r 2n("(?![^&;]+;)(?!<[^<>]*)("+Y+")(?![^<>]*>)(?![^&;]+;)","3w")}s{4 1Q=2r 2n("(?![^&;]+;)(?!<[^<>]*)("+Y+")(?![^<>]*>)(?![^&;]+;)","g")}5(3.2t){X[3.Z]=X[3.Z].1c(1Q,"<2v>$1</2v>")}5(!3.1M){11=11.10(X[3.Z])}s{11=3.1M.v(d,X,11)}I.2K(11);2R X;1r++;5(3.15&&3.15==1r){V}}}n.B("1N");5(1r<=0){I.10(\'<f A="c-2j">\'+3.2i+\'</f>\')}I.2k("2l",n.2x());j.1H();3.2m.v(d)}6 17(7,w){p.b(p.b()+7[3.N]+",");4 z=$(\'<f A="c-Q-z" L="c-Q-\'+w+\'"></f>\').1b(6(){3.1B.v(d,$(d));n.2y().B("M");$(d).F("M")}).1v(6(){C=m});4 1s=$(\'<a A="c-1s">&2T;</a>\').1b(6(){p.b(p.b().1c(","+7[3.N]+",",","));3.1P.v(d,z);C=G;l.1p();K m});J.3q(z.10(7[3.Z]).3v(1s));3.2w.v(d,J.t())}6 1A(1K){5($(":2D",j).o>0){4 W=$("f",j);5(1K=="1T"){4 R=W.3s(0)}s{4 R=W.3j(":S")}4 r=$("f.r:24",j);5(r.o>0){5(1K=="1T"){R=r.3p()}s{R=r.t()}}W.B("r");R.F("r")}}})}}})(3g);',62,219,'|||opts|var|if|function|data||||val|as|this||li||string||results_holder||input|false|selections_holder|length|values_input||active|else|prev|prefill_value|call|num|||item|class|removeClass|input_focus|preFill|hide|addClass|true|str|results_ul|org_li|return|id|selected|selectedValuesProp|for|timeout|selection|start|last|case|i_input|break|lis|this_data|query|selectedItemProp|html|formatted|d_count||d_type|retrieveLimit|new_v|add_selected_item|beforeRetrieve|tab_press|value|click|replace|prefill_count|matchCase|vals|ul|raw_data|blur|limit|lastKeyPressCode|new_data|preventDefault|n_data|startText|focus|elem|matchCount|close|split|names|mousedown|forward|search|searchObjProps|name|moveSelection|selectionClick|keyDelay|keyChange|in|hasOwnProperty|number|show|selectionLimit|processData|direction|v_data|formatList|loading|original|selectionRemoved|regx|asHtmlID|num_count|down|x_id|minChars|selections|attr|No|div|showResultList|clearTimeout|results|setTimeout|first|wrap|object|000|after|Math|keyCode|typeof|values|neverSubmit|lastChar|options|defaults|limitText|emptyText|message|css|width|resultsComplete|RegExp|toLowerCase|result|extend|new|attributes|resultsHighlight|resultClick|em|selectionAdded|outerWidth|children|retrieveComplete|encodeURIComponent|queryParam|req_string|visible|extraParams|org_data|More|Name|Selections|Are|append|list|hidden|as_values_|fn|autoSuggest|Enter|delete|type|times|floor|400|each|Results|Found|random|100|Here||off|autocomplete|Allowed|remove|undefined||not|hasClass|40|trim|first_focus|switch|188|jQuery|46|getJSON|filter|default|00|keydown|up|substring|next|before|mouseover|eq|null|totalSelections|prepend|gi'.split('|'),0,{}))
-- 
GitLab