NeuralFalcon commited on
Commit
b0579ba
·
verified ·
1 Parent(s): 9397e0f

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +178 -19
index.html CHANGED
@@ -1,19 +1,178 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Live QR Clock</title>
7
+ <style>
8
+ @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600&display=swap');
9
+
10
+ /* General Body Styling - Light Theme by Default */
11
+ body {
12
+ margin: 0;
13
+ padding: 0;
14
+ display: flex;
15
+ flex-direction: column;
16
+ align-items: center;
17
+ justify-content: center;
18
+ height: 100vh;
19
+ background-color: #ffffff; /* Light background by default */
20
+ font-family: 'Poppins', sans-serif;
21
+ color: #121212; /* Dark text by default */
22
+ transition: background-color 0.3s, color 0.3s; /* Smooth transitions */
23
+ }
24
+
25
+ /* Dark Theme Styles (applied via JavaScript) */
26
+ body.dark-theme {
27
+ background-color: #121212;
28
+ color: #ffffff;
29
+ }
30
+
31
+ /* Title Styling */
32
+ h1 {
33
+ font-size: 2.5rem;
34
+ font-weight: 600;
35
+ margin: 0;
36
+ color: inherit; /* Inherit from body text color */
37
+ text-align: center;
38
+ }
39
+
40
+ /* Instruction Text Styling */
41
+ .instruction {
42
+ margin-top: 5px;
43
+ font-size: 0.9rem;
44
+ color: #a8a8a8; /* Light grey text for instructions */
45
+ text-align: center;
46
+ }
47
+
48
+ /* Button Styling */
49
+ #theme-toggle {
50
+ position: absolute;
51
+ top: 20px;
52
+ right: 20px;
53
+ padding: 10px 15px;
54
+ background-color: #ddd;
55
+ color: #333;
56
+ border: none;
57
+ border-radius: 5px;
58
+ cursor: pointer;
59
+ font-size: 0.9em;
60
+ transition: background-color 0.3s;
61
+
62
+ }
63
+ #theme-toggle:hover{
64
+ background-color: #ccc;
65
+ }
66
+ #theme-toggle.dark {
67
+ background-color: #333;
68
+ color: #ddd;
69
+ }
70
+ #theme-toggle.dark:hover {
71
+ background-color: #555;
72
+ }
73
+ /* Container Styling */
74
+ .container {
75
+ margin-top: 20px;
76
+ display: flex;
77
+ flex-direction: column;
78
+ align-items: center;
79
+ padding: 30px;
80
+ background-color: #f0f0f0; /* Slightly lighter background for container */
81
+ border-radius: 15px;
82
+ box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2); /* Shadow for separation */
83
+ border: 1px solid #eee; /* Added a subtle border */
84
+ transition: background-color 0.3s, border-color 0.3s;
85
+ }
86
+ .dark-theme .container {
87
+ background-color: #1e1e1e; /* Darker background in dark theme */
88
+ border-color: #333; /* Border matching the dark theme */
89
+ }
90
+
91
+ /* Date and Time Styling */
92
+ #current-datetime {
93
+ text-align: center;
94
+ font-size: 1.8em; /* make the combined datetime bigger */
95
+ font-weight: 500;
96
+ color: inherit; /* Inherit from body text color */
97
+ text-shadow: 0 0 5px rgba(0, 0, 0, 0.1); /* Add a very subtle text glow */
98
+ margin: 10px 0 0 0 ; /* Added spacing above date/time */
99
+ }
100
+
101
+ .dark-theme #current-datetime {
102
+ text-shadow: 0 0 5px rgba(255, 255, 255, 0.4); /* White glow in dark theme */
103
+ }
104
+
105
+ /* QR Code Styling */
106
+ #qr-code {
107
+ width: 300px;
108
+ height: 300px;
109
+ margin-bottom: 10px; /* Added spacing below the qr code */
110
+ }
111
+ </style>
112
+ </head>
113
+ <body>
114
+ <!-- Theme Toggle Button -->
115
+ <button id="theme-toggle">Dark Mode</button>
116
+
117
+ <!-- Title Section -->
118
+ <h1>QR Clock</h1>
119
+ <p class="instruction">Scan the QR code with your phone camera app</p>
120
+
121
+ <!-- QR Code and Date/Time Container -->
122
+ <div class="container">
123
+ <div id="qr-code"></div>
124
+ <!-- Date and Time card -->
125
+ <span id="current-datetime"></span>
126
+ </div>
127
+
128
+ <!-- QR Code Library -->
129
+ <script src="https://cdnjs.cloudflare.com/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>
130
+ <script>
131
+ const body = document.body;
132
+ const themeToggle = document.getElementById('theme-toggle');
133
+ let isDarkMode = false;
134
+
135
+ function updateDateTimeAndQR() {
136
+ // Get current date and time
137
+ const now = new Date();
138
+ const dateString = now.toLocaleDateString('en-GB'); // Format: DD/MM/YYYY
139
+ const timeString = now.toLocaleTimeString('en-US', {
140
+ hour: '2-digit',
141
+ minute: '2-digit',
142
+ second: '2-digit',
143
+ hour12: true
144
+ });
145
+
146
+ // Combine date and time into a single string
147
+ const dateTimeString = `${dateString} ${timeString}`;
148
+
149
+ // Update the displayed date and time in one single place
150
+ document.getElementById('current-datetime').textContent = dateTimeString;
151
+
152
+ // Update the QR Code with the time only
153
+ const qrCodeDiv = document.getElementById('qr-code');
154
+ qrCodeDiv.innerHTML = ''; // Clear the previous QR code
155
+ new QRCode(qrCodeDiv, {
156
+ text: timeString, // QR Code contains only the time
157
+ width: 300,
158
+ height: 300,
159
+ colorDark: isDarkMode ? "#ffffff" : "#000000" ,
160
+ colorLight: "transparent", // Transparent background
161
+ });
162
+ }
163
+
164
+ // Theme Toggle Functionality
165
+ themeToggle.addEventListener('click', () => {
166
+ isDarkMode = !isDarkMode;
167
+ body.classList.toggle('dark-theme', isDarkMode);
168
+ themeToggle.textContent = isDarkMode ? 'Light Mode' : 'Dark Mode';
169
+ themeToggle.classList.toggle('dark', isDarkMode);
170
+ updateDateTimeAndQR();
171
+ });
172
+
173
+ // Initial call and periodic updates
174
+ updateDateTimeAndQR();
175
+ setInterval(updateDateTimeAndQR, 1000);
176
+ </script>
177
+ </body>
178
+ </html>