efront 3.34.7 → 3.34.8

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.
@@ -579,7 +579,8 @@ var init = function (name, then, prebuilds) {
579
579
  } while (rest.length);
580
580
  track = track.map(([d, a, e]) => ` ${new Array(d + 1).join("•")} ${new Array(2 + length - a.length - d).join("-")} ${a} 溃于: ${e.reverse().join(", ")}`)
581
581
  // -->
582
- console.error(`加载 ${name} 失败,${ed && ed.length ? `${ed.join(', ')} 等 ${ed.length} 个模块` : "没有其他模块"}受到影响。\r\n${track.join("\r\n")}`);
582
+ var report = window.performance || !window.alert ? console.error : window.alert;
583
+ report(`加载 ${name} 失败,${ed && ed.length ? `${ed.join(', ')} 等 ${ed.length} 个模块` : "没有其他模块"}受到影响。\r\n${track.join("\r\n")}`);
583
584
  };
584
585
  loadModule(name, function (error) {
585
586
  if (hasOwnProperty.call(modules, name)) {
@@ -97,14 +97,19 @@ inertia.MOVING = 移动;
97
97
  inertia.SLOWING_DWON = 减速;
98
98
  inertia.REBOUNDING = 回弹;
99
99
  inertia.DOCKING = 停靠;
100
-
100
+ var performance = window.performance;
101
+ if (!performance || !performance.now) performance = Date;
102
+ var now = performance.now;
103
+ if (!performance.now) performance.now = function () {
104
+ return +new Date;
105
+ }
101
106
  class Speed extends Array {
102
107
  cache = [];
103
108
  stamp = 0;
104
109
  deltat = 0;
105
110
  accelerate = .1;
106
111
  static now() {
107
- return performance.now ? performance.now() : Date.now();
112
+ return performance.now();
108
113
  }
109
114
  static inertia = inertia;
110
115
  reset() {
@@ -119,6 +124,7 @@ class Speed extends Array {
119
124
  }
120
125
  write(values, stamp = Speed.now()) {
121
126
  if (values.length !== this.length || this.length && this.cache.length < 2) this.unset();
127
+ if (stamp - this.cache[this.cache.length - 1] === 0) return;
122
128
  this.cache.push(values, stamp);
123
129
  if (this.cache.length > 20) this.cache.splice(0, 12);
124
130
  var start = Math.max(this.cache.length - 6, 0);
@@ -81,7 +81,7 @@ function main(express) {
81
81
  add_exp(str);
82
82
  }
83
83
  lastIndex = match.index + m.length;
84
- if (match[1]) {
84
+ if (match[1] || match[0] === '?' && (express.length <= lastIndex || /[\]\}\)]/.test(express.charAt(lastIndex)))) {
85
85
  exp.push(match[1]);
86
86
  }
87
87
  else if (/[\[\{\(]/.test(m)) {
package/coms/kugou/krc.js CHANGED
@@ -27,23 +27,32 @@ function krc(list = div()) {
27
27
  }
28
28
  function createLRC(lrc) {
29
29
  var saved_rows = [];
30
+ var reg = /^\s*\[(.*?)\](.*?)$/;
30
31
  for (var row of lrc.split(/[\r\n]+/)) {
31
- var data = /^\s*\[(.*?)\](.*?)$/.exec(row);
32
+ var data = reg.exec(row);
32
33
  if (!data) {
33
34
  if (!isProduction) console.info("%c未解析%c", "color:#c28", "color:#333", row, data);
34
35
  continue;
35
36
  }
36
- var [, time, words] = data;
37
- var startTime = 0;
38
- var times = time.split(":");
37
+ var times = [];
38
+ while (data) {
39
+ var [, time, words] = data;
40
+ times.push(time);
41
+ data = reg.exec(words);
42
+ }
39
43
  while (times.length) {
40
- startTime = startTime * 60 + +times.shift();
44
+ var time = times.pop();
45
+ var startTime = 0;
46
+ let t = time.split(":");
47
+ while (t.length) {
48
+ startTime = startTime * 60 + +t.shift();
49
+ }
50
+ saveToOrderedArray(saved_rows, {
51
+ value: startTime,
52
+ startTime,
53
+ text: words
54
+ });
41
55
  }
42
- saveToOrderedArray(saved_rows, {
43
- value: startTime,
44
- startTime,
45
- text: words
46
- });
47
56
  }
48
57
  var krcList = saved_rows.map(a => {
49
58
  var r = document.createElement('div');
@@ -318,7 +318,9 @@ var isWorseIE = /msie\s+[2-9]/i.test(navigator.userAgent);
318
318
  var parseData = function (sourceText) {
319
319
  if (/^\s*<[^\s\'\"\`]/i.test(sourceText)) {
320
320
  if (!isWorseIE && window.DOMParser) {
321
- return new window.DOMParser().parseFromString(sourceText, "text/html");
321
+ try {
322
+ return new window.DOMParser().parseFromString(sourceText, "text/html");
323
+ } catch (e) { }
322
324
  }
323
325
  // XML 格式
324
326
  var { implementation } = document;
@@ -2,7 +2,7 @@
2
2
  function speed() {
3
3
  var speed = new Speed();
4
4
  return function (a) {
5
- var now = performance.now ? performance.now() : Date.now();
5
+ var now = Speed.now();
6
6
  if (isFinite(a)) {
7
7
  if (a === 0) speed.reset();
8
8
  else speed.write([a], now);
@@ -190,7 +190,7 @@ var page_generators = {};
190
190
  var loading_tree = {};
191
191
  var getpgpath = function (pagepath) {
192
192
  pagepath = /^[@#!]/.test(pagepath) ? pagepath.slice(1) : pagepath;
193
- if (pagepath === 'main') pagepath = efrontPath || "/main";
193
+ if (pagepath === 'main') pagepath = modules.efrontPath || "/main";
194
194
  return pagepath;
195
195
  };
196
196
  function createState(pgpath) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "3.34.7",
3
+ "version": "3.34.8",
4
4
  "description": "简化前端开发,优化web性能",
5
5
  "main": "public/efront.js",
6
6
  "directories": {