From 2bd6a6823c05053f0192d3c0acd065281a55749c Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 20 Oct 2026 09:25:25 +0000 Subject: [PATCH] Show "Keep only this" only when it changes something It is hidden on the copy that is already the only one kept (its space is kept, so rows stay aligned, and it is not focusable). Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01EgB2BE6SAL3zHCu6oLk3Tw --- style.css | 4 ++++ tab-duplicates.js | 8 +++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/style.css b/style.css index 56ec292..1de4d06 100644 --- a/style.css +++ b/style.css @@ -404,6 +404,10 @@ main { } } +.keep-only.useless { + visibility: hidden; +} + .group-subtitle { color: var(--muted); font-size: 13px; diff --git a/tab-duplicates.js b/tab-duplicates.js index 603fe95..f43fdfd 100644 --- a/tab-duplicates.js +++ b/tab-duplicates.js @@ -77,7 +77,7 @@ TABS.duplicates = (function() { onclick: function() { keepOnlyThis(group, bookmark); } }) ]); - rows.set(bookmark.id, { row: row, checkbox: checkbox }); + rows.set(bookmark.id, { row: row, checkbox: checkbox, group: group }); list.append(row); }); return element("section", { className: "group" }, [ @@ -120,6 +120,12 @@ TABS.duplicates = (function() { item.checkbox.checked = deleting; item.row.classList.toggle("deleting", deleting); item.row.querySelector(".tag").textContent = deleting ? "Delete" : "Keep"; + // "Keep only this" is useless when this copy is already the only + // one kept: hide it, keeping its space so that rows stay aligned + var alreadyOnly = !deleting && item.group.bookmarks.every(function(b) { + return b.id == id || selected.has(b.id); + }); + item.row.querySelector(".keep-only").classList.toggle("useless", alreadyOnly); }); }