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

made some otimizations in nowPlayingBar.js

minor fixes in youtubePlayer plugin
This commit is contained in:
vitorsemeano 2020-11-08 11:00:57 +00:00
parent 383c0d2cc4
commit 8a41247491
2 changed files with 29 additions and 38 deletions

View file

@ -11,6 +11,10 @@ import itemContextMenu from '../itemContextMenu';
import '../../elements/emby-button/paper-icon-button-light';
import '../../elements/emby-ratingbutton/emby-ratingbutton';
import ServerConnections from '../ServerConnections';
import appFooter from '../appFooter/appFooter';
import itemShortcuts from '../shortcuts';
import './nowPlayingBar.css';
import '../../elements/emby-slider/emby-slider';
/* eslint-disable indent */
@ -252,23 +256,14 @@ import ServerConnections from '../ServerConnections';
let nowPlayingBarElement;
function getNowPlayingBar() {
if (nowPlayingBarElement) {
return Promise.resolve(nowPlayingBarElement);
return nowPlayingBarElement;
}
return new Promise(function (resolve, reject) {
Promise.all([
import('../appFooter/appFooter'),
import('../shortcuts'),
import('./nowPlayingBar.css'),
import('../../elements/emby-slider/emby-slider')
])
.then(([appfooter, itemShortcuts]) => {
const parentContainer = appfooter.element;
const parentContainer = appFooter.element;
nowPlayingBarElement = parentContainer.querySelector('.nowPlayingBar');
if (nowPlayingBarElement) {
resolve(nowPlayingBarElement);
return;
return nowPlayingBarElement;
}
parentContainer.insertAdjacentHTML('afterbegin', getNowPlayingBarHtml());
@ -287,9 +282,8 @@ import ServerConnections from '../ServerConnections';
itemShortcuts.on(nowPlayingBarElement);
bindEvents(nowPlayingBarElement);
resolve(nowPlayingBarElement);
});
});
return nowPlayingBarElement;
}
function showButton(button) {
@ -621,7 +615,7 @@ import ServerConnections from '../ServerConnections';
return;
}
getNowPlayingBar().then(slideUp);
slideUp(getNowPlayingBar());
}
function hideNowPlayingBar() {
@ -682,9 +676,8 @@ import ServerConnections from '../ServerConnections';
return;
}
getNowPlayingBar().then(function () {
getNowPlayingBar();
updatePlayerStateInternal(event, state, player);
});
}
function onTimeUpdate(e) {

View file

@ -114,9 +114,7 @@ function onPlaying(instance, playOptions, resolve) {
instance.videoDialog.classList.remove('onTop');
}
import('../../components/loading/loading').then(({default: loading}) => {
loading.hide();
});
}
}
@ -130,7 +128,7 @@ function setCurrentSrc(instance, elem, options) {
instance.currentYoutubePlayer = new YT.Player('player', {
height: instance.videoDialog.offsetHeight,
width: instance.videoDialog.offsetWidth,
videoId: params.v,
videoId: params.get('v'),
events: {
'onReady': onPlayerReady,
'onStateChange': function (event) {