Skip to content

Instantly share code, notes, and snippets.

@rosswintle
Created February 7, 2022 22:56
Show Gist options
  • Save rosswintle/92f534f0e0ab37d52b4df3b4bf8ebb45 to your computer and use it in GitHub Desktop.
Save rosswintle/92f534f0e0ab37d52b4df3b4bf8ebb45 to your computer and use it in GitHub Desktop.
Feedbin: Keep selected centered
// ==UserScript==
// @name Feedbin: Keep selected centered
// @namespace http://tampermonkey.net/
// @version 0.1
// @description Keeps the selected item vertically centered in Feedbin
// @author Ross Wintle
// @match https://feedbin.com/
// @icon https://www.google.com/s2/favicons?domain=feedbin.com
// @grant none
// ==/UserScript==
(function() {
'use strict';
document.addEventListener('keyup', function (ev) {
if (ev.key === 'ArrowDown' || ev.key === 'ArrowUp') {
let entry = document.querySelector( 'li.entry-summary.selected' );
let entryPos = entry.offsetTop;
let scrollTo = entryPos - (document.body.offsetHeight / 2) + (entry.offsetHeight / 2);
document.querySelector('.entries').scrollTo({
top: scrollTo,
left: 0,
behavior: 'smooth'
});
}
})
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment