-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscripts.js
92 lines (63 loc) · 1.94 KB
/
scripts.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
87
88
89
90
91
92
/*(function () {
var localClock = document.getElementById( "local-clock" );
function updateClock ( clock ) {
clock.innerHTML = new Date().toLocaleTimeString();
}
setInterval(function () {
updateClock( localClock );
}, 1000);
}());
//local-clock + 1 hour (have to fix it somehow to UTC+03:00)
(function () {
Date.prototype.grHours = function(h){
this.setHours(this.getHours()+h);
return this;
}
var greekClock = document.getElementById( "greece-clock" );
function updateClock ( clock ) {
clock.innerHTML = new Date().grHours(1).toLocaleTimeString();
}
setInterval(function () {
updateClock( greekClock );
}, 1000);
}());
*/
//testing code
//better to use luxon | much cleaner code ;)
const locations = document.querySelectorAll('section.times div')
const updateTimes = function () {
locations.forEach(location => {
const output = location.querySelector("output")
const timezone = location.getAttribute("data-timezone")
const now = luxon.DateTime.now().setZone(timezone)
output.innerHTML = now.toFormat("HH:mm:ss")
})
}
updateTimes()
setInterval(function () {
updateTimes()
}, 1000)
//volume of background music
var kitRadio = document.getElementById("kit");
kitRadio.volume = 0.6;
/*another one play btn*/
const kit = document.getElementById("kit");
const box = document.querySelector('.box');
function togglePlay() {
return kit.paused ? kit.play() : kit.pause();
};
box.addEventListener('click', (e)=>{
e.target.classList.toggle('pause');
togglePlay();
})
kit.onplaying = function() {
box.classList.add('pause');
};
//volume control
var video = document.getElementById('kit');
var volumeControl = document.getElementById('vol-control');
var setVolume = function(){
video.volume = this.value / 200;
};
volumeControl.addEventListener('change',setVolume);
volumeControl.addEventListener('input',setVolume);