PageSourceSearch

https://forumup.org/js/area.js

js forumup.org collected 2026-10-02 04:12:36 UTC 2,085 bytes, 64 lines download raw bytes

1var watchId = null;
2
3function getLocation() {
4    if (navigator.geolocation) {
5        // 기존 요청이 있다면 중지
6        if (watchId !== null) {
7            navigator.geolocation.clearWatch(watchId);
8        }
9        
10        watchId = navigator.geolocation.watchPosition(
11            getPositionAndSetCookie,
12            handleError,
13            {
14                enableHighAccuracy: true,
15                timeout: 10000,
16                maximumAge: 0
17            }
18        );
19    } else {
20        alert('Geolocation을 지원하지 않는 브라우저입니다.');
21    }
22}
23
24function getPositionAndSetCookie(position) {
25    var latitude = position.coords.latitude;
26    var longitude = position.coords.longitude;
27    var cookieValue = latitude + ',' + longitude;
28    
29    console.log("위도:", latitude, "경도:", longitude); // 디버깅용 로그 추가
30    setCookie('user_location', cookieValue, 365);
31    
32    // 🚀 HTTPS 체크 후 리디렉션 실행
33    if (window.location.protocol === "https:") {
34        location.href = g5_bbs_url + '/board.php?mode=nearby';
35    } else {
36        alert("위치 정보를 가져오려면 HTTPS 환경에서 실행해야 합니다.");
37    }
38}
39
40function setCookie(name, value, exdays) {
41    var d = new Date();
42    d.setTime(d.getTime() + (exdays * 24 * 60 * 60 * 1000));
43    var expires = "expires=" + d.toUTCString();
44    document.cookie = name + "=" + value + ";" + expires + ";path=/";
45}
46
47function handleError(error) {
48    switch (error.code) {
49        case error.PERMISSION_DENIED:
50            alert("❌ 사용자 위치 권한이 거부되었습니다.");
51            break;
52        case error.POSITION_UNAVAILABLE:
53            alert("⚠ 위치 정보를 사용할 수 없습니다.");
54            break;
55        case error.TIMEOUT:
56            alert("⏳ 위치 정보 요청 시간이 초과되었습니다.");
57            break;
58        case error.UNKNOWN_ERROR:
59            alert("❓ 알 수 없는 오류가 발생했습니다.");
60            break;
61    }
62    
63    console.error("위치 정보 에러:", error);
64}

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.