修改了错别字,并且增设了更多调试点

This commit is contained in:
2022-05-05 01:00:56 +08:00
parent d8f19afa38
commit 5815832733

View File

@@ -5,20 +5,22 @@ window.onload = function(){
// 如果网页失去焦点,则改变标题 -- Writtrn By Copilot
window.onblur = function(){
oldTitle = document.title;
playchecker = setInterval(playstatChecking, 1000);
if(!document.getElementById("Player").paused){
changeTitle("playing");
}else if(nowplaying.songname != "" && nowplaying.artist != ""){
changeTitle("nowplaying");
}else{
//document.title = `[Pause]`;
}
bgplayChecker = setInterval(playstatChecking, 3000);
console.warn("Page checker started");
// if(!document.getElementById("Player").paused){
// changeTitle("playing");
// }else if(nowplaying.songname != "" && nowplaying.artist != ""){
// changeTitle("nowplaying");
// }else{
// //document.title = `[Pause]`;
// }
}
// 如果网页获得焦点,则改变标题 -- Writtrn By Copilot
window.onfocus = function(){
clearInterval(bgplayChecker);
console.warn("Page checker stopped");
changeTitle();
clearInterval(playChecker);
}
nowplaying = {
@@ -27,7 +29,7 @@ nowplaying = {
"artist": ""
};
oldTitle = document.title;
var playChecker;
var bgplayChecker;
var listPlayChecker;
// 搜索音乐
@@ -147,9 +149,9 @@ function addlist(songid, songname, artist){
// 播放下一首
function playnext(){
clearInterval(listPlayChecker);
console.warn("Checker Already Cleared.")
console.warn("Checker Already Cleared. pn")
listPlayChecker = setInterval(checkplay, 3000);
console.warn("Checker Already Set.")
console.warn("Checker Already Set. pn")
if(list.isEmpty()){
console.log("音乐列表已经播放完毕了哦,快加入新的音乐吧~");
alert("音乐列表已经播放完毕了哦,快加入新的音乐吧~");
@@ -162,6 +164,7 @@ function playnext(){
// 检测是否播放完毕
function checkplay(){
// 为了防止播放列表结束以后一直调用playnext产生过多的alart所以需要检测播放列表是否为空
console.warn("Checking now play")
if(!list.isEmpty()){
if(document.getElementById("Player").ended){
// 播放完毕后自动播放下一首
@@ -170,16 +173,16 @@ function checkplay(){
}else{
//clearInterval(checkplay);
clearInterval(listPlayChecker);
console.warn("Checker Already Cleared.")
console.warn("Checker Already Cleared. cp")
}
}
// 播放列表
function playthelist(){
clearInterval(listPlayChecker);
console.warn("Checker Already Cleared.")
console.warn("Checker Already Cleared. ptl")
listPlayChecker = setInterval(checkplay, 3000);
console.warn("Checker Already Set.")
console.warn("Checker Already Set. ptl")
if(list.isEmpty()){
console.log("音乐列表没有歌曲哦,快加入新的音乐吧~");
alert("音乐列表没有歌曲哦,快加入新的音乐吧~");
@@ -277,6 +280,7 @@ function removehistory(){
// }
function changeTitle(status){
console.log(status + " title changed");
switch(status){
case "playing":
document.title = `[Now Playing] ${nowplaying.songname} - ${nowplaying.artist}`;
@@ -293,7 +297,7 @@ function changeTitle(status){
}
function playstatChecking(){
// console.log("playstatChecking");
console.log("playstatChecking");
var audio = document.getElementById("Player");
if (audio.paused) {
// 暂停