1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Fix compatibility with older browsers (webOS 2/3)

This commit is contained in:
Dmitry Lyzo 2019-10-22 22:19:43 +03:00
parent cbd64f6b4e
commit c0fbce32ce

View file

@ -1,7 +1,7 @@
define(["dom", "browser", "layoutManager"], function (dom, browser, layoutManager) { define(["dom", "browser", "layoutManager"], function (dom, browser, layoutManager) {
"use strict"; "use strict";
const ScrollTime = 200; var ScrollTime = 200;
// FIXME: Need to scroll to top of page to fully show the top menu. This can be solved by some marker of top most elements or their containers // FIXME: Need to scroll to top of page to fully show the top menu. This can be solved by some marker of top most elements or their containers
var _minimumScrollY = 0; var _minimumScrollY = 0;
@ -210,19 +210,14 @@ define(["dom", "browser", "layoutManager"], function (dom, browser, layoutManage
} }
/** /**
* Performs scroll. * Performs animated scroll.
* *
* @param {HTMLElement} xScroller horizontal scroller * @param {HTMLElement} xScroller horizontal scroller
* @param {number} scrollX horizontal coordinate * @param {number} scrollX horizontal coordinate
* @param {HTMLElement} yScroller vertical scroller * @param {HTMLElement} yScroller vertical scroller
* @param {number} scrollY vertical coordinate * @param {number} scrollY vertical coordinate
* @param {boolean} smooth smooth scrolling
*/ */
function doScroll(xScroller, scrollX, yScroller, scrollY, smooth) { function animateScroll(xScroller, scrollX, yScroller, scrollY) {
resetScrollTimer();
if (smooth && useAnimatedScroll()) {
var start; var start;
function scrollAnim(currentTimestamp) { function scrollAnim(currentTimestamp) {
@ -250,6 +245,23 @@ define(["dom", "browser", "layoutManager"], function (dom, browser, layoutManage
}; };
scrollTimer = requestAnimationFrame(scrollAnim); scrollTimer = requestAnimationFrame(scrollAnim);
}
/**
* Performs scroll.
*
* @param {HTMLElement} xScroller horizontal scroller
* @param {number} scrollX horizontal coordinate
* @param {HTMLElement} yScroller vertical scroller
* @param {number} scrollY vertical coordinate
* @param {boolean} smooth smooth scrolling
*/
function doScroll(xScroller, scrollX, yScroller, scrollY, smooth) {
resetScrollTimer();
if (smooth && useAnimatedScroll()) {
animateScroll(xScroller, scrollX, yScroller, scrollY);
} else { } else {
var scrollBehavior = smooth ? "smooth" : "instant"; var scrollBehavior = smooth ? "smooth" : "instant";