Insert a div into the specified html code to wrap it


<script type="text/discourse-plugin" version="0.8">
  api.onPageChange(() => {
    // 查找所有具有 avatar 类的 img 元素
    const avatarImages = document.querySelectorAll('img.avatar');

    avatarImages.forEach(img => {
      // 创建一个新的 div 元素,并设置其类名为 by9700
      const wrapper = document.createElement('div');
      wrapper.className = 'by9700';

      // 将 img 元素移入到新的 div 中
      img.parentNode.insertBefore(wrapper, img);
      wrapper.appendChild(img);
    });
  });
</script>

It’s like this, but the code doesn’t take effect