efront 3.33.3 → 3.34.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/apps/kugou/icons/kugo.ico +0 -0
- package/apps/kugou/icons/kuwo.png +0 -0
- package/apps/kugou/index.html +1 -1
- package/apps/kugou/main.js +4 -0
- package/apps/kugou/search/search.html +3 -4
- package/apps/kugou/search/search.js +37 -5
- package/apps/kugou/search/search.less +3 -0
- package/coms/basic/cross_.js +13 -1
- package/coms/kugou/api.js +15 -1
- package/coms/kugou/buildList.html +1 -1
- package/coms/kugou/buildList.js +2 -2
- package/coms/kugou/buildScroll.js +1 -1
- package/coms/kugou/getSandbox.js +1 -1
- package/coms/kugou/krc.js +8 -4
- package/coms/kugou/musicList.js +37 -2
- package/coms/kugou/page.js +6 -6
- package/coms/kugou/playList.html +1 -1
- package/coms/kugou/playList.js +0 -1
- package/coms/kugou/playList.less +9 -2
- package/coms/kugou/player.js +42 -30
- package/coms/kugou/song.html +8 -3
- package/coms/kugou/song.js +26 -3
- package/coms/kugou/song.less +72 -16
- package/coms/reptile/colored_console.js +1 -1
- package/coms/zimoli/Canvas.js +7 -7
- package/coms/zimoli/anchor.js +2 -2
- package/coms/zimoli/anniu.js +6 -6
- package/coms/zimoli/button.js +9 -6
- package/coms/zimoli/cloneVisible.js +2 -3
- package/coms/zimoli/createElement.js +1 -1
- package/coms/zimoli/data.js +1 -1
- package/coms/zimoli/dateslider.js +8 -8
- package/coms/zimoli/download.js +1 -1
- package/coms/zimoli/editor.js +2 -2
- package/coms/zimoli/gallery.js +2 -2
- package/coms/zimoli/gallery.less +1 -1
- package/coms/zimoli/getGenerator.js +1 -6
- package/coms/zimoli/group.js +2 -2
- package/coms/zimoli/hline.js +1 -1
- package/coms/zimoli/icon.js +3 -3
- package/coms/zimoli/input.js +2 -2
- package/coms/zimoli/label.js +3 -3
- package/coms/zimoli/list.js +17 -28
- package/coms/zimoli/mask.js +2 -2
- package/coms/zimoli/option.js +7 -7
- package/coms/zimoli/render.js +1 -0
- package/coms/zimoli/selectDate.js +2 -2
- package/coms/zimoli/space.js +1 -1
- package/coms/zimoli/swap.js +1 -1
- package/coms/zimoli/titlebar.js +4 -4
- package/coms/zimoli/vbox.js +1 -1
- package/coms/zimoli/video.js +1 -1
- package/coms/zimoli/zimoli.js +1 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
|
Binary file
|
|
Binary file
|
package/apps/kugou/index.html
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
11
11
|
<link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
|
|
12
12
|
<meta name="viewport" content="initial-scale=1,maximum-scale=1,width=device-width" />
|
|
13
|
-
<title
|
|
13
|
+
<title>酷狗酷你尊享版</title><!-- 这个名字怎么听怎么像骂狗的,你和狗怎么可以放在相同的位置,真是太抬举你了 -->
|
|
14
14
|
<script deleteoncompile efrontloader>
|
|
15
15
|
// 若要在开发环境使用内置组件,请保留此script标签中的代码,在编译发布时,这里的代码会自动删除
|
|
16
16
|
</script>
|
package/apps/kugou/main.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<titlebar>
|
|
2
2
|
<back></back>
|
|
3
|
-
<input placeholder="请输入关键字搜索" ng-model=keyword
|
|
4
|
-
ng-keyup="event.which===13?confirm():search(this.value)" />
|
|
3
|
+
<input placeholder="请输入关键字搜索" ng-model=keyword ng-keyup="event.which===13?confirm():search(this.value)" />
|
|
5
4
|
<icon class="loading" ng-if="result?.loading"></icon>
|
|
6
5
|
<btn ng-click="keyword='';search()">清空</btn>
|
|
7
6
|
</titlebar>
|
|
@@ -13,8 +12,8 @@
|
|
|
13
12
|
<btn ng-click="search(s,0)"><span ng-bind="s"></span></btn>
|
|
14
13
|
</padding>
|
|
15
14
|
</div>
|
|
16
|
-
<list
|
|
15
|
+
<list -else ng-src="s in result" min-width=260 >
|
|
17
16
|
<padding>
|
|
18
|
-
<song _mark=keyword
|
|
17
|
+
<song _mark=keyword @play="play(event.value)" ng-src=s></song>
|
|
19
18
|
</padding>
|
|
20
19
|
</list>
|
|
@@ -19,8 +19,9 @@ function main(params, from) {
|
|
|
19
19
|
searchHistory,
|
|
20
20
|
player: kugou$player,
|
|
21
21
|
padding,
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
list: gallery,
|
|
23
|
+
play(info) {
|
|
24
|
+
this.player.play(info);
|
|
24
25
|
var words = searchHistory.slice(0);
|
|
25
26
|
var { keyword } = this;
|
|
26
27
|
for (var cx = words.length - 1; cx >= 0; cx--) {
|
|
@@ -30,10 +31,41 @@ function main(params, from) {
|
|
|
30
31
|
words = words.slice(0, 20);
|
|
31
32
|
data.setInstance("searchHistory", words, true);
|
|
32
33
|
},
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
resultMap: null,
|
|
35
|
+
addResult(info) {
|
|
36
|
+
var resultMap = this.resultMap;
|
|
37
|
+
var singerName = sortname(String(info.singername || '').split(/[\&\,,、]/)).join('、');
|
|
38
|
+
var songName = info.songname;
|
|
39
|
+
var id = `${singerName}:${info.songname}`;
|
|
40
|
+
if (!resultMap[id]) resultMap[id] = Object.assign([], { singer: singerName, song: songName });
|
|
41
|
+
resultMap[id].push(info);
|
|
42
|
+
},
|
|
43
|
+
async requestSearch(type, id, params, mp, timeout) {
|
|
44
|
+
var res = await data.from(id, params, timeout);
|
|
45
|
+
if (mp !== this.resultMap) return;
|
|
46
|
+
res.forEach(a => a.type = type);
|
|
47
|
+
res.forEach(this.addResult, this);
|
|
48
|
+
this.result = Object.keys(this.resultMap).map(k => this.resultMap[k]);
|
|
49
|
+
for (var r of this.result) r.sort((a, b) => a.priced - b.priced);
|
|
50
|
+
return res;
|
|
51
|
+
},
|
|
52
|
+
searched: null,
|
|
53
|
+
async search(keyword = this.keyword, timeout = 600) {
|
|
54
|
+
if (keyword === this.searched) return;
|
|
55
|
+
this.keyword = keyword;
|
|
56
|
+
this.searched = keyword;
|
|
57
|
+
this.resultMap = Object.create(null);
|
|
58
|
+
this.result = [];
|
|
59
|
+
var s1 = this.requestSearch("kugo", 'search', { keyword }, this.resultMap, timeout);
|
|
60
|
+
var s2 = this.requestSearch("kuwo", "search-kuwo", { key: keyword }, this.resultMap, timeout);
|
|
36
61
|
state({ keyword });
|
|
62
|
+
s1.then(function (s1) {
|
|
63
|
+
s1.forEach(a => {
|
|
64
|
+
a.priced = a.privilege === 10 && (a.price_sq > 0);
|
|
65
|
+
});
|
|
66
|
+
})
|
|
67
|
+
await Promise.all([s1, s2]);
|
|
68
|
+
|
|
37
69
|
},
|
|
38
70
|
confirm() {
|
|
39
71
|
this.search(void 0, 0);
|
package/coms/basic/cross_.js
CHANGED
|
@@ -371,7 +371,19 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
371
371
|
if (_cookies) {
|
|
372
372
|
_headers.Cookie = _cookies;
|
|
373
373
|
}
|
|
374
|
-
|
|
374
|
+
var cookobj = null;
|
|
375
|
+
for (var k in headers) {
|
|
376
|
+
if (/^\$/.test(headers[k])) {
|
|
377
|
+
var k2 = headers[k].slice(1);
|
|
378
|
+
if (!cookobj) cookobj = _cookies ? parseKV(_cookies, ';') : {};
|
|
379
|
+
if (k2 in cookobj) {
|
|
380
|
+
_headers[k] = cookobj[k2];
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
_headers[k] = headers[k];
|
|
385
|
+
}
|
|
386
|
+
}
|
|
375
387
|
if (/^[mc]/i.test(method)) {
|
|
376
388
|
_headers["User-Agent"] = /^m/i.test(method)
|
|
377
389
|
? "efront/3.25 (iPhone) Safari/602.1"
|
package/coms/kugou/api.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
({
|
|
2
2
|
"https://m.kugou.com/": {
|
|
3
|
-
"song-info": "get app/i/getSongInfo.php?cmd=playInfo&from=mkugou
|
|
3
|
+
"song-info;hash": "get app/i/getSongInfo.php?cmd=playInfo&from=mkugou",
|
|
4
4
|
"slider-src": "get:[].mod-slider>.swipe-wrap>div .#src=img!src&href=a!href",
|
|
5
5
|
"songs-list": "get:[].panel-songslist%20li .#hash=!id&.panel-songs-item-name>span!innerText",
|
|
6
6
|
"songs-list": "get:[].m_cm_item1warp:nth-child(2)>div .#=a!href\\song-mix&a:nth-child(2)>p:first-child!innerText&singer=a:nth-child(2)>p:nth-child(2)!innerText&imgurl=img!_src",
|
|
@@ -20,5 +20,19 @@
|
|
|
20
20
|
},
|
|
21
21
|
"http://mobilecdn.kugou.com/": {
|
|
22
22
|
"search?keyword": "get:data.info api/v3/search/song?format=json&page=1&pagesize=30&showtype=1"
|
|
23
|
+
},
|
|
24
|
+
"http://www.kuwo.cn/": {
|
|
25
|
+
"kuwo-token"/*主要用于初始化kw_token*/: "get",
|
|
26
|
+
},
|
|
27
|
+
"http://www.kuwo.cn/api/www/ csrf=$kw_token": {
|
|
28
|
+
"search-kuwo;key": "get:data.list search/searchMusicBykeyWord?&pn=1&rn=30#singername=artist&songname=name&priced=isListenFee",
|
|
29
|
+
"music-info;mid": "get:data music/musicInfo",
|
|
30
|
+
},
|
|
31
|
+
"http://www.kuwo.cn/api/v1/www/": {
|
|
32
|
+
"play-url;mid=rid": "get:data music/playUrl?type=music",
|
|
33
|
+
},
|
|
34
|
+
|
|
35
|
+
"http://newlyric.kuwo.cn/": {
|
|
36
|
+
"kuwo-lrc;rid": "get:data newlyric.lrc",
|
|
23
37
|
}
|
|
24
38
|
})
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
<list ng-src="s in datas" min-width:=datas[0]?.name?320:120>
|
|
2
2
|
<padding>
|
|
3
|
-
<song ng-click="run(s)" ng-class="{activate:
|
|
3
|
+
<song ng-click="run(s)" ng-class="{activate:musicList.isActived(s),imgonly:!datas[0]?.name}" ng-src="s"></song>
|
|
4
4
|
</padding>
|
|
5
5
|
</list>
|
|
6
6
|
<loading ng-if="datas.is_loading"></loading>
|
package/coms/kugou/buildList.js
CHANGED
|
@@ -6,7 +6,7 @@ function main(dataid, datapath) {
|
|
|
6
6
|
padding,
|
|
7
7
|
song,
|
|
8
8
|
loading,
|
|
9
|
-
musicList,
|
|
9
|
+
musicList:kugou$musicList,
|
|
10
10
|
async run(s) {
|
|
11
11
|
if (!s.hash && s.hashid) {
|
|
12
12
|
await data.from("song-mix", s, function (a) {
|
|
@@ -15,7 +15,7 @@ function main(dataid, datapath) {
|
|
|
15
15
|
});
|
|
16
16
|
}
|
|
17
17
|
if (s.hash) {
|
|
18
|
-
kugou$player.play(s
|
|
18
|
+
kugou$player.play(s);
|
|
19
19
|
} else {
|
|
20
20
|
go(datapath, s);
|
|
21
21
|
}
|
package/coms/kugou/getSandbox.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var getSandbox = function (xhr) {
|
|
2
2
|
var bodyHTML = String(xhr.responseText || xhr.response || "").replace(RegBodyExp, "$1").replace(RegScriptExp, "").replace(/\son/ig, " no").replace(/\s(src|href)/g, " s$1");
|
|
3
|
-
var sandbox = createElement(div);
|
|
3
|
+
var sandbox = document.createElement("div");
|
|
4
4
|
sandbox.innerHTML = bodyHTML;
|
|
5
5
|
return sandbox;
|
|
6
6
|
}
|
package/coms/kugou/krc.js
CHANGED
|
@@ -2,7 +2,11 @@ var secret = [64, 71, 97, 119, 94, 50, 116, 71, 81, 54, 49, 45, 206, 210, 110, 1
|
|
|
2
2
|
var isTrident = /Trident/i.test(navigator.userAgent);
|
|
3
3
|
function krc(list = div()) {
|
|
4
4
|
care(list, function (info) {
|
|
5
|
-
|
|
5
|
+
console.log(info)
|
|
6
|
+
if (info.type !== "kugo") {
|
|
7
|
+
remove(list.children);
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
6
10
|
cross("get", `http://lyrics.kugou.com/search?ver=1&man=yes&client=pc&keyword=${info.songName}&duration=${info.time}&hash=${info.hash}`).done(function (response) {
|
|
7
11
|
if (!response.response) return;
|
|
8
12
|
var liric = JSON.parse(response.response);
|
|
@@ -109,17 +113,17 @@ function createKRC(krc) {
|
|
|
109
113
|
}
|
|
110
114
|
}
|
|
111
115
|
};
|
|
112
|
-
var markerLabel = createElement(div);
|
|
116
|
+
var markerLabel = document.createElement("div");
|
|
113
117
|
return krcList;
|
|
114
118
|
}
|
|
115
119
|
function createCell(word) {
|
|
116
120
|
var label = word.label;
|
|
117
|
-
var cell = createElement("span");
|
|
121
|
+
var cell = document.createElement("span");
|
|
118
122
|
text(cell, label);
|
|
119
123
|
return cell;
|
|
120
124
|
}
|
|
121
125
|
function createRow(data) {
|
|
122
|
-
var row = createElement(div);
|
|
126
|
+
var row = document.createElement("div");
|
|
123
127
|
var cells = data.words.map(createCell);
|
|
124
128
|
appendChild(row, cells);
|
|
125
129
|
return row;
|
package/coms/kugou/musicList.js
CHANGED
|
@@ -1,6 +1,41 @@
|
|
|
1
1
|
var musicList = data.getInstance("musicList");
|
|
2
|
+
var actived = null;
|
|
2
3
|
musicList.forEach(function (music) {
|
|
3
|
-
if (music.activate)
|
|
4
|
-
|
|
4
|
+
if (music.activate) actived = music;
|
|
5
|
+
});
|
|
6
|
+
|
|
7
|
+
var isSameSong = function (m1, m2) {
|
|
8
|
+
return m1 === m2 || m1.mid && m1.mid === m2.mid || m1.hash && m1.hash === m2.hash;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
function addMethod(name, func) {
|
|
12
|
+
Object.defineProperty(musicList, name, {
|
|
13
|
+
value: func,
|
|
14
|
+
enumerable: false
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
addMethod("setActive", function (m) {
|
|
18
|
+
if (actived !== m) {
|
|
19
|
+
if (actived && actived !== m) {
|
|
20
|
+
actived.activate = false;
|
|
21
|
+
}
|
|
22
|
+
actived = m;
|
|
5
23
|
}
|
|
24
|
+
});
|
|
25
|
+
addMethod("remove", function (music) {
|
|
26
|
+
for (var cx = this.length - 1; cx >= 0; cx--) {
|
|
27
|
+
if (isSameSong(this[cx], music)) musicList.splice(cx, 1);
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
addMethod('indexOf', function (music, i) {
|
|
32
|
+
for (var cx = i || 0, dx = this.length; cx < dx; cx++) {
|
|
33
|
+
if (isSameSong(this[cx], music)) return cx;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
addMethod('getActived', function () {
|
|
37
|
+
return actived;
|
|
38
|
+
});
|
|
39
|
+
addMethod('isActived', function (m) {
|
|
40
|
+
return actived && m && isSameSong(m, actived);
|
|
6
41
|
});
|
package/coms/kugou/page.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
// var document=this.document;
|
|
5
5
|
// document["body"].appendChild(this.document.createElement("input"));
|
|
6
6
|
var createBottomBar = function (buttonsConfig) {
|
|
7
|
-
var bar = createElement(div);
|
|
7
|
+
var bar = document.createElement("div");
|
|
8
8
|
addClass(bar, "bottom-bar");
|
|
9
9
|
var button_count = 0;
|
|
10
10
|
for (var k in buttonsConfig) button_count++;
|
|
11
|
-
var btnArea = createElement(div);
|
|
11
|
+
var btnArea = document.createElement("div");
|
|
12
12
|
css(btnArea, "width:" + (100 / button_count) + "%;");
|
|
13
13
|
maxWidth(btnArea, 100);
|
|
14
|
-
var line =
|
|
14
|
+
var line = btnArea.cloneNode();
|
|
15
15
|
inlineBlock(btnArea);
|
|
16
16
|
var active = function (ratio) {
|
|
17
17
|
if (ratio >= .6) {
|
|
@@ -29,11 +29,11 @@ var createBottomBar = function (buttonsConfig) {
|
|
|
29
29
|
var index = 0;
|
|
30
30
|
for (var k in buttonsConfig) {
|
|
31
31
|
var [url, info] = buttonsConfig[k].split(":");
|
|
32
|
-
var btn =
|
|
32
|
+
var btn = btnArea.cloneNode();
|
|
33
33
|
btn.url = url;
|
|
34
34
|
btn.searchInfo = info;
|
|
35
35
|
btn.active = active;
|
|
36
|
-
btn.container = createElement(div);
|
|
36
|
+
btn.container = document.createElement("div");
|
|
37
37
|
btn.index = index++;
|
|
38
38
|
btn.innerHTML = k;
|
|
39
39
|
onclick(btn, function () {
|
|
@@ -83,7 +83,7 @@ onappend(pages, function () {
|
|
|
83
83
|
if (!isFinite(index)) index = 1;
|
|
84
84
|
pages.go(index);
|
|
85
85
|
});
|
|
86
|
-
var page = createElement(div);
|
|
86
|
+
var page = document.createElement("div");
|
|
87
87
|
appendChild(page, pages, bar);
|
|
88
88
|
ontouchstart(page, kugou$dragview);
|
|
89
89
|
onmousedown(page, kugou$dragview);
|
package/coms/kugou/playList.html
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
</div>
|
|
5
5
|
<list class="body" ng-src="(p,i) in musicList" min-width=480>
|
|
6
6
|
<padding ng-delete="remove(i)">
|
|
7
|
-
<song ng-click="play(i)" ng-class="{activate:
|
|
7
|
+
<song ng-click="play(i)" ng-class="{activate:musicList.isActived(p)}" ng-src=p></song>
|
|
8
8
|
</padding>
|
|
9
9
|
</list>
|
|
10
10
|
<div foot>
|
package/coms/kugou/playList.js
CHANGED
package/coms/kugou/playList.less
CHANGED
|
@@ -12,13 +12,20 @@
|
|
|
12
12
|
margin-top: 0;
|
|
13
13
|
transition: margin .2s ease-out;
|
|
14
14
|
color: #fff;
|
|
15
|
+
border: 1px solid;
|
|
15
16
|
}
|
|
16
|
-
|
|
17
|
+
|
|
18
|
+
>.head {
|
|
17
19
|
background: inherit;
|
|
20
|
+
border-bottom: 1px solid;
|
|
18
21
|
}
|
|
19
|
-
|
|
22
|
+
|
|
23
|
+
>[foot] {
|
|
20
24
|
background: inherit;
|
|
25
|
+
border-top: 1px solid;
|
|
26
|
+
padding-bottom: 6px;
|
|
21
27
|
}
|
|
28
|
+
|
|
22
29
|
>list.body {
|
|
23
30
|
overflow-x: hidden;
|
|
24
31
|
overflow-y: scroll;
|
package/coms/kugou/player.js
CHANGED
|
@@ -3,8 +3,27 @@ var playState = kugou$playState;
|
|
|
3
3
|
var playModes = kugou$playModes;
|
|
4
4
|
var playModeData = data.getInstance("play-mode");
|
|
5
5
|
var playList = kugou$playList();
|
|
6
|
-
var
|
|
7
|
-
|
|
6
|
+
var patchMusicInfo = async function (info) {
|
|
7
|
+
var res = null;
|
|
8
|
+
switch (info.type) {
|
|
9
|
+
case "kuwo":
|
|
10
|
+
res = await data.from("play-url", info);
|
|
11
|
+
info.avatar = info.pic;
|
|
12
|
+
info.singerName = info.singername;
|
|
13
|
+
info.songName = info.songname;
|
|
14
|
+
break;
|
|
15
|
+
case "kugo":
|
|
16
|
+
default:
|
|
17
|
+
res = await data.from("song-info", info);
|
|
18
|
+
if (res.fail_process === 12) res.priced = true;
|
|
19
|
+
if (res.imgUrl) {
|
|
20
|
+
res.avatar = res.imgUrl.replace(/\{size\}/ig, 200);
|
|
21
|
+
}
|
|
22
|
+
break;
|
|
23
|
+
}
|
|
24
|
+
Object.assign(info, res);
|
|
25
|
+
if (info.avatar) info.avatarUrl = `url('${info.avatar}')`;
|
|
26
|
+
return info;
|
|
8
27
|
};
|
|
9
28
|
var getLrc = function () {
|
|
10
29
|
return `https://m.kugou.com/app/i/krc.php?cmd=100&keyword=%E9%99%88%E6%98%9F%E3%80%81%E5%BC%A0%E7%BF%94%E8%BD%A9%20-%20%E5%86%B3%E4%B8%8D%E5%9B%9E%E5%A4%B4&hash=77AFF2715498A86AA28AC2DAA29C3FEB&timelength=280000&d=0.2984004589282503`;
|
|
@@ -18,7 +37,7 @@ on("keydown")(window, function (event) {
|
|
|
18
37
|
var { target } = event;
|
|
19
38
|
if (/^(input|select|textarea)$/i.test(target.tagName)) return;
|
|
20
39
|
var $scope = player.$scope;
|
|
21
|
-
if (!$scope.audio && !kugou$musicList.
|
|
40
|
+
if (!$scope.audio && !kugou$musicList.getActived()) return;
|
|
22
41
|
switch (event.keyCode || event.which) {
|
|
23
42
|
case 32:
|
|
24
43
|
if (event.repeat) break;
|
|
@@ -69,7 +88,6 @@ var filterTime = function (a, t) {
|
|
|
69
88
|
}
|
|
70
89
|
return res.map(fixTime).join(":");
|
|
71
90
|
};
|
|
72
|
-
|
|
73
91
|
var backer = document.createElement("back");
|
|
74
92
|
onremove(backer, function () {
|
|
75
93
|
$scope.page = false;
|
|
@@ -131,7 +149,8 @@ var $scope = {
|
|
|
131
149
|
rootElements.unmount(backer);
|
|
132
150
|
}
|
|
133
151
|
},
|
|
134
|
-
pause() {
|
|
152
|
+
pause(inc) {
|
|
153
|
+
if (inc !== false) ++this.playid;
|
|
135
154
|
$scope.playing = false;
|
|
136
155
|
let _audio = $scope.audio;
|
|
137
156
|
ns.disable();
|
|
@@ -181,22 +200,22 @@ var $scope = {
|
|
|
181
200
|
}
|
|
182
201
|
},
|
|
183
202
|
playid: 0,
|
|
184
|
-
play(
|
|
203
|
+
play(music = musicList.getActived()) {
|
|
204
|
+
var playid = ++this.playid;
|
|
185
205
|
render.refresh();
|
|
186
|
-
var isPlayback = typeof
|
|
206
|
+
var isPlayback = typeof music === "number";
|
|
187
207
|
if (isPlayback) {
|
|
188
|
-
if (
|
|
189
|
-
|
|
208
|
+
if (music < 0) {
|
|
209
|
+
music = music + musicList.length;
|
|
190
210
|
}
|
|
191
211
|
if (!musicList.length) return;
|
|
192
|
-
if (
|
|
193
|
-
|
|
212
|
+
if (music >= musicList.length) {
|
|
213
|
+
music = music % musicList.length;
|
|
194
214
|
}
|
|
195
|
-
|
|
196
|
-
if (!
|
|
197
|
-
hash = hash.hash;
|
|
215
|
+
music = musicList[music];
|
|
216
|
+
if (!music) return;
|
|
198
217
|
}
|
|
199
|
-
if (
|
|
218
|
+
if (musicList.isActived(music) && $scope.audio) {
|
|
200
219
|
if ($scope.playing) return $scope.pause();
|
|
201
220
|
$scope.playing = true;
|
|
202
221
|
let _audio = $scope.audio;
|
|
@@ -206,15 +225,13 @@ var $scope = {
|
|
|
206
225
|
}
|
|
207
226
|
return;
|
|
208
227
|
}
|
|
209
|
-
if (!isPlayback)
|
|
210
|
-
if (musicList[cx].hash === hash) musicList.splice(cx, 1);
|
|
211
|
-
}
|
|
228
|
+
if (!isPlayback) musicList.remove(music);
|
|
212
229
|
|
|
213
|
-
$scope.pause();
|
|
230
|
+
$scope.pause(false);
|
|
214
231
|
|
|
215
232
|
/**
|
|
216
233
|
* ios 只能由用户创建audio,所以请在用户触发的事件中调用play方法
|
|
217
|
-
|
|
234
|
+
*/
|
|
218
235
|
$scope.playing = false;
|
|
219
236
|
/**
|
|
220
237
|
* @type {HTMLAudioElement}
|
|
@@ -245,17 +262,14 @@ var $scope = {
|
|
|
245
262
|
_audio.autostart = true;
|
|
246
263
|
return alert("暂不支持在您的浏览器中播放!");
|
|
247
264
|
}
|
|
248
|
-
musicList.
|
|
265
|
+
musicList.setActive(music);
|
|
249
266
|
$scope.playing = true;
|
|
250
267
|
playState.width = 0;
|
|
251
|
-
|
|
268
|
+
patchMusicInfo(music).then((response) => {
|
|
269
|
+
if (playid !== this.playid) return;
|
|
252
270
|
if (!this.playing) return;
|
|
253
|
-
if (
|
|
254
|
-
|
|
255
|
-
response.avatar = response.imgUrl.replace(/\{size\}/ig, 200);
|
|
256
|
-
response.avatarUrl = `url('${response.avatar}')`;
|
|
257
|
-
}
|
|
258
|
-
var index = kugou$musicList.map(a => a.hash).indexOf(hash);
|
|
271
|
+
if (!musicList.isActived(music)) return;
|
|
272
|
+
var index = kugou$musicList.indexOf(music);
|
|
259
273
|
var distlist = kugou$musicList.slice(0);
|
|
260
274
|
distlist.forEach(function (info) {
|
|
261
275
|
delete info.activate;
|
|
@@ -267,9 +281,7 @@ var $scope = {
|
|
|
267
281
|
$scope.index = 0;
|
|
268
282
|
distlist.unshift(response);
|
|
269
283
|
}
|
|
270
|
-
response.hash = hash;
|
|
271
284
|
response.activate = true;
|
|
272
|
-
distlist.active_hash = hash;
|
|
273
285
|
extend($scope.info, response);
|
|
274
286
|
cast($scope.krcpad, response);
|
|
275
287
|
_audio.onerror = e => {
|
package/coms/kugou/song.html
CHANGED
|
@@ -1,8 +1,13 @@
|
|
|
1
1
|
<bg></bg>
|
|
2
2
|
<png class="logo" ng-if="song.imgurl" ng-src=song.imgurl></png>
|
|
3
|
-
<div class="singer" ng-if="song.singer" ng-
|
|
4
|
-
<div class="song"
|
|
3
|
+
<div class="singer" ng-if="song.singer" ng-html=song.singerMarked></div>
|
|
4
|
+
<div class="song" style:="{whiteSpace:song.items?'normal':'nowrap'}">
|
|
5
|
+
<span ng-html=song.songMarked></span>
|
|
6
|
+
<span class="types" -if="song.items" refresh>
|
|
7
|
+
<i type_="s.type" ng-class="{actived:musicList.isActived(s)}" priced_="!!s.priced" @click="event.stopPropagation(),play(s)" -repeat="s in song.items"></i>
|
|
8
|
+
</span>
|
|
9
|
+
</div>
|
|
5
10
|
<div class="filterTime(song.timeLength)"></div>
|
|
6
|
-
<div refresh class="play-state"
|
|
11
|
+
<div refresh class="play-state" -if="isActived()" ng-class={error:playState.error}>
|
|
7
12
|
<div ng-style="{width:playState.width}"></div>
|
|
8
13
|
</div>
|
package/coms/kugou/song.js
CHANGED
|
@@ -1,18 +1,33 @@
|
|
|
1
|
+
function dplay() {
|
|
2
|
+
this.firstChild.$scope.play();
|
|
3
|
+
}
|
|
1
4
|
function main(elem) {
|
|
2
5
|
elem = elem || document.createElement("song");
|
|
3
|
-
elem.renderid = 9;
|
|
4
6
|
var $scope = {
|
|
5
7
|
filterTime,
|
|
6
8
|
png: img,
|
|
7
9
|
bg,
|
|
10
|
+
play(s) {
|
|
11
|
+
if (!s) s = this.song.items ? this.song.items[0] : this.song;
|
|
12
|
+
dispatch(elem, 'play', s);
|
|
13
|
+
},
|
|
14
|
+
isActived() {
|
|
15
|
+
if (this.song.items) {
|
|
16
|
+
for (var s of this.song.items) {
|
|
17
|
+
if (this.musicList.isActived(s)) return true;
|
|
18
|
+
}
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return this.musicList.isActived(this.song);
|
|
22
|
+
},
|
|
8
23
|
playState: kugou$playState,
|
|
9
24
|
song: {},
|
|
10
25
|
musicList: kugou$musicList,
|
|
11
26
|
};
|
|
12
27
|
care(elem, function (item) {
|
|
13
28
|
if (!elem.innerHTML) elem.innerHTML = song;
|
|
14
|
-
var songName = String(item.
|
|
15
|
-
var singerName = String(item.
|
|
29
|
+
var songName = String(item.songname || item.song || item.songName || item.songname_original || item.name || '');
|
|
30
|
+
var singerName = String(item.singername || item.singer || item.singerName || '');
|
|
16
31
|
if (~songName.indexOf(singerName)) {
|
|
17
32
|
if (/\s*\-\s*/.test(songName)) {
|
|
18
33
|
singerName = songName.replace(/^([\s\S]*?)\s*\-\s*[\s\S]*$/, '$1');
|
|
@@ -23,10 +38,18 @@ function main(elem) {
|
|
|
23
38
|
hash: item.hash || item.hashid,
|
|
24
39
|
imgurl: item.imgurl,
|
|
25
40
|
singer: singerName,
|
|
41
|
+
items: item instanceof Array ? item : null,
|
|
26
42
|
songMarked: mark(songName, elem.mark),
|
|
27
43
|
singerMarked: mark(singerName, elem.mark)
|
|
28
44
|
};
|
|
45
|
+
if ($scope.song.items) {
|
|
46
|
+
attr(elem, 'group', true);
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
attr(elem, 'group', null);
|
|
50
|
+
}
|
|
29
51
|
render(elem.children, $scope, 0);
|
|
30
52
|
});
|
|
53
|
+
onclick(elem, dplay);
|
|
31
54
|
return block(elem);
|
|
32
55
|
}
|