efront 4.22.7 → 4.22.8
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.
- package/#/345/233/275/351/231/205/345/214/226.yml +36 -0
- package/apps/kugou/home.less +4 -0
- package/apps/pivot/api.yml +6 -2
- package/coms/basic/Table.js +2 -1
- package/coms/basic/data.js +5 -3
- package/coms/basic/mark.js +8 -2
- package/coms/frame/route.js +11 -1
- package/coms/layer/glance.js +1 -1
- package/coms/pivot/checkGeo.js +31 -4
- package/coms/zimoli/checkbox.less +1 -1
- package/coms/zimoli/marker.js +15 -2
- package/coms/zimoli/marker_test.js +24 -0
- package/coms/zimoli/table.js +1 -0
- package/coms/zimoli/zimoli.js +69 -55
- package/coms/zimoli/zimoli.md +3 -0
- package/docs//345/267/245/345/205/267//345/233/275/351/231/205/345/214/226.xht +28 -28
- package/package.json +1 -1
- package/public/efront.js +1 -1
|
@@ -1,3 +1,39 @@
|
|
|
1
|
+
- zh-CN: 此数据不可查询!
|
|
2
|
+
en: This data is not searchable!
|
|
3
|
+
|
|
4
|
+
- zh-CN: 不可查询私有数据!
|
|
5
|
+
en: Cannot query private data!
|
|
6
|
+
|
|
7
|
+
- zh-CN: 此数据不可枚举
|
|
8
|
+
en: This data cannot be enumerated
|
|
9
|
+
|
|
10
|
+
- zh-CN: 您无权访问此数据!
|
|
11
|
+
en: You do not have access to this data!
|
|
12
|
+
|
|
13
|
+
- zh-CN: 商品id
|
|
14
|
+
en: Product ID
|
|
15
|
+
|
|
16
|
+
- zh-CN: 商品名称
|
|
17
|
+
en: Product name
|
|
18
|
+
|
|
19
|
+
- zh-CN: 包含
|
|
20
|
+
en: contain
|
|
21
|
+
|
|
22
|
+
- zh-CN: 商品简述
|
|
23
|
+
en: Product Description
|
|
24
|
+
|
|
25
|
+
- zh-CN: 商品展示
|
|
26
|
+
en: Product Display
|
|
27
|
+
|
|
28
|
+
- zh-CN: 允许所有人检索全部内容
|
|
29
|
+
en: Allow everyone to retrieve all content
|
|
30
|
+
|
|
31
|
+
- zh-CN: 用户互访
|
|
32
|
+
en: User mutual visits
|
|
33
|
+
|
|
34
|
+
- zh-CN: 不公开时检查此项
|
|
35
|
+
en: Check this item when not publicly available
|
|
36
|
+
|
|
1
37
|
- zh-CN: 退出登录
|
|
2
38
|
en: Log Out
|
|
3
39
|
|
package/apps/kugou/home.less
CHANGED
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
padding-right: 60px;
|
|
15
15
|
cursor: default;
|
|
16
16
|
white-space: nowrap;
|
|
17
|
+
margin: 0 -6px;
|
|
18
|
+
width: auto;
|
|
17
19
|
|
|
18
20
|
>tag {
|
|
19
21
|
width: 25%;
|
|
@@ -94,6 +96,8 @@
|
|
|
94
96
|
font-size: 16px;
|
|
95
97
|
width: auto;
|
|
96
98
|
background: inherit;
|
|
99
|
+
border-left: 6px solid transparent;
|
|
100
|
+
border-right: 6px solid transparent;
|
|
97
101
|
}
|
|
98
102
|
|
|
99
103
|
.search-box {
|
package/apps/pivot/api.yml
CHANGED
|
@@ -34,8 +34,12 @@
|
|
|
34
34
|
unique-save: options ::unique-:data
|
|
35
35
|
recert: options ::recert
|
|
36
36
|
upload: put :path
|
|
37
|
-
https://
|
|
38
|
-
|
|
37
|
+
https://api.map.baidu.com/:
|
|
38
|
+
ipbaidu: get location/ip
|
|
39
|
+
https://restapi.amap.com/:
|
|
40
|
+
ipgaode: get v3/ip
|
|
41
|
+
https://www.ip.cn/ referer=https://www.ipshudi.com/&Cookie=:empty:
|
|
42
|
+
ipcn: get#tab0_address ip/:ip.html#address=!innerText
|
|
39
43
|
# https://ipchaxun.com/ :
|
|
40
44
|
# iplocation: get:[].info%20label:nth-child(n+2)>span:nth-child(2) :ip/
|
|
41
45
|
# https://www.ip138.com/:
|
package/coms/basic/Table.js
CHANGED
|
@@ -26,6 +26,7 @@ class Table extends Array {
|
|
|
26
26
|
$filterFields = [];
|
|
27
27
|
$unsummaryFileds = [];
|
|
28
28
|
callback = null;
|
|
29
|
+
heightLight = undefined;
|
|
29
30
|
static from(fields, data) {
|
|
30
31
|
var t = new Table;
|
|
31
32
|
t.fields = fields;
|
|
@@ -120,7 +121,7 @@ class Table extends Array {
|
|
|
120
121
|
var name = seek(o, f.key);
|
|
121
122
|
if (isEmpty(name) || !isString(name)) continue;
|
|
122
123
|
if (name === searchtext) this.hasFullmatch = true;
|
|
123
|
-
var [p, m] = mark.power(name, searchtext);
|
|
124
|
+
var [p, m] = mark.power(name, searchtext, this.heightLight);
|
|
124
125
|
if (p > power) power = p;
|
|
125
126
|
if (!isEmpty(f.key) && !isFunction(f.key)) o[f.key] = m;
|
|
126
127
|
else o.name = m, o.toString = returnName, o.valueOf = returnName;
|
package/coms/basic/data.js
CHANGED
|
@@ -604,14 +604,16 @@ var privates = {
|
|
|
604
604
|
return getApi(serviceId, this.getConfigPromise());
|
|
605
605
|
},
|
|
606
606
|
prepare(method, url, params) {
|
|
607
|
-
var spliterIndex = /[
|
|
607
|
+
var spliterIndex = /[\:\|\/\~\!\?\#\.\[]/.exec(method), search;
|
|
608
608
|
if (spliterIndex) spliterIndex = spliterIndex.index;
|
|
609
609
|
else spliterIndex = method.length;
|
|
610
610
|
var coinmethod = method.slice(0, spliterIndex).toLowerCase();
|
|
611
|
-
var realmethod = coinmethod.replace(/\W
|
|
611
|
+
var realmethod = coinmethod.replace(/\W[\s\S]*$/g, '');
|
|
612
612
|
var [uri, rest, baseuri, search] = prepareURL(url, params);
|
|
613
613
|
if (params && rest.length) rest.forEach(r => delete params[r]);
|
|
614
|
-
|
|
614
|
+
var selector = method.slice(spliterIndex);
|
|
615
|
+
if (!/^(?:[\.\#\[]|\:(?:nth|first|last)\-child)/.test(selector)) selector = selector.slice(1);
|
|
616
|
+
return { method: realmethod, coinmethod, selector, search, baseuri, uri, params };
|
|
615
617
|
},
|
|
616
618
|
loadIgnoreConfig(method, url, params1, api) {
|
|
617
619
|
var headers = api && api.headers;
|
package/coms/basic/mark.js
CHANGED
|
@@ -80,10 +80,16 @@ var pair = function (source, search, t1, t2, t3, t4) {
|
|
|
80
80
|
return power2(source, search);
|
|
81
81
|
}
|
|
82
82
|
var searchText = '';
|
|
83
|
-
var
|
|
83
|
+
var concat1 = function (pre, match, aft) {
|
|
84
|
+
return pre.concat(MARK_PRE1, match, MARK_AFT1, aft);
|
|
85
|
+
};
|
|
86
|
+
var power = function (source, search, concat_me) {
|
|
84
87
|
searchText = search;
|
|
88
|
+
var concat_ = concat1;
|
|
89
|
+
if (concat_me) concat1 = concat_me;
|
|
85
90
|
var res = power_(source, search);
|
|
86
91
|
searchText = '';
|
|
92
|
+
concat1 = concat_;
|
|
87
93
|
return res;
|
|
88
94
|
};
|
|
89
95
|
var power_p = function () { };
|
|
@@ -140,7 +146,7 @@ var power_ = function (source, search, func, mp) {
|
|
|
140
146
|
else if (ap >= p) {
|
|
141
147
|
p += ap / source.length / search.length * .01 - .2;
|
|
142
148
|
}
|
|
143
|
-
return [p, match_text_pre
|
|
149
|
+
return [p, concat1(match_text_pre, match_text, match_text_aft)];
|
|
144
150
|
}
|
|
145
151
|
return [0, source];
|
|
146
152
|
};
|
package/coms/frame/route.js
CHANGED
|
@@ -78,6 +78,7 @@
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
};
|
|
81
|
+
var firstMenu = null;
|
|
81
82
|
var parseMenuList = function (items) {
|
|
82
83
|
if (items instanceof Array) {
|
|
83
84
|
if (!items[0] || !items[0].name) {
|
|
@@ -123,6 +124,7 @@
|
|
|
123
124
|
result.update = function (items) {
|
|
124
125
|
delete result.loading_promise;
|
|
125
126
|
delete result.then;
|
|
127
|
+
firstMenu = null;
|
|
126
128
|
items = result.parse(items);
|
|
127
129
|
items.map(getChildren);
|
|
128
130
|
var opened = data.getInstance("menu-opened");
|
|
@@ -131,11 +133,13 @@
|
|
|
131
133
|
historys.forEach((a, i) => map[a] = i + 1);
|
|
132
134
|
result.splice(0, result.length);
|
|
133
135
|
var actived, actived_value = 0;
|
|
136
|
+
var zimoilPath = zimoli.getInitPath();
|
|
134
137
|
var a = function (menu) {
|
|
135
138
|
var res = checkroles(user.roles, menu.roles);
|
|
136
139
|
if (res) {
|
|
137
140
|
if (savedChildren[menu.id] instanceof Array) menu.children = savedChildren[menu.id].filter(a);
|
|
138
141
|
if (menu.path) {
|
|
142
|
+
if (!firstMenu || menu.path === zimoilPath) firstMenu = menu;
|
|
139
143
|
if (map[menu.path] > actived_value) {
|
|
140
144
|
actived = menu;
|
|
141
145
|
actived_value = map[menu.path];
|
|
@@ -189,11 +193,17 @@
|
|
|
189
193
|
oped.active = menu.id;
|
|
190
194
|
data.setInstance('menu-opened', oped);
|
|
191
195
|
}
|
|
196
|
+
first_opened = true;
|
|
192
197
|
});
|
|
193
198
|
result.open = function (menu) {
|
|
194
199
|
if (!menu) {
|
|
195
200
|
if (first_opened && result.active) return;
|
|
196
|
-
menu = result.active ||
|
|
201
|
+
menu = result.active || firstMenu;
|
|
202
|
+
if (!menu?.path) return;
|
|
203
|
+
first_opened = true;
|
|
204
|
+
zimoli.switch(null, null, menu.path);
|
|
205
|
+
zimoli();
|
|
206
|
+
return;
|
|
197
207
|
}
|
|
198
208
|
if (!menu.path) {
|
|
199
209
|
menu.closed = !menu.closed;
|
package/coms/layer/glance.js
CHANGED
package/coms/pivot/checkGeo.js
CHANGED
|
@@ -1,11 +1,38 @@
|
|
|
1
|
+
var md5 = docs$md5;
|
|
2
|
+
var baidu = function (ip) {
|
|
3
|
+
var query = {
|
|
4
|
+
ip,
|
|
5
|
+
ak: "lPiUBf6CCdZtLzrbzYREa6liU0NycJyr"
|
|
6
|
+
};
|
|
7
|
+
query.sn = md5(encodeURIComponent("/location/ip?" + serialize(query)) + "dZtaNhMkjlDmxAot0uYs2fEJKvTi3REe");
|
|
8
|
+
return data.from("ipbaidu", query);
|
|
9
|
+
};
|
|
10
|
+
var gaode = function (ip) {
|
|
11
|
+
var query = {
|
|
12
|
+
ip,
|
|
13
|
+
key: 'e360c7487575c81c617a42d00edea1fb'
|
|
14
|
+
};
|
|
15
|
+
query.sig = md5(serialize(query) + "a9b7a9509b47169bde38dfa825898ff8");
|
|
16
|
+
return data.from("ipgaode", query);
|
|
17
|
+
};
|
|
1
18
|
return async function (a) {
|
|
2
19
|
var ip = a.ip || a.remote;
|
|
3
20
|
var m = /(\d+\.){3}\d+$/.exec(ip);
|
|
4
|
-
|
|
21
|
+
ip = m ? m[0] : ip;
|
|
22
|
+
var res = await data.from("ipcn", { ip });
|
|
23
|
+
console.log(res)
|
|
24
|
+
if (!res.address && !res.data) res = await baidu(ip);
|
|
25
|
+
var msg = '加载错误';
|
|
26
|
+
if (res.message && !res.data && !res.content && !res.address) {
|
|
27
|
+
msg = res.message;
|
|
28
|
+
res = await gaode(ip);
|
|
29
|
+
}
|
|
5
30
|
if (res.data) res = res.data;
|
|
31
|
+
if (res.content) res = res.content;
|
|
6
32
|
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('
|
|
33
|
+
else if (res.country || res.province || res.city || res.isp) {
|
|
34
|
+
res = [res.country, res.province, res.city, res.district, res.isp].join('');
|
|
9
35
|
}
|
|
10
|
-
|
|
36
|
+
if (!res) alert(msg, 'warn');
|
|
37
|
+
a.address = res || msg;
|
|
11
38
|
}
|
package/coms/zimoli/marker.js
CHANGED
|
@@ -1,7 +1,20 @@
|
|
|
1
|
+
var b = function (match) {
|
|
2
|
+
var b = document.createElement('b');
|
|
3
|
+
b.innerText = match;
|
|
4
|
+
return b;
|
|
5
|
+
};
|
|
6
|
+
var wrap = function (pre, match, aft) {
|
|
7
|
+
return [].concat(pre, b(match), aft);
|
|
8
|
+
};
|
|
1
9
|
function marker(e) {
|
|
2
10
|
if (!e) e = document.createElement("marker");
|
|
3
11
|
on("changes")(e, function () {
|
|
4
|
-
e.
|
|
12
|
+
remove(e.childNodes);
|
|
13
|
+
if (isEmpty(this.source)) return;
|
|
14
|
+
var source = mark(this.source, this.search, wrap);
|
|
15
|
+
if (isArray(source)) appendChild(this, source);
|
|
16
|
+
else this.innerText = source;
|
|
5
17
|
});
|
|
6
18
|
return e;
|
|
7
|
-
}
|
|
19
|
+
}
|
|
20
|
+
marker.wrap = wrap;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
var test_wrap = function (data, search) {
|
|
2
|
+
var wrap = mark.wrap;
|
|
3
|
+
var startTime = Date.now();
|
|
4
|
+
for (var cx = 0, dx = 10000; cx < dx; cx++) {
|
|
5
|
+
for (var d of data) {
|
|
6
|
+
mark(d, search, wrap);
|
|
7
|
+
}
|
|
8
|
+
}
|
|
9
|
+
var spendTime = (Date.now() - startTime);
|
|
10
|
+
console.log('用时', spendTime);
|
|
11
|
+
}
|
|
12
|
+
var testData = [
|
|
13
|
+
"efront.cc/baiplay/bp",
|
|
14
|
+
"chat.efront.cc/baiplay/aa",
|
|
15
|
+
"baiplay.efront.cc/baiplay/aa",
|
|
16
|
+
"baiplay.efront.cc/baiplay/cc",
|
|
17
|
+
"ipv4.efront.cc/baiplay/dd",
|
|
18
|
+
"ipv6.efront.cc/baiplay/ff",
|
|
19
|
+
"baiplay.cn/baiplay/ee",
|
|
20
|
+
"baidu.com/baiplay/gg",
|
|
21
|
+
];
|
|
22
|
+
return function () {
|
|
23
|
+
test_wrap(testData, 'bai');
|
|
24
|
+
}
|
package/coms/zimoli/table.js
CHANGED
package/coms/zimoli/zimoli.js
CHANGED
|
@@ -6,14 +6,17 @@
|
|
|
6
6
|
var body = document.body;
|
|
7
7
|
var onbacks = [];
|
|
8
8
|
var window_history = window.history || { length: 0, go() { }, back() { } };
|
|
9
|
-
var window_history_length = window_history.length;
|
|
10
|
-
var sessionSavedHashKey = "__zimoli_session_init_hash" + location.pathname;
|
|
11
|
-
var sessionInitHash = sessionStorage.getItem(sessionSavedHashKey);
|
|
12
9
|
var hostoryStorage = sessionStorage;
|
|
13
|
-
var
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
10
|
+
var getLocationHash = function () {
|
|
11
|
+
if ('hash' in location) return location.hash;
|
|
12
|
+
return location.href.replace(/^[^#]+/, '');
|
|
13
|
+
};
|
|
14
|
+
var setLocationHash = function (hash) {
|
|
15
|
+
preventNextHashChange = true;
|
|
16
|
+
if ('hash' in location) location.hash = hash;
|
|
17
|
+
else location.href = location.href.replace(/#[\s\S]*$/, '') + hash;
|
|
18
|
+
};
|
|
19
|
+
var locationInitHash = getLocationHash();
|
|
17
20
|
var preventNextHashChange = false;
|
|
18
21
|
window_history.scrollRestoration = 'manual';
|
|
19
22
|
var popupHashlessPath = '/';
|
|
@@ -28,9 +31,8 @@ onhashchange(window, function (event) {
|
|
|
28
31
|
if (preventNextHashChange) return preventNextHashChange = false;
|
|
29
32
|
// 如果是返回事件,一定不是第一次改变hash
|
|
30
33
|
// 这里刚好可以屏蔽首次手动改变url可能产生的hashchange事件
|
|
31
|
-
var targetHash =
|
|
32
|
-
|
|
33
|
-
if (pagehash_reg.test(targetHash)) {
|
|
34
|
+
var targetHash = getLocationHash();
|
|
35
|
+
if (targetHash) {
|
|
34
36
|
var currentHash = getCurrentHash();
|
|
35
37
|
if (currentHash && currentHash === targetHash) return;
|
|
36
38
|
var targetpath = pathFromHash(targetHash);
|
|
@@ -418,17 +420,7 @@ function zimoli(pagepath, args, history_name, oldpagepath) {
|
|
|
418
420
|
history_name = current_history;
|
|
419
421
|
var _history = history[history_name] || createEmptyHistory('/main');
|
|
420
422
|
root_path = _history[0];
|
|
421
|
-
pagepath =
|
|
422
|
-
if (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 = '';
|
|
430
|
-
}
|
|
431
|
-
if (!pagepath) pagepath = _history[_history.index];
|
|
423
|
+
pagepath = _history[_history.index];
|
|
432
424
|
try {
|
|
433
425
|
var saveddata = JSAM.parse(hostoryStorage.getItem(_zimoli_params_key + pagepath)) || {};
|
|
434
426
|
} catch (e) {
|
|
@@ -468,7 +460,6 @@ var pushstate = function (path_name, history_name) {
|
|
|
468
460
|
history[history_name] = createEmptyHistory(path_name);
|
|
469
461
|
} else {
|
|
470
462
|
var _history = history[history_name];
|
|
471
|
-
var prevIndex = _history.index;
|
|
472
463
|
for (var cx = 0, dx = _history.index + 1; cx < dx; cx++) {
|
|
473
464
|
if (_history[cx] === path_name) {
|
|
474
465
|
_history.index = cx;
|
|
@@ -483,7 +474,6 @@ var pushstate = function (path_name, history_name) {
|
|
|
483
474
|
_history.splice(_history.index, _history.length - _history.index);
|
|
484
475
|
_history[_history.index] = path_name;
|
|
485
476
|
}
|
|
486
|
-
if (_history.index >= 0) fixurl(_history.index - prevIndex);
|
|
487
477
|
}
|
|
488
478
|
hostoryStorage.setItem(history_session_object_key, JSAM.stringify(history) || null);
|
|
489
479
|
return isBack;
|
|
@@ -500,6 +490,7 @@ var popstate = function (path_name, history_name) {
|
|
|
500
490
|
}
|
|
501
491
|
}
|
|
502
492
|
};
|
|
493
|
+
|
|
503
494
|
var getCurrentHash = function () {
|
|
504
495
|
var history_name = current_history.replace(/\/$/, '');
|
|
505
496
|
if (rootElements.length) {
|
|
@@ -510,39 +501,46 @@ var getCurrentHash = function () {
|
|
|
510
501
|
var targeturl = `#${history_name}${_historylist.length ? _historylist[_historylist.index] : ""}`;
|
|
511
502
|
return encodeURI(targeturl);
|
|
512
503
|
};
|
|
513
|
-
|
|
514
|
-
var
|
|
515
|
-
var
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
504
|
+
var fixurl = function () {
|
|
505
|
+
var zimoli_hash = getCurrentHash();
|
|
506
|
+
var location_hash = getLocationHash();
|
|
507
|
+
if (location_hash === zimoli_hash) return;
|
|
508
|
+
var location_path = pathFromHash(location_hash);
|
|
509
|
+
if (location_path === popupHashlessPath) {
|
|
510
|
+
preventNextHashChange = true;
|
|
511
|
+
window_history.go(-1);
|
|
512
|
+
location_hash = getCurrentHash();
|
|
513
|
+
location_path = pathFromHash(location_hash);
|
|
514
|
+
};
|
|
515
|
+
if (zimoli_hash === location_hash) return;
|
|
516
|
+
var zimoli_path = pathFromHash(zimoli_hash);
|
|
517
|
+
if (zimoli_path === popupHashlessPath) return setLocationHash(zimoli_hash);
|
|
518
|
+
if (zimoli_hash) {
|
|
519
|
+
if (!location_hash) setLocationHash(zimoli_hash);
|
|
520
|
+
else {
|
|
521
|
+
var _history = history[current_history];
|
|
522
|
+
var b = _history.indexOf(location_path);
|
|
523
|
+
if (b >= 0) {
|
|
524
|
+
var c = _history.indexOf(zimoli_path);
|
|
525
|
+
if (c >= 0) {
|
|
526
|
+
var d = c - b;
|
|
527
|
+
preventNextHashChange = true;
|
|
528
|
+
window_history.go(d);
|
|
529
|
+
location_hash = getLocationHash();
|
|
528
530
|
}
|
|
529
531
|
}
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
}
|
|
533
|
-
else {
|
|
534
|
-
preventNextHashChange = false;
|
|
532
|
+
if (location_hash !== zimoli_hash) {
|
|
533
|
+
setLocationHash(zimoli_hash);
|
|
535
534
|
}
|
|
536
535
|
}
|
|
537
|
-
else {
|
|
538
|
-
preventNextHashChange = false;
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
else if (pagehash_reg.test(location.hash)) {
|
|
542
|
-
window_history.go(-1);
|
|
543
536
|
}
|
|
544
|
-
else {
|
|
545
|
-
|
|
537
|
+
else if (location_hash !== locationInitHash) {
|
|
538
|
+
var _history = history[current_history];
|
|
539
|
+
var i = _history.indexOf(location_path);
|
|
540
|
+
if (i > 0) {
|
|
541
|
+
preventNextHashChange = true;
|
|
542
|
+
window_history.go(-i);
|
|
543
|
+
}
|
|
546
544
|
}
|
|
547
545
|
};
|
|
548
546
|
var checkonback = function (elements) {
|
|
@@ -577,11 +575,12 @@ var forward = function (pgpath) {
|
|
|
577
575
|
var backward = function () {
|
|
578
576
|
if (rootElements.length) {
|
|
579
577
|
var onback = checkonback(rootElements.slice(rootElements.length - 1));
|
|
580
|
-
fixurl();
|
|
581
578
|
if (onback === false) {
|
|
579
|
+
fixurl();
|
|
582
580
|
return;
|
|
583
581
|
}
|
|
584
582
|
remove(rootElements.pop());
|
|
583
|
+
fixurl();
|
|
585
584
|
return;
|
|
586
585
|
}
|
|
587
586
|
var onback = checkonback([
|
|
@@ -610,7 +609,10 @@ function setWithStyle(target, isDestroy) {
|
|
|
610
609
|
}
|
|
611
610
|
|
|
612
611
|
}
|
|
612
|
+
var fixLock = false;
|
|
613
613
|
function addGlobal(element, name = null, isBack) {
|
|
614
|
+
var hasLock = !fixLock;
|
|
615
|
+
if (hasLock) fixLock = true;
|
|
614
616
|
if (isString(name)) {
|
|
615
617
|
if (global[name] === element) return;
|
|
616
618
|
var oldElement = global[name];
|
|
@@ -648,6 +650,7 @@ function addGlobal(element, name = null, isBack) {
|
|
|
648
650
|
}
|
|
649
651
|
rootElements.push(element);
|
|
650
652
|
}
|
|
653
|
+
if (hasLock) fixurl(), fixLock = false;
|
|
651
654
|
}
|
|
652
655
|
var _switch = zimoli.switch = function (history_name = default_history, target_body = document.body, emptyState) {
|
|
653
656
|
if (!arguments.length) {
|
|
@@ -660,7 +663,13 @@ var _switch = zimoli.switch = function (history_name = default_history, target_b
|
|
|
660
663
|
}
|
|
661
664
|
if (target_body) body = target_body;
|
|
662
665
|
}
|
|
663
|
-
if (emptyState !== false
|
|
666
|
+
if (isHandled(emptyState) && emptyState !== false) {
|
|
667
|
+
if (!history[current_history]) root_path = (history[current_history] = createEmptyHistory(emptyState))[0];
|
|
668
|
+
else {
|
|
669
|
+
var _history = history[current_history];
|
|
670
|
+
if (_history.index === 0) root_path = _history[0] = emptyState;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
664
673
|
};
|
|
665
674
|
popup.global = zimoli.global = addGlobal;
|
|
666
675
|
popup.go = zimoli.go = go;
|
|
@@ -705,11 +714,16 @@ zimoli.clearHistory = function () {
|
|
|
705
714
|
history = {};
|
|
706
715
|
};
|
|
707
716
|
zimoli.getCurrentHistory = function () {
|
|
708
|
-
|
|
709
|
-
|
|
717
|
+
var h = history[current_history];
|
|
718
|
+
if (h) h = h.slice(0, h.index + 1);
|
|
719
|
+
else h = [];
|
|
720
|
+
return h;
|
|
710
721
|
};
|
|
711
722
|
zimoli.inithash = locationInitHash;
|
|
712
723
|
zimoli.createState = createState;
|
|
724
|
+
zimoli.getInitPath = function () {
|
|
725
|
+
return pathFromHash(locationInitHash);
|
|
726
|
+
};
|
|
713
727
|
var touchEnabled = false;
|
|
714
728
|
zimoli.enableTouchBack = function () {
|
|
715
729
|
if (touchEnabled) return;
|
package/coms/zimoli/zimoli.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
# 紫茉莉
|
|
2
|
+
默认不支持带hash打开页面,但您可以在主页面或您指定的初始化脚本中切换到hash指向的页面,这样可以让一些写在主文件中的配置项按序加载。
|
|
1
3
|
```javascript
|
|
2
4
|
zimoli(pathname, params) // 跳转
|
|
5
|
+
zimoli.getInitPath()// 返回页面加载时的hash路径在当前历史中指向的路径
|
|
3
6
|
zimoli.switch(historyName, targetElement, homePath) // 切换历史及目标挂载元素
|
|
4
7
|
zimoli() // 切换历史后初始化
|
|
5
8
|
zimoli.clearHistory() // 清空历史
|
|
@@ -264,10 +264,10 @@
|
|
|
264
264
|
// 克什米尔: ["ks", "Kashmiri"],
|
|
265
265
|
// 哈萨克语: ["kk", "Kazakh"],
|
|
266
266
|
// 高棉语: ["km", "Khmer"],
|
|
267
|
-
//
|
|
267
|
+
// 基库尤: ["ki", "Kikuyu"],
|
|
268
268
|
// "基尼亚卢旺达语(卢旺达)": ["rw", "Kinyarwanda (Rwanda)"],
|
|
269
269
|
// 基隆迪语: ["rn", "Kirundi"],
|
|
270
|
-
//
|
|
270
|
+
// 吉尔吉斯斯坦: ["ky", "Kyrgyz"],
|
|
271
271
|
// 科米牌手表: ["kv", "Komi"],
|
|
272
272
|
// 孔戈: ["kg", "Kongo"],
|
|
273
273
|
// 韩国人: ["ko", "Korean"],
|
|
@@ -372,34 +372,34 @@
|
|
|
372
372
|
// 祖鲁语: ["zu", "Zulu"]
|
|
373
373
|
// };
|
|
374
374
|
var supports = [
|
|
375
|
-
{ name:
|
|
376
|
-
{ name:
|
|
377
|
-
{ name:
|
|
375
|
+
{ name: `汉语`/*中文简体*/, id: "zh", lang: "zh-CN" },
|
|
376
|
+
{ name: `漢語`/*中文繁体*/, id: "cht", lang: "zh-TW" },
|
|
377
|
+
{ name: `English`/*英文*/, id: "en", lang: "en" },
|
|
378
378
|
// { name: i18n`文言文`, id: "wyw" },
|
|
379
379
|
// { name: i18n`粤语`, id: "yue" },
|
|
380
|
-
{ name:
|
|
381
|
-
{ name:
|
|
382
|
-
{ name:
|
|
383
|
-
{ name:
|
|
384
|
-
{ name:
|
|
385
|
-
{ name:
|
|
386
|
-
{ name:
|
|
387
|
-
{ name:
|
|
388
|
-
{ name:
|
|
389
|
-
{ name:
|
|
390
|
-
{ name:
|
|
391
|
-
{ name:
|
|
392
|
-
{ name:
|
|
393
|
-
|
|
394
|
-
{ name:
|
|
395
|
-
{ name:
|
|
396
|
-
{ name:
|
|
397
|
-
{ name:
|
|
398
|
-
|
|
399
|
-
{ name:
|
|
400
|
-
{ name:
|
|
401
|
-
{ name:
|
|
402
|
-
{ name:
|
|
380
|
+
{ name: `日本語`/*日语*/, id: "jp", lang: "ja" },
|
|
381
|
+
{ name: `Français`/*法语*/, id: "fra", lang: 'fr' },
|
|
382
|
+
{ name: `Русский язык`/*俄语*/, id: "ru", lang: 'ru' },
|
|
383
|
+
{ name: `한국어`/*韩语*/, id: "kor", lang: "ko" },
|
|
384
|
+
{ name: `Deutsch`/*德语*/, id: "de", lang: "de" },
|
|
385
|
+
{ name: `Italiano`/*意大利语*/, id: "it", lang: 'it' },
|
|
386
|
+
{ name: `ภาษาไทย`/*泰语*/, id: "th", lang: "th" },
|
|
387
|
+
{ name: `Tiếng Việt`/*越南语*/, id: "vie", lang: 'vi' },
|
|
388
|
+
{ name: `بالعربية`/*阿拉伯语*/, id: "ara", lang: "ar" },
|
|
389
|
+
{ name: `Nederlands`/*荷兰语*/, id: "nl", lang: "nl" },
|
|
390
|
+
{ name: `suomi`/*芬兰语*/, id: "fin", lang: "fi" },
|
|
391
|
+
{ name: `Ελληνικά`/*希腊语*/, id: "el", lang: "el" },
|
|
392
|
+
{ name: `Español`/*西班牙语*/, id: "spa", lang: "es" },
|
|
393
|
+
{ name: `Português`/*葡萄牙语*/, id: "pt", lang: /pt\-(BR|PT)/ },
|
|
394
|
+
{ name: `Húngaro`/*匈牙利语*/, id: "hu", lang: 'hu' },
|
|
395
|
+
{ name: `Svenska`/*瑞典语*/, id: "swe", lang: 'sv' },
|
|
396
|
+
{ name: `Dansk`/*丹麦语*/, id: "dan", lang: 'da' },
|
|
397
|
+
{ name: `Čeština`/*捷克语*/, id: "cs", lang: 'cs' },
|
|
398
|
+
{ name: `Polski`/*波兰语*/, id: "pl" },
|
|
399
|
+
{ name: `Български`/*保加利亚语*/, id: "bul", lang: "bg" },
|
|
400
|
+
{ name: `Eesti keel`/*爱沙尼亚语*/, id: "est", lang: 'et' },
|
|
401
|
+
{ name: `Română`/*罗马尼亚语*/, id: "rom", lang: 'ro' },
|
|
402
|
+
{ name: `slovenski jezik`/*斯洛文尼亚语*/, id: "slo", lang: 'sl' },
|
|
403
403
|
];
|
|
404
404
|
supports.forEach(s => s.key = s.id);
|
|
405
405
|
var getAllText = function (data, f) {
|