www.365okl.com Open in urlscan Pro
20.239.97.157  Public Scan

Submitted URL: http://www.365okl.com:8989/mobile-client/index/static/assets/js/init.js?v=5.1.3
Effective URL: https://www.365okl.com:8989/mobile-client/index/static/assets/js/init.js?v=5.1.3
Submission: On June 25 via api from US — Scanned from DE

Form analysis 0 forms found in the DOM

Text Content

/**
 * @description:
 *
 * @author: nick
 *
 * @create: 2019-06-26 11:03
 **/
var handlerError = function(msg, show) {
  if (msg.indexOf('Script error.') != -1) {
    return
  }
  if (msg.indexOf('Unexpected token <') != -1) {
    document.getElementById('loading-text').innerText =
      'The site is currently overcrowded, please try again'
  }
  if (show) {
    document.getElementById('loading-text').innerText = msg
  }
}
onerror = handlerError

function redirectIfm(homePage) {
  var siteId = sessionStorage.getItem('siteId') || '71'
  if (window.location.pathname.indexOf('/mobile-client/') != -1) {
    document.getElementById('ifrm').src =
      window.location.origin +
      '/mobile-client/' +
      homePage +
      '?td_channelid=' +
      siteId
  } else {
    document.getElementById('ifrm').src =
      window.location.origin + '/' + homePage + '?td_channelid=' + siteId
  }
}

/**
 * 模版初始化
 * @param isFrame
 */
function initPage(isFrame) {
  if (!sessionStorage) {
    handlerError(
      'The browser version is too low, please upgrade the browser version!',
      true
    )
  }
  var templateType = sessionStorage.getItem('templatePath')
  if (templateType) {
    //路径
    var hashPath = ''
    //获取hash路由
    var hashRoute = location.hash.replace('#', '')
    if (hashRoute !== '' && hashRoute !== '/') {
      hashPath = location.hash
    } else {
      if (sessionStorage.getItem('homePage')) {
        hashPath = '#' + sessionStorage.getItem('homePage')
      }
    }
    var siteId = sessionStorage.getItem('siteId') || '71'
    //定向到模版,拼接完整路径
    var homePath = templateType + '/index.html' + location.search
    var fullPath = templateType + '/index.html' + location.search + hashPath
    //拼接站点信息
    var siteParam = 'td_channelid=' + siteId
    document.getElementById('loading-text').innerText = 'loading'
    document.title = sessionStorage.getItem('siteName')
    //判断是否已含有参数
    var symbol = hashPath.indexOf('?') !== -1 ? '&' : '?'
    //判断是否已包含站点信息,并生成最终的路径(为了talkingData)
    var finalPath =
      fullPath.indexOf('td_channelid') !== -1
        ? fullPath
        : fullPath + symbol + siteParam
    //判断是否已有指定的
    var url =
      window.location.origin +
      (window.location.pathname.indexOf('/mobile-client/') !== -1
        ? '/mobile-client/'
        : '/') +
      finalPath
    console.log(url, '----------url')
    let hasHomePath = sessionStorage.getItem('hasHomePath')
    if (isFrame) {
      document.getElementById('ifrm').src = url
    } else {
      if (hasHomePath === true) {
        sessionStorage.setItem('hasHomePath', false)
        window.location.href =
          window.location.origin +
          (window.location.pathname.indexOf('/mobile-client/') !== -1
            ? '/mobile-client/'
            : '/') +
          homePath
      } else if (hashPath.indexOf('/home') == -1 && hasHomePath === null) {
        sessionStorage.setItem('hasHomePath', true)
        window.location.href = url
      } else {
        window.location.href = url
      }
    }
  } else {
    document.getElementById('loading-text').innerHTML =
      'Failed to load configuration file, please try again'
  }
}

function configError(isFrame) {
  if (isFrame) {
    document.getElementById('ifrm').style.display = 'none'
  }
  document.getElementById('loading-text').innerHTML =
    'Failed to load configuration file'
}

function iframeLoad(obj) {
  try {
    var url = obj.contentWindow.location.href
    if (url.indexOf('about:blank') !== -1) {
      document.getElementById('floatPanel').style.display = 'none'
    } else if (url.indexOf(window.location.origin + '/mobile-client/') === -1) {
      document.getElementById('floatPanel').style.display = ''
    } else {
      document.getElementById('floatPanel').style.display = 'none'
    }
  } catch (err) {
    document.getElementById('floatPanel').style.display = ''
  }
}

if (document.getElementById('msg')) {
  document.getElementById('msg').style.height = window.innerHeight - 146 + 'px'
}

function initConfig() {
  var request = new XMLHttpRequest()
  request.onreadystatechange = function(r) {
    if (request.readyState === 4) {
      if (request.status === 200) {
        if (request.getResponseHeader('headerStatus') === '607') {
          window.location.href = window.location.origin + '/__error_/607.html'
        }
        // if (request.getResponseHeader('headerStatus') === '605') {
        //   window.location.href = window.location.origin + '/__error_/605.html'
        // }
        var responseText = request.responseText
        if (responseText.indexOf('sessionStorage') != -1) {
          eval(responseText)
          initPage()
        } else {
          console.log(request.getResponseHeader('headerStatus') === '607')
          document.getElementById('loading-text').innerText =
            'The site is currently overcrowded, please try again'
        }
      } else {
        switch (request.status) {
          case 605:
            window.location.href = window.location.origin + '/__error_/605.html'
            break
          case 607:
            goMaintain()
            break
          default:
            document.getElementById('loading-text').innerText =
              'Failed to load configuration file, please try again'
            break
        }
      }
    }
  }
  request.open('GET', '/mobile-api/initConfig.js')
  request.setRequestHeader('X-Requested-With', 'XMLHttpRequest')
  request.send()
}

function goMaintain() {
  var request = new XMLHttpRequest()
  request.onreadystatechange = function(r) {
    if (request.readyState === 4) {
      if (request.status === 200) {
        var responseText = request.responseText
        document.body.innerHTML = responseText
      } else {
        document.getElementById('loading-text').innerText =
          'Maintenance page access failed,[' + request.status + ']'
      }
    }
  }
  request.open('GET', '/__error_/608info.html')
  //request.setRequestHeader('X-Requested-With', 'XMLHttpRequest')
  request.send()
}