PageSourceSearch

https://nosmokeguide.go.kr/resources/js/common.js

js nosmokeguide.go.kr collected 2026-10-01 12:07:15 UTC 4,382 bytes, 119 lines download raw bytes

1$(document).ready(function () {
2    // const target = $(".gnb-wrapper");
3    const target = $(".header-menu");
4    target.mouseover(function () {
5        $(".sub-gnb").stop().fadeIn("fast");
6        $(".gnb-bg").stop().fadeIn("fast");
7        $(".bg").stop().show();
8    });
9    target.mouseleave(function () {
10        $(".sub-gnb").stop().fadeOut("fast");
11        $(".gnb-bg").stop().fadeOut("fast");
12        $(".bg").stop().hide();
13    });
14
15    $('.btn').click((e) => {
16        $(e.currentTarget).attr("disabled", true);
17        setTimeout(() => {
18            $(e.currentTarget).attr("disabled", false);
19        }, 500)
20    })
21
22    if (IS_LOGGED_IN) {
23        startSessionCountdown();
24    }
25
26});
27
28// 세션 카운트다운 시작 함수
29const startSessionCountdown = async () => {
30    const updateTime = () => {
31        const expires = localStorage.getItem('integrate_expires');
32        const expiresSetSecond = localStorage.getItem('integrate_set_expires_second');
33        const nowSecond = getNowSeconds();
34
35        const second = nowSecond - expiresSetSecond;
36        const remainTime = expires - second;
37
38        // 남은 만료 시간이 1초 미만인 경우 logout
39        if (expires > 0 && -1 < remainTime < 1) {
40            const _logout = () => {
41                let sessionTimerId = Number(localStorage.getItem('integrate_session_timer_id'));
42                clearInterval(sessionTimerId); // 타이머 중지
43                sessionTimerId = null; // 타이머 ID 초기화
44                localStorage.removeItem('integrate_session_timer_id');
45                localStorage.removeItem('integrate_set_expires_second');
46                localStorage.removeItem('integrate_expires');
47                localStorage.removeItem('accessToken')
48                localStorage.removeItem('authInfo')
49                sessionStorage.removeItem('authInfo');
50                window.flutter_inappwebview?.callHandler("onSoldierLogout", 'onSoldierLogout');
51                window.location.href = `/main`;
52            }
53
54            const sessionTimerId = Number(localStorage.getItem('integrate_session_timer_id'));
55            clearInterval(sessionTimerId); // 타이머 중지
56            localStorage.removeItem('integrate_session_timer_id');
57            mlc_util.simpleModalAlert(`로그인 시간이 만료되어 자동 로그아웃 됩니다.`, _logout);
58        } else {
59            const formated = formatTime(remainTime);
60            $(".session-time").text(formated);
61        }
62
63    }
64
65    sessionTimerId = setInterval(updateTime, 1000);
66    localStorage.setItem('integrate_session_timer_id', sessionTimerId);
67};
68
69const getNowSeconds = () => {
70    const now = new Date();
71
72    return (now.getFullYear() * 12 * 30 * 24 * 3600 * 60) +
73        (now.getMonth() * 30 * 24 * 3600 * 60) +
74        (now.getDate() * 24 * 3600 * 60) +
75        (now.getHours() * 3600) +
76        (now.getMinutes() * 60) +
77        now.getSeconds();
78}
79
80
81// 초 단위를 "MM:SS" 형식으로 변환하는 함수
82const formatTime = (seconds) => {
83    const minutes = Math.floor(seconds / 60);
84    const remainingSeconds = seconds % 60;
85    return `${String(minutes).padStart(2, "0")}:${String(remainingSeconds).padStart(2, "0")}`;
86};
87
88// mobile gnb
89$(document).ready(function () {
90    const mobileActiveButton = $("#mobileGnbShow");
91    mobileActiveButton.click(function () {
92        $(".mobile-gnb-container").toggle("fade", "fast");
93    });
94    $("#mobileHeader .closed-button").click(function () {
95        $(".mobile-gnb-container").hide("fade", "fast");
96    });
97    $("#mobileHeader .active-button").click(function (e) {
98        $(e.target).toggleClass("active");
99        $(e.target).siblings(".toggle-area").toggle("100");
100    });
101    $(".sub-active-button").click(function (e) {
102        $(e.target).siblings(".sub-toggle-area").toggle("100");
103    });
104});
105
106function getMasking(id) {
107    if (!id) return '';
108    if (id === '-' || id === '*') return id;
109    if (id.length <= 2) return id.charAt(0) + "*";
110
111    const firstChar = id.charAt(0);
112    const lastChar = id.charAt(id.length - 1);
113    if (id.indexOf('-') !== -1 && id.split('-').length === 2) {
114        return id;
115    }
116    const maskedMiddle = '*'.repeat(id.length - 2);
117
118    return `${firstChar}${maskedMiddle}${lastChar}`;
119}

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.