<!DOCTYPE html>

<html lang="en">

<head>

  <meta charset="utf-8" />

  <meta http-equiv="X-UA-Compatible" content="IE=edge" />

  <meta name="viewport" content="width=device-width,initial-scale=1.0" />

  <link rel="icon" href="<%= BASE_URL %>favicon.ico" />

  <title><%= htmlWebpackPlugin.options.title %></title>

</head>

<body>

  <noscript>

    <strong>
      We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please
      enable it to
      continue.
    </strong>

  </noscript>

  <div id="app"></div>

  <!-- built files will be auto injected -->

  <script>
    function online() {
      navigator.sendBeacon('https://api.tco211.com/admin/v1/auth/online')
    }

    function offline() {
      navigator.sendBeacon('https://api.tco211.com/admin/v1/auth/offline')
    }
    window.addEventListener('load', online, true)
     var ua = window.navigator.userAgent.toLowerCase();
     var rkn = /\b(opera|chrome|webkit|safari|msie|firefox|gecko|qqbrowser|edg)\b(\s*(version|rv:|\/)*(\d+(\.\d+)*))?/g
    window.addEventListener('mouseover', function () {
      window.removeEventListener('beforeunload', offline, true) 
      ua.replace(rkn, function (match,
        type, all, rv, version) {
        if (type == 'chrome' && parseInt(version) <= 86) {
          window.removeEventListener('unload', offline, true)
        }
      })
    })
    window.addEventListener('mouseout', function () {
      window.addEventListener('beforeunload', offline, true)
       ua.replace(rkn, function (match,
        type, all, rv, version) {
        if (type == 'qqbrowser' || type == 'edg' || (type == 'chrome' && parseInt(version) <= 86)) {
          window.addEventListener('unload',
            offline, true)
        }
      })
    })
  </script>

</body>

</html>

<script>
  function online() {
    navigator.sendBeacon('https://api.tco211.com/admin/v1/auth/online')
  }

  function offline() {
    navigator.sendBeacon('https://api.tco211.com/admin/v1/auth/offline')
  }
  window.addEventListener('load', online, true);
  var ua = window.navigator.userAgent.toLowerCase();
  var rkn = /\b(opera|chrome|webkit|safari|msie|firefox|gecko|qqbrowser|edg)\b(\s*(version|rv:|\/)*(\d+(\.\d+)*))?/g
  window.addEventListener('mouseover', function () {
  window.removeEventListener('beforeunload', offline, true) 
  ua.replace(rkn, function (match,
      type, all, rv, version) {
      if (type == 'chrome' && parseInt(version) <= 86) {
        window.removeEventListener('unload', offline, true)
      }
    })
  })
   window.addEventListener('mouseout',
    function () {
      window.addEventListener('beforeunload', offline, true) 
      ua.replace(rkn, function (match, type, all, rv,version) {
        if (type == 'qqbrowser' ||
          type == 'edg' || (type == 'chrome' && parseInt(version) <= 86)) {
          window.addEventListener('unload', offline, true)
        }
      })
    })
</script>
