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

Migrated src/components/backdropscreensaver/plugin.js

This commit is contained in:
Cromefire_ 2020-04-15 10:16:41 +02:00
parent 553bbee6fe
commit 1b4c178790
No known key found for this signature in database
GPG key ID: D3D3DB179F435F0C

View file

@ -1,36 +1,32 @@
define(['connectionManager'], function (connectionManager) {
/* eslint-disable indent */
import connectionManager from "connectionManager";
return function () {
var self = this;
self.name = 'Backdrop ScreenSaver';
self.type = 'screensaver';
self.id = 'backdropscreensaver';
self.supportsAnonymous = false;
var currentSlideshow;
self.show = function () {
var query = {
ImageTypes: 'Backdrop',
EnableImageTypes: 'Backdrop',
IncludeItemTypes: 'Movie,Series,MusicArtist',
SortBy: 'Random',
class BackdropScreensaver {
constructor() {
this.name = "Backdrop ScreenSaver";
this.type = "screensaver";
this.id = "backdropscreensaver";
this.supportsAnonymous = false;
}
show() {
const query = {
ImageTypes: "Backdrop",
EnableImageTypes: "Backdrop",
IncludeItemTypes: "Movie,Series,MusicArtist",
SortBy: "Random",
Recursive: true,
Fields: 'Taglines',
Fields: "Taglines",
ImageTypeLimit: 1,
StartIndex: 0,
Limit: 200
};
var apiClient = connectionManager.currentApiClient();
const apiClient = connectionManager.currentApiClient();
apiClient.getItems(apiClient.getCurrentUserId(), query).then(function (result) {
if (result.Items.length) {
require(['slideshow'], function (slideshow) {
import("slideshow").then(slideshow => {
var newSlideShow = new slideshow({
showTitle: true,
@ -39,18 +35,19 @@ define(['connectionManager'], function (connectionManager) {
});
newSlideShow.show();
currentSlideshow = newSlideShow;
});
this.currentSlideshow = newSlideShow;
}).catch(console.error);
}
});
};
}
self.hide = function () {
if (currentSlideshow) {
currentSlideshow.hide();
currentSlideshow = null;
hide() {
if (this.currentSlideshow) {
this.currentSlideshow.hide();
this.currentSlideshow = null;
}
};
};
});
}
}
/* eslint-enable indent */
export default BackdropScreensaver;