Repository navigation
Expand file tree
/
Copy path子页面-文件类型.js
More file actions
55 lines (51 loc) · 1.55 KB
/
Copy path子页面-文件类型.js
File metadata and controls
55 lines (51 loc) · 1.55 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
52
53
54
55
const type_dict = {
0: 'zip|exe|apk|crx',
1: '文件夹',
2: 'pdf|xls|doc',
3: 'mp4|mkv|mp3|flv',
4: '?',
5: 'md|txt|json|js',
6: 'gif|jpg|hiec',
}
function get_icon_dict() {
let root = 'https://gitcode.net/qq_32394351/dr/-/raw/master/img/文件类型/';
return {
0: root + 'zip.svg',
1: root + '文件夹.svg',
2: root + '文件.svg',
3: root + 'mp4.svg',
4: root + '文件.svg',
5: root + '文件.svg',
6: root + 'gif.svg',
}
}
let iconStyles = [{
name:'默认',
url:'https://gitcode.net/qq_32394351/dr/-/raw/master/img/文件类型/'
},{
name:'蓝莓',
url:'https://gitcode.net/qq_32394351/dr/-/raw/master/img/文件类型2/'
}];
let iconStyle = getItem('iconStyle','默认');
let nowStyle = iconStyles.find(x=>x.name===iconStyle);
let iconRoot = nowStyle?nowStyle.url:iconStyles[0].url;
function get_icons() {
// let root = 'https://gitcode.net/qq_32394351/dr/-/raw/master/img/文件类型/';
let root = iconRoot;
let files = 'ai|apk|avi|css|dmg|exe|flv|gif|hiker|html|iso|jpg|js|json|log|mov|mp3|mp4|otf|php|png|ppt|psd|table|txt|wav|xls|zip|文件|文件夹'.split('|');
let obj = {};
files.forEach((it) => {
obj[it] = root + it + '.svg';
});
return obj
}
function isOffice(url){
let str='doc|docx|docm|dotm|dotx|xlsx|xlsb|xls|xlsm|pptx|ppsx|ppt|pps|pptm|potm|ppam|potx|ppsm'.split('|').map(it=>'\\.'+it+'$').join('|');
let mc=new RegExp(str);
return mc.test(url);
}
$.exports.type_dict = type_dict;
$.exports.get_icon_dict = get_icon_dict;
$.exports.get_icons = get_icons;
$.exports.isOffice = isOffice;
$.exports.iconStyles = iconStyles;