document.documentElement.style.fontSize = (100 / 720 * 100) + 'vh'

window.addEventListener('load', function () {
  /**@type HTMLDivElement */
  var mark = document.querySelector('.mark')
  /**@type HTMLInputElement */
  var content = document.getElementById('content')
  /**@type HTMLInputElement */
  var tips = document.getElementById('tips')
  var btnOk = document.getElementById('btnok')

  var callback

  window.openInput = function (c, t, cb) {
    callback = cb
    content.value = c
    tips.innerText = t
    mark.style.display = 'block'
  }

  btnOk.addEventListener('click', function () {
    callback(content.value)
    close()
  })

  mark.addEventListener('click', function (e) {
    if (e.target == mark) {
      close()
    }
  })

  function close() {
    callback = null
    mark.style.display = 'none'
  }
})
