1 line
15 KiB
JavaScript
1 line
15 KiB
JavaScript
void 0===window.nb_&&window.console&&window.console.log&&console.log("Nimble error => window.nb_ global not instantiated"),window.nb_.getQueryVariable=function(e){for(var n=window.location.search.substring(1).split("&"),t=0;t<n.length;t++){var o=n[t].split("=");if(o[0]==e)return o[1]}return!1},window,document,nb_.listenTo("nb-jquery-loaded",function(){jQuery(function(d){jQuery.each(["Arguments","Function","String","Number","Date","RegExp","Error","Symbol","Map","WeakMap","Set","WeakSet"],function(e,n){window.nb_["is"+n]=function(e){return Object.prototype.toString.call(e)==="[object "+n+"]"}});var a,i,u=function(){return Date.now||(new Date).getTime()};d.extend(nb_,{cachedElements:{$window:d(window),$body:d("body")},isMobile:function(){return nb_.isFunction(window.matchMedia)&&matchMedia("only screen and (max-width: 768px)").matches||this.isCustomizing()&&"desktop"!=this.previewedDevice},isCustomizing:function(){return this.cachedElements.$body.hasClass("is-customizing")||"undefined"!=typeof wp&&void 0!==wp.customize},previewedDevice:"desktop",elOrFirstVisibleParentIsInWindow:function(e,n){var t=e instanceof d?e:d(e);if(t instanceof d){if(!n||nb_.isNumber(n)){var o=function(e){if(0<e.length&&e.is(":visible"))return e;var n=e.prev();if(0<n.length&&n.is(":visible"))return n;if(0<n.length&&!n.is(":visible"))return o(n);var t=e.parent();return 0<t.length?o(t):null},a=o(t);if(!a||a.length<1)return!1;var i=this.cachedElements.$window.scrollTop(),l=i+this.cachedElements.$window.height(),r=a.offset().top,s=n||0;return i-s<=r+a.height()&&r<=l+s}nb_.errorLog("invalid threshold in nb_.elOrFirstVisibleParentIsInWindow")}else nb_.errorLog("invalid element in nb_.elOrFirstVisibleParentIsInWindow",t)},has:function(e,n){if(!_.isArray(n))return null!=e&&hasOwnProperty.call(e,n);for(var t=n.length,o=0;o<t;o++){var a=n[o];if(null==e||!Object.prototype.hasOwnProperty.call(e,a))return!1;e=e[a]}return!!t},debounce:function(o,a,i){var l;return function(){var e=this,n=arguments,t=i&&!l;clearTimeout(l),l=setTimeout(function(){l=null,i||o.apply(e,n)},a),t&&o.apply(e,n)}},throttle:function(t,o,a){var i,l,r,s,d=0;a||(a={});var c=function(){d=!1===a.leading?0:u(),i=null,s=t.apply(l,r),i||(l=r=null)},e=function(){var e=u();d||!1!==a.leading||(d=e);var n=o-(e-d);return l=this,r=arguments,n<=0||o<n?(i&&(clearTimeout(i),i=null),d=e,s=t.apply(l,r),i||(l=r=null)):i||!1===a.trailing||(i=setTimeout(c,n)),s};return e.cancel=function(){clearTimeout(i),d=0,i=l=r=null},e},delay:(a=function(e,n,t){return setTimeout(function(){return e.apply(null,t)},n)},i=null==i?a.length-1:+i,function(){for(var e=Math.max(arguments.length-i,0),n=Array(e),t=0;t<e;t++)n[t]=arguments[t+i];switch(i){case 0:return a.call(this,n);case 1:return a.call(this,arguments[0],n);case 2:return a.call(this,arguments[0],arguments[1],n)}var o=Array(i+1);for(t=0;t<i;t++)o[t]=arguments[t];return o[i]=n,a.apply(this,o)})}),nb_.emit("nb-app-ready")})}),window,document,nb_.listenTo("nb-app-ready",function(){var a;(a=jQuery).fn.fitText=function(e,n){var t=e||1,o=a.extend({minFontSize:Number.NEGATIVE_INFINITY,maxFontSize:Number.POSITIVE_INFINITY},n);return this.each(function(){var e=a(this),n=function(){e.css("font-size",Math.max(Math.min(e.width()/(10*t),parseFloat(o.maxFontSize)),parseFloat(o.minFontSize))+"px")};n(),nb_.cachedElements.$window.on("resize.fittext orientationchange.fittext",n)})}}),window,document,nb_.listenTo("nb-app-ready",function(){jQuery(function(i){var l=function(e){var n=document.createElement("a");n.href=e,n.href=n.href;for(var t=["host","hostname","hash","href","port","protocol","search"],o=0,a=t.length;o<a;o++)this[t[o]]=n[t[o]];this.pathname=("/"!==n.pathname.charAt(0)?"/":"")+n.pathname},n=i("html, body");window.nb_allImagesLazyLoadedForScrollToAnchor=!1;var r=function(){var e=i(this);"scrollBehavior"in document.documentElement.style?e[0].scrollIntoView({behavior:"smooth"}):n.animate({scrollTop:e.offset().top-150},400)},t=0,s=function(){var e=i(this);i("img[data-sek-src]").not(".sek-lazy-load-error").length<1?(window.nb_allImagesLazyLoadedForScrollToAnchor=!0,r.call(e)):t<20?(t++,nb_.delay(function(){s.call(e)},100),nb_.delay(function(){r.call(e)},200)):r.call(e)},e=function(e){var n=i(this).attr("href");if(""!==n&&null!==n&&"string"==typeof n&&-1!==n.indexOf("#")){var t=new l(n),o=new l(window.document.location.href);if(t.pathname===o.pathname&&"string"==typeof t.hash&&""!==t.hash){var a=i('[data-sek-level="location"]').find('[id="'+t.hash.replace("#","")+'"]');1===a.length&&(e.preventDefault(),sekFrontLocalized.lazyload_enabled&&!1===window.nb_allImagesLazyLoadedForScrollToAnchor&&0<i("img[data-sek-src]").not(".sek-lazy-load-error").length?(i("body").one("smartload","img",function(){s.call(a)}),i("img[data-sek-src]").trigger("sek_load_img")):r.call(a))}}};nb_.cachedElements.$body.find(".menu-item").on("click","a",e),i('[data-sek-level="location"]').on("click","a",e)})}),window,document,nb_.listenTo("nb-app-ready",function(){!function(r,t){var a="nimbleLazyLoad",i={load_all_images_on_first_scroll:!1,threshold:100,fadeIn_options:{duration:400},delaySmartLoadEvent:0,candidateSelectors:"[data-sek-src], [data-sek-iframe-src]",force:!1},s="sek-lazy-loaded";function n(e,n){this.element=e,this.options=r.extend({},i,n);var t=sekFrontLocalized.lazyload_enabled;if(this.options.force&&(t=!0),t)if(r(this.element).data("nimbleLazyLoadDone"))r(this.element).trigger("nb-trigger-lazyload");else{this._defaults=i,this._name=a;var o=this;r(this.element).on("nb-trigger-lazyload",function(){o._maybe_trigger_load("nb-trigger-lazyload")}),this.init()}}n.prototype._getCandidateEls=function(){return r(this.options.candidateSelectors,this.element)},n.prototype.init=function(){var n=this;r("body").on("sek_load_img sek_load_iframe",n.options.candidateSelectors,function(e){!0!==r(this).data("sek-lazy-loaded")&&("sek_load_img"===e.type?n._load_img(this):"sek_load_iframe"===e.type&&n._load_iframe(this))}),nb_.cachedElements.$window.on("scroll",function(e){n._better_scroll_event_handler(e)}),nb_.cachedElements.$window.on("resize",nb_.debounce(function(e){n._maybe_trigger_load(e)},100)),this._maybe_trigger_load("dom-ready"),setTimeout(function(){n._maybe_trigger_load("dom-ready")},1e3),r(this.element).data("nimbleLazyLoadDone",!0)},n.prototype._better_scroll_event_handler=function(e){var n=this;this.doingAnimation||(this.doingAnimation=!0,t.requestAnimationFrame(function(){n._maybe_trigger_load(e),n.doingAnimation=!1}))},n.prototype._maybe_trigger_load=function(t){var o=this,e=o._getCandidateEls(),a=t&&"scroll"===t.type?this.options.threshold:0;_visible_list=e.filter(function(e,n){return!(!t||"scroll"!=t.type||!o.options.load_all_images_on_first_scroll)||nb_.elOrFirstVisibleParentIsInWindow(n,a)}),_visible_list.map(function(e,n){!0!==r(n).data("sek-lazy-loaded")&&("IFRAME"===r(n).prop("tagName")?r(n).trigger("sek_load_iframe"):r(n).trigger("sek_load_img"))})},n.prototype._load_img=function(e){var t=r(e);if(t.attr("data-sek-src")&&!t.hasClass(s)&&!t.hasClass("lazy-loading")){var n=t.attr("data-sek-src"),o=t.attr("data-sek-srcset"),a=t.attr("data-sek-sizes"),i=this,l=r("<img />",{src:n});t.addClass("lazy-loading"),t.off("sek_load_img"),l.on("load",function(){t.removeAttr(["data-sek-src","data-sek-srcset","data-sek-sizes"].join(" ")),t.data("sek-lazy-bg")?t.css("backgroundImage","url("+n+")"):(t.attr("src",n),o&&t.attr("srcset",o),a&&t.attr("sizes",a)),t.hasClass(s)||t.addClass(s),t.trigger("smartload"),t.data("sek-lazy-loaded",!0),i._clean_css_loader(t)}).on("error",function(e,n){t.addClass("sek-lazy-load-error")}),l[0].complete&&l.trigger("load"),t.removeClass("lazy-loading")}},n.prototype._clean_css_loader=function(e){r.each([e.find(".sek-css-loader"),e.parent().find(".sek-css-loader")],function(e,n){0<n.length&&n.remove()})},n.prototype._load_iframe=function(e){var n=r(e);n.off("sek_load_iframe"),n.attr("src",function(){var e=r(this).attr("data-sek-iframe-src");return r(this).removeAttr("data-sek-iframe-src"),n.data("sek-lazy-loaded",!0),n.trigger("smartload"),n.hasClass(s)||n.addClass(s),e})},r.fn[a]=function(e){return this.each(function(){r.data(this,"plugin_"+a)||r.data(this,"plugin_"+a,new n(this,e))})}}(jQuery,window),(sekFrontLocalized.lazyload_enabled||nb_.isCustomizing())&&nb_.emit("nb-lazyload-parsed")}),window,document,nb_.loadAssetWhenElementVisible=function(a,n){jQuery(function(t){if(!nb_.scrollHandlers[a].loaded){nb_.scrollHandlers[a].loaded=!1;var e=n.elements,o=n.func;t.each(e,function(e,n){!nb_.scrollHandlers[a].loaded&&nb_.elOrFirstVisibleParentIsInWindow(t(n))&&(o(),nb_.scrollHandlers[a].loaded=!0)}),n.scrollHandler&&nb_.scrollHandlers[a].loaded&&nb_.cachedElements.$window.off("scroll",n.scrollHandler)}})},nb_.loopOnScrollHandlers=function(){jQuery(function(e){e.each(nb_.scrollHandlers,function(e,n){if(n.loaded)return!0;var t=sekFrontLocalized.load_front_assets_on_dynamically;if(!0===n.force_loading&&(t=!0),t){if(n.elements.length<1)return!0;try{nb_.loadAssetWhenElementVisible(e,n)}catch(e){nb_.errorLog("Nimble error => nb_.loopOnScrollHandlers",e,n)}nb_.isFunction(n.func)&&nb_.isUndefined(n.scrollHandler)?(n.scrollHandler=nb_.throttle(function(){try{nb_.loadAssetWhenElementVisible(e,n)}catch(e){nb_.errorLog("Nimble error => nb_.loopOnScrollHandlers",e,n)}},100),nb_.cachedElements.$window.on("scroll",n.scrollHandler)):nb_.isFunction(n.func)||nb_.errorLog("Nimble error => nb_.loopOnScrollHandlers => wrong callback func param",n)}})})},nb_.listenTo("nb-app-ready",function(){jQuery(function(e){nb_.listenTo("nimble-new-scroll-handler-added",nb_.loopOnScrollHandlers)})}),window,document,nb_.listenTo("nb-app-ready",function(){jQuery(function(t){nb_.maybeLoadAssetsWhenSelectorInScreen=function(e){if((e=t.extend({id:"",elements:"",func:""},e)).id.length<1)nb_.errorLog("Nimble error => maybeLoadAssetsWhenSelectorInScreen => missing id",e);else if(!(t(e.elements).length<1)&&nb_.isFunction(e.func)){nb_.scrollHandlers=nb_.scrollHandlers||{};var n={elements:e.elements,func:e.func,force_loading:e.force_loading};nb_.scrollHandlers[e.id]=n,nb_.emit("nimble-new-scroll-handler-added",{fire_once:!1})}},nb_.emit("nimble-ready-to-load-assets-on-scroll")})}),function(e,n){var t=function(){jQuery(function(e){if(sekFrontLocalized.load_front_assets_on_dynamically){var n=e('[data-sek-module-type="czr_image_module"]').find(".sek-link-to-img-lightbox");if(!((n=n.add(e('[data-sek-level="module"]').find(".sek-gal-link-to-img-lightbox"))).length<1)){nb_.maybeLoadAssetsWhenSelectorInScreen({id:"swipebox",elements:n,func:function(){e("head").find("#nb-swipebox").length<1&&e("head").append(e("<link/>",{rel:"stylesheet",id:"nb-swipebox",type:"text/css",href:sekFrontLocalized.frontAssetsPath+"css/libs/swipebox.min.css?"+sekFrontLocalized.assetVersion})),!nb_.isFunction(e.fn.swipebox)&&sekFrontLocalized.load_front_assets_on_dynamically&&nb_.ajaxLoadScript({path:"js/libs/jquery-swipebox.min.js",loadcheck:function(){return nb_.isFunction(e.fn.swipebox)}})}})}}})};nb_.listenTo("nb-app-ready",function(){nb_.listenTo("nb-needs-swipebox",t)})}(window,document),function(e,n){var t=function(){jQuery(function(e){if(sekFrontLocalized.load_front_assets_on_dynamically){if(!nb_.isFunction(window.Swiper)){var n=e('[data-sek-module-type="czr_img_slider_module"]');n.length<1||nb_.maybeLoadAssetsWhenSelectorInScreen({id:"swiper",elements:n,func:function(){e("head").find("#czr-swiper").length<1&&e("head").append(e("<link/>",{rel:"stylesheet",id:"czr-swiper",type:"text/css",href:sekFrontLocalized.frontAssetsPath+"css/libs/swiper-bundle.min.css?"+sekFrontLocalized.assetVersion})),nb_.ajaxLoadScript({path:"js/libs/swiper-bundle.min.js?"+sekFrontLocalized.assetVersion,loadcheck:function(){return nb_.isFunction(window.Swiper)}})}})}}})};nb_.listenTo("nb-app-ready",function(){nb_.listenTo("nb-needs-swiper",t)})}(window,document),function(e,n){var t=function(){jQuery(function(e){if(sekFrontLocalized.load_front_assets_on_dynamically){var n=e("[data-sek-video-bg-src]");n.length<1||nb_.maybeLoadAssetsWhenSelectorInScreen({id:"nb-video-bg",elements:n,func:function(){nb_.ajaxLoadScript({path:"js/libs/nimble-video-bg.min.js?"+sekFrontLocalized.assetVersion})}})}})};nb_.listenTo("nb-app-ready",function(){nb_.listenTo("nb-needs-videobg-js",t)})}(window,document),function(e,n){var t=function(){jQuery(function(n){if(!sekFrontLocalized.fontAwesomeAlreadyEnqueued&&sekFrontLocalized.load_front_assets_on_dynamically){var e=n("i[class*=fa-]");if(!(e.length<1)){nb_.maybeLoadAssetsWhenSelectorInScreen({id:"font-awesome",elements:e,func:function(){if(n("head").find("#nb-font-awesome").length<1){var e=document.createElement("link");e.setAttribute("href",sekFrontLocalized.frontAssetsPath+"fonts/css/fontawesome-all.min.css?"+sekFrontLocalized.assetVersion),e.setAttribute("id","nb-font-awesome"),e.setAttribute("data-sek-injected-dynamically","yes"),e.setAttribute("rel",nb_.hasPreloadSupport()?"preload":"stylesheet"),e.setAttribute("as","style"),e.onload=function(){this.onload=null,nb_.hasPreloadSupport()&&(this.rel="stylesheet")},document.getElementsByTagName("head")[0].appendChild(e)}}})}}})};nb_.listenTo("nb-app-ready",function(){nb_.listenTo("nb-needs-fa",t)})}(window,document),window,document,nb_.listenTo("nb-swipebox-parsed",function(){jQuery(function(e){if(!nb_.isCustomizing()){var n=[e('[data-sek-level="module"]').find(".sek-link-to-img-lightbox"),e('[data-sek-level="module"]').find(".sek-gal-link-to-img-lightbox")],t={loopAtEnd:!0};e.each(n,function(e,n){if(!(n.length<1||n.data("nimble-swiperbox-done"))){try{n.swipebox(t)}catch(e){nb_.errorLog("error in callback of nb-swipebox-parsed => ",e)}n.data("nimble-swiperbox-done",!0)}}),e(".sek-gallery-lightbox").on("click",".sek-no-img-link",function(e){e.preventDefault()})}})}),window,document,nb_.listenTo("nb-lazyload-parsed",function(){jQuery(function(n){var t=function(e){n(this).each(function(){try{(function(){n(this).data("nimbleLazyLoadDone")?n(this).trigger("nb-trigger-lazyload"):n(this).nimbleLazyLoad({force:nb_.isCustomizing()})}).call(n(this))}catch(e){nb_.errorLog("error with nimbleLazyLoad => ",e)}})};t.call(n(".sektion-wrapper")),nb_.cachedElements.$body.on("sek-section-added sek-level-refreshed sek-location-refreshed sek-columns-refreshed sek-modules-refreshed",'[data-sek-level="location"]',function(e){t.call(n(this),e),_.delay(function(){nb_.cachedElements.$window.trigger("resize")},200)})})}),window,document,nb_.listenTo("nb-parallax-parsed",function(){jQuery(function(n){n('[data-sek-bg-parallax="true"]').each(function(){n(this).parallaxBg({parallaxForce:n(this).data("sek-parallax-force")})});var t=function(){n(this).parallaxBg({parallaxForce:n(this).data("sek-parallax-force")}),setTimeout(function(){nb_.cachedElements.$body.trigger("resize")},500)};nb_.cachedElements.$body.on("sek-level-refreshed sek-section-added",function(e){"true"===n(this).data("sek-bg-parallax")?t.call(this):n(this).find('[data-sek-bg-parallax="true"]').each(function(){t.call(this)})})})}),nb_.listenTo("nb-docready",function(){if(window.nb_&&window.nb_.getQueryVariable){var e=window.nb_.getQueryVariable("nb_grid_module_go_to"),n=document.getElementById(e);if(e&&n){setTimeout(function(){n.scrollIntoView()},200);try{t=window.location.pathname.split("?go_to")[0],window.history.replaceState({},document.title,t)}catch(e){window.console&&window.console.log&&console.log('NB => error when cleaning url "go_to" param')}}}var t}),nb_.listenTo("nb-app-ready",function(){jQuery(function(e){var n=e(".sek-css-loader");if(!(n.length<1)){var t,o=nb_.throttle(function(){n=e(".sek-css-loader"),e.each(n,function(){t=e(this),nb_.elOrFirstVisibleParentIsInWindow(t)&&nb_.delay(function(){0<t.length&&t.remove()},1e3)}),n.length<1&&nb_.cachedElements.$window.off("scroll",o)},200);nb_.cachedElements.$window.on("scroll",o)}})}); |