-
Notifications
You must be signed in to change notification settings - Fork 0
/
script.js
74 lines (62 loc) · 2.57 KB
/
script.js
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
function updateTimeAndGreeting() {
// Get current time
var now = new Date();
var hours = now.getHours();
var minutes = now.getMinutes();
var seconds = now.getSeconds();
// Format hours, minutes, and seconds to have leading zeros if needed
hours = (hours < 10 ? "0" : "") + hours;
minutes = (minutes < 10 ? "0" : "") + minutes;
seconds = (seconds < 10 ? "0" : "") + seconds;
// Display the time in the format "10:10:00"
document.getElementById("real-time").textContent = "Time: " + hours + ":" + minutes + ":" + seconds;
// Determine the greeting based on the current hour
var greeting;
if (hours < 12) {
greeting = "Good Morning!";
} else if (hours >= 12 && hours < 18) {
greeting = "Good Afternoon!";
} else {
greeting = "Good Evening!";
}
// Display the greeting
document.getElementById("greeting").textContent = greeting;
}
// Call updateTimeAndGreeting function every second to update the clock and greeting
setInterval(updateTimeAndGreeting, 1000);
// Initial call to display time and greeting immediately
updateTimeAndGreeting();
// Toggling
// function toggleUploadOptions() {
// var uploadOptions = document.getElementById("upload-options");
// var radios = document.getElementsByName("choice");
// for (var i = 0; i < radios.length; i++) {
// if (radios[i].checked) {
// uploadOptions.style.display = "block";
// return;
// }
// }
// uploadOptions.style.display = "none";
// }
// Function to toggle upload options based on the selected choice
function toggleUploadOptions(choice) {
var sourceFileLabel = document.getElementById("sourceFileLabel");
var fileInput = document.getElementById("fileInput");
var uploadButton = document.getElementById("upload");
var result = document.getElementById("result");
if (choice === "pre-recorded") {
sourceFileLabel.style.display = "block";
fileInput.style.display = "block";
uploadButton.style.display = "block";
result.style.display = "block";
} else {
sourceFileLabel.style.display = "none";
fileInput.style.display = "none";
uploadButton.style.display = "none";
result.style.display = "none";
}
}
// Call toggleUploadOptions function when the page is loaded to show/hide upload options based on the checked radio button
window.onload = function() {
toggleUploadOptions('pre-recorded'); // Ensure pre-recorded media is selected by default
};