liebling/assets/js/app.js

1 line
6 KiB
JavaScript
Raw Normal View History

2020-04-27 22:14:10 +00:00
(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,"makeImagesZoomable",(function(){return r}));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(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),f=n(12),g=n.n(f),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"),f=i()(".js-recent-articles"),b=i()(".js-open-secondary-menu"),v=i()(".js-open-search"),j=i()(".js-close-search"),w=i()(".js-search"),k=i()(".js-input-search"),C=i()(".js-search-results"),y=i()(".js-no-results"),O=i()(".js-toggle-darkmode"),x=i()(".js-notification-close"),M=localStorage.getItem("theme"),S=null,_=!1,L=null;function T(){t.removeClass("submenu-is-active"),s.removeClass("active"),m.removeClass("opened").addClass("closed")}function z(){e.toggleClass("no-scroll-y")}var A,D,I,F,P,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")):T()})),v.click((function(){w.addClass("opened"),setTimeout((function(){k.focus()}),400),z()})),j.click((function(){k.blur(),w.removeClass("opened"),z()})),k.keyup((function(){if(k.val().length>0&&S){var e=S.search(k.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>");y.hide(),C.html(t),C.show()}else C.html(""),C.hide(),y.show()}else C.html(""),C.hide(),y.hide()})),O.change((function(){O.is(":checked")?(i()("html").attr("data-theme","dark"),localStorage.setItem("theme","dark")