tjwrld commited on
Commit
00972a9
·
verified ·
1 Parent(s): 1212160

Upload 5 files

Browse files
Files changed (5) hide show
  1. admin.html +53 -0
  2. landing.html +29 -0
  3. script.js +71 -0
  4. styles.css +40 -0
  5. user.html +25 -0
admin.html ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Admin Panel</title>
7
+ <link rel="stylesheet" href="styles.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <h1>Admin Panel</h1>
12
+
13
+ <h2>Set Quiz Timing</h2>
14
+ <label for="startTime">Start Time:</label>
15
+ <input type="time" id="startTime" required>
16
+
17
+ <label for="endTime">End Time:</label>
18
+ <input type="time" id="endTime" required>
19
+
20
+ <button id="setTimer">Set Timer</button>
21
+
22
+ <h2>Users who exited fullscreen:</h2>
23
+ <button id="refreshList">Refresh Exited Users</button>
24
+ <ul id="exitedUserList"></ul>
25
+ </div>
26
+
27
+ <script>
28
+ document.getElementById('setTimer').addEventListener('click', () => {
29
+ const startTime = document.getElementById('startTime').value;
30
+ const endTime = document.getElementById('endTime').value;
31
+ if (startTime && endTime) {
32
+ localStorage.setItem('startTime', startTime);
33
+ localStorage.setItem('endTime', endTime);
34
+ alert('Timer has been set!');
35
+ } else {
36
+ alert('Please set both start and end times.');
37
+ }
38
+ });
39
+
40
+ document.getElementById('refreshList').addEventListener('click', () => {
41
+ const exitedUsers = JSON.parse(localStorage.getItem('exitedUsers')) || [];
42
+ const exitedUserList = document.getElementById('exitedUserList');
43
+ exitedUserList.innerHTML = ''; // Clear the list
44
+
45
+ exitedUsers.forEach(user => {
46
+ const li = document.createElement('li');
47
+ li.textContent = user;
48
+ exitedUserList.appendChild(li);
49
+ });
50
+ });
51
+ </script>
52
+ </body>
53
+ </html>
landing.html ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>Enter Your Name</title>
7
+ <link rel="stylesheet" href="styles.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <h1>Welcome to the Quiz</h1>
12
+ <label for="nameInput">Enter Your Name:</label>
13
+ <input type="text" id="nameInput" placeholder="Your Name" required>
14
+ <button id="submitName">Start Quiz</button>
15
+ </div>
16
+
17
+ <script>
18
+ document.getElementById('submitName').addEventListener('click', () => {
19
+ const name = document.getElementById('nameInput').value.trim();
20
+ if (name) {
21
+ localStorage.setItem('userName', name);
22
+ window.location.href = 'user.html'; // Redirect to user page
23
+ } else {
24
+ alert('Please enter your name.');
25
+ }
26
+ });
27
+ </script>
28
+ </body>
29
+ </html>
script.js ADDED
@@ -0,0 +1,71 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ const formIframe = document.getElementById('form-iframe');
2
+ const formStatus = document.getElementById('formStatus');
3
+ const currentTimeDisplay = document.getElementById('time');
4
+ const startTimeDisplay = document.getElementById('startTimeDisplay');
5
+ const endTimeDisplay = document.getElementById('endTimeDisplay');
6
+ const userNameDisplay = document.getElementById('userName');
7
+
8
+ // Display user's name
9
+ const userName = localStorage.getItem('userName') || 'User';
10
+ userNameDisplay.innerText = userName;
11
+
12
+ // Function to check if the form is open based on current time
13
+ function checkFormStatus() {
14
+ const startTime = localStorage.getItem('startTime');
15
+ const endTime = localStorage.getItem('endTime');
16
+
17
+ if (startTime && endTime) {
18
+ startTimeDisplay.innerText = startTime;
19
+ endTimeDisplay.innerText = endTime;
20
+
21
+ const now = new Date();
22
+ const [startHours, startMinutes] = startTime.split(':').map(Number);
23
+ const [endHours, endMinutes] = endTime.split(':').map(Number);
24
+
25
+ const startDateTime = new Date(now.getFullYear(), now.getMonth(), now.getDate(), startHours, startMinutes);
26
+ const endDateTime = new Date(now.getFullYear(), now.getMonth(), now.getDate(), endHours, endMinutes);
27
+
28
+ if (now >= startDateTime && now <= endDateTime) {
29
+ formStatus.innerText = 'Open';
30
+ formIframe.style.display = 'block'; // Show the form
31
+ } else {
32
+ formStatus.innerText = 'Closed';
33
+ formIframe.style.display = 'none'; // Hide the form
34
+ }
35
+ }
36
+ }
37
+
38
+ // Update current time display every second
39
+ setInterval(() => {
40
+ const now = new Date();
41
+ currentTimeDisplay.innerText = now.toLocaleTimeString();
42
+ checkFormStatus();
43
+ }, 1000);
44
+
45
+ // Fullscreen functionality for the user
46
+ const fullscreenBtn = document.getElementById('fullscreen-btn');
47
+ if (fullscreenBtn) {
48
+ fullscreenBtn.addEventListener('click', () => {
49
+ if (!document.fullscreenElement) {
50
+ document.documentElement.requestFullscreen().catch(err => {
51
+ console.error("Error attempting to enable fullscreen mode:", err);
52
+ });
53
+ } else {
54
+ document.exitFullscreen();
55
+ }
56
+ });
57
+
58
+ // Track when the user exits fullscreen
59
+ document.addEventListener('fullscreenchange', () => {
60
+ if (!document.fullscreenElement) {
61
+ // User exited fullscreen
62
+ const exitedUsers = JSON.parse(localStorage.getItem('exitedUsers')) || [];
63
+ exitedUsers.push(userName);
64
+ localStorage.setItem('exitedUsers', JSON.stringify(exitedUsers));
65
+ alert('You have exited fullscreen. Your name has been recorded.');
66
+ }
67
+ });
68
+ }
69
+
70
+ // Initialize status check
71
+ checkFormStatus();
styles.css ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ body {
2
+ font-family: Arial, sans-serif;
3
+ display: flex;
4
+ justify-content: center;
5
+ align-items: center;
6
+ flex-direction: column;
7
+ height: 100vh;
8
+ margin: 0;
9
+ background-color: #f4f4f4;
10
+ }
11
+
12
+ .container {
13
+ text-align: center;
14
+ width: 100%; /* Allow the container to take full width */
15
+ }
16
+
17
+ h1 {
18
+ margin-bottom: 20px;
19
+ }
20
+
21
+ iframe {
22
+ width: 100%; /* Set to 300% */
23
+ max-width: none; /* Remove max-width restriction */
24
+ height: 450px; /* Adjust height as needed */
25
+ border: 1px solid #ccc;
26
+ margin: 0 auto; /* Center the iframe */
27
+ display: block; /* Ensures margin auto works */
28
+ }
29
+
30
+ #status, #currentTime {
31
+ margin-top: 20px;
32
+ font-size: 18px;
33
+ }
34
+
35
+ button {
36
+ margin-top: 20px;
37
+ padding: 10px 20px;
38
+ font-size: 16px;
39
+ cursor: pointer;
40
+ }
user.html ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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>User Form</title>
7
+ <link rel="stylesheet" href="styles.css">
8
+ </head>
9
+ <body>
10
+ <div class="container">
11
+ <h1>Welcome, <span id="userName">User</span>!</h1>
12
+ <h2>Fill Out the Form</h2>
13
+ <iframe id="form-iframe" src="YOUR_GOOGLE_FORM_URL" frameborder="0" allowfullscreen></iframe>
14
+ <div id="status">Status: <span id="formStatus">Closed</span></div>
15
+ <div id="currentTime">Current Time: <span id="time"></span></div>
16
+ <div id="quizTiming">
17
+ <p>Quiz Start Time: <span id="startTimeDisplay">N/A</span></p>
18
+ <p>Quiz End Time: <span id="endTimeDisplay">N/A</span></p>
19
+ </div>
20
+ <button id="fullscreen-btn">Go Fullscreen</button>
21
+ </div>
22
+
23
+ <script src="script.js"></script>
24
+ </body>
25
+ </html>