Spaces:
Running
Running
Bintang Fajar Julio
commited on
Commit
·
cc56a85
1
Parent(s):
a309d98
add offline page
Browse files- static/offline.html +46 -0
- static/service-worker.js +18 -6
- templates/auth/sign_up.html +1 -1
static/offline.html
ADDED
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<!DOCTYPE html>
|
2 |
+
<html lang="en">
|
3 |
+
<head>
|
4 |
+
<meta charset="utf-8" />
|
5 |
+
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
|
6 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
7 |
+
|
8 |
+
<title>Offline</title>
|
9 |
+
|
10 |
+
<link rel="shortcut icon" href="/static/images/favicon.png" />
|
11 |
+
<script defer src="/static/plugins/fontawesome/js/all.min.js"></script>
|
12 |
+
<link id="theme-style" rel="stylesheet" href="/static/css/portal.css" />
|
13 |
+
</head>
|
14 |
+
|
15 |
+
<body class="app app-404-page">
|
16 |
+
<div class="container mb-5">
|
17 |
+
<div class="row">
|
18 |
+
<div class="col-12 col-md-11 col-lg-7 col-xl-6 mx-auto">
|
19 |
+
<div class="app-card p-5 text-center shadow-sm mt-5">
|
20 |
+
<div
|
21 |
+
class="app-branding text-center mb-4"
|
22 |
+
style="margin-bottom: 0px; padding-top: 0px"
|
23 |
+
>
|
24 |
+
<a class="app-logo" href=""
|
25 |
+
><img
|
26 |
+
class="logo-icon"
|
27 |
+
src="/static/images/logotik.png"
|
28 |
+
alt="logo"
|
29 |
+
/>
|
30 |
+
</a>
|
31 |
+
</div>
|
32 |
+
<h1 class="page-title mb-4">
|
33 |
+
Network Error<br /><span class="font-weight-light"
|
34 |
+
>Periksa koneksi internet anda.</span
|
35 |
+
>
|
36 |
+
</h1>
|
37 |
+
<div class="mb-4">Halaman yang anda cari tidak dapat diakses.</div>
|
38 |
+
</div>
|
39 |
+
</div>
|
40 |
+
<!--//col-->
|
41 |
+
</div>
|
42 |
+
<!--//row-->
|
43 |
+
</div>
|
44 |
+
<!--//container-->
|
45 |
+
</body>
|
46 |
+
</html>
|
static/service-worker.js
CHANGED
@@ -1,20 +1,32 @@
|
|
|
|
|
|
|
|
1 |
self.addEventListener("install", (event) => {
|
2 |
event.waitUntil(
|
3 |
-
caches.open(
|
4 |
return cache.addAll([
|
5 |
"/",
|
6 |
"/static/css/portal.css",
|
7 |
"/static/js/app.js",
|
8 |
"/static/images/favicon.png",
|
|
|
9 |
]);
|
10 |
})
|
11 |
);
|
12 |
});
|
13 |
|
14 |
self.addEventListener("fetch", (event) => {
|
15 |
-
event.
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
});
|
|
|
1 |
+
const CACHE_NAME = "my-cache";
|
2 |
+
const OFFLINE_URL = "/static/offline.html";
|
3 |
+
|
4 |
self.addEventListener("install", (event) => {
|
5 |
event.waitUntil(
|
6 |
+
caches.open(CACHE_NAME).then((cache) => {
|
7 |
return cache.addAll([
|
8 |
"/",
|
9 |
"/static/css/portal.css",
|
10 |
"/static/js/app.js",
|
11 |
"/static/images/favicon.png",
|
12 |
+
OFFLINE_URL,
|
13 |
]);
|
14 |
})
|
15 |
);
|
16 |
});
|
17 |
|
18 |
self.addEventListener("fetch", (event) => {
|
19 |
+
if (event.request.mode === "navigate") {
|
20 |
+
event.respondWith(
|
21 |
+
fetch(event.request).catch(() => {
|
22 |
+
return caches.match(OFFLINE_URL);
|
23 |
+
})
|
24 |
+
);
|
25 |
+
} else {
|
26 |
+
event.respondWith(
|
27 |
+
caches.match(event.request).then((response) => {
|
28 |
+
return response || fetch(event.request);
|
29 |
+
})
|
30 |
+
);
|
31 |
+
}
|
32 |
});
|
templates/auth/sign_up.html
CHANGED
@@ -20,7 +20,7 @@ block content %}
|
|
20 |
name="email"
|
21 |
type="email"
|
22 |
class="form-control email"
|
23 |
-
placeholder="
|
24 |
required="required"
|
25 |
/>
|
26 |
</div>
|
|
|
20 |
name="email"
|
21 |
type="email"
|
22 |
class="form-control email"
|
23 |
+
placeholder="Email Politeknik Negeri Jakarta"
|
24 |
required="required"
|
25 |
/>
|
26 |
</div>
|