10-check-offline.js 495 Bytes
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
/* eslint-disable no-undef */
;(function () {
  'use strict'

  const chatButton = document.querySelector('.sidebar .chat-btn')
  const menu = document.querySelector('.navbar-menu')

  // 네트워크 상태 확인 및 버튼 제어
  function checkIfLocalFile () {
    if (window.location.protocol === 'file:') {
      chatButton.style.display = 'none' // 오프라인 상태면 chatButton 숨김
      menu.style.display = 'none'
    }
  }

  // 초기 상태 설정
  checkIfLocalFile()
})()