PageSourceSearch

https://www.leeumhoam.org/script/common-dc5cf6c5b3d3fffb61f86a5f33f40873.js

js leeumhoam.org collected 2026-09-26 00:41:40 UTC 70,392 bytes, 1,814 lines download raw bytes

1let query = window.location.search;
2let param = new URLSearchParams(query);
3let privacyIframe;
4let privacyIframe2;
5let focusedElement;
6let found = location.pathname.split("/")[1];
7const leeumFlag = found === "leeum";
8let currentColorSet;
9const svgPrefix = "url(\"data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='"
10const svgUrl = {
11    arrowDown: [svgPrefix + "0 0 11 6.6'%3E%3Cpath style='fill:none;stroke:", ";stroke-width:1.5;' d='M10.4,0.5l-4.9,5l-5-5'/%3E%3C/svg%3E\")"],
12    arrowUp: [svgPrefix + "0 0 8 8'%3E%3Cpath style='fill:none;stroke:", ";' d='M0.5,5.8L4,2.2l3.5,3.5'/%3E%3C/svg%3E%0A\")"],
13    selectDown: [svgPrefix + "0 0 8 8'%3E%3Cpath style='fill:none;stroke:", ";' d='M7.5,3.2L4,6.8L0.5,3.2'/%3E%3C/svg%3E%0A\")"],
14    paginationFirst: [svgPrefix + "0 0 14 14'%3E%3Cstyle type='text/css'%3E.st0%7Bfill:none;stroke:", ";%7D%3C/style%3E%3Cg transform='translate(-574.489 -2817.195)'%3E%3Cpath class='st0' d='M586,2829.1l-4.9-4.9l4.9-4.9'/%3E%3Cpath class='st0' d='M582,2829.1l-4.9-4.9l4.9-4.9'/%3E%3C/g%3E%3C/svg%3E\")"],
15    paginationLast: [svgPrefix + "0 0 14 14'%3E%3Cstyle type='text/css'%3E.st0%7Bfill:none;stroke:", ";%7D%3C/style%3E%3Cg transform='translate(-864.901 -2817.195)'%3E%3Cpath class='st0' d='M867.4,2819.2l4.9,4.9l-4.9,4.9'/%3E%3Cpath class='st0' d='M871.4,2819.2l4.9,4.9l-4.9,4.9'/%3E%3C/g%3E%3C/svg%3E%0A\")"],
16    paginationPrev: [svgPrefix + "0 0 14 14'%3E%3Cpath style='fill:none;stroke:", ";' d='M9.5,11.9L4.5,7l4.9-4.9'/%3E%3C/svg%3E%0A\")"],
17    paginationNext: [svgPrefix + "0 0 14 14'%3E%3Cpath style='fill:none;stroke:", ";' d='M4.5,2.1L9.5,7l-4.9,4.9'/%3E%3C/svg%3E%0A\")"],
18    people: [svgPrefix + "0 0 18.787 20.5' width='18.787' height='20.5'%3E%3Cpath d='M11012.143-994a8.008,8.008,0,0,0-8-8,8.009,8.009,0,0,0-8,8H10995a9.154,9.154,0,0,1,9.143-9.144,9.155,9.155,0,0,1,9.145,9.144Zm-12.285-15.714a4.29,4.29,0,0,1,4.285-4.286,4.289,4.289,0,0,1,4.285,4.286,4.29,4.29,0,0,1-4.285,4.286A4.291,4.291,0,0,1,10999.857-1009.714Zm1.144,0a3.145,3.145,0,0,0,3.142,3.142,3.146,3.146,0,0,0,3.145-3.142,3.146,3.146,0,0,0-3.145-3.142A3.145,3.145,0,0,0,11001-1009.714Z' transform='translate(-10994.75 1014.25)' stroke='", "' stroke-miterlimit='10' stroke-width='0.5'/%3E%3C/svg%3E\")"],
19};
20
21function movePage(url, replace) {
22
23    if (replace) {
24        if (history.replaceState) {
25            history.replaceState(null, document.title, url);
26            history.go(0);
27        } else {
28            location.replace(url);
29        }
30    } else {
31
32        if(url == '/leeum')
33        {
34            gtag('event', 'click_button_move_to_leeum', {});
35        }
36        else if( url == '/hoam')
37        {
38            gtag('event', 'click_button_move_to_hoam', {});
39        }
40
41        location.href = url;
42    }
43}
44
45function movePageWithParams(url) {
46    location.href = url + (checkSearchParam() ? "?params=Y" : "");
47}
48
49function changeLanguage(lang) {
50    let date = new Date();
51    date.setTime(date.getTime() + (30 * 24 * 60 * 60 * 1000)); // 30일 후 만료
52    // document.cookie = "lang=" + lang.toLowerCase() + "; path=/; expires=" + date.toUTCString() + ";";
53    $.removeCookie('lang', { path: '/' });
54    $.cookie('lang', lang.toLowerCase(),{expires: 30,path:'/'})
55    location.reload();
56}
57
58function createNewEditor(holder, data) {
59    $("#" + holder).append('<div class="comment-cont"><div class="comment-box"><p></p></div></div>');
60    if(data != null && typeof data === "string") {
61        data = data
62            .replaceAll("http://file.samsungfoundation.org/leeum/leeum_upload/gallery", "/upload/exhibition")
63            .replaceAll("http://file.samsungfoundation.org/leeum/leeum_upload/museum", "/upload/museum")
64            .replaceAll("http://file.samsungfoundation.org/leeum/leeum_upload/WebEditor", "/upload/editor")
65            .replaceAll("leeum.org/program/lecture_view.asp?proid=", "leeumhoam.org/leeum/edu/program/")
66            .replaceAll("leeum.org/program/lecture_view.asp?Proid=", "leeumhoam.org/leeum/edu/program/")
67            .replaceAll("leeum.org/html/education/lecture_view.asp?Proid=", "leeumhoam.org/leeum/edu/program/")
68            .replaceAll("leeum.samsungfoundation.org/html/education/lecture_view.asp?Proid=", "www.leeumhoam.org/leeum/edu/program/")
69            .replaceAll("leeum.org/exhibition/exhibition01_detail.asp?seq=", "leeumhoam.org/leeum/exhibition/")
70            .replaceAll("leeum.org/common/membershipguide.asp", "leeumhoam.org/leeum/membership/guide")
71            .replace(/&amp;proType=\d{3}/g, '')
72            .replace(/javascript:_gotoEduView\(document\.frmList,'\/html\/education\/lecture_view\.asp','(\d+)','(\d+)'\)/g, function(match, id1, id2) {
73                return  "https://www.leeumhoam.org/leeum/edu/program/" + id1;
74            });
75    }
76    let editor =  new EditorJS({
77            holder: holder,
78            data: typeof data === "string" ? JSON.parse(data) : data,
79            readOnly: true,
80            tools: {
81                header: {
82                    class: EditorHeader,
83                    config: {
84                        defaultLevel: 3,
85                        placeholder: "제목을 입력하세요"
86                    },
87                    tunes: ['alignment'],
88                },
89                image: {
90                    class: EditorImage,
91                },
92                gallery2: {
93                    class: EditorGallery2,
94                },
95                imageSlide: {
96                    class: EditorImageSlide,
97                },
98                list: {
99                    class: EditorList,
100                    tunes: ['alignment'],
101                },
102                paragraph: {
103                    class: EditorParagraph,
104                    tunes: ['alignment'],
105                },
106                paragraph2: {
107                    class: EditorParagraph2,
108                    tunes: ['alignment'],
109                },
110                line: {
111                    class: EditorLine,
112                },
113                alignment: {
114                    class: EditorAlignment,
115                    config:{
116                        default: "left",
117                        blocks: {
118                            header: 'left',
119                            list: 'left'
120                        }
121                    },
122                },
123                cancelLine: {
124                    class: EditorCancelLine,
125                },
126                note: {
127                    class: EditorNote,
128                },
129                Color: {
130                    class: ColorPlugin,
131                    config: {
132                        type: 'text',
133                        customPicker: true
134                    }
135                },
136                embed: {
137                    class: Embed,
138                    config: {
139                        services: {
140                            youtube: true
141                        }
142                    }
143                }
144            },
145            minHeight : 0,
146            i18n: {
147                messages: {
148                    "ui": {
149                        "blockTunes": {
150                            "toggler": {
151                                "Click to tune": "편집",
152                                "or drag to move": "또는 드래그해서 이동"
153                            },
154                        },
155                        "inlineToolbar": {
156                            "converter": {
157                                "Convert to": "변경"
158                            }
159                        },
160                        "toolbar": {
161                            "toolbox": {
162                                "Add": "추가",
163                            }
164                        },
165                        "popover": {
166                            "Filter": "필터",
167                            "Nothing found": "해당하는 것이 없습니다"
168                        }
169                    },
170                    "toolNames": {
171                        "Text": "본문",
172                    },
173                    "blockTunes": {
174                        "delete": {
175                            "Delete": "삭제",
176                            "Click to delete": "클릭하여 삭제"
177                        },
178                        "moveUp": {
179                            "Move up": "위로 이동"
180                        },
181                        "moveDown": {
182                            "Move down": "아래로 이동"
183                        }
184                    },
185                }
186            },
187            onReady() {
188                const width_margin = $('html').outerWidth() - $('.editor-wrap').outerWidth();
189                $('.comment-box').css('width', width_margin / 2);
190            }
191        }
192    );
193    return editor;
194}
195
196$(document).ready(function (){
197    var id = param.get("eleId")
198    if(id !== null ) {
199        var location = document.getElementById(id).offsetTop
200        $('html').scrollTop(location);
201    }
202})
203
204function paging(obj,functionName) {
205    var isFirst = obj.page === 1;
206    var isLast = obj.page === obj.maxPage || obj.maxPage === 0;
207    var isEng = $.cookie('lang') === "eng";
208
209    var pp = '<li><button class="first '+(isFirst ? 'none' : '')+'" aria-label="' + (isEng ? "Move to First Page" : "첫 페이지로 가기") + '" onclick="'+(isFirst ? '' : functionName+'(1)')+'"></button></li>'
210        + '<li><button class="prev '+(isFirst ? 'none' : '') +'" aria-label="' + (isEng ? "Move to Previous Page" : "이전 페이지로 가기") + '" onclick="'+(isFirst ? '' : functionName+'('+(obj.page-1)+')')+'"></button></li>'
211    for(i=obj.pageBegin;i<=obj.pageEnd;i++) {
212        pp += '<li><button aria-label="' + (isEng ? "Move to Page " + i : i + "페이지로 가기") + '" class="'+(obj.page == i ? 'active' : '')+'" onclick="'+functionName+'('+i+')">'+i+'</button></li>'
213    }
214    pp += '<li><button class="next '+(isLast ? 'none' : '') + '" aria-label="' + (isEng ? "Move to Next Page" : "다음 페이지로 가기") + '" onclick="'+(isLast ? '' : functionName+'('+(obj.page+1)+')')+'"></button></li>'
215        + '<li><button class="last ' +(isLast ? 'none' : '') + '" aria-label="' + (isEng ? "Move to Last Page" : "마지막 페이지로 가기") + '" onclick="'+(isLast ? '' : functionName+'('+(obj.maxPage)+')')+'"></button></li>'
216    return pp;
217}
218
219function sendFormByAjax(page, url, createEl, id, data) {
220    if(!data) data = $(document.form).serialize();
221    data.page = page
222
223    $.ajax({
224        url: url,
225        type: 'get',
226        data: data,
227        success: function (res) {
228            const element = createEl(res);
229            if(!id) id = 'ajax';
230            $('#' + id + '-body').empty();
231            $('#' + id + '-body').append(element);
232            if($('#' + id + '-pagination').length > 0) {
233                $('#' + id + '-pagination').empty();
234                $('#' + id + '-pagination').append(paging(res.paging, 'search'));
235                if(currentColorSet) {
236                    $(".pagination .first").css("background-image", getBackgroundSvg("paginationFirst", 10, 1));
237                    $(".pagination .last").css("background-image", getBackgroundSvg("paginationLast", 10, 1));
238                    $(".pagination .prev").css("background-image", getBackgroun
238dSvg("paginationPrev", 10, 1));
239                    $(".pagination .next").css("background-image", getBackgroundSvg("paginationNext", 10, 1));
240                }
241                if(res.list.length > 0) {
242                    $('#' + id + '-pagination').show();
243                    $(".empty-cont").hide();
244                    $("#has-cont").show();
245                    $("#total-cnt").text(res.total);
246                    $("#total-cnt").show();
247                    //$(".pagination button").attr('tabindex', '0');
248					//$(".pagination button").attr('tabindex', '-1');
249                    $(".pagination button, .archive-list-type02 tr").on('keydown', enterClick);
250                } else {
251                    $('#' + id + '-pagination').hide();
252                    $(".empty-cont").show();
253                    $("#has-cont").hide();
254                    $("#total-cnt").hide();
255                    if(url.includes("/exhibition") && data.keyword === "") $("#empty-exhibition").show();
256                    else $("#empty-exhibition").hide();
257                }
258            }
259            setListView();
260            btnAriaLabel();
261        }
262    });
263}
264
265function formatDate(date) {
266    return date ? date.replaceAll("-", ".") + "." : "";
267}
268
269function formatKeyword(keyword) {
270    if(keyword) {
271        keyword = keyword.replace(/\s/g, "");
272        if(keyword !== "") {
273            keyword = "%" + keyword + "%"
274        }
275    }
276    return keyword;
277}
278
279/*
280function otherSite(gbn,id,pw,url){
281	var ticketHost = 'ticket.leeum.org/leeum';
282
283	// 리움 호암 ticket url 구분 - 2026-02-23
284	if(url.split('/')[3] === "hoam") {
285		ticketHost = 'ticket.hoammuseum.org:8443/hoam';	
286	}
287	
288	//console.log('url : ' + url);
289	//console.log('url3 : ' + url.split('/')[3]);
290	
291	if (gbn === 'logout') {
292		//console.log('url : ' + url);
293		
294		if (url === 'hoam') {
295			ticketHost = 'ticket.hoammuseum.org:8443/hoam';	
296		}
297	}
298
299    $.ajax({
300        type: "POST",
301        dataType: 'jsonp',
302		url: 'https://' + ticketHost + '/crossDataProc.do',
303        data: {
304            gbn: gbn
305            , id: id
306            , passEnc: pw
307        },
308        success: function (data) {
309            console.log(" resultCode : " + data.resultCode + ", resultMessage : " + data.resultMessage);
310
311            if (gbn === 'login') {
312                // 정상인 경우
313                if (data.resultCode === '0000') {
314                    // parent 로그인 처리
315                    console.log("login proc");
316                    movePage(url)
317                    return true
318                }
319                // error인 경우
320                else {
321                    console.log(data.resultMessage);
322                    movePage(url)
323                }
324            } else if (gbn === 'logout') {
325                // 정상인 경우
326                if (data.resultCode === '0000') {
327                    // parent 로그아웃 처리
328                    console.log("logout proc");
329                    movePage("/logout")
330                    return true
331                } else {
332                    console.log(data.resultMessage);
333                    movePage("/logout")
334                }
335            }
336
337
338        }
339        , error: function (e) {
340            console.log(e)
341            if (gbn === 'login') {
342                movePage(url)
343            }else{
344                movePage("/logout")
345            }
346        }
347
348    });
349
350    return false;
351}
352*/
353
354function otherSite(gbn,id,pw,url){
355	// 두 개의 AJAX 요청을 Promise로 감싸기
356	const request1 = $.ajax({
357		type: "POST",
358        dataType: 'jsonp',
359		url: 'https://ticket.leeum.org/leeum/crossDataProc.do',
360        data: {
361            gbn: gbn
362            , id: id
363            , passEnc: pw
364        }
365	});
366
367	const request2 = $.ajax({
368		type: "POST",
369        dataType: 'jsonp',
370		url: 'https://ticket.hoammuseum.org:8443/hoam/crossDataProc.do',
371        data: {
372            gbn: gbn
373            , id: id
374            , passEnc: pw
375        }
376	});
377
378	// 두 요청이 모두 완료되면 특정 URL로 이동
379	Promise.all([request1, request2])
380	  .then((res1, res2) => {
381	    //console.log("두 요청 모두 성공:", res);
382		if (res1.resultCode === '0000' && res2.resultCode === '0000') {
383			if (gbn === 'login') {
384				console.log("login proc");
385	        	movePage(url);
386			} else if (gbn === 'logout') {
387				console.log("logout proc");
388				//movePage("/logout");
389				movePage("/" + url + "/logout");
390			}
391			return true;
392		} else {
393			//console.error("요청 중 하나이상 실패");
394			if (gbn === 'login') {
395				console.log("login error : " + data.resultMessage);
396				movePage(url);
397			} else if (gbn === 'logout') {
398				console.log("logout error : " + data.resultMessage);
399				//movePage("/logout");
400				movePage("/" + url + "/logout");
401			}
402		}
403	  })
404	  .catch((e) => {
405	    console.error("요청 에러 :", e);
406		if (gbn === 'login') {
407            movePage(url);
408        }else{
409            movePage("/logout");
410        }
411	  });
412	  
413	  return false;
414}
415
416function onlyNumber(e) {
417    e.value = e.value.replace(/[^0-9]/ig, '');
418}
419
420function getViewType() {
421    return $("#view-type").attr("class").replace("view-type-", "") === "list" ? "grid" : "list";
422}
423
424async function waitForLoad(selector) {
425    return new Promise(resolve => {
426        const target = $(selector);
427        if (target.length === 0) {
428            resolve(null);
429            return;
430        }
431        target.on("load", function() {
432            resolve($(this).contents());
433        });
434    });
435}
436
437async function setPrivacyIframe(target) {
438    const iframeCss = `
439            <link rel="stylesheet" type="text/css" href="/css/font.css"/>
440            <style>
441                body {font-weight: 600; font-family: 'AktivGrotesk', -apple-system, BlinkMacSystemFont, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji;}
442
443                ::-webkit-scrollbar {width: 0; height: 0; background-color: transparent;}
444                ::-webkit-scrollbar-thumb {background-color: transparent;}
445                ::-webkit-scrollbar-track {background-color: transparent;}
446
447                li.pvinfo_li {list-style: none;}
448                dd.descLv1 {margin: 0; font-size: 16px; line-height: 1.6;}
449                dd.descLv1:not(:first-child) {margin-top: 20px;}
450                dd.descLv1 p.title {margin: 0;}
451                dd.descLv2 {margin: 0; margin-left: 16px; font-size: 15px; line-height: 1.6;}
452                dd.descLv2 p {margin: 0;}
453                dd.descLv3 {margin: 0; margin-left: 32px; margin-top: 4px; font-size: 14px; line-height: 1.6;}
454                dd.descLv3 p {margin: 0;}
455                dd.descLv3 + dd.descLv2 {margin-top: 12px;}
456                dd.descLv4 {margin: 0; margin-left: 32px; margin-top: 6px; font-size: 14px; line-height: 1.6;}
457                dd.descLv4 p {margin: 0;}
458
459                dd.descLv2 table, dd.descLv3 table {width: 100%!important; margin: 0!important; font-weight: 600; font-family: 'AktivGrotesk', -apple-system, BlinkMacSystemFont, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; border-collapse: collapse; border-spacing: 0;}
460                dd.descLv2 table caption, dd.descLv3 table caption {font-size: 14px; margin-bottom: 6px; text-align: center; word-break: keep-all;}
461                dd.descLv2 table thead th, dd.descLv3 table thead th {font-size: 14px;}
462                dd.descLv2 table tbody td, dd.descLv3 table tbody td {font-size: 14px; text-align: center; font-size: 14px; word-break: keep-all;}
463
464                body > div p {margin: 0; font-size: 16px; line-height: 1.6;}
465                body > div h3 {margin: 0; margin-bottom: 6px; font-size: 18px; line-height: 1.6;}
466                body > div * + h3 {margin-top: 12px}
467                body > div ol {list-style: none; padding: 0; padding-left: 16px; line-height: 1.6;}
468                body > div table {width: 100%!important; margin: 0!important; font-weight: 600; font-family: 'AktivGrotesk', -apple-system, BlinkMacSystemFont, Arial, sans-serif, Apple Color Emoji, Segoe UI Emoji, Segoe UI Symbol, Noto Color Emoji; border-collapse: collapse; border-spacing: 0;}
469                body > div table caption {font-size: 14px; margin-bottom: 6px; text-align: center; word-break: keep-all;}
470                body > div table thead th {font-size: 14px;}
471                body > div table tbody td {font-size: 14px; text-align: center; font-size: 14px; word-break: keep-all;}
472            </style>
473        `;
474    if(!target || target === "privacy") {
475        privacyIframe = await waitForLoad("#privacy-iframe");
476        if (privacyIframe) {
477            privacyIframe.find('head').append(iframeCss);
478            privacyIframe.on('keydown', function(e) {
479                if (e.key === 'Escape') {
480                    modalClose($("#privacy"));
481                }
482            });
483        }
484    }
485    if(!target || target === "privacy2") {
486        privacyIframe2 = await waitForLoad("#privacy-iframe-remembership");
487        if (privacyIframe2) {
488            privacyIframe2.find('head').append(iframeCss);
489            privacyIframe2.on('keydown', function(e) {
490                if (e.key === 'Escape') {
491                    modalClose($("#privacy2"));
492                } else if (e.key === 'Tab' && !e.shiftKey) {
493                    $('.menu-wrap .custom-group').focus();
494                }
495            });
496        }
497    }
498
499    $("html, body").css("transition", "none");
500
501    // 사용자화 - 배경색상
502    $("#custom-color-btn button").click(function(){
503        $("html, body").css("transition", "color .6s, background-color .6s");
504        const id = $(this).parent().attr("id").replace("custom-color-", "");
505        changeColor(id);
506        $(".custom-option.active").removeClass("active");
507        sessionStorage.setItem("option", "");
508        switchMotionCss(false);
509    });
510
511    // 사용자화 - 글자크기
512    $("#custom-size-btn button").click(function(){
513        const id = $(this).parent().attr("id").replace("custom-size-", "");
514        changeFontSize(id);
515    });
516
517    // 사용자화 - 추천 옵션
518    $("#custom-option-btn button").click(function(){
519        $("html, body").css("transition", "color .6s, background-color .6s");
520        const id = $(this).parent().attr("id").replace("custom-option-", "");
521        changeOption(id);
522        $(".custom-bg.active").removeClass("active");
523    });
524
525    changeFontSize(sessionStorage.getItem("size"));
526    let customOption, customColor;
527
528    if(leeumFlag) {
529        customOption = sessionStorage.getItem("option");
530        customColor = sessionStorage.getItem("color");
531
532    } else {
533        customOption = sessionStorage.getItem("hoam-option");
534        customColor = sessionStorage.getItem("hoam-color");
535    }
536    customOption ? changeOption(customOption) : changeColor(customColor);
537
538    // aria-label
539    btnAriaLabel();
540    $('li > button:not(.folding-head)').on('click', function() {
541        const clickEvent = $(this).data('events')?.click?.[0]?.handler;
542        if (clickEvent && typeof clickEvent === 'function') {
543            clickEvent();
544        }
545
546        btnAriaLabel($(this));
547    });
548}
549
550function changeColor(id) {
551    if(!id) return;
552
553    $(".custom-option.active").removeClass("active");
554    $(".custom-bg.active").removeClass("active");
555    $(".custom-bg.theme-" + id).addClass("active");
556
557    $(".theme-black").css("border-color", "");
558
559    let key, sets;
560
561    if(leeumFlag) {
562        sessionStorage.setItem("color", id);
563        key = ["--leeum-white", "--leeum-gray100", "--leeum-gray200", "--leeum-gray300", "--leeum-gray400", "--hoam-text-green", "--leeum-black",
564               "--leeum-line200", "--leeum-line100",
565               "--leeum-text400", "--leeum-text300", "--leeum-text200", "--leeum-text100",
566               "--leeum-drag-bg", "--leeum-drag-text"];
567        sets = {
568            whiteSet : ["#FFFFFF", "#F9F9F9", "#F2F2F2", "#57575C", "#57575C", "#2B2B2B", "#000000",
569                        "#D2D2D2", "#F2F2F2",
570                        "#000000", "#57575C", "#D2D2D2", "#FFFFFF",
571                        "#000000", "#FFFFFF"],
572            beigeSet : ["#F8F1E8", "#FFFFFF", "#EFE2CD", "#D9BC95", "#D9BC95", "#D9BC95", "#D9BC95",
573                        "#D9BC95", "#D9BC95",
574                        "#000000", "rgba(0,0,0,0.7)", "#FFFFFF", "#000000",
575                        "#000000", "#F8F1E8"],
576            gray100Set : ["#E1E1E1", "#F2F2F2", "#F2F2F2", "#ADADAD", "#ADADAD", "#57575C", "#57575C",
577                          "#ADADAD", "#ADADAD",
578                          "#000000", "rgba(0,0,0,0.7)", "#FFFFFF", "#000000",
579                          "#000000", "#E1E1E1"],
580            gray200Set : ["#57575C", "#4B4B4F", "#4B4B4F", "#2B2B2B", "#2B2B2B", "#2B2B2B", "#2B2B2B",
581                          "#A5A5AA", "#A5A5AA",
582                          "#FFFFFF", "#FFFFFF", "#FFFFFF", "#FFFFFF",
583                          "#FFFFFF", "#57575C"],
584            blackSet : ["#000000", "#2B2B2B", "#2B2B2B", "#525252", "#525252", "#525252", "#2B2B2B",
585                        "#525252", "#525252",
586                        "#D2D2D2", "#A5A5AA", "#D2D2D2", "#D2D2D2",
587                        "#F2F2F2", "#000000"],
588            contrastSet : ["#FFFFFF", "#D2D2D2", "#D2D2D2", "#000000", "#000000", "#000000", "#D2D2D2",
589                           "#000000", "#000000",
590                           "#000000", "#000000", "#FFFFFF", "#FFFFFF",
591                           "#000000", "#FFFFFF"]
592        };
593
594        if(id === "black" || id === "gray200") {
595            $(".floor-wrap img, .museum-info lottie-player").css("filter", "invert(1)");
596            $(".stamp-wrap > img:first-child").css("filter", "invert(1)");
597            $(".header-gnb-wrap > .background > img").css("filter", "invert(1)");
598            $(".header-gnb-wrap > .background > img").css("mix-blend-mode", "screen");
599        } else {
600            $(".floor-wrap img, .museum-info lottie-player").css("filter", "unset");
601            $(".stamp-wrap > img:first-child").css("filter", "unset");
602            $(".header-gnb-wrap > .background > img").css("filter", "unset");
603            if(id === "beige" || id === "gray100") {
604                $(".header-gnb-wrap > .background > img").css("mix-blend-mode", "multiply");
605            }
606        }
607
608        if(id === "black") {
609            $(".archive-depth-cont li > a").addClass("invert-30");
610            $(".custom-wrap .option li button").addClass("active-dark");
611        } else {
612            $(".archive-depth-cont li > a").removeClass("invert-30");
613            $(".custom-wrap .option li button").removeClass("active-dark");
614        }
615
616    } else {
617        sessionStorage.setItem("hoam-color", id);
618        sessionStorage.setItem("hoam-option", "");
619        key = ["--hoam-white",
620               "--hoam-green", "--hoam-blue", "--hoam-red", "--hoam-gray",
621               "--hoam-text-btn", "--hoam-text-green", "--hoam-text-gray", "--hoam-text-black",
622               "--hoam-line200", "--hoam-line100",
623               "--hoam-drag-bg", "--hoam-drag-text"];
624        sets = {
625            whiteSet : ["#FFFFFF",
626                        "#00662E", "#000F9F", "#FF7276", "#F0ECE9",
627                        "#FFFFFF", "#00662E", "#5F574E", "#000000",
628                        "#D2CCC7", "#F0ECE9",
629                        "#5F574E", "#FFFFFF"],
630            redSet : ["#FF7276",
631                      "#000000", "#000000", "#000000", "rgba(0,0,0,.05)",
632                      "#FFFFFF", "rgba(0,0,0,.5)", "#000000", "#000000",
633                      "#000000", "#000000",
634                      "#000000", "#FFFFFF"],
635            greenSet : ["#FFFFFF",
636                        "#005C29", "#005C29", "#005C29", "#E5FCEF",
637                        "#E5FCEF", "#000F9F", "#005C29", "#005C29",
638                        "#005C29", "#005C29",
639                        "#005C29", "#E5FCEF"],
640            blueSet : ["#000F9F",
641                       "#00DB64", "#00DB64", "#00DB64", "rgba(0,0,0,.3)",
642                       "#000F9F", "#FFFFFF", "#00DB64", "#00DB64",
643                       "#00DB64", "#00DB64",
644                       "#00DB64", "#000F9F"],
645            graySet : ["#B5ADA5",
646                       "#000A6B", "#000A6B", "#000A6B", "rgba(240,236,233,.3)",
647                       "#B5ADA5", "#000000", "#000A6B", "#000A6B",
648                       "#000A6B", "#000A6B",
649                       "#000A6B", "#B5ADA5"],
650            blackSet : ["#000000",
651                        "#B5ADA5", "#B5ADA5", "#B5ADA5", "rgba(181,173,165,.15)",
652                        "#000000", "#FFFFFF", "#B5ADA5", "#FFFFFF",
653                        "#B5ADA5", "#B5ADA5",
654                        "#B5ADA5", "#000000"],
655            contrastSet : ["#FFFFFF",
656                           "#000000", "#000000", "#000000", "rgba(0,0,0,.05)",
657                           "#FFFFFF", "rgba(0,0,0,.75)", "#000000", "#000000",
658                           "#000000", "#000000",
659                           "#000000", "#FFFFFF"]
660        };
661
662        if(id === "black") $(".custom-wrap .cont .keyword > ul > li > a").css("color", "#000");
663        else $(".custom-wrap .cont .keyword > ul > li > a").css("color", sets[id + "Set"][8]);
664
665        if(id === "black" || id === "blue") $(".stamp-wrap > img:first-child").css("filter", "invert(1)");
666        else $(".stamp-wrap > img:first-child").css("filter", "unset");
667
668        if(location.pathname !== "/hoam") {
669            if(id === "black" || id === "blue") $("header .svg-hoam-white").attr("src", "/img/logo/hoam-wh.svg")
670            else $("header .svg-hoam-white").attr("src", "/img/logo/hoam-bl.svg");
671        }
672    }
673
674    currentColorSet = sets[id + "Set"];
675
676    for (let i = 0, len = key.length; i < len; i++) {
677        document.documentElement.style.setProperty(key[i], currentColorSet[i]);
678    }
679
680    // 색상 리움-호암 공통 후처리
681    if(privacyIframe) {
682        privacyIframe.find("body, table, a").css("color", currentColorSet[leeumFlag ? 9 : 8]);
683        privacyIframe.find("table").css("border", currentColorSet[leeumFlag ? 7 : 9]);
684    }
685    if(privacyIframe2) privacyIframe2.find("body").css("color", currentColorSet[leeumFlag ? 9 : 8]);
686    $(".folding-list > :not(.active)").css("background-image", getBackgroundSvg("arrowDown", 9, 8));
687    $(".folding-list > .active").css("background-image", getBackgroundSvg("arrowUp", 9, 8));
688    $("select").css("background-image", getBackgroundSvg("selectDown", 10, 7));
689    $(".pagination .first").css("background-image", getBackgroundSvg("paginationFirst", 10, 1));
690    $(".pagination .last").css("background-image", getBackgroundSvg("paginationLast", 10, 1));
691    $(".pagination .prev").css("background-image", getBackgroundSvg("paginationPrev", 10, 1));
692    $(".pagination .next").css("background-image", getBackgroundSvg("paginationNext", 10, 1));
693    $(".mem-card-info .ic-people").css("background-image", getBackgroundSvg("people", 9, 8));
694    $("select").each(function(){changeSelectFontColor($(this))});
695}
696
697function changeFontSize(id) {
698    if(!id) return;
699
700    sessionStorage.setItem("size", id);
701    $(".custom-size.active").removeClass("active");
702    $(".custom-size." + id).addClass("active");
703
704    let currentSize = "";
705
706    switch (id) {
707        case "sm":
708            currentSize = "52.5%";
709            break;
710        case "md":
711            currentSize = "62.5%";
712            break;
713        case "lg":
714            currentSize = "80.5%";
715            break;
716    }
717    $("html").css("font-size", currentSize);
718}
719
720function changeOption(id) {
721    if(!id) return;
722
723    $(".theme-black").css("border-color", "");
724    switch (id) {
725        case "default":
726            changeColor("white");
727            switchMotionCss(false);
728            break;
729        case "dark":
730            changeColor("black");
731            switchMotionCss(false);
732            $(".theme-black").css("border-color", "#57575C");
733            break;
734        case "contrast":
735            changeColor("contrast");
736            switchMotionCss(false);
737            break;
738        case "echo":
739            changeColor("white");
740            switchMotionCss(true);
741            break;
742    }
743
744    $(".custom-bg.active").removeClass("active");
745    $(".custom-option." + id).addClass("active");
746
747    sessionStorage.setItem(leeumFlag ? "option" : "hoam-option", id);
748}
749
750function switchMotionCss(useFlag) {
751    let styleSheets = document.styleSheets;
752    for (let i = 0, len = styleSheets.length; i < len; i++) {
753        let sheet = styleSheets[i];
754        if (sheet.href === location.origin + '/css/motion.css') {
755            sheet.disabled = useFlag;
756            break;
757        }
758    }
759}
760
761function callContent(id, url, type) {
762    $.ajax({
763        url: url,
764        type: "get",
765        contentType: 'application/json',
766        success: function (res) {
767            if(res) {
768                return renderContent(id, type, res.before, res.after)
769            }
770        },
771        error: function () {
772        },
773    });
774}
775
776function renderContent(id, type, before, after) {
777    if(after) {
778        return createNewEditor(id, after);
779    } else {
780        if(before) {
781            let json = {blocks: []};
782            let el = {};
783            let cont = "";
784
785            if(type === "exhibition") { // 전시
786                let list = before;
787                let imageSlide = {};
788                imageSlide.type = "imageSlide";
789                imageSlide.data = [];
790
791                for (let i = 0, len = list.length; i < len; i++) {
792                    if(i === 0 || (i > 0 && list[i].sectionType !== list[i - 1].sectionType)) {
793                        let section = "";
794                        if($.cookie('lang') === "eng") {
795                            switch (list[i].sectionType) {
796                                case "ex_summary": section = "Introduction"; break;
797                                case "ex_artist": section = "Artist"; break;
798                                case "ex_works": section = "Works"; break;
799                                case "ex_program": section = "Program"; break;
800                                case "ex_intro": section = "Exhibition Guide"; break;
801                            }
802                        } else {
803                            switch (list[i].sectionType) {
804                                case "ex_summary": section = "전시개요"; break;
805                                case "ex_artist": section = "작가소개"; break;
806                                case "ex_works": section = "작품소개"; break;
807                                case "ex_program": section = "프로그램"; break;
808                                case "ex_intro": section = "관람안내"; break;
809                            }
810                        }
811
812                        el = {};
813                        el.type = "header"
814                        el.data = {
815                            text: section,
816                            level: 2
817                        }
818                        json.blocks.push(el);
819                    }
820
821                    if(list[i].sectionType === "ex_works") {
822                        if (list[i].image !== null && list[i].image.trim() !== "") {
823                            imageSlide.data.push({
824                                caption: list[i].title + "<br>" + list[i].content,
825                                url: "/upload/exhibition/" + list[i].image.split("|")[0],
826                            });
827                        }
828                        if(i === len - 1 || list[i + 1].sectionType !== "ex_works") {
829                            json.blocks.push(imageSlide);
830                        }
831                    } else {
832                        if (list[i].title.trim() !== "") {
833                            el = {};
834                            el.type = "header"
835                            el.data = {
836                                text: list[i].title,
837                                level: 3
838                            }
839                            json.blocks.push(el);
840                        }
841
842                        if (list[i].image !== null && list[i].image.trim() !== "") {
843                            let imageArr = list[i].image.split("|");
844                            for (let j = 0; j < imageArr.length; j++) {
845                                el = {};
846                                el.type = "image";
847                                el.data = {
848                                    url: "/upload/exhibition/" + imageArr[j],
849                                    caption: " "
850                                }
851                                json.blocks.push(el);
852                            }
853                        }
854
855                        cont = list[i].content.split("\n\n");
856                        for (let i = 0; i < cont.length; i++) {
857                            el = {};
858                            if(cont[i].substring(0, 4) === "<img") {
859                                el.type = "image";
860                                el.data = {
861                                    url: cont[i].split('src="')[1].split('"')[0],
862                                    caption: " "
863                                }
864                            } else {
865                                if (cont[i] && (cont[i].trim() === "" || cont[i].trim() === "&nbsp;")) continue;
866                                el.type = "paragraph"
867                                el.data = {
868                                    text: cont[i].replaceAll("\n", "<br>")
869                                }
870                            }
871                            json.blocks.push(el);
872                        }
873                    }
874                }
875            }
876            else if(type === 'collection'){
877                var data  = before
878                el = {}
879                data.content = data.content.replaceAll("<br />", "\n").replaceAll("\n\n", " ");
880                if(data.content !== "" && data.content !== null){
881                    el.type = "paragraph"
882                    el.data = {
883                        text: data.content.replaceAll("\n", "<br>")
884                    }
885                    json.blocks.push(el)
886                }
887            }
888            else {
889                if(type === "program") {
890                    before = before
891                        .replace("<P>&nbsp;</P>", "")
892                        .replace("<P><BR>&nbsp;<BR>", "<P>")
893                        .replaceAll(`<p>&nbsp;</p>`, "")
894                        .replaceAll(`\n`, "")
895                        .replaceAll("<table", "\n\n<table").replaceAll("</table>", "</table>\n\n")
896                }
897
898                if(type === "notice") {
899                    before = before.replace("&nbsp;\n", "");
900                }
901
902                cont = before.split("\n\n");
903                for (let i = 0; i < cont.length; i++) {
904                    el = {};
905                    if(cont[i].substring(0, 4) === "<img") {
906                        el.type = "image";
907                        el.data = {
908                            url: cont[i].split('src="')[1].split('"')[0],
909                            caption: " "
910                        }
911                    } else {
912                        if (cont[i] && (cont[i].trim() === "" || cont[i].trim() === "&nbsp;")) continue;
913                        el.type = "paragraph"
914                        el.data = {
915                            text: cont[i].replaceAll("\n", "<br>")
916                        }
917                    }
918                    json.blocks.push(el);
919                }
920            }
921            return createNewEditor(id, JSON.stringify(json));
922        }
923    }
924}
925
926function callAjax(type, url, data, callback) {
927    let ajax = {
928        url: url,
929        type: type,
930        contentType: 'application/json',
931        success: function (res) {
932            if(res.result) {
933                callback(res.object);
934            } else {
935                if(res.object) {
936                    openAlert({type: 'alert', message: res.object});
937                } else {
938                    openAlert({type: 'alert', message: '<sp:message code="common.alert1"/>.'});
939                }
940                if(res.url) {
941                    location.href = res.url;
942                }
943            }
944        },
945        error: function () {
946            openAlert({type: 'alert', message: '<sp:message code="common.alert1"/>.'});
947        },
948    };
949    if(data !== null) {
950        if(type === "get") {
951            ajax.data = data;
952        } else {
953            ajax.data = JSON.stringify(data);
954        }
955    }
956
957    $.ajax(ajax);
958}
959
960function callAjaxBySync(type, url, data, callback) {
961    let ajax = {
962        url: url,
963        type: type,
964        contentType: 'application/json',
965        async: false,
966        success: function (res) {
967            if(res.result) {
968                callback(res.object);
969            } else {
970                if(res.object) {
971                    openAlert({type: 'alert', message: res.object});
972                } else {
973                    openAlert({type: 'alert', message: '<sp:message code="common.alert1"/>.'});
974                }
975                if(res.url) {
976                    location.href = res.url;
977                }
978            }
979        },
980        error: function () {
981            openAlert({type: 'alert', message: '<sp:message code="common.alert1"/>.'});
982        },
983    };
984    if(data !== null) {
985        if(type === "get") {
986            ajax.data = data;
987        } else {
988            ajax.data = JSON.stringify(data);
989        }
990    }
991
992    $.ajax(ajax);
993}
994
995function comma(num) {
996    var len, point, str;
997
998    num = num + "";
999    point = num.length % 3;
1000    len = num.length;
1001
1002    str = num.substring(0, point);
1003    while (point < len) {
1004        if (str !== "") str += ",";
1005        str += num.substring(point, point + 3);
1006        point += 3;
1007    }
1008
1009    return str;
1010}
1011
1012function readURL(input) {
1013    if (input.files && input.files[0]) {
1014        var reader = new FileReader();
1015        reader.onload = function(e) {
1016            $(input).next().attr("src", e.target.result);
1017        };
1018        reader.readAsDataURL(input.files[0]);
1019    } else {
1020        $(input).next().attr("src", e.target.result);
1021    }
1022}
1023
1024function setEditorComment(target) {
1025    $('.comment-cont').click(function(e) {
1026        const focus = $(e.target);
1027
1028        if(focus.is('.comment-cont')) {
1029            $('.comment-cont').removeClass('active');
1030        }
1031    });
1032
1033    $('.comment-cont').addClass('active');
1034    const text_top = $(target).offset().top;
1035    $('.comment-cont').css('top', text_top);
1036    $(target).closest(".editor-wrap").find(".comment-box").html("<p>" +  $(target).children(".comment").children().text() + "</p>");
1037}
1038
1039function downloadFile(path, name) {
1040    fetch(`/download?path=${encodeURIComponent(path)}`)
1041        .then((res) => {
1042            if (res.ok) {
1043                return res.blob();
1044            } else {
1045                throw new Error("File download failed.");
1046            }
1047        })
1048        .then((blob) => {
1049            const url = window.URL.createObjectURL(blob);
1050            const a = document.createElement("a");
1051            a.href = url;
1052            a.download = name;
1053            a.click();
1054            window.URL.revokeObjectURL(url);
1055        })
1056        .catch((error) => {
1057            console.error(error);
1058        });
1059}
1060
1061function heewonPopHeight() {
1062    const window_height = $(document).outerHeight();
1063    const boxes = $('.heewon-pop-cont > p');
1064    if ($(window).width() < 768) {
1065        const heewon_pop_height = window_height - 20 - 20;
1066        for (let i = 0, len = boxes.length; i < len; i++) {
1067            boxes.eq(i).css('max-height', heewon_pop_height - 16 - 16 - $('.heewon-pop-tit').outerHeight(true) - $('.main-img').eq(i).outerHeight() - 20);
1068        }
1069    } else {
1070        const heewon_pop_height = window_height - 30 - 30;
1071        for (let i = 0, len = boxes.length; i < len; i++) {
1072            boxes.eq(i).css('max-height', heewon_pop_height - 20 - 20 - $('.heewon-pop-tit').outerHeight(true) - $('.main-img').eq(i).outerHeight() - 20 - (heewon_pop_height / 5));
1073        }
1074    }
1075}
1076
1077function preventScroll(e) {
1078    if(window.location.pathname === "/hoam" && !$.cookie('hoamPopup')) {
1079        e.preventDefault();
1080        e.stopPropagation();
1081        $(window).scrollTop(0);
1082    }
1083    if(window.location.pathname === "/leeum" && !$.cookie('leeumPopup')) {
1084        e.preventDefault();
1085        e.stopPropagation();
1086        $(window).scrollTop(0);
1087    }
1088}
1089
1090function addScroll() {
1091    window.removeEventListener('mousewheel', preventScroll);
1092    window.removeEventListener('DOMMouseScroll', preventScroll);
1093    window.removeEventListener('touchmove', preventScroll);
1094    window.removeEventListener('scroll', preventScroll);
1095}
1096
1097function stopNoticePopup() {
1098    let date = new Date();
1099    date.setDate(date.getDate() + 1);
1100    date.setHours(0, 0, 0, 0);
1101    if(window.location.pathname === "/hoam") {
1102        $.removeCookie('hoamPopup', { path: '/' });
1103        $.cookie('hoamPopup', true,{expires: date, path:'/'});
1104    }
1105    if(window.location.pathname === "/leeum") {
1106        $.removeCookie('leeumPopup', { path: '/' });
1107        $.cookie('leeumPopup', true,{expires: date, path:'/'});
1108    }
1109}
1110
1111function closeNoticePopup() {
1112    if($("#noticePopupChk").prop("checked")) stopNoticePopup();
1113    addScroll();
1114    $("header").removeClass("disable-hover");
1115    $('.notice-popup').hide();
1116    $("#containerBtn").attr("tabIndex", "0");
1117    resetFocus();
1118
1119    const logoColor = $(".swiper-slide-active .logoColor").text();
1120    $("header > h1 > svg path").css("fill", logoColor);
1121    $("header .gnb-wrap a").css("color", logoColor);
1122}
1123
1124function changeMainBanner() {
1125    let banners = $(".bannerImg");
1126    for (let i = 0; i < banners.length; i++) {
1127        if(window.innerWidth > 767) {
1128            $(".bannerImg").eq(i).css("background-image", "url('" + $(".bannerImg").eq(i).siblings(".bannerImgUrl").text() + "')");
1129			
1130			// 메인 이미지 ALT추가(PC) - 2025-08-18
1131			if ($.cookie('lang') === "kor") {
1132				$(".bannerImg").eq(i).attr('title',$(".bannerImg").eq(i).siblings(".bannerImgAlt").text());
1133		    }
1134		    else {
1135		        $(".bannerImg").eq(i).attr('title',$(".bannerImg").eq(i).siblings(".bannerEngImgAlt").text());
1136		    }
1137        } else {
1138            $(".bannerImg").eq(i).css("background-image", "url('" + $(".bannerImg").eq(i).siblings(".bannerMobileImgUrl").text() + "')");
1139			
1140			// 메인 이미지 ALT추가(모바일) - 2025-08-18
1141			if ($.cookie('lang') === "kor") {
1142				$(".bannerImg").eq(i).attr('title',$(".bannerImg").eq(i).siblings(".bannerMobileImgAlt").text());
1143		    }
1144		    else {
1145		        $(".bannerImg").eq(i).attr('title',$(".bannerImg").eq(i).siblings(".bannerEngMobileImgAlt").text());
1146		    }
1147        }
1148    }
1149}
1150
1151
1152function openAlert(params) {
1153    if (!params.message) return;
1154
1155    let msg = params.message.replace(/\r?\n/g, '<br>');
1156
1157    if (params.type === 'alert') {
1158        let popup = $('#common-alert-popup');
1159        popup.find('#common-alert-message').html(msg);
1160		
1161        let button = popup.find('button');
1162        button.unbind('click');
1163        button.click(function (e) {
1164            modalClose('common-alert-popup');
1165            if (params.callback) params.callback();
1166        });
1167
1168        popup.click(function(e) {
1169            modalClose('common-alert-popup');
1170            if (params.callback) params.callback();
1171        });
1172        popup.children().click(function(e) {
1173            e.stopPropagation();
1174        });
1175
1176        popup.find(".svg-ic-close").click(function(e){
1177            modalClose('common-alert-popup');
1178			
1179			if (params.gubun !== 'gift') {
1180				if (params.gubun === 'login') {
1181					$('#btnlogin').focus();
1182				}
1183				else {
1184					if (params.callback) params.callback();
1185				}
1186			}
1187        });
1188
1189        modalOpen('common-alert-popup');
1190    } else if (params.type === 'confirm') {
1191        let popup = $('#common-confirm-popup');
1192        popup.find('#common-confirm-message').html(msg);
1193
1194        let no = popup.find('#common-confirm-no');
1195        if (params.buttonNo && params.buttonNo.length > 0) {
1196            no.text(params.buttonNo);
1197        }
1198
1199        no.unbind('click');
1200        no.click(function (e) {
1201            modalClose('common-confirm-popup');
1202            if (params.callbackNo) params.callbackNo();
1203        });
1204
1205        let yes = popup.find('#common-confirm-yes');
1206        if (params.buttonYes && params.buttonYes.length > 0) {
1207            yes.text(params.buttonYes);
1208        }
1209
1210        yes.unbind('click');
1211        yes.click(function (e) {
1212            modalClose('common-confirm-popup');
1213            if (params.callbackYes) params.callbackYes();
1214        });
1215
1216        popup.click(function(e) {
1217            modalClose('common-confirm-popup');
1218            if (params.callbackNo) params.callbackNo();
1219        });
1220        popup.children().click(function(e) {
1221            e.stopPropagation();
1222        });
1223
1224        popup.find(".svg-ic-close").click(function(e){
1225            modalClose('common-confirm-popup');
1226            if (params.callbackNo) params.callbackNo();
1227        });
1228
1229        modalOpen('common-confirm-popup');
1230    }
1231}
1232
1233function saveParams(id, data) {
1234    sessionStorage.setItem(id + "-params", JSON.stringify(data));
1235    const url = new URL(window.location.href);
1236    url.searchParams.set("params", "Y");
1237    history.replaceState({}, '', url);
1238}
1239
1240
1241function checkSearchParam() {
1242    const urlParams = new URLSearchParams(window.location.search);
1243    return urlParams.get('params') === "Y";
1244}
1245
1246
1247function setSearchParams(id) {
1248    let searchParams = sessionStorage.getItem(id + "-params");
1249    let result = JSON.parse(searchParams);
1250    if(id === "publication") {
1251        $(".filter-tab > .active").removeClass("active");
1252        $("#type" + result.type).addClass("active");
1253    }
1254    if(id === "media") {
1255        $(".filter-tab > .active").removeClass("active");
1256        $("#cate" + result.category).addClass("active");
1257        $(".filter > .active").removeClass("active");
1258        for (let i = 0; i < result.type.length; i++) {
1259            $("#type" + result.type[i]).addClass("active");
1260        }
1261    }
1262    if(id === "program") {
1263        $(".filter-tab > .active").removeClass("active");
1264        $("#type" + result.type1).addClass("active");
1265        $(".filter > .active").removeClass("active");
1266        for (let i = 0; i < result.status.length; i++) {
1267            $("#status" + result.status[i]).addClass("active");
1268        }
1269    }
1270    if(id === "exhibition" || id === "preservation" || id.includes("collection")) {
1271        $(".filter-tab > .active").removeClass("active");
1272        $(".filter-tab > li[data-tab=" + result.tab + "]").addClass("active");
1273    }
1274    if (id === "newsletter") {
1275        $(".filter-tab > .active").removeClass("active");
1276        $(".filter-tab > li[data-tab=" + "type"+result.serviceGbn + "]").addClass("active");
1277    }
1278    if(id.includes("collection")) {
1279        $(".filter > .active").removeClass("active");
1280        $('#active-1').addClass(result.locYn);
1281        $('#active-2').addClass(result.signLang);
1282        $('#active-3').addClass(result.nationNo);
1283        $('#active-4').addClass(result.age3);
1284        $('#active-5').addClass(result.age4);
1285        $('#active-6').addClass(result.age5);
1286        $('#active-7').addClass(result.age6);
1287        $('#active-8').addClass(result.age7);
1288        $('#active-9').addClass(result.age8);
1289        $('#active-10').addClass(result.age9);
1290        $('#active-1_cp').addClass(result.locYn);
1291        $('#active-2_cp').addClass(result.signLang);
1292        $('#active-3_cp').addClass(result.nationNo);
1293        $('#active-4_cp').addClass(result.age3);
1294        $('#active-5_cp').addClass(result.age4);
1295        $('#active-6_cp').addClass(result.age5);
1296        $('#active-7_cp').addClass(result.age6);
1297        $('#active-8_cp').addClass(result.age7);
1298        $('#active-9_cp').addClass(result.age8);
1299        $('#active-10_cp').addClass(result.age9);
1300        $("input[name=startAge]").val(result.age1);
1301        $("input[name=endAge]").val(result.age2);
1302        $("input[name=startAge2]").val(result.age1);
1303        $("input[name=endAge2]").val(result.age2);
1304    }
1305    if(result !== null && result.keyword !== undefined) {
1306        let keyword = result.keyword.replaceAll("%", "");
1307        if(keyword.length > 0) {
1308            $("#keyword").text(keyword);
1309            $(".search-result").show();
1310        } else {
1311            $(".search-result").hide();
1312        }
1313
1314        $("input[name=keyword]").val(keyword);
1315        $("input[name=startDate]").val(result.startDate);
1316        $("input[name=endDate]").val(result.endDate);
1317        $("input[name=startDate2]").val(result.startDate);
1318        $("input[name=endDate2]").val(result.endDate);
1319        $("input[name=startYear]").val(result.startYear);
1320        $("input[name=endYear]").val(result.endYear);
1321        $("input[name=startYear2]").val(result.startYear);
1322        $("input[name=endYear2]").val(result.endYear);
1323    }
1324
1325    return result;
1326}
1327
1328function dateComma(text){
1329    return text.replace(/(\d{4})(\d{2})(\d{2})/, "$1.$2.$3.")
1330}
1331
1332function dateBar(text){
1333    return text.replace(/(\d{4})(\d{2})(\d{2})/, "$1-$2-$3")
1334}
1335
1336function compareDateTime(dateTimeString) {
1337    const year = parseInt(dateTimeString.slice(0, 4));
1338    const month = parseInt(dateTimeString.slice(4, 6)) - 1;
1339    const day = parseInt(dateTimeString.slice(6, 8));
1340    const hour = parseInt(dateTimeString.slice(8, 10));
1341    const minute = parseInt(dateTimeString.slice(10, 12));
1342    const targetDate = new Date(year, month, day, hour, minute);
1343    const currentDate = new Date();
1344
1345    return targetDate.getTime() < currentDate.getTime();
1346}
1347function isDziFile(filename) {
1348    return filename.startsWith('dzi') && filename.length === 16 && !isNaN(filename.substring(3));
1349}
1350
1351function setListView() {
1352    let max_desc_width = 0;
1353    $('.post-text-list > li > .desc').each(function() {
1354        let range = document.createRange();
1355        range.selectNodeContents(this);
1356        let textWidth = range.getBoundingClientRect().width;
1357        if (textWidth > max_desc_width) {
1358            max_desc_width = textWidth;
1359        }
1360    });
1361    $('.post-text-list > li > .desc').css('width', max_desc_width);
1362
1363
1364    let max_date_width = 0;
1365    $('.post-text-list > li > .date').each(function() {
1366        let range = document.createRange();
1367        range.selectNodeContents(this);
1368        let textWidth = range.getBoundingClientRect().width;
1369        if (textWidth > max_date_width) {
1370            max_date_width = textWidth;
1371        }
1372    });
1373    $('.post-text-list > li > .date').css('width', max_date_width);
1374}
1375
1376function timeOver(id,lang){
1377
1378    if(lang === 'kor'){
1379        $('#error-'+id).val('인증시간이 초과되었습니다.')
1380    }
1381    else if(lang === 'eng'){
1382        $('#error-'+id).val('Authentication timed out.')
1383    }
1384}
1385
1386function sendEmailCode(data,id,old){
1387    timeTemp = true
1388    timeCheck = 20
1389    var min = "";
1390    var sec = "";
1391    var timer = setInterval(function () {
1392        if(timeTemp) {
1393            min = parseInt(timeCheck / 60);
1394            sec = timeCheck % 60
1395            var sec2 = sec.toString()
1396            if (sec2.length === 1) {
1397                sec2 = "0" + sec2
1398            }
1399
1400            document.getElementById("timer-"+id).innerHTML = min + ":" + sec2;
1401            timeCheck--;
1402
1403            if (timeCheck < 0) {
1404                clearInterval(timer);
1405                document.getElementById("timer-"+id).innerHTML = '<sp:message code="member.find.email.timeover"/>';
1406                $('#checkCode'+id).prop('disabled', true);
1407
1408            }
1409        }
1410    }, 1000);
1411    $('#code-'+id).attr('disabled',false)
1412    $('#codeCheck-'+id).attr('disabled',false)
1413
1414
1415    var url = '/api/auth/join/code'
1416    if(old === 'old') url += '/old'
1417
1418    $.ajax({
1419        url        : url,
1420        type       : 'post',
1421        data: JSON.stringify(data),
1422        contentType : 'application/json',
1423        success:function(res) {
1424            console.log(res)
1425            if(res.code === 0){
1426                $('#seq-'+id).val(res.data)
1427                // openAlert({type: 'alert', message: res.message})
1428            }
1429            else if(res.code === -1){
1430                openAlert({type: 'alert', message: res.message})
1431            }
1432
1433        },
1434        error: function(error) {
1435            console.log(error);
1436            openAlert({type: 'alert', message: '<sp:message code="common.email.alert3"/>'})
1437            $('#code'+id).attr('disabled',true)
1438            $('#codeCheck'+id).attr('disabled',true)
1439            timeTemp = false
1440            timeCheck = 240
1441        },
1442    });
1443}
1444
1445function codeCheckEmail(data,id,callback,msg){
1446
1447
1448    $('#codeCheck-'+id).attr('disabled',true)
1449
1450    $.ajax({
1451        url        : '/api/auth/join/verify',
1452        type       : 'post',
1453        data: JSON.stringify(data),
1454        contentType : 'application/json',
1455        success:function(res) {
1456            console.log(res)
1457            if(res.code === 0){
1458                openAlert({type: 'alert', message: '<sp:message code="common.email.alert4"/>', callback: () => callback()})
1459            }
1460            else if(res.code === -1){
1461                alert('<sp:message code="common.email.alert6"/>');
1462                $('#codeCheck-'+id).attr('disabled',false)
1463            }
1464
1465        },
1466        error: function(error) {
1467            console.log(error);
1468            openAlert({type: 'alert', message: '<sp:message code="common.email.alert2"/>'})
1469            $('#codeCheck-'+id).attr('disabled',false)
1470        },
1471    });
1472
1473}
1474
1475function setNum(obj){
1476    val = obj.value;
1477    re = /[^0-9]/gi;
1478    obj.value = val.replace(re, "");
1479}
1480
1481
1482const regEmail =  /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/
1483function regEmailCheck(email){
1484    return regEmail.test(email)
1485}
1486
1487function getFileName(fullFileName) {
1488    if(!fullFileName) return "";
1489
1490    let prefix = fullFileName.split("_")[0];
1491    let fileName = "";
1492
1493    if((prefix.length === 13 && !isNaN(prefix)) || isDziFile(prefix)) {
1494        fileName = fullFileName.replace(prefix + "_", "");
1495    } else {
1496        fileName = fullFileName;
1497    }
1498
1499    const dotIdx = fileName.lastIndexOf('.');
1500    if(dotIdx > -1) fileName = fileName.substring(0, dotIdx);
1501
1502    return fileName;
1503}
1504
1505function getCookie(cookie_name) {
1506    var x, y;
1507    var val = document.cookie.split(';');
1508
1509    for (var i = 0; i < val.length; i++) {
1510        x = val[i].substr(0, val[i].indexOf('='));
1511        y = val[i].substr(val[i].indexOf('=') + 1);
1512        x = x.replace(/^\s+|\s+$/g, ''); // 앞과 뒤의 공백 제거하기
1513        if (x == cookie_name) {
1514            return unescape(y); // unescape로 디코딩 후 값 리턴
1515        }
1516    }
1517}
1518
1519
1520function detectMobileDevice(agent) {
1521    const mobileRegex = [
1522        /Android/i,
1523        /iPhone/i,
1524        /iPad/i,
1525        /iPod/i,
1526        /BlackBerry/i,
1527        /Windows Phone/i
1528    ]
1529
1530    return mobileRegex.some(mobile => agent.match(mobile))
1531}
1532
1533
1534function mobile(){
1535    $('#ALLAT_MOBILE_PAY').css({"height":"1000px"})
1536    $('#ALLAT_MOBILE_PAY').css({"z-index":"100000"})
1537    window.scrollTo(0,0);
1538}
1539
1540function modalOpen(e) {
1541    focusedElement = document.activeElement;
1542    const target_modal = '#' + e;
1543    $(target_modal).fadeIn(300);
1544    $(target_modal + " > .pop-wrap").scrollTop(0);
1545    /*$(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, .pop-wrap, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").attr('tabindex', '0');
1546    $(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, .pop-wrap, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").first().focus();*/
1547    /*$(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").attr('tabindex', '0');
1548    $(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").first().focus();*/
1549	$(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").attr('tabindex', '0');    // 레이어 팝업 첫 포커스 X버튼에 포커스 안가게 처리 - 2026-04-03
1550    $(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").first().focus();
1551    $('body').addClass('popup-open');
1552    $('body').css('overflow', 'hidden');
1553    ariaHidden();
1554}
1555
1556function modalClose(e) {
1557    const target_modal = typeof e === "string" ? $('#' + e) : $(e).closest('.popup');
1558    /*target_modal.find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, .pop-wrap, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").attr('tabindex', '-1');*/
1559    target_modal.find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").attr('tabindex', '-1');
1560    target_modal.hide();
1561    if($(".popup:visible").length > 0) {
1562        /*$(".popup:visible").find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, .pop-wrap, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").first().focus();*/
1563        $(".popup:visible").find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").first().focus();
1564    } else {
1565        $('body').removeClass('popup-open');
1566        $('body').css('overflow', 'auto');
1567        $(focusedElement).focus();
1568    }
1569    ariaHidden();
1570}
1571
1572
1573const focusStack = [];
1574
1575function modalOpen2(e) {
1576    const focusedElement = document.activeElement;
1577	focusStack.push(focusedElement);  // 현재 포커스를 스택에 저장
1578
1579	const target_modal = typeof e === "string" ? $('#' + e) : $(e);
1580    $(target_modal).fadeIn(300);
1581	$(target_modal).find(".pop-wrap").scrollTop(0);
1582    
1583    //$(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, .svg-ic-close, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").attr('tabindex', '0').first().focus();
1584	$(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").attr('tabindex', '0');    // 레이어 팝업 첫 포커스 X버튼에 포커스 안가게 처리 - 2026-04-08
1585	$(target_modal).find('a, button, input:not(:radio, :checkbox), textarea, select, :radio + label, :checkbox + label, iframe').not(":disabled, :hidden").first().focus();
1586    
1587    $('body').addClass('popup-open');
1588    $('body').css('overflow', 'hidden');
1589    ariaHidden();
1590	
1591	$(target_modal).find(".svg-ic-close").click(function(e){
1592		const lastFocused = focusStack.pop();
1593		if (lastFocused && typeof lastFocused.focus === "function") {
1594			lastFocused.focus();
1595		}
1596    });
1597}
1598
1599function modalClose2(e) {
1600    const target_modal = typeof e === "string" ? $('#' + e) : $(e).closest('.popup');
1601    target_modal.hide();
1602	
1603	const lastFocused = focusStack.pop();
1604	if (lastFocused && typeof lastFocused.focus === "function") {
1605		lastFocused.focus();
1606	}
1607	
1608	if($(".popup:visible").length === 0) {
1609		$('body').removeClass('popup-open');
1610		$('body').css('overflow', 'auto');
1611	}
1612		
1613    ariaHidden();
1614}
1615
1616
1617function errorMsg2(msg){
1618    openAlert({type: 'alert', message: msg, callback: function (){ history.back() }})
1619}
1620
1621function enterClick(e) {
1622    if (e.key === "Enter" || e.key === " " || e.key === "Spacebar") {
1623        e.preventDefault();
1624        $(this).trigger("click");
1625    }
1626}
1627
1628function getBackgroundSvg(name, leeumColorIdx, hoamColorIdx) {
1629    return svgUrl[name][0] + currentColorSet[leeumFlag ? leeumColorIdx : hoamColorIdx].replace("#", "%23") + svgUrl[name][1];
1630}
1631
1632function changeSelectFontColor(target) {
1633    if ($(target).attr('option-changed')) {
1634        if(currentColorSet) $(target).css('color', currentColorSet[leeumFlag ? 9 : 8]);
1635    } else {
1636        $(target).css('color', '');
1637    }
1638}
1639
1640function changeLogoColor(e) {
1641    if($('.notice-popup:visible').length) return;
1642    const foundColor = leeumFlag ? "leeum-text400" : "hoam-text-black";
1643    if(window.scrollY > 0 || $(".background").css("display") === "block") {
1644        $("header > h1 > svg path").css("fill", "var(--" + foundColor + ")");
1645        $("header .gnb-wrap a").css("color", "var(--" + foundColor + ")");
1646		
1647		//if (foundColor == "leeum-text400") {
1648		//	$('header svg').addClass('svg-leeum-black');
1649		//}
1650    } else {
1651        const logoColor = $(e.slides[e.activeIndex]).find(".logoColor").text();
1652        $("header > h1 > svg path").css("fill", logoColor);
1653        $("header .gnb-wrap a").css("color", logoColor);
1654		
1655		//alert(logoColor);
1656		//if (logoColor == "#000") {        // 메인 로고 색상 - black - 2025-07-07
1657		//	$('header svg').removeClass('svg-leeum-white');
1658		//	$('header svg').addClass('svg-leeum-black');
1659		//}
1660		//else if (logoColor == "#fff") {   // 메인 로고 색상 - white - 2025-07-07
1661		//	$('header svg').removeClass('svg-leeum-black');
1662		//	$('header svg').addClass('svg-leeum-white');
1663		//}
1664		
1665		if(location.pathname === "/leeum") {
1666			if (logoColor == "#000") {        // 메인 로고 색상 - black - 2025-07-21
1667				$('header svg').removeClass('svg-leeum-white');
1668				$('header svg').addClass('svg-leeum-black');
1669				
1670				$("#ic-change-icon").removeClass("svg-leeum-black");  // 언어교체 이미지 스타일 제거 - 2026-01-12
1671			}
1672			else if (logoColor == "#fff") {   // 메인 로고 색상 - white - 2025-07-21
1673				$('header svg').removeClass('svg-leeum-black');
1674				$('header svg').addClass('svg-leeum-white');
1675				
1676				$("#ic-change-icon").removeClass("svg-leeum-white");  // 언어교체 이미지 스타일 제거 - 2026-01-12
1677			}
1678		}
1679
1680		if(location.pathname === "/hoam") {
1681			if (logoColor == "#000") {        // 메인 로고 색상 - black - 2026-01-23
1682	            $(".hoam-emblem > path").css("fill", "var(--hoam-text-black)");
1683			}
1684			else if (logoColor == "#fff") {   // 메인 로고 색상 - white - 2026-01-23
1685				$(".hoam-emblem > path").css("fill", "var(--hoam-white)");
1686			}
1687        }
1688    }
1689}
1690
1691function resetFocus() {
1692    $('body').one('keydown', function(e) {
1693        if (e.key === 'Tab' && !e.shiftKey) {
1694            e.preventDefault();
1695            const focusableEls = $('a[href], area[href], input, select, textarea, button, iframe, object, embed, *[tabindex], *[contenteditable]').not('[tabindex=-1], [disabled], :hidden');
1696            focusableEls.first().focus();
1697        } else {
1698            resetFocus();
1699        }
1700    });
1701}
1702
1703function ariaHidden() {
1704    if($('.menu-wrap .custom').hasClass('active')) {
1705        $(".popup, header, footer, .container > *:not(script, .custom-wrap, .menu-wrap)").attr('aria-hidden', 'true');
1706        $(".custom-wrap").attr('aria-hidden', 'false');
1707    } else if($('.menu-wrap .menu').hasClass('active')) {
1708        $(".popup, header, footer, .container > *:not(script, .page-gnb-wrap, .menu-wrap)").attr('aria-hidden', 'true');
1709        $(".page-gnb-wrap").attr('aria-hidden', 'false');
1710    } else if($(".popup:visible").length > 0) {
1711        $(".popup, header, footer, .container > *:not(script, .menu-wrap)").attr('aria-hidden', 'true');
1712        $(".popup:visible").first().attr('aria-hidden', 'false');
1713    } else {
1714        $(".custom-wrap, .page-gnb-wrap, .popup").attr('aria-hidden', 'true');
1715        $("header, footer, .container > *:not(script, .menu-wrap, .custom-wrap, .page-gnb-wrap, .popup)").attr('aria-hidden', 'false');
1716    }
1717}
1718
1719function btnAriaLabel() {
1720    $('li > button:not(.folding-head)').each(function() {
1721        const label = $(this).attr("aria-label");
1722        if(label) {
1723            if ($.cookie('lang') === "kor") {
1724                $(this).attr("aria-label", label.replace(" 선택됨", ""));
1725            } else {
1726                $(this).attr("aria-label", label.replace(" Selected", ""));
1727            }
1728        }
1729    });
1730
1731    $('li > .active:not(.folding-head), .active > button:not(.folding-head)').each(function() {
1732        const btn = $(this);
1733        const label = btn.attr("aria-label");
1734        const txt = label ? label : btn.text();
1735        if ($.cookie('lang') === "kor") {
1736            btn.attr('aria-label', txt + ' 선택됨');
1737        } else {
1738            btn.attr('aria-label', txt + ' Selected');
1739        }
1740    });
1741}
1742
1743function labelAriaLabel(label) {
1744    const input = label.prev();
1745    if(input.attr("type") === "checkbox") {
1746        if(input.prop("checked")) {
1747            label.attr("aria-checked", "false");
1748            if ($.cookie('lang') === "kor") {
1749                label.attr('aria-label', label.attr("aria-label").replace(" 선택됨", ""));
1750            } else {
1751                label.attr('aria-label', label.attr("aria-label").replace(' Selected', ""));
1752            }
1753        } else {
1754            label.attr("aria-checked", "true");
1755            if ($.cookie('lang') === "kor") {
1756                label.attr('aria-label', label.text() + ' 선택됨');
1757            } else {
1758                label.attr('aria-label', label.text() + ' Selected');
1759            }
1760        }
1761    } else if(input.attr("type") === "radio") {
1762        $("input[name=" + input.attr("name") + "] + label").removeAttr("aria-label");
1763        $("input[name=" + input.attr("name") + "] + label").removeAttr("aria-checked");
1764        label.attr("aria-checked", "true");
1765        if ($.cookie('lang') === "kor") {
1766            label.attr('aria-label', label.text() + ' 선택됨');
1767        } else {
1768            label.attr('aria-label', label.text() + ' Selected');
1769        }
1770    }
1771}
1772
1773function inputAriaLabel(input) {
1774    const label = input.next();
1775    if(input.attr("type") === "checkbox") {
1776        if(input.prop("checked")) {
1777            label.attr("aria-checked", "true");
1778            if ($.cookie('lang') === "kor") {
1779                label.attr('aria-label', label.text() + ' 선택됨');
1780            } else {
1781                label.attr('aria-label', label.text() + ' Selected');
1782            }
1783        } else {
1784            label.attr("aria-checked", "false");
1785            if ($.cookie('lang') === "kor") {
1786                label.attr('aria-label', label.attr("aria-label").replace(" 선택됨", ""));
1787            } else {
1788                label.attr('aria-label', label.attr("aria-label").replace(' Selected', ""));
1789            }
1790        }
1791    } else if(input.attr("type") === "radio") {
1792        $("input[name=" + input.attr("name") + "] + label").removeAttr("aria-label");
1793        $("input[name=" + input.attr("name") + "] + label").removeAttr("aria-checked");
1794        label.attr("aria-checked", "true");
1795        if ($.cookie('lang') === "kor") {
1796            label.attr('aria-label', label.text() + ' 선택됨');
1797        } else {
1798            label.attr('aria-label', label.text() + ' Selected');
1799        }
1800    }
1801}
1802
1803function alt(alt, title) {
1804    let result = alt;
1805    if(!result || result.trim() === "") result = title;
1806    if(!result) result = "";
1807
1808    return result
1809            .replaceAll(/&/g, '&amp;')
1810            .replaceAll(/</g, '&lt;')
1811            .replaceAll(/>/g, '&gt;')
1812            .replaceAll(/"/g, '&quot;')
1813            .replaceAll(/'/g, '&#39;');
1814}

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.