-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.js
66 lines (52 loc) · 2.09 KB
/
main.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
function openTab(evt, sectionName) {
var i, tabcontent, tablinks, media;
tabcontent = document.getElementsByClassName("tabcontent");
for (i = 0; i < tabcontent.length; i++) {
tabcontent[i].style.display = "none"
}
tablinks = document.getElementsByClassName("tablinks");
for (i=0; i < tablinks.length; i++) {
tablinks[i].className = tablinks[i].className.replace(" active", "");
}
document.getElementById(sectionName).style.display = "flex";
evt.currentTarget.className += " active";
media=document.getElementsByClassName("audio");
for (i = 0; i < media.length; i++) {
media[i].pause();
}
document.getElementById("video").pause();
}
function enlarge(evt, slideName) {
var i;
var slides = document.getElementsByClassName("slides");
for (i = 0; i < slides.length; i++) {
slides[i].style.display = "none"
}
var slidelinks = document.getElementsByClassName("gallery-photos");
for (i = 0; i < slidelinks.length; i++) {
slidelinks[i].className = slidelinks[i].className.replace(" active", "");
}
document.getElementById(slideName).style.display = "block";
evt.currentTarget.className += " active";
}
function pauseAll() {
var allTracks = document.getElementsByClassName("audio");
for (let i = 0; i < allTracks.length; i++) {
allTracks[i].pause()
}
}
function updateTime(audioElement, timeElement) {
let timeToDisplaySeconds;
if (document.getElementById(audioElement).currentTime == 0) {
timeToDisplaySeconds = Math.floor(document.getElementById(audioElement).duration)}
else {timeToDisplaySeconds = Math.floor(document.getElementById(audioElement).currentTime)}
let minutes = Math.floor(timeToDisplaySeconds/60);
let seconds = timeToDisplaySeconds % 60;
if (seconds < 10) {
seconds = "0"+seconds.toString()
}
document.getElementById(timeElement).innerHTML = minutes+":"+seconds
}
function myFunction() {
document.getElementById("demo").innerHTML = "You moved to position " + document.getElementById("myAudio").currentTime;
}