efront 3.35.9 → 3.35.11
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/frame/chat.js +20 -5
- package/coms/frame/chat.less +19 -2
- package/coms/frame/edit.less +1 -0
- package/coms/kugou/krc.js +1 -1
- 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/frame/chat.js
CHANGED
|
@@ -16,12 +16,12 @@ function msg(elem, { m }, parentScopes) {
|
|
|
16
16
|
}
|
|
17
17
|
if (m) switch (m.type) {
|
|
18
18
|
case "html":
|
|
19
|
-
elem.innerHTML = m.content;
|
|
19
|
+
elem.innerHTML = /<(script|iframe)(\s|>)|(src|href)=(['"`]|)javascript\:/i.test(m.content) ? `<span color="#c24">对方正试图窃取您的信息</span>` : m.content;
|
|
20
20
|
break;
|
|
21
21
|
case "file":
|
|
22
22
|
var files = m.content;
|
|
23
23
|
elem.setAttribute("files", '');
|
|
24
|
-
elem.innerHTML = files.map(f => `<a class=file>${shapes$file}
|
|
24
|
+
elem.innerHTML = files.map(f => `<a class=file>${f.icon ? `<img src="${f.icon.replace(/\"/g, '')}"/>` : shapes$file}<span>${f.name.replace(/[><]/g, a => `&#${a.codePointAt(0)};`)}</span></a>`).join("");
|
|
25
25
|
elem.files = files;
|
|
26
26
|
onclick(elem, clickfile);
|
|
27
27
|
break;
|
|
@@ -221,10 +221,25 @@ function chat(title = '会话窗口') {
|
|
|
221
221
|
var files = await chooseFile('*.*', true);
|
|
222
222
|
this.sendFiles(files);
|
|
223
223
|
},
|
|
224
|
-
sendFiles(files) {
|
|
224
|
+
async sendFiles(files) {
|
|
225
225
|
var flist = [];
|
|
226
|
+
var URL = window.URL;
|
|
226
227
|
for (var f of files) {
|
|
227
|
-
|
|
228
|
+
if (URL && f.size < 100 * 1000 * 1000 && /\.(png|jpeg|jpg|jpe|gif|bmp)$/.test(f.name)) {
|
|
229
|
+
var canvas = document.createElement('canvas');
|
|
230
|
+
var size = 32;
|
|
231
|
+
canvas.width = size;
|
|
232
|
+
canvas.height = size;
|
|
233
|
+
var context = canvas.getContext("2d");
|
|
234
|
+
var img = new Image;
|
|
235
|
+
var u = URL.createObjectURL(f);
|
|
236
|
+
img.src = u;
|
|
237
|
+
await awaitable(img);
|
|
238
|
+
context.drawImage(img, 0, 0, size, size);
|
|
239
|
+
f.icon = canvas.toDataURL();
|
|
240
|
+
URL.revokeObjectURL(u);
|
|
241
|
+
}
|
|
242
|
+
flist.push({ name: f.name, icon: f.icon, size: f.size, id: ++fid, mtime: +f.lastModified });
|
|
228
243
|
filesMap[fid] = f;
|
|
229
244
|
}
|
|
230
245
|
return this.send('file', flist);
|
|
@@ -248,7 +263,7 @@ function chat(title = '会话窗口') {
|
|
|
248
263
|
if (data.length > 2000) {
|
|
249
264
|
return alert("信息太长,无法发送!");
|
|
250
265
|
}
|
|
251
|
-
if (this.user && this.user.id !== this.localid) {
|
|
266
|
+
if (this.user && this.user.id !== this.localid && type !== "accept") {
|
|
252
267
|
addToMsgList(this.msglist, [msg]);
|
|
253
268
|
}
|
|
254
269
|
data = encode62.timeencode(data);
|
package/coms/frame/chat.less
CHANGED
|
@@ -181,6 +181,21 @@ msg[files] {
|
|
|
181
181
|
text-align: left;
|
|
182
182
|
border-radius: 0;
|
|
183
183
|
|
|
184
|
+
>img {
|
|
185
|
+
width: 32px;
|
|
186
|
+
height: 32px;
|
|
187
|
+
margin-left: -10px;
|
|
188
|
+
vertical-align: top;
|
|
189
|
+
line-height: 32px;
|
|
190
|
+
|
|
191
|
+
&+* {
|
|
192
|
+
display: inline-block;
|
|
193
|
+
margin-left: 6px;
|
|
194
|
+
line-height: 32px;
|
|
195
|
+
vertical-align: top;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
184
199
|
&:hover {
|
|
185
200
|
border-color: #c80;
|
|
186
201
|
background-color: #ffe;
|
|
@@ -192,12 +207,14 @@ msg[files] {
|
|
|
192
207
|
|
|
193
208
|
&:first-child {
|
|
194
209
|
border-top-color: transparent;
|
|
195
|
-
border-radius: 3px
|
|
210
|
+
border-top-right-radius: 3px;
|
|
211
|
+
border-top-left-radius: 3px;
|
|
196
212
|
}
|
|
197
213
|
|
|
198
214
|
&:last-child {
|
|
199
215
|
border-bottom-color: transparent;
|
|
200
|
-
border-radius:
|
|
216
|
+
border-bottom-left-radius: 3px;
|
|
217
|
+
border-bottom-right-radius: 3px;
|
|
201
218
|
}
|
|
202
219
|
}
|
|
203
220
|
}
|
package/coms/frame/edit.less
CHANGED
package/coms/kugou/krc.js
CHANGED
|
@@ -2,7 +2,7 @@ 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
|
-
if (info.
|
|
5
|
+
if (!info.krc) {
|
|
6
6
|
remove(list.children);
|
|
7
7
|
if (info.lrc) {
|
|
8
8
|
var children = createLRC(info.lrc);
|
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
|
+
}
|