-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathscript.js
34 lines (29 loc) · 812 Bytes
/
script.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
// Input the time in 24h format
const MEETING_END_HRS = 15
const MEETING_END_MIN = 30
/*
* This field is optional.
* Set the time in ms.
* 1000 => 1 second
* 60000 => 1 minute
* 300000 => 5 minutes
* 600000 => 10 minutes
*/
const INTERVAL_CHECK = 60000
// +-------------+
// | script code |
// +-------------+
const date = new Date()
const currentHrs = parseInt(date.toLocaleTimeString().split(':')[0])
const currentMin = parseInt(date.toLocaleTimeString().split(':')[1])
const hangupBtn = document.querySelector('#hangup-button')
const interval = setInterval(() => {
if (currentHrs > MEETING_END_HRS ) {
hangupBtn.click()
clearInterval(interval)
}
if (currentHrs === MEETING_END_HRS && currentMin >= MEETING_END_MIN) {
hangupBtn.click()
clearInterval(interval)
}
}, INTERVAL_CHECK)