A free, self-hostable news aggregator…
JavaScript-free scrollbar (#2181)
Alexandre Alapetite483c698f9a75
diff --git a/p/scripts/main.js b/p/scripts/main.jsindex 6331efc75..c8d520ef7 100644--- a/p/scripts/main.js+++ b/p/scripts/main.js@@ -551,7 +551,13 @@ function init_column_categories() {}});$(this).parent().next(".tree-folder-items").slideToggle(300, function () {- if (useJsScrollbar && sidebar && typeof(Event) === 'function') { //Refresh JS scrollbar+ if (!useJsScrollbar && //Workaround for Gecko bug in Firefox 64-65(+?):+ sidebar.scrollHeight > sidebar.clientHeight && //if needs scrollbar+ sidebar.scrollWidth >= sidebar.offsetWidth) { //but no scrollbar+ sidebar.style['overflow-y'] = 'scroll'; //then force scrollbar+ setTimeout(function () { sidebar.style['overflow-y'] = ''; }, 0);+ }+ if (useJsScrollbar && typeof(Event) === 'function') { //Refresh JS scrollbarsidebar.querySelector('.ss-content').dispatchEvent(new Event('scroll'));}});@@ -1279,7 +1285,7 @@ var useJsScrollbar = true;try {/*jshint -W018 */useJsScrollbar = sidebar && !CSS.supports('scrollbar-color: auto') &&- !(parseInt(getComputedStyle(sidebar, '::-webkit-scrollbar').width) < sidebar.offsetWidth);+ !(parseInt(getComputedStyle(sidebar, '::-webkit-scrollbar').width) < sidebar.scrollWidth);/*jshint +W018 */} catch (ex) {}@@ -1312,12 +1318,10 @@ function init_simple_scrollbar() {var scrollTimeout;function init_sticky_sidebar(){- if (!sidebar) {+ if (!useJsScrollbar) {return;}- if (useJsScrollbar) {- init_simple_scrollbar();- }+ init_simple_scrollbar();$(window).scroll(function () {if (scrollTimeout) {clearTimeout(scrollTimeout);diff --git a/p/themes/base-theme/template.css b/p/themes/base-theme/template.cssindex 7ffce3530..86c985d0c 100644--- a/p/themes/base-theme/template.css+++ b/p/themes/base-theme/template.css@@ -435,7 +435,7 @@ a.btn {@supports (scrollbar-width: thin) {#sidebar {- overflow-y: scroll;+ overflow-y: auto;scrollbar-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.05);scrollbar-width: thin;}@@ -462,6 +462,7 @@ a.btn {/*=== Tree */.tree {margin: 0;+ max-height: 99vh;list-style: none;text-align: left;overflow-x: hidden;@@ -496,7 +497,7 @@ a.btn {}.tree-bottom {visibility: hidden;- margin-bottom: 15em;+ margin-bottom: 18em;}/*=== STRUCTURE */@@ -536,7 +537,6 @@ a.btn {}.aside {display: table-cell;- height: 100%;width: 300px;vertical-align: top;}