From 6c6c8b1105e0cbbc8ab26f9fc5d19dda43361523 Mon Sep 17 00:00:00 2001 From: JP Hastings-Spital Date: Thu, 22 Feb 2024 18:22:31 +0000 Subject: [PATCH] Highlight links on scroll --- assets/js/menu.js | 7 ++++++ assets/scss/_links.scss | 8 +++---- assets/scss/_main.scss | 17 +++++++------- assets/scss/_single.scss | 22 +++++++++++++++++- content/bookmarks/a-primer-on-dopamine.md | 28 +++++++++++------------ 5 files changed, 55 insertions(+), 27 deletions(-) diff --git a/assets/js/menu.js b/assets/js/menu.js index 11c722c0..c581dfd2 100644 --- a/assets/js/menu.js +++ b/assets/js/menu.js @@ -10,6 +10,7 @@ const isMobileMenu = () => { menuTrigger && menuTrigger.classList.toggle("hidden", !isMobile()); menu && menu.classList.toggle("hidden", isMobile()); }; +const showLinks = (state) => document.querySelector('body').classList.toggle('show-links', state); isMobileMenu(); @@ -20,3 +21,9 @@ menuTrigger && ); window.addEventListener("resize", isMobileMenu); +window.addEventListener('scroll', () => { + showLinks(true); + + clearTimeout(this.scrollEndTimer); + this.scrollEndTimer = setTimeout(() => showLinks(false), 500); +}, false); diff --git a/assets/scss/_links.scss b/assets/scss/_links.scss index 6fbeb750..6c9830ff 100644 --- a/assets/scss/_links.scss +++ b/assets/scss/_links.scss @@ -1,11 +1,11 @@ -a[rel~="+agree"]:hover { +a[rel~="+agree"]:hover, .force-is-agree, .show-links article a[rel~="+agree"] { text-decoration-style: double; } -a[rel~="-agree"]:hover { +a[rel~="-agree"]:hover, .force-isnt-agree, .show-links article a[rel~="-agree"] { text-decoration-style: dotted; } -a[rel~="+accurate"]:hover { +a[rel~="+accurate"]:hover, .force-is-accurate, .show-links article a[rel~="+accurate"] { position: relative; &::after { @@ -15,7 +15,7 @@ a[rel~="+accurate"]:hover { content: "✓"; } } -a[rel~="-accurate"]:hover { +a[rel~="-accurate"]:hover, .force-isnt-accurate, .show-links article a[rel~="-accurate"] { position: relative; &::after { diff --git a/assets/scss/_main.scss b/assets/scss/_main.scss index 327ad24c..e5178d48 100644 --- a/assets/scss/_main.scss +++ b/assets/scss/_main.scss @@ -151,19 +151,20 @@ a:not(.noaccent) { color: lch(60% 60 var(--accentHue)); } - &:hover { - color: var(--accent); - - .daytime { - color: inherit; - } - } - transition-property: color, filter; transition-duration: .2s; transition-timing-function: ease-in; } +a:not(.noaccent):hover, .force-anchor, .show-links article a:not(.noaccent) { + color: var(--accent); + text-decoration: underline; + + .daytime { + color: inherit; + } +} + a.noaccent { text-decoration: none; } diff --git a/assets/scss/_single.scss b/assets/scss/_single.scss index 16dc0662..80d6aebe 100644 --- a/assets/scss/_single.scss +++ b/assets/scss/_single.scss @@ -482,12 +482,32 @@ figure { } } +details { + padding-bottom: 0.5em; + + &[open] { + padding-bottom: 0; + padding-left: 1em; + position: relative; + left: -1em; + border-left: 1px solid $dark-background-secondary; + + summary { + border-bottom: 1px solid $dark-background-secondary; + padding-bottom: 1em; + } + } + + summary { + cursor: pointer; + } +} + .interactions { details { summary { margin: 0; - cursor: pointer; list-style: none; &::marker, &::-webkit-details-marker { diff --git a/content/bookmarks/a-primer-on-dopamine.md b/content/bookmarks/a-primer-on-dopamine.md index bcf5e316..1419b44d 100644 --- a/content/bookmarks/a-primer-on-dopamine.md +++ b/content/bookmarks/a-primer-on-dopamine.md @@ -33,11 +33,11 @@ I’ve been (ha!) pleasantly surprised by how this article pulls lots of differe ### Highlights -> **The more interesting part is that dopamine (and hence desire) is intensified when we get positively surprised.** +> The more interesting part is that dopamine (and hence desire) is intensified when we get positively surprised. --- -> **our brain is constantly betting: which choice can lead to the highest gain for the minimum investment.** +> our brain is constantly betting: which choice can lead to the highest gain for the minimum investment. --- @@ -45,7 +45,7 @@ I’ve been (ha!) pleasantly surprised by how this article pulls lots of differe --- -> **You can imagine dopamine as signalling the [value of work](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4696912/).** +> You can imagine dopamine as signalling the [value of work](https://www.ncbi.nlm.nih.gov/pmc/articles/PMC4696912/). --- @@ -53,15 +53,15 @@ I’ve been (ha!) pleasantly surprised by how this article pulls lots of differe --- -> **It’s easy to confuse “liking” and “wanting”** +> It’s easy to confuse “liking” and “wanting” --- -> **If you’re addicted to something, you have an intense desire which fails to resolve into an equally intense pleasure.** +> If you’re addicted to something, you have an intense desire which fails to resolve into an equally intense pleasure. --- -> **desire is generated after encountering something rewarding.** +> desire is generated after encountering something rewarding. --- @@ -77,7 +77,7 @@ I’ve been (ha!) pleasantly surprised by how this article pulls lots of differe --- -> **The gap in knowledge about the reward generating process is intensely motivating** +> The gap in knowledge about the reward generating process is intensely motivating --- @@ -85,7 +85,7 @@ I’ve been (ha!) pleasantly surprised by how this article pulls lots of differe --- -> **Higher the surprise, higher the reward prediction error, higher the activity of dopamine neurons.** +> Higher the surprise, higher the reward prediction error, higher the activity of dopamine neurons. --- @@ -101,11 +101,11 @@ I’ve been (ha!) pleasantly surprised by how this article pulls lots of differe --- -> **it triggers many of the adaptive behaviors of learning, exploration and automaticity**. +> it triggers many of the adaptive behaviors of learning, exploration and automaticity. --- -> If you were expecting a reward and get exactly that, your brain doesn’t increase dopamine production. That’s because **there’s no point in optimizing things even further, since you got what you were expecting**. No further learning, exploration or automaticity is needed. +> If you were expecting a reward and get exactly that, your brain doesn’t increase dopamine production. That’s because there’s no point in optimizing things even further, since you got what you were expecting. No further learning, exploration or automaticity is needed. --- @@ -113,15 +113,15 @@ I’ve been (ha!) pleasantly surprised by how this article pulls lots of differe --- -> **we actively seek high-dopamine producing situations** +> we actively seek high-dopamine producing situations --- -> **we DON’T mind occasional lack of expected rewards as long as we get unexpected rewards.** +> we DON’T mind occasional lack of expected rewards as long as we get unexpected rewards. --- -> **For video games, dopamine’s behavior suggests that continuing to unseat expectations is _the_ key job.** +> For video games, dopamine’s behavior suggests that continuing to unseat expectations is _the_ key job. --- @@ -155,7 +155,7 @@ I don’t agree with the base premise here, I think this is inverted. You can se --- -> **we find it joyful to put in (some) effort to figure out a reward** +> we find it joyful to put in (some) effort to figure out a reward Additionally, from my time at Tesco working on Price Drop, if someone _doesn’t_ have to work to derive reward then it instantly becomes expectation, and pleasure can’t be derived from that source any more.