PageSourceSearch

https://www.idfac.or.kr/resources/user/js/common.js?v=1791461543

js idfac.or.kr collected 2026-10-08 12:12:59 UTC 11,136 bytes, 337 lines download raw bytes

1var callSetGnb = new setGnb(),
2    chk = false,
3    winWidth = 0;
4
5$(function() {
6    setGnb();
7    //setLnb();
8    setTab();
9    chkIE();
10    setCustomSelect();
11
12    $(window).scroll(function() {
13        //setScrolledHeader();
14    });
15
16    //check changing width only - for mobile chrome
17    $(window).resize(function() {
18        if (winWidth != $(window).width()) {
19            //setLnb();
20            callSetGnb.closeGnb();
21            //$("#modal").iziModal('close'); // close popup of sitemap
22            winWidth = $(window).width();
23        }
24    });
25
26    $("#undefined-0 li a").on("focus", function () {
27       $(this).parents("#undefined-0").addClass("active");
28    });
29    $("#undefined-0 li:last-child a").focusout(function () {
30       $(this).parents("#undefined-0").removeClass("active");
31    });
32
33    $(".loc-href").change(function () {
34        setLocation($(this).val());
35    });
36});
37
38window.onload = function () {
39    winWidth = $(window).width();
40}
41
42function setGnb() {
43    var openGnb = undefined,
44        closeGnb = undefined,
45        action = new Object();
46
47    openGnb = function($target) {
48	    if (!chk && (chkDevice() == "normal")) {
49//        if (chkDevice() == "normal") { // sty01
50	        $("#header").addClass("active").siblings(".bg").show();
51//	        $target.find(".depth2").show(); // sty01
52	        $("#gnb .depth2").show();
53	    } else if (!chk && ((chkDevice() == "t") || (chkDevice() == "m"))) {
54	        $(".btn-gnb-open").addClass("active");
55	        $("#header").addClass("mobile");
56	        $("#gnb").hide().css({'top': $("#header").height(), 'height': ($(window).height() - $("#header").height())}).slideDown(150, function () {
57                $("#gnb > ul > li:first-child > a").addClass("on").siblings().slideDown(150);
58            });
59	        $("body").addClass("fixed");
60	    }
61	    chk = true;
62	}
63
64	closeGnb = function() {
65	    if (chk && (chkDevice() == "normal")) {
66	        $("#header").removeClass("active").children("bg").hide();
67	        $("#gnb .depth2").hide();
68	    } else if (chk && ((chkDevice() == "t") || (chkDevice() == "m"))) {
69	        $(".btn-gnb-open").removeClass("active");
70	        $("#gnb").slideUp(150, function () {
71                $(this).removeAttr("style")
72    	        $("body").removeClass("fixed");
73    	        $(".btn-gnb-open").removeClass("active");
74    	        $("#header").removeClass("mobile");
75                $("#gnb ul > li > a").removeClass("on").siblings().slideUp();
76            });
77	    }
78	    chk = false;
79	}
80
81    // to solve the problem of rise in height after open GNB in IE
82    // if (chkIE()) {
83    //     var savedHeight = $(".gnb-bottom > ul").outerHeight();
84    //     $("nav").height(savedHeight);
85    // }
86
87    $("#header nav > ul > li").mouseenter(function() {
88        if (chkDevice() == "normal") {
89            closeGnb(); // sty01
90            openGnb($(this));
91        }
92    });
93
94    $("#header").mouseleave(function() {
95        if (chkDevice() == "normal") {
96            closeGnb();
97        }
98    });
99
100    // 웹접근성 gnb 닫기
101    $("#gnb > ul > li:last-child > .depth2 > li:last-child > a").focusout(function () {
102        if (chkDevice() == "normal") {
103            closeGnb();
104        }
105    });
106
107    $("#header .depth2").prev().on('focus', function(e) {
108        openGnb();
109    });
110
111    $(".btn-gnb-open").click(function() {
112        if (chkDevice() != "normal") {
113            if (!$(this).hasClass("active")) {
114                openGnb();
115            } else {
116                closeGnb();
117            }
118        }
119        return false;
120    });
121
122    $(".btn-gnb-close").click(function() {
123        if (chkDevice() != "normal") {
124            if (!$(this).hasClass("active")) {
125                closeGnb();
126            }
127        }
128        return false;
129    });
130
131    $(".bg-mobile").click(function(e) {
132        e.preventDefault();
133        closeGnb();
134    });
135
136    $("nav > ul > li > a").click(function(e) {
137        if (chk && ((chkDevice() == "t") || (chkDevice() == "m"))) {
138        	e.preventDefault();
139            if ($(this).hasClass("on")) {
140                $(this).removeClass("on").next().slideUp();
141            } else {
142                $("nav > ul > li > a.on").removeClass("on").next().slideUp();
143                $(this).addClass("on").next().slideDown();
144            }
145        }
146    });
147    $(".depth2 > li > a").click(function (e) {
148        if (($(this).siblings(".depth3").find("li").length > 0) && ((chkDevice() == "t") || (chkDevice() == "m"))) {
149            $(this).siblings(".depth3").slideDown();
150            e.preventDefault();
151        } else {
152            // 2depth anchor only
153        }
154    });
155
156    $(".searchbar label").click(function () {
157        $(this).parent().addClass("active");
158        $(".bg").addClass("active");
159    });
160
161//    $(".searchbar .ipt").focusout(function () {
162//        $(this).val("").parent().removeClass("active");
163//        $(".bg").removeClass("active");
164//    })
165
166    action.chk = chk;
167    action.openGnb = openGnb;
168    action.closeGnb = closeGnb;
169    return action;
170}
171
172function setScrolledHeader() {
173    if ($(document).scrollTop() > 0) {
174        $("header").addClass("scroll");
175    } else {
176        $("header").removeClass("scroll");
177    }
178}
179
180function chkDevice() {
181    if ($(window).outerWidth() < 641) {
182        return "m";
183    } else if ($(window).outerWidth() < 1025) {
184        return "t";
185    } else {
186        return "normal";
187    }
188}
189
190function chkIE() {
191    var agent = navigator.userAgent.toLowerCase();
192
193    if ((navigator.appName == 'Netscape' && navigator.userAgent.
193search('Trident') != -1) || (agent.indexOf("msie") != -1)) {
194        return "ie";
195    }
196}
197
198//function setHeight(t, minHeight) {
199//    var target = $(".height-target-" + t);
200//
201//    target.each(function () {
202//        if (minHeight && $(window).outerWidth() < minHeight) {
203//            $(this).removeAttr("style");
204//            return;
205//        }
206//            $(this).height($(".height-standard-" + t).outerHeight());
207//    });
208//}
209
210function setLocation(t) {
211    window.location.href = t;
212}
213
214//function setPopup() {
215//    $("#modal").iziModal();
216//
217//    $(document).on('click', '.btn-gnb-open', function(event) {
218//        if (chkDevice() == "normal") {
219//            event.preventDefault();
220//            $(".sitemap .btn-sitemap-close").addClass("active");
221//            $('#modal').iziModal('open', {
222//                zindex: 99999
223//            });
224//        }
225//    });
226//
227//    $(".btn-sitemap-close").click(function() {
228//        $(this).removeClass("active");
229//        $("#modal").iziModal('close');
230//    });
231//}
232
233//function setLnb() {
234//    // to keep width of LNB in responsive
235//    var el = $(".lnb .depth2 li"),
236//        len = el.length - 1,
237//        w = el.outerWidth(),
238//        idx = el.siblings(".active").index();
239//    $(".lnb .depth2").outerWidth((len * w) + 2) ;
240//
241//    // to scroll ahead pointer
242//    if (chkDevice() == "m" && (idx > 0)) {
243//        $(".lnb .inner").scrollLeft((idx-1) * w);
244//    }
245//}
246
247function setCustomSelect() {
248    //if (chkDevice() == "normal") {
249        (function($) {
250            $.fn.selectUl = function(){
251                var $origSelect = $(this);
252                for (var j = 0; j < $origSelect.length; j++) {
253                    var $this = $origSelect.eq(j);
254                    var newId = $this.attr("name") + '-' + j;
255                    var numOptions = $origSelect.eq(j).children().length;
256                    var options = "";
257
258                    // options
259//                    if ($this.hasClass("newTab")) {
260//                        options += 'target="_blank"';
261//                    }
262
263                    $('<div class="coop"><ul id="' + newId + '" class="plainSelect" /></div>').insertAfter($(".footer-top > div"));
264
265        //                    $('<li class="guidance" />').text($this.attr('title')).appendTo('#' + newId);
266
267                    for (var i = 0; i < numOptions; i++) {
268                        var $thisOption = $this.find('option').eq(i);
269                        var text = $thisOption.text();
270                        var href = $thisOption.val();
271                        var classes = "",target;
272                        if ($thisOption.hasClass("line")) {
273                            classes = "div-line";
274                        }
275                        //[email protected]
276                        if($this.hasClass("newTab")&&href.substring(0,4)=='http')options='target="_blank"'; else options='';
277                        var aTag = $('<li class="' + classes + '"></li>').html('<a href="' + href + '"' + options + '>
277' + text + '</a>').appendTo('#' + newId);
278                    }
279
280                    if ($(this).find('option:selected')) {
281                        var selected = $this.find('option:selected').index();
282                        $('#' + newId).find('li').not(':eq(' + selected + '), .guidance').addClass('unselected');
283                    }
284        //                             assuming that you don't want the 'select' visible:
285                    //$(this).hide();
286                }
287
288                $(".plainSelect").mouseenter(function (){
289                    $(this).addClass("active");
290                    $(this).find("li").click( function(){
291                        var newSelect = $(this).index() - 1;
292                        $(this).parent().find('.unselected').removeClass('unselected');
293                        $(this).parent().find('li').not(this).not('.guidance').addClass('unselected');
294                        $(this).find('option:selected').removeAttr('selected');
295                        $(this).find('option:eq(' + newSelect +')').attr('selected',true);
296                    });
297                }).mouseleave(function () {
298                    $(this).removeClass("active");
299                });
300
301                return $(this);
302            }
303        })(jQuery);
304
305        $('.makePlain').selectUl();
306        $(".makePlain").change(function () {
307            setLocation($(this).val());
308        });
309    //}
310}
311
312function setTab() {
313    var chkTab = true;
314    var chkTabIndex = window.location.href.substring(window.location.href.indexOf("tab-")+4, window.location.href.indexOf("tab-")+5);
315
316    $(".tablist .tab").click(function () {
317        changeTab($(this));
318    });
319
320    $(".tablist-hover .tab").mouseenter(function () {
321        changeTab($(this));
322    });
323
324    if(chkTabIndex > 0){
325        $(".tablist .tab").eq(chkTabIndex - 1).trigger("click");
326    }
327
328    function changeTab(target) {
329        if (!target.hasClass("active") && chkTab) {
330            chkTab = false;
331            var idx = target.index();
332            target.addClass("active").siblings().removeClass("active").parent().siblings(".tabpanellist").children().hide().eq(idx).fadeIn("fast", function () {
333                chkTab = true;
334            });
335        }
336    }
337}

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.