04/26 New features, new for Firefox
This commit is contained in:
@@ -59,6 +59,17 @@ function escHtml(str) {
|
||||
.replace(/>/g, '>').replace(/"/g, '"');
|
||||
}
|
||||
|
||||
// Auto-clear clipboard 30 s after a sensitive copy.
|
||||
let _clipTimer = null;
|
||||
function _copyWithAutoClear(text) {
|
||||
navigator.clipboard.writeText(text).catch(() => {});
|
||||
if (_clipTimer) clearTimeout(_clipTimer);
|
||||
_clipTimer = setTimeout(() => {
|
||||
navigator.clipboard.writeText('').catch(() => {});
|
||||
_clipTimer = null;
|
||||
}, 30_000);
|
||||
}
|
||||
|
||||
// ── Avatar helpers ────────────────────────────────────────────────────────────
|
||||
|
||||
const AVATAR_COLORS = ['', 'color-red', 'color-green', 'color-purple', 'color-teal'];
|
||||
@@ -539,7 +550,7 @@ function renderList() {
|
||||
e.stopPropagation();
|
||||
const item = _items.find(i => i.id === parseInt(btn.dataset.copyPass));
|
||||
if (item?.plain?.password) {
|
||||
navigator.clipboard.writeText(item.plain.password);
|
||||
_copyWithAutoClear(item.plain.password);
|
||||
btn.title = 'Copied!';
|
||||
setTimeout(() => { btn.title = 'Copy password'; }, 1500);
|
||||
}
|
||||
@@ -586,7 +597,7 @@ function renderList() {
|
||||
e.stopPropagation();
|
||||
const item = _items.find(i => i.id === parseInt(btn.dataset.copyUser));
|
||||
if (item?.plain?.username) {
|
||||
navigator.clipboard.writeText(item.plain.username);
|
||||
_copyWithAutoClear(item.plain.username);
|
||||
btn.title = 'Copied!';
|
||||
setTimeout(() => { btn.title = 'Copy username'; }, 1500);
|
||||
}
|
||||
@@ -615,12 +626,12 @@ function renderList() {
|
||||
item.plain?.username ? {
|
||||
label: 'Copy username',
|
||||
icon: '<svg viewBox="0 0 24 24" fill="none" width="14" height="14"><circle cx="12" cy="8" r="4" stroke="currentColor" stroke-width="1.7"/><path d="M4 20c0-4 3.6-7 8-7s8 3 8 7" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>',
|
||||
action: () => { navigator.clipboard.writeText(item.plain.username); flyout.remove(); },
|
||||
action: () => { _copyWithAutoClear(item.plain.username); flyout.remove(); },
|
||||
} : null,
|
||||
item.plain?.password ? {
|
||||
label: 'Copy password',
|
||||
icon: '<svg viewBox="0 0 24 24" fill="none" width="14" height="14"><rect x="3" y="10" width="18" height="11" rx="2" stroke="currentColor" stroke-width="1.7"/><path d="M8 10V7a4 4 0 018 0v3" stroke="currentColor" stroke-width="1.7" stroke-linecap="round"/></svg>',
|
||||
action: () => { navigator.clipboard.writeText(item.plain.password); flyout.remove(); },
|
||||
action: () => { _copyWithAutoClear(item.plain.password); flyout.remove(); },
|
||||
} : null,
|
||||
].filter(Boolean);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user