(($) => {
  const whatsapp = $('.whatsapp-share')
  if (/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(window.navigator.userAgent)) {
    whatsapp.closest('li').show();
    whatsapp.on('click', (e) => {
      e.preventDefault();
      const article = $(this).attr('data-text');
      const weburl = $(this).attr('data-url');
      const whatsAppMessage = `${encodeURIComponent(article)}-${encodeURIComponent(weburl)}`
      const whatsappUrl = `whatsapp://send?text=${whatsAppMessage}`
      window.location.href = whatsappUrl;
    });
  }
})(jQuery)
