Merge remote-tracking branch 'upstream/master' into unavailable-yt-video-trailer-bug-fix

This commit is contained in:
Dmitry Lyzo 2020-10-29 21:44:38 +03:00
commit 7774a4aa00
313 changed files with 12147 additions and 10106 deletions

View File

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

View File

@ -1,3 +1,5 @@
const restrictedGlobals = require('confusing-browser-globals');
module.exports = {
root: true,
plugins: [
@ -39,14 +41,15 @@ module.exports = {
'no-floating-decimal': ['error'],
'no-multi-spaces': ['error'],
'no-multiple-empty-lines': ['error', { 'max': 1 }],
'no-restricted-globals': ['error'].concat(restrictedGlobals),
'no-trailing-spaces': ['error'],
'@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'],
'padded-blocks': ['error', 'never'],
//'prefer-const': ['error', {'destructuring': 'all'}],
'prefer-const': ['error', {'destructuring': 'all'}],
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
'@babel/semi': ['error'],
'no-var': ['error'],
'space-before-blocks': ['error'],
'space-infix-ops': 'error',
'yoda': 'error'
@ -81,7 +84,6 @@ module.exports = {
'ApiClient': 'writable',
'AppInfo': 'writable',
'chrome': 'writable',
'ConnectionManager': 'writable',
'DlnaProfilePage': 'writable',
'Dashboard': 'writable',
'DashboardPage': 'writable',

3
.gitignore vendored
View File

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

View File

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

View File

@ -14,6 +14,9 @@ BuildRequires: yarn
%else
BuildRequires: nodejs-yarn
%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
# Disable Automatic Dependency Processing

View File

@ -5,27 +5,28 @@
"repository": "https://github.com/jellyfin/jellyfin-web",
"license": "GPL-2.0-or-later",
"devDependencies": {
"@babel/core": "^7.11.1",
"@babel/eslint-parser": "^7.11.3",
"@babel/eslint-plugin": "^7.11.3",
"@babel/core": "^7.12.3",
"@babel/eslint-parser": "^7.12.1",
"@babel/eslint-plugin": "^7.12.1",
"@babel/plugin-proposal-class-properties": "^7.10.1",
"@babel/plugin-proposal-private-methods": "^7.10.1",
"@babel/plugin-transform-modules-amd": "^7.10.5",
"@babel/polyfill": "^7.8.7",
"@babel/preset-env": "^7.11.0",
"@babel/plugin-proposal-private-methods": "^7.12.1",
"@babel/plugin-transform-modules-amd": "^7.12.1",
"@babel/polyfill": "^7.12.1",
"@babel/preset-env": "^7.12.1",
"autoprefixer": "^9.8.6",
"babel-loader": "^8.0.6",
"browser-sync": "^2.26.12",
"browser-sync": "^2.26.13",
"confusing-browser-globals": "^1.0.10",
"copy-webpack-plugin": "^5.1.1",
"css-loader": "^4.2.1",
"css-loader": "^5.0.0",
"cssnano": "^4.1.10",
"del": "^5.1.0",
"eslint": "^7.7.0",
"del": "^6.0.0",
"eslint": "^7.12.0",
"eslint-plugin-compat": "^3.5.1",
"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",
"file-loader": "^6.0.0",
"file-loader": "^6.1.1",
"gulp": "^4.0.2",
"gulp-babel": "^8.0.0",
"gulp-cli": "^2.3.0",
@ -38,49 +39,51 @@
"gulp-postcss": "^8.0.0",
"gulp-sass": "^4.0.2",
"gulp-sourcemaps": "^2.6.5",
"gulp-terser": "^1.3.2",
"html-webpack-plugin": "^4.3.0",
"gulp-terser": "^1.4.0",
"html-webpack-plugin": "^4.5.0",
"lazypipe": "^1.0.2",
"node-sass": "^4.13.1",
"postcss-loader": "^3.0.0",
"postcss-preset-env": "^6.7.0",
"style-loader": "^1.1.3",
"stylelint": "^13.6.1",
"style-loader": "^2.0.0",
"stylelint": "^13.7.2",
"stylelint-config-rational-order": "^0.1.2",
"stylelint-no-browser-hacks": "^1.2.1",
"stylelint-order": "^4.1.0",
"webpack": "^4.44.1",
"webpack": "^5.2.0",
"webpack-merge": "^4.2.2",
"webpack-stream": "^5.2.1"
"webpack-stream": "^6.1.0",
"worker-plugin": "^5.0.0"
},
"dependencies": {
"alameda": "^1.4.0",
"blurhash": "^1.1.3",
"classlist.js": "https://github.com/eligrey/classList.js/archive/1.2.20180112.tar.gz",
"core-js": "^3.6.5",
"date-fns": "^2.15.0",
"date-fns": "^2.16.1",
"epubjs": "^0.3.85",
"fast-text-encoding": "^1.0.3",
"flv.js": "^1.5.0",
"headroom.js": "^0.11.0",
"hls.js": "^0.14.8",
"howler": "^2.2.0",
"headroom.js": "^0.12.0",
"hls.js": "^0.14.16",
"howler": "^2.2.1",
"intersection-observer": "^0.11.0",
"jellyfin-apiclient": "^1.4.1",
"jellyfin-apiclient": "^1.4.2",
"jellyfin-noto": "https://github.com/jellyfin/jellyfin-noto",
"jquery": "^3.5.1",
"jstree": "^3.3.10",
"libarchive.js": "^1.3.0",
"libass-wasm": "https://github.com/jellyfin/JavascriptSubtitlesOctopus#4.0.0-jf-smarttv",
"material-design-icons-iconfont": "^5.0.1",
"material-design-icons-iconfont": "^6.1.0",
"native-promise-only": "^0.8.0-a",
"page": "^1.11.6",
"query-string": "^6.13.1",
"query-string": "^6.13.6",
"resize-observer-polyfill": "^1.5.1",
"screenfull": "^5.0.2",
"sortablejs": "^1.10.2",
"swiper": "^5.4.5",
"sortablejs": "^1.12.0",
"swiper": "^6.3.4",
"webcomponents.js": "^0.7.24",
"whatwg-fetch": "^3.4.0"
"whatwg-fetch": "^3.4.1"
},
"babel": {
"presets": [
@ -163,6 +166,8 @@
"src/components/playmenu.js",
"src/components/pluginManager.js",
"src/components/prompt/prompt.js",
"src/components/qualityOptions.js",
"src/components/quickConnectSettings/quickConnectSettings.js",
"src/components/recordingcreator/recordingbutton.js",
"src/components/recordingcreator/recordingcreator.js",
"src/components/recordingcreator/seriesrecordingeditor.js",
@ -170,13 +175,13 @@
"src/components/refreshdialog/refreshdialog.js",
"src/components/recordingcreator/recordingeditor.js",
"src/components/recordingcreator/recordingfields.js",
"src/components/qualityOptions.js",
"src/components/remotecontrol/remotecontrol.js",
"src/components/sanatizefilename.js",
"src/components/scrollManager.js",
"src/plugins/experimentalWarnings/plugin.js",
"src/plugins/sessionPlayer/plugin.js",
"src/plugins/htmlAudioPlayer/plugin.js",
"src/plugins/comicsPlayer/plugin.js",
"src/plugins/chromecastPlayer/plugin.js",
"src/components/slideshow/slideshow.js",
"src/components/sortmenu/sortmenu.js",
@ -209,7 +214,7 @@
"src/components/castSenderApi.js",
"src/controllers/session/addServer/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/selectServer/index.js",
"src/controllers/dashboard/apikeys.js",
@ -240,6 +245,7 @@
"src/controllers/dashboard/plugins/installed/index.js",
"src/controllers/dashboard/plugins/available/index.js",
"src/controllers/dashboard/plugins/repositories/index.js",
"src/controllers/dashboard/quickConnect.js",
"src/controllers/dashboard/scheduledtasks/scheduledtask.js",
"src/controllers/dashboard/scheduledtasks/scheduledtasks.js",
"src/controllers/dashboard/serveractivity.js",
@ -288,6 +294,7 @@
"src/controllers/user/menu/index.js",
"src/controllers/user/playback/index.js",
"src/controllers/user/profile/index.js",
"src/controllers/user/quickConnect/index.js",
"src/controllers/user/subtitles/index.js",
"src/controllers/wizard/finish/index.js",
"src/controllers/wizard/remote/index.js",
@ -320,10 +327,12 @@
"src/plugins/backdropScreensaver/plugin.js",
"src/plugins/bookPlayer/plugin.js",
"src/plugins/bookPlayer/tableOfContents.js",
"src/plugins/chromecastPlayer/chromecastHelper.js",
"src/plugins/photoPlayer/plugin.js",
"src/plugins/youtubePlayer/plugin.js",
"src/scripts/alphanumericshortcuts.js",
"src/scripts/autoBackdrops.js",
"src/scripts/autocast.js",
"src/scripts/browser.js",
"src/scripts/clientUtils.js",
"src/scripts/datetime.js",

View File

@ -16,7 +16,7 @@ langlst.append('en-us.json')
dep = []
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)
output = p.stdout.readlines()
if output:

View File

@ -1,7 +1,5 @@
html {
font-family: "Noto Sans", sans-serif;
font-size: 93%;
-webkit-text-size-adjust: 100%;
text-size-adjust: 100%;
-webkit-font-smoothing: antialiased;
text-rendering: optimizeLegibility;
@ -29,7 +27,9 @@ h3 {
}
.layout-tv {
font-size: 130%;
/* Per WebOS and Tizen guidelines, fonts must be 20px minimum.
This takes the 16px baseline and multiplies it by 1.25 to get 20px. */
font-size: 125%;
}
.layout-mobile {

View File

@ -28,6 +28,10 @@
padding-top: 0 !important;
}
.layout-tv .itemDetailPage {
padding-top: 4.2em !important;
}
.standalonePage {
padding-top: 4.5em !important;
}
@ -163,6 +167,12 @@
transition: background ease-in-out 0.5s;
}
.layout-tv .skinHeader {
/* In TV layout, it makes more sense to keep the top bar at the top of the page
Having it follow the view only makes us lose vertical space, while not being focusable */
position: relative;
}
.hiddenViewMenuBar .skinHeader {
display: none;
}
@ -447,8 +457,7 @@
height: 26.5vh;
}
.layout-desktop .itemBackdrop::after,
.layout-tv .itemBackdrop::after {
.layout-desktop .itemBackdrop::after {
content: "";
width: 100%;
height: 100%;
@ -456,8 +465,8 @@
display: block;
}
.layout-desktop .noBackdrop .itemBackdrop,
.layout-tv .noBackdrop .itemBackdrop {
.layout-tv .itemBackdrop,
.layout-desktop .noBackdrop .itemBackdrop {
display: none;
}
@ -624,6 +633,10 @@
z-index: 2;
}
.layout-tv .detailPagePrimaryContainer {
display: block;
}
.layout-mobile .detailPagePrimaryContainer {
display: block;
position: relative;
@ -637,12 +650,16 @@
padding-left: 32.45vw;
}
.layout-desktop .detailRibbon,
.layout-tv .detailRibbon {
.layout-desktop .detailRibbon {
margin-top: -7.2em;
height: 7.2em;
}
.layout-tv .detailRibbon {
margin-top: 0;
height: inherit;
}
.layout-desktop .noBackdrop .detailRibbon,
.layout-tv .noBackdrop .detailRibbon {
margin-top: 0;
@ -748,8 +765,7 @@ div.itemDetailGalleryLink.defaultCardBackground {
position: relative;
}
.layout-desktop .itemBackdrop,
.layout-tv .itemBackdrop {
.layout-desktop .itemBackdrop {
height: 40vh;
}
@ -775,13 +791,8 @@ div.itemDetailGalleryLink.defaultCardBackground {
}
.emby-button.detailFloatingButton {
position: absolute;
background-color: rgba(0, 0, 0, 0.5);
z-index: 3;
top: 100%;
left: 90%;
margin: -2.2em 0 0 -2.2em;
padding: 0.4em;
font-size: 1.4em;
margin-right: 0.5em !important;
color: rgba(255, 255, 255, 0.76);
}
@ -844,7 +855,7 @@ div.itemDetailGalleryLink.defaultCardBackground {
-webkit-align-items: center;
align-items: center;
margin: 0 !important;
padding: 0.5em 0.7em !important;
padding: 0.7em 0.7em !important;
}
@media all and (min-width: 29em) {
@ -913,10 +924,6 @@ div.itemDetailGalleryLink.defaultCardBackground {
}
@media all and (min-width: 100em) {
.detailFloatingButton {
display: none !important;
}
.personBackdrop {
display: none !important;
}
@ -925,6 +932,11 @@ div.itemDetailGalleryLink.defaultCardBackground {
font-size: 108%;
margin: 1.25em 0;
}
.layout-tv .mainDetailButtons {
font-size: 108%;
margin: 1em 0 1.25em;
}
}
@media all and (max-width: 50em) {
@ -1140,13 +1152,13 @@ div:not(.sectionTitleContainer-cards) > .sectionTitle-cards {
}
.layout-tv .padded-top-focusscale {
padding-top: 1em;
margin-top: -1em;
padding-top: 1.5em;
margin-top: -1.5em;
}
.layout-tv .padded-bottom-focusscale {
padding-bottom: 1em;
margin-bottom: -1em;
padding-bottom: 1.5em;
margin-bottom: -1.5em;
}
@media all and (min-height: 31.25em) {

View File

@ -6,29 +6,42 @@
-ms-user-select: none;
}
.osdPoster img,
.videoOsdBottom {
bottom: 0;
left: 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 {
-webkit-transition: opacity 0.3s ease-out;
-o-transition: opacity 0.3s ease-out;
.skinHeader-withBackground.osdHeader {
transition: opacity 0.3s ease-out;
position: relative;
z-index: 1;
background: rgba(0, 0, 0, 0.7) !important;
-webkit-backdrop-filter: none !important;
backdrop-filter: none !important;
color: #eee !important;
background: linear-gradient(180deg, rgba(16, 16, 16, 0.75) 0%, rgba(16, 16, 16, 0) 100%);
backdrop-filter: none;
color: #eee;
height: 7.5em;
}
.osdHeader-hidden {
opacity: 0;
}
.osdHeader .headerTop {
max-height: 3.5em;
}
.osdHeader .headerButton:not(.headerBackButton):not(.headerCastButton):not(.headerSyncButton) {
display: none;
}
@ -86,34 +99,17 @@
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 {
opacity: 0;
}
.osdControls {
-webkit-box-flex: 1;
-webkit-flex-grow: 1;
flex-grow: 1;
padding: 0 0.8em;
}
.layout-desktop .osdControls {
max-width: calc(100vh * 1.77 - 2vh);
}
.videoOsdBottom .buttons {
@ -145,7 +141,7 @@
}
.volumeButtons {
margin: 0 0.5em 0 auto;
margin: 0 1em 0 0.29em;
display: flex;
-webkit-align-items: center;
align-items: center;
@ -153,33 +149,13 @@
.osdTimeText {
margin-left: 1em;
margin-right: auto;
-webkit-user-select: none;
-moz-user-select: none;
-ms-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,
.osdTitleSmall {
margin: 0 1em 0 0;
@ -248,8 +224,6 @@
}
@media all and (max-width: 30em) {
.btnFastForward,
.btnRewind,
.osdMediaInfo,
.osdPoster {
display: none !important;

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.5 KiB

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 39 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 46 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 42 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 36 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 45 KiB

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

After

Width:  |  Height:  |  Size: 33 KiB

View File

@ -60,8 +60,8 @@ _define('resize-observer-polyfill', function() {
});
// swiper
const swiper = require('swiper/js/swiper');
require('swiper/css/swiper.min.css');
const swiper = require('swiper/swiper-bundle');
require('swiper/swiper-bundle.css');
_define('swiper', function() {
return swiper;
});
@ -175,3 +175,9 @@ _define('connectionManagerFactory', function () {
_define('appStorage', function () {
return apiclient.AppStorage;
});
// libarchive.js
const libarchive = require('libarchive.js');
_define('libarchive', function () {
return libarchive;
});

View File

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

View File

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

View File

@ -2,7 +2,6 @@ import appHost from 'apphost';
import appSettings from 'appSettings';
import backdrop from 'backdrop';
import browser from 'browser';
import connectionManager from 'connectionManager';
import events from 'events';
import globalize from 'globalize';
import itemHelper from 'itemHelper';
@ -41,7 +40,7 @@ class AppRouter {
}
});
this.baseRoute = self.location.href.split('?')[0].replace(this.getRequestFile(), '');
this.baseRoute = window.location.href.split('?')[0].replace(this.getRequestFile(), '');
// support hashbang
this.baseRoute = this.baseRoute.split('#')[0];
if (this.baseRoute.endsWith('/') && !this.baseRoute.endsWith('://')) {
@ -55,7 +54,7 @@ class AppRouter {
* @private
*/
setBaseRoute() {
let baseRoute = self.location.pathname.replace(this.getRequestFile(), '');
let baseRoute = window.location.pathname.replace(this.getRequestFile(), '');
if (baseRoute.lastIndexOf('/') === baseRoute.length - 1) {
baseRoute = baseRoute.substring(0, baseRoute.length - 1);
}
@ -95,7 +94,7 @@ class AppRouter {
beginConnectionWizard() {
backdrop.clearBackdrop();
loading.show();
connectionManager.connect({
window.connectionManager.connect({
enableAutoLogin: appSettings.enableAutoLogin()
}).then((result) => {
this.handleConnectionResult(result);
@ -154,7 +153,7 @@ class AppRouter {
events.on(appHost, 'beforeexit', this.onBeforeExit);
events.on(appHost, 'resume', this.onAppResume);
connectionManager.connect({
window.connectionManager.connect({
enableAutoLogin: appSettings.enableAutoLogin()
}).then((result) => {
this.firstConnectionResult = result;
@ -182,7 +181,7 @@ class AppRouter {
return false;
}
return history.length > 1;
return window.history.length > 1;
}
current() {
@ -210,7 +209,7 @@ class AppRouter {
showItem(item, serverId, options) {
// TODO: Refactor this so it only gets items, not strings.
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) => {
this.showItem(itemObject, options);
});
@ -258,7 +257,7 @@ class AppRouter {
pushState(state, title, url) {
state.navigate = false;
history.pushState(state, title, url);
window.history.pushState(state, title, url);
}
enableNativeHistory() {
@ -309,7 +308,9 @@ class AppRouter {
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
if (url.indexOf('/') !== 0) {
url = '/' + url;
@ -492,15 +493,15 @@ class AppRouter {
}
initApiClients() {
connectionManager.getApiClients().forEach((apiClient) => {
window.connectionManager.getApiClients().forEach((apiClient) => {
this.initApiClient(apiClient, this);
});
events.on(connectionManager, 'apiclientcreated', this.onApiClientCreated);
events.on(window.connectionManager, 'apiclientcreated', this.onApiClientCreated);
}
onAppResume() {
const apiClient = connectionManager.currentApiClient();
const apiClient = window.connectionManager.currentApiClient();
if (apiClient) {
apiClient.ensureWebSocket();
@ -518,7 +519,7 @@ class AppRouter {
}
}
const apiClient = connectionManager.currentApiClient();
const apiClient = window.connectionManager.currentApiClient();
const pathname = ctx.pathname.toLowerCase();
console.debug('appRouter - processing path request ' + pathname);
@ -594,7 +595,7 @@ class AppRouter {
}
getRequestFile() {
let path = self.location.pathname || '';
let path = window.location.pathname || '';
const index = path.lastIndexOf('/');
if (index !== -1) {

View File

@ -55,7 +55,7 @@ function replaceAll(originalString, strReplace, strWith) {
function generateDeviceId() {
const keys = [];
if (keys.push(navigator.userAgent), keys.push(new Date().getTime()), self.btoa) {
if (keys.push(navigator.userAgent), keys.push(new Date().getTime()), window.btoa) {
const result = replaceAll(btoa(keys.join('|')), '=', '1');
return Promise.resolve(result);
}
@ -78,7 +78,7 @@ function getDeviceId() {
}
function getDeviceName() {
var deviceName;
let deviceName;
if (browser.tizen) {
deviceName = 'Samsung Smart TV';
} else if (browser.web0s) {
@ -404,9 +404,9 @@ document.addEventListener(visibilityChange, function () {
}
}, false);
if (self.addEventListener) {
self.addEventListener('focus', onAppVisible);
self.addEventListener('blur', onAppHidden);
if (window.addEventListener) {
window.addEventListener('focus', onAppVisible);
window.addEventListener('blur', onAppHidden);
}
export default appHost;

View File

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

View File

@ -209,6 +209,10 @@ button::-moz-focus-inner {
contain: strict;
}
.defaultCardBackground {
display: flex;
}
.cardContent:not(.defaultCardBackground) {
background-color: transparent;
}
@ -239,33 +243,13 @@ button::-moz-focus-inner {
border: none;
}
.cardImage-img {
max-height: 100%;
max-width: 100%;
/* This is simply for lazy image purposes, to ensure the image is visible sooner when scrolling */
min-height: 70%;
min-width: 70%;
margin: auto;
}
.coveredImage-img {
width: 100%;
height: 100%;
}
.coveredImage-noscale-img {
max-height: none;
max-width: none;
}
.coveredImage {
background-size: cover;
background-position: center center;
}
.coveredImage-noScale {
background-size: cover;
.coveredImage.coveredImage-contain {
background-size: contain;
}
.cardFooter {
@ -372,6 +356,8 @@ button::-moz-focus-inner {
.cardDefaultText {
white-space: normal;
text-align: center;
font-size: 2em;
font-weight: bold;
}
.cardImageContainer .cardImageIcon {

View File

@ -7,7 +7,6 @@
import datetime from 'datetime';
import imageLoader from 'imageLoader';
import connectionManager from 'connectionManager';
import itemHelper from 'itemHelper';
import focusManager from 'focusManager';
import indicators from 'indicators';
@ -371,7 +370,7 @@ import 'programStyles';
if (serverId !== lastServerId) {
lastServerId = serverId;
apiClient = connectionManager.getApiClient(lastServerId);
apiClient = window.connectionManager.getApiClient(lastServerId);
}
if (options.indexBy) {
@ -986,6 +985,10 @@ import 'programStyles';
lines = [];
}
if (overlayText && showTitle) {
lines = [item.Name];
}
const addRightTextMargin = isOuterFooter && options.cardLayout && !options.centerText && options.cardFooterAside !== 'none' && layoutManager.mobile;
html += getCardTextLines(lines, cssClass, !options.overlayText, isOuterFooter, options.cardLayout, addRightTextMargin, options.lines);
@ -1212,8 +1215,8 @@ import 'programStyles';
if (coveredImage) {
cardImageContainerClass += ' coveredImage';
if (item.MediaType === 'Photo' || item.Type === 'PhotoAlbum' || item.Type === 'Folder' || item.ProgramInfo || item.Type === 'Program' || item.Type === 'Recording') {
cardImageContainerClass += ' coveredImage-noScale';
if (item.Type === 'TvChannel') {
cardImageContainerClass += ' coveredImage-contain';
}
}

View File

@ -7,7 +7,6 @@
import datetime from 'datetime';
import imageLoader from 'imageLoader';
import connectionManager from 'connectionManager';
import layoutManager from 'layoutManager';
import browser from 'browser';
@ -48,7 +47,7 @@ import browser from 'browser';
let html = '';
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++) {
if (options.rows && itemsInRow === 0) {

View File

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

View File

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

View File

@ -19,7 +19,7 @@ export default (() => {
}
const text = replaceAll(options.text || '', '<br/>', '\n');
const result = confirm(text);
const result = window.confirm(text);
if (result) {
return Promise.resolve();

View File

@ -85,9 +85,9 @@ import 'scrollStyles';
}
if (!self.closedByBack && isHistoryEnabled(dlg)) {
const state = history.state || {};
const state = window.history.state || {};
if (state.dialogId === hash) {
history.back();
window.history.back();
}
}
@ -213,7 +213,7 @@ import 'scrollStyles';
export function close(dlg) {
if (isOpened(dlg)) {
if (isHistoryEnabled(dlg)) {
history.back();
window.history.back();
} else {
closeDialog(dlg);
}
@ -375,7 +375,7 @@ import 'scrollStyles';
dlg.setAttribute('data-lockscroll', 'true');
}
if (options.enableHistory !== false) {
if (options.enableHistory === true) {
dlg.setAttribute('data-history', 'true');
}

View File

@ -169,7 +169,8 @@ import 'emby-button';
data: JSON.stringify({
ValidateWriteable: validateWriteable,
Path: path
})
}),
contentType: 'application/json'
}).catch(response => {
if (response) {
if (response.status === 404) {

View File

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

View File

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

View File

@ -1,7 +1,6 @@
import dom from 'dom';
import dialogHelper from 'dialogHelper';
import globalize from 'globalize';
import connectionManager from 'connectionManager';
import events from 'events';
import 'emby-checkbox';
import 'emby-collapse';
@ -420,7 +419,7 @@ import 'css!./style.css';
this.bindEvents(dlg);
if (enableDynamicFilters(this.options.mode)) {
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);
}
});

View File

@ -6,12 +6,12 @@
<label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
data-filter="IsPlayed" />
<span>${OptionPlayed}</span>
<span>${Played}</span>
</label>
<label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
data-filter="IsUnPlayed" />
<span>${OptionUnplayed}</span>
<span>${Unplayed}</span>
</label>
<label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
@ -21,7 +21,7 @@
<label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkFavorite"
data-filter="IsFavorite" />
<span>${OptionFavorite}</span>
<span>${Favorites}</span>
</label>
<label>
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkLikes" data-filter="Likes" />
@ -53,11 +53,11 @@
<div class="checkboxList">
<label>
<input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Continuing" />
<span>${OptionContinuing}</span>
<span>${Continuing}</span>
</label>
<label>
<input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Ended" />
<span>${OptionEnded}</span>
<span>${Ended}</span>
</label>
</div>
</div>
@ -68,15 +68,15 @@
<div class="checkboxList">
<label>
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSubtitle" />
<span>${OptionHasSubtitles}</span>
<span>${Subtitles}</span>
</label>
<label>
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkTrailer" />
<span>${OptionHasTrailer}</span>
<span>${ButtonTrailer}</span>
</label>
<label>
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSpecialFeature" />
<span>${OptionHasSpecialFeatures}</span>
<span>${SpecialFeatures}</span>
</label>
<label>
<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 inputManager from 'inputManager';
import layoutManager from 'layoutManager';
import connectionManager from 'connectionManager';
import globalize from 'globalize';
import * as userSettings from 'userSettings';
import 'emby-checkbox';
@ -20,7 +19,7 @@ function onSubmit(e) {
return false;
}
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
var elem = context.querySelector(selector);
const elem = context.querySelector(selector);
if (items.length) {
elem.classList.remove('hide');
@ -28,12 +27,12 @@ function renderOptions(context, selector, cssClass, items, isCheckedFn) {
elem.classList.add('hide');
}
var html = '';
let html = '';
html += items.map(function (filter) {
var itemHtml = '';
let itemHtml = '';
var checkedHtml = isCheckedFn(filter) ? ' checked' : '';
const checkedHtml = isCheckedFn(filter) ? ' checked' : '';
itemHtml += '<label>';
itemHtml += '<input is="emby-checkbox" type="checkbox"' + checkedHtml + ' data-filter="' + filter.Id + '" class="' + cssClass + '"/>';
itemHtml += '<span>' + filter.Name + '</span>';
@ -48,21 +47,21 @@ function renderOptions(context, selector, cssClass, items, isCheckedFn) {
function renderDynamicFilters(context, result, options) {
renderOptions(context, '.genreFilters', 'chkGenreFilter', result.Genres, function (i) {
// 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;
});
}
function setBasicFilter(context, key, elem) {
var value = elem.checked;
let value = elem.checked;
value = value ? value : null;
userSettings.setFilter(key, value);
}
function moveCheckboxFocus(elem, offset) {
var parent = dom.parentWithClass(elem, 'checkboxList-verticalwrap');
var elems = focusManager.getFocusableElements(parent);
const parent = dom.parentWithClass(elem, 'checkboxList-verticalwrap');
const elems = focusManager.getFocusableElements(parent);
var index = -1;
let index = -1;
for (let i = 0, length = elems.length; i < length; i++) {
if (elems[i] === elem) {
index = i;
@ -75,14 +74,14 @@ function moveCheckboxFocus(elem, offset) {
index = Math.min(elems.length - 1, index);
index = Math.max(0, index);
var newElem = elems[index];
const newElem = elems[index];
if (newElem) {
focusManager.focus(newElem);
}
}
function centerFocus(elem, horiz, on) {
import('scrollHelper').then(({ default: scrollHelper }) => {
var fn = on ? 'on' : 'off';
const fn = on ? 'on' : 'off';
scrollHelper.centerFocus[fn](elem, horiz);
});
}
@ -101,7 +100,7 @@ function onInputCommand(e) {
}
}
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++) {
if (elems[i].tagName === 'INPUT') {
setBasicFilter(context, settingsKey + '-filter-' + elems[i].getAttribute('data-settingname'), elems[i]);
@ -111,7 +110,7 @@ function saveValues(context, settings, settingsKey) {
}
// Video type
var videoTypes = [];
const videoTypes = [];
elems = context.querySelectorAll('.chkVideoTypeFilter');
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(','));
// Series status
var seriesStatuses = [];
const seriesStatuses = [];
elems = context.querySelectorAll('.chkSeriesStatus');
for (let i = 0, length = elems.length; i < length; i++) {
@ -132,7 +131,7 @@ function saveValues(context, settings, settingsKey) {
}
// Genres
var genres = [];
const genres = [];
elems = context.querySelectorAll('.chkGenreFilter');
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(','));
}
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++) {
if (on) {
inputManager.on(elems[i], onInputCommand);
@ -155,9 +154,9 @@ function bindCheckboxInput(context, on) {
function initEditor(context, settings) {
context.querySelector('form').addEventListener('submit', onSubmit);
var elems = context.querySelectorAll('.simpleFilter');
var i;
var length;
let elems = context.querySelectorAll('.simpleFilter');
let i;
let length;
for (i = 0, length = elems.length; i < length; i++) {
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');
for (i = 0, length = elems.length; i < length; i++) {
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');
for (i = 0, length = elems.length; i < length; i++) {
@ -194,9 +193,9 @@ function initEditor(context, settings) {
}
}
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(),
ParentId: options.parentId,
@ -211,7 +210,7 @@ class FilterMenu {
show(options) {
return new Promise( (resolve, reject) => {
import('text!./filtermenu.template.html').then(({ default: template }) => {
var dialogOptions = {
const dialogOptions = {
removeOnClose: true,
scrollY: false
};
@ -221,11 +220,11 @@ class FilterMenu {
dialogOptions.size = 'small';
}
var dlg = dialogHelper.createDialog(dialogOptions);
const dlg = dialogHelper.createDialog(dialogOptions);
dlg.classList.add('formDialog');
var html = '';
let html = '';
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>';
@ -237,7 +236,7 @@ class FilterMenu {
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++) {
if (options.visibleSettings.indexOf(settingElements[i].getAttribute('data-settingname')) === -1) {
settingElements[i].classList.add('hide');
@ -258,7 +257,7 @@ class FilterMenu {
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
}
var submitted;
let submitted;
dlg.querySelector('form').addEventListener('change', function () {
submitted = true;

View File

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

View File

@ -2,22 +2,21 @@
import dom from 'dom';
import appRouter from 'appRouter';
import connectionManager from 'connectionManager';
function onGroupedCardClick(e, card) {
var itemId = card.getAttribute('data-id');
var serverId = card.getAttribute('data-serverid');
var apiClient = connectionManager.getApiClient(serverId);
var userId = apiClient.getCurrentUserId();
var playedIndicator = card.querySelector('.playedIndicator');
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
var options = {
const itemId = card.getAttribute('data-id');
const serverId = card.getAttribute('data-serverid');
const apiClient = window.connectionManager.getApiClient(serverId);
const userId = apiClient.getCurrentUserId();
const playedIndicator = card.querySelector('.playedIndicator');
const playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
const options = {
Limit: parseInt(playedIndicatorHtml || '10'),
Fields: 'PrimaryImageAspectRatio,DateCreated',
ParentId: itemId,
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')) {
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]);
}
var url = 'details?id=' + itemId + '&serverId=' + serverId;
const url = 'details?id=' + itemId + '&serverId=' + serverId;
Dashboard.navigate(url);
});
e.stopPropagation();
@ -35,7 +34,7 @@ import connectionManager from 'connectionManager';
}
export default function onItemsContainerClick(e) {
var groupedCard = dom.parentWithClass(e.target, 'groupedCard');
const groupedCard = dom.parentWithClass(e.target, 'groupedCard');
if (groupedCard) {
onGroupedCardClick(e, groupedCard);

View File

@ -70,6 +70,10 @@
contain: strict;
}
.programContainer.emby-scroller {
margin: 0;
}
.channelPrograms {
height: 4.42em;
contain: strict;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -56,7 +56,7 @@ import 'css!./style';
throw new Error('entry cannot be null');
}
const target = entry.target;
var source = undefined;
let source = undefined;
if (target) {
source = target.getAttribute('data-src');
@ -87,6 +87,9 @@ import 'css!./style';
requestAnimationFrame(() => {
if (elem.tagName !== 'IMG') {
elem.style.backgroundImage = "url('" + url + "')";
if (elem.classList.contains('blurhashed')) {
elem.style.backgroundColor = '#fff';
}
} else {
elem.setAttribute('src', url);
}
@ -103,11 +106,12 @@ import 'css!./style';
}
function emptyImageElement(elem) {
var url;
let url;
if (elem.tagName !== 'IMG') {
url = elem.style.backgroundImage.slice(4, -1).replace(/"/g, '');
elem.style.backgroundImage = 'none';
elem.style.backgroundColor = null;
} else {
url = elem.getAttribute('src');
elem.setAttribute('src', '');
@ -133,10 +137,10 @@ import 'css!./style';
}
export function getPrimaryImageAspectRatio(items) {
var values = [];
const values = [];
for (var i = 0, length = items.length; i < length; i++) {
var ratio = items[i].PrimaryImageAspectRatio || 0;
for (let i = 0, length = items.length; i < length; i++) {
const ratio = items[i].PrimaryImageAspectRatio || 0;
if (!ratio) {
continue;
@ -154,9 +158,9 @@ import 'css!./style';
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) {
result = values[half];
@ -165,13 +169,13 @@ import 'css!./style';
}
// 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) {
return aspect2x3;
}
// 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) {
return aspect16x9;
}
@ -182,7 +186,7 @@ import 'css!./style';
}
// 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) {
return aspect4x3;
}
@ -191,8 +195,8 @@ import 'css!./style';
}
export function fillImages(elems) {
for (var i = 0, length = elems.length; i < length; i++) {
var elem = elems[0];
for (let i = 0, length = elems.length; i < length; i++) {
const elem = elems[0];
fillImage(elem);
}
}

View File

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

View File

@ -8,7 +8,6 @@
import dialogHelper from 'dialogHelper';
import layoutManager from 'layoutManager';
import globalize from 'globalize';
import connectionManager from 'connectionManager';
import loading from 'loading';
import 'emby-select';
import 'listViewStyle';
@ -52,8 +51,22 @@ import 'flexStyles';
if (stream.Type === 'Data') {
continue;
}
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>`;
const attributes = [];
if (stream.DisplayTitle) {
@ -107,6 +120,18 @@ import 'flexStyles';
if (stream.BitDepth) {
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) {
attributes.push(createAttribute(globalize.translate('MediaInfoPixelFormat'), stream.PixelFormat));
}
@ -137,7 +162,7 @@ import 'flexStyles';
}
function loadMediaInfo(itemId, serverId, template) {
const apiClient = connectionManager.getApiClient(serverId);
const apiClient = window.connectionManager.getApiClient(serverId);
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
const dialogOptions = {
size: 'small',

View File

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

View File

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

View File

@ -85,14 +85,6 @@
<div class="fieldDescription checkboxFieldDescription">${OptionAutomaticallyGroupSeriesHelp}</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">
<h2>${HeaderChapterImages}</h2>
<div class="checkboxContainer checkboxContainer-withDescription fldExtractChapterImages">

View File

@ -185,6 +185,17 @@
.listItemBody {
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 {

View File

@ -8,7 +8,6 @@
import itemHelper from 'itemHelper';
import mediaInfo from 'mediaInfo';
import indicators from 'indicators';
import connectionManager from 'connectionManager';
import layoutManager from 'layoutManager';
import globalize from 'globalize';
import datetime from 'datetime';
@ -77,7 +76,7 @@ import 'emby-playstatebutton';
}
function getImageUrl(item, width) {
const apiClient = connectionManager.getApiClient(item.ServerId);
const apiClient = window.connectionManager.getApiClient(item.ServerId);
let itemId;
const options = {
@ -106,7 +105,7 @@ import 'emby-playstatebutton';
}
function getChannelImageUrl(item, width) {
const apiClient = connectionManager.getApiClient(item.ServerId);
const apiClient = window.connectionManager.getApiClient(item.ServerId);
const options = {
maxWidth: width,
type: 'Primary'
@ -257,8 +256,8 @@ import 'emby-playstatebutton';
}
if (options.image !== false) {
var imgUrl = options.imageSource === 'channel' ? getChannelImageUrl(item, downloadWidth) : getImageUrl(item, downloadWidth);
var imageClass = isLargeStyle ? 'listItemImage listItemImage-large' : 'listItemImage';
const imgUrl = options.imageSource === 'channel' ? getChannelImageUrl(item, downloadWidth) : getImageUrl(item, downloadWidth);
let imageClass = isLargeStyle ? 'listItemImage listItemImage-large' : 'listItemImage';
if (isLargeStyle && layoutManager.tv) {
imageClass += ' listItemImage-large-tv';
@ -370,18 +369,8 @@ import 'emby-playstatebutton';
}
}
} else {
let showArtist = options.artist === true;
const artistItems = item.ArtistItems;
if (!showArtist && options.artist !== false) {
if (!artistItems || !artistItems.length) {
showArtist = true;
} else if (artistItems.length > 1 || !containerAlbumArtistIds.includes(artistItems[0].Id)) {
showArtist = true;
}
}
if (showArtist) {
if (options.artist) {
const artistItems = item.ArtistItems;
if (artistItems && item.Type !== 'MusicAlbum') {
textlines.push(artistItems.map(a => {
return a.Name;

View File

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

View File

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

View File

@ -251,7 +251,7 @@
</div>
<br />
<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>
</button>
<button is="emby-button" type="submit" class="raised button-submit block btnSave formDialogFooterItem">

View File

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

View File

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

View File

@ -7,7 +7,6 @@ import playbackManager from 'playbackManager';
import nowPlayingHelper from 'nowPlayingHelper';
import appHost from 'apphost';
import dom from 'dom';
import connectionManager from 'connectionManager';
import itemContextMenu from 'itemContextMenu';
import 'paper-icon-button-light';
import 'emby-ratingbutton';
@ -452,7 +451,7 @@ import 'emby-ratingbutton';
if (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) {
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) {
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]) {
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) {
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;
@ -548,7 +547,7 @@ import 'emby-ratingbutton';
if (nowPlayingItem.Id) {
if (isRefreshing) {
const apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId);
const apiClient = window.connectionManager.getApiClient(nowPlayingItem.ServerId);
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
const userData = item.UserData || {};
const likes = userData.Likes == null ? '' : userData.Likes;
@ -583,7 +582,7 @@ import 'emby-ratingbutton';
function onPlaybackStart(e, state) {
console.debug('nowplaying event: ' + e.type);
var player = this;
const player = this;
onStateChanged.call(player, e, state);
}
@ -701,7 +700,7 @@ import 'emby-ratingbutton';
const player = this;
currentRuntimeTicks = playbackManager.duration(player);
updateTimeDisplay(playbackManager.currentTime(player), currentRuntimeTicks, playbackManager.getBufferedRanges(player));
updateTimeDisplay(playbackManager.currentTime(player) * 10000, currentRuntimeTicks, playbackManager.getBufferedRanges(player));
}
function releaseCurrentPlayer() {

View File

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

View File

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

View File

@ -1,7 +1,7 @@
import playbackManager from 'playbackManager';
import nowPlayingHelper from 'nowPlayingHelper';
import shell from 'shell';
import events from 'events';
import connectionManager from 'connectionManager';
/* eslint-disable indent */
// 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) {
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') {
if (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) {
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]) {
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) {
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;
@ -128,8 +128,7 @@ import connectionManager from 'connectionManager';
});
} else {
const itemImageUrl = seriesImageUrl(item, { maxHeight: 3000 }) || imageUrl(item, { maxHeight: 3000 });
window.NativeShell.updateMediaSession({
shell.updateMediaSession({
action: eventName,
isLocalPlayer: isLocalPlayer,
itemId: itemId,
@ -183,7 +182,7 @@ import connectionManager from 'connectionManager';
/* eslint-disable-next-line compat/compat */
navigator.mediaSession.metadata = null;
} else {
window.NativeShell.hideMediaSession();
shell.hideMediaSession();
}
}

View File

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

View File

@ -6,7 +6,6 @@ import pluginManager from 'pluginManager';
import PlayQueueManager from 'playQueueManager';
import * as userSettings from 'userSettings';
import globalize from 'globalize';
import connectionManager from 'connectionManager';
import loading from 'loading';
import appHost from 'apphost';
import screenfull from 'screenfull';
@ -69,7 +68,7 @@ function reportPlayback(playbackManagerInstance, state, player, reportPlaylist,
addPlaylistToPlaybackReport(playbackManagerInstance, info, player, serverId);
}
const apiClient = connectionManager.getApiClient(serverId);
const apiClient = window.connectionManager.getApiClient(serverId);
const reportPlaybackPromise = apiClient[method](info);
// Notify that report has been sent
reportPlaybackPromise.then(() => {
@ -106,7 +105,7 @@ function normalizeName(t) {
}
function getItemsForPlayback(serverId, query) {
const apiClient = connectionManager.getApiClient(serverId);
const apiClient = window.connectionManager.getApiClient(serverId);
if (query.Ids && query.Ids.split(',').length === 1) {
const itemId = query.Ids.split(',');
@ -640,22 +639,18 @@ function supportsDirectPlay(apiClient, item, mediaSource) {
function validatePlaybackInfoResult(instance, result) {
if (result.ErrorCode) {
showPlaybackInfoErrorMessage(instance, result.ErrorCode);
showPlaybackInfoErrorMessage(instance, 'PlaybackError' + result.ErrorCode);
return false;
}
return true;
}
function showPlaybackInfoErrorMessage(instance, errorCode, playNextTrack) {
function showPlaybackInfoErrorMessage(instance, errorCode) {
import('alert').then(({ default: alert }) => {
alert({
text: globalize.translate('PlaybackError' + errorCode),
text: globalize.translate(errorCode),
title: globalize.translate('HeaderPlaybackError')
}).then(function () {
if (playNextTrack) {
instance.nextTrack();
}
});
});
}
@ -874,7 +869,7 @@ class PlaybackManager {
const promises = players.filter(displayPlayerIndividually).map(getPlayerTargets);
return Promise.all(promises).then(function (responses) {
return connectionManager.currentApiClient().getCurrentUser().then(function (user) {
return window.connectionManager.currentApiClient().getCurrentUser().then(function (user) {
const targets = [];
targets.push({
@ -1115,8 +1110,8 @@ class PlaybackManager {
self.increasePlaybackRate = function (player) {
player = player || self._currentPlayer;
if (player) {
let current = self.getPlaybackRate(player);
let supported = self.getSupportedPlaybackRates(player);
const current = self.getPlaybackRate(player);
const supported = self.getSupportedPlaybackRates(player);
let index = -1;
for (let i = 0, length = supported.length; i < length; i++) {
@ -1134,8 +1129,8 @@ class PlaybackManager {
self.decreasePlaybackRate = function (player) {
player = player || self._currentPlayer;
if (player) {
let current = self.getPlaybackRate(player);
let supported = self.getSupportedPlaybackRates(player);
const current = self.getPlaybackRate(player);
const supported = self.getSupportedPlaybackRates(player);
let index = -1;
for (let i = 0, length = supported.length; i < length; i++) {
@ -1372,7 +1367,7 @@ class PlaybackManager {
function getSavedMaxStreamingBitrate(apiClient, mediaType) {
if (!apiClient) {
// This should hopefully never happen
apiClient = connectionManager.currentApiClient();
apiClient = window.connectionManager.currentApiClient();
}
const endpointInfo = apiClient.getSavedEndpointInfo() || {};
@ -1395,7 +1390,7 @@ class PlaybackManager {
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
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);
};
@ -1409,7 +1404,7 @@ class PlaybackManager {
const mediaType = playerData.streamInfo ? playerData.streamInfo.mediaType : null;
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() || {};
return appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType);
@ -1421,7 +1416,7 @@ class PlaybackManager {
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) {
const playerData = getPlayerData(player);
@ -1618,11 +1613,7 @@ class PlaybackManager {
player = player || self._currentPlayer;
if (player && !enableLocalPlaylistManagement(player)) {
if (player.isLocalPlayer) {
return player.seek((ticks || 0) / 10000);
} else {
return player.seek(ticks);
}
return player.seek(ticks);
}
changeStream(player, ticks);
@ -1631,11 +1622,7 @@ class PlaybackManager {
self.seekRelative = function (offsetTicks, player) {
player = player || self._currentPlayer;
if (player && !enableLocalPlaylistManagement(player) && player.seekRelative) {
if (player.isLocalPlayer) {
return player.seekRelative((ticks || 0) / 10000);
} else {
return player.seekRelative(ticks);
}
return player.seekRelative(ticks);
}
const ticks = getCurrentTicks(player) + offsetTicks;
@ -1691,7 +1678,7 @@ class PlaybackManager {
const subtitleStreamIndex = params.SubtitleStreamIndex == null ? getPlayerData(player).subtitleStreamIndex : params.SubtitleStreamIndex;
let currentMediaSource = self.currentMediaSource(player);
const apiClient = connectionManager.getApiClient(currentItem.ServerId);
const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
if (ticks) {
ticks = parseInt(ticks);
@ -1710,7 +1697,7 @@ class PlaybackManager {
streamInfo.lastMediaInfoQuery = lastMediaInfoQuery;
if (!streamInfo.url) {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream', true);
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return;
}
@ -1847,7 +1834,7 @@ class PlaybackManager {
}, queryOptions));
} else if (firstItem.Type === 'Episode' && items.length === 1 && getPlayer(firstItem, options).supportsProgress !== false) {
promise = new Promise(function (resolve, reject) {
const apiClient = connectionManager.getApiClient(firstItem.ServerId);
const apiClient = window.connectionManager.getApiClient(firstItem.ServerId);
apiClient.getCurrentUser().then(function (user) {
if (!user.Configuration.EnableNextEpisodeAutoPlay || !firstItem.SeriesId) {
@ -2070,7 +2057,7 @@ class PlaybackManager {
// If it's still null then there's nothing to play
if (!firstItem) {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream', false);
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return Promise.reject();
}
@ -2078,7 +2065,7 @@ class PlaybackManager {
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) {
const introItems = introsResult.Items;
@ -2119,7 +2106,7 @@ class PlaybackManager {
function playInternal(item, playOptions, onPlaybackStartedFn) {
if (item.IsPlaceHolder) {
loading.hide();
showPlaybackInfoErrorMessage(self, 'PlaceHolder', true);
showPlaybackInfoErrorMessage(self, 'PlaybackErrorPlaceHolder');
return Promise.reject();
}
@ -2141,14 +2128,14 @@ class PlaybackManager {
const mediaType = item.MediaType;
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)) {
return onBitrateDetectionFailure();
}
const apiClient = connectionManager.getApiClient(item.ServerId);
const apiClient = window.connectionManager.getApiClient(item.ServerId);
apiClient.getEndpointInfo().then(function (endpointInfo) {
if ((mediaType === 'Video' || mediaType === 'Audio') && appSettings.enableAutomaticBitrateDetection(endpointInfo.IsInNetwork, mediaType)) {
return apiClient.detectBitrate().then(function (bitrate) {
@ -2271,7 +2258,7 @@ class PlaybackManager {
return Promise.all([promise, player.getDeviceProfile(item)]).then(function (responses) {
const deviceProfile = responses[1];
const apiClient = connectionManager.getApiClient(item.ServerId);
const apiClient = window.connectionManager.getApiClient(item.ServerId);
const mediaSourceId = playOptions.mediaSourceId;
const audioStreamIndex = playOptions.audioStreamIndex;
@ -2316,11 +2303,11 @@ class PlaybackManager {
const startPosition = options.startPositionTicks || 0;
const mediaType = options.mediaType || item.MediaType;
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
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 getPlaybackMediaSource(player, apiClient, deviceProfile, maxBitrate, item, startPosition, options.mediaSourceId, options.audioStreamIndex, options.subtitleStreamIndex).then(function (mediaSource) {
@ -2336,11 +2323,11 @@ class PlaybackManager {
const mediaType = options.mediaType || item.MediaType;
// TODO: Remove the true forceLocalPlayer hack
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
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 getPlaybackInfo(player, apiClient, item, deviceProfile, maxBitrate, startPosition, false, null, null, null, null).then(function (playbackInfoResult) {
@ -2492,7 +2479,7 @@ class PlaybackManager {
return mediaSource;
}
} else {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream');
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return Promise.reject();
}
});
@ -2724,7 +2711,7 @@ class PlaybackManager {
const queueDirectToPlayer = player && !enableLocalPlaylistManagement(player);
if (queueDirectToPlayer) {
const apiClient = connectionManager.getApiClient(items[0].ServerId);
const apiClient = window.connectionManager.getApiClient(items[0].ServerId);
player.getDeviceProfile(items[0]).then(function (profile) {
setStreamUrls(items, profile, self.getMaxStreamingBitrate(player), apiClient, 0).then(function () {
@ -2981,7 +2968,7 @@ class PlaybackManager {
}
if (displayErrorCode && typeof (displayErrorCode) === 'string') {
showPlaybackInfoErrorMessage(self, displayErrorCode, nextItem);
showPlaybackInfoErrorMessage(self, 'PlaybackError' + displayErrorCode);
} else if (nextItem) {
self.nextTrack();
} else {
@ -3174,13 +3161,13 @@ class PlaybackManager {
streamInfo.lastMediaInfoQuery = new Date().getTime();
const apiClient = connectionManager.getApiClient(serverId);
const apiClient = window.connectionManager.getApiClient(serverId);
if (!apiClient.isMinServerVersion('3.2.70.7')) {
return;
}
connectionManager.getApiClient(serverId).getLiveStreamMediaInfo(liveStreamId).then(function (info) {
window.connectionManager.getApiClient(serverId).getLiveStreamMediaInfo(liveStreamId).then(function (info) {
mediaSource.MediaStreams = info.MediaStreams;
events.trigger(player, 'mediastreamschange');
}, function () {
@ -3223,7 +3210,7 @@ class PlaybackManager {
return player.currentTime();
}
return this.getCurrentTicks(player);
return this.getCurrentTicks(player) / 10000;
}
nextItem(player = this._currentPlayer) {
@ -3237,7 +3224,7 @@ class PlaybackManager {
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);
}
@ -3378,7 +3365,7 @@ class PlaybackManager {
return player.playTrailers(item);
}
const apiClient = connectionManager.getApiClient(item.ServerId);
const apiClient = window.connectionManager.getApiClient(item.ServerId);
const instance = this;
@ -3410,7 +3397,7 @@ class PlaybackManager {
}
getSubtitleUrl(textStream, serverId) {
const apiClient = connectionManager.getApiClient(serverId);
const apiClient = window.connectionManager.getApiClient(serverId);
return !textStream.IsExternalUrl ? apiClient.getUrl(textStream.DeliveryUrl) : textStream.DeliveryUrl;
}
@ -3490,7 +3477,7 @@ class PlaybackManager {
return player.instantMix(item);
}
const apiClient = connectionManager.getApiClient(item.ServerId);
const apiClient = window.connectionManager.getApiClient(item.ServerId);
const options = {};
options.UserId = apiClient.getCurrentUserId();

View File

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

View File

@ -6,9 +6,10 @@ import playbackManager from 'playbackManager';
import appRouter from 'appRouter';
import globalize from 'globalize';
import appHost from 'apphost';
import * as autocast from 'autocast';
function mirrorItem(info, player) {
var item = info.item;
const item = info.item;
playbackManager.displayContent({
@ -21,7 +22,7 @@ function mirrorItem(info, player) {
function mirrorIfEnabled(info) {
if (info && playbackManager.enableDisplayMirroring()) {
var getPlayerInfo = playbackManager.getPlayerInfo();
const getPlayerInfo = playbackManager.getPlayerInfo();
if (getPlayerInfo) {
if (!getPlayerInfo.isLocalPlayer && getPlayerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
@ -44,7 +45,7 @@ function getTargetSecondaryText(target) {
}
function getIcon(target) {
var deviceType = target.deviceType;
let deviceType = target.deviceType;
if (!deviceType && target.isLocalPlayer) {
if (browser.tv) {
@ -77,7 +78,7 @@ function getIcon(target) {
}
export function show(button) {
var currentPlayerInfo = playbackManager.getPlayerInfo();
const currentPlayerInfo = playbackManager.getPlayerInfo();
if (currentPlayerInfo) {
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();
playbackManager.getTargets().then(function (targets) {
var menuItems = targets.map(function (t) {
var name = t.name;
const menuItems = targets.map(function (t) {
let name = t.name;
if (t.appName && t.appName !== t.name) {
name += ' - ' + t.appName;
@ -110,7 +111,7 @@ export function show(button) {
import('actionsheet').then(({default: actionsheet}) => {
loading.hide();
var menuOptions = {
const menuOptions = {
title: globalize.translate('HeaderPlayOn'),
items: menuItems,
positionTo: button,
@ -126,7 +127,7 @@ export function show(button) {
}
actionsheet.show(menuOptions).then(function (id) {
var target = targets.filter(function (t) {
const target = targets.filter(function (t) {
return t.id === id;
})[0];
@ -152,7 +153,7 @@ function showActivePlayerMenu(playerInfo) {
function disconnectFromPlayer(currentDeviceName) {
if (playbackManager.getSupportedCommands().indexOf('EndSession') !== -1) {
import('dialog').then(({default: dialog}) => {
var menuItems = [];
const menuItems = [];
menuItems.push({
name: globalize.translate('Yes'),
@ -187,9 +188,9 @@ function disconnectFromPlayer(currentDeviceName) {
}
function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
var html = '';
let html = '';
var dialogOptions = {
const dialogOptions = {
removeOnClose: true
};
@ -198,11 +199,11 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
dialogOptions.exitAnimationDuration = 160;
dialogOptions.autoFocus = false;
var dlg = dialogHelper.createDialog(dialogOptions);
const dlg = dialogHelper.createDialog(dialogOptions);
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 += '<h2 style="margin-top:.5em;">';
@ -213,7 +214,7 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
if (playerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
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 += '<span>' + globalize.translate('EnableDisplayMirroring') + '</span>';
html += '</label>';
@ -221,6 +222,14 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
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 += '<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>';
dlg.innerHTML = html;
var chkMirror = dlg.querySelector('.chkMirror');
const chkMirror = dlg.querySelector('.chkMirror');
if (chkMirror) {
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) {
btnRemoteControl.addEventListener('click', function () {
destination = 'nowplaying';
@ -269,9 +284,13 @@ function onMirrorChange() {
playbackManager.enableDisplayMirroring(this.checked);
}
function onAutoCastChange() {
autocast.enable(this.checked);
}
document.addEventListener('viewshow', function (e) {
var state = e.detail.state || {};
var item = state.item;
const state = e.detail.state || {};
const item = state.item;
if (item && item.ServerId) {
mirrorIfEnabled({

View File

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

View File

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

View File

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

View File

@ -1,7 +1,6 @@
import events from 'events';
import globalize from 'globalize';
import playbackManager from 'playbackManager';
import connectionManager from 'connectionManager';
import syncPlayManager from 'syncPlayManager';
import playMethodHelper from 'playMethodHelper';
import layoutManager from 'layoutManager';
@ -95,7 +94,7 @@ import 'css!./playerstats';
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({
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 = [];
if (audioCodec) {
@ -386,7 +413,7 @@ import 'css!./playerstats';
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')) {
categories.push({
stats: getSyncPlayStats(),

View File

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

View File

@ -4,11 +4,11 @@ import playbackManager from 'playbackManager';
import globalize from 'globalize';
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) {
playbackManager.play({
@ -18,7 +18,7 @@ export function show(options) {
return;
}
var menuItems = [];
const menuItems = [];
menuItems.push({
name: globalize.translate('ResumeAt', datetime.getDisplayRunningTime(resumePositionTicks)),

View File

@ -3,7 +3,7 @@ import globalize from 'globalize';
/* eslint-disable indent */
// TODO: replace with each plugin version
var cacheParam = new Date().getTime();
const cacheParam = new Date().getTime();
class PluginManager {
pluginsList = [];
@ -13,7 +13,7 @@ import globalize from 'globalize';
}
#loadStrings(plugin) {
var strings = plugin.getTranslations ? plugin.getTranslations() : [];
const strings = plugin.getTranslations ? plugin.getTranslations() : [];
return globalize.loadStrings({
name: plugin.id || plugin.packageName,
strings: strings
@ -56,10 +56,10 @@ import globalize from 'globalize';
return new Promise((resolve, reject) => {
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
var existing = this.pluginsList.filter(function (p) {
const existing = this.pluginsList.filter(function (p) {
return p.id === plugin.id;
})[0];
@ -69,10 +69,10 @@ import globalize from 'globalize';
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);
var paths = {};
const paths = {};
paths[plugin.id] = plugin.baseUrl;
requirejs.config({
@ -135,7 +135,7 @@ import globalize from 'globalize';
})[0];
}
var url = plugin.baseUrl + '/' + path;
let url = plugin.baseUrl + '/' + path;
if (addCacheParam) {
url += url.includes('?') ? '&' : '?';

View File

@ -1,9 +1,9 @@
import globalize from 'globalize';
export function getVideoQualityOptions(options) {
var maxStreamingBitrate = options.currentMaxBitrate;
var videoWidth = options.videoWidth;
var videoHeight = options.videoHeight;
const maxStreamingBitrate = options.currentMaxBitrate;
let videoWidth = options.videoWidth;
const videoHeight = options.videoHeight;
// If the aspect ratio is less than 16/9 (1.77), set the width as if it were pillarboxed.
// 4:3 1440x1080 -> 1920x1080
@ -11,9 +11,9 @@ export function getVideoQualityOptions(options) {
videoWidth = videoHeight * (16 / 9);
}
var maxAllowedWidth = videoWidth || 4096;
const maxAllowedWidth = videoWidth || 4096;
var qualityOptions = [];
const qualityOptions = [];
if (maxAllowedWidth >= 3800) {
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: '144p', maxHeight: 144, bitrate: 192000 });
var autoQualityOption = {
const autoQualityOption = {
name: globalize.translate('Auto'),
bitrate: 0,
selected: options.isAutomaticBitrateEnabled
@ -76,9 +76,9 @@ export function getVideoQualityOptions(options) {
}
if (maxStreamingBitrate) {
var selectedIndex = -1;
for (var i = 0, length = qualityOptions.length; i < length; i++) {
var option = qualityOptions[i];
let selectedIndex = -1;
for (let i = 0, length = qualityOptions.length; i < length; i++) {
const option = qualityOptions[i];
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
selectedIndex = i;
@ -89,7 +89,7 @@ export function getVideoQualityOptions(options) {
selectedIndex = qualityOptions.length - 1;
}
var currentQualityOption = qualityOptions[selectedIndex];
const currentQualityOption = qualityOptions[selectedIndex];
if (!options.isAutomaticBitrateEnabled) {
currentQualityOption.selected = true;
@ -102,9 +102,9 @@ export function getVideoQualityOptions(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: '1.5 Mbps', bitrate: 1500000 });
@ -116,7 +116,7 @@ export function getAudioQualityOptions(options) {
qualityOptions.push({ name: '96 kbps', bitrate: 96000 });
qualityOptions.push({ name: '64 kbps', bitrate: 64000 });
var autoQualityOption = {
const autoQualityOption = {
name: globalize.translate('Auto'),
bitrate: 0,
selected: options.isAutomaticBitrateEnabled
@ -127,9 +127,9 @@ export function getAudioQualityOptions(options) {
}
if (maxStreamingBitrate) {
var selectedIndex = -1;
for (var i = 0, length = qualityOptions.length; i < length; i++) {
var option = qualityOptions[i];
let selectedIndex = -1;
for (let i = 0, length = qualityOptions.length; i < length; i++) {
const option = qualityOptions[i];
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
selectedIndex = i;
@ -140,7 +140,7 @@ export function getAudioQualityOptions(options) {
selectedIndex = qualityOptions.length - 1;
}
var currentQualityOption = qualityOptions[selectedIndex];
const currentQualityOption = qualityOptions[selectedIndex];
if (!options.isAutomaticBitrateEnabled) {
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 recordingHelper from 'recordingHelper';
import 'paper-icon-button-light';
@ -53,7 +52,7 @@ class RecordingButton {
}
refresh(serverId, itemId) {
const apiClient = connectionManager.getApiClient(serverId);
const apiClient = window.connectionManager.getApiClient(serverId);
const self = this;
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
self.refreshItem(item);

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

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