liebling/assets/js/app.js

1 line
6.6 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 i})),n.d(t,"formatDate",(function(){return s})),n.d(t,"getParameterByName",(function(){return c})),n.d(t,"adjustImageGallery",(function(){return r})),n.d(t,"managePostImages",(function(){return l})),n.d(t,"makeImagesZoomable",(function(){return d}));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},i=function(){var e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)");return e&&e.matches},s=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},r=function(){for(var e=document.querySelectorAll(".kg-gallery-image img"),t=0,n=e.length;t<n;t++){var a=e[t].closest(".kg-gallery-image"),o=e[t].attributes.width.value/e[t].attributes.height.value;a.style.flex="".concat(o," 1 0%")}},l=function(e){e(".js-post-content").find("img").each((function(){e(this).closest("figure").hasClass("kg-bookmark-card")||e(this).parent().is("a")||e(this).addClass("js-zoomable");var t=e(this).parent().find("figcaption");t?e(this).attr("alt",t.text()):e(this).attr("alt","")}))},d=function(e,t){var n=t(".js-zoomable");n.on("open",(function(t){o()&&e(t.target).parent().hasClass("kg-gallery-image")&&setTimeout((function(){var t=e(".medium-zoom-image--opened"),n=t[0].style.transform,a=n.substr(0,n.indexOf(" ")),o=parseFloat(a.substr(a.indexOf("(")+1).split(")")[0]),i=n.substr(n.indexOf(" ")+1),s=parseFloat(i.split(",")[1]),c="scale(1) translate3d(0, ".concat(s<0?o*s+s:o*s-s,"px, 0)");t.addClass("medium-zoom-image-mobile"),t[0].style.transform=c}),10)})),n.on("close",(function(){o()&&e(event.target).parent().hasClass("kg-gallery-image")&&e(".medium-zoom-image").removeClass("medium-zoom-image-mobile")}))}},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),i=n.n(o),s=n(8),c=n.n(s),r=n(9),l=n.n(r),d=(n(6),n(7)),u=n(2),m=n(11),h=n.n(m),g=n(12),f=n.n(g),p=n(1);Object(a.a)({}),i()(document).ready((function(){Object(p.isRTL)()&&i()("html").attr("dir","rtl").addClass("rtl");var e=i()("body"),t=i()(".js-header"),n=i()(".js-open-menu"),a=i()(".js-close-menu"),o=i()(".js-menu"),s=i()(".js-toggle-submenu"),r=i()(".js-submenu-option")[0],m=i()(".js-submenu"),g=i()(".js-recent-articles"),b=i()(".js-open-secondary-menu"),v=i()(".js-open-search"),j=i()(".js-close-search"),k=i()(".js-search"),w=i()(".js-input-search"),y=i()(".js-search-results"),C=i()(".js-no-results"),O=i()(".js-toggle-darkmode"),x=i()(".js-notification-close"),S=localStorage.getItem("theme"),M=null,_=!1,I=null;function L(){t.removeClass("submenu-is-active"),s.removeClass("active"),m.removeClass("opened").addClass("closed")}function z(){e.toggleClass("no-scroll-y")}var A,T,D,P,F,R,B,E=function(e){var t=i()('.js-alert[data-notification="'.concat(e,'"]'));t.addClass("opened"),setTimeout((function(){H(t)}),5e3)},H=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"),z()})),a.click((function(){t.removeClass("mobile-menu-opened"),o.removeClass("opened"),z()})),s.click((function(){(_=!_)?(t.addClass("submenu-is-active"),s.addClass("active"),m.removeClass("closed").addClass("opened")):L()})),v.click((function(){k.addClass("opened"),setTimeout((function(){w.focus()}),400),z()})),j.click((function(){w.blur(),k.removeClass("opened"),z()})),w.keyup((function(){if(w.val().length>0&&M){var e=M.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(p.formatDate)(e[n].published_at),"</span> </a> </article>");C.hide(),y.html(t),y.show()}else y.html(""),y.hide(),C.show()}else y.html(""),y.hide(),C.hide()})),O.change((function(){O.is(":checked")?(i()("html").attr("data-theme","dark"),localStorage.setItem("theme","dark")):(i()("html").attr("data-theme","light"),localStorage.setItem("theme","light"))})),x.click((function(){H(i()(this).parent())})),i()(window).click((function(e){_&&r&&!r.contains(e.target)&&(_=!1,L())})),S?(i()("html").attr("data-theme",S),"dark"===S&&O.attr("checked",!0)):Object(p.isDarkMode)()&&O.attr("checked",!0),t.length>0)&&new l.a(t[0],{tolerance:{down:10,up:20},offset:15,onUnpin:function(){if(!Object(p.isMobile)()&&I){var e=I[0];e&&e.state.isVisible&&e.hide()}}}).init();if(g.length>0&&(g.on("init",(function(){Object(u.a)(".js-recent-article-title",50)})),g.slick({adaptiveHeight:!0,arrows:!1,infinite:!1,mobileFirst:!0,variableWidth:!0,rtl:Object(p.isRTL)()})),"undefined"!=typeof disableFadeAnimation&&disableFadeAnimation?i()("[data-aos]").addClass("no-aos-animation"):h.a.init({once:!0,startEvent:"DOMContentLoaded"}),c()(".lozad",{loaded:function(e){e.classList.add("loaded")}}).observe(),b.length>0){var N=document.getElementById("secondary-navigation-template");I=Object(d.a)(".js-open-secondary-menu",{content:N.innerHTML,arrow:!0,trigger:"click",interactive:!0})}Object(d.a)(".js-tooltip"),Object(u.a)(".js-article-card-title",100),Object(u.a)(".js-article-card-title-no-image",250),A=Object(p.getParameterByName)("action"),T=Object(p.getParameterByName)("stripe"),"subscribe"===A&&E("subscribe"),"signup"===A&&(window.location="".concat(ghostHost,"/signup/?action=checkout")),"checkout"===A&&E("signup"),"signin"===A&&E("signin"),"success"===T&&E("checkout"),"undefined"!=typeof ghostSearchApiKey?(D=ghostHost,P=ghostSearchApiKey,F=new GhostContentAPI({url:D,key:P,version:"v2"}),R=[],B={shouldSort:!0,threshold:0,location:0,distance:100,tokenize:!0,matchAllTokens:!1,maxPatternLength:32,minMatchCharLength:1,keys:["title","custom_excerpt","html"]},F.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++)R.push(e[t]);M=new f.a(R,B)})).catch((function(e){console.log(e)}))):(v.css("visibility","hidden"),j.remove(),k.remove())}))}},[[16,0,1]]]);