console.log('crawl page', location.href)

chrome.runtime.onMessage.addListener(function (request, sender, sendResponse) {
  console.log(request)
  if (request.type === 'backgroundMessage' && request.target === 'offscreen') {
    const data = JSON.parse(request.data)
    if (data.frame) {
      document.getElementById('jd').src = data.frame.src
    }
  }
  // if (request.type === 'jd') {
  //   document.getElementById('jd').src = request.url
  // } else if (request.type === 'custom') {
  //   document.getElementById('custom').src = request.url
  // }
})
