/* 1. modal ¹öÆ°¿¡ bootstrap ÀÇ ±â´ÉÁß modal âÀ» ´Ý´Â attribute data-bs-dismiss='modal' »ç¿ëÇϸ鼭 javascript ·Î form submit ÇÒ¶§ webview ¿¡¼­ submit ÀÌ ¾ÈµÊ. -> ¿øÀΠãÁö ¸øÇÔ */ var Saved_Scroll_Top; var PushStateEvent = 0; // pushState »ç¿ë ¿©ºÎ flag // =============================================== function Do_Pushstate(modal_id) { PushStateEvent = 1; history.pushState(modal_id, '', location.href.replace(/#(.*)/,'')+'#'+modal_id); window_lasthash.push('#'+modal_id); } // =============================================== url ÀÇ hash °¡ º¯°æµÉ¶§ ÇÊ¿ä¾ø´Â modal À» close window.onhashchange = function(event) { //$("input[type=text]").trigger('blur'); // input text ¸¦ blur var prev_hash = ''; if(location.hash) { if ( window_lasthash.length > 0 ) { del_hash_start = window_lasthash.indexOf(location.hash)+1; del_hash_end = window_lasthash.length; for(var hash_iii = del_hash_start; hash_iii < del_hash_end; hash_iii++) { $(window_lasthash[hash_iii]).modal('hide'); $(window_lasthash[hash_iii]).dropdown('hide'); window_lasthash.splice(-1,1); } } } else { for(var hash_iii = 0; hash_iii < window_lasthash.length; hash_iii++) { if(window_lasthash[hash_iii] == '#autocomplete') { $(".ui-autocomplete").css("display", "none"); } else if(window_lasthash[hash_iii] == '#map_bttm_info') { removePolygon(); $("#map_addr").css("display", "none"); $("#close_b_info").css('display', 'none'); $("#close_b_info").attr('stats', 'off'); $("#open_bttm_list").css('display', 'none'); $("#open_bttm_list").attr('stats', 'off'); if(circle) circle.setMap(null); if(clicked_marker_latlng) $(".rlty_marker[latlng='"+clicked_marker_latlng+"']").removeClass('bounce'); window_lasthash.splice(-1,1); } else if(window_lasthash[hash_iii] == '#open_calendar') { // ¼±ÅÃÇÑ °Ë»öÁ¶°ÇÀÇ ³¯Â¥ update $(".pre_pub_date, .mdetail_pick_date").each(function(index){ PrintSelSrchOpts($(this).attr('name'), $(this).val(), ''); }); $(".pignose-calendar-wrapper-active").css("display","none"); $(".pignose-calendar-wrapper-overlay-active").css("display","none"); } else { $(window_lasthash[hash_iii]).modal('hide'); window_lasthash.splice(-1,1); } } } } // =============================================== ¾îÇÃÀÌ ¾Æ´Ò°æ¿ì »õ·Î°íħ½Ã URL ¿¡ ºÙ¾îÀÖ´Â hash ¸¦ Á¦°Å /* hash °¡ ÀÖ´Â »óÅ¿¡¼­ »õ·Î°íħ½Ã modal closing ±â´É ¿ÀÀÛµ¿À» ¸·±âÀ§ÇØ hash ¸¦ Á¦°Å (#kyg_appraisal_txt) */ $(document).ready(function(){ //var package_name = Cjs_getCookie('package_name'); //if(package_name == '') //{ // var hist_length = window.history.length; // if(location.hash) // history.go(-1); //} }); $("#s_srch_frm input[type=text]").on('blur', function(){ if(location.hash) history.go(-1); }); // =============================================== modal close ÇÒ¶§ url ÀÇ hash ¸¦ °»½Å $(".modal").on('show.bs.modal', function(e) { /* 1. ¿øÀÎÀº Àß ¸ð¸£°ÚÀ¸³ª webview ¿¡¼­ pushstate »ç¿ë½Ã url ÀÌ ¾øÀ¸¸é pushstate »ç¿ë½Ã Á¤»óÀûÀ¸·Î ÀÛµ¿µÇÁö ¾Ê¾Æ modal À» open ÇÒ ¼ö ¾øÀ½. window.location.pathname -> /wdir/°æ¸Å/¹°°ÇÁ¤º¸/ÀÇÁ¤ºÎÁö¹ý/2015Ÿ°æ37910/1 location.href -> http://cjs-m-lf.landfuture.co.kr/wdir/°æ¸Å/¹°°ÇÁ¤º¸/ÀÇÁ¤ºÎÁö¹ý/2015Ÿ°æ37910/1? 2. modal ÀÌ È°¼ºÈ­µÇ¾î ÀÖÀ»¶§, tpl_center ÀÇ height ÀÌ modal scrolling ¿À·ù¸¦ ¹ß»ý½ÃÅ´ modal È°¼ºÈ­½Ã tpl_center ÀÇ height À» ½ºÅ©¸° »çÀÌÁî·Î °íÁ¤½ÃÄÑ ½ºÅ©·Ñ ¿À·ù ¹æÁö */ Saved_Scroll_Top = $(window).scrollTop(); if(!$(".modal-backdrop").length) $("#tpl_center").addClass("modal-open"); $(this).css("padding-right","0px"); var modal = this; var hash = modal.id; Do_Pushstate(hash); }); // =============================================== close ¹öÆ° Ŭ¸¯½Ã history -1 $("button[data-bs-dismiss='modal']").on('click', function() { history.go(-1); }); // =============================================== modal ÀÇ backdrop ¿µ¿ª Ŭ¸¯½Ã modal close ¹× url ÀÇ hash ¸¦ Á¦¾îÇϱâÀ§ÇÑ event $(document).on('click', function(e) { if(e.target.className == 'modal show' ) history.go(-1); }); // =============================================== $(".modal").on('hidden.bs.modal', function() { if(!$(".modal-backdrop").length) { $("#tpl_center").removeClass("modal-open"); $(window).scrollTop(Saved_Scroll_Top); } }); // =============================================== $(document).keyup(function(e){ if( e.key === "Escape" && location.hash ){ history.go(-1); } }); // =============================================== modal close ÇÒ¶§ url ÀÇ hash ¸¦ °»½Å //$(".dropup").on('show.bs.dropdown', function(e) { // var dropup = this; // var hash = dropup.id; // Do_Pushstate(hash); //});