/** * Ajax Autocomplete for jQuery, version %version% * (c) 2017 Tomas Kirda * * Ajax Autocomplete for jQuery is freely distributable under the terms of an MIT-style license. * For details, see the web site: https://github.com/devbridge/jQuery-Autocomplete */ /*jslint browser: true, white: true, single: true, this: true, multivar: true */ /*global define, window, document, jQuery, exports, require */ // Expose plugin as an AMD module if AMD loader is present: (function (factory) { "use strict"; if (typeof define === 'function' && define.amd) { // AMD. Register as an anonymous module. define(['jquery'], factory); } else if (typeof exports === 'object' && typeof require === 'function') { // Browserify factory(require('jquery')); } else { // Browser globals factory(jQuery); } }(function ($) { 'use strict'; var utils = (function () { return { escapeRegExChars: function (value) { return value.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&"); }, createNode: function (containerClass) { var div = document.createElement('div'); div.className = containerClass; div.style.position = 'absolute'; div.style.display = 'none'; return div; } }; }()), keys = { ESC: 27, TAB: 9, RETURN: 13, LEFT: 37, UP: 38, RIGHT: 39, DOWN: 40 }, noop = $.noop; function Autocomplete(el, options) { var that = this; // Shared variables: that.element = el; that.el = $(el); that.suggestions = []; that.badQueries = []; that.selectedIndex = -1; that.currentValue = that.element.value; that.timeoutId = null; that.cachedResponse = {}; that.onChangeTimeout = null; that.onChange = null; that.isLocal = false; that.suggestionsContainer = null; that.noSuggestionsContainer = null; that.options = $.extend(true, {}, Autocomplete.defaults, options); that.classes = { selected: 'selected', suggestion: 'autocomplete-suggestion' }; that.hint = null; that.hintValue = ''; that.selection = null; // Initialize and set options: that.initialize(); that.setOptions(options); } Autocomplete.utils = utils; $.Autocomplete = Autocomplete; Autocomplete.defaults = { ajaxSettings: {}, autoSelectFirst: false, appendTo: 'body', serviceUrl: null, lookup: null, onSelect: null, width: 'auto', minChars: 1, maxHeight: 300, deferRequestBy: 0, params: {}, formatResult: _formatResult, formatGroup: _formatGroup, delimiter: null, zIndex: 9999, type: 'GET', noCache: false, onSearchStart: noop, onSearchComplete: noop, onSearchError: noop, preserveInput: false, containerClass: 'autocomplete-suggestions', tabDisabled: false, dataType: 'text', currentRequest: null, triggerSelectOnValidInput: true, preventBadQueries: true, lookupFilter: _lookupFilter, paramName: 'query', transformResult: _transformResult, showNoSuggestionNotice: false, noSuggestionNotice: 'No results', orientation: 'bottom', forceFixPosition: false }; function _lookupFilter(suggestion, originalQuery, queryLowerCase) { return suggestion.value.toLowerCase().indexOf(queryLowerCase) !== -1; }; function _transformResult(response) { return typeof response === 'string' ? $.parseJSON(response) : response; }; function _formatResult(suggestion, currentValue) { // Do not replace anything if the current value is empty if (!currentValue) { return suggestion.value; } var pattern = '(' + utils.escapeRegExChars(currentValue) + ')'; return suggestion.value .replace(new RegExp(pattern, 'gi'), '$1<\/strong>') .replace(/&/g, '&') .replace(//g, '>') .replace(/"/g, '"') .replace(/<(\/?strong)>/g, '<$1>'); }; function _formatGroup(suggestion, category) { return '
' + category + '
'; }; Autocomplete.prototype = { initialize: function () { var that = this, suggestionSelector = '.' + that.classes.suggestion, selected = that.classes.selected, options = that.options, container; that.element.setAttribute('autocomplete', 'off'); // html() deals with many types: htmlString or Element or Array or jQuery that.noSuggestionsContainer = $('
') .html(this.options.noSuggestionNotice).get(0); that.suggestionsContainer = Autocomplete.utils.createNode(options.containerClass); container = $(that.suggestionsContainer); container.appendTo(options.appendTo || 'body'); // Only set width if it was provided: if (options.width !== 'auto') { container.css('width', options.width); } // Listen for mouse over event on suggestions list: container.on('mouseover.autocomplete', suggestionSelector, function () { that.activate($(this).data('index')); }); // Deselect active element when mouse leaves suggestions container: container.on('mouseout.autocomplete', function () { that.selectedIndex = -1; container.children('.' + selected).removeClass(selected); }); // Listen for click event on suggestions list: container.on('click.autocomplete', suggestionSelector, function () { that.select($(this).data('index')); }); container.on('click.autocomplete', function () { clearTimeout(that.blurTimeoutId); }) that.fixPositionCapture = function () { if (that.visible) { that.fixPosition(); } }; $(window).on('resize.autocomplete', that.fixPositionCapture); that.el.on('keydown.autocomplete', function (e) { that.onKeyPress(e); }); that.el.on('keyup.autocomplete', function (e) { that.onKeyUp(e); }); that.el.on('blur.autocomplete', function () { that.onBlur(); }); that.el.on('focus.autocomplete', function () { that.onFocus(); }); that.el.on('change.autocomplete', function (e) { that.onKeyUp(e); }); that.el.on('input.autocomplete', function (e) { that.onKeyUp(e); }); }, onFocus: function () { var that = this; if (that.disabled) { return; } that.fixPosition(); if (that.el.val().length >= that.options.minChars) { that.onValueChange(); } }, onBlur: function () { var that = this, options = that.options, value = that.el.val(), query = that.getQuery(value); // If user clicked on a suggestion, hide() will // be canceled, otherwise close suggestions that.blurTimeoutId = setTimeout(function () { that.hide(); if (that.selection && that.currentValue !== query) { (options.onInvalidateSelection || $.noop).call(that.element); } }, 200); }, abortAjax: function () { var that = this; if (that.currentRequest) { that.currentRequest.abort(); that.currentRequest = null; } }, setOptions: function (suppliedOptions) { var that = this, options = $.extend({}, that.options, suppliedOptions); that.isLocal = Array.isArray(options.lookup); if (that.isLocal) { options.lookup = that.verifySuggestionsFormat(options.lookup); } options.orientation = that.validateOrientation(options.orientation, 'bottom'); // Adjust height, width and z-index: $(that.suggestionsContainer).css({ 'max-height': options.maxHeight + 'px', 'width': options.width + 'px', 'z-index': options.zIndex }); this.options = options; }, clearCache: function () { this.cachedResponse = {}; this.badQueries = []; }, clear: function () { this.clearCache(); this.currentValue = ''; this.suggestions = []; }, disable: function () { var that = this; that.disabled = true; clearTimeout(that.onChangeTimeout); that.abortAjax(); }, enable: function () { this.disabled = false; }, fixPosition: function () { // Use only when container has already its content var that = this, $container = $(that.suggestionsContainer), containerParent = $container.parent().get(0); // Fix position automatically when appended to body. // In other cases force parameter must be given. if (containerParent !== document.body && !that.options.forceFixPosition) { return; } // Choose orientation var orientation = that.options.orientation, containerHeight = $container.outerHeight(), height = that.el.outerHeight(), offset = that.el.offset(), styles = { 'top': offset.top, 'left': offset.left }; if (orientation === 'auto') { var viewPortHeight = $(window).height(), scrollTop = $(window).scrollTop(), topOverflow = -scrollTop + offset.top - containerHeight, bottomOverflow = scrollTop + viewPortHeight - (offset.top + height + containerHeight); orientation = (Math.max(topOverflow, bottomOverflow) === topOverflow) ? 'top' : 'bottom'; } if (orientation === 'top') { styles.top += -containerHeight; } else { styles.top += height; } // If container is not positioned to body, // correct its position using offset parent offset if(containerParent !== document.body) { var opacity = $container.css('opacity'), parentOffsetDiff; if (!that.visible){ $container.css('opacity', 0).show(); } parentOffsetDiff = $container.offsetParent().offset(); styles.top -= parentOffsetDiff.top; styles.top += containerParent.scrollTop; styles.left -= parentOffsetDiff.left; if (!that.visible){ $container.css('opacity', opacity).hide(); } } if (that.options.width === 'auto') { styles.width = that.el.outerWidth() + 'px'; } $container.css(styles); }, isCursorAtEnd: function () { var that = this, valLength = that.el.val().length, selectionStart = that.element.selectionStart, range; if (typeof selectionStart === 'number') { return selectionStart === valLength; } if (document.selection) { range = document.selection.createRange(); range.moveStart('character', -valLength); return valLength === range.text.length; } return true; }, onKeyPress: function (e) { var that = this; // If suggestions are hidden and user presses arrow down, display suggestions: if (!that.disabled && !that.visible && e.which === keys.DOWN && that.currentValue) { that.suggest(); return; } if (that.disabled || !that.visible) { return; } switch (e.which) { case keys.ESC: that.el.val(that.currentValue); that.hide(); break; case keys.RIGHT: if (that.hint && that.options.onHint && that.isCursorAtEnd()) { that.selectHint(); break; } return; case keys.TAB: if (that.hint && that.options.onHint) { that.selectHint(); return; } if (that.selectedIndex === -1) { that.hide(); return; } that.select(that.selectedIndex); if (that.options.tabDisabled === false) { return; } break; case keys.RETURN: if (that.selectedIndex === -1) { that.hide(); return; } that.select(that.selectedIndex); break; case keys.UP: that.moveUp(); break; case keys.DOWN: that.moveDown(); break; default: return; } // Cancel event if function did not return: e.stopImmediatePropagation(); e.preventDefault(); }, onKeyUp: function (e) { var that = this; if (that.disabled) { return; } switch (e.which) { case keys.UP: case keys.DOWN: return; } clearTimeout(that.onChangeTimeout); if (that.currentValue !== that.el.val()) { that.findBestHint(); if (that.options.deferRequestBy > 0) { // Defer lookup in case when value changes very quickly: that.onChangeTimeout = setTimeout(function () { that.onValueChange(); }, that.options.deferRequestBy); } else { that.onValueChange(); } } }, onValueChange: function () { if (this.ignoreValueChange) { this.ignoreValueChange = false; return; } var that = this, options = that.options, value = that.el.val(), query = that.getQuery(value); if (that.selection && that.currentValue !== query) { that.selection = null; (options.onInvalidateSelection || $.noop).call(that.element); } clearTimeout(that.onChangeTimeout); that.currentValue = value; that.selectedIndex = -1; // Check existing suggestion for the match before proceeding: if (options.triggerSelectOnValidInput && that.isExactMatch(query)) { that.select(0); return; } if (query.length < options.minChars) { that.hide(); } else { that.getSuggestions(query); } }, isExactMatch: function (query) { var suggestions = this.suggestions; return (suggestions.length === 1 && suggestions[0].value.toLowerCase() === query.toLowerCase()); }, getQuery: function (value) { var delimiter = this.options.delimiter, parts; if (!delimiter) { return value; } parts = value.split(delimiter); return $.trim(parts[parts.length - 1]); }, getSuggestionsLocal: function (query) { var that = this, options = that.options, queryLowerCase = query.toLowerCase(), filter = options.lookupFilter, limit = parseInt(options.lookupLimit, 10), data; data = { suggestions: $.grep(options.lookup, function (suggestion) { return filter(suggestion, query, queryLowerCase); }) }; if (limit && data.suggestions.length > limit) { data.suggestions = data.suggestions.slice(0, limit); } return data; }, getSuggestions: function (q) { var response, that = this, options = that.options, serviceUrl = options.serviceUrl, params, cacheKey, ajaxSettings; options.params[options.paramName] = q; if (options.onSearchStart.call(that.element, options.params) === false) { return; } params = options.ignoreParams ? null : options.params; if ($.isFunction(options.lookup)){ options.lookup(q, function (data) { that.suggestions = data.suggestions; that.suggest(); options.onSearchComplete.call(that.element, q, data.suggestions); }); return; } if (that.isLocal) { response = that.getSuggestionsLocal(q); } else { if ($.isFunction(serviceUrl)) { serviceUrl = serviceUrl.call(that.element, q); } cacheKey = serviceUrl + '?' + $.param(params || {}); response = that.cachedResponse[cacheKey]; } if (response && Array.isArray(response.suggestions)) { that.suggestions = response.suggestions; that.suggest(); options.onSearchComplete.call(that.element, q, response.suggestions); } else if (!that.isBadQuery(q)) { that.abortAjax(); ajaxSettings = { url: serviceUrl, data: params, type: options.type, dataType: options.dataType }; $.extend(ajaxSettings, options.ajaxSettings); that.currentRequest = $.ajax(ajaxSettings).done(function (data) { var result; that.currentRequest = null; result = options.transformResult(data, q); that.processResponse(result, q, cacheKey); options.onSearchComplete.call(that.element, q, result.suggestions); }).fail(function (jqXHR, textStatus, errorThrown) { options.onSearchError.call(that.element, q, jqXHR, textStatus, errorThrown); }); } else { options.onSearchComplete.call(that.element, q, []); } }, isBadQuery: function (q) { if (!this.options.preventBadQueries){ return false; } var badQueries = this.badQueries, i = badQueries.length; while (i--) { if (q.indexOf(badQueries[i]) === 0) { return true; } } return false; }, hide: function () { var that = this, container = $(that.suggestionsContainer); if ($.isFunction(that.options.onHide) && that.visible) { that.options.onHide.call(that.element, container); } that.visible = false; that.selectedIndex = -1; clearTimeout(that.onChangeTimeout); $(that.suggestionsContainer).hide(); that.signalHint(null); }, suggest: function () { if (!this.suggestions.length) { if (this.options.showNoSuggestionNotice) { this.noSuggestions(); } else { this.hide(); } return; } var that = this, options = that.options, groupBy = options.groupBy, formatResult = options.formatResult, value = that.getQuery(that.currentValue), className = that.classes.suggestion, classSelected = that.classes.selected, container = $(that.suggestionsContainer), noSuggestionsContainer = $(that.noSuggestionsContainer), beforeRender = options.beforeRender, html = '', category, formatGroup = function (suggestion, index) { var currentCategory = suggestion.data[groupBy]; if (category === currentCategory){ return ''; } category = currentCategory; return options.formatGroup(suggestion, category); }; if (options.triggerSelectOnValidInput && that.isExactMatch(value)) { that.select(0); return; } // Build suggestions inner HTML: $.each(that.suggestions, function (i, suggestion) { if (groupBy){ html += formatGroup(suggestion, value, i); } html += '
' + formatResult(suggestion, value, i) + '
'; }); this.adjustContainerWidth(); noSuggestionsContainer.detach(); container.html(html); if ($.isFunction(beforeRender)) { beforeRender.call(that.element, container, that.suggestions); } that.fixPosition(); container.show(); // Select first value by default: if (options.autoSelectFirst) { that.selectedIndex = 0; container.scrollTop(0); container.children('.' + className).first().addClass(classSelected); } that.visible = true; that.findBestHint(); }, noSuggestions: function() { var that = this, beforeRender = that.options.beforeRender, container = $(that.suggestionsContainer), noSuggestionsContainer = $(that.noSuggestionsContainer); this.adjustContainerWidth(); // Some explicit steps. Be careful here as it easy to get // noSuggestionsContainer removed from DOM if not detached properly. noSuggestionsContainer.detach(); // clean suggestions if any container.empty(); container.append(noSuggestionsContainer); if ($.isFunction(beforeRender)) { beforeRender.call(that.element, container, that.suggestions); } that.fixPosition(); container.show(); that.visible = true; }, adjustContainerWidth: function() { var that = this, options = that.options, width, container = $(that.suggestionsContainer); // If width is auto, adjust width before displaying suggestions, // because if instance was created before input had width, it will be zero. // Also it adjusts if input width has changed. if (options.width === 'auto') { width = that.el.outerWidth(); container.css('width', width > 0 ? width : 300); } else if(options.width === 'flex') { // Trust the source! Unset the width property so it will be the max length // the containing elements. container.css('width', ''); } }, findBestHint: function () { var that = this, value = that.el.val().toLowerCase(), bestMatch = null; if (!value) { return; } $.each(that.suggestions, function (i, suggestion) { var foundMatch = suggestion.value.toLowerCase().indexOf(value) === 0; if (foundMatch) { bestMatch = suggestion; } return !foundMatch; }); that.signalHint(bestMatch); }, signalHint: function (suggestion) { var hintValue = '', that = this; if (suggestion) { hintValue = that.currentValue + suggestion.value.substr(that.currentValue.length); } if (that.hintValue !== hintValue) { that.hintValue = hintValue; that.hint = suggestion; (this.options.onHint || $.noop)(hintValue); } }, verifySuggestionsFormat: function (suggestions) { // If suggestions is string array, convert them to supported format: if (suggestions.length && typeof suggestions[0] === 'string') { return $.map(suggestions, function (value) { return { value: value, data: null }; }); } return suggestions; }, validateOrientation: function(orientation, fallback) { orientation = $.trim(orientation || '').toLowerCase(); if($.inArray(orientation, ['auto', 'bottom', 'top']) === -1){ orientation = fallback; } return orientation; }, processResponse: function (result, originalQuery, cacheKey) { var that = this, options = that.options; result.suggestions = that.verifySuggestionsFormat(result.suggestions); // Cache results if cache is not disabled: if (!options.noCache) { that.cachedResponse[cacheKey] = result; if (options.preventBadQueries && !result.suggestions.length) { that.badQueries.push(originalQuery); } } // Return if originalQuery is not matching current query: /*if (originalQuery !== that.getQuery(that.currentValue)) { return; }*/ that.suggestions = result.suggestions; that.suggest(); }, activate: function (index) { var that = this, activeItem, selected = that.classes.selected, container = $(that.suggestionsContainer), children = container.find('.' + that.classes.suggestion); container.find('.' + selected).removeClass(selected); that.selectedIndex = index; if (that.selectedIndex !== -1 && children.length > that.selectedIndex) { activeItem = children.get(that.selectedIndex); $(activeItem).addClass(selected); return activeItem; } return null; }, selectHint: function () { var that = this, i = $.inArray(that.hint, that.suggestions); that.select(i); }, select: function (i) { var that = this; that.hide(); that.onSelect(i); }, moveUp: function () { var that = this; if (that.selectedIndex === -1) { return; } if (that.selectedIndex === 0) { $(that.suggestionsContainer).children('.' + that.classes.suggestion).first().removeClass(that.classes.selected); that.selectedIndex = -1; that.ignoreValueChange = false; that.el.val(that.currentValue); that.findBestHint(); return; } that.adjustScroll(that.selectedIndex - 1); }, moveDown: function () { var that = this; if (that.selectedIndex === (that.suggestions.length - 1)) { return; } that.adjustScroll(that.selectedIndex + 1); }, adjustScroll: function (index) { var that = this, activeItem = that.activate(index); if (!activeItem) { return; } var offsetTop, upperBound, lowerBound, heightDelta = $(activeItem).outerHeight(); offsetTop = activeItem.offsetTop; upperBound = $(that.suggestionsContainer).scrollTop(); lowerBound = upperBound + that.options.maxHeight - heightDelta; if (offsetTop < upperBound) { $(that.suggestionsContainer).scrollTop(offsetTop); } else if (offsetTop > lowerBound) { $(that.suggestionsContainer).scrollTop(offsetTop - that.options.maxHeight + heightDelta); } if (!that.options.preserveInput) { // During onBlur event, browser will trigger "change" event, // because value has changed, to avoid side effect ignore, // that event, so that correct suggestion can be selected // when clicking on suggestion with a mouse that.ignoreValueChange = true; that.el.val(that.getValue(that.suggestions[index].value)); } that.signalHint(null); }, onSelect: function (index) { var that = this, onSelectCallback = that.options.onSelect, suggestion = that.suggestions[index]; that.currentValue = that.getValue(suggestion.value); if (that.currentValue !== that.el.val() && !that.options.preserveInput) { that.el.val(that.currentValue); } that.signalHint(null); that.suggestions = []; that.selection = suggestion; if ($.isFunction(onSelectCallback)) { onSelectCallback.call(that.element, suggestion); } }, getValue: function (value) { var that = this, delimiter = that.options.delimiter, currentValue, parts; if (!delimiter) { return value; } currentValue = that.currentValue; parts = currentValue.split(delimiter); if (parts.length === 1) { return value; } return currentValue.substr(0, currentValue.length - parts[parts.length - 1].length) + value; }, dispose: function () { var that = this; that.el.off('.autocomplete').removeData('autocomplete'); $(window).off('resize.autocomplete', that.fixPositionCapture); $(that.suggestionsContainer).remove(); } }; // Create chainable jQuery plugin: $.fn.devbridgeAutocomplete = function (options, args) { var dataKey = 'autocomplete'; // If function invoked without argument return // instance of the first matched element: if (!arguments.length) { return this.first().data(dataKey); } return this.each(function () { var inputElement = $(this), instance = inputElement.data(dataKey); if (typeof options === 'string') { if (instance && typeof instance[options] === 'function') { instance[options](args); } } else { // If instance already exists, destroy it: if (instance && instance.dispose) { instance.dispose(); } instance = new Autocomplete(this, options); inputElement.data(dataKey, instance); } }); }; // Don't overwrite if it already exists if (!$.fn.autocompleter) { $.fn.autocompleter = $.fn.devbridgeAutocomplete; } })); if(function(t,e){"function"==typeof define&&define.amd?define("jquery-bridget/jquery-bridget",["jquery"],function(i){return e(t,i)}):"object"==typeof module&&module.exports?module.exports=e(t,require("jquery")):t.jQueryBridget=e(t,t.jQuery)}(window,function(t,e){"use strict";function i(i,s,a){function l(t,e,n){var o,s="$()."+i+'("'+e+'")';return t.each(function(t,l){var h=a.data(l,i);if(h){var d=h[e];if(d&&"_"!=e.charAt(0)){var u=d.apply(h,n);o=void 0===o?u:o}else r(s+" is not a valid method")}else r(i+" not initialized. Cannot call methods, i.e. "+s)}),void 0!==o?o:t}function h(t,e){t.each(function(t,n){var o=a.data(n,i);o?(o.option(e),o._init()):(o=new s(n,e),a.data(n,i,o))})}(a=a||e||t.jQuery)&&(s.prototype.option||(s.prototype.option=function(t){a.isPlainObject(t)&&(this.options=a.extend(!0,this.options,t))}),a.fn[i]=function(t){return"string"==typeof t?l(this,t,o.call(arguments,1)):(h(this,t),this)},n(a))}function n(t){!t||t&&t.bridget||(t.bridget=i)}var o=Array.prototype.slice,s=t.console,r=void 0===s?function(){}:function(t){s.error(t)};return n(e||t.jQuery),i}),function(t,e){"function"==typeof define&&define.amd?define("ev-emitter/ev-emitter",e):"object"==typeof module&&module.exports?module.exports=e():t.EvEmitter=e()}("undefined"!=typeof window?window:this,function(){function t(){}var e=t.prototype;return e.on=function(t,e){if(t&&e){var i=this._events=this._events||{},n=i[t]=i[t]||[];return-1==n.indexOf(e)&&n.push(e),this}},e.once=function(t,e){if(t&&e){this.on(t,e);var i=this._onceEvents=this._onceEvents||{};return(i[t]=i[t]||{})[e]=!0,this}},e.off=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=i.indexOf(e);return-1!=n&&i.splice(n,1),this}},e.emitEvent=function(t,e){var i=this._events&&this._events[t];if(i&&i.length){var n=0,o=i[n];e=e||[];for(var s=this._onceEvents&&this._onceEvents[t];o;){var r=s&&s[o];r&&(this.off(t,o),delete s[o]),o.apply(this,e),o=i[n+=r?0:1]}return this}},t}),function(t,e){"use strict";"function"==typeof define&&define.amd?define("get-size/get-size",[],function(){return e()}):"object"==typeof module&&module.exports?module.exports=e():t.getSize=e()}(window,function(){"use strict";function t(t){var e=parseFloat(t);return-1==t.indexOf("%")&&!isNaN(e)&&e}function e(){for(var t={width:0,height:0,innerWidth:0,innerHeight:0,outerWidth:0,outerHeight:0},e=0;e
")}function i(t,e){this.el=d(t),this.el.attr("autocomplete","off"),this.suggestions=[],this.data=[],this.badQueries=[],this.selectedIndex=-1,this.currentValue=this.el.val(),this.intervalId=0,this.cachedResponse=[],this.onChangeInterval=null,this.ignoreValueChange=!1,this.serviceUrl=e.serviceUrl,this.isLocal=!1,this.options={autoSubmit:!1,minChars:1,maxHeight:300,deferRequestBy:0,width:0,highlight:!0,params:{},fnFormatResult:l,delimiter:null,zIndex:9999},this.initialize(),this.setOptions(e)}var m=new RegExp("(\\/|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\[|\\]|\\{|\\}|\\\\)","g");d.fn.autocomplete=function(t){return new i(this.get(0)||d(""),t)},i.prototype={killerFn:null,initialize:function(){var t,e,i;t=this,i="Autocomplete_"+(e=Math.floor(1048576*Math.random()).toString(16)),this.killerFn=function(e){0===d(e.target).parents(".autocomplete").size()&&(t.killSuggestions(),t.disableKillerFn())},this.options.width||(this.options.width=this.el.width()),this.mainContainerId="AutocompleteContainter_"+e,d('
').appendTo("body"),this.container=d("#"+i),this.fixPosition(),window.opera?this.el.keypress(function(e){t.onKeyPress(e)}):this.el.keydown(function(e){t.onKeyPress(e)}),this.el.keyup(function(e){t.onKeyUp(e)}),this.el.blur(function(){t.enableKillerFn()}),this.el.focus(function(){t.fixPosition()})},setOptions:function(t){var e=this.options;d.extend(e,t),e.lookup&&(this.isLocal=!0,d.isArray(e.lookup)&&(e.lookup={suggestions:e.lookup,data:[]})),d("#"+this.mainContainerId).css({zIndex:e.zIndex}),this.container.css({maxHeight:e.maxHeight+"px",width:e.width})},clearCache:function(){this.cachedResponse=[],this.badQueries=[]},disable:function(){this.disabled=!0},enable:function(){this.disabled=!1},fixPosition:function(){var t=this.el.offset();d("#"+this.mainContainerId).css({top:t.top+this.el.innerHeight()+"px",left:t.left+"px"})},enableKillerFn:function(){d(document).bind("click",this.killerFn)},disableKillerFn:function(){d(document).unbind("click",this.killerFn)},killSuggestions:function(){var t=this;this.stopKillSuggestions(),this.intervalId=window.setInterval(function(){t.hide(),t.stopKillSuggestions()},300)},stopKillSuggestions:function(){window.clearInterval(this.intervalId)},onKeyPress:function(t){if(!this.disabled&&this.enabled){switch(t.keyCode){case 27:this.el.val(this.currentValue),this.hide();break;case 9:case 13:if(-1===this.selectedIndex)return void this.hide();if(this.select(this.selectedIndex),9===t.keyCode)return;break;case 38:this.moveUp();break;case 40:this.moveDown();break;default:return}t.stopImmediatePropagation(),t.preventDefault()}},onKeyUp:function(t){if(!this.disabled){switch(t.keyCode){case 38:case 40:return}if(clearInterval(this.onChangeInterval),this.currentValue!==this.el.val())if(this.options.deferRequestBy>0){var e=this;this.onChangeInterval=setInterval(function(){e.onValueChange()},this.options.deferRequestBy)}else this.onValueChange()}},onValueChange:function(){clearInterval(this.onChangeInterval),this.currentValue=this.el.val();var t=this.getQuery(this.currentValue);this.selectedIndex=-1,this.ignoreValueChange?this.ignoreValueChange=!1:""===t||t.length'+n(i,this.data[s],o)+"")).mouseover(r(s)),i.click(a(s)),this.container.append(i);this.enabled=!0,this.container.show()}},processResponse:function(b){var a;try{a=eval("("+b+")")}catch(t){return}d.isArray(a.data)||(a.data=[]),this.options.noCache||(this.cachedResponse[a.query]=a,0===a.suggestions.length&&this.badQueries.push(a.query)),a.query===this.getQuery(this.currentValue)&&(this.suggestions=a.suggestions,this.data=a.data,this.suggest())},activate:function(t){var e,i;return e=this.container.children(),-1!==this.selectedIndex&&e.length>this.selectedIndex&&d(e.get(this.selectedIndex)).removeClass(),this.selectedIndex=t,-1!==this.selectedIndex&&e.length>this.selectedIndex&&(i=e.get(this.selectedIndex),d(i).addClass("selected")),i},deactivate:function(t,e){t.className="",this.selectedIndex===e&&(this.selectedIndex=-1)},select:function(t){var e;(e=this.suggestions[t])&&(this.el.val(e),this.options.autoSubmit&&(e=this.el.parents("form")).length>0&&e.get(0).submit(),this.ignoreValueChange=!0,this.hide(),this.onSelect(t))},moveUp:function(){-1!==this.selectedIndex&&(0===this.selectedIndex?(this.container.children().get(0).className="",this.selectedIndex=-1,this.el.val(this.currentValue)):this.adjustScroll(this.selectedIndex-1))},moveDown:function(){this.selectedIndex!==this.suggestions.length-1&&this.adjustScroll(this.selectedIndex+1)},adjustScroll:function(t){var e,i,n;e=this.activate(t).offsetTop,n=(i=this.container.scrollTop())+this.options.maxHeight-25,en&&this.container.scrollTop(e-this.options.maxHeight+25),this.el.val(this.getValue(this.suggestions[t]))},onSelect:function(t){var e,i;e=this.options.onSelect,i=this.suggestions[t],t=this.data[t],this.el.val(this.getValue(i)),d.isFunction(e)&&e(i,t,this.el)},getValue:function(t){var e,i;return(e=this.options.delimiter)?(i=this.currentValue,1===(e=i.split(e)).length?t:i.substr(0,i.length-e[e.length-1].length)+t):t}}}(jQuery),function(t){t.fn.customSelectBox=function(e){return e=t.extend({selectboxClass:"styled-select",buttonClass:"curr",selectedClass:"selected",disabledClass:"disabled",focusedClass:"focused"},e),this.each(function(){var i=t(this),n=0;i.css("visibility","hidden").wrap('
');var o=i.parent(),s=o.find("option"),r=i.find("option:selected").html();o.append(''+r+''),s.each(function(){var i=t(this),n=i.val()?i.val():i.html(),s=i.html(),r=i.is(":selected")?e.selectedClass:i.is(":disabled")?e.disabledClass:"";o.find("ul").append('
  • '+s+"
  • ")}),o.find("."+e.buttonClass).on("click",function(i){t("."+e.selectboxClass+" ."+e.focusedClass).removeClass(e.focusedClass).next().hide(),1==n?(t(this).removeClass(e.focusedClass).next().hide(),n=0):(t(this).addClass(e.focusedClass).next().show(),n=1),i.stopPropagation(),t(document).on("click",function(){t("."+e.selectboxClass+" ."+e.focusedClass).removeClass(e.focusedClass).next().hide(),n=0})}).next().find("li").on("click",function(){t(this).hasClass(e.disabledClass)||(t(this).parent().hide().find("."+e.selectedClass).removeClass(e.selectedClass).parent().prev().removeClass(e.focusedClass).text(t(this).text()).prev().val(t(this).data("value")).trigger("change"),t(this).addClass(e.selectedClass)),n=1})})}}(jQuery),jQuery.fn.extend({number_format:function(t,e){var n={numberOfDecimals:2,decimalSeparator:",",thousandSeparator:".",symbol:"€"},o=jQuery.extend(n,e),s=t,r=o.numberOfDecimals,a=o.decimalSeparator,l=o.thousandSeparator,h=o.symbol,d="",u=s.toString(),c=u.indexOf("e");if(c>-1&&(d=u.substring(c),s=parseFloat(u.substring(0,c))),null!=r){var p=Math.pow(10,r);s=Math.round(s*p)/p}var f=s<0?"-":"",m=(s>0?Math.floor(s):Math.abs(Math.ceil(s))).toString(),g=s.toString().substring(m.length+f.length);if(a=null!=a?a:".",g=null!=r&&r>0||g.length>1?a+g.substring(1):"",null!=r&&r>0)for(i=g.length-1,z=r;i0;i-=3)m=m.substring(0,i)+l+m.substring(i);return""==o.symbol?f+m+g+d:h+" "+f+m+g+d}}),function(t){"function"==typeof define&&define.amd?define(["jquery"],t):"object"==typeof module&&module.exports?module.exports=t(require("jquery")):t(jQuery)}(function(t){var e=Array.prototype.slice,i=Array.prototype.splice,n={topSpacing:0,bottomSpacing:0,className:"is-sticky",wrapperClassName:"sticky-wrapper",center:!1,getWidthFrom:"",widthFromWrapper:!0,responsiveWidth:!1,zIndex:"auto"},o=t(window),s=t(document),r=[],a=o.height(),l=function(){for(var e=o.scrollTop(),i=s.height(),n=i-a,l=e>n?n-e:0,h=0,d=r.length;hp||null===u.currentTop&&p=m.offset().top+m.outerHeight()&&u.stickyElement.offset().top<=u.topSpacing?u.stickyElement.css("position","absolute").css("top","").css("bottom",0).css("z-index",""):u.stickyElement.css("position","fixed").css("top",p).css("bottom","").css("z-index",u.zIndex)}}},h=function(){a=o.height();for(var e=0,i=r.length;e").attr("id",s).addClass(i.wrapperClassName);e.wrapAll(function(){if(0==t(this).parent("#"+s).length)return a});var l=e.parent();i.center&&l.css({width:e.outerWidth(),marginLeft:"auto",marginRight:"auto"}),"right"===e.css("float")&&e.css({float:"none"}).parent().css({float:"right"}),i.stickyElement=e,i.stickyWrapper=l,i.currentTop=null,r.push(i),d.setWrapperHeight(this),d.setupChangeListeners(this)})},setWrapperHeight:function(e){var i=t(e),n=i.parent();n&&n.css("height",i.outerHeight())},setupChangeListeners:function(t){window.MutationObserver?new window.MutationObserver(function(e){(e[0].addedNodes.length||e[0].removedNodes.length)&&d.setWrapperHeight(t)}).observe(t,{subtree:!0,childList:!0}):window.addEventListener?(t.addEventListener("DOMNodeInserted",function(){d.setWrapperHeight(t)},!1),t.addEventListener("DOMNodeRemoved",function(){d.setWrapperHeight(t)},!1)):window.attachEvent&&(t.attachEvent("onDOMNodeInserted",function(){d.setWrapperHeight(t)}),t.attachEvent("onDOMNodeRemoved",function(){d.setWrapperHeight(t)}))},update:l,unstick:function(e){return this.each(function(){for(var e=this,n=t(e),o=-1,s=r.length;s-- >0;)r[s].stickyElement.get(0)===e&&(i.call(r,s,1),o=s);-1!==o&&(n.unwrap(),n.css({width:"",position:"",top:"",float:"","z-index":""}))})}};window.addEventListener?(window.addEventListener("scroll",l,!1),window.addEventListener("resize",h,!1)):window.attachEvent&&(window.attachEvent("onscroll",l),window.attachEvent("onresize",h)),t.fn.sticky=function(i){return d[i]?d[i].apply(this,e.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.sticky"):d.init.apply(this,arguments)},t.fn.unstick=function(i){return d[i]?d[i].apply(this,e.call(arguments,1)):"object"!=typeof i&&i?void t.error("Method "+i+" does not exist on jQuery.sticky"):d.unstick.apply(this,arguments)},t(function(){setTimeout(l,0)})});