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

Migrate bundle, qualityOptions, appHost and appLoader

This commit is contained in:
MrTimscampi 2020-07-16 22:19:09 +02:00
parent 9640f13830
commit f16df9788a
39 changed files with 1075 additions and 723 deletions

View file

@ -27,16 +27,16 @@ export class BookPlayer {
this._loaded = false;
loading.show();
let elem = this.createMediaElement();
const elem = this.createMediaElement();
return this.setCurrentSrc(elem, options);
}
stop() {
this.unbindEvents();
let elem = this._mediaElement;
let tocElement = this._tocElement;
let rendition = this._rendition;
const elem = this._mediaElement;
const tocElement = this._tocElement;
const rendition = this._rendition;
if (elem) {
dialogHelper.close(elem);
@ -93,11 +93,9 @@ export class BookPlayer {
}
onWindowKeyUp(e) {
let key = keyboardnavigation.getKeyName(e);
// TODO: depending on the event this can be the document or the rendition itself
let rendition = this._rendition || this;
let book = rendition.book;
const key = keyboardnavigation.getKeyName(e);
const rendition = this._rendition;
const book = rendition.book;
if (this._loaded === false) return;
switch (key) {
@ -147,7 +145,7 @@ export class BookPlayer {
}
bindMediaElementEvents() {
let elem = this._mediaElement;
const elem = this._mediaElement;
elem.addEventListener('close', this.onDialogClosed, {once: true});
elem.querySelector('.btnBookplayerExit').addEventListener('click', this.onDialogClosed, {once: true});
@ -166,7 +164,7 @@ export class BookPlayer {
}
unbindMediaElementEvents() {
let elem = this._mediaElement;
const elem = this._mediaElement;
elem.removeEventListener('close', this.onDialogClosed);
elem.querySelector('.btnBookplayerExit').removeEventListener('click', this.onDialogClosed);
@ -231,7 +229,7 @@ export class BookPlayer {
}
setCurrentSrc(elem, options) {
let item = options.items[0];
const item = options.items[0];
this._currentItem = item;
this.streamInfo = {
started: true,
@ -241,25 +239,25 @@ export class BookPlayer {
}
};
let serverId = item.ServerId;
let apiClient = connectionManager.getApiClient(serverId);
const serverId = item.ServerId;
const apiClient = connectionManager.getApiClient(serverId);
return new Promise((resolve, reject) => {
import('epubjs').then(({default: epubjs}) => {
let downloadHref = apiClient.getItemDownloadUrl(item.Id);
let book = epubjs(downloadHref, {openAs: 'epub'});
let rendition = book.renderTo(elem, {width: '100%', height: '97%'});
const downloadHref = apiClient.getItemDownloadUrl(item.Id);
const book = epubjs(downloadHref, {openAs: 'epub'});
const rendition = book.renderTo(elem, {width: '100%', height: '97%'});
this._currentSrc = downloadHref;
this._rendition = rendition;
let cancellationToken = {
const cancellationToken = {
shouldCancel: false
};
this._cancellationToken = cancellationToken;
return rendition.display().then(() => {
let epubElem = document.querySelector('.epub-container');
const epubElem = document.querySelector('.epub-container');
epubElem.style.display = 'none';
this.bindEvents();