vendor: 4,245 bytes, lines 1-12
1/*------------------------------------ 2 * Theme: Wayfx 3 * File: Main theme scripts file 4 * Author: Wayfx 5 * URI: https://wayfx.com/ 6 *------------------------------------ 7 * 8 */ 9 10/*! lazysizes - v5.2.2 */ 11// prettier-ignore 12!function(e){var t=function(u,D,f){"use strict";var k,H;if(function(){var e;var t={lazyClass:"lazyload",loadedClass:"lazyloaded",loadingClass:"lazyloading",preloadClass:"lazypreload",errorClass:"lazyerror",autosizesClass:"lazyautosizes",srcAttr:"data-src",srcsetAttr:"data-srcset",sizesAttr:"data-sizes",minSize:40,customMedia:{},init:true,expFactor:1.5,hFac:.8,loadMode:2,loadHidden:true,ricTimeout:0,throttleDelay:125};H=u.lazySizesConfig||u.lazysizesConfig||{};for(e in t){if(!(e in H)){H[e]=t[e]}}}(),!D||!D.getElementsByClassName){return{init:function(){},cfg:H,noSupport:true}}var O=D.documentElement,a=u.HTMLPictureElement,P="addEventListener",$="getAttribute",q=u[P].bind(u),I=u.setTimeout,U=u.requestAnimationFrame||I,l=u.requestIdleCallback,j=/^picture$/i,r=["load","error","lazyincluded","_lazyloaded"],i={},G=Array.prototype.forEach,J=function(e,t){if(!i[t]){i[t]=new RegExp("(\\s|^)"+t+"(\\s|$)")}return i[t].test(e[$]("class")||"")&&i[t]},K=function(e,t){if(!J(e,t)){e.setAttribute("class",(e[$]("class")||"").trim()+" "+t)}},Q=function(e,t){var i;if(i=J(e,t)){e.setAttribute("class",(e[$]("class")||"").replace(i," "))}},V=function(t,i,e){var a=e?P:"removeEventListener";if(e){V(t,i)}r.forEach(function(e){t[a](e,i)})},X=function(e,t,i,a,r){var n=D.createEvent("Event");if(!i){i={}}i.instance=k;n.initEvent(t,!a,!r);n.detail=i;e.dispatchEvent(n);return n},Y=function(e,t){var i;if(!a&&(i=u.picturefill||H.pf)){if(t&&t.src&&!e[$]("srcset")){e.setAttribute("srcset",t.src)}i({reevaluate:true,elements:[e]})}else if(t&&t.src){e.src=t.src}},Z=function(e,t){return(getComputedStyle(e,null)||{})[t]},s=function(e,t,i){i=i||e.offsetWidth;while(i<H.minSize&&t&&!e._lazysizesWidth){i=t.offsetWidth;t=t.parentNode}return i},ee=function(){var i,a;var t=[];var r=[];var n=t;var s=function(){var e=n;n=t.length?r:t;i=true;a=false;while(e.length){e.shift()()}i=false};var e=function(e,t){if(i&&!t){e.apply(this,arguments)}else{n.push(e);if(!a){a=true;(D.hidden?I:U)(s)}}};e._lsFlush=s;return e}(),te=function(i,e){return e?function(){ee(i)}:function(){var e=this;var t=arguments;ee(function(){i.apply(e,t)})}},ie=function(e){var i;var a=0;var r=H.throttleDelay;var n=H.ricTimeout;var t=function(){i=false;a=f.now();e()};var s=l&&n>49?function(){l(t,{timeout:n});if(n!==H.ricTimeout){n=H.ricTimeout}}:te(function(){I(t)},true);return function(e){var t;if(e=e===true){n=33}if(i){return}i=true;t=r-(f.now()-a);if(t<0){t=0}if(e||t<9){s()}else{I(s,t)}}},ae=function(e){var t,i;var a=99;var r=function(){t=null;e()};var n=function(){var e=f.now()-i;if(e<a){I(n,a-e)}else{(l||r)(r)}};return function(){i=f.now();if(!t){t=I(n,a)}}},e=function(){var v,m,c,h,e;var y,z,g,p,C,b,A;var n=/^img$/i;var d=/^iframe$/i;var E="onscroll"in u&&!/(gle|ing)bot/.test(navigator.userAgent);var _=0;var w=0;var N=0;var M=-1;var x=function(e){N--;if(!e||N<0||!e.target){N=0}};var W=function(e){if(A==null){A=Z(D.body,"visibility")=="hidden"}return A||!(Z(e.parentNode,"visibility")=="hidden"&&Z(e,"visibility")=="hidden")};var S=function(e,t){var i;var a=e;var r=W(e);g-=t;b+=t;p-=t;C+=t;while(r&&(a=a.offsetParent)&&a!=D.body&&a!=O){r=(Z(a,"opacity")||1)>0;if(r&&Z(a,"overflow")!="visible"){i=a.getBoundingClientRect();r=C>i.left&&p<i.right&&b>i.top-1&&g<i.bottom+1}}return r};var t=function(){var e,t,i,a,r,n,s,l,o,u,f,c;var d=k.elements;if((h=H.loadMode)&&N<8&&(e=d.length)){t=0;M++;for(;t<e;t++){if(!d[t]||d[t]._lazyRace){continue}if(!E||k.prematureUnveil&&k.prematureUnveil(d[t])){R(d[t]);continue}if(!(l=d[t][$]("data-expand"))||!(n=l*1)){n=w}if(!u){u=!H.expand||H.expand<1?O.clientHeight>500&&O.clientWidth>500?500:370:H.expand;k._defEx=u;f=u*H.expFactor;c=H.hFac;A=null;if(w<f&&N<1&&M>2&&h>2&&!D.hidden){w=f;M=0}else if(h>1&&M>1&&N<6){w=u}else{w=_}}if(o!==n){y=innerWidth+n*c;z=innerHeight+n;s=n*-1;o=n}i=d[t].getBoundingClientRect();if((b=i.bottom)>=s&&(g=i.top)<=z&&(C=i.right)>=s*c&&(p=i.left)<=y&&(b||C||p||g)&&(H.loadHidden||W(d[t]))&&(m&&N<3&&!l&&(h<3||M<4)||S(d[t],n))){R(d[t]);r=true;if(N>9){break}}else if(!r&&m&&!a&&N<4&&M<4&&h>
vendor: 4,669 bytes, lines 12-16
122&&(v[0]||H.preloadAfterLoad)&&(v[0]||!l&&(b||C||p||g||d[t][$](H.sizesAttr)!="auto"))){a=v[0]||d[t]}}if(a&&!r){R(a)}}};var i=ie(t);var B=function(e){var t=e.target;if(t._lazyCache){delete t._lazyCache;return}x(e);K(t,H.loadedClass);Q(t,H.loadingClass);V(t,L);X(t,"lazyloaded")};var a=te(B);var L=function(e){a({target:e.target})};var T=function(t,i){try{t.contentWindow.location.replace(i)}catch(e){t.src=i}};var F=function(e){var t;var i=e[$](H.srcsetAttr);if(t=H.customMedia[e[$]("data-media")||e[$]("media")]){e.setAttribute("media",t)}if(i){e.setAttribute("srcset",i)}};var s=te(function(t,e,i,a,r){var n,s,l,o,u,f;if(!(u=X(t,"lazybeforeunveil",e)).defaultPrevented){if(a){if(i){K(t,H.autosizesClass)}else{t.setAttribute("sizes",a)}}s=t[$](H.srcsetAttr);n=t[$](H.srcAttr);if(r){l=t.parentNode;o=l&&j.test(l.nodeName||"")}f=e.firesLoad||"src"in t&&(s||n||o);u={target:t};K(t,H.loadingClass);if(f){clearTimeout(c);c=I(x,2500);V(t,L,true)}if(o){G.call(l.getElementsByTagName("source"),F)}if(s){t.setAttribute("srcset",s)}else if(n&&!o){if(d.test(t.nodeName)){T(t,n)}else{t.src=n}}if(r&&(s||o)){Y(t,{src:n})}}if(t._lazyRace){delete t._lazyRace}Q(t,H.lazyClass);ee(function(){var e=t.complete&&t.naturalWidth>1;if(!f||e){if(e){K(t,"ls-is-cached")}B(u);t._lazyCache=true;I(function(){if("_lazyCache"in t){delete t._lazyCache}},9)}if(t.loading=="lazy"){N--}},true)});var R=function(e){if(e._lazyRace){return}var t;var i=n.test(e.nodeName);var a=i&&(e[$](H.sizesAttr)||e[$]("sizes"));var r=a=="auto";if((r||!m)&&i&&(e[$]("src")||e.srcset)&&!e.complete&&!J(e,H.errorClass)&&J(e,H.lazyClass)){return}t=X(e,"lazyunveilread").detail;if(r){re.updateElem(e,true,e.offsetWidth)}e._lazyRace=true;N++;s(e,t,r,a,i)};var r=ae(function(){H.loadMode=3;i()});var l=function(){if(H.loadMode==3){H.loadMode=2}r()};var o=function(){if(m){return}if(f.now()-e<999){I(o,999);return}m=true;H.loadMode=3;i();q("scroll",l,true)};return{_:function(){e=f.now();k.elements=D.getElementsByClassName(H.lazyClass);v=D.getElementsByClassName(H.lazyClass+" "+H.preloadClass);q("scroll",i,true);q("resize",i,true);q("pageshow",function(e){if(e.persisted){var t=D.querySelectorAll("."+H.loadingClass);if(t.length&&t.forEach){U(function(){t.forEach(function(e){if(e.complete){R(e)}})})}}});if(u.MutationObserver){new MutationObserver(i).observe(O,{childList:true,subtree:true,attributes:true})}else{O[P]("DOMNodeInserted",i,true);O[P]("DOMAttrModified",i,true);setInterval(i,999)}q("hashchange",i,true);["focus","mouseover","click","load","transitionend","animationend"].forEach(function(e){D[P](e,i,true)});if(/d$|^c/.test(D.readyState)){o()}else{q("load",o);D[P]("DOMContentLoaded",i);I(o,2e4)}if(k.elements.length){t();ee._lsFlush()}else{i()}},checkElems:i,unveil:R,_aLSL:l}}(),re=function(){var i;var n=te(function(e,t,i,a){var r,n,s;e._lazysizesWidth=a;a+="px";e.setAttribute("sizes",a);if(j.test(t.nodeName||"")){r=t.getElementsByTagName("source");for(n=0,s=r.length;n<s;n++){r[n].setAttribute("sizes",a)}}if(!i.detail.dataAttr){Y(e,i.detail)}});var a=function(e,t,i){var a;var r=e.parentNode;if(r){i=s(e,r,i);a=X(e,"lazybeforesizes",{width:i,dataAttr:!!t});if(!a.defaultPrevented){i=a.detail.width;if(i&&i!==e._lazysizesWidth){n(e,r,a,i)}}}};var e=function(){var e;var t=i.length;if(t){e=0;for(;e<t;e++){a(i[e])}}};var t=ae(e);return{_:function(){i=D.getElementsByClassName(H.autosizesClass);q("resize",t)},checkElems:t,updateElem:a}}(),t=function(){if(!t.i&&D.getElementsByClassName){t.i=true;re._();e._()}};return I(function(){H.init&&t()}),k={cfg:H,autoSizer:re,loader:e,init:t,uP:Y,aC:K,rC:Q,hC:J,fire:X,gW:s,rAF:ee}}(e,e.document,Date);e.lazySizes=t,"object"==typeof module&&module.exports&&(module.exports=t)}("undefined"!=typeof window?window:{}); 13 14/*! Modernizr */ 15// prettier-ignore 16window.Modernizr=function(e,t,n){function r(e){b.cssText=e}function o(e,t){return r(S.join(e+";")+(t||""))}function a(e,t){return typeof e===t}function i(e,t){return!!~(""+e).indexOf(t)}function c(e,t){for(var r in e){var o=e[r];if(!i(o,"-")&&b[o]!==n)return"pfx"==t?o:!0}return!1}function s(e,t,r){for(var o in e){var i=t[e[o]];if(i!==n)return r===!1?e[o]:a(i,"function")?i.bind(r||t):i}return!1}function u(e,t,n){var r=e.charAt(0).toUpperCase()+e.slice(1),o=(e+" "+k.join(r+" ")+r).split(" ");return a(t,"string")||a(t,"undefined")?c(o,t):(o=(e+" "+T.join(r+" ")+r).split(" "),s(o,t,n))}function l(){p.input=function(n){for(var r=0,o=n.length;o>r;r++)j[n[r]]=!!(n[r]in E);return j.list&&(j.list=!(!t.createElement("datalist")||!e.HTMLDataListElement)),j}("autocomplete autofocus list placeholder max min multiple pattern required step".split(" ")),p.inputtypes=function(e){for(var r,o,a,i=0,c=e.length;c>i;
16i++)E.setAttribute("type",o=e[i]),r="text"!==E.type,r&&(E.value=x,E.style.cssText="position:absolute;visibility:hidden;",/^range$/.test(o)&&E.style.WebkitAppearance!==n?(g.appendChild(E),a=t.defaultView,r=a.getComputedStyle&&"textfield"!==a.getComputedStyle(E,null).WebkitAppearance&&0!==E.offsetHeight,g.removeChild(E)):/^(search|tel)$/.test(o)||(r=/^(url|email)$/.test(o)?E.checkValidity&&E.checkValidity()===!1:E.value!=x)),P[e[i]]=!!r;return P}("search tel url email datetime date month week time datetime-local number range color".split(" "))}var d,f,m="2.8.3",p={},h=!0,g=t.documentElement,v="modernizr",y=t.createElement(v),b=y.style,E=t.createElement("input"),x=":)",w={}.toString,S=" -webkit- -moz- -o- -ms- ".split(" "),C="Webkit Moz O ms",k=C.split(" "),T=C.toLowerCase().split(" "),N={svg:"http://www.w3.org/2000/svg"},M={},P={},j={},$=[],D=$.slice,F=function(e,n,r,o){var a,i,c,s,u=t.createElement("div"),l=t.body,d=l||t.createElement("body");if(parseInt(r,10))for(;r--;)c=t.createElement("div"),c.id=o?o[r]:v+(r+1),u.appendChild(c);return a=["­",'<style id="s',v,'">',e,"</style>"].join(""),u.id=v,(l?u:d).innerHTML+=a,d.appendChild(u),l||(d.style.background="",d.style.overflow="hidden",s=g.style.overflow,g.style.overflow="hidden",g.appendChild(d)),i=n(u,e),l?u.parentNode.removeChild(u):(d.parentNode.removeChild(d),g.style.overflow=s),!!i},z=function(t){var n=e.matchMedia||e.msMatchMedia;if(n)return n(t)&&n(t).matches||!1;var r;return F("@media "+t+" { #"+v+" { position: absolute; } }",function(t){r="absolute"==(e.getComputedStyle?getComputedStyle(t,null):t.currentStyle).position}),r},A=function(){function e(e,o){o=o||t.createElement(r[e]||"div"),e="on"+e;var i=e in o;return i||(o.setAttribute||(o=t.createElement("div")),o.setAttribute&&o.removeAttribute&&(o.setAttribute(e,""),i=a(o[e],"function"),a(o[e],"undefined")||(o[e]=n),o.removeAttribute(e))),o=null,i}var r={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return e}(),L={}.hasOwnProperty;f=a(L,"undefined")||a(L.call,"undefined")?function(e,t){return t in e&&a(e.constructor.prototype[t],"undefined")}:function(e,t){return L.call(e,t)},Function.prototype.bind||(Function.prototype.bind=function(e){var t=this;if("function"!=typeof t)throw new TypeError;var n=D.call(arguments,1),r=function(){if(this instanceof r){var o=function(){};o.prototype=t.prototype;var a=new o,i=t.apply(a,n.concat(D.call(arguments)));return Object(i)===i?i:a}return t.apply(e,n.concat(D.call(arguments)))};return r}),M.flexbox=function(){return u("flexWrap")},M.flexboxlegacy=function(){return u("boxDirection")},M.canvas=function(){var e=t.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},M.canvastext=function(){return!(!p.canvas||!a(t.createElement("canvas").getContext("2d").fillText,"function"))},M.webgl=function(){return!!e.WebGLRenderingContext},M.touch=function(){var n;return"ontouchstart"in e||e.DocumentTouch&&t instanceof DocumentTouch?n=!0:F(["@media (",S.join("touch-enabled),("),v,")","{#modernizr{top:9px;position:absolute}}"].join(""),function(e){n=9===e.offsetTop}),n},M.geolocation=function(){return"geolocation"in navigator},M.postmessage=function(){return!!e.postMessage},M.websqldatabase=function(){return!!e.openDatabase},M.indexedDB=function(){return!!u("indexedDB",e)},M.hashchange=function(){return A("hashchange",e)&&(t.documentMode===n||t.documentMode>7)},M.history=function(){return!(!e.history||!history.pushState)},M.draganddrop=function(){var e=t.createElement("div");return"draggable"in e||"ondragstart"in e&&"ondrop"in e},M.websockets=function(){return"WebSocket"in e||"MozWebSocket"in e},M.rgba=function(){return r("background-color:rgba(150,255,150,.5)"),i(b.backgroundColor,"rgba")},M.hsla=function(){return r("background-color:hsla(120,40%,100%,.5)"),i(b.backgroundColor,"rgba")||i(b.backgroundColor,"hsla")},M.multiplebgs=function(){return r("background:url(https://),url(https://),red url(https://)"),/(url\s*\(.*?){3}/.test(b.background)},M.backgroundsize=function(){return u("backgroundSize")},M.borderimage=function(){return u("borderImage")}
16,M.borderradius=function(){return u("borderRadius")},M.boxshadow=function(){return u("boxShadow")},M.textshadow=function(){return""===t.createElement("div").style.textShadow},M.opacity=function(){return o("opacity:.55"),/^0.55$/.test(b.opacity)},M.cssanimations=function(){return u("animationName")},M.csscolumns=function(){return u("columnCount")},M.cssgradients=function(){var e="background-image:",t="gradient(linear,left top,right bottom,from(#9f9),to(white));",n="linear-gradient(left top,#9f9, white);";return r((e+"-webkit- ".split(" ").join(t+e)+S.join(n+e)).slice(0,-e.length)),i(b.backgroundImage,"gradient")},M.cssreflections=function(){return u("boxReflect")},M.csstransforms=function(){return!!u("transform")},M.csstransforms3d=function(){var e=!!u("perspective");return e&&"webkitPerspective"in g.style&&F("@media (transform-3d),(-webkit-transform-3d){#modernizr{left:9px;position:absolute;height:3px;}}",function(t){e=9===t.offsetLeft&&3===t.offsetHeight}),e},M.csstransitions=function(){return u("transition")},M.fontface=function(){var e;return F('@font-face {font-family:"font";src:url("https://")}',function(n,r){var o=t.getElementById("smodernizr"),a=o.sheet||o.styleSheet,i=a?a.cssRules&&a.cssRules[0]?a.cssRules[0].cssText:a.cssText||"":"";e=/src/i.test(i)&&0===i.indexOf(r.split(" ")[0])}),e},M.generatedcontent=function(){var e;return F(["#",v,"{font:0/0 a}#",v,':after{content:"',x,'";visibility:hidden;font:3px/1 a}'].join(""),function(t){e=t.offsetHeight>=3}),e},M.video=function(){var e=t.createElement("video"),n=!1;try{(n=!!e.canPlayType)&&(n=new Boolean(n),n.ogg=e.canPlayType('video/ogg; codecs="theora"').replace(/^no$/,""),n.h264=e.canPlayType('video/mp4; codecs="avc1.42E01E"').replace(/^no$/,""),n.webm=e.canPlayType('video/webm; codecs="vp8, vorbis"').replace(/^no$/,""))}catch(r){}return n},M.audio=function(){var e=t.createElement("audio"),n=!1;try{(n=!!e.canPlayType)&&(n=new Boolean(n),n.ogg=e.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,""),n.mp3=e.canPlayType("audio/mpeg;").replace(/^no$/,""),n.wav=e.canPlayType('audio/wav; codecs="1"').replace(/^no$/,""),n.m4a=(e.canPlayType("audio/x-m4a;")||e.canPlayType("audio/aac;")).replace(/^no$/,""))}catch(r){}return n},M.localstorage=function(){try{return localStorage.setItem(v,v),localStorage.removeItem(v),!0}catch(e){return!1}},M.sessionstorage=function(){try{return sessionStorage.setItem(v,v),sessionStorage.removeItem(v),!0}catch(e){return!1}},M.webworkers=function(){return!!e.Worker},M.applicationcache=function(){return!!e.applicationCache},M.svg=function(){return!!t.createElementNS&&!!t.createElementNS(N.svg,"svg").createSVGRect},M.inlinesvg=function(){var e=t.createElement("div");return e.innerHTML="<svg/>",(e.firstChild&&e.firstChild.namespaceURI)==N.svg},M.smil=function(){return!!t.createElementNS&&/SVGAnimate/.test(w.call(t.createElementNS(N.svg,"animate")))},M.svgclippaths=function(){return!!t.createElementNS&&/SVGClipPath/.test(w.call(t.createElementNS(N.svg,"clipPath")))};for(var H in M)f(M,H)&&(d=H.toLowerCase(),p[d]=M[H](),$.push((p[d]?"":"no-")+d));return p.input||l(),p.addTest=function(e,t){if("object"==typeof e)for(var r in e)f(e,r)&&p.addTest(r,e[r]);else{if(e=e.toLowerCase(),p[e]!==n)return p;t="function"==typeof t?t():t,"undefined"!=typeof h&&h&&(g.className+=" "+(t?"":"no-")+e),p[e]=t}return p},r(""),y=E=null,function(e,t){function n(e,t){var n=e.createElement("p"),r=e.getElementsByTagName("head")[0]||e.documentElement;return n.innerHTML="x<style>"+t+"</style>",r.insertBefore(n.lastChild,r.firstChild)}function r(){var e=y.elements;return"string"==typeof e?e.split(" "):e}function o(e){var t=v[e[h]];return t||(t={},g++,e[h]=g,v[g]=t),t}function a(e,n,r){if(n||(n=t),l)return n.createElement(e);r||(r=o(n));var a;return a=r.cache[e]?r.cache[e].cloneNode():p.test(e)?(r.cache[e]=r.createElem(e)).cloneNode():r.createElem(e),!a.canHaveChildren||m.test(e)||a.tagUrn?a:r.frag.appendChild(a)}function i(e,n){if(e||(e=t),l)return e.createDocumentFragment();n=n||o(e);for(var a=n.frag.cloneNode(),i=0,c=r(),s=c.length;s>i;i++)a.createElement(c[i]);return a}function c(e,t){t.cache||(t.cache={},t.createElem=e.createElement,t.createFrag=e.createDocumentFragment,t.frag=t.createFrag()),e.createElement=function(n){return y.shivMethods?a(n,e,t):t.createElem(n)},e.createDocumentFragment=Function("h,f","return function(){var n=f.cloneNode(),c=n.createElement;h.shivMethods&&("+r().join().replace(/[\w\-]+/g,function(e){return t.createElem(e),t.frag.createElement(e),'c("'+e+'")'})+");return n}")(y,t.frag)}function s(e){e||(e=t);var r=o(e);return!y.shivCSS||u||r.hasCSS||(r.hasCSS=!!n(e,"article,aside,dialog,figcaption,figure,footer,header,hgroup,main,nav,section{dis
16play:block}mark{background:#FF0;color:#000}template{display:none}")),l||c(e,r),e}var u,l,d="3.7.0",f=e.html5||{},m=/^<|^(?:button|map|select|textarea|object|iframe|option|optgroup)$/i,p=/^(?:a|b|code|div|fieldset|h1|h2|h3|h4|h5|h6|i|label|li|ol|p|q|span|strong|style|table|tbody|td|th|tr|ul)$/i,h="_html5shiv",g=0,v={};!function(){try{var e=t.createElement("a");e.innerHTML="<xyz></xyz>",u="hidden"in e,l=1==e.childNodes.length||function(){t.createElement("a");var e=t.createDocumentFragment();return"undefined"==typeof e.cloneNode||"undefined"==typeof e.createDocumentFragment||"undefined"==typeof e.createElement}()}catch(n){u=!0,l=!0}}();var y={elements:f.elements||"abbr article aside audio bdi canvas data datalist details dialog figcaption figure footer header hgroup main mark meter nav output progress section summary template time video",version:d,shivCSS:f.shivCSS!==!1,supportsUnknownElements:l,shivMethods:f.shivMethods!==!1,type:"default",shivDocument:s,createElement:a,createDocumentFragment:i};e.html5=y,s(t)}(this,t),p._version=m,p._prefixes=S,p._domPrefixes=T,p._cssomPrefixes=k,p.mq=z,p.hasEvent=A,p.testProp=function(e){return c([e])},p.testAllProps=u,p.testStyles=F,p.prefixed=function(e,t,n){return t?u(e,t,n):u(e,"pfx")},g.className=g.className.replace(/(^|\s)no-js(\s|$)/,"$1$2")+(h?" js "+$.join(" "):""),p}(this,this.document); 17 18/*--------------------------------------- 19 * Detect User Agent Script 20 * http://cssuseragent.org 21 *---------------------------------------- 22 * This is by far the best detection script I've found. 23 * Using javascript means that this will work with caching. W00t. 24 * 25 * Adds user agent classes to the <html> element on your page including OS 26 * and browser version. 27 * 28 */ 29// prettier-ignore 30var cssua=function(n,l,p){var q=/\s*([\-\w ]+)[\s\/\:]([\d_]+\b(?:[\-\._\/]\w+)*)/,r=/([\w\-\.]+[\s\/][v]?[\d_]+\b(?:[\-\._\/]\w+)*)/g,s=/\b(?:(blackberry\w*|bb10)|(rim tablet os))(?:\/(\d+\.\d+(?:\.\w+)*))?/,t=/\bsilk-accelerated=true\b/,u=/\bfluidapp\b/,v=/(\bwindows\b|\bmacintosh\b|\blinux\b|\bunix\b)/,w=/(\bandroid\b|\bipad\b|\bipod\b|\bwindows phone\b|\bwpdesktop\b|\bxblwp7\b|\bzunewp7\b|\bwindows ce\b|\bblackberry\w*|\bbb10\b|\brim tablet os\b|\bmeego|\bwebos\b|\bpalm|\bsymbian|\bj2me\b|\bdocomo\b|\bpda\b|\bchtml\b|\bmidp\b|\bcldc\b|\w*?mobile\w*?|\w*?phone\w*?)/, 31x=/(\bxbox\b|\bplaystation\b|\bnintendo\s+\w+)/,k={parse:function(b,d){var a={};d&&(a.standalone=d);b=(""+b).toLowerCase();if(!b)return a;for(var c,e,g=b.split(/[()]/),f=0,k=g.length;f<k;f++)if(f%2){var m=g[f].split(";");c=0;for(e=m.length;c<e;c++)if(q.exec(m[c])){var h=RegExp.$1.split(" ").join("_"),l=RegExp.$2;if(!a[h]||parseFloat(a[h])<parseFloat(l))a[h]=l}}else if(m=g[f].match(r))for(c=0,e=m.length;c<e;c++)h=m[c].split(/[\/\s]+/),h.length&&"mozilla"!==h[0]&&(a[h[0].split(" ").join("_")]=h.slice(1).join("-")); 32w.exec(b)?(a.mobile=RegExp.$1,s.exec(b)&&(delete a[a.mobile],a.blackberry=a.version||RegExp.$3||RegExp.$2||RegExp.$1,RegExp.$1?a.mobile="blackberry":"0.0.1"===a.version&&(a.blackberry="7.1.0.0"))):x.exec(b)?(a.game=RegExp.$1,c=a.game.split(" ").join("_"),a.version&&!a[c]&&(a[c]=a.version)):v.exec(b)&&(a.desktop=RegExp.$1);a.intel_mac_os_x?(a.mac_os_x=a.intel_mac_os_x.split("_").join("."),delete a.intel_mac_os_x):a.cpu_iphone_os?(a.ios=a.cpu_iphone_os.split("_").join("."),delete a.cpu_iphone_os):a.cpu_os? 33(a.ios=a.cpu_os.split("_").join("."),delete a.cpu_os):"iphone"!==a.mobile||a.ios||(a.ios="1");a.opera&&a.version?(a.opera=a.version,delete a.blackberry):t.exec(b)?a.silk_accelerated=!0:u.exec(b)&&(a.fluidapp=a.version);a.edge&&(delete a.applewebkit,delete a.safari,delete a.chrome,delete a.android);if(a.applewebkit)a.webkit=a.applewebkit,delete a.applewebkit,a.opr&&(a.opera=a.opr,delete a.opr,delete a.chrome),a.safari&&(a.chrome||a.crios||a.fxios||a.opera||a.silk||a.fluidapp||a.phantomjs||a.mobile&& 34!a.ios?(delete a.safari,a.vivaldi&&delete a.chrome):a.safari=a.version&&!a.rim_tablet_os?a.version:{419:"2.0.4",417:"2.0.3",416:"2.0.2",412:"2.0",312:"1.3",125:"1.2",85:"1.0"}[parseInt(a.safari,10)]||a.safari);else if(a.msie||a.trident)if(a.opera||(a.ie=a.msie||a.rv),delete a.msie,delete a.android,a.windows_phone_os)a.windows_phone=a.windows_phone_os,delete a.windows_phone_os;else{if("wpdesktop"===a.mobile||"xblwp7"===a.mobile||"zunewp7"===a.mobile)a.mobile="windows desktop",a.windows_phone=9>+a.ie? 35"7.0":10>+a.ie?"7.5":"8.0",delete a.windows_nt}else if(a.gecko||a.firefox)a.gecko=a.rv;a.rv&&delete a.rv;a.version&&delete a.version;return a},format:function(b){var d="",a;for(a in b)if(a&&b.hasOwnProperty(a)){var c=a,e=b[a],c=c.split(".").join("-"),g=" ua-"+c;if("string"===typeof e){for(var e=e.split(" ").join("_").split(".").join("-"),f=e.indexOf("-");0<f;)g+=" ua-"+c+"-"+e.substring(0,f),f=e.indexOf("-",f+1);g+=" ua-"+c+"-"+e}d+=g}return d},encode:function(b){var d="",a;for(a in b)a&&b.hasOwnProperty(a)&& 36(d&&(d+="\x26"),d+=encodeURIComponent(a)+"\x3d"+encodeURIComponent(b[a]));return d}};k.userAgent=k.ua=k.parse(l,p);l=k.format(k.ua)+" js";n.className=n.className?n.className.replace(/\bno-js\b/g,"")+l:l.substr(1);return k}(document.documentElement,navigator.userAgent,navigator.standalone); 37 38/* 39 * Get Viewport Dimensions 40 * returns object with viewport dimensions to match css in width and height properties 41 * ( source: http://andylangton.co.uk/blog/development/get-viewport-size-width-and-height-javascript ) 42 */ 43// prettier-ignore 44function updateViewportDimensions() { 45 var w=window,d=document,e=d.documentElement,g=d.getElementsByTagName('body')[0],x=w.innerWidth||e.clientWidth||g.clientWidth,y=w.innerHeight||e.clientHeight||g.clientHeight; 46 return { width:x,height:y }; 47} 48// setting the viewport width 49var viewport = updateViewportDimensions(); 50 51/* 52 * Throttle Resize-triggered Events 53 * Wrap your actions in this function to throttle the frequency of firing them off, for better performance, esp. on mobile.
vendor: 4,339 bytes, lines 54-114
54 * ( source: http://stackoverflow.com/questions/2854407/javascript-jquery-window-resize-how-to-fire-after-the-resize-is-completed ) 55 */ 56// prettier-ignore 57var waitForFinalEvent = (function () { 58 var timers = {}; 59 return function (callback, ms, uniqueId) { 60 if (!uniqueId) { uniqueId = "Don't call this twice without a uniqueId"; } 61 if (timers[uniqueId]) { clearTimeout (timers[uniqueId]); } 62 timers[uniqueId] = setTimeout(callback, ms); 63 }; 64})(); 65 66// how long to wait before deciding the resize has stopped, in ms. Around 50-100 should work ok. 67var timeToWaitForLast = 100; 68 69/* 70 * Here's an example so you can see how we're using the above function 71 * 72 * This is commented out so it won't work, but you can copy it and 73 * remove the comments. 74 * 75 * 76 * 77 * If we want to only do it on a certain page, we can setup checks so we do it 78 * as efficient as possible. 79 * 80 * if( typeof is_home === "undefined" ) var is_home = $('body').hasClass('home'); 81 * 82 * This once checks to see if you're on the home page based on the body class 83 * We can then use that check to perform actions on the home page only 84 * 85 * When the window is resized, we perform this function 86 * $(window).resize(function () { 87 * 88 * // if we're on the home page, we wait the set amount (in function above) then fire the function 89 * if( is_home ) { waitForFinalEvent( function() { 90 * 91 * // update the viewport, in case the window size has changed 92 * viewport = updateViewportDimensions(); 93 * 94 * // if we're above or equal to 768 fire this off 95 * if( viewport.width >= 768 ) { 96 * console.log('On home page and window sized to 768 width or more.'); 97 * } else { 98 * // otherwise, let's do this instead 99 * console.log('Not on home page, or window sized to less than 768.'); 100 * } 101 * 102 * }, timeToWaitForLast, "your-function-identifier-string"); } 103 * }); 104 * 105 * 106 */ 107 108/*! 109 * headroom.js v0.12.0 - Give your page some headroom. Hide your header until you need it 110 * Copyright (c) 2020 Nick Williams - http://wicky.nillia.ms/headroom.js 111 * License: MIT 112 */ 113// prettier-ignore 114!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(t=t||self).Headroom=n()}(this,function(){"use strict";function t(){return"undefined"!=typeof window}function d(t){return function(t){return t&&t.document&&function(t){return 9===t.nodeType}(t.document)}(t)?function(t){var n=t.document,o=n.body,s=n.documentElement;return{scrollHeight:function(){return Math.max(o.scrollHeight,s.scrollHeight,o.offsetHeight,s.offsetHeight,o.clientHeight,s.clientHeight)},height:function(){return t.innerHeight||s.clientHeight||o.clientHeight},scrollY:function(){return void 0!==t.pageYOffset?t.pageYOffset:(s||o.parentNode||o).scrollTop}}}(t):function(t){return{scrollHeight:function(){return Math.max(t.scrollHeight,t.offsetHeight,t.clientHeight)},height:function(){return Math.max(t.offsetHeight,t.clientHeight)},scrollY:function(){return t.scrollTop}}}(t)}function n(t,s,e){var n,o=function(){var n=!1;try{var t={get passive(){n=!0}};window.addEventListener("test",t,t),window.removeEventListener("test",t,t)}catch(t){n=!1}return n}(),i=!1,r=d(t),l=r.scrollY(),a={};function c(){var t=Math.round(r.scrollY()),n=r.height(),o=r.scrollHeight();a.scrollY=t,a.lastScrollY=l,a.direction=l<t?"down":"up",a.distance=Math.abs(t-l),a.isOutOfBounds=t<0||o<t+n,a.top=t<=s.offset[a.direction],a.bottom=o<=t+n,a.toleranceExceeded=a.distance>s.tolerance[a.direction],e(a),l=t,i=!1}function h(){i||(i=!0,n=requestAnimationFrame(c))}var u=!!o&&{passive:!0,capture:!1};return t.addEventListener("scroll",h,u),c(),{destroy:function(){cancelAnimationFrame(n),t.removeEventListener("scroll",h,u)}}}function o(t){return t===Object(t)?t:{down:t,up:t}}function s(t,n){n=n||{},Object.assign(this,s.options,n),this.classes=Object.assign({},s.options.classes,n.classes),this.elem=t,this.tolerance=o(this.tolerance),this.offset=o(this.offset),this.initialised=!1,this.frozen=!1}return s.prototype={constructor:s,init:function(){return s.cutsTheMustard&&!this.initialised&&(this.addClass("initial"),this.initialised=!0,setTimeout(function(t){t.scrollTracker=n(t.scroller,{offset:t.offset,tolerance:t.tolerance},t.update.bind(t))},100,this)),this},destroy:function(){this.initialised=!1,Object.keys(this.classes).forEac
114h(this.removeClass,this),this.scrollTracker.destroy()},unpin:function(){!this.hasClass("pinned")&&this.hasClass("unpinned")||(this.addClass("unpinned"),this.removeClass("pinned"),this.onUnpin&&this.onUnpin.call(this))},pin:function(){this.hasClass("unpinned")&&(this.addClass("pinned"),this.removeClass("unpinned"),this.onPin&&this.onPin.call(this))},freeze:function(){this.frozen=!0,this.addClass("frozen")},unfreeze:function(){this.frozen=!1,this.removeClass("frozen")},top:function(){this.hasClass("top")||(this.addClass("top"),this.removeClass("notTop"),this.onTop&&this.onTop.call(this))},notTop:function(){this.hasClass("notTop")||(this.addClass("notTop"),this.removeClass("top"),this.onNotTop&&this.onNotTop.call(this))},bottom:function(){this.hasClass("bottom")||(this.addClass("bottom"),this.removeClass("notBottom"),this.onBottom&&this.onBottom.call(this))},notBottom:function(){this.hasClass("notBottom")||(this.addClass("notBottom"),this.removeClass("bottom"),this.onNotBottom&&this.onNotBottom.call(this))},shouldUnpin:function(t){return"down"===t.direction&&!t.top&&t.toleranceExceeded},shouldPin:function(t){return"up"===t.direction&&t.toleranceExceeded||t.top},addClass:function(t){this.elem.classList.add.apply(this.elem.classList,this.classes[t].split(" "))},removeClass:function(t){this.elem.classList.remove.apply(this.elem.classList,this.classes[t].split(" "))},hasClass:function(t){return this.classes[t].split(" ").every(function(t){return this.classList.contains(t)},this.elem)},update:function(t){t.isOutOfBounds||!0!==this.frozen&&(t.top?this.top():this.notTop(),t.bottom?this.bottom():this.notBottom(),this.shouldUnpin(t)?this.unpin():this.shouldPin(t)&&this.pin())}},s.options={tolerance:{up:0,down:0},offset:0,scroller:t()?window:null,classes:{frozen:"headroom--frozen",pinned:"headroom--pinned",unpinned:"headroom--unpinned",top:"headroom--top",notTop:"headroom--not-top",bottom:"headroom--bottom",notBottom:"headroom--not-bottom",initial:"headroom"}},s.cutsTheMustard=!!(t()&&function(){}.bind&&"classList"in document.documentElement&&Object.assign&&Object.keys&&requestAnimationFrame),s}); 115/*! 116 * headroom.js v0.9.4 - Give your page some headroom. Hide your header until you need it 117 * Copyright (c) 2017 Nick Williams - http://wicky.nillia.ms/headroom.js 118 * License: MIT 119 */ 120// prettier-ignore 121// !function(a){a&&(a.fn.headroom=function(b){return this.each(function(){var c=a(this),d=c.data("headroom"),e="object"==typeof b&&b;e=a.extend(!0,{},Headroom.options,e),d||(d=new Headroom(this,e),d.init(),c.data("headroom",d)),"string"==typeof b&&(d[b](),"destroy"===b&&c.removeData("headroom"))})},a("[data-headroom]").each(function(){var b=a(this);b.headroom(b.data())}))}(window.Zepto||window.jQuery); 122 123window.wayfx = window.wayfx || {}; 124wayfx.cacheSelectors = function () { 125 wayfx.cache = { 126 // General 127 $html: $("html"), 128 $body: $(document.body), 129 130 // Navigation 131 $header: $(".wayfx-header"), 132 $main: $("#primary"), 133 $navigation: $("#wayfxNavigation"), 134 $mobileNavToggle: $(".wayfx-header__nav-toggle"), 135 $mobileNav: $(".wayfx-header__mobile-nav"), 136 $mobileNavBlog: $(".wayfx-header__mobile-nav-blog"), 137 }; 138}; 139 140wayfx.init = function () { 141 wayfx.cacheSelectors(); 142 wayfx.siteHeader(); 143 // wayfx.mobileNavToggle(); 144 // wayfx.mobileNavDropdown(); 145 wayfx.smoothScroll(); 146 wayfx.accordions(); 147 wayfx.fancyLightbox(); 148 // wayfx.homeProductsSlider(); 149 wayfx.pageProgress(); 150 // wayfx.customSelect(); 151 wayfx.slickSliders(); 152 wayfx.animations(); 153 wayfx.misc(); 154}; 155 156wayfx.siteHeader = function () { 157 $(window).on("load scroll", function () { 158 var siteHeader = wayfx.cache.$header, 159 topbar = $(".wayfx-topbar"), 160 topbarHeight = topbar.outerHeight(true), 161 scrollwin = $(window).scrollTop(); 162 163 if (topbar.length) { 164 siteHeader.css("--top", topbarHeight + "px"); 165 } 166 }); 167 168 if ( 169 wayfx.cache.$body.hasClass("home") || 170 wayfx.cache.$body.hasClass("page-template-homepage-warrior") || 171 wayfx.cache.$body.hasClass("page-template-homepage-video") 172 ) { 173 $(window).on("scroll unload", function () { 174 let scroll = $(window).scrollTop(), 175 topbarHeight = $(".wayfx-topbar").outerHeight(true); 176 177 if ($(".wayfx-topbar").length && scroll > topbarHeight) { 178 wayfx.cache.$header.addClass("activeScroll"); 179 wayfx.cache.$header.css("--top", "0px"); 180 } else if (!$(".wayfx-topbar").length && scroll > 0) { 181 wayfx.cache.$header.addClass("activeScroll"); 182 wayfx.cache.$header.css("--top", "0px"); 183 } else { 184 wayfx.cache.$header.removeClass("activeScroll"); 185 } 186 }); 187 } 188 189 // Search 190 $("#search").each(function () { 191 var self = $(this); 192 var form = self.children("form"); 193 var formInput = $(".search-input"); 194 var closeBtn = $(".search__reset"); 195 formInput.on("click", function () { 196 self.addClass("open"); 197 198 setTimeout(function () { 199 formInput[0].focus(); 200 }, 250); 201 202 if (formInput.val()) { 203 closeBtn.removeClass("hide"); 204 } 205 }); 206 207 formInput.on("keypress", function () { 208 closeBtn.removeClass("hide"); 209 }); 210 211 $(document).on("click", function (e) { 212 if (!$(e.target).is(self) && !jQuery.contains(self[0], e.target)) { 213 self.removeClass("open"); 214 closeBtn.addClass("hide"); 215 formInput.val(""); 216 } 217 }); 218 219 closeBtn.on("click", function () { 220 $(this).addClass("hide"); 221 formInput.val(""); 222 }); 223 }); 224}; 225 226// wayfx.mobileNavToggle = function () { 227// var navToggle = wayfx.cache.$mobileNavToggle, 228// siteHeader = wayfx.cache.$header, 229// mobileNav = wayfx.cache.$mobileNav; 230 231// navToggle.on("click", function () { 232// if ( 233// siteHeader.hasClass("mobile-menu-active") && 234// wayfx.cache.$body.hasClass("menu-opened") 235// ) { 236// $(this).attr("aria-expanded", "false"); 237// $(this).attr("aria-label", "menu"); 238// siteHeader.removeClass("mobile-menu-active"); 239// mobileNav.removeClass("active"); 240// wayfx.cache.$body.removeClass("menu-opened"); 241// } else { 242// siteHeader.addClass("mobile-menu-active"); 243// mobileNav.addClass("active"); 244// wayfx.cache.$body.addClass("menu-opened"); 245// $(this).attr("aria-expanded", "true"); 246// $(this).attr("aria-label", "close menu"); 247// } 248// }); 249 250// // Function to hide mobile nav if clicked anywhere outside of it 251// $(document).mouseup(function (e) { 252// var siteheader = wayfx.cache.$header, 253// mobileNav = wayfx.cache.$mobileNav; 254 255// if ( 256// !siteheader.is(e.target) && 257// !mobileNav.is(e.target) && 258// siteheader.has(e.target).length === 0 && 259// mobileNav.has(e.target).length === 0 260// ) { 261// siteheader.removeClass("mobile-menu-active"); 262// mobileNav.removeClass("active"); 263// wayfx.cache.$body.removeClass("menu-opened"); 264// $(".wayfx-header__nav-toggle").attr("aria-expanded", "false"); 265// $(".wayfx-header__nav-toggle").attr("aria-label", "menu"); 266// } 267// }); 268 269// var siteHeader = wayfx.cache.$header, 270// mobileNav = wayfx.cache.$mobileNav, 271// siteHeaderHeight = siteHeader.outerHeight(true), 272// topbar = $(".wayfx-topbar"), 273// topbarHeight = topbar.outerHeight(true), 274// topbarAndSiteHeaderHeight = siteHeaderHeight + topbarHeight, 275// scroll = $(window).scrollTop(); 276 277// if (!topbar.length && scroll == 0) { 278// mobileNav.css("--top", siteHeaderHeight + "px"); 279// } else if (scroll == 0) { 280// mobileNav.css("--top", topbarAndSiteHeaderHeight + "px"); 281// } else if (scroll >= siteHeaderHeight) { 282// mobileNav.css("--top", siteHeaderHeight + "px"); 283// } 284 285// $(window).on("load scroll", function () { 286// var siteHeader = wayfx.cache.$header, 287// mobileNav = wayfx.cache.$mobileNav, 288// siteHeaderHeight = siteHeader.outerHeight(true), 289// topbar = $(".wayfx-topbar"), 290// topbarHeight = topbar.outerHeight(true), 291// topbarAndSiteHeaderHeight = siteHeaderHeight + topbarHeight, 292// scroll = $(window).scrollTop(); 293 294// if (!topbar.length && scroll == 0) { 295// mobileNav.css("--top", siteHeaderHeight + "px"); 296// } else if (scroll == 0) { 297// mobileNav.css("--top", topbarAndSiteHeaderHeight + "px"); 298// } else if (scroll >= siteHeaderHeight) { 299// mobileNav.css("--top", siteHeaderHeight + "px"); 300// } 301 302// // if(siteHeader.hasClass('wayfx-header--alt') && topbar.length){ 303// // siteHeaderHeight = topbarAndSiteHeaderHeight; 304// // mobileNav.css("--top",siteHeaderHeight+"px"); 305// // $('.wayfx-header__subnav').css("--top","0px"); 306// // $('#wayfx-reading-progress').css("--top","0px"); 307// // } else if(siteHeader.hasClass('wayfx-header--alt')) { 308// // siteHeaderHeight = 132; 309// // mobileNav.css("--top",siteHeaderHeight+"px"); 310// // $('.wayfx-header__subnav').css("--top",siteHeaderHeight+"px"); 311// // } 312// }); 313 314// // blog mobile menu search 315// var blogMobileMenu = $(".wayfx-header__mobile-nav-blog"),
316// blogMobileMenuInput = $(".wayfx-header__mobile-nav-blog input"), 317// blogMobileMenuCategories = $(".wayfx-header__mobile-nav-categories"), 318// blogMobileMenuNav = $(".wayfx-header__mobile-nav-main"), 319// blogMobileMenuSearchBack = $(".wayfx-header__search-close"), 320// headerCloseBtn = $(".wayfx-header__nav-toggle"), 321// blogMobileMenuSearcHSuggestions = $(".wayfx-header__search-suggestions"); 322 323// $(".hidden-toggle").on("click", function (e) { 324// e.preventDefault(); 325// $(this).hide(); 326// blogMobileMenu.addClass("search-active"); 327// $("body").addClass("search-active"); 328// headerCloseBtn.hide(); 329// blogMobileMenuCategories.slideUp(100); 330// blogMobileMenuNav.slideUp(100); 331// blogMobileMenuSearchBack.addClass("active"); 332// $(".search__reset").removeClass("hide"); 333// blogMobileMenuSearcHSuggestions.slideDown(100); 334 335// //some trickery mainly for mobile devices especially iOS not adhering to the setTimeout function. 336// const fakeInput = document.createElement("input"); 337// fakeInput.setAttribute("type", "text"); 338// fakeInput.style.position = "absolute"; 339// fakeInput.style.opacity = 0; 340// fakeInput.style.height = 0; 341// fakeInput.style.fontSize = "16px"; // disable auto zoom 342 343// // you may need to append to another element depending on the browser's auto 344// // zoom/scroll behavior 345// document.body.prepend(fakeInput); 346 347// // focus so that subsequent async focus will work 348// fakeInput.focus(); 349 350// setTimeout(() => { 351// blogMobileMenuInput.focus(); 352// fakeInput.remove(); 353// }, 300); 354// }); 355 356// $(".search__reset").on("click", function () { 357// blogMobileMenuInput.val(""); 358// blogMobileMenuInput.focus(); 359// }); 360 361// blogMobileMenuInput.on("blur", function (e) { 362// blogMobileMenuInput.val(""); 363// }); 364 365// blogMobileMenuSearchBack.on("click", function () { 366// $(".hidden-toggle").show(); 367// blogMobileMenuInput.val(""); 368// blogMobileMenu.removeClass("search-active"); 369// $("body").removeClass("search-active"); 370// headerCloseBtn.fadeIn(100); 371// blogMobileMenuCategories.slideDown(150); 372// blogMobileMenuNav.slideDown(150); 373// blogMobileMenuSearchBack.removeClass("active"); 374// blogMobileMenuSearcHSuggestions.slideUp(100); 375// }); 376 377// // Check if window size is greater than 600px and remove any active classes that trigger the mobile menu 378// $(window).on("load resize", function () { 379// viewport = updateViewportDimensions(); 380 381// if (viewport.width >= 600) { 382// if ( 383// siteHeader.hasClass("mobile-menu-active") && 384// wayfx.cache.$body.hasClass("menu-opened") 385// ) { 386// navToggle.attr("aria-expanded", "false"); 387// navToggle.attr("aria-label", "menu"); 388// siteHeader.removeClass("mobile-menu-active"); 389// mobileNav.removeClass("active"); 390// wayfx.cache.$body.removeClass("menu-opened"); 391// } 392// } 393// }); 394// }; 395 396// wayfx.mobileNavDropdown = function () { 397// var dropdownContainer = $(".wayfx-header__has-dropdown"), 398// dropdownTitle = $(".wayfx-header__dropdown-title"); 399 400// if (Modernizr.touch) { 401// dropdownContainer.each(function (index) { 402// $(this) 403// .find(dropdownTitle) 404// .on("click", function (e) { 405// $(this).attr("aria-expanded", function (i, attr) { 406// return attr == "true" ? "false" : "true"; 407// }); 408// $(this).parent().toggleClass("dropdown-open"); 409// }); 410// }); 411// } 412// }; 413 414wayfx.smoothScroll = function () { 415 if (wayfx.cache.$body.hasClass("wayfx-ab30")) { 416 // $('a[href*="#"]') 417 // // Remove links that don't actually link to anything 418 // .not('[href="#"]') 419 // .not('[href="#0"]') 420 // .click(function (event) { 421 // // On-page links 422 // if ( 423 // location.pathname.replace(/^\//, "") == 424 // this.pathname.replace(/^\//, "") && 425 // location.hostname == this.hostname 426 // ) { 427 // // Figure out element to scroll to 428 // var target = $(this.hash); 429 // target = target.length 430 // ? target 431 // : $("[name=" + this.hash.slice(1) + "]"); 432 // // Does a scroll target exist? 433 // if (target.length) { 434 // // Only prevent default if animation is actually gonna happen 435 // event.preventDefault(); 436 // $("html, body").animate( 437 // { 438 // scrollTop: target.offset().top - 120, 439 // }, 440 // 800, 441 // function () { 442 // // Callback after animation 443 // // Must change focus! 444 // var $target = $(target);
445 // $target.focus(); 446 // if ($target.is(":focus")) { 447 // // Checking if the target was focused 448 // return false; 449 // } else { 450 // $target.attr("tabindex", "-1"); // Adding tabindex for elements not focusable 451 // $target.focus(); // Set focus again 452 // } 453 // } 454 // ); 455 // } 456 // } 457 // }); 458 } else { 459 } 460}; 461 462wayfx.accordions = function () { 463 $(".wayfx-accordion-block-title").on("click", function () { 464 $(this).parent().toggleClass("wayfx-accordion-block-item--open"); 465 $(this).next(".wayfx-accordion-block-content").slideToggle(150); 466 }); 467 468 $(".wp-block-acf-accordion-title").on("click", function () { 469 $(this).parent().toggleClass("wp-block-acf-accordion-item--open"); 470 $(this).next(".wp-block-acf-accordion-content").slideToggle(150); 471 }); 472}; 473 474wayfx.fancyLightbox = function () { 475 if ($(".wp-block-image a[href*='youtube.com']").length) { 476 $(".wp-block-image a[href*='youtube.com']").fancybox(); 477 } 478}; 479 480wayfx.misc = function () { 481 $(".js-tooltip .tooltip-trigger").on("click", function () { 482 $(this).parent().addClass("js-tooltip-active"); 483 }); 484 $(".js-tooltip .close").on("click", function () { 485 if ($(this).closest(".js-tooltip").hasClass("js-tooltip-active")) { 486 $(this).closest(".js-tooltip").removeClass("js-tooltip-active"); 487 } 488 }); 489 490 $(document).mouseup(function (e) { 491 var container = $(".js-tooltip"); 492 if (!container.is(e.target) && container.has(e.target).length === 0) { 493 container.removeClass("js-tooltip-active"); 494 } 495 }); 496 497 $("div[data-readmore]") 498 .hide() 499 .each(function () { 500 var open_text = $(this).data("See All"); 501 open_text = typeof open_text !== "undefined" ? open_text : "See All"; 502 $(this).before( 503 '<a data-readmore-toggle href="#" class="readmore-toggle">' + 504 open_text + 505 "</a>" 506 ); 507 }); 508 509 $("[data-readmore-toggle]").click(function (e) { 510 e.preventDefault(); 511 512 $(this).toggleClass("active"); 513 514 var open_text = $(this).siblings("div[data-readmore]").data("open-text"); 515 var close_text = $(this).siblings("div[data-readmore]").data("close-text"); 516 517 if (typeof open_text == "undefined") { 518 open_text = "See All"; 519 } 520 if (typeof close_text == "undefined") { 521 close_text = "Close"; 522 } 523 524 if ($(this).text() == open_text) { 525 $(this) 526 .html(close_text) 527 .next("div[data-readmore]") 528 .slideToggle("fast") 529 .after(this); 530 } else { 531 $(this) 532 .html(open_text) 533 .prev("div[data-readmore]") 534 .slideToggle("fast") 535 .before(this); 536 } 537 }); 538}; 539 540// wayfx.homeProductsSlider = function () { 541// if ( 542// wayfx.cache.$body.hasClass("home") || 543// wayfx.cache.$body.hasClass("page-template-homepage-warrior") || 544// wayfx.cache.$body.hasClass("page-template-homepage-video") 545// ) { 546// // let breakpoint = window.matchMedia( '(max-width:600px)' ), // set width to destroy slider 547// // swiperHomeSlider; 548 549// // const breakpointChecker = function() { 550// // if ( breakpoint.matches === true ) { 551// // if ( swiperHomeSlider !== undefined ) swiperHomeSlider.destroy( true, true ); 552// // return; 553// // } else if ( breakpoint.matches === false ) { 554// // return enableSwiper(); 555// // } 556// // }; 557 558// // const enableSwiper = function() { 559// // swiperHomeSlider = new Swiper('.wayfx-home-products-slider', { 560// // slidesPerView: 2, 561// // slidesPerGroup: 2, 562// // spaceBetween: 32, 563// // scrollbar: { 564// // el: '.swiper-scrollbar', 565// // hide: false, 566// // draggable: true, 567// // }, 568// // navigation: { 569// // nextEl: '.swiper-button-next', 570// // prevEl: '.swiper-button-prev', 571// // }, 572// // breakpoints: { 573// // 960: { 574// // slidesPerView: 3, 575// // slidesPerGroup: 3, 576// // } 577// // } 578// // }); 579// // }; 580 581// // // keep an eye on viewport size changes 582// // breakpoint.addListener(breakpointChecker); 583 584// // // kickstart 585// // breakpointChecker(); 586 587// var swiper = new Swiper(".wayfx-home-products-slider", { 588// slidesPerView: 1, 589// slidesPerColumn: 3, 590// slidesPerColumnFill: "row", 591// spaceBetween: 16, 592// scrollbar: { 593// el: ".swiper-scrollbar", 594// hide: false, 595// draggable: true, 596// }, 597// navigation: { 598// nextEl: ".swiper-button-next", 599// prevEl: ".swiper-button-prev", 600// }, 601// pagination: { 602// el: ".swiper-pagination", 603// clickable: true, 604// }, 605// breakpoints: { 606// 600: { 607// slidesPerView: 2, 608// slidesPerGroup: 2, 609// slidesPerColumn: 1, 610// spaceBetween: 32, 611// }, 612// 960: { 613// slidesPerView: 3, 614// slidesPerGroup: 3, 615// slidesPerColumn: 1, 616// }, 617// }, 618// }); 619 620// var swiper2 = new Swiper(".wayfx-testimonials-slider", { 621// slidesPerView: 1, 622// spaceBetween: 56, 623// navigation: { 624// nextEl: ".swiper-button-next", 625// prevEl: ".swiper-button-prev", 626// }, 627// pagination: { 628// el: ".swiper-pagination", 629// clickable: true, 630// }, 631// breakpoints: { 632// 640: { 633// slidesPerView: 2, 634// slidesPerGroup: 2, 635// }, 636// }, 637// }); 638// } 639// }; 640 641wayfx.pageProgress = function () { 642 if ($("body").hasClass("single")) { 643 let readingProgressTopTimeout = null; 644 645 const updateReadingProgressTop = function () { 646 const readingProgressBar = document.getElementById("wayfx-reading-progress"); 647 if (!readingProgressBar) { 648 return; 649 } 650 651 const pinnedTopElements = [ 652 document.getElementById("wpadminbar"), 653 document.querySelector(".rtnu-topbar"), 654 document.querySelector(".wayfx-topbar"), 655 document.querySelector(".hp-top-bar"), 656 document.querySelector(".ab30stack__topbar"), 657 document.querySelector(".rtnu-nav-header"), 658 document.querySelector(".wayfx-header"), 659 document.querySelector(".rtnu-header"), 660 document.querySelector(".rtnu-header__mobile"), 661 document.querySelector(".wayfx-header__subnav"), 662 ]; 663 664 let offsetTop = 0; 665
666 pinnedTopElements.forEach(function (element) { 667 if (!element) { 668 return; 669 } 670 671 const elementStyles = window.getComputedStyle(element); 672 if (elementStyles.display === "none" || elementStyles.visibility === "hidden") { 673 return; 674 } 675 676 const rect = element.getBoundingClientRect(); 677 if (rect.height <= 0 || rect.bottom <= 0) { 678 return; 679 } 680 if (rect.top >= window.innerHeight) { 681 return; 682 } 683 684 offsetTop = Math.max(offsetTop, rect.bottom); 685 }); 686 687 readingProgressBar.style.top = Math.max(0, Math.round(offsetTop)) + "px"; 688 }; 689 690 const scheduleReadingProgressTopUpdate = function () { 691 if (readingProgressTopTimeout) { 692 window.clearTimeout(readingProgressTopTimeout); 693 } 694 readingProgressTopTimeout = window.setTimeout(updateReadingProgressTop, 250); 695 }; 696 697 $(window).scroll(function () { 698 let scrollwin = $(window).scrollTop(), 699 articleContent = $(".wayfx-article__content"), 700 articleheight = articleContent.outerHeight(true) || 0, 701 articleOffset = articleContent.length ? articleContent.offset() : null, 702 articleTop = articleOffset ? articleOffset.top : 0; 703 704 updateReadingProgressTop(); 705 scheduleReadingProgressTopUpdate(); 706 707 if (articleContent.length && articleheight > 0 && scrollwin >= articleTop) { 708 if (scrollwin <= articleTop + articleheight) { 709 $("#wayfx-reading-progress").css( 710 "width", 711 ((scrollwin - articleTop) / articleheight) * 100 + "%" 712 ); 713 } else { 714 $("#wayfx-reading-progress").css("width", "100%"); 715 } 716 } else { 717 $("#wayfx-reading-progress").css("width", "0px"); 718 } 719 720 //Trigger email opt-in box on posts 721 let triggerHeight = articleheight * 0.5, // 50% of article height 722 hideTrigger = articleheight * 0.95, // 97% of article height 723 blogSubscribeCallout = $(".wayfx-subscribe-callout"), 724 subscribeCalloutSessionData = sessionStorage.getItem( 725 "hide-subscribe-callout" 726 ); 727 728 if (scrollwin >= triggerHeight) { 729 blogSubscribeCallout.addClass("wayfx-subscribe-callout--active"); 730 } 731 if (scrollwin >= hideTrigger || subscribeCalloutSessionData == 1) { 732 blogSubscribeCallout.removeClass("wayfx-subscribe-callout--active"); 733 } 734 }); 735 736 // Include function outside of scroll function to display progress on a page reload 737 let scrollwin = $(window).scrollTop(), 738 articleContent = $(".wayfx-article__content"), 739 articleheight = articleContent.outerHeight(true) || 0, 740 articleOffset = articleContent.length ? articleContent.offset() : null, 741 articleTop = articleOffset ? articleOffset.top : 0; 742 743 updateReadingProgressTop(); 744 745 if (articleContent.length && articleheight > 0 && scrollwin >= articleTop) { 746 if (scrollwin <= articleTop + articleheight) { 747 $("#wayfx-reading-progress").css( 748 "width", 749 ((scrollwin - articleTop) / articleheight) * 100 + "%" 750 ); 751 } else { 752 $("#wayfx-reading-progress").css("width", "100%"); 753 } 754 } else { 755 $("#wayfx-reading-progress").css("width", "0px"); 756 } 757 758 $(window).on("resize orientationchange", updateReadingProgressTop); 759 $(window).on("resize orientationchange", scheduleReadingProgressTopUpdate); 760 761 const navTransitionSources = [ 762 document.querySelector(".rtnu-nav-header"), 763 document.querySelector(".wayfx-header__subnav"), 764 document.querySelector(".rtnu-nav-desktop"), 765 document.querySelector(".rtnu-nav-mobile"), 766 ]; 767 768 navTransitionSources.forEach(function (element) { 769 if (!element) { 770 return; 771 } 772 element.addEventListener("transitionend", updateReadingProgressTop); 773 }); 774 775 // Hide Subscribe callout on close 776 let blogSubscribeCallout = $(".wayfx-subscribe-callout"), 777 closeCalloutBtn = $(".wayfx-close-callout"), 778 subscribeCalloutSessionData = sessionStorage.getItem( 779 "hide-subscribe-callout" 780 ); 781 782 closeCalloutBtn.on("click", function () { 783 blogSubscribeCallout.removeClass("wayfx-subscribe-callout--active"); 784 sessionStorage.setItem("hide-subscribe-callout", "1"); 785 }); 786 787 if (subscribeCalloutSessionData == 1) { 788 blogSubscribeCallout.removeClass("wayfx-subscribe-callout--active"); 789 } 790 791 //reset all session storage on page refresh or when exiting current page 792 $(window).on("beforeunload", function () { 793 sessionStorage.removeItem("hide-subscribe-callout"); 794 }); 795 } 796}; 797 798// wayfx.customSelect = function () { 799// $(".wayfx-contact-form select").each(function () { 800// var $parent = $(this).parent(); 801// $(this).select2({ 802// width: "style", 803// dropdownParent: $parent, 804// minimumResultsForSearch: -1, 805// }); 806// }); 807// }; 808 809wayfx.slickSliders = function () { 810 // if ($(".wayfx-story_video-slider").length) { 811 // $(".wayfx-story_video-slider").slick({ 812 // dots: true, 813 // infinite: false, 814 // speed: 300, 815 // arrows: true, 816 // slidesToShow: 1, 817 // slidesToScroll: 1, 818 // adaptiveHeight: false,
819 // prevArrow: $(".wayfx-slider-previous-arrow"), 820 // nextArrow: $(".wayfx-slider-next-arrow"), 821 // }); 822 // } 823 824 $("[data-fancybox]").fancybox({ 825 afterShow: function () { 826 var vid = document.getElementById("hsvideo"); 827 828 if (vid) { 829 vid.play(); 830 } 831 }, 832 }); 833}; 834 835wayfx.animations = function () { 836 if (wayfx.cache.$body.hasClass("page-template-story") || wayfx.cache.$body.hasClass("page-template-careers")) { 837 gsap.registerPlugin(ScrollTrigger); 838 839 gsap.set(".wayfx-story__hero h1", { autoAlpha: 0, yPercent: 30 }); 840 841 gsap.to(".wayfx-story__hero h1", { 842 autoAlpha: 1, 843 yPercent: 0, 844 duration: 0.8, 845 delay: 0.4, 846 ease: "power3.out", 847 }); 848 849 // Story Ancestors 850 gsap.set(".wayfx-story__ancestors .left-image", { 851 autoAlpha: 0, 852 xPercent: -20, 853 }); 854 gsap.set(".wayfx-story__ancestors .right-image", { 855 autoAlpha: 0, 856 xPercent: 20, 857 }); 858 var ancestorTl = gsap.timeline(); 859 860 ancestorTl 861 .add("start") 862 .to( 863 ".wayfx-story__ancestors .left-image", 864 { 865 autoAlpha: 1, 866 xPercent: 0, 867 duration: 0.8, 868 ease: "power3.out", 869 }, 870 "start" 871 ) 872 .to( 873 ".wayfx-story__ancestors .right-image", 874 { 875 autoAlpha: 1, 876 xPercent: 0, 877 duration: 0.8, 878 ease: "power3.out", 879 }, 880 "start" 881 ); 882 883 ScrollTrigger.create({ 884 trigger: ".wayfx-story__ancestors", 885 animation: ancestorTl, 886 start: "top 40%", 887 }); 888 889 // Story Founder 890 gsap.set(".wayfx-story__founder-image", { autoAlpha: 0, yPercent: 10 }); 891 gsap.set(".wayfx-story__founder-content", { autoAlpha: 0, yPercent: 10 }); 892 var ancestorTl = gsap.timeline(); 893 894 ancestorTl 895 .add("start") 896 .to( 897 ".wayfx-story__founder-image", 898 { 899 autoAlpha: 1, 900 yPercent: 0, 901 duration: 0.8, 902 ease: "power3.out", 903 }, 904 "start" 905 ) 906 .to( 907 ".wayfx-story__founder-content", 908 { 909 autoAlpha: 1, 910 yPercent: 0, 911 duration: 0.8, 912 delay: 0.4, 913 ease: "power3.out", 914 }, 915 "start" 916 ); 917 918 ScrollTrigger.create({ 919 trigger: ".wayfx-story__founder", 920 animation: ancestorTl, 921 start: "top 40%", 922 }); 923 924 // Story Carnivore Code 925 var codeTl = gsap.timeline(); 926 927 codeTl 928 .add("start") 929 .to( 930 ".wayfx-carnivore-code__image-wrapper .top-image", 931 { 932 autoAlpha: 1, 933 rotation: 5, 934 duration: 0.2, 935 ease: "power3.out", 936 }, 937 "start" 938 ) 939 .to( 940 ".wayfx-carnivore-code__image-wrapper .bottom-image", 941 { 942 autoAlpha: 0.26, 943 rotation: -8, 944 duration: 0.2, 945 ease: "power3.out", 946 }, 947 "start" 948 ); 949 950 ScrollTrigger.create({ 951 trigger: ".wayfx-carnivore-code", 952 animation: codeTl, 953 start: "top 60%", 954 scrub: 0.5, 955 }); 956 957 // Health Goals 958 gsap.set(".wayfx-health-goals .wayfx-grid__item", { 959 autoAlpha: 0, 960 yPercent: 30, 961 }); 962 ScrollTrigger.batch(".wayfx-health-goals", { 963 onEnter: (batch) => { 964 batch.forEach((item, i) => { 965 gsap.to( 966 item.querySelectorAll(".wayfx-health-goals .wayfx-grid__item"), 967 { 968 autoAlpha: 1, 969 yPercent: 0, 970 duration: 0.8, 971 ease: "power3.out", 972 stagger: 0.2, 973 delay: i * 0.3, 974 } 975 ); 976 }); 977 }, 978 start: "top 40%", 979 }); 980 } 981 982 // Home Hero animation 983 // gsap.set(".wayfx-hero__heading", { autoAlpha: 0, yPercent: 30 }); 984 // gsap.set(".wayfx-hero__desc", { yPercent: 30 }); 985 // gsap.set(".video-play", { autoAlpha: 0, scaleX: 1.1, scaleY: 1.1 }); 986 987 // var heroTl = gsap.timeline(); 988 989 // heroTl 990 // .to(".wayfx-hero__heading", { 991 // autoAlpha: 1, 992 // yPercent: 0, 993 // duration: 0.8, 994 // delay: 0.6, 995 // ease: "power3.out", 996 // }) 997 // .to( 998 // ".wayfx-hero__desc", 999 // { 1000 // autoAlpha: 1, 1001 // yPercent: 0, 1002 // duration: 0.4, 1003 // delay: 0, 1004 // ease: "power3.out", 1005 // }, 1006 // "-=0.6" 1007 // ) 1008 // .to( 1009 // ".wayfx-hero__btn", 1010 // { 1011 // autoAlpha: 1, 1012 // duration: 0.1, 1013 // delay: 0, 1014 // ease: "none", 1015 // }, 1016 // "-=0.4" 1017 // ) 1018 // .to(".video-play", { 1019 // autoAlpha: 1, 1020 // scaleX: 1, 1021 // scaleY: 1, 1022 // duration: 0.8, 1023 // delay: 0.4, 1024 // ease: "power3.out", 1025 // }); 1026 1027 // // Home Benefits section 1028 // gsap.set(".wayfx-benefit__item", { autoAlpha: 0, yPercent: 30 }); 1029 // ScrollTrigger.batch(".wayfx-benefits", { 1030 // onEnter: (batch) => {
1031 // batch.forEach((item, i) => { 1032 // gsap.to(item.querySelectorAll(".wayfx-benefit__item"), { 1033 // autoAlpha: 1, 1034 // yPercent: 0, 1035 // duration: 0.8, 1036 // ease: "power3.out", 1037 // stagger: 0.2, 1038 // delay: i * 0.3, 1039 // }); 1040 // }); 1041 // }, 1042 // start: "top 90%", 1043 // }); 1044 1045 // // Home block 1 1046 // gsap.set(".wayfx-home-block-1__image", { autoAlpha: 1 }); 1047 // gsap.set(".wayfx-home-block-1__content", { autoAlpha: 1, yPercent: 10 }); 1048 1049 // var block1Tl = gsap.timeline(); 1050 1051 // block1Tl 1052 // .add("start") 1053 // .to( 1054 // ".wayfx-home-block-1__image", 1055 // { 1056 // autoAlpha: 1, 1057 // duration: 0.6, 1058 // ease: "power3.out", 1059 // }, 1060 // "start" 1061 // ) 1062 // .to( 1063 // ".wayfx-home-block-1__content", 1064 // { 1065 // autoAlpha: 1, 1066 // yPercent: 0, 1067 // duration: 0.8, 1068 // ease: "power3.out", 1069 // }, 1070 // "start" 1071 // ); 1072 1073 // ScrollTrigger.create({ 1074 // trigger: ".wayfx-home-block-1", 1075 // animation: block1Tl, 1076 // start: "top 75%", 1077 // }); 1078 1079 // // Home block 2 1080 // gsap.set(".wayfx-home-block-2__left-content", { autoAlpha: 0, yPercent: 20 }); 1081 // gsap.set(".wayfx-home-block-2__right-content", { 1082 // autoAlpha: 0, 1083 // yPercent: 20, 1084 // }); 1085 1086 // var block2Tl = gsap.timeline(); 1087 1088 // block2Tl 1089 // .add("start") 1090 // .to( 1091 // ".wayfx-home-block-2__left-content", 1092 // { 1093 // autoAlpha: 1, 1094 // yPercent: 0, 1095 // duration: 0.8, 1096 // ease: "power3.out", 1097 // }, 1098 // "start" 1099 // ) 1100 // .to( 1101 // ".wayfx-home-block-2__right-content", 1102 // { 1103 // autoAlpha: 1, 1104 // yPercent: 0, 1105 // duration: 0.8, 1106 // ease: "power3.out", 1107 // }, 1108 // "start" 1109 // ); 1110 1111 // ScrollTrigger.create({ 1112 // trigger: ".wayfx-home-block-2", 1113 // animation: block2Tl, 1114 // start: "top 75%", 1115 // }); 1116 1117 // // Home Story 1118 // gsap.set(".wayfx-home-block-3__image", { autoAlpha: 0, yPercent: 10 }); 1119 // gsap.set(".wayfx-home-block-3__content", { autoAlpha: 0, yPercent: 10 }); 1120 1121 // var block3Tl = gsap.timeline(); 1122 1123 // block3Tl 1124 // .add("start") 1125 // .to( 1126 // ".wayfx-home-block-3__image", 1127 // { 1128 // autoAlpha: 1, 1129 // yPercent: 0, 1130 // duration: 0.8, 1131 // ease: "power3.out", 1132 // }, 1133 // "start" 1134 // ) 1135 // .to( 1136 // ".wayfx-home-block-3__content", 1137 // { 1138 // autoAlpha: 1, 1139 // yPercent: 0, 1140 // duration: 0.8, 1141 // ease: "power3.out", 1142 // }, 1143 // "start" 1144 // ); 1145 1146 // ScrollTrigger.create({ 1147 // trigger: ".wayfx-story", 1148 // animation: block3Tl, 1149 // start: "top 75%", 1150 // }); 1151 1152 // Home BYB 1153 // gsap.set(".wayfx-byb__item", { autoAlpha: 0, yPercent: 30 }); 1154 // ScrollTrigger.batch(".wayfx-byb", { 1155 // onEnter: (batch) => { 1156 // batch.forEach((item, i) => { 1157 // gsap.to(item.querySelectorAll(".wayfx-byb__item"), { 1158 // autoAlpha: 1, 1159 // yPercent: 0, 1160 // duration: 0.8, 1161 // ease: "power3.out", 1162 // stagger: 0.2, 1163 // delay: i * 0.3, 1164 // }); 1165 // }); 1166 // }, 1167 // start: "top 40%", 1168 // }); 1169 1170 // Story Hero animation 1171}; 1172 1173$(wayfx.init); 1174 1175// V3 1176 1177window.addEventListener("DOMContentLoaded", function () { 1178 const rtnuHeader = document.querySelector(".rtnu-header"), 1179 rtnuHeaderMobile = document.querySelector(".rtnu-header__mobile"), 1180 rtnuHasDropdown = document.querySelectorAll(".rtnu-header__has-dropdown"), 1181 rtnuMobileToggle = document.querySelector(".rtnu-header__toggle"), 1182 rtnuMobileMenu = document.querySelector(".rtnu-header__mobile-nav"), 1183 rtnuMobileMenuHasSubmenu = document.querySelectorAll( 1184 ".rtnu-header__mobile-nav--has-nav" 1185 ), 1186 rtnuMobileMenuExpanded = rtnuMobileMenu?.querySelector( 1187 ".rtnu-header__mobile-nav-expanded" 1188 ), 1189 rtnuMobileMenuExpandedItem = rtnuMobileMenu?.querySelectorAll( 1190 ".rtnu-header__mobile-nav-links" 1191 ), 1192 rtnuMobileMenuItemBack = rtnuMobileMenu?.querySelectorAll( 1193 ".rtnu-header__mobile-nav-back" 1194 ), 1195 rtnuTopBar = document.querySelector(".rtnu-topbar"), 1196 rtnuHeaderSubNav = document.querySelector(".wayfx-header__subnav"); 1197 1198 if (!rtnuHeader || !rtnuHeaderMobile) { 1199 return; 1200 } 1201 1202 if (document.body.classList.contains("admin-bar")) { 1203 rtnuHeader?.style.setProperty("top", "32px"); 1204 rtnuHeaderMobile?.style.setProperty("top", "32px"); 1205 } 1206 1207 // debounce function to prevent performance issues 1208 function debounce(func, wait = 20, immediate = true) { 1209 var timeout; 1210 return function () { 1211 var context = this, 1212 args = arguments; 1213 var later = function () { 1214 timeout = null;
1215 if (!immediate) func.apply(context, args); 1216 }; 1217 var callNow = immediate && !timeout; 1218 clearTimeout(timeout); 1219 timeout = setTimeout(later, wait); 1220 if (callNow) func.apply(context, args); 1221 }; 1222 } 1223 1224 // add active class to rtnuHeader when user is hovering over rtnuHasDropdown and children 1225 rtnuHasDropdown.forEach(function (item) { 1226 item.addEventListener("mouseenter", function () { 1227 rtnuHeader?.classList.add("active"); 1228 }); 1229 item.addEventListener("mouseleave", function () { 1230 rtnuHeader?.classList.remove("active"); 1231 }); 1232 }); 1233 1234 function setTopBar() { 1235 if (rtnuTopBar) { 1236 let topBarHeight = rtnuTopBar.offsetHeight; 1237 rtnuHeader?.style.setProperty("top", topBarHeight + "px"); 1238 rtnuHeaderMobile?.style.setProperty("top", topBarHeight + "px"); 1239 rtnuHeaderMobile?.style.setProperty( 1240 "--header-mobile-height", 1241 topBarHeight + rtnuHeaderMobile.offsetHeight + "px" 1242 ); 1243 } 1244 } 1245 1246 setTopBar(); 1247 1248 // add active class to rtnuHeader on scroll and remove on top. Add debounce function to prevent performance issues 1249 window.addEventListener( 1250 "scroll", 1251 debounce(function () { 1252 if (rtnuTopBar) { 1253 if (window.scrollY > rtnuTopBar.offsetHeight) { 1254 rtnuHeader?.classList.add("active-scroll"); 1255 rtnuHeaderMobile?.classList.add("active-scroll"); 1256 } else { 1257 rtnuHeader?.classList.remove("active-scroll"); 1258 rtnuHeaderMobile?.classList.remove("active-scroll"); 1259 } 1260 1261 // reduce the top value of rtnuHeader and rtnuHeaderMobile equal to the distance scrolled until value is 0 1262 let topValue = rtnuTopBar.offsetHeight - window.scrollY; 1263 let topValueMobile = 1264 rtnuHeaderMobile.offsetHeight + 1265 rtnuTopBar.offsetHeight - 1266 window.scrollY; 1267 1268 if (topValue > 0) { 1269 rtnuHeader?.style.setProperty("top", topValue + "px"); 1270 if (rtnuHeaderSubNav) { 1271 rtnuHeaderSubNav.style.setProperty("top", topValue + "px"); 1272 } 1273 } else { 1274 rtnuHeader?.style.setProperty("top", "0px"); 1275 if (rtnuHeaderSubNav) { 1276 rtnuHeaderSubNav.style.setProperty( 1277 "top", 1278 rtnuHeader.offsetHeight + "px" 1279 ); 1280 } 1281 } 1282 1283 if (topValueMobile > 0 && topValue > 0) { 1284 rtnuHeaderMobile?.style.setProperty("top", topValue + "px"); 1285 rtnuHeaderMobile?.style.setProperty( 1286 "--mobile-header-height", 1287 topValueMobile + "px" 1288 ); 1289 } else { 1290 rtnuHeaderMobile?.style.setProperty("top", "0px"); 1291 rtnuHeaderMobile?.style.setProperty( 1292 "--mobile-header-height", 1293 rtnuHeaderMobile.offsetHeight + "px" 1294 ); 1295 } 1296 } else { 1297 if (window.scrollY > 0) { 1298 rtnuHeader?.classList.add("active-scroll"); 1299 rtnuHeaderMobile?.classList.add("active-scroll"); 1300 } else { 1301 rtnuHeader?.classList.remove("active-scroll"); 1302 rtnuHeaderMobile?.classList.remove("active-scroll"); 1303 } 1304 } 1305 }, 5) 1306 ); 1307 1308 // Scroll-end safety net - ensures header resets correctly when scrolling stops 1309 let scrollEndTimeout; 1310 window.addEventListener("scroll", function() { 1311 clearTimeout(scrollEndTimeout); 1312 scrollEndTimeout = setTimeout(function() { 1313 if (rtnuTopBar) { 1314 let topValue = rtnuTopBar.offsetHeight - window.scrollY; 1315 if (topValue >= rtnuTopBar.offsetHeight) { 1316 // At top - reset to original position 1317 rtnuHeader?.style.setProperty("top", rtnuTopBar.offsetHeight + "px"); 1318 rtnuHeaderMobile?.style.setProperty("top", rtnuTopBar.offsetHeight + "px"); 1319 } 1320 } 1321 }, 50); 1322 }); 1323 1324 rtnuMobileToggle?.addEventListener("click", function () { 1325 rtnuMobileToggle.classList.toggle("active"); 1326 rtnuHeaderMobile.classList.toggle("active"); 1327 document.body.classList.toggle("mobile-menu-active"); 1328 rtnuMobileMenu.classList.toggle("active"); 1329 1330 if (rtnuMobileToggle.classList.contains("active")) { 1331 rtnuMobileToggle.setAttribute("aria-label", "Close mobile menu"); 1332 } else { 1333 rtnuMobileToggle.setAttribute("aria-label", "Open mobile menu"); 1334 } 1335 }); 1336 1337 rtnuMobileMenuHasSubmenu.forEach(function (menu) { 1338 let menuId = menu.getAttribute("data-menu-id"); 1339 1340 menu.addEventListener("click", function () { 1341 rtnuMobileMenu.querySelector( 1342 ".rtnu-header__mobile-nav-container > div" 1343 ).style.opacity = 0; 1344 rtnuMobileMenu.querySelector( 1345 ".rtnu-header__mobile-nav-container > ul" 1346 ).style.opacity = 0; 1347 rtnuMobileMenuExpanded.classList.add("active"); 1348 1349 rtnuMobileMenuExpandedItem.forEach(function (item) { 1350 item.style.display = "none"; 1351 1352 if (item.getAttribute("data-nav-id") === menuId) { 1353 item.style.display = "block"; 1354 } 1355 }); 1356 1357 rtnuMobileMenuItemBack.forEach((itemBack) => { 1358 itemBack.addEventListener("click", function (e) { 1359 e.preventDefault(); 1360 1361 rtnuMobileMenu.querySelector( 1362 ".rtnu-header__mobile-nav-container > div" 1363 ).style.opacity = 1; 1364 rtnuMobileMenu.querySelector( 1365 ".rtnu-header__mobile-nav-container > ul" 1366 ).style.opacity = 1; 1367 rtnuMobileMenuExpanded.classList.remove("active"); 1368 }); 1369 }); 1370 }); 1371 }); 1372 1373 // add css custom property to body to set the height of the header if the header contains class rtnu-header--blog 1374 function setHeaderHeight() {
1375 let headerHeight = rtnuHeader?.offsetHeight; 1376 1377 if (rtnuTopBar) { 1378 if (rtnuHeader?.classList.contains("rtnu-header--blog")) { 1379 rtnuTopBar.style.setProperty("position", "absolute"); 1380 document.body.style.setProperty( 1381 "--header-height", 1382 headerHeight + rtnuTopBar.offsetHeight + "px" 1383 ); 1384 } 1385 } else { 1386 if (rtnuHeader?.classList.contains("rtnu-header--blog")) { 1387 document.body.style.setProperty("--header-height", headerHeight + "px"); 1388 } 1389 } 1390 } 1391 setHeaderHeight(); 1392 1393 window.addEventListener("resize", function () { 1394 setHeaderHeight(); 1395 }); 1396 1397 // add css custom property to body to set the height of the header when viewport is less than 1024px 1398 function setHeaderMobileHeight() { 1399 let headerMobileHeight = rtnuHeaderMobile?.offsetHeight; 1400 1401 if (rtnuTopBar) { 1402 rtnuHeaderMobile?.style.setProperty( 1403 "--mobile-header-height", 1404 headerMobileHeight + rtnuTopBar.offsetHeight + "px" 1405 ); 1406 } else { 1407 rtnuHeaderMobile?.style.setProperty( 1408 "--mobile-header-height", 1409 headerMobileHeight + "px" 1410 ); 1411 } 1412 1413 if (rtnuTopBar) { 1414 if (rtnuHeaderMobile?.classList.contains("rtnu-header__mobile--blog")) { 1415 document.body.style.setProperty( 1416 "--header-mobile-height", 1417 headerMobileHeight + rtnuTopBar.offsetHeight + "px" 1418 ); 1419 } 1420 } else { 1421 document.body.style.setProperty( 1422 "--header-mobile-height", 1423 headerMobileHeight + "px" 1424 ); 1425 } 1426 } 1427 setHeaderMobileHeight(); 1428 1429 window.addEventListener("resize", function () { 1430 setHeaderMobileHeight(); 1431 }); 1432 1433 document.querySelectorAll('a[href*="#"]:not([href="#"]):not([href="#0"]):not(.rtnu-btn-2--outline):not(.rtnu-footer__accessibility-trigger)').forEach(function(anchor) { 1434 anchor.addEventListener('click', function (e) { 1435 e.preventDefault(); 1436 1437 // On-page links 1438 if (location.pathname.replace(/^\//, '') === this.pathname.replace(/^\//, '') && location.hostname === this.hostname) { 1439 // Figure out element to scroll to 1440 let target = document.querySelector(this.hash); 1441 target = target ? target : document.querySelector("[name=" + this.hash.slice(1) + "]"); 1442 1443 // Does a scroll target exist? 1444 if (target) { 1445 // Only prevent default if animation is actually gonna happen 1446 let targetPosition = target.getBoundingClientRect().top + window.scrollY - 100; 1447 1448 window.scrollTo({ 1449 top: targetPosition, 1450 behavior: "smooth" 1451 }); 1452 1453 // Callback after animation 1454 // Must change focus! - Updated to prevent double scroll on mobile 1455 setTimeout(function() { 1456 // Use preventScroll to avoid browser scrolling the element into view again 1457 target.focus({ preventScroll: true }); 1458 if (document.activeElement !== target) { 1459 target.setAttribute("tabindex", "-1"); // Adding tabindex for elements not focusable 1460 target.focus({ preventScroll: true }); // Set focus again without scrolling 1461 } 1462 }, 800); // Adjust the delay to match the scroll duration 1463 } 1464 } 1465 }); 1466 }); 1467});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.