芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/www/wp-content/plugins/blocksy-companion/static/bundle/sticky.js
!function(){"use strict";var t={n:function(e){var r=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(r,{a:r}),r},d:function(e,r){for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},o:function(t,e){return Object.prototype.hasOwnProperty.call(t,e)}},e=window.ctEvents,r=t.n(e),i=window.ctFrontend;function n(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r
[data-id="logo"]')){var o=getComputedStyle(t.querySelector('[data-items] > [data-id="logo"]')),a=parseFloat(o.height);if(a+=parseFloat(o.marginTop)+parseFloat(o.marginBottom),t.querySelector(".site-logo-container")){var c=getComputedStyle(t.querySelector(".site-logo-container")),s=parseFloat(c.getPropertyValue("--logo-shrink-height")||0);s>0&&(a=a-s+parseFloat(c.getPropertyValue("--logo-max-height")||50))}a>n&&(n=a)}var l=['[data-items] > [data-id*="widget-area"]','[data-items] > [data-id*="content-block"]','[data-items] > [data-id*="text"]'].reduce((function(e,r){if(t.querySelector(r)){var i=getComputedStyle(t.querySelector(r)),n=parseFloat(i.height);if(n>e)return n}return e}),0);return l>n&&(n=l),n+i},l=function(t){if(t.blcInitialHeight)return t.blcInitialHeight;var e=t.firstElementChild;t.firstElementChild.firstElementChild&&(e=t.firstElementChild.firstElementChild);var r=e.getBoundingClientRect().height;return t.blcInitialHeight=r,r},d=function(t){var e=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(t.blcStickyHeight)return t.blcStickyHeight;var r=l(t),i=getComputedStyle(t),n=getComputedStyle(t.firstElementChild);if(t.closest('[data-sticky*="yes"]')){var o=parseFloat(i.borderTopWidth)+parseFloat(i.borderBottomWidth)+parseFloat(n.borderTopWidth)+parseFloat(n.borderBottomWidth);e||(o=0);var a=t.getBoundingClientRect().height-o;if(Math.round(a)!==Math.round(r)||Math.round(r)>Math.round(s(t)))return t.blcStickyHeight=t.getBoundingClientRect().height,a}var c=100;t.dataset.row.includes("middle")&&(c=i.getPropertyValue("--sticky-shrink"));return c&&(r*=parseFloat(c)/100),r},u=function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:function(){return 0},e=document.querySelector(".ct-floating-bar");e&&e.style.setProperty("--header-sticky-height-animated",t())},y=null,f=function(t){var e=t.stickyContainer,r=t.startPosition;o(e.querySelectorAll('[data-row*="middle"]')).map((function(t){if(t.querySelector('[data-id="logo"] .site-logo-container')){var e=t.querySelector('[data-id="logo"] .site-logo-container'),i=function(t){var e=t.logo,r=t.row;if(y)return y;var i=parseFloat(getComputedStyle(e).getPropertyValue("--logo-max-height")||50),n=parseFloat(getComputedStyle(e).getPropertyValue("--logo-sticky-shrink").toString().replace(",",".")||1),o=l(r),a=d(r);return y={initialHeight:i,stickyShrink:n,rowInitialHeight:o,rowStickyHeight:a}}({logo:e,row:t}),n=i.initialHeight,o=i.stickyShrink,s=i.rowInitialHeight,u=i.rowStickyHeight,f=n*o;1!==o&&e.style.setProperty("--logo-shrink-height","".concat(c([r,r+Math.abs(s===u?n-f:s-u)],[1,o],a(r,r+Math.abs(s===u?n-f:s-u),scrollY))*n,"px"))}}))},h=null,g=function(t){var e=t.stickyContainer,r=(t.containerInitialHeight,t.startPosition);e.querySelector('[data-row*="middle"]')&&[e.querySelector('[data-row*="middle"]')].map((function(t){var e=function(t){var e=t.row;if(h)return h;var r=l(e),i=d(e);return h={rowInitialHeight:r,rowStickyHeight:i}}({row:t}),i=e.rowInitialHeight,n=e.rowStickyHeight;if(i!==n){var o=n;o=c([r,r+Math.abs(i-n)],[i,n],a(r,r+Math.abs(i-n),scrollY)),t.style.setProperty("--shrink-height","".concat(Math.round(o),"px"))}}))},m=function(t){var e=t.stickyContainer,r=o(e.querySelectorAll("[data-row]")).reduce((function(t,e){return t+d(e,!1)}),0);return{stickyContainerHeight:r,stickyContainerHeightAbsolute:r+parseFloat(getComputedStyle(e).top)}},p=null,k=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"yes";Array.from(t.querySelectorAll("[data-row][data-transparent-row]")).map((function(t){t.dataset.transparentRow=e}))},v=null,w={},S=null,C=null,b=!1,x=function(){h=null,y=null,v=null,S=null,C=null,O=null,b=!1};if(r().on("blocksy:sticky:compute",(function(){setTimeout((function(){x(),P()}),100)})),window.wp&&wp.customize&&wp.customize.selectiveRefresh){var A=!1;wp.customize.selectiveRefresh.bind("partial-content-rendered",(function(t){A||(A=!0,setTimeout((function(){x(),b=!0,P(),A=!1}),500))}))}var H=function(t){-1===t.dataset.sticky.indexOf("shrink")&&t.dataset.sticky.indexOf("auto-hide");var e=t.closest("header").getBoundingClientRect().top+scrollY;if(e>0){var r=document.elementFromPoint(0,3);r&&function(t){for(var e=[];t&&t!==document;t=t.parentNode)e.push(t);return e}(r).map((function(t){return getComputedStyle(t).position})).indexOf("fixed")>-1&&(e-=r.getBoundingClientRect().height)}-1===t.dataset.sticky.indexOf("shrink")&&-1===t.dataset.sticky.indexOf("auto-hide")&&(e+=200);var i=t.parentNode,n=getComputedStyle(document.body),a=parseFloat(n.getPropertyValue("--header-sticky-offset")||0);if(a+=parseFloat(n.getPropertyValue("--theme-frame-size"))||0,1===i.parentNode.children.length||i.parentNode.children[0].classList.contains("ct-sticky-container"))return e>0?e-a:e;var c=Array.from(i.parentNode.children).reduce((function(t,e,r){return t.indexOf(0)>-1||!e.dataset.row?[].concat(o(t),[0]):[].concat(o(t),[e.classList.contains("ct-sticky-container")?0:e.getBoundingClientRect().height])}),[]).reduce((function(t,e){return t+e}),e);return c>0?c-a:c},O=null,P=function(){if(O!==scrollY){var t=document.querySelector('[data-device="'.concat((0,i.getCurrentScreen)(),'"] [data-sticky]'));if(t){var e=(0,i.getCurrentScreen)({withTablet:!0}),r=w[e],n=!r||b;r&&!b||(w[e]=o(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+s(e)}),0),r=w[e]),n&&(b=!1,t.parentNode.style.height="".concat(r,"px"));var a=v;null===a&&(a=H(t),v=a);var c=S;if(null===c)c=t.closest("[data-device]").getBoundingClientRect().height,S=c;var l=C,y=t.dataset.sticky.split(":").filter((function(t){return"yes"!==t&&"no"!==t&&"fixed"!==t}));l||(l=o(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+d(e)}),0),C=parseInt(l),u((function(){return-1===y.indexOf("auto-hide")?l>o(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+s(e)}),0)?"".concat(l,"px"):"".concat(o(t.querySelectorAll("[data-row]")).reduce((function(t,e){return t+d(e)}),0),"px"):"0px"})));var h=a>0&&Math.abs(window.scrollY-a)<5||window.scrollY>a;y.indexOf("shrink")>-1&&(h=a>0?window.scrollY>=a:window.scrollY>0),setTimeout((function(){h&&-1===document.body.dataset.header.indexOf("shrink")&&(document.body.dataset.header="".concat(document.body.dataset.header,":shrink")),!h&&document.body.dataset.header.indexOf("shrink")>-1&&(document.body.dataset.header=document.body.dataset.header.replace(":shrink",""))}),300);var x=scrollY;y.indexOf("shrink")>-1&&function(t){var e=t.containerInitialHeight,r=t.stickyContainer,i=(t.stickyContainerHeight,t.isSticky),n=t.startPosition,a=t.stickyComponents;if(0===n&&0===window.scrollY&&(r.dataset.sticky=["fixed"].concat(o(a)).join(":")),i){if(a.indexOf("yes")>-1)return;-1===r.dataset.sticky.indexOf("yes")&&(k(r,"no"),r.dataset.sticky=["yes"].concat(o(a)).join(":")),f({stickyContainer:r,startPosition:n}),g({stickyContainer:r,containerInitialHeight:e,startPosition:n})}else Array.from(r.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")})),Array.from(r.querySelectorAll('[data-row*="middle"] .site-logo-container')).map((function(t){return t.removeAttribute("style")})),k(r,"yes"),0===n&&window.scrollY<=0?r.dataset.sticky=["fixed"].concat(o(a)).join(":"):r.dataset.sticky=a.join(":")}({stickyContainer:t,stickyContainerHeight:l,containerInitialHeight:r,isSticky:h,startPosition:a,stickyComponents:y}),y.indexOf("auto-hide")>-1&&function(t){var e=t.currentScrollY,r=t.stickyContainer,i=t.containerInitialHeight,n=t.headerInitialHeight,a=t.startPosition,c=t.isSticky,s=t.stickyComponents;c&&e-t.prevScrollY==0&&u((function(){return"0px"})),c?-1===r.dataset.sticky.indexOf("yes")&&e>2*n+a&&(r.dataset.sticky=["yes"].concat(o(s)).join(":"),f({stickyContainer:r,startPosition:a}),g({stickyContainer:r,containerInitialHeight:i,startPosition:a}),k(r,"no"),document.body.removeAttribute("style")):(Array.from(r.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")})),Array.from(r.querySelectorAll('[data-row*="middle"] .site-logo-container')).map((function(t){return t.removeAttribute("style")})),r.dataset.sticky=o(s).join(":"),k(r,"yes"),u((function(){return"0px"})),p=null),null===p&&(p=1e3);var l=p+t.prevScrollY-e,d=0;if(e>2*n+a||r.dataset.sticky.indexOf("yes")>-1){if(e<=a)d=0;else if(e>t.prevScrollY){var y=m({stickyContainer:r}).stickyContainerHeightAbsolute;d=Math.abs(l)>y?-y:l}else d=l>0?0:l;r.style.transform="translateY(".concat(d,"px)"),p=d}else r.removeAttribute("style");r.dataset.sticky.indexOf("yes")>-1&&(e<=a||e>t.prevScrollY||(f({stickyContainer:r,startPosition:a}),g({stickyContainer:r,containerInitialHeight:i,startPosition:a}))),u((function(){var t=m({stickyContainer:r}).stickyContainerHeight;return"".concat(t-Math.abs(d),"px")}))}({stickyContainer:t,isSticky:h,startPosition:a,stickyComponents:y,containerInitialHeight:r,stickyContainerHeight:l,headerInitialHeight:c,currentScrollY:x,prevScrollY:O}),(y.indexOf("slide")>-1||y.indexOf("fade")>-1)&&function(t){var e=t.stickyContainer,r=t.isSticky,i=t.startPosition,n=t.stickyComponents;r?(-1===e.dataset.sticky.indexOf("yes")&&(e.dataset.sticky=["yes-start"].concat(o(n)).join(":"),setTimeout((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-start","yes-end"),setTimeout((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-end","yes")}),200)}),1)),k(e,"no")):-1===e.dataset.sticky.indexOf("yes-hide")&&e.dataset.sticky.indexOf("yes:")>-1&&(Math.abs(window.scrollY-i)>10?(e.dataset.sticky=n.join(":"),setTimeout((function(){Array.from(e.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")}))}),300),k(e,"yes")):(e.dataset.sticky=["yes-hide-start"].concat(o(n)).join(":"),requestAnimationFrame((function(){e.dataset.sticky=e.dataset.sticky.replace("yes-hide-start","yes-hide-end"),setTimeout((function(){e.dataset.sticky=n.join(":"),setTimeout((function(){Array.from(e.querySelectorAll("[data-row]")).map((function(t){return t.removeAttribute("style")}))}),300),k(e,"yes")}),200)}))))}({stickyContainer:t,isSticky:h,startPosition:a,stickyComponents:y}),O=x}}},q=function(){if(document.querySelector("header [data-sticky]")){var t=window.width;window.addEventListener("resize",(function(e){window.width!==t&&(t=window.width,x(),P(e),r().trigger("ct:header:update"))}),!1),window.addEventListener("orientationchange",(function(t){x(),P(t),r().trigger("ct:header:update")})),window.addEventListener("scroll",P,!1),window.addEventListener("load",P,!1),P()}};document.body.className.indexOf("e-preview")>-1?setTimeout((function(){q()}),500):q(),(0,i.registerDynamicChunk)("blocksy_sticky_header",{mount:function(t){}})}();