PageSourceSearch

https://members.edaalberta.ca/_jquery/js/ajax-chosen.min.js

js edaalberta.ca collected 2026-10-05 01:20:32 UTC 2,776 bytes, 17 lines download raw bytes

1
2(function($){return $.fn.ajaxChosen=function(settings,callback,chosenOptions){var chosenXhr,defaultOptions,options,select;if(settings==null){settings={};}
3if(callback==null){callback={};}
4if(chosenOptions==null){chosenOptions=function(){};}
5defaultOptions={minTermLength:3,afterTypeDelay:500,jsonTermKey:"term",keepTypingMsg:"Keep typing...",lookingForMsg:"Looking for"};select=this;chosenXhr=null;options=$.extend({},defaultOptions,$(select).data(),settings);this.chosen(chosenOptions?chosenOptions:{});return this.each(function(){return $(this).next('.chzn-container').find(".search-field > input, .chzn-search > input").bind('keyup',function(){var field,msg,success,untrimmed_val,val;untrimmed_val=$(this).attr('value');val=$.trim($(this).attr('value'));msg=val.length<options.minTermLength?options.keepTypingMsg:options.lookingForMsg+(" '"+val+"'");select.next('.chzn-container').find('.no-results').text(msg);if(val===$(this).data('prevVal')){return false;}
6$(this).data('prevVal',val);if(this.timer){clearTimeout(this.timer);}
7if(val.length<options.minTermLength){return false;}
8field=$(this);if(!(options.data!=null)){options.data={};}
9options.data[options.jsonTermKey]=val;if(options.dataCallback!=null){options.data=options.dataCallback(options.data);}
10success=options.success;options.success=function(data){var items,selected_values;if(!(data!=null)){return;}
11selected_values=[];select.find('option').each(function(){if(!$(this).is(":selected")){return $(this).remove();}else{return selected_values.push($(this).val()+"-"+$(this).text());}});select.find('optgroup:empty').each(function(){return $(this).remove();});items=callback(data);$.each(items,function(i,element){var group,text,value;if(element.group){group=select.find("optgroup[label='"+element.text+"']");if(!group.size()){group=$("<optgroup />");}
12group.attr('label',element.text).appendTo(select);return $.each(element.items,function(i,element){var text,value;if(typeof element==="string"){value=i;text=element;}else{value=element.value;text=element.text;}
13if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr('value',value).html(text).appendTo(group);}});}else{if(typeof element==="string"){value=i;text=element;}else{value=element.value;text=element.text;}
14if($.inArray(value+"-"+text,selected_values)===-1){return $("<option />").attr('value',value).html(text).appendTo(select);}}});if(Object.keys(items).length){select.trigger("liszt:updated");}else{select.data().chosen.no_results_clear();select.data().chosen.no_results(field.attr('value'));}
15if(success!=null){success(data);}
16return field.attr('value',untrimmed_val);};return this.timer=setTimeout(function(){if(chosenXhr){chosenXhr.abort();}
17return chosenXhr=$.ajax(options);},options.afterTypeDelay);});});};})(jQuery);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.