refactor ciagl dalszy
This commit is contained in:
1 parent
01b8ff656e
commit
bc45c91d92
15 files changed
+1592
-1492
No files matched your search
@@ -0,0 +1,25 @@
|
||||
(function () {
|
||||
const t = localStorage.getItem('theme') || 'dark';
|
||||
document.documentElement.setAttribute('data-theme', t);
|
||||
// prosty "try again"
|
||||
document.querySelector('[data-action="try-again"]')?.addEventListener('click', () => {
|
||||
location.reload();
|
||||
});
|
||||
// kopiowanie logs
|
||||
document.querySelector('[data-action="copy-text"]')?.addEventListener('click', (e) => {
|
||||
const sel = e.currentTarget.getAttribute('data-target');
|
||||
const el = sel && document.querySelector(sel);
|
||||
if (!el) return;
|
||||
const txt = el.textContent || '';
|
||||
navigator.clipboard.writeText(txt).then(() => {
|
||||
const toast = document.getElementById('toast');
|
||||
if (toast) {
|
||||
toast.textContent = 'Copied!';
|
||||
toast.classList.add('show');
|
||||
setTimeout(() => toast.classList.remove('show'), 1200);
|
||||
}
|
||||
});
|
||||
});
|
||||
})();
|
||||
|
||||
|
||||
Reference in new issue
Block a user