Просмотр исходного кода

Remove simple-scrollbar fallback (#2182)

https://github.com/FreshRSS/FreshRSS/pull/2181#issuecomment-447636787
Alexandre Alapetite 7 лет назад
Родитель
Сommit
e0e96d6a13

+ 0 - 1
README.fr.md

@@ -209,7 +209,6 @@ Tout client supportant une API de type Fever ; Sélection :
 ## Uniquement pour certaines options ou configurations
 * [bcrypt.js](https://github.com/dcodeIO/bcrypt.js)
 * [phpQuery](https://github.com/phpquery/phpquery)
-* [simple-scrollbar](https://github.com/buzinas/simple-scrollbar)
 
 ## Si les fonctions natives ne sont pas disponibles
 * [Services_JSON](https://pear.php.net/pepr/pepr-proposal-show.php?id=198)

+ 0 - 1
README.md

@@ -209,7 +209,6 @@ Supported clients are:
 ## Only for some options or configurations
 * [bcrypt.js](https://github.com/dcodeIO/bcrypt.js)
 * [phpQuery](https://github.com/phpquery/phpquery)
-* [simple-scrollbar](https://github.com/buzinas/simple-scrollbar)
 
 ## If native functions are not available
 * [Services_JSON](https://pear.php.net/pepr/pepr-proposal-show.php?id=198)

+ 4 - 67
p/scripts/main.js

@@ -1,5 +1,5 @@
 "use strict";
-/* globals $, jQuery, context, i18n, shortcut, shortcuts, SimpleScrollbar, url */
+/* globals $, jQuery, context, i18n, shortcut, shortcuts, url */
 /* jshint strict:global */
 
 var $stream = null,
@@ -527,14 +527,6 @@ function init_posts() {
 	}
 }
 
-function inject_script(name) {
-	var script = document.createElement('script');
-	script.async = 'async';
-	script.defer = 'defer';
-	script.src = '../scripts/' + name;
-	document.head.appendChild(script);
-}
-
 function init_column_categories() {
 	if (context.current_view !== 'normal' && context.current_view !== 'reader') {
 		return;
@@ -551,15 +543,13 @@ function init_column_categories() {
 			}
 		});
 		$(this).parent().next(".tree-folder-items").slideToggle(300, function () {
-			if (!useJsScrollbar &&	//Workaround for Gecko bug in Firefox 64-65(+?):
-				sidebar.scrollHeight > sidebar.clientHeight &&	//if needs scrollbar
+			//Workaround for Gecko bug in Firefox 64-65(+?):
+			var sidebar = document.getElementById('sidebar');
+			if (sidebar && 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 scrollbar
-				sidebar.querySelector('.ss-content').dispatchEvent(new Event('scroll'));
-			}
 		});
 		return false;
 	});
@@ -1280,58 +1270,6 @@ function init_crypto_form() {
 }
 //</crypto form (Web login)>
 
-var sidebar = document.getElementById('sidebar');
-var useJsScrollbar = true;
-try {
-	/*jshint -W018 */
-	useJsScrollbar = sidebar && !CSS.supports('scrollbar-color: auto') &&
-		!(parseInt(getComputedStyle(sidebar, '::-webkit-scrollbar').width) < sidebar.scrollWidth);
-	/*jshint +W018 */
-} catch (ex) {
-}
-if (useJsScrollbar) {
-	inject_script('simple-scrollbar.min.js');
-}
-
-function sticky_recalc() {
-	var h = 0;
-	if ($nav_entries && $nav_entries.length > 0) {
-		h = $(window).height() - sidebar.getBoundingClientRect().top - $nav_entries.height();
-	} else {
-		h = $(window).height() - sidebar.getBoundingClientRect().top;
-	}
-	if (h > 0) {
-		$(sidebar).height(h);
-	}
-}
-
-function init_simple_scrollbar() {
-	if (!window.SimpleScrollbar) {
-		if (window.console) {
-			console.log('FreshRSS waiting for simple-scrollbar…');
-		}
-		window.setTimeout(init_simple_scrollbar, 100);
-	} else {
-		SimpleScrollbar.initEl(sidebar);
-	}
-}
-
-var scrollTimeout;
-function init_sticky_sidebar(){
-	if (!useJsScrollbar) {
-		return;
-	}
-	init_simple_scrollbar();
-	$(window).scroll(function () {
-		if (scrollTimeout) {
-			clearTimeout(scrollTimeout);
-			scrollTimeout = null;
-		}
-		scrollTimeout = setTimeout(sticky_recalc, 200);
-	});
-	window.onresize = sticky_recalc;
-}
-
 function init_confirm_action() {
 	$('body').on('click', '.confirm', function () {
 		var str_confirmation = $(this).attr('data-str-confirm');
@@ -1597,7 +1535,6 @@ function init_afterDOM() {
 	$stream = $('#stream');
 	if ($stream.length > 0) {
 		init_load_more($stream);
-		init_sticky_sidebar();
 		init_posts();
 		init_nav_entries();
 		init_dynamic_tags();

Разница между файлами не показана из-за своего большого размера
+ 0 - 1
p/scripts/simple-scrollbar.min.js


+ 0 - 7
p/themes/BlueLagoon/BlueLagoon.css

@@ -574,13 +574,6 @@ a.btn {
 		scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.0);
 	}
 }
-.ss-scroll {
-	background: rgba(255, 255, 255, 0.1);
-}
-.ss-container:hover .ss-scroll,
-.ss-container:active .ss-scroll {
-	background: rgba(255, 255, 255, 0.3);
-}
 @supports not (scrollbar-width: thin) {
 	#sidebar::-webkit-scrollbar-thumb {
 		background: rgba(255, 255, 255, 0.1);

+ 0 - 7
p/themes/Dark/dark.css

@@ -511,13 +511,6 @@ a.btn {
 		scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.0);
 	}
 }
-.ss-scroll {
-	background: rgba(255, 255, 255, 0.1);
-}
-.ss-container:hover .ss-scroll,
-.ss-container:active .ss-scroll {
-	background: rgba(255, 255, 255, 0.3);
-}
 @supports not (scrollbar-width: thin) {
 	#sidebar::-webkit-scrollbar-thumb {
 		background: rgba(255, 255, 255, 0.1);

+ 0 - 7
p/themes/Flat/flat.css

@@ -514,13 +514,6 @@ a.btn {
 		scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.0);
 	}
 }
-.ss-scroll {
-	background: rgba(255, 255, 255, 0.1);
-}
-.ss-container:hover .ss-scroll,
-.ss-container:active .ss-scroll {
-	background: rgba(255, 255, 255, 0.3);
-}
 @supports not (scrollbar-width: thin) {
 	#sidebar::-webkit-scrollbar-thumb {
 		background: rgba(255, 255, 255, 0.1);

+ 0 - 7
p/themes/Screwdriver/screwdriver.css

@@ -568,13 +568,6 @@ a.btn {
 		scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.0);
 	}
 }
-.ss-scroll {
-	background: rgba(255, 255, 255, 0.1);
-}
-.ss-container:hover .ss-scroll,
-.ss-container:active .ss-scroll {
-	background: rgba(255, 255, 255, 0.3);
-}
 @supports not (scrollbar-width: thin) {
 	#sidebar::-webkit-scrollbar-thumb {
 		background: rgba(255, 255, 255, 0.1);

+ 0 - 8
p/themes/Swage/swage.css

@@ -538,14 +538,6 @@ scrollbar-color: rgba(255, 255, 255, 0.3) rgba(0, 0, 0, 0.0);
 }
 }
 
-.ss-scroll {
-background: rgba(255, 255, 255, 0.1);
-}
-.ss-container:hover .ss-scroll,
-.ss-container:active .ss-scroll {
-background: rgba(255, 255, 255, 0.3);
-}
-
 @supports not (scrollbar-width: thin) {
 #sidebar::-webkit-scrollbar-thumb {
 background: rgba(255, 255, 255, 0.1);

+ 0 - 8
p/themes/Swage/swage.scss

@@ -612,14 +612,6 @@ form {
 	}
 }
 
-.ss-scroll {
-	background: rgba(255, 255, 255, 0.1);
-}
-.ss-container:hover .ss-scroll,
-.ss-container:active .ss-scroll {
-	background: rgba(255, 255, 255, 0.3);
-}
-
 @supports not (scrollbar-width: thin) {
 	#sidebar::-webkit-scrollbar-thumb {
 		background: rgba(255, 255, 255, 0.1);

+ 0 - 51
p/themes/base-theme/template.css

@@ -382,57 +382,6 @@ a.btn {
 }
 
 /*=== Scrollbar */
-.ss-wrapper {
-	overflow: hidden;
-	width: 100%;
-	height: 100%;
-	position: relative;
-	z-index: 1;
-	float: left;
-}
-
-.ss-content {
-	height: 100%;
-	width: calc(100% + 18px);
-	padding: 0 0 0 0;
-	position: relative;
-	overflow-y: scroll;
-	box-sizing: border-box;
-}
-
-.ss-content.rtl {
-	width: calc(100% + 18px);
-	right: auto;
-}
-
-.ss-scroll {
-	position: relative;
-	background: rgba(0, 0, 0, 0.1);
-	width: 9px;
-	border-radius: 4px;
-	top: 0;
-	z-index: 2;
-	cursor: pointer;
-	transition: opacity 0.25s linear;
-}
-
-.ss-hidden {
-	display: none;
-}
-
-.ss-container:hover .ss-scroll,
-.ss-container:active .ss-scroll {
-	background: rgba(0, 0, 0, 0.3);
-}
-
-.ss-grabbed {
-	-o-user-select: none;
-	-ms-user-select: none;
-	-moz-user-select: none;
-	-webkit-user-select: none;
-	user-select: none;
-}
-
 @supports (scrollbar-width: thin) {
 	#sidebar {
 		overflow-y: auto;

Некоторые файлы не были показаны из-за большого количества измененных файлов