PageSourceSearch

https://epark.jp/v2/js/common/common.js?ver=202609291210

js epark.jp collected 2026-10-01 10:42:33 UTC 11,976 bytes, 310 lines download raw bytes

1// JavaScript Document
2const isSP = $(window).width() < 767 ? true : false;
3$(window).on('load', function() {
4  objectFitImages('.ofi_sd, .ofi_cover, .ofi_contain');
5  // #で始まるアンカーをクリックした場合に処理
6  $('a[href^="#"]').click(function() {
7    // スクロールの速度
8    var speed = 600; // ミリ秒
9    // アンカーの値取得
10    var href = $(this).attr("href");
11    // 移動先を取得
12    var target = $(href === "#" || href === "" ? 'html' : href);
13    // 移動先を数値で取得
14    var position = target.offset().top;
15    // スムーススクロール
16    $('body,html').animate({scrollTop: position}, speed, 'swing');
17    return false;
18  });
19  //ppcボタン時
20  $('a.ppc_number').each(function() {
21    $(this).attr('href', 'tel:' + $(this).data('ppc_number'));
22  });
23  //ヘッダー/グロナビ
24  //メガドロップボックスオープン/クローズ
25  var scrollpos;//スクロール位置保存用
26  var opened_mega_drop = '';
27  var fade_speed = 150;
28  var open_modal_target;
29  $('.mega_drop_check').change(function() {
30    open_modal_target = $(this).data('target');
31    open_modal(open_modal_target);
32  });
33  function open_modal(target) {
34    var overlay_position = $('header').outerHeight() + $('.global_nav').outerHeight();
35    $('.overlay').css('top', overlay_position);
36    overlay_height(overlay_position);
37    if (!opened_mega_drop) { //何も開かれていないとき
38      $('.overlay, #' + target).fadeIn(fade_speed);//メガドロップボックスを表示
39      opened_mega_drop = target;
40      $('.' + opened_mega_drop + '_tab').addClass('active');//タブをアクティブにする
41    } else { //なにか開いているとき
42      if (opened_mega_drop === target) {
43        $('.' + opened_mega_drop + '_tab').removeClass('active');//タブを非アクティブにする
44        $('.overlay, #' + target).fadeOut(fade_speed);//メガドロップボックスを非表示
45        opened_mega_drop = '';
46      } else {
47        $('.' + opened_mega_drop + '_tab').removeClass('active');//タブを非アクティブにする
48        $('#' + opened_mega_drop).css('display', 'none');
49        $('#' + target).fadeIn(fade_speed);//メガドロップボックスを表示
50        opened_mega_drop = target;
51        $('.' + opened_mega_drop + '_tab').addClass('active');//タブをアクティブにする
52      }
53    }
54    overlay_height(overlay_position);
55  }
56  $('.overlay').click(function() {
57    $('.mega_drop_check').prop('checked', false);
58    $('.' + opened_mega_drop + '_tab').removeClass('active');//タブを非アクティブにする
59    $('.overlay, #' + open_modal_target).fadeOut(fade_speed);//メガドロップボックスを非表示
60    opened_mega_drop = '';
61  });
62  $('.overlay .panel_body').click(function(event) {
63    event.stopPropagation();
64  });
65  function overlay_height(overlay_position) {
66    $('.overlay').css('height', 'auto');
67    var overlay_height = $(document).height() - overlay_position;
68    $('.overlay').css('height', overlay_height);
69  }
70  //スクロールストップする
71  function scroll_stop() {
72    var scrollpos;
73    var scroll_bar;
74    scroll_bar = window.innerWidth - $(window).width();
75    scrollpos = $(window).scrollTop();
76    $('body').addClass('fixed').css({'top': -scrollpos, 'padding-right': scroll_bar + 'px'});
77    return scrollpos;
78  }
79  //スクロール再開する
80  function scroll_start(scrollpos) {
81    $('body').removeClass('fixed').css({'top': 0, 'padding-right': 0});
82    window.scrollTo(0, scrollpos);
83  }
84  //フッター
85  set_box_height('footer_sitemap_box');
86  function set_box_height(str) {
87    var box_height = [];
88    var max_height;
89    $('.' + str).each(function() {
90      box_height.push($(this).outerHeight());
91      max_height = Math.max.apply(null, box_height);
92    });
93    $('.' + str).css('height', max_height);
94  }
95  // タブで表示内容切り替え
96  var opened_brand;//初期状態
97  $('.brand_open').each(function() {
98    if ($(this).prop('checked')) {
99      opened_brand = $(this).attr('id');
100      $('label[for="' + opened_brand + '"]').addClass('brand_opend');
101    }
102  });
103  //タブが切り替わったとき
104  $('.brand_open').change(function() {
105    $('label[for="' + opened_brand + '"]').removeClass('brand_opend');//タブを押せるようにする
106    $('#' + opened_brand).prop('checked', false);
107    opened_brand = $(this).attr('id');
108    $('label[for="' + opened_brand + '"]').addClass('brand_opend');
109  });
110  $('#epark_common_groupheader').click(function() {
111    //modal削除
112    if ($(this).hasClass('active')) {
113      $('#epark_common_groupmodal').stop(true, false).slideUp('fast',
114        function() {
115          $('#epark_common_groupheader').removeClass('active');
116        });
117    } else {
118      //modal表示
119      $('#epark_common_groupmodal').stop(true, false).slideDown('fast');
120      $('#epark_common_groupheader').addClass('active');
121      // 新ファスパsp共通ナビゲーションモーダルの高さを自動調整
122      (function(target_class) {
123        var modal_iframe = document.getElementsByClassName(target_class);
124        var modal_iframe_element = modal_iframe[0];
125        // 要素が取得できない場合、処理終了
126        if (!modal_iframe_element) {
127          return;
128        }
129        var modal_height = modal_iframe_element.style.height;
130        if (!modal_height) {
131          // 既存cssの指定値解除
132          modal_iframe_element.style.height = 0;
133          var modal_auto_height = modal_iframe_element.contentWindow.document.body.scrollHeight;
134          modal_iframe_element.style.height = modal_auto_height + 'px';
135        }
136      })('epark_common_groupmodal_iframe');
137    }
138  });
139  $('.epark_common_groupheader_close').click(function() {
140    if ($('#epark_common_groupheader').hasClass('active')) {
141      $('#epark_common_groupmodal').stop(true, false).fadeOut('fast',
142        function() {
143          $('#epark_common_groupheader').removeClass('active');
144        }
145      );
146    }
147  });
148  window.addEventListener('message', function(e) {
149    if (e.origin === "http://www.epark.jp/event/special/thanks_members/") {
150      document.getElementById('content-frame').height = e.data;
151    }
152  }, false);
153  var scrollTop;
154  var mypage_open = $('#mypage_open');     // マイメニューモーダルID
155  let inobounceScript;
156  
157  // マイメニュー展開時にバナー読込
158  mypage_open.on('click', function() {
159    // iOS端末のバウンス効果をなくすためinobounce.js使用
160    inobounceScript     = document.createElement('script');
161    inobounceScript.src = INOBOUNCE_SCRIPT_SOURCE;
162    document.body.appendChild(inobounceScript);
163  });
164  $('#sp_mymenu_overlay').click(function() { // #sp_mymenu_overlay マイメニューの親要素をクリック
165    $("#mypage_open").prop('checked', false); // メニュー開閉判断用のcheckboxを外す
166    $('body').removeClass('fixed').css({'top': 0, 'padding-right': 0});
167    window.scrollTo(0, scrollpos);
168    iNoBounce.disable(); // iNoBounce無効
169    document.body.removeChild(inobounceScript);
170  });
171  $('#sp_mymenu_overlay #sp_login_info_area').click(function(event) { // #sp_mymenu_overlay に重なっている要素にはイベントを発生させない
172    event.stopPropagation();
173  });
174  $('#sp_mymenu_overlay').find('a').on('click', function(event) {
175    event.preventDefault();
176    var linkUrl = $(this).attr('href');
177    var targetWindow = $(this).attr('target');
178    $('#mypage_open').prop('checked', false);
179    scroll_start(scrollpos);
180    action(targetWindow);
181    // ここにリンク先への遷移直前に実行する内容を記述
182    function action(targetWindow) {
183      if (targetWindow) {
184        window.open(linkUrl, '_blank');
185        return false;
186      } else {
187        location.href = linkUrl;
188      }
189    }
190  });
191  //緊急お知らせ枠の表示制御
192  $(function() {
193    setTimeout(function() {
194      var emergency_info_pc_cnt;
195      var emergency_info_sp_cnt;
196      if (navigator.userAgent.match(/(iPhone|Android)/)) {
197        for (var i = 0; i <= 5; i++) {
198          emergency_info_sp_cnt = $('.emergency_info_sp').find('p').length;
199        }
200        if (emergency_info_sp_cnt) {
201          $('.emergency_info_sp').css('display', 'block');
202          $('.hidden_txt').css('display', 'none');
203        }
204      } else {
205        for (var i = 0; i <= 5; i++) {
206          emergency_info_pc_cnt = $('.emergency_info_pc').find('p').length;
207        }
208        if (emergency_info_pc_cnt) {
209          $('.emergency_info_pc').css('display', 'block');
210          $('.hidden_txt').css('display', 'none');
211        }
212      }
213    }, 1000);
214  });
215  //totopボタン
216  $(window).scroll(function() {
217    if ($(this).scrollTop() > 500) {
218      $('.totop_btn').fadeIn();
219    } else {
220      $('.totop_btn').fadeOut();
221    }
222  });
223  if ($('.footer_ad').find('a').length > 0) {
224    $('.footer_ad').css('display', 'block');
225  }
226  //SP レギュレーションフッター 高さ揃え
227  var set_ecfe = [];
228  var set_ecfe_height = [];
229  var set_ecfe_cnt = 0;
230  $('.epark_common_footer_eparklink li:not(.full) a').each(function() {
231    set_ecfe_cnt++;
232    set_ecfe.push($(this));
233    set_ecfe_height.push($(this).outerHeight());
234    if (set_ecfe_cnt === 2) {
235      for (var i = 0; i < set_ecfe_cnt; i++) {
236        set_ecfe[i].css('height', Math.max.apply(null, set_ecfe_height) + 'px');
237      }
238      set_ecfe = [];
239      set_ecfe_height = [];
240      set_ecfe_cnt = 0;
241    }
242  });
243});
244
245/* 空満カレンダーに応じたCVボタン吹き出し表示 */
246function displayCalloutByOccupiedState(target) {
247  if (!_.isUndefined($('.callout', target).data('genre_id')) &&
248    (_.isEqual($('.callout', target).data('genre_id'), GENRE_ID.medical) ||
249      _.isEqual($('.callout', target).data('genre_id'), GENRE_ID.dentistry) ||
250      _.isEqual($('.callout', target).data('genre_id'), GENRE_ID.relaxation))) {
251    if (isCanReservationToday(target)) {
252      $('.callout_today', target).css({'display': 'inline-block',});
253      $('.callout', target).css({'width': '95px'});
254    }
255    if (isCanReservationTomorrow(target)) {
256      $('.callout_tomorrow', target).css({'display': 'inline-block'});
257      $('.callout', target).css({'width': '95px'});
258    }
259    if (isCanReservationToday(target) && isCanReservationTomorrow(target)) {
260      $('.callout', target).css({'width': '160px'});
261    }
262  }
263}
264
265/* 吹き出し表示判定 */
266function isDisplayCallout(reservationButtonArea, occupiedStateArea) {
267  if (_.isUndefined($('.callout', reservationButtonArea).data('genre_id'))) {
268    return false;
269  }
270
271  if (_.isEqual($('.callout', reservationButtonArea).data('genre_id'), GENRE_ID.medical)
272    || _.isEqual($('.callout', reservationButtonArea).data('genre_id'), GENRE_ID.dentistry)
273    || _.isEqual($('.callout', reservationButtonArea).data('genre_id'), GENRE_ID.relaxation)) {
274    if (isCanReservationToday(occupiedStateArea)) {
275      return true;
276    }
277    if (isCanReservationTomorrow(occupiedStateArea)) {
278      return true;
279    }
280    return false;
281  }
282  return true;
283}
284
285/* 空満カレンダーの今日空きがあるかの判定 */
286function isCanReservationToday(target) {
287  if ($('.dataTable', target).length === 0) {
288    return false;
289  }
290  // カレンダーの今日の日程の要素取得
291  var isCanReservationToday = $('.dataTable tr:nth-child(2) td:first-child', target).data('is_can_reservation');
292  if (_.isUndefined(isCanReservationToday)) {
293    return false;
294  }
295  return isCanReservationToday;
296}
297
298/* 空満カレンダーの明日空きがあるかの判定 */
299function isCanReservationTomorrow(target) {
300  if ($('.dataTable', target).length === 0) {
301    return false;
302  }
303
304  // カレンダーの明日の日程の要素取得
305  var isCanReservationTomorrow = $('.dataTable tr:nth-child(2) td:nth-child(2)', target).data('is_can_reservation');
306  if (_.isUndefined(isCanReservationTomorrow)) {
307    return false;
308  }
309  return isCanReservationTomorrow;
310}

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.