efront 3.24.5 → 3.25.1
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/{index.html → _index.html} +1 -1
- package/apps/index.jsp +58 -0
- package/coms/basic/bdecode.js +38 -0
- package/coms/basic/bdecode_test.js +13 -0
- package/coms/basic/bencode.js +14 -0
- package/coms/basic/bencode_test.js +20 -0
- package/coms/basic/combine.js +21 -0
- package/coms/basic/cross_.js +13 -6
- package/coms/basic/queue.js +2 -2
- package/coms/kugou/api.js +1 -1
- package/coms/kugou/buildList.html +2 -2
- package/coms/kugou/song.less +20 -1
- package/coms/zimoli/button.less +49 -0
- package/coms/zimoli/cloneVisible.js +1 -0
- package/coms/zimoli/data.js +1 -0
- package/coms/zimoli/lattice.js +17 -14
- package/coms/zimoli/list.js +3 -3
- package/coms/zimoli/menuList.js +0 -2
- package/coms/zimoli/picture.js +6 -5
- package/coms/zimoli/picture_.js +4 -2
- package/coms/zimoli/popup.js +12 -22
- package/coms/zimoli/render.js +2 -1
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/readme.md +0 -1
|
@@ -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>efront 项目</title>
|
|
14
14
|
<script deleteoncompile efrontloader>
|
|
15
15
|
// 若要在开发环境使用内置组件,请保留此script标签中的代码,在编译发布时,这里的代码会自动删除
|
|
16
16
|
</script>
|
package/apps/index.jsp
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<script serverside>
|
|
2
|
+
var fs = require("fs");
|
|
3
|
+
var path = require("path");
|
|
4
|
+
return new Promise(function (ok, oh) {
|
|
5
|
+
fs.readdir(__dirname, { withFileTypes: true }, function (error, names) {
|
|
6
|
+
if (error) oh(error);
|
|
7
|
+
names = names.filter(a => a.isDirectory()).map(a => a.name);
|
|
8
|
+
context.names = [];
|
|
9
|
+
for (var n of names) {
|
|
10
|
+
if (fs.existsSync(path.join(__dirname, n, 'index.html'))) context.names.push(n);
|
|
11
|
+
}
|
|
12
|
+
ok();
|
|
13
|
+
});
|
|
14
|
+
});
|
|
15
|
+
</script>
|
|
16
|
+
<!DOCTYPE html>
|
|
17
|
+
<!--
|
|
18
|
+
http://efront.cc
|
|
19
|
+
-->
|
|
20
|
+
<html lang="zh-CN">
|
|
21
|
+
|
|
22
|
+
<head>
|
|
23
|
+
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
|
|
24
|
+
<meta charset="utf-8" />
|
|
25
|
+
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
26
|
+
<link rel="Shortcut Icon" href="/favicon.ico" type="image/x-icon" />
|
|
27
|
+
<meta name="viewport" content="initial-scale=1,maximum-scale=1,width=device-width" />
|
|
28
|
+
<title>efront 项目</title>
|
|
29
|
+
<style>
|
|
30
|
+
html {
|
|
31
|
+
height: 100%;
|
|
32
|
+
font-family: "SF Pro SC", "SF Pro Text", "SF Pro Icons", "PingFang SC", "Helvetica Neue", "Helvetica", "Arial", sans-serif;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
*,
|
|
36
|
+
::before,
|
|
37
|
+
::after {
|
|
38
|
+
box-sizing: border-box;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
body {
|
|
42
|
+
border: none;
|
|
43
|
+
margin: 0;
|
|
44
|
+
padding: 0;
|
|
45
|
+
height: 100%;
|
|
46
|
+
overflow: hidden;
|
|
47
|
+
}
|
|
48
|
+
</style>
|
|
49
|
+
</head>
|
|
50
|
+
|
|
51
|
+
<body scroll=no max-render=1440>
|
|
52
|
+
欢迎使用efront开发套件
|
|
53
|
+
<script serverside>
|
|
54
|
+
return context.names.map(n => `<a href="${n}">${n}</a>`)
|
|
55
|
+
</script>
|
|
56
|
+
</body>
|
|
57
|
+
|
|
58
|
+
</html>
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
var reg = /([a-z]?)(\d*)/g;
|
|
2
|
+
function decode(str, i) {
|
|
3
|
+
reg.lastIndex = i;
|
|
4
|
+
var a = reg.exec(str);
|
|
5
|
+
if (!a) return [, str.length];
|
|
6
|
+
var [m, t, l] = a;
|
|
7
|
+
var e = a.index + m.length;
|
|
8
|
+
switch (t) {
|
|
9
|
+
case "":
|
|
10
|
+
e++;
|
|
11
|
+
return [str.slice(e, e += +l), e];
|
|
12
|
+
case "i":
|
|
13
|
+
e = str.indexOf("e", a.index + +m.length);
|
|
14
|
+
if (e < 0) e = str.length;
|
|
15
|
+
return [+str.slice(a.index + 1, e), e + 1];
|
|
16
|
+
case "d":
|
|
17
|
+
var res = {};
|
|
18
|
+
i++;
|
|
19
|
+
while (i < str.length && str.charAt(i) !== 'e') {
|
|
20
|
+
var [k, i] = decode(str, i);
|
|
21
|
+
var [v, i] = decode(str, i);
|
|
22
|
+
res[k] = v;
|
|
23
|
+
}
|
|
24
|
+
return [res, i + 1];
|
|
25
|
+
case "l":
|
|
26
|
+
var res = [];
|
|
27
|
+
i++;
|
|
28
|
+
while (i < str.length && str.charAt(i) !== 'e') {
|
|
29
|
+
var [o, i] = decode(str, i);
|
|
30
|
+
res.push(o);
|
|
31
|
+
}
|
|
32
|
+
return [res, i + 1];
|
|
33
|
+
}
|
|
34
|
+
return [, str.length]
|
|
35
|
+
}
|
|
36
|
+
function bdecode(str) {
|
|
37
|
+
return decode(str, 0)[0];
|
|
38
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
var test = function (data, res) {
|
|
2
|
+
var d = bdecode(res);
|
|
3
|
+
assert(d, data);
|
|
4
|
+
};
|
|
5
|
+
test({ "t": "aa", "y": "e", "e": [201, "A Generic Error Ocurred"] }, 'd1:eli201e23:A Generic Error Ocurrede1:t2:aa1:y1:ee')
|
|
6
|
+
test({ "t": "aa", "y": "q", "q": "ping", "a": { "id": "abcdefghij0123456789" } }, 'd1:ad2:id20:abcdefghij0123456789e1:q4:ping1:t2:aa1:y1:qe')
|
|
7
|
+
test({ "t": "aa", "y": "r", "r": { "id": "mnopqrstuvwxyz123456" } }, 'd1:rd2:id20:mnopqrstuvwxyz123456e1:t2:aa1:y1:re')
|
|
8
|
+
test({ "t": "aa", "y": "q", "q": "find_node", "a": { "id": "abcdefghij0123456789", "target": "mnopqrstuvwxyz123456" } }, 'd1:ad2:id20:abcdefghij01234567896:target20:mnopqrstuvwxyz123456e1:q9:find_node1:t2:aa1:y1:qe')
|
|
9
|
+
test({ "t": "aa", "y": "r", "r": { "id": "0123456789abcdefghij", "nodes": "def456..." } }, 'd1:rd2:id20:0123456789abcdefghij5:nodes9:def456...e1:t2:aa1:y1:re')
|
|
10
|
+
test({ "t": "aa", "y": "q", "q": "get_peers", "a": { "id": "abcdefghij0123456789", "info_hash": "mnopqrstuvwxyz123456" } }, 'd1:ad2:id20:abcdefghij01234567899:info_hash20:mnopqrstuvwxyz123456e1:q9:get_peers1:t2:aa1:y1:qe')
|
|
11
|
+
test({ "t": "aa", "y": "r", "r": { "id": "abcdefghij0123456789", "token": "aoeusnth", "nodes": "def456..." } }, 'd1:rd2:id20:abcdefghij01234567895:nodes9:def456...5:token8:aoeusnthe1:t2:aa1:y1:re')
|
|
12
|
+
test({ "t": "aa", "y": "q", "q": "announce_peer", "a": { "id": "abcdefghij0123456789", "implied_port": 1, "info_hash": "mnopqrstuvwxyz123456", "port": 6881, "token": "aoeusnth" } }, 'd1:ad2:id20:abcdefghij012345678912:implied_porti1e9:info_hash20:mnopqrstuvwxyz1234564:porti6881e5:token8:aoeusnthe1:q13:announce_peer1:t2:aa1:y1:qe')
|
|
13
|
+
test({ "t": "aa", "y": "r", "r": { "id": "mnopqrstuvwxyz123456" } }, 'd1:rd2:id20:mnopqrstuvwxyz123456e1:t2:aa1:y1:re')
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
function bencode(object) {
|
|
2
|
+
if (isString(object)) return `${object.length}:${object}`;
|
|
3
|
+
if (isNumber(object)) return `i${object}e`;
|
|
4
|
+
if (isArray(object)) return `l${object.map(bencode).join('')}e`;
|
|
5
|
+
if (isEmpty(object)) return ``;
|
|
6
|
+
if (!isObject(object)) return ``;
|
|
7
|
+
var res = [];
|
|
8
|
+
for (var k in object) {
|
|
9
|
+
var o = object[k];
|
|
10
|
+
if (isEmpty(o)) continue;
|
|
11
|
+
res.push(bencode(k), bencode(o));
|
|
12
|
+
}
|
|
13
|
+
return `d${res.join('')}e`;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
var format = function (data) {
|
|
2
|
+
if (!isObject(data)) return data;
|
|
3
|
+
if (isArray(data)) return data.map(format);
|
|
4
|
+
var d = {};
|
|
5
|
+
Object.keys(data).sort().map(k => d[k] = format(data[k]));
|
|
6
|
+
return d;
|
|
7
|
+
}
|
|
8
|
+
var test = function (data, res) {
|
|
9
|
+
var d = format(data);
|
|
10
|
+
assert(bencode(d), res);
|
|
11
|
+
};
|
|
12
|
+
test({ "t": "aa", "y": "e", "e": [201, "A Generic Error Ocurred"] }, 'd1:eli201e23:A Generic Error Ocurrede1:t2:aa1:y1:ee')
|
|
13
|
+
test({ "t": "aa", "y": "q", "q": "ping", "a": { "id": "abcdefghij0123456789" } }, 'd1:ad2:id20:abcdefghij0123456789e1:q4:ping1:t2:aa1:y1:qe')
|
|
14
|
+
test({ "t": "aa", "y": "r", "r": { "id": "mnopqrstuvwxyz123456" } }, 'd1:rd2:id20:mnopqrstuvwxyz123456e1:t2:aa1:y1:re')
|
|
15
|
+
test({ "t": "aa", "y": "q", "q": "find_node", "a": { "id": "abcdefghij0123456789", "target": "mnopqrstuvwxyz123456" } }, 'd1:ad2:id20:abcdefghij01234567896:target20:mnopqrstuvwxyz123456e1:q9:find_node1:t2:aa1:y1:qe')
|
|
16
|
+
test({ "t": "aa", "y": "r", "r": { "id": "0123456789abcdefghij", "nodes": "def456..." } }, 'd1:rd2:id20:0123456789abcdefghij5:nodes9:def456...e1:t2:aa1:y1:re')
|
|
17
|
+
test({ "t": "aa", "y": "q", "q": "get_peers", "a": { "id": "abcdefghij0123456789", "info_hash": "mnopqrstuvwxyz123456" } }, 'd1:ad2:id20:abcdefghij01234567899:info_hash20:mnopqrstuvwxyz123456e1:q9:get_peers1:t2:aa1:y1:qe')
|
|
18
|
+
test({ "t": "aa", "y": "r", "r": { "id": "abcdefghij0123456789", "token": "aoeusnth", "nodes": "def456..." } }, 'd1:rd2:id20:abcdefghij01234567895:nodes9:def456...5:token8:aoeusnthe1:t2:aa1:y1:re')
|
|
19
|
+
test({ "t": "aa", "y": "q", "q": "announce_peer", "a": { "id": "abcdefghij0123456789", "implied_port": 1, "info_hash": "mnopqrstuvwxyz123456", "port": 6881, "token": "aoeusnth" } }, 'd1:ad2:id20:abcdefghij012345678912:implied_porti1e9:info_hash20:mnopqrstuvwxyz1234564:porti6881e5:token8:aoeusnthe1:q13:announce_peer1:t2:aa1:y1:qe')
|
|
20
|
+
test({ "t": "aa", "y": "r", "r": { "id": "mnopqrstuvwxyz123456" } }, 'd1:rd2:id20:mnopqrstuvwxyz123456e1:t2:aa1:y1:re')
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
function combine() {
|
|
2
|
+
var total = 1;
|
|
3
|
+
var argsList = Array.prototype.map.call(arguments, a => {
|
|
4
|
+
total *= a.length;
|
|
5
|
+
return a;
|
|
6
|
+
});
|
|
7
|
+
|
|
8
|
+
var temp = total;
|
|
9
|
+
var ratioList = argsList.map(a => temp = temp / a.length);
|
|
10
|
+
var dist = new Array(total);
|
|
11
|
+
for (var cx = 0, dx = total; cx < dx; cx++) {
|
|
12
|
+
var temp = cx;
|
|
13
|
+
dist[cx] = argsList.map(function (a, cx) {
|
|
14
|
+
var index = temp / ratioList[cx] | 0;
|
|
15
|
+
temp = temp - index * ratioList[cx];
|
|
16
|
+
return a[index];
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
return dist;
|
|
20
|
+
}
|
|
21
|
+
module.exports = combine;
|
package/coms/basic/cross_.js
CHANGED
|
@@ -81,8 +81,8 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
81
81
|
extend(_headers, headers);
|
|
82
82
|
if (/^[mc]/i.test(method)) {
|
|
83
83
|
_headers["User-Agent"] = /^m/i.test(method)
|
|
84
|
-
|
|
85
|
-
: "
|
|
84
|
+
? "efront/3.25 (iPhone) Safari/602.1"
|
|
85
|
+
: "efront/3.25 (Windows) Chrome/77.0.3865.90";
|
|
86
86
|
method = method.slice(1);
|
|
87
87
|
}
|
|
88
88
|
var loaded, errored;
|
|
@@ -118,8 +118,12 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
118
118
|
var flush = function () {
|
|
119
119
|
var then = xhr.then;
|
|
120
120
|
delete xhr.then;
|
|
121
|
-
if (loaded) onloads.
|
|
122
|
-
if (errored) onerrors.
|
|
121
|
+
if (loaded) onloads.forEach(e => e instanceof Function && e(xhr));
|
|
122
|
+
if (errored) onerrors.forEach(e => e instanceof Function && e(errored));
|
|
123
|
+
if (loaded || errored) {
|
|
124
|
+
onloads.splice(0, onloads.length);
|
|
125
|
+
onerrors.splice(0, onerrors.length);
|
|
126
|
+
}
|
|
123
127
|
xhr.then = then;
|
|
124
128
|
};
|
|
125
129
|
if (/^jsonp/i.test(method)) {
|
|
@@ -198,9 +202,11 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
198
202
|
case 304:
|
|
199
203
|
onload(xhr);
|
|
200
204
|
break;
|
|
201
|
-
case 307:
|
|
202
205
|
case 302:
|
|
203
206
|
case 301:
|
|
207
|
+
method = 'get';
|
|
208
|
+
datas = null;
|
|
209
|
+
case 307:
|
|
204
210
|
if (xhr.isRedirected > 2) break;
|
|
205
211
|
var exposekey = nocross ? "location" : "efront-location";
|
|
206
212
|
var location = exposeMap[exposekey] && xhr.getResponseHeader(exposekey);
|
|
@@ -212,10 +218,11 @@ function cross_(jsonp, digest = noop, method, url, headers) {
|
|
|
212
218
|
}
|
|
213
219
|
location = getRequestProtocol(url) + "//" + location;
|
|
214
220
|
}
|
|
215
|
-
var crs = cross_(
|
|
221
|
+
var crs = cross_.call(cross, jsonp, digest, method, location, _headers);
|
|
216
222
|
crs.isRedirected = (xhr.isRedirected || 0) + 1;
|
|
217
223
|
crs.done(onload, false);
|
|
218
224
|
crs.error(onerror, false);
|
|
225
|
+
if (!isEmpty(datas)) crs.send(datas);
|
|
219
226
|
break;
|
|
220
227
|
default:
|
|
221
228
|
onerror(xhr);
|
package/coms/basic/queue.js
CHANGED
|
@@ -33,7 +33,7 @@ function queue(list, count = 1, context = null) {
|
|
|
33
33
|
oh(e);
|
|
34
34
|
return promised = null;
|
|
35
35
|
}
|
|
36
|
-
if (
|
|
36
|
+
if (promised === false && (!result[saved_cx] || !isFunction(result[saved_cx].then))) count++;
|
|
37
37
|
else Promise.resolve(result[saved_cx]).then(next, reject), promised = true;
|
|
38
38
|
};
|
|
39
39
|
if (count > list.length) {
|
|
@@ -42,7 +42,7 @@ function queue(list, count = 1, context = null) {
|
|
|
42
42
|
if (!(count >= 1)) {
|
|
43
43
|
count = 1;
|
|
44
44
|
}
|
|
45
|
-
while (
|
|
45
|
+
while (count-- > 0) run();
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
48
|
module.exports = queue;
|
package/coms/kugou/api.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
"rank-list": "get:[].panel-img-list%20li rank/list#href=a!href&=a!href\\rank-info&imgurl=img!_src&name=p|innerText",
|
|
9
9
|
"rank-info": "get:[].panel-songslist%20li rank/info/:id#src=!id&name=.panel-songs-item-name|innerText&data=.panel-songs-item-download/innerText",
|
|
10
10
|
"plist-index": "get:[].panel-img-list%20li plist/index#href=a!href&=a!href\\plist-info&imgurl=img!_src&name=.panel-img-content-first|innerText&count=.panel-img-content-sub|innerText",
|
|
11
|
-
"plist-info": "
|
|
11
|
+
"plist-info": "mget:[].panel-songslist%20li plist/list/:id/#name=.panel-songs-item-name|innerText&data=.panel-songs-item-download/innerText",
|
|
12
12
|
"search-hot": "get api/v3/search/hot?format=json&plat=0&count=30",
|
|
13
13
|
"singer-class": "get:[].bd%20li singer/class#href=a!href&=a!href\\singer-list&name=a|innerText&group=?parentNode",
|
|
14
14
|
"singer-list": "get:[].singer-img-list>li singer/list/:id#href=a!href&=a!href\\singer-info0&imgurl=img!_src&name=p|innerText",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
<list ng-src="s in datas" min-width
|
|
1
|
+
<list ng-src="s in datas" min-width:=datas[0]?.name?480:120>
|
|
2
2
|
<padding>
|
|
3
|
-
<song ng-click="run(s)" ng-class="{activate:s.hash===musicList.active_hash}" ng-src="s"></song>
|
|
3
|
+
<song ng-click="run(s)" ng-class="{activate:s.hash===musicList.active_hash,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/song.less
CHANGED
|
@@ -38,9 +38,28 @@
|
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
}
|
|
41
|
+
&.imgonly{
|
|
42
|
+
padding: 0;
|
|
43
|
+
line-height: 0;
|
|
44
|
+
font-size: 0;
|
|
45
|
+
padding-bottom: 76%;
|
|
46
|
+
height: auto;
|
|
47
|
+
>:not(png){
|
|
48
|
+
display: none;
|
|
49
|
+
}
|
|
50
|
+
>.logo{
|
|
51
|
+
position: absolute;
|
|
52
|
+
height: 100%;
|
|
53
|
+
width: 100%;
|
|
54
|
+
margin: 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
41
57
|
|
|
42
58
|
>.song {
|
|
43
59
|
line-height: 30px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
overflow: hidden;
|
|
62
|
+
text-overflow: ellipsis;
|
|
44
63
|
}
|
|
45
64
|
|
|
46
65
|
b {
|
|
@@ -62,7 +81,7 @@ b {
|
|
|
62
81
|
color: #888;
|
|
63
82
|
|
|
64
83
|
&+.song {
|
|
65
|
-
padding-top:
|
|
84
|
+
padding-top: 8px;
|
|
66
85
|
}
|
|
67
86
|
}
|
|
68
87
|
|
package/coms/zimoli/button.less
CHANGED
|
@@ -41,6 +41,20 @@
|
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
+
@keyframes busy-pending {
|
|
45
|
+
0% {
|
|
46
|
+
transform: rotate(0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
70% {
|
|
50
|
+
transform: rotate(180deg);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
100% {
|
|
54
|
+
transform: rotate(360deg);
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
44
58
|
&>input {
|
|
45
59
|
position: absolute;
|
|
46
60
|
opacity: 0;
|
|
@@ -149,6 +163,29 @@
|
|
|
149
163
|
animation: ltr 2s linear 0s infinite;
|
|
150
164
|
}
|
|
151
165
|
|
|
166
|
+
a&,
|
|
167
|
+
&[type=anchor] {
|
|
168
|
+
&:before {
|
|
169
|
+
display: none;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
overflow: visible;
|
|
173
|
+
|
|
174
|
+
&.track {
|
|
175
|
+
display: none;
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
&:after {
|
|
179
|
+
content: "↻";
|
|
180
|
+
font-family: 'Times New Roman', Times, serif;
|
|
181
|
+
display: inline-block;
|
|
182
|
+
vertical-align: middle;
|
|
183
|
+
position: absolute;
|
|
184
|
+
animation: busy-pending 2s linear 0s infinite;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
|
|
152
189
|
}
|
|
153
190
|
|
|
154
191
|
&:focus {
|
|
@@ -174,6 +211,13 @@
|
|
|
174
211
|
background: #fff;
|
|
175
212
|
animation: busy-loading 3s linear 0s infinite;
|
|
176
213
|
}
|
|
214
|
+
|
|
215
|
+
a&,
|
|
216
|
+
&[type=anchor] {
|
|
217
|
+
&:before {
|
|
218
|
+
animation: busy-pending 3s linear 0s infinite;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
177
221
|
}
|
|
178
222
|
|
|
179
223
|
a&,
|
|
@@ -198,6 +242,10 @@ a&,
|
|
|
198
242
|
}
|
|
199
243
|
}
|
|
200
244
|
|
|
245
|
+
&[loading],
|
|
246
|
+
&[pending] {
|
|
247
|
+
.clear();
|
|
248
|
+
}
|
|
201
249
|
|
|
202
250
|
&.hover {
|
|
203
251
|
color: lighten(@default-color, 10%);
|
|
@@ -265,5 +313,6 @@ a&,
|
|
|
265
313
|
&:before {
|
|
266
314
|
content: "确认";
|
|
267
315
|
}
|
|
316
|
+
|
|
268
317
|
background: #333;
|
|
269
318
|
}
|
|
@@ -88,6 +88,7 @@ var isMaybeVisible = function (node) {
|
|
|
88
88
|
}
|
|
89
89
|
if (node.offsetParent) {
|
|
90
90
|
var parent = node.offsetParent;
|
|
91
|
+
if (!isMaybeVisible(parent)) return false;
|
|
91
92
|
if (getComputedStyle(parent).overflow === 'visible') return true;
|
|
92
93
|
return !(node.offsetLeft + node.offsetWidth - parent.scrollLeft <= parent.clientLeft ||
|
|
93
94
|
node.offsetTop + node.offsetHeight - parent.scrollTop <= parent.clientTop ||
|
package/coms/zimoli/data.js
CHANGED
|
@@ -178,6 +178,7 @@ function getUrlParamsForApi(api, url) {
|
|
|
178
178
|
return r;
|
|
179
179
|
});
|
|
180
180
|
if (api.base) base = api.base + base;
|
|
181
|
+
if (/\/$/.test(base)) base += "?";
|
|
181
182
|
var params = {};
|
|
182
183
|
url = url.replace(/[\?#]*$/g, function (match) {
|
|
183
184
|
match.split(/[&#\?]+/).forEach(function (s) {
|
package/coms/zimoli/lattice.js
CHANGED
|
@@ -5,6 +5,10 @@ function lattice(element, minWidth, maxWidth = minWidth << 1, layers) {
|
|
|
5
5
|
var resize = function () {
|
|
6
6
|
var _layers = layers || _box.src || [];
|
|
7
7
|
if (!_layers.length) return;
|
|
8
|
+
var _minWidth = +(element.getAttribute("min-width") || element.getAttribute("item-width"));
|
|
9
|
+
if (_minWidth) {
|
|
10
|
+
minWidth = _minWidth;
|
|
11
|
+
}
|
|
8
12
|
var clientWidth = parseFloat(freePixel(_box.clientWidth));
|
|
9
13
|
if (!clientWidth) return;
|
|
10
14
|
var savedCount = boxCount;
|
|
@@ -80,30 +84,29 @@ function lattice(element, minWidth, maxWidth = minWidth << 1, layers) {
|
|
|
80
84
|
}
|
|
81
85
|
function main() {
|
|
82
86
|
var element, minWidth, maxWidth, layers;
|
|
87
|
+
var initMinWidth = function (arg) {
|
|
88
|
+
if (minWidth) {
|
|
89
|
+
if (arg >= minWidth) {
|
|
90
|
+
maxWidth = arg;
|
|
91
|
+
} else {
|
|
92
|
+
maxWidth = minWidth;
|
|
93
|
+
minWidth = arg;
|
|
94
|
+
}
|
|
95
|
+
} else {
|
|
96
|
+
minWidth = arg;
|
|
97
|
+
}
|
|
98
|
+
};
|
|
83
99
|
[].forEach.call(arguments, function (arg) {
|
|
84
100
|
if (isNode(arg)) {
|
|
85
101
|
element = arg;
|
|
86
102
|
} else if (isArray(arg)) {
|
|
87
103
|
layers = arg;
|
|
88
104
|
} else if (isFinite(arg)) {
|
|
89
|
-
|
|
90
|
-
if (arg >= minWidth) {
|
|
91
|
-
maxWidth = arg;
|
|
92
|
-
} else {
|
|
93
|
-
maxWidth = minWidth;
|
|
94
|
-
minWidth = arg;
|
|
95
|
-
}
|
|
96
|
-
} else {
|
|
97
|
-
minWidth = arg;
|
|
98
|
-
}
|
|
105
|
+
initMinWidth(arg);
|
|
99
106
|
}
|
|
100
107
|
});
|
|
101
108
|
if (element && element.$scope) {
|
|
102
109
|
layers = null;
|
|
103
110
|
}
|
|
104
|
-
|
|
105
|
-
if (isNode(element) && !minWidth) {
|
|
106
|
-
minWidth = +(element.getAttribute("min-width") || element.getAttribute("item-width"));
|
|
107
|
-
}
|
|
108
111
|
return lattice(element, minWidth || 240, maxWidth, layers);
|
|
109
112
|
}
|
package/coms/zimoli/list.js
CHANGED
|
@@ -190,7 +190,7 @@ function ylist(container, generator, $Y) {
|
|
|
190
190
|
var runbuild = lazy(function () {
|
|
191
191
|
patchBottom();
|
|
192
192
|
patchTop();
|
|
193
|
-
var firstElement = getFirstElement(), y;
|
|
193
|
+
var firstElement = getFirstElement(1), y;
|
|
194
194
|
if (firstElement) {
|
|
195
195
|
y = firstElement.index * getNodeTarget(firstElement).offsetHeight;
|
|
196
196
|
} else {
|
|
@@ -302,7 +302,7 @@ function ylist(container, generator, $Y) {
|
|
|
302
302
|
var cache_height = list.offsetHeight;
|
|
303
303
|
|
|
304
304
|
var childrenMap = getChildrenMap();
|
|
305
|
-
var first_element, flag_element = first_element = getFirstElement();
|
|
305
|
+
var first_element, flag_element = first_element = getFirstElement(1);
|
|
306
306
|
if (!flag_element || !isFinite(flag_element.offsetTop)) return;
|
|
307
307
|
var offset = flag_element.index || 0;
|
|
308
308
|
var offsetTop = flag_element.offsetTop;
|
|
@@ -435,7 +435,7 @@ function ylist(container, generator, $Y) {
|
|
|
435
435
|
return index + scrolled;
|
|
436
436
|
};
|
|
437
437
|
list.topIndex = function () {
|
|
438
|
-
var element = getFirstElement();
|
|
438
|
+
var element = getFirstElement(1);
|
|
439
439
|
return element ? element.index : 0;
|
|
440
440
|
};
|
|
441
441
|
list.getIndexedElement = getIndexedElement;
|
package/coms/zimoli/menuList.js
CHANGED
|
@@ -14,7 +14,6 @@ var unfocus = function () {
|
|
|
14
14
|
this.setFocus(null);
|
|
15
15
|
};
|
|
16
16
|
var setFocus = function (focused) {
|
|
17
|
-
console.log(focused)
|
|
18
17
|
if (focused && focused.hasAttribute("disabled")) return;
|
|
19
18
|
var page = this;
|
|
20
19
|
if (focused) {
|
|
@@ -179,7 +178,6 @@ function main(page, items, active, direction = 'y') {
|
|
|
179
178
|
}
|
|
180
179
|
if (emptyFocus !== false) page.setFocus(target);
|
|
181
180
|
if (!item.length) return;
|
|
182
|
-
console.log('popupmenu')
|
|
183
181
|
page.setFocus(target);
|
|
184
182
|
var clone = template.cloneNode();
|
|
185
183
|
clone.$parentScopes = page.$parentScopes;
|
package/coms/zimoli/picture.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
|
|
2
2
|
var coordIn = move.coordIn;
|
|
3
|
-
var _createImage = function (url, callback) {
|
|
3
|
+
var _createImage = function (url, callback, iscurrent) {
|
|
4
4
|
var imgpic;
|
|
5
5
|
if (url instanceof Image) {
|
|
6
6
|
imgpic = new Image;
|
|
@@ -18,10 +18,11 @@ var _createImage = function (url, callback) {
|
|
|
18
18
|
onload.call(imgpic);
|
|
19
19
|
} else {
|
|
20
20
|
imgpic.onload = onload;
|
|
21
|
+
if (iscurrent) imgpic.onerror = () => alert("打开失败!");
|
|
21
22
|
}
|
|
22
23
|
return imgpic;
|
|
23
24
|
};
|
|
24
|
-
var create = function (url, key) {
|
|
25
|
+
var create = function (url, key, report_error) {
|
|
25
26
|
if (!url) return;
|
|
26
27
|
|
|
27
28
|
var image = picture_();
|
|
@@ -90,7 +91,7 @@ var create = function (url, key) {
|
|
|
90
91
|
}
|
|
91
92
|
};
|
|
92
93
|
|
|
93
|
-
createImage(url, image.setImage);
|
|
94
|
+
createImage(url, image.setImage, report_error);
|
|
94
95
|
|
|
95
96
|
|
|
96
97
|
var get_style = function (x, y, scaled, rotate) {
|
|
@@ -127,10 +128,10 @@ function picture(url, to = 0, key) {
|
|
|
127
128
|
delete images[index];
|
|
128
129
|
}
|
|
129
130
|
if (!images[index]) {
|
|
130
|
-
images[index] = create.call(p, urls[index], key);
|
|
131
|
+
images[index] = create.call(p, urls[index], key, p.index === index);
|
|
131
132
|
}
|
|
132
133
|
if (!images[index + 1] && index + 1 < urls.length) {
|
|
133
|
-
images[index + 1] = create.call(p, urls[index + 1], key);
|
|
134
|
+
images[index + 1] = create.call(p, urls[index + 1], key, p.index === index);
|
|
134
135
|
}
|
|
135
136
|
if (index >= 5) delete images[index - 5];
|
|
136
137
|
if (index + 5 < urls.length) {
|
package/coms/zimoli/picture_.js
CHANGED
|
@@ -85,8 +85,10 @@ function picture_(image = document.createElement("div")) {
|
|
|
85
85
|
cover_scale = isxrelex ? x_scale : y_scale;
|
|
86
86
|
loaded_scale = contain_scale = isxrelex ? y_scale : x_scale;
|
|
87
87
|
if (loaded_scale >= 1) {
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if (loaded_scale > devicePixelRatio) {
|
|
89
|
+
loaded_scale = devicePixelRatio;
|
|
90
|
+
}
|
|
91
|
+
click_scale = loaded_scale * 2;
|
|
90
92
|
}
|
|
91
93
|
else if (loaded_scale > .5) {
|
|
92
94
|
click_scale = 2;
|
package/coms/zimoli/popup.js
CHANGED
|
@@ -303,28 +303,18 @@ var _as_yextra = function (global, innerWidth, innerHeight, element, target, poi
|
|
|
303
303
|
css(_rhomb, temp);
|
|
304
304
|
_rhomb.setSide(side);
|
|
305
305
|
}
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
css(_rhomb, `left:${fromOffset(position.left + position.width / 2)};right:auto`);
|
|
319
|
-
|
|
320
|
-
}
|
|
321
|
-
} else {
|
|
322
|
-
if (position.left + element.offsetWidth > innerWidth) {
|
|
323
|
-
css(element, `right:${fromOffset(viewrect.width + viewrect.left - position.left - position.width)};left:auto;`);
|
|
324
|
-
}
|
|
325
|
-
else {
|
|
326
|
-
css(element, `left:${fromOffset(position.left - viewrect.left)};right:auto;`);
|
|
327
|
-
}
|
|
306
|
+
var targetX = position.left + (position.width - element.offsetWidth) / 2;
|
|
307
|
+
if (targetX < 0) {
|
|
308
|
+
css(element, `left:0;right:auto`);
|
|
309
|
+
if (_rhomb) css(_rhomb, `left:${fromOffset(position.left + position.width / 2)};right:auto`);
|
|
310
|
+
}
|
|
311
|
+
else if (targetX + element.offsetWidth > innerWidth) {
|
|
312
|
+
css(element, `right:0;left:auto`);
|
|
313
|
+
if (_rhomb) css(_rhomb, `right:${fromOffset(innerWidth - position.left - position.width / 2)};left:auto`);
|
|
314
|
+
}
|
|
315
|
+
else {
|
|
316
|
+
css(element, `left:${fromOffset(targetX)};right:auto`);
|
|
317
|
+
if (_rhomb) css(_rhomb, `left:${fromOffset(position.left + position.width / 2)};right:auto`);
|
|
328
318
|
}
|
|
329
319
|
|
|
330
320
|
var offsetParent = target.offsetParent;
|
package/coms/zimoli/render.js
CHANGED
|
@@ -554,6 +554,7 @@ var binders = {
|
|
|
554
554
|
});
|
|
555
555
|
}
|
|
556
556
|
};
|
|
557
|
+
var reject = function (e) { digest(); throw e };
|
|
557
558
|
var createEmiter = function (on) {
|
|
558
559
|
return function (key, search) {
|
|
559
560
|
var parsedSrc = this.$src;
|
|
@@ -603,7 +604,7 @@ var createEmiter = function (on) {
|
|
|
603
604
|
else {
|
|
604
605
|
res = getter0.call(this, e);
|
|
605
606
|
}
|
|
606
|
-
if (res && isFunction(res.then)) res.then(digest,
|
|
607
|
+
if (res && isFunction(res.then)) res.then(digest, reject);
|
|
607
608
|
return res;
|
|
608
609
|
});
|
|
609
610
|
};
|