PageSourceSearch

https://smpa.go.kr/resource/js_2020/smpa_popup.js?ver=1

js smpa.go.kr collected 2026-10-02 17:44:48 UTC 1,996 bytes, 69 lines download raw bytes

1 // 쿠키 설정 함수
2  function setCookie(name, value, hours) {
3    const date = new Date();
4    date.setTime(date.getTime() + (hours * 60 * 60 * 1000));
5    document.cookie = `${name}=${value};expires=${date.toUTCString()};path=/`;
6  }
7
8  // 쿠키 가져오기
9  function getCookie(name) {
10    const cookies = document.cookie.split(';');
11    for (let c of cookies) {
12      const [key, val] = c.trim().split('=');
13      if (key === name) return val;
14    }
15    return null;
16  }
17
18  // 팝업 닫기 함수
19  function closePopup() {
20    if (document.getElementById('hideToday').checked) {
21      setCookie('hidePopupToday', 'Y', 24);  // 24시간 유지
22    }
23    document.getElementById('popup').style.display = 'none';
24  }
25  
26  /*기존 팝업 동작 소스 START*/
27  function popup_up(pop_id){
28		var $pop_id = $(pop_id);
29		
30		//쿠키에서 hideToday체크
31		const cookieName = 'hide_'+ pop_id;
32		if( getCookie(cookieName) !== 'Y'){
33			$pop_id.fadeIn(); // hide가 아니면 팝업출력
34		}
35
36		var $pop_idWidth = Math.floor($pop_id.outerWidth());
37		var $pop_idHeight = Math.floor($pop_id.outerHeight());
38		var docWidth = $(document).width();
39		var docHeight = $(document).height();
40
41		if($pop_idHeight < docHeight || $pop_idWidth < docWidth){
42			$pop_id.css({marginTop: -$pop_idHeight /2, marginLeft: -$pop_idWidth/2});
43		}else{
44			$pop_id.css({top: 0, left: 0});
45		}
46
47		//닫기버튼이벤트
48		$pop_id.find('.btn_pane a.btn-close').click(function(){
49			popup_close(pop_id,cookieName);
50		});
51		$pop_id.find('.close-x').click(function(){
52			popup_close(pop_id,cookieName);
53		});
54		
55		
56		
57  	}
58  	function popup_close(pop_id, cookieName){
59  		const $pop_id = $(pop_id);
60  		const checkbox = $pop_id.find('.hide-today');
61  		if( checkbox.is(':checked')){
62			setCookie(cookieName, 'Y', 1); // 24H동안 팝업을 띄우지 않음
63		}
64		$pop_id.fadeOut();
65		return false;
66  	}
67		/*기존 팝업 동작 소스 START*/		
68  
69  

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.