efront 4.22.6 → 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/apps/pivot/home/welcome.js +0 -1
- 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 +16 -3
- package/coms/layer/glance.js +2 -2
- 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 +70 -47
- 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) {
|
|
@@ -119,9 +120,11 @@
|
|
|
119
120
|
}
|
|
120
121
|
return [];
|
|
121
122
|
};
|
|
123
|
+
var first_opened = false;
|
|
122
124
|
result.update = function (items) {
|
|
123
125
|
delete result.loading_promise;
|
|
124
126
|
delete result.then;
|
|
127
|
+
firstMenu = null;
|
|
125
128
|
items = result.parse(items);
|
|
126
129
|
items.map(getChildren);
|
|
127
130
|
var opened = data.getInstance("menu-opened");
|
|
@@ -130,11 +133,13 @@
|
|
|
130
133
|
historys.forEach((a, i) => map[a] = i + 1);
|
|
131
134
|
result.splice(0, result.length);
|
|
132
135
|
var actived, actived_value = 0;
|
|
136
|
+
var zimoilPath = zimoli.getInitPath();
|
|
133
137
|
var a = function (menu) {
|
|
134
138
|
var res = checkroles(user.roles, menu.roles);
|
|
135
139
|
if (res) {
|
|
136
140
|
if (savedChildren[menu.id] instanceof Array) menu.children = savedChildren[menu.id].filter(a);
|
|
137
141
|
if (menu.path) {
|
|
142
|
+
if (!firstMenu || menu.path === zimoilPath) firstMenu = menu;
|
|
138
143
|
if (map[menu.path] > actived_value) {
|
|
139
144
|
actived = menu;
|
|
140
145
|
actived_value = map[menu.path];
|
|
@@ -157,6 +162,7 @@
|
|
|
157
162
|
};
|
|
158
163
|
}
|
|
159
164
|
}
|
|
165
|
+
first_opened = false;
|
|
160
166
|
return result;
|
|
161
167
|
};
|
|
162
168
|
var setActive = function (p, active) {
|
|
@@ -187,17 +193,24 @@
|
|
|
187
193
|
oped.active = menu.id;
|
|
188
194
|
data.setInstance('menu-opened', oped);
|
|
189
195
|
}
|
|
196
|
+
first_opened = true;
|
|
190
197
|
});
|
|
191
198
|
result.open = function (menu) {
|
|
192
199
|
if (!menu) {
|
|
193
|
-
if (result.active) return;
|
|
194
|
-
menu = result
|
|
200
|
+
if (first_opened && result.active) return;
|
|
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;
|
|
195
207
|
}
|
|
196
208
|
if (!menu.path) {
|
|
197
209
|
menu.closed = !menu.closed;
|
|
198
210
|
return;
|
|
199
211
|
}
|
|
200
|
-
if (menu === result.active) return;
|
|
212
|
+
if (first_opened && menu === result.active) return;
|
|
213
|
+
first_opened = true;
|
|
201
214
|
var opened = result.opened || [];
|
|
202
215
|
if (!~opened.indexOf(menu) && !getChild(menu).id) {
|
|
203
216
|
opened.push(menu);
|
package/coms/layer/glance.js
CHANGED
|
@@ -57,7 +57,7 @@ var dragview = function (dragview) {
|
|
|
57
57
|
* 左侧为菜单
|
|
58
58
|
* 菜单在小屏上收起,可以点击按钮打开
|
|
59
59
|
*/
|
|
60
|
-
function main(mainPath, historyName = "") {
|
|
60
|
+
function main(mainPath, historyName = "/") {
|
|
61
61
|
var layer = div();
|
|
62
62
|
layer.innerHTML = glance;
|
|
63
63
|
if (mainPath instanceof Object) {
|
|
@@ -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);
|
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,18 +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
|
-
preventNextHashChange = true;
|
|
428
|
-
pagepath = pathFromHash(location.hash);
|
|
429
|
-
}
|
|
430
|
-
if (_history.index === 0) pagepath = '';
|
|
431
|
-
}
|
|
432
|
-
if (!pagepath) pagepath = _history[_history.index];
|
|
423
|
+
pagepath = _history[_history.index];
|
|
433
424
|
try {
|
|
434
425
|
var saveddata = JSAM.parse(hostoryStorage.getItem(_zimoli_params_key + pagepath)) || {};
|
|
435
426
|
} catch (e) {
|
|
@@ -469,7 +460,6 @@ var pushstate = function (path_name, history_name) {
|
|
|
469
460
|
history[history_name] = createEmptyHistory(path_name);
|
|
470
461
|
} else {
|
|
471
462
|
var _history = history[history_name];
|
|
472
|
-
var prevIndex = _history.index;
|
|
473
463
|
for (var cx = 0, dx = _history.index + 1; cx < dx; cx++) {
|
|
474
464
|
if (_history[cx] === path_name) {
|
|
475
465
|
_history.index = cx;
|
|
@@ -484,7 +474,6 @@ var pushstate = function (path_name, history_name) {
|
|
|
484
474
|
_history.splice(_history.index, _history.length - _history.index);
|
|
485
475
|
_history[_history.index] = path_name;
|
|
486
476
|
}
|
|
487
|
-
if (_history.index >= 0) fixurl(_history.index - prevIndex);
|
|
488
477
|
}
|
|
489
478
|
hostoryStorage.setItem(history_session_object_key, JSAM.stringify(history) || null);
|
|
490
479
|
return isBack;
|
|
@@ -501,6 +490,7 @@ var popstate = function (path_name, history_name) {
|
|
|
501
490
|
}
|
|
502
491
|
}
|
|
503
492
|
};
|
|
493
|
+
|
|
504
494
|
var getCurrentHash = function () {
|
|
505
495
|
var history_name = current_history.replace(/\/$/, '');
|
|
506
496
|
if (rootElements.length) {
|
|
@@ -511,29 +501,46 @@ var getCurrentHash = function () {
|
|
|
511
501
|
var targeturl = `#${history_name}${_historylist.length ? _historylist[_historylist.index] : ""}`;
|
|
512
502
|
return encodeURI(targeturl);
|
|
513
503
|
};
|
|
514
|
-
|
|
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
|
-
|
|
532
|
+
if (location_hash !== zimoli_hash) {
|
|
533
|
+
setLocationHash(zimoli_hash);
|
|
534
|
+
}
|
|
531
535
|
}
|
|
532
536
|
}
|
|
533
|
-
else if (
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
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
|
+
}
|
|
537
544
|
}
|
|
538
545
|
};
|
|
539
546
|
var checkonback = function (elements) {
|
|
@@ -568,11 +575,12 @@ var forward = function (pgpath) {
|
|
|
568
575
|
var backward = function () {
|
|
569
576
|
if (rootElements.length) {
|
|
570
577
|
var onback = checkonback(rootElements.slice(rootElements.length - 1));
|
|
571
|
-
fixurl();
|
|
572
578
|
if (onback === false) {
|
|
579
|
+
fixurl();
|
|
573
580
|
return;
|
|
574
581
|
}
|
|
575
582
|
remove(rootElements.pop());
|
|
583
|
+
fixurl();
|
|
576
584
|
return;
|
|
577
585
|
}
|
|
578
586
|
var onback = checkonback([
|
|
@@ -601,7 +609,10 @@ function setWithStyle(target, isDestroy) {
|
|
|
601
609
|
}
|
|
602
610
|
|
|
603
611
|
}
|
|
612
|
+
var fixLock = false;
|
|
604
613
|
function addGlobal(element, name = null, isBack) {
|
|
614
|
+
var hasLock = !fixLock;
|
|
615
|
+
if (hasLock) fixLock = true;
|
|
605
616
|
if (isString(name)) {
|
|
606
617
|
if (global[name] === element) return;
|
|
607
618
|
var oldElement = global[name];
|
|
@@ -639,6 +650,7 @@ function addGlobal(element, name = null, isBack) {
|
|
|
639
650
|
}
|
|
640
651
|
rootElements.push(element);
|
|
641
652
|
}
|
|
653
|
+
if (hasLock) fixurl(), fixLock = false;
|
|
642
654
|
}
|
|
643
655
|
var _switch = zimoli.switch = function (history_name = default_history, target_body = document.body, emptyState) {
|
|
644
656
|
if (!arguments.length) {
|
|
@@ -651,7 +663,13 @@ var _switch = zimoli.switch = function (history_name = default_history, target_b
|
|
|
651
663
|
}
|
|
652
664
|
if (target_body) body = target_body;
|
|
653
665
|
}
|
|
654
|
-
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
|
+
}
|
|
655
673
|
};
|
|
656
674
|
popup.global = zimoli.global = addGlobal;
|
|
657
675
|
popup.go = zimoli.go = go;
|
|
@@ -696,11 +714,16 @@ zimoli.clearHistory = function () {
|
|
|
696
714
|
history = {};
|
|
697
715
|
};
|
|
698
716
|
zimoli.getCurrentHistory = function () {
|
|
699
|
-
|
|
700
|
-
|
|
717
|
+
var h = history[current_history];
|
|
718
|
+
if (h) h = h.slice(0, h.index + 1);
|
|
719
|
+
else h = [];
|
|
720
|
+
return h;
|
|
701
721
|
};
|
|
702
722
|
zimoli.inithash = locationInitHash;
|
|
703
723
|
zimoli.createState = createState;
|
|
724
|
+
zimoli.getInitPath = function () {
|
|
725
|
+
return pathFromHash(locationInitHash);
|
|
726
|
+
};
|
|
704
727
|
var touchEnabled = false;
|
|
705
728
|
zimoli.enableTouchBack = function () {
|
|
706
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) {
|