mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-16 18:38:25 -07:00
Merge pull request #3941 from thornbill/defer-swiper
Defer loading of swiper until used
This commit is contained in:
commit
3e269bf3f4
@ -13,10 +13,6 @@ import './style.scss';
|
|||||||
import 'material-design-icons-iconfont';
|
import 'material-design-icons-iconfont';
|
||||||
import '../../elements/emby-button/paper-icon-button-light';
|
import '../../elements/emby-button/paper-icon-button-light';
|
||||||
import ServerConnections from '../ServerConnections';
|
import ServerConnections from '../ServerConnections';
|
||||||
//eslint-disable-next-line import/no-unresolved
|
|
||||||
import { Swiper } from 'swiper/bundle';
|
|
||||||
//eslint-disable-next-line import/no-unresolved
|
|
||||||
import 'swiper/css/bundle';
|
|
||||||
import screenfull from 'screenfull';
|
import screenfull from 'screenfull';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -345,6 +341,11 @@ export default function (options) {
|
|||||||
slides = currentOptions.items;
|
slides = currentOptions.items;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//eslint-disable-next-line import/no-unresolved
|
||||||
|
import('swiper/css/bundle');
|
||||||
|
|
||||||
|
// eslint-disable-next-line import/no-unresolved
|
||||||
|
import('swiper/bundle').then(({ Swiper }) => {
|
||||||
swiperInstance = new Swiper(dialog.querySelector('.slideshowSwiperContainer'), {
|
swiperInstance = new Swiper(dialog.querySelector('.slideshowSwiperContainer'), {
|
||||||
direction: 'horizontal',
|
direction: 'horizontal',
|
||||||
// Loop is disabled due to the virtual slides option not supporting it.
|
// Loop is disabled due to the virtual slides option not supporting it.
|
||||||
@ -384,6 +385,7 @@ export default function (options) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (swiperInstance.autoplay?.running) onAutoplayStart();
|
if (swiperInstance.autoplay?.running) onAutoplayStart();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -6,10 +6,6 @@ import keyboardnavigation from '../../scripts/keyboardNavigation';
|
|||||||
import { appRouter } from '../../components/appRouter';
|
import { appRouter } from '../../components/appRouter';
|
||||||
import ServerConnections from '../../components/ServerConnections';
|
import ServerConnections from '../../components/ServerConnections';
|
||||||
import * as userSettings from '../../scripts/settings/userSettings';
|
import * as userSettings from '../../scripts/settings/userSettings';
|
||||||
//eslint-disable-next-line import/no-unresolved
|
|
||||||
import { Swiper } from 'swiper/bundle';
|
|
||||||
//eslint-disable-next-line import/no-unresolved
|
|
||||||
import 'swiper/css/bundle';
|
|
||||||
|
|
||||||
import './style.scss';
|
import './style.scss';
|
||||||
|
|
||||||
@ -292,7 +288,13 @@ export class ComicsPlayer {
|
|||||||
const downloadUrl = apiClient.getItemDownloadUrl(item.Id);
|
const downloadUrl = apiClient.getItemDownloadUrl(item.Id);
|
||||||
this.archiveSource = new ArchiveSource(downloadUrl);
|
this.archiveSource = new ArchiveSource(downloadUrl);
|
||||||
|
|
||||||
return this.archiveSource.load().then(() => {
|
//eslint-disable-next-line import/no-unresolved
|
||||||
|
import('swiper/css/bundle');
|
||||||
|
|
||||||
|
return this.archiveSource.load()
|
||||||
|
// eslint-disable-next-line import/no-unresolved
|
||||||
|
.then(() => import('swiper/bundle'))
|
||||||
|
.then(({ Swiper }) => {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
this.pageCount = this.archiveSource.urls.length;
|
this.pageCount = this.archiveSource.urls.length;
|
||||||
|
Loading…
Reference in New Issue
Block a user