HEX
Server: nginx/1.18.0
System: Linux mail.dakarash.co.id 5.15.0-164-generic #174-Ubuntu SMP Fri Nov 14 20:25:16 UTC 2025 x86_64
User: www-data (33)
PHP: 8.1.2-1ubuntu2.23
Disabled: NONE
Upload Files
File: /home/dakarash.co.id/public_html/wp-content/plugins/visual-portfolio/assets/js/lazyload.js
// Recalculate image size if parent is <picture>
document.addEventListener('lazybeforesizes', (e) => {
	// for some reason sometimes e.detail is undefined, so we need to check it.
	if (!e.detail || !e.detail.width || !e.target) {
		return;
	}

	const parent = e.target.closest(':not(picture)');

	if (parent) {
		e.detail.width = parent.clientWidth || e.detail.width;
	}
});

/**
 * Remove <noscript> tag.
 * Some of optimization plugin make something, that killed our styles with noscript tag.
 * Related topic: https://wordpress.org/support/topic/visual-portfolio-and-sg-optimizer-dont-play-well/
 */
document.addEventListener('lazybeforeunveil', (e) => {
	const prevEl = e.target.previousElementSibling;

	if (prevEl && prevEl.matches('noscript')) {
		prevEl.remove();
	}
});