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}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
1.2:
Reset scroll position when show notes change.