Sha256: 9c1fa5d89c1f610e194a57b44011f97ef2ddff6db9a6b5edbdfbb558abebb4f7

Contents?: true

Size: 1.55 KB

Versions: 1

Compression:

Stored size: 1.55 KB

Contents

var autocomplete_data_static={};$(document).ready(function(){$('input[data-provide="typeahead"][data-source-array]').each(function(){obj=$(this);var t=JSON.parse(obj.attr("data-source-array").replace(/"/g,'"'));obj.typeahead({source:t,items:obj.attr("data-items"),minLength:obj.attr("data-min-length")})}),$('input[data-provide="typeahead"][data-source]').each(function(){obj=$(this);var t=obj.attr("id");autocomplete_data_static[t]={map:[],values:[]},$.get(obj.attr("data-source"),function(a){$.each(a,function(a,e){autocomplete_data_static[t].values.push(e[1]),autocomplete_data_static[t].map[e[1]]=e[0]}),obj.typeahead({source:autocomplete_data_static[t].values,updater:function(a){return obj_id=$("#"+obj.attr("data-field-id")),obj_id&&obj_id.val(autocomplete_data_static[t].map[a]),a},items:obj.attr("data-items"),minLength:obj.attr("data-min-length")})},"json")}),$('input[data-provide="typeahead"][data-source-query]').each(function(){obj=$(this),obj.typeahead({source:function(t,a){obj=this.$element,rows=[];var e=obj.attr("name");autocomplete_data_static[e]={map:[],values:[]},$.getJSON(obj.attr("data-source-query"),{q:t},function(t){$.each(t,function(t,a){autocomplete_data_static[e].values.push(a[1]),autocomplete_data_static[e].map[a[1]]=a[0]}),a(autocomplete_data_static[e].values)})},updater:function(t){obj=this.$element;var a=obj.attr("name");return obj_id=$("#"+obj.attr("data-field-id")),obj_id&&obj_id.val(autocomplete_data_static[a].map[t]),t},items:obj.attr("data-items"),minLength:obj.attr("data-min-length"),afterSelect:obj.attr("data-afterSelect")})})});

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bootstrap3_autocomplete_input-0.0.5 lib/assets/javascripts/bootstrap3-autocomplete-input.min.js