efront 3.5.3 → 3.5.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/coms/basic/parseURL.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
// -------/// ---------------1-------------//////////////2---3--------//////// ----4----2/////5-----------------------6
|
|
2
|
-
var reg = /^([
|
|
1
|
+
// -------/// ---------------1-------------//////////////2---3--------//////// ----4----2/////5-----------------------6-----------------------//////////////-7--5///8----9----//10--11---10///--12-----8//
|
|
2
|
+
var reg = /^([^\:\/\?#\[]+\:(?![^\:\/\?\#]*@))?(?:\/\/)?(?:(([^\:\/\?#]+)?(?:\:([^\/\?#]+))?)@)?(([^\/@\:\?\#]*(?:[^\d\@\:\/\?#]|\.)[^\/@\?\#]*?)?(?:(?:\:|^)(\d+))?)((\/[^\?#]*)?(\?([^#]*))?(#[\s\S]*)?)$/;
|
|
3
3
|
function parseURL(url) {
|
|
4
4
|
if (url === undefined || url === null) url = '';
|
|
5
5
|
var [__, protocol, auth, username, password, host, hostname, port, path, pathname, search, query, hash] = reg.exec(url);
|
|
@@ -30,3 +30,10 @@ test('?80', 'path', '?80')
|
|
|
30
30
|
test('?80', 'search', '?80')
|
|
31
31
|
test('?80', 'query', '80')
|
|
32
32
|
test('#?80', 'hash', '#?80')
|
|
33
|
+
test("http://[fe80::caa:a647:ef1d:b4db]/", "host", "[fe80::caa:a647:ef1d:b4db]")
|
|
34
|
+
test("http://[::1]/", "host", "[::1]")
|
|
35
|
+
test("http://[::]/", "host", "[::]")
|
|
36
|
+
test("http://[::%12]/", "host", "[::%12]")
|
|
37
|
+
test("http://[::]:80/", "hostname", "[::]")
|
|
38
|
+
test("[::]:80/", "hostname", "[::]")
|
|
39
|
+
test("[fd64:f52:f52:f52:f52:f52:f52:97]", "hostname", "[fd64:f52:f52:f52:f52:f52:f52:97]")
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
var prime = [2, 3];
|
|
2
|
+
var updatePrime = function (m) {
|
|
3
|
+
var n = prime[prime.length - 1];
|
|
4
|
+
var i = 1;
|
|
5
|
+
a: while (n < m) {
|
|
6
|
+
n += 2;
|
|
7
|
+
if (prime[i] * prime[i] < n) i++;
|
|
8
|
+
for (var cx = 0, dx = i + 1; cx < dx; cx++) {
|
|
9
|
+
if (n % prime[cx] === 0) continue a;
|
|
10
|
+
}
|
|
11
|
+
prime.push(n);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
var isPrime = function (s) {
|
|
15
|
+
var n = Math.sqrt(Number(s));
|
|
16
|
+
s = BigInt(s);
|
|
17
|
+
if (n > prime[prime.length - 1]) updatePrime(n);
|
|
18
|
+
for (var cx = 0; prime[cx] < n; cx++)if (s % BigInt(prime[cx]) === 0n) return false;
|
|
19
|
+
return true;
|
|
20
|
+
};
|
|
21
|
+
prime.isPrime = isPrime;
|
|
22
|
+
prime.find = function (start, delta, end) {
|
|
23
|
+
var isBigInt = typeof start === 'bigint' || typeof end === 'bigint';
|
|
24
|
+
var n = [0, 1, 2];
|
|
25
|
+
if (isBigInt) {
|
|
26
|
+
start = BigInt(start);
|
|
27
|
+
delta = BigInt(delta);
|
|
28
|
+
n = n.map(BigInt);
|
|
29
|
+
} else {
|
|
30
|
+
start = Number(start);
|
|
31
|
+
delta = Number(delta);
|
|
32
|
+
}
|
|
33
|
+
if (!(delta > n[0]) && !(delta < n[0])) {
|
|
34
|
+
return isPrime(start);
|
|
35
|
+
}
|
|
36
|
+
if (delta != n[1] && delta != -n[1] && start % delta == n[0]) {
|
|
37
|
+
return null;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (delta % n[1]) return null;
|
|
41
|
+
if (start % n[2] === n[0]) {
|
|
42
|
+
start += delta > n[0] ? n[1] : -n[1];
|
|
43
|
+
}
|
|
44
|
+
if (delta === n[1] || delta === -n[1]) {
|
|
45
|
+
delta *= n[2];
|
|
46
|
+
}
|
|
47
|
+
if (end) {
|
|
48
|
+
var res = [];
|
|
49
|
+
if (isBigInt) end = BigInt(end);
|
|
50
|
+
else end = Number(end);
|
|
51
|
+
for (var cx = start, dx = end + n[1], ex = delta; ex > n[0] ? cx < dx : cx > dx; cx += ex) {
|
|
52
|
+
if (isPrime(cx)) res.push(cx);
|
|
53
|
+
}
|
|
54
|
+
} else {
|
|
55
|
+
while (!isPrime(start)) start += delta;
|
|
56
|
+
var res = start;
|
|
57
|
+
}
|
|
58
|
+
return res;
|
|
59
|
+
|
|
60
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
var test = function (a, b, c) {
|
|
2
|
+
var start = new Date;
|
|
3
|
+
prime.find(a, b, c)
|
|
4
|
+
var end = new Date;
|
|
5
|
+
console.log(a, b, c, '用时', end - start);
|
|
6
|
+
}
|
|
7
|
+
test(19000000n, 1, 21000000n);
|
|
8
|
+
test(19000000, 1, 21000000);
|
|
9
|
+
test(19000000, 1, 21000000);
|
|
10
|
+
test(19000000n, 1, 21000000n);
|
|
@@ -152,7 +152,7 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
152
152
|
saved_opacity = targetBox.style.opacity;
|
|
153
153
|
rebuildTargets = function () { };
|
|
154
154
|
[moveMargin, moveChildren, scroll] = getMoveFuncs(targetChild);
|
|
155
|
-
moveChildren = moveChildren.bind(null,
|
|
155
|
+
moveChildren = moveChildren.bind(null, that, previousElements, followedElements, moveMargin, recover);
|
|
156
156
|
} else {
|
|
157
157
|
previousElements = [];
|
|
158
158
|
followedElements = [];
|
|
@@ -176,7 +176,7 @@ var hooka = function (matcher, move, event, targetChild, isMovingSource) {
|
|
|
176
176
|
previousElements = [].slice.call(targetBox.children, 0).reverse();
|
|
177
177
|
followedElements = [];
|
|
178
178
|
[moveMargin, moveChildren, scroll] = getMoveFuncs(previousElements[0]);
|
|
179
|
-
moveChildren = moveChildren.bind(null,
|
|
179
|
+
moveChildren = moveChildren.bind(null, that, previousElements, followedElements, moveMargin, recover);
|
|
180
180
|
};
|
|
181
181
|
}
|
|
182
182
|
};
|
package/coms/zimoli/table.js
CHANGED
|
@@ -121,6 +121,7 @@ function table(elem) {
|
|
|
121
121
|
move: resizeTarget,
|
|
122
122
|
});
|
|
123
123
|
onmousemove(tableElement, function (event) {
|
|
124
|
+
if (!thead) [thead] = table.getElementsByTagName("thead");
|
|
124
125
|
if (!getTargetIn(thead, event.target)) return;
|
|
125
126
|
var tds = getTargetIn(cellMatchManager, event.target);
|
|
126
127
|
if (!isArray(tds)) tds = [];
|
|
@@ -159,6 +160,7 @@ function table(elem) {
|
|
|
159
160
|
return thead;
|
|
160
161
|
};
|
|
161
162
|
care(table, function ([fields, data]) {
|
|
163
|
+
thead = null;
|
|
162
164
|
this.innerHTML = template;
|
|
163
165
|
render(this, {
|
|
164
166
|
fields,
|
|
@@ -169,10 +171,7 @@ function table(elem) {
|
|
|
169
171
|
})
|
|
170
172
|
autodragchildren(
|
|
171
173
|
table,
|
|
172
|
-
|
|
173
|
-
console.log('match')
|
|
174
|
-
return cellMatchManager.apply(this, arguments);
|
|
175
|
-
},
|
|
174
|
+
cellMatchManager,
|
|
176
175
|
function (src, dst, rel, append, parentNode) {
|
|
177
176
|
if (table.src) {
|
|
178
177
|
var [fields] = table.src;
|