-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrid-rally.html
More file actions
54 lines (43 loc) · 1.82 KB
/
rid-rally.html
File metadata and controls
54 lines (43 loc) · 1.82 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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>Rid Rally: Monthly Riddance Goal Tracker</title>
<script>
function redirectWithValues() {
const now = new Date();
const monthYear = `${now.getFullYear()}-${String(now.getMonth() + 1).padStart(2, '0')}`;
const deviceId = localStorage.getItem('device-id') || 'unknown-device';
const storageKey = `goal-tracker-${deviceId}-${monthYear}`;
const redirectFlagKey = `redirected-${deviceId}-${monthYear}`;
const saved = JSON.parse(localStorage.getItem(storageKey));
if (!saved) {
window.location.href = 'https://ridrally.com/';
}
const alreadyRedirected = localStorage.getItem(redirectFlagKey);
if (!alreadyRedirected) {
const goalValue = saved.goal || saved.originalGoal || 0;
const throwValue = (saved.progress && saved.progress.throw) || 0;
const giveValue = (saved.progress && saved.progress.give) || 0;
const sellValue = (saved.progress && saved.progress.sell) || 0;
// Build URL with query parameters
const url = new URL('https://ridrally.com/');
url.searchParams.set('goalValue', goalValue);
url.searchParams.set('throwValue', throwValue);
url.searchParams.set('giveValue', giveValue);
url.searchParams.set('sellValue', sellValue);
// Set flag so this doesn't happen again this month
localStorage.setItem(redirectFlagKey, 'true');
// Redirect with values
window.location.href = url.toString();
} else {
// Redirect without values
window.location.href = 'https://ridrally.com/';
}
}
redirectWithValues();
</script>
</head>
<body>test</body>
</html>