efront 3.23.0 → 3.24.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.
Files changed (124) hide show
  1. package/apps/kugou/main.js +1 -3
  2. package/coms/basic/BigNumber.js +28 -5
  3. package/coms/basic/BigNumber_test.js +14 -1
  4. package/coms/basic/[]map.js +18 -13
  5. package/coms/basic/assert.js +10 -2
  6. package/coms/basic/extends_.js +13 -0
  7. package/coms/basic/loader.js +47 -28
  8. package/coms/basic/mark.js +155 -0
  9. package/coms/basic/queue.js +11 -14
  10. package/coms/basic/rest_.js +27 -0
  11. package/coms/basic/submit_.js +3 -1
  12. package/{apps → coms}/kugou/api.js +2 -0
  13. package/coms/kugou/buildList.js +7 -1
  14. package/coms/kugou/parseSongsList.js +1 -1
  15. package/coms/kugou/player.js +4 -2
  16. package/coms/kugou/song.html +1 -1
  17. package/coms/kugou/song.js +1 -0
  18. package/coms/kugou/song.less +12 -4
  19. package/coms/zimoli/Promise.js +84 -133
  20. package/coms/zimoli/appendChild.js +4 -14
  21. package/coms/zimoli/cless.js +11 -5
  22. package/coms/zimoli/color.js +0 -1
  23. package/coms/zimoli/compile.js +64 -1
  24. package/coms/{compile → zimoli}/compile_test.js +0 -0
  25. package/coms/zimoli/cross.js +1 -1
  26. package/coms/zimoli/data.js +14 -4
  27. package/coms/zimoli/dispatch.js +1 -1
  28. package/coms/zimoli/input.js +6 -4
  29. package/coms/zimoli/on.js +64 -47
  30. package/coms/zimoli/remove.js +0 -9
  31. package/coms/zimoli/render.js +2 -2
  32. package/coms/zimoli/zimoli.js +2 -2
  33. package/package.json +1 -1
  34. package/public/efront.js +1 -1
  35. package/apps/zimoli/book/main.js +0 -8
  36. package/apps/zimoli/broadcast/main.js +0 -8
  37. package/apps/zimoli/collection/add.html +0 -13
  38. package/apps/zimoli/collection/add.js +0 -14
  39. package/apps/zimoli/collection/add.less +0 -0
  40. package/apps/zimoli/collection/main.html +0 -0
  41. package/apps/zimoli/collection/main.js +0 -13
  42. package/apps/zimoli/collection/main.less +0 -8
  43. package/apps/zimoli/config.js +0 -14
  44. package/apps/zimoli/extra/pending.html +0 -1
  45. package/apps/zimoli/extra/pending.js +0 -8
  46. package/apps/zimoli/extra/pending.less +0 -15
  47. package/apps/zimoli/files/info.js +0 -7
  48. package/apps/zimoli/files/main.js +0 -108
  49. package/apps/zimoli/files/main.less +0 -26
  50. package/apps/zimoli/images/avatar.png +0 -0
  51. package/apps/zimoli/images/background.jpg +0 -0
  52. package/apps/zimoli/index.html +0 -42
  53. package/apps/zimoli/kugou/font/demo.css +0 -539
  54. package/apps/zimoli/kugou/font/demo_index.html +0 -1159
  55. package/apps/zimoli/kugou/font/iconfont.css +0 -189
  56. package/apps/zimoli/kugou/font/iconfont.eot +0 -0
  57. package/apps/zimoli/kugou/font/iconfont.js +0 -1
  58. package/apps/zimoli/kugou/font/iconfont.svg +0 -155
  59. package/apps/zimoli/kugou/font/iconfont.ttf +0 -0
  60. package/apps/zimoli/kugou/font/iconfont.woff +0 -0
  61. package/apps/zimoli/kugou/font/iconfont.woff2 +0 -0
  62. package/apps/zimoli/kugou/listen.html +0 -15
  63. package/apps/zimoli/kugou/listen.js +0 -37
  64. package/apps/zimoli/kugou/listen.less +0 -114
  65. package/apps/zimoli/kugou/mine.html +0 -53
  66. package/apps/zimoli/kugou/mine.js +0 -21
  67. package/apps/zimoli/kugou/mine.less +0 -106
  68. package/apps/zimoli/kugou/search.js +0 -109
  69. package/apps/zimoli/kugou/search.less +0 -50
  70. package/apps/zimoli/kugou/sing.js +0 -42
  71. package/apps/zimoli/kugou/sing.less +0 -93
  72. package/apps/zimoli/kugou/view.html +0 -39
  73. package/apps/zimoli/kugou/view.js +0 -17
  74. package/apps/zimoli/kugou/view.less +0 -84
  75. package/apps/zimoli/login/qq.js +0 -20
  76. package/apps/zimoli/login/qq_callback.html +0 -15
  77. package/apps/zimoli/main.js +0 -87
  78. package/apps/zimoli/main.less +0 -81
  79. package/apps/zimoli/message/chatList.js +0 -57
  80. package/apps/zimoli/message/chatList.less +0 -52
  81. package/apps/zimoli/message/commentList.js +0 -55
  82. package/apps/zimoli/message/commentList.less +0 -55
  83. package/apps/zimoli/message/informList.js +0 -69
  84. package/apps/zimoli/message/informList.less +0 -51
  85. package/apps/zimoli/message/main.js +0 -59
  86. package/apps/zimoli/message/main.less +0 -51
  87. package/apps/zimoli/message/praiseList.js +0 -3
  88. package/apps/zimoli/message/praiseList.less +0 -7
  89. package/apps/zimoli/nearby/main.js +0 -8
  90. package/apps/zimoli/skin/main.js +0 -47
  91. package/apps/zimoli/skin/main.less +0 -31
  92. package/apps/zimoli/user/getPassword.js +0 -82
  93. package/apps/zimoli/user/getPassword.less +0 -14
  94. package/apps/zimoli/user/login.html +0 -12
  95. package/apps/zimoli/user/login.js +0 -50
  96. package/apps/zimoli/user/login.less +0 -139
  97. package/apps/zimoli/user/profile-bg.jpg +0 -0
  98. package/apps/zimoli/user/profile.html +0 -32
  99. package/apps/zimoli/user/profile.js +0 -63
  100. package/apps/zimoli/user/profile.less +0 -50
  101. package/apps/zimoli/user/register.js +0 -20
  102. package/apps/zimoli/user/register.less +0 -3
  103. package/apps/zimoli/user/setting.js +0 -90
  104. package/apps/zimoli/user/setting.less +0 -11
  105. package/apps/zimoli/user/welcome.js +0 -36
  106. package/apps/zimoli/user/welcome.less +0 -136
  107. package/apps/zimoli/watch/main.html +0 -22
  108. package/apps/zimoli/watch/main.js +0 -76
  109. package/apps/zimoli/watch/main.less +0 -54
  110. package/apps/zimoli/yuanfen/main.js +0 -55
  111. package/apps/zimoli/yuanfen/main.json +0 -0
  112. package/coms/compile/breakcode.js +0 -78
  113. package/coms/compile/common.js +0 -683
  114. package/coms/compile/compile.js +0 -64
  115. package/coms/compile/keywords.js +0 -6
  116. package/coms/compile/namelist.js +0 -142
  117. package/coms/compile/namelist_test.js +0 -7
  118. package/coms/compile/required.js +0 -20
  119. package/coms/compile/scanner.js +0 -653
  120. package/coms/compile/scanner2.js +0 -909
  121. package/coms/compile/scanner2_test.js +0 -85
  122. package/coms/compile/scanner_test.js +0 -10
  123. package/coms/compile/washcode.js +0 -313
  124. package/coms/zimoli/mark.js +0 -70
@@ -143,11 +143,11 @@ var $scope = {
143
143
  },
144
144
  draw(buf) {
145
145
  if (!player || !player.offsetHeight || !$scope.dance) return;
146
- buf = [].map.call(buf, a => (a / 128.0 - 1) * 2 / 9 + 0.6);
146
+ buf = Array.prototype.map.call(buf, a => (a / 128.0 - 1) * 2 / 9 + 0.6);
147
147
  var width = freePixel(player.offsetWidth);
148
148
  var height = 72;
149
149
  var ratio = 1 / width * buf.length;
150
- var buf = [].map.call(buf, (y, i) => [i / buf.length, y]);
150
+ var buf = Array.prototype.map.call(buf, (y, i) => [i / buf.length, y]);
151
151
  var { sin, cos } = Math;
152
152
  var { currentTheta } = $scope;
153
153
  if (player.offsetHeight <= calcPixel(80)) {
@@ -179,6 +179,7 @@ var $scope = {
179
179
  cast($scope.dance, buf);
180
180
  }
181
181
  },
182
+ playid: 0,
182
183
  play(hash = musicList.active_hash) {
183
184
  render.refresh();
184
185
  var isPlayback = typeof hash === "number";
@@ -237,6 +238,7 @@ var $scope = {
237
238
  $scope.playing = true;
238
239
  playState.width = 0;
239
240
  getMusicInfo(hash).loading_promise.then((response) => {
241
+ console.log(response)
240
242
  if (!this.playing) return;
241
243
  if (hash !== musicList.active_hash) return;
242
244
  if (response.imgUrl) {
@@ -1,7 +1,7 @@
1
1
  <div class="bg"></div>
2
2
  <png class="logo" ng-if="song.imgurl" ng-src=song.imgurl></png>
3
+ <div class="singer" ng-if="song.singer" ng-model=song.singerMarked></div>
3
4
  <div class="song" ng-model=song.songMarked></div>
4
- <div class="singer" ng-model=song.singerMarked></div>
5
5
  <div class="filterTime(song.timeLength)"></div>
6
6
  <div refresh class="play-state" ng-if="song.hash===musicList.active_hash" ng-class={error:playState.error}>
7
7
  <div ng-style="{width:playState.width}"></div>
@@ -21,6 +21,7 @@ function main(elem) {
21
21
  $scope.song = {
22
22
  hash: item.hash,
23
23
  imgurl: item.imgurl,
24
+ singer: singerName,
24
25
  songMarked: mark(songName, elem.mark),
25
26
  singerMarked: mark(singerName, elem.mark)
26
27
  };
@@ -24,19 +24,23 @@
24
24
  width: 40px;
25
25
  margin: -6px -4px;
26
26
 
27
+ &+.singer+.song,
27
28
  &+.song {
28
29
  margin-left: -38px;
29
30
  padding-left: 46px;
30
- line-height: 30px;
31
31
  display: inline-block;
32
32
  vertical-align: top;
33
+
33
34
  }
35
+
36
+ &+.singer {
37
+ padding-left: 46px;
38
+ }
39
+
34
40
  }
35
41
 
36
42
  >.song {
37
- width: 100%;
38
- overflow: hidden;
39
- text-overflow: ellipsis;
43
+ line-height: 30px;
40
44
  }
41
45
 
42
46
  b {
@@ -56,6 +60,10 @@ b {
56
60
  line-height: 12px;
57
61
  font-size: 12px;
58
62
  color: #888;
63
+
64
+ &+.song {
65
+ padding-top: 6px;
66
+ }
59
67
  }
60
68
 
61
69
  >.play-state {
@@ -4,177 +4,128 @@ var setTimeout = window.setTimeout;
4
4
  var Function = window.Function;
5
5
  var console = window.console;
6
6
  var Error = window.Error;
7
+ var requestAnimationFrame = window.setImmediate || window.setTimeout;
7
8
  var isFunction = function (f) {
8
9
  return typeof f === "function";
9
10
  };
10
11
  if (window.Promise) {
11
12
  var Promise = window.Promise;
12
13
  } else {
13
- var isPromise = function (pendding) {
14
- return pendding instanceof Promise || pendding && isFunction(pendding.then) && isFunction(pendding.catch);
14
+ var isThenable = function (pendding) {
15
+ return pendding instanceof Promise || pendding && isFunction(pendding.then);
15
16
  };
16
-
17
- var concat = function (okfun, ohfun, oks, ohs) {
18
- var _oked, _ohed, _ok, _oh, removeed;
19
- var runable = function (ok, oh) {
20
- if (_oked) {
21
- ok.apply(null, _oked);
22
- } else if (_ohed) {
23
- oh.apply(null, _ohed);
24
- } else {
25
- _ok = ok;
26
- _oh = oh;
27
- }
28
- };
29
- var _promise = new Promise(runable);
30
- var onpermit = function (f, args) {
31
- if (!removeed) {
32
- try {
33
- var pendding = f.apply(null, args);
34
- if (_ok) _ok(pendding);
35
- else _oked = [pendding];
36
- } catch (e) {
37
- if (_oh) _oh(e);
38
- else _ohed = [e];
17
+ var queue = [];
18
+ var run = function (q) {
19
+ var threads = queue.splice(0, queue.length);
20
+ for (var t of threads) {
21
+ if (t.oked) {
22
+ for (var r of t.PromiseFulfillReactions) {
23
+ r.apply(null, t.oked);
39
24
  }
40
- removeed = true;
41
- }
42
- };
43
- var onresolve = function () {
44
- if (okfun instanceof Function) onpermit(okfun, arguments);
45
- if (!removeed) {
46
- if (_ok) _ok.apply(null, arguments);
47
- else _oked = arguments;
48
- removeed = true;
49
25
  }
50
- };
51
- var onreject = function () {
52
- if (ohfun instanceof Function) onpermit(ohfun, arguments);
53
- if (!removeed) {
54
- if (_oh) _oh.apply(null, arguments);
55
- else _ohed = arguments;
56
- removeed = true;
26
+ if (t.ohed) {
27
+ if (!t.PromiseRejectReactions.length) throw `未处理的异常:${t.ohed}`;
28
+ for (var r of t.PromiseRejectReactions) {
29
+ r.apply(null, t.ohed);
30
+ }
57
31
  }
58
- };
59
- oks.push(onresolve);
60
- ohs.push(onreject);
61
- return _promise;
62
- }
63
-
32
+ t.PromiseRejectReactions.splice(0, t.PromiseRejectReactions.length);
33
+ t.PromiseFulfillReactions.splice(0, t.PromiseFulfillReactions.length);
34
+ }
35
+ };
36
+ var fire = function (p) {
37
+ if (queue.length) return queue.push(p);
38
+ queue.push(p);
39
+ requestAnimationFrame(run);
40
+ };
64
41
  var Promise = function (executor) {
65
- var PromiseFulfillReactions = this.PromiseFulfillReactions = [], //thens
66
- PromiseRejectReactions = this.PromiseRejectReactions = [], //catches
67
- oked = this.oked, ohed = this.ohed;
42
+ this.PromiseFulfillReactions = []; //thens
43
+ this.PromiseRejectReactions = []; //catches
44
+ this.oked = this.ohed = null;
68
45
 
69
46
  var ResolvingFunctions_resolve = (result) => { //ok
70
- if (isPromise(result)) {
71
- result.then(ResolvingFunctions_resolve).catch(ResolvingFunctions_reject);
47
+ if (this.oked || this.ohed) return;
48
+ if (isThenable(result)) {
49
+ result.then(ResolvingFunctions_resolve, ResolvingFunctions_reject);
72
50
  } else {
73
- oked = this.oked = arguments;
74
- this.run(PromiseFulfillReactions, oked);
51
+ this.oked = arguments;
52
+ fire(this);
75
53
  }
76
54
  };
77
55
 
78
56
  var ResolvingFunctions_reject = (e) => { //oh
79
- ohed = this.ohed = arguments;
80
- this.run(PromiseRejectReactions, ohed);
57
+ if (this.oked || this.ohed) return;
58
+ this.ohed = arguments;
59
+ fire(this);
81
60
  };
82
-
83
- try {
84
- executor(ResolvingFunctions_resolve, ResolvingFunctions_reject);
85
- } catch (e) {
86
- ResolvingFunctions_reject(e);
87
- }
61
+ executor(ResolvingFunctions_resolve, ResolvingFunctions_reject);
88
62
  };
89
63
  Promise.prototype = {
90
64
  then(onok, onoh) {
91
- var _promise = concat(onok, onoh, this.PromiseFulfillReactions, this.PromiseRejectReactions);
92
- this.oked && this.run(this.PromiseFulfillReactions, this.oked);
93
- this.ohed && this.run(this.PromiseRejectReactions, this.ohed);
94
- return _promise;
65
+ var resolve, reject;
66
+ var promise = new Promise(function (ok, oh) {
67
+ if (onok) resolve = function (a) {
68
+ try {
69
+ a = onok(a);
70
+ ok(a);
71
+ } catch (e) {
72
+ oh(e);
73
+ }
74
+ };
75
+ if (onoh) reject = function (a) {
76
+ try {
77
+ a = onoh(a);
78
+ ok(a);
79
+ } catch (e) {
80
+ oh(e);
81
+ }
82
+ };
83
+ })
84
+ if (resolve) this.PromiseFulfillReactions.push(resolve);
85
+ if (reject) this.PromiseRejectReactions.push(reject);
86
+ if (this.oked || this.ohed) fire(this);
87
+ return promise;
95
88
  },
96
89
  catch(f) {
97
90
  return this.then(null, f);
98
91
  },
99
- run(threads, args) {
100
- if (threads.pendding) return;
101
- threads.pendding = true;
102
- setTimeout(_ => {
103
- do {
104
- var next = threads.shift();
105
- if (next instanceof Function) {
106
- next.apply(null, args);
107
- }
108
- } while (threads.length);
109
- this.PromiseRejectReactions.splice(0, this.PromiseRejectReactions.length);
110
- this.PromiseFulfillReactions.splice(0, this.PromiseFulfillReactions.length);
111
- threads.pendding = false;
112
- }, 0);
113
- }
114
92
  }
115
93
  Promise.all = function (penddings) {
116
94
  return new Promise(function (ok, oh) {
117
95
  if (!(penddings && penddings.length)) {
118
96
  return ok();
119
97
  }
120
- try {
121
- var resolved_count = 0,
122
- rejected_count = 0,
123
- results = Array(penddings.length);
124
- for (var cx = 0, dx = penddings.length; cx < dx; cx++) {
125
- var pendding = penddings[cx];
126
- if (isPromise(pendding)) {
127
- pendding.then(function (cx) {
128
- return function (arg) {
129
- results[cx] = arg;
130
- if (++resolved_count === dx) {
131
- ok(results);
132
- }
133
- };
134
- }(cx));
135
- pendding.catch(function (e) {
136
- if (rejected_count++ === 0) {
137
- oh(e);
98
+ var resolved_count = 0,
99
+ results = Array(penddings.length);
100
+ for (var cx = 0, dx = penddings.length; cx < dx; cx++) {
101
+ var pendding = penddings[cx];
102
+ if (isThenable(pendding)) {
103
+ pendding.then(function (cx) {
104
+ return function (arg) {
105
+ results[cx] = arg;
106
+ if (++resolved_count === dx) {
107
+ ok(results);
138
108
  }
139
- });
140
- } else {
141
- results[cx] = pendding;
142
- if (++resolved_count === dx) {
143
- ok(results);
144
- }
145
- };
146
- }
147
- } catch (e) {
148
- oh(e);
109
+ };
110
+ }(cx), oh);
111
+ } else {
112
+ results[cx] = pendding;
113
+ if (++resolved_count === dx) {
114
+ ok(results);
115
+ }
116
+ };
149
117
  }
150
118
  });
151
119
  };
152
120
  Promise.race = function (penddings) {
153
121
  return new Promise(function (ok, oh) {
154
- try {
155
- var resolved_count = 0,
156
- rejected_count = 0,
157
- results = Array(penddings.length);
158
- for (var cx = 0, dx = penddings.length; cx < dx; cx++) {
159
- var pendding = penddings[cx];
160
- if (isPromise(pendding)) {
161
- pendding.then(function (cx) {
162
- return function (arg) {
163
- if (++resolved_count === 0) {
164
- ok(arg);
165
- }
166
- };
167
- }(cx)).catch(function (e) {
168
- if (rejected_count++ === dx) {
169
- oh(e);
170
- }
171
- });
172
- } else {
173
- results[cx] = pendding;
174
- };
175
- }
176
- } catch (e) {
177
- oh(e);
122
+ for (var cx = 0, dx = penddings.length; cx < dx; cx++) {
123
+ var pendding = penddings[cx];
124
+ if (isThenable(pendding)) {
125
+ pendding.then(ok, oh);
126
+ } else {
127
+ ok(pendding);
128
+ };
178
129
  }
179
130
  });
180
131
  };
@@ -15,18 +15,9 @@ function _onappend(node, append = createEvent("append"), mount = createEvent("mo
15
15
  if (node.isMounted) return;
16
16
  if (node.nodeType === 1 || node.nodeType === 8) node.isMounted = true;
17
17
  dispatch(node, append);
18
- var onappend = node.onappend;
19
- if (isArray(onappend)) {
20
- onappend.map(function (append_handler) {
21
- append_handler.call(this, append);
22
- }, node);
23
- }
24
- if (isFunction(onappend)) {
25
- onappend.call(node, append);
26
- }
27
- var children = [].concat.apply([], node.childNodes);
28
- if (children) for (var cx = 0, dx = children.length; cx < dx; cx++) {
29
- _onappend(children[cx], append, mount);
18
+ var children = [...node.childNodes];
19
+ for (var c of children) {
20
+ _onappend(c, append, mount);
30
21
  }
31
22
  dispatch(node, mount);
32
23
  }
@@ -93,8 +84,7 @@ function insertAfter(alreadyMounted, obj, transition) {
93
84
  if (o.removeTimer) clearTimeout(o.removeTimer);
94
85
  _insertBefore.call(parent, o, alreadyMounted.nextSibling);
95
86
  o.with && insertBefore(alreadyMounted.nextSibling, o.with, transition);
96
- if (isMounted(parent))
97
- _onappend(o);
87
+ if (isMounted(parent)) _onappend(o);
98
88
  if (hasEnterStyle(o) && transition !== false) {
99
89
  isFunction(appendChild.transition) && appendChild.transition(o);
100
90
  }
@@ -1,25 +1,31 @@
1
1
 
2
- function create(commFactory, className) {
2
+ var _create = function (commFactory, className, _invoke) {
3
3
  if (!className) return commFactory;
4
4
  if (commFactory instanceof Promise) {
5
5
  return commFactory.then(function (result) {
6
- return create(result, className);
6
+ return _invoke(result, className, _invoke);
7
7
  });
8
8
  }
9
9
  if (isFunction(commFactory)) {
10
10
  var result = function () {
11
11
  var commRelease = commFactory.apply(this || result, arguments);
12
12
  if (commRelease) {
13
- commRelease = create(commRelease, className);
13
+ commRelease = _invoke(commRelease, className, _invoke);
14
14
  }
15
15
  return commRelease;
16
16
  };
17
17
  result.prototype = commFactory.prototype;
18
18
  commFactory.className = className;
19
19
  keys(commFactory).map(k => result[k] = commFactory[k]);
20
+ result.call = function (context, ...args) {
21
+ if (!isEmpty(context)) var release = commFactory.apply(context, args);
22
+ else release = commFactory.apply(result, args);
23
+ if (release) release = _invoke(release, className, _invoke);
24
+ return release;
25
+ };
20
26
  if ({}.hasOwnProperty.call(commFactory, 'toString')) {
21
27
  result.toString = function () {
22
- return create(commFactory.toString(), className);
28
+ return _invoke(commFactory.toString(), className, _invoke);
23
29
  };
24
30
  }
25
31
  return result;
@@ -54,5 +60,5 @@ function cless(commFactory, innerCss, className) {
54
60
  }
55
61
  appendChild(head, stylesheet);
56
62
  }
57
- return create(commFactory, className);
63
+ return _create(commFactory, className, _create);
58
64
  }
@@ -381,7 +381,6 @@ extend(color, {
381
381
  },
382
382
  rgb2h,
383
383
  rgb4h,
384
- rgb4s,
385
384
  rgb2v,
386
385
  rgb4v,
387
386
  rgb2s,
@@ -1 +1,64 @@
1
- "use ../compile/compile.js"
1
+ "use strict";
2
+ var Scanner = function (dataString, syntax) {
3
+ this.source = dataString;
4
+ this.syntax = syntax.syntax;
5
+ this.entry = syntax.entry;
6
+ var Token = this.token = syntax.token;
7
+ var block = this.block = new Token(syntax.entry, 0);
8
+ block.scanner = this;
9
+ this.blocks = this.block.children = [];
10
+ this.source = dataString;
11
+ }
12
+ Scanner.prototype = {
13
+ scan(index = 0, type = this.entry, collection = this.blocks, parent = this.block) {
14
+ var regInfo = this.syntax[type];
15
+ var dataString = this.source;
16
+ var Block = this.token;
17
+ if (!regInfo) return index;
18
+ if (!(regInfo instanceof Array)) {
19
+ regInfo = [regInfo];
20
+ }
21
+ var reg = regInfo[0];
22
+ loop: while (index < dataString.length) {
23
+ reg.lastIndex = index;
24
+ var res = reg.exec(dataString, collection);
25
+ if (res) {
26
+ index = reg.lastIndex;
27
+ var inc = 0;
28
+ while (res[++inc] === undefined) {
29
+ if (inc >= regInfo.length) break loop;
30
+ }
31
+ var matchType = regInfo[inc];
32
+ if (!matchType) continue;
33
+ var savedIndex = reg.lastIndex - res[inc].length;
34
+ var children = [];
35
+ var block = new Block(matchType, savedIndex);
36
+ block.parent = parent;
37
+ block.children = children;
38
+ block.root = this.block;
39
+ block.scanner = this;
40
+ index = this.scan(index, matchType, children, block);
41
+ if (collection && savedIndex < index) {
42
+ if (collection.length) {
43
+ var lastChild = collection[collection.length - 1];
44
+ block.prev = lastChild;
45
+ lastChild.next = block;
46
+ }
47
+ collection.push(block);
48
+ }
49
+ block.end = index;
50
+ } else if (/y/.test(reg.flags)) {
51
+ throw new Error(`unexcepted token ${dataString[index]}`);
52
+ } else {
53
+ index = dataString.length;
54
+ }
55
+ }
56
+ return index;
57
+ }
58
+ }
59
+ var scan = function (data, syntax) {
60
+ var scanner = new Scanner(data, syntax);
61
+ scanner.scan();
62
+ return scanner.blocks;
63
+ };
64
+ module.exports = scan;
File without changes
@@ -20,7 +20,7 @@ if (cookiesData) {
20
20
  var digest = function () {
21
21
  dispatch('render', window);
22
22
  };
23
-
23
+ if (/Trident/i.test(navigator.userAgent)) digest = lazy(digest, 60);
24
24
  var cross = cross_.bind(function (callback, onerror) {
25
25
  var xhr = new XMLHttpRequest;
26
26
  var abort = xhr.abort;
@@ -268,8 +268,7 @@ function parseConfig(api) {
268
268
  var required = [];
269
269
  var prepared = [];
270
270
  var autotrim = false;
271
-
272
- id = id.replace(/[\?\|\:;](.+?)$/, function (m, s) {
271
+ id = id.replace(/[\?\|\:;](.*?)$/, function (m, s) {
273
272
  autotrim = /^[\|;]/.test(m);
274
273
  if (/^[\|\/]/.test(s)) autotrim = true, s = s.slice(1);
275
274
  s = s.split('&');
@@ -323,9 +322,13 @@ var parseData = function (sourceText) {
323
322
  sourceText = sourceText
324
323
  .replace(/<!--[\s\S]*?-->|<\[CDATA\[[\s\S]*?\]\]>/ig, '')
325
324
  .replace(/^[\s\S]*?<html>([\s\S]*)<\/html>[\s\S]*?$/i, '$1')
326
- .replace(/^[\s\S]*?<body>([\s\S]*?)$/i, '$1')
325
+ .replace(/^([\s\S]*?)<body>([\s\S]*?)$/i, '$1<body>$2')
327
326
  .replace(/<\/body>[\s\S]*?$/, '');
328
- doc.body.innerHTML = sourceText;
327
+ var div = document.createElement('div');
328
+ div.innerHTML = sourceText.replace(/^([\s\S]*?)<body>[\s\S]*?$/, "$1")
329
+ .replace(/<head>/i, '').replace(/<\/head>/i, '');
330
+ for (var c of [...div.childNodes]) doc.head.appendChild(c);
331
+ doc.body.innerHTML = sourceText.replace(/^[\s\S]*?<body>/, '');
329
332
  } else {
330
333
  doc.documentElement.innerHTML = sourceText;
331
334
  }
@@ -705,6 +708,13 @@ var data = {
705
708
  data = this.parseConfig(data);
706
709
  configPormise = Promise.resolve(data);
707
710
  },
711
+ async addConfig(data) {
712
+ var p = configPormise;
713
+ var c = await p;
714
+ if (p !== configPormise) return;
715
+ data = this.parseConfig(data);
716
+ extend(c, data);
717
+ },
708
718
  getConfig() {
709
719
  return privates.getConfigPromise();
710
720
  },
@@ -1,6 +1,6 @@
1
1
  var dispatch = "dispatchEvent" in document ? function dispatchEvent(target, event) {
2
2
  return target.dispatchEvent(event);
3
- } : function fireEvent(target, event) {
3
+ } : function (target, event) {
4
4
  var fire = "on" + event.type;
5
5
  try {
6
6
  return target.fireEvent(fire, event);
@@ -67,10 +67,12 @@ var number = function (event) {
67
67
  }
68
68
  };
69
69
  var toFixed = function () {
70
- if (this.value && this.fixed) var fixed = BigNumber.fix(this.value, this.fixed);
71
- if (this.value !== fixed) {
72
- this.value = fixed;
73
- dispatch(this, 'change');
70
+ if (this.value && this.fixed) {
71
+ var fixed = BigNumber.fix(this.value, this.fixed);
72
+ if (this.value !== fixed) {
73
+ this.value = fixed;
74
+ dispatch(this, 'change');
75
+ }
74
76
  }
75
77
  };
76
78
  var positiveReg = /^\+|^positive\-?|\-?positive$|\+$/i;