liebling/assets/js/app.js
2020-04-15 11:59:06 +02:00

1 line
5.1 KiB
JavaScript

(window.webpackJsonp=window.webpackJsonp||[]).push([[2],{1:function(e,t,n){"use strict";n.r(t),n.d(t,"isRTL",(function(){return a})),n.d(t,"isMobile",(function(){return o})),n.d(t,"isDarkMode",(function(){return s})),n.d(t,"formatDate",(function(){return i})),n.d(t,"getParameterByName",(function(){return c}));var a=function(){var e=document.querySelector("html");return["ar","he","fa"].includes(e.getAttribute("lang"))},o=function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"768px";return window.matchMedia("(max-width: ".concat(e,")")).matches},s=function(){var e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)");return e&&e.matches},i=function(e){return e?new Date(e).toLocaleDateString(document.documentElement.lang,{year:"numeric",month:"long",day:"numeric"}):""},c=function(e,t){t||(t=window.location.href),e=e.replace(/[\[\]]/g,"\\$&");var n=new RegExp("[?&]".concat(e,"(=([^&#]*)|&|#|$)")).exec(t);return n?n[2]?decodeURIComponent(n[2].replace(/\+/g," ")):"":null}},16:function(e,t,n){e.exports=n(17)},17:function(e,t,n){"use strict";n.r(t);var a=n(13),o=n(0),s=n.n(o),i=n(7),c=n.n(i),r=n(8),l=n.n(r),d=(n(6),n(9)),u=n(2),m=n(11),h=n.n(m),f=n(12),p=n.n(f),g=n(1);Object(a.a)({}),s()(document).ready((function(){Object(g.isRTL)()&&s()("html").attr("dir","rtl").addClass("rtl");var e=s()("body"),t=s()(".js-header"),n=s()(".js-open-menu"),a=s()(".js-close-menu"),o=s()(".js-menu"),i=s()(".js-toggle-submenu"),r=s()(".js-submenu-option")[0],m=s()(".js-submenu"),f=s()(".js-recent-articles"),v=s()(".js-open-search"),b=s()(".js-close-search"),j=s()(".js-search"),w=s()(".js-input-search"),k=s()(".js-search-results"),C=s()(".js-no-results"),y=s()(".js-toggle-darkmode"),O=s()(".js-notification-close"),S=localStorage.getItem("theme"),x=null,_=!1;function L(){t.removeClass("submenu-is-active"),i.removeClass("active"),m.removeClass("opened").addClass("closed")}function M(){e.toggleClass("no-scroll-y")}var A=function(e){var t=s()('.js-alert[data-notification="'.concat(e,'"]'));t.addClass("opened"),setTimeout((function(){D(t)}),5e3)},D=function(e){e.removeClass("opened");var t=window.location.toString();if(t.indexOf("?")>0){var n=t.substring(0,t.indexOf("?"));window.history.replaceState({},document.title,n)}};n.click((function(){t.addClass("mobile-menu-opened"),o.addClass("opened"),M()})),a.click((function(){t.removeClass("mobile-menu-opened"),o.removeClass("opened"),M()})),i.click((function(){(_=!_)?(t.addClass("submenu-is-active"),i.addClass("active"),m.removeClass("closed").addClass("opened")):L()})),v.click((function(){j.addClass("opened"),setTimeout((function(){w.focus()}),400),M()})),b.click((function(){w.blur(),j.removeClass("opened"),M()})),w.keyup((function(){if(w.val().length>0&&x){var e=x.search(w.val()),t="";if(e.length>0){for(var n=0,a=e.length;n<a;n++)t+='\n <article class="m-result"> <a href="'.concat(e[n].url,'" class="m-result__link"> <h3 class="m-result__title">').concat(e[n].title,'</h3> <span class="m-result__date">').concat(Object(g.formatDate)(e[n].published_at),"</span> </a> </article>");C.hide(),k.html(t),k.show()}else k.html(""),k.hide(),C.show()}else k.html(""),k.hide(),C.hide()})),y.change((function(){y.is(":checked")?(s()("html").attr("data-theme","dark"),localStorage.setItem("theme","dark")):(s()("html").attr("data-theme","light"),localStorage.setItem("theme","light"))})),O.click((function(){D(s()(this).parent())})),s()(window).click((function(e){_&&r&&!r.contains(e.target)&&(_=!1,L())})),S?(s()("html").attr("data-theme",S),"dark"===S&&y.attr("checked",!0)):Object(g.isDarkMode)()&&y.attr("checked",!0);var T,I,P,R,B,E,F,H=document.querySelector(".js-header");H&&new l.a(H,{tolerance:{down:10,up:20},offset:15}).init();f.length>0&&(f.on("init",(function(){Object(u.a)(".js-recent-article-title",50)})),f.slick({adaptiveHeight:!0,arrows:!1,infinite:!1,mobileFirst:!0,variableWidth:!0,rtl:Object(g.isRTL)()})),"undefined"!=typeof disableFadeAnimation&&disableFadeAnimation?s()("[data-aos]").addClass("no-aos-animation"):h.a.init({once:!0,startEvent:"DOMContentLoaded"}),c()(".lozad",{loaded:function(e){e.classList.add("loaded")}}).observe(),Object(d.a)(".js-tooltip"),Object(u.a)(".js-article-card-title",100),Object(u.a)(".js-article-card-title-no-image",250),T=Object(g.getParameterByName)("action"),I=Object(g.getParameterByName)("stripe"),"subscribe"===T&&A("subscribe"),"signup"===T&&(window.location="".concat(ghostHost,"/signup/?action=checkout")),"checkout"===T&&A("signup"),"signin"===T&&A("signin"),"success"===I&&A("checkout"),"undefined"!=typeof ghostSearchApiKey?(P=ghostHost,R=ghostSearchApiKey,B=new GhostContentAPI({url:P,key:R,version:"v2"}),E=[],F={shouldSort:!0,threshold:0,location:0,distance:100,tokenize:!0,matchAllTokens:!1,maxPatternLength:32,minMatchCharLength:1,keys:["title","custom_excerpt","html"]},B.posts.browse({limit:"all",fields:"id, title, url, published_at, custom_excerpt, html"}).then((function(e){for(var t=0,n=e.length;t<n;t++)E.push(e[t]);x=new p.a(E,F)})).catch((function(e){console.log(e)}))):(v.css("visibility","hidden"),b.remove(),j.remove())}))}},[[16,0,1]]]);