jQuery(function($){    
    $('html').click(function() {
        $('.chama-share-dropdown-menu').removeClass("active");
      });
      
      $(".chama-share-button").click(function(e) {
        e.stopPropagation();
        $('.chama-share-dropdown-menu').toggleClass("active");
      });
      
      $('.chama-share-dropdown-menu').click(function(e) {
        e.stopPropagation();
      });

      $(".chama-share-dropdown-wrapper .chama-copy-link").on("click", function (e) {
        e.preventDefault();
        navigator.clipboard.writeText(window.location.href);
        this.insertAdjacentHTML('afterend', '<div class="chama-copy-tooltip chama-global-copy-tooltip" style="margin-bottom: 10px">Link copied</div>'); setTimeout(() => { document.querySelectorAll('.chama-copy-tooltip').forEach(el => el.remove()); }, 3000);
      });
});