efront 3.34.4 → 3.34.7
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/favicon.ico +0 -0
- package/apps/kugou/home.js +1 -1
- package/apps/kugou/ie8.js +93 -0
- package/apps/kugou/index.html +5 -2
- package/apps/kugou/search/search.js +2 -1
- package/coms/basic/#decrypt.js +1 -0
- package/coms/basic/#loader.js +26 -14
- package/coms/basic/ArrayFill.js +1 -1
- package/coms/basic/JSAM.js +7 -3
- package/coms/basic/Matrix.js +8 -2
- package/coms/basic/awaitable.js +1 -1
- package/coms/{zimoli → basic}/color.js +14 -4
- package/coms/{zimoli → basic}/color_test.js +0 -0
- package/coms/basic/decodeUTF16.js +4 -3
- package/coms/basic/encodeUTF16.js +18 -3
- package/coms/basic/parseURL.js +49 -13
- package/coms/basic/parseURL_test.js +6 -1
- package/coms/basic/renderExpress.js +1 -1
- package/coms/basic_/Array2.js +1 -1
- package/coms/basic_/Promise.js +21 -14
- package/coms/basic_/[]map.js +27 -3
- package/coms/basic_/readme.md +83 -0
- package/coms/kugou/api.js +2 -2
- package/coms/kugou/dance.js +50 -2
- package/coms/kugou/krc.js +5 -0
- package/coms/kugou/playList.html +1 -1
- package/coms/kugou/playList.js +1 -0
- package/coms/kugou/player.html +3 -3
- package/coms/kugou/player.js +17 -13
- package/coms/kugou/shortcurt.js +8 -0
- package/coms/zimoli/LoadingArray.js +9 -25
- package/coms/zimoli/appendChild.js +1 -1
- package/coms/zimoli/cless.js +0 -1
- package/coms/zimoli/data.js +16 -6
- package/coms/zimoli/gallery.js +1 -1
- package/coms/zimoli/getGenerator.js +1 -1
- package/coms/zimoli/on.js +2 -0
- package/coms/zimoli/render.js +33 -33
- package/coms/zimoli/selectList.js +1 -1
- package/data/packexe-setup.sfx +0 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
- package/readme.md +9 -8
- package/coms/basic/encodeUTF16.asm +0 -62
|
Binary file
|
package/apps/kugou/home.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var page =
|
|
1
|
+
var page = document.createElement("page");
|
|
2
2
|
page.initialStyle = 'transform:scale(.9);opacity:0;';
|
|
3
3
|
var tags = "新歌:song/list:音乐总有新玩法,排行:rank/list:排行榜 - 酷狗音乐,歌单:plist/list:歌单 - 酷狗音乐,歌手:singer/keywords:歌手分类 - 酷狗音乐".split(",").map(function (tag, cx) {
|
|
4
4
|
var [str, url, title] = tag.split(":");
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
document.createElement = function (document, createElement, defineProperty) {
|
|
2
|
+
var setHTML = function (v) {
|
|
3
|
+
v = String(v);
|
|
4
|
+
var nodePath = [this], currentNode = this;
|
|
5
|
+
v.replace(/<\!\-\-[\s\S]*?(?:\-\-\!?>|$)|<(?:[^>'"]+|(["'])(?:\\[\s\S]|[\s\S])*?\1)*>|[^<]+/g, function (m, q, index) {
|
|
6
|
+
var tagCloseIndex = index + m.length + 3;
|
|
7
|
+
var isComment = /^<\!\-\-/.test(m);
|
|
8
|
+
var tag = /^<([^\s]+)([\s\S]*)\/?>/.exec(m);
|
|
9
|
+
var isTextNode = !tag;
|
|
10
|
+
if (isComment || isTextNode) {
|
|
11
|
+
if (v.charAt(tagCloseIndex - 1) !== '/' || v.slice(tagCloseIndex, tagCloseIndex + currentNode.tagName.length).toUpperCase() !== currentNode.tagName.toUpperCase()) {
|
|
12
|
+
currentNode = nodePath[nodePath.length - 1];
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
if (isComment) {
|
|
16
|
+
var comment = document.createComment(m.replace(/^<\!\-\-|\-\-\!?>$/g, ''));
|
|
17
|
+
currentNode.appendChild(comment);
|
|
18
|
+
return;
|
|
19
|
+
}
|
|
20
|
+
if (isTextNode) {
|
|
21
|
+
var textNode = document.createTextNode(m);
|
|
22
|
+
currentNode.appendChild(textNode);
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
var tagName = tag[1];
|
|
26
|
+
if (/^[!?]/.test(tagName)) return;
|
|
27
|
+
if (tagName.charAt(0) === "/") {
|
|
28
|
+
tagName = tagName.slice(1).toUpperCase();
|
|
29
|
+
while (currentNode && currentNode.tagName.toUpperCase() !== tagName) currentNode = nodePath.pop();
|
|
30
|
+
if (currentNode === nodePath[nodePath.length - 1]) nodePath.pop();
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
currentNode = nodePath[nodePath.length - 1];
|
|
34
|
+
tagName = tagName.replace(/\/$/, '');
|
|
35
|
+
var element = createElement.call(document, tagName);
|
|
36
|
+
var attributes = tag[2].trim();
|
|
37
|
+
if (attributes) attributes.replace(/([^\s\'\"\=\/]+)(?:\s*\=\s*((['"])(?:\\[\s\S]|[\s\S])*?\3|\S+))?/g, function (_, name, value) {
|
|
38
|
+
if (value) value = value.replace(/^['"]|["']$/g, '').replace(/\\([\s\S])/, '$1');
|
|
39
|
+
else value = '';
|
|
40
|
+
element.setAttribute(name, value);
|
|
41
|
+
})
|
|
42
|
+
currentNode.appendChild(element);
|
|
43
|
+
if (!/^(input|meta|link|img)$/i.test(tagName) && !/\/\>$/.test(tag)) {
|
|
44
|
+
nodePath.push(element);
|
|
45
|
+
};
|
|
46
|
+
currentNode = element;
|
|
47
|
+
});
|
|
48
|
+
};
|
|
49
|
+
var getHTML = function () {
|
|
50
|
+
/**
|
|
51
|
+
* @type {NodeList}
|
|
52
|
+
*/
|
|
53
|
+
var childNodes = this.childNodes;
|
|
54
|
+
var text = [];
|
|
55
|
+
for (var cx = 0, dx = childNodes.length; cx < dx; cx++) {
|
|
56
|
+
var c = childNodes[cx];
|
|
57
|
+
switch (c.nodeType === 8) {
|
|
58
|
+
case 8: text.push("<!", "-", "-", c.nodeValue, "-", "-", ">"); continue;
|
|
59
|
+
case 3: text.push('"', c.nodeValue.replace(/[\\"]/g, "\\$&"), '"'); continue;
|
|
60
|
+
case 1:
|
|
61
|
+
var attributes = c.attributes;
|
|
62
|
+
text.push("<", c.nodeName);
|
|
63
|
+
for (var cy = 0, dy = attributes.length; cy < dy; cy++) {
|
|
64
|
+
var a = attributes[cy];
|
|
65
|
+
text.push(" ", a.name)
|
|
66
|
+
if (a.value) text.push("=\"", a.value.replace(/[\\"]/g, "\\$&"), "\"");
|
|
67
|
+
}
|
|
68
|
+
var innerHTML = c.innerHTML;
|
|
69
|
+
if (!innerHTML && /^(input|meta|link)$/i.test(c.nodeName)) {
|
|
70
|
+
text.push('>');
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
text.push(">", innerHTML, "</", c.nodeName, ">");
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return text.join('');
|
|
77
|
+
};
|
|
78
|
+
var descriptor = { set: setHTML, get: getHTML };
|
|
79
|
+
return function (tagName) {
|
|
80
|
+
var element = createElement.call(document, tagName);
|
|
81
|
+
if (/^(style|script)$/i.test(element.tagName)) return element;
|
|
82
|
+
defineProperty(element, "innerHTML", descriptor);
|
|
83
|
+
return element;
|
|
84
|
+
};
|
|
85
|
+
}(document, document.createElement, Object.defineProperty);
|
|
86
|
+
Object.defineProperty = function (Object, defineProperty) {
|
|
87
|
+
return function (o, k, v) {
|
|
88
|
+
if (o.nodeType) return defineProperty.call(Object, o, k, v);
|
|
89
|
+
if ("value" in v) {
|
|
90
|
+
return o[k] = v.value;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}(Object, Object.defineProperty);
|
package/apps/kugou/index.html
CHANGED
|
@@ -8,9 +8,12 @@
|
|
|
8
8
|
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
|
|
9
9
|
<meta charset="utf-8" />
|
|
10
10
|
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
|
11
|
-
<link rel="Shortcut Icon" href="
|
|
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
|
+
<!--[if IE 8]>
|
|
15
|
+
<script src="ie8.js"></script>
|
|
16
|
+
<![endif]-->
|
|
14
17
|
<script deleteoncompile efrontloader>
|
|
15
18
|
// 若要在开发环境使用内置组件,请保留此script标签中的代码,在编译发布时,这里的代码会自动删除
|
|
16
19
|
</script>
|
|
@@ -8,6 +8,7 @@ function main(params, from) {
|
|
|
8
8
|
var page = div();
|
|
9
9
|
page.initialStyle = 'margin-left:100%';
|
|
10
10
|
page.innerHTML = search;
|
|
11
|
+
document.title = "搜索";
|
|
11
12
|
var $scope = render(page, {
|
|
12
13
|
titlebar,
|
|
13
14
|
back,
|
|
@@ -59,7 +60,7 @@ function main(params, from) {
|
|
|
59
60
|
if (!keyword) return;
|
|
60
61
|
var s1 = this.requestSearch("kugo", 'search', { keyword }, this.resultMap, timeout, function (s1) {
|
|
61
62
|
if (s1 instanceof Array) s1.forEach(a => {
|
|
62
|
-
a.priced = a.privilege === 10
|
|
63
|
+
a.priced = a.privilege === 10
|
|
63
64
|
});
|
|
64
65
|
else s1 = [];
|
|
65
66
|
return s1;
|
package/coms/basic/#decrypt.js
CHANGED
package/coms/basic/#loader.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var window = this;
|
|
3
|
+
var isProduction = true;
|
|
4
|
+
// <!-- isProduction = false -->
|
|
5
|
+
|
|
3
6
|
var {
|
|
4
7
|
parseInt,
|
|
5
8
|
XMLHttpRequest,
|
|
6
9
|
ActiveXObject,
|
|
7
|
-
isProduction = function develop() { return develop.name !== 'develop'; }(),
|
|
8
10
|
Error,
|
|
9
11
|
Function,
|
|
10
12
|
Array,
|
|
@@ -18,7 +20,6 @@ var {
|
|
|
18
20
|
top,
|
|
19
21
|
location,
|
|
20
22
|
Object,
|
|
21
|
-
String,
|
|
22
23
|
console,
|
|
23
24
|
efrontURI,
|
|
24
25
|
parseFloat,
|
|
@@ -137,9 +138,11 @@ var readFile = function (names, then) {
|
|
|
137
138
|
clearTimeout(flush_to_storage_timer);
|
|
138
139
|
flush_to_storage_timer = setTimeout(saveResponseTreeToStorage, 200);
|
|
139
140
|
readingCount--;
|
|
141
|
+
// <!--
|
|
140
142
|
if (readingCount === 0) {
|
|
141
143
|
killCircle();
|
|
142
144
|
}
|
|
145
|
+
// -->
|
|
143
146
|
};
|
|
144
147
|
var oh = function (e) {
|
|
145
148
|
if (isProduction) {
|
|
@@ -164,7 +167,12 @@ var createFunction = function (name, body, args, isAsync, isYield) {
|
|
|
164
167
|
|
|
165
168
|
var FILE_NAME_REG = /^https?\:|\.(html?|css|asp|jsp|php)$/i;
|
|
166
169
|
var loadedModules = {};
|
|
170
|
+
// <!--
|
|
171
|
+
var undefinedModules = {};
|
|
167
172
|
var killCircle = function () {
|
|
173
|
+
var undefinedkeys = Object.keys(undefinedModules);
|
|
174
|
+
if (undefinedkeys.length) console.warn("已使用 undefined 代替", undefinedkeys.join(", "));
|
|
175
|
+
undefinedModules = {};
|
|
168
176
|
var penddings = {}, circle = [], module_keys = [];
|
|
169
177
|
for (var k in loadedModules) {
|
|
170
178
|
if (k.slice(0, keyprefix.length) === keyprefix && loadedModules[k] instanceof Array) {
|
|
@@ -233,10 +241,11 @@ var killCircle = function () {
|
|
|
233
241
|
});
|
|
234
242
|
}
|
|
235
243
|
};
|
|
244
|
+
// -->
|
|
236
245
|
var hasOwnProperty = {}.hasOwnProperty;
|
|
237
246
|
var loadModule = function (name, then, prebuilds = {}) {
|
|
238
247
|
if (/^(?:module|exports|define|require|window|global|undefined|__dirname|__filename)$/.test(name)) return then();
|
|
239
|
-
if ((name
|
|
248
|
+
if ((hasOwnProperty.call(prebuilds, name)) || hasOwnProperty.call(modules, name) || (!/^on/.test(name) && window[name] !== null && window[name] !== void 0 && !hasOwnProperty.call(forceRequest, name))
|
|
240
249
|
) return then();
|
|
241
250
|
preLoad(name);
|
|
242
251
|
var key = keyprefix + name;
|
|
@@ -276,7 +285,9 @@ var loadModule = function (name, then, prebuilds = {}) {
|
|
|
276
285
|
flushTree(loadedModules, key);
|
|
277
286
|
return;
|
|
278
287
|
}
|
|
279
|
-
|
|
288
|
+
// <!--
|
|
289
|
+
if (!data) undefinedModules[name] = true;
|
|
290
|
+
// -->
|
|
280
291
|
var [argNames, body, args, required, strs, isAsync, isYield] = getArgs(data);
|
|
281
292
|
if (isProduction) {
|
|
282
293
|
strs = strs.map ? strs.map(toRem) : strs;
|
|
@@ -412,7 +423,7 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
|
|
|
412
423
|
var required = exec.required;
|
|
413
424
|
if (required) required = required.map(a => loadedModules[keyprefix + a]);
|
|
414
425
|
var argsList = originNames.map(function (argName) {
|
|
415
|
-
if (argName
|
|
426
|
+
if (hasOwnProperty.call(prebuilds, argName)) {
|
|
416
427
|
return prebuilds[argName];
|
|
417
428
|
}
|
|
418
429
|
if (argName === "module") {
|
|
@@ -459,7 +470,7 @@ var createModule = function (exec, originNames, compiledNames, prebuilds = {}) {
|
|
|
459
470
|
var result, created;
|
|
460
471
|
if (prebuilds.init) {
|
|
461
472
|
var prebuilds2 = Object.create(null);
|
|
462
|
-
for (var k in prebuilds) prebuilds2[k] = prebuilds[k];
|
|
473
|
+
for (var k in prebuilds) if (hasOwnProperty.call(prebuilds, k)) prebuilds2[k] = prebuilds[k];
|
|
463
474
|
prebuilds = prebuilds2;
|
|
464
475
|
delete prebuilds.popup;
|
|
465
476
|
delete prebuilds.action;
|
|
@@ -489,7 +500,7 @@ var init = function (name, then, prebuilds) {
|
|
|
489
500
|
// then = bindthen(then);
|
|
490
501
|
var key = keyprefix + name;
|
|
491
502
|
if (prebuilds) {
|
|
492
|
-
if (name
|
|
503
|
+
if (hasOwnProperty.call(prebuilds, name)) {
|
|
493
504
|
if (then) then(prebuilds[name]);
|
|
494
505
|
return prebuilds[name];
|
|
495
506
|
}
|
|
@@ -585,7 +596,7 @@ var init = function (name, then, prebuilds) {
|
|
|
585
596
|
then(module.created = modules[name] = created);
|
|
586
597
|
return;
|
|
587
598
|
}
|
|
588
|
-
var filteredArgs = prebuilds ? args.filter(a => !(a
|
|
599
|
+
var filteredArgs = prebuilds ? args.filter(a => !hasOwnProperty.call(prebuilds, a)) : args;
|
|
589
600
|
|
|
590
601
|
var saveAsModule = filteredArgs.length === args.length;
|
|
591
602
|
if (!filteredArgs.length) {
|
|
@@ -794,6 +805,7 @@ var loadResponseTreeFromStorage = function () {
|
|
|
794
805
|
var preLoad = function () { };
|
|
795
806
|
var start_time = efront_time / 1000 | 0;
|
|
796
807
|
var errored = {};
|
|
808
|
+
// modules 的代码不可出现多层
|
|
797
809
|
var modules = {
|
|
798
810
|
isProduction,
|
|
799
811
|
undefined: void 0,
|
|
@@ -810,12 +822,12 @@ var modules = {
|
|
|
810
822
|
devicePixelRatio,
|
|
811
823
|
renderPixelRatio,
|
|
812
824
|
efrontsign: "",
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
825
|
+
};
|
|
826
|
+
modules.debug = function () {
|
|
827
|
+
document.addEventListener("blur", e => e.stopPropagation(), true);
|
|
828
|
+
};
|
|
829
|
+
modules.put = function (name, module) {
|
|
830
|
+
modules[name] = module;
|
|
819
831
|
};
|
|
820
832
|
var penddings = {};
|
|
821
833
|
|
package/coms/basic/ArrayFill.js
CHANGED
package/coms/basic/JSAM.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
var isEmpty = require("./isEmpty");
|
|
2
2
|
var convertReg = /^(?:object|function)$/;
|
|
3
|
+
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
3
4
|
var check = function (o) {
|
|
4
5
|
return o === null || typeof o === 'bigint' || o instanceof BigInt || typeof o === 'number' || typeof o === "boolean";
|
|
5
6
|
};
|
|
@@ -260,6 +261,7 @@ function parse(string, preload) {
|
|
|
260
261
|
if (!isEmpty(preload)) dist = dist.concat(preload);
|
|
261
262
|
var preloads_length = dist.length - 1;
|
|
262
263
|
dist = dist.concat(trimed.slice(1, trimed.length));
|
|
264
|
+
|
|
263
265
|
for (var cx = 0, dx = marked.length; cx < dx; cx++) {
|
|
264
266
|
var index = marked[cx];
|
|
265
267
|
var o = trimed[index];
|
|
@@ -276,11 +278,13 @@ function parse(string, preload) {
|
|
|
276
278
|
delete o[""];
|
|
277
279
|
delete o._;
|
|
278
280
|
if (arr) for (var k in arr) {
|
|
279
|
-
t[k] = dist[arr[k]];
|
|
281
|
+
if (hasOwnProperty.call(arr, k)) t[k] = dist[arr[k]];
|
|
280
282
|
}
|
|
281
283
|
for (var k in o) {
|
|
282
|
-
|
|
283
|
-
|
|
284
|
+
if (hasOwnProperty.call(o, k)) {
|
|
285
|
+
var v = o[k];
|
|
286
|
+
t[dist[k]] = dist[v];
|
|
287
|
+
}
|
|
284
288
|
}
|
|
285
289
|
}
|
|
286
290
|
if (trimed.length > 1 && typeof trimed[0] === 'number') {
|
package/coms/basic/Matrix.js
CHANGED
|
@@ -84,8 +84,11 @@ class Matrix extends Array {
|
|
|
84
84
|
}
|
|
85
85
|
}
|
|
86
86
|
class MathMatrix extends Matrix {
|
|
87
|
+
getTransform() {
|
|
88
|
+
return [this[0], this[1], this[3], this[4], this[6], this[7]];
|
|
89
|
+
}
|
|
87
90
|
toDOMString() {
|
|
88
|
-
if (this.size()[1] === 2) return `matrix(${
|
|
91
|
+
if (this.size()[1] === 2) return `matrix(${this.getTransform()})`;
|
|
89
92
|
return `matrix(${this})`;
|
|
90
93
|
}
|
|
91
94
|
|
|
@@ -222,8 +225,11 @@ class MathMatrix extends Matrix {
|
|
|
222
225
|
|
|
223
226
|
}
|
|
224
227
|
class MatrixTransposed extends Matrix {
|
|
228
|
+
getTransform() {
|
|
229
|
+
return [this[0], this[3], this[1], this[4], this[2], this[5]];
|
|
230
|
+
}
|
|
225
231
|
toDOMString() {
|
|
226
|
-
if (this.size()[1] === 2) return `matrix(${
|
|
232
|
+
if (this.size()[1] === 2) return `matrix(${this.getTransform()})`;
|
|
227
233
|
return `matrix(${this.transpose()})`;
|
|
228
234
|
}
|
|
229
235
|
static transform(B, dots) {
|
package/coms/basic/awaitable.js
CHANGED
|
@@ -162,7 +162,7 @@ var hex256 = function (num) {
|
|
|
162
162
|
return num.toString(16);
|
|
163
163
|
}
|
|
164
164
|
var hex16 = function (num) {
|
|
165
|
-
num = trim16(num);
|
|
165
|
+
num = trim16(num / 17);
|
|
166
166
|
return num.toString(16);
|
|
167
167
|
}
|
|
168
168
|
function color(rgba) {
|
|
@@ -242,6 +242,9 @@ function parse(color) {
|
|
|
242
242
|
return [R, G, B, A >= 0 ? A / 0xff : 1];
|
|
243
243
|
}
|
|
244
244
|
}
|
|
245
|
+
var maybe16 = function (n) {
|
|
246
|
+
return (n >> 4) === (n & 0xf);
|
|
247
|
+
}
|
|
245
248
|
function stringify(color) {
|
|
246
249
|
var [R, G, B, a] = color;
|
|
247
250
|
if (a >= 0 && a < 1) {
|
|
@@ -250,9 +253,11 @@ function stringify(color) {
|
|
|
250
253
|
B = B.toFixed();
|
|
251
254
|
a = +a.toFixed(3);
|
|
252
255
|
return `rgba(${R},${G},${B},${a})`;
|
|
253
|
-
} else {
|
|
254
|
-
return "#" + [R, G, B].map(hex256).join("");
|
|
255
256
|
}
|
|
257
|
+
if (maybe16(R) && maybe16(G) && maybe16(B)) {
|
|
258
|
+
return "#" + [R, G, B].map(hex16).join("");
|
|
259
|
+
}
|
|
260
|
+
return "#" + [R, G, B].map(hex256).join("");
|
|
256
261
|
}
|
|
257
262
|
function doWith(manager, color, args) {
|
|
258
263
|
var isparsed = color instanceof Array,
|
|
@@ -317,6 +322,11 @@ var colorReg = /(?:rgb|hsl)a?\s*\([\,\.\d\s%]+\)|#[\da-f]{3,8}/ig;
|
|
|
317
322
|
function isColor(text) {
|
|
318
323
|
return rgbReg.test(text) || rgbHex.test(text) || rgbHex2.test(text) || hslReg.test(text);
|
|
319
324
|
}
|
|
325
|
+
function format(color) {
|
|
326
|
+
var c = parse(color);
|
|
327
|
+
if (!c) return color;
|
|
328
|
+
return stringify(c);
|
|
329
|
+
}
|
|
320
330
|
var replacer = function (match) {
|
|
321
331
|
if (!isColor(match)) return match;
|
|
322
332
|
if (colorDesigner.rotate !== 0) {
|
|
@@ -325,7 +335,7 @@ var replacer = function (match) {
|
|
|
325
335
|
if (colorDesigner.contrast !== 1) {
|
|
326
336
|
match = color.contrast(match, colorDesigner.contrast);
|
|
327
337
|
}
|
|
328
|
-
return match;
|
|
338
|
+
return format(match);
|
|
329
339
|
};
|
|
330
340
|
var colorDesigner = {
|
|
331
341
|
rotate: 0,
|
|
File without changes
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
function decodeUTF16(buff) {
|
|
1
|
+
function decodeUTF16(buff, be = true) {
|
|
2
2
|
var dist = [];
|
|
3
|
+
var dec = be ? (a, b) => a << 8 | b : (a, b) => b << 8 | a;
|
|
3
4
|
for (var cx = 0, dx = buff; cx < dx; cx += 2) {
|
|
4
|
-
var m = (buff[cx]
|
|
5
|
+
var m = dec(buff[cx], buff[cx + 1]);
|
|
5
6
|
var t;
|
|
6
7
|
if (m > 0b1101111111111111 || m < 0b1101100000000000) {
|
|
7
8
|
t = m;
|
|
8
9
|
}
|
|
9
10
|
else {
|
|
10
|
-
var n = (buff[cx + 2]
|
|
11
|
+
var n = dec(buff[cx + 2], buff[cx + 3]);
|
|
11
12
|
if (n < 0b1101100000000000 || n > 0b1101111111111111) {
|
|
12
13
|
continue;
|
|
13
14
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
function numberUTF16(t, dist = []) {
|
|
2
|
-
|
|
2
|
+
if (t > 0x10ffff) {
|
|
3
3
|
throw new Error("编码错误");
|
|
4
4
|
}
|
|
5
5
|
if (t <= 0xffff) {
|
|
@@ -11,12 +11,27 @@ function numberUTF16(t, dist = []) {
|
|
|
11
11
|
}
|
|
12
12
|
return dist;
|
|
13
13
|
}
|
|
14
|
-
function
|
|
14
|
+
function numberUTF16LE(t, dist = []) {
|
|
15
|
+
if (t > 0x10ffff) {
|
|
16
|
+
throw new Error("编码错误");
|
|
17
|
+
}
|
|
18
|
+
if (t <= 0xffff) {
|
|
19
|
+
dist.push(t & 0xff, t >> 8);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
t -= 0x10000;
|
|
23
|
+
dist.push(t >> 10 & 0xff, 0b11011000 | t >> 18, t & 0xff, t >> 8 & 0b00000011 | 0b11011100);
|
|
24
|
+
}
|
|
25
|
+
return dist;
|
|
26
|
+
|
|
27
|
+
}
|
|
28
|
+
function encodeUTF16(strings, be = true) {
|
|
15
29
|
var dist = [];
|
|
30
|
+
var utf16 = be ? numberUTF16 : numberUTF16LE;
|
|
16
31
|
for (var cx = 0, dx = strings.length; cx < dx; cx++) {
|
|
17
32
|
var s = strings.codePointAt(cx);
|
|
18
33
|
if (s > 0xffff) cx++;
|
|
19
|
-
|
|
34
|
+
utf16(s, dist);
|
|
20
35
|
}
|
|
21
36
|
return dist;
|
|
22
37
|
}
|
package/coms/basic/parseURL.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// 下图来自 https://nodejs.org/dist/latest-v16.x/docs/api/
|
|
1
|
+
// 下图来自 https://nodejs.org/dist/latest-v16.x/docs/api/html#urlobjectauth
|
|
2
2
|
// ┌────────────────────────────────────────────────────────────────────────────────────────────────┐
|
|
3
3
|
// │ href │
|
|
4
4
|
// ├──────────┬──┬─────────────────────┬────────────────────────┬───────────────────────────┬───────┤
|
|
@@ -19,8 +19,46 @@
|
|
|
19
19
|
|
|
20
20
|
// -------/// ---------------1---------------------------------///////////////////2-----3--------//////// ------4----2/////5---------------------------------------------------6------------------------------------------------------------------------------------//////////////-7--5///8-------9----------//10--11---10/8/--12----////
|
|
21
21
|
var reg = /^([^\:\/\\\?#\[]+\:(?![^\:\/\\\?\#]*@|[\/\\][^\/\\]))?(?:\/\/|\\\\)?(?:(([^\:\/\\\?#]+)?(?:\:([^\/\\\?#]+))?)@)?(([^\/\\@\?\#\.]*?[^\/\\@\:\?\#\.\d][^\/\\@\:\?\#\.]*?|[^\/\\@\:\?\#\.]+(?:\:[^\@\/\\\?#\.]*[^\d\@\:\/\\\?#\.]+|(?:\.[^\/\\@\:\?\#\.]+)+))?(?:(?:\:|^)(\d+))?)(((?:\/|\\|^)[^\?#]*)?(\?([^#]*))?)(#[\s\S]*)?$/;
|
|
22
|
-
|
|
23
|
-
|
|
22
|
+
class URL {
|
|
23
|
+
locate(url) {
|
|
24
|
+
if (url === undefined || url === null) url = '';
|
|
25
|
+
var [__, protocol, auth, username, password, host, hostname, port, path, pathname, search, query, hash] = reg.exec(url);
|
|
26
|
+
if (protocol) {
|
|
27
|
+
this.protocol = protocol;
|
|
28
|
+
}
|
|
29
|
+
if (host) {
|
|
30
|
+
this.auth = auth;
|
|
31
|
+
this.username = username;
|
|
32
|
+
this.password = password;
|
|
33
|
+
this.host = host;
|
|
34
|
+
this.hostname = hostname;
|
|
35
|
+
this.port = port;
|
|
36
|
+
this.path = path;
|
|
37
|
+
this.pathname = pathname;
|
|
38
|
+
this.search = search;
|
|
39
|
+
this.query = query;
|
|
40
|
+
this.hash = hash;
|
|
41
|
+
}
|
|
42
|
+
else if (pathname) {
|
|
43
|
+
this.path = path;
|
|
44
|
+
this.pathname = pathname;
|
|
45
|
+
this.search = search;
|
|
46
|
+
this.query = query;
|
|
47
|
+
this.hash = hash;
|
|
48
|
+
}
|
|
49
|
+
else if (search) {
|
|
50
|
+
this.search = search;
|
|
51
|
+
this.path = (this.pathname || '') + search;
|
|
52
|
+
this.query = query;
|
|
53
|
+
this.hash = hash;
|
|
54
|
+
}
|
|
55
|
+
else if (hash) {
|
|
56
|
+
this.hash = hash;
|
|
57
|
+
}
|
|
58
|
+
this.href = this.toString();
|
|
59
|
+
return this;
|
|
60
|
+
}
|
|
61
|
+
toString() {
|
|
24
62
|
var href = '';
|
|
25
63
|
if (this.protocol) href += this.protocol;
|
|
26
64
|
if (this.auth) href += "//" + this.auth + "@" + this.host;
|
|
@@ -28,19 +66,17 @@ var hrefDescriptor = {
|
|
|
28
66
|
if (this.path) href += this.path;
|
|
29
67
|
if (this.hash) href += this.hash;
|
|
30
68
|
return href;
|
|
31
|
-
},
|
|
32
|
-
set(href) {
|
|
33
|
-
Object.assign(this, parseURL(href));
|
|
34
69
|
}
|
|
35
|
-
};
|
|
36
|
-
function parse(url) {
|
|
37
|
-
if (url === undefined || url === null) url = '';
|
|
38
|
-
var [__, protocol, auth, username, password, host, hostname, port, path, pathname, search, query, hash] = reg.exec(url);
|
|
39
|
-
return { protocol, auth, username, password, host, hostname, port, path, pathname, search, query, hash };
|
|
40
70
|
}
|
|
71
|
+
// function parse(url) {
|
|
72
|
+
// if (url === undefined || url === null) url = '';
|
|
73
|
+
// var [__, protocol, auth, username, password, host, hostname, port, path, pathname, search, query, hash] = reg.exec(url);
|
|
74
|
+
// return { protocol, auth, username, password, host, hostname, port, path, pathname, search, query, hash };
|
|
75
|
+
// }
|
|
41
76
|
function parseURL(url) {
|
|
42
|
-
var obj =
|
|
43
|
-
|
|
77
|
+
var obj = new URL;
|
|
78
|
+
obj.locate(url);
|
|
44
79
|
return obj;
|
|
45
80
|
}
|
|
81
|
+
// mdn说__proto__这玩意在deno上不支持,吓我一跳,2023-01-04亲测支持
|
|
46
82
|
module.exports = parseURL;
|
|
@@ -6,15 +6,19 @@ var test = function (url, key, value) {
|
|
|
6
6
|
else console.pass(`url:${url}, key:${key}, expect:${value}, result:${parsed[key]}`);
|
|
7
7
|
};
|
|
8
8
|
|
|
9
|
+
test('//efront.cc/kugou', 'pathname', '/kugou')
|
|
10
|
+
test('//efront.cc/kugou', 'host', 'efront.cc')
|
|
11
|
+
test('//efront.cc/kugou', 'href', '//efront.cc/kugou')
|
|
9
12
|
test('http://efront.cc/kugou', 'pathname', '/kugou')
|
|
10
13
|
test('http://efront.cc/kugou?a', 'path', '/kugou?a')
|
|
14
|
+
test('http://efront.cc/kugou?a', 'href', 'http://efront.cc/kugou?a')
|
|
11
15
|
test('http://yunxu1019@live.cn@github.com/?a', 'username', 'yunxu1019@live.cn')
|
|
12
16
|
test('localhost', 'host', 'localhost')
|
|
13
17
|
test('localhost:80', 'port', '80')
|
|
14
18
|
test('localhost:80/', 'port', '80')
|
|
15
19
|
test('magnet:?xt=::', 'search', '?xt=::')
|
|
16
20
|
test('magnet:?xt=::', 'protocol', 'magnet:')
|
|
17
|
-
test('magnet:?xt=::', 'host',
|
|
21
|
+
test('magnet:?xt=::', 'host', undefined)
|
|
18
22
|
test('magnet:?xt=::', 'pathname', undefined)
|
|
19
23
|
test('efront.cc', 'host', 'efront.cc')
|
|
20
24
|
test('127.0.0.1', 'host', '127.0.0.1')
|
|
@@ -35,6 +39,7 @@ test('efront.', 'pathname', "efront.")
|
|
|
35
39
|
test('http//:80', 'hostname', 'http')
|
|
36
40
|
test('http//:80', 'pathname', '//:80')
|
|
37
41
|
test('//h:80', 'host', 'h:80')
|
|
42
|
+
test('//h:80', 'href', '//h:80')
|
|
38
43
|
test('?80', 'path', '?80')
|
|
39
44
|
test('?80', 'search', '?80')
|
|
40
45
|
test('?80', 'query', '80')
|
package/coms/basic_/Array2.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
var setPrototypeOf = Object.setPrototypeOf || function (obj, proto) {
|
|
2
2
|
var hasOwnProperty = Object.prototype.hasOwnProperty;
|
|
3
|
-
for (var p in proto) if (
|
|
3
|
+
for (var p in proto) if (hasOwnProperty.call(proto, p) && !(p in obj)) obj[p] = proto[p];
|
|
4
4
|
return obj;
|
|
5
5
|
}
|
|
6
6
|
function Array2() {
|