1$(document).ready(function () { 2 3 var baseURL = window.location.protocol + "//" + window.location.host + "/"; 4 5 var geoCitiesJsonUri = baseURL + 'typo3conf/ext/bfd_einsatzstellensuche/Resources/Public/data/full-cities-ge.json'; 6 7 window.jsonCities = {}; 8 window.typeaheadSuggestion = {}; 9 window.typeaheadSuggestion.plz = ''; 10 11 $.getJSON(geoCitiesJsonUri, function (data) { 12 13 window.jsonCities = data.records; 14 15 /* 16 var geoCitiesJsonData = new Bloodhound({ 17 datumTokenizer: function (datum) { 18 return Bloodhound.tokenizers.whitespace([datum.fields.note]); 19 }, 20 queryTokenizer: Bloodhound.tokenizers.whitespace, 21 local: window.jsonCities, 22 identify: function (obj) { 23 return obj.fields.note; 24 } 25 }); 26 */ 27 28 var geoPlzJsonData = new Bloodhound({ 29 datumTokenizer: function (datum) { 30 return Bloodhound.tokenizers.whitespace([datum.fields.plz]); 31 }, 32 queryTokenizer: Bloodhound.tokenizers.whitespace, 33 local: window.jsonCities 34 }); 35 36 var $formPlzInput = $('#typeahead-plz'); 37 38 /* 39 var $formCityInput = $('#typeahead-ort'); 40 var $geoCitiesTypeahead = $('.geo-cities-typeahead'); 41 if ($geoCitiesTypeahead.length > 0) { 42 $geoCitiesTypeahead.typeahead({ 43 hint: true, 44 highlight: true, 45 minLength: 1, 46 limit: 99 47 }, 48 { 49 display: function (data) { 50 return data.fields.note; 51 }, 52 name: 'cities', 53 source: geoCitiesJsonData.ttAdapter(), 54 limit: 99, 55 templates: { 56 empty: function () { 57 return '<div class="widget-main"><div class="alert alert-danger">Keine Stadt gefunden</div></div>' 58 }, 59 suggestion: function (data) { 60 return '<div>' + data.fields.note + '</div>' 61 } 62 } 63 }); 64 65 } 66 */ 67 68 var $geoPlzTypeahead = $('.geo-plz-typeahead'); 69 if ($geoPlzTypeahead.length > 0) { 70 $geoPlzTypeahead.typeahead({ 71 hint: true, 72 highlight: true, 73 minLength: 1 74 }, 75 { 76 display: function (data) { 77 return data.fields.plz; 78 }, 79 name: 'plz', 80 source: geoPlzJsonData.ttAdapter(), 81 82 templates: { 83 empty: function () { 84 return '<div class="widget-main"><div class="alert alert-danger">Keine passende Postleitzahl gefunden</div></div>' 85 }, 86 suggestion: function (data) { 87 return '<div>' + data.fields.note + ' - ' + data.fields.plz + '</div>' 88 } 89 } 90 }); 91 92 /* 93 if ($formCityInput.length > 0) { 94 $geoPlzTypeahead.bind('typeahead:select', function (ev, suggestion) { 95 if (suggestion.fields.note !== undefined) { 96 $formCityInput.val(suggestion.fields.note); 97 } 98 }); 99 } 100 */ 101 } 102 103 }); 104});
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.