All Downloads are FREE. Search and download functionalities are using the official Maven repository.

template.js.plugins.jquery.combobox.min.js Maven / Gradle / Ivy

There is a newer version: 5.0.4
Show newest version
// Taken from jquery UI Combobox Example
(function(a){a.widget("ui.combobox",{options:{icon:false},_create:function(){var e=this;var c=this.element.hide(),g=c.children(":selected"),h=g.val()?g.text():"";c.focus();var d=a("").insertAfter(c).val(h).autocomplete({delay:0,minLength:0,source:function(j,i){var k=new RegExp(a.ui.autocomplete.escapeRegex(j.term),"i");i(c.children("option").map(function(){var l=a(this).text();if(this.value&&(!j.term||k.test(l))){return{label:l.replace(new RegExp("(?![^&;]+;)(?!<[^<>]*)("+a.ui.autocomplete.escapeRegex(j.term)+")(?![^<>]*>)(?![^&;]+;)","gi"),"$1"),value:l,option:this}}}))},focus:function(i,j){e._trigger("focus",i,{item:j.item});i.ui=j;if(e.options.onfocustopics){a.each(e.options.onfocustopics.split(","),function(k,l){c.publish(l,{item:j.item},i)})}},select:function(i,j){j.item.option.selected=true;e._trigger("select",i,{item:j.item});i.ui=j;if(e.options.onselecttopics){a.each(e.options.onselecttopics.split(","),function(k,l){c.publish(l,{item:j.item},i)})}},change:function(j,k){if(!k.item){var l=new RegExp("^"+a.ui.autocomplete.escapeRegex(a(this).val())+"$","i"),i=false;c.children("option").each(function(){if(this.value.match(l)){this.selected=i=true;return false}});if(!i){a(this).val("");c.val("");return false}}e._trigger("change",j,{item:k.item});j.ui=k;if(e.options.oncha){a.each(e.options.oncha.split(","),function(m,n){c.publish(n,{item:k.item},j)})}}}).addClass("ui-widget ui-widget-content ui-corner-left");d.data("autocomplete")._renderItem=function(i,j){return a("
  • ").data("item.autocomplete",j).append(""+j.label+"").appendTo(i)};if(e.options.icon===true){var b=d.outerHeight();var f=a("").attr("tabIndex",-1).attr("title","Show All Items").button({icons:{primary:"ui-icon-triangle-1-s"},text:false}).css("marginLeft","-1px").css("width",b).css("height",b).insertAfter(d).removeClass("ui-corner-all").addClass("ui-corner-right ui-button-icon").click(function(i){i.preventDefault();if(d.autocomplete("widget").is(":visible")){d.autocomplete("close");return}d.autocomplete("search","");d.focus()});f.find(".ui-button-icon-only .ui-button-text").css("padding","0.35em");f.css("margin",0).css("padding","0.48em 0 0.47em 0.45em;");f.position({of:d,my:"left center",at:"right center",offset:"0 0"})}}})})(jQuery);




    © 2015 - 2024 Weber Informatics LLC | Privacy Policy