-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmodule.js
More file actions
66 lines (58 loc) · 2.11 KB
/
module.js
File metadata and controls
66 lines (58 loc) · 2.11 KB
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
// myDom.addEventListener('pointerdown', thePointerListener);
// function thePointerListener(event){
// if (event.target.className == 'container') return;
// let theDom = event.target.closest('.to-learn-events');
// theDom.style.position = 'relative';
// theDom.style.zIndex = 1000;
// theDom.addEventListener('mousemove', moveEl) ;
// function moveEl(el) {
// let theDomReal = getComputedStyle(theDom);
// theDom.style.top = parseFloat(theDomReal.top) + 1 + 'px';
// theDom.style.display= 'none'
// let theBelow = document.elementFromPoint(el.clientX, el.clientY);
// if (theBelow.className == 'container') return;
// console.log(theBelow.id)
// theBelow.insertAdjacentElement('afterend', theDom);
// theDom.style.display = 'grid'
// theDom.mouseup = function(e) {
// theDom.removeEventListener('mousemove', moveEl);
// theDom.mouseup = null;
// }
// }
// }
let timeModule = document.querySelectorAll('.each-Item');
console.log(timeModule)
function theRealTime(){
let date = new Date();
let [hours, minutes, seconds] = [date.getHours(), date.getMinutes(), date.getSeconds()]
if (hours >= 12){
timeModule[3].innerHTML = 'PM'
} else {
timeModule[3].innerHTML = 'AM'
}
if (hours > 12) {
let myHours = hours - 12;
if (myHours < 10){
timeModule[0].innerHTML = '0' + myHours;
} else {
timeModule[0].innerHTML = myHours;
}
} else {
if (hours < 10){
timeModule[0].innerHTML = '0' + hours;
} else {
timeModule[0].innerHTML = hours;
}
}
if (minutes < 10) {
timeModule[1].innerHTML = '0' + minutes;
} else {
timeModule[1].innerHTML = minutes;
}
if (seconds < 10) {
timeModule[2].innerHTML = '0' + seconds;
} else {
timeModule[2].innerHTML = seconds;
}
}
setInterval(theRealTime, 1000);