src/dynamics/video_player/sidebar/sidebar.js
File sidebar.js
has 475 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
Scoped.define("module:VideoPlayer.Dynamics.Sidebar", [
"dynamics:Dynamic",
"base:Objs",
"base:Async",
"base:Types",
Function setNextVideoIndex
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setNextVideoIndex: function(triggerNext) {
triggerNext = triggerNext || false;
let nextVideo, videoFromTop, indexFromTop, nextIndex = null;
const currentVideo = this.__getCurrentVideo();
const currentIndex = currentVideo?.get("index");
Function showplaylist:playlist
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
"showplaylist:playlist": function(playlist) {
if (!playlist) return false;
const showSidebar = playlist.length > 0;
if (!showSidebar) return false;
const videos = this.get("videos");
Function __generateCompanionAdContent
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
__generateCompanionAdContent: function(companionads) {
companionads = companionads || this.get("companionads");
if (companionads && companionads.length > 0) {
const isMobile = this.get("mobileviewport");
if (
Function initSidebarGallery
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initSidebarGallery: function() {
this.set("states.gallerysidebar", this.get("gallerysidebar"));
if (this.get("adsplaying")) return;
this.__sidebarGalleryInited = true;
Consider simplifying this complex logical expression. Open
Open
if (
(this.get("floatingoptions.desktop.companionad") && !isMobile) ||
(this.get("floatingoptions.mobile.companionad") && isMobile) ||
(this.get("gallerysidebar") && this.get("sidebaroptions.showcompanionad") && !isMobile)
) {
Avoid deeply nested control flow statements. Open
Open
if (this.__dyn.__listeningOnPlayNext) {
this.__dyn.trigger("play_next");
} else {
// TODO: need to be improved, this part runs only if first video from the playlist has error
this.__dyn.setAll({
Function __drawCompanionAdToContainer
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
__drawCompanionAdToContainer: function(container, companionAd, dimensions, ar, _ar) {
TODO found Open
Open
// TODO: need to be improved, this part runs only if first video from the playlist has error
- Exclude checks
TODO found Open
Open
// TODO: in the future could be better replace Async.eventually calling in the adsplaying change event to MutationObserver
- Exclude checks