Repository navigation
Expand file tree
/
Copy path足迹管理器.js
More file actions
51 lines (51 loc) · 1.7 KB
/
Copy path足迹管理器.js
File metadata and controls
51 lines (51 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
js:
var d = [];
const {color, small} = $.require("hiker://page/utiliy?rule=道长仓库Pro");
let t1=(new Date()).getTime(); // 记录获取历史或者收藏的耗时
let mode = getItem('mode','历史');
let options = ['历史','收藏'].map(x=>x === mode ? color(x,'#12b668') : x);
options.forEach(it=>{
d.push({
title: it,
col_type:'scroll_button',
url:$('#noLoading#').lazyRule((it)=>{
it = pdfh(it,'body&&Text').replace('““””','');
setItem('mode',it);
refreshPage(false);
return 'hiker://empty'
},it)
})
});
let route = mode === '历史' ? 'hiker://history': 'hiker://collection';
let code = fetch(route);
let arr = JSON.parse(code)||'[]';
let his = [];
if(arr.length > 0){
let show = `${mode} 共有至少以下属性:${Object.keys(arr[0]).join(',')}`
log(show);
}
arr.forEach(it=>{
let title = mode === '历史' ? it.title : it.mTitle;
let desc = mode === '历史' ? it.url : it.cUrl;
let tips = mode === '历史' ? it.type : it.mITitle;
title += small(color('('+tips+')','#aaaaaa'));
if(it.lastClick){
title += '\n' + color('足迹:','#12b668') + small(color(it.lastClick,'#aaaaaa'));
}
his.push({
title: title,
url: $(`要删除这条${mode}记录吗?`).confirm(()=>{return 'toast://抱歉没接口'}),
col_type: "text_1",
desc: small(desc),
});
});
let t2=(new Date()).getTime(); // 记录获取历史或者收藏的结束耗时
let cnt = his.length;
his.unshift({
title:`共计${color(cnt,'#d96715')}条记录,获取足迹耗时:${color(t2-t1,'#d96715')}毫秒`,
url:'',
col_type:'text_1'
});
// d.push.apply(his);
d = d.concat(his);
setResult(d);