-
Notifications
You must be signed in to change notification settings - Fork 0
/
components.js
34 lines (33 loc) · 1.03 KB
/
components.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
//---- Sidebar script
var toggleSidebar = function () {
showSidebar = !showSidebar
Sidebar.style.display = showSidebar ? 'block' : 'none'
questionMark.innerHTML = showSidebar ? 'x' : '?'
}
let showSidebar = true
toggleSidebar()
window.onload = function (e) {
questionMark.style.animationName = 'highlight'
questionMark.style.animationDuration = '2s'
questionMark.style.animationIterationCount = '2'
}
questionMark.addEventListener('animationend', (e) => {
e.target.style.animationName = ''
})
//---- Copy button
COPY_BTN.addEventListener('animationend', (e) => {
e.target.style.animationName = ''
})
var copyAns = function () {
var copyText = ANSF.innerText
navigator.clipboard.writeText(copyText).then(
function (e) {
if (ENV === 'DEV') console.log('Copy successful', e)
COPY_BTN.style.animationName = 'copyHighlight'
COPY_BTN.style.animationDuration = '0.8s'
},
function (e) {
if (ENV === 'DEV') console.log('Copy failed', e)
}
)
}