mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge remote-tracking branch 'upstream/master' into another-es6-pr
This commit is contained in:
commit
0feb4f1e36
199 changed files with 8972 additions and 9527 deletions
|
@ -2,4 +2,3 @@ node_modules
|
||||||
dist
|
dist
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
src/libraries
|
|
||||||
|
|
46
package.json
46
package.json
|
@ -6,8 +6,8 @@
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.11.1",
|
"@babel/core": "^7.11.1",
|
||||||
"@babel/eslint-parser": "^7.11.0",
|
"@babel/eslint-parser": "^7.11.3",
|
||||||
"@babel/eslint-plugin": "^7.11.0",
|
"@babel/eslint-plugin": "^7.11.3",
|
||||||
"@babel/plugin-proposal-class-properties": "^7.10.1",
|
"@babel/plugin-proposal-class-properties": "^7.10.1",
|
||||||
"@babel/plugin-proposal-private-methods": "^7.10.1",
|
"@babel/plugin-proposal-private-methods": "^7.10.1",
|
||||||
"@babel/plugin-transform-modules-amd": "^7.10.5",
|
"@babel/plugin-transform-modules-amd": "^7.10.5",
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
"babel-loader": "^8.0.6",
|
"babel-loader": "^8.0.6",
|
||||||
"browser-sync": "^2.26.12",
|
"browser-sync": "^2.26.12",
|
||||||
"copy-webpack-plugin": "^5.1.1",
|
"copy-webpack-plugin": "^5.1.1",
|
||||||
"css-loader": "^4.2.0",
|
"css-loader": "^4.2.1",
|
||||||
"cssnano": "^4.1.10",
|
"cssnano": "^4.1.10",
|
||||||
"del": "^5.1.0",
|
"del": "^5.1.0",
|
||||||
"eslint": "^7.6.0",
|
"eslint": "^7.6.0",
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
"fast-text-encoding": "^1.0.3",
|
"fast-text-encoding": "^1.0.3",
|
||||||
"flv.js": "^1.5.0",
|
"flv.js": "^1.5.0",
|
||||||
"headroom.js": "^0.11.0",
|
"headroom.js": "^0.11.0",
|
||||||
"hls.js": "^0.14.7",
|
"hls.js": "^0.14.8",
|
||||||
"howler": "^2.2.0",
|
"howler": "^2.2.0",
|
||||||
"intersection-observer": "^0.11.0",
|
"intersection-observer": "^0.11.0",
|
||||||
"jellyfin-apiclient": "^1.4.1",
|
"jellyfin-apiclient": "^1.4.1",
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
"sortablejs": "^1.10.2",
|
"sortablejs": "^1.10.2",
|
||||||
"swiper": "^5.4.5",
|
"swiper": "^5.4.5",
|
||||||
"webcomponents.js": "^0.7.24",
|
"webcomponents.js": "^0.7.24",
|
||||||
"whatwg-fetch": "^3.3.1"
|
"whatwg-fetch": "^3.4.0"
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
"presets": [
|
"presets": [
|
||||||
|
@ -95,6 +95,7 @@
|
||||||
"src/components/alert.js",
|
"src/components/alert.js",
|
||||||
"src/components/alphaPicker/alphaPicker.js",
|
"src/components/alphaPicker/alphaPicker.js",
|
||||||
"src/components/appFooter/appFooter.js",
|
"src/components/appFooter/appFooter.js",
|
||||||
|
"src/components/apphost.js",
|
||||||
"src/components/appRouter.js",
|
"src/components/appRouter.js",
|
||||||
"src/components/autoFocuser.js",
|
"src/components/autoFocuser.js",
|
||||||
"src/components/backdrop/backdrop.js",
|
"src/components/backdrop/backdrop.js",
|
||||||
|
@ -113,6 +114,8 @@
|
||||||
"src/components/filterdialog/filterdialog.js",
|
"src/components/filterdialog/filterdialog.js",
|
||||||
"src/components/focusManager.js",
|
"src/components/focusManager.js",
|
||||||
"src/components/groupedcards.js",
|
"src/components/groupedcards.js",
|
||||||
|
"src/components/guide/guide.js",
|
||||||
|
"src/components/guide/guide-settings.js",
|
||||||
"src/components/homeScreenSettings/homeScreenSettings.js",
|
"src/components/homeScreenSettings/homeScreenSettings.js",
|
||||||
"src/components/homesections/homesections.js",
|
"src/components/homesections/homesections.js",
|
||||||
"src/components/htmlMediaHelper.js",
|
"src/components/htmlMediaHelper.js",
|
||||||
|
@ -126,6 +129,8 @@
|
||||||
"src/components/itemHelper.js",
|
"src/components/itemHelper.js",
|
||||||
"src/components/itemidentifier/itemidentifier.js",
|
"src/components/itemidentifier/itemidentifier.js",
|
||||||
"src/components/itemMediaInfo/itemMediaInfo.js",
|
"src/components/itemMediaInfo/itemMediaInfo.js",
|
||||||
|
"src/components/itemsrefresher.js",
|
||||||
|
"src/components/layoutManager.js",
|
||||||
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
||||||
"src/components/libraryoptionseditor/libraryoptionseditor.js",
|
"src/components/libraryoptionseditor/libraryoptionseditor.js",
|
||||||
"src/components/listview/listview.js",
|
"src/components/listview/listview.js",
|
||||||
|
@ -154,22 +159,36 @@
|
||||||
"src/components/playlisteditor/playlisteditor.js",
|
"src/components/playlisteditor/playlisteditor.js",
|
||||||
"src/components/playmenu.js",
|
"src/components/playmenu.js",
|
||||||
"src/components/prompt/prompt.js",
|
"src/components/prompt/prompt.js",
|
||||||
|
"src/components/recordingcreator/recordingbutton.js",
|
||||||
|
"src/components/recordingcreator/recordingcreator.js",
|
||||||
"src/components/recordingcreator/seriesrecordingeditor.js",
|
"src/components/recordingcreator/seriesrecordingeditor.js",
|
||||||
"src/components/recordingcreator/recordinghelper.js",
|
"src/components/recordingcreator/recordinghelper.js",
|
||||||
"src/components/refreshdialog/refreshdialog.js",
|
"src/components/refreshdialog/refreshdialog.js",
|
||||||
|
"src/components/qualityOptions.js",
|
||||||
|
"src/components/remotecontrol/remotecontrol.js",
|
||||||
"src/components/sanatizefilename.js",
|
"src/components/sanatizefilename.js",
|
||||||
"src/components/scrollManager.js",
|
"src/components/scrollManager.js",
|
||||||
|
"src/plugins/htmlAudioPlayer/plugin.js",
|
||||||
|
"src/plugins/chromecastPlayer/plugin.js",
|
||||||
|
"src/components/slideshow/slideshow.js",
|
||||||
|
"src/components/sortmenu/sortmenu.js",
|
||||||
"src/plugins/htmlVideoPlayer/plugin.js",
|
"src/plugins/htmlVideoPlayer/plugin.js",
|
||||||
|
"src/plugins/logoScreensaver/plugin.js",
|
||||||
|
"src/plugins/playAccessValidation/plugin.js",
|
||||||
"src/components/search/searchfields.js",
|
"src/components/search/searchfields.js",
|
||||||
"src/components/search/searchresults.js",
|
"src/components/search/searchresults.js",
|
||||||
"src/components/settingshelper.js",
|
"src/components/settingshelper.js",
|
||||||
"src/components/shortcuts.js",
|
"src/components/shortcuts.js",
|
||||||
|
"src/components/subtitleeditor/subtitleeditor.js",
|
||||||
|
"src/components/subtitlesync/subtitlesync.js",
|
||||||
"src/components/subtitlesettings/subtitleappearancehelper.js",
|
"src/components/subtitlesettings/subtitleappearancehelper.js",
|
||||||
"src/components/subtitlesettings/subtitlesettings.js",
|
"src/components/subtitlesettings/subtitlesettings.js",
|
||||||
"src/components/syncPlay/groupSelectionMenu.js",
|
"src/components/syncPlay/groupSelectionMenu.js",
|
||||||
"src/components/syncPlay/playbackPermissionManager.js",
|
"src/components/syncPlay/playbackPermissionManager.js",
|
||||||
"src/components/syncPlay/syncPlayManager.js",
|
"src/components/syncPlay/syncPlayManager.js",
|
||||||
"src/components/syncPlay/timeSyncManager.js",
|
"src/components/syncPlay/timeSyncManager.js",
|
||||||
|
"src/components/tabbedview/tabbedview.js",
|
||||||
|
"src/components/viewManager/viewManager.js",
|
||||||
"src/components/tvproviders/schedulesdirect.js",
|
"src/components/tvproviders/schedulesdirect.js",
|
||||||
"src/components/tvproviders/xmltv.js",
|
"src/components/tvproviders/xmltv.js",
|
||||||
"src/components/toast/toast.js",
|
"src/components/toast/toast.js",
|
||||||
|
@ -198,13 +217,16 @@
|
||||||
"src/controllers/music/musicplaylists.js",
|
"src/controllers/music/musicplaylists.js",
|
||||||
"src/controllers/music/musicrecommended.js",
|
"src/controllers/music/musicrecommended.js",
|
||||||
"src/controllers/music/songs.js",
|
"src/controllers/music/songs.js",
|
||||||
"src/controllers/dashboard/mediaLibrary.js",
|
"src/controllers/dashboard/library.js",
|
||||||
"src/controllers/dashboard/metadataImages.js",
|
"src/controllers/dashboard/metadataImages.js",
|
||||||
"src/controllers/dashboard/metadatanfo.js",
|
"src/controllers/dashboard/metadatanfo.js",
|
||||||
"src/controllers/dashboard/networking.js",
|
"src/controllers/dashboard/networking.js",
|
||||||
"src/controllers/dashboard/notifications/notification.js",
|
"src/controllers/dashboard/notifications/notification.js",
|
||||||
"src/controllers/dashboard/notifications/notifications.js",
|
"src/controllers/dashboard/notifications/notifications.js",
|
||||||
"src/controllers/dashboard/playback.js",
|
"src/controllers/dashboard/playback.js",
|
||||||
|
"src/controllers/dashboard/plugins/add/index.js",
|
||||||
|
"src/controllers/dashboard/plugins/installed/index.js",
|
||||||
|
"src/controllers/dashboard/plugins/available/index.js",
|
||||||
"src/controllers/dashboard/plugins/repositories/index.js",
|
"src/controllers/dashboard/plugins/repositories/index.js",
|
||||||
"src/controllers/dashboard/scheduledtasks/scheduledtask.js",
|
"src/controllers/dashboard/scheduledtasks/scheduledtask.js",
|
||||||
"src/controllers/dashboard/scheduledtasks/scheduledtasks.js",
|
"src/controllers/dashboard/scheduledtasks/scheduledtasks.js",
|
||||||
|
@ -216,6 +238,8 @@
|
||||||
"src/controllers/dashboard/users/userparentalcontrol.js",
|
"src/controllers/dashboard/users/userparentalcontrol.js",
|
||||||
"src/controllers/dashboard/users/userpasswordpage.js",
|
"src/controllers/dashboard/users/userpasswordpage.js",
|
||||||
"src/controllers/dashboard/users/userprofilespage.js",
|
"src/controllers/dashboard/users/userprofilespage.js",
|
||||||
|
"src/controllers/home.js",
|
||||||
|
"src/controllers/list.js",
|
||||||
"src/controllers/edititemmetadata.js",
|
"src/controllers/edititemmetadata.js",
|
||||||
"src/controllers/favorites.js",
|
"src/controllers/favorites.js",
|
||||||
"src/controllers/hometab.js",
|
"src/controllers/hometab.js",
|
||||||
|
@ -230,6 +254,7 @@
|
||||||
"src/controllers/playback/queue/index.js",
|
"src/controllers/playback/queue/index.js",
|
||||||
"src/controllers/playback/video/index.js",
|
"src/controllers/playback/video/index.js",
|
||||||
"src/controllers/searchpage.js",
|
"src/controllers/searchpage.js",
|
||||||
|
"src/controllers/livetv/livetvguide.js",
|
||||||
"src/controllers/livetvtuner.js",
|
"src/controllers/livetvtuner.js",
|
||||||
"src/controllers/livetvstatus.js",
|
"src/controllers/livetvstatus.js",
|
||||||
"src/controllers/livetvguideprovider.js",
|
"src/controllers/livetvguideprovider.js",
|
||||||
|
@ -276,6 +301,9 @@
|
||||||
"src/elements/emby-tabs/emby-tabs.js",
|
"src/elements/emby-tabs/emby-tabs.js",
|
||||||
"src/elements/emby-textarea/emby-textarea.js",
|
"src/elements/emby-textarea/emby-textarea.js",
|
||||||
"src/elements/emby-toggle/emby-toggle.js",
|
"src/elements/emby-toggle/emby-toggle.js",
|
||||||
|
"src/libraries/screensavermanager.js",
|
||||||
|
"src/libraries/navdrawer/navdrawer.js",
|
||||||
|
"src/libraries/scroller.js",
|
||||||
"src/plugins/backdropScreensaver/plugin.js",
|
"src/plugins/backdropScreensaver/plugin.js",
|
||||||
"src/plugins/bookPlayer/plugin.js",
|
"src/plugins/bookPlayer/plugin.js",
|
||||||
"src/plugins/bookPlayer/tableOfContents.js",
|
"src/plugins/bookPlayer/tableOfContents.js",
|
||||||
|
@ -293,18 +321,24 @@
|
||||||
"src/scripts/filesystem.js",
|
"src/scripts/filesystem.js",
|
||||||
"src/scripts/globalize.js",
|
"src/scripts/globalize.js",
|
||||||
"src/scripts/imagehelper.js",
|
"src/scripts/imagehelper.js",
|
||||||
|
"src/scripts/itembynamedetailpage.js",
|
||||||
"src/scripts/inputManager.js",
|
"src/scripts/inputManager.js",
|
||||||
"src/scripts/autoThemes.js",
|
"src/scripts/autoThemes.js",
|
||||||
"src/scripts/themeManager.js",
|
"src/scripts/themeManager.js",
|
||||||
"src/scripts/keyboardNavigation.js",
|
"src/scripts/keyboardNavigation.js",
|
||||||
|
"src/scripts/libraryMenu.js",
|
||||||
"src/scripts/libraryBrowser.js",
|
"src/scripts/libraryBrowser.js",
|
||||||
|
"src/scripts/livetvcomponents.js",
|
||||||
"src/scripts/mouseManager.js",
|
"src/scripts/mouseManager.js",
|
||||||
"src/scripts/multiDownload.js",
|
"src/scripts/multiDownload.js",
|
||||||
"src/scripts/playlists.js",
|
"src/scripts/playlists.js",
|
||||||
|
"src/scripts/scrollHelper.js",
|
||||||
|
"src/scripts/serverNotifications.js",
|
||||||
"src/scripts/routes.js",
|
"src/scripts/routes.js",
|
||||||
"src/scripts/settings/appSettings.js",
|
"src/scripts/settings/appSettings.js",
|
||||||
"src/scripts/settings/userSettings.js",
|
"src/scripts/settings/userSettings.js",
|
||||||
"src/scripts/settings/webSettings.js",
|
"src/scripts/settings/webSettings.js",
|
||||||
|
"src/scripts/shell.js",
|
||||||
"src/scripts/taskbutton.js",
|
"src/scripts/taskbutton.js",
|
||||||
"src/scripts/themeLoader.js",
|
"src/scripts/themeLoader.js",
|
||||||
"src/scripts/touchHelper.js"
|
"src/scripts/touchHelper.js"
|
||||||
|
|
|
@ -236,12 +236,6 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop .searchTabButton,
|
|
||||||
.layout-mobile .searchTabButton,
|
|
||||||
.layout-tv .headerSearchButton {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mainDrawer-scrollContainer {
|
.mainDrawer-scrollContainer {
|
||||||
padding-bottom: 10vh;
|
padding-bottom: 10vh;
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,159 +2,159 @@
|
||||||
* require.js module definitions bundled by webpack
|
* require.js module definitions bundled by webpack
|
||||||
*/
|
*/
|
||||||
// Use define from require.js not webpack's define
|
// Use define from require.js not webpack's define
|
||||||
var _define = window.define;
|
const _define = window.define;
|
||||||
|
|
||||||
// fetch
|
// fetch
|
||||||
var fetch = require('whatwg-fetch');
|
const fetch = require('whatwg-fetch');
|
||||||
_define('fetch', function() {
|
_define('fetch', function() {
|
||||||
return fetch;
|
return fetch;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Blurhash
|
// Blurhash
|
||||||
var blurhash = require('blurhash');
|
const blurhash = require('blurhash');
|
||||||
_define('blurhash', function() {
|
_define('blurhash', function() {
|
||||||
return blurhash;
|
return blurhash;
|
||||||
});
|
});
|
||||||
|
|
||||||
// query-string
|
// query-string
|
||||||
var query = require('query-string');
|
const query = require('query-string');
|
||||||
_define('queryString', function() {
|
_define('queryString', function() {
|
||||||
return query;
|
return query;
|
||||||
});
|
});
|
||||||
|
|
||||||
// flvjs
|
// flvjs
|
||||||
var flvjs = require('flv.js/dist/flv').default;
|
const flvjs = require('flv.js/dist/flv').default;
|
||||||
_define('flvjs', function() {
|
_define('flvjs', function() {
|
||||||
return flvjs;
|
return flvjs;
|
||||||
});
|
});
|
||||||
|
|
||||||
// jstree
|
// jstree
|
||||||
var jstree = require('jstree');
|
const jstree = require('jstree');
|
||||||
require('jstree/dist/themes/default/style.css');
|
require('jstree/dist/themes/default/style.css');
|
||||||
_define('jstree', function() {
|
_define('jstree', function() {
|
||||||
return jstree;
|
return jstree;
|
||||||
});
|
});
|
||||||
|
|
||||||
// jquery
|
// jquery
|
||||||
var jquery = require('jquery');
|
const jquery = require('jquery');
|
||||||
_define('jQuery', function() {
|
_define('jQuery', function() {
|
||||||
return jquery;
|
return jquery;
|
||||||
});
|
});
|
||||||
|
|
||||||
// hlsjs
|
// hlsjs
|
||||||
var hlsjs = require('hls.js');
|
const hlsjs = require('hls.js');
|
||||||
_define('hlsjs', function() {
|
_define('hlsjs', function() {
|
||||||
return hlsjs;
|
return hlsjs;
|
||||||
});
|
});
|
||||||
|
|
||||||
// howler
|
// howler
|
||||||
var howler = require('howler');
|
const howler = require('howler');
|
||||||
_define('howler', function() {
|
_define('howler', function() {
|
||||||
return howler;
|
return howler;
|
||||||
});
|
});
|
||||||
|
|
||||||
// resize-observer-polyfill
|
// resize-observer-polyfill
|
||||||
var resize = require('resize-observer-polyfill').default;
|
const resize = require('resize-observer-polyfill').default;
|
||||||
_define('resize-observer-polyfill', function() {
|
_define('resize-observer-polyfill', function() {
|
||||||
return resize;
|
return resize;
|
||||||
});
|
});
|
||||||
|
|
||||||
// swiper
|
// swiper
|
||||||
var swiper = require('swiper/js/swiper');
|
const swiper = require('swiper/js/swiper');
|
||||||
require('swiper/css/swiper.min.css');
|
require('swiper/css/swiper.min.css');
|
||||||
_define('swiper', function() {
|
_define('swiper', function() {
|
||||||
return swiper;
|
return swiper;
|
||||||
});
|
});
|
||||||
|
|
||||||
// sortable
|
// sortable
|
||||||
var sortable = require('sortablejs').default;
|
const sortable = require('sortablejs').default;
|
||||||
_define('sortable', function() {
|
_define('sortable', function() {
|
||||||
return sortable;
|
return sortable;
|
||||||
});
|
});
|
||||||
|
|
||||||
// webcomponents
|
// webcomponents
|
||||||
var webcomponents = require('webcomponents.js/webcomponents-lite');
|
const webcomponents = require('webcomponents.js/webcomponents-lite');
|
||||||
_define('webcomponents', function() {
|
_define('webcomponents', function() {
|
||||||
return webcomponents;
|
return webcomponents;
|
||||||
});
|
});
|
||||||
|
|
||||||
// libass-wasm
|
// libass-wasm
|
||||||
var libassWasm = require('libass-wasm');
|
const libassWasm = require('libass-wasm');
|
||||||
_define('JavascriptSubtitlesOctopus', function() {
|
_define('JavascriptSubtitlesOctopus', function() {
|
||||||
return libassWasm;
|
return libassWasm;
|
||||||
});
|
});
|
||||||
|
|
||||||
// material-icons
|
// material-icons
|
||||||
var materialIcons = require('material-design-icons-iconfont/dist/material-design-icons.css');
|
const materialIcons = require('material-design-icons-iconfont/dist/material-design-icons.css');
|
||||||
_define('material-icons', function() {
|
_define('material-icons', function() {
|
||||||
return materialIcons;
|
return materialIcons;
|
||||||
});
|
});
|
||||||
|
|
||||||
// noto font
|
// noto font
|
||||||
var noto = require('jellyfin-noto');
|
const noto = require('jellyfin-noto');
|
||||||
_define('jellyfin-noto', function () {
|
_define('jellyfin-noto', function () {
|
||||||
return noto;
|
return noto;
|
||||||
});
|
});
|
||||||
|
|
||||||
var epubjs = require('epubjs');
|
const epubjs = require('epubjs');
|
||||||
_define('epubjs', function () {
|
_define('epubjs', function () {
|
||||||
return epubjs;
|
return epubjs;
|
||||||
});
|
});
|
||||||
|
|
||||||
// page.js
|
// page.js
|
||||||
var page = require('page');
|
const page = require('page');
|
||||||
_define('page', function() {
|
_define('page', function() {
|
||||||
return page;
|
return page;
|
||||||
});
|
});
|
||||||
|
|
||||||
// core-js
|
// core-js
|
||||||
var polyfill = require('@babel/polyfill/dist/polyfill');
|
const polyfill = require('@babel/polyfill/dist/polyfill');
|
||||||
_define('polyfill', function () {
|
_define('polyfill', function () {
|
||||||
return polyfill;
|
return polyfill;
|
||||||
});
|
});
|
||||||
|
|
||||||
// domtokenlist-shim
|
// domtokenlist-shim
|
||||||
var classlist = require('classlist.js');
|
const classlist = require('classlist.js');
|
||||||
_define('classlist-polyfill', function () {
|
_define('classlist-polyfill', function () {
|
||||||
return classlist;
|
return classlist;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Date-FNS
|
// Date-FNS
|
||||||
var dateFns = require('date-fns');
|
const dateFns = require('date-fns');
|
||||||
_define('date-fns', function () {
|
_define('date-fns', function () {
|
||||||
return dateFns;
|
return dateFns;
|
||||||
});
|
});
|
||||||
|
|
||||||
var dateFnsLocale = require('date-fns/locale');
|
const dateFnsLocale = require('date-fns/locale');
|
||||||
_define('date-fns/locale', function () {
|
_define('date-fns/locale', function () {
|
||||||
return dateFnsLocale;
|
return dateFnsLocale;
|
||||||
});
|
});
|
||||||
|
|
||||||
var fast_text_encoding = require('fast-text-encoding');
|
const fast_text_encoding = require('fast-text-encoding');
|
||||||
_define('fast-text-encoding', function () {
|
_define('fast-text-encoding', function () {
|
||||||
return fast_text_encoding;
|
return fast_text_encoding;
|
||||||
});
|
});
|
||||||
|
|
||||||
// intersection-observer
|
// intersection-observer
|
||||||
var intersection_observer = require('intersection-observer');
|
const intersection_observer = require('intersection-observer');
|
||||||
_define('intersection-observer', function () {
|
_define('intersection-observer', function () {
|
||||||
return intersection_observer;
|
return intersection_observer;
|
||||||
});
|
});
|
||||||
|
|
||||||
// screenfull
|
// screenfull
|
||||||
var screenfull = require('screenfull');
|
const screenfull = require('screenfull');
|
||||||
_define('screenfull', function () {
|
_define('screenfull', function () {
|
||||||
return screenfull;
|
return screenfull;
|
||||||
});
|
});
|
||||||
|
|
||||||
// headroom.js
|
// headroom.js
|
||||||
var headroom = require('headroom.js/dist/headroom');
|
const headroom = require('headroom.js/dist/headroom');
|
||||||
_define('headroom', function () {
|
_define('headroom', function () {
|
||||||
return headroom;
|
return headroom;
|
||||||
});
|
});
|
||||||
|
|
||||||
// apiclient
|
// apiclient
|
||||||
var apiclient = require('jellyfin-apiclient');
|
const apiclient = require('jellyfin-apiclient');
|
||||||
|
|
||||||
_define('apiclient', function () {
|
_define('apiclient', function () {
|
||||||
return apiclient.ApiClient;
|
return apiclient.ApiClient;
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<div class="formDialogFooter">
|
<div class="formDialogFooter">
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">
|
<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">
|
||||||
<span>${ButtonAdd}</span>
|
<span>${Add}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,447 +1,412 @@
|
||||||
define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'globalize'], function (appSettings, browser, events, htmlMediaHelper, webSettings, globalize) {
|
import appSettings from 'appSettings';
|
||||||
'use strict';
|
import browser from 'browser';
|
||||||
|
import events from 'events';
|
||||||
|
import * as htmlMediaHelper from 'htmlMediaHelper';
|
||||||
|
import * as webSettings from 'webSettings';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
browser = browser.default || browser;
|
function getBaseProfileOptions(item) {
|
||||||
|
const disableHlsVideoAudioCodecs = [];
|
||||||
|
|
||||||
function getBaseProfileOptions(item) {
|
if (item && htmlMediaHelper.enableHlsJsPlayer(item.RunTimeTicks, item.MediaType)) {
|
||||||
var disableHlsVideoAudioCodecs = [];
|
if (browser.edge) {
|
||||||
|
disableHlsVideoAudioCodecs.push('mp3');
|
||||||
|
}
|
||||||
|
|
||||||
if (item && htmlMediaHelper.enableHlsJsPlayer(item.RunTimeTicks, item.MediaType)) {
|
disableHlsVideoAudioCodecs.push('ac3');
|
||||||
if (browser.edge) {
|
disableHlsVideoAudioCodecs.push('eac3');
|
||||||
disableHlsVideoAudioCodecs.push('mp3');
|
disableHlsVideoAudioCodecs.push('opus');
|
||||||
|
}
|
||||||
|
|
||||||
|
return {
|
||||||
|
enableMkvProgressive: false,
|
||||||
|
disableHlsVideoAudioCodecs: disableHlsVideoAudioCodecs
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDeviceProfile(item, options = {}) {
|
||||||
|
return new Promise(function (resolve) {
|
||||||
|
import('browserdeviceprofile').then(({default: profileBuilder}) => {
|
||||||
|
let profile;
|
||||||
|
|
||||||
|
if (window.NativeShell) {
|
||||||
|
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
|
||||||
|
} else {
|
||||||
|
const builderOpts = getBaseProfileOptions(item);
|
||||||
|
builderOpts.enableSsaRender = (item && !options.isRetry && appSettings.get('subtitleburnin') !== 'allcomplexformats');
|
||||||
|
profile = profileBuilder(builderOpts);
|
||||||
}
|
}
|
||||||
|
|
||||||
disableHlsVideoAudioCodecs.push('ac3');
|
resolve(profile);
|
||||||
disableHlsVideoAudioCodecs.push('eac3');
|
|
||||||
disableHlsVideoAudioCodecs.push('opus');
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
enableMkvProgressive: false,
|
|
||||||
disableHlsVideoAudioCodecs: disableHlsVideoAudioCodecs
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDeviceProfileForWindowsUwp(item) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
require(['browserdeviceprofile', 'environments/windows-uwp/mediacaps'], function (profileBuilder, uwpMediaCaps) {
|
|
||||||
var profileOptions = getBaseProfileOptions(item);
|
|
||||||
profileOptions.supportsDts = uwpMediaCaps.supportsDTS();
|
|
||||||
profileOptions.supportsTrueHd = uwpMediaCaps.supportsDolby();
|
|
||||||
profileOptions.audioChannels = uwpMediaCaps.getAudioChannels();
|
|
||||||
resolve(profileBuilder(profileOptions));
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function escapeRegExp(str) {
|
||||||
|
return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');
|
||||||
|
}
|
||||||
|
|
||||||
|
function replaceAll(originalString, strReplace, strWith) {
|
||||||
|
const strReplace2 = escapeRegExp(strReplace);
|
||||||
|
const reg = new RegExp(strReplace2, 'ig');
|
||||||
|
return originalString.replace(reg, strWith);
|
||||||
|
}
|
||||||
|
|
||||||
|
function generateDeviceId() {
|
||||||
|
const keys = [];
|
||||||
|
|
||||||
|
if (keys.push(navigator.userAgent), keys.push(new Date().getTime()), self.btoa) {
|
||||||
|
const result = replaceAll(btoa(keys.join('|')), '=', '1');
|
||||||
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDeviceProfile(item, options) {
|
return Promise.resolve(new Date().getTime());
|
||||||
options = options || {};
|
}
|
||||||
|
|
||||||
if (self.Windows) {
|
function getDeviceId() {
|
||||||
return getDeviceProfileForWindowsUwp(item);
|
const key = '_deviceId2';
|
||||||
}
|
const deviceId = appSettings.get(key);
|
||||||
|
|
||||||
return new Promise(function (resolve) {
|
if (deviceId) {
|
||||||
require(['browserdeviceprofile'], function (profileBuilder) {
|
return Promise.resolve(deviceId);
|
||||||
var profile;
|
|
||||||
|
|
||||||
if (window.NativeShell) {
|
|
||||||
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
|
|
||||||
} else {
|
|
||||||
var builderOpts = getBaseProfileOptions(item);
|
|
||||||
builderOpts.enableSsaRender = (item && !options.isRetry && appSettings.get('subtitleburnin') !== 'allcomplexformats');
|
|
||||||
profile = profileBuilder(builderOpts);
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve(profile);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeRegExp(str) {
|
return generateDeviceId().then(function (deviceId) {
|
||||||
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
|
appSettings.set(key, deviceId);
|
||||||
|
return deviceId;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getDeviceName() {
|
||||||
|
var deviceName;
|
||||||
|
if (browser.tizen) {
|
||||||
|
deviceName = 'Samsung Smart TV';
|
||||||
|
} else if (browser.web0s) {
|
||||||
|
deviceName = 'LG Smart TV';
|
||||||
|
} else if (browser.operaTv) {
|
||||||
|
deviceName = 'Opera TV';
|
||||||
|
} else if (browser.xboxOne) {
|
||||||
|
deviceName = 'Xbox One';
|
||||||
|
} else if (browser.ps4) {
|
||||||
|
deviceName = 'Sony PS4';
|
||||||
|
} else if (browser.chrome) {
|
||||||
|
deviceName = 'Chrome';
|
||||||
|
} else if (browser.edgeChromium) {
|
||||||
|
deviceName = 'Edge Chromium';
|
||||||
|
} else if (browser.edge) {
|
||||||
|
deviceName = 'Edge';
|
||||||
|
} else if (browser.firefox) {
|
||||||
|
deviceName = 'Firefox';
|
||||||
|
} else if (browser.opera) {
|
||||||
|
deviceName = 'Opera';
|
||||||
|
} else if (browser.safari) {
|
||||||
|
deviceName = 'Safari';
|
||||||
|
} else {
|
||||||
|
deviceName = 'Web Browser';
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceAll(originalString, strReplace, strWith) {
|
if (browser.ipad) {
|
||||||
var strReplace2 = escapeRegExp(strReplace);
|
deviceName += ' iPad';
|
||||||
var reg = new RegExp(strReplace2, 'ig');
|
} else if (browser.iphone) {
|
||||||
return originalString.replace(reg, strWith);
|
deviceName += ' iPhone';
|
||||||
|
} else if (browser.android) {
|
||||||
|
deviceName += ' Android';
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateDeviceId() {
|
return deviceName;
|
||||||
var keys = [];
|
}
|
||||||
|
|
||||||
if (keys.push(navigator.userAgent), keys.push(new Date().getTime()), self.btoa) {
|
function supportsVoiceInput() {
|
||||||
var result = replaceAll(btoa(keys.join('|')), '=', '1');
|
if (!browser.tv) {
|
||||||
return Promise.resolve(result);
|
return window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.oSpeechRecognition || window.msSpeechRecognition;
|
||||||
}
|
|
||||||
|
|
||||||
return Promise.resolve(new Date().getTime());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDeviceId() {
|
return false;
|
||||||
var key = '_deviceId2';
|
}
|
||||||
var deviceId = appSettings.get(key);
|
|
||||||
|
|
||||||
if (deviceId) {
|
|
||||||
return Promise.resolve(deviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
return generateDeviceId().then(function (deviceId) {
|
|
||||||
appSettings.set(key, deviceId);
|
|
||||||
return deviceId;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDeviceName() {
|
|
||||||
var deviceName;
|
|
||||||
if (browser.tizen) {
|
|
||||||
deviceName = 'Samsung Smart TV';
|
|
||||||
} else if (browser.web0s) {
|
|
||||||
deviceName = 'LG Smart TV';
|
|
||||||
} else if (browser.operaTv) {
|
|
||||||
deviceName = 'Opera TV';
|
|
||||||
} else if (browser.xboxOne) {
|
|
||||||
deviceName = 'Xbox One';
|
|
||||||
} else if (browser.ps4) {
|
|
||||||
deviceName = 'Sony PS4';
|
|
||||||
} else if (browser.chrome) {
|
|
||||||
deviceName = 'Chrome';
|
|
||||||
} else if (browser.edgeChromium) {
|
|
||||||
deviceName = 'Edge Chromium';
|
|
||||||
} else if (browser.edge) {
|
|
||||||
deviceName = 'Edge';
|
|
||||||
} else if (browser.firefox) {
|
|
||||||
deviceName = 'Firefox';
|
|
||||||
} else if (browser.opera) {
|
|
||||||
deviceName = 'Opera';
|
|
||||||
} else if (browser.safari) {
|
|
||||||
deviceName = 'Safari';
|
|
||||||
} else {
|
|
||||||
deviceName = 'Web Browser';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser.ipad) {
|
|
||||||
deviceName += ' iPad';
|
|
||||||
} else if (browser.iphone) {
|
|
||||||
deviceName += ' iPhone';
|
|
||||||
} else if (browser.android) {
|
|
||||||
deviceName += ' Android';
|
|
||||||
}
|
|
||||||
|
|
||||||
return deviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
function supportsVoiceInput() {
|
|
||||||
if (!browser.tv) {
|
|
||||||
return window.SpeechRecognition || window.webkitSpeechRecognition || window.mozSpeechRecognition || window.oSpeechRecognition || window.msSpeechRecognition;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function supportsFullscreen() {
|
||||||
|
if (browser.tv) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function supportsFullscreen() {
|
const element = document.documentElement;
|
||||||
if (browser.tv) {
|
return (element.requestFullscreen || element.mozRequestFullScreen || element.webkitRequestFullscreen || element.msRequestFullscreen) || document.createElement('video').webkitEnterFullscreen;
|
||||||
return false;
|
}
|
||||||
}
|
|
||||||
|
|
||||||
var element = document.documentElement;
|
function getDefaultLayout() {
|
||||||
return (element.requestFullscreen || element.mozRequestFullScreen || element.webkitRequestFullscreen || element.msRequestFullscreen) || document.createElement('video').webkitEnterFullscreen;
|
return 'desktop';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSyncProfile() {
|
|
||||||
return new Promise(function (resolve) {
|
|
||||||
require(['browserdeviceprofile', 'appSettings'], function (profileBuilder, appSettings) {
|
|
||||||
var profile;
|
|
||||||
|
|
||||||
if (window.NativeShell) {
|
|
||||||
profile = window.NativeShell.AppHost.getSyncProfile(profileBuilder, appSettings);
|
|
||||||
} else {
|
|
||||||
profile = profileBuilder();
|
|
||||||
profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate();
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve(profile);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDefaultLayout() {
|
|
||||||
return 'desktop';
|
|
||||||
}
|
|
||||||
|
|
||||||
function supportsHtmlMediaAutoplay() {
|
|
||||||
if (browser.edgeUwp || browser.tizen || browser.web0s || browser.orsay || browser.operaTv || browser.ps4 || browser.xboxOne) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser.mobile) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
function supportsHtmlMediaAutoplay() {
|
||||||
|
if (browser.edgeUwp || browser.tizen || browser.web0s || browser.orsay || browser.operaTv || browser.ps4 || browser.xboxOne) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function supportsCue() {
|
if (browser.mobile) {
|
||||||
try {
|
return false;
|
||||||
var video = document.createElement('video');
|
|
||||||
var style = document.createElement('style');
|
|
||||||
|
|
||||||
style.textContent = 'video::cue {background: inherit}';
|
|
||||||
document.body.appendChild(style);
|
|
||||||
document.body.appendChild(video);
|
|
||||||
|
|
||||||
var cue = window.getComputedStyle(video, '::cue').background;
|
|
||||||
document.body.removeChild(style);
|
|
||||||
document.body.removeChild(video);
|
|
||||||
|
|
||||||
return !!cue.length;
|
|
||||||
} catch (err) {
|
|
||||||
console.error('error detecting cue support: ' + err);
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAppVisible() {
|
return true;
|
||||||
if (isHidden) {
|
}
|
||||||
isHidden = false;
|
|
||||||
console.debug('triggering app resume event');
|
function supportsCue() {
|
||||||
events.trigger(appHost, 'resume');
|
try {
|
||||||
}
|
const video = document.createElement('video');
|
||||||
|
const style = document.createElement('style');
|
||||||
|
|
||||||
|
style.textContent = 'video::cue {background: inherit}';
|
||||||
|
document.body.appendChild(style);
|
||||||
|
document.body.appendChild(video);
|
||||||
|
|
||||||
|
const cue = window.getComputedStyle(video, '::cue').background;
|
||||||
|
document.body.removeChild(style);
|
||||||
|
document.body.removeChild(video);
|
||||||
|
|
||||||
|
return !!cue.length;
|
||||||
|
} catch (err) {
|
||||||
|
console.error('error detecting cue support: ' + err);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onAppVisible() {
|
||||||
|
if (isHidden) {
|
||||||
|
isHidden = false;
|
||||||
|
console.debug('triggering app resume event');
|
||||||
|
events.trigger(appHost, 'resume');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onAppHidden() {
|
||||||
|
if (!isHidden) {
|
||||||
|
isHidden = true;
|
||||||
|
console.debug('app is hidden');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const supportedFeatures = function () {
|
||||||
|
const features = [];
|
||||||
|
|
||||||
|
if (navigator.share) {
|
||||||
|
features.push('sharing');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAppHidden() {
|
if (!browser.edgeUwp && !browser.tv && !browser.xboxOne && !browser.ps4) {
|
||||||
if (!isHidden) {
|
features.push('filedownload');
|
||||||
isHidden = true;
|
|
||||||
console.debug('app is hidden');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportedFeatures = function () {
|
if (browser.operaTv || browser.tizen || browser.orsay || browser.web0s) {
|
||||||
var features = [];
|
features.push('exit');
|
||||||
|
} else {
|
||||||
|
features.push('exitmenu');
|
||||||
|
features.push('plugins');
|
||||||
|
}
|
||||||
|
|
||||||
if (navigator.share) {
|
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.ps4) {
|
||||||
features.push('sharing');
|
features.push('externallinks');
|
||||||
}
|
features.push('externalpremium');
|
||||||
|
}
|
||||||
|
|
||||||
if (!browser.edgeUwp && !browser.tv && !browser.xboxOne && !browser.ps4) {
|
if (!browser.operaTv) {
|
||||||
features.push('filedownload');
|
features.push('externallinkdisplay');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.operaTv || browser.tizen || browser.orsay || browser.web0s) {
|
if (supportsVoiceInput()) {
|
||||||
features.push('exit');
|
features.push('voiceinput');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (supportsHtmlMediaAutoplay()) {
|
||||||
|
features.push('htmlaudioautoplay');
|
||||||
|
features.push('htmlvideoautoplay');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (browser.edgeUwp) {
|
||||||
|
features.push('sync');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (supportsFullscreen()) {
|
||||||
|
features.push('fullscreenchange');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) {
|
||||||
|
features.push('physicalvolumecontrol');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
|
||||||
|
features.push('remotecontrol');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.edgeUwp) {
|
||||||
|
features.push('remotevideo');
|
||||||
|
}
|
||||||
|
|
||||||
|
features.push('displaylanguage');
|
||||||
|
features.push('otherapppromotions');
|
||||||
|
features.push('displaymode');
|
||||||
|
features.push('targetblank');
|
||||||
|
features.push('screensaver');
|
||||||
|
|
||||||
|
webSettings.getMultiServer().then(enabled => {
|
||||||
|
if (enabled) features.push('multiserver');
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!browser.orsay && (browser.firefox || browser.ps4 || browser.edge || supportsCue())) {
|
||||||
|
features.push('subtitleappearancesettings');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!browser.orsay) {
|
||||||
|
features.push('subtitleburnsettings');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!browser.tv && !browser.ps4 && !browser.xboxOne) {
|
||||||
|
features.push('fileinput');
|
||||||
|
}
|
||||||
|
|
||||||
|
if (browser.chrome || browser.edgeChromium) {
|
||||||
|
features.push('chromecast');
|
||||||
|
}
|
||||||
|
|
||||||
|
return features;
|
||||||
|
}();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Do exit according to platform
|
||||||
|
*/
|
||||||
|
function doExit() {
|
||||||
|
try {
|
||||||
|
if (window.NativeShell) {
|
||||||
|
window.NativeShell.AppHost.exit();
|
||||||
|
} else if (browser.tizen) {
|
||||||
|
tizen.application.getCurrentApplication().exit();
|
||||||
|
} else if (browser.web0s) {
|
||||||
|
webOS.platformBack();
|
||||||
} else {
|
} else {
|
||||||
features.push('exitmenu');
|
window.close();
|
||||||
features.push('plugins');
|
|
||||||
}
|
}
|
||||||
|
} catch (err) {
|
||||||
|
console.error('error closing application: ' + err);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.ps4) {
|
let exitPromise;
|
||||||
features.push('externallinks');
|
|
||||||
features.push('externalpremium');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!browser.operaTv) {
|
/**
|
||||||
features.push('externallinkdisplay');
|
* Ask user for exit
|
||||||
}
|
*/
|
||||||
|
function askForExit() {
|
||||||
if (supportsVoiceInput()) {
|
if (exitPromise) {
|
||||||
features.push('voiceinput');
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
if (supportsHtmlMediaAutoplay()) {
|
|
||||||
features.push('htmlaudioautoplay');
|
|
||||||
features.push('htmlvideoautoplay');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser.edgeUwp) {
|
|
||||||
features.push('sync');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (supportsFullscreen()) {
|
|
||||||
features.push('fullscreenchange');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) {
|
|
||||||
features.push('physicalvolumecontrol');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
|
|
||||||
features.push('remotecontrol');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.edgeUwp) {
|
|
||||||
features.push('remotevideo');
|
|
||||||
}
|
|
||||||
|
|
||||||
features.push('displaylanguage');
|
|
||||||
features.push('otherapppromotions');
|
|
||||||
features.push('displaymode');
|
|
||||||
features.push('targetblank');
|
|
||||||
features.push('screensaver');
|
|
||||||
|
|
||||||
webSettings.getMultiServer().then(enabled => {
|
|
||||||
if (enabled) features.push('multiserver');
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!browser.orsay && (browser.firefox || browser.ps4 || browser.edge || supportsCue())) {
|
|
||||||
features.push('subtitleappearancesettings');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!browser.orsay) {
|
|
||||||
features.push('subtitleburnsettings');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!browser.tv && !browser.ps4 && !browser.xboxOne) {
|
|
||||||
features.push('fileinput');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser.chrome || browser.edgeChromium) {
|
|
||||||
features.push('chromecast');
|
|
||||||
}
|
|
||||||
|
|
||||||
return features;
|
|
||||||
}();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Do exit according to platform
|
|
||||||
*/
|
|
||||||
function doExit() {
|
|
||||||
try {
|
|
||||||
if (window.NativeShell) {
|
|
||||||
window.NativeShell.AppHost.exit();
|
|
||||||
} else if (browser.tizen) {
|
|
||||||
tizen.application.getCurrentApplication().exit();
|
|
||||||
} else if (browser.web0s) {
|
|
||||||
webOS.platformBack();
|
|
||||||
} else {
|
|
||||||
window.close();
|
|
||||||
}
|
|
||||||
} catch (err) {
|
|
||||||
console.error('error closing application: ' + err);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var exitPromise;
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
|
exitPromise = actionsheet.show({
|
||||||
/**
|
title: globalize.translate('MessageConfirmAppExit'),
|
||||||
* Ask user for exit
|
items: [
|
||||||
*/
|
{id: 'yes', name: globalize.translate('Yes')},
|
||||||
function askForExit() {
|
{id: 'no', name: globalize.translate('No')}
|
||||||
if (exitPromise) {
|
]
|
||||||
return;
|
}).then(function (value) {
|
||||||
}
|
if (value === 'yes') {
|
||||||
|
|
||||||
require(['actionsheet'], function (actionsheet) {
|
|
||||||
exitPromise = actionsheet.show({
|
|
||||||
title: globalize.translate('MessageConfirmAppExit'),
|
|
||||||
items: [
|
|
||||||
{id: 'yes', name: globalize.translate('Yes')},
|
|
||||||
{id: 'no', name: globalize.translate('No')}
|
|
||||||
]
|
|
||||||
}).then(function (value) {
|
|
||||||
if (value === 'yes') {
|
|
||||||
doExit();
|
|
||||||
}
|
|
||||||
}).finally(function () {
|
|
||||||
exitPromise = null;
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
var deviceId;
|
|
||||||
var deviceName;
|
|
||||||
var appName = 'Jellyfin Web';
|
|
||||||
var appVersion = '10.7.0';
|
|
||||||
|
|
||||||
var appHost = {
|
|
||||||
getWindowState: function () {
|
|
||||||
return document.windowState || 'Normal';
|
|
||||||
},
|
|
||||||
setWindowState: function (state) {
|
|
||||||
alert('setWindowState is not supported and should not be called');
|
|
||||||
},
|
|
||||||
exit: function () {
|
|
||||||
if (!!window.appMode && browser.tizen) {
|
|
||||||
askForExit();
|
|
||||||
} else {
|
|
||||||
doExit();
|
doExit();
|
||||||
}
|
}
|
||||||
},
|
}).finally(function () {
|
||||||
supports: function (command) {
|
exitPromise = null;
|
||||||
if (window.NativeShell) {
|
});
|
||||||
return window.NativeShell.AppHost.supports(command);
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return supportedFeatures.indexOf(command.toLowerCase()) !== -1;
|
let deviceId;
|
||||||
},
|
let deviceName;
|
||||||
preferVisualCards: browser.android || browser.chrome,
|
const appName = 'Jellyfin Web';
|
||||||
getSyncProfile: getSyncProfile,
|
const appVersion = '10.7.0';
|
||||||
getDefaultLayout: function () {
|
|
||||||
if (window.NativeShell) {
|
|
||||||
return window.NativeShell.AppHost.getDefaultLayout();
|
|
||||||
}
|
|
||||||
|
|
||||||
return getDefaultLayout();
|
const appHost = {
|
||||||
},
|
getWindowState: function () {
|
||||||
getDeviceProfile: getDeviceProfile,
|
return document.windowState || 'Normal';
|
||||||
init: function () {
|
},
|
||||||
if (window.NativeShell) {
|
setWindowState: function () {
|
||||||
return window.NativeShell.AppHost.init();
|
alert('setWindowState is not supported and should not be called');
|
||||||
}
|
},
|
||||||
|
exit: function () {
|
||||||
deviceName = getDeviceName();
|
if (!!window.appMode && browser.tizen) {
|
||||||
getDeviceId().then(function (id) {
|
askForExit();
|
||||||
deviceId = id;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
deviceName: function () {
|
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.deviceName() : deviceName;
|
|
||||||
},
|
|
||||||
deviceId: function () {
|
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.deviceId() : deviceId;
|
|
||||||
},
|
|
||||||
appName: function () {
|
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.appName() : appName;
|
|
||||||
},
|
|
||||||
appVersion: function () {
|
|
||||||
return window.NativeShell ? window.NativeShell.AppHost.appVersion() : appVersion;
|
|
||||||
},
|
|
||||||
getPushTokenInfo: function () {
|
|
||||||
return {};
|
|
||||||
},
|
|
||||||
setUserScalable: function (scalable) {
|
|
||||||
if (!browser.tv) {
|
|
||||||
var att = scalable ? 'width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes' : 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no';
|
|
||||||
document.querySelector('meta[name=viewport]').setAttribute('content', att);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
var isHidden = false;
|
|
||||||
var hidden;
|
|
||||||
var visibilityChange;
|
|
||||||
|
|
||||||
if (typeof document.hidden !== 'undefined') { /* eslint-disable-line compat/compat */
|
|
||||||
hidden = 'hidden';
|
|
||||||
visibilityChange = 'visibilitychange';
|
|
||||||
} else if (typeof document.webkitHidden !== 'undefined') {
|
|
||||||
hidden = 'webkitHidden';
|
|
||||||
visibilityChange = 'webkitvisibilitychange';
|
|
||||||
}
|
|
||||||
|
|
||||||
document.addEventListener(visibilityChange, function () {
|
|
||||||
/* eslint-disable-next-line compat/compat */
|
|
||||||
if (document[hidden]) {
|
|
||||||
onAppHidden();
|
|
||||||
} else {
|
} else {
|
||||||
onAppVisible();
|
doExit();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
supports: function (command) {
|
||||||
|
if (window.NativeShell) {
|
||||||
|
return window.NativeShell.AppHost.supports(command);
|
||||||
}
|
}
|
||||||
}, false);
|
|
||||||
|
|
||||||
if (self.addEventListener) {
|
return supportedFeatures.indexOf(command.toLowerCase()) !== -1;
|
||||||
self.addEventListener('focus', onAppVisible);
|
},
|
||||||
self.addEventListener('blur', onAppHidden);
|
preferVisualCards: browser.android || browser.chrome,
|
||||||
|
getDefaultLayout: function () {
|
||||||
|
if (window.NativeShell) {
|
||||||
|
return window.NativeShell.AppHost.getDefaultLayout();
|
||||||
|
}
|
||||||
|
|
||||||
|
return getDefaultLayout();
|
||||||
|
},
|
||||||
|
getDeviceProfile: getDeviceProfile,
|
||||||
|
init: function () {
|
||||||
|
if (window.NativeShell) {
|
||||||
|
return window.NativeShell.AppHost.init();
|
||||||
|
}
|
||||||
|
|
||||||
|
deviceName = getDeviceName();
|
||||||
|
getDeviceId().then(function (id) {
|
||||||
|
deviceId = id;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
deviceName: function () {
|
||||||
|
return window.NativeShell ? window.NativeShell.AppHost.deviceName() : deviceName;
|
||||||
|
},
|
||||||
|
deviceId: function () {
|
||||||
|
return window.NativeShell ? window.NativeShell.AppHost.deviceId() : deviceId;
|
||||||
|
},
|
||||||
|
appName: function () {
|
||||||
|
return window.NativeShell ? window.NativeShell.AppHost.appName() : appName;
|
||||||
|
},
|
||||||
|
appVersion: function () {
|
||||||
|
return window.NativeShell ? window.NativeShell.AppHost.appVersion() : appVersion;
|
||||||
|
},
|
||||||
|
getPushTokenInfo: function () {
|
||||||
|
return {};
|
||||||
|
},
|
||||||
|
setUserScalable: function (scalable) {
|
||||||
|
if (!browser.tv) {
|
||||||
|
const att = scalable ? 'width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes' : 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no';
|
||||||
|
document.querySelector('meta[name=viewport]').setAttribute('content', att);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
|
||||||
return appHost;
|
let isHidden = false;
|
||||||
});
|
let hidden;
|
||||||
|
let visibilityChange;
|
||||||
|
|
||||||
|
if (typeof document.hidden !== 'undefined') { /* eslint-disable-line compat/compat */
|
||||||
|
hidden = 'hidden';
|
||||||
|
visibilityChange = 'visibilitychange';
|
||||||
|
} else if (typeof document.webkitHidden !== 'undefined') {
|
||||||
|
hidden = 'webkitHidden';
|
||||||
|
visibilityChange = 'webkitvisibilitychange';
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener(visibilityChange, function () {
|
||||||
|
/* eslint-disable-next-line compat/compat */
|
||||||
|
if (document[hidden]) {
|
||||||
|
onAppHidden();
|
||||||
|
} else {
|
||||||
|
onAppVisible();
|
||||||
|
}
|
||||||
|
}, false);
|
||||||
|
|
||||||
|
if (self.addEventListener) {
|
||||||
|
self.addEventListener('focus', onAppVisible);
|
||||||
|
self.addEventListener('blur', onAppHidden);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default appHost;
|
||||||
|
|
|
@ -200,7 +200,7 @@ import 'flexStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
import('scrollHelper').then(scrollHelper => {
|
import('scrollHelper').then((scrollHelper) => {
|
||||||
const fn = on ? 'on' : 'off';
|
const fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
|
|
|
@ -354,7 +354,7 @@ import 'scrollStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
import('scrollHelper').then(scrollHelper => {
|
import('scrollHelper').then((scrollHelper) => {
|
||||||
const fn = on ? 'on' : 'off';
|
const fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div style="margin: 0;padding:1.5em 2em;" class="filterDialogContent">
|
<div style="margin: 0;padding:1.5em 2em;" class="filterDialogContent">
|
||||||
|
|
||||||
<div is="emby-collapse" title="${HeaderFilters}">
|
<div is="emby-collapse" title="${Filters}">
|
||||||
<div class="collapseContent">
|
<div class="collapseContent">
|
||||||
<div class="checkboxList">
|
<div class="checkboxList">
|
||||||
<label>
|
<label>
|
||||||
|
@ -63,7 +63,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div is="emby-collapse" title="${HeaderFeatures}" class="features hide">
|
<div is="emby-collapse" title="${Features}" class="features hide">
|
||||||
<div class="collapseContent">
|
<div class="collapseContent">
|
||||||
<div class="checkboxList">
|
<div class="checkboxList">
|
||||||
<label>
|
<label>
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div is="emby-collapse" title="${HeaderTags}" class="tagFilters hide">
|
<div is="emby-collapse" title="${Tags}" class="tagFilters hide">
|
||||||
<div class="collapseContent filterOptions">
|
<div class="collapseContent filterOptions">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost', 'inputManager', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'userSettings', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button', 'flexStyles'], function (require, dom, focusManager, dialogHelper, loading, appHost, inputManager, layoutManager, connectionManager, appRouter, globalize, userSettings) {
|
define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost', 'inputManager', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'userSettings', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button', 'flexStyles'], function (require, dom, focusManager, dialogHelper, loading, appHost, inputManager, layoutManager, connectionManager, appRouter, globalize, userSettings) {
|
||||||
'use strict';
|
'use strict';
|
||||||
focusManager = focusManager.default || focusManager;
|
|
||||||
|
|
||||||
|
focusManager = focusManager.default || focusManager;
|
||||||
appRouter = appRouter.default || appRouter;
|
appRouter = appRouter.default || appRouter;
|
||||||
|
layoutManager = layoutManager.default || layoutManager;
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -153,6 +154,7 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
require(['scrollHelper'], function (scrollHelper) {
|
||||||
|
scrollHelper = scrollHelper.default || scrollHelper;
|
||||||
var fn = on ? 'on' : 'off';
|
var fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,147 +1,149 @@
|
||||||
define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectionManager', 'require', 'loading', 'scrollHelper', 'emby-checkbox', 'emby-radio', 'css!./../formdialog', 'material-icons'], function (dialogHelper, globalize, userSettings, layoutManager, connectionManager, require, loading, scrollHelper) {
|
import dialogHelper from 'dialogHelper';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import scrollHelper from 'scrollHelper';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-radio';
|
||||||
|
import 'css!./../formdialog';
|
||||||
|
import 'material-icons';
|
||||||
|
|
||||||
function saveCategories(context, options) {
|
function saveCategories(context, options) {
|
||||||
var categories = [];
|
const categories = [];
|
||||||
|
|
||||||
var chkCategorys = context.querySelectorAll('.chkCategory');
|
const chkCategorys = context.querySelectorAll('.chkCategory');
|
||||||
for (var i = 0, length = chkCategorys.length; i < length; i++) {
|
for (const chkCategory of chkCategorys) {
|
||||||
var type = chkCategorys[i].getAttribute('data-type');
|
const type = chkCategory.getAttribute('data-type');
|
||||||
|
|
||||||
if (chkCategorys[i].checked) {
|
if (chkCategory.checked) {
|
||||||
categories.push(type);
|
categories.push(type);
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (categories.length >= 4) {
|
|
||||||
categories.push('series');
|
|
||||||
}
|
|
||||||
|
|
||||||
// differentiate between none and all
|
|
||||||
categories.push('all');
|
|
||||||
options.categories = categories;
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadCategories(context, options) {
|
|
||||||
var selectedCategories = options.categories || [];
|
|
||||||
|
|
||||||
var chkCategorys = context.querySelectorAll('.chkCategory');
|
|
||||||
for (var i = 0, length = chkCategorys.length; i < length; i++) {
|
|
||||||
var type = chkCategorys[i].getAttribute('data-type');
|
|
||||||
|
|
||||||
chkCategorys[i].checked = !selectedCategories.length || selectedCategories.indexOf(type) !== -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(context) {
|
if (categories.length >= 4) {
|
||||||
var i;
|
categories.push('series');
|
||||||
var length;
|
}
|
||||||
|
|
||||||
var chkIndicators = context.querySelectorAll('.chkIndicator');
|
// differentiate between none and all
|
||||||
for (i = 0, length = chkIndicators.length; i < length; i++) {
|
categories.push('all');
|
||||||
var type = chkIndicators[i].getAttribute('data-type');
|
options.categories = categories;
|
||||||
userSettings.set('guide-indicator-' + type, chkIndicators[i].checked);
|
}
|
||||||
|
|
||||||
|
function loadCategories(context, options) {
|
||||||
|
const selectedCategories = options.categories || [];
|
||||||
|
|
||||||
|
const chkCategorys = context.querySelectorAll('.chkCategory');
|
||||||
|
for (const chkCategory of chkCategorys) {
|
||||||
|
const type = chkCategory.getAttribute('data-type');
|
||||||
|
|
||||||
|
chkCategory.checked = !selectedCategories.length || selectedCategories.indexOf(type) !== -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function save(context) {
|
||||||
|
const chkIndicators = context.querySelectorAll('.chkIndicator');
|
||||||
|
|
||||||
|
for (const chkIndicator of chkIndicators) {
|
||||||
|
const type = chkIndicator.getAttribute('data-type');
|
||||||
|
userSettings.set('guide-indicator-' + type, chkIndicator.checked);
|
||||||
|
}
|
||||||
|
|
||||||
|
userSettings.set('guide-colorcodedbackgrounds', context.querySelector('.chkColorCodedBackgrounds').checked);
|
||||||
|
userSettings.set('livetv-favoritechannelsattop', context.querySelector('.chkFavoriteChannelsAtTop').checked);
|
||||||
|
|
||||||
|
const sortBys = context.querySelectorAll('.chkSortOrder');
|
||||||
|
for (const sortBy of sortBys) {
|
||||||
|
if (sortBy.checked) {
|
||||||
|
userSettings.set('livetv-channelorder', sortBy.value);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
userSettings.set('guide-colorcodedbackgrounds', context.querySelector('.chkColorCodedBackgrounds').checked);
|
function load(context) {
|
||||||
userSettings.set('livetv-favoritechannelsattop', context.querySelector('.chkFavoriteChannelsAtTop').checked);
|
const chkIndicators = context.querySelectorAll('.chkIndicator');
|
||||||
|
|
||||||
var sortBys = context.querySelectorAll('.chkSortOrder');
|
for (const chkIndicator of chkIndicators) {
|
||||||
for (i = 0, length = sortBys.length; i < length; i++) {
|
const type = chkIndicator.getAttribute('data-type');
|
||||||
if (sortBys[i].checked) {
|
|
||||||
userSettings.set('livetv-channelorder', sortBys[i].value);
|
if (chkIndicator.getAttribute('data-default') === 'true') {
|
||||||
break;
|
chkIndicator.checked = userSettings.get('guide-indicator-' + type) !== 'false';
|
||||||
}
|
} else {
|
||||||
|
chkIndicator.checked = userSettings.get('guide-indicator-' + type) === 'true';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function load(context) {
|
context.querySelector('.chkColorCodedBackgrounds').checked = userSettings.get('guide-colorcodedbackgrounds') === 'true';
|
||||||
var i;
|
context.querySelector('.chkFavoriteChannelsAtTop').checked = userSettings.get('livetv-favoritechannelsattop') !== 'false';
|
||||||
var length;
|
|
||||||
|
|
||||||
var chkIndicators = context.querySelectorAll('.chkIndicator');
|
const sortByValue = userSettings.get('livetv-channelorder') || 'Number';
|
||||||
for (i = 0, length = chkIndicators.length; i < length; i++) {
|
|
||||||
var type = chkIndicators[i].getAttribute('data-type');
|
|
||||||
|
|
||||||
if (chkIndicators[i].getAttribute('data-default') === 'true') {
|
const sortBys = context.querySelectorAll('.chkSortOrder');
|
||||||
chkIndicators[i].checked = userSettings.get('guide-indicator-' + type) !== 'false';
|
for (const sortBy of sortBys) {
|
||||||
|
sortBy.checked = sortBy.value === sortByValue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditor(options) {
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
let settingsChanged = false;
|
||||||
|
|
||||||
|
import('text!./guide-settings.template.html').then(({ default: template }) => {
|
||||||
|
const dialogOptions = {
|
||||||
|
removeOnClose: true,
|
||||||
|
scrollY: false
|
||||||
|
};
|
||||||
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
dialogOptions.size = 'fullscreen';
|
||||||
} else {
|
} else {
|
||||||
chkIndicators[i].checked = userSettings.get('guide-indicator-' + type) === 'true';
|
dialogOptions.size = 'small';
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
context.querySelector('.chkColorCodedBackgrounds').checked = userSettings.get('guide-colorcodedbackgrounds') === 'true';
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
context.querySelector('.chkFavoriteChannelsAtTop').checked = userSettings.get('livetv-favoritechannelsattop') !== 'false';
|
|
||||||
|
|
||||||
var sortByValue = userSettings.get('livetv-channelorder') || 'Number';
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
var sortBys = context.querySelectorAll('.chkSortOrder');
|
let html = '';
|
||||||
for (i = 0, length = sortBys.length; i < length; i++) {
|
|
||||||
sortBys[i].checked = sortBys[i].value === sortByValue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showEditor(options) {
|
html += globalize.translateHtml(template, 'core');
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
var settingsChanged = false;
|
|
||||||
|
|
||||||
require(['text!./guide-settings.template.html'], function (template) {
|
dlg.innerHTML = html;
|
||||||
var dialogOptions = {
|
|
||||||
removeOnClose: true,
|
|
||||||
scrollY: false
|
|
||||||
};
|
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
dlg.addEventListener('change', function () {
|
||||||
dialogOptions.size = 'fullscreen';
|
settingsChanged = true;
|
||||||
} else {
|
|
||||||
dialogOptions.size = 'small';
|
|
||||||
}
|
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
|
||||||
|
|
||||||
var html = '';
|
|
||||||
|
|
||||||
html += globalize.translateHtml(template, 'core');
|
|
||||||
|
|
||||||
dlg.innerHTML = html;
|
|
||||||
|
|
||||||
dlg.addEventListener('change', function () {
|
|
||||||
settingsChanged = true;
|
|
||||||
});
|
|
||||||
|
|
||||||
dlg.addEventListener('close', function () {
|
|
||||||
if (layoutManager.tv) {
|
|
||||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
save(dlg);
|
|
||||||
saveCategories(dlg, options);
|
|
||||||
|
|
||||||
if (settingsChanged) {
|
|
||||||
resolve();
|
|
||||||
} else {
|
|
||||||
reject();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
|
||||||
dialogHelper.close(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
|
||||||
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
load(dlg);
|
|
||||||
loadCategories(dlg, options);
|
|
||||||
dialogHelper.open(dlg);
|
|
||||||
});
|
});
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
dlg.addEventListener('close', function () {
|
||||||
show: showEditor
|
if (layoutManager.tv) {
|
||||||
};
|
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
save(dlg);
|
||||||
|
saveCategories(dlg, options);
|
||||||
|
|
||||||
|
if (settingsChanged) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||||
|
dialogHelper.close(dlg);
|
||||||
|
});
|
||||||
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
load(dlg);
|
||||||
|
loadCategories(dlg, options);
|
||||||
|
dialogHelper.open(dlg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
show: showEditor
|
||||||
|
};
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,6 @@ import browser from 'browser';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import scrollHelper from 'scrollHelper';
|
import scrollHelper from 'scrollHelper';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import require from 'require';
|
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
import 'paper-icon-button-light';
|
import 'paper-icon-button-light';
|
||||||
import 'emby-button';
|
import 'emby-button';
|
||||||
|
@ -317,7 +316,7 @@ import 'cardStyle';
|
||||||
function showEditor(itemId, serverId, itemType) {
|
function showEditor(itemId, serverId, itemType) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
require(['text!./imageDownloader.template.html'], function (template) {
|
import('text!./imageDownloader.template.html').then(({default: template}) => {
|
||||||
const apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
currentItemId = itemId;
|
currentItemId = itemId;
|
||||||
|
|
|
@ -1,130 +1,130 @@
|
||||||
define(['playbackManager', 'serverNotifications', 'events'], function (playbackManager, serverNotifications, events) {
|
import playbackManager from 'playbackManager';
|
||||||
'use strict';
|
import serverNotifications from 'serverNotifications';
|
||||||
|
import events from 'events';
|
||||||
|
|
||||||
playbackManager = playbackManager.default || playbackManager;
|
function onUserDataChanged(e, apiClient, userData) {
|
||||||
|
const instance = this;
|
||||||
|
|
||||||
function onUserDataChanged(e, apiClient, userData) {
|
const eventsToMonitor = getEventsToMonitor(instance);
|
||||||
var instance = this;
|
|
||||||
|
|
||||||
var eventsToMonitor = getEventsToMonitor(instance);
|
|
||||||
|
|
||||||
// TODO: Check user data change reason?
|
|
||||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
|
||||||
instance.notifyRefreshNeeded();
|
|
||||||
} else if (eventsToMonitor.indexOf('markplayed') !== -1) {
|
|
||||||
instance.notifyRefreshNeeded();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function getEventsToMonitor(instance) {
|
|
||||||
var options = instance.options;
|
|
||||||
var monitor = options ? options.monitorEvents : null;
|
|
||||||
if (monitor) {
|
|
||||||
return monitor.split(',');
|
|
||||||
}
|
|
||||||
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTimerCreated(e, apiClient, data) {
|
|
||||||
var instance = this;
|
|
||||||
|
|
||||||
if (getEventsToMonitor(instance).indexOf('timers') !== -1) {
|
|
||||||
instance.notifyRefreshNeeded();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSeriesTimerCreated(e, apiClient, data) {
|
|
||||||
var instance = this;
|
|
||||||
if (getEventsToMonitor(instance).indexOf('seriestimers') !== -1) {
|
|
||||||
instance.notifyRefreshNeeded();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onTimerCancelled(e, apiClient, data) {
|
|
||||||
var instance = this;
|
|
||||||
|
|
||||||
if (getEventsToMonitor(instance).indexOf('timers') !== -1) {
|
|
||||||
instance.notifyRefreshNeeded();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSeriesTimerCancelled(e, apiClient, data) {
|
|
||||||
var instance = this;
|
|
||||||
if (getEventsToMonitor(instance).indexOf('seriestimers') !== -1) {
|
|
||||||
instance.notifyRefreshNeeded();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onLibraryChanged(e, apiClient, data) {
|
|
||||||
var instance = this;
|
|
||||||
var eventsToMonitor = getEventsToMonitor(instance);
|
|
||||||
if (eventsToMonitor.indexOf('seriestimers') !== -1 || eventsToMonitor.indexOf('timers') !== -1) {
|
|
||||||
// yes this is an assumption
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var itemsAdded = data.ItemsAdded || [];
|
|
||||||
var itemsRemoved = data.ItemsRemoved || [];
|
|
||||||
if (!itemsAdded.length && !itemsRemoved.length) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var options = instance.options || {};
|
|
||||||
var parentId = options.parentId;
|
|
||||||
if (parentId) {
|
|
||||||
var foldersAddedTo = data.FoldersAddedTo || [];
|
|
||||||
var foldersRemovedFrom = data.FoldersRemovedFrom || [];
|
|
||||||
var collectionFolders = data.CollectionFolders || [];
|
|
||||||
|
|
||||||
if (foldersAddedTo.indexOf(parentId) === -1 && foldersRemovedFrom.indexOf(parentId) === -1 && collectionFolders.indexOf(parentId) === -1) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
// TODO: Check user data change reason?
|
||||||
|
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
||||||
|
instance.notifyRefreshNeeded();
|
||||||
|
} else if (eventsToMonitor.indexOf('markplayed') !== -1) {
|
||||||
instance.notifyRefreshNeeded();
|
instance.notifyRefreshNeeded();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onPlaybackStopped(e, stopInfo) {
|
function getEventsToMonitor(instance) {
|
||||||
var instance = this;
|
const options = instance.options;
|
||||||
|
const monitor = options ? options.monitorEvents : null;
|
||||||
|
if (monitor) {
|
||||||
|
return monitor.split(',');
|
||||||
|
}
|
||||||
|
|
||||||
var state = stopInfo.state;
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
var eventsToMonitor = getEventsToMonitor(instance);
|
function onTimerCreated(e, apiClient, data) {
|
||||||
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') {
|
const instance = this;
|
||||||
if (eventsToMonitor.indexOf('videoplayback') !== -1) {
|
|
||||||
instance.notifyRefreshNeeded(true);
|
if (getEventsToMonitor(instance).indexOf('timers') !== -1) {
|
||||||
return;
|
instance.notifyRefreshNeeded();
|
||||||
}
|
return;
|
||||||
} else if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Audio') {
|
}
|
||||||
if (eventsToMonitor.indexOf('audioplayback') !== -1) {
|
}
|
||||||
instance.notifyRefreshNeeded(true);
|
|
||||||
return;
|
function onSeriesTimerCreated(e, apiClient, data) {
|
||||||
}
|
const instance = this;
|
||||||
|
if (getEventsToMonitor(instance).indexOf('seriestimers') !== -1) {
|
||||||
|
instance.notifyRefreshNeeded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onTimerCancelled(e, apiClient, data) {
|
||||||
|
const instance = this;
|
||||||
|
|
||||||
|
if (getEventsToMonitor(instance).indexOf('timers') !== -1) {
|
||||||
|
instance.notifyRefreshNeeded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSeriesTimerCancelled(e, apiClient, data) {
|
||||||
|
const instance = this;
|
||||||
|
if (getEventsToMonitor(instance).indexOf('seriestimers') !== -1) {
|
||||||
|
instance.notifyRefreshNeeded();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onLibraryChanged(e, apiClient, data) {
|
||||||
|
const instance = this;
|
||||||
|
const eventsToMonitor = getEventsToMonitor(instance);
|
||||||
|
if (eventsToMonitor.indexOf('seriestimers') !== -1 || eventsToMonitor.indexOf('timers') !== -1) {
|
||||||
|
// yes this is an assumption
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const itemsAdded = data.ItemsAdded || [];
|
||||||
|
const itemsRemoved = data.ItemsRemoved || [];
|
||||||
|
if (!itemsAdded.length && !itemsRemoved.length) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const options = instance.options || {};
|
||||||
|
const parentId = options.parentId;
|
||||||
|
if (parentId) {
|
||||||
|
const foldersAddedTo = data.FoldersAddedTo || [];
|
||||||
|
const foldersRemovedFrom = data.FoldersRemovedFrom || [];
|
||||||
|
const collectionFolders = data.CollectionFolders || [];
|
||||||
|
|
||||||
|
if (foldersAddedTo.indexOf(parentId) === -1 && foldersRemovedFrom.indexOf(parentId) === -1 && collectionFolders.indexOf(parentId) === -1) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function addNotificationEvent(instance, name, handler, owner) {
|
instance.notifyRefreshNeeded();
|
||||||
var localHandler = handler.bind(instance);
|
}
|
||||||
|
|
||||||
|
function onPlaybackStopped(e, stopInfo) {
|
||||||
|
const instance = this;
|
||||||
|
|
||||||
|
const state = stopInfo.state;
|
||||||
|
|
||||||
|
const eventsToMonitor = getEventsToMonitor(instance);
|
||||||
|
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') {
|
||||||
|
if (eventsToMonitor.indexOf('videoplayback') !== -1) {
|
||||||
|
instance.notifyRefreshNeeded(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
} else if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Audio') {
|
||||||
|
if (eventsToMonitor.indexOf('audioplayback') !== -1) {
|
||||||
|
instance.notifyRefreshNeeded(true);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function addNotificationEvent(instance, name, handler, owner) {
|
||||||
|
const localHandler = handler.bind(instance);
|
||||||
|
owner = owner || serverNotifications;
|
||||||
|
events.on(owner, name, localHandler);
|
||||||
|
instance['event_' + name] = localHandler;
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeNotificationEvent(instance, name, owner) {
|
||||||
|
const handler = instance['event_' + name];
|
||||||
|
if (handler) {
|
||||||
owner = owner || serverNotifications;
|
owner = owner || serverNotifications;
|
||||||
events.on(owner, name, localHandler);
|
events.off(owner, name, handler);
|
||||||
instance['event_' + name] = localHandler;
|
instance['event_' + name] = null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function removeNotificationEvent(instance, name, owner) {
|
class ItemsRefresher {
|
||||||
var handler = instance['event_' + name];
|
constructor(options) {
|
||||||
if (handler) {
|
|
||||||
owner = owner || serverNotifications;
|
|
||||||
events.off(owner, name, handler);
|
|
||||||
instance['event_' + name] = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function ItemsRefresher(options) {
|
|
||||||
this.options = options || {};
|
this.options = options || {};
|
||||||
|
|
||||||
addNotificationEvent(this, 'UserDataChanged', onUserDataChanged);
|
addNotificationEvent(this, 'UserDataChanged', onUserDataChanged);
|
||||||
|
@ -136,18 +136,18 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
||||||
addNotificationEvent(this, 'playbackstop', onPlaybackStopped, playbackManager);
|
addNotificationEvent(this, 'playbackstop', onPlaybackStopped, playbackManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemsRefresher.prototype.pause = function () {
|
pause() {
|
||||||
clearRefreshInterval(this, true);
|
clearRefreshInterval(this, true);
|
||||||
|
|
||||||
this.paused = true;
|
this.paused = true;
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsRefresher.prototype.resume = function (options) {
|
resume(options) {
|
||||||
this.paused = false;
|
this.paused = false;
|
||||||
|
|
||||||
var refreshIntervalEndTime = this.refreshIntervalEndTime;
|
const refreshIntervalEndTime = this.refreshIntervalEndTime;
|
||||||
if (refreshIntervalEndTime) {
|
if (refreshIntervalEndTime) {
|
||||||
var remainingMs = refreshIntervalEndTime - new Date().getTime();
|
const remainingMs = refreshIntervalEndTime - new Date().getTime();
|
||||||
if (remainingMs > 0 && !this.needsRefresh) {
|
if (remainingMs > 0 && !this.needsRefresh) {
|
||||||
resetRefreshInterval(this, remainingMs);
|
resetRefreshInterval(this, remainingMs);
|
||||||
} else {
|
} else {
|
||||||
|
@ -161,9 +161,9 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsRefresher.prototype.refreshItems = function () {
|
refreshItems() {
|
||||||
if (!this.fetchData) {
|
if (!this.fetchData) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
@ -176,15 +176,15 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
||||||
this.needsRefresh = false;
|
this.needsRefresh = false;
|
||||||
|
|
||||||
return this.fetchData().then(onDataFetched.bind(this));
|
return this.fetchData().then(onDataFetched.bind(this));
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsRefresher.prototype.notifyRefreshNeeded = function (isInForeground) {
|
notifyRefreshNeeded(isInForeground) {
|
||||||
if (this.paused) {
|
if (this.paused) {
|
||||||
this.needsRefresh = true;
|
this.needsRefresh = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeout = this.refreshTimeout;
|
const timeout = this.refreshTimeout;
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
|
@ -194,44 +194,9 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
||||||
} else {
|
} else {
|
||||||
this.refreshTimeout = setTimeout(this.refreshItems.bind(this), 10000);
|
this.refreshTimeout = setTimeout(this.refreshItems.bind(this), 10000);
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
function clearRefreshInterval(instance, isPausing) {
|
|
||||||
if (instance.refreshInterval) {
|
|
||||||
clearInterval(instance.refreshInterval);
|
|
||||||
instance.refreshInterval = null;
|
|
||||||
|
|
||||||
if (!isPausing) {
|
|
||||||
instance.refreshIntervalEndTime = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetRefreshInterval(instance, intervalMs) {
|
destroy() {
|
||||||
clearRefreshInterval(instance);
|
|
||||||
|
|
||||||
if (!intervalMs) {
|
|
||||||
var options = instance.options;
|
|
||||||
if (options) {
|
|
||||||
intervalMs = options.refreshIntervalMs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (intervalMs) {
|
|
||||||
instance.refreshInterval = setInterval(instance.notifyRefreshNeeded.bind(instance), intervalMs);
|
|
||||||
instance.refreshIntervalEndTime = new Date().getTime() + intervalMs;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onDataFetched(result) {
|
|
||||||
resetRefreshInterval(this);
|
|
||||||
|
|
||||||
if (this.afterRefresh) {
|
|
||||||
this.afterRefresh(result);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ItemsRefresher.prototype.destroy = function () {
|
|
||||||
clearRefreshInterval(this);
|
clearRefreshInterval(this);
|
||||||
|
|
||||||
removeNotificationEvent(this, 'UserDataChanged');
|
removeNotificationEvent(this, 'UserDataChanged');
|
||||||
|
@ -244,7 +209,42 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
||||||
|
|
||||||
this.fetchData = null;
|
this.fetchData = null;
|
||||||
this.options = null;
|
this.options = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ItemsRefresher;
|
function clearRefreshInterval(instance, isPausing) {
|
||||||
});
|
if (instance.refreshInterval) {
|
||||||
|
clearInterval(instance.refreshInterval);
|
||||||
|
instance.refreshInterval = null;
|
||||||
|
|
||||||
|
if (!isPausing) {
|
||||||
|
instance.refreshIntervalEndTime = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetRefreshInterval(instance, intervalMs) {
|
||||||
|
clearRefreshInterval(instance);
|
||||||
|
|
||||||
|
if (!intervalMs) {
|
||||||
|
const options = instance.options;
|
||||||
|
if (options) {
|
||||||
|
intervalMs = options.refreshIntervalMs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (intervalMs) {
|
||||||
|
instance.refreshInterval = setInterval(instance.notifyRefreshNeeded.bind(instance), intervalMs);
|
||||||
|
instance.refreshIntervalEndTime = new Date().getTime() + intervalMs;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onDataFetched(result) {
|
||||||
|
resetRefreshInterval(this);
|
||||||
|
|
||||||
|
if (this.afterRefresh) {
|
||||||
|
this.afterRefresh(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default ItemsRefresher;
|
||||||
|
|
|
@ -1,23 +1,19 @@
|
||||||
define(['browser', 'appSettings', 'events'], function (browser, appSettings, events) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import appSettings from 'appSettings';
|
||||||
|
import events from 'events';
|
||||||
|
|
||||||
browser = browser.default || browser;
|
function setLayout(instance, layout, selectedLayout) {
|
||||||
|
if (layout === selectedLayout) {
|
||||||
function setLayout(instance, layout, selectedLayout) {
|
instance[layout] = true;
|
||||||
if (layout === selectedLayout) {
|
document.documentElement.classList.add('layout-' + layout);
|
||||||
instance[layout] = true;
|
} else {
|
||||||
document.documentElement.classList.add('layout-' + layout);
|
instance[layout] = false;
|
||||||
} else {
|
document.documentElement.classList.remove('layout-' + layout);
|
||||||
instance[layout] = false;
|
|
||||||
document.documentElement.classList.remove('layout-' + layout);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function LayoutManager() {
|
class LayoutManager {
|
||||||
|
setLayout(layout, save) {
|
||||||
}
|
|
||||||
|
|
||||||
LayoutManager.prototype.setLayout = function (layout, save) {
|
|
||||||
if (!layout || layout === 'auto') {
|
if (!layout || layout === 'auto') {
|
||||||
this.autoLayout();
|
this.autoLayout();
|
||||||
|
|
||||||
|
@ -35,13 +31,13 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
|
||||||
}
|
}
|
||||||
|
|
||||||
events.trigger(this, 'modechange');
|
events.trigger(this, 'modechange');
|
||||||
};
|
}
|
||||||
|
|
||||||
LayoutManager.prototype.getSavedLayout = function (layout) {
|
getSavedLayout(layout) {
|
||||||
return appSettings.get('layout');
|
return appSettings.get('layout');
|
||||||
};
|
}
|
||||||
|
|
||||||
LayoutManager.prototype.autoLayout = function () {
|
autoLayout() {
|
||||||
// Take a guess at initial layout. The consuming app can override
|
// Take a guess at initial layout. The consuming app can override
|
||||||
if (browser.mobile) {
|
if (browser.mobile) {
|
||||||
this.setLayout('mobile', false);
|
this.setLayout('mobile', false);
|
||||||
|
@ -50,16 +46,16 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
|
||||||
} else {
|
} else {
|
||||||
this.setLayout(this.defaultLayout || 'tv', false);
|
this.setLayout(this.defaultLayout || 'tv', false);
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
LayoutManager.prototype.init = function () {
|
init() {
|
||||||
var saved = this.getSavedLayout();
|
const saved = this.getSavedLayout();
|
||||||
if (saved) {
|
if (saved) {
|
||||||
this.setLayout(saved, false);
|
this.setLayout(saved, false);
|
||||||
} else {
|
} else {
|
||||||
this.autoLayout();
|
this.autoLayout();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new LayoutManager();
|
export default new LayoutManager();
|
||||||
});
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
<div class="folders">
|
<div class="folders">
|
||||||
<div style="display: flex; align-items: center;">
|
<div style="display: flex; align-items: center;">
|
||||||
<h1 style="margin: .5em 0;">${HeadersFolders}</h1>
|
<h1 style="margin: .5em 0;">${HeadersFolders}</h1>
|
||||||
<button is="emby-button" type="button" class="fab btnAddFolder submit" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnAddFolder submit" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add"></span>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
<div class="folders hide">
|
<div class="folders hide">
|
||||||
<div style="display: flex; align-items: center;">
|
<div style="display: flex; align-items: center;">
|
||||||
<h1 style="margin: .5em 0;">${HeadersFolders}</h1>
|
<h1 style="margin: .5em 0;">${HeadersFolders}</h1>
|
||||||
<button is="emby-button" type="button" class="fab btnAddFolder submit" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnAddFolder submit" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add"></span>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -6,7 +6,6 @@ import loading from 'loading';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import connectionManager from 'connectionManager';
|
import connectionManager from 'connectionManager';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import require from 'require';
|
|
||||||
import shell from 'shell';
|
import shell from 'shell';
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
import 'emby-input';
|
import 'emby-input';
|
||||||
|
@ -37,7 +36,7 @@ import 'flexStyles';
|
||||||
|
|
||||||
function submitUpdatedItem(form, item) {
|
function submitUpdatedItem(form, item) {
|
||||||
function afterContentTypeUpdated() {
|
function afterContentTypeUpdated() {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('MessageItemSaved'));
|
toast(globalize.translate('MessageItemSaved'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -227,7 +226,7 @@ import 'flexStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
function editPerson(context, person, index) {
|
function editPerson(context, person, index) {
|
||||||
require(['personEditor'], function (personEditor) {
|
import('personEditor').then(({default: personEditor}) => {
|
||||||
personEditor.show(person).then(function (updatedPerson) {
|
personEditor.show(person).then(function (updatedPerson) {
|
||||||
const isNew = index === -1;
|
const isNew = index === -1;
|
||||||
|
|
||||||
|
@ -246,14 +245,14 @@ import 'flexStyles';
|
||||||
if (parentId) {
|
if (parentId) {
|
||||||
reload(context, parentId, item.ServerId);
|
reload(context, parentId, item.ServerId);
|
||||||
} else {
|
} else {
|
||||||
require(['appRouter'], function (appRouter) {
|
import('appRouter').then(({default: appRouter}) => {
|
||||||
appRouter.default.goHome();
|
appRouter.goHome();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showMoreMenu(context, button, user) {
|
function showMoreMenu(context, button, user) {
|
||||||
require(['itemContextMenu'], function (itemContextMenu) {
|
import('itemContextMenu').then(({default: itemContextMenu}) => {
|
||||||
var item = currentItem;
|
var item = currentItem;
|
||||||
|
|
||||||
itemContextMenu.show({
|
itemContextMenu.show({
|
||||||
|
@ -907,7 +906,7 @@ import 'flexStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
function populatePeople(context, people) {
|
function populatePeople(context, people) {
|
||||||
let lastType = '';
|
const lastType = '';
|
||||||
let html = '';
|
let html = '';
|
||||||
|
|
||||||
const elem = context.querySelector('#peopleList');
|
const elem = context.querySelector('#peopleList');
|
||||||
|
|
|
@ -2,6 +2,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
playbackManager = playbackManager.default || playbackManager;
|
playbackManager = playbackManager.default || playbackManager;
|
||||||
|
serverNotifications = serverNotifications.default || serverNotifications;
|
||||||
|
|
||||||
function onOneDocumentClick() {
|
function onOneDocumentClick() {
|
||||||
document.removeEventListener('click', onOneDocumentClick);
|
document.removeEventListener('click', onOneDocumentClick);
|
||||||
|
|
|
@ -8,7 +8,7 @@ import * as userSettings from 'userSettings';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
import connectionManager from 'connectionManager';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import apphost from 'apphost';
|
import appHost from 'apphost';
|
||||||
import screenfull from 'screenfull';
|
import screenfull from 'screenfull';
|
||||||
|
|
||||||
function enableLocalPlaylistManagement(player) {
|
function enableLocalPlaylistManagement(player) {
|
||||||
|
@ -322,7 +322,7 @@ function getAudioStreamUrl(item, transcodingProfile, directPlayContainers, maxBi
|
||||||
PlaySessionId: startingPlaySession,
|
PlaySessionId: startingPlaySession,
|
||||||
StartTimeTicks: startPosition || 0,
|
StartTimeTicks: startPosition || 0,
|
||||||
EnableRedirection: true,
|
EnableRedirection: true,
|
||||||
EnableRemoteMedia: apphost.supports('remoteaudio')
|
EnableRemoteMedia: appHost.supports('remoteaudio')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -606,7 +606,7 @@ function supportsDirectPlay(apiClient, item, mediaSource) {
|
||||||
const isFolderRip = mediaSource.VideoType === 'BluRay' || mediaSource.VideoType === 'Dvd' || mediaSource.VideoType === 'HdDvd';
|
const isFolderRip = mediaSource.VideoType === 'BluRay' || mediaSource.VideoType === 'Dvd' || mediaSource.VideoType === 'HdDvd';
|
||||||
|
|
||||||
if (mediaSource.SupportsDirectPlay || isFolderRip) {
|
if (mediaSource.SupportsDirectPlay || isFolderRip) {
|
||||||
if (mediaSource.IsRemote && !apphost.supports('remotevideo')) {
|
if (mediaSource.IsRemote && !appHost.supports('remotevideo')) {
|
||||||
return Promise.resolve(false);
|
return Promise.resolve(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3156,7 +3156,7 @@ class PlaybackManager {
|
||||||
return streamInfo ? streamInfo.playbackStartTimeTicks : null;
|
return streamInfo ? streamInfo.playbackStartTimeTicks : null;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (apphost.supports('remotecontrol')) {
|
if (appHost.supports('remotecontrol')) {
|
||||||
import('serverNotifications').then(({ default: serverNotifications }) => {
|
import('serverNotifications').then(({ default: serverNotifications }) => {
|
||||||
events.on(serverNotifications, 'ServerShuttingDown', self.setDefaultPlayerActive.bind(self));
|
events.on(serverNotifications, 'ServerShuttingDown', self.setDefaultPlayerActive.bind(self));
|
||||||
events.on(serverNotifications, 'ServerRestarting', self.setDefaultPlayerActive.bind(self));
|
events.on(serverNotifications, 'ServerRestarting', self.setDefaultPlayerActive.bind(self));
|
||||||
|
@ -3520,7 +3520,7 @@ class PlaybackManager {
|
||||||
'PlayTrailers'
|
'PlayTrailers'
|
||||||
];
|
];
|
||||||
|
|
||||||
if (apphost.supports('fullscreenchange')) {
|
if (appHost.supports('fullscreenchange')) {
|
||||||
list.push('ToggleFullscreen');
|
list.push('ToggleFullscreen');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,6 +99,6 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block btnSave hide">
|
<button is="emby-button" type="submit" class="raised button-submit block btnSave hide">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -210,7 +210,7 @@ import 'emby-button';
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
import('scrollHelper').then(scrollHelper => {
|
import('scrollHelper').then((scrollHelper) => {
|
||||||
const fn = on ? 'on' : 'off';
|
const fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,160 +1,158 @@
|
||||||
define(['globalize'], function (globalize) {
|
import globalize from 'globalize';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function getVideoQualityOptions(options) {
|
export function getVideoQualityOptions(options) {
|
||||||
var maxStreamingBitrate = options.currentMaxBitrate;
|
var maxStreamingBitrate = options.currentMaxBitrate;
|
||||||
var videoWidth = options.videoWidth;
|
var videoWidth = options.videoWidth;
|
||||||
var videoHeight = options.videoHeight;
|
var videoHeight = options.videoHeight;
|
||||||
|
|
||||||
// If the aspect ratio is less than 16/9 (1.77), set the width as if it were pillarboxed.
|
// If the aspect ratio is less than 16/9 (1.77), set the width as if it were pillarboxed.
|
||||||
// 4:3 1440x1080 -> 1920x1080
|
// 4:3 1440x1080 -> 1920x1080
|
||||||
if (videoWidth / videoHeight < 16 / 9) {
|
if (videoWidth / videoHeight < 16 / 9) {
|
||||||
videoWidth = videoHeight * (16 / 9);
|
videoWidth = videoHeight * (16 / 9);
|
||||||
}
|
|
||||||
|
|
||||||
var maxAllowedWidth = videoWidth || 4096;
|
|
||||||
|
|
||||||
var qualityOptions = [];
|
|
||||||
|
|
||||||
if (maxAllowedWidth >= 3800) {
|
|
||||||
qualityOptions.push({ name: '4K - 120 Mbps', maxHeight: 2160, bitrate: 120000000 });
|
|
||||||
qualityOptions.push({ name: '4K - 100 Mbps', maxHeight: 2160, bitrate: 100000000 });
|
|
||||||
qualityOptions.push({ name: '4K - 80 Mbps', maxHeight: 2160, bitrate: 80000000 });
|
|
||||||
}
|
|
||||||
|
|
||||||
// Some 1080- videos are reported as 1912?
|
|
||||||
if (maxAllowedWidth >= 1900) {
|
|
||||||
qualityOptions.push({ name: '1080p - 60 Mbps', maxHeight: 1080, bitrate: 60000000 });
|
|
||||||
qualityOptions.push({ name: '1080p - 50 Mbps', maxHeight: 1080, bitrate: 50000000 });
|
|
||||||
qualityOptions.push({ name: '1080p - 40 Mbps', maxHeight: 1080, bitrate: 40000000 });
|
|
||||||
qualityOptions.push({ name: '1080p - 30 Mbps', maxHeight: 1080, bitrate: 30000000 });
|
|
||||||
qualityOptions.push({ name: '1080p - 25 Mbps', maxHeight: 1080, bitrate: 25000000 });
|
|
||||||
qualityOptions.push({ name: '1080p - 20 Mbps', maxHeight: 1080, bitrate: 20000000 });
|
|
||||||
qualityOptions.push({ name: '1080p - 15 Mbps', maxHeight: 1080, bitrate: 15000000 });
|
|
||||||
qualityOptions.push({ name: '1080p - 10 Mbps', maxHeight: 1080, bitrate: 10000001 });
|
|
||||||
qualityOptions.push({ name: '1080p - 8 Mbps', maxHeight: 1080, bitrate: 8000001 });
|
|
||||||
qualityOptions.push({ name: '1080p - 6 Mbps', maxHeight: 1080, bitrate: 6000001 });
|
|
||||||
qualityOptions.push({ name: '1080p - 5 Mbps', maxHeight: 1080, bitrate: 5000001 });
|
|
||||||
qualityOptions.push({ name: '1080p - 4 Mbps', maxHeight: 1080, bitrate: 4000002 });
|
|
||||||
} else if (maxAllowedWidth >= 1260) {
|
|
||||||
qualityOptions.push({ name: '720p - 10 Mbps', maxHeight: 720, bitrate: 10000000 });
|
|
||||||
qualityOptions.push({ name: '720p - 8 Mbps', maxHeight: 720, bitrate: 8000000 });
|
|
||||||
qualityOptions.push({ name: '720p - 6 Mbps', maxHeight: 720, bitrate: 6000000 });
|
|
||||||
qualityOptions.push({ name: '720p - 5 Mbps', maxHeight: 720, bitrate: 5000000 });
|
|
||||||
} else if (maxAllowedWidth >= 620) {
|
|
||||||
qualityOptions.push({ name: '480p - 4 Mbps', maxHeight: 480, bitrate: 4000001 });
|
|
||||||
qualityOptions.push({ name: '480p - 3 Mbps', maxHeight: 480, bitrate: 3000001 });
|
|
||||||
qualityOptions.push({ name: '480p - 2.5 Mbps', maxHeight: 480, bitrate: 2500000 });
|
|
||||||
qualityOptions.push({ name: '480p - 2 Mbps', maxHeight: 480, bitrate: 2000001 });
|
|
||||||
qualityOptions.push({ name: '480p - 1.5 Mbps', maxHeight: 480, bitrate: 1500001 });
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxAllowedWidth >= 1260) {
|
|
||||||
qualityOptions.push({ name: '720p - 4 Mbps', maxHeight: 720, bitrate: 4000000 });
|
|
||||||
qualityOptions.push({ name: '720p - 3 Mbps', maxHeight: 720, bitrate: 3000000 });
|
|
||||||
qualityOptions.push({ name: '720p - 2 Mbps', maxHeight: 720, bitrate: 2000000 });
|
|
||||||
|
|
||||||
// The extra 1 is because they're keyed off the bitrate value
|
|
||||||
qualityOptions.push({ name: '720p - 1.5 Mbps', maxHeight: 720, bitrate: 1500000 });
|
|
||||||
qualityOptions.push({ name: '720p - 1 Mbps', maxHeight: 720, bitrate: 1000001 });
|
|
||||||
}
|
|
||||||
|
|
||||||
qualityOptions.push({ name: '480p - 1 Mbps', maxHeight: 480, bitrate: 1000000 });
|
|
||||||
qualityOptions.push({ name: '480p - 720 kbps', maxHeight: 480, bitrate: 720000 });
|
|
||||||
qualityOptions.push({ name: '480p - 420 kbps', maxHeight: 480, bitrate: 420000 });
|
|
||||||
qualityOptions.push({ name: '360p', maxHeight: 360, bitrate: 400000 });
|
|
||||||
qualityOptions.push({ name: '240p', maxHeight: 240, bitrate: 320000 });
|
|
||||||
qualityOptions.push({ name: '144p', maxHeight: 144, bitrate: 192000 });
|
|
||||||
|
|
||||||
var autoQualityOption = {
|
|
||||||
name: globalize.translate('Auto'),
|
|
||||||
bitrate: 0,
|
|
||||||
selected: options.isAutomaticBitrateEnabled
|
|
||||||
};
|
|
||||||
|
|
||||||
if (options.enableAuto) {
|
|
||||||
qualityOptions.push(autoQualityOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxStreamingBitrate) {
|
|
||||||
var selectedIndex = -1;
|
|
||||||
for (var i = 0, length = qualityOptions.length; i < length; i++) {
|
|
||||||
var option = qualityOptions[i];
|
|
||||||
|
|
||||||
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
|
|
||||||
selectedIndex = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedIndex === -1) {
|
|
||||||
selectedIndex = qualityOptions.length - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentQualityOption = qualityOptions[selectedIndex];
|
|
||||||
|
|
||||||
if (!options.isAutomaticBitrateEnabled) {
|
|
||||||
currentQualityOption.selected = true;
|
|
||||||
} else {
|
|
||||||
autoQualityOption.autoText = currentQualityOption.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return qualityOptions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAudioQualityOptions(options) {
|
var maxAllowedWidth = videoWidth || 4096;
|
||||||
var maxStreamingBitrate = options.currentMaxBitrate;
|
|
||||||
|
|
||||||
var qualityOptions = [];
|
var qualityOptions = [];
|
||||||
|
|
||||||
qualityOptions.push({ name: '2 Mbps', bitrate: 2000000 });
|
if (maxAllowedWidth >= 3800) {
|
||||||
qualityOptions.push({ name: '1.5 Mbps', bitrate: 1500000 });
|
qualityOptions.push({ name: '4K - 120 Mbps', maxHeight: 2160, bitrate: 120000000 });
|
||||||
qualityOptions.push({ name: '1 Mbps', bitrate: 1000000 });
|
qualityOptions.push({ name: '4K - 100 Mbps', maxHeight: 2160, bitrate: 100000000 });
|
||||||
qualityOptions.push({ name: '320 kbps', bitrate: 320000 });
|
qualityOptions.push({ name: '4K - 80 Mbps', maxHeight: 2160, bitrate: 80000000 });
|
||||||
qualityOptions.push({ name: '256 kbps', bitrate: 256000 });
|
|
||||||
qualityOptions.push({ name: '192 kbps', bitrate: 192000 });
|
|
||||||
qualityOptions.push({ name: '128 kbps', bitrate: 128000 });
|
|
||||||
qualityOptions.push({ name: '96 kbps', bitrate: 96000 });
|
|
||||||
qualityOptions.push({ name: '64 kbps', bitrate: 64000 });
|
|
||||||
|
|
||||||
var autoQualityOption = {
|
|
||||||
name: globalize.translate('Auto'),
|
|
||||||
bitrate: 0,
|
|
||||||
selected: options.isAutomaticBitrateEnabled
|
|
||||||
};
|
|
||||||
|
|
||||||
if (options.enableAuto) {
|
|
||||||
qualityOptions.push(autoQualityOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (maxStreamingBitrate) {
|
|
||||||
var selectedIndex = -1;
|
|
||||||
for (var i = 0, length = qualityOptions.length; i < length; i++) {
|
|
||||||
var option = qualityOptions[i];
|
|
||||||
|
|
||||||
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
|
|
||||||
selectedIndex = i;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (selectedIndex === -1) {
|
|
||||||
selectedIndex = qualityOptions.length - 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentQualityOption = qualityOptions[selectedIndex];
|
|
||||||
|
|
||||||
if (!options.isAutomaticBitrateEnabled) {
|
|
||||||
currentQualityOption.selected = true;
|
|
||||||
} else {
|
|
||||||
autoQualityOption.autoText = currentQualityOption.name;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return qualityOptions;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
// Some 1080- videos are reported as 1912?
|
||||||
getVideoQualityOptions: getVideoQualityOptions,
|
if (maxAllowedWidth >= 1900) {
|
||||||
getAudioQualityOptions: getAudioQualityOptions
|
qualityOptions.push({ name: '1080p - 60 Mbps', maxHeight: 1080, bitrate: 60000000 });
|
||||||
|
qualityOptions.push({ name: '1080p - 50 Mbps', maxHeight: 1080, bitrate: 50000000 });
|
||||||
|
qualityOptions.push({ name: '1080p - 40 Mbps', maxHeight: 1080, bitrate: 40000000 });
|
||||||
|
qualityOptions.push({ name: '1080p - 30 Mbps', maxHeight: 1080, bitrate: 30000000 });
|
||||||
|
qualityOptions.push({ name: '1080p - 25 Mbps', maxHeight: 1080, bitrate: 25000000 });
|
||||||
|
qualityOptions.push({ name: '1080p - 20 Mbps', maxHeight: 1080, bitrate: 20000000 });
|
||||||
|
qualityOptions.push({ name: '1080p - 15 Mbps', maxHeight: 1080, bitrate: 15000000 });
|
||||||
|
qualityOptions.push({ name: '1080p - 10 Mbps', maxHeight: 1080, bitrate: 10000001 });
|
||||||
|
qualityOptions.push({ name: '1080p - 8 Mbps', maxHeight: 1080, bitrate: 8000001 });
|
||||||
|
qualityOptions.push({ name: '1080p - 6 Mbps', maxHeight: 1080, bitrate: 6000001 });
|
||||||
|
qualityOptions.push({ name: '1080p - 5 Mbps', maxHeight: 1080, bitrate: 5000001 });
|
||||||
|
qualityOptions.push({ name: '1080p - 4 Mbps', maxHeight: 1080, bitrate: 4000002 });
|
||||||
|
} else if (maxAllowedWidth >= 1260) {
|
||||||
|
qualityOptions.push({ name: '720p - 10 Mbps', maxHeight: 720, bitrate: 10000000 });
|
||||||
|
qualityOptions.push({ name: '720p - 8 Mbps', maxHeight: 720, bitrate: 8000000 });
|
||||||
|
qualityOptions.push({ name: '720p - 6 Mbps', maxHeight: 720, bitrate: 6000000 });
|
||||||
|
qualityOptions.push({ name: '720p - 5 Mbps', maxHeight: 720, bitrate: 5000000 });
|
||||||
|
} else if (maxAllowedWidth >= 620) {
|
||||||
|
qualityOptions.push({ name: '480p - 4 Mbps', maxHeight: 480, bitrate: 4000001 });
|
||||||
|
qualityOptions.push({ name: '480p - 3 Mbps', maxHeight: 480, bitrate: 3000001 });
|
||||||
|
qualityOptions.push({ name: '480p - 2.5 Mbps', maxHeight: 480, bitrate: 2500000 });
|
||||||
|
qualityOptions.push({ name: '480p - 2 Mbps', maxHeight: 480, bitrate: 2000001 });
|
||||||
|
qualityOptions.push({ name: '480p - 1.5 Mbps', maxHeight: 480, bitrate: 1500001 });
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxAllowedWidth >= 1260) {
|
||||||
|
qualityOptions.push({ name: '720p - 4 Mbps', maxHeight: 720, bitrate: 4000000 });
|
||||||
|
qualityOptions.push({ name: '720p - 3 Mbps', maxHeight: 720, bitrate: 3000000 });
|
||||||
|
qualityOptions.push({ name: '720p - 2 Mbps', maxHeight: 720, bitrate: 2000000 });
|
||||||
|
|
||||||
|
// The extra 1 is because they're keyed off the bitrate value
|
||||||
|
qualityOptions.push({ name: '720p - 1.5 Mbps', maxHeight: 720, bitrate: 1500000 });
|
||||||
|
qualityOptions.push({ name: '720p - 1 Mbps', maxHeight: 720, bitrate: 1000001 });
|
||||||
|
}
|
||||||
|
|
||||||
|
qualityOptions.push({ name: '480p - 1 Mbps', maxHeight: 480, bitrate: 1000000 });
|
||||||
|
qualityOptions.push({ name: '480p - 720 kbps', maxHeight: 480, bitrate: 720000 });
|
||||||
|
qualityOptions.push({ name: '480p - 420 kbps', maxHeight: 480, bitrate: 420000 });
|
||||||
|
qualityOptions.push({ name: '360p', maxHeight: 360, bitrate: 400000 });
|
||||||
|
qualityOptions.push({ name: '240p', maxHeight: 240, bitrate: 320000 });
|
||||||
|
qualityOptions.push({ name: '144p', maxHeight: 144, bitrate: 192000 });
|
||||||
|
|
||||||
|
var autoQualityOption = {
|
||||||
|
name: globalize.translate('Auto'),
|
||||||
|
bitrate: 0,
|
||||||
|
selected: options.isAutomaticBitrateEnabled
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
if (options.enableAuto) {
|
||||||
|
qualityOptions.push(autoQualityOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxStreamingBitrate) {
|
||||||
|
var selectedIndex = -1;
|
||||||
|
for (var i = 0, length = qualityOptions.length; i < length; i++) {
|
||||||
|
var option = qualityOptions[i];
|
||||||
|
|
||||||
|
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
|
||||||
|
selectedIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedIndex === -1) {
|
||||||
|
selectedIndex = qualityOptions.length - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentQualityOption = qualityOptions[selectedIndex];
|
||||||
|
|
||||||
|
if (!options.isAutomaticBitrateEnabled) {
|
||||||
|
currentQualityOption.selected = true;
|
||||||
|
} else {
|
||||||
|
autoQualityOption.autoText = currentQualityOption.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return qualityOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function getAudioQualityOptions(options) {
|
||||||
|
var maxStreamingBitrate = options.currentMaxBitrate;
|
||||||
|
|
||||||
|
var qualityOptions = [];
|
||||||
|
|
||||||
|
qualityOptions.push({ name: '2 Mbps', bitrate: 2000000 });
|
||||||
|
qualityOptions.push({ name: '1.5 Mbps', bitrate: 1500000 });
|
||||||
|
qualityOptions.push({ name: '1 Mbps', bitrate: 1000000 });
|
||||||
|
qualityOptions.push({ name: '320 kbps', bitrate: 320000 });
|
||||||
|
qualityOptions.push({ name: '256 kbps', bitrate: 256000 });
|
||||||
|
qualityOptions.push({ name: '192 kbps', bitrate: 192000 });
|
||||||
|
qualityOptions.push({ name: '128 kbps', bitrate: 128000 });
|
||||||
|
qualityOptions.push({ name: '96 kbps', bitrate: 96000 });
|
||||||
|
qualityOptions.push({ name: '64 kbps', bitrate: 64000 });
|
||||||
|
|
||||||
|
var autoQualityOption = {
|
||||||
|
name: globalize.translate('Auto'),
|
||||||
|
bitrate: 0,
|
||||||
|
selected: options.isAutomaticBitrateEnabled
|
||||||
|
};
|
||||||
|
|
||||||
|
if (options.enableAuto) {
|
||||||
|
qualityOptions.push(autoQualityOption);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (maxStreamingBitrate) {
|
||||||
|
var selectedIndex = -1;
|
||||||
|
for (var i = 0, length = qualityOptions.length; i < length; i++) {
|
||||||
|
var option = qualityOptions[i];
|
||||||
|
|
||||||
|
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
|
||||||
|
selectedIndex = i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (selectedIndex === -1) {
|
||||||
|
selectedIndex = qualityOptions.length - 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
var currentQualityOption = qualityOptions[selectedIndex];
|
||||||
|
|
||||||
|
if (!options.isAutomaticBitrateEnabled) {
|
||||||
|
currentQualityOption.selected = true;
|
||||||
|
} else {
|
||||||
|
autoQualityOption.autoText = currentQualityOption.name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return qualityOptions;
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
getVideoQualityOptions,
|
||||||
|
getAudioQualityOptions
|
||||||
|
};
|
||||||
|
|
|
@ -1,37 +1,40 @@
|
||||||
define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields'], function (globalize, connectionManager, require, loading, appHost, dom, recordingHelper, events) {
|
import connectionManager from 'connectionManager';
|
||||||
'use strict';
|
import dom from 'dom';
|
||||||
|
import recordingHelper from 'recordingHelper';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'css!./recordingfields';
|
||||||
|
|
||||||
recordingHelper = recordingHelper.default || recordingHelper;
|
function onRecordingButtonClick(e) {
|
||||||
|
const item = this.item;
|
||||||
|
|
||||||
function onRecordingButtonClick(e) {
|
if (item) {
|
||||||
var item = this.item;
|
const serverId = item.ServerId;
|
||||||
|
const programId = item.Id;
|
||||||
|
const timerId = item.TimerId;
|
||||||
|
const timerStatus = item.Status;
|
||||||
|
const seriesTimerId = item.SeriesTimerId;
|
||||||
|
|
||||||
if (item) {
|
const instance = this;
|
||||||
var serverId = item.ServerId;
|
|
||||||
var programId = item.Id;
|
|
||||||
var timerId = item.TimerId;
|
|
||||||
var timerStatus = item.Status;
|
|
||||||
var seriesTimerId = item.SeriesTimerId;
|
|
||||||
|
|
||||||
var instance = this;
|
recordingHelper.toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId).then(function () {
|
||||||
|
instance.refresh(serverId, programId);
|
||||||
recordingHelper.toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId).then(function () {
|
});
|
||||||
instance.refresh(serverId, programId);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function setButtonIcon(button, icon) {
|
function setButtonIcon(button, icon) {
|
||||||
var inner = button.querySelector('.material-icons');
|
const inner = button.querySelector('.material-icons');
|
||||||
inner.classList.remove('fiber_smart_record');
|
inner.classList.remove('fiber_smart_record');
|
||||||
inner.classList.remove('fiber_manual_record');
|
inner.classList.remove('fiber_manual_record');
|
||||||
inner.classList.add(icon);
|
inner.classList.add(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
function RecordingButton(options) {
|
class RecordingButton {
|
||||||
|
constructor(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
var button = options.button;
|
const button = options.button;
|
||||||
|
|
||||||
setButtonIcon(button, 'fiber_manual_record');
|
setButtonIcon(button, 'fiber_manual_record');
|
||||||
|
|
||||||
|
@ -41,7 +44,7 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
||||||
this.refresh(options.itemId, options.serverId);
|
this.refresh(options.itemId, options.serverId);
|
||||||
}
|
}
|
||||||
|
|
||||||
var clickFn = onRecordingButtonClick.bind(this);
|
const clickFn = onRecordingButtonClick.bind(this);
|
||||||
this.clickFn = clickFn;
|
this.clickFn = clickFn;
|
||||||
|
|
||||||
dom.addEventListener(button, 'click', clickFn, {
|
dom.addEventListener(button, 'click', clickFn, {
|
||||||
|
@ -49,39 +52,17 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIndicatorIcon(item) {
|
refresh(serverId, itemId) {
|
||||||
var status;
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
const self = this;
|
||||||
if (item.Type === 'SeriesTimer') {
|
|
||||||
return 'fiber_smart_record';
|
|
||||||
} else if (item.TimerId || item.SeriesTimerId) {
|
|
||||||
status = item.Status || 'Cancelled';
|
|
||||||
} else if (item.Type === 'Timer') {
|
|
||||||
status = item.Status;
|
|
||||||
} else {
|
|
||||||
return 'fiber_manual_record';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (item.SeriesTimerId) {
|
|
||||||
if (status !== 'Cancelled') {
|
|
||||||
return 'fiber_smart_record';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'fiber_manual_record';
|
|
||||||
}
|
|
||||||
|
|
||||||
RecordingButton.prototype.refresh = function (serverId, itemId) {
|
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
|
||||||
var self = this;
|
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||||
self.refreshItem(item);
|
self.refreshItem(item);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
RecordingButton.prototype.refreshItem = function (item) {
|
refreshItem(item) {
|
||||||
var options = this.options;
|
const options = this.options;
|
||||||
var button = options.button;
|
const button = options.button;
|
||||||
this.item = item;
|
this.item = item;
|
||||||
setButtonIcon(button, getIndicatorIcon(item));
|
setButtonIcon(button, getIndicatorIcon(item));
|
||||||
|
|
||||||
|
@ -90,15 +71,15 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
||||||
} else {
|
} else {
|
||||||
button.classList.remove('recordingIcon-active');
|
button.classList.remove('recordingIcon-active');
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
RecordingButton.prototype.destroy = function () {
|
destroy() {
|
||||||
var options = this.options;
|
const options = this.options;
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
var button = options.button;
|
const button = options.button;
|
||||||
|
|
||||||
var clickFn = this.clickFn;
|
const clickFn = this.clickFn;
|
||||||
|
|
||||||
if (clickFn) {
|
if (clickFn) {
|
||||||
dom.removeEventListener(button, 'click', clickFn, {
|
dom.removeEventListener(button, 'click', clickFn, {
|
||||||
|
@ -109,7 +90,29 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
||||||
|
|
||||||
this.options = null;
|
this.options = null;
|
||||||
this.item = null;
|
this.item = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return RecordingButton;
|
function getIndicatorIcon(item) {
|
||||||
});
|
let status;
|
||||||
|
|
||||||
|
if (item.Type === 'SeriesTimer') {
|
||||||
|
return 'fiber_smart_record';
|
||||||
|
} else if (item.TimerId || item.SeriesTimerId) {
|
||||||
|
status = item.Status || 'Cancelled';
|
||||||
|
} else if (item.Type === 'Timer') {
|
||||||
|
status = item.Status;
|
||||||
|
} else {
|
||||||
|
return 'fiber_manual_record';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.SeriesTimerId) {
|
||||||
|
if (status !== 'Cancelled') {
|
||||||
|
return 'fiber_smart_record';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return 'fiber_manual_record';
|
||||||
|
}
|
||||||
|
|
||||||
|
export default RecordingButton;
|
||||||
|
|
|
@ -1,187 +1,204 @@
|
||||||
define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'datetime', 'imageLoader', 'recordingFields', 'events', 'emby-checkbox', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, datetime, imageLoader, recordingFields, events) {
|
import dialogHelper from 'dialogHelper';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import mediaInfo from 'mediaInfo';
|
||||||
|
import connectionManager from 'connectionManager';
|
||||||
|
import require from 'require';
|
||||||
|
import loading from 'loading';
|
||||||
|
import scrollHelper from 'scrollHelper';
|
||||||
|
import datetime from 'datetime';
|
||||||
|
import imageLoader from 'imageLoader';
|
||||||
|
import recordingFields from 'recordingFields';
|
||||||
|
import events from 'events';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'emby-collapse';
|
||||||
|
import 'emby-input';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'css!./../formdialog';
|
||||||
|
import 'css!./recordingcreator';
|
||||||
|
import 'material-icons';
|
||||||
|
|
||||||
var currentDialog;
|
let currentDialog;
|
||||||
var closeAction;
|
let closeAction;
|
||||||
var currentRecordingFields;
|
let currentRecordingFields;
|
||||||
|
|
||||||
function closeDialog() {
|
function closeDialog() {
|
||||||
dialogHelper.close(currentDialog);
|
dialogHelper.close(currentDialog);
|
||||||
|
}
|
||||||
|
|
||||||
|
function init(context) {
|
||||||
|
context.querySelector('.btnPlay').addEventListener('click', function () {
|
||||||
|
closeAction = 'play';
|
||||||
|
closeDialog();
|
||||||
|
});
|
||||||
|
|
||||||
|
context.querySelector('.btnCancel').addEventListener('click', function () {
|
||||||
|
closeAction = null;
|
||||||
|
closeDialog();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getImageUrl(item, apiClient, imageHeight) {
|
||||||
|
const imageTags = item.ImageTags || {};
|
||||||
|
|
||||||
|
if (item.PrimaryImageTag) {
|
||||||
|
imageTags.Primary = item.PrimaryImageTag;
|
||||||
}
|
}
|
||||||
|
|
||||||
function init(context) {
|
if (imageTags.Primary) {
|
||||||
context.querySelector('.btnPlay').addEventListener('click', function () {
|
return apiClient.getScaledImageUrl(item.Id, {
|
||||||
closeAction = 'play';
|
type: 'Primary',
|
||||||
closeDialog();
|
maxHeight: imageHeight,
|
||||||
|
tag: item.ImageTags.Primary
|
||||||
});
|
});
|
||||||
|
} else if (imageTags.Thumb) {
|
||||||
context.querySelector('.btnCancel').addEventListener('click', function () {
|
return apiClient.getScaledImageUrl(item.Id, {
|
||||||
closeAction = null;
|
type: 'Thumb',
|
||||||
closeDialog();
|
maxHeight: imageHeight,
|
||||||
|
tag: item.ImageTags.Thumb
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageUrl(item, apiClient, imageHeight) {
|
return null;
|
||||||
var imageTags = item.ImageTags || {};
|
}
|
||||||
|
|
||||||
if (item.PrimaryImageTag) {
|
function renderRecording(context, defaultTimer, program, apiClient, refreshRecordingStateOnly) {
|
||||||
imageTags.Primary = item.PrimaryImageTag;
|
if (!refreshRecordingStateOnly) {
|
||||||
|
const imgUrl = getImageUrl(program, apiClient, 200);
|
||||||
|
const imageContainer = context.querySelector('.recordingDialog-imageContainer');
|
||||||
|
|
||||||
|
if (imgUrl) {
|
||||||
|
imageContainer.innerHTML = '<img src="' + require.toUrl('.').split('?')[0] + '/empty.png" data-src="' + imgUrl + '" class="recordingDialog-img lazy" />';
|
||||||
|
imageContainer.classList.remove('hide');
|
||||||
|
|
||||||
|
imageLoader.lazyChildren(imageContainer);
|
||||||
|
} else {
|
||||||
|
imageContainer.innerHTML = '';
|
||||||
|
imageContainer.classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (imageTags.Primary) {
|
context.querySelector('.recordingDialog-itemName').innerHTML = program.Name;
|
||||||
return apiClient.getScaledImageUrl(item.Id, {
|
context.querySelector('.formDialogHeaderTitle').innerHTML = program.Name;
|
||||||
type: 'Primary',
|
context.querySelector('.itemGenres').innerHTML = (program.Genres || []).join(' / ');
|
||||||
maxHeight: imageHeight,
|
context.querySelector('.itemOverview').innerHTML = program.Overview || '';
|
||||||
tag: item.ImageTags.Primary
|
|
||||||
});
|
const formDialogFooter = context.querySelector('.formDialogFooter');
|
||||||
} else if (imageTags.Thumb) {
|
const now = new Date();
|
||||||
return apiClient.getScaledImageUrl(item.Id, {
|
if (now >= datetime.parseISO8601Date(program.StartDate, true) && now < datetime.parseISO8601Date(program.EndDate, true)) {
|
||||||
type: 'Thumb',
|
formDialogFooter.classList.remove('hide');
|
||||||
maxHeight: imageHeight,
|
} else {
|
||||||
tag: item.ImageTags.Thumb
|
formDialogFooter.classList.add('hide');
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
context.querySelector('.itemMiscInfoPrimary').innerHTML = mediaInfo.getPrimaryMediaInfoHtml(program);
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderRecording(context, defaultTimer, program, apiClient, refreshRecordingStateOnly) {
|
context.querySelector('.itemMiscInfoSecondary').innerHTML = mediaInfo.getSecondaryMediaInfoHtml(program, {
|
||||||
if (!refreshRecordingStateOnly) {
|
});
|
||||||
var imgUrl = getImageUrl(program, apiClient, 200);
|
|
||||||
var imageContainer = context.querySelector('.recordingDialog-imageContainer');
|
|
||||||
|
|
||||||
if (imgUrl) {
|
loading.hide();
|
||||||
imageContainer.innerHTML = '<img src="' + require.toUrl('.').split('?')[0] + '/empty.png" data-src="' + imgUrl + '" class="recordingDialog-img lazy" />';
|
}
|
||||||
imageContainer.classList.remove('hide');
|
|
||||||
|
|
||||||
imageLoader.lazyChildren(imageContainer);
|
function reload(context, programId, serverId, refreshRecordingStateOnly) {
|
||||||
} else {
|
loading.show();
|
||||||
imageContainer.innerHTML = '';
|
|
||||||
imageContainer.classList.add('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
context.querySelector('.recordingDialog-itemName').innerHTML = program.Name;
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
context.querySelector('.formDialogHeaderTitle').innerHTML = program.Name;
|
|
||||||
context.querySelector('.itemGenres').innerHTML = (program.Genres || []).join(' / ');
|
|
||||||
context.querySelector('.itemOverview').innerHTML = program.Overview || '';
|
|
||||||
|
|
||||||
var formDialogFooter = context.querySelector('.formDialogFooter');
|
const promise1 = apiClient.getNewLiveTvTimerDefaults({ programId: programId });
|
||||||
var now = new Date();
|
const promise2 = apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId());
|
||||||
if (now >= datetime.parseISO8601Date(program.StartDate, true) && now < datetime.parseISO8601Date(program.EndDate, true)) {
|
|
||||||
formDialogFooter.classList.remove('hide');
|
|
||||||
} else {
|
|
||||||
formDialogFooter.classList.add('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
context.querySelector('.itemMiscInfoPrimary').innerHTML = mediaInfo.getPrimaryMediaInfoHtml(program);
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
}
|
const defaults = responses[0];
|
||||||
|
const program = responses[1];
|
||||||
|
|
||||||
context.querySelector('.itemMiscInfoSecondary').innerHTML = mediaInfo.getSecondaryMediaInfoHtml(program, {
|
renderRecording(context, defaults, program, apiClient, refreshRecordingStateOnly);
|
||||||
});
|
});
|
||||||
|
}
|
||||||
|
|
||||||
loading.hide();
|
function executeCloseAction(action, programId, serverId) {
|
||||||
}
|
if (action === 'play') {
|
||||||
|
import('playbackManager').then(({default: playbackManager}) => {
|
||||||
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
function reload(context, programId, serverId, refreshRecordingStateOnly) {
|
apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()).then(function (item) {
|
||||||
loading.show();
|
playbackManager.play({
|
||||||
|
ids: [item.ChannelId],
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
|
||||||
|
|
||||||
var promise1 = apiClient.getNewLiveTvTimerDefaults({ programId: programId });
|
|
||||||
var promise2 = apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId());
|
|
||||||
|
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
|
||||||
var defaults = responses[0];
|
|
||||||
var program = responses[1];
|
|
||||||
|
|
||||||
renderRecording(context, defaults, program, apiClient, refreshRecordingStateOnly);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function executeCloseAction(action, programId, serverId) {
|
|
||||||
if (action === 'play') {
|
|
||||||
require(['playbackManager'], function (playbackManager) {
|
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
|
||||||
|
|
||||||
apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()).then(function (item) {
|
|
||||||
playbackManager.default.play({
|
|
||||||
ids: [item.ChannelId],
|
|
||||||
serverId: serverId
|
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showEditor(itemId, serverId) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
closeAction = null;
|
|
||||||
|
|
||||||
loading.show();
|
|
||||||
|
|
||||||
require(['text!./recordingcreator.template.html'], function (template) {
|
|
||||||
var dialogOptions = {
|
|
||||||
removeOnClose: true,
|
|
||||||
scrollY: false
|
|
||||||
};
|
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
|
||||||
dialogOptions.size = 'fullscreen';
|
|
||||||
} else {
|
|
||||||
dialogOptions.size = 'small';
|
|
||||||
}
|
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
|
||||||
dlg.classList.add('recordingDialog');
|
|
||||||
|
|
||||||
var html = '';
|
|
||||||
|
|
||||||
html += globalize.translateHtml(template, 'core');
|
|
||||||
|
|
||||||
dlg.innerHTML = html;
|
|
||||||
|
|
||||||
currentDialog = dlg;
|
|
||||||
|
|
||||||
function onRecordingChanged() {
|
|
||||||
reload(dlg, itemId, serverId, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
dlg.addEventListener('close', function () {
|
|
||||||
events.off(currentRecordingFields, 'recordingchanged', onRecordingChanged);
|
|
||||||
executeCloseAction(closeAction, itemId, serverId);
|
|
||||||
|
|
||||||
if (currentRecordingFields && currentRecordingFields.hasChanged()) {
|
|
||||||
resolve();
|
|
||||||
} else {
|
|
||||||
reject();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
|
||||||
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
init(dlg);
|
|
||||||
|
|
||||||
reload(dlg, itemId, serverId);
|
|
||||||
|
|
||||||
currentRecordingFields = new recordingFields({
|
|
||||||
parent: dlg.querySelector('.recordingFields'),
|
|
||||||
programId: itemId,
|
|
||||||
serverId: serverId
|
serverId: serverId
|
||||||
});
|
});
|
||||||
|
|
||||||
events.on(currentRecordingFields, 'recordingchanged', onRecordingChanged);
|
|
||||||
|
|
||||||
dialogHelper.open(dlg);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
function showEditor(itemId, serverId) {
|
||||||
show: showEditor
|
return new Promise(function (resolve, reject) {
|
||||||
};
|
closeAction = null;
|
||||||
});
|
|
||||||
|
loading.show();
|
||||||
|
|
||||||
|
import('text!./recordingcreator.template.html').then(({default: template}) => {
|
||||||
|
const dialogOptions = {
|
||||||
|
removeOnClose: true,
|
||||||
|
scrollY: false
|
||||||
|
};
|
||||||
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
dialogOptions.size = 'fullscreen';
|
||||||
|
} else {
|
||||||
|
dialogOptions.size = 'small';
|
||||||
|
}
|
||||||
|
|
||||||
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
|
dlg.classList.add('formDialog');
|
||||||
|
dlg.classList.add('recordingDialog');
|
||||||
|
|
||||||
|
let html = '';
|
||||||
|
|
||||||
|
html += globalize.translateHtml(template, 'core');
|
||||||
|
|
||||||
|
dlg.innerHTML = html;
|
||||||
|
|
||||||
|
currentDialog = dlg;
|
||||||
|
|
||||||
|
function onRecordingChanged() {
|
||||||
|
reload(dlg, itemId, serverId, true);
|
||||||
|
}
|
||||||
|
|
||||||
|
dlg.addEventListener('close', function () {
|
||||||
|
events.off(currentRecordingFields, 'recordingchanged', onRecordingChanged);
|
||||||
|
executeCloseAction(closeAction, itemId, serverId);
|
||||||
|
|
||||||
|
if (currentRecordingFields && currentRecordingFields.hasChanged()) {
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
scrollHelper.centerFocus.on(dlg.querySelector('.formDialogContent'), false);
|
||||||
|
}
|
||||||
|
|
||||||
|
init(dlg);
|
||||||
|
|
||||||
|
reload(dlg, itemId, serverId);
|
||||||
|
|
||||||
|
currentRecordingFields = new recordingFields({
|
||||||
|
parent: dlg.querySelector('.recordingFields'),
|
||||||
|
programId: itemId,
|
||||||
|
serverId: serverId
|
||||||
|
});
|
||||||
|
|
||||||
|
events.on(currentRecordingFields, 'recordingchanged', onRecordingChanged);
|
||||||
|
|
||||||
|
dialogHelper.open(dlg);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
show: showEditor
|
||||||
|
};
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'imageLoader', 'scrollStyles', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons', 'flexStyles'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, imageLoader) {
|
define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'connectionManager', 'require', 'loading', 'scrollHelper', 'imageLoader', 'scrollStyles', 'emby-button', 'emby-collapse', 'emby-input', 'paper-icon-button-light', 'css!./../formdialog', 'css!./recordingcreator', 'material-icons', 'flexStyles'], function (dialogHelper, globalize, layoutManager, mediaInfo, appHost, connectionManager, require, loading, scrollHelper, imageLoader) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
scrollHelper = scrollHelper.default || scrollHelper;
|
||||||
loading = loading.default || loading;
|
loading = loading.default || loading;
|
||||||
|
layoutManager = layoutManager.default || layoutManager;
|
||||||
|
|
||||||
var currentDialog;
|
var currentDialog;
|
||||||
var recordingDeleted = false;
|
var recordingDeleted = false;
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields', 'flexStyles'], function (globalize, connectionManager, serverNotifications, require, loading, appHost, dom, recordingHelper, events) {
|
define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loading', 'apphost', 'dom', 'recordingHelper', 'events', 'paper-icon-button-light', 'emby-button', 'css!./recordingfields', 'flexStyles'], function (globalize, connectionManager, serverNotifications, require, loading, appHost, dom, recordingHelper, events) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
|
serverNotifications = serverNotifications.default || serverNotifications;
|
||||||
recordingHelper = recordingHelper.default || recordingHelper;
|
recordingHelper = recordingHelper.default || recordingHelper;
|
||||||
loading = loading.default || loading;
|
loading = loading.default || loading;
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
File diff suppressed because it is too large
Load diff
|
@ -1,48 +1,51 @@
|
||||||
define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutManager', 'connectionManager', 'globalize', 'userSettings', 'emby-select', 'paper-icon-button-light', 'material-icons', 'css!./../formdialog', 'emby-button', 'flexStyles'], function (require, dom, focusManager, dialogHelper, loading, layoutManager, connectionManager, globalize, userSettings) {
|
import dialogHelper from 'dialogHelper';
|
||||||
'use strict';
|
import layoutManager from 'layoutManager';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import 'emby-select';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'material-icons';
|
||||||
|
import 'css!./../formdialog';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'flexStyles';
|
||||||
|
|
||||||
focusManager = focusManager.default || focusManager;
|
function onSubmit(e) {
|
||||||
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
function onSubmit(e) {
|
function initEditor(context, settings) {
|
||||||
e.preventDefault();
|
context.querySelector('form').addEventListener('submit', onSubmit);
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function initEditor(context, settings) {
|
context.querySelector('.selectSortOrder').value = settings.sortOrder;
|
||||||
context.querySelector('form').addEventListener('submit', onSubmit);
|
context.querySelector('.selectSortBy').value = settings.sortBy;
|
||||||
|
}
|
||||||
|
|
||||||
context.querySelector('.selectSortOrder').value = settings.sortOrder;
|
function centerFocus(elem, horiz, on) {
|
||||||
context.querySelector('.selectSortBy').value = settings.sortBy;
|
import('scrollHelper').then(({default: scrollHelper}) => {
|
||||||
}
|
const fn = on ? 'on' : 'off';
|
||||||
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function fillSortBy(context, options) {
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
const selectSortBy = context.querySelector('.selectSortBy');
|
||||||
var fn = on ? 'on' : 'off';
|
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function fillSortBy(context, options) {
|
selectSortBy.innerHTML = options.map(function (o) {
|
||||||
var selectSortBy = context.querySelector('.selectSortBy');
|
return '<option value="' + o.value + '">' + o.name + '</option>';
|
||||||
|
}).join('');
|
||||||
|
}
|
||||||
|
|
||||||
selectSortBy.innerHTML = options.map(function (o) {
|
function saveValues(context, settingsKey) {
|
||||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
userSettings.setFilter(settingsKey + '-sortorder', context.querySelector('.selectSortOrder').value);
|
||||||
}).join('');
|
userSettings.setFilter(settingsKey + '-sortby', context.querySelector('.selectSortBy').value);
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveValues(context, settings, settingsKey) {
|
class SortMenu {
|
||||||
userSettings.setFilter(settingsKey + '-sortorder', context.querySelector('.selectSortOrder').value);
|
show(options) {
|
||||||
userSettings.setFilter(settingsKey + '-sortby', context.querySelector('.selectSortBy').value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function SortMenu() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
SortMenu.prototype.show = function (options) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
require(['text!./sortmenu.template.html'], function (template) {
|
import('text!./sortmenu.template.html').then(({default: template}) => {
|
||||||
var dialogOptions = {
|
const dialogOptions = {
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
@ -53,11 +56,11 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
||||||
dialogOptions.size = 'small';
|
dialogOptions.size = 'small';
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="formDialogHeader">';
|
html += '<div class="formDialogHeader">';
|
||||||
html += '<button is="paper-icon-button-light" class="btnCancel hide-mouse-idle-tv" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
html += '<button is="paper-icon-button-light" class="btnCancel hide-mouse-idle-tv" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||||
|
@ -80,7 +83,7 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
||||||
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var submitted;
|
let submitted;
|
||||||
|
|
||||||
dlg.querySelector('form').addEventListener('change', function () {
|
dlg.querySelector('form').addEventListener('change', function () {
|
||||||
submitted = true;
|
submitted = true;
|
||||||
|
@ -92,7 +95,7 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
||||||
}
|
}
|
||||||
|
|
||||||
if (submitted) {
|
if (submitted) {
|
||||||
saveValues(dlg, options.settings, options.settingsKey);
|
saveValues(dlg, options.settingsKey);
|
||||||
resolve();
|
resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -101,7 +104,7 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SortMenu;
|
export default SortMenu;
|
||||||
});
|
|
||||||
|
|
|
@ -1,427 +1,437 @@
|
||||||
define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings', 'connectionManager', 'loading', 'focusManager', 'dom', 'apphost', 'emby-select', 'listViewStyle', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'css!./subtitleeditor', 'emby-button', 'flexStyles'], function (dialogHelper, require, layoutManager, globalize, userSettings, connectionManager, loading, focusManager, dom, appHost) {
|
import dialogHelper from 'dialogHelper';
|
||||||
'use strict';
|
import layoutManager from 'layoutManager';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import connectionManager from 'connectionManager';
|
||||||
|
import loading from 'loading';
|
||||||
|
import focusManager from 'focusManager';
|
||||||
|
import dom from 'dom';
|
||||||
|
import 'emby-select';
|
||||||
|
import 'listViewStyle';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'css!./../formdialog';
|
||||||
|
import 'material-icons';
|
||||||
|
import 'css!./subtitleeditor';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'flexStyles';
|
||||||
|
|
||||||
loading = loading.default || loading;
|
let currentItem;
|
||||||
focusManager = focusManager.default || focusManager;
|
let hasChanges;
|
||||||
|
|
||||||
var currentItem;
|
function downloadRemoteSubtitles(context, id) {
|
||||||
var hasChanges;
|
let url = 'Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + id;
|
||||||
|
|
||||||
function downloadRemoteSubtitles(context, id) {
|
let apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
||||||
var url = 'Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + id;
|
apiClient.ajax({
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
type: 'POST',
|
||||||
apiClient.ajax({
|
url: apiClient.getUrl(url)
|
||||||
|
|
||||||
type: 'POST',
|
}).then(function () {
|
||||||
url: apiClient.getUrl(url)
|
hasChanges = true;
|
||||||
|
|
||||||
|
import('toast').then(({default: toast}) => {
|
||||||
|
toast(globalize.translate('MessageDownloadQueued'));
|
||||||
|
});
|
||||||
|
|
||||||
|
focusManager.autoFocus(context);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function deleteLocalSubtitle(context, index) {
|
||||||
|
let msg = globalize.translate('MessageAreYouSureDeleteSubtitles');
|
||||||
|
|
||||||
|
import('confirm').then(({default: confirm}) => {
|
||||||
|
confirm({
|
||||||
|
|
||||||
|
title: globalize.translate('ConfirmDeletion'),
|
||||||
|
text: msg,
|
||||||
|
confirmText: globalize.translate('Delete'),
|
||||||
|
primary: 'delete'
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
hasChanges = true;
|
loading.show();
|
||||||
|
|
||||||
require(['toast'], function (toast) {
|
let itemId = currentItem.Id;
|
||||||
toast(globalize.translate('MessageDownloadQueued'));
|
let url = 'Videos/' + itemId + '/Subtitles/' + index;
|
||||||
});
|
|
||||||
|
|
||||||
focusManager.autoFocus(context);
|
let apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function deleteLocalSubtitle(context, index) {
|
apiClient.ajax({
|
||||||
var msg = globalize.translate('MessageAreYouSureDeleteSubtitles');
|
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
type: 'DELETE',
|
||||||
confirm.default({
|
url: apiClient.getUrl(url)
|
||||||
|
|
||||||
title: globalize.translate('ConfirmDeletion'),
|
|
||||||
text: msg,
|
|
||||||
confirmText: globalize.translate('Delete'),
|
|
||||||
primary: 'delete'
|
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
loading.show();
|
hasChanges = true;
|
||||||
|
reload(context, apiClient, itemId);
|
||||||
var itemId = currentItem.Id;
|
|
||||||
var url = 'Videos/' + itemId + '/Subtitles/' + index;
|
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
|
||||||
|
|
||||||
apiClient.ajax({
|
|
||||||
|
|
||||||
type: 'DELETE',
|
|
||||||
url: apiClient.getUrl(url)
|
|
||||||
|
|
||||||
}).then(function () {
|
|
||||||
hasChanges = true;
|
|
||||||
reload(context, apiClient, itemId);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function fillSubtitleList(context, item) {
|
function fillSubtitleList(context, item) {
|
||||||
var streams = item.MediaStreams || [];
|
let streams = item.MediaStreams || [];
|
||||||
|
|
||||||
var subs = streams.filter(function (s) {
|
let subs = streams.filter(function (s) {
|
||||||
return s.Type === 'Subtitle';
|
return s.Type === 'Subtitle';
|
||||||
});
|
});
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
if (subs.length) {
|
if (subs.length) {
|
||||||
html += '<h2>' + globalize.translate('MySubtitles') + '</h2>';
|
html += '<h2>' + globalize.translate('MySubtitles') + '</h2>';
|
||||||
|
|
||||||
html += '<div>';
|
html += '<div>';
|
||||||
|
|
||||||
html += subs.map(function (s) {
|
html += subs.map(function (s) {
|
||||||
var itemHtml = '';
|
let itemHtml = '';
|
||||||
|
|
||||||
var tagName = layoutManager.tv ? 'button' : 'div';
|
let tagName = layoutManager.tv ? 'button' : 'div';
|
||||||
var className = layoutManager.tv && s.Path ? 'listItem listItem-border btnDelete' : 'listItem listItem-border';
|
let className = layoutManager.tv && s.Path ? 'listItem listItem-border btnDelete' : 'listItem listItem-border';
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
|
||||||
className += ' listItem-focusscale listItem-button';
|
|
||||||
}
|
|
||||||
|
|
||||||
className += ' listItem-noborder';
|
|
||||||
|
|
||||||
itemHtml += '<' + tagName + ' class="' + className + '" data-index="' + s.Index + '">';
|
|
||||||
|
|
||||||
itemHtml += '<span class="listItemIcon material-icons closed_caption"></span>';
|
|
||||||
|
|
||||||
itemHtml += '<div class="listItemBody two-line">';
|
|
||||||
|
|
||||||
itemHtml += '<div>';
|
|
||||||
itemHtml += s.DisplayTitle || '';
|
|
||||||
itemHtml += '</div>';
|
|
||||||
|
|
||||||
if (s.Path) {
|
|
||||||
itemHtml += '<div class="secondary listItemBodyText">' + (s.Path) + '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
itemHtml += '</a>';
|
|
||||||
itemHtml += '</div>';
|
|
||||||
|
|
||||||
if (!layoutManager.tv) {
|
|
||||||
if (s.Path) {
|
|
||||||
itemHtml += '<button is="paper-icon-button-light" data-index="' + s.Index + '" title="' + globalize.translate('Delete') + '" class="btnDelete listItemButton"><span class="material-icons delete"></span></button>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
itemHtml += '</' + tagName + '>';
|
|
||||||
|
|
||||||
return itemHtml;
|
|
||||||
}).join('');
|
|
||||||
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
var elem = context.querySelector('.subtitleList');
|
|
||||||
|
|
||||||
if (subs.length) {
|
|
||||||
elem.classList.remove('hide');
|
|
||||||
} else {
|
|
||||||
elem.classList.add('hide');
|
|
||||||
}
|
|
||||||
elem.innerHTML = html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function fillLanguages(context, apiClient, languages) {
|
|
||||||
var selectLanguage = context.querySelector('#selectLanguage');
|
|
||||||
|
|
||||||
selectLanguage.innerHTML = languages.map(function (l) {
|
|
||||||
return '<option value="' + l.ThreeLetterISOLanguageName + '">' + l.DisplayName + '</option>';
|
|
||||||
});
|
|
||||||
|
|
||||||
var lastLanguage = userSettings.get('subtitleeditor-language');
|
|
||||||
if (lastLanguage) {
|
|
||||||
selectLanguage.value = lastLanguage;
|
|
||||||
} else {
|
|
||||||
apiClient.getCurrentUser().then(function (user) {
|
|
||||||
var lang = user.Configuration.SubtitleLanguagePreference;
|
|
||||||
|
|
||||||
if (lang) {
|
|
||||||
selectLanguage.value = lang;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderSearchResults(context, results) {
|
|
||||||
var lastProvider = '';
|
|
||||||
var html = '';
|
|
||||||
|
|
||||||
if (!results.length) {
|
|
||||||
context.querySelector('.noSearchResults').classList.remove('hide');
|
|
||||||
context.querySelector('.subtitleResults').innerHTML = '';
|
|
||||||
loading.hide();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
context.querySelector('.noSearchResults').classList.add('hide');
|
|
||||||
|
|
||||||
for (var i = 0, length = results.length; i < length; i++) {
|
|
||||||
var result = results[i];
|
|
||||||
|
|
||||||
var provider = result.ProviderName;
|
|
||||||
|
|
||||||
if (provider !== lastProvider) {
|
|
||||||
if (i > 0) {
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '<h2>' + provider + '</h2>';
|
|
||||||
html += '<div>';
|
|
||||||
lastProvider = provider;
|
|
||||||
}
|
|
||||||
|
|
||||||
var tagName = layoutManager.tv ? 'button' : 'div';
|
|
||||||
var className = layoutManager.tv ? 'listItem listItem-border btnOptions' : 'listItem listItem-border';
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
className += ' listItem-focusscale listItem-button';
|
className += ' listItem-focusscale listItem-button';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<' + tagName + ' class="' + className + '" data-subid="' + result.Id + '">';
|
className += ' listItem-noborder';
|
||||||
|
|
||||||
html += '<span class="listItemIcon material-icons closed_caption"></span>';
|
itemHtml += '<' + tagName + ' class="' + className + '" data-index="' + s.Index + '">';
|
||||||
|
|
||||||
var bodyClass = result.Comment || result.IsHashMatch ? 'three-line' : 'two-line';
|
itemHtml += '<span class="listItemIcon material-icons closed_caption"></span>';
|
||||||
|
|
||||||
html += '<div class="listItemBody ' + bodyClass + '">';
|
itemHtml += '<div class="listItemBody two-line">';
|
||||||
|
|
||||||
html += '<div>' + (result.Name) + '</div>';
|
itemHtml += '<div>';
|
||||||
html += '<div class="secondary listItemBodyText">';
|
itemHtml += s.DisplayTitle || '';
|
||||||
|
itemHtml += '</div>';
|
||||||
|
|
||||||
if (result.Format) {
|
if (s.Path) {
|
||||||
html += '<span style="margin-right:1em;">' + globalize.translate('FormatValue', result.Format) + '</span>';
|
itemHtml += '<div class="secondary listItemBodyText">' + (s.Path) + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (result.DownloadCount != null) {
|
itemHtml += '</a>';
|
||||||
html += '<span>' + globalize.translate('DownloadsValue', result.DownloadCount) + '</span>';
|
itemHtml += '</div>';
|
||||||
}
|
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
if (result.Comment) {
|
|
||||||
html += '<div class="secondary listItemBodyText">' + (result.Comment) + '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
if (result.IsHashMatch) {
|
|
||||||
html += '<div class="secondary listItemBodyText"><div class="inline-flex align-items-center justify-content-center" style="background:#3388cc;color:#fff;padding: .3em 1em;border-radius:1000em;">' + globalize.translate('PerfectMatch') + '</div></div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '</div>';
|
|
||||||
|
|
||||||
if (!layoutManager.tv) {
|
if (!layoutManager.tv) {
|
||||||
html += '<button type="button" is="paper-icon-button-light" data-subid="' + result.Id + '" class="btnDownload listItemButton"><span class="material-icons file_download"></span></button>';
|
if (s.Path) {
|
||||||
|
itemHtml += '<button is="paper-icon-button-light" data-index="' + s.Index + '" title="' + globalize.translate('Delete') + '" class="btnDelete listItemButton"><span class="material-icons delete"></span></button>';
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</' + tagName + '>';
|
itemHtml += '</' + tagName + '>';
|
||||||
|
|
||||||
|
return itemHtml;
|
||||||
|
}).join('');
|
||||||
|
|
||||||
|
html += '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
let elem = context.querySelector('.subtitleList');
|
||||||
|
|
||||||
|
if (subs.length) {
|
||||||
|
elem.classList.remove('hide');
|
||||||
|
} else {
|
||||||
|
elem.classList.add('hide');
|
||||||
|
}
|
||||||
|
elem.innerHTML = html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function fillLanguages(context, apiClient, languages) {
|
||||||
|
let selectLanguage = context.querySelector('#selectLanguage');
|
||||||
|
|
||||||
|
selectLanguage.innerHTML = languages.map(function (l) {
|
||||||
|
return '<option value="' + l.ThreeLetterISOLanguageName + '">' + l.DisplayName + '</option>';
|
||||||
|
});
|
||||||
|
|
||||||
|
let lastLanguage = userSettings.get('subtitleeditor-language');
|
||||||
|
if (lastLanguage) {
|
||||||
|
selectLanguage.value = lastLanguage;
|
||||||
|
} else {
|
||||||
|
apiClient.getCurrentUser().then(function (user) {
|
||||||
|
let lang = user.Configuration.SubtitleLanguagePreference;
|
||||||
|
|
||||||
|
if (lang) {
|
||||||
|
selectLanguage.value = lang;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderSearchResults(context, results) {
|
||||||
|
let lastProvider = '';
|
||||||
|
let html = '';
|
||||||
|
|
||||||
|
if (!results.length) {
|
||||||
|
context.querySelector('.noSearchResults').classList.remove('hide');
|
||||||
|
context.querySelector('.subtitleResults').innerHTML = '';
|
||||||
|
loading.hide();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
context.querySelector('.noSearchResults').classList.add('hide');
|
||||||
|
|
||||||
|
for (let i = 0, length = results.length; i < length; i++) {
|
||||||
|
let result = results[i];
|
||||||
|
|
||||||
|
let provider = result.ProviderName;
|
||||||
|
|
||||||
|
if (provider !== lastProvider) {
|
||||||
|
if (i > 0) {
|
||||||
|
html += '</div>';
|
||||||
|
}
|
||||||
|
html += '<h2>' + provider + '</h2>';
|
||||||
|
html += '<div>';
|
||||||
|
lastProvider = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (results.length) {
|
let tagName = layoutManager.tv ? 'button' : 'div';
|
||||||
html += '</div>';
|
let className = layoutManager.tv ? 'listItem listItem-border btnOptions' : 'listItem listItem-border';
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
className += ' listItem-focusscale listItem-button';
|
||||||
}
|
}
|
||||||
|
|
||||||
var elem = context.querySelector('.subtitleResults');
|
html += '<' + tagName + ' class="' + className + '" data-subid="' + result.Id + '">';
|
||||||
elem.innerHTML = html;
|
|
||||||
|
html += '<span class="listItemIcon material-icons closed_caption"></span>';
|
||||||
|
|
||||||
|
let bodyClass = result.Comment || result.IsHashMatch ? 'three-line' : 'two-line';
|
||||||
|
|
||||||
|
html += '<div class="listItemBody ' + bodyClass + '">';
|
||||||
|
|
||||||
|
html += '<div>' + (result.Name) + '</div>';
|
||||||
|
html += '<div class="secondary listItemBodyText">';
|
||||||
|
|
||||||
|
if (result.Format) {
|
||||||
|
html += '<span style="margin-right:1em;">' + globalize.translate('FormatValue', result.Format) + '</span>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.DownloadCount != null) {
|
||||||
|
html += '<span>' + globalize.translate('DownloadsValue', result.DownloadCount) + '</span>';
|
||||||
|
}
|
||||||
|
html += '</div>';
|
||||||
|
|
||||||
|
if (result.Comment) {
|
||||||
|
html += '<div class="secondary listItemBodyText">' + (result.Comment) + '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (result.IsHashMatch) {
|
||||||
|
html += '<div class="secondary listItemBodyText"><div class="inline-flex align-items-center justify-content-center" style="background:#3388cc;color:#fff;padding: .3em 1em;border-radius:1000em;">' + globalize.translate('PerfectMatch') + '</div></div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '</div>';
|
||||||
|
|
||||||
|
if (!layoutManager.tv) {
|
||||||
|
html += '<button type="button" is="paper-icon-button-light" data-subid="' + result.Id + '" class="btnDownload listItemButton"><span class="material-icons file_download"></span></button>';
|
||||||
|
}
|
||||||
|
|
||||||
|
html += '</' + tagName + '>';
|
||||||
|
}
|
||||||
|
|
||||||
|
if (results.length) {
|
||||||
|
html += '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
let elem = context.querySelector('.subtitleResults');
|
||||||
|
elem.innerHTML = html;
|
||||||
|
|
||||||
|
loading.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
function searchForSubtitles(context, language) {
|
||||||
|
userSettings.set('subtitleeditor-language', language);
|
||||||
|
|
||||||
|
loading.show();
|
||||||
|
|
||||||
|
let apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
||||||
|
let url = apiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
|
||||||
|
|
||||||
|
apiClient.getJSON(url).then(function (results) {
|
||||||
|
renderSearchResults(context, results);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function reload(context, apiClient, itemId) {
|
||||||
|
context.querySelector('.noSearchResults').classList.add('hide');
|
||||||
|
|
||||||
|
function onGetItem(item) {
|
||||||
|
currentItem = item;
|
||||||
|
|
||||||
|
fillSubtitleList(context, item);
|
||||||
|
let file = item.Path || '';
|
||||||
|
let index = Math.max(file.lastIndexOf('/'), file.lastIndexOf('\\'));
|
||||||
|
if (index > -1) {
|
||||||
|
file = file.substring(index + 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (file) {
|
||||||
|
context.querySelector('.pathValue').innerHTML = file;
|
||||||
|
context.querySelector('.originalFile').classList.remove('hide');
|
||||||
|
} else {
|
||||||
|
context.querySelector('.pathValue').innerHTML = '';
|
||||||
|
context.querySelector('.originalFile').classList.add('hide');
|
||||||
|
}
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function searchForSubtitles(context, language) {
|
if (typeof itemId === 'string') {
|
||||||
userSettings.set('subtitleeditor-language', language);
|
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(onGetItem);
|
||||||
|
} else {
|
||||||
|
onGetItem(itemId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loading.show();
|
function onSearchSubmit(e) {
|
||||||
|
let form = this;
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
let lang = form.querySelector('#selectLanguage', form).value;
|
||||||
var url = apiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
|
|
||||||
|
|
||||||
apiClient.getJSON(url).then(function (results) {
|
searchForSubtitles(dom.parentWithClass(form, 'formDialogContent'), lang);
|
||||||
renderSearchResults(context, results);
|
|
||||||
});
|
e.preventDefault();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSubtitleListClick(e) {
|
||||||
|
let btnDelete = dom.parentWithClass(e.target, 'btnDelete');
|
||||||
|
if (btnDelete) {
|
||||||
|
let index = btnDelete.getAttribute('data-index');
|
||||||
|
let context = dom.parentWithClass(btnDelete, 'subtitleEditorDialog');
|
||||||
|
deleteLocalSubtitle(context, index);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function onSubtitleResultsClick(e) {
|
||||||
|
let subtitleId;
|
||||||
|
let context;
|
||||||
|
|
||||||
|
let btnOptions = dom.parentWithClass(e.target, 'btnOptions');
|
||||||
|
if (btnOptions) {
|
||||||
|
subtitleId = btnOptions.getAttribute('data-subid');
|
||||||
|
context = dom.parentWithClass(btnOptions, 'subtitleEditorDialog');
|
||||||
|
showDownloadOptions(btnOptions, context, subtitleId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reload(context, apiClient, itemId) {
|
let btnDownload = dom.parentWithClass(e.target, 'btnDownload');
|
||||||
context.querySelector('.noSearchResults').classList.add('hide');
|
if (btnDownload) {
|
||||||
|
subtitleId = btnDownload.getAttribute('data-subid');
|
||||||
|
context = dom.parentWithClass(btnDownload, 'subtitleEditorDialog');
|
||||||
|
downloadRemoteSubtitles(context, subtitleId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function onGetItem(item) {
|
function showDownloadOptions(button, context, subtitleId) {
|
||||||
currentItem = item;
|
let items = [];
|
||||||
|
|
||||||
fillSubtitleList(context, item);
|
items.push({
|
||||||
var file = item.Path || '';
|
name: globalize.translate('Download'),
|
||||||
var index = Math.max(file.lastIndexOf('/'), file.lastIndexOf('\\'));
|
id: 'download'
|
||||||
if (index > -1) {
|
});
|
||||||
file = file.substring(index + 1);
|
|
||||||
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
|
actionsheet.show({
|
||||||
|
items: items,
|
||||||
|
positionTo: button
|
||||||
|
|
||||||
|
}).then(function (id) {
|
||||||
|
switch (id) {
|
||||||
|
case 'download':
|
||||||
|
downloadRemoteSubtitles(context, subtitleId);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (file) {
|
function centerFocus(elem, horiz, on) {
|
||||||
context.querySelector('.pathValue').innerHTML = file;
|
import('scrollHelper').then(({default: scrollHelper}) => {
|
||||||
context.querySelector('.originalFile').classList.remove('hide');
|
let fn = on ? 'on' : 'off';
|
||||||
} else {
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
context.querySelector('.pathValue').innerHTML = '';
|
});
|
||||||
context.querySelector('.originalFile').classList.add('hide');
|
}
|
||||||
}
|
|
||||||
|
|
||||||
loading.hide();
|
function showEditorInternal(itemId, serverId, template) {
|
||||||
}
|
hasChanges = false;
|
||||||
|
|
||||||
if (typeof itemId === 'string') {
|
let apiClient = connectionManager.getApiClient(serverId);
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(onGetItem);
|
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||||
|
let dialogOptions = {
|
||||||
|
removeOnClose: true,
|
||||||
|
scrollY: false
|
||||||
|
};
|
||||||
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
dialogOptions.size = 'fullscreen';
|
||||||
} else {
|
} else {
|
||||||
onGetItem(itemId);
|
dialogOptions.size = 'small';
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSearchSubmit(e) {
|
|
||||||
var form = this;
|
|
||||||
|
|
||||||
var lang = form.querySelector('#selectLanguage', form).value;
|
|
||||||
|
|
||||||
searchForSubtitles(dom.parentWithClass(form, 'formDialogContent'), lang);
|
|
||||||
|
|
||||||
e.preventDefault();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubtitleListClick(e) {
|
|
||||||
var btnDelete = dom.parentWithClass(e.target, 'btnDelete');
|
|
||||||
if (btnDelete) {
|
|
||||||
var index = btnDelete.getAttribute('data-index');
|
|
||||||
var context = dom.parentWithClass(btnDelete, 'subtitleEditorDialog');
|
|
||||||
deleteLocalSubtitle(context, index);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubtitleResultsClick(e) {
|
|
||||||
var subtitleId;
|
|
||||||
var context;
|
|
||||||
|
|
||||||
var btnOptions = dom.parentWithClass(e.target, 'btnOptions');
|
|
||||||
if (btnOptions) {
|
|
||||||
subtitleId = btnOptions.getAttribute('data-subid');
|
|
||||||
context = dom.parentWithClass(btnOptions, 'subtitleEditorDialog');
|
|
||||||
showDownloadOptions(btnOptions, context, subtitleId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var btnDownload = dom.parentWithClass(e.target, 'btnDownload');
|
let dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
if (btnDownload) {
|
|
||||||
subtitleId = btnDownload.getAttribute('data-subid');
|
dlg.classList.add('formDialog');
|
||||||
context = dom.parentWithClass(btnDownload, 'subtitleEditorDialog');
|
dlg.classList.add('subtitleEditorDialog');
|
||||||
downloadRemoteSubtitles(context, subtitleId);
|
|
||||||
|
dlg.innerHTML = globalize.translateHtml(template, 'core');
|
||||||
|
|
||||||
|
dlg.querySelector('.originalSubtitleFileLabel').innerHTML = globalize.translate('File');
|
||||||
|
|
||||||
|
dlg.querySelector('.subtitleSearchForm').addEventListener('submit', onSearchSubmit);
|
||||||
|
|
||||||
|
let btnSubmit = dlg.querySelector('.btnSubmit');
|
||||||
|
|
||||||
|
if (layoutManager.tv) {
|
||||||
|
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
||||||
|
dlg.querySelector('.btnSearchSubtitles').classList.add('hide');
|
||||||
|
} else {
|
||||||
|
btnSubmit.classList.add('hide');
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
function showDownloadOptions(button, context, subtitleId) {
|
let editorContent = dlg.querySelector('.formDialogContent');
|
||||||
var items = [];
|
|
||||||
|
|
||||||
items.push({
|
dlg.querySelector('.subtitleList').addEventListener('click', onSubtitleListClick);
|
||||||
name: globalize.translate('Download'),
|
dlg.querySelector('.subtitleResults').addEventListener('click', onSubtitleResultsClick);
|
||||||
id: 'download'
|
|
||||||
|
apiClient.getCultures().then(function (languages) {
|
||||||
|
fillLanguages(editorContent, apiClient, languages);
|
||||||
});
|
});
|
||||||
|
|
||||||
require(['actionsheet'], function (actionsheet) {
|
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||||
actionsheet.show({
|
dialogHelper.close(dlg);
|
||||||
items: items,
|
|
||||||
positionTo: button
|
|
||||||
|
|
||||||
}).then(function (id) {
|
|
||||||
switch (id) {
|
|
||||||
case 'download':
|
|
||||||
downloadRemoteSubtitles(context, subtitleId);
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
|
||||||
var fn = on ? 'on' : 'off';
|
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showEditorInternal(itemId, serverId, template) {
|
|
||||||
hasChanges = false;
|
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
|
||||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
|
||||||
var dialogOptions = {
|
|
||||||
removeOnClose: true,
|
|
||||||
scrollY: false
|
|
||||||
};
|
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
|
||||||
dialogOptions.size = 'fullscreen';
|
|
||||||
} else {
|
|
||||||
dialogOptions.size = 'small';
|
|
||||||
}
|
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
|
||||||
dlg.classList.add('subtitleEditorDialog');
|
|
||||||
|
|
||||||
dlg.innerHTML = globalize.translateHtml(template, 'core');
|
|
||||||
|
|
||||||
dlg.querySelector('.originalSubtitleFileLabel').innerHTML = globalize.translate('File');
|
|
||||||
|
|
||||||
dlg.querySelector('.subtitleSearchForm').addEventListener('submit', onSearchSubmit);
|
|
||||||
|
|
||||||
var btnSubmit = dlg.querySelector('.btnSubmit');
|
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
|
||||||
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
|
||||||
dlg.querySelector('.btnSearchSubtitles').classList.add('hide');
|
|
||||||
} else {
|
|
||||||
btnSubmit.classList.add('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
var editorContent = dlg.querySelector('.formDialogContent');
|
|
||||||
|
|
||||||
dlg.querySelector('.subtitleList').addEventListener('click', onSubtitleListClick);
|
|
||||||
dlg.querySelector('.subtitleResults').addEventListener('click', onSubtitleResultsClick);
|
|
||||||
|
|
||||||
apiClient.getCultures().then(function (languages) {
|
|
||||||
fillLanguages(editorContent, apiClient, languages);
|
|
||||||
});
|
|
||||||
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
|
||||||
dialogHelper.close(dlg);
|
|
||||||
});
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
dlg.addEventListener('close', function () {
|
|
||||||
if (layoutManager.tv) {
|
|
||||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hasChanges) {
|
|
||||||
resolve();
|
|
||||||
} else {
|
|
||||||
reject();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
dialogHelper.open(dlg);
|
|
||||||
|
|
||||||
reload(editorContent, apiClient, item);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function showEditor(itemId, serverId) {
|
|
||||||
loading.show();
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
require(['text!./subtitleeditor.template.html'], function (template) {
|
dlg.addEventListener('close', function () {
|
||||||
showEditorInternal(itemId, serverId, template).then(resolve, reject);
|
if (layoutManager.tv) {
|
||||||
});
|
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||||
});
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
if (hasChanges) {
|
||||||
show: showEditor
|
resolve();
|
||||||
};
|
} else {
|
||||||
});
|
reject();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
dialogHelper.open(dlg);
|
||||||
|
|
||||||
|
reload(editorContent, apiClient, item);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function showEditor(itemId, serverId) {
|
||||||
|
loading.show();
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
import('text!./subtitleeditor.template.html').then(({default: template}) => {
|
||||||
|
showEditorInternal(itemId, serverId, template).then(resolve, reject);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
show: showEditor
|
||||||
|
};
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getTextStyles(settings, preview) {
|
function getTextStyles(settings, preview) {
|
||||||
let list = [];
|
const list = [];
|
||||||
|
|
||||||
switch (settings.textSize || '') {
|
switch (settings.textSize || '') {
|
||||||
case 'smaller':
|
case 'smaller':
|
||||||
|
@ -130,14 +130,14 @@ export function getStyles(settings, preview) {
|
||||||
|
|
||||||
function applyStyleList(styles, elem) {
|
function applyStyleList(styles, elem) {
|
||||||
for (let i = 0, length = styles.length; i < length; i++) {
|
for (let i = 0, length = styles.length; i < length; i++) {
|
||||||
let style = styles[i];
|
const style = styles[i];
|
||||||
|
|
||||||
elem.style[style.name] = style.value;
|
elem.style[style.name] = style.value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function applyStyles(elements, appearanceSettings) {
|
export function applyStyles(elements, appearanceSettings) {
|
||||||
let styles = getStyles(appearanceSettings, !!elements.preview);
|
const styles = getStyles(appearanceSettings, !!elements.preview);
|
||||||
|
|
||||||
if (elements.text) {
|
if (elements.text) {
|
||||||
applyStyleList(styles.text, elements.text);
|
applyStyleList(styles.text, elements.text);
|
||||||
|
|
|
@ -23,7 +23,7 @@ import 'css!./subtitlesettings';
|
||||||
*/
|
*/
|
||||||
|
|
||||||
function getSubtitleAppearanceObject(context) {
|
function getSubtitleAppearanceObject(context) {
|
||||||
let appearanceSettings = {};
|
const appearanceSettings = {};
|
||||||
|
|
||||||
appearanceSettings.textSize = context.querySelector('#selectTextSize').value;
|
appearanceSettings.textSize = context.querySelector('#selectTextSize').value;
|
||||||
appearanceSettings.dropShadow = context.querySelector('#selectDropShadow').value;
|
appearanceSettings.dropShadow = context.querySelector('#selectDropShadow').value;
|
||||||
|
@ -41,7 +41,7 @@ function loadForm(context, user, userSettings, appearanceSettings, apiClient) {
|
||||||
context.querySelector('.fldBurnIn').classList.remove('hide');
|
context.querySelector('.fldBurnIn').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
let selectSubtitleLanguage = context.querySelector('#selectSubtitleLanguage');
|
const selectSubtitleLanguage = context.querySelector('#selectSubtitleLanguage');
|
||||||
|
|
||||||
settingsHelper.populateLanguages(selectSubtitleLanguage, allCultures);
|
settingsHelper.populateLanguages(selectSubtitleLanguage, allCultures);
|
||||||
|
|
||||||
|
@ -101,9 +101,9 @@ function save(instance, context, userId, userSettings, apiClient, enableSaveConf
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubtitleModeChange(e) {
|
function onSubtitleModeChange(e) {
|
||||||
let view = dom.parentWithClass(e.target, 'subtitlesettings');
|
const view = dom.parentWithClass(e.target, 'subtitlesettings');
|
||||||
|
|
||||||
let subtitlesHelp = view.querySelectorAll('.subtitlesHelp');
|
const subtitlesHelp = view.querySelectorAll('.subtitlesHelp');
|
||||||
for (let i = 0, length = subtitlesHelp.length; i < length; i++) {
|
for (let i = 0, length = subtitlesHelp.length; i < length; i++) {
|
||||||
subtitlesHelp[i].classList.add('hide');
|
subtitlesHelp[i].classList.add('hide');
|
||||||
}
|
}
|
||||||
|
@ -111,11 +111,11 @@ function onSubtitleModeChange(e) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAppearanceFieldChange(e) {
|
function onAppearanceFieldChange(e) {
|
||||||
let view = dom.parentWithClass(e.target, 'subtitlesettings');
|
const view = dom.parentWithClass(e.target, 'subtitlesettings');
|
||||||
|
|
||||||
let appearanceSettings = getSubtitleAppearanceObject(view);
|
const appearanceSettings = getSubtitleAppearanceObject(view);
|
||||||
|
|
||||||
let elements = {
|
const elements = {
|
||||||
window: view.querySelector('.subtitleappearance-preview-window'),
|
window: view.querySelector('.subtitleappearance-preview-window'),
|
||||||
text: view.querySelector('.subtitleappearance-preview-text'),
|
text: view.querySelector('.subtitleappearance-preview-text'),
|
||||||
preview: true
|
preview: true
|
||||||
|
@ -226,20 +226,20 @@ export class SubtitleSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
loadData() {
|
loadData() {
|
||||||
let self = this;
|
const self = this;
|
||||||
let context = self.options.element;
|
const context = self.options.element;
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
let userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
let apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||||
let userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
apiClient.getUser(userId).then(function (user) {
|
apiClient.getUser(userId).then(function (user) {
|
||||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
userSettings.setUserInfo(userId, apiClient).then(function () {
|
||||||
self.dataLoaded = true;
|
self.dataLoaded = true;
|
||||||
|
|
||||||
let appearanceSettings = userSettings.getSubtitleAppearanceSettings(self.options.appearanceKey);
|
const appearanceSettings = userSettings.getSubtitleAppearanceSettings(self.options.appearanceKey);
|
||||||
|
|
||||||
loadForm(context, user, userSettings, appearanceSettings, apiClient);
|
loadForm(context, user, userSettings, appearanceSettings, apiClient);
|
||||||
});
|
});
|
||||||
|
@ -256,12 +256,12 @@ export class SubtitleSettings {
|
||||||
|
|
||||||
onSubmit(e) {
|
onSubmit(e) {
|
||||||
const self = this;
|
const self = this;
|
||||||
let apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||||
let userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
let userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
userSettings.setUserInfo(userId, apiClient).then(function () {
|
||||||
let enableSaveConfirmation = self.options.enableSaveConfirmation;
|
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,147 +1,148 @@
|
||||||
define(['playbackManager', 'layoutManager', 'text!./subtitlesync.template.html', 'css!./subtitlesync'], function (playbackManager, layoutManager, template, css) {
|
import playbackManager from 'playbackManager';
|
||||||
'use strict';
|
import layoutManager from 'layoutManager';
|
||||||
|
import template from 'text!./subtitlesync.template.html';
|
||||||
|
import 'css!./subtitlesync';
|
||||||
|
|
||||||
playbackManager = playbackManager.default || playbackManager;
|
let player;
|
||||||
|
let subtitleSyncSlider;
|
||||||
|
let subtitleSyncTextField;
|
||||||
|
let subtitleSyncCloseButton;
|
||||||
|
let subtitleSyncContainer;
|
||||||
|
|
||||||
var player;
|
function init(instance) {
|
||||||
var subtitleSyncSlider;
|
const parent = document.createElement('div');
|
||||||
var subtitleSyncTextField;
|
document.body.appendChild(parent);
|
||||||
var subtitleSyncCloseButton;
|
parent.innerHTML = template;
|
||||||
var subtitleSyncContainer;
|
|
||||||
|
|
||||||
function init(instance) {
|
subtitleSyncSlider = parent.querySelector('.subtitleSyncSlider');
|
||||||
var parent = document.createElement('div');
|
subtitleSyncTextField = parent.querySelector('.subtitleSyncTextField');
|
||||||
document.body.appendChild(parent);
|
subtitleSyncCloseButton = parent.querySelector('.subtitleSync-closeButton');
|
||||||
parent.innerHTML = template;
|
subtitleSyncContainer = parent.querySelector('.subtitleSyncContainer');
|
||||||
|
|
||||||
subtitleSyncSlider = parent.querySelector('.subtitleSyncSlider');
|
if (layoutManager.tv) {
|
||||||
subtitleSyncTextField = parent.querySelector('.subtitleSyncTextField');
|
subtitleSyncSlider.classList.add('focusable');
|
||||||
subtitleSyncCloseButton = parent.querySelector('.subtitleSync-closeButton');
|
// HACK: Delay to give time for registered element attach (Firefox)
|
||||||
subtitleSyncContainer = parent.querySelector('.subtitleSyncContainer');
|
setTimeout(function () {
|
||||||
|
subtitleSyncSlider.enableKeyboardDragging();
|
||||||
|
}, 0);
|
||||||
|
}
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
subtitleSyncContainer.classList.add('hide');
|
||||||
subtitleSyncSlider.classList.add('focusable');
|
|
||||||
// HACK: Delay to give time for registered element attach (Firefox)
|
|
||||||
setTimeout(function () {
|
|
||||||
subtitleSyncSlider.enableKeyboardDragging();
|
|
||||||
}, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
subtitleSyncContainer.classList.add('hide');
|
subtitleSyncTextField.updateOffset = function (offset) {
|
||||||
|
this.textContent = offset + 's';
|
||||||
|
};
|
||||||
|
|
||||||
subtitleSyncTextField.updateOffset = function(offset) {
|
subtitleSyncTextField.addEventListener('click', function () {
|
||||||
this.textContent = offset + 's';
|
// keep focus to prevent fade with osd
|
||||||
};
|
this.hasFocus = true;
|
||||||
|
});
|
||||||
|
|
||||||
subtitleSyncTextField.addEventListener('click', function () {
|
subtitleSyncTextField.addEventListener('keydown', function (event) {
|
||||||
|
if (event.key === 'Enter') {
|
||||||
|
// if input key is enter search for float pattern
|
||||||
|
let inputOffset = /[-+]?\d+\.?\d*/g.exec(this.textContent);
|
||||||
|
if (inputOffset) {
|
||||||
|
inputOffset = inputOffset[0];
|
||||||
|
|
||||||
|
// replace current text by considered offset
|
||||||
|
this.textContent = inputOffset + 's';
|
||||||
|
|
||||||
|
inputOffset = parseFloat(inputOffset);
|
||||||
|
// set new offset
|
||||||
|
playbackManager.setSubtitleOffset(inputOffset, player);
|
||||||
|
// synchronize with slider value
|
||||||
|
subtitleSyncSlider.updateOffset(
|
||||||
|
getPercentageFromOffset(inputOffset));
|
||||||
|
} else {
|
||||||
|
this.textContent = (playbackManager.getPlayerSubtitleOffset(player) || 0) + 's';
|
||||||
|
}
|
||||||
|
this.hasFocus = false;
|
||||||
|
event.preventDefault();
|
||||||
|
} else {
|
||||||
// keep focus to prevent fade with osd
|
// keep focus to prevent fade with osd
|
||||||
this.hasFocus = true;
|
this.hasFocus = true;
|
||||||
});
|
if (event.key.match(/[+-\d.s]/) === null) {
|
||||||
|
|
||||||
subtitleSyncTextField.addEventListener('keydown', function(event) {
|
|
||||||
if (event.key === 'Enter') {
|
|
||||||
// if input key is enter search for float pattern
|
|
||||||
var inputOffset = /[-+]?\d+\.?\d*/g.exec(this.textContent);
|
|
||||||
if (inputOffset) {
|
|
||||||
inputOffset = inputOffset[0];
|
|
||||||
|
|
||||||
// replace current text by considered offset
|
|
||||||
this.textContent = inputOffset + 's';
|
|
||||||
|
|
||||||
inputOffset = parseFloat(inputOffset);
|
|
||||||
// set new offset
|
|
||||||
playbackManager.setSubtitleOffset(inputOffset, player);
|
|
||||||
// synchronize with slider value
|
|
||||||
subtitleSyncSlider.updateOffset(
|
|
||||||
getPercentageFromOffset(inputOffset));
|
|
||||||
} else {
|
|
||||||
this.textContent = (playbackManager.getPlayerSubtitleOffset(player) || 0) + 's';
|
|
||||||
}
|
|
||||||
this.hasFocus = false;
|
|
||||||
event.preventDefault();
|
event.preventDefault();
|
||||||
} else {
|
|
||||||
// keep focus to prevent fade with osd
|
|
||||||
this.hasFocus = true;
|
|
||||||
if (event.key.match(/[+-\d.s]/) === null) {
|
|
||||||
event.preventDefault();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: TV layout will require special handling for navigation keys. But now field is not focusable
|
// FIXME: TV layout will require special handling for navigation keys. But now field is not focusable
|
||||||
event.stopPropagation();
|
event.stopPropagation();
|
||||||
});
|
});
|
||||||
|
|
||||||
subtitleSyncTextField.blur = function() {
|
subtitleSyncTextField.blur = function () {
|
||||||
// prevent textfield to blur while element has focus
|
// prevent textfield to blur while element has focus
|
||||||
if (!this.hasFocus && this.prototype) {
|
if (!this.hasFocus && this.prototype) {
|
||||||
this.prototype.blur();
|
this.prototype.blur();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
subtitleSyncSlider.updateOffset = function(percent) {
|
subtitleSyncSlider.updateOffset = function (percent) {
|
||||||
// default value is 0s = 50%
|
// default value is 0s = 50%
|
||||||
this.value = percent === undefined ? 50 : percent;
|
this.value = percent === undefined ? 50 : percent;
|
||||||
};
|
};
|
||||||
|
|
||||||
subtitleSyncSlider.addEventListener('change', function () {
|
subtitleSyncSlider.addEventListener('change', function () {
|
||||||
// set new offset
|
// set new offset
|
||||||
playbackManager.setSubtitleOffset(getOffsetFromPercentage(this.value), player);
|
playbackManager.setSubtitleOffset(getOffsetFromPercentage(this.value), player);
|
||||||
// synchronize with textField value
|
// synchronize with textField value
|
||||||
subtitleSyncTextField.updateOffset(
|
subtitleSyncTextField.updateOffset(
|
||||||
getOffsetFromPercentage(this.value));
|
getOffsetFromPercentage(this.value));
|
||||||
});
|
});
|
||||||
|
|
||||||
subtitleSyncSlider.getBubbleHtml = function (value) {
|
subtitleSyncSlider.getBubbleHtml = function (value) {
|
||||||
var newOffset = getOffsetFromPercentage(value);
|
const newOffset = getOffsetFromPercentage(value);
|
||||||
return '<h1 class="sliderBubbleText">' +
|
return '<h1 class="sliderBubbleText">' +
|
||||||
(newOffset > 0 ? '+' : '') + parseFloat(newOffset) + 's' +
|
(newOffset > 0 ? '+' : '') + parseFloat(newOffset) + 's' +
|
||||||
'</h1>';
|
'</h1>';
|
||||||
};
|
};
|
||||||
|
|
||||||
subtitleSyncCloseButton.addEventListener('click', function() {
|
subtitleSyncCloseButton.addEventListener('click', function () {
|
||||||
playbackManager.disableShowingSubtitleOffset(player);
|
playbackManager.disableShowingSubtitleOffset(player);
|
||||||
SubtitleSync.prototype.toggle('forceToHide');
|
SubtitleSync.prototype.toggle('forceToHide');
|
||||||
});
|
});
|
||||||
|
|
||||||
instance.element = parent;
|
instance.element = parent;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOffsetFromPercentage(value) {
|
function getOffsetFromPercentage(value) {
|
||||||
// convert percent to fraction
|
// convert percent to fraction
|
||||||
var offset = (value - 50) / 50;
|
let offset = (value - 50) / 50;
|
||||||
// multiply by offset min/max range value (-x to +x) :
|
// multiply by offset min/max range value (-x to +x) :
|
||||||
offset *= 30;
|
offset *= 30;
|
||||||
return offset.toFixed(1);
|
return offset.toFixed(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPercentageFromOffset(value) {
|
function getPercentageFromOffset(value) {
|
||||||
// divide by offset min/max range value (-x to +x) :
|
// divide by offset min/max range value (-x to +x) :
|
||||||
var percentValue = value / 30;
|
let percentValue = value / 30;
|
||||||
// convert fraction to percent
|
// convert fraction to percent
|
||||||
percentValue *= 50;
|
percentValue *= 50;
|
||||||
percentValue += 50;
|
percentValue += 50;
|
||||||
return Math.min(100, Math.max(0, percentValue.toFixed()));
|
return Math.min(100, Math.max(0, percentValue.toFixed()));
|
||||||
}
|
}
|
||||||
|
|
||||||
function SubtitleSync(currentPlayer) {
|
class SubtitleSync {
|
||||||
|
constructor(currentPlayer) {
|
||||||
player = currentPlayer;
|
player = currentPlayer;
|
||||||
init(this);
|
init(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
SubtitleSync.prototype.destroy = function() {
|
destroy() {
|
||||||
SubtitleSync.prototype.toggle('forceToHide');
|
SubtitleSync.prototype.toggle('forceToHide');
|
||||||
if (player) {
|
if (player) {
|
||||||
playbackManager.disableShowingSubtitleOffset(player);
|
playbackManager.disableShowingSubtitleOffset(player);
|
||||||
playbackManager.setSubtitleOffset(0, player);
|
playbackManager.setSubtitleOffset(0, player);
|
||||||
}
|
}
|
||||||
var elem = this.element;
|
const elem = this.element;
|
||||||
if (elem) {
|
if (elem) {
|
||||||
elem.parentNode.removeChild(elem);
|
elem.parentNode.removeChild(elem);
|
||||||
this.element = null;
|
this.element = null;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
SubtitleSync.prototype.toggle = function(action) {
|
toggle(action) {
|
||||||
if (player && playbackManager.supportSubtitleOffset(player)) {
|
if (player && playbackManager.supportSubtitleOffset(player)) {
|
||||||
/* eslint-disable no-fallthrough */
|
/* eslint-disable no-fallthrough */
|
||||||
switch (action) {
|
switch (action) {
|
||||||
|
@ -170,7 +171,7 @@ define(['playbackManager', 'layoutManager', 'text!./subtitlesync.template.html',
|
||||||
}
|
}
|
||||||
/* eslint-enable no-fallthrough */
|
/* eslint-enable no-fallthrough */
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SubtitleSync;
|
export default SubtitleSync;
|
||||||
});
|
|
||||||
|
|
|
@ -1,30 +1,33 @@
|
||||||
define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (backdrop, mainTabsManager, layoutManager) {
|
import backdrop from 'backdrop';
|
||||||
'use strict';
|
import * as mainTabsManager from 'mainTabsManager';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import 'emby-tabs';
|
||||||
|
|
||||||
function onViewDestroy(e) {
|
function onViewDestroy(e) {
|
||||||
var tabControllers = this.tabControllers;
|
var tabControllers = this.tabControllers;
|
||||||
|
|
||||||
if (tabControllers) {
|
if (tabControllers) {
|
||||||
tabControllers.forEach(function (t) {
|
tabControllers.forEach(function (t) {
|
||||||
if (t.destroy) {
|
if (t.destroy) {
|
||||||
t.destroy();
|
t.destroy();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
this.tabControllers = null;
|
this.tabControllers = null;
|
||||||
}
|
|
||||||
|
|
||||||
this.view = null;
|
|
||||||
this.params = null;
|
|
||||||
this.currentTabController = null;
|
|
||||||
this.initialTabIndex = null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBeforeTabChange() {
|
this.view = null;
|
||||||
|
this.params = null;
|
||||||
|
this.currentTabController = null;
|
||||||
|
this.initialTabIndex = null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
function onBeforeTabChange() {
|
||||||
|
|
||||||
function TabbedView(view, params) {
|
}
|
||||||
|
|
||||||
|
class TabbedView {
|
||||||
|
constructor(view, params) {
|
||||||
this.tabControllers = [];
|
this.tabControllers = [];
|
||||||
this.view = view;
|
this.view = view;
|
||||||
this.params = params;
|
this.params = params;
|
||||||
|
@ -85,7 +88,7 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
||||||
view.addEventListener('viewdestroy', onViewDestroy.bind(this));
|
view.addEventListener('viewdestroy', onViewDestroy.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
TabbedView.prototype.onResume = function (options) {
|
onResume(options) {
|
||||||
this.setTitle();
|
this.setTitle();
|
||||||
backdrop.clearBackdrop();
|
backdrop.clearBackdrop();
|
||||||
|
|
||||||
|
@ -96,19 +99,18 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
||||||
} else if (currentTabController && currentTabController.onResume) {
|
} else if (currentTabController && currentTabController.onResume) {
|
||||||
currentTabController.onResume({});
|
currentTabController.onResume({});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
TabbedView.prototype.onPause = function () {
|
onPause() {
|
||||||
var currentTabController = this.currentTabController;
|
var currentTabController = this.currentTabController;
|
||||||
|
|
||||||
if (currentTabController && currentTabController.onPause) {
|
if (currentTabController && currentTabController.onPause) {
|
||||||
currentTabController.onPause();
|
currentTabController.onPause();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
setTitle() {
|
||||||
TabbedView.prototype.setTitle = function () {
|
|
||||||
Emby.Page.setTitle('');
|
Emby.Page.setTitle('');
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return TabbedView;
|
export default TabbedView;
|
||||||
});
|
|
||||||
|
|
|
@ -3,7 +3,9 @@ define(['dialogHelper', 'dom', 'layoutManager', 'connectionManager', 'globalize'
|
||||||
|
|
||||||
browser = browser.default || browser;
|
browser = browser.default || browser;
|
||||||
loading = loading.default || loading;
|
loading = loading.default || loading;
|
||||||
|
layoutManager = layoutManager.default || layoutManager;
|
||||||
focusManager = focusManager.default || focusManager;
|
focusManager = focusManager.default || focusManager;
|
||||||
|
scrollHelper = scrollHelper.default || scrollHelper;
|
||||||
|
|
||||||
var enableFocusTransform = !browser.slow && !browser.edge;
|
var enableFocusTransform = !browser.slow && !browser.edge;
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
<input is="emby-input" class="txtPass" label="${LabelPassword}" required="required" autocomplete="off" type="password" />
|
<input is="emby-input" class="txtPass" label="${LabelPassword}" required="required" autocomplete="off" type="password" />
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block"><span>${ButtonSave}</span></button>
|
<button is="emby-button" type="submit" class="raised button-submit block"><span>${Save}</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
@ -65,7 +65,7 @@
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block btnSubmitListingsContainer btnSubmitListings hide"><span>${ButtonSave}</span></button>
|
<button is="emby-button" type="submit" class="raised button-submit block btnSubmitListingsContainer btnSubmitListings hide"><span>${Save}</span></button>
|
||||||
<button is="emby-button" type="button" class="raised button-cancel block btnCancel hide" onclick="history.back();"><span>${ButtonCancel}</span></button>
|
<button is="emby-button" type="button" class="raised button-cancel block btnCancel hide" onclick="history.back();"><span>${ButtonCancel}</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -56,7 +56,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block btnSubmitListings hide"><span>${ButtonSave}</span></button>
|
<button is="emby-button" type="submit" class="raised button-submit block btnSubmitListings hide"><span>${Save}</span></button>
|
||||||
<button is="emby-button" type="button" class="raised button-cancel block btnCancel hide" onclick="history.back();"><span>${ButtonCancel}</span></button>
|
<button is="emby-button" type="button" class="raised button-cancel block btnCancel hide" onclick="history.back();"><span>${ButtonCancel}</span></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -1,136 +1,134 @@
|
||||||
define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], function (viewContainer, focusManager, queryString, layoutManager) {
|
import viewContainer from 'viewContainer';
|
||||||
'use strict';
|
import focusManager from 'focusManager';
|
||||||
|
import queryString from 'queryString';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
|
||||||
focusManager = focusManager.default || focusManager;
|
let currentView;
|
||||||
|
let dispatchPageEvents;
|
||||||
|
|
||||||
var currentView;
|
viewContainer.setOnBeforeChange(function (newView, isRestored, options) {
|
||||||
var dispatchPageEvents;
|
const lastView = currentView;
|
||||||
|
if (lastView) {
|
||||||
|
const beforeHideResult = dispatchViewEvent(lastView, null, 'viewbeforehide', true);
|
||||||
|
|
||||||
viewContainer.setOnBeforeChange(function (newView, isRestored, options) {
|
if (!beforeHideResult) {
|
||||||
var lastView = currentView;
|
// todo: cancel
|
||||||
if (lastView) {
|
|
||||||
var beforeHideResult = dispatchViewEvent(lastView, null, 'viewbeforehide', true);
|
|
||||||
|
|
||||||
if (!beforeHideResult) {
|
|
||||||
// todo: cancel
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var eventDetail = getViewEventDetail(newView, options, isRestored);
|
|
||||||
|
|
||||||
if (!newView.initComplete) {
|
|
||||||
newView.initComplete = true;
|
|
||||||
|
|
||||||
if (typeof options.controllerFactory === 'function') {
|
|
||||||
new options.controllerFactory(newView, eventDetail.detail.params);
|
|
||||||
} else if (options.controllerFactory && typeof options.controllerFactory.default === 'function') {
|
|
||||||
new options.controllerFactory.default(newView, eventDetail.detail.params);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!options.controllerFactory || dispatchPageEvents) {
|
|
||||||
dispatchViewEvent(newView, eventDetail, 'viewinit');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
dispatchViewEvent(newView, eventDetail, 'viewbeforeshow');
|
|
||||||
});
|
|
||||||
|
|
||||||
function onViewChange(view, options, isRestore) {
|
|
||||||
var lastView = currentView;
|
|
||||||
if (lastView) {
|
|
||||||
dispatchViewEvent(lastView, null, 'viewhide');
|
|
||||||
}
|
|
||||||
|
|
||||||
currentView = view;
|
|
||||||
|
|
||||||
var eventDetail = getViewEventDetail(view, options, isRestore);
|
|
||||||
|
|
||||||
if (!isRestore) {
|
|
||||||
if (options.autoFocus !== false) {
|
|
||||||
focusManager.autoFocus(view);
|
|
||||||
}
|
|
||||||
} else if (!layoutManager.mobile) {
|
|
||||||
if (view.activeElement && document.body.contains(view.activeElement) && focusManager.isCurrentlyFocusable(view.activeElement)) {
|
|
||||||
focusManager.focus(view.activeElement);
|
|
||||||
} else {
|
|
||||||
focusManager.autoFocus(view);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
view.dispatchEvent(new CustomEvent('viewshow', eventDetail));
|
|
||||||
|
|
||||||
if (dispatchPageEvents) {
|
|
||||||
view.dispatchEvent(new CustomEvent('pageshow', eventDetail));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProperties(view) {
|
const eventDetail = getViewEventDetail(newView, options, isRestored);
|
||||||
var props = view.getAttribute('data-properties');
|
|
||||||
|
|
||||||
if (props) {
|
if (!newView.initComplete) {
|
||||||
return props.split(',');
|
newView.initComplete = true;
|
||||||
|
|
||||||
|
if (typeof options.controllerFactory === 'function') {
|
||||||
|
new options.controllerFactory(newView, eventDetail.detail.params);
|
||||||
|
} else if (options.controllerFactory && typeof options.controllerFactory.default === 'function') {
|
||||||
|
new options.controllerFactory.default(newView, eventDetail.detail.params);
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
if (!options.controllerFactory || dispatchPageEvents) {
|
||||||
|
dispatchViewEvent(newView, eventDetail, 'viewinit');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function dispatchViewEvent(view, eventInfo, eventName, isCancellable) {
|
dispatchViewEvent(newView, eventDetail, 'viewbeforeshow');
|
||||||
if (!eventInfo) {
|
});
|
||||||
eventInfo = {
|
|
||||||
detail: {
|
|
||||||
type: view.getAttribute('data-type'),
|
|
||||||
properties: getProperties(view)
|
|
||||||
},
|
|
||||||
bubbles: true,
|
|
||||||
cancelable: isCancellable
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
eventInfo.cancelable = isCancellable || false;
|
function onViewChange(view, options, isRestore) {
|
||||||
|
const lastView = currentView;
|
||||||
var eventResult = view.dispatchEvent(new CustomEvent(eventName, eventInfo));
|
if (lastView) {
|
||||||
|
dispatchViewEvent(lastView, null, 'viewhide');
|
||||||
if (dispatchPageEvents) {
|
|
||||||
eventInfo.cancelable = false;
|
|
||||||
view.dispatchEvent(new CustomEvent(eventName.replace('view', 'page'), eventInfo));
|
|
||||||
}
|
|
||||||
|
|
||||||
return eventResult;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getViewEventDetail(view, options, isRestore) {
|
currentView = view;
|
||||||
var url = options.url;
|
|
||||||
var index = url.indexOf('?');
|
|
||||||
var params = index === -1 ? {} : queryString.parse(url.substring(index + 1));
|
|
||||||
|
|
||||||
return {
|
const eventDetail = getViewEventDetail(view, options, isRestore);
|
||||||
|
|
||||||
|
if (!isRestore) {
|
||||||
|
if (options.autoFocus !== false) {
|
||||||
|
focusManager.autoFocus(view);
|
||||||
|
}
|
||||||
|
} else if (!layoutManager.mobile) {
|
||||||
|
if (view.activeElement && document.body.contains(view.activeElement) && focusManager.isCurrentlyFocusable(view.activeElement)) {
|
||||||
|
focusManager.focus(view.activeElement);
|
||||||
|
} else {
|
||||||
|
focusManager.autoFocus(view);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
view.dispatchEvent(new CustomEvent('viewshow', eventDetail));
|
||||||
|
|
||||||
|
if (dispatchPageEvents) {
|
||||||
|
view.dispatchEvent(new CustomEvent('pageshow', eventDetail));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function getProperties(view) {
|
||||||
|
const props = view.getAttribute('data-properties');
|
||||||
|
|
||||||
|
if (props) {
|
||||||
|
return props.split(',');
|
||||||
|
}
|
||||||
|
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
function dispatchViewEvent(view, eventInfo, eventName, isCancellable) {
|
||||||
|
if (!eventInfo) {
|
||||||
|
eventInfo = {
|
||||||
detail: {
|
detail: {
|
||||||
type: view.getAttribute('data-type'),
|
type: view.getAttribute('data-type'),
|
||||||
properties: getProperties(view),
|
properties: getProperties(view)
|
||||||
params: params,
|
|
||||||
isRestored: isRestore,
|
|
||||||
state: options.state,
|
|
||||||
|
|
||||||
// The route options
|
|
||||||
options: options.options || {}
|
|
||||||
},
|
},
|
||||||
bubbles: true,
|
bubbles: true,
|
||||||
cancelable: false
|
cancelable: isCancellable
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetCachedViews() {
|
eventInfo.cancelable = isCancellable || false;
|
||||||
// Reset all cached views whenever the skin changes
|
|
||||||
viewContainer.reset();
|
const eventResult = view.dispatchEvent(new CustomEvent(eventName, eventInfo));
|
||||||
|
|
||||||
|
if (dispatchPageEvents) {
|
||||||
|
eventInfo.cancelable = false;
|
||||||
|
view.dispatchEvent(new CustomEvent(eventName.replace('view', 'page'), eventInfo));
|
||||||
}
|
}
|
||||||
|
|
||||||
document.addEventListener('skinunload', resetCachedViews);
|
return eventResult;
|
||||||
|
}
|
||||||
|
|
||||||
function ViewManager() {
|
function getViewEventDetail(view, options, isRestore) {
|
||||||
}
|
const url = options.url;
|
||||||
|
const index = url.indexOf('?');
|
||||||
|
const params = index === -1 ? {} : queryString.parse(url.substring(index + 1));
|
||||||
|
|
||||||
ViewManager.prototype.loadView = function (options) {
|
return {
|
||||||
var lastView = currentView;
|
detail: {
|
||||||
|
type: view.getAttribute('data-type'),
|
||||||
|
properties: getProperties(view),
|
||||||
|
params: params,
|
||||||
|
isRestored: isRestore,
|
||||||
|
state: options.state,
|
||||||
|
|
||||||
|
// The route options
|
||||||
|
options: options.options || {}
|
||||||
|
},
|
||||||
|
bubbles: true,
|
||||||
|
cancelable: false
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
function resetCachedViews() {
|
||||||
|
// Reset all cached views whenever the skin changes
|
||||||
|
viewContainer.reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener('skinunload', resetCachedViews);
|
||||||
|
|
||||||
|
class ViewManager {
|
||||||
|
loadView(options) {
|
||||||
|
const lastView = currentView;
|
||||||
|
|
||||||
// Record the element that has focus
|
// Record the element that has focus
|
||||||
if (lastView) {
|
if (lastView) {
|
||||||
|
@ -144,9 +142,9 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
||||||
viewContainer.loadView(options).then(function (view) {
|
viewContainer.loadView(options).then(function (view) {
|
||||||
onViewChange(view, options);
|
onViewChange(view, options);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
ViewManager.prototype.tryRestoreView = function (options, onViewChanging) {
|
tryRestoreView(options, onViewChanging) {
|
||||||
if (options.cancel) {
|
if (options.cancel) {
|
||||||
return Promise.reject({ cancelled: true });
|
return Promise.reject({ cancelled: true });
|
||||||
}
|
}
|
||||||
|
@ -160,15 +158,15 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
||||||
onViewChanging();
|
onViewChanging();
|
||||||
onViewChange(view, options, true);
|
onViewChange(view, options, true);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
ViewManager.prototype.currentView = function () {
|
currentView() {
|
||||||
return currentView;
|
return currentView;
|
||||||
};
|
}
|
||||||
|
|
||||||
ViewManager.prototype.dispatchPageEvents = function (value) {
|
dispatchPageEvents(value) {
|
||||||
dispatchPageEvents = value;
|
dispatchPageEvents = value;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return new ViewManager();
|
export default new ViewManager();
|
||||||
});
|
|
||||||
|
|
|
@ -2,6 +2,7 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
appRouter = appRouter.default || appRouter;
|
appRouter = appRouter.default || appRouter;
|
||||||
|
layoutManager = layoutManager.default || layoutManager;
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -31,6 +32,7 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
require(['scrollHelper'], function (scrollHelper) {
|
||||||
|
scrollHelper = scrollHelper.default || scrollHelper;
|
||||||
var fn = on ? 'on' : 'off';
|
var fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
<div class="detailSectionHeader">
|
<div class="detailSectionHeader">
|
||||||
<h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;">${HeaderApiKeys}</h2>
|
<h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;">${HeaderApiKeys}</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnNewKey submit" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnNewKey submit" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add" aria-hidden="true"></span>
|
<span class="material-icons add" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
|
@ -24,7 +24,7 @@ import 'emby-itemscontainer';
|
||||||
function showPlaybackInfo(btn, session) {
|
function showPlaybackInfo(btn, session) {
|
||||||
import('alert').then(({default: alert}) => {
|
import('alert').then(({default: alert}) => {
|
||||||
let title;
|
let title;
|
||||||
let text = [];
|
const text = [];
|
||||||
const displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
|
const displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
|
||||||
|
|
||||||
if (displayPlayMethod === 'DirectStream') {
|
if (displayPlayMethod === 'DirectStream') {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -38,7 +38,7 @@ import 'cardStyle';
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDeviceMenu(view, btn, deviceId) {
|
function showDeviceMenu(view, btn, deviceId) {
|
||||||
let menuItems = [];
|
const menuItems = [];
|
||||||
|
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div data-role="controlgroup" data-type="horizontal" data-mini="true">
|
<div data-role="controlgroup" data-type="horizontal" data-mini="true">
|
||||||
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioInfo" data-value="tabInfo">${TabInfo}</a>
|
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioInfo" data-value="tabInfo">${TabInfo}</a>
|
||||||
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioDirectPlay" data-value="tabDirectPlayProfiles">${TabDirectPlay}</a>
|
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioDirectPlay" data-value="tabDirectPlayProfiles">${TabDirectPlay}</a>
|
||||||
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioTranscoding" data-value="tabTranscodingProfiles">${TabTranscoding}</a>
|
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioTranscoding" data-value="tabTranscodingProfiles">${Transcoding}</a>
|
||||||
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioContainers" data-value="tabContainerProfiles">${TabContainers}</a>
|
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioContainers" data-value="tabContainerProfiles">${TabContainers}</a>
|
||||||
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioCodecs" data-value="tabCodecProfiles">${TabCodecs}</a>
|
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioCodecs" data-value="tabCodecProfiles">${TabCodecs}</a>
|
||||||
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioMediaProfiles" data-value="tabMediaProfiles">${TabResponses}</a>
|
<a href="#" is="emby-linkbutton" data-role="button" class="radioTabButton" id="radioMediaProfiles" data-value="tabMediaProfiles">${TabResponses}</a>
|
||||||
|
@ -96,14 +96,14 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<h2 style="vertical-align:middle;display:inline-block;">${HeaderHttpHeaders}</h2>
|
<h2 style="vertical-align:middle;display:inline-block;">${HeaderHttpHeaders}</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnAddIdentificationHttpHeader submit sectionTitleButton" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnAddIdentificationHttpHeader submit sectionTitleButton" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add"></span>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="httpHeaderIdentificationList"></div>
|
<div class="httpHeaderIdentificationList"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div is="emby-collapse" title="${HeaderDisplay}">
|
<div is="emby-collapse" title="${Display}">
|
||||||
<div class="collapseContent">
|
<div class="collapseContent">
|
||||||
<br />
|
<br />
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||||
|
@ -209,7 +209,7 @@
|
||||||
<div class="collapseContent">
|
<div class="collapseContent">
|
||||||
<p>${HeaderSubtitleProfilesHelp}</p>
|
<p>${HeaderSubtitleProfilesHelp}</p>
|
||||||
<button is="emby-button" type="button" class="raised submit block btnAddSubtitleProfile">
|
<button is="emby-button" type="button" class="raised submit block btnAddSubtitleProfile">
|
||||||
<span>${ButtonAdd}</span>
|
<span>${Add}</span>
|
||||||
</button>
|
</button>
|
||||||
<div class="subtitleProfileList"></div>
|
<div class="subtitleProfileList"></div>
|
||||||
<br />
|
<br />
|
||||||
|
@ -219,7 +219,7 @@
|
||||||
<div class="collapseContent">
|
<div class="collapseContent">
|
||||||
<div>
|
<div>
|
||||||
<h2 style="vertical-align:middle;display:inline-block;">${HeaderXmlDocumentAttributes}</h2>
|
<h2 style="vertical-align:middle;display:inline-block;">${HeaderXmlDocumentAttributes}</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnAddXmlDocumentAttribute submit sectionTitleButton" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnAddXmlDocumentAttribute submit sectionTitleButton" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add"></span>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -262,7 +262,7 @@
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
<button is="emby-button" type="button" class="button-cancel raised block" onclick="Dashboard.navigate('dlnaprofiles.html');">
|
<button is="emby-button" type="button" class="button-cancel raised block" onclick="Dashboard.navigate('dlnaprofiles.html');">
|
||||||
<span>${ButtonCancel}</span>
|
<span>${ButtonCancel}</span>
|
|
@ -315,7 +315,7 @@ import 'listViewStyle';
|
||||||
let currentType;
|
let currentType;
|
||||||
|
|
||||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
let profile = profiles[i];
|
const profile = profiles[i];
|
||||||
|
|
||||||
if (profile.Type !== currentType) {
|
if (profile.Type !== currentType) {
|
||||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||||
|
@ -401,7 +401,7 @@ import 'listViewStyle';
|
||||||
let currentType;
|
let currentType;
|
||||||
|
|
||||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
let profile = profiles[i];
|
const profile = profiles[i];
|
||||||
|
|
||||||
if (profile.Type !== currentType) {
|
if (profile.Type !== currentType) {
|
||||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||||
|
@ -472,7 +472,7 @@ import 'listViewStyle';
|
||||||
let currentType;
|
let currentType;
|
||||||
|
|
||||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
let profile = profiles[i];
|
const profile = profiles[i];
|
||||||
const type = profile.Type.replace('VideoAudio', 'Video Audio');
|
const type = profile.Type.replace('VideoAudio', 'Video Audio');
|
||||||
|
|
||||||
if (type !== currentType) {
|
if (type !== currentType) {
|
||||||
|
@ -696,7 +696,7 @@ import 'listViewStyle';
|
||||||
let currentProfile;
|
let currentProfile;
|
||||||
let currentSubProfile;
|
let currentSubProfile;
|
||||||
let isSubProfileNew;
|
let isSubProfileNew;
|
||||||
const allText = globalize.translate('LabelAll');
|
const allText = globalize.translate('All');
|
||||||
|
|
||||||
$(document).on('pageinit', '#dlnaProfilePage', function () {
|
$(document).on('pageinit', '#dlnaProfilePage', function () {
|
||||||
const page = this;
|
const page = this;
|
||||||
|
|
|
@ -36,7 +36,7 @@ import 'emby-button';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
let profile = profiles[i];
|
const profile = profiles[i];
|
||||||
html += '<div class="listItem listItem-border">';
|
html += '<div class="listItem listItem-border">';
|
||||||
html += '<span class="listItemIcon material-icons live_tv"></span>';
|
html += '<span class="listItemIcon material-icons live_tv"></span>';
|
||||||
html += '<div class="listItemBody two-line">';
|
html += '<div class="listItemBody two-line">';
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -4,7 +4,7 @@
|
||||||
<form class="encodingSettingsForm">
|
<form class="encodingSettingsForm">
|
||||||
<div class="verticalSection">
|
<div class="verticalSection">
|
||||||
<div class="sectionTitleContainer flex align-items-center">
|
<div class="sectionTitleContainer flex align-items-center">
|
||||||
<h2 class="sectionTitle">${TabTranscoding}</h2>
|
<h2 class="sectionTitle">${Transcoding}</h2>
|
||||||
<a is="emby-linkbutton" rel="noopener noreferrer" class="raised button-alt headerHelpButton" target="_blank" href="https://docs.jellyfin.org/general/server/transcoding.html">${Help}</a>
|
<a is="emby-linkbutton" rel="noopener noreferrer" class="raised button-alt headerHelpButton" target="_blank" href="https://docs.jellyfin.org/general/server/transcoding.html">${Help}</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -176,7 +176,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -63,7 +63,7 @@
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -363,10 +363,10 @@ import 'emby-itemrefreshindicator';
|
||||||
name: globalize.translate('HeaderLibraries')
|
name: globalize.translate('HeaderLibraries')
|
||||||
}, {
|
}, {
|
||||||
href: 'librarydisplay.html',
|
href: 'librarydisplay.html',
|
||||||
name: globalize.translate('TabDisplay')
|
name: globalize.translate('Display')
|
||||||
}, {
|
}, {
|
||||||
href: 'metadataimages.html',
|
href: 'metadataimages.html',
|
||||||
name: globalize.translate('TabMetadata')
|
name: globalize.translate('Metadata')
|
||||||
}, {
|
}, {
|
||||||
href: 'metadatanfo.html',
|
href: 'metadatanfo.html',
|
||||||
name: globalize.translate('TabNfoSettings')
|
name: globalize.translate('TabNfoSettings')
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
<br/>
|
<br/>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
|
@ -12,10 +12,10 @@ import 'emby-button';
|
||||||
name: globalize.translate('HeaderLibraries')
|
name: globalize.translate('HeaderLibraries')
|
||||||
}, {
|
}, {
|
||||||
href: 'librarydisplay.html',
|
href: 'librarydisplay.html',
|
||||||
name: globalize.translate('TabDisplay')
|
name: globalize.translate('Display')
|
||||||
}, {
|
}, {
|
||||||
href: 'metadataimages.html',
|
href: 'metadataimages.html',
|
||||||
name: globalize.translate('TabMetadata')
|
name: globalize.translate('Metadata')
|
||||||
}, {
|
}, {
|
||||||
href: 'metadatanfo.html',
|
href: 'metadatanfo.html',
|
||||||
name: globalize.translate('TabNfoSettings')
|
name: globalize.translate('TabNfoSettings')
|
||||||
|
|
|
@ -55,10 +55,10 @@ import 'listViewStyle';
|
||||||
name: globalize.translate('HeaderLibraries')
|
name: globalize.translate('HeaderLibraries')
|
||||||
}, {
|
}, {
|
||||||
href: 'librarydisplay.html',
|
href: 'librarydisplay.html',
|
||||||
name: globalize.translate('TabDisplay')
|
name: globalize.translate('Display')
|
||||||
}, {
|
}, {
|
||||||
href: 'metadataimages.html',
|
href: 'metadataimages.html',
|
||||||
name: globalize.translate('TabMetadata')
|
name: globalize.translate('Metadata')
|
||||||
}, {
|
}, {
|
||||||
href: 'metadatanfo.html',
|
href: 'metadatanfo.html',
|
||||||
name: globalize.translate('TabNfoSettings')
|
name: globalize.translate('TabNfoSettings')
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<select is="emby-select" id="selectCountry" required="required" label="${LabelCountry}"></select>
|
<select is="emby-select" id="selectCountry" required="required" label="${LabelCountry}"></select>
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div><button is="emby-button" type="submit" class="raised button-submit block"><span>${ButtonSave}</span></button></div>
|
<div><button is="emby-button" type="submit" class="raised button-submit block"><span>${Save}</span></button></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
</label>
|
</label>
|
||||||
<div class="fieldDescription checkboxFieldDescription">${LabelKodiMetadataEnableExtraThumbsHelp}</div>
|
<div class="fieldDescription checkboxFieldDescription">${LabelKodiMetadataEnableExtraThumbsHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
<div><button is="emby-button" type="submit" class="raised button-submit block"><span>${ButtonSave}</span></button></div>
|
<div><button is="emby-button" type="submit" class="raised button-submit block"><span>${Save}</span></button></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -52,10 +52,10 @@ import globalize from 'globalize';
|
||||||
name: globalize.translate('HeaderLibraries')
|
name: globalize.translate('HeaderLibraries')
|
||||||
}, {
|
}, {
|
||||||
href: 'librarydisplay.html',
|
href: 'librarydisplay.html',
|
||||||
name: globalize.translate('TabDisplay')
|
name: globalize.translate('Display')
|
||||||
}, {
|
}, {
|
||||||
href: 'metadataimages.html',
|
href: 'metadataimages.html',
|
||||||
name: globalize.translate('TabMetadata')
|
name: globalize.translate('Metadata')
|
||||||
}, {
|
}, {
|
||||||
href: 'metadatanfo.html',
|
href: 'metadatanfo.html',
|
||||||
name: globalize.translate('TabNfoSettings')
|
name: globalize.translate('TabNfoSettings')
|
||||||
|
|
|
@ -112,7 +112,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -54,7 +54,7 @@
|
||||||
<div>
|
<div>
|
||||||
<br />
|
<br />
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button is="emby-button" type="button" class="raised button-cancel block btnCancel" onclick="history.back();">
|
<button is="emby-button" type="button" class="raised button-cancel block btnCancel" onclick="history.back();">
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
${LabelMinResumeDurationHelp}
|
${LabelMinResumeDurationHelp}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div><button is="emby-button" type="submit" class="raised button-submit block"><span>${ButtonSave}</span></button></div>
|
<div><button is="emby-button" type="submit" class="raised button-submit block"><span>${Save}</span></button></div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
|
@ -1,143 +1,146 @@
|
||||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'connectionManager', 'emby-button'], function ($, loading, libraryMenu, globalize, connectionManager) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
loading = loading.default || loading;
|
function populateHistory(packageInfo, page) {
|
||||||
|
let html = '';
|
||||||
|
const length = Math.min(packageInfo.versions.length, 10);
|
||||||
|
|
||||||
function populateHistory(packageInfo, page) {
|
for (let i = 0; i < length; i++) {
|
||||||
var html = '';
|
const version = packageInfo.versions[i];
|
||||||
var length = Math.min(packageInfo.versions.length, 10);
|
html += '<h2 style="margin:.5em 0;">' + version.version + '</h2>';
|
||||||
|
html += '<div style="margin-bottom:1.5em;">' + version.changelog + '</div>';
|
||||||
for (var i = 0; i < length; i++) {
|
|
||||||
var version = packageInfo.versions[i];
|
|
||||||
html += '<h2 style="margin:.5em 0;">' + version.version + '</h2>';
|
|
||||||
html += '<div style="margin-bottom:1.5em;">' + version.changelog + '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#revisionHistory', page).html(html);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateVersions(packageInfo, page, installedPlugin) {
|
$('#revisionHistory', page).html(html);
|
||||||
var html = '';
|
}
|
||||||
|
|
||||||
for (var i = 0; i < packageInfo.versions.length; i++) {
|
function populateVersions(packageInfo, page, installedPlugin) {
|
||||||
var version = packageInfo.versions[i];
|
let html = '';
|
||||||
html += '<option value="' + version.version + '">' + version.version + '</option>';
|
|
||||||
}
|
|
||||||
|
|
||||||
var selectmenu = $('#selectVersion', page).html(html);
|
for (let i = 0; i < packageInfo.versions.length; i++) {
|
||||||
|
const version = packageInfo.versions[i];
|
||||||
if (!installedPlugin) {
|
html += '<option value="' + version.version + '">' + version.version + '</option>';
|
||||||
$('#pCurrentVersion', page).hide().html('');
|
|
||||||
}
|
|
||||||
|
|
||||||
var packageVersion = packageInfo.versions[0];
|
|
||||||
if (packageVersion) {
|
|
||||||
selectmenu.val(packageVersion.version);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPackage(pkg, installedPlugins, page) {
|
const selectmenu = $('#selectVersion', page).html(html);
|
||||||
var installedPlugin = installedPlugins.filter(function (ip) {
|
|
||||||
return ip.Name == pkg.name;
|
|
||||||
})[0];
|
|
||||||
|
|
||||||
populateVersions(pkg, page, installedPlugin);
|
if (!installedPlugin) {
|
||||||
populateHistory(pkg, page);
|
$('#pCurrentVersion', page).hide().html('');
|
||||||
|
|
||||||
$('.pluginName', page).html(pkg.name);
|
|
||||||
$('#btnInstallDiv', page).removeClass('hide');
|
|
||||||
$('#pSelectVersion', page).removeClass('hide');
|
|
||||||
|
|
||||||
if (pkg.overview) {
|
|
||||||
$('#overview', page).show().html(pkg.overview);
|
|
||||||
} else {
|
|
||||||
$('#overview', page).hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
$('#description', page).html(pkg.description);
|
|
||||||
$('#developer', page).html(pkg.owner);
|
|
||||||
|
|
||||||
if (installedPlugin) {
|
|
||||||
var currentVersionText = globalize.translate('MessageYouHaveVersionInstalled', '<strong>' + installedPlugin.Version + '</strong>');
|
|
||||||
$('#pCurrentVersion', page).show().html(currentVersionText);
|
|
||||||
} else {
|
|
||||||
$('#pCurrentVersion', page).hide().html('');
|
|
||||||
}
|
|
||||||
|
|
||||||
loading.hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function alertText(options) {
|
const packageVersion = packageInfo.versions[0];
|
||||||
require(['alert'], function ({default: alert}) {
|
if (packageVersion) {
|
||||||
alert(options);
|
selectmenu.val(packageVersion.version);
|
||||||
});
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderPackage(pkg, installedPlugins, page) {
|
||||||
|
const installedPlugin = installedPlugins.filter(function (ip) {
|
||||||
|
return ip.Name == pkg.name;
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
populateVersions(pkg, page, installedPlugin);
|
||||||
|
populateHistory(pkg, page);
|
||||||
|
|
||||||
|
$('.pluginName', page).html(pkg.name);
|
||||||
|
$('#btnInstallDiv', page).removeClass('hide');
|
||||||
|
$('#pSelectVersion', page).removeClass('hide');
|
||||||
|
|
||||||
|
if (pkg.overview) {
|
||||||
|
$('#overview', page).show().html(pkg.overview);
|
||||||
|
} else {
|
||||||
|
$('#overview', page).hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function performInstallation(page, name, guid, version) {
|
$('#description', page).html(pkg.description);
|
||||||
var developer = $('#developer', page).html().toLowerCase();
|
$('#developer', page).html(pkg.owner);
|
||||||
|
|
||||||
var alertCallback = function () {
|
if (installedPlugin) {
|
||||||
loading.show();
|
const currentVersionText = globalize.translate('MessageYouHaveVersionInstalled', '<strong>' + installedPlugin.Version + '</strong>');
|
||||||
page.querySelector('#btnInstall').disabled = true;
|
$('#pCurrentVersion', page).show().html(currentVersionText);
|
||||||
ApiClient.installPlugin(name, guid, version).then(function () {
|
} else {
|
||||||
loading.hide();
|
$('#pCurrentVersion', page).hide().html('');
|
||||||
alertText(globalize.translate('MessagePluginInstalled'));
|
}
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
if (developer !== 'jellyfin') {
|
loading.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
function alertText(options) {
|
||||||
|
import('alert').then(({default: alert}) => {
|
||||||
|
alert(options);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function performInstallation(page, name, guid, version) {
|
||||||
|
const developer = $('#developer', page).html().toLowerCase();
|
||||||
|
|
||||||
|
const alertCallback = function () {
|
||||||
|
loading.show();
|
||||||
|
page.querySelector('#btnInstall').disabled = true;
|
||||||
|
ApiClient.installPlugin(name, guid, version).then(() => {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
var msg = globalize.translate('MessagePluginInstallDisclaimer');
|
alertText(globalize.translate('MessagePluginInstalled'));
|
||||||
msg += '<br/>';
|
}).catch(() => {
|
||||||
msg += '<br/>';
|
alertText(globalize.translate('MessagePluginInstallError'));
|
||||||
msg += globalize.translate('PleaseConfirmPluginInstallation');
|
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
|
||||||
confirm.default(msg, globalize.translate('HeaderConfirmPluginInstallation')).then(function () {
|
|
||||||
alertCallback();
|
|
||||||
}, function () {
|
|
||||||
console.debug('plugin not installed');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
alertCallback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return function (view, params) {
|
|
||||||
$('.addPluginForm', view).on('submit', function () {
|
|
||||||
loading.show();
|
|
||||||
var page = $(this).parents('#addPluginPage')[0];
|
|
||||||
var name = params.name;
|
|
||||||
var guid = params.guid;
|
|
||||||
ApiClient.getInstalledPlugins().then(function (plugins) {
|
|
||||||
var installedPlugin = plugins.filter(function (plugin) {
|
|
||||||
return plugin.Name == name;
|
|
||||||
})[0];
|
|
||||||
|
|
||||||
var version = $('#selectVersion', page).val();
|
|
||||||
if (installedPlugin && installedPlugin.Version === version) {
|
|
||||||
loading.hide();
|
|
||||||
Dashboard.alert({
|
|
||||||
message: globalize.translate('MessageAlreadyInstalled'),
|
|
||||||
title: globalize.translate('HeaderPluginInstallation')
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
performInstallation(page, name, guid, version);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return false;
|
|
||||||
});
|
|
||||||
view.addEventListener('viewshow', function () {
|
|
||||||
var page = this;
|
|
||||||
loading.show();
|
|
||||||
var name = params.name;
|
|
||||||
var guid = params.guid;
|
|
||||||
var promise1 = ApiClient.getPackageInfo(name, guid);
|
|
||||||
var promise2 = ApiClient.getInstalledPlugins();
|
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
|
||||||
renderPackage(responses[0], responses[1], page);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
if (developer !== 'jellyfin') {
|
||||||
|
loading.hide();
|
||||||
|
let msg = globalize.translate('MessagePluginInstallDisclaimer');
|
||||||
|
msg += '<br/>';
|
||||||
|
msg += '<br/>';
|
||||||
|
msg += globalize.translate('PleaseConfirmPluginInstallation');
|
||||||
|
|
||||||
|
import('confirm').then(({default: confirm}) => {
|
||||||
|
confirm(msg, globalize.translate('HeaderConfirmPluginInstallation')).then(function () {
|
||||||
|
alertCallback();
|
||||||
|
}).catch(() => {
|
||||||
|
console.debug('plugin not installed');
|
||||||
|
});
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
alertCallback();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function(view, params) {
|
||||||
|
$('.addPluginForm', view).on('submit', function () {
|
||||||
|
loading.show();
|
||||||
|
const page = $(this).parents('#addPluginPage')[0];
|
||||||
|
const name = params.name;
|
||||||
|
const guid = params.guid;
|
||||||
|
ApiClient.getInstalledPlugins().then(function (plugins) {
|
||||||
|
const installedPlugin = plugins.filter(function (plugin) {
|
||||||
|
return plugin.Name == name;
|
||||||
|
})[0];
|
||||||
|
|
||||||
|
const version = $('#selectVersion', page).val();
|
||||||
|
if (installedPlugin && installedPlugin.Version === version) {
|
||||||
|
loading.hide();
|
||||||
|
Dashboard.alert({
|
||||||
|
message: globalize.translate('MessageAlreadyInstalled'),
|
||||||
|
title: globalize.translate('HeaderPluginInstallation')
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
performInstallation(page, name, guid, version);
|
||||||
|
}
|
||||||
|
}).catch(() => {
|
||||||
|
alertText(globalize.translate('MessageGetInstalledPluginsError'));
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
view.addEventListener('viewshow', function () {
|
||||||
|
const page = this;
|
||||||
|
loading.show();
|
||||||
|
const name = params.name;
|
||||||
|
const guid = params.guid;
|
||||||
|
const promise1 = ApiClient.getPackageInfo(name, guid);
|
||||||
|
const promise2 = ApiClient.getInstalledPlugins();
|
||||||
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
|
renderPackage(responses[0], responses[1], page);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
|
@ -1,143 +1,142 @@
|
||||||
define(['loading', 'libraryMenu', 'globalize', 'cardStyle', 'emby-button', 'emby-checkbox', 'emby-select'], function (loading, libraryMenu, globalize) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'cardStyle';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-select';
|
||||||
|
|
||||||
loading = loading.default || loading;
|
function reloadList(page) {
|
||||||
|
loading.show();
|
||||||
function reloadList(page) {
|
const promise1 = ApiClient.getAvailablePlugins();
|
||||||
loading.show();
|
const promise2 = ApiClient.getInstalledPlugins();
|
||||||
var promise1 = ApiClient.getAvailablePlugins();
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
var promise2 = ApiClient.getInstalledPlugins();
|
populateList({
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
catalogElement: page.querySelector('#pluginTiles'),
|
||||||
populateList({
|
noItemsElement: page.querySelector('#noPlugins'),
|
||||||
catalogElement: page.querySelector('#pluginTiles'),
|
availablePlugins: responses[0],
|
||||||
noItemsElement: page.querySelector('#noPlugins'),
|
installedPlugins: responses[1]
|
||||||
availablePlugins: responses[0],
|
|
||||||
installedPlugins: responses[1]
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getHeaderText(category) {
|
||||||
|
category = category.replace(' ', '');
|
||||||
|
// TODO: Replace with switch
|
||||||
|
if (category === 'Channel') {
|
||||||
|
category = 'Channels';
|
||||||
|
} else if (category === 'Theme') {
|
||||||
|
category = 'Themes';
|
||||||
|
} else if (category === 'LiveTV') {
|
||||||
|
category = 'HeaderLiveTV';
|
||||||
|
} else if (category === 'ScreenSaver') {
|
||||||
|
category = 'HeaderScreenSavers';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHeaderText(category) {
|
return globalize.translate(category);
|
||||||
category = category.replace(' ', '');
|
}
|
||||||
if (category === 'Channel') {
|
|
||||||
category = 'Channels';
|
function populateList(options) {
|
||||||
} else if (category === 'Theme') {
|
const availablePlugins = options.availablePlugins;
|
||||||
category = 'Themes';
|
const installedPlugins = options.installedPlugins;
|
||||||
} else if (category === 'LiveTV') {
|
|
||||||
category = 'HeaderLiveTV';
|
availablePlugins.forEach(function (plugin, index, array) {
|
||||||
} else if (category === 'ScreenSaver') {
|
plugin.category = plugin.category || 'General';
|
||||||
category = 'HeaderScreenSavers';
|
plugin.categoryDisplayName = getHeaderText(plugin.category);
|
||||||
|
array[index] = plugin;
|
||||||
|
});
|
||||||
|
|
||||||
|
availablePlugins.sort(function (a, b) {
|
||||||
|
if (a.category > b.category) {
|
||||||
|
return 1;
|
||||||
|
} else if (b.category > a.category) {
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
if (a.name > b.name) {
|
||||||
|
return 1;
|
||||||
|
} else if (b.name > a.name) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
});
|
||||||
|
|
||||||
return globalize.translate(category);
|
let currentCategory = null;
|
||||||
}
|
let html = '';
|
||||||
|
|
||||||
function populateList(options) {
|
for (let i = 0; i < availablePlugins.length; i++) {
|
||||||
var availablePlugins = options.availablePlugins;
|
const plugin = availablePlugins[i];
|
||||||
var installedPlugins = options.installedPlugins;
|
const category = plugin.categoryDisplayName;
|
||||||
|
if (category != currentCategory) {
|
||||||
availablePlugins.forEach(function (plugin, index, array) {
|
if (currentCategory) {
|
||||||
plugin.category = plugin.category || 'General';
|
html += '</div>';
|
||||||
plugin.categoryDisplayName = getHeaderText(plugin.category);
|
html += '</div>';
|
||||||
array[index] = plugin;
|
|
||||||
});
|
|
||||||
|
|
||||||
availablePlugins.sort(function (a, b) {
|
|
||||||
if (a.category > b.category) {
|
|
||||||
return 1;
|
|
||||||
} else if (b.category > a.category) {
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
if (a.name > b.name) {
|
html += '<div class="verticalSection">';
|
||||||
return 1;
|
html += '<h2 class="sectionTitle sectionTitle-cards">' + category + '</h2>';
|
||||||
} else if (b.name > a.name) {
|
html += '<div class="itemsContainer vertical-wrap">';
|
||||||
return -1;
|
currentCategory = category;
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
});
|
|
||||||
|
|
||||||
var currentCategory = null;
|
|
||||||
var html = '';
|
|
||||||
|
|
||||||
for (var i = 0; i < availablePlugins.length; i++) {
|
|
||||||
var plugin = availablePlugins[i];
|
|
||||||
var category = plugin.categoryDisplayName;
|
|
||||||
if (category != currentCategory) {
|
|
||||||
if (currentCategory) {
|
|
||||||
html += '</div>';
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
html += '<div class="verticalSection">';
|
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + category + '</h2>';
|
|
||||||
html += '<div class="itemsContainer vertical-wrap">';
|
|
||||||
currentCategory = category;
|
|
||||||
}
|
|
||||||
html += getPluginHtml(plugin, options, installedPlugins);
|
|
||||||
}
|
}
|
||||||
html += '</div>';
|
html += getPluginHtml(plugin, options, installedPlugins);
|
||||||
html += '</div>';
|
}
|
||||||
|
html += '</div>';
|
||||||
|
html += '</div>';
|
||||||
|
|
||||||
if (!availablePlugins.length && options.noItemsElement) {
|
if (!availablePlugins.length && options.noItemsElement) {
|
||||||
options.noItemsElement.classList.remove('hide');
|
options.noItemsElement.classList.remove('hide');
|
||||||
}
|
|
||||||
|
|
||||||
options.catalogElement.innerHTML = html;
|
|
||||||
loading.hide();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPluginHtml(plugin, options, installedPlugins) {
|
options.catalogElement.innerHTML = html;
|
||||||
var html = '';
|
loading.hide();
|
||||||
var href = plugin.externalUrl ? plugin.externalUrl : 'addplugin.html?name=' + encodeURIComponent(plugin.name) + '&guid=' + plugin.guid;
|
}
|
||||||
|
|
||||||
if (options.context) {
|
function getPluginHtml(plugin, options, installedPlugins) {
|
||||||
href += '&context=' + options.context;
|
let html = '';
|
||||||
}
|
let href = plugin.externalUrl ? plugin.externalUrl : 'addplugin.html?name=' + encodeURIComponent(plugin.name) + '&guid=' + plugin.guid;
|
||||||
|
|
||||||
var target = plugin.externalUrl ? ' target="_blank"' : '';
|
if (options.context) {
|
||||||
html += "<div class='card backdropCard'>";
|
href += '&context=' + options.context;
|
||||||
html += '<div class="cardBox visualCardBox">';
|
|
||||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
|
||||||
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
|
||||||
html += '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + href + '"' + target + '>';
|
|
||||||
html += '<span class="cardImageIcon material-icons folder"></span>';
|
|
||||||
html += '</a>';
|
|
||||||
html += '</div>';
|
|
||||||
html += '<div class="cardFooter">';
|
|
||||||
html += "<div class='cardText'>";
|
|
||||||
html += plugin.name;
|
|
||||||
html += '</div>';
|
|
||||||
var installedPlugin = installedPlugins.filter(function (ip) {
|
|
||||||
return ip.Id == plugin.guid;
|
|
||||||
})[0];
|
|
||||||
html += "<div class='cardText cardText-secondary'>";
|
|
||||||
html += installedPlugin ? globalize.translate('LabelVersionInstalled', installedPlugin.Version) : ' ';
|
|
||||||
html += '</div>';
|
|
||||||
html += '</div>';
|
|
||||||
html += '</div>';
|
|
||||||
return html += '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTabs() {
|
const target = plugin.externalUrl ? ' target="_blank"' : '';
|
||||||
return [{
|
html += "<div class='card backdropCard'>";
|
||||||
href: 'installedplugins.html',
|
html += '<div class="cardBox visualCardBox">';
|
||||||
name: globalize.translate('TabMyPlugins')
|
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||||
}, {
|
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||||
href: 'availableplugins.html',
|
html += '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + href + '"' + target + '>';
|
||||||
name: globalize.translate('TabCatalog')
|
html += '<span class="cardImageIcon material-icons folder"></span>';
|
||||||
}, {
|
html += '</a>';
|
||||||
href: 'repositories.html',
|
html += '</div>';
|
||||||
name: globalize.translate('TabRepositories')
|
html += '<div class="cardFooter">';
|
||||||
}];
|
html += "<div class='cardText'>";
|
||||||
}
|
html += plugin.name;
|
||||||
|
html += '</div>';
|
||||||
|
const installedPlugin = installedPlugins.filter(function (ip) {
|
||||||
|
return ip.Id == plugin.guid;
|
||||||
|
})[0];
|
||||||
|
html += "<div class='cardText cardText-secondary'>";
|
||||||
|
html += installedPlugin ? globalize.translate('LabelVersionInstalled', installedPlugin.Version) : ' ';
|
||||||
|
html += '</div>';
|
||||||
|
html += '</div>';
|
||||||
|
html += '</div>';
|
||||||
|
return html += '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
window.PluginCatalog = {
|
function getTabs() {
|
||||||
renderCatalog: populateList
|
return [{
|
||||||
};
|
href: 'installedplugins.html',
|
||||||
|
name: globalize.translate('TabMyPlugins')
|
||||||
|
}, {
|
||||||
|
href: 'availableplugins.html',
|
||||||
|
name: globalize.translate('TabCatalog')
|
||||||
|
}, {
|
||||||
|
href: 'repositories.html',
|
||||||
|
name: globalize.translate('TabRepositories')
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view) {
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
libraryMenu.setTabs('plugins', 1, getTabs);
|
libraryMenu.setTabs('plugins', 1, getTabs);
|
||||||
reloadList(this);
|
reloadList(this);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
|
|
@ -1,192 +1,193 @@
|
||||||
define(['loading', 'libraryMenu', 'dom', 'globalize', 'cardStyle', 'emby-button'], function (loading, libraryMenu, dom, globalize) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import dom from 'dom';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'cardStyle';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
loading = loading.default || loading;
|
function deletePlugin(page, uniqueid, name) {
|
||||||
|
const msg = globalize.translate('UninstallPluginConfirmation', name);
|
||||||
|
|
||||||
function deletePlugin(page, uniqueid, name) {
|
import('confirm').then(({default: confirm}) => {
|
||||||
var msg = globalize.translate('UninstallPluginConfirmation', name);
|
confirm.default({
|
||||||
|
title: globalize.translate('HeaderUninstallPlugin'),
|
||||||
require(['confirm'], function (confirm) {
|
text: msg,
|
||||||
confirm.default({
|
primary: 'delete',
|
||||||
title: globalize.translate('HeaderUninstallPlugin'),
|
confirmText: globalize.translate('HeaderUninstallPlugin')
|
||||||
text: msg,
|
}).then(function () {
|
||||||
primary: 'delete',
|
loading.show();
|
||||||
confirmText: globalize.translate('HeaderUninstallPlugin')
|
ApiClient.uninstallPlugin(uniqueid).then(function () {
|
||||||
}).then(function () {
|
reloadList(page);
|
||||||
loading.show();
|
|
||||||
ApiClient.uninstallPlugin(uniqueid).then(function () {
|
|
||||||
reloadList(page);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function showNoConfigurationMessage() {
|
function showNoConfigurationMessage() {
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: globalize.translate('MessageNoPluginConfiguration')
|
message: globalize.translate('MessageNoPluginConfiguration')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function showConnectMessage() {
|
function showConnectMessage() {
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: globalize.translate('MessagePluginConfigurationRequiresLocalAccess')
|
message: globalize.translate('MessagePluginConfigurationRequiresLocalAccess')
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPluginCardHtml(plugin, pluginConfigurationPages) {
|
function getPluginCardHtml(plugin, pluginConfigurationPages) {
|
||||||
var configPage = pluginConfigurationPages.filter(function (pluginConfigurationPage) {
|
const configPage = pluginConfigurationPages.filter(function (pluginConfigurationPage) {
|
||||||
return pluginConfigurationPage.PluginId == plugin.Id;
|
return pluginConfigurationPage.PluginId == plugin.Id;
|
||||||
})[0];
|
})[0];
|
||||||
var configPageUrl = configPage ? Dashboard.getConfigurationPageUrl(configPage.Name) : null;
|
const configPageUrl = configPage ? Dashboard.getConfigurationPageUrl(configPage.Name) : null;
|
||||||
var html = '';
|
let html = '';
|
||||||
html += "<div data-id='" + plugin.Id + "' data-name='" + plugin.Name + "' data-removable='" + plugin.CanUninstall + "' class='card backdropCard'>";
|
html += "<div data-id='" + plugin.Id + "' data-name='" + plugin.Name + "' data-removable='" + plugin.CanUninstall + "' class='card backdropCard'>";
|
||||||
html += '<div class="cardBox visualCardBox">';
|
html += '<div class="cardBox visualCardBox">';
|
||||||
html += '<div class="cardScalable">';
|
html += '<div class="cardScalable">';
|
||||||
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||||
html += configPageUrl ? '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + configPageUrl + '">' : '<div class="cardContent noConfigPluginCard noHoverEffect cardImageContainer emby-button">';
|
html += configPageUrl ? '<a class="cardContent cardImageContainer" is="emby-linkbutton" href="' + configPageUrl + '">' : '<div class="cardContent noConfigPluginCard noHoverEffect cardImageContainer emby-button">';
|
||||||
html += '<span class="cardImageIcon material-icons folder"></span>';
|
html += '<span class="cardImageIcon material-icons folder"></span>';
|
||||||
html += configPageUrl ? '</a>' : '</div>';
|
html += configPageUrl ? '</a>' : '</div>';
|
||||||
|
html += '</div>';
|
||||||
|
html += '<div class="cardFooter">';
|
||||||
|
|
||||||
|
if (configPage || plugin.CanUninstall) {
|
||||||
|
html += '<div style="text-align:right; float:right;padding-top:5px;">';
|
||||||
|
html += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><span class="material-icons more_vert"></span></button>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '<div class="cardFooter">';
|
}
|
||||||
|
|
||||||
if (configPage || plugin.CanUninstall) {
|
html += "<div class='cardText'>";
|
||||||
html += '<div style="text-align:right; float:right;padding-top:5px;">';
|
html += configPage && configPage.DisplayName ? configPage.DisplayName : plugin.Name;
|
||||||
html += '<button type="button" is="paper-icon-button-light" class="btnCardMenu autoSize"><span class="material-icons more_vert"></span></button>';
|
html += '</div>';
|
||||||
html += '</div>';
|
html += "<div class='cardText cardText-secondary'>";
|
||||||
|
html += plugin.Version;
|
||||||
|
html += '</div>';
|
||||||
|
html += '</div>';
|
||||||
|
html += '</div>';
|
||||||
|
html += '</div>';
|
||||||
|
return html;
|
||||||
|
}
|
||||||
|
|
||||||
|
function renderPlugins(page, plugins) {
|
||||||
|
ApiClient.getJSON(ApiClient.getUrl('web/configurationpages') + '?pageType=PluginConfiguration').then(function (configPages) {
|
||||||
|
populateList(page, plugins, configPages);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function populateList(page, plugins, pluginConfigurationPages) {
|
||||||
|
plugins = plugins.sort(function (plugin1, plugin2) {
|
||||||
|
if (plugin1.Name > plugin2.Name) {
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
html += "<div class='cardText'>";
|
return -1;
|
||||||
html += configPage && configPage.DisplayName ? configPage.DisplayName : plugin.Name;
|
|
||||||
html += '</div>';
|
|
||||||
html += "<div class='cardText cardText-secondary'>";
|
|
||||||
html += plugin.Version;
|
|
||||||
html += '</div>';
|
|
||||||
html += '</div>';
|
|
||||||
html += '</div>';
|
|
||||||
html += '</div>';
|
|
||||||
return html;
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderPlugins(page, plugins) {
|
|
||||||
ApiClient.getJSON(ApiClient.getUrl('web/configurationpages') + '?pageType=PluginConfiguration').then(function (configPages) {
|
|
||||||
populateList(page, plugins, configPages);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function populateList(page, plugins, pluginConfigurationPages) {
|
|
||||||
plugins = plugins.sort(function (plugin1, plugin2) {
|
|
||||||
if (plugin1.Name > plugin2.Name) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return -1;
|
|
||||||
});
|
|
||||||
|
|
||||||
var html = plugins.map(function (p) {
|
|
||||||
return getPluginCardHtml(p, pluginConfigurationPages);
|
|
||||||
}).join('');
|
|
||||||
|
|
||||||
var installedPluginsElement = page.querySelector('.installedPlugins');
|
|
||||||
installedPluginsElement.removeEventListener('click', onInstalledPluginsClick);
|
|
||||||
installedPluginsElement.addEventListener('click', onInstalledPluginsClick);
|
|
||||||
|
|
||||||
if (plugins.length) {
|
|
||||||
installedPluginsElement.classList.add('itemsContainer');
|
|
||||||
installedPluginsElement.classList.add('vertical-wrap');
|
|
||||||
} else {
|
|
||||||
html += '<div class="centerMessage">';
|
|
||||||
html += '<h1>' + globalize.translate('MessageNoPluginsInstalled') + '</h1>';
|
|
||||||
html += '<p><a is="emby-linkbutton" class="button-link" href="availableplugins.html">';
|
|
||||||
html += globalize.translate('MessageBrowsePluginCatalog');
|
|
||||||
html += '</a></p>';
|
|
||||||
html += '</div>';
|
|
||||||
}
|
|
||||||
|
|
||||||
installedPluginsElement.innerHTML = html;
|
|
||||||
loading.hide();
|
|
||||||
}
|
|
||||||
|
|
||||||
function showPluginMenu(page, elem) {
|
|
||||||
var card = dom.parentWithClass(elem, 'card');
|
|
||||||
var id = card.getAttribute('data-id');
|
|
||||||
var name = card.getAttribute('data-name');
|
|
||||||
var removable = card.getAttribute('data-removable');
|
|
||||||
var configHref = card.querySelector('.cardContent').getAttribute('href');
|
|
||||||
var menuItems = [];
|
|
||||||
|
|
||||||
if (configHref) {
|
|
||||||
menuItems.push({
|
|
||||||
name: globalize.translate('ButtonSettings'),
|
|
||||||
id: 'open',
|
|
||||||
icon: 'mode_edit'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (removable === 'true') {
|
|
||||||
menuItems.push({
|
|
||||||
name: globalize.translate('ButtonUninstall'),
|
|
||||||
id: 'delete',
|
|
||||||
icon: 'delete'
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
require(['actionsheet'], function (actionsheet) {
|
|
||||||
actionsheet.show({
|
|
||||||
items: menuItems,
|
|
||||||
positionTo: elem,
|
|
||||||
callback: function (resultId) {
|
|
||||||
switch (resultId) {
|
|
||||||
case 'open':
|
|
||||||
Dashboard.navigate(configHref);
|
|
||||||
break;
|
|
||||||
case 'delete':
|
|
||||||
deletePlugin(page, id, name);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function reloadList(page) {
|
|
||||||
loading.show();
|
|
||||||
ApiClient.getInstalledPlugins().then(function (plugins) {
|
|
||||||
renderPlugins(page, plugins);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTabs() {
|
|
||||||
return [{
|
|
||||||
href: 'installedplugins.html',
|
|
||||||
name: globalize.translate('TabMyPlugins')
|
|
||||||
}, {
|
|
||||||
href: 'availableplugins.html',
|
|
||||||
name: globalize.translate('TabCatalog')
|
|
||||||
}, {
|
|
||||||
href: 'repositories.html',
|
|
||||||
name: globalize.translate('TabRepositories')
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
|
|
||||||
function onInstalledPluginsClick(e) {
|
|
||||||
if (dom.parentWithClass(e.target, 'noConfigPluginCard')) {
|
|
||||||
showNoConfigurationMessage();
|
|
||||||
} else if (dom.parentWithClass(e.target, 'connectModePluginCard')) {
|
|
||||||
showConnectMessage();
|
|
||||||
} else {
|
|
||||||
var btnCardMenu = dom.parentWithClass(e.target, 'btnCardMenu');
|
|
||||||
if (btnCardMenu) {
|
|
||||||
showPluginMenu(dom.parentWithClass(btnCardMenu, 'page'), btnCardMenu);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pageIdOn('pageshow', 'pluginsPage', function () {
|
|
||||||
libraryMenu.setTabs('plugins', 0, getTabs);
|
|
||||||
reloadList(this);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
window.PluginsPage = {
|
let html = plugins.map(function (p) {
|
||||||
renderPlugins: renderPlugins
|
return getPluginCardHtml(p, pluginConfigurationPages);
|
||||||
};
|
}).join('');
|
||||||
|
|
||||||
|
const installedPluginsElement = page.querySelector('.installedPlugins');
|
||||||
|
installedPluginsElement.removeEventListener('click', onInstalledPluginsClick);
|
||||||
|
installedPluginsElement.addEventListener('click', onInstalledPluginsClick);
|
||||||
|
|
||||||
|
if (plugins.length) {
|
||||||
|
installedPluginsElement.classList.add('itemsContainer');
|
||||||
|
installedPluginsElement.classList.add('vertical-wrap');
|
||||||
|
} else {
|
||||||
|
html += '<div class="centerMessage">';
|
||||||
|
html += '<h1>' + globalize.translate('MessageNoPluginsInstalled') + '</h1>';
|
||||||
|
html += '<p><a is="emby-linkbutton" class="button-link" href="availableplugins.html">';
|
||||||
|
html += globalize.translate('MessageBrowsePluginCatalog');
|
||||||
|
html += '</a></p>';
|
||||||
|
html += '</div>';
|
||||||
|
}
|
||||||
|
|
||||||
|
installedPluginsElement.innerHTML = html;
|
||||||
|
loading.hide();
|
||||||
|
}
|
||||||
|
|
||||||
|
function showPluginMenu(page, elem) {
|
||||||
|
const card = dom.parentWithClass(elem, 'card');
|
||||||
|
const id = card.getAttribute('data-id');
|
||||||
|
const name = card.getAttribute('data-name');
|
||||||
|
const removable = card.getAttribute('data-removable');
|
||||||
|
const configHref = card.querySelector('.cardContent').getAttribute('href');
|
||||||
|
const menuItems = [];
|
||||||
|
|
||||||
|
if (configHref) {
|
||||||
|
menuItems.push({
|
||||||
|
name: globalize.translate('ButtonSettings'),
|
||||||
|
id: 'open',
|
||||||
|
icon: 'mode_edit'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
if (removable === 'true') {
|
||||||
|
menuItems.push({
|
||||||
|
name: globalize.translate('ButtonUninstall'),
|
||||||
|
id: 'delete',
|
||||||
|
icon: 'delete'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
|
actionsheet.show({
|
||||||
|
items: menuItems,
|
||||||
|
positionTo: elem,
|
||||||
|
callback: function (resultId) {
|
||||||
|
switch (resultId) {
|
||||||
|
case 'open':
|
||||||
|
Dashboard.navigate(configHref);
|
||||||
|
break;
|
||||||
|
case 'delete':
|
||||||
|
deletePlugin(page, id, name);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function reloadList(page) {
|
||||||
|
loading.show();
|
||||||
|
ApiClient.getInstalledPlugins().then(function (plugins) {
|
||||||
|
renderPlugins(page, plugins);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function getTabs() {
|
||||||
|
return [{
|
||||||
|
href: 'installedplugins.html',
|
||||||
|
name: globalize.translate('TabMyPlugins')
|
||||||
|
}, {
|
||||||
|
href: 'availableplugins.html',
|
||||||
|
name: globalize.translate('TabCatalog')
|
||||||
|
}, {
|
||||||
|
href: 'repositories.html',
|
||||||
|
name: globalize.translate('TabRepositories')
|
||||||
|
}];
|
||||||
|
}
|
||||||
|
|
||||||
|
function onInstalledPluginsClick(e) {
|
||||||
|
if (dom.parentWithClass(e.target, 'noConfigPluginCard')) {
|
||||||
|
showNoConfigurationMessage();
|
||||||
|
} else if (dom.parentWithClass(e.target, 'connectModePluginCard')) {
|
||||||
|
showConnectMessage();
|
||||||
|
} else {
|
||||||
|
const btnCardMenu = dom.parentWithClass(e.target, 'btnCardMenu');
|
||||||
|
if (btnCardMenu) {
|
||||||
|
showPluginMenu(dom.parentWithClass(btnCardMenu, 'page'), btnCardMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pageIdOn('pageshow', 'pluginsPage', function () {
|
||||||
|
libraryMenu.setTabs('plugins', 0, getTabs);
|
||||||
|
reloadList(this);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
window.PluginsPage = {
|
||||||
|
renderPlugins: renderPlugins
|
||||||
|
};
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
<div class="content-primary">
|
<div class="content-primary">
|
||||||
<div class="sectionTitleContainer flex align-items-center">
|
<div class="sectionTitleContainer flex align-items-center">
|
||||||
<h2 class="sectionTitle">${TabRepositories}</h2>
|
<h2 class="sectionTitle">${TabRepositories}</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnNewRepository submit" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnNewRepository submit" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add" aria-hidden="true"></span>
|
<span class="material-icons add" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -127,7 +127,7 @@ export default function(view, params) {
|
||||||
html += `<input is="emby-input" id="txtRepositoryUrl" label="${globalize.translate('LabelRepositoryUrl')}" type="url" required />`;
|
html += `<input is="emby-input" id="txtRepositoryUrl" label="${globalize.translate('LabelRepositoryUrl')}" type="url" required />`;
|
||||||
html += `<div class="fieldDescription">${globalize.translate('LabelRepositoryUrlHelp')}</div>`;
|
html += `<div class="fieldDescription">${globalize.translate('LabelRepositoryUrlHelp')}</div>`;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += `<button is="emby-button" type="submit" class="raised button-submit block"><span>${globalize.translate('ButtonSave')}</span></button>`;
|
html += `<button is="emby-button" type="submit" class="raised button-submit block"><span>${globalize.translate('Save')}</span></button>`;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</form>';
|
html += '</form>';
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block" data-icon="check">
|
<button is="emby-button" type="submit" class="raised button-submit block" data-icon="check">
|
||||||
<span>${ButtonAdd}</span>
|
<span>${Add}</span>
|
||||||
</button>
|
</button>
|
||||||
<button is="emby-button" type="button" class="raised button-cancel block" data-icon="delete" onclick="$(this).parents('.dialog').addClass('hide');">
|
<button is="emby-button" type="button" class="raised button-cancel block" data-icon="delete" onclick="$(this).parents('.dialog').addClass('hide');">
|
||||||
<span>${ButtonCancel}</span>
|
<span>${ButtonCancel}</span>
|
|
@ -33,7 +33,7 @@ import 'emby-select';
|
||||||
const ScheduledTaskPage = {
|
const ScheduledTaskPage = {
|
||||||
refreshScheduledTask: function (view) {
|
refreshScheduledTask: function (view) {
|
||||||
loading.show();
|
loading.show();
|
||||||
let id = getParameterByName('id');
|
const id = getParameterByName('id');
|
||||||
ApiClient.getScheduledTask(id).then(function (task) {
|
ApiClient.getScheduledTask(id).then(function (task) {
|
||||||
ScheduledTaskPage.loadScheduledTask(view, task);
|
ScheduledTaskPage.loadScheduledTask(view, task);
|
||||||
});
|
});
|
||||||
|
@ -143,7 +143,7 @@ import 'emby-select';
|
||||||
},
|
},
|
||||||
deleteTrigger: function (view, index) {
|
deleteTrigger: function (view, index) {
|
||||||
loading.show();
|
loading.show();
|
||||||
let id = getParameterByName('id');
|
const id = getParameterByName('id');
|
||||||
ApiClient.getScheduledTask(id).then(function (task) {
|
ApiClient.getScheduledTask(id).then(function (task) {
|
||||||
task.Triggers.remove(index);
|
task.Triggers.remove(index);
|
||||||
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
||||||
|
@ -211,7 +211,7 @@ import 'emby-select';
|
||||||
export default function (view, params) {
|
export default function (view, params) {
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
loading.show();
|
loading.show();
|
||||||
let id = getParameterByName('id');
|
const id = getParameterByName('id');
|
||||||
ApiClient.getScheduledTask(id).then(function (task) {
|
ApiClient.getScheduledTask(id).then(function (task) {
|
||||||
task.Triggers.push(ScheduledTaskPage.getTriggerToAdd(view));
|
task.Triggers.push(ScheduledTaskPage.getTriggerToAdd(view));
|
||||||
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
||||||
|
|
|
@ -103,7 +103,7 @@ import 'emby-button';
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTaskButtonIcon(button, icon) {
|
function setTaskButtonIcon(button, icon) {
|
||||||
let inner = button.querySelector('.material-icons');
|
const inner = button.querySelector('.material-icons');
|
||||||
inner.classList.remove('stop', 'play_arrow');
|
inner.classList.remove('stop', 'play_arrow');
|
||||||
inner.classList.add(icon);
|
inner.classList.add(icon);
|
||||||
}
|
}
|
||||||
|
@ -160,7 +160,7 @@ import 'emby-button';
|
||||||
|
|
||||||
$('.divScheduledTasks', view).on('click', '.btnStartTask', function() {
|
$('.divScheduledTasks', view).on('click', '.btnStartTask', function() {
|
||||||
const button = this;
|
const button = this;
|
||||||
let id = button.getAttribute('data-taskid');
|
const id = button.getAttribute('data-taskid');
|
||||||
ApiClient.startScheduledTask(id).then(function() {
|
ApiClient.startScheduledTask(id).then(function() {
|
||||||
updateTaskButton(button, 'Running');
|
updateTaskButton(button, 'Running');
|
||||||
reloadList(view);
|
reloadList(view);
|
||||||
|
@ -169,7 +169,7 @@ import 'emby-button';
|
||||||
|
|
||||||
$('.divScheduledTasks', view).on('click', '.btnStopTask', function() {
|
$('.divScheduledTasks', view).on('click', '.btnStopTask', function() {
|
||||||
const button = this;
|
const button = this;
|
||||||
let id = button.getAttribute('data-taskid');
|
const id = button.getAttribute('data-taskid');
|
||||||
ApiClient.stopScheduledTask(id).then(function() {
|
ApiClient.stopScheduledTask(id).then(function() {
|
||||||
updateTaskButton(button, '');
|
updateTaskButton(button, '');
|
||||||
reloadList(view);
|
reloadList(view);
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
|
@ -192,7 +192,7 @@
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button is="emby-button" type="button" class="raised button-cancel block btnCancel" onclick="history.back();">
|
<button is="emby-button" type="button" class="raised button-cancel block btnCancel" onclick="history.back();">
|
|
@ -59,7 +59,7 @@
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -49,7 +49,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button is="emby-button" type="button" class="raised button-cancel block btnCancel" onclick="history.back();">
|
<button is="emby-button" type="button" class="raised button-cancel block btnCancel" onclick="history.back();">
|
|
@ -30,7 +30,7 @@
|
||||||
<div class="verticalSection" style="margin-bottom:2em;">
|
<div class="verticalSection" style="margin-bottom:2em;">
|
||||||
<div class="detailSectionHeader sectionTitleContainer">
|
<div class="detailSectionHeader sectionTitleContainer">
|
||||||
<h2 class="sectionTitle">${LabelBlockContentWithTags}</h2>
|
<h2 class="sectionTitle">${LabelBlockContentWithTags}</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnAddBlockedTag submit" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnAddBlockedTag submit" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add"></span>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
<div class="accessScheduleSection verticalSection" style="margin-bottom:2em;">
|
<div class="accessScheduleSection verticalSection" style="margin-bottom:2em;">
|
||||||
<div class="sectionTitleContainer">
|
<div class="sectionTitleContainer">
|
||||||
<h2 class="sectionTitle">${HeaderAccessSchedule}</h2>
|
<h2 class="sectionTitle">${HeaderAccessSchedule}</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnAddSchedule submit" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnAddSchedule submit" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add"></span>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
|
@ -29,7 +29,7 @@
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block"><span>${ButtonSave}</span></button>
|
<button is="emby-button" type="submit" class="raised button-submit block"><span>${Save}</span></button>
|
||||||
<button is="emby-button" type="button" id="btnResetPassword" class="raised button-cancel block hide">
|
<button is="emby-button" type="button" id="btnResetPassword" class="raised button-cancel block hide">
|
||||||
<span>${ButtonResetPassword}</span>
|
<span>${ButtonResetPassword}</span>
|
||||||
</button>
|
</button>
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
<button is="emby-button" type="button" id="btnResetEasyPassword" class="raised button-cancel block hide">
|
<button is="emby-button" type="button" id="btnResetEasyPassword" class="raised button-cancel block hide">
|
||||||
<span>${ButtonResetEasyPassword}</span>
|
<span>${ButtonResetEasyPassword}</span>
|
|
@ -1,7 +1,33 @@
|
||||||
define(['tabbedView', 'globalize', 'require', 'emby-tabs', 'emby-button', 'emby-scroller'], function (TabbedView, globalize, require) {
|
import TabbedView from 'tabbedView';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
import 'emby-tabs';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'emby-scroller';
|
||||||
|
|
||||||
function getTabs() {
|
class HomeView extends TabbedView {
|
||||||
|
constructor(view, params) {
|
||||||
|
super(view, params);
|
||||||
|
}
|
||||||
|
|
||||||
|
setTitle() {
|
||||||
|
Emby.Page.setTitle(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
onPause() {
|
||||||
|
super.onPause(this);
|
||||||
|
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
||||||
|
}
|
||||||
|
|
||||||
|
onResume(options) {
|
||||||
|
super.onResume(this, options);
|
||||||
|
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
||||||
|
}
|
||||||
|
|
||||||
|
getDefaultTabIndex() {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
getTabs() {
|
||||||
return [{
|
return [{
|
||||||
name: globalize.translate('Home')
|
name: globalize.translate('Home')
|
||||||
}, {
|
}, {
|
||||||
|
@ -9,67 +35,34 @@ define(['tabbedView', 'globalize', 'require', 'emby-tabs', 'emby-button', 'emby-
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultTabIndex() {
|
getTabController(index) {
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getRequirePromise(deps) {
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
require(deps, resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getTabController(index) {
|
|
||||||
if (index == null) {
|
if (index == null) {
|
||||||
throw new Error('index cannot be null');
|
throw new Error('index cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
var depends = [];
|
let depends = '';
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
depends.push('controllers/hometab');
|
depends = 'controllers/hometab';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
depends.push('controllers/favorites');
|
depends = 'controllers/favorites';
|
||||||
}
|
}
|
||||||
|
|
||||||
var instance = this;
|
const instance = this;
|
||||||
return getRequirePromise(depends).then(function (controllerFactory) {
|
return import(depends).then(({ default: controllerFactory }) => {
|
||||||
var controller = instance.tabControllers[index];
|
let controller = instance.tabControllers[index];
|
||||||
|
|
||||||
if (!controller) {
|
if (!controller) {
|
||||||
controller = new controllerFactory.default(instance.view.querySelector(".tabContent[data-index='" + index + "']"), instance.params);
|
controller = new controllerFactory(instance.view.querySelector(".tabContent[data-index='" + index + "']"), instance.params);
|
||||||
instance.tabControllers[index] = controller;
|
instance.tabControllers[index] = controller;
|
||||||
}
|
}
|
||||||
|
|
||||||
return controller;
|
return controller;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function HomeView(view, params) {
|
export default HomeView;
|
||||||
TabbedView.call(this, view, params);
|
|
||||||
}
|
|
||||||
|
|
||||||
Object.assign(HomeView.prototype, TabbedView.prototype);
|
|
||||||
HomeView.prototype.getTabs = getTabs;
|
|
||||||
HomeView.prototype.getDefaultTabIndex = getDefaultTabIndex;
|
|
||||||
HomeView.prototype.getTabController = getTabController;
|
|
||||||
|
|
||||||
HomeView.prototype.setTitle = function () {
|
|
||||||
Emby.Page.setTitle(null);
|
|
||||||
};
|
|
||||||
|
|
||||||
HomeView.prototype.onPause = function () {
|
|
||||||
TabbedView.prototype.onPause.call(this);
|
|
||||||
document.querySelector('.skinHeader').classList.remove('noHomeButtonHeader');
|
|
||||||
};
|
|
||||||
|
|
||||||
HomeView.prototype.onResume = function (options) {
|
|
||||||
TabbedView.prototype.onResume.call(this, options);
|
|
||||||
document.querySelector('.skinHeader').classList.add('noHomeButtonHeader');
|
|
||||||
};
|
|
||||||
|
|
||||||
return HomeView;
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import appHost from 'apphost';
|
||||||
import loading from 'loading';
|
import loading from 'loading';
|
||||||
import appRouter from 'appRouter';
|
import appRouter from 'appRouter';
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
|
@ -373,7 +374,7 @@ import 'emby-select';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getArtistLinksHtml(artists, serverId, context) {
|
function getArtistLinksHtml(artists, serverId, context) {
|
||||||
let html = [];
|
const html = [];
|
||||||
|
|
||||||
for (const artist of artists) {
|
for (const artist of artists) {
|
||||||
const href = appRouter.getRouteUrl(artist, {
|
const href = appRouter.getRouteUrl(artist, {
|
||||||
|
@ -657,7 +658,7 @@ import 'emby-select';
|
||||||
setPeopleHeader(page, item);
|
setPeopleHeader(page, item);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
if (item.Type === 'Book') {
|
if (item.Type === 'Book' && item.CanDownload && appHost.supports('filedownload')) {
|
||||||
hideAll(page, 'btnDownload', true);
|
hideAll(page, 'btnDownload', true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,21 @@
|
||||||
define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager', 'cardBuilder', 'loading', 'connectionManager', 'alphaNumericShortcuts', 'scroller', 'playbackManager', 'alphaPicker', 'emby-itemscontainer', 'emby-scroller'], function (globalize, listView, layoutManager, userSettings, focusManager, cardBuilder, loading, connectionManager, AlphaNumericShortcuts, scroller, playbackManager, AlphaPicker) {
|
import globalize from 'globalize';
|
||||||
'use strict';
|
import listView from 'listView';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import focusManager from 'focusManager';
|
||||||
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import loading from 'loading';
|
||||||
|
import connectionManager from 'connectionManager';
|
||||||
|
import AlphaNumericShortcuts from 'alphaNumericShortcuts';
|
||||||
|
import playbackManager from 'playbackManager';
|
||||||
|
import AlphaPicker from 'alphaPicker';
|
||||||
|
import 'emby-itemscontainer';
|
||||||
|
import 'emby-scroller';
|
||||||
|
|
||||||
playbackManager = playbackManager.default || playbackManager;
|
/* eslint-disable indent */
|
||||||
loading = loading.default || loading;
|
|
||||||
focusManager = focusManager.default || focusManager;
|
|
||||||
|
|
||||||
function getInitialLiveTvQuery(instance, params) {
|
function getInitialLiveTvQuery(instance, params) {
|
||||||
var query = {
|
const query = {
|
||||||
UserId: connectionManager.getApiClient(params.serverId).getCurrentUserId(),
|
UserId: connectionManager.getApiClient(params.serverId).getCurrentUserId(),
|
||||||
StartIndex: 0,
|
StartIndex: 0,
|
||||||
Fields: 'ChannelInfo,PrimaryImageAspectRatio',
|
Fields: 'ChannelInfo,PrimaryImageAspectRatio',
|
||||||
|
@ -63,7 +72,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function modifyQueryWithFilters(instance, query) {
|
function modifyQueryWithFilters(instance, query) {
|
||||||
var sortValues = instance.getSortValues();
|
const sortValues = instance.getSortValues();
|
||||||
|
|
||||||
if (!query.SortBy) {
|
if (!query.SortBy) {
|
||||||
query.SortBy = sortValues.sortBy;
|
query.SortBy = sortValues.sortBy;
|
||||||
|
@ -72,9 +81,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
|
|
||||||
query.Fields = query.Fields ? query.Fields + ',PrimaryImageAspectRatio' : 'PrimaryImageAspectRatio';
|
query.Fields = query.Fields ? query.Fields + ',PrimaryImageAspectRatio' : 'PrimaryImageAspectRatio';
|
||||||
query.ImageTypeLimit = 1;
|
query.ImageTypeLimit = 1;
|
||||||
var hasFilters;
|
let hasFilters;
|
||||||
var queryFilters = [];
|
const queryFilters = [];
|
||||||
var filters = instance.getFilters();
|
const filters = instance.getFilters();
|
||||||
|
|
||||||
if (filters.IsPlayed) {
|
if (filters.IsPlayed) {
|
||||||
queryFilters.push('IsPlayed');
|
queryFilters.push('IsPlayed');
|
||||||
|
@ -168,21 +177,21 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateSortText(instance) {
|
function updateSortText(instance) {
|
||||||
var btnSortText = instance.btnSortText;
|
const btnSortText = instance.btnSortText;
|
||||||
|
|
||||||
if (btnSortText) {
|
if (btnSortText) {
|
||||||
var options = instance.getSortMenuOptions();
|
const options = instance.getSortMenuOptions();
|
||||||
var values = instance.getSortValues();
|
const values = instance.getSortValues();
|
||||||
var sortBy = values.sortBy;
|
const sortBy = values.sortBy;
|
||||||
|
|
||||||
for (var i = 0, length = options.length; i < length; i++) {
|
for (const option of options) {
|
||||||
if (sortBy === options[i].value) {
|
if (sortBy === option.value) {
|
||||||
btnSortText.innerHTML = globalize.translate('SortByValue', options[i].name);
|
btnSortText.innerHTML = globalize.translate('SortByValue', option.name);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var btnSortIcon = instance.btnSortIcon;
|
const btnSortIcon = instance.btnSortIcon;
|
||||||
|
|
||||||
if (btnSortIcon) {
|
if (btnSortIcon) {
|
||||||
setSortButtonIcon(btnSortIcon, values.sortOrder === 'Descending' ? 'arrow_downward' : 'arrow_upward');
|
setSortButtonIcon(btnSortIcon, values.sortOrder === 'Descending' ? 'arrow_downward' : 'arrow_upward');
|
||||||
|
@ -202,10 +211,10 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
|
|
||||||
function updateAlphaPickerState(instance, numItems) {
|
function updateAlphaPickerState(instance, numItems) {
|
||||||
if (instance.alphaPicker) {
|
if (instance.alphaPicker) {
|
||||||
var alphaPicker = instance.alphaPickerElement;
|
const alphaPicker = instance.alphaPickerElement;
|
||||||
|
|
||||||
if (alphaPicker) {
|
if (alphaPicker) {
|
||||||
var values = instance.getSortValues();
|
const values = instance.getSortValues();
|
||||||
|
|
||||||
if (numItems == null) {
|
if (numItems == null) {
|
||||||
numItems = 100;
|
numItems = 100;
|
||||||
|
@ -223,7 +232,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItems(instance, params, item, sortBy, startIndex, limit) {
|
function getItems(instance, params, item, sortBy, startIndex, limit) {
|
||||||
var apiClient = connectionManager.getApiClient(params.serverId);
|
const apiClient = connectionManager.getApiClient(params.serverId);
|
||||||
|
|
||||||
instance.queryRecursive = false;
|
instance.queryRecursive = false;
|
||||||
if (params.type === 'Recordings') {
|
if (params.type === 'Recordings') {
|
||||||
|
@ -252,7 +261,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
|
|
||||||
if (!item) {
|
if (!item) {
|
||||||
instance.queryRecursive = true;
|
instance.queryRecursive = true;
|
||||||
var method = 'getItems';
|
let method = 'getItems';
|
||||||
|
|
||||||
if (params.type === 'MusicArtist') {
|
if (params.type === 'MusicArtist') {
|
||||||
method = 'getArtists';
|
method = 'getArtists';
|
||||||
|
@ -275,7 +284,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
|
|
||||||
if (item.Type === 'Genre' || item.Type === 'MusicGenre' || item.Type === 'Studio' || item.Type === 'Person') {
|
if (item.Type === 'Genre' || item.Type === 'MusicGenre' || item.Type === 'Studio' || item.Type === 'Person') {
|
||||||
instance.queryRecursive = true;
|
instance.queryRecursive = true;
|
||||||
var query = {
|
const query = {
|
||||||
StartIndex: startIndex,
|
StartIndex: startIndex,
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Fields: 'PrimaryImageAspectRatio,SortName',
|
Fields: 'PrimaryImageAspectRatio,SortName',
|
||||||
|
@ -324,8 +333,8 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
return Promise.resolve(null);
|
return Promise.resolve(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(params.serverId);
|
const apiClient = connectionManager.getApiClient(params.serverId);
|
||||||
var itemId = params.genreId || params.musicGenreId || params.studioId || params.personId || params.parentId;
|
const itemId = params.genreId || params.musicGenreId || params.studioId || params.personId || params.parentId;
|
||||||
|
|
||||||
if (itemId) {
|
if (itemId) {
|
||||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId);
|
return apiClient.getItem(apiClient.getCurrentUserId(), itemId);
|
||||||
|
@ -335,9 +344,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function showViewSettingsMenu() {
|
function showViewSettingsMenu() {
|
||||||
var instance = this;
|
const instance = this;
|
||||||
|
|
||||||
require(['viewSettings'], function (ViewSettings) {
|
import('viewSettings').then(({default: ViewSettings}) => {
|
||||||
new ViewSettings().show({
|
new ViewSettings().show({
|
||||||
settingsKey: instance.getSettingsKey(),
|
settingsKey: instance.getSettingsKey(),
|
||||||
settings: instance.getViewSettings(),
|
settings: instance.getViewSettings(),
|
||||||
|
@ -350,9 +359,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function showFilterMenu() {
|
function showFilterMenu() {
|
||||||
var instance = this;
|
const instance = this;
|
||||||
|
|
||||||
require(['filterMenu'], function (FilterMenu) {
|
import('filterMenu').then(({default: FilterMenu}) => {
|
||||||
new FilterMenu().show({
|
new FilterMenu().show({
|
||||||
settingsKey: instance.getSettingsKey(),
|
settingsKey: instance.getSettingsKey(),
|
||||||
settings: instance.getFilters(),
|
settings: instance.getFilters(),
|
||||||
|
@ -369,9 +378,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSortMenu() {
|
function showSortMenu() {
|
||||||
var instance = this;
|
const instance = this;
|
||||||
|
|
||||||
require(['sortMenu'], function (SortMenu) {
|
import('sortMenu').then(({default: SortMenu}) => {
|
||||||
new SortMenu().show({
|
new SortMenu().show({
|
||||||
settingsKey: instance.getSettingsKey(),
|
settingsKey: instance.getSettingsKey(),
|
||||||
settings: instance.getSortValues(),
|
settings: instance.getSortValues(),
|
||||||
|
@ -387,10 +396,10 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function onNewItemClick() {
|
function onNewItemClick() {
|
||||||
var instance = this;
|
const instance = this;
|
||||||
|
|
||||||
require(['playlistEditor'], function (playlistEditor) {
|
import('playlistEditor').then(({default: playlistEditor}) => {
|
||||||
new playlistEditor.showEditor({
|
new playlistEditor({
|
||||||
items: [],
|
items: [],
|
||||||
serverId: instance.params.serverId
|
serverId: instance.params.serverId
|
||||||
});
|
});
|
||||||
|
@ -398,22 +407,23 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideOrShowAll(elems, hide) {
|
function hideOrShowAll(elems, hide) {
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
for (const elem of elems) {
|
||||||
if (hide) {
|
if (hide) {
|
||||||
elems[i].classList.add('hide');
|
elem.classList.add('hide');
|
||||||
} else {
|
} else {
|
||||||
elems[i].classList.remove('hide');
|
elem.classList.remove('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function bindAll(elems, eventName, fn) {
|
function bindAll(elems, eventName, fn) {
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
for (const elem of elems) {
|
||||||
elems[i].addEventListener(eventName, fn);
|
elem.addEventListener(eventName, fn);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ItemsView(view, params) {
|
class ItemsView {
|
||||||
|
constructor(view, params) {
|
||||||
function fetchData() {
|
function fetchData() {
|
||||||
return getItems(self, params, self.currentItem).then(function (result) {
|
return getItems(self, params, self.currentItem).then(function (result) {
|
||||||
if (self.totalItemCount == null) {
|
if (self.totalItemCount == null) {
|
||||||
|
@ -426,7 +436,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItemsHtml(items) {
|
function getItemsHtml(items) {
|
||||||
var settings = self.getViewSettings();
|
const settings = self.getViewSettings();
|
||||||
|
|
||||||
if (settings.imageType === 'list') {
|
if (settings.imageType === 'list') {
|
||||||
return listView.getListViewHtml({
|
return listView.getListViewHtml({
|
||||||
|
@ -434,13 +444,13 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var shape;
|
let shape;
|
||||||
var preferThumb;
|
let preferThumb;
|
||||||
var preferDisc;
|
let preferDisc;
|
||||||
var preferLogo;
|
let preferLogo;
|
||||||
var defaultShape;
|
let defaultShape;
|
||||||
var item = self.currentItem;
|
const item = self.currentItem;
|
||||||
var lines = settings.showTitle ? 2 : 0;
|
let lines = settings.showTitle ? 2 : 0;
|
||||||
|
|
||||||
if (settings.imageType === 'banner') {
|
if (settings.imageType === 'banner') {
|
||||||
shape = 'banner';
|
shape = 'banner';
|
||||||
|
@ -464,7 +474,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
shape = 'autoVertical';
|
shape = 'autoVertical';
|
||||||
}
|
}
|
||||||
|
|
||||||
var posterOptions = {
|
let posterOptions = {
|
||||||
shape: shape,
|
shape: shape,
|
||||||
showTitle: settings.showTitle,
|
showTitle: settings.showTitle,
|
||||||
showYear: settings.showTitle,
|
showYear: settings.showTitle,
|
||||||
|
@ -497,19 +507,19 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
lines = 1;
|
lines = 1;
|
||||||
} else if (params.type === 'Programs') {
|
} else if (params.type === 'Programs') {
|
||||||
lines = settings.showTitle ? 1 : 0;
|
lines = settings.showTitle ? 1 : 0;
|
||||||
var showParentTitle = settings.showTitle && params.IsMovie !== 'true';
|
const showParentTitle = settings.showTitle && params.IsMovie !== 'true';
|
||||||
|
|
||||||
if (showParentTitle) {
|
if (showParentTitle) {
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
var showAirTime = settings.showTitle && params.type !== 'Recordings';
|
const showAirTime = settings.showTitle && params.type !== 'Recordings';
|
||||||
|
|
||||||
if (showAirTime) {
|
if (showAirTime) {
|
||||||
lines++;
|
lines++;
|
||||||
}
|
}
|
||||||
|
|
||||||
var showYear = settings.showTitle && params.IsMovie === 'true' && params.type === 'Recordings';
|
const showYear = settings.showTitle && params.IsMovie === 'true' && params.type === 'Recordings';
|
||||||
|
|
||||||
if (showYear) {
|
if (showYear) {
|
||||||
lines++;
|
lines++;
|
||||||
|
@ -542,13 +552,13 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
|
|
||||||
function initAlphaPicker() {
|
function initAlphaPicker() {
|
||||||
self.scroller = view.querySelector('.scrollFrameY');
|
self.scroller = view.querySelector('.scrollFrameY');
|
||||||
var alphaPickerElement = self.alphaPickerElement;
|
const alphaPickerElement = self.alphaPickerElement;
|
||||||
|
|
||||||
alphaPickerElement.classList.add('alphaPicker-fixed-right');
|
alphaPickerElement.classList.add('alphaPicker-fixed-right');
|
||||||
alphaPickerElement.classList.add('focuscontainer-right');
|
alphaPickerElement.classList.add('focuscontainer-right');
|
||||||
self.itemsContainer.parentNode.classList.add('padded-right-withalphapicker');
|
self.itemsContainer.parentNode.classList.add('padded-right-withalphapicker');
|
||||||
|
|
||||||
self.alphaPicker = new AlphaPicker.default({
|
self.alphaPicker = new AlphaPicker({
|
||||||
element: alphaPickerElement,
|
element: alphaPickerElement,
|
||||||
itemsContainer: layoutManager.tv ? self.itemsContainer : null,
|
itemsContainer: layoutManager.tv ? self.itemsContainer : null,
|
||||||
itemClass: 'card',
|
itemClass: 'card',
|
||||||
|
@ -653,7 +663,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function play() {
|
function play() {
|
||||||
var currentItem = self.currentItem;
|
const currentItem = self.currentItem;
|
||||||
|
|
||||||
if (currentItem && !self.hasFilters) {
|
if (currentItem && !self.hasFilters) {
|
||||||
playbackManager.play({
|
playbackManager.play({
|
||||||
|
@ -669,7 +679,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function queue() {
|
function queue() {
|
||||||
var currentItem = self.currentItem;
|
const currentItem = self.currentItem;
|
||||||
|
|
||||||
if (currentItem && !self.hasFilters) {
|
if (currentItem && !self.hasFilters) {
|
||||||
playbackManager.queue({
|
playbackManager.queue({
|
||||||
|
@ -685,7 +695,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
function shuffle() {
|
function shuffle() {
|
||||||
var currentItem = self.currentItem;
|
const currentItem = self.currentItem;
|
||||||
|
|
||||||
if (currentItem && !self.hasFilters) {
|
if (currentItem && !self.hasFilters) {
|
||||||
playbackManager.shuffle(currentItem);
|
playbackManager.shuffle(currentItem);
|
||||||
|
@ -698,7 +708,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
self.params = params;
|
self.params = params;
|
||||||
this.itemsContainer = view.querySelector('.itemsContainer');
|
this.itemsContainer = view.querySelector('.itemsContainer');
|
||||||
|
|
||||||
|
@ -712,20 +722,17 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
this.itemsContainer.setAttribute('data-refreshinterval', '300000');
|
this.itemsContainer.setAttribute('data-refreshinterval', '300000');
|
||||||
}
|
}
|
||||||
|
|
||||||
var i;
|
const btnViewSettings = view.querySelectorAll('.btnViewSettings');
|
||||||
var length;
|
|
||||||
var btnViewSettings = view.querySelectorAll('.btnViewSettings');
|
|
||||||
|
|
||||||
for (i = 0, length = btnViewSettings.length; i < length; i++) {
|
for (const btnViewSetting of btnViewSettings) {
|
||||||
btnViewSettings[i].addEventListener('click', showViewSettingsMenu.bind(this));
|
btnViewSetting.addEventListener('click', showViewSettingsMenu.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
var filterButtons = view.querySelectorAll('.btnFilter');
|
const filterButtons = view.querySelectorAll('.btnFilter');
|
||||||
this.filterButtons = filterButtons;
|
this.filterButtons = filterButtons;
|
||||||
var hasVisibleFilters = this.getVisibleFilters().length;
|
const hasVisibleFilters = this.getVisibleFilters().length;
|
||||||
|
|
||||||
for (i = 0, length = filterButtons.length; i < length; i++) {
|
for (const btnFilter of filterButtons) {
|
||||||
var btnFilter = filterButtons[i];
|
|
||||||
btnFilter.addEventListener('click', showFilterMenu.bind(this));
|
btnFilter.addEventListener('click', showFilterMenu.bind(this));
|
||||||
|
|
||||||
if (hasVisibleFilters) {
|
if (hasVisibleFilters) {
|
||||||
|
@ -735,10 +742,10 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var sortButtons = view.querySelectorAll('.btnSort');
|
const sortButtons = view.querySelectorAll('.btnSort');
|
||||||
|
|
||||||
for (this.sortButtons = sortButtons, i = 0, length = sortButtons.length; i < length; i++) {
|
this.sortButtons = sortButtons;
|
||||||
var sortButton = sortButtons[i];
|
for (const sortButton of sortButtons) {
|
||||||
sortButton.addEventListener('click', showSortMenu.bind(this));
|
sortButton.addEventListener('click', showSortMenu.bind(this));
|
||||||
|
|
||||||
if (params.type !== 'nextup') {
|
if (params.type !== 'nextup') {
|
||||||
|
@ -753,7 +760,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
self.itemsContainer.fetchData = fetchData;
|
self.itemsContainer.fetchData = fetchData;
|
||||||
self.itemsContainer.getItemsHtml = getItemsHtml;
|
self.itemsContainer.getItemsHtml = getItemsHtml;
|
||||||
view.addEventListener('viewshow', function (e) {
|
view.addEventListener('viewshow', function (e) {
|
||||||
var isRestored = e.detail.isRestored;
|
const isRestored = e.detail.isRestored;
|
||||||
|
|
||||||
if (!isRestored) {
|
if (!isRestored) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
@ -765,7 +772,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
getItem(params).then(function (item) {
|
getItem(params).then(function (item) {
|
||||||
setTitle(item);
|
setTitle(item);
|
||||||
self.currentItem = item;
|
self.currentItem = item;
|
||||||
var refresh = !isRestored;
|
const refresh = !isRestored;
|
||||||
self.itemsContainer.resume({
|
self.itemsContainer.resume({
|
||||||
refresh: refresh
|
refresh: refresh
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
@ -780,7 +787,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
initAlphaPicker();
|
initAlphaPicker();
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemType = item ? item.Type : null;
|
const itemType = item ? item.Type : null;
|
||||||
|
|
||||||
if (itemType === 'MusicGenre' || params.type !== 'Programs' && itemType !== 'Channel') {
|
if (itemType === 'MusicGenre' || params.type !== 'Programs' && itemType !== 'Channel') {
|
||||||
hideOrShowAll(view.querySelectorAll('.btnPlay'), false);
|
hideOrShowAll(view.querySelectorAll('.btnPlay'), false);
|
||||||
|
@ -807,18 +814,18 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
bindAll(view.querySelectorAll('.btnShuffle'), 'click', shuffle);
|
bindAll(view.querySelectorAll('.btnShuffle'), 'click', shuffle);
|
||||||
}
|
}
|
||||||
|
|
||||||
self.alphaNumericShortcuts = new AlphaNumericShortcuts.default({
|
self.alphaNumericShortcuts = new AlphaNumericShortcuts({
|
||||||
itemsContainer: self.itemsContainer
|
itemsContainer: self.itemsContainer
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
view.addEventListener('viewhide', function (e) {
|
view.addEventListener('viewhide', function (e) {
|
||||||
var itemsContainer = self.itemsContainer;
|
const itemsContainer = self.itemsContainer;
|
||||||
|
|
||||||
if (itemsContainer) {
|
if (itemsContainer) {
|
||||||
itemsContainer.pause();
|
itemsContainer.pause();
|
||||||
}
|
}
|
||||||
|
|
||||||
var alphaNumericShortcuts = self.alphaNumericShortcuts;
|
const alphaNumericShortcuts = self.alphaNumericShortcuts;
|
||||||
|
|
||||||
if (alphaNumericShortcuts) {
|
if (alphaNumericShortcuts) {
|
||||||
alphaNumericShortcuts.destroy();
|
alphaNumericShortcuts.destroy();
|
||||||
|
@ -846,8 +853,8 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getFilters = function () {
|
getFilters() {
|
||||||
var basekey = this.getSettingsKey();
|
const basekey = this.getSettingsKey();
|
||||||
return {
|
return {
|
||||||
IsPlayed: userSettings.getFilter(basekey + '-filter-IsPlayed') === 'true',
|
IsPlayed: userSettings.getFilter(basekey + '-filter-IsPlayed') === 'true',
|
||||||
IsUnplayed: userSettings.getFilter(basekey + '-filter-IsUnplayed') === 'true',
|
IsUnplayed: userSettings.getFilter(basekey + '-filter-IsUnplayed') === 'true',
|
||||||
|
@ -866,39 +873,37 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
HasThemeVideo: userSettings.getFilter(basekey + '-filter-HasThemeVideo'),
|
HasThemeVideo: userSettings.getFilter(basekey + '-filter-HasThemeVideo'),
|
||||||
GenreIds: userSettings.getFilter(basekey + '-filter-GenreIds')
|
GenreIds: userSettings.getFilter(basekey + '-filter-GenreIds')
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getSortValues = function () {
|
getSortValues() {
|
||||||
var basekey = this.getSettingsKey();
|
const basekey = this.getSettingsKey();
|
||||||
return {
|
return {
|
||||||
sortBy: userSettings.getFilter(basekey + '-sortby') || this.getDefaultSortBy(),
|
sortBy: userSettings.getFilter(basekey + '-sortby') || this.getDefaultSortBy(),
|
||||||
sortOrder: userSettings.getFilter(basekey + '-sortorder') === 'Descending' ? 'Descending' : 'Ascending'
|
sortOrder: userSettings.getFilter(basekey + '-sortorder') === 'Descending' ? 'Descending' : 'Ascending'
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getDefaultSortBy = function () {
|
getDefaultSortBy() {
|
||||||
var params = this.params;
|
const sortNameOption = this.getNameSortOption(this.params);
|
||||||
var sortNameOption = this.getNameSortOption(params);
|
|
||||||
|
|
||||||
if (params.type) {
|
if (this.params.type) {
|
||||||
return sortNameOption.value;
|
return sortNameOption.value;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 'IsFolder,' + sortNameOption.value;
|
return 'IsFolder,' + sortNameOption.value;
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getSortMenuOptions = function () {
|
getSortMenuOptions() {
|
||||||
var sortBy = [];
|
const sortBy = [];
|
||||||
var params = this.params;
|
|
||||||
|
|
||||||
if (params.type === 'Programs') {
|
if (this.params.type === 'Programs') {
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('AirDate'),
|
name: globalize.translate('AirDate'),
|
||||||
value: 'StartDate,SortName'
|
value: 'StartDate,SortName'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var option = this.getNameSortOption(params);
|
let option = this.getNameSortOption(this.params);
|
||||||
|
|
||||||
if (option) {
|
if (option) {
|
||||||
sortBy.push(option);
|
sortBy.push(option);
|
||||||
|
@ -916,7 +921,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
sortBy.push(option);
|
sortBy.push(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (params.type !== 'Programs') {
|
if (this.params.type !== 'Programs') {
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('DateAdded'),
|
name: globalize.translate('DateAdded'),
|
||||||
value: 'DateCreated,SortName'
|
value: 'DateCreated,SortName'
|
||||||
|
@ -929,8 +934,8 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
sortBy.push(option);
|
sortBy.push(option);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!params.type) {
|
if (!this.params.type) {
|
||||||
option = this.getNameSortOption(params);
|
option = this.getNameSortOption(this.params);
|
||||||
sortBy.push({
|
sortBy.push({
|
||||||
name: globalize.translate('Folders'),
|
name: globalize.translate('Folders'),
|
||||||
value: 'IsFolder,' + option.value
|
value: 'IsFolder,' + option.value
|
||||||
|
@ -956,9 +961,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
value: 'Runtime,SortName'
|
value: 'Runtime,SortName'
|
||||||
});
|
});
|
||||||
return sortBy;
|
return sortBy;
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getNameSortOption = function (params) {
|
getNameSortOption(params) {
|
||||||
if (params.type === 'Episode') {
|
if (params.type === 'Episode') {
|
||||||
return {
|
return {
|
||||||
name: globalize.translate('Name'),
|
name: globalize.translate('Name'),
|
||||||
|
@ -970,9 +975,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
name: globalize.translate('Name'),
|
name: globalize.translate('Name'),
|
||||||
value: 'SortName'
|
value: 'SortName'
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getPlayCountSortOption = function () {
|
getPlayCountSortOption() {
|
||||||
if (this.params.type === 'Programs') {
|
if (this.params.type === 'Programs') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -981,9 +986,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
name: globalize.translate('PlayCount'),
|
name: globalize.translate('PlayCount'),
|
||||||
value: 'PlayCount,SortName'
|
value: 'PlayCount,SortName'
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getDatePlayedSortOption = function () {
|
getDatePlayedSortOption() {
|
||||||
if (this.params.type === 'Programs') {
|
if (this.params.type === 'Programs') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -992,9 +997,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
name: globalize.translate('DatePlayed'),
|
name: globalize.translate('DatePlayed'),
|
||||||
value: 'DatePlayed,SortName'
|
value: 'DatePlayed,SortName'
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getCriticRatingSortOption = function () {
|
getCriticRatingSortOption() {
|
||||||
if (this.params.type === 'Programs') {
|
if (this.params.type === 'Programs') {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -1003,18 +1008,18 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
name: globalize.translate('CriticRating'),
|
name: globalize.translate('CriticRating'),
|
||||||
value: 'CriticRating,SortName'
|
value: 'CriticRating,SortName'
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getCommunityRatingSortOption = function () {
|
getCommunityRatingSortOption() {
|
||||||
return {
|
return {
|
||||||
name: globalize.translate('CommunityRating'),
|
name: globalize.translate('CommunityRating'),
|
||||||
value: 'CommunityRating,SortName'
|
value: 'CommunityRating,SortName'
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getVisibleFilters = function () {
|
getVisibleFilters() {
|
||||||
var filters = [];
|
const filters = [];
|
||||||
var params = this.params;
|
const params = this.params;
|
||||||
|
|
||||||
if (!(params.type === 'nextup')) {
|
if (!(params.type === 'nextup')) {
|
||||||
if (params.type === 'Programs') {
|
if (params.type === 'Programs') {
|
||||||
|
@ -1038,16 +1043,15 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
return filters;
|
return filters;
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.setFilterStatus = function (hasFilters) {
|
setFilterStatus(hasFilters) {
|
||||||
this.hasFilters = hasFilters;
|
this.hasFilters = hasFilters;
|
||||||
var filterButtons = this.filterButtons;
|
const filterButtons = this.filterButtons;
|
||||||
|
|
||||||
if (filterButtons.length) {
|
if (filterButtons.length) {
|
||||||
for (var i = 0, length = filterButtons.length; i < length; i++) {
|
for (const btnFilter of filterButtons) {
|
||||||
var btnFilter = filterButtons[i];
|
let bubble = btnFilter.querySelector('.filterButtonBubble');
|
||||||
var bubble = btnFilter.querySelector('.filterButtonBubble');
|
|
||||||
|
|
||||||
if (!bubble) {
|
if (!bubble) {
|
||||||
if (!hasFilters) {
|
if (!hasFilters) {
|
||||||
|
@ -1066,10 +1070,10 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getFilterMenuOptions = function () {
|
getFilterMenuOptions() {
|
||||||
var params = this.params;
|
const params = this.params;
|
||||||
return {
|
return {
|
||||||
IsAiring: params.IsAiring,
|
IsAiring: params.IsAiring,
|
||||||
IsMovie: params.IsMovie,
|
IsMovie: params.IsMovie,
|
||||||
|
@ -1079,11 +1083,11 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
IsSeries: params.IsSeries,
|
IsSeries: params.IsSeries,
|
||||||
Recursive: this.queryRecursive
|
Recursive: this.queryRecursive
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getVisibleViewSettings = function () {
|
getVisibleViewSettings() {
|
||||||
var item = (this.params, this.currentItem);
|
const item = (this.params, this.currentItem);
|
||||||
var fields = ['showTitle'];
|
const fields = ['showTitle'];
|
||||||
|
|
||||||
if (!item || item.Type !== 'PhotoAlbum' && item.Type !== 'ChannelFolderItem') {
|
if (!item || item.Type !== 'PhotoAlbum' && item.Type !== 'ChannelFolderItem') {
|
||||||
fields.push('imageType');
|
fields.push('imageType');
|
||||||
|
@ -1091,13 +1095,13 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
|
|
||||||
fields.push('viewType');
|
fields.push('viewType');
|
||||||
return fields;
|
return fields;
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getViewSettings = function () {
|
getViewSettings() {
|
||||||
var basekey = this.getSettingsKey();
|
const basekey = this.getSettingsKey();
|
||||||
var params = this.params;
|
const params = this.params;
|
||||||
var item = this.currentItem;
|
const item = this.currentItem;
|
||||||
var showTitle = userSettings.get(basekey + '-showTitle');
|
let showTitle = userSettings.get(basekey + '-showTitle');
|
||||||
|
|
||||||
if (showTitle === 'true') {
|
if (showTitle === 'true') {
|
||||||
showTitle = true;
|
showTitle = true;
|
||||||
|
@ -1109,7 +1113,7 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
showTitle = true;
|
showTitle = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageType = userSettings.get(basekey + '-imageType');
|
let imageType = userSettings.get(basekey + '-imageType');
|
||||||
|
|
||||||
if (!imageType && params.type === 'nextup') {
|
if (!imageType && params.type === 'nextup') {
|
||||||
imageType = 'thumb';
|
imageType = 'thumb';
|
||||||
|
@ -1121,10 +1125,10 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
imageType: imageType || 'primary',
|
imageType: imageType || 'primary',
|
||||||
viewType: userSettings.get(basekey + '-viewType') || 'images'
|
viewType: userSettings.get(basekey + '-viewType') || 'images'
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getItemTypes = function () {
|
getItemTypes() {
|
||||||
var params = this.params;
|
const params = this.params;
|
||||||
|
|
||||||
if (params.type === 'nextup') {
|
if (params.type === 'nextup') {
|
||||||
return ['Episode'];
|
return ['Episode'];
|
||||||
|
@ -1135,12 +1139,12 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
return [];
|
return [];
|
||||||
};
|
}
|
||||||
|
|
||||||
ItemsView.prototype.getSettingsKey = function () {
|
getSettingsKey() {
|
||||||
var values = [];
|
const values = [];
|
||||||
values.push('items');
|
values.push('items');
|
||||||
var params = this.params;
|
const params = this.params;
|
||||||
|
|
||||||
if (params.type) {
|
if (params.type) {
|
||||||
values.push(params.type);
|
values.push(params.type);
|
||||||
|
@ -1197,7 +1201,9 @@ define(['globalize', 'listView', 'layoutManager', 'userSettings', 'focusManager'
|
||||||
}
|
}
|
||||||
|
|
||||||
return values.join('-');
|
return values.join('-');
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ItemsView;
|
export default ItemsView;
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,29 +1,27 @@
|
||||||
define(['tvguide'], function (tvguide) {
|
import tvguide from 'tvguide';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
return function (view, params, tabContent) {
|
export default function (view, params, tabContent) {
|
||||||
var guideInstance;
|
let guideInstance;
|
||||||
var self = this;
|
const self = this;
|
||||||
|
|
||||||
self.renderTab = function () {
|
self.renderTab = function () {
|
||||||
if (!guideInstance) {
|
if (!guideInstance) {
|
||||||
guideInstance = new tvguide({
|
guideInstance = new tvguide({
|
||||||
element: tabContent,
|
element: tabContent,
|
||||||
serverId: ApiClient.serverId()
|
serverId: ApiClient.serverId()
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
|
||||||
|
|
||||||
self.onShow = function () {
|
|
||||||
if (guideInstance) {
|
|
||||||
guideInstance.resume();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
self.onHide = function () {
|
|
||||||
if (guideInstance) {
|
|
||||||
guideInstance.pause();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
self.onShow = function () {
|
||||||
|
if (guideInstance) {
|
||||||
|
guideInstance.resume();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
self.onHide = function () {
|
||||||
|
if (guideInstance) {
|
||||||
|
guideInstance.pause();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
|
@ -2,6 +2,7 @@ define(['layoutManager', 'userSettings', 'inputManager', 'loading', 'globalize',
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
loading = loading.default || loading;
|
loading = loading.default || loading;
|
||||||
|
layoutManager = layoutManager.default || layoutManager;
|
||||||
|
|
||||||
function enableScrollX() {
|
function enableScrollX() {
|
||||||
return !layoutManager.desktop;
|
return !layoutManager.desktop;
|
||||||
|
@ -169,9 +170,6 @@ define(['layoutManager', 'userSettings', 'inputManager', 'loading', 'globalize',
|
||||||
name: globalize.translate('HeaderSchedule')
|
name: globalize.translate('HeaderSchedule')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabSeries')
|
name: globalize.translate('TabSeries')
|
||||||
}, {
|
|
||||||
name: globalize.translate('ButtonSearch'),
|
|
||||||
cssClass: 'searchTabButton'
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -255,12 +253,11 @@ define(['layoutManager', 'userSettings', 'inputManager', 'loading', 'globalize',
|
||||||
case 5:
|
case 5:
|
||||||
depends.push('controllers/livetv/livetvseriestimers');
|
depends.push('controllers/livetv/livetvseriestimers');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
|
||||||
depends.push('scripts/searchtab');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
require(depends, function (controllerFactory) {
|
require(depends, function (controllerFactory) {
|
||||||
|
controllerFactory = controllerFactory.default || controllerFactory;
|
||||||
|
|
||||||
var tabContent;
|
var tabContent;
|
||||||
|
|
||||||
if (index == 0) {
|
if (index == 0) {
|
||||||
|
|
|
@ -94,7 +94,7 @@
|
||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block"><span>${ButtonSave}</span></button>
|
<button is="emby-button" type="submit" class="raised button-submit block"><span>${Save}</span></button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
|
@ -7,7 +7,7 @@
|
||||||
<h2 class="sectionTitle sectionTitle-cards">
|
<h2 class="sectionTitle sectionTitle-cards">
|
||||||
<span>${HeaderTunerDevices}</span>
|
<span>${HeaderTunerDevices}</span>
|
||||||
</h2>
|
</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnAddDevice submit sectionTitleButton" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnAddDevice submit sectionTitleButton" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add"></span>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
<a is="emby-linkbutton" rel="noopener noreferrer" style="margin-left:2em!important;" class="raised button-alt headerHelpButton" target="_blank" href="https://docs.jellyfin.org/general/server/live-tv/index.html">${Help}</a>
|
<a is="emby-linkbutton" rel="noopener noreferrer" style="margin-left:2em!important;" class="raised button-alt headerHelpButton" target="_blank" href="https://docs.jellyfin.org/general/server/live-tv/index.html">${Help}</a>
|
||||||
|
@ -20,7 +20,7 @@
|
||||||
<div class="verticalSection">
|
<div class="verticalSection">
|
||||||
<div class="sectionTitleContainer">
|
<div class="sectionTitleContainer">
|
||||||
<h2 class="sectionTitle">${HeaderGuideProviders}</h2>
|
<h2 class="sectionTitle">${HeaderGuideProviders}</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnAddProvider submit" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnAddProvider submit" style="margin-left:1em;" title="${Add}">
|
||||||
<span class="material-icons add"></span>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
|
@ -15,12 +15,10 @@ import 'emby-button';
|
||||||
const enableFocusTransform = !browser.slow && !browser.edge;
|
const enableFocusTransform = !browser.slow && !browser.edge;
|
||||||
|
|
||||||
function getDeviceHtml(device) {
|
function getDeviceHtml(device) {
|
||||||
let padderClass;
|
const padderClass = 'cardPadder-backdrop';
|
||||||
|
let cssClass = 'card scalableCard backdropCard backdropCard-scalable';
|
||||||
|
const cardBoxCssClass = 'cardBox visualCardBox';
|
||||||
let html = '';
|
let html = '';
|
||||||
let cssClass = 'card scalableCard';
|
|
||||||
let cardBoxCssClass = 'cardBox visualCardBox';
|
|
||||||
cssClass += ' backdropCard backdropCard-scalable';
|
|
||||||
padderClass = 'cardPadder-backdrop';
|
|
||||||
|
|
||||||
// TODO move card creation code to Card component
|
// TODO move card creation code to Card component
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
<input type="hidden" class="fldDeviceId" />
|
<input type="hidden" class="fldDeviceId" />
|
||||||
<div>
|
<div>
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block">
|
<button is="emby-button" type="submit" class="raised button-submit block">
|
||||||
<span>${ButtonSave}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
<button is="emby-button" type="button" class="raised button-cancel block btnCancel" onclick="history.back();">
|
<button is="emby-button" type="button" class="raised button-cancel block btnCancel" onclick="history.back();">
|
||||||
<span>${ButtonCancel}</span>
|
<span>${ButtonCancel}</span>
|
|
@ -227,7 +227,7 @@ import 'emby-button';
|
||||||
return [{
|
return [{
|
||||||
name: globalize.translate('Movies')
|
name: globalize.translate('Movies')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabSuggestions')
|
name: globalize.translate('Suggestions')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabTrailers')
|
name: globalize.translate('TabTrailers')
|
||||||
}, {
|
}, {
|
||||||
|
@ -236,9 +236,6 @@ import 'emby-button';
|
||||||
name: globalize.translate('TabCollections')
|
name: globalize.translate('TabCollections')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabGenres')
|
name: globalize.translate('TabGenres')
|
||||||
}, {
|
|
||||||
name: globalize.translate('ButtonSearch'),
|
|
||||||
cssClass: 'searchTabButton'
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,10 +303,6 @@ import 'emby-button';
|
||||||
case 5:
|
case 5:
|
||||||
depends = 'controllers/movies/moviegenres';
|
depends = 'controllers/movies/moviegenres';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
|
||||||
depends = 'scripts/searchtab';
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
import(depends).then(({default: controllerFactory}) => {
|
import(depends).then(({default: controllerFactory}) => {
|
||||||
|
|
|
@ -104,7 +104,6 @@ import 'flexStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
var itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
|
|
||||||
itemsContainer.innerHTML = cardBuilder.getCardsHtml({
|
itemsContainer.innerHTML = cardBuilder.getCardsHtml({
|
||||||
items: result.Items,
|
items: result.Items,
|
||||||
showUnplayedIndicator: false,
|
showUnplayedIndicator: false,
|
||||||
|
@ -178,22 +177,19 @@ import 'flexStyles';
|
||||||
|
|
||||||
function getTabs() {
|
function getTabs() {
|
||||||
return [{
|
return [{
|
||||||
name: globalize.translate('TabSuggestions')
|
name: globalize.translate('Suggestions')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabAlbums')
|
name: globalize.translate('TabAlbums')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabAlbumArtists')
|
name: globalize.translate('TabAlbumArtists')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabArtists')
|
name: globalize.translate('Artists')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabPlaylists')
|
name: globalize.translate('TabPlaylists')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabSongs')
|
name: globalize.translate('TabSongs')
|
||||||
}, {
|
}, {
|
||||||
name: globalize.translate('TabGenres')
|
name: globalize.translate('TabGenres')
|
||||||
}, {
|
|
||||||
name: globalize.translate('ButtonSearch'),
|
|
||||||
cssClass: 'searchTabButton'
|
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -295,10 +291,6 @@ import 'flexStyles';
|
||||||
case 6:
|
case 6:
|
||||||
depends = 'controllers/music/musicgenres';
|
depends = 'controllers/music/musicgenres';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
|
||||||
depends = 'scripts/searchtab';
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
import(depends).then(({default: controllerFactory}) => {
|
import(depends).then(({default: controllerFactory}) => {
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue