File size: 5,833 Bytes
3ff1432
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Book Reading Streak Tracker</title>
    <style>
        body {
            font-family: 'Helvetica Neue', Arial, sans-serif;
            text-align: center;
            margin: 0;
            padding: 0;
            background: url('https://source.unsplash.com/1920x1080/?book') no-repeat center center fixed;
            background-size: cover;
            color: white;
        }
        header {
            background-color: rgba(0, 0, 0, 0.7);
            padding: 10px 20px;
            position: fixed;
            width: 100%;
            top: 0;
            z-index: 1000;
        }
        #container {
            background: rgba(255, 255, 255, 0.7);
            padding: 20px;
            border-radius: 10px;
            margin-top: 60px;
        }
        h1 {
            color: #333;
        }
        p {
            color: #555;
        }
        button {
            padding: 10px 20px;
            font-size: 16px;
            cursor: pointer;
            margin: 10px;
            background-color: #007bff;
            color: #fff;
            border: none;
            border-radius: 5px;
            position: relative;
        }
        #streak {
            font-size: 24px;
            font-weight: bold;
            color: #007bff;
        }
        .notification-bar {
            position: fixed;
            bottom: 0;
            left: 0;
            width: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 15px;
            text-align: center;
            display: none;
        }
        .menu-icon {
            display: none;
            cursor: pointer;
            font-size: 24px;
            color: #fff;
            position: absolute;
            top: 15px;
            left: 20px;
        }
        .menu-options {
            display: flex;
            justify-content: center;
            align-items: center;
            height: 100vh;
            position: fixed;
            top: 0;
            left: 0;
            width: 100%;
            background-color: rgba(0, 0, 0, 0.7);
            z-index: 100;
            flex-direction: column;
            transform: translateY(-100%);
            transition: transform 0.3s ease-in-out;
        }
        .menu-option {
            margin: 20px;
            font-size: 18px;
            color: #fff;
            cursor: pointer;
        }
        
                div.scrollmenu {
  background-color: #333;
  overflow: auto;
  white-space: nowrap;
}

div.scrollmenu a {
  display: inline-block;
  color: white;
  text-align: center;
  padding: 14px;
  text-decoration: none;
}

div.scrollmenu a:hover {
  background-color: #777;
}
    </style>
</head>
<body>

 
<div class="scrollmenu">
  <a href="index.html">Home</a>
  <a href="index.html">Sign Out</a>
  <a href="#about">About</a>
  <a href="#support">Support</a>
</div>

    <div id="container">
        <h1>Book Reading Streak Tracker</h1>
        <p>Track your daily reading streak by clicking the button below:</p>

        <button onclick="updateStreak()">Read a Book Today</button>
        <button onclick="deleteStreak()">Delete Streak</button>
        <p>Your current streak: <span id="streak">1</span> days</p>
    </div>

    <div class="notification-bar">
        This website uses cookies to save your reading streak data. By using this site, you agree to our use of cookies.
    </div>

    <script>
        // Function to update the reading streak
        function updateStreak() {
            let lastClickDate = localStorage.getItem('lastClickDate');
            let currentDate = new Date().toLocaleDateString();

            if (lastClickDate !== currentDate) {
                let currentStreak = parseInt(document.getElementById('streak').innerText);
                currentStreak++;
                document.getElementById('streak').innerText = currentStreak;

                // Update the last click date in local storage
                localStorage.setItem('lastClickDate', currentDate);

                // Show notification
                showNotification();
            } else {
                alert('You already clicked the button today. Come back tomorrow!');
            }
        }

        // Function to delete the last streak
        function deleteStreak() {
            let lastClickDate = localStorage.getItem('lastClickDate');
            let currentDate = new Date().toLocaleDateString();

            if (lastClickDate === currentDate) {
                // If the button was clicked today, update the streak
                let currentStreak = parseInt(document.getElementById('streak').innerText);
                currentStreak = Math.max(1, currentStreak - 1); // Ensure streak is not less than 1
                document.getElementById('streak').innerText = currentStreak;

                // Clear the last click date in local storage
                localStorage.removeItem('lastClickDate');
            } else {
                alert('No streak to delete for today.');
            }
        }

        // Function to show notification
        function showNotification() {
            document.querySelector('.notification-bar').style.display = 'block';
            setTimeout(function() {
                document.querySelector('.notification-bar').style.display = 'none';
            }, 5000);
        }

        // Function to toggle menu options
        function toggleMenu() {
            const menuOptions = document.querySelector('.menu-options');
            menuOptions.style.transform = menuOptions.style.transform === 'translateY(0)' ? 'translateY(-100%)' : 'translateY(0)';
        }
    </script>

</body>
</html>