PageSourceSearch

https://www.hamburg-tourism.de/_assets/b4ccaba872ad200c4e382984a31…/_vendor/imx.autocomplete.js?1789550564

js hamburg-tourism.de collected 2026-09-24 09:40:25 UTC 8,118 bytes, 1 lines download raw bytes

1window.imx=window.imx||{},imx.Autocomplete=function(t,e){this.keyCodes={UP:38,DOWN:40,RETURN:13,TAB:9,ESC:27,DEL:46};var i={appendTo:document.querySelector("body"),adapter:null,inputClass:"autocomplete",resultsClass:"results",loadingClass:"loading",enableListStyle:!0,minChars:1,delay:400,listElement:"<ul>",itemElement:"<li>",wrap:{start:function(t,e,i){return!1},end:function(t,e,i){return!1},element:"<div>"},templates:{},events:{select:function(t){return this},change:function(t){return this},create:function(){return this},destroy:function(){return this},show:function(){return this},hide:function(){return this},beforeRequest:function(){return this},afterRequest:function(){return this},error:function(){return this},blur:function(t){return!1},keyDown:function(t){return!1}}};this.setSettings(Autocomplete_util.extend(!0,i,e)),this.setInput(t),this.setList(this.buildAutocompleteList_())},imx.Autocomplete.prototype.getInput=function(){return this.input},imx.Autocomplete.prototype.setInput=function(t){return this.input=t,this},imx.Autocomplete.prototype.getList=function(){return this.list},imx.Autocomplete.prototype.setList=function(t){return this.list=t,this},imx.Autocomplete.prototype.getSettings=function(){return this.settings},imx.Autocomplete.prototype.setSettings=function(t){return this.settings=t,this},imx.Autocomplete.prototype.handleKeyDown_=function(t){var e=this,i=this.getInput(),n=this.getList(),s=this.getSettings(),o=null,l="";switch(t.keyCode){case e.keyCodes.UP:Autocomplete_util.isVisible(n)?(e.select_("prev",l),t.preventDefault()):e.show();break;case e.keyCodes.DOWN:Autocomplete_util.isVisible(n)?(e.select_("next",l),t.preventDefault()):e.show();break;case e.keyCodes.RETURN:case e.keyCodes.TAB:Autocomplete_util.isVisible(n)&&n.querySelectorAll(".selectable.selected").length>0&&(e.change_(),t.preventDefault());break;case e.keyCodes.ESC:e.hide();break;default:s.events.keyDown.call(this,t)||(clearTimeout(o),o=setTimeout((function(){l=i.value,e.handleChange_()}),s.delay))}},imx.Autocomplete.prototype.handleBlur_=function(t){this.getSettings().events.blur.call(this,t)||this.hide()},imx.Autocomplete.prototype.create=function(){var t=this.getInput(),e=this.getSettings();return t.setAttribute("autocomplete","nope"),t.classList.add(e.inputClass),t.addEventListener("keydown",this.handleKeyDown_.bind(this)),t.addEventListener("blur",this.handleBlur_.bind(this)),e.events.create.call(this),this},imx.Autocomplete.prototype.destroy=function(){var t=this.getInput(),e=this.getList();return t.removeAttribute("autocomplete"),t.classList.remove(this.getSettings().inputClass),t.removeEventListener("keydown",this.handleKeyDown_),t.removeEventListener("blur",this.handleBlur_),e.parentNode.removeChild(e),this.getSettings().events.destroy.call(this),this},imx.Autocomplete.prototype.show=function(){return this.getList().style.display="block",this.getSettings().events.show.call(this),this},imx.Autocomplete.prototype.hide=function(){var t=this.getList(),e=t.querySelector(".selectable.selected");return t.style.display="none",e&&e.classList.remove("selected"),this.getSettings().events.hide.call(this),this},imx.Autocomplete.prototype.select_=function(t,e){var i=this.getInput(),n=this.getList(),s=[],o=null,l=n.querySelector(".selectable.selected");if(l){s=l.parentNode.querySelectorAll(".selectable");for(var r=0;r<s.length;r++)if(s[r]===l){o="next"===t?s[r+1]:s[r-1];break}l.classList.remove("selected")}else s=n.querySelectorAll(".selectable"),o="next"===t?s[0]:s[s.length-1];if(o){var u=JSON.parse(o.dataset.item);o.classList.add("selected"),i.value=u.label,this.getSettings().events.select.call(this,u)}else i.value=e;return this},imx.Autocomplete.prototype.change_=function(){var t=this.getList().querySelector(".selectable.selected"),e=JSON.parse(t.dataset.item);if(Autocomplete_util.triggerEvent(this.getInput(),"setautocomplete"),t){if(e.href)return void(window.location.href=e.href);this.getInput().value=e.label,this.getSettings().events.change.call(this,e),this.hide()}return this},imx.Autocomplete.prototype.buildAutocompleteList_=function(){var t=this.getSettings(),e=this.getInput(),i=Autocomplete_util.createElementByTemplate(t.listElement);if(i.setAttribute("id",e.getAttribute("id")+"_autocomplete"),i.setAttribute("class","autocomplete "+t.resultsClass),t.enableListStyle){var n=e.getBoundingClientRect();i.style.display="none",i.style.width=e.offsetWidth+"px",i.style.position="absolute",i.style.top=n.top+document.body.scrollTop+e.offsetHeight+"px",i.style.left=n.left+document.body.scrollLeft+"px"}return Autocomplete_util.append(i,t.appendTo),i},imx.Autocomplete.prototype.handleChange_=function(){var t=this.getInput(),e=this.getSettings();return t.value.length>=e.minChars?(t.classList.add(e.loadingClass),this.handleAdapter_
1()):(t.classList.remove(e.loadingClass),this.hide()),this},imx.Autocomplete.prototype.handleAdapter_=function(){var t=this,e=this.getInput(),i=this.getList(),n=this.getSettings(),s=this.getInput().value;return n.adapter.request(s,(function(o){var l=null;i.innerHTML="";for(var r=0;r<o.length;r++){var u=o[r].type,a=n.templates[u];if("function"==typeof a){if(!0===n.wrap.start.call(t,o[r],r,o)){var c;c="function"==typeof n.wrap.element?n.wrap.element.call(t,o[r],r,o):n.wrap.element,l=Autocomplete_util.createElementByTemplate(c)}var p="item type-"+u;o[r].selectable&&(p+=" selectable");var h=Autocomplete_util.createElementByTemplate(n.itemElement);h.setAttribute("class",p),h.dataset.item=JSON.stringify(o[r]),o[r].selectable&&(h.addEventListener("mouseover",(function(){var e=i.querySelector(".selected");e&&e.classList.remove("selected"),this.classList.add("selected"),t.getSettings().events.select.call(t,JSON.parse(this.dataset.item))})),h.addEventListener("mousedown",(function(){t.change_()}))),h.innerHTML=a.call(t,o[r],s),l?Autocomplete_util.append(h,l):Autocomplete_util.append(h,i),!0===n.wrap.end.call(t,o[r],r,o)&&Autocomplete_util.append(l,i)}}i.childElementCount>0&&t.show(),e.classList.remove(n.loadingClass)}),n.events.beforeRequest,n.events.afterRequest,n.events.error),this},window.Autocomplete_util=function(t,e,i,n,s){var o=function(t){return t instanceof i},l=function(t){return null!==t&&"object"==typeof t&&t!==t.window&&n.getPrototypeOf(t)===n.prototype},r=function(t,e,i){for(var n in e)i&&(l(e[n])||o(e[n]))?(l(e[n])&&!l(t[n])&&(t[n]={}),o(e[n])&&!o(t[n])&&(t[n]=[]),r(t[n],e[n],i)):void 0!==e[n]&&(t[n]=e[n])};return{triggerEvent:function(i,n,s){var o=null;"function"==typeof t.CustomEvent?o=new CustomEvent(n,{detail:s}):(o=e.createEvent("CustomEvent")).initCustomEvent(n,!1,!1,{detail:s}),i.dispatchEvent(o)},append:function(t,e){e.appendChild(t)},isVisible:function(t){return(t.offsetWidth>0||t.offsetHeigth>0)&&"none"!==t.style.display},extend:function(t){var e,n=i.prototype.slice.call(arguments,1);return"boolean"==typeof t&&(e=t,t=n.shift()),n.forEach((function(i){r(t,i,e)})),t},serialize:function(t){var e=[];for(var i in t)t.hasOwnProperty(i)&&e.push(s(i)+"="+s(t[i]));return e.join("&")},createElementByTemplate:function(t){var i=e.createElement("template");return i.innerHTML=t,i.content?i.content.firstChild:i.firstChild}}}(window,document,Array,Object,encodeURIComponent),window.imx=window.imx||{},window.imx.Autocomplete=window.imx.Autocomplete||{},imx.Autocomplete.AjaxAdapter=function(t){this.requestObject=null,this.setSettings(Autocomplete_util.extend({url:"",extraParams:{}},t))},imx.Autocomplete.AjaxAdapter.prototype.getSettings=function(){return this.settings},imx.Autocomplete.AjaxAdapter.prototype.setSettings=function(t){return this.settings=t,this},imx.Autocomplete.AjaxAdapter.prototype.request=function(t,e,i,n,s){null!==this.requestObject&&this.requestObject.abort();var o=this.getSettings(),l={q:t},r=Autocomplete_util.extend(l,o.extraParams),u=Autocomplete_util.serialize(r),a=o.url;a=a+(-1!==a.indexOf("?")?"&":"?")+u;var c=new XMLHttpRequest;return c.open("GET",a,!0),"function"!=typeof s&&(s=function(){}),c.onload=function(){if(c.status>=200&&c.status<400){var t=JSON.parse(c.responseText);t.error?s(c):e(t.data)}else s(c);n()},i(),c.send(),this.requestObject=c,this};

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.