efront 4.22.5 → 4.22.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.
@@ -29,7 +29,6 @@ function main() {
29
29
  scope.nodeVersion = a.nodeVersion;
30
30
  scope.platform = a.platform;
31
31
  scope.arch = a.arch;
32
- console.log('status')
33
32
  });
34
33
  return page;
35
34
  }
@@ -119,6 +119,7 @@
119
119
  }
120
120
  return [];
121
121
  };
122
+ var first_opened = false;
122
123
  result.update = function (items) {
123
124
  delete result.loading_promise;
124
125
  delete result.then;
@@ -157,6 +158,7 @@
157
158
  };
158
159
  }
159
160
  }
161
+ first_opened = false;
160
162
  return result;
161
163
  };
162
164
  var setActive = function (p, active) {
@@ -190,14 +192,15 @@
190
192
  });
191
193
  result.open = function (menu) {
192
194
  if (!menu) {
193
- if (result.active) return;
194
- menu = result[0];
195
+ if (first_opened && result.active) return;
196
+ menu = result.active || result[0];
195
197
  }
196
198
  if (!menu.path) {
197
199
  menu.closed = !menu.closed;
198
200
  return;
199
201
  }
200
- if (menu === result.active) return;
202
+ if (first_opened && menu === result.active) return;
203
+ first_opened = true;
201
204
  var opened = result.opened || [];
202
205
  if (!~opened.indexOf(menu) && !getChild(menu).id) {
203
206
  opened.push(menu);
@@ -82,7 +82,7 @@ function main(mainPath, historyName = "") {
82
82
  appendChild.replace(topLayer, page);
83
83
  topLayer = page;
84
84
  }
85
- zimoli();
85
+ if (mainPath) zimoli();
86
86
  };
87
87
  if (typeof leftPath === 'string') {
88
88
  zimoli.prepare(leftPath, hook);
@@ -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,13 @@ 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
+ pagepath = pathFromHash(location.hash);
428
+ }
429
+ if (_history.index === 0) pagepath = '';
425
430
  }
426
431
  if (!pagepath) pagepath = _history[_history.index];
427
432
  try {
@@ -498,7 +503,7 @@ var popstate = function (path_name, history_name) {
498
503
  var getCurrentHash = function () {
499
504
  var history_name = current_history.replace(/\/$/, '');
500
505
  if (rootElements.length) {
501
- return `#${history_name}/`;
506
+ return `#${history_name}${popupHashlessPath}`;
502
507
  }
503
508
  var _historylist = history[current_history];
504
509
  if (!_historylist || _historylist.index < 1) return "";
@@ -507,26 +512,36 @@ var getCurrentHash = function () {
507
512
  };
508
513
 
509
514
  var fixurl = function (historyDelta) {
510
- preventNextHashChange = false;
511
515
  var hash = getCurrentHash();
516
+ preventNextHashChange = true;
512
517
  if (pagehash_reg.test(hash)) {
513
518
  hash = location.href.replace(/\#[\s\S]*$/, '') + hash;
514
519
  if (!pagehash_reg.test(location.href)) location.href = hash;
515
520
  else if (location.href !== hash) {
516
521
  if (historyDelta) {
517
- preventNextHashChange = true;
518
522
  window_history.go(historyDelta);
519
- preventNextHashChange = false;
520
523
  if (location.href !== hash) {
521
524
  location.href = hash;
522
525
  }
526
+ else {
527
+ preventNextHashChange = false;
528
+ }
523
529
  }
524
- else location.replace(hash);
530
+ else if (location.href !== hash) {
531
+ location.href = hash;
532
+ }
533
+ else {
534
+ preventNextHashChange = false;
535
+ }
536
+ }
537
+ else {
538
+ preventNextHashChange = false;
525
539
  }
526
540
  }
527
541
  else if (pagehash_reg.test(location.hash)) {
528
- preventNextHashChange = true;
529
542
  window_history.go(-1);
543
+ }
544
+ else {
530
545
  preventNextHashChange = false;
531
546
  }
532
547
  };
@@ -553,7 +568,10 @@ var forward = function (pgpath) {
553
568
  go(1);
554
569
  }
555
570
  else if (hty[hty.index - 1] === pgpath) {
556
- go(-1);
571
+ backward();
572
+ }
573
+ else {
574
+ go(pgpath);
557
575
  }
558
576
  };
559
577
  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.7",
4
4
  "description": "一个开发环境,提供一种自由的前端开发模式,也可作为辅助工具使用。",
5
5
  "main": "public/efront.js",
6
6
  "directories": {