-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathserviceWorker.js
106 lines (103 loc) · 2.43 KB
/
serviceWorker.js
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
"use strict";
const v='d0';
addEventListener('install',event=>{
event.waitUntil(
caches.open(v).then(cache=>
cache.addAll([
'https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js',
'https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js',
'https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js',
'https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css',
'/',
'/css/',
'/css/animation.css',
'/css/aside.css',
'/css/col.css',
'/css/core.css',
'/css/dark.css',
'/css/input.css',
'/css/media.css',
'/css/techScrollBar.css',
'/css/w3.css',
'/html/',
'/html/aside.html',
'/html/asideInt.js',
'/img/',
'/img/exe.svg',
'/img/icon.png',
'/img/icon.svg',
'/img/iconAlt.svg',
'/img/tab_apex.png',
'/img/tab_apex_select.png',
'/img/tab_avian.png',
'/img/tab_avian_select.png',
'/img/tab_floran.png',
'/img/tab_floran_select.png',
'/img/tab_glitch.png',
'/img/tab_glitch_select.png',
'/img/tab_human.png',
'/img/tab_human_select.png',
'/img/tab_hylotl.png',
'/img/tab_hylotl_select.png',
'/img/tab_kazdra.png',
'/img/tab_kazdra_select.png',
'/img/tab_other.png',
'/img/tab_other_select.png',
'/js/',
'/js/custom.js',
'/js/db.js',
'/js/globalIo.js',
'/js/io.js',
'/js/load.js',
'/js/nav.js',
'/js/node.js',
'/js/search.js',
'/js/species.js',
'/js/speciesList.js',
'/js/tour.js',
'/js/util.js',
'/webWorker/',
'/webWorker/nav.js',
'/webWorker/search.js',
'/xml/',
'/xml/html.xsl',
'/xml/species.xml',
'/xml/tab.xml',
'/xml/template.xsl',
'/xml/verify.xml',
'/serviceWorker.js',
'/index.xml'
]);
)
);
});
addEventListener('fetch',event=>{
const req=event.request;
event.respondWith(
caches.match(req).then(resp=>
resp||fetch(req).then(resp=>
caches.open(v).then(cache=>{
cache.put(req,resp.clone());
return resp;
});
).catch(()=>caches.match('/img/tab_other.png'));
)
);
});
addEventListener('activate',event=>{
event.waitUntil(
caches.keys().then(keyList=>
Promise.all(keyList.map(key=>{
if(key!==v)return caches.delete(key);
}));
)
);
});
/*
function folder(f){
f=`/${f}/`;
var arr=[f],
_a=arguments.length;
for(let i=1;i<_a;i++)arr[i]=f+arguments[i];
return arr;
}*/