"use strict"; var caseScript; (function (caseScript) { function initializeEvent() { var city_code = 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)); } }); if (window.performance) { if (performance.navigation.type === 2) { city_code = sessionStorage.getItem('city_code'); } else { sessionStorage.clear(); } } $('#select_city').change(commonScript.getCaseCount); $('.radiobtn01,.checkbox01').on('click', commonScript.getCaseCount); $('.btn_submit').on('click', onclickBtnSubmit); $(window).on('scroll resize', function () { setTimeout(scrollListInbox, 100); }); var place_code = '' + $('[name="group1"]:checked').map(function () { return $(this).val(); }).get(); var construction_type = $('input[name="group2"]:checked').val(); $('input[name="group2"]').trigger('change'); var preference_code = ''; if (construction_type == '2') { $('#group2_1').trigger('click'); preference_code = '' + $('[name="group3"]:checked').map(function () { return $(this).val(); }).get(); } else if (construction_type == '1') { $('#group2_2').trigger('click'); preference_code = '' + $('[name="group4"]:checked').map(function () { return $(this).val(); }).get(); } if ($('#select_pref').val() != null) { $("#select_pref").trigger('change', 'init'); } commonScript.getCaseListByConditions(city_code, place_code, construction_type, preference_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); } } caseScript.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 place_code = '' + $('[name="group1"]:checked').map(function () { return $(this).val(); }).get(); var construction_type = $('input[name="group2"]:checked').val(); var preference_code_new = '' + $('[name="group3"]:checked').map(function () { return $(this).val(); }).get(); var preference_code_reform = '' + $('[name="group4"]:checked').map(function () { return $(this).val(); }).get(); var preference_code = construction_type == '1' ? preference_code_reform : preference_code_new; if (param_shop_code == '' && pref_code != null && city_code == null) { $("#warning").html('市区町村を選択してください'); $("#warning").removeClass('non-display'); return; } if ($('.btn_condition').hasClass('active')) { $('.btn_condition').click(); } commonScript.getCaseListByConditions(city_code, place_code, construction_type, preference_code); } 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'); scrollCaseList(); } } function scrollCaseList() { setTimeout(function () { var html = commonScript.getHtmlPage(commonScript.case_list, 'a', case_cnt_per_scroll, case_cnt_default); $('#case_list_inbox').append(html); $('#loading').addClass('hide'); commonScript.scroll_flg = true; }, 500); } })(caseScript || (caseScript = {})); $(document).ready(caseScript.initializeEvent);