09-session.js 1.61 KB
Newer Older
minseok.park's avatar
minseok.park committed
1 2
// ;(function () {
//   'use strict'
3

minseok.park's avatar
minseok.park committed
4
//   const logo = document.getElementById('logo')
5

minseok.park's avatar
minseok.park committed
6 7 8 9 10 11 12 13 14 15
//   function getCookie (name) {
//     const cookies = document.cookie.split(';')
//     for (let i = 0; i < cookies.length; i++) {
//       const cookie = cookies[i].trim()
//       if (cookie.startsWith(name + '=')) {
//         return cookie.substring(name.length + 1)
//       }
//     }
//     return null
//   }
16

minseok.park's avatar
minseok.park committed
17 18
//   document.addEventListener('DOMContentLoaded', function () {
//     const jsessionid = getCookie('JSESSIONID')
19

minseok.park's avatar
minseok.park committed
20 21 22 23 24 25
//     if (jsessionid) {
//       // JSESSIONID 쿠키 값이 있을 경우 추가할 a 태그 생성
//       const newLink = document.createElement('a')
//       newLink.className = 'navbar-item'
//       newLink.href = 'https://swlab.bwg.co.kr/web/docs/bxm/swlab-docs-bxm-s/current/concepts/overview.html'
//       newLink.textContent = 'BXM Concepts Overview'
26

minseok.park's avatar
minseok.park committed
27 28 29 30 31 32 33 34
//       // 기존 BXM 링크 바로 아래에 삽입
//       const bxmLink = document.querySelector(
//         '.navbar-dropdown .navbar-item[href="https://swlab.bwg.co.kr/web/docs/bxm/swlab-docs-bxm/current/index.html"]'
//       )
//       if (bxmLink) {
//         bxmLink.insertAdjacentElement('afterend', newLink)
//       }
//     }
35

minseok.park's avatar
minseok.park committed
36 37 38 39 40 41 42 43 44 45 46 47
//     // logo 클릭 이벤트
//     logo.addEventListener('click', function (event) {
//       if (jsessionid) {
//         // JSESSIONID 쿠키 값이 있을 경우
//         window.location.href = 'https://swlab.bwg.co.kr/web/dms/home'
//       } else {
//         // JSESSIONID 쿠키 값이 없을 경우
//         window.location.href = 'https://swlab.bwg.co.kr/web/main/'
//       }
//     })
//   })
// })()