mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Fix sonarjs no-collapsible-if
This commit is contained in:
parent
ccdbf0bfc3
commit
1f4e65822b
33 changed files with 330 additions and 473 deletions
|
@ -289,34 +289,32 @@ class NavDrawer {
|
|||
setEdgeSwipeEnabled(enabled) {
|
||||
const options = this.options;
|
||||
|
||||
if (!options.disableEdgeSwipe) {
|
||||
if (browser.touch) {
|
||||
if (enabled) {
|
||||
if (!this._edgeSwipeEnabled) {
|
||||
this._edgeSwipeEnabled = true;
|
||||
dom.addEventListener(this.edgeContainer, 'touchstart', this.onEdgeTouchStart, {
|
||||
passive: true
|
||||
});
|
||||
dom.addEventListener(this.edgeContainer, 'touchend', this.onEdgeTouchEnd, {
|
||||
passive: true
|
||||
});
|
||||
dom.addEventListener(this.edgeContainer, 'touchcancel', this.onEdgeTouchEnd, {
|
||||
passive: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (this._edgeSwipeEnabled) {
|
||||
this._edgeSwipeEnabled = false;
|
||||
dom.removeEventListener(this.edgeContainer, 'touchstart', this.onEdgeTouchStart, {
|
||||
passive: true
|
||||
});
|
||||
dom.removeEventListener(this.edgeContainer, 'touchend', this.onEdgeTouchEnd, {
|
||||
passive: true
|
||||
});
|
||||
dom.removeEventListener(this.edgeContainer, 'touchcancel', this.onEdgeTouchEnd, {
|
||||
passive: true
|
||||
});
|
||||
}
|
||||
if (!options.disableEdgeSwipe && browser.touch) {
|
||||
if (enabled) {
|
||||
if (!this._edgeSwipeEnabled) {
|
||||
this._edgeSwipeEnabled = true;
|
||||
dom.addEventListener(this.edgeContainer, 'touchstart', this.onEdgeTouchStart, {
|
||||
passive: true
|
||||
});
|
||||
dom.addEventListener(this.edgeContainer, 'touchend', this.onEdgeTouchEnd, {
|
||||
passive: true
|
||||
});
|
||||
dom.addEventListener(this.edgeContainer, 'touchcancel', this.onEdgeTouchEnd, {
|
||||
passive: true
|
||||
});
|
||||
}
|
||||
} else {
|
||||
if (this._edgeSwipeEnabled) {
|
||||
this._edgeSwipeEnabled = false;
|
||||
dom.removeEventListener(this.edgeContainer, 'touchstart', this.onEdgeTouchStart, {
|
||||
passive: true
|
||||
});
|
||||
dom.removeEventListener(this.edgeContainer, 'touchend', this.onEdgeTouchEnd, {
|
||||
passive: true
|
||||
});
|
||||
dom.removeEventListener(this.edgeContainer, 'touchcancel', this.onEdgeTouchEnd, {
|
||||
passive: true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -279,10 +279,8 @@ const scrollerFactory = function (frame, options) {
|
|||
|
||||
const now = new Date().getTime();
|
||||
|
||||
if (o.autoImmediate) {
|
||||
if (!immediate && (now - (lastAnimate || 0)) <= 50) {
|
||||
immediate = true;
|
||||
}
|
||||
if (o.autoImmediate && !immediate && (now - (lastAnimate || 0)) <= 50) {
|
||||
immediate = true;
|
||||
}
|
||||
|
||||
if (!immediate && o.skipSlideToWhenVisible && fullItemPos && fullItemPos.isVisible) {
|
||||
|
@ -787,15 +785,13 @@ const scrollerFactory = function (frame, options) {
|
|||
passive: true
|
||||
});
|
||||
}
|
||||
} else if (o.horizontal) {
|
||||
} else if (o.horizontal && o.mouseWheel) {
|
||||
// Don't bind to mouse events with vertical scroll since the mouse wheel can handle this natively
|
||||
|
||||
if (o.mouseWheel) {
|
||||
// Scrolling navigation
|
||||
dom.addEventListener(scrollSource, wheelEvent, scrollHandler, {
|
||||
passive: true
|
||||
});
|
||||
}
|
||||
// Scrolling navigation
|
||||
dom.addEventListener(scrollSource, wheelEvent, scrollHandler, {
|
||||
passive: true
|
||||
});
|
||||
}
|
||||
|
||||
dom.addEventListener(frame, 'click', onFrameClick, {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue