From a69a7531b6dce98ff5d8baff4039668be11be33d Mon Sep 17 00:00:00 2001 From: Alexandre Alapetite Date: Mon, 19 Oct 2020 11:38:27 +0200 Subject: Remember sidebar position (#3231) #fix https://github.com/FreshRSS/FreshRSS/issues/3209 Extracted from https://github.com/FreshRSS/FreshRSS/pull/3185 --- p/scripts/main.js | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'p/scripts') diff --git a/p/scripts/main.js b/p/scripts/main.js index ae44e9e32..6823f3119 100644 --- a/p/scripts/main.js +++ b/p/scripts/main.js @@ -697,6 +697,9 @@ function init_column_categories() { return; } + //Restore sidebar scroll position + document.getElementById('sidebar').scrollTop = +sessionStorage.getItem('FreshRSS_sidebar_scrollTop'); + document.getElementById('aside_feed').onclick = function (ev) { let a = ev.target.closest('.tree-folder > .tree-folder-title > a.dropdown-toggle'); if (a) { @@ -1562,6 +1565,10 @@ function init_normal() { faviconNbUnread(); window.onbeforeunload = function (e) { + const sidebar = document.getElementById('sidebar'); + if (sidebar) { //Save sidebar scroll position + sessionStorage.setItem('FreshRSS_sidebar_scrollTop', sidebar.scrollTop); + } if (mark_read_queue && mark_read_queue.length > 0) { return false; } -- cgit v1.2.3