HEX
Server: LiteSpeed
System: Linux server.nevid-deploma.com 4.18.0-553.111.1.lve.el8.x86_64 #1 SMP Fri Mar 13 13:42:17 UTC 2026 x86_64
User: smilepac (1037)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/smilepac/public_html/wp-content/plugins/codevz-plus/assets/js/share.js
document.addEventListener('DOMContentLoaded', () => {
	const body = document.body;

	body.addEventListener('click', (e) => {
		const shareLink = e.target.closest('.xtra-share a');
		const printBtn = e.target.closest('.cz-print');

		if (shareLink) {
			e.preventDefault();
			const href = shareLink.getAttribute('href');

			if (shareLink.querySelector('.fa-copy')) {
				navigator.clipboard.writeText(href).then(() => {
					const originalTitle = shareLink.getAttribute('data-title');
					const copiedTitle = shareLink.getAttribute('data-copied');

					shareLink.style.animation = 'xtraCopyAbsorber .8s forwards';
					shareLink.setAttribute('data-title', copiedTitle);

					setTimeout(() => {
						shareLink.style.animation = '';
						shareLink.setAttribute('data-title', originalTitle);
					}, 2000);
				});
			} else if (href && href.startsWith('http')) {
				window.open(href, "null", "height=300, width=600, top=200, left=200");
			}
		}

		if (printBtn) {
			let printDiv = document.getElementById('xtraPrint');
			if (!printDiv) {
				printDiv = document.createElement('div');
				printDiv.id = 'xtraPrint';
				body.appendChild(printDiv);
			}

			const selectors = '.xtra-post-title, .page_title .codevz-section-title, .cz_single_fi, .cz_post_content, .xtra-single-product';
			document.querySelectorAll(selectors).forEach(el => {
				const clone = el.cloneNode(true);
				
				if (clone.classList.contains('cz_single_fi')) {
					const br = document.createElement('br');
					printDiv.appendChild(clone);
					printDiv.appendChild(br);
				} else if (clone.classList.contains('xtra-post-title')) {
					clone.style.fontSize = '28px';
					printDiv.appendChild(clone);
				} else {
					printDiv.appendChild(clone);
				}
			});

			body.classList.add('xtra-printing');

			setTimeout(() => {
				window.print();
			}, 250);

			setTimeout(() => {
				body.classList.remove('xtra-printing');
				printDiv.innerHTML = '';
			}, 1000);
		}
	});
});