-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexpire.html
More file actions
265 lines (241 loc) · 11.1 KB
/
expire.html
File metadata and controls
265 lines (241 loc) · 11.1 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
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
<?xml version="1.0" encoding="UTF-8"?>
<html xmlns="http://www.w3.org/1999/xhtml">
<!DOCTYPE html PUBLIC '-//WAPFORUM//DTD XHTML Mobile 1.0//EN' 'http://www.wapforum.org/DTD/xhtml-mobile10.dtd'>
<head>
<title>Masa Aktif Member</title>
<meta charset="UTF-8">
<meta name="author" content="Hardiansyah">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimal-scale=1.0, maximal-scale=1">
<link rel="manifest" href="manifest.json">
<link rel="stylesheet" href="stockid_script/exp.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<!--<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>-->
<link href="https://fonts.googleapis.com/css2?family=Parkinsans&display=swap" rel="stylesheet">
<meta name="theme-color" content="#3498DB">
<meta property="og:title" content="Di Tinggal Kekasih Emang Menyakitkan 💔">
<meta property="og:description" content="Tapi Pernah Gak Sih Loe Di Tinggal Stock ID VIP? 🗿">
<meta property="og:image" content="stockid_gambar/thumb.jpg">
<meta property="og:url" content="https://webstockid.github.io/exp">
<meta property="og:type" content="website">
</head>
<body>
<h2>Monitoring Masa Aktif Member</h2>
<div id="activeSummary" class="active-summary"></div>
<input id="search" placeholder="Cari nama kamu...">
<div class="stat-box" id="statistik"></div>
<div class="controls">
<select id="filter">
<option value="all">Semua 👻</option>
<option value="1">1 Bulan 😏</option>
<option value="2">2 Bulan 🙂↔️</option>
<option value="3">3 Bulan 😌</option>
<option value="6">6 Bulan ☺️</option>
<option value="12">1 Tahun 😍</option>
<option value="expired">Expired 🥱</option>
</select>
</div>
<button onclick="enableNotif ()" class="notif-btn">
<i class="fa fa-bullhorn"></i> Aktifkan Reminder
</button>
<audio id="notifSound" src="stockid_suara/notif.mp3"></audio>
<div id="list"></div>
<script type="text/javascript">
function enableNotif () {
if (!("Notification" in window)) {
alert("Browser tidak mendukung notifikasi");
return;
}
Notification.requestPermission().then(p=> {
if (p==="granted") alert("Notifikasi diaktifkan ✅");
});
}
function pushNotif (title, body) {
if (Notification.permission!=="granted") return;
new Notification(title,{body:body,icon:"stockid_gambar/alert.jpg",vibrate:[200,100,200]});
document.getElementById("notifSound").play().catch(()=> {});
}
</script>
<script type="text/javascript">
/* ================= DATA MEMBER ================= */
const members = [
{ nama:"Mas. Yayat", wa:"82967078794", expired:"2027-02-21", history:[12] },
{ nama:"Mas. Dimas", wa:"6282288133212", expired:"2027-02-11", history:[1,12] },
{ nama:"Mas. Devan", wa:"6285800322160", expired:"2026-09-18", history:[1,6] },
{ nama:"Mas. Ardha", wa:"6281542779853", expired:"2026-08-25", history:[3,6] },
{ nama:"Mas. Vani", wa:"62896622628826", expired:"2026-08-09", history:[6] },
{ nama:"Mas. Tito", wa:"6281270370727", expired:"2026-06-30", history:[3,3] },
{ nama:"Mas. Farhan", wa:"6288221513462", expired:"2026-06-22", history:[1,3] },
{ nama:"Mas. Yoga", wa:"6282382795953", expired:"2026-06-18", history:[3,3] },
{ nama:"Mas. Dika", wa:"628131093311", expired:"2026-06-02", history:[3] },
{ nama:"Mas. Adam", wa:"6282140581317", expired:"2026-05-26", history:[3] },
{ nama:"Mas. Tomy", wa:"6289609809039", expired:"2026-05-22", history:[1,2,2] },
{ nama:"Mas. Dedi", wa:"62859515686282", expired:"2026-05-21", history:[1,3] },
{ nama:"Mas. Arif", wa:"6285265337779", expired:"2026-05-16", history:[1,3] },
{ nama:"Mas. Ananda", wa:"6282256863256", expired:"2026-05-12", history:[3] },
{ nama:"Mas. Anggoro", wa:"6289525567420", expired:"2026-05-10", history:[3] },
{ nama:"Mba. Puspita", wa:"6282146281427", expired:"2026-05-10", history:[3] },
{ nama:"Mas. Faisal", wa:"6285727473240", expired:"2026-05-07", history:[1,2] },
{ nama:"Mas. Abdul", wa:"6285704755602", expired:"2026-05-06", history:[1,2] },
{ nama:"Mba. Fauziah", wa:"6285753648079", expired:"2026-05-05", history:[1,2] },
{ nama:"Mas. Ardan", wa:"628888136363", expired:"2026-04-28", history:[2] },
{ nama:"Mas. Dwiky", wa:"6281163836288", expired:"2026-04-27", history:[1,1,2] },
{ nama:"Mas. Ihsan", wa:"6282215352174", expired:"2026-04-27", history:[2] },
{ nama:"Mba. Dhila", wa:"6289528936511", expired:"2026-04-26", history:[1,1] },
{ nama:"Mas. Roid", wa:"6287819304040", expired:"2026-04-25", history:[1,2] },
{ nama:"Mas. Made", wa:"6281353043869", expired:"2026-04-24", history:[1,2] },
{ nama:"Mba. Tati", wa:"6285773015045", expired:"2026-04-21", history:[2] },
{ nama:"Mba. Linda", wa:"628112630261", expired:"2026-04-21", history:[2] },
{ nama:"Mas. Purna", wa:"6289627939527", expired:"2026-04-19", history:[1,2] },
{ nama:"Mas. Tomin", wa:"6282241230030", expired:"2026-04-11", history:[1] },
{ nama:"Mba. Kayla", wa:"6281357764067", expired:"2026-04-11", history:[2] },
{ nama:"Mas. Danny", wa:"6281932677981", expired:"2026-04-09", history:[2] },
{ nama:"Mas. Zidan", wa:"6282146281427", expired:"2026-04-09", history:[2] },
{ nama:"Mba. Viani", wa:"6282146281427", expired:"2026-04-09", history:[2] },
{ nama:"Mas. Dhio", wa:"6282349033673", expired:"2026-04-04", history:[1] },
{ nama:"Mas. Ridho", wa:"6285839352252", expired:"2026-04-04", history:[1,1] },
{ nama:"Mas. Rachmad", wa:"6288989669913", expired:"2026-04-03", history:[1,1] },
{ nama:"Mas. Resky", wa:"6282125867841", expired:"2026-04-03", history:[1] },
{ nama:"Mas. Gias", wa:"6285974635148", expired:"2026-04-01", history:[1] },
{ nama:"Mba. Lukita", wa:"6282244816942", expired:"2026-04-01", history:[1] },
{ nama:"Mas. Rizal", wa:"6282190537612", expired:"2026-03-31", history:[1] },
{ nama:"Mas. Iram", wa:"6281391330905", expired:"2026-03-31", history:[1] },
{ nama:"Mas. Alvi", wa:"6282112373026", expired:"2026-03-30", history:[1,1] },
{ nama:"Mas. Agung", wa:"6281907273068", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Erwin", wa:"6282284955923", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Ahmad", wa:"6289610006606", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Ega", wa:"082371646313", expired:"2026-03-31", history:[1] },
{ nama:"Mba. Jasmine", wa:"089527787810", expired:"2026-03-31", history:[1] },
{ nama:"Mas. Rahman", wa:"081233704317", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Annur", wa:"08558895157", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Pandya", wa:"081286977138", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Hadi", wa:"081934151515", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Hamid", wa:"085546399043", expired:"2026-03-31", history:[1] },
{ nama:"Mas. Izzudin", wa:"081910019807", expired:"2026-03-31", history:[1] },
{ nama:"Mas. Satya", wa:"085263019463", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Ilham", wa:"082229069298", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Jefri", wa:"0895322198674", expired:"2026-03-30", history:[1] },
{ nama:"Mas. Muazin", wa:"081391334236", expired:"2026-03-30", history:[1,1] },
];
const DAY=86400000,HOUR=3600000,MIN=60000,SEC=1000;
const lastMonth=m=>m.history.at(-1)||0;
const target=d=>new Date(d+"T00:00:00").getTime();
/* ================= FORMAT ================= */
function sisa(ms) {
if (ms<=0) return "Expired";
const h=Math.floor(ms/DAY);
const j=Math.floor(ms%DAY/HOUR);
const m=Math.floor(ms%HOUR/MIN);
const d=Math.floor(ms%MIN/SEC);
return `${h} Hari ${j} Jam ${m} Menit ${d} Detik`;
}
function kelas(b,ms) {
if (ms<=0) return "expired";
if (b==1) return "satu";
if (b==2) return "dua";
if (b==3) return "tiga";
if (b==6) return "enam";
if (b==12) return "setahun";
}
function badge(arr) {
if (arr.length==1) return `+${arr[0]} bulan`;
return `+${arr.slice(0,-1).join(", ")} & ${arr.at(-1)} bulan`;
}
function join(arr) {
return arr.map(b=>`${b} Bulan`).join(" + ");
}
/* ================= STAT ================= */
function renderStat(data) {
const box=document.getElementById("statistik");
box.innerHTML="";
const map={1:0,2:0,3:0,6:0,12:0,x:0};
data.forEach(m=> {
if (m.ms<=0) map.x++;
else map[lastMonth(m)]++;
});
const rows=[
[1,"1 Bulan","b1"],
[2,"2 Bulan","b2"],
[3,"3 Bulan","b3"],
[6,"6 Bulan","b6"],
[12,"1 Tahun","b12"],
["x","Expired","bx"]
];
const max=Math.max(...Object.values(map),1);
rows.forEach(r=> {
const val=map[r[0]];
const el=document.createElement("div");
el.className="stat-row";
el.innerHTML=`
<div class="stat-label">${r[1]} (${val})</div>
<div class="bar">
<div class="bar-fill ${r[2]}" style="--w:${val/max*30}%"></div>
</div>`;
box.appendChild(el);
});
}
function initStat() {
members.forEach(m => m.ms = target(m.expired) - Date.now());
const sorted = [...members].sort((a,b)=>b.ms - a.ms);
renderStat(sorted);
}
/* ================= RENDER ================= */
function render() {
const list=document.getElementById("list");
list.innerHTML="";
const key=search.value.toLowerCase();
const f=filter.value;
members.forEach(m=>m.ms=target(m.expired)-Date.now());
const sorted=[...members].sort((a,b)=>b.ms-a.ms);
//renderStat(sorted);
sorted.forEach(m=> {
const lm=lastMonth(m);
if (!m.nama.toLowerCase().includes(key)) return;
if (f==="expired" && m.ms>0) return;
if (f!=="all" && f!=="expired" && lm!=f) return;
const div=document.createElement("div");
div.className="member "+kelas(lm,m.ms);
div.innerHTML=`
<b><i class='fa fa-user-circle-o'></i> Nama: ${m.nama}</b><br>
<i class='fa fa-hourglass-1 fa-spin'></i> Expired: ${m.expired}<br>
<i class='fa fa-circle-o-notch fa-spin'></i> Sisa Waktu: ${sisa(m.ms)}
<span class="badge">${badge(m.history)}</span>
<div class="history"><i class='fa fa-vcard-o'></i> Join Kelas: ${join(m.history)}</div>
`;
list.appendChild(div);
});
if (w) {
const key=notifKey(m,w);
if (!localStorage.getItem(key)) {
let title="⏰ Masa Aktif Member";
let msg="";
if (w=="h7") msg=`${m.nama} akan expired 7 hari lagi`;
if (w=="h3") msg=`${m.nama} tinggal 3 hari lagi`;
if (w=="expired") msg=`${m.nama} sudah EXPIRED`;
pushNotif (title,msg);
localStorage.setItem(key,"1");
}
}
}
search.oninput=render;
filter.onchange=render;
initStat();
setInterval(render, 12000); // hanya list yang update
render();
</script>
<script type="text/javascript">
if ('serviceWorker' in navigator) {
navigator.serviceWorker.register('/sw.js').then(reg=> {
alert("Service Worker Registered", reg);
}).catch(err=> {
alert("SW Registration failed: ", err);
});
navigator.serviceWorker.addEventListener('message', e=> {
if (e.data.type === 'check-reminder') {
render(); // trigger reminder H-7, H-3, Expired
}
});
}
</script>
</body>
</html>