"use strict"; var shopScript; (function (shopScript) { function initializeEvent() { var city_code = null; var shop_name = null; $(window).on('pageshow', function () { city_code = sessionStorage.getItem('city_code'); if (city_code == null) { $('#select_pref').val('00'); commonScript.initSelectCity(); $('#select_city').prop('disabled', true); } else { $('#select_pref').val(city_code.substring(0, 2)); } shop_name = sessionStorage.getItem('shop_name'); $('#name_search').val(shop_name); }); var params = location.search.substring(1).split('&'); for (var i = 0; i < params.length; i++) { var param = params[i].split('='); if (param[0] != 'city_code') { continue; } city_code = param[1]; } if (window.performance) { if (performance.navigation.type === 2) { city_code = sessionStorage.getItem('city_code'); } else { sessionStorage.clear(); } } $('#select_city').change(commonScript.getShopCount); $('.radiobtn01,.checkbox01').on('click', commonScript.getShopCount); $('.btn_submit').on('click', onclickBtnSubmit); $(window).on('scroll resize', function () { setTimeout(scrollListInbox, 100); }); var construction_type = $('input[name="group1"]:checked').val(); var reform_place_code = ''; if (construction_type == '2') { $('#group1_1').trigger('click'); } else if (construction_type == '1') { $('#group1_2').trigger('click'); $('input[name="group1"]').trigger('change'); reform_place_code = '' + $('[name="group3"]:checked').map(function () { return $(this).val(); }).get(); } if ($('#select_pref').val() != null) { $("#select_pref").trigger('change', 'init'); } commonScript.getShopListByConditions(city_code, construction_type, reform_place_code); if (city_code != null && city_code != '') { var pref_code = city_code.substring(0, 2); $('#select_pref').val(pref_code); $('#select_city').prop('disabled', false); commonScript.getCity(null, pref_code, city_code); } } shopScript.initializeEvent = initializeEvent; function onclickBtnSubmit() { $("#warning").html(''); $("#warning").addClass('non-display'); var pref_code = $('#select_pref').val(); var city_code = $('#select_city').val(); if (city_code != null) { sessionStorage.setItem('city_code', city_code); } var shop_name = $('#name_search').val(); if (shop_name != null) { sessionStorage.setItem('shop_name', shop_name); } var construction_type = $('input[name="group1"]:checked').val(); var reform_place_code = '' + $('[name="group3"]:checked').map(function () { return $(this).val(); }).get(); if (pref_code != null && city_code == null) { $("#warning").html('市区町村を選択してください'); $("#warning").removeClass('non-display'); return; } if ($('.btn_condition').hasClass('active')) { $('.btn_condition').click(); } commonScript.getShopListByConditions(city_code, construction_type, reform_place_code, shop_name); } function scrollListInbox() { var offset = $('#loading').offset(); var window_height = window.innerHeight; var window_scrollTop = $(window).scrollTop(); var scroll_bottom_position = window_height + window_scrollTop; if (commonScript.page_no > 0 && commonScript.page_no <= commonScript.max_page && scroll_bottom_position >= offset.top && commonScript.scroll_flg) { if (!commonScript.scroll_flg) { return; } commonScript.scroll_flg = false; $('#loading').removeClass('hide'); scrollShopList(); } } function scrollShopList() { setTimeout(function () { var html = commonScript.getHtmlPage(commonScript.shop_list, 'div', shop_cnt_per_scroll, shop_cnt_default); $('#shop_list_inbox').append(html); $('#loading').addClass('hide'); commonScript.scroll_flg = true; }, 500); } })(shopScript || (shopScript = {})); $(document).ready(shopScript.initializeEvent);