1(function($){"use strict";$('.js-search-open').click(function(e){e.preventDefault();if(!searchBar.moving)searchBar.toggle();var targetClick='search';if($('.navbar-nav .trigger').hasClass('open')){console.log(1);$('.navbar-nav .trigger').removeClass('open');$('.page-overlay').removeClass('open');$('.main-menu-sidebar-panel').removeClass('panel-open');$('body').removeClass('scroll-blocked')}else{console.log(2,'.main-menu-sidebar-'+targetClick);$('.navbar-nav .trigger').removeClass('open');$('.navbar-nav .trigger[data-target="'+targetClick+'"]').addClass('open');$('.page-overlay').removeClass('open');$('.main-menu-sidebar-panel').removeClass('panel-open');$('.main-menu-sidebar-'+targetClick).addClass('panel-open');$('.page-overlay').addClass('open');$('body').addClass('scroll-blocked')}});var searchBar={$el:$('.b-search'),$headerIcon:$('.search-form'),$input:$('.b-search__input input'),$results:$('.b-search__results ul'),$popup:$('.b-popup.b-popup--search'),$submit:$('.b-search__submit'),results:{},resultIndex:0,keyword:'',opened:!1,moving:!1,updating:!1,init:function(){var that=this;this.$input.keyup(function(e){that.checkState(this,e)});this.$results.click(function(e){if(!Cookies.get('popup')){e.preventDefault();var keyword=$(e.target).parent().attr('data-search-keyword');that.openPopup(keyword)}});this.$submit.click(function(e){if(that.keyword==''){e.preventDefault();return} 2if(!Cookies.get('popup')){that.openPopup(that.keyword)}else{window.location.href=that.genHref(that.keyword)}})},checkState:function(i,e){var that=this;if(that.specialEvent(e,!0))return;var $i=$(i);var val=$i.val().trim();if(val===''){that.$el.removeClass('active')}else{that.$el.addClass('active')} 3this.loadResults(val)},loadResults:function(val){if(val===this.keyword)return;this.keyword=encodeURI(encodeURIComponent(val));if(this.updating)return;if(this.keyword==='')return this.updateResults([]);this.$el.addClass('searching');var that=this;$.ajax({url:dw.ajax,data:{autocomplete:this.keyword},dataType:'json',success:function(data){that.evalData(data)},error:function(request,status,error){console.log(request.responseText);console.log(error)}})},evalData:function(data){if(!data.query||data.query!==this.keyword)return;if(!data.errors.length)return this.updateResults(data.results);console.log(data.errors);this.$el.removeClass('searching');this.updating=!1},updateResults:function(newResults){this.updating=!0;var that=this;newResults=newResults.sort(function(a,b){return a.text.localeCompare(b.text)});for(var id in that.results){var oldResult=that.results[id];if(!dwIndexOfObjects(newResults,oldResult)){that.removeResult(id);delete that.results[id]}} 4var lastRow=-1;newResults.forEach(function(newResult){var id=dwGetIndexOf(that.results,newResult);if(id===-1){id=that.resultIndex++;that.results[id]=newResult;that.addResult(newResult,id,lastRow)} 5lastRow=id});this.$el.removeClass('searching');this.updating=!1;this.loadResults(this.keyword)},addResult:function(r,id,after){var that=this;var keyword=r.href;console.log(r);if(!r.href||r.href==='')keyword=r.text.toLowerCase.replace(' ','_');var href=this.genHref(keyword);var $link=$('<a />').text(r.text).attr('href',href);var $li=$('<li />').attr('data-search-id',id).attr('data-search-keyword',keyword).append($link);after===-1?$li.prependTo(that.$results):$li.insertAfter(that.getResultById(after));setTimeout(function(){$li.addClass('visible')},10)},removeResult:function(id){var $el=this.getResultById(id);$el.height(0);if($el.is('.selRow'))this.$input.addClass('selRow');setTimeout(function(){$el.remove()},200)},getResultById:function(id){return this.$results.find('li[data-search-id="'+id+'"]')},specialEvent:function(e,stop){var that=this;switch(e.keyCode){case 38:if(!stop)that.goUp();break;case 40:if(!stop)that.goDown();break;case 13:if(!stop)that.submitForm();break;case 27:if(!stop)that.close();break;default:return!1} 6if(!$('.selRow').length)this.$input.addClass('selRow');e.preventDefault();return!0},goUp:function(){if(this.$input.is('.selRow'))return;var $sel=$('.selRow');var $prev=$sel.prev();$sel.removeClass('selRow');
6if($prev.length)$prev.addClass('selRow');else this.$input.addClass('selRow')},goDown:function(){if(!this.$results.length)return;if(this.$input.is('.selRow')){this.$input.removeClass('selRow');this.$results.find('li:first-child').addClass('selRow')}else{var $sel=$('.selRow');var $next=$sel.next();if($next.length){$sel.removeClass('selRow');$next.addClass('selRow')}}},submitForm:function(){var keyword='';if(this.$input.is('.selRow')){keyword=this.keyword}else{var $sel=$('.selRow');keyword=$sel.attr('data-search-keyword')} 7if(!Cookies.get('popup')){this.openPopup(keyword)}else{window.location.href=this.genHref(keyword)}},genHref:function(keyword){return dw.ajax+'?s='+encodeURIComponent(keyword)},openPopup:function(keyword){var that=this;var href=this.genHref(keyword);window.openNicely(this.$popup);$(document).off("keydown.dw_search");$(document).on("keydown",function(e){switch(e.which){case 27:e.preventDefault();that.setCookie();window.location.href=href;break}});setTimeout(function(){that.$popup.find('.button.leave').attr('href',dw.pro);var $stayButton=that.$popup.find('.button.stay');$stayButton.attr('href',href);$stayButton.click(function(){that.setCookie()})},50)},setCookie:function(){if($('#popup_show_dont').is(':checked')){Cookies.set('popup',!0,{expires:90})}},open:function(){var that=this;this.moving=!0;window.openNicely(that.$el);that.$headerIcon.addClass('opened');that.opened=!0;$('html, body').addClass('search-opened');setTimeout(function(){that.$input.focus();that.moving=!1;$(document).on("keydown.dw_search",function(e){that.specialEvent(e)})},620)},close:function(){var that=this;this.moving=!0;window.closeNicely(that.$el);that.$headerIcon.removeClass('opened');$('html, body').removeClass('search-opened');setTimeout(function(){that.opened=!1;that.moving=!1 8$(document).off("keydown.dw_search")},600)},toggle:function(){if(this.opened)this.close();else this.open()}} 9searchBar.init()})(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.