diff --git a/index.html b/index.html index 6602e44..dd441b4 100644 --- a/index.html +++ b/index.html @@ -19,7 +19,7 @@ - +
Now Playing: None
diff --git a/js/main.js b/js/main.js index 6493334..feebb5b 100644 --- a/js/main.js +++ b/js/main.js @@ -222,4 +222,53 @@ function gethistory(){ function removehistory(){ localStorage.removeItem("historyList"); gethistory(); -} \ No newline at end of file +} + +// 当点击清空列表的时候进行一次确认,如果确认之后再进行删除操作。 +function ClearList(){ + var Choose = confirm("确定清空歌单吗?(此操作不可逆!)") + if(Choose == true){ + removehistory(); + console.log("The History List Has been cleared."); + return true; + }else{ + console.log("List Clear Canceled!"); + return false; + } +} + +// 添加所有歌曲到播放列表 +function addAllHistorytoPlayList(){ + var historyList = JSON.parse(localStorage.getItem("historyList")); + if(historyList == null){ + historyList = []; + } + var reslist = document.getElementById("reslist"); + reslist.innerHTML = ""; + for(var i = 0; i < historyList.length; i++){ + addlist(historyList[i].songid, historyList[i].songname, historyList[i].artist); + console.log(`${historyList[i].songname} - ${historyList[i].artist} is add to list.`); + } + alert("已把历史记录插入到了播放列表"); + // Planning to Code... +} + +// 清空播放列表 +function ClearthePlaylist(){ + if(!list.isEmpty()){ + list.clear(); + console.log("List Cleared!"); + }else{ + console.log("List is empty, not need to clear.") + } +} + +// 推送到云播放列表 +function PushToCloud(){ + // Cloud Prepareing... +} + +// 拉取云播放列表 +function PullToCloud(){ + // Cloud Prepareing... +}