便捷查询

鼠标移动到头像可以便捷查看违规记录

< Feedback on 便捷查询

Review: OK - script works, but has bugs

§
Posted: 2023-04-04

// 这样改就行,在获取内容之后包装一层 FileReader

imgs.forEach(img => {
  img.addEventListener('mouseenter', function (e) {
    const uid = e.target.parentNode.href.match(/uid=(\d+)/)[1]
    if (uid) {
      let userInfoUrl = `https://www.52pojie.cn/home.php?mod=space&uid=${uid}&do=profile&from=space`
      fetch(userInfoUrl, {
        headers: { 'Content-Type': 'text/html;charset=gbk' },
      })
      .then(res => res.blob())
      .then(data => {
          let reader = new FileReader();
          reader.readAsText(data,"GBK")
          reader.onload = ()=>{
              let htmlString = reader.result;
              console.log(htmlString);
              const parser = new DOMParser()
              const pageHtml = parser.parseFromString(htmlString, 'text/html')
              showInfo(img, pageHtml.querySelector('#pcr'))
          }
      })
    } else {
      console.error('未匹配到uid')
    }
  })
})
§
Posted: 2023-04-04

Thanks♪(・ω・)ノ 大佬666

Post reply

Sign in to post a reply.