-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
138 lines (116 loc) · 4.72 KB
/
index.html
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
<!DOCTYPE html>
<html lang="en">
<head>
<link href="https://fonts.googleapis.com/css?family=Raleway&display=swap" rel="stylesheet">
<!--Import Google Icon Font-->
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
<meta name="theme-color" content="#ddd"/>
<meta charset="UTF-8"/>
<title>Football</title>
<meta name="description" content="All about Football"/>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="css/materialize.min.css">
<link rel="manifest" href="/manifest.json" />
<style type="text/css">
html {
font-family: 'Raleway', sans-serif;
}
.sidenav .collapsible-header,
.sidenav li a {
padding : 0 30px;
}
.sidenav .collapsible-body li a {
padding-left: 45px;
}
#teams h6 {
padding-left: 7px;
padding-bottom: 7px;
padding-top: 10px;
font-style: italic;
font-weight: lighter;
}
/* .xcontainer {
display: flex;
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
} */
.xcontainer .row {
margin: 0 auto;
}
</style>
</head>
<body>
<header>
<!-- Navigasi -->
<nav class="nav-extended grey darken-3" role="navigation">
<div class="nav-wrapper container">
<a href="#" class="brand-logo" id="logo-container">i-football</a>
<a href="#" class="sidenav-trigger" data-target="nav-mobile">☰</a>
<ul class="topnav right hide-on-med-and-down"></ul>
<ul class="sidenav grey lighten-2" id="nav-mobile" style="color: white;"></ul>
</div>
<div id="extend-nav" class="nav-content container" >
</div>
</nav>
<!-- Akhir Navigasi -->
</header>
<script src="js/materialize.min.js"></script>
<script src="js/nav.js"></script>
<script type="text/javascript" src="js/idb.js"></script>
<script src="js/api.js"></script>
<div class="container" id="body-content">
</div>
<script>
if ("serviceWorker" in navigator){
window.addEventListener("load", function() {
navigator.serviceWorker
.register("/service-worker.js")
.then(function(){
console.log("Pendaftaran Service Worker Berhasil");
})
.catch(function(){
console.log("Pendaftaran Service Worker Gagal");
});
});
requestPermission();
}
else{
console.log("Service Worker belum di dukung.");
}
function requestPermission() {
if ('Notification' in window) {
Notification.requestPermission().then(function (result) {
if (result === "denied") {
console.log("Fitur notifikasi tidak diijinkan.");
return;
} else if (result === "default") {
console.error("Pengguna menutup kotak dialog permintaan ijin.");
return;
}
if (('PushManager' in window)) {
navigator.serviceWorker.getRegistration().then(function(reg) {
reg.pushManager.subscribe({
userVisibleOnly: true
}).then(function(sub) {
console.log("subcribe Berhasil");
console.log('Berhasil melakukan subscribe dengan endpoint: ', sub.endpoint);
console.log('Berhasil melakukan subscribe dengan p256dh key: ', btoa(String.fromCharCode.apply(null, new Uint8Array(sub.getKey('p256dh')))));
console.log('Berhasil melakukan subscribe dengan auth key: ', btoa(String.fromCharCode.apply(null, new Uint8Array(sub.getKey('auth')))));
}).catch(function(e) {
console.error('Tidak dapat melakukan subscribe ', e);
});
});
}
});
}
}
// //Request API
// document.addEventListener("DOMContentLoaded", function(){
// getmaindata();
// });
</script>
</body>
</html>