Created
November 8, 2023 11:16
-
-
Save dantetesta/710d0685e863b3e8412123436f2699d7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
jQuery(document).ready(function() { | |
// Função para definir o link do WhatsApp | |
function setWhatsAppLinks() { | |
jQuery('.jet-listing-grid__item').each(function() { | |
var zapLugar = jQuery(this).find('.zap_lugar .jet-listing-dynamic-field__content').text().trim(); | |
var siteURL = window.location.href; | |
var message = `Olá, vi uma publicação no site ${siteURL}, gostaria de mais informações.`; | |
var whatsappURL = `https://wa.me/55${zapLugar}?text=${encodeURIComponent(message)}`; | |
jQuery(this).find('.btn_zap a').attr('href', whatsappURL); | |
}); | |
} | |
// Executar quando a página carrega | |
setWhatsAppLinks(); | |
// Executar também após cada ação AJAX ser concluída | |
jQuery(document).ajaxComplete(function() { | |
setWhatsAppLinks(); | |
}); | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment