// JavaScript Document
(function (window, document, $) {
  $(function () {

    // モーダル
    $('#floorplan').modaal({
      type: 'inline',
      overlay_close  : true,
      background : '#000000',
      overlay_opacity: 0.8,
      content_source: '#mdl_floorplan',
    });


    // ボタンの要素を取得
    const $shareButton = $('#webShareButton');
    // ページのdescriptionを取得
    const description = $("meta[name='description']").attr("content") || '';

    // クリックイベントを設定
    $shareButton.on('click', async function () {
      try {
        await navigator.share({
          title: document.title,
          text: description,
          url: window.location.href
        });
        console.log('シェア成功！');
      } catch (error) {
        console.error('シェア失敗', error);
      }
    });

  });
})(window, document, jQuery);