grf_chinese_asr_test / copy_content.js
Jollyfish's picture
Upload copy_content.js
fdf2937 verified
raw
history blame contribute delete
747 Bytes
(text) => {
navigator.clipboard.writeText(text);
const toast = document.createElement('div')
toast.textContent = "The content has been copied to the clipboard."
toast.style.cssText = `
position: fixed;
top: 20px;
right: 20px;
background-color: #ff8945;
color: white;
padding: 16px;
border-radius: 4px;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
z-index: 10000;
font-size: 14px;
opacity: 0;
transition: opacity 0.3s ease-in-out;
`;
document.body.appendChild(toast);
setTimeout(() => {
toast.style.opacity = "1";
}, 10);
setTimeout(() => {
toast.style.opacity = "0";
setTimeout(() => {
document.body.removeChild(toast);
}, 300);
}, 3000);
return null;
}