Highlight links on scroll

This commit is contained in:
JP Hastings-Spital 2024-02-22 18:22:31 +00:00
parent 233e7c35af
commit 6c6c8b1105
5 changed files with 55 additions and 27 deletions

View file

@ -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);

View file

@ -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 {

View file

@ -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;
}

View file

@ -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 {

View file

@ -33,11 +33,11 @@ Ive 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 @@ Ive 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 @@ Ive been (ha!) pleasantly surprised by how this article pulls lots of differe
---
> **Its easy to confuse “liking” and “wanting”**
> Its easy to confuse “liking” and “wanting”
---
> **If youre addicted to something, you have an intense desire which fails to resolve into an equally intense pleasure.**
> If youre 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 @@ Ive 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 @@ Ive 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 @@ Ive 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 doesnt increase dopamine production. Thats because **theres 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 doesnt increase dopamine production. Thats because theres 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 @@ Ive 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 DONT mind occasional lack of expected rewards as long as we get unexpected rewards.**
> we DONT mind occasional lack of expected rewards as long as we get unexpected rewards.
---
> **For video games, dopamines behavior suggests that continuing to unseat expectations is _the_ key job.**
> For video games, dopamines behavior suggests that continuing to unseat expectations is _the_ key job.
---
@ -155,7 +155,7 @@ I dont 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 _doesnt_ have to work to derive reward then it instantly becomes expectation, and pleasure cant be derived from that source any more.