1 line
2.8 KiB
JavaScript
1 line
2.8 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{27:function(e,s,t){e.exports=t(28)},28:function(e,s,t){"use strict";t.r(s);var n=t(0),a=t.n(n),o=(t(6),t(15)),i=t(17),l=t.n(i),c=t(18),r=t(20),d=t.n(r);a()(document).ready(function(){var e,s,t,n,i,r=a()("body"),u=a()(".js-header"),h=a()(".js-open-menu"),m=a()(".js-close-menu"),f=a()(".js-menu"),v=a()(".js-toggle-submenu"),p=a()(".js-submenu-option")[0],g=a()(".js-submenu"),w=a()(".js-recent-articles"),C=a()(".js-open-search"),j=a()(".js-close-search"),b=a()(".js-search"),k=a()(".js-input-search"),y=a()(".js-search-results"),x=a()(".js-no-results"),_=u.outerHeight(),L=null,A=window.pageYOffset,O=!1,S=!1;function D(){var e=window.pageYOffset;e>=_?(u.addClass("fixed"),S&&u.addClass("fixed-active"),e>=A?S||u.removeClass("fixed-active"):u.addClass("fixed-active")):(S||u.removeClass("fixed-active"),u.removeClass("fixed")),A=e,O=!1}function E(){u.removeClass("submenu-is-active"),v.removeClass("active"),g.removeClass("opened").addClass("closed")}function H(){r.toggleClass("no-scroll-y")}h.click(function(){f.addClass("opened"),H()}),m.click(function(){f.removeClass("opened"),H()}),v.click(function(){(S=!S)?(u.addClass("submenu-is-active"),v.addClass("active"),g.removeClass("closed").addClass("opened")):E()}),C.click(function(){b.addClass("opened"),setTimeout(function(){k.focus()},400),H()}),j.click(function(){k.blur(),b.removeClass("opened"),H()}),k.keyup(function(){if(k.val().length>0&&L){var e=L.search(k.val()),s="";if(e.length>0){for(var t=0,n=e.length;t<n;t++)s+='\n <article class="m-result"> <a href="'.concat(e[t].url,'" class="m-result__link"> <h3 class="m-result__title">').concat(e[t].title,'</h3> <span class="m-result__date">').concat((a=e[t].published_at)?new Date(a).toLocaleDateString(document.documentElement.lang,{year:"numeric",month:"long",day:"numeric"}):"","</span> </a> </article>");x.hide(),y.html(s),y.show()}else y.html(""),y.hide(),x.show()}else y.html(""),y.hide(),x.hide();var a}),a()(window).click(function(e){S&&p&&!p.contains(e.target)&&(S=!1,E())}),w.length>0&&w.slick({adaptiveHeight:!0,arrows:!1,infinite:!1,mobileFirst:!0,variableWidth:!0}),l.a.init({once:!0,startEvent:"DOMContentLoaded"}),Object(o.a)(".js-tooltip"),"undefined"!=typeof ghostSearchApiKey?(e=ghostHost,s=ghostSearchApiKey,t=new c.a({host:e,key:s,version:"v2"}),n=[],i={shouldSort:!0,threshold:0,location:0,distance:100,tokenize:!0,matchAllTokens:!0,maxPatternLength:32,minMatchCharLength:1,keys:["title","custom_excerpt","html"]},t.posts.browse({limit:"all",fields:"id, title, url, published_at, custom_excerpt, html"}).then(function(e){for(var s=0,t=e.length;s<t;s++)n.push(e[s]);L=new d.a(n,i)}).catch(function(e){console.log(e)})):(C.remove(),j.remove(),b.remove()),window.addEventListener("scroll",function(){O||requestAnimationFrame(D),O=!0},{passive:!0})})}},[[27,0,1]]]); |