efront 4.22.3 → 4.22.5

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.
@@ -34,8 +34,8 @@
34
34
  unique-save: options ::unique-:data
35
35
  recert: options ::recert
36
36
  upload: put :path
37
- https://www.ip.cn/:
38
- iplocation: get https://www.ip.cn/api/index?ip=:ip&type=1
37
+ https://www.ip.cn/ referer=https://www.ip.cn/api/index/&Cookie=:empty:
38
+ iplocation: get /api/index/?ip=:ip&type=1
39
39
  # https://ipchaxun.com/ :
40
40
  # iplocation: get:[].info%20label:nth-child(n+2)>span:nth-child(2) :ip/
41
41
  # https://www.ip138.com/:
@@ -51,7 +51,9 @@ data.bindInstance("base", async function (base) {
51
51
  for (var k in apimap) {
52
52
  var api = apimap[k];
53
53
  if (api.base || !/^\w+\:\/\//.test(api.url)) {
54
- api.base = base.base;
54
+ if (api.headers && 'authorization' in api.headers) {
55
+ api.base = base.base;
56
+ }
55
57
  }
56
58
  }
57
59
  });
@@ -8,7 +8,7 @@ model.setReader('jscode', "text");
8
8
  return plist.bind(null, '任务管理', "task", refilm`
9
9
  *任务ID/key 100
10
10
  *任务名/name 100
11
- *是否启用/status radio 不启用,启用
11
+ *是否启用/status radio 不启用#ccc,启用#396
12
12
  任务代码/code jscode
13
13
  / $ ${[
14
14
  {
@@ -49,7 +49,7 @@ var _devicePixelRatio = devicePixelRatio;
49
49
  var request = window.request || function (url, onload, onerror, version) {
50
50
  var xhr = new (XMLHttpRequest || ActiveXObject)("Microsoft.XMLHTTP");
51
51
  url = encodeURI(url);
52
- xhr.open("POST", url);
52
+ xhr.open("PURGE", url);
53
53
  xhr.onreadystatechange = function () {
54
54
  if (xhr.readyState === 4) {
55
55
  var status = xhr.status;
@@ -398,10 +398,8 @@ function cross_(jsonp, digest = noop, method, url, headers) {
398
398
  var prepareHeaders = () => {
399
399
  cookie_ = this.hostCookie(xhr);
400
400
  var _cookies = cookie_.getCookies(originDomain);
401
- if (_cookies) {
402
- _headers.Cookie = _cookies;
403
- }
404
401
  var cookobj = null;
402
+ var hasCookie = false;
405
403
  for (var k in headers) {
406
404
  if (/^\$/.test(headers[k])) {
407
405
  var k2 = headers[k].slice(1);
@@ -416,10 +414,21 @@ function cross_(jsonp, digest = noop, method, url, headers) {
416
414
  realHeaders[k1] = headers[k];
417
415
  }
418
416
  else {
417
+ if (/Cookie/i.test(k)) {
418
+ hasCookie = true;
419
+ if (isEmpty(headers[k])) {
420
+ continue;
421
+ }
422
+ _headers.Cookie = headers[k];
423
+ continue;
424
+ }
419
425
  _headers[k] = headers[k];
420
426
  }
421
427
  }
422
428
  }
429
+ if (_cookies && !hasCookie) {
430
+ _headers.Cookie = _cookies;
431
+ }
423
432
  };
424
433
  var _headers = {};
425
434
  if (/^[mc]/i.test(method)) {
@@ -524,7 +533,14 @@ cross_.bind = function () {
524
533
  setHost,
525
534
  addReform,
526
535
  addDirect,
527
- getCrossUrl
536
+ getCrossUrl,
537
+ // 之前一直以为中国习是中国走向衰败的罪魁祸首,可是随着了解的史料越来越多,越发觉得之前以为的是错的,中国习不过是泱泱赤匪的一个代表,赤匪从根上就是长了四只脚的土匪,他们任人唯亲,见利忘义,睚眦必报,是盘踞在华夏大地的邪恶力量的化身。他们不辨是非,做事一轰而上,唯上级马屁是瞻,遇到问题首先想到的是封锁消息,问题爆发又会选择性失聪,顾左右而言其他。
538
+ // 赤匪犯境时,河南大学为了保护师资,举校万里迁徙,赤匪看不见这其中的民族大义,篡权后将将北大清华那种墙头草视为香饽饽,倾斜各种资源重点培养,助长他们的墙头草作风。你看那清华北大,为国外培养了多少高科技人才啊,他们之前是墙头草,如今也还是墙头草。
539
+ // 儿时那清凉可口的井水,如今散发着浓郁的农药味。儿时那干净透亮的空气,晴天可以看到白云,阴天可以看到乌云,晚上还有月牙和群星同晖,如今已长年雾蒙蒙一片。可怜我华夏大地被赤匪汲取精华拱手送人,忍受各国糟粕还要强颜欢笑。
540
+ get: cross_.bind(null, 'GET'),
541
+ post: cross_.bind(null, 'POST'),
542
+ put: cross_.bind(null, 'PUT'),
543
+ delete: cross_.bind(null, 'DELETE'),
528
544
  });
529
545
  return cross_;
530
546
  }
@@ -19,11 +19,16 @@ function scanBlock(piece) {
19
19
  res.push(a);
20
20
  };
21
21
  var avoid = false;
22
+ var instr = null;
22
23
  for (var cx = 0, dx = piece.length; cx < dx; cx++) {
23
24
  reg.lastIndex = cx;
24
25
  var m = reg.exec(piece);
25
26
  if (m) {
26
27
  var s = m[0];
28
+ if (instr) {
29
+ if (instr === s) instr = null;
30
+ continue;
31
+ }
27
32
  if (/^(\s+|\^)$/.test(s)) {
28
33
  if (s === '^') {
29
34
  avoid = res.length;
@@ -32,12 +37,10 @@ function scanBlock(piece) {
32
37
  save(piece.slice(lastIndex, reg.lastIndex));
33
38
  }
34
39
  lastIndex = reg.lastIndex;
35
- } else if (/^["']$/i.test(s)) {
36
- var i = piece.indexOf(s, cx + 1);
37
- if (i > 0) {
38
- cx = i;
39
- continue;
40
- }
40
+ }
41
+ else if (/^[`"']$/i.test(s)) {
42
+ instr = s;
43
+ continue;
41
44
  }
42
45
  cx = m.index + s.length - 1;
43
46
  } else {
@@ -51,29 +54,39 @@ function scanBlock(piece) {
51
54
 
52
55
  function scanSlant(str, s, lastIndex = 0, end = str.length) {
53
56
  s = s.replace(/[\/]/g, '\\$&');
54
- var reg = new RegExp(`${/\\[\s\S]/.source}|${s}`, 'g');
57
+ var reg = new RegExp(`${/\\[\s\S]/.source}|[${s}'"\`]`, 'g');
55
58
  var reg1 = new RegExp(`^${s}$`);
56
59
  var res = [];
57
60
  var start = lastIndex, start;
61
+ var instr = false;
58
62
  while (lastIndex < end) {
59
63
  reg.lastIndex = lastIndex;
60
64
  var match = reg.exec(str);
61
65
  if (!match) {
62
66
  break;
63
67
  }
68
+ var [s] = match;
69
+ if (instr) {
70
+ if (instr === s) instr = null;
71
+ continue;
72
+ }
73
+ if (/^['"`]$/.test(s)) {
74
+ instr = s;
75
+ continue;
76
+ }
64
77
  lastIndex = match.index + match[0].length;
65
- if (!reg1.test(match[0])) {
78
+ if (!reg1.test(s)) {
66
79
  continue;
67
80
  }
68
81
  if (lastIndex === start) {
69
82
  lastIndex++;
70
83
  continue;
71
84
  }
72
- res.push(str.slice(start, match.index).replace(/\\([\s\S])/g, '$1'));
85
+ res.push(strings.decode(str.slice(start, match.index)));
73
86
  start = lastIndex;
74
87
  }
75
88
  if (start < end) {
76
- res.push(str.slice(start, end).replace(/\\([\s\S])/g, '$1'));
89
+ res.push(strings.decode(str.slice(start, end)));
77
90
  }
78
91
  return res;
79
92
  }
@@ -121,15 +134,28 @@ var createEval = function (express, value) {
121
134
  name: express
122
135
  });
123
136
  };
124
-
125
- var createOption = function (o) {
137
+ var getColorFromTail = function (o) {
138
+ var m;
139
+ if (m = /\#(?:[0-9a-f]{3,4}){1,2}$/.exec(o)) {
140
+ o = o.slice(0, m.index);
141
+ return [o, color.format(m[0])];
142
+ }
143
+ return [o];
144
+ }
145
+ var createOption = function (o, i) {
126
146
  if (isObject(o)) {
147
+ if (!o.color) [o.name, o.color] = getColorFromTail(o.name);
127
148
  o.toString = toName;
128
149
  o.valueOf = toValue;
129
150
  return o;
130
151
  }
152
+ var [name, color] = getColorFromTail(o);
153
+ if (!color && !/[,\/]/.test(o)) return name;
154
+ var [name, key = i] = spreadkey(name);
131
155
  return {
132
- name: o,
156
+ name,
157
+ key,
158
+ color,
133
159
  valueOf: toValue,
134
160
  toString: toName
135
161
  };
@@ -139,9 +165,9 @@ function unfoldOptions(size, options) {
139
165
  for (var cx = 0, dx = options.length; cx < dx; cx++) {
140
166
  var o = options[cx];
141
167
  if (typeof o === 'string') {
142
- var [name, key = name] = spreadkey(o);
168
+ var [name, key = name, needs, color] = spreadkey(o);
143
169
  if (parseInt(key) === +key) key = +key;
144
- o = { name, key };
170
+ o = { name, key, color, needs };
145
171
  }
146
172
  var range = rangereg.exec(o.name);
147
173
  if (range) {
@@ -269,13 +295,14 @@ function spreadkey(name) {
269
295
  }
270
296
  return [name, key, needs, holder];
271
297
  }
272
- function parseOptions(options) {
273
- if (typeof options === "string" && !/^[\$#]+\d+$/.test(options)) {
298
+ function parseOptions(size, options) {
299
+ if (typeof options === "string" && !/^[\$&]+\d+$/.test(options)) {
274
300
  var needUnfold = /^\[|\]$/.test(options);
275
301
  options = options.replace(/^\[|\]$/g, '');
276
302
  if (needUnfold || /,/.test(options)) options = scanSlant(options, ',');
277
303
  else options = scanSlant(options, "");
278
304
  if (needUnfold) unfoldOptions(size, options);
305
+ else options = options.map(createOption);
279
306
  }
280
307
  return options;
281
308
  }
@@ -333,7 +360,7 @@ function parse(piece) {
333
360
  return [, a];
334
361
  };
335
362
  var is = function (a) {
336
- var reg = /^\$(?!\d)|[\*\+\-\!\-\$&\?\~\:;]|^[\*\+\-\!\-&\?\~]$/;
363
+ var reg = /^\$(?!\d)|\$$|^[\*\+\-\!\-&\?\~]|[\*\+\-\!\-&\?\~\:;]$|^[\*\+\-\!\-&\?\~]$/;
337
364
  if (!reg.test(a)) return a;
338
365
  [colon, a] = test(/\;$/, a);
339
366
  if (colon) colon = false;
@@ -342,9 +369,10 @@ function parse(piece) {
342
369
  [inlist, a] = test(/^[\+]|[\+]$/, a);
343
370
  [inlist, a] = test(/^[\!]|[\!]$/, a);
344
371
  [hidden, a] = test(/^\-|\-$/, a);
345
- [readonly, a] = test(/^&|\$(?!\d)|[\$&]$/, a);
372
+ [readonly, a] = test(/^&|^\$(?!\d)|[\$&]$/, a);
346
373
  [delete_onempty, a] = test(/^\?|\?$/, a);
347
374
  [delete_onsubmit, a] = test(/^\~|\~$/, a);
375
+
348
376
  return a.replace(reg, '');
349
377
  };
350
378
  var type1 = is(type);
@@ -451,8 +479,8 @@ function parse(piece) {
451
479
  editable = true;
452
480
  options = options.replace(/^[\+\-\*]|[\+\*\-]$/g, '');
453
481
  }
454
- options = parseOptions(options);
455
- avoid = parseOptions(avoid1 || avoid);
482
+ options = parseOptions(size, options);
483
+ avoid = parseOptions(size, avoid1 || avoid);
456
484
  name = is(name);
457
485
  key = is(key);
458
486
  }
@@ -22,3 +22,4 @@ test(refilm`连城剑法 别名 ^[唐诗剑法/0,躺尸剑法/1]`, ['avoid', 1,
22
22
  test(refilm`连城剑法 别名 [唐诗剑法/0,躺尸剑法/1] ^[a,b]`, ['options', 1, 'key'], 1);
23
23
  test(refilm`连城剑法 别名 [唐诗剑法/0,躺尸剑法/1] ^[a,b]`, ['avoid', 1, 'key'], 'b');
24
24
  test(refilm`连城剑法 别名 [唐诗剑法/0,躺尸剑法/1] ^${[{ key: 'a' }, { key: 'c' }]}`, ['avoid', 1, 'key'], 'c');
25
+ test(refilm`连城剑法 别名 [唐诗剑法/0/#c29,躺尸剑法/1]`, ['options', 0, 'color'], '#c29');
@@ -75,7 +75,7 @@ function getI18nPrefixedText(code, dist = []) {
75
75
  return dist;
76
76
  }
77
77
  var ctn = function (tt, t) {
78
- var tn = scanner2(tt.replace(/[\$#]+(\d+)/g, (_, i) => {
78
+ var tn = scanner2(tt.replace(/[\$&]+(\d+)/g, (_, i) => {
79
79
  var a = (i << 1) - 1;
80
80
  if (a in t) return `\${${a}}`;
81
81
  return _;
@@ -152,8 +152,8 @@ function translate([imap, supports], code) {
152
152
  var o = scanner2('={}')[1];
153
153
  Object.keys(f).forEach(k => {
154
154
  var v = f[k];
155
- if (/[\$#]\d+/.test(v)) {
156
- var a = v.replace(/^[\$#]+/, '');
155
+ if (/[\$&]\d+/.test(v)) {
156
+ var a = v.replace(/^[\$&]+/, '');
157
157
  var a = (a << 1) - 1;
158
158
  if (a in t) v = t[a];
159
159
  else v = scanner2(JSON.stringify(v));
@@ -1,6 +1,11 @@
1
1
  return async function (a) {
2
2
  var ip = a.ip || a.remote;
3
3
  var m = /(\d+\.){3}\d+$/.exec(ip);
4
- var { address } = await data.from("iplocation", { ip: m ? m[0] : ip });
5
- a.address = address;
4
+ var res = await data.from("iplocation", { ip: m ? m[0] : ip });
5
+ if (res.data) res = res.data;
6
+ if (res.address) res = res.address;
7
+ else if (res.country || res.isp) {
8
+ res = [res.country, res.province, res.city, res.district, res.isp].join(' ');
9
+ }
10
+ a.address = res;
6
11
  }
@@ -11,6 +11,7 @@ function XMLHttpRequest() {
11
11
  }
12
12
  XMLHttpRequest.prototype.open = function (method, url) {
13
13
  this.readyState = 1;
14
+ if (/^(options|get|post|put|delete)$/i.test(method)) method = method.toUpperCase();
14
15
  this.method = method;
15
16
  this.url = url;
16
17
  };
@@ -38,7 +38,7 @@ var api = function () {
38
38
  }
39
39
  }
40
40
  if (!method) {
41
- method = "post";
41
+ method = "PURGE";
42
42
  }
43
43
 
44
44
  if (!uri) {
@@ -27,7 +27,7 @@ function button(texter, type) {
27
27
  _texter = _label.cloneNode();
28
28
  if (isString(texter)) {
29
29
  if (!type) {
30
- texter = texter.replace(/#\w*/, function (w) {
30
+ texter = texter.replace(/#\w*$/, function (w) {
31
31
  if (/^#([a-f\d]{3,4}){1,2}$/.test(w)) {
32
32
  type = w;
33
33
  }
@@ -222,7 +222,15 @@ var readonly_types = {
222
222
  if (!field.optionsMap) field.optionsMap = createOptionsMap(field.options);
223
223
  var o = field.optionsMap[v];
224
224
  try { this.setAttribute(field.key, v); } catch { }
225
- if (isObject(o)) return `<s></s>` + o.name;
225
+ if (isObject(o)) {
226
+ if (o.color) {
227
+ css(this, { color: o.color });
228
+ var b = document.createElement('label');
229
+ b.innerText = o.name;
230
+ return b;
231
+ }
232
+ return o.name;
233
+ }
226
234
  if (isHandled(o)) return o;
227
235
  }
228
236
  if (isEmpty(v)) v = '';
@@ -293,6 +301,19 @@ var getOptionsFrom = function () {
293
301
  var { data, field } = this;
294
302
  return data[field.options_from];
295
303
  };
304
+ function setModel(ipt) {
305
+ var elem = this;
306
+ if (isHandled(ipt) && ipt !== elem) {
307
+ if (isNode(ipt)) {
308
+ var model = new Model(getScopeValue, setScopeValue, ipt);
309
+ model.hook(elem, elem.field.option_to ? copyOptionData : true);
310
+ appendChild(elem, ipt);
311
+ }
312
+ else {
313
+ elem.innerText = ipt;
314
+ }
315
+ }
316
+ }
296
317
  function setBinder(elem, binder) {
297
318
  if (binder === elem.$binder) return;
298
319
  removeFromList(elem.$renders, elem.$binder);
@@ -303,17 +324,11 @@ function setBinder(elem, binder) {
303
324
  }
304
325
  else {
305
326
  var ipt = binder(elem);
306
- binder = null;
307
- if (isHandled(ipt) && ipt !== elem) {
308
- if (isNode(ipt)) {
309
- var model = new Model(getScopeValue, setScopeValue, ipt);
310
- model.hook(elem, elem.field.option_to ? copyOptionData : true);
311
- appendChild(elem, ipt);
312
- }
313
- else {
314
- elem.innerHTML = ipt;
315
- }
327
+ if (ipt && isFunction(ipt.then)) {
328
+ ipt.then(setModel.bind(elem));
316
329
  }
330
+ else setModel.call(elem, ipt);
331
+ binder = null;
317
332
  }
318
333
  elem.$binder = binder;
319
334
  }
@@ -78,4 +78,23 @@
78
78
  @u(3);
79
79
  @u(4);
80
80
  @u(5);
81
- @u(6);
81
+ @u(6);
82
+
83
+ &[readonly] {
84
+
85
+ &[type=radio] {
86
+ &:before {
87
+ vertical-align: middle;
88
+ content: '';
89
+ border-radius: 50%;
90
+ box-sizing: border-box;
91
+ border: 6px solid;
92
+ display: inline-block;
93
+ margin: 0 6px;
94
+ }
95
+
96
+ label {
97
+ color: #333;
98
+ }
99
+ }
100
+ }
@@ -604,9 +604,8 @@ class Model {
604
604
  var getValue = target.getValue;
605
605
  var setValue = target.setValue;
606
606
  if (getValue && setValue);
607
- else if ('value' in target) {
608
- if (!setValue) setValue = stValue;
609
- if (!getValue) getValue = gtValue;
607
+ else if ('value' in target && setValue) {
608
+ getValue = gtValue;
610
609
  }
611
610
  else if (/^input$/i.test(target.tagName) && /^checkbox$/i.test(target.type) || /^checkbox$/i.test(target.tagName)) {
612
611
  if (!getValue) getValue = gtChecked;
@@ -244,4 +244,22 @@ thead {
244
244
  [type=number],
245
245
  [type=price] {
246
246
  float: right;
247
+ }
248
+
249
+ tbody,
250
+ [tbody] {
251
+
252
+ [type=jscode],
253
+ [type=function] {
254
+ display: -webkit-box;
255
+ -webkit-box-orient: vertical;
256
+ -webkit-line-clamp: 2;
257
+ text-overflow: ellipsis;
258
+ line-height: 16px;
259
+ font-size: 14px;
260
+ white-space: pre;
261
+ font-family: Consolas, "Courier New", monospace;
262
+ color: #666;
263
+ overflow: hidden;
264
+ }
247
265
  }
@@ -45,7 +45,7 @@ function 函数帧(p1, p2, point) {
45
45
  });
46
46
  }
47
47
  var targetWidth = innerWidth;
48
- var unitFloatReg = /^(\d+(?:\.\d+)?|\.\d+)([^\d]*)$/;
48
+ var unitFloatReg = /^[\+\-]?(\d+(?:\.\d+)?|\.\d+)([^\d]*)$/;
49
49
  function 单位帧(u1, u2, point) {
50
50
  var m1 = unitFloatReg.exec(u1);
51
51
  if (!m1) return u1;
@@ -68,6 +68,9 @@ function 值帧(k, v1, v2, point) {
68
68
  if (/color|background/.test(k)) {
69
69
  return 颜色帧(v1, v2, point);
70
70
  }
71
+ if (/opacity/.test(k)) {
72
+ return 浮点帧(v1, v2, Math.abs(point));
73
+ }
71
74
  if (/\(/.test(v1)) {
72
75
  return 函数帧(v1, v2, point);
73
76
  }