Commit 9107f981 authored by minseok.park's avatar minseok.park

세션 여부에 따른 홈페이지 이동 및 dropdown 메뉴 변경

parent 826ca574
;(function () {
'use strict'
const logo = document.getElementById('logo')
function getCookie(name) {
let cookies = document.cookie.split(';')
for (let i = 0; i < cookies.length; i++) {
let cookie = cookies[i].trim()
if (cookie.startsWith(name + '=')) {
return cookie.substring(name.length + 1)
}
}
return null
}
document.addEventListener('DOMContentLoaded', function () {
let jsessionid = getCookie('JSESSIONID')
if (jsessionid) {
// JSESSIONID 쿠키 값이 있을 경우 추가할 a 태그 생성
let 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'
// 기존 BXM 링크 바로 아래에 삽입
let 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)
}
}
// 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/'
}
})
})
})()
<header class="header">
<nav class="navbar">
<div class="navbar-brand">
<a class="navbar-item" href="https://swlab.bwg.co.kr/">
{{!-- <a class="navbar-item" href="https://swlab.bwg.co.kr/"> --}}
<a id="logo" class="navbar-item">
<i class="navbar-logo"></i>
<div class="navbar-title-contents">
<span class="navbar-title">SWLab</span>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment