-
Notifications
You must be signed in to change notification settings - Fork 0
/
renderer.js
40 lines (31 loc) · 1.12 KB
/
renderer.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
const { remote } = require('electron');
const mainWin = remote.getCurrentWindow();
let display;
// mainWin.blur();
// mainWin.focus();
window.addEventListener('DOMContentLoaded', updateClock, false);
function updateClock() {
let now = new Date();
let hours = now.getHours();
let minutes = now.getMinutes();
//let seconds = now.getSeconds();
//let timeOfDay = (hours < 12 ? 'AM' : 'PM');
hours = (hours == 0) ? 12 : hours;
minutes = (minutes < 10 ? '0' : '') + minutes;
//seconds = (seconds < 10 ? '0' : '') + seconds;
let timeString = hours + ':' + minutes;// + ':' + seconds;
//document.getElementById('clock').innerHTML = timeString;
display = document.getElementById('clock');
display.textContent = timeString;
setTimeout(updateClock, 1000);
}
//window.addEventListener('mouseover', showClock);
//window.addEventListener('mouseout', hideClock);
function showClock() {
mainWin.setBackgroundColor('#618f83');
display.fontColor('#618f83');
}
function hideClock() {
mainWin.setBackgroundColor('#00FFFFFF');
display.textContent.fontColor('#00FFFFFF');
}