PageSourceSearch

https://static.ggtour.or.kr/js/app/context.js

js ggtour.or.kr collected 2026-09-24 22:27:26 UTC 9,848 bytes, 349 lines download raw bytes

1// let environment = 'production'
2// let environment = 'development'
3let environment = 'local'
4
5let context = {
6  baseUrl: getBaseUrl(),
7  isDevelopment,
8}
9
10function getBaseUrl() {
11  if (localStorage.getItem('isProduction')) {
12    return 'https://ggtour.or.kr'
13  }
14  return location.origin
15}
16
17function getBaseStaticUrl() {
18  if (['localhost', 'd2j34t.ggtour.or.kr'].indexOf(location.hostname) !== -1) {
19    return `${location.origin}/resources`
20  }
21  return 'https://static.ggtour.or.kr'
22}
23
24function getBaseResourceUrl() {
25  return `${getBaseUrl()}/resource`
26}
27
28
29function getMySpotImageUrl() {
30  return `/resources/images/sub/img_notailor.png`
31}
32
33function getEmptyImageUrl() {
34  return Utils.isMobile() ? '/resources/images/no_image_mo.jpg' : '/resources/images/no_image_pc.jpg'
35}
36
37function getFullResourceUrlById(id) {
38  return `${getBaseResourceUrl()}/${id}`
39}
40
41function getFullResourceUrlByPath(path) {
42  return `${`https://image.ggtour.or.kr`}${path}`
43}
44
45function getWebResourceUrlByPath(path) {
46  return `${getBaseResourceUrl()}${path}`
47}
48
49function getGrandWebResourceUrlByPath(path) {
50    return `${getGrandResourceUrl()}${path}`
51}
52
53function getWebResourceViewUrlByPath(path) {
54  return `${getBaseResourceUrl()}/view${path}`
55}
56
57function downloadWebResourceUrlByPath(path) {
58  window.open(getWebResourceUrlByPath(path))
59}
60
61function getFullNamedResourceUrlByPath(path) {
62  return `${getBaseResourceUrl()}/content/named-file${path}`
63}
64
65function getFullResourceUrlByDatabaseContentId(id) {
66  return `${getBaseResourceUrl()}/thumbnail/db-content/${id}`
67}
68
69function getFullResourceUrlByContentId(id) {
70  return `${getBaseResourceUrl()}/thumbnail/content/${id}`
71}
72
73function getGrandFullResourceUrlByContentId(id) {
74    return `${getBaseResourceUrl()}/thumbnail/grand/content/${id}`
75}
76
77function getJsResourceUrlByPath(path) {
78  return `${getBaseStaticUrl()}/js${path || ''}`
79}
80
81function isDevelopment() {
82  return location.hostname !== 'ggtour.or.kr'
83}
84
85function getCurrentURL() {
86  let { pathname, search } = location
87  if (search) {
88    if (pathname.slice(-1) === '/') {
89      pathname = pathname.slice(0, -1)
90    }
91    return `${getBaseUrl()}${pathname}/${search}`
92  }
93  return `${getBaseUrl()}${pathname}`
94}
95
96function openExternalUrl(url) {
97  window.open(url)
98}
99
100function redirectMain() {
101  location.href = '/main'
102}
103
104function redirectUrl(url) {
105  location.href = url
106}
107
108function redirectLogin(isRedirectBeforeUrl) {
109  if (isRedirectBeforeUrl) {
110    Utils.addCookie('_url_from_auth', location.href, 30)
111  }
112  redirectUrl('/login')
113}
114
115function doShare() {
116  let shareUrl = location.href
117  if (shareUrl.match('my-travel')) {
118    shareUrl = shareUrl.replace('my-travel', 'share-travel')
119  }
120  document.querySelector('#sharepop .url').value = shareUrl
121  layerPopup.layerShow('sharepop')
122}
123
124function doPrint() {
125  window.print()
126}
127
128function doStar() {
129  if(!storage.getSnsId()) {
130    return redirectLogin()
131  } else {
132    const path = location.pathname;
133    if (path.includes("/travel-info/tourism-info/")) {
134      const activeBtn = document.querySelector("#btn-pop-star");
135      layerPopup.activeBtn = activeBtn;
136    }
137    layerPopup.layerShow('starreviewPop01')
138  }
139}
140
141function closeStarPopup() {
142  $("input:radio[name='rating']").prop("checked", false)
143  layerPopup.layerHide('starreviewPop01');
144}
145
146function closeCommentPopup() {
147  document.querySelector('#commentWritePop .comment-area textarea').value = ''
148  Utils.replaceHtml('#commentWritePop .comment-area span', '<span>0/200자</span>')
149  layerPopup.layerHide('commentWritePop')
150}
151
152function doGeoLocation() {
153  if (localStorage.getItem('location')) {
154    const expiryAt = JSON.parse(localStorage.getItem('location')).expiryAt
155    if (moment().isAfter(expiryAt)) {
156      layerPopup.layerShow('locationPop')
157      return
158    }
159    const elements = document.querySelectorAll('.header .header-wrap .btn_location')
160    for (let i = 0; i < elements.length; i++) {
161      const element = elements[i]
162      element.classList.remove("on")
163    }
164    localStorage.removeItem('location')
165    location.reload()
166  } else {
167    layerPopup.layerShow('locationPop')
168  }
169}
170
171function eventClose() {
172  return alert('이벤트가 종료되었습니다.')
173}
174
175function doWrite() {
176  if (Utils.isMobile()) {
177    layerPopup.layerShow('iddeletePop04')
178  } else {
179    location.href = `/my-page/story`
180  }
181}
182
183function doLink(linkUrl, fileUrl) {
184  if(fileUrl && !linkUrl) {
185    openExternalUrl(getWebResourceViewUrlByPath(`${fileUrl}`))
186  } else {
187    openExternalUrl(`${linkUrl}`)
188  }
189}
190
191function doAddContent({day}) {
192  document.querySelector('#tailorPop02').dataset.day = day
193  layerPopup.layerShow('tailorPop02')
194}
195
196function onCompleteGeoLocation() {
197  layerPopup.layerHide('locationPop')
198  if (_geoLocation.exists()) {
199    const elements = document.querySelectorAll('.header .header-wrap .btn_location')
200    for (let i = 0; i < elements.length; i++) {
201      const element = elements[i]
202      element.classList.add("on")
203    }
204    localStorage.setItem("location", _geoLocation.asJson())
205  }
206  if (typeof callbackCompleteGeoLocation !== 'undefined') {
207    callbackCompleteGeoLocation()
208  } else {
209    // location.reload()
210  }
211}
212
213function getContentUri({ id, type, dbCategory1, dbCategory2, diningCode }) {
214  let baseUri
215  switch (type) {
216    case 'GG_BUSINESS_FESTIVAL': baseUri = '/information/tourism'; break
217    case 'GG_MOVIE': baseUri = '/information/in-video'; break
218    case 'ETC_PHOTO': baseUri = '/information/gallery'; break
219    case 'ETC_EVENT': baseUri = '/information/event'; break
220    case 'ETC_EVENT_WINNER': baseUri = '/information/event#winner'; break
221    case 'ATICLE_COURSE': baseUri = '/recommend-travel/course'; break
222    case 'ATICLE_SPOTS': baseUri = '/recommend-travel/spots'; break
223    case 'ATICLE_STORY': baseUri = '/recommend-travel/story'; break
224    case 'ATICLE_VISIT': baseUri = '/recommend-travel/visit'; break
225    case 'ETC_SCHEDULE': baseUri = '/fit-travel/course'; break
226    case 'SERVICE_NOTICE': baseUri = '/service/notice'; break
227    case 'ETC_PUBLICATION': baseUri = '/travel-info/e-book'; break
228  }
229  if (dbCategory1) {
230    switch (dbCategory1) {
231      case 'D01': baseUri = '/travel-info/tourism-info'; break
232      case 'D02': baseUri = '/travel-info/accommodation'; break
233      case 'D03': baseUri = '/travel-info/restaurant'; break
234      case 'D04': baseUri = '/travel-info/festival'; break
235    }
236  }
237  if (diningCode) {
238    baseUri = '/travel-info/restaurant'
239  }
240  if (baseUri) {
241    return `${baseUri}/${id}`
242  }
243}
244
245/**
246 * 관광지/자연 카테고리 추가정보 항목
247 * - 이용시간 / 휴무일 / 주차정보 / 반려동물동반가능 / 이용시기 / 세계문화유산 / 세계자연유산 / 세계기록유산
248 *
249 * 문화시설 카테고리 추가정보 항목
250 * - 이용시간 / 휴무일 / 주차정보 / 반려동물동반가능
251 *
252 * 레포츠 카테고리 추가정보 항목
253 * - 이용시간 / 휴무일 / 주차정보 / 반려동물동반가능 / 개장기간
254 *
255 * 쇼핑 카테고리 추가정보 항목
256 * - 이용시간 / 휴무일 / 주차정보 / 반려동물동반가능 / 개장일 / 장서는날
257 *
258 * 숙박 카테고리 추가정보 항목
259 * - 입실시간 / 퇴실시간 / 주차시설 / 픽업서비스
260 *
261 * 축제/행사 카테고리 추가정보 항목
262 * - 행사장소 / 행사시작일 / 행사종료일 / 공연시간 / 관람가능연령
263 */
264function isUseContentInfo(key) {
265  const accommodation = ['checkInTime', 'checkOutTime', 'parkingInfo', 'pickupInfo']
266  const festival = ['eventPlace', 'eventStartDate', 'eventEndDate', 'spendtime', 'ageLimit']
267  return [
268    'useTime', 'openTime', 'restDate', 'parkingInfo', 'petInfo', 'openDate'
269    , 'openPeriod', 'fairDay', 'useSeason'
270    , 'cultureHeritage', 'naturalHeritage', 'documentaryHeritage',
271    ...accommodation,
272    ...festival
273  ].indexOf(key) !== -1
274}
275
276function findContentInfoLabel(key) {
277  const accommodation = {
278    checkInTime: '입실시간',
279    checkOutTime: '퇴실시간',
280    parkingInfo: '주차시설',
281    pickupInfo: '픽업서비스',
282  }
283  const festival = {
284    eventPlace: '행사장소',
285    eventStartDate: '행사시작일',
286    eventEndDate: '행사종료일',
287    spendtime: '공연시간',
288    ageLimit: '관람가능연령',
289  }
290  const map = {
291    carriageInfo: "유모차 대여 정보",
292    count: "수용 인원",
293    creditCardCheck: "신용카드 가능 정보",
294    experienceAge: "체험 가능 연령",
295    experienceGuide: "체험 안내",
296    cultureHeritage: "세계 문화유산",
297    naturalHeritage: "세계 자연유산",
298    documentaryHeritage: "세계 기록유산",
299    infoCenter: "문의 및 전화",
300    openDate: "개장일",
301    openPeriod: "개장기간",
302    fairDay: "장서는날",
303    restDate: "휴무일",
304    useTime: "이용시간",
305    openTime: "이용시간",
306    parkingInfo: "주차정보",
307    petInfo: "반려동물동반가능",
308    useSeason: "이용시기",
309    ...accommodation,
310    ...festival
311  }
312  return map[key]
313}
314
315function getTourismInfoSortOrder(key) {
316  switch (key) {
317    case 'useTime': return 1
318    case 'openTime': return 1
319    case 'restDate': return 2
320    case 'parkingInfo': return 3
321    case 'petInfo': return 4
322    case 'openDate': return 5
323    case 'openPeriod': return 6
324    case 'fairDay': return 7
325    case 'useSeason': return 8
326    case 'cultureHeritage': return 9
327    case 'naturalHeritage': return 10
328    case 'documentaryHeritage': return 11
329  }
330}
331
332function getAccommodationSortOrder(key) {
333  switch (key) {
334    case 'checkInTime': return 1
335    case 'checkOutTime': return 2
336    case 'parkingInfo': return 3
337    case 'pickupInfo': return 4
338  }
339}
340
341function getFestivalSortOrder(key) {
342  switch (key) {
343    case 'eventPlace': return 1
344    case 'eventStartDate': return 2
345    case 'eventEndDate': return 3
346    case 'spendtime': return 4
347    case 'ageLimit': return 5
348  }
349}

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.