text: $(document).ready(function(){var e=["Aaron","Abel","Bacon","Barry","Clancy","Cornstalk","Daniel","David","Edison","Frank","George","Hamilton","Irvine","Jackson","Kelly","Lumb","Magee","Newton","Olson","Paul","Quine","Roy","Smith","Tony","Young","Zampa"];$(".ac-default").autocomplete({source:e});var t=["Jörn Zaefferer","Scott González","John Resig"],o={"á":"a","ö":"o"};$(".ac-accent-folding").autocomplete({source:function(e,a){var n=new RegExp($.ui.autocomplete.escapeRegex(e.term),"i");a($.grep(t,function(e){return e=e.label||e.value||e,n.test(e)||n.test(function(e){for(var t="",a=0;a<e.length;a++)t+=o[e.charAt(a)]||e.charAt(a);return t}(e))}))}}),$.widget("custom.catcomplete",$.ui.autocomplete,{_create:function(){this._super(),this.widget().menu("option","items","> :not(.ui-autocomplete-category)")},_renderMenu:function(e,t){var o=this,a="";$.each(t,function(t,n){var i;n.category!=a&&(e.append("<li class='ui-autocomplete-category'>"+n.category+"</li>"),a=n.category),i=o._renderItemData(e,n),n.category&&i.attr("aria-label",n.category+" : "+n.label)})}});$(".ac-category").catcomplete({delay:0,source:[{label:"anders",category:""},{label:"andreas",category:""},{label:"antal",category:""},{label:"annhhx10",category:"Products"},{label:"annk K12",category:"Products"},{label:"annttop C13",category:"Products"},{label:"anders andersson",category:"People"},{label:"andreas andersson",category:"People"},{label:"andreas johnson",category:"People"}]}),$.widget("custom.combobox",{_create:function(){this.wrapper=$("<div>").addClass("custom-combobox input-group").insertAfter(this.element),$('<div class="input-group-prepend"><span class="input-group-text"><i class="ft-search"></i></span></div>').appendTo(this.wrapper),this.element.hide(),this._createAutocomplete(),this._createShowAllButton()},_createAutocomplete:function(){var e=this.element.children(":selected"),t=e.val()?e.text():"";this.input=$("<input>").appendTo(this.wrapper).val(t).attr("title","").addClass("custom-combobox-input form-control ui-widget ui-widget-content ui-state-default ui-corner-left").autocomplete({delay:0,minLength:0,source:$.proxy(this,"_source")}).tooltip({classes:{"ui-tooltip":"ui-state-highlight"}}),this._on(this.input,{autocompleteselect:function(e,t){t.item.option.selected=!0,this._trigger("select",e,{item:t.item.option})},autocompletechange:"_removeIfInvalid"})},_createShowAllButton:function(){var e=this.input,t=!1;$('<div class="input-group-prepend"><span class="input-group-text ac-toggle"><i class="ft-chevron-down"></i></span></div>').attr("tabIndex",-1).appendTo(this.wrapper).removeClass("ui-corner-all").addClass("custom-combobox-toggle ui-corner-right").on("mousedown",function(){t=e.autocomplete("widget").is(":visible")}).on("click",function(){e.trigger("focus"),t||e.autocomplete("search","")})},_source:function(e,t){var o=new RegExp($.ui.autocomplete.escapeRegex(e.term),"i");t(this.element.children("option").map(function(){var t=$(this).text();if(this.value&&(!e.term||o.test(t)))return{label:t,value:t,option:this}}))},_removeIfInvalid:function(e,t){if(!t.item){var o=this.input.val(),a=o.toLowerCase(),n=!1;this.element.children("option").each(function(){if($(this).text().toLowerCase()===a)return this.selected=n=!0,!1}),n||(this.input.val("").attr("title",o+" didn't match any item").tooltip("open"),this.element.val(""),this._delay(function(){this.input.tooltip("close").attr("title","")},2500),this.input.autocomplete("instance").term="")}},_destroy:function(){this.wrapper.remove(),this.element.show()}}),$(".ac-combobox").combobox();function a(e){return e.split(/,\s*/)}$(".ac-project").autocomplete({minLength:0,source:[{value:"jquery",label:"jQuery",desc:"the write less, do more, JavaScript library",icon:"jquery_32x32.png"},{value:"jquery-ui",label:"jQuery UI",desc:"the official user interface library for jQuery",icon:"jqueryui_32x32.png"},{value:"sizzlejs",label:"Sizzle JS",desc:"a pure-JavaScript CSS selector engine",icon:"sizzlejs_32x32.png"}],focus:function(e,t){return $(".ac-project").val(t.item.label),!1},select:function(e,t){return $(".ac-project").val(t.item.label),$(".ac-project-id").val(t.item.value),$(".ac-project-description").html(t.item.desc),!1}}).autocomplete("instance")._renderItem=function(e,t){return $("<li>").append("<div>"+t.label+"<br>"+t.desc+"</div>").appendTo(e)},$(".ac-multiple-values").on("keydown",function(e){e.keyCode===$.ui.keyCode.TAB&&$(this).autocomplete("instance").menu.active&&e.preventDefault()}).autocomplete({minLength:0,source:function(t,o){o($.ui.autocomplete.filter(e,a(t.term).pop()))},focus:function(){return!1},select:function(e,t){var o=a(this.value);return o.pop(),o.push(t.item.value),o.push(""),this.value=o.join(", "),!1}}),$(".ac-remote-datasource").autocomplete({source:"../../../app-assets/data/jquery-ui/search.php",minLength:2});var n={};function i(e){return e.split(/,\s*/)}function r(e){return i(e).pop()}$(".ac-remote-caching").autocomplete({minLength:2,source:function(e,t){var o=e.term;o in n?t(n[o]):$.getJSON("../../../app-assets/data/jquery-ui/search.php",e,function(e,a,i){n[o]=e,t(e)})}}),$(".ac-multiple-remote").on("keydown",function(e){e.keyCode===$.ui.keyCode.TAB&&$(this).autocomplete("instance").menu.active&&e.preventDefault()}).autocomplete({source:function(e,t){$.getJSON("../../../app-assets/data/jquery-ui/search.php",{term:r(e.term)},t)},search:function(){if(r(this.value).length<2)return!1},focus:function(){return!1},select:function(e,t){var o=i(this.value);return o.pop(),o.push(t.item.value),o.push(""),this.value=o.join(", "),!1}}),$.ajax({url:"../../../app-assets/data/jquery-ui/london.xml",dataType:"xml",success:function(e){var t=$("geoname",e).map(function(){return{value:$("name",this).text()+", "+($.trim($("countryName",this).text())||"(unknown country)"),id:$("geonameId",this).text()}}).get();$(".ac-xml-data-parse").autocomplete({source:t,minLength:0})}})});