efront 4.22.5 → 4.22.6

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.
@@ -16,15 +16,11 @@ var isFirstTimeLoad = sessionInitHash === null;
16
16
  var isSimpleRefresh = sessionInitHash === locationInitHash;
17
17
  var preventNextHashChange = false;
18
18
  window_history.scrollRestoration = 'manual';
19
+ var popupHashlessPath = '/';
19
20
  var pathFromHash = function (targetHash) {
20
21
  var targetHashIndex = targetHash.indexOf("#" + current_history);
21
22
  if (targetHashIndex < 0) return;
22
23
  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
24
  targetpath = decodeURI(targetpath);
29
25
  return targetpath;
30
26
  }
@@ -38,6 +34,10 @@ onhashchange(window, function (event) {
38
34
  var currentHash = getCurrentHash();
39
35
  if (currentHash && currentHash === targetHash) return;
40
36
  var targetpath = pathFromHash(targetHash);
37
+ if (pathFromHash(currentHash) === popupHashlessPath) {
38
+ backward();
39
+ return;
40
+ }
41
41
  forward(targetpath);
42
42
  return;
43
43
  }
@@ -420,8 +420,14 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
420
420
  root_path = _history[0];
421
421
  pagepath = location.hash;
422
422
  if (pagepath) {
423
- if (_history.index > 0) pagepath = pathFromHash(pagepath);
424
- else pagepath = '';
423
+ pagepath = pathFromHash(pagepath);
424
+ if (pagepath === popupHashlessPath) {
425
+ preventNextHashChange = true;
426
+ window_history.go(-1);
427
+ preventNextHashChange = true;
428
+ pagepath = pathFromHash(location.hash);
429
+ }
430
+ if (_history.index === 0) pagepath = '';
425
431
  }
426
432
  if (!pagepath) pagepath = _history[_history.index];
427
433
  try {
@@ -498,7 +504,7 @@ var popstate = function (path_name, history_name) {
498
504
  var getCurrentHash = function () {
499
505
  var history_name = current_history.replace(/\/$/, '');
500
506
  if (rootElements.length) {
501
- return `#${history_name}/`;
507
+ return `#${history_name}${popupHashlessPath}`;
502
508
  }
503
509
  var _historylist = history[current_history];
504
510
  if (!_historylist || _historylist.index < 1) return "";
@@ -521,7 +527,7 @@ var fixurl = function (historyDelta) {
521
527
  location.href = hash;
522
528
  }
523
529
  }
524
- else location.replace(hash);
530
+ else if (location.href !== hash) location.href = hash;
525
531
  }
526
532
  }
527
533
  else if (pagehash_reg.test(location.hash)) {
@@ -553,7 +559,10 @@ var forward = function (pgpath) {
553
559
  go(1);
554
560
  }
555
561
  else if (hty[hty.index - 1] === pgpath) {
556
- go(-1);
562
+ backward();
563
+ }
564
+ else {
565
+ go(pgpath);
557
566
  }
558
567
  };
559
568
  var backward = function () {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "efront",
3
- "version": "4.22.5",
3
+ "version": "4.22.6",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {