From e1dd0185c207c3d94124189e6c1d4d79293c0e4d Mon Sep 17 00:00:00 2001 From: Howard Chiam Date: Tue, 3 Sep 2024 16:31:52 -0600 Subject: [PATCH 1/2] enhance hilite bookmark to toggle in case of mistakes 1/2 --- bookmarklets/highlightScrollWhatYouClick.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bookmarklets/highlightScrollWhatYouClick.js b/bookmarklets/highlightScrollWhatYouClick.js index 91a8573..eb2d1e2 100644 --- a/bookmarklets/highlightScrollWhatYouClick.js +++ b/bookmarklets/highlightScrollWhatYouClick.js @@ -5,9 +5,14 @@ javascript: (function () { x.addEventListener("click", (e) => { if (window.highlightWhatYouClick) { e.stopPropagation(); - x.style.background = "gold"; - x.style.color = "black"; - x.nextElementSibling?.scrollIntoView({ behavior: "smooth" }); + if (x.style.background !== "gold") { + x.style.background = "gold"; + x.style.color = "black"; + x.nextElementSibling?.scrollIntoView({ behavior: "smooth" }); + } else { + x.style.background = ""; + x.style.color = ""; + } } }); let outline = x.style.outline; From 92a7e1fe532770087b47f550de318ea4f8b5543b Mon Sep 17 00:00:00 2001 From: Howard Chiam Date: Tue, 3 Sep 2024 16:33:38 -0600 Subject: [PATCH 2/2] enhance hilite bookmark to toggle in case of mistakes 2/2 --- bookmarklets/highlightWhatYouClick.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/bookmarklets/highlightWhatYouClick.js b/bookmarklets/highlightWhatYouClick.js index bfb492a..8552f14 100644 --- a/bookmarklets/highlightWhatYouClick.js +++ b/bookmarklets/highlightWhatYouClick.js @@ -5,8 +5,13 @@ javascript: (function () { x.addEventListener("click", (e) => { if (window.highlightWhatYouClick) { e.stopPropagation(); - x.style.background = "gold"; - x.style.color = "black"; + if (x.style.background !== "gold") { + x.style.background = "gold"; + x.style.color = "black"; + } else { + x.style.background = ""; + x.style.color = ""; + } } }); let outline = x.style.outline;