efront 3.19.2 → 3.20.2

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.
@@ -27,7 +27,7 @@ function main() {
27
27
  $scope.open();
28
28
  return false;
29
29
  }
30
- page.setAttribute('ng-mousedown', 'setActive')
30
+ page.setAttribute('on-contextmenu', 'setActive')
31
31
  bind('drop')(page, async function (event) {
32
32
  event.preventDefault();
33
33
  var files = event.dataTransfer.files;
File without changes
@@ -0,0 +1,154 @@
1
+ class Tree extends Array {
2
+ constructor(src) {
3
+ if (src instanceof Tree) return src;
4
+ if (src instanceof Array && src[0] && ('tab' in src[0] || 'deep' in src[0])) {
5
+ return Tree.fromArray(src);
6
+ }
7
+ else if (src instanceof Array) {
8
+ return Tree.fromData(src);
9
+ }
10
+ if (src && src.children) {
11
+ return Tree.fromData(src.children);
12
+ }
13
+ super();
14
+ }
15
+ static fromData(array) {
16
+ if (array instanceof Tree) return array;
17
+ var root = new Tree;
18
+ root.tab = -Infinity;
19
+ root.count = 0;
20
+ var map = {};
21
+ array = array.filter(a => !!a);
22
+ var active_item = null;
23
+ var hasIcon = [];
24
+ array.forEach(function (data) {
25
+ var item = new Item(data);
26
+ if (!active_item && item.isActived()) active_item = item;
27
+ if (data.id) {
28
+ map[data.id] = item;
29
+ } else {
30
+ root.push(item);
31
+ }
32
+ });
33
+ array.forEach(function (data) {
34
+ if (!data) return;
35
+ var parent = map[data.parentId];
36
+ if (parent) {
37
+ var item = map[data.id];
38
+ delete map[data.id];
39
+ if (parent) {
40
+ parent.push(item);
41
+ }
42
+ }
43
+ });
44
+ var items = Object.keys(map).map(a => map[a]);
45
+ root.push.apply(root, items);
46
+ var tab = 0;
47
+ var deep = 0;
48
+ var run = function (item, parent) {
49
+ item.tab = tab;
50
+ item.deep = tab;
51
+ var count = 0, total = 0;
52
+ item.parent = parent;
53
+ item.root = root;
54
+ if (item.icon && !hasIcon[deep]) hasIcon[deep] = true;
55
+ if (item.length) {
56
+ tab++;
57
+ if (hasIcon[deep]) tab++;
58
+ deep++;
59
+ for (var cx = 0, dx = item.length; cx < dx; cx++) {
60
+ var i = item[cx];
61
+ run(i, parent);
62
+ count += i.count || 1;
63
+ total += i.total;
64
+ }
65
+ deep--;
66
+ if (hasIcon[deep]) tab--;
67
+ tab--;
68
+ }
69
+ item.total = total + item.length;
70
+ return item.count = count;
71
+ };
72
+ run(root);
73
+ root.hasIcon = hasIcon;
74
+ root.actived = active_item;
75
+ return root;
76
+ }
77
+ static fromArray(array) {
78
+ if (array instanceof Tree) return array;
79
+ var root = new Tree;
80
+ root.tab = -Infinity;
81
+ root.count = 0;
82
+ root.total = 0;
83
+ var path = [root];
84
+ for (var cx = 0, dx = array.length; cx < dx; cx++) {
85
+ var arg = array[cx];
86
+ var item = new Item(arg);
87
+ item.root = root;
88
+ for (var cy = path.length - 1; cy >= 0; cy--) {
89
+ var parentElement = path[cy];
90
+ if (parentElement.tab < arg.tab) {
91
+ item.parent = parentElement;
92
+ parentElement.push(item);
93
+ path.splice(cy + 1, path.length - cy - 1, item);
94
+ break;
95
+ }
96
+ parentElement.parent.count += parentElement.count || parentElement.length || 1;
97
+ parentElement.parent.total += (parentElement.total || parentElement.length) + 1;
98
+ }
99
+ }
100
+ while (path.length > 1) {
101
+ var item = path.pop();
102
+ path[path.length - 1].count += item.count || item.length || 1;
103
+ }
104
+ return root;
105
+ }
106
+ static toArray(root, skipClosed = true) {
107
+ var path = [root], pathcx = [0];
108
+ var result = [];
109
+ var max_deep = 1;
110
+ loop: while (pathcx.length) {
111
+ var pathindex = pathcx.length - 1;
112
+ var cx = pathcx[pathindex];
113
+ var item = path[pathindex];
114
+ if (cx >= item.length) {
115
+ path.pop();
116
+ pathcx.pop();
117
+ continue loop;
118
+ }
119
+ var elem = item[cx];
120
+ elem.parent = item;
121
+ result.push(elem);
122
+ pathcx[pathindex] = ++cx;
123
+ if (!skipClosed || !elem.isClosed()) {
124
+ if (elem.length) {
125
+ path.push(elem);
126
+ pathcx.push(0);
127
+ if (pathcx.length > max_deep) {
128
+ max_deep = pathcx.length;
129
+ }
130
+ }
131
+ }
132
+ }
133
+ result.deep = max_deep;
134
+ return result;
135
+ }
136
+ static appendTo(parent, datas) {
137
+ var tab = parent && parent.tab + 1 || 1;
138
+ var length = parent.length;
139
+ for (var data of datas) {
140
+ if (isObject(data)) {
141
+ data.tab = tab;
142
+ var item = new Item(data);
143
+ item.parent = parent;
144
+ item.root = parent.root;
145
+ parent.push(item);
146
+ }
147
+ }
148
+ var delta = parent.length - length;
149
+ while (parent) {
150
+ parent.count += delta;
151
+ parent = parent.parent;
152
+ }
153
+ }
154
+ }
@@ -85,8 +85,16 @@ function getCookies(domainPath) {
85
85
  } while (domain.length);
86
86
  return serialize(cookieObject, ";");
87
87
  }
88
+
89
+ function delCookies(domainPath) {
90
+ var splited = domainPath.split("/");
91
+ var domain = splited[0];
92
+ delete cookiesMap[domain];
93
+ }
94
+
88
95
  return {
89
96
  cookiesMap,
90
97
  addCookie,
91
98
  getCookies,
99
+ delCookies,
92
100
  }
@@ -1,4 +1,4 @@
1
- var { getCookies, addCookie } = cookie;
1
+ var { getCookies, addCookie, delCookies } = cookie;
2
2
  var { File } = this;
3
3
  function isFile(a) {
4
4
  if (File) {
@@ -6,10 +6,12 @@ function isFile(a) {
6
6
  }
7
7
  }
8
8
  var base = null, location_href = null;
9
+ var encrypt = null;
9
10
  // ///// 1 ////////// 2 /////// 3 //// 4 //
10
11
  var domainReg = /^(?:(https?)\:)?\/\/(.*?)(?:\/(.*?))?([\?#].*)?$/i;
11
12
  var setHost = function (host) {
12
13
  base = host;
14
+ encrypt = null;
13
15
  };
14
16
  var HeadersKeys = ["Content-Type"];
15
17
  var cors_hosts = [];
@@ -26,8 +28,8 @@ function isChildPath(relative, path) {
26
28
  return relative.replace(/^(.*\/)[^\/]*$/, path);
27
29
  }
28
30
 
29
- var getCrossUrl = function (domain, headers) {
30
- if (notCross(domain)) return domain;
31
+ var getCrossUrl = function (domain, headers, encrypt) {
32
+ if (notCross(domain, !!encrypt)) return domain;
31
33
  var originDomain = getDomainPath(domain);
32
34
  var _cookies = getCookies(originDomain);
33
35
  var _headers = {};
@@ -37,9 +39,14 @@ var getCrossUrl = function (domain, headers) {
37
39
  extend(_headers, headers);
38
40
  _headers = serialize(_headers);
39
41
  if (_headers) _headers = "," + _headers;
40
- return domain
42
+ var b = encrypt ? "!" : `*`;
43
+ var ishttps = /^(https\:|s\/\/)/i.test(domain);
44
+ domain = domain
41
45
  .replace(/^(s?)(\/\/)/i, "http$1:$2")
42
- .replace(domainReg, base + `*${/^(https\:|s\/\/)/i.test(domain) ? "*" : ""}$2${_headers}/$3$4`);
46
+ .replace(domainReg, `$2${_headers}/$3$4`)
47
+ if (ishttps) domain = b + domain;
48
+ if (encrypt) domain = encode62.timeencode(encode62.safeencode(domain, encrypt));
49
+ return base + b + domain;
43
50
  };
44
51
  function noop() { }
45
52
  function toResponse() {
@@ -63,7 +70,6 @@ function cross_(jsonp, digest = noop, method, url, headers) {
63
70
  }
64
71
  var loaded, errored;
65
72
  var onload = function (data) {
66
- removeFromList(requests, xhr);
67
73
  if (xhr.decoder) {
68
74
  data = xhr.decoder(data);
69
75
  }
@@ -72,13 +78,13 @@ function cross_(jsonp, digest = noop, method, url, headers) {
72
78
  digest();
73
79
  };
74
80
  var onerror1 = function (e) {
75
- removeFromList(requests, xhr);
76
81
  errored = e || "未知错误!";
77
82
  flush();
78
83
  digest();
79
84
  };
80
85
  var onerror = async function (e) {
81
86
  if (e.type === 'error') {
87
+ removeFromList(requests, e.target);
82
88
  e = { response: "无法访问服务器", toString: toResponse };
83
89
  }
84
90
  for (var r of reforms) {
@@ -112,8 +118,12 @@ function cross_(jsonp, digest = noop, method, url, headers) {
112
118
  xhr.onerror = onerror;
113
119
  }
114
120
  else {
115
- var nocross = notCross(url);
116
- var callback = function () {
121
+ var isencrypt = /^[夏商周秦xszq]/i.test(method);
122
+ if (isencrypt) method = method.slice(1);
123
+ var nocross = notCross(url, isencrypt);
124
+ if (nocross) isencrypt = false;
125
+ var callback = async function () {
126
+ removeFromList(requests, xhr);
117
127
  var exposeHeaders = !nocross && xhr.getResponseHeader("access-control-expose-headers");
118
128
  var exposeMap = {};
119
129
  if (exposeHeaders) exposeHeaders.split(",").forEach(h => exposeMap[h.toLowerCase()] = true);
@@ -121,9 +131,31 @@ function cross_(jsonp, digest = noop, method, url, headers) {
121
131
  var exposekey = nocross ? "set-cookie" : "efront-cookie";
122
132
  if (exposeMap[exposekey]) {
123
133
  var cookie = xhr.getResponseHeader(exposekey);
124
- addCookie(cookie, originDomain);
134
+ if (cookie && !xhr.nocookie) {
135
+ try {
136
+ if (isencrypt) cookie = encode62.safedecode(cookie, xhr.encrypt);
137
+ }
138
+ catch (e) {
139
+ onerror({ status: xhr.status, response: "Cookie解析异常!", toString: toResponse });
140
+ return;
141
+ }
142
+ addCookie(cookie, originDomain);
143
+ }
144
+
125
145
  }
126
146
  }
147
+ if (isencrypt && xhr.response) {
148
+ try {
149
+ xhr = {
150
+ status: xhr.status,
151
+ response: encode62.safedecode(xhr.response || xhr.responseText, xhr.encrypt),
152
+ };
153
+ xhr.responseText = xhr.response;
154
+ }
155
+ catch (e) {
156
+ return onerror({ status: xhr.status, response: "数据无法解析!", toString: toResponse })
157
+ }
158
+ };
127
159
  switch (xhr.status) {
128
160
  case 0:
129
161
  if (!xhr.response) {
@@ -167,6 +199,8 @@ function cross_(jsonp, digest = noop, method, url, headers) {
167
199
  var xhr = cross(callback, onerror);
168
200
  var send = xhr.send;
169
201
  xhr.toString = toResponse;
202
+ if (isencrypt && !encrypt) encrypt = cross.getCode();
203
+ if (isencrypt) xhr.encrypt = encrypt;
170
204
  xhr.json = xhr.data = xhr.send = function (data, value) {
171
205
  if (!jsondata && !(isEmpty(data) && isEmpty(value))) jsondata = data instanceof Array ? [] : {};
172
206
  if (FormData && data instanceof FormData) {
@@ -202,8 +236,9 @@ function cross_(jsonp, digest = noop, method, url, headers) {
202
236
  datas = serialize(jsondata, "&", "=");
203
237
  }
204
238
  };
205
-
206
- var fire = function () {
239
+ var fire = async function () {
240
+ var code = await xhr.encrypt;
241
+ xhr.encrypt = code;
207
242
  var isform = /^f/i.test(method);
208
243
  if (isform) {
209
244
  if (method === 'form') method = 'post';
@@ -236,12 +271,12 @@ function cross_(jsonp, digest = noop, method, url, headers) {
236
271
  extend(realHeaders, _headers);
237
272
  xhr.open(method, url);
238
273
  } else {
239
- xhr.open(method, getCrossUrl(url, _headers));
274
+ xhr.open(method, getCrossUrl(url, _headers, isencrypt && code));
240
275
  }
241
276
  if (is_gb2312) xhr.overrideMimeType("text/plain; charset=gb2312");
242
-
277
+ delete realHeaders.Cookie;
243
278
  Object.keys(realHeaders).forEach(key => setRequestHeader.call(xhr, key, realHeaders[key]));
244
- if (!isEmpty(datas)) send.call(xhr, datas);
279
+ if (!isEmpty(datas)) send.call(xhr, !isencrypt ? datas : encode62.safeencode(datas, code));
245
280
  else send.call(xhr);
246
281
  digest();
247
282
  };
@@ -282,6 +317,11 @@ function cross_(jsonp, digest = noop, method, url, headers) {
282
317
  removeFromList(requests, this);
283
318
  if (isFunction(abort)) abort.call(this);
284
319
  };
320
+ xhr.delCookies = function () {
321
+ delCookies(originDomain);
322
+ xhr.nocookie = true;
323
+ return xhr;
324
+ };
285
325
  requests.push(xhr);
286
326
  return xhr;
287
327
  }
@@ -289,11 +329,10 @@ function addDirect(a) {
289
329
  if (cors_hosts.indexOf(a) >= 0) return;
290
330
  if (typeof a === 'string' || a instanceof RegExp) cors_hosts.push(a);
291
331
  }
292
- function notCross(domain) {
293
- if (!base ||
294
- location_href && location_href === domain.slice(0, location_href.length) ||
295
- !/^https?\:\/\/|^s?\/\//.test(domain) ||
296
- domain.replace(domainReg, '$2') === base.replace(domainReg, '$2')) return true;
332
+ function notCross(domain, encrypt) {
333
+ if (!location_href || !base || !/^https?\:\/\/|^s?\/\//.test(domain)) return true;
334
+ if (location_href === domain.slice(0, location_href.length) ||
335
+ domain.replace(domainReg, '$2') === base.replace(domainReg, '$2')) return !encrypt;
297
336
  for (var cx = 0, dx = cors_hosts.length; cx < dx; cx++) {
298
337
  var host = cors_hosts[cx];
299
338
  if (host instanceof RegExp) {
@@ -323,9 +362,17 @@ function reform(r, info, fire, cancel, e) {
323
362
  function addReform(r) {
324
363
  if (isFunction(r)) reforms.push(r);
325
364
  }
365
+ function getCode() {
366
+ return new Promise((ok, oh) => {
367
+ this('get', base + "!").then((xhr) => { return ok(encode62.timedecode(xhr.response || xhr.responseText)) }, () => {
368
+ return oh('未连接到可加密的服务器!');
369
+ });
370
+ });
371
+ }
326
372
  var bind = cross_.bind;
327
373
  cross_.bind = function () {
328
374
  var cross_ = bind.apply(this, arguments);
375
+ arguments[0].getCode = getCode.bind(cross_);
329
376
  extend(cross_, {
330
377
  requests,
331
378
  abortAll() {
@@ -28,13 +28,20 @@ Object.assign(encode62, {
28
28
  src,
29
29
  map,
30
30
  time_delta: parseInt("zzzzz", 36),
31
+ safeencode(string, sign, offset) {
32
+ string = encodeURIComponent(string).replace(/\./g, '..').replace(/[\!'\(\)~]/g, a => escape(a)).replace(/%/g, '.');
33
+ return this.encode62(string, sign, offset);
34
+ },
35
+ safedecode(string, sign, offset) {
36
+ string = this.decode62(string, sign, offset).replace(/\.\.?/g, a => a === '.' ? "%" : ".");
37
+ return decodeURIComponent(string);
38
+ },
31
39
  timedecode(string) {
32
40
  var { time_delta } = this;
33
41
  var time_rest = string.slice(string.length - time_delta.toString(36).length, string.length);
34
42
  var time_start = parseInt((new Date() - parseInt(time_rest, 36)) / time_delta) * time_delta;
35
43
  var time_stamp = time_start + parseInt(time_rest, 36);
36
- string = this.decode62(string.slice(0, string.length - time_delta.toString(36).length), time_stamp.toString(36)).replace(/\.\.?/g, a => a === '.' ? "%" : ".");
37
- return decodeURIComponent(string);
44
+ return this.safedecode(string.slice(0, string.length - time_delta.toString(36).length), time_stamp.toString(36));
38
45
  },
39
46
  timeencode(string) {
40
47
  var { time_delta } = this;
@@ -43,8 +50,7 @@ Object.assign(encode62, {
43
50
  var time_rest = time_stamp % time_delta;
44
51
  var time_rest_str = time_rest.toString(36);
45
52
  var time_delta_str = time_delta.toString(36);
46
- string = encodeURIComponent(string).replace(/\./g, '..').replace(/[\!'\(\)~]/g, a => escape(a)).replace(/%/g, '.');
47
- return this.encode62(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
53
+ return this.safeencode(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
48
54
  },
49
55
  timeupdate(string) {
50
56
  var { time_delta } = this;
@@ -57,7 +63,7 @@ Object.assign(encode62, {
57
63
  return this.timeencode(this.timedecode(string));
58
64
  }
59
65
  },
60
- encode62(data, sign) {
66
+ encode62(data, sign, offset = 0) {
61
67
  if (!sign) return data;
62
68
  var result = String(data);
63
69
  sign = String(sign);
@@ -65,7 +71,7 @@ Object.assign(encode62, {
65
71
  var result = result.replace(/\w/g, function (w, cx) {
66
72
  var code = map[w];
67
73
  if (typeof code !== "number") return w;
68
- var s = code ^ (sign.charCodeAt(cx % sign.length) % src.length);
74
+ var s = code ^ (sign.charCodeAt((offset + cx) % sign.length) % src.length);
69
75
  if (s >= src.length) return w;
70
76
  return src[s];
71
77
  });
@@ -9,11 +9,11 @@ var dragview = function (dragview) {
9
9
  offsetWidth = menu.offsetWidth;
10
10
  var { target } = event;
11
11
  moving = null;
12
- if (/(input|textarea)/i.test(target.tagName)) {
12
+ if (/(input|textarea|select)/i.test(target.tagName) || getTargetIn(a => a.nodrag || a.hasAttribute('nodrag') || a.dragable === false, event.target)) {
13
13
  moving = false;
14
14
  } else {
15
15
  var { childNodes } = target;
16
- for (var cx = 0, dx = childNodes.length; cx < dx; cx++) {
16
+ if (getComputedStyle(target).cursor === 'auto') for (var cx = 0, dx = childNodes.length; cx < dx; cx++) {
17
17
  var child = childNodes[cx];
18
18
  if (child.nodeType === 3) {
19
19
  moving = false;
@@ -27,7 +27,7 @@ var dragview = function (dragview) {
27
27
  break;
28
28
  }
29
29
  target = target.parentNode;
30
- } while (target.nodeType == 1);
30
+ } while (target && target.nodeType == 1);
31
31
  }
32
32
  },
33
33
  move(event) {
@@ -38,6 +38,7 @@ var dragview = function (dragview) {
38
38
  ) return;
39
39
  var deltaX = savedX - event.clientX;
40
40
  var deltaY = savedY - event.clientY;
41
+ event.preventDefault();
41
42
  if (!moving) {
42
43
  if (Math.abs(deltaX) < MOVELOCK_DELTA && Math.abs(deltaY) < MOVELOCK_DELTA) return;
43
44
  if (Math.abs(deltaY) >= Math.abs(deltaX)) {
@@ -140,7 +141,7 @@ function main(mainPath, historyName = "") {
140
141
  };
141
142
  on("transitionend")(layer, function (event) {
142
143
  if (event.target !== this) return;
143
- dispatch(window, 'render');
144
+ dispatch(window, 'resize');
144
145
  });
145
146
  layer.closeLeft = function () {
146
147
  closed = true;
@@ -1 +1 @@
1
- <select -model="host" @change="setHost(this.value)" direction=y addable><option -repeat="h in hosts" :value=h.key -text="h.name"></option></select>
1
+ <select -model="host" @change="setHost(this.value)" direction=y editable -src="h in hosts"><option :value=h.key -text="h.name"></option></select>
@@ -3,6 +3,7 @@ function main() {
3
3
  a.innerHTML = template;
4
4
  render(a, {
5
5
  setHost(a) {
6
+ data.setInstance("hosts", this.hosts, true);
6
7
  data.setInstance("base", { base: location.protocol + "//" + a + "/", host: a });
7
8
  data.abortAll();
8
9
  zimoli();
@@ -0,0 +1 @@
1
+ submit_
@@ -1,5 +1,5 @@
1
1
  var cloneProperties = "fontWeight,fontSize,fontFamily,color,textShadow,opacity,writingMode,blockSize,wordSpacing,letterSpacing,whiteSpace".split(",");
2
- var cloneProperties2 = "position,backdropFilter,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");
2
+ var cloneProperties2 = "position,backdropFilter,float,clear,margin,color,verticalAlign,textAlign,textShadow,opacity,boxShadow,overflow,textOverflow,wordBreak,webkitLineClamp,webkitBoxOrient,writingMode,blockSize,wordSpacing,letterSpacing,textIndent,lineHeight,display,appearance,webkitAppearance,MozAppearance".split(",");
3
3
  var pushProperty = function (key, props) {
4
4
  props.split(",").forEach(k => {
5
5
  cloneProperties2.push(key + k);
@@ -348,6 +348,16 @@ var parseData = function (sourceText) {
348
348
  };
349
349
 
350
350
  function fixApi(api, href) {
351
+ if (/^\//.test(href)) {
352
+ var { protocol, host } = parseURL(location.href);
353
+ href = protocol + "//" + host + href;
354
+ }
355
+ else if (/^\.\//.test(href)) {
356
+ var { protocol, host, pathname } = parseURL(location.href);
357
+ href = href.slice(1);
358
+ if (pathname) href = pathname.replace(/\/[^\/\\]*$/, '') + href;
359
+ href = protocol + "//" + host + href;
360
+ };
351
361
  api.transpile = getTranspile(api.url);
352
362
  api.url = api.url.replace(/#[\s\S]*$/, '');
353
363
  if (!reg.test(api.url)) {
@@ -18,13 +18,20 @@ var encode62 = {
18
18
  }
19
19
  return buff.join('');
20
20
  },
21
+ safeencode(string, sign, offset) {
22
+ string = encodeURIComponent(string).replace(/\./g, '..').replace(/[\!'\(\)~]/g, a => escape(a)).replace(/%/g, '.');
23
+ return this.encode(string, sign, offset);
24
+ },
25
+ safedecode(string, sign, offset) {
26
+ string = this.encode(string, sign, offset).replace(/\.\.?/g, a => a === '.' ? "%" : ".");
27
+ return decodeURIComponent(string);
28
+ },
21
29
  timedecode(string) {
22
30
  var { time_delta } = this;
23
31
  var time_rest = string.slice(string.length - time_delta.toString(36).length, string.length);
24
32
  var time_start = parseInt((new Date() - parseInt(time_rest, 36)) / time_delta) * time_delta;
25
33
  var time_stamp = time_start + parseInt(time_rest, 36);
26
- string = this.encode(string.slice(0, string.length - time_delta.toString(36).length), time_stamp.toString(36)).replace(/\.\.?/g, a => a === '.' ? "%" : ".");
27
- return decodeURIComponent(string);
34
+ return this.safedecode(string.slice(0, string.length - time_delta.toString(36).length), time_stamp.toString(36));
28
35
  },
29
36
  timeencode(string) {
30
37
  var { time_delta } = this;
@@ -35,8 +42,7 @@ var encode62 = {
35
42
  var time_rest = time_stamp % time_delta;
36
43
  var time_rest_str = time_rest.toString(36);
37
44
  var time_delta_str = time_delta.toString(36);
38
- string = encodeURIComponent(string).replace(/\./g, '..').replace(/[\!'\(\)~]/g, a => escape(a)).replace(/%/g, '.');
39
- return this.encode(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
45
+ return this.safeencode(string, time_stamp.toString(36)) + repeat("0", time_delta_str.length - time_rest_str.length) + time_rest_str;
40
46
  },
41
47
  timeupdate(string) {
42
48
  var { time_delta } = this;
@@ -50,7 +56,7 @@ var encode62 = {
50
56
  return this.timeencode(this.timedecode(string));
51
57
  }
52
58
  },
53
- encode(data, sign) {
59
+ encode(data, sign, offset = 0) {
54
60
  if (!sign) return data;
55
61
  var result = String(data);
56
62
  sign = String(sign);
@@ -58,7 +64,7 @@ var encode62 = {
58
64
  var result = result.replace(/\w/g, function (w, cx) {
59
65
  var code = map[w];
60
66
  if (!isNumber(code)) return w;
61
- var s = code ^ (sign.charCodeAt(cx % sign.length) % src.length);
67
+ var s = code ^ (sign.charCodeAt((offset + cx) % sign.length) % src.length);
62
68
  if (s >= src.length) return w;
63
69
  return src[s];
64
70
  });
@@ -1,4 +1,3 @@
1
- var mountedGalleries = resizingList;
2
1
  var complete_class = "complete";
3
2
  var inadequate_class = "lack";
4
3
  function bindScroll(elements) {
@@ -36,6 +35,7 @@ function gallery(element, minWidth, generator) {
36
35
 
37
36
  var resize = function () {
38
37
  var clientWidth = parseFloat(freePixel(element.clientWidth));
38
+ if (!clientWidth) return;
39
39
  boxCount = clientWidth / minWidth | 0;
40
40
  if (boxCount < 1) boxCount = 1;
41
41
  element.paddingMax = boxCount;
@@ -47,19 +47,7 @@ function gallery(element, minWidth, generator) {
47
47
  maxWidth: fromPixel(maxWidth),
48
48
  });
49
49
  };
50
- var _onappend = function () {
51
- mountedGalleries.push(element);
52
- element.resize();
53
- };
54
- onappend(element, _onappend);
55
-
56
- onremove(element, function () {
57
- for (var cx = mountedGalleries.length - 1; cx >= 0; cx--) {
58
- if (mountedGalleries[cx] === element) {
59
- mountedGalleries.splice(cx, 1);
60
- }
61
- }
62
- });
50
+ resizingList.set(element);
63
51
  var createColumn = function (id) {
64
52
  var _box = list(function (index) {
65
53
  var realindex = index * boxCount + id;
@@ -102,8 +90,6 @@ function gallery(element, minWidth, generator) {
102
90
  index = realIndex / boxCount || 0;
103
91
  element.go(index);
104
92
  }, 0);
105
- if (!element.renders) element.renders = [];
106
- element.renders.unshift(element.resize);
107
93
  care(element, function () {
108
94
  var index = this.index();
109
95
  this.clean();
@@ -1,53 +1 @@
1
-
2
- function getTreeFromData(array) {
3
- var root = [];
4
- root.tab = -Infinity;
5
- root.count = 0;
6
- var map = {};
7
- array = array.filter(a => !!a);
8
- var active_item = null;
9
- array.forEach(function (data) {
10
- var item = new Item(data);
11
- if (!active_item && item.isActived()) active_item = item;
12
- if (data.id) {
13
- map[data.id] = item;
14
- } else {
15
- root.push(item);
16
- }
17
- });
18
- array.forEach(function (data) {
19
- if (!data) return;
20
- var parent = map[data.parentId];
21
- if (parent) {
22
- var item = map[data.id];
23
- delete map[data.id];
24
- if (parent) {
25
- parent.push(item);
26
- }
27
- }
28
- });
29
- var items = Object.keys(map).map(a => map[a]);
30
- root.push.apply(root, items);
31
- var tab = 0;
32
- var run = function (item, parent) {
33
- item.tab = tab;
34
- var count = 0, total = 0;
35
- item.parent = parent;
36
- item.root = root;
37
- if (item.length) {
38
- tab++;
39
- for (var cx = 0, dx = item.length; cx < dx; cx++) {
40
- var i = item[cx];
41
- run(i, parent);
42
- count += i.count || 1;
43
- total += i.total;
44
- }
45
- tab--;
46
- }
47
- item.total = total + item.length;
48
- return item.count = count;
49
- };
50
- run(root);
51
- root.actived = active_item;
52
- return root;
53
- }
1
+ Tree.fromData;