1
0
DavidZhang73.github.io/js/loadaplayer.js

34 lines
1.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

var aplayerconf = "<!-- 我使用的APlayer本体 -->"
aplayerconf += "<div class=\"aplayer\" "
aplayerconf += "data-id=\"" + musiclist + "\" "
aplayerconf += "data-server=\"netease\" "
aplayerconf += "data-type=\"playlist\" "
aplayerconf += "data-fixed=\"true\" "
aplayerconf += "data-autoplay=\"false\" "
aplayerconf += "data-order=\"random\" "
aplayerconf += "data-volume=\"0.55\" "
aplayerconf += "data-preload=\"true\""
aplayerconf += "data-mutex=\"true\""
aplayerconf += "</div>"
aplayerconf += "<!--如果将本体放在body里面导致页面加载出现问题请尝试放到body体后面-->"
function removelrc() {
//检测是否存在歌词按钮
if (!document.querySelector(".aplayer-icon-lrc"))
return;
else
{
//触发以后立刻移除监听
document.removeEventListener("DOMNodeInserted",removelrc);
//稍作延时保证触发函数时存在按钮
setTimeout(function() {
//以触发按钮的方式隐藏歌词,防止在点击显示歌词按钮时需要点击两次才能出现的问题
document.querySelector(".aplayer-icon-lrc").click();
}, 1);
// console.log("success");
return;
}
}
document.addEventListener('DOMNodeInserted', removelrc)