-
Notifications
You must be signed in to change notification settings - Fork 0
/
javascript.js
86 lines (72 loc) · 2.65 KB
/
javascript.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
75
76
77
78
79
80
81
82
83
84
85
86
/* Variable were the date gets saved */
var dateVar;
var dateDay = null;
/* Function that updates time */
function updateTime() {
/* Waits for a second before updating the time */
setTimeout(function() {
/* Gets the current date from the system */
dateVar = new Date();
/* dd - mm - yyyy */
if(dateDay == null || (dateVar.getHours() + 1 == 23))
updateBigDate();
/* h - m - s */
document.getElementById('fineDate').innerText = (dateVar.getHours() < 10 ? "0" + dateVar.getHours() : dateVar.getHours()) + " - " + (dateVar.getMinutes() < 10 ? "0" + dateVar.getMinutes() : dateVar.getMinutes()) + " - " + (dateVar.getSeconds() < 10 ? "0" + dateVar.getSeconds() : dateVar.getSeconds());
updateTime();
}, 100);
}
function updateBigDate(){
/* dd - mm - yyyy */
dateDay = (dateVar.getDate() < 10 ? "0" + dateVar.getDate() : dateVar.getDate()) + " - ";
//Month
dateDay += ((dateVar.getMonth() + 1) < 10 ? "0" + (dateVar.getMonth() + 1) : (dateVar.getMonth() + 1)) + " - ";
//Year
dateDay += dateVar.getFullYear();
document.getElementById('date').innerText = dateDay;
}
/* Function to Hide and UnHide the fullscreen button */
function unHideButton(){
document.getElementById("fullscreenButton").style.background = "rgba(0, 0, 0, 0.3)";
document.getElementById("fullscreenButton").style.color = "#f1f1f1";
}
function hideButton(){
document.getElementById("fullscreenButton").style.background = "rgba(0, 0, 0, 0)";
document.getElementById("fullscreenButton").style.color = "rgba(0, 0, 0, 0)";
}
/* Function to change the background (Not Working) */
function changeToImage(){
document.getElementById("videoBackground").style.display = "none";
document.getElementById("videoBackground").src = "./";
return document.getElementById("videoBackground").src;
}
/* Saves the state of the page in a rudimental way to decide what the button does */
var elem = document.documentElement;
var clicked = false;
function changeState(){
if(clicked)
closeFullscreen();
else
openFullscreen();
clicked = !clicked;
}
/* View in fullscreen */
function openFullscreen() {
if (elem.requestFullscreen) {
elem.requestFullscreen();
} else if (elem.webkitRequestFullscreen) { /* Safari */
elem.webkitRequestFullscreen();
} else if (elem.msRequestFullscreen) { /* IE11 */
elem.msRequestFullscreen();
}
hideButton();
}
/* Close fullscreen */
function closeFullscreen() {
if (document.exitFullscreen) {
document.exitFullscreen();
} else if (document.webkitExitFullscreen) { /* Safari */
document.webkitExitFullscreen();
} else if (document.msExitFullscreen) { /* IE11 */
document.msExitFullscreen();
}
}