efront 3.35.9 → 3.35.10
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/Matrix.js +3 -2
- package/coms/reptile/cross.js +1 -1
- package/coms/reptile/gbk2utf8.js +68 -0
- package/package.json +1 -1
- package/public/efront.js +1 -1
package/coms/basic/Matrix.js
CHANGED
|
@@ -58,9 +58,10 @@ class Matrix extends Array {
|
|
|
58
58
|
return this;
|
|
59
59
|
}
|
|
60
60
|
translate(vector) {
|
|
61
|
-
|
|
61
|
+
var v = vector;
|
|
62
|
+
if (!isFinite(v.length)) v = arguments;
|
|
62
63
|
this.dirty();
|
|
63
|
-
return this.constructor.translate(this,
|
|
64
|
+
return this.constructor.translate(this, v);
|
|
64
65
|
}
|
|
65
66
|
scale(ratio, center) {
|
|
66
67
|
this.dirty();
|
package/coms/reptile/cross.js
CHANGED
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var fs = require("fs");
|
|
3
|
+
var points = [
|
|
4
|
+
0x3000, 0x3003,
|
|
5
|
+
0x3005, 0x3017,
|
|
6
|
+
0x301d, 0x301e,
|
|
7
|
+
0x3021, 0x3029,
|
|
8
|
+
0x3041, 0x3093,
|
|
9
|
+
0x309b, 0x309e,
|
|
10
|
+
0x30a1, 0x30f6,
|
|
11
|
+
0x30fc, 0x30fe,
|
|
12
|
+
0x3105, 0x3129,
|
|
13
|
+
0x3220, 0x3229,
|
|
14
|
+
0x3231, 0x3231,
|
|
15
|
+
0x32a3, 0x32a3,
|
|
16
|
+
0x32a3, 0x32a3,
|
|
17
|
+
0x338e, 0x338f,
|
|
18
|
+
0x339c, 0x339e,
|
|
19
|
+
0x33a1, 0x33a1,
|
|
20
|
+
0x33c4, 0x33c4,
|
|
21
|
+
0x33ce, 0x33ce,
|
|
22
|
+
0x33d1, 0x33d2,
|
|
23
|
+
0x33d5, 0x33d5,
|
|
24
|
+
0x4e00, 0x9fa5,
|
|
25
|
+
0xe76c, 0xe76c,
|
|
26
|
+
0xe78d, 0xe796,
|
|
27
|
+
0xe7e7, 0xe7f3,
|
|
28
|
+
0xe815, 0xe864,
|
|
29
|
+
0xff01, 0xff5e
|
|
30
|
+
];
|
|
31
|
+
var gbk = fs.readFileSync(require("path").join(__dirname, "../../data/gbk.txt"));
|
|
32
|
+
var index = 0;
|
|
33
|
+
var map = [];
|
|
34
|
+
while (points.length) {
|
|
35
|
+
for (var cx = points.shift(), dx = points.shift() + 1; cx < dx; cx++) {
|
|
36
|
+
var code = gbk[index++] << 8 | gbk[index++];
|
|
37
|
+
map[code] = String.fromCharCode(cx);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
// var map2 = [], saved = -1;
|
|
41
|
+
// for (var cx = 0, dx = map.length; cx < dx; cx++) {
|
|
42
|
+
// if (map[cx]) {
|
|
43
|
+
// var start = cx;
|
|
44
|
+
// while (map[++cx]);
|
|
45
|
+
// var end = cx - 1;
|
|
46
|
+
// map2.push(start - saved - 1, end - start);
|
|
47
|
+
// saved = end;
|
|
48
|
+
// }
|
|
49
|
+
// }
|
|
50
|
+
// console.log(map2.join());
|
|
51
|
+
// fs.writeFileSync("bb.txt",map.join(""));
|
|
52
|
+
|
|
53
|
+
module.exports = function gbk2utf8(buff) {
|
|
54
|
+
var temp = 0;
|
|
55
|
+
var res = [];
|
|
56
|
+
for (var cx = 0, dx = buff.length; cx < dx; cx++) {
|
|
57
|
+
var buf = buff[cx];
|
|
58
|
+
if (temp) {
|
|
59
|
+
res.push(map[temp << 8 | buf]);
|
|
60
|
+
temp = 0;
|
|
61
|
+
} else if (buf > 0x7f) {
|
|
62
|
+
temp = buf;
|
|
63
|
+
} else {
|
|
64
|
+
res.push(String.fromCharCode(buf));
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
return res.join("");
|
|
68
|
+
}
|