| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 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/themes/blocksy/static/js/frontend/ |
Upload File : |
import { loadStyle } from '../helpers'
import { isTouchDevice } from './helpers/is-touch-device'
const mountPopper = (reference) => {
if (!reference.nextElementSibling) {
return
}
if (reference.nextElementSibling.popperMounted) {
return
}
reference.nextElementSibling.popperMounted = true
// Prevent focus on click for non-touch devices when element is tabbable
// but not clickable.
if (!isTouchDevice() && reference.tabIndex === 0) {
reference.addEventListener('mousedown', (e) => {
e.preventDefault()
})
}
const target = reference.nextElementSibling
const referenceRect = reference.getBoundingClientRect()
const targetRect = target.getBoundingClientRect()
let initialPlacement =
referenceRect.left > innerWidth / 2 ? 'left' : 'right'
let placement = initialPlacement
const offset = parseFloat(
getComputedStyle(target).getPropertyValue(
'--theme-submenu-inline-offset'
) || -20
)
if (targetRect.width > innerWidth - referenceRect.left + offset) {
placement = 'left'
}
if (referenceRect.right - offset - targetRect.width < 0) {
placement = 'right'
}
if (
referenceRect.left + targetRect.width > innerWidth &&
referenceRect.right - targetRect.width < 0
) {
placement = initialPlacement
let offset = 0
let edgeOffset = 20
if (placement === 'left') {
offset = innerWidth - referenceRect.right - edgeOffset
}
if (placement === 'right') {
offset = referenceRect.left - edgeOffset
}
offset = Math.round(offset)
target.style.setProperty(
'--theme-submenu-inline-offset',
`${offset * -1}px`
)
}
target.dataset.placement = placement
const observer = new MutationObserver((mutations) => {
const maybeMutation = mutations.find(
(mutation) =>
mutation.type === 'childList' &&
[...mutation.removedNodes].find((el) => el === target)
)
if (!maybeMutation) {
return
}
observer.disconnect()
mountPopper(reference)
})
observer.observe(target.parentNode, { childList: true })
}
export const mount = (reference) => {
Promise.all(
ct_localizations.dynamic_styles_selectors
.filter(
(styleDescriptor) =>
!!reference.closest(styleDescriptor.selector)
)
.map(({ url }) => loadStyle(url))
).then(() => mountPopper(reference))
}