| Server IP : 38.190.208.107 / Your IP : 216.73.217.13 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.2/wp-content/plugins/blocksy-companion-pro/static/js/frontend/sticky/ |
Upload File : |
import { setTransparencyFor } from '../sticky'
import {
maybeSetStickyHeightAnimated,
getRowStickyHeight,
computeLinearScale,
clamp,
} from './shrink-utils'
import { shrinkHandleLogo } from './shrink-handle-logo'
import { shrinkHandleMiddleRow } from './shrink-handle-middle-row'
const getData = ({ stickyContainer }) => {
const stickyContainerHeight = [
...stickyContainer.querySelectorAll('[data-row]'),
].reduce((res, row) => res + getRowStickyHeight(row, false), 0)
return {
stickyContainerHeight,
stickyContainerHeightAbsolute:
stickyContainerHeight +
parseFloat(getComputedStyle(stickyContainer).top),
}
}
let prevOffset = null
export const computeAutoHide = (args) => {
let {
currentScrollY,
stickyContainer,
containerInitialHeight,
headerInitialHeight,
startPosition,
isSticky,
stickyComponents,
} = args
if (isSticky && currentScrollY - args.prevScrollY === 0) {
maybeSetStickyHeightAnimated(() => {
return '0px'
})
}
if (isSticky) {
if (
stickyContainer.dataset.sticky.indexOf('yes') === -1 &&
currentScrollY > headerInitialHeight * 2 + startPosition
) {
stickyContainer.dataset.sticky = ['yes', ...stickyComponents].join(
':'
)
shrinkHandleLogo({ stickyContainer, startPosition })
shrinkHandleMiddleRow({
stickyContainer,
containerInitialHeight,
startPosition,
})
setTransparencyFor(stickyContainer, 'no')
document.body.removeAttribute('style')
}
} else {
Array.from(stickyContainer.querySelectorAll('[data-row]')).map((row) =>
row.removeAttribute('style')
)
Array.from(
stickyContainer.querySelectorAll(
'[data-row*="middle"] .site-logo-container'
)
).map((el) => el.removeAttribute('style'))
stickyContainer.dataset.sticky = [...stickyComponents].join(':')
setTransparencyFor(stickyContainer, 'yes')
maybeSetStickyHeightAnimated(() => {
return '0px'
})
prevOffset = null
}
if (prevOffset === null) {
prevOffset = 1000
}
var elTopOff = prevOffset + args.prevScrollY - currentScrollY
let offset = 0
if (
currentScrollY > headerInitialHeight * 2 + startPosition ||
stickyContainer.dataset.sticky.indexOf('yes') > -1
) {
if (currentScrollY <= startPosition) {
offset = 0
} else if (currentScrollY > args.prevScrollY) {
let { stickyContainerHeightAbsolute } = getData({ stickyContainer })
offset =
Math.abs(elTopOff) > stickyContainerHeightAbsolute
? -stickyContainerHeightAbsolute
: elTopOff
} else {
offset = elTopOff > 0 ? 0 : elTopOff
}
stickyContainer.style.transform = `translateY(${offset}px)`
prevOffset = offset
} else {
stickyContainer.removeAttribute('style')
}
if (stickyContainer.dataset.sticky.indexOf('yes') > -1) {
if (currentScrollY <= startPosition) {
} else if (currentScrollY > args.prevScrollY) {
} else {
shrinkHandleLogo({ stickyContainer, startPosition })
shrinkHandleMiddleRow({
stickyContainer,
containerInitialHeight,
startPosition,
})
}
}
maybeSetStickyHeightAnimated(() => {
const { stickyContainerHeight } = getData({ stickyContainer })
let finalOffset = clamp(
0,
stickyContainerHeight - Math.abs(offset),
stickyContainerHeight
)
if (stickyContainer.dataset.sticky.indexOf('yes') === -1) {
finalOffset = 0
}
return `${finalOffset}px`
})
}