anzhiyu-c / hexo-theme-anzhiyu

安知鱼主题,这是一个简洁美丽的hexo主题。
GNU General Public License v3.0
1.31k stars 202 forks source link

[Bug]: 右键菜单复制歌曲名为无 #196

Closed YL2209 closed 7 months ago

YL2209 commented 8 months ago

使用的 AnZhiYu 版本? | What version of AnZhiYu are you use?

1.6.12

使用的浏览器? || What browse are you using?

Chrome

是否修改过主题文件? || Has the theme files been modified?

是 (Yes)

使用的系统? || What operating system are you using?

Windows

问题描述 | Describe the bug

修改原有函数musicGetName:

  //获取音乐中的名称
  musicGetName: function () {
    // 使用querySelectorAll选择类名为"aplayer-title"的所有元素
    var elements = document.querySelectorAll(".aplayer-title");
    // 初始化一个数组来存储音乐标题
    var arr = [];
    // 遍历所有找到的元素
    for (var i = 0; i < elements.length; i++) {
      // 将每个元素的innerText添加到数组中
      arr[i] = elements[i].innerText;
    }
    // 返回数组中的第一个元素作为默认的音乐名称
    return arr[0];
  }

出现问题的网站 | Website

https://www.naokuo.top

anzhiyu-c commented 7 months ago

感谢。