MCPcopy
hub / github.com/mengkunsoft/MKOnlineMusicPlayer / loadList

Function loadList

js/functions.js:481–534  ·  view source on GitHub ↗
(list)

Source from the content-addressed store, hash-verified

479
480// 向列表中载入某个播放列表
481function loadList(list) {
482 if(musicList[list].isloading === true) {
483 layer.msg('列表读取中...', {icon: 16,shade: 0.01,time: 500});
484 return true;
485 }
486
487 rem.dislist = list; // 记录当前显示的列表
488
489 dataBox("list"); // 在主界面显示出播放列表
490
491 // 调试信息输出
492 if(mkPlayer.debug) {
493 if(musicList[list].id) {
494 console.log('加载播放列表 ' + list + ' - ' + musicList[list].name + '\n' +
495 'id: ' + musicList[list].id + ',\n' +
496 'name: "' + musicList[list].name + '",\n' +
497 'cover: "' + musicList[list].cover + '",\n' +
498 'item: []');
499 } else {
500 console.log('加载播放列表 ' + list + ' - ' + musicList[list].name);
501 }
502 }
503
504 rem.mainList.html(''); // 清空列表中原有的元素
505 addListhead(); // 向列表中加入列表头
506
507 if(musicList[list].item.length == 0) {
508 addListbar("nodata"); // 列表中没有数据
509 } else {
510
511 // 逐项添加数据
512 for(var i=0; i<musicList[list].item.length; i++) {
513 var tmpMusic = musicList[list].item[i];
514
515 addItem(i + 1, tmpMusic.name, tmpMusic.artist, tmpMusic.album);
516
517 // 音乐链接均有有效期限制,重新显示列表时清空处理
518 if(list == 1 || list == 2) tmpMusic.url = "";
519 }
520
521 // 列表加载完成后的处理
522 if(list == 1 || list == 2) { // 历史记录和正在播放列表允许清空
523 addListbar("clear"); // 清空列表
524 }
525
526 if(rem.playlist === undefined) { // 未曾播放过
527 if(mkPlayer.autoplay == true) pause(); // 设置了自动播放,则自动播放
528 } else {
529 refreshList(); // 刷新列表,添加正在播放样式
530 }
531
532 listToTop(); // 播放列表滚动到顶部
533 }
534}
535
536// 播放列表滚动到顶部
537function listToTop() {

Callers 4

ajaxPlayListFunction · 0.85
playFunction · 0.85
functions.jsFile · 0.85
initListFunction · 0.85

Calls 7

dataBoxFunction · 0.85
addListheadFunction · 0.85
addListbarFunction · 0.85
addItemFunction · 0.85
pauseFunction · 0.85
refreshListFunction · 0.85
listToTopFunction · 0.85

Tested by

no test coverage detected