efront 4.22.4 → 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
  });
@@ -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
  }
@@ -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) {
@@ -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;
@@ -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
  }
@@ -14,57 +14,36 @@ var pagehash_reg = /#([\/\w\:@\.\_\(\)\+\-\*\$@!~_'\?,&~%]+)$/;
14
14
  var locationInitHash = location.hash;
15
15
  var isFirstTimeLoad = sessionInitHash === null;
16
16
  var isSimpleRefresh = sessionInitHash === locationInitHash;
17
- var isWithHashLoad = !!location.hash;
18
17
  var preventNextHashChange = false;
19
18
  window_history.scrollRestoration = 'manual';
20
- if (isWithHashLoad && !isSimpleRefresh) {
21
- //带hash加载,吃掉hash
22
- location.replace("#");
23
- }
24
-
25
- if (/MSIE\s*[2-7]/.test(navigator.userAgent)) {
26
- window.onhistorychange = function (url) {
27
- // 如果是返回事件,一定不是第一次改变hash
28
- // 这里刚好可以屏蔽首次手动改变url可能产生的hashchange事件
29
- if (preventNextHashChange) return preventNextHashChange = false, window_history.go(-1);
30
- if (preventNextHashChange === void 0 ? onback && onback() === true : preventNextHashChange = void 0) { }
31
- };
32
- onselectstart(body, function (e) {
33
- return e.preventDefault();
34
- });
35
- var frame = document.createElement("iframe");
36
- css(frame, "display:none");
37
- appendChild.insert(body, frame);
38
- var doc = frame.contentWindow.document;
39
- var backman = function (isloaded) {
40
- doc.open();
41
- doc.write(isloaded !== false ? "" : "<script>result=parent.onhistorychange();onload=function(){history.forward()}</script>");
42
- doc.close();
43
- };
44
- backman(false);
45
- backman();
46
- } else {
47
- onhashchange(window, function (event) {
48
- if (fixurl.ing) return;
49
- // 如果是返回事件,一定不是第一次改变hash
50
- // 这里刚好可以屏蔽首次手动改变url可能产生的hashchange事件
51
- var targetHash = location.hash;
52
- sessionStorage.setItem(sessionSavedHashKey, targetHash);
53
- if (pagehash_reg.test(targetHash)) {
54
- var currentHash = getCurrentHash();
55
- if (currentHash && currentHash === targetHash) return;
56
- var targetHashIndex = targetHash.indexOf("#" + current_history);
57
- if (targetHashIndex < 0) return;
58
- var targetpath = targetHash.slice(targetHashIndex + current_history.replace(/\/$/, '').length + 1);
59
- targetpath = decodeURI(targetpath);
60
- go(targetpath);
61
- return;
62
- }
63
- if (preventNextHashChange) return preventNextHashChange = false;
64
- event.preventDefault();
65
- onback();
66
- });
19
+ var pathFromHash = function (targetHash) {
20
+ var targetHashIndex = targetHash.indexOf("#" + current_history);
21
+ if (targetHashIndex < 0) return;
22
+ var targetpath = targetHash.slice(targetHashIndex + current_history.replace(/\/$/, '').length + 1);
23
+ if (targetpath === '/') {
24
+ preventNextHashChange = true;
25
+ window_history.go(-1);
26
+ return;
27
+ }
28
+ targetpath = decodeURI(targetpath);
29
+ return targetpath;
67
30
  }
31
+ onhashchange(window, function (event) {
32
+ if (preventNextHashChange) return preventNextHashChange = false;
33
+ // 如果是返回事件,一定不是第一次改变hash
34
+ // 这里刚好可以屏蔽首次手动改变url可能产生的hashchange事件
35
+ var targetHash = location.hash;
36
+ sessionStorage.setItem(sessionSavedHashKey, targetHash);
37
+ if (pagehash_reg.test(targetHash)) {
38
+ var currentHash = getCurrentHash();
39
+ if (currentHash && currentHash === targetHash) return;
40
+ var targetpath = pathFromHash(targetHash);
41
+ forward(targetpath);
42
+ return;
43
+ }
44
+ event.preventDefault();
45
+ backward();
46
+ });
68
47
  // body
69
48
  var location_pathname = location.pathname;
70
49
  var _zimoli_params_key = `_zimoli_parameters:${location_pathname}#`;
@@ -113,8 +92,8 @@ function go(pagepath, args, history_name, oldpagepath) {
113
92
  if (isNumber(pagepath)) {
114
93
  if (isString(history_name)) {
115
94
  var _history = history[history_name] || [];
116
- pagepath = _history[pagepath < 1 ? _history.length + pagepath - 1 : pagepath];
117
- oldpagepath = _history[_history.length - 1];
95
+ pagepath = _history[pagepath < 2 ? _history.index + pagepath : pagepath];
96
+ oldpagepath = _history[_history.index];
118
97
  if (arguments.length === 1) {
119
98
  args = getZimoliParams(pagepath).data;
120
99
  }
@@ -171,7 +150,7 @@ function go(pagepath, args, history_name, oldpagepath) {
171
150
  addGlobal(_page, history_name, isRecover);
172
151
  page_object.prepares.splice(0, page_object.prepares.length).forEach(function (url) {
173
152
  if (isNumber(url)) {
174
- url = _history[url < 1 ? _history.length + url - 1 : url];
153
+ url = _history[url < 2 ? _history.index + url : url];
175
154
  }
176
155
  if (isString(url)) prepare(url);
177
156
  });
@@ -427,15 +406,24 @@ function create(pagepath, args, from, needroles) {
427
406
  return _page;
428
407
 
429
408
  }
430
-
409
+ var createEmptyHistory = function (emptyState) {
410
+ var h = [emptyState];
411
+ h.index = 0;
412
+ return h;
413
+ }
431
414
  var zimoliid = 0, zimoliad = 0;
432
415
  function zimoli(pagepath, args, history_name, oldpagepath) {
433
416
  if (arguments.length === 0) {
434
417
  if (zimoliid !== zimoliad) return;
435
418
  history_name = current_history;
436
- var _history = history[history_name] || [];
437
- root_path = _history[0] || "/main";
438
- pagepath = _history[_history.length - 1] || "/main";
419
+ var _history = history[history_name] || createEmptyHistory('/main');
420
+ root_path = _history[0];
421
+ pagepath = location.hash;
422
+ if (pagepath) {
423
+ if (_history.index > 0) pagepath = pathFromHash(pagepath);
424
+ else pagepath = '';
425
+ }
426
+ if (!pagepath) pagepath = _history[_history.index];
439
427
  try {
440
428
  var saveddata = JSAM.parse(hostoryStorage.getItem(_zimoli_params_key + pagepath)) || {};
441
429
  } catch (e) {
@@ -448,8 +436,6 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
448
436
  if (isNode(history_name))
449
437
  var zid = history_name.zimoliid = (history_name.zimoliid | 0) + 1;
450
438
  else var zid = arguments.length ? ++zimoliid : zimoliid;
451
-
452
- if (page_generators[pagepath]) return go(pagepath, args, history_name, oldpagepath);
453
439
  return prepare(pagepath, function () {
454
440
  if (isNode(history_name)) {
455
441
  if (history_name.zimoliid !== zid) return;
@@ -460,7 +446,7 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
460
446
  var global = {};
461
447
  var history = {};
462
448
  var current_history, default_history = current_history = "";
463
- history[current_history] = [];
449
+ history[current_history] = createEmptyHistory('/main');
464
450
  var history_session_object_key = `_zimoli_history_key:${location_pathname}`;
465
451
  try {
466
452
  history = JSAM.parse(hostoryStorage.getItem(history_session_object_key)) || history;
@@ -474,18 +460,25 @@ var pushstate = function (path_name, history_name) {
474
460
  }
475
461
  if (!isString(history_name)) return;
476
462
  if (!history[history_name]) {
477
- history[history_name] = [path_name];
463
+ history[history_name] = createEmptyHistory(path_name);
478
464
  } else {
479
465
  var _history = history[history_name];
480
- for (var cx = 0, dx = _history.length; cx < dx; cx++) {
466
+ var prevIndex = _history.index;
467
+ for (var cx = 0, dx = _history.index + 1; cx < dx; cx++) {
481
468
  if (_history[cx] === path_name) {
482
- _history.splice(cx, dx - cx);
469
+ _history.index = cx;
483
470
  isBack = cx < dx - 1;
484
471
  break;
485
472
  }
486
473
  }
487
- _history.push(path_name);
488
- if (_history.length) fixurl();
474
+ if (_history.index !== cx) {
475
+ _history.index++;
476
+ }
477
+ if (_history[_history.index] !== path_name) {
478
+ _history.splice(_history.index, _history.length - _history.index);
479
+ _history[_history.index] = path_name;
480
+ }
481
+ if (_history.index >= 0) fixurl(_history.index - prevIndex);
489
482
  }
490
483
  hostoryStorage.setItem(history_session_object_key, JSAM.stringify(history) || null);
491
484
  return isBack;
@@ -495,38 +488,47 @@ var popstate = function (path_name, history_name) {
495
488
  if (!isString(history_name)) return;
496
489
  if (!history[history_name]) return;
497
490
  var _history = history[history_name];
498
- for (var cx = 0, dx = _history.length; cx < dx; cx++) {
491
+ for (var cx = 0, dx = _history.index; cx < dx; cx++) {
499
492
  if (_history[cx] === path_name) {
500
- _history.splice(cx, dx - cx);
493
+ _history.index = cx;
501
494
  break;
502
495
  }
503
496
  }
504
497
  };
505
498
  var getCurrentHash = function () {
506
- var _historylist = history[current_history] || [];
507
499
  var history_name = current_history.replace(/\/$/, '');
508
500
  if (rootElements.length) {
509
501
  return `#${history_name}/`;
510
502
  }
511
- if (_historylist.length < 2) return "";
512
- var targeturl = `#${history_name}${_historylist.length ? _historylist[_historylist.length - 1] : ""}`;
503
+ var _historylist = history[current_history];
504
+ if (!_historylist || _historylist.index < 1) return "";
505
+ var targeturl = `#${history_name}${_historylist.length ? _historylist[_historylist.index] : ""}`;
513
506
  return encodeURI(targeturl);
514
507
  };
515
508
 
516
- var fixurl = function () {
517
- if (fixurl.ing) return;
518
- fixurl.ing = setTimeout(function () {
519
- fixurl.ing = false;
520
- var targeturl = getCurrentHash();
521
- if (pagehash_reg.test(targeturl)) {
522
- targeturl = location.href.replace(/\#[\s\S]*$/, '') + targeturl;
523
- if (!pagehash_reg.test(location.href)) location.href = targeturl;
524
- else if (location.hash !== targeturl) location.replace(targeturl);
525
- } else if (pagehash_reg.test(location.href)) {
526
- preventNextHashChange = true;
527
- window_history.go(-1);
528
- }
529
- }, 0);
509
+ var fixurl = function (historyDelta) {
510
+ preventNextHashChange = false;
511
+ var hash = getCurrentHash();
512
+ if (pagehash_reg.test(hash)) {
513
+ hash = location.href.replace(/\#[\s\S]*$/, '') + hash;
514
+ if (!pagehash_reg.test(location.href)) location.href = hash;
515
+ else if (location.href !== hash) {
516
+ if (historyDelta) {
517
+ preventNextHashChange = true;
518
+ window_history.go(historyDelta);
519
+ preventNextHashChange = false;
520
+ if (location.href !== hash) {
521
+ location.href = hash;
522
+ }
523
+ }
524
+ else location.replace(hash);
525
+ }
526
+ }
527
+ else if (pagehash_reg.test(location.hash)) {
528
+ preventNextHashChange = true;
529
+ window_history.go(-1);
530
+ preventNextHashChange = false;
531
+ }
530
532
  };
531
533
  var checkonback = function (elements) {
532
534
  for (var cx = 0, dx = elements.length; cx < dx; cx++) {
@@ -545,8 +547,16 @@ var checkonback = function (elements) {
545
547
  put(":empty", function () {
546
548
  return null;
547
549
  });
548
-
549
- var onback = function () {
550
+ var forward = function (pgpath) {
551
+ var hty = history[current_history];
552
+ if (hty[hty.index + 1] === pgpath) {
553
+ go(1);
554
+ }
555
+ else if (hty[hty.index - 1] === pgpath) {
556
+ go(-1);
557
+ }
558
+ };
559
+ var backward = function () {
550
560
  if (rootElements.length) {
551
561
  var onback = checkonback(rootElements.slice(rootElements.length - 1));
552
562
  fixurl();
@@ -632,7 +642,7 @@ var _switch = zimoli.switch = function (history_name = default_history, target_b
632
642
  }
633
643
  if (target_body) body = target_body;
634
644
  }
635
- if (emptyState !== false && !history[current_history]) root_path = (history[current_history] = [].concat(emptyState || ":empty"))[0];
645
+ if (emptyState !== false && !history[current_history]) root_path = (history[current_history] = createEmptyHistory(emptyState))[0];
636
646
  };
637
647
  popup.global = zimoli.global = addGlobal;
638
648
  popup.go = zimoli.go = go;
@@ -666,7 +676,7 @@ zimoli.setStorage = function (storage) {
666
676
  };
667
677
  zimoli.register = function (pathlike) {
668
678
  var params = [];
669
- pathlike = pathlike.replace(/\/\:(^[^\/]+)?/g, function (_, id) {
679
+ pathlike = pathlike.replace(/\/\:([^\/\:\-]+)/g, function (_, id) {
670
680
  params.push(id);
671
681
  return '';
672
682
  });
@@ -677,64 +687,100 @@ zimoli.clearHistory = function () {
677
687
  history = {};
678
688
  };
679
689
  zimoli.getCurrentHistory = function () {
680
- if (!history[current_history]) history[current_history] = [];
690
+ if (!history[current_history]) history[current_history] = createEmptyHistory();
681
691
  return history[current_history];
682
692
  };
683
693
  zimoli.inithash = locationInitHash;
684
694
  zimoli.createState = createState;
695
+ var touchEnabled = false;
685
696
  zimoli.enableTouchBack = function () {
686
- var touchTarget, currentTarget, history_name, historyList;
697
+ if (touchEnabled) return;
698
+ touchEnabled = true;
699
+ var backwardTarget, forwardTarget, currentTarget, history_name, historyList;
687
700
  var touchId = 0;
688
701
  var ratio = 0;
689
702
  var deltaX = 0;
690
703
  bindtouch(body, {
691
704
  start(event) {
692
705
  event.preventDefault();
706
+ touchId++;
693
707
  ratio = null;
694
708
  },
695
709
  move(a, event) {
696
710
  event.preventDefault();
697
711
  if (a !== null) {
712
+ ratio = a.x / body.clientWidth;
713
+ if (ratio <= -1) ratio = -0.999;
714
+ if (ratio >= 1) ratio = 0.999;
698
715
  if (!currentTarget) {
699
- var id = ++touchId;
700
716
  history_name = current_history;
701
717
  historyList = history[history_name];
702
718
  if (historyList.length < 2) return;
703
- var path1 = historyList[historyList.length - 1];
704
- var path0 = historyList[historyList.length - 2];
705
719
  currentTarget = global[history_name];
720
+ }
721
+ if (ratio > 0) a: {
722
+ if (backwardTarget) break a;
723
+ var id = ++touchId;
724
+ if (historyList.index < 1) return;
725
+ var path1 = historyList[historyList.index];
726
+ var path0 = historyList[historyList.index - 1];
706
727
  prepare(path0, function () {
707
728
  if (id !== touchId) return;
708
729
  var args = getZimoliParams(path0).data;
709
- touchTarget = create(path0, args, path1);
710
- setWithStyle(touchTarget, true);
711
- appendChild.insert(body, touchTarget);
730
+ backwardTarget = create(path0, args, path1);
731
+ setWithStyle(backwardTarget, true);
732
+ appendChild.insert(body, backwardTarget);
712
733
  });
734
+ if (forwardTarget) remove(forwardTarget, false), forwardTarget = null;
735
+ }
736
+ else if (ratio < 0) a: {
737
+ if (forwardTarget) break a;
738
+ var id = ++touchId;
739
+ if (historyList.index >= historyList.length - 1) return;
740
+ var path2 = historyList[historyList.index + 1];
741
+ prepare(path2, function () {
742
+ if (id !== touchId) return;
743
+ var args = getZimoliParams(path2).data;
744
+ forwardTarget = create(path2, args, path1);
745
+ setWithStyle(forwardTarget, false);
746
+ appendChild.insert(body, forwardTarget);
747
+ });
748
+ if (backwardTarget) remove(backwardTarget, false), backwardTarget = null;
713
749
  }
714
- ratio = a.x / body.clientWidth;
715
- if (ratio <= 0) ratio = 0.001;
716
- if (ratio >= 1) ratio = 0.999;
717
750
  deltaX = a.deltax;
718
751
  transition(currentTarget, ratio);
719
- transition(touchTarget, ratio - 1);
752
+ if (backwardTarget) transition(backwardTarget, ratio - 1);
753
+ if (forwardTarget) transition(forwardTarget, ratio + 1);
720
754
  }
721
755
  return { x: ratio * body.clientWidth };
722
756
  },
723
757
  end() {
724
- if (ratio === null || !touchTarget) return;
725
- if (deltaX > 0 && ratio > .1 || deltaX < 0 && ratio > .9 || deltaX === 0 && ratio > .4) {
726
- pushstate(historyList[historyList.length - 2], history_name);
758
+ if (ratio === null) return;
759
+ if (historyList.index >= 1 && (deltaX > 0 && ratio > .1 || deltaX < 0 && ratio > .9 || deltaX === 0 && ratio > .4)) {
760
+ setWithStyle(currentTarget, true);
761
+ pushstate(historyList[historyList.index - 1], history_name);
762
+ remove(currentTarget);
763
+ remove(forwardTarget, false);
764
+ transition(backwardTarget, 1);
765
+ global[history_name] = backwardTarget;
766
+ }
767
+ else if (historyList.index < historyList.length - 1 && (deltaX < 0 && ratio < -.1 || deltaX > 0 && ratio < -.9 || deltaX === 0 && ratio < -.4)) {
768
+ pushstate(historyList[historyList.index + 1], history_name);
769
+ setWithStyle(currentTarget, false);
727
770
  remove(currentTarget);
728
- transition(touchTarget, 1);
729
- global[history_name] = touchTarget;
771
+ remove(backwardTarget, false);
772
+ transition(forwardTarget, 1);
773
+ global[history_name] = forwardTarget;
730
774
  }
731
775
  else {
732
- setWithStyle(touchTarget, false);
733
- remove(touchTarget);
776
+ if (backwardTarget) setWithStyle(backwardTarget, false), remove(backwardTarget);
777
+ if (forwardTarget) setWithStyle(forwardTarget, true), remove(forwardTarget);
734
778
  transition(currentTarget, 1);
735
779
  }
736
780
  currentTarget = null;
737
- touchTarget = null;
781
+ backwardTarget = null;
782
+ historyList = null;
783
+ forwardTarget = null;
738
784
  ratio = null;
739
785
  }
740
786
  }, 'x')
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.22.4",
3
+ "version": "4.22.5",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {