Skip to content

Instantly share code, notes, and snippets.

@cuylerstuwe
Last active July 21, 2019 18:29
Show Gist options
  • Save cuylerstuwe/8d1b73d2cf14ba012039ac844d0c79c6 to your computer and use it in GitHub Desktop.
Save cuylerstuwe/8d1b73d2cf14ba012039ac844d0c79c6 to your computer and use it in GitHub Desktop.
// ==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});
@cuylerstuwe
Copy link
Author

1.1:

Fix include path, so that the script always triggers when necessary.

@cuylerstuwe
Copy link
Author

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