-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathblock-window-renderer.js
More file actions
32 lines (27 loc) · 906 Bytes
/
Copy pathblock-window-renderer.js
File metadata and controls
32 lines (27 loc) · 906 Bytes
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
'use strict';
document.addEventListener('DOMContentLoaded', () => {
const form = document.getElementById('retrospect-form')
const retrospectInput = document.getElementById('retrospect')
const errorMsg = document.getElementById('error-msg')
function submitRetrospect() {
const text = retrospectInput.value.trim()
if (!text) {
retrospectInput.classList.add('invalid')
errorMsg.textContent = 'Please write what you accomplished'
return
}
retrospectInput.classList.remove('invalid')
errorMsg.textContent = ''
window.powerdoro.sendRetrospect(text)
}
form.addEventListener('submit', (event) => {
event.preventDefault()
submitRetrospect()
})
retrospectInput.addEventListener('keydown', (event) => {
const isEnter = event.key === 'Enter'
if (!isEnter || event.shiftKey) return
event.preventDefault()
submitRetrospect()
})
})