dc09.ru-old/js/script.js

33 lines
665 B
JavaScript
Raw Normal View History

const body = document.body
function copyLink(/** @type {Event} */ ev) {
2021-07-23 11:00:33 +04:00
/** @type {HTMLSpanElement} */
let elem = ev.currentTarget
2021-07-23 11:00:33 +04:00
navigator.clipboard.writeText(elem.dataset.link)
2021-07-23 11:00:33 +04:00
let wrapper = elem.parentElement.parentElement.parentElement
let msg = wrapper.querySelector('.copied')
2021-07-23 11:00:33 +04:00
msg.classList.add(...fadeAnimIn)
2021-07-23 11:00:33 +04:00
setTimeout(() => {
msg.classList.remove(...fadeAnimIn)
2021-07-23 11:00:33 +04:00
msg.classList.add('show')
msg.classList.add(...fadeAnimOut)
setTimeout(() => {
msg.classList.remove(...fadeAnimOut)
msg.classList.remove(...fadeAnimIn)
}, 600)
}, 1500)
}
function styleValue(/** @type {string} */ prop) {
return prop.replace('px', '') * 1
}