efront 3.34.4 → 3.34.7

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 (44) hide show
  1. package/apps/kugou/favicon.ico +0 -0
  2. package/apps/kugou/home.js +1 -1
  3. package/apps/kugou/ie8.js +93 -0
  4. package/apps/kugou/index.html +5 -2
  5. package/apps/kugou/search/search.js +2 -1
  6. package/coms/basic/#decrypt.js +1 -0
  7. package/coms/basic/#loader.js +26 -14
  8. package/coms/basic/ArrayFill.js +1 -1
  9. package/coms/basic/JSAM.js +7 -3
  10. package/coms/basic/Matrix.js +8 -2
  11. package/coms/basic/awaitable.js +1 -1
  12. package/coms/{zimoli → basic}/color.js +14 -4
  13. package/coms/{zimoli → basic}/color_test.js +0 -0
  14. package/coms/basic/decodeUTF16.js +4 -3
  15. package/coms/basic/encodeUTF16.js +18 -3
  16. package/coms/basic/parseURL.js +49 -13
  17. package/coms/basic/parseURL_test.js +6 -1
  18. package/coms/basic/renderExpress.js +1 -1
  19. package/coms/basic_/Array2.js +1 -1
  20. package/coms/basic_/Promise.js +21 -14
  21. package/coms/basic_/[]map.js +27 -3
  22. package/coms/basic_/readme.md +83 -0
  23. package/coms/kugou/api.js +2 -2
  24. package/coms/kugou/dance.js +50 -2
  25. package/coms/kugou/krc.js +5 -0
  26. package/coms/kugou/playList.html +1 -1
  27. package/coms/kugou/playList.js +1 -0
  28. package/coms/kugou/player.html +3 -3
  29. package/coms/kugou/player.js +17 -13
  30. package/coms/kugou/shortcurt.js +8 -0
  31. package/coms/zimoli/LoadingArray.js +9 -25
  32. package/coms/zimoli/appendChild.js +1 -1
  33. package/coms/zimoli/cless.js +0 -1
  34. package/coms/zimoli/data.js +16 -6
  35. package/coms/zimoli/gallery.js +1 -1
  36. package/coms/zimoli/getGenerator.js +1 -1
  37. package/coms/zimoli/on.js +2 -0
  38. package/coms/zimoli/render.js +33 -33
  39. package/coms/zimoli/selectList.js +1 -1
  40. package/data/packexe-setup.sfx +0 -0
  41. package/package.json +1 -1
  42. package/public/efront.js +1 -1
  43. package/readme.md +9 -8
  44. package/coms/basic/encodeUTF16.asm +0 -62
@@ -20,11 +20,18 @@ if (window.Promise) {
20
20
  for (var t of threads) {
21
21
  if (t.oked) {
22
22
  for (var r of t.PromiseFulfillReactions) {
23
- r.apply(null, t.oked);
23
+ r.call(null, t.oked[0]);
24
24
  }
25
25
  }
26
26
  if (t.ohed) {
27
- if (!t.PromiseRejectReactions.length) throw t.ohed[0];
27
+ var throwed = t.throwed;
28
+ t.throwed = true;
29
+ if (!throwed && !t.PromiseRejectReactions.length) {
30
+ // <!--
31
+ console.warn("在异步过程中发现未处理的异常:", t.ohed[0], t.ohed[1], t.ohed[2]);
32
+ // -->
33
+ throw t.ohed[0];
34
+ }
28
35
  for (var r of t.PromiseRejectReactions) {
29
36
  r.apply(null, t.ohed);
30
37
  }
@@ -42,21 +49,21 @@ if (window.Promise) {
42
49
  this.PromiseFulfillReactions = []; //thens
43
50
  this.PromiseRejectReactions = []; //catches
44
51
  this.oked = this.ohed = null;
45
-
46
- var ResolvingFunctions_resolve = (result) => { //ok
47
- if (this.oked || this.ohed) return;
52
+ var p = this;
53
+ var ResolvingFunctions_resolve = function (result) { //ok
54
+ if (p.oked || p.ohed) return;
48
55
  if (isThenable(result)) {
49
56
  result.then(ResolvingFunctions_resolve, ResolvingFunctions_reject);
50
57
  } else {
51
- this.oked = arguments;
52
- fire(this);
58
+ p.oked = arguments;
59
+ fire(p);
53
60
  }
54
61
  };
55
62
 
56
- var ResolvingFunctions_reject = (e) => { //oh
57
- if (this.oked || this.ohed) return;
58
- this.ohed = arguments;
59
- fire(this);
63
+ var ResolvingFunctions_reject = function (e) { //oh
64
+ if (p.oked || p.ohed) return;
65
+ p.ohed = arguments;
66
+ fire(p);
60
67
  };
61
68
  executor(ResolvingFunctions_resolve, ResolvingFunctions_reject);
62
69
  };
@@ -69,15 +76,15 @@ if (window.Promise) {
69
76
  a = onok(a);
70
77
  ok(a);
71
78
  } catch (e) {
72
- oh(e);
79
+ oh(e, onok, onoh);
73
80
  }
74
81
  };
75
82
  if (onoh) reject = function (a) {
76
83
  try {
77
- a = onoh(a);
84
+ a = onoh.apply(null, arguments);
78
85
  ok(a);
79
86
  } catch (e) {
80
- oh(e);
87
+ oh(e, onok, onoh);
81
88
  }
82
89
  };
83
90
  })
@@ -5,6 +5,7 @@ var {
5
5
  String,
6
6
  Object,
7
7
  isFinite,
8
+ document,
8
9
  console
9
10
  } = this;
10
11
 
@@ -33,7 +34,7 @@ function forEach(f, o) {
33
34
  }
34
35
  function filter(f, o) {
35
36
  if (!(f instanceof Function)) return;
36
- var result = new this.constructor;
37
+ var result = Object.create(this.constructor.prototype);
37
38
  if (this instanceof String) {
38
39
  result = this.split("").filter(f, o);
39
40
  }
@@ -73,14 +74,37 @@ if (!ArrayProto.filter) ArrayProto.filter = filter;
73
74
  if (!"".trim) String.prototype.trim = trim;
74
75
  if (!Object.keys) Object.keys = keys;
75
76
  if (!Object.create) Object.create = function (object) {
76
- return { __proto__: object };
77
+ if (object === null) {
78
+ // 参考 https://github.com/tarruda/object-create
79
+ var iframe = document.createElement('iframe');
80
+ var parent = document.body || document.documentElement;
81
+ iframe.style.display = 'none';
82
+ parent.appendChild(iframe);
83
+ iframe.src = 'javascript:';
84
+ var empty = iframe.contentWindow.Object.prototype;
85
+ parent.removeChild(iframe);
86
+ iframe = null;
87
+ delete empty.constructor;
88
+ delete empty.hasOwnProperty;
89
+ delete empty.propertyIsEnumerable;
90
+ delete empty.isPrototypeOf;
91
+ delete empty.toLocaleString;
92
+ delete empty.toString;
93
+ delete empty.valueOf;
94
+ return empty;
95
+ };
96
+ var f = function () { };
97
+ f.prototype = object;
98
+ return new f;
77
99
  };
78
100
  if (!Function.prototype.bind) Function.prototype.bind = function (context) {
79
101
  var args = [].slice.call(arguments, 1);
80
102
  var f = this;
81
- return function () {
103
+ var c = function () {
82
104
  var _args = args.slice.call(arguments, 0, arguments.length);
83
105
  args.unshift.apply(_args, args);
84
106
  return f.apply(context === void 0 || context === null ? this : context, _args);
85
107
  };
108
+ c.prototype = this.prototype;
109
+ return c;
86
110
  };
@@ -0,0 +1,83 @@
1
+ # efront 兼容性说明
2
+ * `coms/basic_`目录的代码均为非标准实现,如果你要兼容低版本的运行环境,尽量避免使用高级的功能
3
+ * 已知在转换成低版本代码后与高级版本有区别的语法如下:
4
+ 1. ```javascript
5
+ class ... extends Array {...}
6
+ ```
7
+ 因为如果增加一级原型,数组的特性便会消失,`efront`暂时并没有实现完美的降级方案,未来实现的可能性也不大。类似语句经`typescript`转换后新定义的方法会丢失, `efront` 在降级编译期使用 `class ... extends Array2 {...}` 进行替换,`Array2`会将定义的方法挂载到新生成的对象上。
8
+
9
+ 2. ```javascript
10
+ async function () {
11
+ await ...;
12
+ arguments; // typescript 转换后arguments对象的内容有误
13
+ }
14
+ // 或
15
+ function* (){
16
+ yield ...;
17
+ arguments;
18
+ }
19
+ ```
20
+ 这不是一个难解决的问题,应该只是`typescript`已发现但不愿解决的问题。`efront`在降级编译时临时使用变量重命名的方法对代码中的`arguments`进行替换使其内容与原生高级代码一致。
21
+
22
+ 3. ```javascript
23
+ Object.keys
24
+ Object.create
25
+ Array.prototype.map
26
+ Array.prototype.forEach
27
+ Array.prototype.filter
28
+ Array.prototype.indexOf
29
+ String.prototype.trim// 不同的支持环境实现不一致,大厂对空格的理解不一致
30
+ Function.prototype.bind
31
+ ```
32
+ 以上几个方法`ie9+`系列浏览器已支持,但`ie8`及以下版本不支持,如果没有指定`--no-polyfill`参数`efront`在降级编译期会使用`[]map.js`中提供的方法进行修补,这些方法会在加载器检测到浏览器不支持`[].map`时进行初始化
33
+ 4. ```javascript
34
+ Array.prototype.fill
35
+ Array(3).fill(0) // 类似这种的将变成[0,0,0]一个常量数组
36
+ var [a,b,c]=Array(3).fill(0).map((_,i)=>i+1) // 类似这种用于生成常量并赋值的,将直接变成赋值语句 var a=1,b=2,c=3
37
+ Array(3).fill(a)// 类似这种非常量的,将由类似 ArrayFill(3,a) 的语句替换
38
+ ```
39
+ `Array(...).fill(...).map(...)`这种写法经常被`efront`开发者用来生成自增赋值序列,并且非所有运行环境都支持,所以包括其它显式用到`Array.prototype.fill`的几种写法都会被替换。为了目标代码的性能考虑,这种替换在自动常量化之前就要执行,所以不再支持用`polyfill`的开关进行关闭。如果要关闭,请使用参数`--no-autoeval`将自动常量化的功能一同关闭。
40
+
41
+ 5. ```javascript
42
+ Object.assign
43
+ ```
44
+ Object.assign,`ie`系列浏览器均不支持,由于经常被`efront`开发者使用,在降级编译期,如果没有指定`--no-polyfill`参数,将由`efront`处理成替代品[extend](../basic/extend.js)
45
+ 6. ```javascript
46
+ Promise
47
+ Promise.prototype.then
48
+ Promise.prototype.catch
49
+ Promise.all
50
+ Promise.race
51
+ Promise.reject
52
+ Promise.resolve
53
+ ```
54
+ `Promise`对象也是`ie`系列浏览器均不支持的。`efront`实现的`Promise`与原生的特性并不一致,仅在运行环境不支持的时候进行替代。比如由`.then`触发的方法与`setTimeout`触发的方法执行的先后顺序会与高级的运行环境有所区别,但也会保持在当前语境执行后再执行相关的语句。以上没有提到的`Promise`相关的方法均不支持,如`Promise.prototype.finally`,如果您使用了这些缺失的特性,就只能自己实现或找类似[core-js](https://github.com/zloirock/core-js)的库填充了
55
+ 7. ```javascript
56
+ obj.if
57
+ obj.catch
58
+ obj.for
59
+ ```
60
+ 类似这种用`.`取属性的语句,由于属性名与`js`的保留字一样,`ie6`等浏览器会报错,但您可以在`efront`提供的环境中放心使用。因为`efront`本身就会把取属性的语句处理掉。
61
+ 8. `ie8`及以下浏览器中存在的一些与现代`js`标准不同的特性,`efront`提供的组件可能不兼容,在处理为这类环境进行应用开发时,应避免使用。
62
+ ```javascript
63
+ Object.defineProperty(...);
64
+ ({
65
+ get a(){},
66
+ set a(){}
67
+ });
68
+ class {
69
+ get a(){}
70
+ set a(){}
71
+ }
72
+ ```
73
+ `ie8`及以下浏览器对`Object.defineProperty`支持的不好或根本不支持,`efront`暂时没有实现这类功能的兼容方案。如果您要兼容相应的环境,请暂时避免使用相关的语句,也不要使用使用了这些特性的库。
74
+ ```javascript
75
+ Array.prototype.slice.call(objNodeList,...)
76
+ ```
77
+ `ie8`及以下浏览器不支持`this`指向`NodeList`等dom对象,而当前`efront`和内部使用的`typescript`转换的代码都没有处理这一细节,所以暂时不要在dom操作相关的语句中使用高级语法,以避免转换后的代码出问题。
78
+ ```javascript
79
+ var div = document.createElement("div");
80
+ div.innerHTML = `<abcd><span></span></abcd>`;
81
+ console.log(div.innerHTML); // <SPAN></SPAN>
82
+ ```
83
+ `ie8`及以下浏览器无法正确地通过`innerHTML`属性设置自定义标签,`efront`提供的大部分组件都使用了这一特性,`efront`示例项目中[ie8.js](../../apps/kugou/ie8.js)可以实现`ie8`上设置`innerHTML`的适配,但不能保证样式正常,对于`ie7`及以下的浏览器,就暂时别用`efront`提供的与元素相关的组件了。
package/coms/kugou/api.js CHANGED
@@ -3,8 +3,8 @@
3
3
  "song-info;hash": "get app/i/getSongInfo.php?cmd=playInfo&from=mkugou",
4
4
  "slider-src": "get:[].mod-slider>.swipe-wrap>div .#src=img!src&href=a!href",
5
5
  "songs-list": "get:[].panel-songslist%20li .#hash=!id&.panel-songs-item-name>span!innerText",
6
- "songs-list": "get:[].m_cm_item1warp:nth-child(2)>div .#=a!href\\song-mix&a:nth-child(2)>p:first-child!innerText&singer=a:nth-child(2)>p:nth-child(2)!innerText&imgurl=img!_src",
7
- "song-mix;": "mget:script:nth-last-child(2) mixsong/:hashid.html",
6
+ "songs-list": "get:[]div+.m_cm_item1warp>div .#=a!href\\song-mix&a+a>p:first-child!innerText&singer=a+a>p+p!innerText&imgurl=img!_src",
7
+ "song-mix;": "mget:script+script mixsong/:hashid.html",
8
8
  "rank-list": "get:[].panel-img-list%20li rank/list#href=a!href&=a!href\\rank-info&imgurl=img!_src&name=p|innerText",
9
9
  "rank-info": "get:[].panel-songslist%20li rank/info/:id#src=!id&name=.panel-songs-item-name|innerText&data=.panel-songs-item-download/innerText",
10
10
  "rank-title": "get:.page-title rank/info/:id#title=!innerText",
@@ -1,10 +1,28 @@
1
- var activeDevice;
1
+ var activeDevice, ratio = 1;
2
2
  function line(buffer, style, lineWidth = window.devicePixelRatio || 1) {
3
3
  var canvas = this;
4
4
  var context = canvas.getContext("2d");
5
5
  context.moveTo.apply(context, buffer[0]);
6
6
  context.beginPath();
7
7
  var { width, height } = canvas;
8
+ var lasty = buffer[0][1], deltay = 0, changed = 0;
9
+ for (var cx = 1, dx = Math.min(100, buffer.length); cx < dx; cx++) {
10
+ var [, y] = buffer[cx];
11
+ if (y > lasty) {
12
+ if (deltay < 0) {
13
+ changed++;
14
+ }
15
+ deltay = 1;
16
+ }
17
+ else {
18
+ if (deltay > 0) {
19
+ changed++;
20
+ }
21
+ deltay = -1;
22
+ }
23
+ lasty = y;
24
+ }
25
+ ratio = (dx - changed / 2) / dx;
8
26
  for (var cx = 1, dx = buffer.length; cx < dx; cx++) {
9
27
  var [x, y] = buffer[cx];
10
28
  context.lineTo(x * width, y * height);
@@ -13,7 +31,37 @@ function line(buffer, style, lineWidth = window.devicePixelRatio || 1) {
13
31
  context.lineWidth = lineWidth;
14
32
  context.stroke();
15
33
  }
34
+ var linkImage;
35
+ var danceIcon = lazy(async function (theta) {
36
+ if (!linkImage) linkImage = new Image, linkImage.canvas = document.createElement("canvas");
37
+ var canvas = linkImage.canvas;
38
+ /**
39
+ * @type {CanvasRenderingContext2D}
40
+ */
41
+ var context = canvas.getContext("2d");
42
+ var size = 32;
43
+ if (linkImage.src !== shortcurt.getHref()) {
44
+ linkImage.src = shortcurt.getHref();
45
+ await awaitable(linkImage);
46
+ canvas.width = size;
47
+ canvas.height = size;
48
+ }
49
+ context.setTransform(1, 0, 0, 1, 0, 0);
50
+ context.clearRect(0, 0, size, size);
51
+ var matrix = Matrix.create2d(0);
52
+ matrix.translate(-size >> 1, -size >> 1);
53
+ matrix.rotate(-theta);
54
+ matrix.scale(ratio);
55
+ matrix.translate(size >> 1, size >> 1);
56
+ context.setTransform.apply(context, matrix.getTransform());
57
+ context.drawImage(linkImage, 0, 0, size, size);
58
+ shortcurt.href = canvas.toDataURL();
59
+ }, -120);
60
+ /**
61
+ * @this {HTMLCanvasElement}
62
+ */
16
63
  function draw(buffer) {
64
+ danceIcon(buffer.theta);
17
65
  var canvas = this;
18
66
  var context = canvas.getContext("2d");
19
67
  if (canvas.width !== canvas.offsetWidth * devicePixelRatio) canvas.width = canvas.offsetWidth * devicePixelRatio;
@@ -57,6 +105,6 @@ function draw(buffer) {
57
105
 
58
106
  function dance(elem) {
59
107
  var canvas = /^canvas$/i.test(elem.tagName) ? elem : document.createElement("canvas");
60
- care(canvas, draw);
108
+ if (canvas.getContext) care(canvas, draw);
61
109
  return canvas;
62
110
  }
package/coms/kugou/krc.js CHANGED
@@ -9,6 +9,10 @@ function krc(list = div()) {
9
9
  appendChild(list, children);
10
10
  list.process = children.process;
11
11
  }
12
+ else {
13
+ list.process = Function.prototype;
14
+ document.title = `${info.songName} - ${info.singerName}`;
15
+ }
12
16
  return;
13
17
  }
14
18
  var content = info.krc.slice(4).map((a, i) => a ^ secret[i % 16]);
@@ -77,6 +81,7 @@ function setClass(krcList, index) {
77
81
  removeClass(ele, "after before after-active before-active");
78
82
  addClass(krcList[index - 1], 'before-active');
79
83
  addClass(ele, "active");
84
+ if (ele.innerText) document.title = ele.innerText;
80
85
  krcList.slice(index + 1).map(function (a) {
81
86
  removeClass(a, "before active after-active before-active");
82
87
  addClass(a, "after");
@@ -7,7 +7,7 @@
7
7
  <song ng-click="play(i)" ng-class="{activate:musicList.isActived(p)}" ng-src=p></song>
8
8
  </padding>
9
9
  </list>
10
- <div foot>
10
+ <div foot -if="wakeEnabled">
11
11
  <span>播放时屏幕常亮</span>&nbsp;&nbsp;
12
12
  <swap -model="playMode.wake" @change="keepWake"></swap>
13
13
  </div>
@@ -10,6 +10,7 @@ var $scope = {
10
10
  song: kugou$song,
11
11
  padding,
12
12
  swap,
13
+ wakeEnabled: !!document.addEventListener,
13
14
  mode: playModes[playModeIndex],
14
15
  switchMode() {
15
16
  playModeIndex++;
@@ -11,9 +11,9 @@
11
11
  <span ng-bind="totalTime"></span>
12
12
  </div>
13
13
  <div class="song">
14
- <span class="name" ng-bind=songName></span>
15
- <span class="spliter" ng-if="songName&&singerName">&nbsp;-&nbsp;</span>
16
- <span class="singer" ng-bind=singerName></span>
14
+ <span class="name" ng-bind=getSongName()></span>
15
+ <span class="spliter" ng-if="getSongName()&&getSingerName()">&nbsp;-&nbsp;</span>
16
+ <span class="singer" ng-bind=getSingerName()></span>
17
17
  </div>
18
18
  </div>
19
19
  <btn class="prev" ng-click=play(index-1)></btn>
@@ -8,7 +8,6 @@ var patchMusicInfo = async function (info) {
8
8
  switch (info.type) {
9
9
  case "qqjt":
10
10
  info.lrc = (await cross("get", info.lyric)).response;
11
- console.log(info)
12
11
  res = await data.from("qqjt-url", qqjc({
13
12
  TSID: info.id
14
13
  }))
@@ -137,10 +136,10 @@ var $scope = {
137
136
  canvas: kugou$dance,
138
137
  activeList: playList,
139
138
  index: 0,
140
- get songName() {
139
+ getSongName() {
141
140
  return this.info.singername || this.info.singerName;
142
141
  },
143
- get singerName() {
142
+ getSingerName() {
144
143
  return this.info.songname || this.info.songName;
145
144
  },
146
145
  update() {
@@ -167,8 +166,9 @@ var $scope = {
167
166
  }
168
167
  $scope.currentTime = filterTime(currentTime, duration);
169
168
  $scope.totalTime = filterTime(duration, duration);
170
- $scope.currentRotate = `rotate(${currentTime * 6}deg)`;
171
- $scope.currentTheta = ((currentTime * 6 + 90) % 180 - 90) / 180 * Math.PI;
169
+ $scope.currentRotate = `rotate(${-currentTime * 6}deg)`;
170
+ $scope.quickTheta = currentTime / 3 * Math.PI;
171
+ $scope.currentTheta = (90 - (currentTime * 6 + 90) % 180) / 180 * Math.PI;
172
172
  playState.width = (currentTime * 100 / duration).toFixed(2) + `%`;
173
173
  $scope.currentProcess = `width:` + playState.width;
174
174
  },
@@ -207,6 +207,8 @@ var $scope = {
207
207
  if (player.offsetHeight <= calcPixel(80)) {
208
208
  var centerx = 44 / width, centery = .5;
209
209
  var start = 11 * ratio | 0, end = 77 * ratio | 0;
210
+ var cost = cos(currentTheta);
211
+ var sint = sin(currentTheta);
210
212
  for (var cx = start, dx = end; cx < dx; cx++) {
211
213
  var [x, y] = buf[cx];
212
214
  y -= 0.1;
@@ -214,24 +216,26 @@ var $scope = {
214
216
  x = (x - centerx) * width;
215
217
  y = (y - centery) * height;
216
218
  y = y * cos(x / 66 * Math.PI);
217
- var x1 = cos(currentTheta) * x - sin(currentTheta) * y,
218
- y1 = cos(currentTheta) * y + sin(currentTheta) * x;
219
+ var x1 = cost * x - sint * y,
220
+ y1 = cost * y + sint * x;
219
221
  buf[cx][0] = x1 / width + centerx;
220
222
  buf[cx][1] = y1 / height + centery;
221
223
  } else {
222
224
  buf[cx][1] = y;
223
225
  }
224
226
  }
225
- cast($scope.dance, [{
227
+ buf = [{
226
228
  data: buf.slice(0, start),
227
229
  }, {
228
230
  data: buf.slice(start, end)
229
231
  }, {
230
232
  data: buf.slice(end)
231
- }]);
232
- } else {
233
+ }]
234
+
233
235
  cast($scope.dance, buf);
234
236
  }
237
+ buf.theta = $scope.quickTheta || 0;
238
+ cast($scope.dance, buf);
235
239
  },
236
240
  playid: 0,
237
241
  play(music = musicList.getActived()) {
@@ -342,8 +346,7 @@ if (hasContext) {
342
346
  var animate = function () {
343
347
  if (analyser) {
344
348
  analyser.getByteTimeDomainData(dancingArray);
345
- // console.log(dancingArray);
346
- $scope.draw(dancingArray);
349
+ if ($scope.playing) $scope.draw(dancingArray);
347
350
  }
348
351
  requestAnimationFrame(animate);
349
352
  };
@@ -431,8 +434,9 @@ var createControls = function () {
431
434
  });
432
435
  return player;
433
436
  };
434
- var ns = new thirdParty$NoSleep;
437
+ var ns = document.addEventListener && new thirdParty$NoSleep;
435
438
  data.bindInstance("play-mode", function (e) {
439
+ if (!ns) return;
436
440
  if (e.wake) {
437
441
  ns.wake = true;
438
442
  if ($scope.playing) {
@@ -0,0 +1,8 @@
1
+ var shortcurt = document.querySelector("link[type='image/x-icon']");
2
+ shortcurt._href = shortcurt.href;
3
+ shortcurt.setHref = function (href) {
4
+ shortcurt._href = shortcurt.href = href;
5
+ };
6
+ shortcurt.getHref = function () {
7
+ return shortcurt._href;
8
+ };
@@ -1,25 +1,9 @@
1
- // class LoadingArray extends Array {
2
- // totalCount = 0;
3
- // data = [];
4
- // is_errored = null;
5
- // error_message = null;
6
- // is_loading = true;
7
- // is_loaded = false;
8
- // is_readonly = null;
9
- // loading = null;
10
- // loading_promise = null;
11
- // then (ok, oh) {
12
- // if (this.loading_promise) this.loading_promise.then(ok, oh);
13
- // }
14
- // }
15
- function LoadingArray() {
16
- var this0 = [];
17
- this0.is_errored = null;
18
- this0.error_message = null;
19
- this0.is_loading = true;
20
- this0.is_loaded = false;
21
- this0.is_readonly = null;
22
- this0.loading = null;
23
- this0.loading_promise = null;
24
- return this0;
25
- };
1
+ class LoadingArray extends Array {
2
+ is_errored = null;
3
+ error_message = null;
4
+ is_loading = true;
5
+ is_loaded = false;
6
+ is_readonly = null;
7
+ loading = null;
8
+ loading_promise = null;
9
+ }
@@ -15,7 +15,7 @@ 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 children = [...node.childNodes];
18
+ var children = Array.apply(null, node.childNodes);
19
19
  for (var c of children) {
20
20
  _onappend(c, append, mount);
21
21
  }
@@ -52,7 +52,6 @@ function cless(commFactory, innerCss, className) {
52
52
  var stylesheet = document.createElement("style");
53
53
  stylesheet.type = "text/css";
54
54
  stylesheet.savedText = innerCss;
55
- innerCss = color.transform(innerCss);
56
55
  if (stylesheet.styleSheet) {
57
56
  stylesheet.styleSheet.cssText = innerCss;
58
57
  } else {
@@ -210,7 +210,7 @@ function seekResponse(data, seeker, apiMap = {}) {
210
210
  seeker = unescape(seeker);
211
211
  var reg = /^(\[\]|,)|(\[\]|,)$/g;
212
212
  if (reg.test(seeker)) {
213
- return [].concat.apply([], data.querySelectorAll(seeker.replace(reg, '')));
213
+ return Array.apply(null, data.querySelectorAll(seeker.replace(reg, '')));
214
214
  }
215
215
  var reg = /[\|\?\!\/]/, selector, prop;
216
216
  if (reg.test(seeker)) {
@@ -321,17 +321,27 @@ var parseData = function (sourceText) {
321
321
  return new window.DOMParser().parseFromString(sourceText, "text/html");
322
322
  }
323
323
  // XML 格式
324
- var doc = document.implementation.createHTMLDocument('');
324
+ var { implementation } = document;
325
+ if (implementation.createHTMLDocument) var doc = implementation.createHTMLDocument("");
326
+ else {
327
+ doc = document.createElement("html");
328
+ doc.head = document.createElement("head");
329
+ doc.body = document.createElement("body");
330
+ doc.appendChild(doc.head);
331
+ doc.appendChild(doc.body);
332
+ doc.documentElement = doc;
333
+ }
325
334
  if (isWorseIE) {
326
335
  sourceText = sourceText
327
336
  .replace(/<!--[\s\S]*?-->|<\[CDATA\[[\s\S]*?\]\]>/ig, '')
328
337
  .replace(/^[\s\S]*?<html>([\s\S]*)<\/html>[\s\S]*?$/i, '$1')
329
338
  .replace(/^([\s\S]*?)<body>([\s\S]*?)$/i, '$1<body>$2')
330
- .replace(/<\/body>[\s\S]*?$/, '');
331
- var div = document.createElement('div');
332
- div.innerHTML = sourceText.replace(/^([\s\S]*?)<body>[\s\S]*?$/, "$1")
339
+ .replace(/<\/body>[\s\S]*?$/, '')
340
+ .replace(/<(script|style)[\s\>][\s\S]*?<\/\1>/ig, '');
341
+ var hd = document.createElement('div');
342
+ hd.innerHTML = sourceText.replace(/^([\s\S]*?)<body>[\s\S]*?$/, "$1")
333
343
  .replace(/<head>/i, '').replace(/<\/head>/i, '');
334
- for (var c of [...div.childNodes]) doc.head.appendChild(c);
344
+ for (var c of Array.apply(null, hd.childNodes)) doc.head.appendChild(c);
335
345
  doc.body.innerHTML = sourceText.replace(/^[\s\S]*?<body>/, '');
336
346
  } else {
337
347
  doc.documentElement.innerHTML = sourceText;
@@ -67,7 +67,7 @@ function gallery(element, minWidth, generator) {
67
67
  var c = createColumn(cx);
68
68
  element.appendChild(c);
69
69
  }
70
- bindScroll([].slice.call(element.children, 0));
70
+ bindScroll(Array.apply(null, element.children));
71
71
 
72
72
  };
73
73
  element.go = function (index) {
@@ -7,7 +7,7 @@ var cloneChildNodes = function (template) {
7
7
  var tNodes = template.childNodes;
8
8
  for (var cx = 0, dx = cNodes.length; cx < dx; cx++) {
9
9
  cNodes[cx].$struct = tNodes[cx].$struct;
10
- cNodes[cx].renderid = tNodes[cx].renderid;
10
+ cNodes[cx].$renderid = tNodes[cx].$renderid;
11
11
  }
12
12
  return cNodes;
13
13
  }
package/coms/zimoli/on.js CHANGED
@@ -315,7 +315,9 @@ var checkroot = function (element, k) {
315
315
  if (!(k in element)) {
316
316
  if (element === window && k in document) {
317
317
  element = document;
318
+ // <!--
318
319
  if (!checkroot[k]) checkroot[k] = true, console.warn("使用 document 的", k, "替代 window 的");
320
+ // -->
319
321
  }
320
322
  }
321
323
  return element;