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:
parent
553bbee6fe
commit
1b4c178790
1 changed files with 30 additions and 33 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue