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

merge branch master into pdf-reader

This commit is contained in:
dkanada 2020-10-20 13:22:09 +09:00
commit 6b302ed20b
292 changed files with 7971 additions and 6918 deletions

View file

@ -2,4 +2,4 @@ version: 1
update_configs: update_configs:
- package_manager: "javascript" - package_manager: "javascript"
directory: "/" directory: "/"
update_schedule: "live" update_schedule: "weekly"

View file

@ -44,12 +44,12 @@ module.exports = {
'no-restricted-globals': ['error'].concat(restrictedGlobals), 'no-restricted-globals': ['error'].concat(restrictedGlobals),
'no-trailing-spaces': ['error'], 'no-trailing-spaces': ['error'],
'@babel/no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }], '@babel/no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }],
//'no-unused-vars': ['error', { 'vars': 'all', 'args': 'none', 'ignoreRestSiblings': true }],
'one-var': ['error', 'never'], 'one-var': ['error', 'never'],
'padded-blocks': ['error', 'never'], 'padded-blocks': ['error', 'never'],
//'prefer-const': ['error', {'destructuring': 'all'}], 'prefer-const': ['error', {'destructuring': 'all'}],
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }], 'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
'@babel/semi': ['error'], '@babel/semi': ['error'],
'no-var': ['error'],
'space-before-blocks': ['error'], 'space-before-blocks': ['error'],
'space-infix-ops': 'error', 'space-infix-ops': 'error',
'yoda': 'error' 'yoda': 'error'
@ -84,7 +84,6 @@ module.exports = {
'ApiClient': 'writable', 'ApiClient': 'writable',
'AppInfo': 'writable', 'AppInfo': 'writable',
'chrome': 'writable', 'chrome': 'writable',
'ConnectionManager': 'writable',
'DlnaProfilePage': 'writable', 'DlnaProfilePage': 'writable',
'Dashboard': 'writable', 'Dashboard': 'writable',
'DashboardPage': 'writable', 'DashboardPage': 'writable',

3
.gitignore vendored
View file

@ -3,6 +3,9 @@ dist
web web
node_modules node_modules
# config
config.json
# ide # ide
.idea .idea
.vscode .vscode

View file

@ -34,10 +34,13 @@
- [Ryan Hartzell](https://github.com/ryan-hartzell) - [Ryan Hartzell](https://github.com/ryan-hartzell)
- [Thibault Nocchi](https://github.com/ThibaultNocchi) - [Thibault Nocchi](https://github.com/ThibaultNocchi)
- [MrTimscampi](https://github.com/MrTimscampi) - [MrTimscampi](https://github.com/MrTimscampi)
- [ConfusedPolarBear](https://github.com/ConfusedPolarBear)
- [Sarab Singh](https://github.com/sarab97) - [Sarab Singh](https://github.com/sarab97)
- [GuilhermeHideki](https://github.com/GuilhermeHideki) - [GuilhermeHideki](https://github.com/GuilhermeHideki)
- [Andrei Oanca](https://github.com/OancaAndrei) - [Andrei Oanca](https://github.com/OancaAndrei)
- [Cromefire_](https://github.com/cromefire) - [Cromefire_](https://github.com/cromefire)
- [Orry Verducci](https://github.com/orryverducci)
- [Camc314](https://github.com/camc314)
# Emby Contributors # Emby Contributors

View file

@ -11,11 +11,12 @@ Source0: jellyfin-web-%{version}.tar.gz
%if 0%{?centos} %if 0%{?centos}
BuildRequires: yarn BuildRequires: yarn
# sadly the yarn RPM at https://dl.yarnpkg.com/rpm/ uses git but doesn't Requires: it
BuildRequires: git
%else %else
BuildRequires: nodejs-yarn BuildRequires: nodejs-yarn
%endif %endif
# sadly the yarn RPM at https://dl.yarnpkg.com/rpm/ uses git but doesn't Requires: it
# ditto for Fedora's yarn RPM
BuildRequires: git
BuildArch: noarch BuildArch: noarch
# Disable Automatic Dependency Processing # Disable Automatic Dependency Processing

View file

@ -5,28 +5,28 @@
"repository": "https://github.com/jellyfin/jellyfin-web", "repository": "https://github.com/jellyfin/jellyfin-web",
"license": "GPL-2.0-or-later", "license": "GPL-2.0-or-later",
"devDependencies": { "devDependencies": {
"@babel/core": "^7.11.4", "@babel/core": "^7.11.6",
"@babel/eslint-parser": "^7.11.4", "@babel/eslint-parser": "^7.12.1",
"@babel/eslint-plugin": "^7.11.3", "@babel/eslint-plugin": "^7.12.1",
"@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",
"@babel/polyfill": "^7.8.7", "@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.11.0", "@babel/preset-env": "^7.11.5",
"autoprefixer": "^9.8.6", "autoprefixer": "^9.8.6",
"babel-loader": "^8.0.6", "babel-loader": "^8.0.6",
"browser-sync": "^2.26.12", "browser-sync": "^2.26.12",
"confusing-browser-globals": "^1.0.9", "confusing-browser-globals": "^1.0.9",
"copy-webpack-plugin": "^5.1.1", "copy-webpack-plugin": "^5.1.1",
"css-loader": "^4.2.2", "css-loader": "^5.0.0",
"cssnano": "^4.1.10", "cssnano": "^4.1.10",
"del": "^5.1.0", "del": "^6.0.0",
"eslint": "^7.7.0", "eslint": "^7.11.0",
"eslint-plugin-compat": "^3.5.1", "eslint-plugin-compat": "^3.5.1",
"eslint-plugin-eslint-comments": "^3.2.0", "eslint-plugin-eslint-comments": "^3.2.0",
"eslint-plugin-import": "^2.21.2", "eslint-plugin-import": "^2.22.1",
"eslint-plugin-promise": "^4.2.1", "eslint-plugin-promise": "^4.2.1",
"file-loader": "^6.0.0", "file-loader": "^6.1.1",
"gulp": "^4.0.2", "gulp": "^4.0.2",
"gulp-babel": "^8.0.0", "gulp-babel": "^8.0.0",
"gulp-cli": "^2.3.0", "gulp-cli": "^2.3.0",
@ -40,19 +40,19 @@
"gulp-sass": "^4.0.2", "gulp-sass": "^4.0.2",
"gulp-sourcemaps": "^2.6.5", "gulp-sourcemaps": "^2.6.5",
"gulp-terser": "^1.4.0", "gulp-terser": "^1.4.0",
"html-webpack-plugin": "^4.4.1", "html-webpack-plugin": "^4.5.0",
"lazypipe": "^1.0.2", "lazypipe": "^1.0.2",
"node-sass": "^4.13.1", "node-sass": "^4.13.1",
"postcss-loader": "^3.0.0", "postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.7.0", "postcss-preset-env": "^6.7.0",
"style-loader": "^1.1.3", "style-loader": "^2.0.0",
"stylelint": "^13.6.1", "stylelint": "^13.7.2",
"stylelint-config-rational-order": "^0.1.2", "stylelint-config-rational-order": "^0.1.2",
"stylelint-no-browser-hacks": "^1.2.1", "stylelint-no-browser-hacks": "^1.2.1",
"stylelint-order": "^4.1.0", "stylelint-order": "^4.1.0",
"webpack": "^4.44.1", "webpack": "^5.0.0",
"webpack-merge": "^4.2.2", "webpack-merge": "^4.2.2",
"webpack-stream": "^6.0.0", "webpack-stream": "^6.1.0",
"worker-plugin": "^5.0.0" "worker-plugin": "^5.0.0"
}, },
"dependencies": { "dependencies": {
@ -60,31 +60,31 @@
"blurhash": "^1.1.3", "blurhash": "^1.1.3",
"classlist.js": "https://github.com/eligrey/classList.js/archive/1.2.20180112.tar.gz", "classlist.js": "https://github.com/eligrey/classList.js/archive/1.2.20180112.tar.gz",
"core-js": "^3.6.5", "core-js": "^3.6.5",
"date-fns": "^2.16.0", "date-fns": "^2.16.1",
"epubjs": "^0.3.85", "epubjs": "^0.3.85",
"pdfjs-dist": "^2.4.456", "pdfjs-dist": "^2.4.456",
"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.10", "hls.js": "^0.14.15",
"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.2",
"jellyfin-noto": "https://github.com/jellyfin/jellyfin-noto", "jellyfin-noto": "https://github.com/jellyfin/jellyfin-noto",
"jquery": "^3.5.1", "jquery": "^3.5.1",
"jstree": "^3.3.10", "jstree": "^3.3.10",
"libarchive.js": "^1.3.0", "libarchive.js": "^1.3.0",
"libass-wasm": "https://github.com/jellyfin/JavascriptSubtitlesOctopus#4.0.0-jf-smarttv", "libass-wasm": "https://github.com/jellyfin/JavascriptSubtitlesOctopus#4.0.0-jf-smarttv",
"material-design-icons-iconfont": "^6.0.1", "material-design-icons-iconfont": "^6.1.0",
"native-promise-only": "^0.8.0-a", "native-promise-only": "^0.8.0-a",
"page": "^1.11.6", "page": "^1.11.6",
"query-string": "^6.13.1", "query-string": "^6.13.6",
"resize-observer-polyfill": "^1.5.1", "resize-observer-polyfill": "^1.5.1",
"screenfull": "^5.0.2", "screenfull": "^5.0.2",
"sortablejs": "^1.10.2", "sortablejs": "^1.12.0",
"swiper": "^6.1.1", "swiper": "^6.3.3",
"webcomponents.js": "^0.7.24", "webcomponents.js": "^0.7.24",
"whatwg-fetch": "^3.4.0" "whatwg-fetch": "^3.4.1"
}, },
"babel": { "babel": {
"presets": [ "presets": [
@ -167,6 +167,8 @@
"src/components/playmenu.js", "src/components/playmenu.js",
"src/components/pluginManager.js", "src/components/pluginManager.js",
"src/components/prompt/prompt.js", "src/components/prompt/prompt.js",
"src/components/qualityOptions.js",
"src/components/quickConnectSettings/quickConnectSettings.js",
"src/components/recordingcreator/recordingbutton.js", "src/components/recordingcreator/recordingbutton.js",
"src/components/recordingcreator/recordingcreator.js", "src/components/recordingcreator/recordingcreator.js",
"src/components/recordingcreator/seriesrecordingeditor.js", "src/components/recordingcreator/seriesrecordingeditor.js",
@ -174,7 +176,6 @@
"src/components/refreshdialog/refreshdialog.js", "src/components/refreshdialog/refreshdialog.js",
"src/components/recordingcreator/recordingeditor.js", "src/components/recordingcreator/recordingeditor.js",
"src/components/recordingcreator/recordingfields.js", "src/components/recordingcreator/recordingfields.js",
"src/components/qualityOptions.js",
"src/components/remotecontrol/remotecontrol.js", "src/components/remotecontrol/remotecontrol.js",
"src/components/sanatizefilename.js", "src/components/sanatizefilename.js",
"src/components/scrollManager.js", "src/components/scrollManager.js",
@ -214,7 +215,7 @@
"src/components/castSenderApi.js", "src/components/castSenderApi.js",
"src/controllers/session/addServer/index.js", "src/controllers/session/addServer/index.js",
"src/controllers/session/forgotPassword/index.js", "src/controllers/session/forgotPassword/index.js",
"src/controllers/session/redeemPassword/index.js", "src/controllers/session/resetPassword/index.js",
"src/controllers/session/login/index.js", "src/controllers/session/login/index.js",
"src/controllers/session/selectServer/index.js", "src/controllers/session/selectServer/index.js",
"src/controllers/dashboard/apikeys.js", "src/controllers/dashboard/apikeys.js",
@ -245,6 +246,7 @@
"src/controllers/dashboard/plugins/installed/index.js", "src/controllers/dashboard/plugins/installed/index.js",
"src/controllers/dashboard/plugins/available/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/quickConnect.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",
"src/controllers/dashboard/serveractivity.js", "src/controllers/dashboard/serveractivity.js",
@ -293,6 +295,7 @@
"src/controllers/user/menu/index.js", "src/controllers/user/menu/index.js",
"src/controllers/user/playback/index.js", "src/controllers/user/playback/index.js",
"src/controllers/user/profile/index.js", "src/controllers/user/profile/index.js",
"src/controllers/user/quickConnect/index.js",
"src/controllers/user/subtitles/index.js", "src/controllers/user/subtitles/index.js",
"src/controllers/wizard/finish/index.js", "src/controllers/wizard/finish/index.js",
"src/controllers/wizard/remote/index.js", "src/controllers/wizard/remote/index.js",
@ -331,6 +334,7 @@
"src/plugins/youtubePlayer/plugin.js", "src/plugins/youtubePlayer/plugin.js",
"src/scripts/alphanumericshortcuts.js", "src/scripts/alphanumericshortcuts.js",
"src/scripts/autoBackdrops.js", "src/scripts/autoBackdrops.js",
"src/scripts/autocast.js",
"src/scripts/browser.js", "src/scripts/browser.js",
"src/scripts/clientUtils.js", "src/scripts/clientUtils.js",
"src/scripts/datetime.js", "src/scripts/datetime.js",

View file

@ -16,7 +16,7 @@ langlst.append('en-us.json')
dep = [] dep = []
def grep(key): def grep(key):
command = 'grep -r -E "(\(\\\"|\(\'|\{)%s(\\\"|\'|\})" --include=\*.{js,html} --exclude-dir=../src/strings ../src' % key command = 'grep -r -E "(\\\"|\'|\{)%s(\\\"|\'|\})" --include=\*.{js,html} --exclude-dir=../src/strings ../src' % key
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
output = p.stdout.readlines() output = p.stdout.readlines()
if output: if output:

View file

@ -6,29 +6,42 @@
-ms-user-select: none; -ms-user-select: none;
} }
.osdPoster img,
.videoOsdBottom { .videoOsdBottom {
bottom: 0; bottom: 0;
left: 0; left: 0;
right: 0; right: 0;
position: fixed;
background: linear-gradient(0deg, rgba(16, 16, 16, 0.75) 0%, rgba(16, 16, 16, 0) 100%);
padding-top: 7.5em;
padding-bottom: 1.75em;
display: flex;
flex-direction: row;
justify-content: center;
will-change: opacity;
transition: opacity 0.3s ease-out;
color: #fff;
user-select: none;
-webkit-touch-callout: none;
} }
.osdHeader { .skinHeader-withBackground.osdHeader {
-webkit-transition: opacity 0.3s ease-out;
-o-transition: opacity 0.3s ease-out;
transition: opacity 0.3s ease-out; transition: opacity 0.3s ease-out;
position: relative; position: relative;
z-index: 1; z-index: 1;
background: rgba(0, 0, 0, 0.7) !important; background: linear-gradient(180deg, rgba(16, 16, 16, 0.75) 0%, rgba(16, 16, 16, 0) 100%);
-webkit-backdrop-filter: none !important; backdrop-filter: none;
backdrop-filter: none !important; color: #eee;
color: #eee !important; height: 7.5em;
} }
.osdHeader-hidden { .osdHeader-hidden {
opacity: 0; opacity: 0;
} }
.osdHeader .headerTop {
max-height: 3.5em;
}
.osdHeader .headerButton:not(.headerBackButton):not(.headerCastButton):not(.headerSyncButton) { .osdHeader .headerButton:not(.headerBackButton):not(.headerCastButton):not(.headerSyncButton) {
display: none; display: none;
} }
@ -86,34 +99,17 @@
opacity: 0.6; opacity: 0.6;
} }
.videoOsdBottom {
position: fixed;
background-color: rgba(0, 0, 0, 0.7);
padding: 1%;
display: -webkit-box;
display: -webkit-flex;
display: flex;
-webkit-box-orient: horizontal;
-webkit-box-direction: normal;
-webkit-flex-direction: row;
flex-direction: row;
will-change: opacity;
-webkit-transition: opacity 0.3s ease-out;
-o-transition: opacity 0.3s ease-out;
transition: opacity 0.3s ease-out;
color: #fff;
user-select: none;
-webkit-touch-callout: none;
}
.videoOsdBottom-hidden { .videoOsdBottom-hidden {
opacity: 0; opacity: 0;
} }
.osdControls { .osdControls {
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
flex-grow: 1; flex-grow: 1;
padding: 0 0.8em;
}
.layout-desktop .osdControls {
max-width: calc(100vh * 1.77 - 2vh);
} }
.videoOsdBottom .buttons { .videoOsdBottom .buttons {
@ -145,7 +141,7 @@
} }
.volumeButtons { .volumeButtons {
margin: 0 0.5em 0 auto; margin: 0 1em 0 0.29em;
display: flex; display: flex;
-webkit-align-items: center; -webkit-align-items: center;
align-items: center; align-items: center;
@ -153,33 +149,13 @@
.osdTimeText { .osdTimeText {
margin-left: 1em; margin-left: 1em;
margin-right: auto;
-webkit-user-select: none; -webkit-user-select: none;
-moz-user-select: none; -moz-user-select: none;
-ms-user-select: none; -ms-user-select: none;
user-select: none; user-select: none;
} }
.osdPoster {
width: 10%;
position: relative;
margin-right: 0.5em;
}
.osdPoster img {
position: absolute;
height: auto;
width: 100%;
-webkit-box-shadow: 0 0 1.9vh #000;
box-shadow: 0 0 1.9vh #000;
border: 0.08em solid #222;
user-drag: none;
user-select: none;
-moz-user-select: none;
-webkit-user-drag: none;
-webkit-user-select: none;
-ms-user-select: none;
}
.osdTitle, .osdTitle,
.osdTitleSmall { .osdTitleSmall {
margin: 0 1em 0 0; margin: 0 1em 0 0;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Before After
Before After

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Before After
Before After

View file

@ -182,7 +182,7 @@ _define('appStorage', function () {
}); });
// libarchive.js // libarchive.js
var libarchive = require('libarchive.js'); const libarchive = require('libarchive.js');
_define('libarchive', function () { _define('libarchive', function () {
return libarchive; return libarchive;
}); });

View file

@ -4,7 +4,6 @@ import dom from 'dom';
import * as datefns from 'date-fns'; import * as datefns from 'date-fns';
import dfnshelper from 'dfnshelper'; import dfnshelper from 'dfnshelper';
import serverNotifications from 'serverNotifications'; import serverNotifications from 'serverNotifications';
import connectionManager from 'connectionManager';
import 'emby-button'; import 'emby-button';
import 'listViewStyle'; import 'listViewStyle';
@ -141,7 +140,7 @@ class ActivityLog {
const element = options.element; const element = options.element;
element.classList.add('activityLogListWidget'); element.classList.add('activityLogListWidget');
element.addEventListener('click', onListClick.bind(this)); element.addEventListener('click', onListClick.bind(this));
const apiClient = connectionManager.getApiClient(options.serverId); const apiClient = window.connectionManager.getApiClient(options.serverId);
reloadData(this, element, apiClient); reloadData(this, element, apiClient);
const onUpdate = onActivityLogUpdate.bind(this); const onUpdate = onActivityLogUpdate.bind(this);
this.updateFn = onUpdate; this.updateFn = onUpdate;
@ -153,7 +152,7 @@ class ActivityLog {
if (options) { if (options) {
options.element.classList.remove('activityLogListWidget'); options.element.classList.remove('activityLogListWidget');
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500'); window.connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
} }
const onUpdate = this.updateFn; const onUpdate = this.updateFn;

View file

@ -27,7 +27,7 @@ class appFooter {
}; };
} }
destroy() { destroy() {
var self = this; const self = this;
self.element = null; self.element = null;
} }

View file

@ -2,7 +2,6 @@ import appHost from 'apphost';
import appSettings from 'appSettings'; import appSettings from 'appSettings';
import backdrop from 'backdrop'; import backdrop from 'backdrop';
import browser from 'browser'; import browser from 'browser';
import connectionManager from 'connectionManager';
import events from 'events'; import events from 'events';
import globalize from 'globalize'; import globalize from 'globalize';
import itemHelper from 'itemHelper'; import itemHelper from 'itemHelper';
@ -95,7 +94,7 @@ class AppRouter {
beginConnectionWizard() { beginConnectionWizard() {
backdrop.clearBackdrop(); backdrop.clearBackdrop();
loading.show(); loading.show();
connectionManager.connect({ window.connectionManager.connect({
enableAutoLogin: appSettings.enableAutoLogin() enableAutoLogin: appSettings.enableAutoLogin()
}).then((result) => { }).then((result) => {
this.handleConnectionResult(result); this.handleConnectionResult(result);
@ -154,7 +153,7 @@ class AppRouter {
events.on(appHost, 'beforeexit', this.onBeforeExit); events.on(appHost, 'beforeexit', this.onBeforeExit);
events.on(appHost, 'resume', this.onAppResume); events.on(appHost, 'resume', this.onAppResume);
connectionManager.connect({ window.connectionManager.connect({
enableAutoLogin: appSettings.enableAutoLogin() enableAutoLogin: appSettings.enableAutoLogin()
}).then((result) => { }).then((result) => {
this.firstConnectionResult = result; this.firstConnectionResult = result;
@ -210,7 +209,7 @@ class AppRouter {
showItem(item, serverId, options) { showItem(item, serverId, options) {
// TODO: Refactor this so it only gets items, not strings. // TODO: Refactor this so it only gets items, not strings.
if (typeof (item) === 'string') { if (typeof (item) === 'string') {
const apiClient = serverId ? connectionManager.getApiClient(serverId) : connectionManager.currentApiClient(); const apiClient = serverId ? window.connectionManager.getApiClient(serverId) : window.connectionManager.currentApiClient();
apiClient.getItem(apiClient.getCurrentUserId(), item).then((itemObject) => { apiClient.getItem(apiClient.getCurrentUserId(), item).then((itemObject) => {
this.showItem(itemObject, options); this.showItem(itemObject, options);
}); });
@ -309,7 +308,9 @@ class AppRouter {
url = route.contentPath || route.path; url = route.contentPath || route.path;
} }
if (url.indexOf('://') === -1) { if (url.includes('configurationpage')) {
url = ApiClient.getUrl('/web' + url);
} else if (url.indexOf('://') === -1) {
// Put a slash at the beginning but make sure to avoid a double slash // Put a slash at the beginning but make sure to avoid a double slash
if (url.indexOf('/') !== 0) { if (url.indexOf('/') !== 0) {
url = '/' + url; url = '/' + url;
@ -492,15 +493,15 @@ class AppRouter {
} }
initApiClients() { initApiClients() {
connectionManager.getApiClients().forEach((apiClient) => { window.connectionManager.getApiClients().forEach((apiClient) => {
this.initApiClient(apiClient, this); this.initApiClient(apiClient, this);
}); });
events.on(connectionManager, 'apiclientcreated', this.onApiClientCreated); events.on(window.connectionManager, 'apiclientcreated', this.onApiClientCreated);
} }
onAppResume() { onAppResume() {
const apiClient = connectionManager.currentApiClient(); const apiClient = window.connectionManager.currentApiClient();
if (apiClient) { if (apiClient) {
apiClient.ensureWebSocket(); apiClient.ensureWebSocket();
@ -518,7 +519,7 @@ class AppRouter {
} }
} }
const apiClient = connectionManager.currentApiClient(); const apiClient = window.connectionManager.currentApiClient();
const pathname = ctx.pathname.toLowerCase(); const pathname = ctx.pathname.toLowerCase();
console.debug('appRouter - processing path request ' + pathname); console.debug('appRouter - processing path request ' + pathname);

View file

@ -78,7 +78,7 @@ function getDeviceId() {
} }
function getDeviceName() { function getDeviceName() {
var deviceName; let deviceName;
if (browser.tizen) { if (browser.tizen) {
deviceName = 'Samsung Smart TV'; deviceName = 'Samsung Smart TV';
} else if (browser.web0s) { } else if (browser.web0s) {

View file

@ -1,5 +1,4 @@
import browser from 'browser'; import browser from 'browser';
import connectionManager from 'connectionManager';
import playbackManager from 'playbackManager'; import playbackManager from 'playbackManager';
import dom from 'dom'; import dom from 'dom';
import * as userSettings from 'userSettings'; import * as userSettings from 'userSettings';
@ -177,7 +176,7 @@ import 'css!./backdrop';
function getItemImageUrls(item, imageOptions) { function getItemImageUrls(item, imageOptions) {
imageOptions = imageOptions || {}; imageOptions = imageOptions || {};
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
if (item.BackdropImageTags && item.BackdropImageTags.length > 0) { if (item.BackdropImageTags && item.BackdropImageTags.length > 0) {
return item.BackdropImageTags.map((imgTag, index) => { return item.BackdropImageTags.map((imgTag, index) => {
return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, { return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, {

View file

@ -7,7 +7,6 @@
import datetime from 'datetime'; import datetime from 'datetime';
import imageLoader from 'imageLoader'; import imageLoader from 'imageLoader';
import connectionManager from 'connectionManager';
import itemHelper from 'itemHelper'; import itemHelper from 'itemHelper';
import focusManager from 'focusManager'; import focusManager from 'focusManager';
import indicators from 'indicators'; import indicators from 'indicators';
@ -371,7 +370,7 @@ import 'programStyles';
if (serverId !== lastServerId) { if (serverId !== lastServerId) {
lastServerId = serverId; lastServerId = serverId;
apiClient = connectionManager.getApiClient(lastServerId); apiClient = window.connectionManager.getApiClient(lastServerId);
} }
if (options.indexBy) { if (options.indexBy) {

View file

@ -7,7 +7,6 @@
import datetime from 'datetime'; import datetime from 'datetime';
import imageLoader from 'imageLoader'; import imageLoader from 'imageLoader';
import connectionManager from 'connectionManager';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import browser from 'browser'; import browser from 'browser';
@ -48,7 +47,7 @@ import browser from 'browser';
let html = ''; let html = '';
let itemsInRow = 0; let itemsInRow = 0;
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
for (let i = 0, length = chapters.length; i < length; i++) { for (let i = 0, length = chapters.length; i < length; i++) {
if (options.rows && itemsInRow === 0) { if (options.rows && itemsInRow === 0) {

View file

@ -1,7 +1,6 @@
import dom from 'dom'; import dom from 'dom';
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import loading from 'loading'; import loading from 'loading';
import connectionManager from 'connectionManager';
import globalize from 'globalize'; import globalize from 'globalize';
import actionsheet from 'actionsheet'; import actionsheet from 'actionsheet';
import 'emby-input'; import 'emby-input';
@ -16,7 +15,7 @@ export default class channelMapper {
function mapChannel(button, channelId, providerChannelId) { function mapChannel(button, channelId, providerChannelId) {
loading.show(); loading.show();
const providerId = options.providerId; const providerId = options.providerId;
connectionManager.getApiClient(options.serverId).ajax({ window.connectionManager.getApiClient(options.serverId).ajax({
type: 'POST', type: 'POST',
url: ApiClient.getUrl('LiveTv/ChannelMappings'), url: ApiClient.getUrl('LiveTv/ChannelMappings'),
data: JSON.stringify({ data: JSON.stringify({
@ -59,7 +58,7 @@ export default class channelMapper {
} }
function getChannelMappingOptions(serverId, providerId) { function getChannelMappingOptions(serverId, providerId) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
return apiClient.getJSON(apiClient.getUrl('LiveTv/ChannelMappingOptions', { return apiClient.getJSON(apiClient.getUrl('LiveTv/ChannelMappingOptions', {
providerId: providerId providerId: providerId
})); }));

View file

@ -2,7 +2,6 @@ import dom from 'dom';
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import loading from 'loading'; import loading from 'loading';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import connectionManager from 'connectionManager';
import appRouter from 'appRouter'; import appRouter from 'appRouter';
import globalize from 'globalize'; import globalize from 'globalize';
import 'emby-checkbox'; import 'emby-checkbox';
@ -25,7 +24,7 @@ import 'flexStyles';
const collectionId = panel.querySelector('#selectCollectionToAddTo').value; const collectionId = panel.querySelector('#selectCollectionToAddTo').value;
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
if (collectionId) { if (collectionId) {
addToCollection(apiClient, panel, collectionId); addToCollection(apiClient, panel, collectionId);
@ -106,7 +105,7 @@ import 'flexStyles';
EnableTotalRecordCount: false EnableTotalRecordCount: false
}; };
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => { apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
let html = ''; let html = '';

View file

@ -375,7 +375,7 @@ import 'scrollStyles';
dlg.setAttribute('data-lockscroll', 'true'); dlg.setAttribute('data-lockscroll', 'true');
} }
if (options.enableHistory !== false) { if (options.enableHistory === true) {
dlg.setAttribute('data-history', 'true'); dlg.setAttribute('data-history', 'true');
} }

View file

@ -6,7 +6,6 @@ import focusManager from 'focusManager';
import datetime from 'datetime'; import datetime from 'datetime';
import globalize from 'globalize'; import globalize from 'globalize';
import loading from 'loading'; import loading from 'loading';
import connectionManager from 'connectionManager';
import skinManager from 'skinManager'; import skinManager from 'skinManager';
import events from 'events'; import events from 'events';
import 'emby-select'; import 'emby-select';
@ -24,7 +23,7 @@ import 'emby-button';
}).join(''); }).join('');
// get default theme // get default theme
var defaultTheme = themes.find(theme => { const defaultTheme = themes.find(theme => {
return theme.default; return theme.default;
}); });
@ -182,7 +181,7 @@ import 'emby-button';
function onSubmit(e) { function onSubmit(e) {
const self = this; const self = this;
const apiClient = connectionManager.getApiClient(self.options.serverId); const apiClient = window.connectionManager.getApiClient(self.options.serverId);
const userId = self.options.userId; const userId = self.options.userId;
const userSettings = self.options.userSettings; const userSettings = self.options.userSettings;
@ -221,7 +220,7 @@ import 'emby-button';
loading.show(); loading.show();
const userId = self.options.userId; const userId = self.options.userId;
const apiClient = connectionManager.getApiClient(self.options.serverId); const apiClient = window.connectionManager.getApiClient(self.options.serverId);
const userSettings = self.options.userSettings; const userSettings = self.options.userSettings;
return apiClient.getUser(userId).then(user => { return apiClient.getUser(userId).then(user => {

View file

@ -28,21 +28,21 @@ import 'emby-itemscontainer';
function getSections() { function getSections() {
return [{ return [{
name: 'HeaderFavoriteMovies', name: 'Movies',
types: 'Movie', types: 'Movie',
id: 'favoriteMovies', id: 'favoriteMovies',
shape: getPosterShape(), shape: getPosterShape(),
showTitle: false, showTitle: false,
overlayPlayButton: true overlayPlayButton: true
}, { }, {
name: 'HeaderFavoriteShows', name: 'Shows',
types: 'Series', types: 'Series',
id: 'favoriteShows', id: 'favoriteShows',
shape: getPosterShape(), shape: getPosterShape(),
showTitle: false, showTitle: false,
overlayPlayButton: true overlayPlayButton: true
}, { }, {
name: 'HeaderFavoriteEpisodes', name: 'Episodes',
types: 'Episode', types: 'Episode',
id: 'favoriteEpisode', id: 'favoriteEpisode',
shape: getThumbShape(), shape: getThumbShape(),
@ -53,7 +53,7 @@ import 'emby-itemscontainer';
overlayText: false, overlayText: false,
centerText: true centerText: true
}, { }, {
name: 'HeaderFavoriteVideos', name: 'Videos',
types: 'Video,MusicVideo', types: 'Video,MusicVideo',
id: 'favoriteVideos', id: 'favoriteVideos',
shape: getThumbShape(), shape: getThumbShape(),
@ -63,7 +63,7 @@ import 'emby-itemscontainer';
overlayText: false, overlayText: false,
centerText: true centerText: true
}, { }, {
name: 'HeaderFavoriteArtists', name: 'Artists',
types: 'MusicArtist', types: 'MusicArtist',
id: 'favoriteArtists', id: 'favoriteArtists',
shape: getSquareShape(), shape: getSquareShape(),
@ -75,7 +75,7 @@ import 'emby-itemscontainer';
overlayPlayButton: true, overlayPlayButton: true,
coverImage: true coverImage: true
}, { }, {
name: 'HeaderFavoriteAlbums', name: 'Albums',
types: 'MusicAlbum', types: 'MusicAlbum',
id: 'favoriteAlbums', id: 'favoriteAlbums',
shape: getSquareShape(), shape: getSquareShape(),
@ -87,7 +87,7 @@ import 'emby-itemscontainer';
overlayPlayButton: true, overlayPlayButton: true,
coverImage: true coverImage: true
}, { }, {
name: 'HeaderFavoriteSongs', name: 'Songs',
types: 'Audio', types: 'Audio',
id: 'favoriteSongs', id: 'favoriteSongs',
shape: getSquareShape(), shape: getSquareShape(),

View file

@ -1,7 +1,6 @@
import dom from 'dom'; import dom from 'dom';
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import globalize from 'globalize'; import globalize from 'globalize';
import connectionManager from 'connectionManager';
import events from 'events'; import events from 'events';
import 'emby-checkbox'; import 'emby-checkbox';
import 'emby-collapse'; import 'emby-collapse';
@ -420,7 +419,7 @@ import 'css!./style.css';
this.bindEvents(dlg); this.bindEvents(dlg);
if (enableDynamicFilters(this.options.mode)) { if (enableDynamicFilters(this.options.mode)) {
dlg.classList.add('dynamicFilterDialog'); dlg.classList.add('dynamicFilterDialog');
const apiClient = connectionManager.getApiClient(this.options.serverId); const apiClient = window.connectionManager.getApiClient(this.options.serverId);
loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), this.options.query); loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), this.options.query);
} }
}); });

View file

@ -6,12 +6,12 @@
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard" <input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
data-filter="IsPlayed" /> data-filter="IsPlayed" />
<span>${OptionPlayed}</span> <span>${Played}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard" <input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
data-filter="IsUnPlayed" /> data-filter="IsUnPlayed" />
<span>${OptionUnplayed}</span> <span>${Unplayed}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard" <input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
@ -21,7 +21,7 @@
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkFavorite" <input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkFavorite"
data-filter="IsFavorite" /> data-filter="IsFavorite" />
<span>${OptionFavorite}</span> <span>${Favorites}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkLikes" data-filter="Likes" /> <input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkLikes" data-filter="Likes" />
@ -53,11 +53,11 @@
<div class="checkboxList"> <div class="checkboxList">
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Continuing" /> <input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Continuing" />
<span>${OptionContinuing}</span> <span>${Continuing}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Ended" /> <input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Ended" />
<span>${OptionEnded}</span> <span>${Ended}</span>
</label> </label>
</div> </div>
</div> </div>
@ -68,15 +68,15 @@
<div class="checkboxList"> <div class="checkboxList">
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSubtitle" /> <input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSubtitle" />
<span>${OptionHasSubtitles}</span> <span>${Subtitles}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkTrailer" /> <input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkTrailer" />
<span>${OptionHasTrailer}</span> <span>${ButtonTrailer}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSpecialFeature" /> <input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSpecialFeature" />
<span>${OptionHasSpecialFeatures}</span> <span>${SpecialFeatures}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkThemeSong" /> <input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkThemeSong" />

View file

@ -3,7 +3,6 @@ import focusManager from 'focusManager';
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import inputManager from 'inputManager'; import inputManager from 'inputManager';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import connectionManager from 'connectionManager';
import globalize from 'globalize'; import globalize from 'globalize';
import * as userSettings from 'userSettings'; import * as userSettings from 'userSettings';
import 'emby-checkbox'; import 'emby-checkbox';
@ -20,7 +19,7 @@ function onSubmit(e) {
return false; return false;
} }
function renderOptions(context, selector, cssClass, items, isCheckedFn) { function renderOptions(context, selector, cssClass, items, isCheckedFn) {
var elem = context.querySelector(selector); const elem = context.querySelector(selector);
if (items.length) { if (items.length) {
elem.classList.remove('hide'); elem.classList.remove('hide');
@ -28,12 +27,12 @@ function renderOptions(context, selector, cssClass, items, isCheckedFn) {
elem.classList.add('hide'); elem.classList.add('hide');
} }
var html = ''; let html = '';
html += items.map(function (filter) { html += items.map(function (filter) {
var itemHtml = ''; let itemHtml = '';
var checkedHtml = isCheckedFn(filter) ? ' checked' : ''; const checkedHtml = isCheckedFn(filter) ? ' checked' : '';
itemHtml += '<label>'; itemHtml += '<label>';
itemHtml += '<input is="emby-checkbox" type="checkbox"' + checkedHtml + ' data-filter="' + filter.Id + '" class="' + cssClass + '"/>'; itemHtml += '<input is="emby-checkbox" type="checkbox"' + checkedHtml + ' data-filter="' + filter.Id + '" class="' + cssClass + '"/>';
itemHtml += '<span>' + filter.Name + '</span>'; itemHtml += '<span>' + filter.Name + '</span>';
@ -48,21 +47,21 @@ function renderOptions(context, selector, cssClass, items, isCheckedFn) {
function renderDynamicFilters(context, result, options) { function renderDynamicFilters(context, result, options) {
renderOptions(context, '.genreFilters', 'chkGenreFilter', result.Genres, function (i) { renderOptions(context, '.genreFilters', 'chkGenreFilter', result.Genres, function (i) {
// Switching from | to , // Switching from | to ,
var delimeter = (options.settings.GenreIds || '').indexOf('|') === -1 ? ',' : '|'; const delimeter = (options.settings.GenreIds || '').indexOf('|') === -1 ? ',' : '|';
return (delimeter + (options.settings.GenreIds || '') + delimeter).indexOf(delimeter + i.Id + delimeter) !== -1; return (delimeter + (options.settings.GenreIds || '') + delimeter).indexOf(delimeter + i.Id + delimeter) !== -1;
}); });
} }
function setBasicFilter(context, key, elem) { function setBasicFilter(context, key, elem) {
var value = elem.checked; let value = elem.checked;
value = value ? value : null; value = value ? value : null;
userSettings.setFilter(key, value); userSettings.setFilter(key, value);
} }
function moveCheckboxFocus(elem, offset) { function moveCheckboxFocus(elem, offset) {
var parent = dom.parentWithClass(elem, 'checkboxList-verticalwrap'); const parent = dom.parentWithClass(elem, 'checkboxList-verticalwrap');
var elems = focusManager.getFocusableElements(parent); const elems = focusManager.getFocusableElements(parent);
var index = -1; let index = -1;
for (let i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
if (elems[i] === elem) { if (elems[i] === elem) {
index = i; index = i;
@ -75,14 +74,14 @@ function moveCheckboxFocus(elem, offset) {
index = Math.min(elems.length - 1, index); index = Math.min(elems.length - 1, index);
index = Math.max(0, index); index = Math.max(0, index);
var newElem = elems[index]; const newElem = elems[index];
if (newElem) { if (newElem) {
focusManager.focus(newElem); focusManager.focus(newElem);
} }
} }
function centerFocus(elem, horiz, on) { function centerFocus(elem, horiz, on) {
import('scrollHelper').then(({ default: scrollHelper }) => { import('scrollHelper').then(({ default: scrollHelper }) => {
var fn = on ? 'on' : 'off'; const fn = on ? 'on' : 'off';
scrollHelper.centerFocus[fn](elem, horiz); scrollHelper.centerFocus[fn](elem, horiz);
}); });
} }
@ -101,7 +100,7 @@ function onInputCommand(e) {
} }
} }
function saveValues(context, settings, settingsKey) { function saveValues(context, settings, settingsKey) {
var elems = context.querySelectorAll('.simpleFilter'); let elems = context.querySelectorAll('.simpleFilter');
for (let i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
if (elems[i].tagName === 'INPUT') { if (elems[i].tagName === 'INPUT') {
setBasicFilter(context, settingsKey + '-filter-' + elems[i].getAttribute('data-settingname'), elems[i]); setBasicFilter(context, settingsKey + '-filter-' + elems[i].getAttribute('data-settingname'), elems[i]);
@ -111,7 +110,7 @@ function saveValues(context, settings, settingsKey) {
} }
// Video type // Video type
var videoTypes = []; const videoTypes = [];
elems = context.querySelectorAll('.chkVideoTypeFilter'); elems = context.querySelectorAll('.chkVideoTypeFilter');
for (let i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
@ -122,7 +121,7 @@ function saveValues(context, settings, settingsKey) {
userSettings.setFilter(settingsKey + '-filter-VideoTypes', videoTypes.join(',')); userSettings.setFilter(settingsKey + '-filter-VideoTypes', videoTypes.join(','));
// Series status // Series status
var seriesStatuses = []; const seriesStatuses = [];
elems = context.querySelectorAll('.chkSeriesStatus'); elems = context.querySelectorAll('.chkSeriesStatus');
for (let i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
@ -132,7 +131,7 @@ function saveValues(context, settings, settingsKey) {
} }
// Genres // Genres
var genres = []; const genres = [];
elems = context.querySelectorAll('.chkGenreFilter'); elems = context.querySelectorAll('.chkGenreFilter');
for (let i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
@ -143,7 +142,7 @@ function saveValues(context, settings, settingsKey) {
userSettings.setFilter(settingsKey + '-filter-GenreIds', genres.join(',')); userSettings.setFilter(settingsKey + '-filter-GenreIds', genres.join(','));
} }
function bindCheckboxInput(context, on) { function bindCheckboxInput(context, on) {
var elems = context.querySelectorAll('.checkboxList-verticalwrap'); const elems = context.querySelectorAll('.checkboxList-verticalwrap');
for (let i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
if (on) { if (on) {
inputManager.on(elems[i], onInputCommand); inputManager.on(elems[i], onInputCommand);
@ -155,9 +154,9 @@ function bindCheckboxInput(context, on) {
function initEditor(context, settings) { function initEditor(context, settings) {
context.querySelector('form').addEventListener('submit', onSubmit); context.querySelector('form').addEventListener('submit', onSubmit);
var elems = context.querySelectorAll('.simpleFilter'); let elems = context.querySelectorAll('.simpleFilter');
var i; let i;
var length; let length;
for (i = 0, length = elems.length; i < length; i++) { for (i = 0, length = elems.length; i < length; i++) {
if (elems[i].tagName === 'INPUT') { if (elems[i].tagName === 'INPUT') {
@ -167,14 +166,14 @@ function initEditor(context, settings) {
} }
} }
var videoTypes = settings.VideoTypes ? settings.VideoTypes.split(',') : []; const videoTypes = settings.VideoTypes ? settings.VideoTypes.split(',') : [];
elems = context.querySelectorAll('.chkVideoTypeFilter'); elems = context.querySelectorAll('.chkVideoTypeFilter');
for (i = 0, length = elems.length; i < length; i++) { for (i = 0, length = elems.length; i < length; i++) {
elems[i].checked = videoTypes.indexOf(elems[i].getAttribute('data-filter')) !== -1; elems[i].checked = videoTypes.indexOf(elems[i].getAttribute('data-filter')) !== -1;
} }
var seriesStatuses = settings.SeriesStatus ? settings.SeriesStatus.split(',') : []; const seriesStatuses = settings.SeriesStatus ? settings.SeriesStatus.split(',') : [];
elems = context.querySelectorAll('.chkSeriesStatus'); elems = context.querySelectorAll('.chkSeriesStatus');
for (i = 0, length = elems.length; i < length; i++) { for (i = 0, length = elems.length; i < length; i++) {
@ -194,9 +193,9 @@ function initEditor(context, settings) {
} }
} }
function loadDynamicFilters(context, options) { function loadDynamicFilters(context, options) {
var apiClient = connectionManager.getApiClient(options.serverId); const apiClient = window.connectionManager.getApiClient(options.serverId);
var filterMenuOptions = Object.assign(options.filterMenuOptions, { const filterMenuOptions = Object.assign(options.filterMenuOptions, {
UserId: apiClient.getCurrentUserId(), UserId: apiClient.getCurrentUserId(),
ParentId: options.parentId, ParentId: options.parentId,
@ -211,7 +210,7 @@ class FilterMenu {
show(options) { show(options) {
return new Promise( (resolve, reject) => { return new Promise( (resolve, reject) => {
import('text!./filtermenu.template.html').then(({ default: template }) => { import('text!./filtermenu.template.html').then(({ default: template }) => {
var dialogOptions = { const dialogOptions = {
removeOnClose: true, removeOnClose: true,
scrollY: false scrollY: false
}; };
@ -221,11 +220,11 @@ class FilterMenu {
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>';
@ -237,7 +236,7 @@ class FilterMenu {
dlg.innerHTML = globalize.translateHtml(html, 'core'); dlg.innerHTML = globalize.translateHtml(html, 'core');
var settingElements = dlg.querySelectorAll('.viewSetting'); const settingElements = dlg.querySelectorAll('.viewSetting');
for (let i = 0, length = settingElements.length; i < length; i++) { for (let i = 0, length = settingElements.length; i < length; i++) {
if (options.visibleSettings.indexOf(settingElements[i].getAttribute('data-settingname')) === -1) { if (options.visibleSettings.indexOf(settingElements[i].getAttribute('data-settingname')) === -1) {
settingElements[i].classList.add('hide'); settingElements[i].classList.add('hide');
@ -258,7 +257,7 @@ class FilterMenu {
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;

View file

@ -3,7 +3,7 @@
import dom from 'dom'; import dom from 'dom';
import scrollManager from 'scrollManager'; import scrollManager from 'scrollManager';
var scopes = []; const scopes = [];
function pushScope(elem) { function pushScope(elem) {
scopes.push(elem); scopes.push(elem);
} }
@ -15,7 +15,7 @@ import scrollManager from 'scrollManager';
} }
function autoFocus(view, defaultToFirst, findAutoFocusElement) { function autoFocus(view, defaultToFirst, findAutoFocusElement) {
var element; let element;
if (findAutoFocusElement !== false) { if (findAutoFocusElement !== false) {
element = view.querySelector('*[autofocus]'); element = view.querySelector('*[autofocus]');
if (element) { if (element) {
@ -46,9 +46,9 @@ import scrollManager from 'scrollManager';
} }
} }
var focusableTagNames = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'A']; const focusableTagNames = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'A'];
var focusableContainerTagNames = ['BODY', 'DIALOG']; const focusableContainerTagNames = ['BODY', 'DIALOG'];
var focusableQuery = focusableTagNames.map(function (t) { const focusableQuery = focusableTagNames.map(function (t) {
if (t === 'INPUT') { if (t === 'INPUT') {
t += ':not([type="range"]):not([type="file"])'; t += ':not([type="range"]):not([type="file"])';
} }
@ -69,7 +69,7 @@ import scrollManager from 'scrollManager';
function normalizeFocusable(elem, originalElement) { function normalizeFocusable(elem, originalElement) {
if (elem) { if (elem) {
var tagName = elem.tagName; const tagName = elem.tagName;
if (!tagName || tagName === 'HTML' || tagName === 'BODY') { if (!tagName || tagName === 'HTML' || tagName === 'BODY') {
elem = originalElement; elem = originalElement;
} }
@ -79,10 +79,10 @@ import scrollManager from 'scrollManager';
} }
function focusableParent(elem) { function focusableParent(elem) {
var originalElement = elem; const originalElement = elem;
while (!isFocusable(elem)) { while (!isFocusable(elem)) {
var parent = elem.parentNode; const parent = elem.parentNode;
if (!parent) { if (!parent) {
return normalizeFocusable(elem, originalElement); return normalizeFocusable(elem, originalElement);
@ -115,7 +115,7 @@ import scrollManager from 'scrollManager';
} }
if (elem.tagName === 'INPUT') { if (elem.tagName === 'INPUT') {
var type = elem.type; const type = elem.type;
if (type === 'range') { if (type === 'range') {
return false; return false;
} }
@ -132,11 +132,11 @@ import scrollManager from 'scrollManager';
} }
function getFocusableElements(parent, limit, excludeClass) { function getFocusableElements(parent, limit, excludeClass) {
var elems = (parent || getDefaultScope()).querySelectorAll(focusableQuery); const elems = (parent || getDefaultScope()).querySelectorAll(focusableQuery);
var focusableElements = []; const focusableElements = [];
for (var i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
var elem = elems[i]; const elem = elems[i];
if (excludeClass && elem.classList.contains(excludeClass)) { if (excludeClass && elem.classList.contains(excludeClass)) {
continue; continue;
@ -159,7 +159,7 @@ import scrollManager from 'scrollManager';
return true; return true;
} }
var classList = elem.classList; const classList = elem.classList;
if (classList.contains('focuscontainer')) { if (classList.contains('focuscontainer')) {
return true; return true;
@ -208,7 +208,7 @@ import scrollManager from 'scrollManager';
} }
function getOffset(elem) { function getOffset(elem) {
var box; let box;
// Support: BlackBerry 5, iOS 3 (original iPhone) // Support: BlackBerry 5, iOS 3 (original iPhone)
// If we don't have gBCR, just use 0,0 rather than error // If we don't have gBCR, just use 0,0 rather than error
@ -225,7 +225,7 @@ import scrollManager from 'scrollManager';
if (box.right === null) { if (box.right === null) {
// Create a new object because some browsers will throw an error when trying to set data onto the Rect object // Create a new object because some browsers will throw an error when trying to set data onto the Rect object
var newBox = { const newBox = {
top: box.top, top: box.top,
left: box.left, left: box.left,
width: box.width, width: box.width,
@ -255,27 +255,27 @@ import scrollManager from 'scrollManager';
return; return;
} }
var focusableContainer = dom.parentWithClass(activeElement, 'focusable'); const focusableContainer = dom.parentWithClass(activeElement, 'focusable');
var rect = getOffset(activeElement); const rect = getOffset(activeElement);
// Get elements and work out x/y points // Get elements and work out x/y points
var point1x = parseFloat(rect.left) || 0; const point1x = parseFloat(rect.left) || 0;
var point1y = parseFloat(rect.top) || 0; const point1y = parseFloat(rect.top) || 0;
var point2x = parseFloat(point1x + rect.width - 1) || point1x; const point2x = parseFloat(point1x + rect.width - 1) || point1x;
var point2y = parseFloat(point1y + rect.height - 1) || point1y; const point2y = parseFloat(point1y + rect.height - 1) || point1y;
var sourceMidX = rect.left + (rect.width / 2); const sourceMidX = rect.left + (rect.width / 2);
var sourceMidY = rect.top + (rect.height / 2); const sourceMidY = rect.top + (rect.height / 2);
var focusable = focusableElements || container.querySelectorAll(focusableQuery); const focusable = focusableElements || container.querySelectorAll(focusableQuery);
var maxDistance = Infinity; const maxDistance = Infinity;
var minDistance = maxDistance; let minDistance = maxDistance;
var nearestElement; let nearestElement;
for (var i = 0, length = focusable.length; i < length; i++) { for (let i = 0, length = focusable.length; i < length; i++) {
var curr = focusable[i]; const curr = focusable[i];
if (curr === activeElement) { if (curr === activeElement) {
continue; continue;
@ -285,7 +285,7 @@ import scrollManager from 'scrollManager';
continue; continue;
} }
var elementRect = getOffset(curr); const elementRect = getOffset(curr);
// not currently visible // not currently visible
if (!elementRect.width && !elementRect.height) { if (!elementRect.width && !elementRect.height) {
@ -333,19 +333,19 @@ import scrollManager from 'scrollManager';
break; break;
} }
var x = elementRect.left; const x = elementRect.left;
var y = elementRect.top; const y = elementRect.top;
var x2 = x + elementRect.width - 1; const x2 = x + elementRect.width - 1;
var y2 = y + elementRect.height - 1; const y2 = y + elementRect.height - 1;
var intersectX = intersects(point1x, point2x, x, x2); const intersectX = intersects(point1x, point2x, x, x2);
var intersectY = intersects(point1y, point2y, y, y2); const intersectY = intersects(point1y, point2y, y, y2);
var midX = elementRect.left + (elementRect.width / 2); const midX = elementRect.left + (elementRect.width / 2);
var midY = elementRect.top + (elementRect.height / 2); const midY = elementRect.top + (elementRect.height / 2);
var distX; let distX;
var distY; let distY;
switch (direction) { switch (direction) {
case 0: case 0:
@ -372,7 +372,7 @@ import scrollManager from 'scrollManager';
break; break;
} }
var dist = Math.sqrt(distX * distX + distY * distY); const dist = Math.sqrt(distX * distX + distY * distY);
if (dist < minDistance) { if (dist < minDistance) {
nearestElement = curr; nearestElement = curr;
@ -383,7 +383,7 @@ import scrollManager from 'scrollManager';
if (nearestElement) { if (nearestElement) {
// See if there's a focusable container, and if so, send the focus command to that // See if there's a focusable container, and if so, send the focus command to that
if (activeElement) { if (activeElement) {
var nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable'); const nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable');
if (nearestElementFocusableParent && nearestElementFocusableParent !== nearestElement) { if (nearestElementFocusableParent && nearestElementFocusableParent !== nearestElement) {
if (focusableContainer !== nearestElementFocusableParent) { if (focusableContainer !== nearestElementFocusableParent) {
nearestElement = nearestElementFocusableParent; nearestElement = nearestElementFocusableParent;
@ -403,16 +403,16 @@ import scrollManager from 'scrollManager';
} }
function sendText(text) { function sendText(text) {
var elem = document.activeElement; const elem = document.activeElement;
elem.value = text; elem.value = text;
} }
function focusFirst(container, focusableSelector) { function focusFirst(container, focusableSelector) {
var elems = container.querySelectorAll(focusableSelector); const elems = container.querySelectorAll(focusableSelector);
for (var i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
var elem = elems[i]; const elem = elems[i];
if (isCurrentlyFocusableInternal(elem)) { if (isCurrentlyFocusableInternal(elem)) {
focus(elem); focus(elem);
@ -422,10 +422,10 @@ import scrollManager from 'scrollManager';
} }
function focusLast(container, focusableSelector) { function focusLast(container, focusableSelector) {
var elems = [].slice.call(container.querySelectorAll(focusableSelector), 0).reverse(); const elems = [].slice.call(container.querySelectorAll(focusableSelector), 0).reverse();
for (var i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
var elem = elems[i]; const elem = elems[i];
if (isCurrentlyFocusableInternal(elem)) { if (isCurrentlyFocusableInternal(elem)) {
focus(elem); focus(elem);
@ -435,11 +435,11 @@ import scrollManager from 'scrollManager';
} }
function moveFocus(sourceElement, container, focusableSelector, offset) { function moveFocus(sourceElement, container, focusableSelector, offset) {
var elems = container.querySelectorAll(focusableSelector); const elems = container.querySelectorAll(focusableSelector);
var list = []; const list = [];
var i; let i;
var length; let length;
var elem; let elem;
for (i = 0, length = elems.length; i < length; i++) { for (i = 0, length = elems.length; i < length; i++) {
elem = elems[i]; elem = elems[i];
@ -449,7 +449,7 @@ import scrollManager from 'scrollManager';
} }
} }
var currentIndex = -1; let currentIndex = -1;
for (i = 0, length = list.length; i < length; i++) { for (i = 0, length = list.length; i < length; i++) {
elem = list[i]; elem = list[i];
@ -464,11 +464,11 @@ import scrollManager from 'scrollManager';
return; return;
} }
var newIndex = currentIndex + offset; let newIndex = currentIndex + offset;
newIndex = Math.max(0, newIndex); newIndex = Math.max(0, newIndex);
newIndex = Math.min(newIndex, list.length - 1); newIndex = Math.min(newIndex, list.length - 1);
var newElem = list[newIndex]; const newElem = list[newIndex];
if (newElem) { if (newElem) {
focus(newElem); focus(newElem);
} }
@ -482,23 +482,23 @@ export default {
focusableParent: focusableParent, focusableParent: focusableParent,
getFocusableElements: getFocusableElements, getFocusableElements: getFocusableElements,
moveLeft: function (sourceElement, options) { moveLeft: function (sourceElement, options) {
var container = options ? options.container : null; const container = options ? options.container : null;
var focusableElements = options ? options.focusableElements : null; const focusableElements = options ? options.focusableElements : null;
nav(sourceElement, 0, container, focusableElements); nav(sourceElement, 0, container, focusableElements);
}, },
moveRight: function (sourceElement, options) { moveRight: function (sourceElement, options) {
var container = options ? options.container : null; const container = options ? options.container : null;
var focusableElements = options ? options.focusableElements : null; const focusableElements = options ? options.focusableElements : null;
nav(sourceElement, 1, container, focusableElements); nav(sourceElement, 1, container, focusableElements);
}, },
moveUp: function (sourceElement, options) { moveUp: function (sourceElement, options) {
var container = options ? options.container : null; const container = options ? options.container : null;
var focusableElements = options ? options.focusableElements : null; const focusableElements = options ? options.focusableElements : null;
nav(sourceElement, 2, container, focusableElements); nav(sourceElement, 2, container, focusableElements);
}, },
moveDown: function (sourceElement, options) { moveDown: function (sourceElement, options) {
var container = options ? options.container : null; const container = options ? options.container : null;
var focusableElements = options ? options.focusableElements : null; const focusableElements = options ? options.focusableElements : null;
nav(sourceElement, 3, container, focusableElements); nav(sourceElement, 3, container, focusableElements);
}, },
sendText: sendText, sendText: sendText,

View file

@ -2,22 +2,21 @@
import dom from 'dom'; import dom from 'dom';
import appRouter from 'appRouter'; import appRouter from 'appRouter';
import connectionManager from 'connectionManager';
function onGroupedCardClick(e, card) { function onGroupedCardClick(e, card) {
var itemId = card.getAttribute('data-id'); const itemId = card.getAttribute('data-id');
var serverId = card.getAttribute('data-serverid'); const serverId = card.getAttribute('data-serverid');
var apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
var userId = apiClient.getCurrentUserId(); const userId = apiClient.getCurrentUserId();
var playedIndicator = card.querySelector('.playedIndicator'); const playedIndicator = card.querySelector('.playedIndicator');
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null; const playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
var options = { const options = {
Limit: parseInt(playedIndicatorHtml || '10'), Limit: parseInt(playedIndicatorHtml || '10'),
Fields: 'PrimaryImageAspectRatio,DateCreated', Fields: 'PrimaryImageAspectRatio,DateCreated',
ParentId: itemId, ParentId: itemId,
GroupItems: false GroupItems: false
}; };
var actionableParent = dom.parentWithTag(e.target, ['A', 'BUTTON', 'INPUT']); const actionableParent = dom.parentWithTag(e.target, ['A', 'BUTTON', 'INPUT']);
if (!actionableParent || actionableParent.classList.contains('cardContent')) { if (!actionableParent || actionableParent.classList.contains('cardContent')) {
apiClient.getJSON(apiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) { apiClient.getJSON(apiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
@ -25,7 +24,7 @@ import connectionManager from 'connectionManager';
return void appRouter.showItem(items[0]); return void appRouter.showItem(items[0]);
} }
var url = 'details?id=' + itemId + '&serverId=' + serverId; const url = 'details?id=' + itemId + '&serverId=' + serverId;
Dashboard.navigate(url); Dashboard.navigate(url);
}); });
e.stopPropagation(); e.stopPropagation();
@ -35,7 +34,7 @@ import connectionManager from 'connectionManager';
} }
export default function onItemsContainerClick(e) { export default function onItemsContainerClick(e) {
var groupedCard = dom.parentWithClass(e.target, 'groupedCard'); const groupedCard = dom.parentWithClass(e.target, 'groupedCard');
if (groupedCard) { if (groupedCard) {
onGroupedCardClick(e, groupedCard); onGroupedCardClick(e, groupedCard);

View file

@ -1,7 +1,6 @@
import inputManager from 'inputManager'; import inputManager from 'inputManager';
import browser from 'browser'; import browser from 'browser';
import globalize from 'globalize'; import globalize from 'globalize';
import connectionManager from 'connectionManager';
import scrollHelper from 'scrollHelper'; import scrollHelper from 'scrollHelper';
import serverNotifications from 'serverNotifications'; import serverNotifications from 'serverNotifications';
import loading from 'loading'; import loading from 'loading';
@ -213,7 +212,7 @@ function Guide(options) {
} }
function reloadGuide(context, newStartDate, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs, focusProgramOnRender) { function reloadGuide(context, newStartDate, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs, focusProgramOnRender) {
const apiClient = connectionManager.getApiClient(options.serverId); const apiClient = window.connectionManager.getApiClient(options.serverId);
const channelQuery = { const channelQuery = {
@ -873,7 +872,7 @@ function Guide(options) {
function reloadPage(page) { function reloadPage(page) {
showLoading(); showLoading();
const apiClient = connectionManager.getApiClient(options.serverId); const apiClient = window.connectionManager.getApiClient(options.serverId);
apiClient.getLiveTvGuideInfo().then(function (guideInfo) { apiClient.getLiveTvGuideInfo().then(function (guideInfo) {
setDateRange(page, guideInfo); setDateRange(page, guideInfo);

View file

@ -2,7 +2,6 @@ import layoutManager from 'layoutManager';
import focusManager from 'focusManager'; import focusManager from 'focusManager';
import globalize from 'globalize'; import globalize from 'globalize';
import loading from 'loading'; import loading from 'loading';
import connectionManager from 'connectionManager';
import homeSections from 'homeSections'; import homeSections from 'homeSections';
import dom from 'dom'; import dom from 'dom';
import events from 'events'; import events from 'events';
@ -76,26 +75,30 @@ import 'emby-checkbox';
value: 'suggestions' value: 'suggestions'
}); });
list.push({ list.push({
name: globalize.translate('Latest'), name: globalize.translate('Upcoming'),
value: 'latest' value: 'upcoming'
}); });
list.push({ list.push({
name: globalize.translate('Genres'), name: globalize.translate('Genres'),
value: 'genres' value: 'genres'
}); });
list.push({ list.push({
name: globalize.translate('Favorites'), name: globalize.translate('Networks'),
value: 'favorites' value: 'networks'
});
list.push({
name: globalize.translate('Episodes'),
value: 'episodes'
}); });
} else if (type === 'music') { } else if (type === 'music') {
list.push({ list.push({
name: globalize.translate('Suggestions'), name: globalize.translate('Albums'),
value: 'suggestions', value: 'albums',
isDefault: true isDefault: true
}); });
list.push({ list.push({
name: globalize.translate('Albums'), name: globalize.translate('Suggestions'),
value: 'albums' value: 'suggestions'
}); });
list.push({ list.push({
name: globalize.translate('HeaderAlbumArtists'), name: globalize.translate('HeaderAlbumArtists'),
@ -380,7 +383,7 @@ import 'emby-checkbox';
function onSubmit(e) { function onSubmit(e) {
const self = this; const self = this;
const apiClient = connectionManager.getApiClient(self.options.serverId); const apiClient = window.connectionManager.getApiClient(self.options.serverId);
const userId = self.options.userId; const userId = self.options.userId;
const userSettings = self.options.userSettings; const userSettings = self.options.userSettings;
@ -452,7 +455,7 @@ import 'emby-checkbox';
loading.show(); loading.show();
const userId = self.options.userId; const userId = self.options.userId;
const apiClient = connectionManager.getApiClient(self.options.serverId); const apiClient = window.connectionManager.getApiClient(self.options.serverId);
const userSettings = self.options.userSettings; const userSettings = self.options.userSettings;
apiClient.getUser(userId).then(user => { apiClient.getUser(userId).then(user => {

View file

@ -1,4 +1,3 @@
import connectionManager from 'connectionManager';
import cardBuilder from 'cardBuilder'; import cardBuilder from 'cardBuilder';
import dom from 'dom'; import dom from 'dom';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
@ -212,7 +211,7 @@ import 'css!./homesections';
function getFetchLatestItemsFn(serverId, parentId, collectionType) { function getFetchLatestItemsFn(serverId, parentId, collectionType) {
return function () { return function () {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
let limit = 16; let limit = 16;
if (enableScrollX()) { if (enableScrollX()) {
@ -368,7 +367,7 @@ import 'css!./homesections';
function getContinueWatchingFetchFn(serverId) { function getContinueWatchingFetchFn(serverId) {
return function () { return function () {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
const screenWidth = dom.getWindowSize().innerWidth; const screenWidth = dom.getWindowSize().innerWidth;
let limit; let limit;
@ -441,7 +440,7 @@ import 'css!./homesections';
function getContinueListeningFetchFn(serverId) { function getContinueListeningFetchFn(serverId) {
return function () { return function () {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
const screenWidth = dom.getWindowSize().innerWidth; const screenWidth = dom.getWindowSize().innerWidth;
let limit; let limit;
@ -514,7 +513,7 @@ import 'css!./homesections';
function getOnNowFetchFn(serverId) { function getOnNowFetchFn(serverId) {
return function () { return function () {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
return apiClient.getLiveTvRecommendedPrograms({ return apiClient.getLiveTvRecommendedPrograms({
userId: apiClient.getCurrentUserId(), userId: apiClient.getCurrentUserId(),
IsAiring: true, IsAiring: true,
@ -657,7 +656,7 @@ import 'css!./homesections';
function getNextUpFetchFn(serverId) { function getNextUpFetchFn(serverId) {
return function () { return function () {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
return apiClient.getNextUpEpisodes({ return apiClient.getNextUpEpisodes({
Limit: enableScrollX() ? 24 : 15, Limit: enableScrollX() ? 24 : 15,
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path', Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
@ -728,7 +727,7 @@ import 'css!./homesections';
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) { function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
return function () { return function () {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
return apiClient.getLiveTvRecordings({ return apiClient.getLiveTvRecordings({
userId: apiClient.getCurrentUserId(), userId: apiClient.getCurrentUserId(),
Limit: enableScrollX() ? 12 : 5, Limit: enableScrollX() ? 12 : 5,

View file

@ -23,7 +23,7 @@ import events from 'events';
} }
function canPlayNativeHls() { function canPlayNativeHls() {
var media = document.createElement('video'); const media = document.createElement('video');
if (media.canPlayType('application/x-mpegURL').replace(/no/, '') || if (media.canPlayType('application/x-mpegURL').replace(/no/, '') ||
media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, '')) { media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, '')) {
@ -71,16 +71,16 @@ import events from 'events';
return true; return true;
} }
var recoverDecodingErrorDate; let recoverDecodingErrorDate;
var recoverSwapAudioCodecDate; let recoverSwapAudioCodecDate;
export function handleHlsJsMediaError(instance, reject) { export function handleHlsJsMediaError(instance, reject) {
var hlsPlayer = instance._hlsPlayer; const hlsPlayer = instance._hlsPlayer;
if (!hlsPlayer) { if (!hlsPlayer) {
return; return;
} }
var now = Date.now(); let now = Date.now();
if (window.performance && window.performance.now) { if (window.performance && window.performance.now) {
now = performance.now(); // eslint-disable-line compat/compat now = performance.now(); // eslint-disable-line compat/compat
@ -136,7 +136,7 @@ import events from 'events';
} }
export function seekOnPlaybackStart(instance, element, ticks, onMediaReady) { export function seekOnPlaybackStart(instance, element, ticks, onMediaReady) {
var seconds = (ticks || 0) / 10000000; const seconds = (ticks || 0) / 10000000;
if (seconds) { if (seconds) {
// Appending #t=xxx to the query string doesn't seem to work with HLS // Appending #t=xxx to the query string doesn't seem to work with HLS
@ -148,8 +148,8 @@ import events from 'events';
if (onMediaReady) onMediaReady(); if (onMediaReady) onMediaReady();
} else { } else {
// update video player position when media is ready to be sought // update video player position when media is ready to be sought
var events = ['durationchange', 'loadeddata', 'play', 'loadedmetadata']; const events = ['durationchange', 'loadeddata', 'play', 'loadedmetadata'];
var onMediaChange = function(e) { const onMediaChange = function(e) {
if (element.currentTime === 0 && element.duration >= seconds) { if (element.currentTime === 0 && element.duration >= seconds) {
// seek only when video position is exactly zero, // seek only when video position is exactly zero,
// as this is true only if video hasn't started yet or // as this is true only if video hasn't started yet or
@ -173,10 +173,10 @@ import events from 'events';
export function applySrc(elem, src, options) { export function applySrc(elem, src, options) {
if (window.Windows && options.mediaSource && options.mediaSource.IsLocal) { if (window.Windows && options.mediaSource && options.mediaSource.IsLocal) {
return Windows.Storage.StorageFile.getFileFromPathAsync(options.url).then(function (file) { return Windows.Storage.StorageFile.getFileFromPathAsync(options.url).then(function (file) {
var playlist = new Windows.Media.Playback.MediaPlaybackList(); const playlist = new Windows.Media.Playback.MediaPlaybackList();
var source1 = Windows.Media.Core.MediaSource.createFromStorageFile(file); const source1 = Windows.Media.Core.MediaSource.createFromStorageFile(file);
var startTime = (options.playerStartPositionTicks || 0) / 10000; const startTime = (options.playerStartPositionTicks || 0) / 10000;
playlist.items.append(new Windows.Media.Playback.MediaPlaybackItem(source1, startTime)); playlist.items.append(new Windows.Media.Playback.MediaPlaybackItem(source1, startTime));
elem.src = URL.createObjectURL(playlist, { oneTimeOnly: true }); elem.src = URL.createObjectURL(playlist, { oneTimeOnly: true });
return Promise.resolve(); return Promise.resolve();
@ -194,11 +194,11 @@ import events from 'events';
export function playWithPromise(elem, onErrorFn) { export function playWithPromise(elem, onErrorFn) {
try { try {
var promise = elem.play(); const promise = elem.play();
if (promise && promise.then) { if (promise && promise.then) {
// Chrome now returns a promise // Chrome now returns a promise
return promise.catch(function (e) { return promise.catch(function (e) {
var errorName = (e.name || '').toLowerCase(); const errorName = (e.name || '').toLowerCase();
// safari uses aborterror // safari uses aborterror
if (errorName === 'notallowederror' || if (errorName === 'notallowederror' ||
errorName === 'aborterror') { errorName === 'aborterror') {
@ -219,7 +219,7 @@ import events from 'events';
} }
export function destroyCastPlayer(instance) { export function destroyCastPlayer(instance) {
var player = instance._castPlayer; const player = instance._castPlayer;
if (player) { if (player) {
try { try {
player.unload(); player.unload();
@ -232,7 +232,7 @@ import events from 'events';
} }
export function destroyHlsPlayer(instance) { export function destroyHlsPlayer(instance) {
var player = instance._hlsPlayer; const player = instance._hlsPlayer;
if (player) { if (player) {
try { try {
player.destroy(); player.destroy();
@ -245,7 +245,7 @@ import events from 'events';
} }
export function destroyFlvPlayer(instance) { export function destroyFlvPlayer(instance) {
var player = instance._flvPlayer; const player = instance._flvPlayer;
if (player) { if (player) {
try { try {
player.unload(); player.unload();
@ -322,9 +322,8 @@ import events from 'events';
break; break;
case Hls.ErrorTypes.MEDIA_ERROR: case Hls.ErrorTypes.MEDIA_ERROR:
console.debug('fatal media error encountered, try to recover'); console.debug('fatal media error encountered, try to recover');
var currentReject = reject; handleHlsJsMediaError(instance, reject);
reject = null; reject = null;
handleHlsJsMediaError(instance, currentReject);
break; break;
default: default:
@ -356,7 +355,7 @@ import events from 'events';
destroyFlvPlayer(instance); destroyFlvPlayer(instance);
destroyCastPlayer(instance); destroyCastPlayer(instance);
var stopInfo = { const stopInfo = {
src: instance._currentSrc src: instance._currentSrc
}; };
@ -368,20 +367,20 @@ import events from 'events';
} }
export function getBufferedRanges(instance, elem) { export function getBufferedRanges(instance, elem) {
var ranges = []; const ranges = [];
var seekable = elem.buffered || []; const seekable = elem.buffered || [];
var offset; let offset;
var currentPlayOptions = instance._currentPlayOptions; const currentPlayOptions = instance._currentPlayOptions;
if (currentPlayOptions) { if (currentPlayOptions) {
offset = currentPlayOptions.transcodingOffsetTicks; offset = currentPlayOptions.transcodingOffsetTicks;
} }
offset = offset || 0; offset = offset || 0;
for (var i = 0, length = seekable.length; i < length; i++) { for (let i = 0, length = seekable.length; i < length; i++) {
var start = seekable.start(i); let start = seekable.start(i);
var end = seekable.end(i); let end = seekable.end(i);
if (!isValidDuration(start)) { if (!isValidDuration(start)) {
start = 0; start = 0;

View file

@ -2,7 +2,6 @@ import dom from 'dom';
import loading from 'loading'; import loading from 'loading';
import appHost from 'apphost'; import appHost from 'apphost';
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import connectionManager from 'connectionManager';
import imageLoader from 'imageLoader'; import imageLoader from 'imageLoader';
import browser from 'browser'; import browser from 'browser';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
@ -317,7 +316,7 @@ import 'cardStyle';
loading.show(); loading.show();
import('text!./imageDownloader.template.html').then(({default: template}) => { import('text!./imageDownloader.template.html').then(({default: template}) => {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
currentItemId = itemId; currentItemId = itemId;
currentItemType = itemType; currentItemType = itemType;

View file

@ -93,7 +93,7 @@ import 'emby-input';
const response = await fetch('components/imageOptionsEditor/imageOptionsEditor.template.html'); const response = await fetch('components/imageOptionsEditor/imageOptionsEditor.template.html');
const template = await response.text(); const template = await response.text();
var dlg = dialogHelper.createDialog({ const dlg = dialogHelper.createDialog({
size: 'small', size: 'small',
removeOnClose: true, removeOnClose: true,
scrollY: false scrollY: false

View file

@ -15,41 +15,41 @@
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Primary" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Primary" />
<span>${OptionDownloadPrimaryImage}</span> <span>${Primary}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Art" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Art" />
<span>${OptionDownloadArtImage}</span> <span>${Art}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="BoxRear" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="BoxRear" />
<span>${OptionDownloadBackImage}</span> <span>${Back}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Banner" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Banner" />
<span>${OptionDownloadBannerImage}</span> <span>${Banner}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Box" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Box" />
<span>${OptionDownloadBoxImage}</span> <span>${Box}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Disc" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Disc" />
<span>${OptionDownloadDiscImage}</span> <span>${Disc}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Logo" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Logo" />
<span>${OptionDownloadLogoImage}</span> <span>${Logo}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Menu" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Menu" />
<span>${OptionDownloadMenuImage}</span> <span>${Menu}</span>
</label> </label>
<label> <label>
<input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Thumb" /> <input type="checkbox" is="emby-checkbox" class="imageType" data-imagetype="Thumb" />
<span>${OptionDownloadThumbImage}</span> <span>${Thumb}</span>
</label> </label>
</div> </div>
</div> </div>

View file

@ -6,7 +6,6 @@
*/ */
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import connectionManager from 'connectionManager';
import dom from 'dom'; import dom from 'dom';
import loading from 'loading'; import loading from 'loading';
import scrollHelper from 'scrollHelper'; import scrollHelper from 'scrollHelper';
@ -108,7 +107,7 @@ import 'css!./style';
return false; return false;
} }
connectionManager.getApiClient(currentServerId).uploadItemImage(currentItemId, imageType, file).then(() => { window.connectionManager.getApiClient(currentServerId).uploadItemImage(currentItemId, imageType, file).then(() => {
dlg.querySelector('#uploadImage').value = ''; dlg.querySelector('#uploadImage').value = '';
loading.hide(); loading.hide();

View file

@ -1,5 +1,4 @@
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import connectionManager from 'connectionManager';
import loading from 'loading'; import loading from 'loading';
import dom from 'dom'; import dom from 'dom';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
@ -36,10 +35,10 @@ import 'css!./imageeditor';
let apiClient; let apiClient;
if (item) { if (item) {
apiClient = connectionManager.getApiClient(item.ServerId); apiClient = window.connectionManager.getApiClient(item.ServerId);
reloadItem(page, item, apiClient, focusContext); reloadItem(page, item, apiClient, focusContext);
} else { } else {
apiClient = connectionManager.getApiClient(currentItem.ServerId); apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
apiClient.getItem(apiClient.getCurrentUserId(), currentItem.Id).then(function (item) { apiClient.getItem(apiClient.getCurrentUserId(), currentItem.Id).then(function (item) {
reloadItem(page, item, apiClient, focusContext); reloadItem(page, item, apiClient, focusContext);
}); });
@ -59,8 +58,8 @@ import 'css!./imageeditor';
currentItem = item; currentItem = item;
apiClient.getRemoteImageProviders(getBaseRemoteOptions()).then(function (providers) { apiClient.getRemoteImageProviders(getBaseRemoteOptions()).then(function (providers) {
var btnBrowseAllImages = page.querySelectorAll('.btnBrowseAllImages'); const btnBrowseAllImages = page.querySelectorAll('.btnBrowseAllImages');
for (var i = 0, length = btnBrowseAllImages.length; i < length; i++) { for (let i = 0, length = btnBrowseAllImages.length; i < length; i++) {
if (providers.length) { if (providers.length) {
btnBrowseAllImages[i].classList.remove('hide'); btnBrowseAllImages[i].classList.remove('hide');
} else { } else {
@ -293,7 +292,7 @@ import 'css!./imageeditor';
function showActionSheet(context, imageCard) { function showActionSheet(context, imageCard) {
const itemId = imageCard.getAttribute('data-id'); const itemId = imageCard.getAttribute('data-id');
const serverId = imageCard.getAttribute('data-serverid'); const serverId = imageCard.getAttribute('data-serverid');
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
const type = imageCard.getAttribute('data-imagetype'); const type = imageCard.getAttribute('data-imagetype');
const index = parseInt(imageCard.getAttribute('data-index')); const index = parseInt(imageCard.getAttribute('data-index'));
@ -404,7 +403,7 @@ import 'css!./imageeditor';
const type = this.getAttribute('data-imagetype'); const type = this.getAttribute('data-imagetype');
let index = this.getAttribute('data-index'); let index = this.getAttribute('data-index');
index = index === 'null' ? null : parseInt(index); index = index === 'null' ? null : parseInt(index);
const apiClient = connectionManager.getApiClient(currentItem.ServerId); const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
deleteImage(context, currentItem.Id, type, index, apiClient, true); deleteImage(context, currentItem.Id, type, index, apiClient, true);
}); });
@ -412,7 +411,7 @@ import 'css!./imageeditor';
const type = this.getAttribute('data-imagetype'); const type = this.getAttribute('data-imagetype');
const index = this.getAttribute('data-index'); const index = this.getAttribute('data-index');
const newIndex = this.getAttribute('data-newindex'); const newIndex = this.getAttribute('data-newindex');
const apiClient = connectionManager.getApiClient(currentItem.ServerId); const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
moveImage(context, apiClient, currentItem.Id, type, index, newIndex, dom.parentWithClass(this, 'itemsContainer')); moveImage(context, apiClient, currentItem.Id, type, index, newIndex, dom.parentWithClass(this, 'itemsContainer'));
}); });
} }
@ -424,7 +423,7 @@ import 'css!./imageeditor';
loading.show(); loading.show();
import('text!./imageeditor.template.html').then(({default: template}) => { import('text!./imageeditor.template.html').then(({default: template}) => {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) { apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
const dialogOptions = { const dialogOptions = {
removeOnClose: true removeOnClose: true

View file

@ -56,7 +56,7 @@ import 'css!./style';
throw new Error('entry cannot be null'); throw new Error('entry cannot be null');
} }
const target = entry.target; const target = entry.target;
var source = undefined; let source = undefined;
if (target) { if (target) {
source = target.getAttribute('data-src'); source = target.getAttribute('data-src');
@ -106,7 +106,7 @@ import 'css!./style';
} }
function emptyImageElement(elem) { function emptyImageElement(elem) {
var url; let url;
if (elem.tagName !== 'IMG') { if (elem.tagName !== 'IMG') {
url = elem.style.backgroundImage.slice(4, -1).replace(/"/g, ''); url = elem.style.backgroundImage.slice(4, -1).replace(/"/g, '');
@ -137,10 +137,10 @@ import 'css!./style';
} }
export function getPrimaryImageAspectRatio(items) { export function getPrimaryImageAspectRatio(items) {
var values = []; const values = [];
for (var i = 0, length = items.length; i < length; i++) { for (let i = 0, length = items.length; i < length; i++) {
var ratio = items[i].PrimaryImageAspectRatio || 0; const ratio = items[i].PrimaryImageAspectRatio || 0;
if (!ratio) { if (!ratio) {
continue; continue;
@ -158,9 +158,9 @@ import 'css!./style';
return a - b; return a - b;
}); });
var half = Math.floor(values.length / 2); const half = Math.floor(values.length / 2);
var result; let result;
if (values.length % 2) { if (values.length % 2) {
result = values[half]; result = values[half];
@ -169,13 +169,13 @@ import 'css!./style';
} }
// If really close to 2:3 (poster image), just return 2:3 // If really close to 2:3 (poster image), just return 2:3
var aspect2x3 = 2 / 3; const aspect2x3 = 2 / 3;
if (Math.abs(aspect2x3 - result) <= 0.15) { if (Math.abs(aspect2x3 - result) <= 0.15) {
return aspect2x3; return aspect2x3;
} }
// If really close to 16:9 (episode image), just return 16:9 // If really close to 16:9 (episode image), just return 16:9
var aspect16x9 = 16 / 9; const aspect16x9 = 16 / 9;
if (Math.abs(aspect16x9 - result) <= 0.2) { if (Math.abs(aspect16x9 - result) <= 0.2) {
return aspect16x9; return aspect16x9;
} }
@ -186,7 +186,7 @@ import 'css!./style';
} }
// If really close to 4:3 (poster image), just return 2:3 // If really close to 4:3 (poster image), just return 2:3
var aspect4x3 = 4 / 3; const aspect4x3 = 4 / 3;
if (Math.abs(aspect4x3 - result) <= 0.15) { if (Math.abs(aspect4x3 - result) <= 0.15) {
return aspect4x3; return aspect4x3;
} }
@ -195,8 +195,8 @@ import 'css!./style';
} }
export function fillImages(elems) { export function fillImages(elems) {
for (var i = 0, length = elems.length; i < length; i++) { for (let i = 0, length = elems.length; i < length; i++) {
var elem = elems[0]; const elem = elems[0];
fillImage(elem); fillImage(elem);
} }
} }

View file

@ -1,6 +1,5 @@
import appHost from 'apphost'; import appHost from 'apphost';
import globalize from 'globalize'; import globalize from 'globalize';
import connectionManager from 'connectionManager';
import itemHelper from 'itemHelper'; import itemHelper from 'itemHelper';
import appRouter from 'appRouter'; import appRouter from 'appRouter';
import playbackManager from 'playbackManager'; import playbackManager from 'playbackManager';
@ -330,7 +329,7 @@ import actionsheet from 'actionsheet';
function executeCommand(item, id, options) { function executeCommand(item, id, options) {
const itemId = item.Id; const itemId = item.Id;
const serverId = item.ServerId; const serverId = item.ServerId;
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
return new Promise(function (resolve, reject) { return new Promise(function (resolve, reject) {
switch (id) { switch (id) {

View file

@ -8,7 +8,6 @@
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import globalize from 'globalize'; import globalize from 'globalize';
import connectionManager from 'connectionManager';
import loading from 'loading'; import loading from 'loading';
import 'emby-select'; import 'emby-select';
import 'listViewStyle'; import 'listViewStyle';
@ -52,8 +51,22 @@ import 'flexStyles';
if (stream.Type === 'Data') { if (stream.Type === 'Data') {
continue; continue;
} }
html += '<div class="mediaInfoStream">'; html += '<div class="mediaInfoStream">';
const displayType = globalize.translate(`MediaInfoStreamType${stream.Type}`); let translateString;
switch (stream.Type) {
case 'Audio':
case 'Data':
case 'Subtitle':
case 'Video':
translateString = stream.Type;
break;
case 'EmbeddedImage':
translateString = 'Image';
break;
}
const displayType = globalize.translate(translateString);
html += `<h2 class="mediaInfoStreamType">${displayType}</h2>`; html += `<h2 class="mediaInfoStreamType">${displayType}</h2>`;
const attributes = []; const attributes = [];
if (stream.DisplayTitle) { if (stream.DisplayTitle) {
@ -107,6 +120,18 @@ import 'flexStyles';
if (stream.BitDepth) { if (stream.BitDepth) {
attributes.push(createAttribute(globalize.translate('MediaInfoBitDepth'), `${stream.BitDepth} bit`)); attributes.push(createAttribute(globalize.translate('MediaInfoBitDepth'), `${stream.BitDepth} bit`));
} }
if (stream.VideoRange) {
attributes.push(createAttribute(globalize.translate('MediaInfoVideoRange'), stream.VideoRange));
}
if (stream.ColorSpace) {
attributes.push(createAttribute(globalize.translate('MediaInfoColorSpace'), stream.ColorSpace));
}
if (stream.ColorTransfer) {
attributes.push(createAttribute(globalize.translate('MediaInfoColorTransfer'), stream.ColorTransfer));
}
if (stream.ColorPrimaries) {
attributes.push(createAttribute(globalize.translate('MediaInfoColorPrimaries'), stream.ColorPrimaries));
}
if (stream.PixelFormat) { if (stream.PixelFormat) {
attributes.push(createAttribute(globalize.translate('MediaInfoPixelFormat'), stream.PixelFormat)); attributes.push(createAttribute(globalize.translate('MediaInfoPixelFormat'), stream.PixelFormat));
} }
@ -137,7 +162,7 @@ import 'flexStyles';
} }
function loadMediaInfo(itemId, serverId, template) { function loadMediaInfo(itemId, serverId, template) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => { return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
const dialogOptions = { const dialogOptions = {
size: 'small', size: 'small',

View file

@ -7,7 +7,6 @@
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import loading from 'loading'; import loading from 'loading';
import connectionManager from 'connectionManager';
import globalize from 'globalize'; import globalize from 'globalize';
import scrollHelper from 'scrollHelper'; import scrollHelper from 'scrollHelper';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
@ -31,7 +30,7 @@ import 'cardStyle';
let currentSearchResult; let currentSearchResult;
function getApiClient() { function getApiClient() {
return connectionManager.getApiClient(currentServerId); return window.connectionManager.getApiClient(currentServerId);
} }
function searchForIdentificationResults(page) { function searchForIdentificationResults(page) {

View file

@ -399,12 +399,10 @@ import 'emby-input';
} }
if (contentType === 'tvshows') { if (contentType === 'tvshows') {
parent.querySelector('.chkImportMissingEpisodesContainer').classList.remove('hide');
parent.querySelector('.chkAutomaticallyGroupSeriesContainer').classList.remove('hide'); parent.querySelector('.chkAutomaticallyGroupSeriesContainer').classList.remove('hide');
parent.querySelector('.fldSeasonZeroDisplayName').classList.remove('hide'); parent.querySelector('.fldSeasonZeroDisplayName').classList.remove('hide');
parent.querySelector('#txtSeasonZeroName').setAttribute('required', 'required'); parent.querySelector('#txtSeasonZeroName').setAttribute('required', 'required');
} else { } else {
parent.querySelector('.chkImportMissingEpisodesContainer').classList.add('hide');
parent.querySelector('.chkAutomaticallyGroupSeriesContainer').classList.add('hide'); parent.querySelector('.chkAutomaticallyGroupSeriesContainer').classList.add('hide');
parent.querySelector('.fldSeasonZeroDisplayName').classList.add('hide'); parent.querySelector('.fldSeasonZeroDisplayName').classList.add('hide');
parent.querySelector('#txtSeasonZeroName').removeAttribute('required'); parent.querySelector('#txtSeasonZeroName').removeAttribute('required');
@ -511,7 +509,6 @@ import 'emby-input';
EnableChapterImageExtraction: parent.querySelector('.chkExtractChapterImages').checked, EnableChapterImageExtraction: parent.querySelector('.chkExtractChapterImages').checked,
DownloadImagesInAdvance: parent.querySelector('#chkDownloadImagesInAdvance').checked, DownloadImagesInAdvance: parent.querySelector('#chkDownloadImagesInAdvance').checked,
EnableInternetProviders: true, EnableInternetProviders: true,
ImportMissingEpisodes: parent.querySelector('#chkImportMissingEpisodes').checked,
SaveLocalMetadata: parent.querySelector('#chkSaveLocal').checked, SaveLocalMetadata: parent.querySelector('#chkSaveLocal').checked,
EnableAutomaticSeriesGrouping: parent.querySelector('.chkAutomaticallyGroupSeries').checked, EnableAutomaticSeriesGrouping: parent.querySelector('.chkAutomaticallyGroupSeries').checked,
PreferredMetadataLanguage: parent.querySelector('#selectLanguage').value, PreferredMetadataLanguage: parent.querySelector('#selectLanguage').value,
@ -569,7 +566,6 @@ import 'emby-input';
parent.querySelector('.chkExtractChapterImages').checked = options.EnableChapterImageExtraction; parent.querySelector('.chkExtractChapterImages').checked = options.EnableChapterImageExtraction;
parent.querySelector('#chkDownloadImagesInAdvance').checked = options.DownloadImagesInAdvance; parent.querySelector('#chkDownloadImagesInAdvance').checked = options.DownloadImagesInAdvance;
parent.querySelector('#chkSaveLocal').checked = options.SaveLocalMetadata; parent.querySelector('#chkSaveLocal').checked = options.SaveLocalMetadata;
parent.querySelector('#chkImportMissingEpisodes').checked = options.ImportMissingEpisodes;
parent.querySelector('.chkAutomaticallyGroupSeries').checked = options.EnableAutomaticSeriesGrouping; parent.querySelector('.chkAutomaticallyGroupSeries').checked = options.EnableAutomaticSeriesGrouping;
parent.querySelector('#chkEnableEmbeddedTitles').checked = options.EnableEmbeddedTitles; parent.querySelector('#chkEnableEmbeddedTitles').checked = options.EnableEmbeddedTitles;
parent.querySelector('#chkEnableEmbeddedEpisodeInfos').checked = options.EnableEmbeddedEpisodeInfos; parent.querySelector('#chkEnableEmbeddedEpisodeInfos').checked = options.EnableEmbeddedEpisodeInfos;

View file

@ -85,14 +85,6 @@
<div class="fieldDescription checkboxFieldDescription">${OptionAutomaticallyGroupSeriesHelp}</div> <div class="fieldDescription checkboxFieldDescription">${OptionAutomaticallyGroupSeriesHelp}</div>
</div> </div>
<div class="checkboxContainer checkboxContainer-withDescription hide chkImportMissingEpisodesContainer advanced">
<label>
<input is="emby-checkbox" type="checkbox" id="chkImportMissingEpisodes" />
<span>${DisplayMissingEpisodesWithinSeasons}</span>
</label>
<div class="fieldDescription checkboxFieldDescription">${ImportMissingEpisodesHelp}</div>
</div>
<div class="chapterSettingsSection hide"> <div class="chapterSettingsSection hide">
<h2>${HeaderChapterImages}</h2> <h2>${HeaderChapterImages}</h2>
<div class="checkboxContainer checkboxContainer-withDescription fldExtractChapterImages"> <div class="checkboxContainer checkboxContainer-withDescription fldExtractChapterImages">

View file

@ -185,6 +185,17 @@
.listItemBody { .listItemBody {
padding-right: 0.5em; padding-right: 0.5em;
} }
.listItemMediaInfo {
display: none;
}
}
@media all and (max-width: 40em) {
[data-type='Movie'] .listItemImage,
[data-type='Series'] .listItemImage {
display: none;
}
} }
.listItemImage-large-tv { .listItemImage-large-tv {

View file

@ -8,7 +8,6 @@
import itemHelper from 'itemHelper'; import itemHelper from 'itemHelper';
import mediaInfo from 'mediaInfo'; import mediaInfo from 'mediaInfo';
import indicators from 'indicators'; import indicators from 'indicators';
import connectionManager from 'connectionManager';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import globalize from 'globalize'; import globalize from 'globalize';
import datetime from 'datetime'; import datetime from 'datetime';
@ -77,7 +76,7 @@ import 'emby-playstatebutton';
} }
function getImageUrl(item, width) { function getImageUrl(item, width) {
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
let itemId; let itemId;
const options = { const options = {
@ -106,7 +105,7 @@ import 'emby-playstatebutton';
} }
function getChannelImageUrl(item, width) { function getChannelImageUrl(item, width) {
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
const options = { const options = {
maxWidth: width, maxWidth: width,
type: 'Primary' type: 'Primary'
@ -257,8 +256,8 @@ import 'emby-playstatebutton';
} }
if (options.image !== false) { if (options.image !== false) {
var imgUrl = options.imageSource === 'channel' ? getChannelImageUrl(item, downloadWidth) : getImageUrl(item, downloadWidth); const imgUrl = options.imageSource === 'channel' ? getChannelImageUrl(item, downloadWidth) : getImageUrl(item, downloadWidth);
var imageClass = isLargeStyle ? 'listItemImage listItemImage-large' : 'listItemImage'; let imageClass = isLargeStyle ? 'listItemImage listItemImage-large' : 'listItemImage';
if (isLargeStyle && layoutManager.tv) { if (isLargeStyle && layoutManager.tv) {
imageClass += ' listItemImage-large-tv'; imageClass += ' listItemImage-large-tv';

View file

@ -100,11 +100,10 @@ import 'emby-button';
return html; return html;
} }
export function getMediaInfoHtml(item, options) { export function getMediaInfoHtml(item, options = {}) {
let html = ''; let html = '';
const miscInfo = []; const miscInfo = [];
options = options || {};
let text; let text;
let date; let date;
let minutes; let minutes;
@ -289,7 +288,9 @@ import 'emby-button';
return getMediaInfoItem(m); return getMediaInfoItem(m);
}).join(''); }).join('');
html += getStarIconsHtml(item); if (options.starRating !== false) {
html += getStarIconsHtml(item);
}
if (item.HasSubtitles && options.subtitles !== false) { if (item.HasSubtitles && options.subtitles !== false) {
html += '<div class="mediaInfoItem mediaInfoText closedCaptionMediaInfoText">CC</div>'; html += '<div class="mediaInfoItem mediaInfoText closedCaptionMediaInfoText">CC</div>';
@ -418,9 +419,8 @@ import 'emby-button';
return false; return false;
} }
export function getPrimaryMediaInfoHtml(item, options) { export function getPrimaryMediaInfoHtml(item, options = {}) {
options = options || {}; if (options.interactive === undefined) {
if (options.interactive == null) {
options.interactive = false; options.interactive = false;
} }

View file

@ -4,7 +4,6 @@ import dialogHelper from 'dialogHelper';
import datetime from 'datetime'; import datetime from 'datetime';
import loading from 'loading'; import loading from 'loading';
import focusManager from 'focusManager'; import focusManager from 'focusManager';
import connectionManager from 'connectionManager';
import globalize from 'globalize'; import globalize from 'globalize';
import shell from 'shell'; import shell from 'shell';
import 'emby-checkbox'; import 'emby-checkbox';
@ -240,7 +239,7 @@ import 'flexStyles';
} }
function afterDeleted(context, item) { function afterDeleted(context, item) {
var parentId = item.ParentId || item.SeasonId || item.SeriesId; const parentId = item.ParentId || item.SeasonId || item.SeriesId;
if (parentId) { if (parentId) {
reload(context, parentId, item.ServerId); reload(context, parentId, item.ServerId);
@ -253,7 +252,7 @@ import 'flexStyles';
function showMoreMenu(context, button, user) { function showMoreMenu(context, button, user) {
import('itemContextMenu').then(({default: itemContextMenu}) => { import('itemContextMenu').then(({default: itemContextMenu}) => {
var item = currentItem; const item = currentItem;
itemContextMenu.show({ itemContextMenu.show({
item: item, item: item,
@ -290,7 +289,7 @@ import 'flexStyles';
} }
function getApiClient() { function getApiClient() {
return connectionManager.getApiClient(currentItem.ServerId); return window.connectionManager.getApiClient(currentItem.ServerId);
} }
function bindAll(elems, eventName, fn) { function bindAll(elems, eventName, fn) {
@ -370,7 +369,7 @@ import 'flexStyles';
} }
function getItem(itemId, serverId) { function getItem(itemId, serverId) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
if (itemId) { if (itemId) {
return apiClient.getItem(apiClient.getCurrentUserId(), itemId); return apiClient.getItem(apiClient.getCurrentUserId(), itemId);
@ -380,7 +379,7 @@ import 'flexStyles';
} }
function getEditorConfig(itemId, serverId) { function getEditorConfig(itemId, serverId) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
if (itemId) { if (itemId) {
return apiClient.getJSON(apiClient.getUrl('Items/' + itemId + '/MetadataEditor')); return apiClient.getJSON(apiClient.getUrl('Items/' + itemId + '/MetadataEditor'));
@ -1068,7 +1067,7 @@ import 'flexStyles';
currentContext = dlg; currentContext = dlg;
init(dlg, connectionManager.getApiClient(serverId)); init(dlg, window.connectionManager.getApiClient(serverId));
reload(dlg, itemId, serverId); reload(dlg, itemId, serverId);
}); });
@ -1095,7 +1094,7 @@ import 'flexStyles';
currentContext = elem; currentContext = elem;
init(elem, connectionManager.getApiClient(serverId)); init(elem, window.connectionManager.getApiClient(serverId));
reload(elem, itemId, serverId); reload(elem, itemId, serverId);
focusManager.autoFocus(elem); focusManager.autoFocus(elem);

View file

@ -251,7 +251,7 @@
</div> </div>
<br /> <br />
<div class="formDialogFooter"> <div class="formDialogFooter">
<button is="emby-button" class="raised button-cancel block btnCancel formDialogFooterItem"> <button is="emby-button" type="button" class="raised button-cancel block btnCancel formDialogFooterItem">
<span>${Cancel}</span> <span>${Cancel}</span>
</button> </button>
<button is="emby-button" type="submit" class="raised button-submit block btnSave formDialogFooterItem"> <button is="emby-button" type="submit" class="raised button-submit block btnSave formDialogFooterItem">

View file

@ -1,7 +1,6 @@
import browser from 'browser'; import browser from 'browser';
import appHost from 'apphost'; import appHost from 'apphost';
import loading from 'loading'; import loading from 'loading';
import connectionManager from 'connectionManager';
import globalize from 'globalize'; import globalize from 'globalize';
import dom from 'dom'; import dom from 'dom';
import 'css!./multiSelect'; import 'css!./multiSelect';
@ -170,7 +169,7 @@ import 'css!./multiSelect';
} }
function showMenuForSelectedItems(e) { function showMenuForSelectedItems(e) {
const apiClient = connectionManager.currentApiClient(); const apiClient = window.connectionManager.currentApiClient();
apiClient.getCurrentUser().then(user => { apiClient.getCurrentUser().then(user => {
const menuItems = []; const menuItems = [];

View file

@ -31,7 +31,7 @@ function closeAfter(notification, timeoutMs) {
function resetRegistration() { function resetRegistration() {
/* eslint-disable-next-line compat/compat */ /* eslint-disable-next-line compat/compat */
let serviceWorker = navigator.serviceWorker; const serviceWorker = navigator.serviceWorker;
if (serviceWorker) { if (serviceWorker) {
serviceWorker.ready.then(function (registration) { serviceWorker.ready.then(function (registration) {
serviceWorkerRegistration = registration; serviceWorkerRegistration = registration;
@ -47,7 +47,7 @@ function showPersistentNotification(title, options, timeoutMs) {
function showNonPersistentNotification(title, options, timeoutMs) { function showNonPersistentNotification(title, options, timeoutMs) {
try { try {
let notif = new Notification(title, options); /* eslint-disable-line compat/compat */ const notif = new Notification(title, options); /* eslint-disable-line compat/compat */
if (notif.show) { if (notif.show) {
notif.show(); notif.show();
@ -67,7 +67,7 @@ function showNonPersistentNotification(title, options, timeoutMs) {
} }
function showNotification(options, timeoutMs, apiClient) { function showNotification(options, timeoutMs, apiClient) {
let title = options.title; const title = options.title;
options.data = options.data || {}; options.data = options.data || {};
options.data.serverId = apiClient.serverInfo().Id; options.data.serverId = apiClient.serverInfo().Id;
@ -95,7 +95,7 @@ function showNewItemNotification(item, apiClient) {
body = item.SeriesName + ' - ' + body; body = item.SeriesName + ' - ' + body;
} }
let notification = { const notification = {
title: 'New ' + item.Type, title: 'New ' + item.Type,
body: body, body: body,
vibrate: true, vibrate: true,
@ -103,7 +103,7 @@ function showNewItemNotification(item, apiClient) {
data: {} data: {}
}; };
let imageTags = item.ImageTags || {}; const imageTags = item.ImageTags || {};
if (imageTags.Primary) { if (imageTags.Primary) {
notification.icon = apiClient.getScaledImageUrl(item.Id, { notification.icon = apiClient.getScaledImageUrl(item.Id, {
@ -117,7 +117,7 @@ function showNewItemNotification(item, apiClient) {
} }
function onLibraryChanged(data, apiClient) { function onLibraryChanged(data, apiClient) {
let newItems = data.ItemsAdded; const newItems = data.ItemsAdded;
if (!newItems.length) { if (!newItems.length) {
return; return;
@ -140,7 +140,7 @@ function onLibraryChanged(data, apiClient) {
EnableTotalRecordCount: false EnableTotalRecordCount: false
}).then(function (result) { }).then(function (result) {
let items = result.Items; const items = result.Items;
for (const item of items) { for (const item of items) {
showNewItemNotification(item, apiClient); showNewItemNotification(item, apiClient);
@ -159,7 +159,7 @@ function showPackageInstallNotification(apiClient, installation, status) {
return; return;
} }
let notification = { const notification = {
tag: 'install' + installation.Id, tag: 'install' + installation.Id,
data: {} data: {}
}; };
@ -188,12 +188,12 @@ function showPackageInstallNotification(apiClient, installation, status) {
} }
if (status === 'progress') { if (status === 'progress') {
let percentComplete = Math.round(installation.PercentComplete || 0); const percentComplete = Math.round(installation.PercentComplete || 0);
notification.body = percentComplete + '% complete.'; notification.body = percentComplete + '% complete.';
} }
let timeout = status === 'cancelled' ? 5000 : 0; const timeout = status === 'cancelled' ? 5000 : 0;
showNotification(notification, timeout, apiClient); showNotification(notification, timeout, apiClient);
}); });
@ -220,8 +220,8 @@ events.on(serverNotifications, 'PackageInstalling', function (e, apiClient, data
}); });
events.on(serverNotifications, 'ServerShuttingDown', function (e, apiClient, data) { events.on(serverNotifications, 'ServerShuttingDown', function (e, apiClient, data) {
let serverId = apiClient.serverInfo().Id; const serverId = apiClient.serverInfo().Id;
let notification = { const notification = {
tag: 'restart' + serverId, tag: 'restart' + serverId,
title: globalize.translate('ServerNameIsShuttingDown', apiClient.serverInfo().Name) title: globalize.translate('ServerNameIsShuttingDown', apiClient.serverInfo().Name)
}; };
@ -229,8 +229,8 @@ events.on(serverNotifications, 'ServerShuttingDown', function (e, apiClient, dat
}); });
events.on(serverNotifications, 'ServerRestarting', function (e, apiClient, data) { events.on(serverNotifications, 'ServerRestarting', function (e, apiClient, data) {
let serverId = apiClient.serverInfo().Id; const serverId = apiClient.serverInfo().Id;
let notification = { const notification = {
tag: 'restart' + serverId, tag: 'restart' + serverId,
title: globalize.translate('ServerNameIsRestarting', apiClient.serverInfo().Name) title: globalize.translate('ServerNameIsRestarting', apiClient.serverInfo().Name)
}; };
@ -238,8 +238,8 @@ events.on(serverNotifications, 'ServerRestarting', function (e, apiClient, data)
}); });
events.on(serverNotifications, 'RestartRequired', function (e, apiClient) { events.on(serverNotifications, 'RestartRequired', function (e, apiClient) {
let serverId = apiClient.serverInfo().Id; const serverId = apiClient.serverInfo().Id;
let notification = { const notification = {
tag: 'restart' + serverId, tag: 'restart' + serverId,
title: globalize.translate('PleaseRestartServerName', apiClient.serverInfo().Name) title: globalize.translate('PleaseRestartServerName', apiClient.serverInfo().Name)
}; };
@ -248,7 +248,7 @@ events.on(serverNotifications, 'RestartRequired', function (e, apiClient) {
[ [
{ {
action: 'restart', action: 'restart',
title: globalize.translate('ButtonRestart'), title: globalize.translate('Restart'),
icon: getIconUrl() icon: getIconUrl()
} }
]; ];

View file

@ -7,7 +7,6 @@ import playbackManager from 'playbackManager';
import nowPlayingHelper from 'nowPlayingHelper'; import nowPlayingHelper from 'nowPlayingHelper';
import appHost from 'apphost'; import appHost from 'apphost';
import dom from 'dom'; import dom from 'dom';
import connectionManager from 'connectionManager';
import itemContextMenu from 'itemContextMenu'; import itemContextMenu from 'itemContextMenu';
import 'paper-icon-button-light'; import 'paper-icon-button-light';
import 'emby-ratingbutton'; import 'emby-ratingbutton';
@ -452,7 +451,7 @@ import 'emby-ratingbutton';
if (item.SeriesPrimaryImageTag) { if (item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag; options.tag = item.SeriesPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} }
} }
@ -460,12 +459,12 @@ import 'emby-ratingbutton';
if (item.SeriesThumbImageTag) { if (item.SeriesThumbImageTag) {
options.tag = item.SeriesThumbImageTag; options.tag = item.SeriesThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} }
if (item.ParentThumbImageTag) { if (item.ParentThumbImageTag) {
options.tag = item.ParentThumbImageTag; options.tag = item.ParentThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
} }
} }
@ -482,12 +481,12 @@ import 'emby-ratingbutton';
if (item.ImageTags && item.ImageTags[options.type]) { if (item.ImageTags && item.ImageTags[options.type]) {
options.tag = item.ImageTags[options.type]; options.tag = item.ImageTags[options.type];
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
} }
if (item.AlbumId && item.AlbumPrimaryImageTag) { if (item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag; options.tag = item.AlbumPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
} }
return null; return null;
@ -548,7 +547,7 @@ import 'emby-ratingbutton';
if (nowPlayingItem.Id) { if (nowPlayingItem.Id) {
if (isRefreshing) { if (isRefreshing) {
const apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId); const apiClient = window.connectionManager.getApiClient(nowPlayingItem.ServerId);
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) { apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
const userData = item.UserData || {}; const userData = item.UserData || {};
const likes = userData.Likes == null ? '' : userData.Likes; const likes = userData.Likes == null ? '' : userData.Likes;
@ -583,7 +582,7 @@ import 'emby-ratingbutton';
function onPlaybackStart(e, state) { function onPlaybackStart(e, state) {
console.debug('nowplaying event: ' + e.type); console.debug('nowplaying event: ' + e.type);
var player = this; const player = this;
onStateChanged.call(player, e, state); onStateChanged.call(player, e, state);
} }

View file

@ -8,7 +8,7 @@ import pluginManager from 'pluginManager';
init() { init() {
console.groupCollapsed('loading packages'); console.groupCollapsed('loading packages');
var manifestUrls = JSON.parse(appSettings.get(this.#settingsKey) || '[]'); const manifestUrls = JSON.parse(appSettings.get(this.#settingsKey) || '[]');
return Promise.all(manifestUrls.map((url) => { return Promise.all(manifestUrls.map((url) => {
return this.loadPackage(url); return this.loadPackage(url);
@ -30,7 +30,7 @@ import pluginManager from 'pluginManager';
install(url) { install(url) {
return this.loadPackage(url, true).then((pkg) => { return this.loadPackage(url, true).then((pkg) => {
var manifestUrls = JSON.parse(appSettings.get(this.#settingsKey) || '[]'); const manifestUrls = JSON.parse(appSettings.get(this.#settingsKey) || '[]');
if (!manifestUrls.includes(url)) { if (!manifestUrls.includes(url)) {
manifestUrls.push(url); manifestUrls.push(url);
@ -42,7 +42,7 @@ import pluginManager from 'pluginManager';
} }
uninstall(name) { uninstall(name) {
var pkg = this.#packagesList.filter((p) => { const pkg = this.#packagesList.filter((p) => {
return p.name === name; return p.name === name;
})[0]; })[0];
@ -58,12 +58,12 @@ import pluginManager from 'pluginManager';
} }
mapPath(pkg, pluginUrl) { mapPath(pkg, pluginUrl) {
var urlLower = pluginUrl.toLowerCase(); const urlLower = pluginUrl.toLowerCase();
if (urlLower.startsWith('http:') || urlLower.startsWith('https:') || urlLower.startsWith('file:')) { if (urlLower.startsWith('http:') || urlLower.startsWith('https:') || urlLower.startsWith('file:')) {
return pluginUrl; return pluginUrl;
} }
var packageUrl = pkg.url; let packageUrl = pkg.url;
packageUrl = packageUrl.substring(0, packageUrl.lastIndexOf('/')); packageUrl = packageUrl.substring(0, packageUrl.lastIndexOf('/'));
packageUrl += '/'; packageUrl += '/';
@ -81,7 +81,7 @@ import pluginManager from 'pluginManager';
} }
removeUrl(url) { removeUrl(url) {
var manifestUrls = JSON.parse(appSettings.get(this.#settingsKey) || '[]'); let manifestUrls = JSON.parse(appSettings.get(this.#settingsKey) || '[]');
manifestUrls = manifestUrls.filter((i) => { manifestUrls = manifestUrls.filter((i) => {
return i !== url; return i !== url;
@ -92,14 +92,14 @@ import pluginManager from 'pluginManager';
loadPackage(url, throwError = false) { loadPackage(url, throwError = false) {
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
var xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
var originalUrl = url; const originalUrl = url;
url += url.indexOf('?') === -1 ? '?' : '&'; url += url.indexOf('?') === -1 ? '?' : '&';
url += 't=' + new Date().getTime(); url += 't=' + new Date().getTime();
xhr.open('GET', url, true); xhr.open('GET', url, true);
var onError = () => { const onError = () => {
if (throwError === true) { if (throwError === true) {
reject(); reject();
} else { } else {
@ -110,16 +110,16 @@ import pluginManager from 'pluginManager';
xhr.onload = () => { xhr.onload = () => {
if (this.status < 400) { if (this.status < 400) {
var pkg = JSON.parse(this.response); const pkg = JSON.parse(this.response);
pkg.url = originalUrl; pkg.url = originalUrl;
this.addPackage(pkg); this.addPackage(pkg);
var plugins = pkg.plugins || []; const plugins = pkg.plugins || [];
if (pkg.plugin) { if (pkg.plugin) {
plugins.push(pkg.plugin); plugins.push(pkg.plugin);
} }
var promises = plugins.map((pluginUrl) => { const promises = plugins.map((pluginUrl) => {
return pluginManager.loadPlugin(this.mapPath(pkg, pluginUrl)); return pluginManager.loadPlugin(this.mapPath(pkg, pluginUrl));
}); });
Promise.all(promises).then(resolve, resolve); Promise.all(promises).then(resolve, resolve);

View file

@ -5,15 +5,15 @@ import browser from 'browser';
import 'css!./iconosd'; import 'css!./iconosd';
import 'material-icons'; import 'material-icons';
var currentPlayer; let currentPlayer;
var osdElement; let osdElement;
var iconElement; let iconElement;
var progressElement; let progressElement;
var enableAnimation; let enableAnimation;
function getOsdElementHtml() { function getOsdElementHtml() {
var html = ''; let html = '';
html += '<span class="material-icons iconOsdIcon brightness_high"></span>'; html += '<span class="material-icons iconOsdIcon brightness_high"></span>';
@ -23,7 +23,7 @@ function getOsdElementHtml() {
} }
function ensureOsdElement() { function ensureOsdElement() {
var elem = osdElement; let elem = osdElement;
if (!elem) { if (!elem) {
enableAnimation = browser.supportsCssAnimation(); enableAnimation = browser.supportsCssAnimation();
@ -46,11 +46,11 @@ function onHideComplete() {
this.classList.add('hide'); this.classList.add('hide');
} }
var hideTimeout; let hideTimeout;
function showOsd() { function showOsd() {
clearHideTimeout(); clearHideTimeout();
var elem = osdElement; const elem = osdElement;
dom.removeEventListener(elem, dom.whichTransitionEvent(), onHideComplete, { dom.removeEventListener(elem, dom.whichTransitionEvent(), onHideComplete, {
once: true once: true
@ -78,7 +78,7 @@ function clearHideTimeout() {
function hideOsd() { function hideOsd() {
clearHideTimeout(); clearHideTimeout();
var elem = osdElement; const elem = osdElement;
if (elem) { if (elem) {
if (enableAnimation) { if (enableAnimation) {
// trigger reflow // trigger reflow
@ -118,7 +118,7 @@ function updateElementsFromPlayer(brightness) {
} }
function releaseCurrentPlayer() { function releaseCurrentPlayer() {
var player = currentPlayer; const player = currentPlayer;
if (player) { if (player) {
events.off(player, 'brightnesschange', onBrightnessChanged); events.off(player, 'brightnesschange', onBrightnessChanged);
@ -128,7 +128,7 @@ function releaseCurrentPlayer() {
} }
function onBrightnessChanged(e) { function onBrightnessChanged(e) {
var player = this; const player = this;
ensureOsdElement(); ensureOsdElement();

View file

@ -1,7 +1,7 @@
import playbackManager from 'playbackManager'; import playbackManager from 'playbackManager';
import nowPlayingHelper from 'nowPlayingHelper'; import nowPlayingHelper from 'nowPlayingHelper';
import shell from 'shell';
import events from 'events'; import events from 'events';
import connectionManager from 'connectionManager';
/* eslint-disable indent */ /* eslint-disable indent */
// Reports media playback to the device for lock screen control // Reports media playback to the device for lock screen control
@ -16,16 +16,16 @@ import connectionManager from 'connectionManager';
} else if (options.type === 'Primary' && item.SeriesPrimaryImageTag) { } else if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag; options.tag = item.SeriesPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} else if (options.type === 'Thumb') { } else if (options.type === 'Thumb') {
if (item.SeriesThumbImageTag) { if (item.SeriesThumbImageTag) {
options.tag = item.SeriesThumbImageTag; options.tag = item.SeriesThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} else if (item.ParentThumbImageTag) { } else if (item.ParentThumbImageTag) {
options.tag = item.ParentThumbImageTag; options.tag = item.ParentThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
} }
} }
@ -38,11 +38,11 @@ import connectionManager from 'connectionManager';
if (item.ImageTags && item.ImageTags[options.type]) { if (item.ImageTags && item.ImageTags[options.type]) {
options.tag = item.ImageTags[options.type]; options.tag = item.ImageTags[options.type];
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.Id, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.Id, options);
} else if (item.AlbumId && item.AlbumPrimaryImageTag) { } else if (item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag; options.tag = item.AlbumPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
} }
return null; return null;
@ -128,8 +128,7 @@ import connectionManager from 'connectionManager';
}); });
} else { } else {
const itemImageUrl = seriesImageUrl(item, { maxHeight: 3000 }) || imageUrl(item, { maxHeight: 3000 }); const itemImageUrl = seriesImageUrl(item, { maxHeight: 3000 }) || imageUrl(item, { maxHeight: 3000 });
shell.updateMediaSession({
window.NativeShell.updateMediaSession({
action: eventName, action: eventName,
isLocalPlayer: isLocalPlayer, isLocalPlayer: isLocalPlayer,
itemId: itemId, itemId: itemId,
@ -183,7 +182,7 @@ import connectionManager from 'connectionManager';
/* eslint-disable-next-line compat/compat */ /* eslint-disable-next-line compat/compat */
navigator.mediaSession.metadata = null; navigator.mediaSession.metadata = null;
} else { } else {
window.NativeShell.hideMediaSession(); shell.hideMediaSession();
} }
} }

View file

@ -1,7 +1,7 @@
export function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) { export function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) {
var topItem = nowPlayingItem; let topItem = nowPlayingItem;
var bottomItem = null; let bottomItem = null;
var topText = nowPlayingItem.Name; let topText = nowPlayingItem.Name;
if (nowPlayingItem.AlbumId && nowPlayingItem.MediaType === 'Audio') { if (nowPlayingItem.AlbumId && nowPlayingItem.MediaType === 'Audio') {
topItem = { topItem = {
@ -21,7 +21,7 @@ export function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) {
} }
} }
var bottomText = ''; let bottomText = '';
if (nowPlayingItem.ArtistItems && nowPlayingItem.ArtistItems.length) { if (nowPlayingItem.ArtistItems && nowPlayingItem.ArtistItems.length) {
bottomItem = { bottomItem = {
@ -56,7 +56,7 @@ export function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) {
bottomText = nowPlayingItem.ProductionYear; bottomText = nowPlayingItem.ProductionYear;
} }
var list = []; const list = [];
list.push({ list.push({
text: topText, text: topText,

View file

@ -6,7 +6,6 @@ import pluginManager from 'pluginManager';
import PlayQueueManager from 'playQueueManager'; import PlayQueueManager from 'playQueueManager';
import * as userSettings from 'userSettings'; import * as userSettings from 'userSettings';
import globalize from 'globalize'; import globalize from 'globalize';
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';
@ -69,7 +68,7 @@ function reportPlayback(playbackManagerInstance, state, player, reportPlaylist,
addPlaylistToPlaybackReport(playbackManagerInstance, info, player, serverId); addPlaylistToPlaybackReport(playbackManagerInstance, info, player, serverId);
} }
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
const reportPlaybackPromise = apiClient[method](info); const reportPlaybackPromise = apiClient[method](info);
// Notify that report has been sent // Notify that report has been sent
reportPlaybackPromise.then(() => { reportPlaybackPromise.then(() => {
@ -106,7 +105,7 @@ function normalizeName(t) {
} }
function getItemsForPlayback(serverId, query) { function getItemsForPlayback(serverId, query) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
if (query.Ids && query.Ids.split(',').length === 1) { if (query.Ids && query.Ids.split(',').length === 1) {
const itemId = query.Ids.split(','); const itemId = query.Ids.split(',');
@ -640,22 +639,18 @@ function supportsDirectPlay(apiClient, item, mediaSource) {
function validatePlaybackInfoResult(instance, result) { function validatePlaybackInfoResult(instance, result) {
if (result.ErrorCode) { if (result.ErrorCode) {
showPlaybackInfoErrorMessage(instance, result.ErrorCode); showPlaybackInfoErrorMessage(instance, 'PlaybackError' + result.ErrorCode);
return false; return false;
} }
return true; return true;
} }
function showPlaybackInfoErrorMessage(instance, errorCode, playNextTrack) { function showPlaybackInfoErrorMessage(instance, errorCode) {
import('alert').then(({ default: alert }) => { import('alert').then(({ default: alert }) => {
alert({ alert({
text: globalize.translate('PlaybackError' + errorCode), text: globalize.translate(errorCode),
title: globalize.translate('HeaderPlaybackError') title: globalize.translate('HeaderPlaybackError')
}).then(function () {
if (playNextTrack) {
instance.nextTrack();
}
}); });
}); });
} }
@ -874,7 +869,7 @@ class PlaybackManager {
const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets); const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets);
return Promise.all(promises).then(function (responses) { return Promise.all(promises).then(function (responses) {
return connectionManager.currentApiClient().getCurrentUser().then(function (user) { return window.connectionManager.currentApiClient().getCurrentUser().then(function (user) {
const targets = []; const targets = [];
targets.push({ targets.push({
@ -1115,8 +1110,8 @@ class PlaybackManager {
self.increasePlaybackRate = function (player) { self.increasePlaybackRate = function (player) {
player = player || self._currentPlayer; player = player || self._currentPlayer;
if (player) { if (player) {
let current = self.getPlaybackRate(player); const current = self.getPlaybackRate(player);
let supported = self.getSupportedPlaybackRates(player); const supported = self.getSupportedPlaybackRates(player);
let index = -1; let index = -1;
for (let i = 0, length = supported.length; i < length; i++) { for (let i = 0, length = supported.length; i < length; i++) {
@ -1134,8 +1129,8 @@ class PlaybackManager {
self.decreasePlaybackRate = function (player) { self.decreasePlaybackRate = function (player) {
player = player || self._currentPlayer; player = player || self._currentPlayer;
if (player) { if (player) {
let current = self.getPlaybackRate(player); const current = self.getPlaybackRate(player);
let supported = self.getSupportedPlaybackRates(player); const supported = self.getSupportedPlaybackRates(player);
let index = -1; let index = -1;
for (let i = 0, length = supported.length; i < length; i++) { for (let i = 0, length = supported.length; i < length; i++) {
@ -1372,7 +1367,7 @@ class PlaybackManager {
function getSavedMaxStreamingBitrate(apiClient, mediaType) { function getSavedMaxStreamingBitrate(apiClient, mediaType) {
if (!apiClient) { if (!apiClient) {
// This should hopefully never happen // This should hopefully never happen
apiClient = connectionManager.currentApiClient(); apiClient = window.connectionManager.currentApiClient();
} }
const endpointInfo = apiClient.getSavedEndpointInfo() || {}; const endpointInfo = apiClient.getSavedEndpointInfo() || {};
@ -1395,7 +1390,7 @@ class PlaybackManager {
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null; const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
const currentItem = self.currentItem(player); const currentItem = self.currentItem(player);
const apiClient = currentItem ? connectionManager.getApiClient(currentItem.ServerId) : connectionManager.currentApiClient(); const apiClient = currentItem ? window.connectionManager.getApiClient(currentItem.ServerId) : window.connectionManager.currentApiClient();
return getSavedMaxStreamingBitrate(apiClient, mediaType); return getSavedMaxStreamingBitrate(apiClient, mediaType);
}; };
@ -1409,7 +1404,7 @@ class PlaybackManager {
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null; const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
const currentItem = self.currentItem(player); const currentItem = self.currentItem(player);
const apiClient = currentItem ? connectionManager.getApiClient(currentItem.ServerId) : connectionManager.currentApiClient(); const apiClient = currentItem ? window.connectionManager.getApiClient(currentItem.ServerId) : window.connectionManager.currentApiClient();
const endpointInfo = apiClient.getSavedEndpointInfo() || {}; const endpointInfo = apiClient.getSavedEndpointInfo() || {};
return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType); return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType);
@ -1421,7 +1416,7 @@ class PlaybackManager {
return player.setMaxStreamingBitrate(options); return player.setMaxStreamingBitrate(options);
} }
const apiClient = connectionManager.getApiClient(self.currentItem(player).ServerId); const apiClient = window.connectionManager.getApiClient(self.currentItem(player).ServerId);
apiClient.getEndpointInfo().then(function (endpointInfo) { apiClient.getEndpointInfo().then(function (endpointInfo) {
const playerData = getPlayerData(player); const playerData = getPlayerData(player);
@ -1683,7 +1678,7 @@ class PlaybackManager {
const subtitleStreamIndex = params.SubtitleStreamIndex == null ? getPlayerData(player).subtitleStreamIndex : params.SubtitleStreamIndex; const subtitleStreamIndex = params.SubtitleStreamIndex == null ? getPlayerData(player).subtitleStreamIndex : params.SubtitleStreamIndex;
let currentMediaSource = self.currentMediaSource(player); let currentMediaSource = self.currentMediaSource(player);
const apiClient = connectionManager.getApiClient(currentItem.ServerId); const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
if (ticks) { if (ticks) {
ticks = parseInt(ticks); ticks = parseInt(ticks);
@ -1702,7 +1697,7 @@ class PlaybackManager {
streamInfo.lastMediaInfoQuery = lastMediaInfoQuery; streamInfo.lastMediaInfoQuery = lastMediaInfoQuery;
if (!streamInfo.url) { if (!streamInfo.url) {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream', true); showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return; return;
} }
@ -1839,7 +1834,7 @@ class PlaybackManager {
}, queryOptions)); }, queryOptions));
} else if (firstItem.Type === 'Episode' && items.length === 1 && getPlayer(firstItem, options).supportsProgress !== false) { } else if (firstItem.Type === 'Episode' && items.length === 1 && getPlayer(firstItem, options).supportsProgress !== false) {
promise = new Promise(function (resolve, reject) { promise = new Promise(function (resolve, reject) {
const apiClient = connectionManager.getApiClient(firstItem.ServerId); const apiClient = window.connectionManager.getApiClient(firstItem.ServerId);
apiClient.getCurrentUser().then(function (user) { apiClient.getCurrentUser().then(function (user) {
if (!user.Configuration.EnableNextEpisodeAutoPlay || !firstItem.SeriesId) { if (!user.Configuration.EnableNextEpisodeAutoPlay || !firstItem.SeriesId) {
@ -2062,7 +2057,7 @@ class PlaybackManager {
// If it's still null then there's nothing to play // If it's still null then there's nothing to play
if (!firstItem) { if (!firstItem) {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream', false); showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return Promise.reject(); return Promise.reject();
} }
@ -2070,7 +2065,7 @@ class PlaybackManager {
return playOther(items, options, user); return playOther(items, options, user);
} }
const apiClient = connectionManager.getApiClient(firstItem.ServerId); const apiClient = window.connectionManager.getApiClient(firstItem.ServerId);
return getIntros(firstItem, apiClient, options).then(function (introsResult) { return getIntros(firstItem, apiClient, options).then(function (introsResult) {
const introItems = introsResult.Items; const introItems = introsResult.Items;
@ -2111,7 +2106,7 @@ class PlaybackManager {
function playInternal(item, playOptions, onPlaybackStartedFn) { function playInternal(item, playOptions, onPlaybackStartedFn) {
if (item.IsPlaceHolder) { if (item.IsPlaceHolder) {
loading.hide(); loading.hide();
showPlaybackInfoErrorMessage(self, 'PlaceHolder', true); showPlaybackInfoErrorMessage(self, 'PlaybackErrorPlaceHolder');
return Promise.reject(); return Promise.reject();
} }
@ -2133,14 +2128,14 @@ class PlaybackManager {
const mediaType = item.MediaType; const mediaType = item.MediaType;
const onBitrateDetectionFailure = function () { const onBitrateDetectionFailure = function () {
return playAfterBitrateDetect(getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId), mediaType), item, playOptions, onPlaybackStartedFn); return playAfterBitrateDetect(getSavedMaxStreamingBitrate(window.connectionManager.getApiClient(item.ServerId), mediaType), item, playOptions, onPlaybackStartedFn);
}; };
if (!isServerItem(item) || itemHelper.isLocalItem(item)) { if (!isServerItem(item) || itemHelper.isLocalItem(item)) {
return onBitrateDetectionFailure(); return onBitrateDetectionFailure();
} }
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
apiClient.getEndpointInfo().then(function (endpointInfo) { apiClient.getEndpointInfo().then(function (endpointInfo) {
if ((mediaType === 'Video' || mediaType === 'Audio') && appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType)) { if ((mediaType === 'Video' || mediaType === 'Audio') && appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType)) {
return apiClient.detectBitrate().then(function (bitrate) { return apiClient.detectBitrate().then(function (bitrate) {
@ -2259,7 +2254,7 @@ class PlaybackManager {
return Promise.all([promise, player.getDeviceProfile(item)]).then(function (responses) { return Promise.all([promise, player.getDeviceProfile(item)]).then(function (responses) {
const deviceProfile = responses[1]; const deviceProfile = responses[1];
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
const mediaSourceId = playOptions.mediaSourceId; const mediaSourceId = playOptions.mediaSourceId;
const audioStreamIndex = playOptions.audioStreamIndex; const audioStreamIndex = playOptions.audioStreamIndex;
@ -2304,11 +2299,11 @@ class PlaybackManager {
const startPosition = options.startPositionTicks || 0; const startPosition = options.startPositionTicks || 0;
const mediaType = options.mediaType || item.MediaType; const mediaType = options.mediaType || item.MediaType;
const player = getPlayer(item, options); const player = getPlayer(item, options);
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
// Call this just to ensure the value is recorded, it is needed with getSavedMaxStreamingBitrate // Call this just to ensure the value is recorded, it is needed with getSavedMaxStreamingBitrate
return apiClient.getEndpointInfo().then(function () { return apiClient.getEndpointInfo().then(function () {
const maxBitrate = getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId), mediaType); const maxBitrate = getSavedMaxStreamingBitrate(window.connectionManager.getApiClient(item.ServerId), mediaType);
return player.getDeviceProfile(item).then(function (deviceProfile) { return player.getDeviceProfile(item).then(function (deviceProfile) {
return getPlaybackMediaSource(player, apiClient, deviceProfile, maxBitrate, item, startPosition, options.mediaSourceId, options.audioStreamIndex, options.subtitleStreamIndex).then(function (mediaSource) { return getPlaybackMediaSource(player, apiClient, deviceProfile, maxBitrate, item, startPosition, options.mediaSourceId, options.audioStreamIndex, options.subtitleStreamIndex).then(function (mediaSource) {
@ -2324,11 +2319,11 @@ class PlaybackManager {
const mediaType = options.mediaType || item.MediaType; const mediaType = options.mediaType || item.MediaType;
// TODO: Remove the true forceLocalPlayer hack // TODO: Remove the true forceLocalPlayer hack
const player = getPlayer(item, options, true); const player = getPlayer(item, options, true);
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
// Call this just to ensure the value is recorded, it is needed with getSavedMaxStreamingBitrate // Call this just to ensure the value is recorded, it is needed with getSavedMaxStreamingBitrate
return apiClient.getEndpointInfo().then(function () { return apiClient.getEndpointInfo().then(function () {
const maxBitrate = getSavedMaxStreamingBitrate(connectionManager.getApiClient(item.ServerId), mediaType); const maxBitrate = getSavedMaxStreamingBitrate(window.connectionManager.getApiClient(item.ServerId), mediaType);
return player.getDeviceProfile(item).then(function (deviceProfile) { return player.getDeviceProfile(item).then(function (deviceProfile) {
return getPlaybackInfo(player, apiClient, item, deviceProfile, maxBitrate, startPosition, false, null, null, null, null).then(function (playbackInfoResult) { return getPlaybackInfo(player, apiClient, item, deviceProfile, maxBitrate, startPosition, false, null, null, null, null).then(function (playbackInfoResult) {
@ -2480,7 +2475,7 @@ class PlaybackManager {
return mediaSource; return mediaSource;
} }
} else { } else {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream'); showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return Promise.reject(); return Promise.reject();
} }
}); });
@ -2712,7 +2707,7 @@ class PlaybackManager {
const queueDirectToPlayer = player && !enableLocalPlaylistManagement(player); const queueDirectToPlayer = player && !enableLocalPlaylistManagement(player);
if (queueDirectToPlayer) { if (queueDirectToPlayer) {
const apiClient = connectionManager.getApiClient(items[0].ServerId); const apiClient = window.connectionManager.getApiClient(items[0].ServerId);
player.getDeviceProfile(items[0]).then(function (profile) { player.getDeviceProfile(items[0]).then(function (profile) {
setStreamUrls(items, profile, self.getMaxStreamingBitrate(player), apiClient, 0).then(function () { setStreamUrls(items, profile, self.getMaxStreamingBitrate(player), apiClient, 0).then(function () {
@ -2969,7 +2964,7 @@ class PlaybackManager {
} }
if (displayErrorCode && typeof (displayErrorCode) === 'string') { if (displayErrorCode && typeof (displayErrorCode) === 'string') {
showPlaybackInfoErrorMessage(self, displayErrorCode, nextItem); showPlaybackInfoErrorMessage(self, 'PlaybackError' + displayErrorCode);
} else if (nextItem) { } else if (nextItem) {
self.nextTrack(); self.nextTrack();
} else { } else {
@ -3162,13 +3157,13 @@ class PlaybackManager {
streamInfo.lastMediaInfoQuery = new Date().getTime(); streamInfo.lastMediaInfoQuery = new Date().getTime();
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
if (!apiClient.isMinServerVersion('3.2.70.7')) { if (!apiClient.isMinServerVersion('3.2.70.7')) {
return; return;
} }
connectionManager.getApiClient(serverId).getLiveStreamMediaInfo(liveStreamId).then(function (info) { window.connectionManager.getApiClient(serverId).getLiveStreamMediaInfo(liveStreamId).then(function (info) {
mediaSource.MediaStreams = info.MediaStreams; mediaSource.MediaStreams = info.MediaStreams;
events.trigger(player, 'mediastreamschange'); events.trigger(player, 'mediastreamschange');
}, function () { }, function () {
@ -3225,7 +3220,7 @@ class PlaybackManager {
return Promise.reject(); return Promise.reject();
} }
const apiClient = connectionManager.getApiClient(nextItem.item.ServerId); const apiClient = window.connectionManager.getApiClient(nextItem.item.ServerId);
return apiClient.getItem(apiClient.getCurrentUserId(), nextItem.item.Id); return apiClient.getItem(apiClient.getCurrentUserId(), nextItem.item.Id);
} }
@ -3366,7 +3361,7 @@ class PlaybackManager {
return player.playTrailers(item); return player.playTrailers(item);
} }
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
const instance = this; const instance = this;
@ -3398,7 +3393,7 @@ class PlaybackManager {
} }
getSubtitleUrl(textStream, serverId) { getSubtitleUrl(textStream, serverId) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
return !textStream.IsExternalUrl ? apiClient.getUrl(textStream.DeliveryUrl) : textStream.DeliveryUrl; return !textStream.IsExternalUrl ? apiClient.getUrl(textStream.DeliveryUrl) : textStream.DeliveryUrl;
} }
@ -3478,7 +3473,7 @@ class PlaybackManager {
return player.instantMix(item); return player.instantMix(item);
} }
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
const options = {}; const options = {};
options.UserId = apiClient.getCurrentUserId(); options.UserId = apiClient.getCurrentUserId();

View file

@ -2,7 +2,7 @@ import playbackManager from 'playbackManager';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import events from 'events'; import events from 'events';
var orientationLocked; let orientationLocked;
function onOrientationChangeSuccess() { function onOrientationChangeSuccess() {
orientationLocked = true; orientationLocked = true;
@ -14,15 +14,15 @@ function onOrientationChangeError(err) {
} }
events.on(playbackManager, 'playbackstart', function (e, player, state) { events.on(playbackManager, 'playbackstart', function (e, player, state) {
var isLocalVideo = player.isLocalPlayer && !player.isExternalPlayer && playbackManager.isPlayingVideo(player); const isLocalVideo = player.isLocalPlayer && !player.isExternalPlayer && playbackManager.isPlayingVideo(player);
if (isLocalVideo && layoutManager.mobile) { if (isLocalVideo && layoutManager.mobile) {
/* eslint-disable-next-line compat/compat */ /* eslint-disable-next-line compat/compat */
var lockOrientation = window.screen.lockOrientation || window.screen.mozLockOrientation || window.screen.msLockOrientation || (window.screen.orientation && window.screen.orientation.lock); const lockOrientation = window.screen.lockOrientation || window.screen.mozLockOrientation || window.screen.msLockOrientation || (window.screen.orientation && window.screen.orientation.lock);
if (lockOrientation) { if (lockOrientation) {
try { try {
var promise = lockOrientation('landscape'); const promise = lockOrientation('landscape');
if (promise.then) { if (promise.then) {
promise.then(onOrientationChangeSuccess, onOrientationChangeError); promise.then(onOrientationChangeSuccess, onOrientationChangeError);
} else { } else {
@ -39,7 +39,7 @@ events.on(playbackManager, 'playbackstart', function (e, player, state) {
events.on(playbackManager, 'playbackstop', function (e, playbackStopInfo) { events.on(playbackManager, 'playbackstop', function (e, playbackStopInfo) {
if (orientationLocked && !playbackStopInfo.nextMediaType) { if (orientationLocked && !playbackStopInfo.nextMediaType) {
/* eslint-disable-next-line compat/compat */ /* eslint-disable-next-line compat/compat */
var unlockOrientation = window.screen.unlockOrientation || window.screen.mozUnlockOrientation || window.screen.msUnlockOrientation || (window.screen.orientation && window.screen.orientation.unlock); const unlockOrientation = window.screen.unlockOrientation || window.screen.mozUnlockOrientation || window.screen.msUnlockOrientation || (window.screen.orientation && window.screen.orientation.unlock);
if (unlockOrientation) { if (unlockOrientation) {
try { try {

View file

@ -6,9 +6,10 @@ import playbackManager from 'playbackManager';
import appRouter from 'appRouter'; import appRouter from 'appRouter';
import globalize from 'globalize'; import globalize from 'globalize';
import appHost from 'apphost'; import appHost from 'apphost';
import * as autocast from 'autocast';
function mirrorItem(info, player) { function mirrorItem(info, player) {
var item = info.item; const item = info.item;
playbackManager.displayContent({ playbackManager.displayContent({
@ -21,7 +22,7 @@ function mirrorItem(info, player) {
function mirrorIfEnabled(info) { function mirrorIfEnabled(info) {
if (info && playbackManager.enableDisplayMirroring()) { if (info && playbackManager.enableDisplayMirroring()) {
var getPlayerInfo = playbackManager.getPlayerInfo(); const getPlayerInfo = playbackManager.getPlayerInfo();
if (getPlayerInfo) { if (getPlayerInfo) {
if (!getPlayerInfo.isLocalPlayer && getPlayerInfo.supportedCommands.indexOf('DisplayContent') !== -1) { if (!getPlayerInfo.isLocalPlayer && getPlayerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
@ -44,7 +45,7 @@ function getTargetSecondaryText(target) {
} }
function getIcon(target) { function getIcon(target) {
var deviceType = target.deviceType; let deviceType = target.deviceType;
if (!deviceType && target.isLocalPlayer) { if (!deviceType && target.isLocalPlayer) {
if (browser.tv) { if (browser.tv) {
@ -77,7 +78,7 @@ function getIcon(target) {
} }
export function show(button) { export function show(button) {
var currentPlayerInfo = playbackManager.getPlayerInfo(); const currentPlayerInfo = playbackManager.getPlayerInfo();
if (currentPlayerInfo) { if (currentPlayerInfo) {
if (!currentPlayerInfo.isLocalPlayer) { if (!currentPlayerInfo.isLocalPlayer) {
@ -86,13 +87,13 @@ export function show(button) {
} }
} }
var currentPlayerId = currentPlayerInfo ? currentPlayerInfo.id : null; const currentPlayerId = currentPlayerInfo ? currentPlayerInfo.id : null;
loading.show(); loading.show();
playbackManager.getTargets().then(function (targets) { playbackManager.getTargets().then(function (targets) {
var menuItems = targets.map(function (t) { const menuItems = targets.map(function (t) {
var name = t.name; let name = t.name;
if (t.appName && t.appName !== t.name) { if (t.appName && t.appName !== t.name) {
name += ' - ' + t.appName; name += ' - ' + t.appName;
@ -110,7 +111,7 @@ export function show(button) {
import('actionsheet').then(({default: actionsheet}) => { import('actionsheet').then(({default: actionsheet}) => {
loading.hide(); loading.hide();
var menuOptions = { const menuOptions = {
title: globalize.translate('HeaderPlayOn'), title: globalize.translate('HeaderPlayOn'),
items: menuItems, items: menuItems,
positionTo: button, positionTo: button,
@ -126,7 +127,7 @@ export function show(button) {
} }
actionsheet.show(menuOptions).then(function (id) { actionsheet.show(menuOptions).then(function (id) {
var target = targets.filter(function (t) { const target = targets.filter(function (t) {
return t.id === id; return t.id === id;
})[0]; })[0];
@ -152,7 +153,7 @@ function showActivePlayerMenu(playerInfo) {
function disconnectFromPlayer(currentDeviceName) { function disconnectFromPlayer(currentDeviceName) {
if (playbackManager.getSupportedCommands().indexOf('EndSession') !== -1) { if (playbackManager.getSupportedCommands().indexOf('EndSession') !== -1) {
import('dialog').then(({default: dialog}) => { import('dialog').then(({default: dialog}) => {
var menuItems = []; const menuItems = [];
menuItems.push({ menuItems.push({
name: globalize.translate('Yes'), name: globalize.translate('Yes'),
@ -187,9 +188,9 @@ function disconnectFromPlayer(currentDeviceName) {
} }
function showActivePlayerMenuInternal(dialogHelper, playerInfo) { function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
var html = ''; let html = '';
var dialogOptions = { const dialogOptions = {
removeOnClose: true removeOnClose: true
}; };
@ -198,11 +199,11 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
dialogOptions.exitAnimationDuration = 160; dialogOptions.exitAnimationDuration = 160;
dialogOptions.autoFocus = false; dialogOptions.autoFocus = false;
var dlg = dialogHelper.createDialog(dialogOptions); const dlg = dialogHelper.createDialog(dialogOptions);
dlg.classList.add('promptDialog'); dlg.classList.add('promptDialog');
var currentDeviceName = (playerInfo.deviceName || playerInfo.name); const currentDeviceName = (playerInfo.deviceName || playerInfo.name);
html += '<div class="promptDialogContent" style="padding:1.5em;">'; html += '<div class="promptDialogContent" style="padding:1.5em;">';
html += '<h2 style="margin-top:.5em;">'; html += '<h2 style="margin-top:.5em;">';
@ -213,7 +214,7 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
if (playerInfo.supportedCommands.indexOf('DisplayContent') !== -1) { if (playerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
html += '<label class="checkboxContainer">'; html += '<label class="checkboxContainer">';
var checkedHtml = playbackManager.enableDisplayMirroring() ? ' checked' : ''; const checkedHtml = playbackManager.enableDisplayMirroring() ? ' checked' : '';
html += '<input type="checkbox" is="emby-checkbox" class="chkMirror"' + checkedHtml + '/>'; html += '<input type="checkbox" is="emby-checkbox" class="chkMirror"' + checkedHtml + '/>';
html += '<span>' + globalize.translate('EnableDisplayMirroring') + '</span>'; html += '<span>' + globalize.translate('EnableDisplayMirroring') + '</span>';
html += '</label>'; html += '</label>';
@ -221,6 +222,14 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
html += '</div>'; html += '</div>';
if (autocast.supported()) {
html += '<div><label class="checkboxContainer">';
const checkedHtmlAC = autocast.isEnabled() ? ' checked' : '';
html += '<input type="checkbox" is="emby-checkbox" class="chkAutoCast"' + checkedHtmlAC + '/>';
html += '<span>' + globalize.translate('EnableAutoCast') + '</span>';
html += '</label></div>';
}
html += '<div style="margin-top:1em;display:flex;justify-content: flex-end;">'; html += '<div style="margin-top:1em;display:flex;justify-content: flex-end;">';
html += '<button is="emby-button" type="button" class="button-flat btnRemoteControl promptDialogButton">' + globalize.translate('HeaderRemoteControl') + '</button>'; html += '<button is="emby-button" type="button" class="button-flat btnRemoteControl promptDialogButton">' + globalize.translate('HeaderRemoteControl') + '</button>';
@ -231,15 +240,21 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
html += '</div>'; html += '</div>';
dlg.innerHTML = html; dlg.innerHTML = html;
var chkMirror = dlg.querySelector('.chkMirror'); const chkMirror = dlg.querySelector('.chkMirror');
if (chkMirror) { if (chkMirror) {
chkMirror.addEventListener('change', onMirrorChange); chkMirror.addEventListener('change', onMirrorChange);
} }
var destination = ''; const chkAutoCast = dlg.querySelector('.chkAutoCast');
var btnRemoteControl = dlg.querySelector('.btnRemoteControl'); if (chkAutoCast) {
chkAutoCast.addEventListener('change', onAutoCastChange);
}
let destination = '';
const btnRemoteControl = dlg.querySelector('.btnRemoteControl');
if (btnRemoteControl) { if (btnRemoteControl) {
btnRemoteControl.addEventListener('click', function () { btnRemoteControl.addEventListener('click', function () {
destination = 'nowplaying'; destination = 'nowplaying';
@ -269,9 +284,13 @@ function onMirrorChange() {
playbackManager.enableDisplayMirroring(this.checked); playbackManager.enableDisplayMirroring(this.checked);
} }
function onAutoCastChange() {
autocast.enable(this.checked);
}
document.addEventListener('viewshow', function (e) { document.addEventListener('viewshow', function (e) {
var state = e.detail.state || {}; const state = e.detail.state || {};
var item = state.item; const item = state.item;
if (item && item.ServerId) { if (item && item.ServerId) {
mirrorIfEnabled({ mirrorIfEnabled({

View file

@ -1,17 +1,16 @@
import connectionManager from 'connectionManager';
import actionsheet from 'actionsheet'; import actionsheet from 'actionsheet';
import playbackManager from 'playbackManager'; import playbackManager from 'playbackManager';
import globalize from 'globalize'; import globalize from 'globalize';
import qualityoptions from 'qualityoptions'; import qualityoptions from 'qualityoptions';
function showQualityMenu(player, btn) { function showQualityMenu(player, btn) {
var videoStream = playbackManager.currentMediaSource(player).MediaStreams.filter(function (stream) { const videoStream = playbackManager.currentMediaSource(player).MediaStreams.filter(function (stream) {
return stream.Type === 'Video'; return stream.Type === 'Video';
})[0]; })[0];
var videoWidth = videoStream ? videoStream.Width : null; const videoWidth = videoStream ? videoStream.Width : null;
var videoHeight = videoStream ? videoStream.Height : null; const videoHeight = videoStream ? videoStream.Height : null;
var options = qualityoptions.getVideoQualityOptions({ const options = qualityoptions.getVideoQualityOptions({
currentMaxBitrate: playbackManager.getMaxStreamingBitrate(player), currentMaxBitrate: playbackManager.getMaxStreamingBitrate(player),
isAutomaticBitrateEnabled: playbackManager.enableAutomaticBitrateDetection(player), isAutomaticBitrateEnabled: playbackManager.enableAutomaticBitrateDetection(player),
videoWidth: videoWidth, videoWidth: videoWidth,
@ -19,8 +18,8 @@ function showQualityMenu(player, btn) {
enableAuto: true enableAuto: true
}); });
var menuItems = options.map(function (o) { const menuItems = options.map(function (o) {
var opt = { const opt = {
name: o.name, name: o.name,
id: o.bitrate, id: o.bitrate,
asideText: o.secondaryText asideText: o.secondaryText
@ -33,7 +32,7 @@ function showQualityMenu(player, btn) {
return opt; return opt;
}); });
var selectedId = options.filter(function (o) { let selectedId = options.filter(function (o) {
return o.selected; return o.selected;
}); });
@ -43,7 +42,7 @@ function showQualityMenu(player, btn) {
items: menuItems, items: menuItems,
positionTo: btn positionTo: btn
}).then(function (id) { }).then(function (id) {
var bitrate = parseInt(id); const bitrate = parseInt(id);
if (bitrate !== selectedId) { if (bitrate !== selectedId) {
playbackManager.setMaxStreamingBitrate({ playbackManager.setMaxStreamingBitrate({
enableAutomaticBitrateDetection: bitrate ? false : true, enableAutomaticBitrateDetection: bitrate ? false : true,
@ -54,8 +53,8 @@ function showQualityMenu(player, btn) {
} }
function showRepeatModeMenu(player, btn) { function showRepeatModeMenu(player, btn) {
var menuItems = []; const menuItems = [];
var currentValue = playbackManager.getRepeatMode(player); const currentValue = playbackManager.getRepeatMode(player);
menuItems.push({ menuItems.push({
name: globalize.translate('RepeatAll'), name: globalize.translate('RepeatAll'),
@ -86,16 +85,16 @@ function showRepeatModeMenu(player, btn) {
} }
function getQualitySecondaryText(player) { function getQualitySecondaryText(player) {
var state = playbackManager.getPlayerState(player); const state = playbackManager.getPlayerState(player);
var videoStream = playbackManager.currentMediaSource(player).MediaStreams.filter(function (stream) { const videoStream = playbackManager.currentMediaSource(player).MediaStreams.filter(function (stream) {
return stream.Type === 'Video'; return stream.Type === 'Video';
})[0]; })[0];
var videoWidth = videoStream ? videoStream.Width : null; const videoWidth = videoStream ? videoStream.Width : null;
var videoHeight = videoStream ? videoStream.Height : null; const videoHeight = videoStream ? videoStream.Height : null;
var options = qualityoptions.getVideoQualityOptions({ const options = qualityoptions.getVideoQualityOptions({
currentMaxBitrate: playbackManager.getMaxStreamingBitrate(player), currentMaxBitrate: playbackManager.getMaxStreamingBitrate(player),
isAutomaticBitrateEnabled: playbackManager.enableAutomaticBitrateDetection(player), isAutomaticBitrateEnabled: playbackManager.enableAutomaticBitrateDetection(player),
videoWidth: videoWidth, videoWidth: videoWidth,
@ -103,7 +102,7 @@ function getQualitySecondaryText(player) {
enableAuto: true enableAuto: true
}); });
var selectedOption = options.filter(function (o) { let selectedOption = options.filter(function (o) {
return o.selected; return o.selected;
}); });
@ -112,7 +111,7 @@ function getQualitySecondaryText(player) {
} }
selectedOption = selectedOption[0]; selectedOption = selectedOption[0];
var text = selectedOption.name; let text = selectedOption.name;
if (selectedOption.autoText) { if (selectedOption.autoText) {
if (state.PlayState && state.PlayState.PlayMethod !== 'Transcode') { if (state.PlayState && state.PlayState.PlayMethod !== 'Transcode') {
@ -127,8 +126,8 @@ function getQualitySecondaryText(player) {
function showAspectRatioMenu(player, btn) { function showAspectRatioMenu(player, btn) {
// each has a name and id // each has a name and id
var currentId = playbackManager.getAspectRatio(player); const currentId = playbackManager.getAspectRatio(player);
var menuItems = playbackManager.getSupportedAspectRatios(player).map(function (i) { const menuItems = playbackManager.getSupportedAspectRatios(player).map(function (i) {
return { return {
id: i.id, id: i.id,
name: i.name, name: i.name,
@ -172,12 +171,12 @@ function showPlaybackRateMenu(player, btn) {
} }
function showWithUser(options, player, user) { function showWithUser(options, player, user) {
var supportedCommands = playbackManager.getSupportedCommands(player); const supportedCommands = playbackManager.getSupportedCommands(player);
var menuItems = []; const menuItems = [];
if (supportedCommands.indexOf('SetAspectRatio') !== -1) { if (supportedCommands.indexOf('SetAspectRatio') !== -1) {
var currentAspectRatioId = playbackManager.getAspectRatio(player); const currentAspectRatioId = playbackManager.getAspectRatio(player);
var currentAspectRatio = playbackManager.getSupportedAspectRatios(player).filter(function (i) { const currentAspectRatio = playbackManager.getSupportedAspectRatios(player).filter(function (i) {
return i.id === currentAspectRatioId; return i.id === currentAspectRatioId;
})[0]; })[0];
@ -200,7 +199,7 @@ function showWithUser(options, player, user) {
} }
if (user && user.Policy.EnableVideoPlaybackTranscoding) { if (user && user.Policy.EnableVideoPlaybackTranscoding) {
var secondaryQualityText = getQualitySecondaryText(player); const secondaryQualityText = getQualitySecondaryText(player);
menuItems.push({ menuItems.push({
name: globalize.translate('Quality'), name: globalize.translate('Quality'),
@ -209,7 +208,7 @@ function showWithUser(options, player, user) {
}); });
} }
var repeatMode = playbackManager.getRepeatMode(player); const repeatMode = playbackManager.getRepeatMode(player);
if (supportedCommands.indexOf('SetRepeatMode') !== -1 && playbackManager.currentMediaSource(player).RunTimeTicks) { if (supportedCommands.indexOf('SetRepeatMode') !== -1 && playbackManager.currentMediaSource(player).RunTimeTicks) {
menuItems.push({ menuItems.push({
@ -244,14 +243,14 @@ function showWithUser(options, player, user) {
} }
export function show(options) { export function show(options) {
var player = options.player; const player = options.player;
var currentItem = playbackManager.currentItem(player); const currentItem = playbackManager.currentItem(player);
if (!currentItem || !currentItem.ServerId) { if (!currentItem || !currentItem.ServerId) {
return showWithUser(options, player, null); return showWithUser(options, player, null);
} }
var apiClient = connectionManager.getApiClient(currentItem.ServerId); const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
return apiClient.getCurrentUser().then(function (user) { return apiClient.getCurrentUser().then(function (user) {
return showWithUser(options, player, user); return showWithUser(options, player, user);
}); });

View file

@ -5,15 +5,15 @@ import browser from 'browser';
import 'css!./iconosd'; import 'css!./iconosd';
import 'material-icons'; import 'material-icons';
var currentPlayer; let currentPlayer;
var osdElement; let osdElement;
var iconElement; let iconElement;
var progressElement; let progressElement;
var enableAnimation; let enableAnimation;
function getOsdElementHtml() { function getOsdElementHtml() {
var html = ''; let html = '';
html += '<span class="material-icons iconOsdIcon volume_up"></span>'; html += '<span class="material-icons iconOsdIcon volume_up"></span>';
@ -23,7 +23,7 @@ function getOsdElementHtml() {
} }
function ensureOsdElement() { function ensureOsdElement() {
var elem = osdElement; let elem = osdElement;
if (!elem) { if (!elem) {
enableAnimation = browser.supportsCssAnimation(); enableAnimation = browser.supportsCssAnimation();
@ -46,11 +46,11 @@ function onHideComplete() {
this.classList.add('hide'); this.classList.add('hide');
} }
var hideTimeout; let hideTimeout;
function showOsd() { function showOsd() {
clearHideTimeout(); clearHideTimeout();
var elem = osdElement; const elem = osdElement;
dom.removeEventListener(elem, dom.whichTransitionEvent(), onHideComplete, { dom.removeEventListener(elem, dom.whichTransitionEvent(), onHideComplete, {
once: true once: true
@ -78,7 +78,7 @@ function clearHideTimeout() {
function hideOsd() { function hideOsd() {
clearHideTimeout(); clearHideTimeout();
var elem = osdElement; const elem = osdElement;
if (elem) { if (elem) {
if (enableAnimation) { if (enableAnimation) {
// trigger reflow // trigger reflow
@ -108,7 +108,7 @@ function updatePlayerVolumeState(isMuted, volume) {
} }
function releaseCurrentPlayer() { function releaseCurrentPlayer() {
var player = currentPlayer; const player = currentPlayer;
if (player) { if (player) {
events.off(player, 'volumechange', onVolumeChanged); events.off(player, 'volumechange', onVolumeChanged);
@ -118,7 +118,7 @@ function releaseCurrentPlayer() {
} }
function onVolumeChanged(e) { function onVolumeChanged(e) {
var player = this; const player = this;
ensureOsdElement(); ensureOsdElement();

View file

@ -5,7 +5,6 @@ import focusManager from 'focusManager';
import qualityoptions from 'qualityoptions'; import qualityoptions from 'qualityoptions';
import globalize from 'globalize'; import globalize from 'globalize';
import loading from 'loading'; import loading from 'loading';
import connectionManager from 'connectionManager';
import events from 'events'; import events from 'events';
import 'emby-select'; import 'emby-select';
import 'emby-checkbox'; import 'emby-checkbox';
@ -258,7 +257,7 @@ import 'emby-checkbox';
function onSubmit(e) { function onSubmit(e) {
const self = this; const self = this;
const apiClient = connectionManager.getApiClient(self.options.serverId); const apiClient = window.connectionManager.getApiClient(self.options.serverId);
const userId = self.options.userId; const userId = self.options.userId;
const userSettings = self.options.userSettings; const userSettings = self.options.userSettings;
@ -305,7 +304,7 @@ import 'emby-checkbox';
loading.show(); loading.show();
const userId = self.options.userId; const userId = self.options.userId;
const apiClient = connectionManager.getApiClient(self.options.serverId); const apiClient = window.connectionManager.getApiClient(self.options.serverId);
const userSettings = self.options.userSettings; const userSettings = self.options.userSettings;
apiClient.getUser(userId).then(user => { apiClient.getUser(userId).then(user => {

View file

@ -1,7 +1,6 @@
import events from 'events'; import events from 'events';
import globalize from 'globalize'; import globalize from 'globalize';
import playbackManager from 'playbackManager'; import playbackManager from 'playbackManager';
import connectionManager from 'connectionManager';
import syncPlayManager from 'syncPlayManager'; import syncPlayManager from 'syncPlayManager';
import playMethodHelper from 'playMethodHelper'; import playMethodHelper from 'playMethodHelper';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
@ -95,7 +94,7 @@ import 'css!./playerstats';
return Promise.resolve(instance.lastSession); return Promise.resolve(instance.lastSession);
} }
const apiClient = connectionManager.getApiClient(playbackManager.currentItem(player).ServerId); const apiClient = window.connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
return apiClient.getSessions({ return apiClient.getSessions({
deviceId: apiClient.deviceId() deviceId: apiClient.deviceId()
@ -264,6 +263,34 @@ import 'css!./playerstats';
}); });
} }
if (videoStream.VideoRange) {
sessionStats.push({
label: globalize.translate('LabelVideoRange'),
value: videoStream.VideoRange
});
}
if (videoStream.ColorSpace) {
sessionStats.push({
label: globalize.translate('LabelColorSpace'),
value: videoStream.ColorSpace
});
}
if (videoStream.ColorTransfer) {
sessionStats.push({
label: globalize.translate('LabelColorTransfer'),
value: videoStream.ColorTransfer
});
}
if (videoStream.ColorPrimaries) {
sessionStats.push({
label: globalize.translate('LabelColorPrimaries'),
value: videoStream.ColorPrimaries
});
}
const audioInfos = []; const audioInfos = [];
if (audioCodec) { if (audioCodec) {
@ -386,7 +413,7 @@ import 'css!./playerstats';
name: 'Original Media Info' name: 'Original Media Info'
}); });
var apiClient = connectionManager.getApiClient(playbackManager.currentItem(player).ServerId); const apiClient = window.connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
if (syncPlayManager.isSyncPlayEnabled() && apiClient.isMinServerVersion('10.6.0')) { if (syncPlayManager.isSyncPlayEnabled() && apiClient.isMinServerVersion('10.6.0')) {
categories.push({ categories.push({
stats: getSyncPlayStats(), stats: getSyncPlayStats(),

View file

@ -3,7 +3,6 @@ import dialogHelper from 'dialogHelper';
import loading from 'loading'; import loading from 'loading';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import playbackManager from 'playbackManager'; import playbackManager from 'playbackManager';
import connectionManager from 'connectionManager';
import * as userSettings from 'userSettings'; import * as userSettings from 'userSettings';
import appRouter from 'appRouter'; import appRouter from 'appRouter';
import globalize from 'globalize'; import globalize from 'globalize';
@ -22,7 +21,7 @@ import 'emby-button';
const panel = dom.parentWithClass(this, 'dialog'); const panel = dom.parentWithClass(this, 'dialog');
const playlistId = panel.querySelector('#selectPlaylistToAddTo').value; const playlistId = panel.querySelector('#selectPlaylistToAddTo').value;
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
if (playlistId) { if (playlistId) {
userSettings.set('playlisteditor-lastplaylistid', playlistId); userSettings.set('playlisteditor-lastplaylistid', playlistId);
@ -113,7 +112,7 @@ import 'emby-button';
EnableTotalRecordCount: false EnableTotalRecordCount: false
}; };
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => { apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
let html = ''; let html = '';

View file

@ -4,11 +4,11 @@ import playbackManager from 'playbackManager';
import globalize from 'globalize'; import globalize from 'globalize';
export function show(options) { export function show(options) {
var item = options.item; const item = options.item;
var resumePositionTicks = item.UserData ? item.UserData.PlaybackPositionTicks : null; const resumePositionTicks = item.UserData ? item.UserData.PlaybackPositionTicks : null;
var playableItemId = item.Type === 'Program' ? item.ChannelId : item.Id; const playableItemId = item.Type === 'Program' ? item.ChannelId : item.Id;
if (!resumePositionTicks || item.IsFolder) { if (!resumePositionTicks || item.IsFolder) {
playbackManager.play({ playbackManager.play({
@ -18,7 +18,7 @@ export function show(options) {
return; return;
} }
var menuItems = []; const menuItems = [];
menuItems.push({ menuItems.push({
name: globalize.translate('ResumeAt', datetime.getDisplayRunningTime(resumePositionTicks)), name: globalize.translate('ResumeAt', datetime.getDisplayRunningTime(resumePositionTicks)),

View file

@ -3,7 +3,7 @@ import globalize from 'globalize';
/* eslint-disable indent */ /* eslint-disable indent */
// TODO: replace with each plugin version // TODO: replace with each plugin version
var cacheParam = new Date().getTime(); const cacheParam = new Date().getTime();
class PluginManager { class PluginManager {
pluginsList = []; pluginsList = [];
@ -13,7 +13,7 @@ import globalize from 'globalize';
} }
#loadStrings(plugin) { #loadStrings(plugin) {
var strings = plugin.getTranslations ? plugin.getTranslations() : []; const strings = plugin.getTranslations ? plugin.getTranslations() : [];
return globalize.loadStrings({ return globalize.loadStrings({
name: plugin.id || plugin.packageName, name: plugin.id || plugin.packageName,
strings: strings strings: strings
@ -56,10 +56,10 @@ import globalize from 'globalize';
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
require([pluginSpec], (pluginFactory) => { require([pluginSpec], (pluginFactory) => {
var plugin = pluginFactory.default ? new pluginFactory.default() : new pluginFactory(); const plugin = pluginFactory.default ? new pluginFactory.default() : new pluginFactory();
// See if it's already installed // See if it's already installed
var existing = this.pluginsList.filter(function (p) { const existing = this.pluginsList.filter(function (p) {
return p.id === plugin.id; return p.id === plugin.id;
})[0]; })[0];
@ -69,10 +69,10 @@ import globalize from 'globalize';
plugin.installUrl = pluginSpec; plugin.installUrl = pluginSpec;
var separatorIndex = Math.max(pluginSpec.lastIndexOf('/'), pluginSpec.lastIndexOf('\\')); const separatorIndex = Math.max(pluginSpec.lastIndexOf('/'), pluginSpec.lastIndexOf('\\'));
plugin.baseUrl = pluginSpec.substring(0, separatorIndex); plugin.baseUrl = pluginSpec.substring(0, separatorIndex);
var paths = {}; const paths = {};
paths[plugin.id] = plugin.baseUrl; paths[plugin.id] = plugin.baseUrl;
requirejs.config({ requirejs.config({
@ -135,7 +135,7 @@ import globalize from 'globalize';
})[0]; })[0];
} }
var url = plugin.baseUrl + '/' + path; let url = plugin.baseUrl + '/' + path;
if (addCacheParam) { if (addCacheParam) {
url += url.includes('?') ? '&' : '?'; url += url.includes('?') ? '&' : '?';

View file

@ -1,9 +1,9 @@
import globalize from 'globalize'; import globalize from 'globalize';
export function getVideoQualityOptions(options) { export function getVideoQualityOptions(options) {
var maxStreamingBitrate = options.currentMaxBitrate; const maxStreamingBitrate = options.currentMaxBitrate;
var videoWidth = options.videoWidth; let videoWidth = options.videoWidth;
var videoHeight = options.videoHeight; const 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
@ -11,9 +11,9 @@ export function getVideoQualityOptions(options) {
videoWidth = videoHeight * (16 / 9); videoWidth = videoHeight * (16 / 9);
} }
var maxAllowedWidth = videoWidth || 4096; const maxAllowedWidth = videoWidth || 4096;
var qualityOptions = []; const qualityOptions = [];
if (maxAllowedWidth >= 3800) { if (maxAllowedWidth >= 3800) {
qualityOptions.push({ name: '4K - 120 Mbps', maxHeight: 2160, bitrate: 120000000 }); qualityOptions.push({ name: '4K - 120 Mbps', maxHeight: 2160, bitrate: 120000000 });
@ -65,7 +65,7 @@ export function getVideoQualityOptions(options) {
qualityOptions.push({ name: '240p', maxHeight: 240, bitrate: 320000 }); qualityOptions.push({ name: '240p', maxHeight: 240, bitrate: 320000 });
qualityOptions.push({ name: '144p', maxHeight: 144, bitrate: 192000 }); qualityOptions.push({ name: '144p', maxHeight: 144, bitrate: 192000 });
var autoQualityOption = { const autoQualityOption = {
name: globalize.translate('Auto'), name: globalize.translate('Auto'),
bitrate: 0, bitrate: 0,
selected: options.isAutomaticBitrateEnabled selected: options.isAutomaticBitrateEnabled
@ -76,9 +76,9 @@ export function getVideoQualityOptions(options) {
} }
if (maxStreamingBitrate) { if (maxStreamingBitrate) {
var selectedIndex = -1; let selectedIndex = -1;
for (var i = 0, length = qualityOptions.length; i < length; i++) { for (let i = 0, length = qualityOptions.length; i < length; i++) {
var option = qualityOptions[i]; const option = qualityOptions[i];
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) { if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
selectedIndex = i; selectedIndex = i;
@ -89,7 +89,7 @@ export function getVideoQualityOptions(options) {
selectedIndex = qualityOptions.length - 1; selectedIndex = qualityOptions.length - 1;
} }
var currentQualityOption = qualityOptions[selectedIndex]; const currentQualityOption = qualityOptions[selectedIndex];
if (!options.isAutomaticBitrateEnabled) { if (!options.isAutomaticBitrateEnabled) {
currentQualityOption.selected = true; currentQualityOption.selected = true;
@ -102,9 +102,9 @@ export function getVideoQualityOptions(options) {
} }
export function getAudioQualityOptions(options) { export function getAudioQualityOptions(options) {
var maxStreamingBitrate = options.currentMaxBitrate; const maxStreamingBitrate = options.currentMaxBitrate;
var qualityOptions = []; const qualityOptions = [];
qualityOptions.push({ name: '2 Mbps', bitrate: 2000000 }); qualityOptions.push({ name: '2 Mbps', bitrate: 2000000 });
qualityOptions.push({ name: '1.5 Mbps', bitrate: 1500000 }); qualityOptions.push({ name: '1.5 Mbps', bitrate: 1500000 });
@ -116,7 +116,7 @@ export function getAudioQualityOptions(options) {
qualityOptions.push({ name: '96 kbps', bitrate: 96000 }); qualityOptions.push({ name: '96 kbps', bitrate: 96000 });
qualityOptions.push({ name: '64 kbps', bitrate: 64000 }); qualityOptions.push({ name: '64 kbps', bitrate: 64000 });
var autoQualityOption = { const autoQualityOption = {
name: globalize.translate('Auto'), name: globalize.translate('Auto'),
bitrate: 0, bitrate: 0,
selected: options.isAutomaticBitrateEnabled selected: options.isAutomaticBitrateEnabled
@ -127,9 +127,9 @@ export function getAudioQualityOptions(options) {
} }
if (maxStreamingBitrate) { if (maxStreamingBitrate) {
var selectedIndex = -1; let selectedIndex = -1;
for (var i = 0, length = qualityOptions.length; i < length; i++) { for (let i = 0, length = qualityOptions.length; i < length; i++) {
var option = qualityOptions[i]; const option = qualityOptions[i];
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) { if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
selectedIndex = i; selectedIndex = i;
@ -140,7 +140,7 @@ export function getAudioQualityOptions(options) {
selectedIndex = qualityOptions.length - 1; selectedIndex = qualityOptions.length - 1;
} }
var currentQualityOption = qualityOptions[selectedIndex]; const currentQualityOption = qualityOptions[selectedIndex];
if (!options.isAutomaticBitrateEnabled) { if (!options.isAutomaticBitrateEnabled) {
currentQualityOption.selected = true; currentQualityOption.selected = true;

View file

@ -0,0 +1,41 @@
import globalize from 'globalize';
import toast from 'toast';
export class QuickConnectSettings {
constructor() { }
authorize(code) {
const url = ApiClient.getUrl('/QuickConnect/Authorize?Code=' + code);
ApiClient.ajax({
type: 'POST',
url: url
}, true).then(() => {
toast(globalize.translate('QuickConnectAuthorizeSuccess'));
}).catch(() => {
toast(globalize.translate('QuickConnectAuthorizeFail'));
});
// prevent bubbling
return false;
}
activate() {
const url = ApiClient.getUrl('/QuickConnect/Activate');
return ApiClient.ajax({
type: 'POST',
url: url
}).then(() => {
toast(globalize.translate('QuickConnectActivationSuccessful'));
return true;
}).catch((e) => {
console.error('Error activating quick connect. Error:', e);
Dashboard.alert({
title: globalize.translate('HeaderError'),
message: globalize.translate('DefaultErrorMessage')
});
throw e;
});
}
}
export default QuickConnectSettings;

View file

@ -1,4 +1,3 @@
import connectionManager from 'connectionManager';
import dom from 'dom'; import dom from 'dom';
import recordingHelper from 'recordingHelper'; import recordingHelper from 'recordingHelper';
import 'paper-icon-button-light'; import 'paper-icon-button-light';
@ -53,7 +52,7 @@ class RecordingButton {
} }
refresh(serverId, itemId) { refresh(serverId, itemId) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
const self = this; const self = this;
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) { apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
self.refreshItem(item); self.refreshItem(item);

View file

@ -2,7 +2,6 @@ import dialogHelper from 'dialogHelper';
import globalize from 'globalize'; import globalize from 'globalize';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import mediaInfo from 'mediaInfo'; import mediaInfo from 'mediaInfo';
import connectionManager from 'connectionManager';
import require from 'require'; import require from 'require';
import loading from 'loading'; import loading from 'loading';
import scrollHelper from 'scrollHelper'; import scrollHelper from 'scrollHelper';
@ -103,7 +102,7 @@ function renderRecording(context, defaultTimer, program, apiClient, refreshRecor
function reload(context, programId, serverId, refreshRecordingStateOnly) { function reload(context, programId, serverId, refreshRecordingStateOnly) {
loading.show(); loading.show();
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
const promise1 = apiClient.getNewLiveTvTimerDefaults({ programId: programId }); const promise1 = apiClient.getNewLiveTvTimerDefaults({ programId: programId });
const promise2 = apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()); const promise2 = apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId());
@ -119,7 +118,7 @@ function reload(context, programId, serverId, refreshRecordingStateOnly) {
function executeCloseAction(action, programId, serverId) { function executeCloseAction(action, programId, serverId) {
if (action === 'play') { if (action === 'play') {
import('playbackManager').then(({ default: playbackManager }) => { import('playbackManager').then(({ default: playbackManager }) => {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()).then(function (item) { apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()).then(function (item) {
playbackManager.play({ playbackManager.play({

View file

@ -1,7 +1,6 @@
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import globalize from 'globalize'; import globalize from 'globalize';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import connectionManager from 'connectionManager';
import loading from 'loading'; import loading from 'loading';
import scrollHelper from 'scrollHelper'; import scrollHelper from 'scrollHelper';
import 'scrollStyles'; import 'scrollStyles';
@ -41,7 +40,7 @@ function closeDialog(isDeleted) {
function onSubmit(e) { function onSubmit(e) {
const form = this; const form = this;
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
apiClient.getLiveTvTimer(currentItemId).then(function (item) { apiClient.getLiveTvTimer(currentItemId).then(function (item) {
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60; item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
@ -61,7 +60,7 @@ function init(context) {
}); });
context.querySelector('.btnCancelRecording').addEventListener('click', function () { context.querySelector('.btnCancelRecording').addEventListener('click', function () {
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
deleteTimer(apiClient, currentItemId).then(function () { deleteTimer(apiClient, currentItemId).then(function () {
closeDialog(true); closeDialog(true);
@ -75,7 +74,7 @@ function reload(context, id) {
loading.show(); loading.show();
currentItemId = id; currentItemId = id;
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
apiClient.getLiveTvTimer(id).then(function (result) { apiClient.getLiveTvTimer(id).then(function (result) {
renderTimer(context, result, apiClient); renderTimer(context, result, apiClient);
loading.hide(); loading.hide();

View file

@ -1,5 +1,4 @@
import globalize from 'globalize'; import globalize from 'globalize';
import connectionManager from 'connectionManager';
import serverNotifications from 'serverNotifications'; import serverNotifications from 'serverNotifications';
import loading from 'loading'; import loading from 'loading';
import dom from 'dom'; import dom from 'dom';
@ -46,7 +45,7 @@ function loadData(parent, program, apiClient) {
function fetchData(instance) { function fetchData(instance) {
const options = instance.options; const options = instance.options;
const apiClient = connectionManager.getApiClient(options.serverId); const apiClient = window.connectionManager.getApiClient(options.serverId);
options.parent.querySelector('.recordingFields').classList.remove('hide'); options.parent.querySelector('.recordingFields').classList.remove('hide');
return apiClient.getLiveTvProgram(options.programId, apiClient.getCurrentUserId()).then(function (program) { return apiClient.getLiveTvProgram(options.programId, apiClient.getCurrentUserId()).then(function (program) {
@ -197,7 +196,7 @@ function onRecordChange(e) {
const self = this; const self = this;
const options = this.options; const options = this.options;
const apiClient = connectionManager.getApiClient(options.serverId); const apiClient = window.connectionManager.getApiClient(options.serverId);
const button = dom.parentWithTag(e.target, 'BUTTON'); const button = dom.parentWithTag(e.target, 'BUTTON');
const isChecked = !button.querySelector('.material-icons').classList.contains('recordingIcon-active'); const isChecked = !button.querySelector('.material-icons').classList.contains('recordingIcon-active');
@ -236,7 +235,7 @@ function onRecordSeriesChange(e) {
const self = this; const self = this;
const options = this.options; const options = this.options;
const apiClient = connectionManager.getApiClient(options.serverId); const apiClient = window.connectionManager.getApiClient(options.serverId);
const button = dom.parentWithTag(e.target, 'BUTTON'); const button = dom.parentWithTag(e.target, 'BUTTON');
const isChecked = !button.querySelector('.material-icons').classList.contains('recordingIcon-active'); const isChecked = !button.querySelector('.material-icons').classList.contains('recordingIcon-active');

View file

@ -1,6 +1,5 @@
import globalize from 'globalize'; import globalize from 'globalize';
import loading from 'loading'; import loading from 'loading';
import connectionManager from 'connectionManager';
/*eslint prefer-const: "error"*/ /*eslint prefer-const: "error"*/
@ -40,7 +39,7 @@ function cancelTimerWithConfirmation(timerId, serverId) {
}).then(function () { }).then(function () {
loading.show(); loading.show();
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
cancelTimer(apiClient, timerId, true).then(resolve, reject); cancelTimer(apiClient, timerId, true).then(resolve, reject);
}, reject); }, reject);
}); });
@ -60,7 +59,7 @@ function cancelSeriesTimerWithConfirmation(timerId, serverId) {
}).then(function () { }).then(function () {
loading.show(); loading.show();
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
apiClient.cancelLiveTvSeriesTimer(timerId).then(function () { apiClient.cancelLiveTvSeriesTimer(timerId).then(function () {
import('toast').then(({default: toast}) => { import('toast').then(({default: toast}) => {
toast(globalize.translate('SeriesCancelled')); toast(globalize.translate('SeriesCancelled'));
@ -141,7 +140,7 @@ function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus,
buttons: items buttons: items
}).then(function (result) { }).then(function (result) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
if (result === 'canceltimer') { if (result === 'canceltimer') {
loading.show(); loading.show();
@ -167,7 +166,7 @@ function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus,
} }
function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) { function toggleRecording(serverId, programId, timerId, timerStatus, seriesTimerId) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
const hasTimer = timerId && timerStatus !== 'Cancelled'; const hasTimer = timerId && timerStatus !== 'Cancelled';
if (seriesTimerId && hasTimer) { if (seriesTimerId && hasTimer) {
// cancel // cancel

View file

@ -1,7 +1,6 @@
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import globalize from 'globalize'; import globalize from 'globalize';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import connectionManager from 'connectionManager';
import loading from 'loading'; import loading from 'loading';
import scrollHelper from 'scrollHelper'; import scrollHelper from 'scrollHelper';
import datetime from 'datetime'; import datetime from 'datetime';
@ -64,7 +63,7 @@ function closeDialog(isDeleted) {
function onSubmit(e) { function onSubmit(e) {
const form = this; const form = this;
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
apiClient.getLiveTvSeriesTimer(currentItemId).then(function (item) { apiClient.getLiveTvSeriesTimer(currentItemId).then(function (item) {
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60; item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
@ -92,7 +91,7 @@ function init(context) {
}); });
context.querySelector('.btnCancelRecording').addEventListener('click', function () { context.querySelector('.btnCancelRecording').addEventListener('click', function () {
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
deleteTimer(apiClient, currentItemId).then(function () { deleteTimer(apiClient, currentItemId).then(function () {
closeDialog(true); closeDialog(true);
}); });
@ -102,7 +101,7 @@ function init(context) {
} }
function reload(context, id) { function reload(context, id) {
const apiClient = connectionManager.getApiClient(currentServerId); const apiClient = window.connectionManager.getApiClient(currentServerId);
loading.show(); loading.show();
if (typeof id === 'string') { if (typeof id === 'string') {

View file

@ -2,7 +2,6 @@ import dom from 'dom';
import dialogHelper from 'dialogHelper'; import dialogHelper from 'dialogHelper';
import loading from 'loading'; import loading from 'loading';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import connectionManager from 'connectionManager';
import globalize from 'globalize'; import globalize from 'globalize';
import 'emby-input'; import 'emby-input';
import 'emby-checkbox'; import 'emby-checkbox';
@ -66,7 +65,7 @@ function onSubmit(e) {
const dlg = dom.parentWithClass(e.target, 'dialog'); const dlg = dom.parentWithClass(e.target, 'dialog');
const options = instance.options; const options = instance.options;
const apiClient = connectionManager.getApiClient(options.serverId); const apiClient = window.connectionManager.getApiClient(options.serverId);
const replaceAllMetadata = dlg.querySelector('#selectMetadataRefreshMode').value === 'all'; const replaceAllMetadata = dlg.querySelector('#selectMetadataRefreshMode').value === 'all';

View file

@ -5,7 +5,6 @@ import imageLoader from 'imageLoader';
import playbackManager from 'playbackManager'; import playbackManager from 'playbackManager';
import nowPlayingHelper from 'nowPlayingHelper'; import nowPlayingHelper from 'nowPlayingHelper';
import events from 'events'; import events from 'events';
import connectionManager from 'connectionManager';
import appHost from 'apphost'; import appHost from 'apphost';
import globalize from 'globalize'; import globalize from 'globalize';
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
@ -96,18 +95,18 @@ function seriesImageUrl(item, options) {
options.type = options.type || 'Primary'; options.type = options.type || 'Primary';
if (options.type === 'Primary' && item.SeriesPrimaryImageTag) { if (options.type === 'Primary' && item.SeriesPrimaryImageTag) {
options.tag = item.SeriesPrimaryImageTag; options.tag = item.SeriesPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} }
if (options.type === 'Thumb') { if (options.type === 'Thumb') {
if (item.SeriesThumbImageTag) { if (item.SeriesThumbImageTag) {
options.tag = item.SeriesThumbImageTag; options.tag = item.SeriesThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
} }
if (item.ParentThumbImageTag) { if (item.ParentThumbImageTag) {
options.tag = item.ParentThumbImageTag; options.tag = item.ParentThumbImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
} }
} }
@ -120,12 +119,12 @@ function imageUrl(item, options) {
if (item.ImageTags && item.ImageTags[options.type]) { if (item.ImageTags && item.ImageTags[options.type]) {
options.tag = item.ImageTags[options.type]; options.tag = item.ImageTags[options.type];
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
} }
if (item.AlbumId && item.AlbumPrimaryImageTag) { if (item.AlbumId && item.AlbumPrimaryImageTag) {
options.tag = item.AlbumPrimaryImageTag; options.tag = item.AlbumPrimaryImageTag;
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options); return window.connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
} }
return null; return null;
@ -216,7 +215,7 @@ function updateNowPlayingInfo(context, state, serverId) {
openAlbum: false, openAlbum: false,
positionTo: contextButton positionTo: contextButton
}; };
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) { apiClient.getItem(apiClient.getCurrentUserId(), item.Id).then(function (fullItem) {
apiClient.getCurrentUser().then(function (user) { apiClient.getCurrentUser().then(function (user) {
contextButton.addEventListener('click', function () { contextButton.addEventListener('click', function () {

View file

@ -1,7 +1,7 @@
define(function () { define(function () {
'use strict'; 'use strict';
var requireCss = {}; const requireCss = {};
requireCss.normalize = function (name, normalize) { requireCss.normalize = function (name, normalize) {
if (name.substr(name.length - 4, 4) === '.css') { if (name.substr(name.length - 4, 4) === '.css') {
@ -11,7 +11,7 @@ define(function () {
return normalize(name); return normalize(name);
}; };
var importedCss = []; let importedCss = [];
function isLoaded(url) { function isLoaded(url) {
return importedCss.indexOf(url) !== -1; return importedCss.indexOf(url) !== -1;
@ -27,14 +27,14 @@ define(function () {
requireCss.load = function (cssId, req, load, config) { requireCss.load = function (cssId, req, load, config) {
// Somehow if the url starts with /css, require will get all screwed up since this extension is also called css // Somehow if the url starts with /css, require will get all screwed up since this extension is also called css
var srch = 'components/require/requirecss'; const srch = 'components/require/requirecss';
var index = cssId.indexOf(srch); const index = cssId.indexOf(srch);
if (index !== -1) { if (index !== -1) {
cssId = 'css' + cssId.substring(index + srch.length); cssId = 'css' + cssId.substring(index + srch.length);
} }
var url = cssId + '.css'; let url = cssId + '.css';
if (url.indexOf('://') === -1) { if (url.indexOf('://') === -1) {
url = config.baseUrl + url; url = config.baseUrl + url;
@ -43,13 +43,13 @@ define(function () {
if (!isLoaded(url)) { if (!isLoaded(url)) {
importedCss.push(url); importedCss.push(url);
var link = document.createElement('link'); const link = document.createElement('link');
link.setAttribute('rel', 'stylesheet'); link.setAttribute('rel', 'stylesheet');
link.setAttribute('type', 'text/css'); link.setAttribute('type', 'text/css');
link.onload = load; link.onload = load;
var linkUrl = url; let linkUrl = url;
if (config.urlArgs) { if (config.urlArgs) {
linkUrl += config.urlArgs(cssId, url); linkUrl += config.urlArgs(cssId, url);

View file

@ -2,7 +2,7 @@ define(function () {
'use strict'; 'use strict';
// hack to work around the server's auto-redirection feature // hack to work around the server's auto-redirection feature
var addRedirectPrevention = window.dashboardVersion != null && window.Dashboard && !window.AppInfo.isNativeApp; const addRedirectPrevention = window.dashboardVersion != null && window.Dashboard && !window.AppInfo.isNativeApp;
return { return {
@ -25,7 +25,7 @@ define(function () {
url += 'r=0'; url += 'r=0';
} }
var xhr = new XMLHttpRequest(); const xhr = new XMLHttpRequest();
xhr.open('GET', url, true); xhr.open('GET', url, true);
xhr.onload = function (e) { xhr.onload = function (e) {

View file

@ -1,6 +1,5 @@
import layoutManager from 'layoutManager'; import layoutManager from 'layoutManager';
import globalize from 'globalize'; import globalize from 'globalize';
import connectionManager from 'connectionManager';
import cardBuilder from 'cardBuilder'; import cardBuilder from 'cardBuilder';
import appRouter from 'appRouter'; import appRouter from 'appRouter';
import 'emby-scroller'; import 'emby-scroller';
@ -606,7 +605,7 @@ class SearchResults {
embed(options.element, this, options); embed(options.element, this, options);
} }
search(value) { search(value) {
const apiClient = connectionManager.getApiClient(this.options.serverId); const apiClient = window.connectionManager.getApiClient(this.options.serverId);
search(this, apiClient, this.options.element, value); search(this, apiClient, this.options.element, value);
} }

View file

@ -2,7 +2,7 @@
(function () { (function () {
'use strict'; 'use strict';
var connectionManager; let connectionManager;
function getApiClient(serverId) { function getApiClient(serverId) {
if (connectionManager) { if (connectionManager) {
@ -15,8 +15,7 @@
return getApiClient(serverId).then(function (apiClient) { return getApiClient(serverId).then(function (apiClient) {
switch (action) { switch (action) {
case 'cancel-install': case 'cancel-install':
var id = data.id; return apiClient.cancelPackageInstallation(data.id);
return apiClient.cancelPackageInstallation(id);
case 'restart': case 'restart':
return apiClient.restartServer(); return apiClient.restartServer();
default: default:
@ -28,12 +27,12 @@
/* eslint-disable-next-line no-restricted-globals -- self is valid in a serviceworker environment */ /* eslint-disable-next-line no-restricted-globals -- self is valid in a serviceworker environment */
self.addEventListener('notificationclick', function (event) { self.addEventListener('notificationclick', function (event) {
var notification = event.notification; const notification = event.notification;
notification.close(); notification.close();
var data = notification.data; const data = notification.data;
var serverId = data.serverId; const serverId = data.serverId;
var action = event.action; const action = event.action;
if (!action) { if (!action) {
clients.openWindow('/'); clients.openWindow('/');

View file

@ -7,7 +7,6 @@
import playbackManager from 'playbackManager'; import playbackManager from 'playbackManager';
import inputManager from 'inputManager'; import inputManager from 'inputManager';
import connectionManager from 'connectionManager';
import appRouter from 'appRouter'; import appRouter from 'appRouter';
import globalize from 'globalize'; import globalize from 'globalize';
import dom from 'dom'; import dom from 'dom';
@ -81,7 +80,7 @@ import recordingHelper from 'recordingHelper';
const id = button.getAttribute('data-id'); const id = button.getAttribute('data-id');
const type = button.getAttribute('data-type'); const type = button.getAttribute('data-type');
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
if (type === 'Timer') { if (type === 'Timer') {
return apiClient.getLiveTvTimer(id); return apiClient.getLiveTvTimer(id);
@ -111,7 +110,7 @@ import recordingHelper from 'recordingHelper';
} }
import('itemContextMenu').then(({default: itemContextMenu}) => { import('itemContextMenu').then(({default: itemContextMenu}) => {
connectionManager.getApiClient(item.ServerId).getCurrentUser().then(user => { window.connectionManager.getApiClient(item.ServerId).getCurrentUser().then(user => {
itemContextMenu.show(Object.assign({ itemContextMenu.show(Object.assign({
item: item, item: item,
play: true, play: true,
@ -280,7 +279,7 @@ import recordingHelper from 'recordingHelper';
} }
function playTrailer(item) { function playTrailer(item) {
const apiClient = connectionManager.getApiClient(item.ServerId); const apiClient = window.connectionManager.getApiClient(item.ServerId);
apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(trailers => { apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(trailers => {
playbackManager.play({ items: trailers }); playbackManager.play({ items: trailers });
@ -288,7 +287,7 @@ import recordingHelper from 'recordingHelper';
} }
function editItem(item, serverId) { function editItem(item, serverId) {
const apiClient = connectionManager.getApiClient(serverId); const apiClient = window.connectionManager.getApiClient(serverId);
return new Promise((resolve, reject) => { return new Promise((resolve, reject) => {
const serverId = apiClient.serverInfo().Id; const serverId = apiClient.serverInfo().Id;

Some files were not shown because too many files have changed in this diff Show more