Server IP : 192.250.235.76 / Your IP : 45.90.210.12
System : Linux s2968.sgp1.stableserver.net 4.18.0-513.18.1.lve.2.el8.x86_64 #1 SMP Sat Mar 30 15:36:11 UTC 2024 x86_64
PHP Version : 8.2.29
Disable Function : NONE
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
1902120114081995
Server IP : 198.54.116.172 / Your IP : 216.73.216.36
System : Linux server322.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
PHP Version : 7.4.33
Disable Function : mail
cURL : ON | WGET : ON | Sudo : OFF | Pkexec : OFF
Upload Files :
Command :
Current File : /home/sadasgfe/fashiondebate.pk/wp-content/plugins/extendify/src/Agent/lib//svg-blocks-scanner.js
/** Recursively builds a unique duotone to the parent map from the block tree. */
export const getDynamicDuotoneMap = (blocks) => {
const map = new Map();
const seen = new Set();
const duotonePrefix = 'var:preset|duotone|';
const duotonePrefixLength = duotonePrefix.length;
const scan = (blocks) => {
if (!blocks || !blocks.length) return;
for (const block of blocks) {
if (block.name !== 'core/image') {
scan(block.innerBlocks || []);
continue;
}
const url = block.attributes?.url || '';
if (
!url ||
!url.startsWith('data:image/svg+xml;') ||
seen.has(block.clientId)
) {
scan(block.innerBlocks || []);
continue;
}
// slice the duotone value to remove the prefix and get the slug
const duotoneValue = block.attributes?.style?.color?.duotone;
const duotone = duotoneValue?.startsWith(duotonePrefix)
? duotoneValue.slice(duotonePrefixLength)
: null;
const parents = getImageParentsByBlockIdAndUrl(
block.clientId,
url,
)?.filter(Boolean);
if (duotone && parents.length && !map.has(duotone)) {
parents.forEach((parent) => map.set(parent, duotone));
}
seen.add(block.clientId);
scan(block.innerBlocks || []);
}
};
scan(blocks);
return Object.fromEntries(map);
};
const doc =
document.querySelector('iframe[name="editor-canvas"]')?.contentDocument ||
document;
const getImageParentsByBlockIdAndUrl = (id, url) => {
if (!doc) return [];
const blockElement = doc.querySelector(`[data-block="${id}"]`);
if (blockElement && blockElement.classList) {
const duotoneClass = [];
for (const cls of blockElement.classList) {
if (cls.startsWith('wp-duotone-')) duotoneClass.push(cls);
}
if (duotoneClass.length) return duotoneClass;
}
const images = doc.querySelectorAll(`img[src="${url}"]`);
const elements = [];
for (const image of images) {
const parent = image.closest('figure[data-block]');
if (parent && parent.classList) {
for (const cls of parent.classList) {
if (cls.startsWith('wp-duotone-')) elements.push(cls);
}
}
}
return elements;
};
Name
Size
Last Modified
Owner / Group
Permissions
Options
.. -- December 18 2025 11:49:17 sadasgfe / sadasgfe 0755 __tests__ -- December 18 2025 11:49:17 sadasgfe / sadasgfe 0755 blocks.js 1.965 KB October 23 2025 20:20:58 sadasgfe / sadasgfe 0644 editor.js 0.729 KB August 27 2025 17:47:28 sadasgfe / sadasgfe 0644 page-tours.js 0.706 KB September 25 2025 20:59:30 sadasgfe / sadasgfe 0644 svg-blocks-scanner.js 2.044 KB August 27 2025 17:47:28 sadasgfe / sadasgfe 0644 svg-helpers.js 4.263 KB August 27 2025 17:47:28 sadasgfe / sadasgfe 0644 tour-helpers.js 0.45 KB August 27 2025 17:47:28 sadasgfe / sadasgfe 0644 util.js 0.382 KB December 17 2025 19:09:10 sadasgfe / sadasgfe 0644 variant-classes.js 4.716 KB December 17 2025 19:09:10 sadasgfe / sadasgfe 0644