PageSourceSearch

https://www.fbo.or.kr/js/sub.js?v=1791402099999

js fbo.or.kr collected 2026-10-07 19:42:07 UTC 23,424 bytes, 638 lines download raw bytes

1$(document).ready(function () {
2    // sub location
3    var $locBtn = $('.locBtn');
4    
5    //사업안내 및 농지은행사업의 경우 옵션 슬라이드 버튼 비활성화
6/*    $locBtn.each(function(idx, item){
7    	if(item.children[0].innerText == "사업안내" || item.children[0].innerText == "농지은행사업")
8    	{//1lv 이 사업안내면 메뉴 id를 상위메뉴와 다르게 가지고 있어 이벤트 적용 x
9    		if($(item).closest("ul.locationTab").find("li:first-child>button>span").text() != "농지연금")
10    		{
11    			item.classList.add("noneSlide");
12    		}//end if
13    	}//end if
14    });*/
15    
16    $locBtn.on('click', function () {
17        var $navBtn = $(this);
18        var $navTarget = $navBtn.closest('li').find('div');
19        /*if($navBtn.text() == "사업안내" || $navBtn.text() == "농지은행사업")
20    	{//1lv 이 사업안내면 메뉴 id를 상위메뉴와 다르게 가지고 있어 이벤트 적용 x
21        	if($navBtn.closest("ul.locationTab").find("li:first-child>button>span").text() != "농지연금")
22    		{
23        		return false;
24    		}//end if
25    	}//end if
26*/        
27        if ($navTarget.is(':hidden')) {
28            $locBtn.removeClass('active');
29            $locBtn.closest('li').find('div').hide();
30            $navBtn.addClass('active');
31            $navTarget.slideDown();
32        } else {
33            $navBtn.removeClass('active');
34            $navTarget.hide();
35        }
36        $(window).resize(function () {
37            if ($('.btnMoGnb').is(':hidden')) {
38                $locBtn.closest('li').find('div').removeAttr('style');
39            }
40        });
41    });
42    $('.subFunc').on('mouseleave', function () {
43        $locBtn.removeClass('active');
44        $locBtn.closest('li').find('div').removeAttr('style');
45    });
46    $('.btnShare').click(function () {
47        $(this).closest('li').addClass('active');
48        $('.shareList').css('display', 'flex');
49    });
50    $('.shareClose>button').on('click', function () {
51        $('.btnShare').closest('li').removeClass('active');
52        $('.shareList').fadeOut(200);
53    });
54    $('.btnPrint>button, button.btnPrint').click(function () {
55        window.print();
56    });
57
58    // 상단 메뉴에서 포커스 벗어났을 시 처리
59    $(document).on('focus', ':focusable', function (e) {
60        if ($('.locationTab div').has(e.target).length === 0) {
61            $('.subFunc').mouseleave();
62        }
63    });
64
65    $(window).resize(function () { // 화면크기 조절에 따라 가운데 위치.
66        popupCenter();
67        popupTgrCenter('.popup_view_bizclid');
68    });
69
70    // 사업안내 dropdown
71    $(document).on('click', '.dropdown-btn', function () {
72        $(this).siblings('div').slideToggle();
73        $(this).parent('.dropdown-item').toggleClass('open');
74        $(this).parent('.dropdown-item').find('.slider').slick('slickGoTo', 0);
75    });
76    var $bizItem = $('.bizItem');
77    $bizItem.each(function () {
78        var $this = $(this);
79        var slick =
80            $this.find('.slider').slick({
81                slidesToShow: 1,
82                slidesToScroll: 1,
83                arrows: true,
84                prevArrow: $this.find('.prev'),
85                nextArrow: $this.find('.next'),
86                dots: false,
87                variableWidth: true,
88                responsive: [
89                    {
90                        breakpoint: 961,
91                        settings: {
92                            slidesToShow: 1,
93                            slidesToScroll: 1,
94                            centerMode: true
95                        }
96                    },
97                    {
98                        breakpoint: 581,
99                        settings: {
100                            slidesToShow: 1,
101                            slidesToScroll: 1,
102                            variableWidth: false,
103                            centerMode: false,
104                            adaptiveHeight: true
105                        }
106                    }
107                ]
108            });
109    });
110    $(window).on('resize orientationchange', function () {
111        $('.bizItem>.slider').slick('resize');
112    });
113
114    //헤더 메뉴 바로가기
115	if($("header .depth1>li").not(".tradeShortcutItem").length > 0)
116    {
117        /*농지직거래 헤더에서 제거 (버튼형으로 처리함)*/
118    	var $vaDepth1 = $("header .depth1>li").not(".tradeShortcutItem");
119    	var voDocFrag = document.createDocumentFragment();
120		var voDocFrag2 = document.createDocumentFragment();
121        /*모바일 헤더 , locationTab 구조 잡기*/
122		var $tempLi,$tempLi2,$tempSpan,$currentDepth2Links;
123		var currentDepthMatched = false;
124		var $depth1LinkSource, depth1Href, depth1Target;
125
126		$vaDepth1.each(function(idx, item){
127			//1depth 적용
128			$depth1LinkSource = $(item).hasClass("menuSpc") ? $(item).find(">a") : $(item).find(".depth2>ul>li:first-child>a");
129			depth1Href = $depth1LinkSource.attr("href");
130			depth1Target = $depth1LinkSource.attr("target");
131			if(!depth1Href)
132			{
133				depth1Href = $(item).find(">a").attr("href") || "#";
134			}
135			$tempLi = $("<li><a href=\"" + depth1Href + "\">" + $(item).find(">a").text() + "</a></li>");
136			if(depth1Target)
137			{
138				$tempLi.find(">a").attr("target", depth1Target);
139				$tempLi.find(">a").attr("rel", "noopener noreferrer");
140			}
141			$(voDocFrag).append($tempLi);
142			if($(".locationTab>li:first-child>.locBtn>span").length > 0)
143			{
144				if($(item).find(">a").text() == $(".locationTab>li:first-child>.locBtn>span")[0].innerText)
145				{//현재 선택된 1depth의 2depth 적용 - 개행문자인식되지 않게 inerText로 변경
146					$currentDepth2Links = $(item).find(".depth2>ul>li>a");
147					if($currentDepth2Links.length > 0)
148					{
149						currentDepthMatched = true;
150						$currentDepth2Links.each(function(idx,item){
151						$tempLi2 = $("<li>" + $(item).prop("outerHTML") + "</li>");
152						$(voDocFrag2).append($tempLi2);
153						});
154					}
155				}//end if
156			}//end if
157		});
158
159		$tempLi = $("<li><a href=\"/p2p/prop/Intro.do?menuId=091010\">농지거래e음</a></li>");
160		var tradeShortcutInserted = false;
161		$(voDocFrag.childNodes).each(function(idx, item){
162			if($(item).text().replace(/\s/g, "") == "마이페이지")
163			{
164				$(item).after($tempLi);
165				tradeShortcutInserted = true;
166				return false;
167			}
168		});
169		if(!tradeShortcutInserted)
170		{
171			$(voDocFrag).append($tempLi);
172		}
173
174		if(!currentDepthMatched && typeof menuRows !== 'undefined' && menuRows && menuRows.length > 0)
175		{
176			$(menuRows).each(function(idx, item){
177				if(item && item.pgmId)
178				{
179					var tabMenuNm = item.menuId === "091010" || item.menuId === "091020" || item.menuId === "091030"
180						? item.menuNm
181						: item.menuNm.replace(/\s/g, '');
182					$tempLi2 = $("<li><a href=\"" + item.pgmId + "\" data-menu-id=\"" + item.menuId + "\">" + tabMenuNm + "</a></li>");
183					$(voDocFrag2).append($tempLi2);
184				}
185			});
186		}
187		if(voDocFrag.children.length > 0)
188		{
189			$("ul.locationDepth1").append(voDocFrag);
190		}//end if
191		else
192		{
193			$("ul.locationDepth1").closest("div").remove();
194		}//end esle
195		
196		if(voDocFrag2.children.length > 0)
197		{
198			var voDupDocFrag = voDocFrag2.cloneNode(true);
199            var voDupLocationDepth = voDocFrag2.cloneNode(true);
200
201            // locationDepth2용 복사본에서 onclick 제거
202            $(voDupLocationDepth).find('a').each(function() {
203                this.removeAttribute('onclick');
204                this.onclick = null;
205            });
206
207            $("ul.locationDepth2").append(voDupLocationDepth);
208
209			$(voDupDocFrag.children).each(function(idx, item){
210				var currentMenu2Id = menu1Id + menu2Id;
211				var tabMenuId = $(item).find(">a").attr("data-menu-id");
212				if(!tabMenuId)
213				{
214					var href = $(item).find(">a").attr("href") || "";
215					var matchMenuId = href.match(/menuId=([0-9]+)/);
216					if(matchMenuId && matchMenuId[1])
217					{
218						tabMenuId = matchMenuId[1].substring(0, 6);
219					}
220				}
221
222				$tempSpan = $("<span>" + $(item).find(">a").text() + "</span>");
223				$(item).find(">a").text("");
224				if(tabMenuId == currentMenu2Id || $tempSpan.text() == $("span.depth2Refer")[0].innerText.replace(/\s/g, ""))
225				{//개행문자인식되지 않게 inerText로 변경
226					item.classList.add("active");
227					item.setAttribute("title","선택됨");
228				}//end if
229				if($tempSpan.text() == "지도서비스")
230				{//모바일에서는 지도서비스 감춤
231					item.classList.add("menuSpc");
232				}//end if
233				$(item).find(">a").append($tempSpan);
234			});
235
236            if(has4thLevel !== "true" && has4thLevel !== true) {
237                if($(".tabNav>.tabList>ul").length > 0)
238                {
239                    $(".tabNav>.tabList>ul").append(voDupDocFrag);
240                }
241            }
242			//end if
243		}//end if
244		else
245		{
246			$("ul.locationDepth2").closest("div").remove();
247		}//end esle
248    }//end if
249    
250    // 3, 4차 메뉴 설정
251    depth3And4Menu();
252
253    $('.tabNav a[href*="gis"], .locationTab a[href*="gis"], .depth3List a[href*="gis"], .depth4List a[href*="gis"]').attr({
254        'target': '_blank',
255        'rel': 'noopener noreferrer'
256    });
257
258    // TODO : 25.09.09 운영 반영 후 이상 없을 시 삭제 요망 박성빈
259    /*//사업안내-농지은행사업 메뉴로 진입시
260    if($(".depth3List").length > 0)
261    {
262    	var $vaBusinessInfo = $(".business-infomation>.swipe>ul>li");
263    	var voDocFrag = document.createDocumentFragment();
264		$vaBusinessInfo.each(function(idx, item){
265			//1depth 적용
266			tempLi = $("<li>" + $(item).find(">a").prop("outerHTML") + "</li>");
267			$(voDocFrag).append(tempLi);
268		});
269		
270		if(voDocFrag.children.length > 0)
271		{
272			$(".depth3List>div>ul").append(voDocFrag);
273		}//end if
274		else
275		{
276			$(".depth3List>div>ul").closest("div").remove();
277		}//end esle
278    }//end if*/
279
280    // tabMenu
281    $('.tabNav').each(function () {
282        var $this = $(this);
283        var $moBtn = $this.find('.moTabBtn');
284        var $target = $this.find('.tabList');
285        var activeTxt = $this.find('.active').text();
286        $moBtn.find('span').text(activeTxt);
287        $moBtn.on('click', function () {
288            if ($target.is(':hidden')) {
289                $(this).addClass('active');
290                $target.slideDown();
291            } else {
292                $(this).removeClass('active');
293                $target.slideUp();
294            }
295        });
296        $(window).resize(function () {
297            if ($('.headerMobile').is(':hidden')) {
298                $target.removeAttr('style');
299                $moBtn.removeClass('active');
300            }
301        });
302    });
303
304    // has4thLevel이 true면 2차 메뉴 표시 (모바일에서만)
305    if (has4thLevel === "true" || has4thLevel === true) {
306        if (window.matchMedia("(max-width: 1024px)").matches) {
307            $('.locationTab > li:nth-child(2)').show();
308
309            $('.locationTab > li:nth-child(2) .locBtn').css({
310                'background': '#1e88e5',
311                'color': '#fff'
312            });
313        }
314
315        // 화면 크기 변경 시에도 적용
316        window.addEventListener('resize', function() {
317            if (window.matchMedia("(max-width: 1024px)").matches) {
318                $('.locationTab > li:nth-child(2)').show();
319                $('.locationTab > li:nth-child(2) .locBtn').css({
320                    'background': '#1e88e5',
321                    'color': '#fff'
322                });
323            } else {
324                // 데스크톱에서는 원래 CSS 적용 (인라인 스타일 제거)
325                $('.locationTab > li:nth-child(2) .locBtn').css({
326                    'background': '',
327                    'color': ''
328                });
329            }
330        });
331    }
332
333	// 관심지역 닫기
334	$(".js_favloc_hide").on('click', function () {
335		$(this).parents('.favloc_popup').removeClass('show');
336		fnFavFlag("close", "C")
337	});
338	// 관심지역 개인정보 form 이동
339	$("#btn_fav_form").on('click', function () {
340		$(this).parents('.favloc_popup').removeClass('show');
341        // AJAX 완료 후 페이지 이동
342		fnFavFlag("href", "C");
343	});
344});
345
346// 25.09.09 3, 4 단계 메뉴 설정 박성빈
347function depth3And4Menu() {
348    // 현재 선택된 2차 메뉴 찾기
349    let currentMenu2 = getCurrentMenu2();
350    if (!currentMenu2 || !currentMenu2.menu3Rows) {
351        // 3차, 4차 메뉴 모두 제거
352        $(".depth3List>div>ul").closest("div").remove();
353        $(".depth4List>div>ul").closest("div").remove();
354        return;
355    }
356
357    // upperMenu가 "090"인 경우 3차 메뉴 제거
358    if (currentMenu2.upperMenu === "090") {
359        $(".depth3List>div>ul").closest("div").remove();
360        $(".depth4List>div>ul").closest("div").remove();
361        return;
362    }
363
364    let menu3Fragment = document.createDocumentFragment();
365    let menu4Fragment = document.createDocumentFragment();
366    let menu3TabFragment = document.createDocumentFragment(); // 3차 메뉴 탭용
367    let currentMenu3Found = false;
368
369    // 3차 메뉴 순회 (1차 반복문)
370    currentMenu2.menu3Rows.forEach(function(menu3Item) {
371        // 3차 메뉴 li 생성
372        let menu3Li = $("<li><a href=\"" + (menu3Item.pgmId || '#') + "\">" + menu3Item.menuNm + "</a></li>");
373
374        // 현재 선택된 3차 메뉴 체크
375        if (menu3Nm && menu3Item.menuNm.trim() === menu3Nm.trim()) {
376            $(menu3Li).addClass("active");
377            $(menu3Li).attr("title", "선택됨");
378            currentMenu3Found = true;
379
380            // 4차 메뉴 처리 (2차 반복문) - 현재 선택된 3차 메뉴의 4차 메뉴들만
381            if (menu3Item.menu4Rows && menu3Item.menu4Rows.length > 0) {
382                menu3Item.menu4Rows.forEach(function(menu4Item) {
383                    let menu4Li = $("<li><a href=\"" + (menu4Item.pgmId || '#') + "\">" + menu4Item.menuNm + "</a></li>");
384
385                    // 현재 선택된 4차 메뉴 체크
386                    if (menu4Nm && menu4Item.menuNm.trim() === menu4Nm.trim()) {
387                        $(menu4Li).addClass("active");
388                        $(menu4Li).attr("title", "선택됨");
389                    }
390
391                    $(menu4Fragment).append(menu4Li);
392                });
393            }
394        }
395
396        $(menu3Fragment).append(menu3Li);
397
398        // 4차 메뉴가 있는 경우 3차 메뉴를 탭용으로 생성
399        if (has4thLevel !== "false" && has4thLevel !== false) {
400            let menu3TabLi = $("<li><a href=\"" + (menu3Item.pgmId || '#') + "\"><span>" + menu3Item.menuNm + "</span></a></li>");
401
402            // 현재 선택된 3차 메뉴 체크 (탭용)
403            if (menu3Nm && menu3Item.menuNm.trim() === menu3Nm.trim()) {
404                $(menu3TabLi).addClass("active");
405                $(menu3TabLi).attr("title", "선택됨");
406            }
407
408            $(menu3TabFragment).append(menu3TabLi);
409        }
410    });
411
412    // 3차 메뉴 DOM 업데이트
413    if ($(".depth3List").length > 0) {
414        if (menu3Fragment.children.length > 0) {
415            $(".depth3List>div>ul").append(menu3Fragment);
416        } else {
417            $(".depth3List>div>ul").closest("div").remove();
418        }
419    }
420
421    // 4차 메뉴 DOM 업데이트
422    if ($(".depth4List").length > 0) {
423        if (menu4Fragment.children.length > 0) {
424            $(".depth4List>div>ul").append(menu4Fragment);
425        } else {
426            $(".depth4List>div>ul").closest("div").remove();
427        }
428    }
429
430    // 4차 메뉴가 있는 경우 3차 메뉴를 탭 네비게이션에 추가
431    if (has4thLevel && $(".tabNav>.tabList>ul").length > 0) {
432        if (menu3TabFragment.children.length > 0) {
433            $(".tabNav>.tabList>ul").append(menu3TabFragment);
434        }
435    }
436}
437
438/**
439 * 25.09.09 현재 선택된 2차 메뉴 객체를 반환 박성빈
440 */
441function getCurrentMenu2() {
442    if (typeof menuRows === 'undefined' || !menuRows || menuRows.length === 0) {
443        return null;
444    }
445
446    if (typeof menu1Id === 'undefined' || typeof menu2Id === 'undefined') {
447        return null;
448    }
449
450    let targetMenu2Id = menu1Id + menu2Id;
451
452    return menuRows.find(function(item) {
453        return item.menuId === targetMenu2Id;
454    });
455}
456
457// 문자 콤마
458function addcomma(str) {
459    var clearExp = /[^0-9\.]/g;
460    var regExp = /\B(?=(\d{3})+(?!\d))/g;
461    var clearStr = str.toString().replace(clearExp, '');
462    var splitStr = clearStr.toString().split(".");
463    splitStr[0] = splitStr[0].toString() == "" ? 0 : splitStr[0].toString();
464    var amt = "" + parseInt(splitStr[0].toString());
465    if (splitStr.length == 1) {
466        return amt.replace(regExp, ',') + (splitStr[1] ? "." + splitStr[1] : "");
467    } else {
468        return amt.replace(regExp, ',') + ("." + splitStr[1]);
469    }
470}
471
472// 우선순위별 신청상태 팝업
473function popupCenter() { // 매물조회 신청자
474    var wrapperHeight = $(window).height();
475    var objWidth = $('.popup_view_status').width();
476    var objHeight = $('.popup_view_status').height();
477    var left = (($(window).width() - objWidth) / 2);
478    var top = (($(window).height() - objHeight) / 2) + $(window).scrollTop();
479    var visualDisplay = $(".sub-top .visual-container").css("display");
480    if (visualDisplay != "none") {
481        wrapperHeight = wrapperHeight - 50;
482    }
483
484    $('.popup_view_status').css({
485        'position': 'absolute',
486        'left': left,
487        'top': top,
488        'margin': '0px auto'
489    });
490    
491    if($(".popup_view_status>.warn_rank_msg").length < 1)
492    {//24.01.16 우선순위별 신청상태 팝업창 아래부분에 알림문구 추가
493    	var $msg = $('<div class="warn_rank_msg">' + 
494    			'본 순위는 신청자 입력에 의한 순위로 확정되지 않은 순위입니다.신청기한 완료 후 업무담당자의 신청자격 확정에 따라 최종 순위가 변동이 있을 수 있습니다.' +
495    			'</div>');
496    	
497    	$(".popup_view_status").append($msg);
498    }//end if
499}
500
501function popupTgrCenter(obj) {
502    var wrapperHeight = $(window).height();
503    var objWidth = $(obj).width();
504    var objHeight = $(obj).height();
505    var left = (($(window).width() - objWidth) / 2) + $(window).scrollLeft();
506    var top = (($(window).height() - objHeight) / 2) + $(window).scrollTop();
507    var visualDisplay = $(".sub-top .visual-container").css("display");
508    if (visualDisplay != "none") {
509        wrapperHeight = wrapperHeight - 50;
510    }
511
512    $(obj).css({
513        'position': 'absolute',
514        'left': left,
515        'top': top,
516        'margin': '0px auto'
517    });
518}
519
520// 도움말 팝업
521function helpMsg() {
522    $('.btnh a.pop_open').click(function () {
523        $(".pop_wrap").each(function () {
524            $(this).removeClass('on');
525        })
526        $(this).next('div').addClass('on');
527    });
528    // 도움말 팝업 닫기
529    $('.pop_wrap .tit a.pop_close').click(function () {
530        $(this).parent('.tit').parent('.pop_wrap').removeClass('on');
531    });
532}
533
534
535/***** 250825 관심지역 추가 *****/
536function fncFavLoc() {
537    // fildset
538    if ($('.favlocWrap .fieldset').length) {
539        // myFavFlndOnOFF
540        if ($('.favlocWrap [class^="rgst_box"]').length) {
541            $('.favlocWrap [class^="rgst_box"] ~ .fieldset').show();
542
543            // 인풋 , 버튼 비활성화 이벤트
544            $('input[name="favUseYn"]').change(function () {
545                if ($('input[id="favUseY"]').is(':checked')) {
546                    $(".fieldset").find('input, button').prop('disabled', false);
547                } else {
548                    $(".fieldset").find('input , button').prop('disabled', true);
549                }
550            });
551
552
553            // 회원가입 완료창에서 관심지역 hide - show 처리
554            if(vsMenuId == "090020"){
555                if( $("#favUseY").is(":checked")) {
556                    $('.favlocWrap [class^="rgst_box"] ~ .fieldset').show();
557                }else {
558                    $('.favlocWrap [class^="rgst_box"] ~ .fieldset').hide();
559                }
560
561                $('input[name="favUseYn"]').change(function () {
562                    if ($('input[id="favUseY"]').is(':checked')) {
563                        $(this).parents('[class^="rgst_box"]').siblings('.fieldset').show();
564                    } else {
565                        $(this).parents('[class^="rgst_box"]').siblings('.fieldset').hide();
566                    }
567                });
568            }else {
569                // 마이페이지 고객정보수정에서 checked 에 따른 disabled 처리
570                if( $("#favUseY").is(":checked")) {
571                    $(".fieldset").find('input, button').prop('disabled', false);
572                } else {
573                    $(".fieldset").find('input , button').prop('disabled', true);
574                }
575            }
576
577
578        }
579        // input refresh
580        $(document).on('click', '.favlocWrap .fieldset .btn_refresh', function () {
581            $(this).siblings('.inp_btn').children('input[type="text"]').val('');
582        });
583    }
584    // favloc_popup
585    if ($('[data-favlocpop]').length || $('.favloc_popup').length) {
586		// show
587        $(document).on('click', '[data-favlocpop]', function () {
588            $('#' + $(this).attr('data-favlocpop')).addClass('show');
589        });
590		// hide
591        $(document).on('click', '.js_favloc_hide, .favloc_popup:not(.imgpop) .favloc_overlay', function () {
592            $(this).parents('.favloc_popup').removeClass('show');
593        });
594	}
595}
596/*관심지역 닫기버튼 플래그 설정*/
597function fnFavFlag(btnType,flag){
598
599     return $.ajax({
600        type : "post",
601        url : '/mypg/cstm/favFlag.do',
602        data : {favFlndFlag : flag},
603        xhrFields: { withCredentials: true }, // CORS일 때 필수
604        success : function(data) {
605			// console.log("success");
606            if (data.resultFlag){
607                if(data.resultMsg) {
608                    if(btnType == "close"){
609                        // 개인정보변경 폼 외 alert
610                        alert(data.resultMsg);
611                    }
612                }
613                if(data.redirect || data.redirect != undefined){
614                    window.location.replace(data.redirect);
615                }
616            }else {
617                if(data.resultFlag =="error"){
618                    alert(data.resultMsg);
619                }
620                if(data.redirect || data.redirect != undefined){
621                    window.location.replace(data.redirect);
622                }
623            }
624        },
625		 complete : function (data) {
626			// console.log("complete");
627			// console.log(data);
628			 if(btnType == "href"){
629				window.location.replace("/mypg/infom/UserForm.do?menuId=09004
62900010");
630			 }
631		 },
632        error : function(request, status, error) {
633            alert("code:" + request.status + "\n" + "message:" + request.responseText + "\n" + "error:" + error);
634        },
635        async : true
636    });
637}
638/***** // 250825 관심지역 추가 *****/

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.