-
Notifications
You must be signed in to change notification settings - Fork 1
/
custom.example.js
42 lines (39 loc) · 1.2 KB
/
custom.example.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
(() => {
/**
* @typedef CustomWindow
* @property {(movie: Movie) => boolean} [movieLibraryFilter]
* @property {(movieA: Movie, movieB: Movie) => number} [movieLibrarySort]
*/
/**
* @typedef Movie
* @property {string} title
* @property {string} titleSortStr
* @property {string} setName
* @property {string} setNameSortStr
* @property {string} year
* @property {string} premiereDateISOStr
* @property {string} plot
* @property {string} tagline
* @property {string} rating
* @property {string[]} genres
* @property {string[]} directorNames
* @property {string[]} actorNames
* @property {boolean} hasSubtitles
* @property {number} runtimeMinutes
* @property {string} thumbURL
* @property {string} logoURL
* @property {string} keyartURL
* @property {string} videoFilepath
*/
/** @type {CustomWindow} */
const cwindow = {
movieLibraryFilter: (movie) => ['Rated G', 'Rated PG'].includes(movie.rating),
// Sort movies in sets by release date.
movieLibrarySort: (a, b) => (
a.setName === b.setName
? a.premiereDateISOStr.localeCompare(b.premiereDateISOStr)
: (a.setNameSortStr || a.titleSortStr).localeCompare(b.setNameSortStr || b.titleSortStr)
)
};
Object.assign(window, cwindow);
})();