jQuery(document).ready(function ($) { 'use strict'; $('body').on('click', '.easyel-wrapper-link', function (e) { const $el = $(this); const settings = $el.data('easyel-wrapper-link'); if (!settings || !settings.url) return; const url = settings.url.trim(); if (url.startsWith('#')) { e.preventDefault(); const target = $(url); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top }, 600); } return; } if (url.startsWith('mailto:')) { window.open(url, '_self'); return; } if (url.startsWith('tel:')) { window.open(url, '_self'); return; } if (!/^https?:\/\//i.test(url)) return; e.preventDefault(); const linkId = 'easyel-wrapper-link-' + $el.data('id'); if ($('#' + linkId).length === 0) { $('', { id: linkId, href: url, target: settings.is_external ? '_blank' : '_self', rel: settings.is_external ? 'noopener noreferrer' : '', class: 'easyel-hidden-link' }).appendTo('body'); } document.getElementById(linkId).click(); }); });