Last active
July 21, 2019 18:29
-
-
Save cuylerstuwe/8d1b73d2cf14ba012039ac844d0c79c6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==UserScript== | |
// @name Syntax.FM - Sticky Show Notes | |
// @namespace salembeats | |
// @version 1.2 | |
// @description UPDATE: Reset scroll position when show notes change. | |
// @author Cuyler Stuwe (salembeats) | |
// @include https://syntax.fm/* | |
// @grant none | |
// ==/UserScript== | |
const topOffset = "102px"; | |
const showNotesEl = document.querySelector(".showNotes"); | |
showNotesEl.style = ` | |
position: sticky; | |
top: ${topOffset}; | |
height: calc(100vh - ${topOffset}); | |
overflow-y: scroll; | |
`; | |
new MutationObserver(mutations => { | |
showNotesEl.scrollTop = 0; | |
}).observe(showNotesEl, {childList: true, subtree: true}); |
1.1:
Fix include path, so that the script always triggers when necessary.
1.2:
Reset scroll position when show notes change.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Problem
On Syntax.FM's website, it is incredibly tedious to see show notes for old episodes.
This is what you see when you scroll to an old episode:
The problem is caused by the list of show notes and the list of episodes scrolling simultaneously with one another (sharing a single scroll bar).
Solution
This userscript adds a handful of styles to the show notes div so that it has its own independent scroll bar, and follows the page as it scrolls.
Here's what the same episode looks like with this userscript enabled: