PageSourceSearch

https://0404.go.kr/js/commons/common_ui_front.js

js 0404.go.kr collected 2026-10-02 04:01:09 UTC 10,713 bytes, 283 lines download raw bytes

1document.addEventListener('DOMContentLoaded', ()=>{
2    //console.log("common_ui_front start");
3
4    // nav 에 href를 세팅한다.
5/*    document.querySelectorAll('.moveMenuContsUrl').forEach(menu => {
6        const menuNo = menu.dataset.menuNo;
7
8        if(isNull(menuNo)) return;
9        if(menu.href !== 'javascript:void(0);' || isNull(menu.href)) return; //href에 값이 있으면 정지
10
11        // 클릭한 tobNav에서 가장 가까운 url매칭 메뉴를 찾는다.
12        let childMenu = findChildMenu(menuNo);
13        if(isNull(childMenu)) return;
14        while (isNull(childMenu.contsUrl)) {
15            childMenu = findChildMenu(childMenu.menuNo);
16            if(isNull(childMenu)) return;
17        }
18        menu.href = childMenu.contsUrl;
19    })*/
20
21
22    // post url이동
23    document.querySelectorAll('.moveUrlDo, .moveUrlDo2').forEach(e => e.addEventListener('click', (event)=>{
24        event.stopPropagation();
25        const target = event.currentTarget;
26        const data = target.dataset;
27        const url = data.url;
28        Reflect.deleteProperty(data, 'url');
29        submitForm(url,{data : data, method : "POST"});
30    }));
31
32    // jquery datepicker세팅
33    if($(".datepicker").length > 0){
34        $(".datepicker").datepicker({
35            dateFormat: "yy-mm-dd",  // 날짜 형식 (yyyy-MM-dd)
36            changeMonth: true,       // 월 선택 가능
37            changeYear: true,        // 연도 선택 가능
38            yearRange: "2000:2030",   // 선택 가능 연도 범위
39            dayNames: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"], // 요일 전체 이름
40            dayNamesMin: ["일", "월", "화", "수", "목", "금", "토"], // 요일 축약 이름
41            monthNames: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], // 월 전체 이름
42            monthNamesShort: ["1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"], // 월 축약 이름
43            prevText: "이전",
44            nextText: "다음",
45            currentText: "오늘",
46            closeText: "닫기",
47            showOn : "both",
48            buttonImage : "/images/front/ico_calendar.svg",
49            buttonImageOnly : false,
50        });
51    }
52
53    // loading-link 클래스를 입력하면 로딩바를 보여준다.
54    document.querySelectorAll(".loading-link").forEach((link) => {
55        link.addEventListener("click", () => {
56            console.log("a태그 클릭으로 화면 이동시 로딩바 보여주기")
57            showLoading();
58        });
59    });
60
61    // 동적 이벤트 바인딩, 팝업창 닫기
62    document.body.addEventListener('click',(event)=>{
63        if(!event.target.closest("button.js_close_pop")) return;
64        if(!isNull(document.querySelector('.dim'))){
65            document.querySelector('.dim').style.display = 'none';
66        }
67        event.target.closest('.basic_pop').style.display='none';
68    });
69
70    // 동적 이벤트 바인딩, side nav를 열고 닫기
71    document.querySelectorAll('.snb').forEach(e => e.addEventListener('click',(event)=>{
72        if(!event.target.matches('.btn-toggle-side-nav')) return;
73        event.preventDefault();
74        const target = event.target;
75        const targetParent = event.target.parentNode;
76
77        if(target.classList.contains("active")){
78            target.classList.remove("active");
79        } else {
80            target.classList.add("active");
81        }
82    }));
83
84    // url 공유 버튼
85    document.querySelectorAll('.urlShareBtn').forEach(e=> e.addEventListener('click', ()=>{
86        copyCurrentUrlToClipboard();
87    }));
88
89    // 프린트 버튼
90    document.querySelectorAll('.printBtn').forEach(e=> e.addEventListener('click', ()=>{
91        window.print();
92    }));
93
94    // 위기상황별 대처매뉴얼
95    if(window.location.pathname === '/bbs/contsPst/MST0000000000125/25/detail'){
96        const hash = window.location.hash;
97         setTimeout(() => {
98            handleHashNavigation();
99        }, 10);
100
101
102        // 해시 변경 시 (뒤로가기/앞으로가기, 수동 hash 변경)
103        window.addEventListener("hashchange", handleHashNavigation);
104
105        function handleHashNavigation() {
106            const hash = window.location.hash;
107            if (!hash) return;
108
109            const anchor = document.querySelector(`a[href="${hash}"]`);
110            if (anchor){
111                anchor.click();
112            }
113        }
114    }
115
116    // 단계별 여행경보
117    if(window.location.pathname === '/travelAlert/apntStatus/stepTravelAlert'){
118        const hash = window.location.hash;
119        if (hash) {
120            const anchor = document.querySelector(`a[href="${hash}"]`); // <a href="#someId"> 찾기
121            if (anchor) {
122                setTimeout(()=>{
123                    anchor.click();
124                },50)
125            }
126            //if (anchor)anchor.click();
127        }
128    }
129
130
131    // 뒤로가기를 감지하여 로딩바를 지운다. (뒤로가기시 로딩바가 남아있는 경우가 있음)
132    window.addEventListener("pageshow", (event) => {
133        if (event.persisted) {
134            console.log('pageshow 뒤로가기 감지')
135            showLoading(false);
136        }
137    });
138    window.addEventListener("popstate", (event) => {
139        console.log('popstate 뒤로가기 감지')
140        showLoading(false);
141    });
142    document.addEventListener("visibilitychange", () => {
143        console.log('visibilitychange 뒤로가기 감지')
144        showLoading(false);
145    });
146    //"페이지를 떠나기 직전" 이벤트를 감지
147    window.addEventListener("beforeunload", () => {
148        console.log('beforeunload 페이지 떠남 감지')
149        isUnloading = true;
150    });
151});
152//"페이지를 떠나기 직전" 이벤트 여부
153let isUnloading = false;
154
155/*
156function findChildMenu(menuNo){
157    const allMenuListCheck = allMenuList.filter(menu => menu.upMenuNo == menuNo);
158    if(Array.isArray(allMenuListCheck) && allMenuListCheck.length > 0){
159        return allMenuListCheck[0]
160    }
161    return null;
162}
163*/
164
165/*
166let menuAuthList = null;
167
168document.addEventListener('DOMContentLoaded', ()=>{
169    const headerGnb = document.querySelector('#header_gnb');
170    if(headerGnb === null) return;
171    setMenuAuthList();
172});
173
174
175function callMenuAuthList(){
176    return fetchWrapper("/cmm/menu/authList");
177}
178
179function setMenuAuthList(){
180    fetchWrapper("/cmm/menu/authList")
181        .then(data=>{
182            if (isNull(data)) {
183                console.error("메뉴 데이터 호출 실패");
184                return;
185            }
186
187            menuAuthList = data;
188
189            const menuLvl1List = menuAuthList.filter(menu => menu.menuLvl === "1");
190            const menuLvl2List = menuAuthList.filter(menu => menu.menuLvl === "2");
191            const menuLvl3List = menuAuthList.filter(menu => menu.menuLvl === "3");
192
193            const headerGnb = document.querySelector('#header_gnb');
194            if(headerGnb === null) return;
195            headerGnb.innerHTML = null;
196            headerGnb.insertAdjacentElement('beforeend', document.createElement('ul'))
197
198            const gnbLvl1 = headerGnb.querySelector('ul')
199            gnbLvl1.innerHTML = null;
200
201            //
202            menuLvl1List.forEach((menu,index) => {
203                const liEl = document.createElement('li');
204                const url = isNull(menu.menuUrl) ? "javascript:void(0);" : menu.menuUrl;
205                liEl.innerHTML = `<a href="${url}" data-menu-no="${menu.menuNo}">${menu.menuNm}</a>`;
206                gnbLvl1.insertAdjacentElement('beforeend', liEl);
207            });
208
209            const lnbLvl2 = document.querySelector('#left_lnb');
210
211            const menuLvl2ListSelect = menuLvl2List.filter(menu => menu.upMenuNo == "20");
212            menuLvl2ListSelect.forEach((menu, index)=>{
213                const menuUrl = menu.menuUrl;
214                const menuNo = menu.menuNo;
215                const menuNm = menu.menuNm;
216
217                const liEl = document.createElement('li');
218                liEl.setAttribute("class", "on");
219
220                const url = isNull(menuUrl) ? "javascript:void(0);" : menuUrl;
221                liEl.innerHTML = `<a href="${url}" data-menu-no="${menuNo}">${menuNm}</a>`;
222                if(isNull(menuUrl)){
223                    liEl.innerHTML += `<ul class="depth2 menu_depth2" data-menu-no="${menuNo}"></ul>`;
224                }
225
226                lnbLvl2.insertAdjacentElement('beforeend', liEl);
227            });
228
229            const lnbLvl3 = document.querySelectorAll('.menu_depth2');
230            lnbLvl3.forEach((upMenu,index)=>{
231                const upMenuNo = upMenu.dataset.menuNo
232                const menuLvl3ListSelect = menuLvl3List.filter(menu => menu.upMenuNo == upMenuNo);
233                menuLvl3ListSelect.forEach((menu3, index)=> {
234                    const menu
234Url = menu3.menuUrl;
235                    const menuNo = menu3.menuNo;
236                    const menuNm = menu3.menuNm;
237                    const url = urlNullCheck(menuUrl);
238
239                    upMenu.innerHTML += `<li><a href="${url}" data-menu-no="${menuNo}">${menuNm}</a></li>`;
240                })
241            });
242        }).catch(error => {
243            console.error("setMenuAuthList error");
244        });
245
246    function urlNullCheck(menuUrl) {
247        return isNull(menuUrl) ? "javascript:void(0);" : menuUrl;
248    }
249}
250
251console.log("common_ui.js on!")*/
252// nav 클릭하여 메뉴 이동
253/*document.querySelectorAll('.moveMenuContsUrl').forEach(menu => {
254    menu.addEventListener('click', (e) => {
255
256        const target = e.currentTarget;
257        const menuNo = target.dataset.menuNo;
258        const contsUrl = target.dataset.contsUrl;
259
260        if(isNull(menuNo)){
261            return;
262        }
263
264        showLoading(); // 로딩바
265        if(!isNull(contsUrl)){
266            location.href = contsUrl;
267            return;
268        }
269
270        // 클릭한 tobNav에서 가장 가까운 url매칭 메뉴를 찾아서 이동한다.
271        let childMenu = findChildMenu(menuNo);
272        while (isNull(childMenu.contsUrl)) {
273            childMenu = findChildMenu(childMenu.menuNo);
274            if(isNull(childMenu)){
275                showLoading(false);
276                return; // childMenu가 null이면 정지
277            }
278        }
279        //console.log(childMenu);
280
281        location.href = childMenu.contsUrl;
282    });
283})*/

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.