Sfoglia il codice sorgente

Remember sidebar position (#3231)

#fix https://github.com/FreshRSS/FreshRSS/issues/3209
Extracted from https://github.com/FreshRSS/FreshRSS/pull/3185
Alexandre Alapetite 5 anni fa
parent
commit
a69a7531b6
1 ha cambiato i file con 7 aggiunte e 0 eliminazioni
  1. 7 0
      p/scripts/main.js

+ 7 - 0
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;
 		}