|
@ -59,7 +59,15 @@ jobs:
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
|
|
||||||
|
variables:
|
||||||
|
- name: JellyfinVersion
|
||||||
|
value: 0.0.0
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
|
- script: echo "##vso[task.setvariable variable=JellyfinVersion]$( awk -F '/' '{ print $NF }' <<<'$(Build.SourceBranch)' | sed 's/^v//' )"
|
||||||
|
displayName: Set release version (stable)
|
||||||
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/tags')
|
||||||
|
|
||||||
- task: Docker@2
|
- task: Docker@2
|
||||||
displayName: 'Push Unstable Image'
|
displayName: 'Push Unstable Image'
|
||||||
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
|
condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/master')
|
||||||
|
@ -84,7 +92,7 @@ jobs:
|
||||||
containerRegistry: Docker Hub
|
containerRegistry: Docker Hub
|
||||||
tags: |
|
tags: |
|
||||||
stable-$(Build.BuildNumber)
|
stable-$(Build.BuildNumber)
|
||||||
stable
|
$(JellyfinVersion)
|
||||||
|
|
||||||
- job: CollectArtifacts
|
- job: CollectArtifacts
|
||||||
displayName: 'Collect Artifacts'
|
displayName: 'Collect Artifacts'
|
||||||
|
|
|
@ -8,5 +8,5 @@ trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
|
|
||||||
[json]
|
[*.json]
|
||||||
indent_size = 2
|
indent_size = 2
|
||||||
|
|
|
@ -2,4 +2,3 @@ node_modules
|
||||||
dist
|
dist
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
src/libraries
|
|
||||||
|
|
26
.eslintrc.js
|
@ -1,6 +1,9 @@
|
||||||
|
const restrictedGlobals = require('confusing-browser-globals');
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
root: true,
|
root: true,
|
||||||
plugins: [
|
plugins: [
|
||||||
|
'@babel',
|
||||||
'promise',
|
'promise',
|
||||||
'import',
|
'import',
|
||||||
'eslint-comments'
|
'eslint-comments'
|
||||||
|
@ -28,7 +31,7 @@ module.exports = {
|
||||||
],
|
],
|
||||||
rules: {
|
rules: {
|
||||||
'block-spacing': ['error'],
|
'block-spacing': ['error'],
|
||||||
'brace-style': ['error'],
|
'brace-style': ['error', '1tbs', { 'allowSingleLine': true }],
|
||||||
'comma-dangle': ['error', 'never'],
|
'comma-dangle': ['error', 'never'],
|
||||||
'comma-spacing': ['error'],
|
'comma-spacing': ['error'],
|
||||||
'eol-last': ['error'],
|
'eol-last': ['error'],
|
||||||
|
@ -38,19 +41,25 @@ module.exports = {
|
||||||
'no-floating-decimal': ['error'],
|
'no-floating-decimal': ['error'],
|
||||||
'no-multi-spaces': ['error'],
|
'no-multi-spaces': ['error'],
|
||||||
'no-multiple-empty-lines': ['error', { 'max': 1 }],
|
'no-multiple-empty-lines': ['error', { 'max': 1 }],
|
||||||
|
'no-restricted-globals': ['error'].concat(restrictedGlobals),
|
||||||
'no-trailing-spaces': ['error'],
|
'no-trailing-spaces': ['error'],
|
||||||
|
'@babel/no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }],
|
||||||
'one-var': ['error', 'never'],
|
'one-var': ['error', 'never'],
|
||||||
|
'padded-blocks': ['error', 'never'],
|
||||||
|
'prefer-const': ['error', {'destructuring': 'all'}],
|
||||||
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
|
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
|
||||||
'semi': ['error'],
|
'@babel/semi': ['error'],
|
||||||
|
'no-var': ['error'],
|
||||||
'space-before-blocks': ['error'],
|
'space-before-blocks': ['error'],
|
||||||
'space-infix-ops': 'error'
|
'space-infix-ops': 'error',
|
||||||
|
'yoda': 'error'
|
||||||
},
|
},
|
||||||
overrides: [
|
overrides: [
|
||||||
{
|
{
|
||||||
files: [
|
files: [
|
||||||
'./src/**/*.js'
|
'./src/**/*.js'
|
||||||
],
|
],
|
||||||
parser: 'babel-eslint',
|
parser: '@babel/eslint-parser',
|
||||||
env: {
|
env: {
|
||||||
node: false,
|
node: false,
|
||||||
amd: true,
|
amd: true,
|
||||||
|
@ -75,7 +84,6 @@ module.exports = {
|
||||||
'ApiClient': 'writable',
|
'ApiClient': 'writable',
|
||||||
'AppInfo': 'writable',
|
'AppInfo': 'writable',
|
||||||
'chrome': 'writable',
|
'chrome': 'writable',
|
||||||
'ConnectionManager': 'writable',
|
|
||||||
'DlnaProfilePage': 'writable',
|
'DlnaProfilePage': 'writable',
|
||||||
'Dashboard': 'writable',
|
'Dashboard': 'writable',
|
||||||
'DashboardPage': 'writable',
|
'DashboardPage': 'writable',
|
||||||
|
@ -98,9 +106,9 @@ module.exports = {
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
// TODO: Fix warnings and remove these rules
|
// TODO: Fix warnings and remove these rules
|
||||||
'no-redeclare': ['warn'],
|
'no-redeclare': ['off'],
|
||||||
'no-unused-vars': ['warn'],
|
'no-useless-escape': ['off'],
|
||||||
'no-useless-escape': ['warn'],
|
'no-unused-vars': ['off'],
|
||||||
// TODO: Remove after ES6 migration is complete
|
// TODO: Remove after ES6 migration is complete
|
||||||
'import/no-unresolved': ['off']
|
'import/no-unresolved': ['off']
|
||||||
},
|
},
|
||||||
|
@ -193,4 +201,4 @@ module.exports = {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
};
|
||||||
|
|
4
.github/CODEOWNERS
vendored
|
@ -1,4 +1,6 @@
|
||||||
.ci @dkanada @EraYaN
|
.ci @dkanada @EraYaN
|
||||||
.github @jellyfin/core
|
.github @jellyfin/core
|
||||||
build.sh @joshuaboniface
|
fedora @joshuaboniface
|
||||||
|
debian @joshuaboniface
|
||||||
|
.copr @joshuaboniface
|
||||||
deployment @joshuaboniface
|
deployment @joshuaboniface
|
||||||
|
|
|
@ -1,23 +1,20 @@
|
||||||
---
|
---
|
||||||
name: Bug report
|
name: Bug Report
|
||||||
about: Create a bug report
|
about: You have noticed a general issue or regression, and would like to report it
|
||||||
title: ''
|
|
||||||
labels: bug
|
labels: bug
|
||||||
assignees: ''
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**Describe the bug**
|
**Describe The Bug**
|
||||||
<!-- A clear and concise description of what the bug is. -->
|
<!-- A clear and concise description of what the bug is. -->
|
||||||
|
|
||||||
**To Reproduce**
|
**Steps To Reproduce**
|
||||||
<!-- Steps to reproduce the behavior: -->
|
<!-- Steps to reproduce the behavior: -->
|
||||||
1. Go to '...'
|
1. Go to '...'
|
||||||
2. Click on '....'
|
2. Click on '....'
|
||||||
3. Scroll down to '....'
|
3. Scroll down to '....'
|
||||||
4. See error
|
4. See error
|
||||||
|
|
||||||
**Expected behavior**
|
**Expected Behavior**
|
||||||
<!-- A clear and concise description of what you expected to happen. -->
|
<!-- A clear and concise description of what you expected to happen. -->
|
||||||
|
|
||||||
**Logs**
|
**Logs**
|
||||||
|
@ -27,9 +24,9 @@ assignees: ''
|
||||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||||
|
|
||||||
**System (please complete the following information):**
|
**System (please complete the following information):**
|
||||||
- OS: [e.g. Docker, Debian, Windows]
|
- Platform: [e.g. Linux, Windows, iPhone, Tizen]
|
||||||
- Browser: [e.g. Firefox, Chrome, Safari]
|
- Browser: [e.g. Firefox, Chrome, Safari]
|
||||||
- Jellyfin Version: [e.g. 10.0.1]
|
- Jellyfin Version: [e.g. 10.6.0]
|
||||||
|
|
||||||
**Additional context**
|
**Additional Context**
|
||||||
<!-- Add any other context about the problem here. -->
|
<!-- Add any other context about the problem here. -->
|
22
.github/ISSUE_TEMPLATE/2-playback-issue.md
vendored
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
---
|
||||||
|
name: Playback Issue
|
||||||
|
about: You have playback issues with some files
|
||||||
|
labels: playback
|
||||||
|
---
|
||||||
|
|
||||||
|
**Describe The Bug**
|
||||||
|
<!-- A clear and concise description of what the bug is. -->
|
||||||
|
|
||||||
|
**Media Information**
|
||||||
|
<!-- Please paste any ffprobe or MediaInfo logs. -->
|
||||||
|
|
||||||
|
**Screenshots**
|
||||||
|
<!-- Add screenshots from the Playback Data and Media Info. -->
|
||||||
|
|
||||||
|
**System (please complete the following information):**
|
||||||
|
- Platform: [e.g. Linux, Windows, iPhone, Tizen]
|
||||||
|
- Browser: [e.g. Firefox, Chrome, Safari]
|
||||||
|
- Jellyfin Version: [e.g. 10.6.0]
|
||||||
|
|
||||||
|
**Additional Context**
|
||||||
|
<!-- Add any other context about the problem here. -->
|
13
.github/ISSUE_TEMPLATE/3-technical-discussion.md
vendored
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
---
|
||||||
|
name: Technical Discussion
|
||||||
|
about: You want to discuss technical aspects of changes you intend to make
|
||||||
|
labels: enhancement
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Explain the change and the motivations behind it.
|
||||||
|
|
||||||
|
For example, if you plan to rely on a new dependency, explain why and what
|
||||||
|
it brings to the project.
|
||||||
|
|
||||||
|
If you plan to make significant changes, go roughly over the steps you intend
|
||||||
|
to take and how you would divide the change in PRs of a manageable size. -->
|
9
.github/ISSUE_TEMPLATE/4-meta-issue.md
vendored
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
name: Meta Issue
|
||||||
|
about: You want to track a number of other issues as part of a larger project
|
||||||
|
labels: meta
|
||||||
|
---
|
||||||
|
|
||||||
|
* [ ] Issue 1 [#123]
|
||||||
|
* [ ] Issue 2 [#456]
|
||||||
|
* [ ] ...
|
8
.github/ISSUE_TEMPLATE/config.yml
vendored
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
blank_issues_enabled: false
|
||||||
|
contact_links:
|
||||||
|
- name: Feature Request
|
||||||
|
url: https://features.jellyfin.org/
|
||||||
|
about: Please head over to our feature request hub to vote on or submit a feature.
|
||||||
|
- name: Help Or Question
|
||||||
|
url: https://matrix.to/#/#jellyfin-troubleshooting:matrix.org
|
||||||
|
about: Please join the troubleshooting Matrix channel to get some help.
|
24
.github/SUPPORT.md
vendored
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
# Support
|
||||||
|
|
||||||
|
Jellyfin contributors have limited availability to address general support
|
||||||
|
questions. Please make sure you are using the latest version of Jellyfin.
|
||||||
|
|
||||||
|
When looking for support or information, please first search for your
|
||||||
|
question in these venues:
|
||||||
|
|
||||||
|
* [Jellyfin Forum](https://forum.jellyfin.org)
|
||||||
|
* [Jellyfin Documentation](https://docs.jellyfin.org)
|
||||||
|
* [Open or **closed** issues in the organization](https://github.com/issues?q=sort%3Aupdated-desc+org%3Ajellyfin+is%3Aissue+)
|
||||||
|
|
||||||
|
If you didn't find an answer in the resources above, contributors and other
|
||||||
|
users are reachable through the following channels:
|
||||||
|
|
||||||
|
* #jellyfin on [Matrix](https://matrix.to/#/#jellyfin:matrix.org%22) or [IRC](https://webchat.freenode.net/#jellyfin)
|
||||||
|
* #jellyfin-troubleshooting on [Matrix](https://matrix.to/#/#jellyfin-troubleshooting:matrix.org) or [IRC](https://webchat.freenode.net/#jellyfin-troubleshooting)
|
||||||
|
* [/r/jellyfin on Reddit](https://www.reddit.com/r/jellyfin)
|
||||||
|
|
||||||
|
GitHub issues are for tracking enhancements and bugs, not general support.
|
||||||
|
|
||||||
|
The open source license grants you the freedom to use Jellyfin.
|
||||||
|
It does not guarantee commitments of other people's time.
|
||||||
|
Please be respectful and manage your expectations.
|
3
.gitignore
vendored
|
@ -3,6 +3,9 @@ dist
|
||||||
web
|
web
|
||||||
node_modules
|
node_modules
|
||||||
|
|
||||||
|
# config
|
||||||
|
config.json
|
||||||
|
|
||||||
# ide
|
# ide
|
||||||
.idea
|
.idea
|
||||||
.vscode
|
.vscode
|
||||||
|
|
|
@ -34,8 +34,13 @@
|
||||||
- [Ryan Hartzell](https://github.com/ryan-hartzell)
|
- [Ryan Hartzell](https://github.com/ryan-hartzell)
|
||||||
- [Thibault Nocchi](https://github.com/ThibaultNocchi)
|
- [Thibault Nocchi](https://github.com/ThibaultNocchi)
|
||||||
- [MrTimscampi](https://github.com/MrTimscampi)
|
- [MrTimscampi](https://github.com/MrTimscampi)
|
||||||
|
- [ConfusedPolarBear](https://github.com/ConfusedPolarBear)
|
||||||
- [Sarab Singh](https://github.com/sarab97)
|
- [Sarab Singh](https://github.com/sarab97)
|
||||||
|
- [GuilhermeHideki](https://github.com/GuilhermeHideki)
|
||||||
- [Andrei Oanca](https://github.com/OancaAndrei)
|
- [Andrei Oanca](https://github.com/OancaAndrei)
|
||||||
|
- [Cromefire_](https://github.com/cromefire)
|
||||||
|
- [Orry Verducci](https://github.com/orryverducci)
|
||||||
|
- [Camc314](https://github.com/camc314)
|
||||||
|
|
||||||
# Emby Contributors
|
# Emby Contributors
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ Jellyfin Web is the frontend used for most of the clients available for end user
|
||||||
|
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
|
- [Node.js](https://nodejs.org/en/download/)
|
||||||
- [Yarn 1.22.4](https://classic.yarnpkg.com/en/docs/install)
|
- [Yarn 1.22.4](https://classic.yarnpkg.com/en/docs/install)
|
||||||
- Gulp-cli
|
- Gulp-cli
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
# We just wrap `build` so this is really it
|
# We just wrap `build` so this is really it
|
||||||
name: "jellyfin-web"
|
name: "jellyfin-web"
|
||||||
version: "10.6.0"
|
version: "10.7.0"
|
||||||
packages:
|
packages:
|
||||||
- debian.all
|
- debian.all
|
||||||
- fedora.all
|
- fedora.all
|
||||||
|
|
23
bump_version
|
@ -4,6 +4,7 @@
|
||||||
|
|
||||||
set -o errexit
|
set -o errexit
|
||||||
set -o pipefail
|
set -o pipefail
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
usage() {
|
usage() {
|
||||||
echo -e "bump_version - increase the shared version and generate changelogs"
|
echo -e "bump_version - increase the shared version and generate changelogs"
|
||||||
|
@ -23,10 +24,7 @@ build_file="./build.yaml"
|
||||||
new_version="$1"
|
new_version="$1"
|
||||||
|
|
||||||
# Parse the version from shared version file
|
# Parse the version from shared version file
|
||||||
old_version="$(
|
old_version="$( grep "appVersion" ${shared_version_file} | head -1 | sed -E "s/var appVersion = '([0-9\.]+)';/\1/" | tr -d '[:space:]' )"
|
||||||
grep "appVersion" ${shared_version_file} | head -1 \
|
|
||||||
| sed -E 's/var appVersion = "([0-9\.]+)";/\1/'
|
|
||||||
)"
|
|
||||||
echo "Old version in appHost is: $old_version"
|
echo "Old version in appHost is: $old_version"
|
||||||
|
|
||||||
# Set the shared version to the specified new_version
|
# Set the shared version to the specified new_version
|
||||||
|
@ -34,11 +32,8 @@ old_version_sed="$( sed 's/\./\\./g' <<<"${old_version}" )" # Escape the '.' cha
|
||||||
new_version_sed="$( cut -f1 -d'-' <<<"${new_version}" )"
|
new_version_sed="$( cut -f1 -d'-' <<<"${new_version}" )"
|
||||||
sed -i "s/${old_version_sed}/${new_version_sed}/g" ${shared_version_file}
|
sed -i "s/${old_version_sed}/${new_version_sed}/g" ${shared_version_file}
|
||||||
|
|
||||||
old_version="$(
|
old_version="$( grep "version:" ${build_file} | sed -E 's/version: "([0-9\.]+[-a-z0-9]*)"/\1/' )"
|
||||||
grep "version:" ${build_file} \
|
echo "Old version in ${build_file}: ${old_version}"
|
||||||
| sed -E 's/version: "([0-9\.]+[-a-z0-9]*)"/\1/'
|
|
||||||
)"
|
|
||||||
echo "Old version in ${build_file}: $old_version`"
|
|
||||||
|
|
||||||
# Set the build.yaml version to the specified new_version
|
# Set the build.yaml version to the specified new_version
|
||||||
old_version_sed="$( sed 's/\./\\./g' <<<"${old_version}" )" # Escape the '.' chars
|
old_version_sed="$( sed 's/\./\\./g' <<<"${old_version}" )" # Escape the '.' chars
|
||||||
|
@ -54,7 +49,7 @@ fi
|
||||||
debian_changelog_file="debian/changelog"
|
debian_changelog_file="debian/changelog"
|
||||||
debian_changelog_temp="$( mktemp )"
|
debian_changelog_temp="$( mktemp )"
|
||||||
# Create new temp file with our changelog
|
# Create new temp file with our changelog
|
||||||
echo -e "jellyfin (${new_version_deb}) unstable; urgency=medium
|
echo -e "jellyfin-web (${new_version_deb}) unstable; urgency=medium
|
||||||
|
|
||||||
* New upstream version ${new_version}; release changelog at https://github.com/jellyfin/jellyfin-web/releases/tag/v${new_version}
|
* New upstream version ${new_version}; release changelog at https://github.com/jellyfin/jellyfin-web/releases/tag/v${new_version}
|
||||||
|
|
||||||
|
@ -65,15 +60,15 @@ cat ${debian_changelog_file} >> ${debian_changelog_temp}
|
||||||
mv ${debian_changelog_temp} ${debian_changelog_file}
|
mv ${debian_changelog_temp} ${debian_changelog_file}
|
||||||
|
|
||||||
# Write out a temporary Yum changelog with our new stuff prepended and some templated formatting
|
# Write out a temporary Yum changelog with our new stuff prepended and some templated formatting
|
||||||
fedora_spec_file="fedora/jellyfin.spec"
|
fedora_spec_file="fedora/jellyfin-web.spec"
|
||||||
fedora_changelog_temp="$( mktemp )"
|
fedora_changelog_temp="$( mktemp )"
|
||||||
fedora_spec_temp_dir="$( mktemp -d )"
|
fedora_spec_temp_dir="$( mktemp -d )"
|
||||||
fedora_spec_temp="${fedora_spec_temp_dir}/jellyfin.spec.tmp"
|
fedora_spec_temp="${fedora_spec_temp_dir}/jellyfin-web.spec.tmp"
|
||||||
# Make a copy of our spec file for hacking
|
# Make a copy of our spec file for hacking
|
||||||
cp ${fedora_spec_file} ${fedora_spec_temp_dir}/
|
cp ${fedora_spec_file} ${fedora_spec_temp_dir}/
|
||||||
pushd ${fedora_spec_temp_dir}
|
pushd ${fedora_spec_temp_dir}
|
||||||
# Split out the stuff before and after changelog
|
# Split out the stuff before and after changelog
|
||||||
csplit jellyfin.spec "/^%changelog/" # produces xx00 xx01
|
csplit jellyfin-web.spec "/^%changelog/" # produces xx00 xx01
|
||||||
# Update the version in xx00
|
# Update the version in xx00
|
||||||
sed -i "s/${old_version_sed}/${new_version_sed}/g" xx00
|
sed -i "s/${old_version_sed}/${new_version_sed}/g" xx00
|
||||||
# Remove the header from xx01
|
# Remove the header from xx01
|
||||||
|
@ -92,5 +87,5 @@ mv ${fedora_spec_temp} ${fedora_spec_file}
|
||||||
rm -rf ${fedora_changelog_temp} ${fedora_spec_temp_dir}
|
rm -rf ${fedora_changelog_temp} ${fedora_spec_temp_dir}
|
||||||
|
|
||||||
# Stage the changed files for commit
|
# Stage the changed files for commit
|
||||||
git add ${shared_version_file} ${build_file} ${debian_changelog_file} ${fedora_spec_file} Dockerfile*
|
git add ${shared_version_file} ${build_file} ${debian_changelog_file} ${fedora_spec_file}
|
||||||
git status
|
git status
|
||||||
|
|
6
debian/changelog
vendored
|
@ -1,3 +1,9 @@
|
||||||
|
jellyfin-web (10.7.0-1) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Forthcoming stable release
|
||||||
|
|
||||||
|
-- Jellyfin Packaging Team <packaging@jellyfin.org> Mon, 27 Jul 2020 19:13:31 -0400
|
||||||
|
|
||||||
jellyfin-web (10.6.0-1) unstable; urgency=medium
|
jellyfin-web (10.6.0-1) unstable; urgency=medium
|
||||||
|
|
||||||
* New upstream version 10.6.0; release changelog at https://github.com/jellyfin/jellyfin-web/releases/tag/v10.6.0
|
* New upstream version 10.6.0; release changelog at https://github.com/jellyfin/jellyfin-web/releases/tag/v10.6.0
|
||||||
|
|
1
debian/conffiles
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
/usr/share/jellyfin/web/config.json
|
|
@ -1,7 +1,7 @@
|
||||||
%global debug_package %{nil}
|
%global debug_package %{nil}
|
||||||
|
|
||||||
Name: jellyfin-web
|
Name: jellyfin-web
|
||||||
Version: 10.6.0
|
Version: 10.7.0
|
||||||
Release: 1%{?dist}
|
Release: 1%{?dist}
|
||||||
Summary: The Free Software Media System web client
|
Summary: The Free Software Media System web client
|
||||||
License: GPLv3
|
License: GPLv3
|
||||||
|
@ -14,6 +14,9 @@ BuildRequires: yarn
|
||||||
%else
|
%else
|
||||||
BuildRequires: nodejs-yarn
|
BuildRequires: nodejs-yarn
|
||||||
%endif
|
%endif
|
||||||
|
# sadly the yarn RPM at https://dl.yarnpkg.com/rpm/ uses git but doesn't Requires: it
|
||||||
|
# ditto for Fedora's yarn RPM
|
||||||
|
BuildRequires: git
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
|
||||||
# Disable Automatic Dependency Processing
|
# Disable Automatic Dependency Processing
|
||||||
|
@ -39,5 +42,7 @@ mv dist %{buildroot}%{_datadir}/jellyfin-web
|
||||||
%{_datadir}/licenses/jellyfin/LICENSE
|
%{_datadir}/licenses/jellyfin/LICENSE
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Mon Jul 27 2020 Jellyfin Packaging Team <packaging@jellyfin.org>
|
||||||
|
- Forthcoming stable release
|
||||||
* Mon Mar 23 2020 Jellyfin Packaging Team <packaging@jellyfin.org>
|
* Mon Mar 23 2020 Jellyfin Packaging Team <packaging@jellyfin.org>
|
||||||
- Forthcoming stable release
|
- Forthcoming stable release
|
||||||
|
|
320
package.json
|
@ -5,26 +5,28 @@
|
||||||
"repository": "https://github.com/jellyfin/jellyfin-web",
|
"repository": "https://github.com/jellyfin/jellyfin-web",
|
||||||
"license": "GPL-2.0-or-later",
|
"license": "GPL-2.0-or-later",
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.10.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-class-properties": "^7.10.1",
|
||||||
"@babel/plugin-proposal-private-methods": "^7.10.1",
|
"@babel/plugin-proposal-private-methods": "^7.12.1",
|
||||||
"@babel/plugin-transform-modules-amd": "^7.9.6",
|
"@babel/plugin-transform-modules-amd": "^7.12.1",
|
||||||
"@babel/polyfill": "^7.8.7",
|
"@babel/polyfill": "^7.12.1",
|
||||||
"@babel/preset-env": "^7.10.3",
|
"@babel/preset-env": "^7.12.1",
|
||||||
"autoprefixer": "^9.8.5",
|
"autoprefixer": "^9.8.6",
|
||||||
"babel-eslint": "^11.0.0-beta.2",
|
"babel-loader": "^8.2.1",
|
||||||
"babel-loader": "^8.0.6",
|
"browser-sync": "^2.26.13",
|
||||||
"browser-sync": "^2.26.7",
|
"confusing-browser-globals": "^1.0.10",
|
||||||
"copy-webpack-plugin": "^5.1.1",
|
"copy-webpack-plugin": "^5.1.1",
|
||||||
"css-loader": "^3.6.0",
|
"css-loader": "^5.0.1",
|
||||||
"cssnano": "^4.1.10",
|
"cssnano": "^4.1.10",
|
||||||
"del": "^5.1.0",
|
"del": "^6.0.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^7.13.0",
|
||||||
"eslint-plugin-compat": "^3.5.1",
|
"eslint-plugin-compat": "^3.5.1",
|
||||||
"eslint-plugin-eslint-comments": "^3.2.0",
|
"eslint-plugin-eslint-comments": "^3.2.0",
|
||||||
"eslint-plugin-import": "^2.21.2",
|
"eslint-plugin-import": "^2.22.1",
|
||||||
"eslint-plugin-promise": "^4.2.1",
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
"file-loader": "^6.0.0",
|
"file-loader": "^6.2.0",
|
||||||
"gulp": "^4.0.2",
|
"gulp": "^4.0.2",
|
||||||
"gulp-babel": "^8.0.0",
|
"gulp-babel": "^8.0.0",
|
||||||
"gulp-cli": "^2.3.0",
|
"gulp-cli": "^2.3.0",
|
||||||
|
@ -36,51 +38,53 @@
|
||||||
"gulp-mode": "^1.0.2",
|
"gulp-mode": "^1.0.2",
|
||||||
"gulp-postcss": "^8.0.0",
|
"gulp-postcss": "^8.0.0",
|
||||||
"gulp-sass": "^4.0.2",
|
"gulp-sass": "^4.0.2",
|
||||||
"gulp-sourcemaps": "^2.6.5",
|
"gulp-sourcemaps": "^3.0.0",
|
||||||
"gulp-terser": "^1.2.0",
|
"gulp-terser": "^1.4.1",
|
||||||
"html-webpack-plugin": "^4.3.0",
|
"html-webpack-plugin": "^4.5.0",
|
||||||
"lazypipe": "^1.0.2",
|
"lazypipe": "^1.0.2",
|
||||||
"node-sass": "^4.13.1",
|
"node-sass": "^5.0.0",
|
||||||
"postcss-loader": "^3.0.0",
|
"postcss-loader": "^3.0.0",
|
||||||
"postcss-preset-env": "^6.7.0",
|
"postcss-preset-env": "^6.7.0",
|
||||||
"style-loader": "^1.1.3",
|
"style-loader": "^2.0.0",
|
||||||
"stylelint": "^13.6.1",
|
"stylelint": "^13.7.2",
|
||||||
"stylelint-config-rational-order": "^0.1.2",
|
"stylelint-config-rational-order": "^0.1.2",
|
||||||
"stylelint-no-browser-hacks": "^1.2.1",
|
"stylelint-no-browser-hacks": "^1.2.1",
|
||||||
"stylelint-order": "^4.1.0",
|
"stylelint-order": "^4.1.0",
|
||||||
"webpack": "^4.41.5",
|
"webpack": "^5.4.0",
|
||||||
"webpack-merge": "^4.2.2",
|
"webpack-merge": "^4.2.2",
|
||||||
"webpack-stream": "^5.2.1"
|
"webpack-stream": "^6.1.1",
|
||||||
|
"worker-plugin": "^5.0.0"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"alameda": "^1.4.0",
|
"alameda": "^1.4.0",
|
||||||
"blurhash": "^1.1.3",
|
"blurhash": "^1.1.3",
|
||||||
"classlist.js": "https://github.com/eligrey/classList.js/archive/1.2.20180112.tar.gz",
|
"classlist.js": "https://github.com/eligrey/classList.js/archive/1.2.20180112.tar.gz",
|
||||||
"core-js": "^3.6.5",
|
"core-js": "^3.7.0",
|
||||||
"date-fns": "^2.14.0",
|
"date-fns": "^2.16.1",
|
||||||
"epubjs": "^0.3.85",
|
"epubjs": "^0.3.85",
|
||||||
|
"pdfjs-dist": "2.5.207",
|
||||||
"fast-text-encoding": "^1.0.3",
|
"fast-text-encoding": "^1.0.3",
|
||||||
"flv.js": "^1.5.0",
|
"flv.js": "^1.5.0",
|
||||||
"headroom.js": "^0.11.0",
|
"headroom.js": "^0.12.0",
|
||||||
"hls.js": "^0.14.0",
|
"hls.js": "^0.14.16",
|
||||||
"howler": "^2.2.0",
|
"howler": "^2.2.1",
|
||||||
"intersection-observer": "^0.11.0",
|
"intersection-observer": "^0.11.0",
|
||||||
"jellyfin-apiclient": "^1.3.0",
|
"jellyfin-apiclient": "^1.4.2",
|
||||||
"jellyfin-noto": "https://github.com/jellyfin/jellyfin-noto",
|
"jellyfin-noto": "https://github.com/jellyfin/jellyfin-noto",
|
||||||
"jquery": "^3.5.1",
|
"jquery": "^3.5.1",
|
||||||
"jstree": "^3.3.10",
|
"jstree": "^3.3.10",
|
||||||
|
"libarchive.js": "^1.3.0",
|
||||||
"libass-wasm": "https://github.com/jellyfin/JavascriptSubtitlesOctopus#4.0.0-jf-smarttv",
|
"libass-wasm": "https://github.com/jellyfin/JavascriptSubtitlesOctopus#4.0.0-jf-smarttv",
|
||||||
"material-design-icons-iconfont": "^5.0.1",
|
"material-design-icons-iconfont": "^6.1.0",
|
||||||
"native-promise-only": "^0.8.0-a",
|
"native-promise-only": "^0.8.0-a",
|
||||||
"page": "^1.11.6",
|
"page": "^1.11.6",
|
||||||
"query-string": "^6.13.1",
|
"query-string": "^6.13.7",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
"screenfull": "^5.0.2",
|
"screenfull": "^5.0.2",
|
||||||
"shaka-player": "^2.5.13",
|
"sortablejs": "^1.12.0",
|
||||||
"sortablejs": "^1.10.2",
|
"swiper": "^6.3.5",
|
||||||
"swiper": "^5.4.5",
|
|
||||||
"webcomponents.js": "^0.7.24",
|
"webcomponents.js": "^0.7.24",
|
||||||
"whatwg-fetch": "^3.2.0"
|
"whatwg-fetch": "^3.5.0"
|
||||||
},
|
},
|
||||||
"babel": {
|
"babel": {
|
||||||
"presets": [
|
"presets": [
|
||||||
|
@ -91,52 +95,278 @@
|
||||||
"test": [
|
"test": [
|
||||||
"src/components/accessSchedule/accessSchedule.js",
|
"src/components/accessSchedule/accessSchedule.js",
|
||||||
"src/components/actionSheet/actionSheet.js",
|
"src/components/actionSheet/actionSheet.js",
|
||||||
|
"src/components/activitylog.js",
|
||||||
|
"src/components/alert.js",
|
||||||
|
"src/components/alphaPicker/alphaPicker.js",
|
||||||
|
"src/components/appFooter/appFooter.js",
|
||||||
|
"src/components/apphost.js",
|
||||||
|
"src/components/appRouter.js",
|
||||||
"src/components/autoFocuser.js",
|
"src/components/autoFocuser.js",
|
||||||
|
"src/components/backdrop/backdrop.js",
|
||||||
"src/components/cardbuilder/cardBuilder.js",
|
"src/components/cardbuilder/cardBuilder.js",
|
||||||
"src/components/cardbuilder/chaptercardbuilder.js",
|
"src/components/cardbuilder/chaptercardbuilder.js",
|
||||||
"src/components/cardbuilder/peoplecardbuilder.js",
|
"src/components/cardbuilder/peoplecardbuilder.js",
|
||||||
|
"src/components/channelMapper/channelMapper.js",
|
||||||
|
"src/components/collectionEditor/collectionEditor.js",
|
||||||
|
"src/components/confirm/confirm.js",
|
||||||
|
"src/components/dialog/dialog.js",
|
||||||
|
"src/components/dialogHelper/dialogHelper.js",
|
||||||
|
"src/components/directorybrowser/directorybrowser.js",
|
||||||
|
"src/components/displaySettings/displaySettings.js",
|
||||||
|
"src/components/favoriteitems.js",
|
||||||
|
"src/components/fetchhelper.js",
|
||||||
|
"src/components/filterdialog/filterdialog.js",
|
||||||
|
"src/components/filtermenu/filtermenu.js",
|
||||||
|
"src/components/focusManager.js",
|
||||||
|
"src/components/groupedcards.js",
|
||||||
|
"src/components/guide/guide.js",
|
||||||
|
"src/components/guide/guide-settings.js",
|
||||||
|
"src/components/homeScreenSettings/homeScreenSettings.js",
|
||||||
|
"src/components/homesections/homesections.js",
|
||||||
|
"src/components/htmlMediaHelper.js",
|
||||||
|
"src/components/imageOptionsEditor/imageOptionsEditor.js",
|
||||||
"src/components/images/imageLoader.js",
|
"src/components/images/imageLoader.js",
|
||||||
|
"src/components/imageDownloader/imageDownloader.js",
|
||||||
|
"src/components/imageeditor/imageeditor.js",
|
||||||
|
"src/components/imageUploader/imageUploader.js",
|
||||||
"src/components/indicators/indicators.js",
|
"src/components/indicators/indicators.js",
|
||||||
|
"src/components/itemContextMenu.js",
|
||||||
|
"src/components/itemHelper.js",
|
||||||
|
"src/components/itemidentifier/itemidentifier.js",
|
||||||
|
"src/components/itemMediaInfo/itemMediaInfo.js",
|
||||||
|
"src/components/itemsrefresher.js",
|
||||||
|
"src/components/layoutManager.js",
|
||||||
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
||||||
|
"src/components/libraryoptionseditor/libraryoptionseditor.js",
|
||||||
|
"src/components/listview/listview.js",
|
||||||
|
"src/components/loading/loading.js",
|
||||||
|
"src/components/maintabsmanager.js",
|
||||||
|
"src/components/mediainfo/mediainfo.js",
|
||||||
|
"src/components/mediaLibraryCreator/mediaLibraryCreator.js",
|
||||||
|
"src/components/mediaLibraryEditor/mediaLibraryEditor.js",
|
||||||
|
"src/components/metadataEditor/metadataEditor.js",
|
||||||
|
"src/components/metadataEditor/personEditor.js",
|
||||||
|
"src/components/multiSelect/multiSelect.js",
|
||||||
|
"src/components/notifications/notifications.js",
|
||||||
|
"src/components/nowPlayingBar/nowPlayingBar.js",
|
||||||
|
"src/components/packageManager.js",
|
||||||
"src/components/playback/brightnessosd.js",
|
"src/components/playback/brightnessosd.js",
|
||||||
"src/components/playback/mediasession.js",
|
"src/components/playback/mediasession.js",
|
||||||
"src/components/playback/nowplayinghelper.js",
|
"src/components/playback/nowplayinghelper.js",
|
||||||
"src/components/playback/playbackorientation.js",
|
"src/components/playback/playbackorientation.js",
|
||||||
|
"src/components/playback/playbackmanager.js",
|
||||||
"src/components/playback/playerSelectionMenu.js",
|
"src/components/playback/playerSelectionMenu.js",
|
||||||
"src/components/playback/playersettingsmenu.js",
|
"src/components/playback/playersettingsmenu.js",
|
||||||
"src/components/playback/playmethodhelper.js",
|
"src/components/playback/playmethodhelper.js",
|
||||||
|
"src/components/playback/playqueuemanager.js",
|
||||||
"src/components/playback/remotecontrolautoplay.js",
|
"src/components/playback/remotecontrolautoplay.js",
|
||||||
"src/components/playback/volumeosd.js",
|
"src/components/playback/volumeosd.js",
|
||||||
|
"src/components/playbackSettings/playbackSettings.js",
|
||||||
|
"src/components/playerstats/playerstats.js",
|
||||||
|
"src/components/playlisteditor/playlisteditor.js",
|
||||||
"src/components/playmenu.js",
|
"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",
|
||||||
|
"src/components/recordingcreator/recordinghelper.js",
|
||||||
|
"src/components/refreshdialog/refreshdialog.js",
|
||||||
|
"src/components/recordingcreator/recordingeditor.js",
|
||||||
|
"src/components/recordingcreator/recordingfields.js",
|
||||||
|
"src/components/remotecontrol/remotecontrol.js",
|
||||||
"src/components/sanatizefilename.js",
|
"src/components/sanatizefilename.js",
|
||||||
"src/components/scrollManager.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",
|
||||||
|
"src/plugins/htmlVideoPlayer/plugin.js",
|
||||||
|
"src/plugins/logoScreensaver/plugin.js",
|
||||||
|
"src/plugins/playAccessValidation/plugin.js",
|
||||||
|
"src/components/search/searchfields.js",
|
||||||
|
"src/components/search/searchresults.js",
|
||||||
|
"src/components/settingshelper.js",
|
||||||
|
"src/components/shortcuts.js",
|
||||||
|
"src/components/subtitleeditor/subtitleeditor.js",
|
||||||
|
"src/components/subtitlesync/subtitlesync.js",
|
||||||
|
"src/components/subtitlesettings/subtitleappearancehelper.js",
|
||||||
|
"src/components/subtitlesettings/subtitlesettings.js",
|
||||||
"src/components/syncPlay/groupSelectionMenu.js",
|
"src/components/syncPlay/groupSelectionMenu.js",
|
||||||
"src/components/syncPlay/playbackPermissionManager.js",
|
"src/components/syncPlay/playbackPermissionManager.js",
|
||||||
"src/components/syncPlay/syncPlayManager.js",
|
"src/components/syncPlay/syncPlayManager.js",
|
||||||
"src/components/syncPlay/timeSyncManager.js",
|
"src/components/syncPlay/timeSyncManager.js",
|
||||||
|
"src/components/themeMediaPlayer.js",
|
||||||
|
"src/components/tabbedview/tabbedview.js",
|
||||||
|
"src/components/viewManager/viewManager.js",
|
||||||
|
"src/components/tvproviders/schedulesdirect.js",
|
||||||
|
"src/components/tvproviders/xmltv.js",
|
||||||
|
"src/components/toast/toast.js",
|
||||||
|
"src/components/tunerPicker.js",
|
||||||
|
"src/components/upnextdialog/upnextdialog.js",
|
||||||
|
"src/components/userdatabuttons/userdatabuttons.js",
|
||||||
|
"src/components/viewContainer.js",
|
||||||
|
"src/components/viewSettings/viewSettings.js",
|
||||||
|
"src/components/castSenderApi.js",
|
||||||
|
"src/controllers/session/addServer/index.js",
|
||||||
|
"src/controllers/session/forgotPassword/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",
|
||||||
|
"src/controllers/dashboard/dashboard.js",
|
||||||
|
"src/controllers/dashboard/devices/device.js",
|
||||||
|
"src/controllers/dashboard/devices/devices.js",
|
||||||
|
"src/controllers/dashboard/dlna/profile.js",
|
||||||
|
"src/controllers/dashboard/dlna/profiles.js",
|
||||||
|
"src/controllers/dashboard/dlna/settings.js",
|
||||||
|
"src/controllers/dashboard/encodingsettings.js",
|
||||||
|
"src/controllers/dashboard/general.js",
|
||||||
|
"src/controllers/dashboard/librarydisplay.js",
|
||||||
"src/controllers/dashboard/logs.js",
|
"src/controllers/dashboard/logs.js",
|
||||||
"src/controllers/dashboard/plugins/repositories.js",
|
"src/controllers/music/musicalbums.js",
|
||||||
"src/controllers/user/display.js",
|
"src/controllers/music/musicartists.js",
|
||||||
"src/controllers/user/home.js",
|
"src/controllers/music/musicgenres.js",
|
||||||
"src/controllers/user/playback.js",
|
"src/controllers/music/musicplaylists.js",
|
||||||
"src/controllers/user/subtitles.js",
|
"src/controllers/music/musicrecommended.js",
|
||||||
|
"src/controllers/music/songs.js",
|
||||||
|
"src/controllers/dashboard/library.js",
|
||||||
|
"src/controllers/dashboard/metadataImages.js",
|
||||||
|
"src/controllers/dashboard/metadatanfo.js",
|
||||||
|
"src/controllers/dashboard/networking.js",
|
||||||
|
"src/controllers/dashboard/notifications/notification/index.js",
|
||||||
|
"src/controllers/dashboard/notifications/notifications/index.js",
|
||||||
|
"src/controllers/dashboard/playback.js",
|
||||||
|
"src/controllers/dashboard/plugins/add/index.js",
|
||||||
|
"src/controllers/dashboard/plugins/installed/index.js",
|
||||||
|
"src/controllers/dashboard/plugins/available/index.js",
|
||||||
|
"src/controllers/dashboard/plugins/repositories/index.js",
|
||||||
|
"src/controllers/dashboard/quickConnect.js",
|
||||||
|
"src/controllers/dashboard/scheduledtasks/scheduledtask.js",
|
||||||
|
"src/controllers/dashboard/scheduledtasks/scheduledtasks.js",
|
||||||
|
"src/controllers/dashboard/serveractivity.js",
|
||||||
|
"src/controllers/dashboard/streaming.js",
|
||||||
|
"src/controllers/dashboard/users/useredit.js",
|
||||||
|
"src/controllers/dashboard/users/userlibraryaccess.js",
|
||||||
|
"src/controllers/dashboard/users/usernew.js",
|
||||||
|
"src/controllers/dashboard/users/userparentalcontrol.js",
|
||||||
|
"src/controllers/dashboard/users/userpasswordpage.js",
|
||||||
|
"src/controllers/dashboard/users/userprofilespage.js",
|
||||||
|
"src/controllers/home.js",
|
||||||
|
"src/controllers/list.js",
|
||||||
|
"src/controllers/edititemmetadata.js",
|
||||||
|
"src/controllers/favorites.js",
|
||||||
|
"src/controllers/hometab.js",
|
||||||
|
"src/controllers/movies/moviecollections.js",
|
||||||
|
"src/controllers/movies/moviegenres.js",
|
||||||
|
"src/controllers/movies/movies.js",
|
||||||
|
"src/controllers/movies/moviesrecommended.js",
|
||||||
|
"src/controllers/movies/movietrailers.js",
|
||||||
|
"src/controllers/playback/nowplaying.js",
|
||||||
|
"src/controllers/playback/videoosd.js",
|
||||||
|
"src/controllers/itemDetails/index.js",
|
||||||
|
"src/controllers/playback/queue/index.js",
|
||||||
|
"src/controllers/playback/video/index.js",
|
||||||
|
"src/controllers/searchpage.js",
|
||||||
|
"src/controllers/livetv/livetvguide.js",
|
||||||
|
"src/controllers/livetvtuner.js",
|
||||||
|
"src/controllers/livetv/livetvsuggested.js",
|
||||||
|
"src/controllers/livetvstatus.js",
|
||||||
|
"src/controllers/livetvguideprovider.js",
|
||||||
|
"src/controllers/livetvsettings.js",
|
||||||
|
"src/controllers/livetv/livetvrecordings.js",
|
||||||
|
"src/controllers/livetv/livetvschedule.js",
|
||||||
|
"src/controllers/livetv/livetvseriestimers.js",
|
||||||
|
"src/controllers/livetv/livetvchannels.js",
|
||||||
|
"src/controllers/shows/episodes.js",
|
||||||
|
"src/controllers/shows/tvgenres.js",
|
||||||
|
"src/controllers/shows/tvlatest.js",
|
||||||
|
"src/controllers/shows/tvrecommended.js",
|
||||||
|
"src/controllers/shows/tvshows.js",
|
||||||
|
"src/controllers/shows/tvstudios.js",
|
||||||
|
"src/controllers/shows/tvupcoming.js",
|
||||||
|
"src/controllers/user/display/index.js",
|
||||||
|
"src/controllers/user/home/index.js",
|
||||||
|
"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",
|
||||||
|
"src/controllers/wizard/settings/index.js",
|
||||||
|
"src/controllers/wizard/start/index.js",
|
||||||
|
"src/controllers/wizard/user/index.js",
|
||||||
|
"src/elements/emby-button/emby-button.js",
|
||||||
|
"src/elements/emby-button/paper-icon-button-light.js",
|
||||||
|
"src/elements/emby-checkbox/emby-checkbox.js",
|
||||||
|
"src/elements/emby-collapse/emby-collapse.js",
|
||||||
|
"src/elements/emby-input/emby-input.js",
|
||||||
|
"src/elements/emby-itemrefreshindicator/emby-itemrefreshindicator.js",
|
||||||
|
"src/elements/emby-itemscontainer/emby-itemscontainer.js",
|
||||||
|
"src/elements/emby-playstatebutton/emby-playstatebutton.js",
|
||||||
|
"src/elements/emby-programcell/emby-programcell.js",
|
||||||
|
"src/elements/emby-progressbar/emby-progressbar.js",
|
||||||
|
"src/elements/emby-progressring/emby-progressring.js",
|
||||||
|
"src/elements/emby-radio/emby-radio.js",
|
||||||
|
"src/elements/emby-ratingbutton/emby-ratingbutton.js",
|
||||||
|
"src/elements/emby-scrollbuttons/emby-scrollbuttons.js",
|
||||||
|
"src/elements/emby-scroller/emby-scroller.js",
|
||||||
|
"src/elements/emby-select/emby-select.js",
|
||||||
|
"src/elements/emby-slider/emby-slider.js",
|
||||||
|
"src/elements/emby-tabs/emby-tabs.js",
|
||||||
|
"src/elements/emby-textarea/emby-textarea.js",
|
||||||
|
"src/elements/emby-toggle/emby-toggle.js",
|
||||||
|
"src/libraries/screensavermanager.js",
|
||||||
|
"src/libraries/navdrawer/navdrawer.js",
|
||||||
|
"src/libraries/scroller.js",
|
||||||
|
"src/plugins/backdropScreensaver/plugin.js",
|
||||||
"src/plugins/bookPlayer/plugin.js",
|
"src/plugins/bookPlayer/plugin.js",
|
||||||
|
"src/plugins/pdfPlayer/plugin.js",
|
||||||
"src/plugins/bookPlayer/tableOfContents.js",
|
"src/plugins/bookPlayer/tableOfContents.js",
|
||||||
|
"src/plugins/chromecastPlayer/chromecastHelper.js",
|
||||||
"src/plugins/photoPlayer/plugin.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",
|
||||||
"src/scripts/deleteHelper.js",
|
"src/scripts/deleteHelper.js",
|
||||||
"src/scripts/dfnshelper.js",
|
"src/scripts/dfnshelper.js",
|
||||||
"src/scripts/dom.js",
|
"src/scripts/dom.js",
|
||||||
|
"src/scripts/editorsidebar.js",
|
||||||
"src/scripts/fileDownloader.js",
|
"src/scripts/fileDownloader.js",
|
||||||
"src/scripts/filesystem.js",
|
"src/scripts/filesystem.js",
|
||||||
|
"src/scripts/globalize.js",
|
||||||
"src/scripts/imagehelper.js",
|
"src/scripts/imagehelper.js",
|
||||||
|
"src/scripts/itembynamedetailpage.js",
|
||||||
"src/scripts/inputManager.js",
|
"src/scripts/inputManager.js",
|
||||||
"src/plugins/backdropScreensaver/plugin.js",
|
"src/scripts/autoThemes.js",
|
||||||
"src/components/filterdialog/filterdialog.js",
|
"src/scripts/themeManager.js",
|
||||||
"src/components/fetchhelper.js",
|
|
||||||
"src/scripts/keyboardNavigation.js",
|
"src/scripts/keyboardNavigation.js",
|
||||||
|
"src/scripts/libraryMenu.js",
|
||||||
|
"src/scripts/libraryBrowser.js",
|
||||||
|
"src/scripts/livetvcomponents.js",
|
||||||
|
"src/scripts/mouseManager.js",
|
||||||
|
"src/scripts/multiDownload.js",
|
||||||
|
"src/scripts/playlists.js",
|
||||||
|
"src/scripts/scrollHelper.js",
|
||||||
|
"src/scripts/serverNotifications.js",
|
||||||
|
"src/scripts/routes.js",
|
||||||
"src/scripts/settings/appSettings.js",
|
"src/scripts/settings/appSettings.js",
|
||||||
"src/scripts/settings/userSettings.js",
|
"src/scripts/settings/userSettings.js",
|
||||||
"src/scripts/settings/webSettings.js"
|
"src/scripts/settings/webSettings.js",
|
||||||
|
"src/scripts/shell.js",
|
||||||
|
"src/scripts/taskbutton.js",
|
||||||
|
"src/scripts/themeLoader.js",
|
||||||
|
"src/scripts/touchHelper.js"
|
||||||
],
|
],
|
||||||
"plugins": [
|
"plugins": [
|
||||||
"@babel/plugin-transform-modules-amd",
|
"@babel/plugin-transform-modules-amd",
|
||||||
|
@ -151,7 +381,7 @@
|
||||||
"last 2 Chrome versions",
|
"last 2 Chrome versions",
|
||||||
"last 2 ChromeAndroid versions",
|
"last 2 ChromeAndroid versions",
|
||||||
"last 2 Safari versions",
|
"last 2 Safari versions",
|
||||||
"last 2 iOS versions",
|
"iOS > 10",
|
||||||
"last 2 Edge versions",
|
"last 2 Edge versions",
|
||||||
"Chrome 27",
|
"Chrome 27",
|
||||||
"Chrome 38",
|
"Chrome 38",
|
||||||
|
@ -159,9 +389,11 @@
|
||||||
"Chrome 53",
|
"Chrome 53",
|
||||||
"Chrome 56",
|
"Chrome 56",
|
||||||
"Chrome 63",
|
"Chrome 63",
|
||||||
|
"Edge 18",
|
||||||
"Firefox ESR"
|
"Firefox ESR"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
"start": "yarn serve",
|
||||||
"serve": "gulp serve --development",
|
"serve": "gulp serve --development",
|
||||||
"prepare": "gulp --production",
|
"prepare": "gulp --production",
|
||||||
"build:development": "gulp --development",
|
"build:development": "gulp --development",
|
||||||
|
|
33
scripts/duplicates.py
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
import sys
|
||||||
|
import os
|
||||||
|
import json
|
||||||
|
|
||||||
|
# load every string in the source language
|
||||||
|
# print all duplicate values to a file
|
||||||
|
|
||||||
|
cwd = os.getcwd()
|
||||||
|
source = cwd + '/../src/strings/en-us.json'
|
||||||
|
|
||||||
|
reverse = {}
|
||||||
|
duplicates = {}
|
||||||
|
|
||||||
|
with open(source) as en:
|
||||||
|
strings = json.load(en)
|
||||||
|
for key, value in strings.items():
|
||||||
|
if value not in reverse:
|
||||||
|
reverse[value] = [key]
|
||||||
|
else:
|
||||||
|
reverse[value].append(key)
|
||||||
|
|
||||||
|
for key, value in reverse.items():
|
||||||
|
if len(value) > 1:
|
||||||
|
duplicates[key] = value
|
||||||
|
|
||||||
|
print('LENGTH: ' + str(len(duplicates)))
|
||||||
|
with open('duplicates.txt', 'w') as out:
|
||||||
|
for item in duplicates:
|
||||||
|
out.write(json.dumps(item) + ': ')
|
||||||
|
out.write(json.dumps(duplicates[item]) + '\n')
|
||||||
|
out.close()
|
||||||
|
|
||||||
|
print('DONE')
|
|
@ -11,7 +11,7 @@ langlst = os.listdir(langdir)
|
||||||
|
|
||||||
keys = []
|
keys = []
|
||||||
|
|
||||||
with open('scout.txt', 'r') as f:
|
with open('unused.txt', 'r') as f:
|
||||||
for line in f:
|
for line in f:
|
||||||
keys.append(line.strip('\n'))
|
keys.append(line.strip('\n'))
|
||||||
|
|
|
@ -16,7 +16,7 @@ langlst.append('en-us.json')
|
||||||
dep = []
|
dep = []
|
||||||
|
|
||||||
def grep(key):
|
def grep(key):
|
||||||
command = 'grep -r -E "(\(\\\"|\(\'|\{)%s(\\\"|\'|\})" --include=\*.{js,html} --exclude-dir=../src/strings ../src' % key
|
command = 'grep -r -E "(\\\"|\'|\{)%s(\\\"|\'|\})" --include=\*.{js,html} --exclude-dir=../src/strings ../src' % key
|
||||||
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
p = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
|
||||||
output = p.stdout.readlines()
|
output = p.stdout.readlines()
|
||||||
if output:
|
if output:
|
|
@ -1,37 +0,0 @@
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1,
|
|
||||||
h2,
|
|
||||||
h3 {
|
|
||||||
font-family: "Noto Sans", sans-serif;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 1.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 1.17em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout-tv {
|
|
||||||
font-size: 130%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout-mobile {
|
|
||||||
font-size: 90%;
|
|
||||||
}
|
|
34
src/assets/css/fonts.scss
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
@mixin font($weight: null, $size: null) {
|
||||||
|
font-family: "Noto Sans", sans-serif;
|
||||||
|
font-weight: $weight;
|
||||||
|
font-size: $size;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
@include font;
|
||||||
|
text-size-adjust: 100%;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
|
text-rendering: optimizeLegibility;
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
@include font(400, 1.8em);
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
@include font(400, 1.5em);
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
@include font(400, 1.17em);
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-tv {
|
||||||
|
/* 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 {
|
||||||
|
font-size: 90%;
|
||||||
|
}
|
|
@ -1,31 +0,0 @@
|
||||||
h1 {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 1.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.layout-desktop h1 {
|
|
||||||
font-size: 2em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 1.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
h3 {
|
|
||||||
font-weight: 400;
|
|
||||||
font-size: 1.17em;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (min-height: 720px) {
|
|
||||||
html {
|
|
||||||
font-size: 20px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* This is supposed to be 1080p, but had to reduce the min height to account for possible browser chrome */
|
|
||||||
@media all and (min-height: 1000px) {
|
|
||||||
html {
|
|
||||||
font-size: 27px;
|
|
||||||
}
|
|
||||||
}
|
|
31
src/assets/css/fonts.sized.scss
Normal file
|
@ -0,0 +1,31 @@
|
||||||
|
@mixin header-font($size: null) {
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: $size;
|
||||||
|
}
|
||||||
|
|
||||||
|
html {
|
||||||
|
@media all and (min-height: 720px) {
|
||||||
|
font-size: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* This is supposed to be 1080p, but had to reduce the min height to account for possible browser chrome */
|
||||||
|
@media all and (min-height: 1000px) {
|
||||||
|
font-size: 27px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h1 {
|
||||||
|
@include header-font(1.8em);
|
||||||
|
|
||||||
|
.layout-desktop & {
|
||||||
|
font-size: 2em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
h2 {
|
||||||
|
@include header-font(1.8em);
|
||||||
|
}
|
||||||
|
|
||||||
|
h3 {
|
||||||
|
@include header-font(1.17em);
|
||||||
|
}
|
|
@ -1,8 +0,0 @@
|
||||||
html {
|
|
||||||
font-size: 82% !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.formDialogFooter {
|
|
||||||
position: static !important;
|
|
||||||
margin: 0 -1em !important;
|
|
||||||
}
|
|
3
src/assets/css/ios.scss
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
html {
|
||||||
|
font-size: 82% !important;
|
||||||
|
}
|
|
@ -28,6 +28,10 @@
|
||||||
padding-top: 0 !important;
|
padding-top: 0 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-tv .itemDetailPage {
|
||||||
|
padding-top: 4.2em !important;
|
||||||
|
}
|
||||||
|
|
||||||
.standalonePage {
|
.standalonePage {
|
||||||
padding-top: 4.5em !important;
|
padding-top: 4.5em !important;
|
||||||
}
|
}
|
||||||
|
@ -163,6 +167,12 @@
|
||||||
transition: background ease-in-out 0.5s;
|
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 {
|
.hiddenViewMenuBar .skinHeader {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -175,6 +185,10 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-tv .sectionTabs {
|
||||||
|
width: 55%;
|
||||||
|
}
|
||||||
|
|
||||||
.selectedMediaFolder {
|
.selectedMediaFolder {
|
||||||
background-color: #f2f2f2 !important;
|
background-color: #f2f2f2 !important;
|
||||||
}
|
}
|
||||||
|
@ -232,12 +246,6 @@
|
||||||
text-align: center;
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop .searchTabButton,
|
|
||||||
.layout-mobile .searchTabButton,
|
|
||||||
.layout-tv .headerSearchButton {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mainDrawer-scrollContainer {
|
.mainDrawer-scrollContainer {
|
||||||
padding-bottom: 10vh;
|
padding-bottom: 10vh;
|
||||||
}
|
}
|
||||||
|
@ -269,7 +277,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 84em) {
|
@media all and (max-width: 100em) {
|
||||||
.withSectionTabs .headerTop {
|
.withSectionTabs .headerTop {
|
||||||
padding-bottom: 0.55em;
|
padding-bottom: 0.55em;
|
||||||
}
|
}
|
||||||
|
@ -277,9 +285,13 @@
|
||||||
.sectionTabs {
|
.sectionTabs {
|
||||||
font-size: 83.5%;
|
font-size: 83.5%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-tv .sectionTabs {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (min-width: 84em) {
|
@media all and (min-width: 100em) {
|
||||||
.headerTop {
|
.headerTop {
|
||||||
padding: 0.8em 0.8em;
|
padding: 0.8em 0.8em;
|
||||||
}
|
}
|
||||||
|
@ -445,8 +457,7 @@
|
||||||
height: 26.5vh;
|
height: 26.5vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop .itemBackdrop::after,
|
.layout-desktop .itemBackdrop::after {
|
||||||
.layout-tv .itemBackdrop::after {
|
|
||||||
content: "";
|
content: "";
|
||||||
width: 100%;
|
width: 100%;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
|
@ -454,8 +465,8 @@
|
||||||
display: block;
|
display: block;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop .noBackdrop .itemBackdrop,
|
.layout-tv .itemBackdrop,
|
||||||
.layout-tv .noBackdrop .itemBackdrop {
|
.layout-desktop .noBackdrop .itemBackdrop {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -622,6 +633,10 @@
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-tv .detailPagePrimaryContainer {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
.layout-mobile .detailPagePrimaryContainer {
|
.layout-mobile .detailPagePrimaryContainer {
|
||||||
display: block;
|
display: block;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
@ -635,10 +650,14 @@
|
||||||
padding-left: 32.45vw;
|
padding-left: 32.45vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop .detailRibbon,
|
.layout-desktop .detailRibbon {
|
||||||
.layout-tv .detailRibbon {
|
|
||||||
margin-top: -7.2em;
|
margin-top: -7.2em;
|
||||||
height: 7.18em;
|
height: 7.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-tv .detailRibbon {
|
||||||
|
margin-top: 0;
|
||||||
|
height: inherit;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop .noBackdrop .detailRibbon,
|
.layout-desktop .noBackdrop .detailRibbon,
|
||||||
|
@ -746,8 +765,7 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-desktop .itemBackdrop,
|
.layout-desktop .itemBackdrop {
|
||||||
.layout-tv .itemBackdrop {
|
|
||||||
height: 40vh;
|
height: 40vh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -773,13 +791,8 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
}
|
}
|
||||||
|
|
||||||
.emby-button.detailFloatingButton {
|
.emby-button.detailFloatingButton {
|
||||||
position: absolute;
|
font-size: 1.4em;
|
||||||
background-color: rgba(0, 0, 0, 0.5);
|
margin-right: 0.5em !important;
|
||||||
z-index: 3;
|
|
||||||
top: 100%;
|
|
||||||
left: 90%;
|
|
||||||
margin: -2.2em 0 0 -2.2em;
|
|
||||||
padding: 0.4em;
|
|
||||||
color: rgba(255, 255, 255, 0.76);
|
color: rgba(255, 255, 255, 0.76);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -842,7 +855,7 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
-webkit-align-items: center;
|
-webkit-align-items: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
margin: 0 !important;
|
margin: 0 !important;
|
||||||
padding: 0.5em 0.7em !important;
|
padding: 0.7em 0.7em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (min-width: 29em) {
|
@media all and (min-width: 29em) {
|
||||||
|
@ -910,25 +923,7 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (min-width: 62.5em) {
|
@media all and (min-width: 100em) {
|
||||||
.headerTop {
|
|
||||||
padding-left: 0.8em;
|
|
||||||
padding-right: 0.8em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headerTabs {
|
|
||||||
align-self: center;
|
|
||||||
width: auto;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
margin-top: -4.2em;
|
|
||||||
position: relative;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detailFloatingButton {
|
|
||||||
display: none !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.personBackdrop {
|
.personBackdrop {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
@ -937,6 +932,11 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
font-size: 108%;
|
font-size: 108%;
|
||||||
margin: 1.25em 0;
|
margin: 1.25em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-tv .mainDetailButtons {
|
||||||
|
font-size: 108%;
|
||||||
|
margin: 1em 0 1.25em;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 50em) {
|
@media all and (max-width: 50em) {
|
||||||
|
@ -1152,13 +1152,13 @@ div:not(.sectionTitleContainer-cards) > .sectionTitle-cards {
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-tv .padded-top-focusscale {
|
.layout-tv .padded-top-focusscale {
|
||||||
padding-top: 1em;
|
padding-top: 1.5em;
|
||||||
margin-top: -1em;
|
margin-top: -1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-tv .padded-bottom-focusscale {
|
.layout-tv .padded-bottom-focusscale {
|
||||||
padding-bottom: 1em;
|
padding-bottom: 1.5em;
|
||||||
margin-bottom: -1em;
|
margin-bottom: -1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (min-height: 31.25em) {
|
@media all and (min-height: 31.25em) {
|
||||||
|
|
|
@ -2,8 +2,8 @@
|
||||||
padding-bottom: 15em;
|
padding-bottom: 15em;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (min-width: 62.5em) {
|
|
||||||
#guideTab {
|
#guideTab {
|
||||||
|
@media all and (min-width: 62.5em) {
|
||||||
padding-left: 0.5em;
|
padding-left: 0.5em;
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,7 @@
|
||||||
.hiddenScrollX,
|
.hiddenScrollX,
|
||||||
.layout-tv .scrollX {
|
.layout-tv .scrollX {
|
||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
|
scrollbar-width: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.hiddenScrollX-forced {
|
.hiddenScrollX-forced {
|
||||||
|
@ -40,6 +41,7 @@
|
||||||
.hiddenScrollY,
|
.hiddenScrollY,
|
||||||
.layout-tv .smoothScrollY {
|
.layout-tv .smoothScrollY {
|
||||||
-ms-overflow-style: none;
|
-ms-overflow-style: none;
|
||||||
|
scrollbar-width: none;
|
||||||
|
|
||||||
/* Can't do this because it not only hides the scrollbar, but also prevents scrolling */
|
/* Can't do this because it not only hides the scrollbar, but also prevents scrolling */
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
body,
|
@mixin fullpage {
|
||||||
html {
|
|
||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-mobile,
|
html {
|
||||||
.layout-tv {
|
@include fullpage;
|
||||||
-webkit-touch-callout: none;
|
line-height: 1.35;
|
||||||
user-select: none;
|
}
|
||||||
|
|
||||||
|
body {
|
||||||
|
@include fullpage;
|
||||||
|
overflow-x: hidden;
|
||||||
|
background-color: transparent !important;
|
||||||
|
-webkit-font-smoothing: antialiased;
|
||||||
}
|
}
|
||||||
|
|
||||||
.clipForScreenReader {
|
.clipForScreenReader {
|
||||||
|
@ -36,14 +41,10 @@ html {
|
||||||
contain: strict;
|
contain: strict;
|
||||||
}
|
}
|
||||||
|
|
||||||
html {
|
.layout-mobile,
|
||||||
line-height: 1.35;
|
.layout-tv {
|
||||||
}
|
-webkit-touch-callout: none;
|
||||||
|
user-select: none;
|
||||||
body {
|
|
||||||
overflow-x: hidden;
|
|
||||||
background-color: transparent !important;
|
|
||||||
-webkit-font-smoothing: antialiased;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.mainAnimatedPage {
|
.mainAnimatedPage {
|
||||||
|
@ -58,7 +59,7 @@ body {
|
||||||
overflow-y: hidden !important;
|
overflow-y: hidden !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
div[data-role=page] {
|
div[data-role="page"] {
|
||||||
outline: 0;
|
outline: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,11 +72,11 @@ div[data-role=page] {
|
||||||
padding-left: 0.15em;
|
padding-left: 0.15em;
|
||||||
font-weight: 400;
|
font-weight: 400;
|
||||||
white-space: normal !important;
|
white-space: normal !important;
|
||||||
}
|
|
||||||
|
|
||||||
.fieldDescription + .fieldDescription {
|
+ .fieldDescription {
|
||||||
margin-top: 0.3em;
|
margin-top: 0.3em;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.content-primary,
|
.content-primary,
|
||||||
.padded-bottom-page,
|
.padded-bottom-page,
|
||||||
|
@ -85,9 +86,14 @@ div[data-role=page] {
|
||||||
padding-bottom: 5em !important;
|
padding-bottom: 5em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.readOnlyContent {
|
||||||
@media all and (min-width: 50em) {
|
@media all and (min-width: 50em) {
|
||||||
.readOnlyContent,
|
max-width: 54em;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
form {
|
form {
|
||||||
|
@media all and (min-width: 50em) {
|
||||||
max-width: 54em;
|
max-width: 54em;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -107,15 +113,15 @@ div[data-role=page] {
|
||||||
.headroom {
|
.headroom {
|
||||||
will-change: transform;
|
will-change: transform;
|
||||||
transition: transform 200ms linear;
|
transition: transform 200ms linear;
|
||||||
}
|
|
||||||
|
|
||||||
.headroom--pinned {
|
&--pinned {
|
||||||
transform: translateY(0%);
|
transform: translateY(0%);
|
||||||
}
|
}
|
||||||
|
|
||||||
.headroom--unpinned {
|
&--unpinned {
|
||||||
transform: translateY(-100%);
|
transform: translateY(-100%);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.drawerContent {
|
.drawerContent {
|
||||||
/* make sure the bottom of the drawer is visible when music is playing */
|
/* make sure the bottom of the drawer is visible when music is playing */
|
||||||
|
@ -129,3 +135,17 @@ div[data-role=page] {
|
||||||
.hide-scroll {
|
.hide-scroll {
|
||||||
overflow-y: hidden;
|
overflow-y: hidden;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.w-100 {
|
||||||
|
width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-auto-x {
|
||||||
|
margin-left: auto;
|
||||||
|
margin-right: auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.margin-auto-y {
|
||||||
|
margin-top: auto;
|
||||||
|
margin-bottom: auto;
|
||||||
|
}
|
|
@ -6,30 +6,42 @@
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osdPoster img,
|
|
||||||
.pageContainer,
|
|
||||||
.videoOsdBottom {
|
.videoOsdBottom {
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
|
position: fixed;
|
||||||
|
background: linear-gradient(0deg, rgba(16, 16, 16, 0.75) 0%, rgba(16, 16, 16, 0) 100%);
|
||||||
|
padding-top: 7.5em;
|
||||||
|
padding-bottom: 1.75em;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
justify-content: center;
|
||||||
|
will-change: opacity;
|
||||||
|
transition: opacity 0.3s ease-out;
|
||||||
|
color: #fff;
|
||||||
|
user-select: none;
|
||||||
|
-webkit-touch-callout: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osdHeader {
|
.skinHeader-withBackground.osdHeader {
|
||||||
-webkit-transition: opacity 0.3s ease-out;
|
|
||||||
-o-transition: opacity 0.3s ease-out;
|
|
||||||
transition: opacity 0.3s ease-out;
|
transition: opacity 0.3s ease-out;
|
||||||
position: relative;
|
position: relative;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
background: rgba(0, 0, 0, 0.7) !important;
|
background: linear-gradient(180deg, rgba(16, 16, 16, 0.75) 0%, rgba(16, 16, 16, 0) 100%);
|
||||||
-webkit-backdrop-filter: none !important;
|
backdrop-filter: none;
|
||||||
backdrop-filter: none !important;
|
color: #eee;
|
||||||
color: #eee !important;
|
height: 7.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osdHeader-hidden {
|
.osdHeader-hidden {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.osdHeader .headerTop {
|
||||||
|
max-height: 3.5em;
|
||||||
|
}
|
||||||
|
|
||||||
.osdHeader .headerButton:not(.headerBackButton):not(.headerCastButton):not(.headerSyncButton) {
|
.osdHeader .headerButton:not(.headerBackButton):not(.headerCastButton):not(.headerSyncButton) {
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
|
@ -87,34 +99,17 @@
|
||||||
opacity: 0.6;
|
opacity: 0.6;
|
||||||
}
|
}
|
||||||
|
|
||||||
.videoOsdBottom {
|
|
||||||
position: fixed;
|
|
||||||
background-color: rgba(0, 0, 0, 0.7);
|
|
||||||
padding: 1%;
|
|
||||||
display: -webkit-box;
|
|
||||||
display: -webkit-flex;
|
|
||||||
display: flex;
|
|
||||||
-webkit-box-orient: horizontal;
|
|
||||||
-webkit-box-direction: normal;
|
|
||||||
-webkit-flex-direction: row;
|
|
||||||
flex-direction: row;
|
|
||||||
will-change: opacity;
|
|
||||||
-webkit-transition: opacity 0.3s ease-out;
|
|
||||||
-o-transition: opacity 0.3s ease-out;
|
|
||||||
transition: opacity 0.3s ease-out;
|
|
||||||
color: #fff;
|
|
||||||
user-select: none;
|
|
||||||
-webkit-touch-callout: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.videoOsdBottom-hidden {
|
.videoOsdBottom-hidden {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osdControls {
|
.osdControls {
|
||||||
-webkit-box-flex: 1;
|
|
||||||
-webkit-flex-grow: 1;
|
|
||||||
flex-grow: 1;
|
flex-grow: 1;
|
||||||
|
padding: 0 0.8em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-desktop .osdControls {
|
||||||
|
max-width: calc(100vh * 1.77 - 2vh);
|
||||||
}
|
}
|
||||||
|
|
||||||
.videoOsdBottom .buttons {
|
.videoOsdBottom .buttons {
|
||||||
|
@ -146,7 +141,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.volumeButtons {
|
.volumeButtons {
|
||||||
margin: 0 0.5em 0 auto;
|
margin: 0 1em 0 0.29em;
|
||||||
display: flex;
|
display: flex;
|
||||||
-webkit-align-items: center;
|
-webkit-align-items: center;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
|
@ -154,33 +149,13 @@
|
||||||
|
|
||||||
.osdTimeText {
|
.osdTimeText {
|
||||||
margin-left: 1em;
|
margin-left: 1em;
|
||||||
|
margin-right: auto;
|
||||||
-webkit-user-select: none;
|
-webkit-user-select: none;
|
||||||
-moz-user-select: none;
|
-moz-user-select: none;
|
||||||
-ms-user-select: none;
|
-ms-user-select: none;
|
||||||
user-select: none;
|
user-select: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.osdPoster {
|
|
||||||
width: 10%;
|
|
||||||
position: relative;
|
|
||||||
margin-right: 0.5em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osdPoster img {
|
|
||||||
position: absolute;
|
|
||||||
height: auto;
|
|
||||||
width: 100%;
|
|
||||||
-webkit-box-shadow: 0 0 1.9vh #000;
|
|
||||||
box-shadow: 0 0 1.9vh #000;
|
|
||||||
border: 0.08em solid #222;
|
|
||||||
user-drag: none;
|
|
||||||
user-select: none;
|
|
||||||
-moz-user-select: none;
|
|
||||||
-webkit-user-drag: none;
|
|
||||||
-webkit-user-select: none;
|
|
||||||
-ms-user-select: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.osdTitle,
|
.osdTitle,
|
||||||
.osdTitleSmall {
|
.osdTitleSmall {
|
||||||
margin: 0 1em 0 0;
|
margin: 0 1em 0 0;
|
||||||
|
@ -248,14 +223,7 @@
|
||||||
animation: spin 4s linear infinite;
|
animation: spin 4s linear infinite;
|
||||||
}
|
}
|
||||||
|
|
||||||
.pageContainer {
|
|
||||||
top: 0;
|
|
||||||
position: fixed;
|
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (max-width: 30em) {
|
@media all and (max-width: 30em) {
|
||||||
.btnFastForward,
|
|
||||||
.btnRewind,
|
|
||||||
.osdMediaInfo,
|
.osdMediaInfo,
|
||||||
.osdPoster {
|
.osdPoster {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
|
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 1.6 KiB |
1
src/assets/img/devices/edgechromium.svg
Normal file
|
@ -0,0 +1 @@
|
||||||
|
<svg xmlns="http://www.w3.org/2000/svg" role="img" viewBox="0 0 24 24"><title>Microsoft Edge icon</title><path d="M21.86 17.86q.14 0 .25.12.1.13.1.25t-.11.33l-.32.46-.43.53-.44.5q-.21.25-.38.42l-.22.23q-.58.53-1.34 1.04-.76.51-1.6.91-.86.4-1.74.64t-1.67.24q-.9 0-1.69-.28-.8-.28-1.48-.78-.68-.5-1.22-1.17-.53-.66-.92-1.44-.38-.77-.58-1.6-.2-.83-.2-1.67 0-1 .32-1.96.33-.97.87-1.8.14.95.55 1.77.41.82 1.02 1.5.6.68 1.38 1.21.78.54 1.64.9.86.36 1.77.56.92.2 1.8.2 1.12 0 2.18-.24 1.06-.23 2.06-.72l.2-.1.2-.05zm-15.5-1.27q0 1.1.27 2.15.27 1.06.78 2.03.51.96 1.24 1.77.74.82 1.66 1.4-1.47-.2-2.8-.74-1.33-.55-2.48-1.37-1.15-.83-2.08-1.9-.92-1.07-1.58-2.33T.36 14.94Q0 13.54 0 12.06q0-.81.32-1.49.31-.68.83-1.23.53-.55 1.2-.96.66-.4 1.35-.66.74-.27 1.5-.39.78-.12 1.55-.12.7 0 1.42.1.72.12 1.4.35.68.23 1.32.57.63.35 1.16.83-.35 0-.7.07-.33.07-.65.23v-.02q-.63.28-1.2.74-.57.46-1.05 1.04-.48.58-.87 1.26-.38.67-.65 1.39-.27.71-.42 1.44-.15.72-.15 1.38zM11.96.06q1.7 0 3.33.39 1.63.38 3.07 1.15 1.43.77 2.62 1.93 1.18 1.16 1.98 2.7.49.94.76 1.96.28 1 .28 2.08 0 .89-.23 1.7-.24.8-.69 1.48-.45.68-1.1 1.22-.64.53-1.45.88-.54.24-1.11.36-.58.13-1.16.13-.42 0-.97-.03-.54-.03-1.1-.12-.55-.1-1.05-.28-.5-.19-.84-.5-.12-.09-.23-.24-.1-.16-.1-.33 0-.15.16-.35.16-.2.35-.5.2-.28.36-.68.16-.4.16-.95 0-1.06-.4-1.96-.4-.91-1.06-1.64-.66-.74-1.52-1.28-.86-.55-1.79-.89-.84-.3-1.72-.44-.87-.14-1.76-.14-1.55 0-3.06.45T.94 7.55q.71-1.74 1.81-3.13 1.1-1.38 2.52-2.35Q6.68 1.1 8.37.58q1.7-.52 3.58-.52Z" fill="#fff"/></svg>
|
After Width: | Height: | Size: 1.5 KiB |
Before Width: | Height: | Size: 39 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 32 KiB |
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 57 KiB After Width: | Height: | Size: 41 KiB |
Before Width: | Height: | Size: 52 KiB After Width: | Height: | Size: 42 KiB |
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 46 KiB After Width: | Height: | Size: 35 KiB |
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 32 KiB After Width: | Height: | Size: 20 KiB |
Before Width: | Height: | Size: 29 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 33 KiB After Width: | Height: | Size: 21 KiB |
Before Width: | Height: | Size: 42 KiB After Width: | Height: | Size: 28 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 41 KiB After Width: | Height: | Size: 31 KiB |
Before Width: | Height: | Size: 44 KiB After Width: | Height: | Size: 34 KiB |
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 23 KiB |
Before Width: | Height: | Size: 36 KiB After Width: | Height: | Size: 26 KiB |
Before Width: | Height: | Size: 45 KiB After Width: | Height: | Size: 30 KiB |
Before Width: | Height: | Size: 43 KiB After Width: | Height: | Size: 33 KiB |
|
@ -2,165 +2,164 @@
|
||||||
* require.js module definitions bundled by webpack
|
* require.js module definitions bundled by webpack
|
||||||
*/
|
*/
|
||||||
// Use define from require.js not webpack's define
|
// Use define from require.js not webpack's define
|
||||||
var _define = window.define;
|
const _define = window.define;
|
||||||
|
|
||||||
// fetch
|
// fetch
|
||||||
var fetch = require('whatwg-fetch');
|
const fetch = require('whatwg-fetch');
|
||||||
_define('fetch', function() {
|
_define('fetch', function() {
|
||||||
return fetch;
|
return fetch;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Blurhash
|
// Blurhash
|
||||||
var blurhash = require('blurhash');
|
const blurhash = require('blurhash');
|
||||||
_define('blurhash', function() {
|
_define('blurhash', function() {
|
||||||
return blurhash;
|
return blurhash;
|
||||||
});
|
});
|
||||||
|
|
||||||
// query-string
|
// query-string
|
||||||
var query = require('query-string');
|
const query = require('query-string');
|
||||||
_define('queryString', function() {
|
_define('queryString', function() {
|
||||||
return query;
|
return query;
|
||||||
});
|
});
|
||||||
|
|
||||||
// flvjs
|
// flvjs
|
||||||
var flvjs = require('flv.js/dist/flv').default;
|
const flvjs = require('flv.js/dist/flv').default;
|
||||||
_define('flvjs', function() {
|
_define('flvjs', function() {
|
||||||
return flvjs;
|
return flvjs;
|
||||||
});
|
});
|
||||||
|
|
||||||
// jstree
|
// jstree
|
||||||
var jstree = require('jstree');
|
const jstree = require('jstree');
|
||||||
require('jstree/dist/themes/default/style.css');
|
require('jstree/dist/themes/default/style.css');
|
||||||
_define('jstree', function() {
|
_define('jstree', function() {
|
||||||
return jstree;
|
return jstree;
|
||||||
});
|
});
|
||||||
|
|
||||||
// jquery
|
// jquery
|
||||||
var jquery = require('jquery');
|
const jquery = require('jquery');
|
||||||
_define('jQuery', function() {
|
_define('jQuery', function() {
|
||||||
return jquery;
|
return jquery;
|
||||||
});
|
});
|
||||||
|
|
||||||
// hlsjs
|
// hlsjs
|
||||||
var hlsjs = require('hls.js');
|
const hlsjs = require('hls.js');
|
||||||
_define('hlsjs', function() {
|
_define('hlsjs', function() {
|
||||||
return hlsjs;
|
return hlsjs;
|
||||||
});
|
});
|
||||||
|
|
||||||
// howler
|
// howler
|
||||||
var howler = require('howler');
|
const howler = require('howler');
|
||||||
_define('howler', function() {
|
_define('howler', function() {
|
||||||
return howler;
|
return howler;
|
||||||
});
|
});
|
||||||
|
|
||||||
// resize-observer-polyfill
|
// resize-observer-polyfill
|
||||||
var resize = require('resize-observer-polyfill').default;
|
const resize = require('resize-observer-polyfill').default;
|
||||||
_define('resize-observer-polyfill', function() {
|
_define('resize-observer-polyfill', function() {
|
||||||
return resize;
|
return resize;
|
||||||
});
|
});
|
||||||
|
|
||||||
// swiper
|
// swiper
|
||||||
var swiper = require('swiper/js/swiper');
|
const swiper = require('swiper/swiper-bundle');
|
||||||
require('swiper/css/swiper.min.css');
|
require('swiper/swiper-bundle.css');
|
||||||
_define('swiper', function() {
|
_define('swiper', function() {
|
||||||
return swiper;
|
return swiper;
|
||||||
});
|
});
|
||||||
|
|
||||||
// sortable
|
// sortable
|
||||||
var sortable = require('sortablejs').default;
|
const sortable = require('sortablejs').default;
|
||||||
_define('sortable', function() {
|
_define('sortable', function() {
|
||||||
return sortable;
|
return sortable;
|
||||||
});
|
});
|
||||||
|
|
||||||
// webcomponents
|
// webcomponents
|
||||||
var webcomponents = require('webcomponents.js/webcomponents-lite');
|
const webcomponents = require('webcomponents.js/webcomponents-lite');
|
||||||
_define('webcomponents', function() {
|
_define('webcomponents', function() {
|
||||||
return webcomponents;
|
return webcomponents;
|
||||||
});
|
});
|
||||||
|
|
||||||
// shaka
|
|
||||||
var shaka = require('shaka-player');
|
|
||||||
_define('shaka', function() {
|
|
||||||
return shaka;
|
|
||||||
});
|
|
||||||
|
|
||||||
// libass-wasm
|
// libass-wasm
|
||||||
var libassWasm = require('libass-wasm');
|
const libassWasm = require('libass-wasm');
|
||||||
_define('JavascriptSubtitlesOctopus', function() {
|
_define('JavascriptSubtitlesOctopus', function() {
|
||||||
return libassWasm;
|
return libassWasm;
|
||||||
});
|
});
|
||||||
|
|
||||||
// material-icons
|
// material-icons
|
||||||
var materialIcons = require('material-design-icons-iconfont/dist/material-design-icons.css');
|
const materialIcons = require('material-design-icons-iconfont/dist/material-design-icons.css');
|
||||||
_define('material-icons', function() {
|
_define('material-icons', function() {
|
||||||
return materialIcons;
|
return materialIcons;
|
||||||
});
|
});
|
||||||
|
|
||||||
// noto font
|
// noto font
|
||||||
var noto = require('jellyfin-noto');
|
const noto = require('jellyfin-noto');
|
||||||
_define('jellyfin-noto', function () {
|
_define('jellyfin-noto', function () {
|
||||||
return noto;
|
return noto;
|
||||||
});
|
});
|
||||||
|
|
||||||
var epubjs = require('epubjs');
|
const epubjs = require('epubjs');
|
||||||
_define('epubjs', function () {
|
_define('epubjs', function () {
|
||||||
return epubjs;
|
return epubjs;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
const pdfjs = require('pdfjs-dist/build/pdf');
|
||||||
|
_define('pdfjs', function () {
|
||||||
|
return pdfjs;
|
||||||
|
});
|
||||||
|
|
||||||
// page.js
|
// page.js
|
||||||
var page = require('page');
|
const page = require('page');
|
||||||
_define('page', function() {
|
_define('page', function() {
|
||||||
return page;
|
return page;
|
||||||
});
|
});
|
||||||
|
|
||||||
// core-js
|
// core-js
|
||||||
var polyfill = require('@babel/polyfill/dist/polyfill');
|
const polyfill = require('@babel/polyfill/dist/polyfill');
|
||||||
_define('polyfill', function () {
|
_define('polyfill', function () {
|
||||||
return polyfill;
|
return polyfill;
|
||||||
});
|
});
|
||||||
|
|
||||||
// domtokenlist-shim
|
// domtokenlist-shim
|
||||||
var classlist = require('classlist.js');
|
const classlist = require('classlist.js');
|
||||||
_define('classlist-polyfill', function () {
|
_define('classlist-polyfill', function () {
|
||||||
return classlist;
|
return classlist;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Date-FNS
|
// Date-FNS
|
||||||
var dateFns = require('date-fns');
|
const dateFns = require('date-fns');
|
||||||
_define('date-fns', function () {
|
_define('date-fns', function () {
|
||||||
return dateFns;
|
return dateFns;
|
||||||
});
|
});
|
||||||
|
|
||||||
var dateFnsLocale = require('date-fns/locale');
|
const dateFnsLocale = require('date-fns/locale');
|
||||||
_define('date-fns/locale', function () {
|
_define('date-fns/locale', function () {
|
||||||
return dateFnsLocale;
|
return dateFnsLocale;
|
||||||
});
|
});
|
||||||
|
|
||||||
var fast_text_encoding = require('fast-text-encoding');
|
const fast_text_encoding = require('fast-text-encoding');
|
||||||
_define('fast-text-encoding', function () {
|
_define('fast-text-encoding', function () {
|
||||||
return fast_text_encoding;
|
return fast_text_encoding;
|
||||||
});
|
});
|
||||||
|
|
||||||
// intersection-observer
|
// intersection-observer
|
||||||
var intersection_observer = require('intersection-observer');
|
const intersection_observer = require('intersection-observer');
|
||||||
_define('intersection-observer', function () {
|
_define('intersection-observer', function () {
|
||||||
return intersection_observer;
|
return intersection_observer;
|
||||||
});
|
});
|
||||||
|
|
||||||
// screenfull
|
// screenfull
|
||||||
var screenfull = require('screenfull');
|
const screenfull = require('screenfull');
|
||||||
_define('screenfull', function () {
|
_define('screenfull', function () {
|
||||||
return screenfull;
|
return screenfull;
|
||||||
});
|
});
|
||||||
|
|
||||||
// headroom.js
|
// headroom.js
|
||||||
var headroom = require('headroom.js/dist/headroom');
|
const headroom = require('headroom.js/dist/headroom');
|
||||||
_define('headroom', function () {
|
_define('headroom', function () {
|
||||||
return headroom;
|
return headroom;
|
||||||
});
|
});
|
||||||
|
|
||||||
// apiclient
|
// apiclient
|
||||||
var apiclient = require('jellyfin-apiclient');
|
const apiclient = require('jellyfin-apiclient');
|
||||||
|
|
||||||
_define('apiclient', function () {
|
_define('apiclient', function () {
|
||||||
return apiclient.ApiClient;
|
return apiclient.ApiClient;
|
||||||
|
@ -181,3 +180,9 @@ _define('connectionManagerFactory', function () {
|
||||||
_define('appStorage', function () {
|
_define('appStorage', function () {
|
||||||
return apiclient.AppStorage;
|
return apiclient.AppStorage;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// libarchive.js
|
||||||
|
const libarchive = require('libarchive.js');
|
||||||
|
_define('libarchive', function () {
|
||||||
|
return libarchive;
|
||||||
|
});
|
||||||
|
|
|
@ -49,7 +49,7 @@ import 'formDialogStyle';
|
||||||
};
|
};
|
||||||
|
|
||||||
if (parseFloat(updatedSchedule.StartHour) >= parseFloat(updatedSchedule.EndHour)) {
|
if (parseFloat(updatedSchedule.StartHour) >= parseFloat(updatedSchedule.EndHour)) {
|
||||||
return void alert(globalize.translate('ErrorMessageStartHourGreaterThanEnd'));
|
return void alert(globalize.translate('ErrorStartHourGreaterThanEnd'));
|
||||||
}
|
}
|
||||||
|
|
||||||
context.submitted = true;
|
context.submitted = true;
|
||||||
|
@ -59,15 +59,14 @@ import 'formDialogStyle';
|
||||||
|
|
||||||
export function show(options) {
|
export function show(options) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
// TODO: remove require
|
import('text!./accessSchedule.template.html').then(({default: template}) => {
|
||||||
require(['text!./components/accessSchedule/accessSchedule.template.html'], template => {
|
|
||||||
const dlg = dialogHelper.createDialog({
|
const dlg = dialogHelper.createDialog({
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
size: 'small'
|
size: 'small'
|
||||||
});
|
});
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
let html = '';
|
let html = '';
|
||||||
html += globalize.translateDocument(template);
|
html += globalize.translateHtml(template);
|
||||||
dlg.innerHTML = html;
|
dlg.innerHTML = html;
|
||||||
populateHours(dlg);
|
populateHours(dlg);
|
||||||
loadSchedule(dlg, options.schedule);
|
loadSchedule(dlg, options.schedule);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="formDialogHeader">
|
<div class="formDialogHeader">
|
||||||
<button is="paper-icon-button-light" class="btnCancel autoSize" title="${LabelPrevious}" tabindex="-1">
|
<button is="paper-icon-button-light" class="btnCancel autoSize" title="${Previous}" tabindex="-1">
|
||||||
<span class="material-icons arrow_back" aria-hidden="true"></span>
|
<span class="material-icons arrow_back" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
<h3 class="formDialogHeaderTitle">
|
<h3 class="formDialogHeaderTitle">
|
||||||
|
@ -12,13 +12,13 @@
|
||||||
|
|
||||||
<div class="selectContainer">
|
<div class="selectContainer">
|
||||||
<select is="emby-select" id="selectDay" label="${LabelAccessDay}">
|
<select is="emby-select" id="selectDay" label="${LabelAccessDay}">
|
||||||
<option value="Sunday">${OptionSunday}</option>
|
<option value="Sunday">${Sunday}</option>
|
||||||
<option value="Monday">${OptionMonday}</option>
|
<option value="Monday">${Monday}</option>
|
||||||
<option value="Tuesday">${OptionTuesday}</option>
|
<option value="Tuesday">${Tuesday}</option>
|
||||||
<option value="Wednesday">${OptionWednesday}</option>
|
<option value="Wednesday">${Wednesday}</option>
|
||||||
<option value="Thursday">${OptionThursday}</option>
|
<option value="Thursday">${Thursday}</option>
|
||||||
<option value="Friday">${OptionFriday}</option>
|
<option value="Friday">${Friday}</option>
|
||||||
<option value="Saturday">${OptionSaturday}</option>
|
<option value="Saturday">${Saturday}</option>
|
||||||
<option value="Everyday">${OptionEveryday}</option>
|
<option value="Everyday">${OptionEveryday}</option>
|
||||||
<option value="Weekday">${OptionWeekdays}</option>
|
<option value="Weekday">${OptionWeekdays}</option>
|
||||||
<option value="Weekend">${OptionWeekends}</option>
|
<option value="Weekend">${OptionWeekends}</option>
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
<div class="formDialogFooter">
|
<div class="formDialogFooter">
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">
|
<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">
|
||||||
<span>${ButtonAdd}</span>
|
<span>${Add}</span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -9,15 +9,14 @@ import 'scrollStyles';
|
||||||
import 'listViewStyle';
|
import 'listViewStyle';
|
||||||
|
|
||||||
function getOffsets(elems) {
|
function getOffsets(elems) {
|
||||||
|
const results = [];
|
||||||
let results = [];
|
|
||||||
|
|
||||||
if (!document) {
|
if (!document) {
|
||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const elem of elems) {
|
for (const elem of elems) {
|
||||||
let box = elem.getBoundingClientRect();
|
const box = elem.getBoundingClientRect();
|
||||||
|
|
||||||
results.push({
|
results.push({
|
||||||
top: box.top,
|
top: box.top,
|
||||||
|
@ -31,12 +30,11 @@ function getOffsets(elems) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPosition(options, dlg) {
|
function getPosition(options, dlg) {
|
||||||
|
|
||||||
const windowSize = dom.getWindowSize();
|
const windowSize = dom.getWindowSize();
|
||||||
const windowHeight = windowSize.innerHeight;
|
const windowHeight = windowSize.innerHeight;
|
||||||
const windowWidth = windowSize.innerWidth;
|
const windowWidth = windowSize.innerWidth;
|
||||||
|
|
||||||
let pos = getOffsets([options.positionTo])[0];
|
const pos = getOffsets([options.positionTo])[0];
|
||||||
|
|
||||||
if (options.positionY !== 'top') {
|
if (options.positionY !== 'top') {
|
||||||
pos.top += (pos.height || 0) / 2;
|
pos.top += (pos.height || 0) / 2;
|
||||||
|
@ -73,19 +71,18 @@ function getPosition(options, dlg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
import('scrollHelper').then(({default: scrollHelper}) => {
|
||||||
const fn = on ? 'on' : 'off';
|
const fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function show(options) {
|
export function show(options) {
|
||||||
|
|
||||||
// items
|
// items
|
||||||
// positionTo
|
// positionTo
|
||||||
// showCancel
|
// showCancel
|
||||||
// title
|
// title
|
||||||
let dialogOptions = {
|
const dialogOptions = {
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
enableHistory: options.enableHistory,
|
enableHistory: options.enableHistory,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
|
@ -98,7 +95,6 @@ export function show(options) {
|
||||||
isFullscreen = true;
|
isFullscreen = true;
|
||||||
dialogOptions.autoFocus = true;
|
dialogOptions.autoFocus = true;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
dialogOptions.modal = false;
|
dialogOptions.modal = false;
|
||||||
dialogOptions.entryAnimation = options.entryAnimation;
|
dialogOptions.entryAnimation = options.entryAnimation;
|
||||||
dialogOptions.exitAnimation = options.exitAnimation;
|
dialogOptions.exitAnimation = options.exitAnimation;
|
||||||
|
@ -107,7 +103,7 @@ export function show(options) {
|
||||||
dialogOptions.autoFocus = false;
|
dialogOptions.autoFocus = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
let dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
if (isFullscreen) {
|
if (isFullscreen) {
|
||||||
dlg.classList.add('actionsheet-fullscreen');
|
dlg.classList.add('actionsheet-fullscreen');
|
||||||
|
@ -133,10 +129,9 @@ export function show(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
let renderIcon = false;
|
let renderIcon = false;
|
||||||
let icons = [];
|
const icons = [];
|
||||||
let itemIcon;
|
let itemIcon;
|
||||||
for (const item of options.items) {
|
for (const item of options.items) {
|
||||||
|
|
||||||
itemIcon = item.icon || (item.selected ? 'check' : null);
|
itemIcon = item.icon || (item.selected ? 'check' : null);
|
||||||
|
|
||||||
if (itemIcon) {
|
if (itemIcon) {
|
||||||
|
@ -161,7 +156,6 @@ export function show(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.title) {
|
if (options.title) {
|
||||||
|
|
||||||
html += '<h1 class="actionSheetTitle">' + options.title + '</h1>';
|
html += '<h1 class="actionSheetTitle">' + options.title + '</h1>';
|
||||||
}
|
}
|
||||||
if (options.text) {
|
if (options.text) {
|
||||||
|
@ -197,7 +191,6 @@ export function show(options) {
|
||||||
const item = options.items[i];
|
const item = options.items[i];
|
||||||
|
|
||||||
if (item.divider) {
|
if (item.divider) {
|
||||||
|
|
||||||
html += '<div class="actionsheetDivider"></div>';
|
html += '<div class="actionsheetDivider"></div>';
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -248,15 +241,13 @@ export function show(options) {
|
||||||
centerFocus(dlg.querySelector('.actionSheetScroller'), false, true);
|
centerFocus(dlg.querySelector('.actionSheetScroller'), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
let btnCloseActionSheet = dlg.querySelector('.btnCloseActionSheet');
|
const btnCloseActionSheet = dlg.querySelector('.btnCloseActionSheet');
|
||||||
if (btnCloseActionSheet) {
|
if (btnCloseActionSheet) {
|
||||||
btnCloseActionSheet.addEventListener('click', function () {
|
btnCloseActionSheet.addEventListener('click', function () {
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Seeing an issue in some non-chrome browsers where this is requiring a double click
|
|
||||||
//var eventName = browser.firefox ? 'mousedown' : 'click';
|
|
||||||
let selectedId;
|
let selectedId;
|
||||||
|
|
||||||
let timeout;
|
let timeout;
|
||||||
|
@ -267,26 +258,20 @@ export function show(options) {
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
let isResolved;
|
let isResolved;
|
||||||
|
|
||||||
dlg.addEventListener('click', function (e) {
|
dlg.addEventListener('click', function (e) {
|
||||||
|
|
||||||
const actionSheetMenuItem = dom.parentWithClass(e.target, 'actionSheetMenuItem');
|
const actionSheetMenuItem = dom.parentWithClass(e.target, 'actionSheetMenuItem');
|
||||||
|
|
||||||
if (actionSheetMenuItem) {
|
if (actionSheetMenuItem) {
|
||||||
selectedId = actionSheetMenuItem.getAttribute('data-id');
|
selectedId = actionSheetMenuItem.getAttribute('data-id');
|
||||||
|
|
||||||
if (options.resolveOnClick) {
|
if (options.resolveOnClick) {
|
||||||
|
|
||||||
if (options.resolveOnClick.indexOf) {
|
if (options.resolveOnClick.indexOf) {
|
||||||
|
|
||||||
if (options.resolveOnClick.indexOf(selectedId) !== -1) {
|
if (options.resolveOnClick.indexOf(selectedId) !== -1) {
|
||||||
|
|
||||||
resolve(selectedId);
|
resolve(selectedId);
|
||||||
isResolved = true;
|
isResolved = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
resolve(selectedId);
|
resolve(selectedId);
|
||||||
isResolved = true;
|
isResolved = true;
|
||||||
|
@ -295,11 +280,9 @@ export function show(options) {
|
||||||
|
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.addEventListener('close', function () {
|
dlg.addEventListener('close', function () {
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
centerFocus(dlg.querySelector('.actionSheetScroller'), false, false);
|
centerFocus(dlg.querySelector('.actionSheetScroller'), false, false);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,13 +1,21 @@
|
||||||
define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings', 'serverNotifications', 'connectionManager', 'emby-button', 'listViewStyle'], function (events, globalize, dom, datefns, dfnshelper, userSettings, serverNotifications, connectionManager) {
|
import events from 'events';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
import dom from 'dom';
|
||||||
|
import * as datefns from 'date-fns';
|
||||||
|
import dfnshelper from 'dfnshelper';
|
||||||
|
import serverNotifications from 'serverNotifications';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'listViewStyle';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function getEntryHtml(entry, apiClient) {
|
function getEntryHtml(entry, apiClient) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="listItem listItem-border">';
|
html += '<div class="listItem listItem-border">';
|
||||||
var color = '#00a4dc';
|
let color = '#00a4dc';
|
||||||
var icon = 'notifications';
|
let icon = 'notifications';
|
||||||
|
|
||||||
if ('Error' == entry.Severity || 'Fatal' == entry.Severity || 'Warn' == entry.Severity) {
|
if (entry.Severity == 'Error' || entry.Severity == 'Fatal' || entry.Severity == 'Warn') {
|
||||||
color = '#cc0000';
|
color = '#cc0000';
|
||||||
icon = 'notification_important';
|
icon = 'notification_important';
|
||||||
}
|
}
|
||||||
|
@ -51,14 +59,15 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadData(instance, elem, apiClient, startIndex, limit) {
|
function reloadData(instance, elem, apiClient, startIndex, limit) {
|
||||||
if (null == startIndex) {
|
if (startIndex == null) {
|
||||||
startIndex = parseInt(elem.getAttribute('data-activitystartindex') || '0');
|
startIndex = parseInt(elem.getAttribute('data-activitystartindex') || '0');
|
||||||
}
|
}
|
||||||
|
|
||||||
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
||||||
var minDate = new Date();
|
const minDate = new Date();
|
||||||
var hasUserId = 'false' !== elem.getAttribute('data-useractivity');
|
const hasUserId = elem.getAttribute('data-useractivity') !== 'false';
|
||||||
|
|
||||||
|
// TODO: Use date-fns
|
||||||
if (hasUserId) {
|
if (hasUserId) {
|
||||||
minDate.setTime(minDate.getTime() - 24 * 60 * 60 * 1000); // one day back
|
minDate.setTime(minDate.getTime() - 24 * 60 * 60 * 1000); // one day back
|
||||||
} else {
|
} else {
|
||||||
|
@ -74,7 +83,7 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
elem.setAttribute('data-activitystartindex', startIndex);
|
elem.setAttribute('data-activitystartindex', startIndex);
|
||||||
elem.setAttribute('data-activitylimit', limit);
|
elem.setAttribute('data-activitylimit', limit);
|
||||||
if (!startIndex) {
|
if (!startIndex) {
|
||||||
var activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
const activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
||||||
|
|
||||||
if (activityContainer) {
|
if (activityContainer) {
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
|
@ -91,7 +100,7 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onActivityLogUpdate(e, apiClient, data) {
|
function onActivityLogUpdate(e, apiClient, data) {
|
||||||
var options = this.options;
|
const options = this.options;
|
||||||
|
|
||||||
if (options && options.serverId === apiClient.serverId()) {
|
if (options && options.serverId === apiClient.serverId()) {
|
||||||
reloadData(this, options.element, apiClient);
|
reloadData(this, options.element, apiClient);
|
||||||
|
@ -99,14 +108,14 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onListClick(e) {
|
function onListClick(e) {
|
||||||
var btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
const btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
||||||
|
|
||||||
if (btnEntryInfo) {
|
if (btnEntryInfo) {
|
||||||
var id = btnEntryInfo.getAttribute('data-id');
|
const id = btnEntryInfo.getAttribute('data-id');
|
||||||
var items = this.items;
|
const items = this.items;
|
||||||
|
|
||||||
if (items) {
|
if (items) {
|
||||||
var item = items.filter(function (i) {
|
const item = items.filter(function (i) {
|
||||||
return i.Id.toString() === id;
|
return i.Id.toString() === id;
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
|
@ -118,35 +127,35 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
}
|
}
|
||||||
|
|
||||||
function showItemOverview(item) {
|
function showItemOverview(item) {
|
||||||
require(['alert'], function (alert) {
|
import('alert').then(({default: alert}) => {
|
||||||
alert({
|
alert({
|
||||||
text: item.Overview
|
text: item.Overview
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function ActivityLog(options) {
|
class ActivityLog {
|
||||||
|
constructor(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
var element = options.element;
|
const element = options.element;
|
||||||
element.classList.add('activityLogListWidget');
|
element.classList.add('activityLogListWidget');
|
||||||
element.addEventListener('click', onListClick.bind(this));
|
element.addEventListener('click', onListClick.bind(this));
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
reloadData(this, element, apiClient);
|
reloadData(this, element, apiClient);
|
||||||
var onUpdate = onActivityLogUpdate.bind(this);
|
const onUpdate = onActivityLogUpdate.bind(this);
|
||||||
this.updateFn = onUpdate;
|
this.updateFn = onUpdate;
|
||||||
events.on(serverNotifications, 'ActivityLogEntry', onUpdate);
|
events.on(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||||
apiClient.sendMessage('ActivityLogEntryStart', '0,1500');
|
apiClient.sendMessage('ActivityLogEntryStart', '0,1500');
|
||||||
}
|
}
|
||||||
|
destroy() {
|
||||||
ActivityLog.prototype.destroy = function () {
|
const options = this.options;
|
||||||
var options = this.options;
|
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
options.element.classList.remove('activityLogListWidget');
|
options.element.classList.remove('activityLogListWidget');
|
||||||
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
window.connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
||||||
}
|
}
|
||||||
|
|
||||||
var onUpdate = this.updateFn;
|
const onUpdate = this.updateFn;
|
||||||
|
|
||||||
if (onUpdate) {
|
if (onUpdate) {
|
||||||
events.off(serverNotifications, 'ActivityLogEntry', onUpdate);
|
events.off(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||||
|
@ -154,7 +163,9 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
|
|
||||||
this.items = null;
|
this.items = null;
|
||||||
this.options = null;
|
this.options = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ActivityLog;
|
export default ActivityLog;
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,14 +1,16 @@
|
||||||
define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import dialog from 'dialog';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function replaceAll(originalString, strReplace, strWith) {
|
function replaceAll(originalString, strReplace, strWith) {
|
||||||
var reg = new RegExp(strReplace, 'ig');
|
const reg = new RegExp(strReplace, 'ig');
|
||||||
return originalString.replace(reg, strWith);
|
return originalString.replace(reg, strWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (text, title) {
|
export default function (text, title) {
|
||||||
|
let options;
|
||||||
var options;
|
|
||||||
if (typeof text === 'string') {
|
if (typeof text === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -21,7 +23,7 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||||
if (browser.tv && window.alert) {
|
if (browser.tv && window.alert) {
|
||||||
alert(replaceAll(options.text || '', '<br/>', '\n'));
|
alert(replaceAll(options.text || '', '<br/>', '\n'));
|
||||||
} else {
|
} else {
|
||||||
var items = [];
|
const items = [];
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
name: globalize.translate('ButtonGotIt'),
|
name: globalize.translate('ButtonGotIt'),
|
||||||
|
@ -31,7 +33,7 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||||
|
|
||||||
options.buttons = items;
|
options.buttons = items;
|
||||||
|
|
||||||
return dialog(options).then(function (result) {
|
return dialog.show(options).then(function (result) {
|
||||||
if (result === 'ok') {
|
if (result === 'ok') {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
@ -41,5 +43,6 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,11 +1,22 @@
|
||||||
define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-button-light', 'material-icons'], function (focusManager, layoutManager, dom) {
|
/* eslint-disable indent */
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var selectedButtonClass = 'alphaPickerButton-selected';
|
/**
|
||||||
|
* Module alphaPicker.
|
||||||
|
* @module components/alphaPicker/alphaPicker
|
||||||
|
*/
|
||||||
|
|
||||||
|
import focusManager from 'focusManager';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import dom from 'dom';
|
||||||
|
import 'css!./style.css';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'material-icons';
|
||||||
|
|
||||||
|
const selectedButtonClass = 'alphaPickerButton-selected';
|
||||||
|
|
||||||
function focus() {
|
function focus() {
|
||||||
var scope = this;
|
const scope = this;
|
||||||
var selected = scope.querySelector('.' + selectedButtonClass);
|
const selected = scope.querySelector(`.${selectedButtonClass}`);
|
||||||
|
|
||||||
if (selected) {
|
if (selected) {
|
||||||
focusManager.focus(selected);
|
focusManager.focus(selected);
|
||||||
|
@ -15,8 +26,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAlphaPickerButtonClassName(vertical) {
|
function getAlphaPickerButtonClassName(vertical) {
|
||||||
|
let alphaPickerButtonClassName = 'alphaPickerButton';
|
||||||
var alphaPickerButtonClassName = 'alphaPickerButton';
|
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
alphaPickerButtonClassName += ' alphaPickerButton-tv';
|
alphaPickerButtonClassName += ' alphaPickerButton-tv';
|
||||||
|
@ -30,44 +40,42 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLetterButton(l, vertical) {
|
function getLetterButton(l, vertical) {
|
||||||
return '<button data-value="' + l + '" class="' + getAlphaPickerButtonClassName(vertical) + '">' + l + '</button>';
|
return `<button data-value="${l}" class="${getAlphaPickerButtonClassName(vertical)}">${l}</button>`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function mapLetters(letters, vertical) {
|
function mapLetters(letters, vertical) {
|
||||||
|
return letters.map(l => {
|
||||||
return letters.map(function (l) {
|
|
||||||
return getLetterButton(l, vertical);
|
return getLetterButton(l, vertical);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function render(element, options) {
|
function render(element, options) {
|
||||||
|
|
||||||
element.classList.add('alphaPicker');
|
element.classList.add('alphaPicker');
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
element.classList.add('alphaPicker-tv');
|
element.classList.add('alphaPicker-tv');
|
||||||
}
|
}
|
||||||
|
|
||||||
var vertical = element.classList.contains('alphaPicker-vertical');
|
const vertical = element.classList.contains('alphaPicker-vertical');
|
||||||
|
|
||||||
if (!vertical) {
|
if (!vertical) {
|
||||||
element.classList.add('focuscontainer-x');
|
element.classList.add('focuscontainer-x');
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
var letters;
|
let letters;
|
||||||
|
|
||||||
var alphaPickerButtonClassName = getAlphaPickerButtonClassName(vertical);
|
const alphaPickerButtonClassName = getAlphaPickerButtonClassName(vertical);
|
||||||
|
|
||||||
var rowClassName = 'alphaPickerRow';
|
let rowClassName = 'alphaPickerRow';
|
||||||
|
|
||||||
if (vertical) {
|
if (vertical) {
|
||||||
rowClassName += ' alphaPickerRow-vertical';
|
rowClassName += ' alphaPickerRow-vertical';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<div class="' + rowClassName + '">';
|
html += `<div class="${rowClassName}">`;
|
||||||
if (options.mode === 'keyboard') {
|
if (options.mode === 'keyboard') {
|
||||||
html += '<button data-value=" " is="paper-icon-button-light" class="' + alphaPickerButtonClassName + '"><span class="material-icons alphaPickerButtonIcon space_bar"></span></button>';
|
html += `<button data-value=" " is="paper-icon-button-light" class="${alphaPickerButtonClassName}"><span class="material-icons alphaPickerButtonIcon space_bar"></span></button>`;
|
||||||
} else {
|
} else {
|
||||||
letters = ['#'];
|
letters = ['#'];
|
||||||
html += mapLetters(letters, vertical).join('');
|
html += mapLetters(letters, vertical).join('');
|
||||||
|
@ -77,11 +85,11 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
html += mapLetters(letters, vertical).join('');
|
html += mapLetters(letters, vertical).join('');
|
||||||
|
|
||||||
if (options.mode === 'keyboard') {
|
if (options.mode === 'keyboard') {
|
||||||
html += '<button data-value="backspace" is="paper-icon-button-light" class="' + alphaPickerButtonClassName + '"><span class="material-icons alphaPickerButtonIcon backspace"></span></button>';
|
html += `<button data-value="backspace" is="paper-icon-button-light" class="${alphaPickerButtonClassName}"><span class="material-icons alphaPickerButtonIcon backspace"></span></button>`;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
letters = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
letters = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||||
html += '<div class="' + rowClassName + '">';
|
html += `<div class="${rowClassName}">`;
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
html += mapLetters(letters, vertical).join('');
|
html += mapLetters(letters, vertical).join('');
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
@ -95,74 +103,71 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
element.focus = focus;
|
element.focus = focus;
|
||||||
}
|
}
|
||||||
|
|
||||||
function AlphaPicker(options) {
|
export class AlphaPicker {
|
||||||
|
constructor(options) {
|
||||||
|
const self = this;
|
||||||
|
|
||||||
var self = this;
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
var element = options.element;
|
const element = options.element;
|
||||||
var itemsContainer = options.itemsContainer;
|
const itemsContainer = options.itemsContainer;
|
||||||
var itemClass = options.itemClass;
|
const itemClass = options.itemClass;
|
||||||
|
|
||||||
var itemFocusValue;
|
let itemFocusValue;
|
||||||
var itemFocusTimeout;
|
let itemFocusTimeout;
|
||||||
|
|
||||||
function onItemFocusTimeout() {
|
function onItemFocusTimeout() {
|
||||||
itemFocusTimeout = null;
|
itemFocusTimeout = null;
|
||||||
self.value(itemFocusValue);
|
self.value(itemFocusValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
var alphaFocusedElement;
|
let alphaFocusedElement;
|
||||||
var alphaFocusTimeout;
|
let alphaFocusTimeout;
|
||||||
|
|
||||||
function onAlphaFocusTimeout() {
|
function onAlphaFocusTimeout() {
|
||||||
|
|
||||||
alphaFocusTimeout = null;
|
alphaFocusTimeout = null;
|
||||||
|
|
||||||
if (document.activeElement === alphaFocusedElement) {
|
if (document.activeElement === alphaFocusedElement) {
|
||||||
var value = alphaFocusedElement.getAttribute('data-value');
|
const value = alphaFocusedElement.getAttribute('data-value');
|
||||||
self.value(value, true);
|
self.value(value, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAlphaPickerInKeyboardModeClick(e) {
|
function onAlphaPickerInKeyboardModeClick(e) {
|
||||||
|
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||||
var alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
|
||||||
|
|
||||||
if (alphaPickerButton) {
|
if (alphaPickerButton) {
|
||||||
var value = alphaPickerButton.getAttribute('data-value');
|
const value = alphaPickerButton.getAttribute('data-value');
|
||||||
|
|
||||||
element.dispatchEvent(new CustomEvent('alphavalueclicked', {
|
element.dispatchEvent(new CustomEvent('alphavalueclicked', {
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
detail: {
|
detail: {
|
||||||
value: value
|
value
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAlphaPickerClick(e) {
|
function onAlphaPickerClick(e) {
|
||||||
|
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||||
var alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
|
||||||
|
|
||||||
if (alphaPickerButton) {
|
if (alphaPickerButton) {
|
||||||
var value = alphaPickerButton.getAttribute('data-value');
|
const value = alphaPickerButton.getAttribute('data-value');
|
||||||
if ((this._currentValue || '').toUpperCase() === value.toUpperCase()) {
|
if ((this._currentValue || '').toUpperCase() === value.toUpperCase()) {
|
||||||
self.value(null, true);
|
this.value(null, true);
|
||||||
} else {
|
} else {
|
||||||
self.value(value, true);
|
this.value(value, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAlphaPickerFocusIn(e) {
|
function onAlphaPickerFocusIn(e) {
|
||||||
|
|
||||||
if (alphaFocusTimeout) {
|
if (alphaFocusTimeout) {
|
||||||
clearTimeout(alphaFocusTimeout);
|
clearTimeout(alphaFocusTimeout);
|
||||||
alphaFocusTimeout = null;
|
alphaFocusTimeout = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||||
|
|
||||||
if (alphaPickerButton) {
|
if (alphaPickerButton) {
|
||||||
alphaFocusedElement = alphaPickerButton;
|
alphaFocusedElement = alphaPickerButton;
|
||||||
|
@ -171,13 +176,11 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
}
|
}
|
||||||
|
|
||||||
function onItemsFocusIn(e) {
|
function onItemsFocusIn(e) {
|
||||||
|
const item = dom.parentWithClass(e.target, itemClass);
|
||||||
var item = dom.parentWithClass(e.target, itemClass);
|
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
var prefix = item.getAttribute('data-prefix');
|
const prefix = item.getAttribute('data-prefix');
|
||||||
if (prefix && prefix.length) {
|
if (prefix && prefix.length) {
|
||||||
|
|
||||||
itemFocusValue = prefix[0];
|
itemFocusValue = prefix[0];
|
||||||
if (itemFocusTimeout) {
|
if (itemFocusTimeout) {
|
||||||
clearTimeout(itemFocusTimeout);
|
clearTimeout(itemFocusTimeout);
|
||||||
|
@ -187,10 +190,8 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
self.enabled = function (enabled) {
|
this.enabled = function (enabled) {
|
||||||
|
|
||||||
if (enabled) {
|
if (enabled) {
|
||||||
|
|
||||||
if (itemsContainer) {
|
if (itemsContainer) {
|
||||||
itemsContainer.addEventListener('focus', onItemsFocusIn, true);
|
itemsContainer.addEventListener('focus', onItemsFocusIn, true);
|
||||||
}
|
}
|
||||||
|
@ -204,9 +205,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
} else {
|
} else {
|
||||||
element.addEventListener('click', onAlphaPickerClick.bind(this));
|
element.addEventListener('click', onAlphaPickerClick.bind(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (itemsContainer) {
|
if (itemsContainer) {
|
||||||
itemsContainer.removeEventListener('focus', onItemsFocusIn, true);
|
itemsContainer.removeEventListener('focus', onItemsFocusIn, true);
|
||||||
}
|
}
|
||||||
|
@ -223,25 +222,23 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
this.visible(true);
|
this.visible(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
AlphaPicker.prototype.value = function (value, applyValue) {
|
value(value, applyValue) {
|
||||||
|
const element = this.options.element;
|
||||||
var element = this.options.element;
|
let btn;
|
||||||
var btn;
|
let selected;
|
||||||
var selected;
|
|
||||||
|
|
||||||
if (value !== undefined) {
|
if (value !== undefined) {
|
||||||
if (value != null) {
|
if (value != null) {
|
||||||
|
|
||||||
value = value.toUpperCase();
|
value = value.toUpperCase();
|
||||||
this._currentValue = value;
|
this._currentValue = value;
|
||||||
|
|
||||||
if (this.options.mode !== 'keyboard') {
|
if (this.options.mode !== 'keyboard') {
|
||||||
selected = element.querySelector('.' + selectedButtonClass);
|
selected = element.querySelector(`.${selectedButtonClass}`);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
btn = element.querySelector('.alphaPickerButton[data-value=\'' + value + '\']');
|
btn = element.querySelector(`.alphaPickerButton[data-value='${value}']`);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error('error in querySelector: ' + err);
|
console.error('error in querySelector:', err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btn && btn !== selected) {
|
if (btn && btn !== selected) {
|
||||||
|
@ -254,7 +251,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
} else {
|
} else {
|
||||||
this._currentValue = value;
|
this._currentValue = value;
|
||||||
|
|
||||||
selected = element.querySelector('.' + selectedButtonClass);
|
selected = element.querySelector(`.${selectedButtonClass}`);
|
||||||
if (selected) {
|
if (selected) {
|
||||||
selected.classList.remove(selectedButtonClass);
|
selected.classList.remove(selectedButtonClass);
|
||||||
}
|
}
|
||||||
|
@ -265,57 +262,52 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
element.dispatchEvent(new CustomEvent('alphavaluechanged', {
|
element.dispatchEvent(new CustomEvent('alphavaluechanged', {
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
detail: {
|
detail: {
|
||||||
value: value
|
value
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
return this._currentValue;
|
return this._currentValue;
|
||||||
};
|
}
|
||||||
|
|
||||||
AlphaPicker.prototype.on = function (name, fn) {
|
on(name, fn) {
|
||||||
var element = this.options.element;
|
const element = this.options.element;
|
||||||
element.addEventListener(name, fn);
|
element.addEventListener(name, fn);
|
||||||
};
|
}
|
||||||
|
|
||||||
AlphaPicker.prototype.off = function (name, fn) {
|
off(name, fn) {
|
||||||
var element = this.options.element;
|
const element = this.options.element;
|
||||||
element.removeEventListener(name, fn);
|
element.removeEventListener(name, fn);
|
||||||
};
|
}
|
||||||
|
|
||||||
AlphaPicker.prototype.visible = function (visible) {
|
visible(visible) {
|
||||||
|
const element = this.options.element;
|
||||||
var element = this.options.element;
|
|
||||||
element.style.visibility = visible ? 'visible' : 'hidden';
|
element.style.visibility = visible ? 'visible' : 'hidden';
|
||||||
};
|
}
|
||||||
|
|
||||||
AlphaPicker.prototype.values = function () {
|
|
||||||
|
|
||||||
var element = this.options.element;
|
|
||||||
var elems = element.querySelectorAll('.alphaPickerButton');
|
|
||||||
var values = [];
|
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
|
||||||
|
|
||||||
|
values() {
|
||||||
|
const element = this.options.element;
|
||||||
|
const elems = element.querySelectorAll('.alphaPickerButton');
|
||||||
|
const values = [];
|
||||||
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
values.push(elems[i].getAttribute('data-value'));
|
values.push(elems[i].getAttribute('data-value'));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return values;
|
return values;
|
||||||
};
|
}
|
||||||
|
|
||||||
AlphaPicker.prototype.focus = function () {
|
focus() {
|
||||||
|
const element = this.options.element;
|
||||||
var element = this.options.element;
|
|
||||||
focusManager.autoFocus(element, true);
|
focusManager.autoFocus(element, true);
|
||||||
};
|
}
|
||||||
|
|
||||||
AlphaPicker.prototype.destroy = function () {
|
destroy() {
|
||||||
|
const element = this.options.element;
|
||||||
var element = this.options.element;
|
|
||||||
this.enabled(false);
|
this.enabled(false);
|
||||||
element.classList.remove('focuscontainer-x');
|
element.classList.remove('focuscontainer-x');
|
||||||
this.options = null;
|
this.options = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return AlphaPicker;
|
/* eslint-enable indent */
|
||||||
});
|
export default AlphaPicker;
|
||||||
|
|
|
@ -1,8 +1,7 @@
|
||||||
define(['browser', 'css!./appFooter'], function (browser) {
|
import 'css!./appFooter';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function render(options) {
|
function render(options) {
|
||||||
var elem = document.createElement('div');
|
const elem = document.createElement('div');
|
||||||
elem.classList.add('appfooter');
|
elem.classList.add('appfooter');
|
||||||
|
|
||||||
document.body.appendChild(elem);
|
document.body.appendChild(elem);
|
||||||
|
@ -10,8 +9,9 @@ define(['browser', 'css!./appFooter'], function (browser) {
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
function appFooter(options) {
|
class appFooter {
|
||||||
var self = this;
|
constructor(options) {
|
||||||
|
const self = this;
|
||||||
|
|
||||||
self.element = render(options);
|
self.element = render(options);
|
||||||
self.add = function (elem) {
|
self.add = function (elem) {
|
||||||
|
@ -26,12 +26,11 @@ define(['browser', 'css!./appFooter'], function (browser) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
destroy() {
|
||||||
appFooter.prototype.destroy = function () {
|
const self = this;
|
||||||
var self = this;
|
|
||||||
|
|
||||||
self.element = null;
|
self.element = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return appFooter;
|
export default appFooter;
|
||||||
});
|
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'globalize'], function (appSettings, browser, events, htmlMediaHelper, webSettings, globalize) {
|
import appSettings from 'appSettings';
|
||||||
'use strict';
|
import browser from 'browser';
|
||||||
|
import events from 'events';
|
||||||
|
import * as htmlMediaHelper from 'htmlMediaHelper';
|
||||||
|
import * as webSettings from 'webSettings';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
function getBaseProfileOptions(item) {
|
function getBaseProfileOptions(item) {
|
||||||
var disableHlsVideoAudioCodecs = [];
|
const disableHlsVideoAudioCodecs = [];
|
||||||
|
|
||||||
if (item && htmlMediaHelper.enableHlsJsPlayer(item.RunTimeTicks, item.MediaType)) {
|
if (item && htmlMediaHelper.enableHlsJsPlayer(item.RunTimeTicks, item.MediaType)) {
|
||||||
if (browser.edge) {
|
if (browser.edge) {
|
||||||
|
@ -20,34 +24,16 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDeviceProfileForWindowsUwp(item) {
|
function getDeviceProfile(item, options = {}) {
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
require(['browserdeviceprofile', 'environments/windows-uwp/mediacaps'], function (profileBuilder, uwpMediaCaps) {
|
|
||||||
var profileOptions = getBaseProfileOptions(item);
|
|
||||||
profileOptions.supportsDts = uwpMediaCaps.supportsDTS();
|
|
||||||
profileOptions.supportsTrueHd = uwpMediaCaps.supportsDolby();
|
|
||||||
profileOptions.audioChannels = uwpMediaCaps.getAudioChannels();
|
|
||||||
resolve(profileBuilder(profileOptions));
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDeviceProfile(item, options) {
|
|
||||||
options = options || {};
|
|
||||||
|
|
||||||
if (self.Windows) {
|
|
||||||
return getDeviceProfileForWindowsUwp(item);
|
|
||||||
}
|
|
||||||
|
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
require(['browserdeviceprofile'], function (profileBuilder) {
|
import('browserdeviceprofile').then(({default: profileBuilder}) => {
|
||||||
var profile;
|
let profile;
|
||||||
|
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell) {
|
||||||
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
|
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
|
||||||
} else {
|
} else {
|
||||||
var builderOpts = getBaseProfileOptions(item);
|
const builderOpts = getBaseProfileOptions(item);
|
||||||
builderOpts.enableSsaRender = (item && !options.isRetry && 'allcomplexformats' !== appSettings.get('subtitleburnin'));
|
builderOpts.enableSsaRender = (item && !options.isRetry && appSettings.get('subtitleburnin') !== 'allcomplexformats');
|
||||||
profile = profileBuilder(builderOpts);
|
profile = profileBuilder(builderOpts);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -57,20 +43,20 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
}
|
}
|
||||||
|
|
||||||
function escapeRegExp(str) {
|
function escapeRegExp(str) {
|
||||||
return str.replace(/([.*+?^=!:${}()|\[\]\/\\])/g, '\\$1');
|
return str.replace(/([.*+?^=!:${}()|[\]/\\])/g, '\\$1');
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceAll(originalString, strReplace, strWith) {
|
function replaceAll(originalString, strReplace, strWith) {
|
||||||
var strReplace2 = escapeRegExp(strReplace);
|
const strReplace2 = escapeRegExp(strReplace);
|
||||||
var reg = new RegExp(strReplace2, 'ig');
|
const reg = new RegExp(strReplace2, 'ig');
|
||||||
return originalString.replace(reg, strWith);
|
return originalString.replace(reg, strWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
function generateDeviceId() {
|
function generateDeviceId() {
|
||||||
var keys = [];
|
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) {
|
||||||
var result = replaceAll(btoa(keys.join('|')), '=', '1');
|
const result = replaceAll(btoa(keys.join('|')), '=', '1');
|
||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,8 +64,8 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDeviceId() {
|
function getDeviceId() {
|
||||||
var key = '_deviceId2';
|
const key = '_deviceId2';
|
||||||
var deviceId = appSettings.get(key);
|
const deviceId = appSettings.get(key);
|
||||||
|
|
||||||
if (deviceId) {
|
if (deviceId) {
|
||||||
return Promise.resolve(deviceId);
|
return Promise.resolve(deviceId);
|
||||||
|
@ -92,7 +78,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDeviceName() {
|
function getDeviceName() {
|
||||||
var deviceName;
|
let deviceName;
|
||||||
if (browser.tizen) {
|
if (browser.tizen) {
|
||||||
deviceName = 'Samsung Smart TV';
|
deviceName = 'Samsung Smart TV';
|
||||||
} else if (browser.web0s) {
|
} else if (browser.web0s) {
|
||||||
|
@ -105,6 +91,8 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
deviceName = 'Sony PS4';
|
deviceName = 'Sony PS4';
|
||||||
} else if (browser.chrome) {
|
} else if (browser.chrome) {
|
||||||
deviceName = 'Chrome';
|
deviceName = 'Chrome';
|
||||||
|
} else if (browser.edgeChromium) {
|
||||||
|
deviceName = 'Edge Chromium';
|
||||||
} else if (browser.edge) {
|
} else if (browser.edge) {
|
||||||
deviceName = 'Edge';
|
deviceName = 'Edge';
|
||||||
} else if (browser.firefox) {
|
} else if (browser.firefox) {
|
||||||
|
@ -141,27 +129,10 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var element = document.documentElement;
|
const element = document.documentElement;
|
||||||
return (element.requestFullscreen || element.mozRequestFullScreen || element.webkitRequestFullscreen || element.msRequestFullscreen) || document.createElement('video').webkitEnterFullscreen;
|
return (element.requestFullscreen || element.mozRequestFullScreen || element.webkitRequestFullscreen || element.msRequestFullscreen) || document.createElement('video').webkitEnterFullscreen;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSyncProfile() {
|
|
||||||
return new Promise(function (resolve) {
|
|
||||||
require(['browserdeviceprofile', 'appSettings'], function (profileBuilder, appSettings) {
|
|
||||||
var profile;
|
|
||||||
|
|
||||||
if (window.NativeShell) {
|
|
||||||
profile = window.NativeShell.AppHost.getSyncProfile(profileBuilder, appSettings);
|
|
||||||
} else {
|
|
||||||
profile = profileBuilder();
|
|
||||||
profile.MaxStaticMusicBitrate = appSettings.maxStaticMusicBitrate();
|
|
||||||
}
|
|
||||||
|
|
||||||
resolve(profile);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getDefaultLayout() {
|
function getDefaultLayout() {
|
||||||
return 'desktop';
|
return 'desktop';
|
||||||
}
|
}
|
||||||
|
@ -180,14 +151,14 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
|
|
||||||
function supportsCue() {
|
function supportsCue() {
|
||||||
try {
|
try {
|
||||||
var video = document.createElement('video');
|
const video = document.createElement('video');
|
||||||
var style = document.createElement('style');
|
const style = document.createElement('style');
|
||||||
|
|
||||||
style.textContent = 'video::cue {background: inherit}';
|
style.textContent = 'video::cue {background: inherit}';
|
||||||
document.body.appendChild(style);
|
document.body.appendChild(style);
|
||||||
document.body.appendChild(video);
|
document.body.appendChild(video);
|
||||||
|
|
||||||
var cue = window.getComputedStyle(video, '::cue').background;
|
const cue = window.getComputedStyle(video, '::cue').background;
|
||||||
document.body.removeChild(style);
|
document.body.removeChild(style);
|
||||||
document.body.removeChild(video);
|
document.body.removeChild(video);
|
||||||
|
|
||||||
|
@ -201,7 +172,6 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
function onAppVisible() {
|
function onAppVisible() {
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
isHidden = false;
|
isHidden = false;
|
||||||
console.debug('triggering app resume event');
|
|
||||||
events.trigger(appHost, 'resume');
|
events.trigger(appHost, 'resume');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -209,12 +179,11 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
function onAppHidden() {
|
function onAppHidden() {
|
||||||
if (!isHidden) {
|
if (!isHidden) {
|
||||||
isHidden = true;
|
isHidden = true;
|
||||||
console.debug('app is hidden');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportedFeatures = function () {
|
const supportedFeatures = function () {
|
||||||
var features = [];
|
const features = [];
|
||||||
|
|
||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
features.push('sharing');
|
features.push('sharing');
|
||||||
|
@ -257,12 +226,6 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
features.push('fullscreenchange');
|
features.push('fullscreenchange');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.chrome || browser.edge && !browser.slow) {
|
|
||||||
if (!browser.noAnimation && !browser.edgeUwp && !browser.xboxOne) {
|
|
||||||
features.push('imageanalysis');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) {
|
if (browser.tv || browser.xboxOne || browser.ps4 || browser.mobile) {
|
||||||
features.push('physicalvolumecontrol');
|
features.push('physicalvolumecontrol');
|
||||||
}
|
}
|
||||||
|
@ -281,7 +244,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
features.push('targetblank');
|
features.push('targetblank');
|
||||||
features.push('screensaver');
|
features.push('screensaver');
|
||||||
|
|
||||||
webSettings.enableMultiServer().then(enabled => {
|
webSettings.getMultiServer().then(enabled => {
|
||||||
if (enabled) features.push('multiserver');
|
if (enabled) features.push('multiserver');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -297,7 +260,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
features.push('fileinput');
|
features.push('fileinput');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.chrome) {
|
if (browser.chrome || browser.edgeChromium) {
|
||||||
features.push('chromecast');
|
features.push('chromecast');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -323,7 +286,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var exitPromise;
|
let exitPromise;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Ask user for exit
|
* Ask user for exit
|
||||||
|
@ -333,7 +296,7 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require(['actionsheet'], function (actionsheet) {
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
exitPromise = actionsheet.show({
|
exitPromise = actionsheet.show({
|
||||||
title: globalize.translate('MessageConfirmAppExit'),
|
title: globalize.translate('MessageConfirmAppExit'),
|
||||||
items: [
|
items: [
|
||||||
|
@ -350,16 +313,16 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var deviceId;
|
let deviceId;
|
||||||
var deviceName;
|
let deviceName;
|
||||||
var appName = 'Jellyfin Web';
|
const appName = 'Jellyfin Web';
|
||||||
var appVersion = '10.6.0';
|
const appVersion = '10.7.0';
|
||||||
|
|
||||||
var appHost = {
|
const appHost = {
|
||||||
getWindowState: function () {
|
getWindowState: function () {
|
||||||
return document.windowState || 'Normal';
|
return document.windowState || 'Normal';
|
||||||
},
|
},
|
||||||
setWindowState: function (state) {
|
setWindowState: function () {
|
||||||
alert('setWindowState is not supported and should not be called');
|
alert('setWindowState is not supported and should not be called');
|
||||||
},
|
},
|
||||||
exit: function () {
|
exit: function () {
|
||||||
|
@ -374,10 +337,9 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
return window.NativeShell.AppHost.supports(command);
|
return window.NativeShell.AppHost.supports(command);
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1 !== supportedFeatures.indexOf(command.toLowerCase());
|
return supportedFeatures.indexOf(command.toLowerCase()) !== -1;
|
||||||
},
|
},
|
||||||
preferVisualCards: browser.android || browser.chrome,
|
preferVisualCards: browser.android || browser.chrome,
|
||||||
getSyncProfile: getSyncProfile,
|
|
||||||
getDefaultLayout: function () {
|
getDefaultLayout: function () {
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell) {
|
||||||
return window.NativeShell.AppHost.getDefaultLayout();
|
return window.NativeShell.AppHost.getDefaultLayout();
|
||||||
|
@ -411,24 +373,17 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
getPushTokenInfo: function () {
|
getPushTokenInfo: function () {
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
setThemeColor: function (color) {
|
|
||||||
var metaThemeColor = document.querySelector('meta[name=theme-color]');
|
|
||||||
|
|
||||||
if (metaThemeColor) {
|
|
||||||
metaThemeColor.setAttribute('content', color);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
setUserScalable: function (scalable) {
|
setUserScalable: function (scalable) {
|
||||||
if (!browser.tv) {
|
if (!browser.tv) {
|
||||||
var att = scalable ? 'width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes' : 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no';
|
const att = scalable ? 'width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes' : 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no';
|
||||||
document.querySelector('meta[name=viewport]').setAttribute('content', att);
|
document.querySelector('meta[name=viewport]').setAttribute('content', att);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var isHidden = false;
|
let isHidden = false;
|
||||||
var hidden;
|
let hidden;
|
||||||
var visibilityChange;
|
let visibilityChange;
|
||||||
|
|
||||||
if (typeof document.hidden !== 'undefined') { /* eslint-disable-line compat/compat */
|
if (typeof document.hidden !== 'undefined') { /* eslint-disable-line compat/compat */
|
||||||
hidden = 'hidden';
|
hidden = 'hidden';
|
||||||
|
@ -447,10 +402,9 @@ define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'g
|
||||||
}
|
}
|
||||||
}, false);
|
}, false);
|
||||||
|
|
||||||
if (self.addEventListener) {
|
if (window.addEventListener) {
|
||||||
self.addEventListener('focus', onAppVisible);
|
window.addEventListener('focus', onAppVisible);
|
||||||
self.addEventListener('blur', onAppHidden);
|
window.addEventListener('blur', onAppHidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
return appHost;
|
export default appHost;
|
||||||
});
|
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings', 'css!./backdrop'], function (browser, connectionManager, playbackManager, dom, userSettings) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import playbackManager from 'playbackManager';
|
||||||
|
import dom from 'dom';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import 'css!./backdrop';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function enableAnimation(elem) {
|
function enableAnimation(elem) {
|
||||||
if (browser.slow) {
|
if (browser.slow) {
|
||||||
|
@ -22,22 +27,20 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function Backdrop() {
|
class Backdrop {
|
||||||
}
|
load(url, parent, existingBackdropImage) {
|
||||||
|
const img = new Image();
|
||||||
|
const self = this;
|
||||||
|
|
||||||
Backdrop.prototype.load = function (url, parent, existingBackdropImage) {
|
img.onload = () => {
|
||||||
var img = new Image();
|
|
||||||
var self = this;
|
|
||||||
|
|
||||||
img.onload = function () {
|
|
||||||
if (self.isDestroyed) {
|
if (self.isDestroyed) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var backdropImage = document.createElement('div');
|
const backdropImage = document.createElement('div');
|
||||||
backdropImage.classList.add('backdropImage');
|
backdropImage.classList.add('backdropImage');
|
||||||
backdropImage.classList.add('displayingBackdropImage');
|
backdropImage.classList.add('displayingBackdropImage');
|
||||||
backdropImage.style.backgroundImage = "url('" + url + "')";
|
backdropImage.style.backgroundImage = `url('${url}')`;
|
||||||
backdropImage.setAttribute('data-url', url);
|
backdropImage.setAttribute('data-url', url);
|
||||||
|
|
||||||
backdropImage.classList.add('backdropImageFadeIn');
|
backdropImage.classList.add('backdropImageFadeIn');
|
||||||
|
@ -51,7 +54,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var onAnimationComplete = function () {
|
const onAnimationComplete = () => {
|
||||||
dom.removeEventListener(backdropImage, dom.whichAnimationEvent(), onAnimationComplete, {
|
dom.removeEventListener(backdropImage, dom.whichAnimationEvent(), onAnimationComplete, {
|
||||||
once: true
|
once: true
|
||||||
});
|
});
|
||||||
|
@ -71,22 +74,23 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
};
|
};
|
||||||
|
|
||||||
img.src = url;
|
img.src = url;
|
||||||
};
|
}
|
||||||
|
|
||||||
Backdrop.prototype.cancelAnimation = function () {
|
cancelAnimation() {
|
||||||
var elem = this.currentAnimatingElement;
|
const elem = this.currentAnimatingElement;
|
||||||
if (elem) {
|
if (elem) {
|
||||||
elem.classList.remove('backdropImageFadeIn');
|
elem.classList.remove('backdropImageFadeIn');
|
||||||
this.currentAnimatingElement = null;
|
this.currentAnimatingElement = null;
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
Backdrop.prototype.destroy = function () {
|
destroy() {
|
||||||
this.isDestroyed = true;
|
this.isDestroyed = true;
|
||||||
this.cancelAnimation();
|
this.cancelAnimation();
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var backdropContainer;
|
let backdropContainer;
|
||||||
function getBackdropContainer() {
|
function getBackdropContainer() {
|
||||||
if (!backdropContainer) {
|
if (!backdropContainer) {
|
||||||
backdropContainer = document.querySelector('.backdropContainer');
|
backdropContainer = document.querySelector('.backdropContainer');
|
||||||
|
@ -101,7 +105,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
return backdropContainer;
|
return backdropContainer;
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearBackdrop(clearAll) {
|
export function clearBackdrop(clearAll) {
|
||||||
clearRotation();
|
clearRotation();
|
||||||
|
|
||||||
if (currentLoadingBackdrop) {
|
if (currentLoadingBackdrop) {
|
||||||
|
@ -109,7 +113,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
currentLoadingBackdrop = null;
|
currentLoadingBackdrop = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var elem = getBackdropContainer();
|
const elem = getBackdropContainer();
|
||||||
elem.innerHTML = '';
|
elem.innerHTML = '';
|
||||||
|
|
||||||
if (clearAll) {
|
if (clearAll) {
|
||||||
|
@ -119,7 +123,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
internalBackdrop(false);
|
internalBackdrop(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
var backgroundContainer;
|
let backgroundContainer;
|
||||||
function getBackgroundContainer() {
|
function getBackgroundContainer() {
|
||||||
if (!backgroundContainer) {
|
if (!backgroundContainer) {
|
||||||
backgroundContainer = document.querySelector('.backgroundContainer');
|
backgroundContainer = document.querySelector('.backgroundContainer');
|
||||||
|
@ -135,31 +139,27 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasInternalBackdrop;
|
let hasInternalBackdrop;
|
||||||
function internalBackdrop(enabled) {
|
function internalBackdrop(enabled) {
|
||||||
hasInternalBackdrop = enabled;
|
hasInternalBackdrop = enabled;
|
||||||
setBackgroundContainerBackgroundEnabled();
|
setBackgroundContainerBackgroundEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasExternalBackdrop;
|
let hasExternalBackdrop;
|
||||||
function externalBackdrop(enabled) {
|
export function externalBackdrop(enabled) {
|
||||||
hasExternalBackdrop = enabled;
|
hasExternalBackdrop = enabled;
|
||||||
setBackgroundContainerBackgroundEnabled();
|
setBackgroundContainerBackgroundEnabled();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRandom(min, max) {
|
let currentLoadingBackdrop;
|
||||||
return Math.floor(Math.random() * (max - min) + min);
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentLoadingBackdrop;
|
|
||||||
function setBackdropImage(url) {
|
function setBackdropImage(url) {
|
||||||
if (currentLoadingBackdrop) {
|
if (currentLoadingBackdrop) {
|
||||||
currentLoadingBackdrop.destroy();
|
currentLoadingBackdrop.destroy();
|
||||||
currentLoadingBackdrop = null;
|
currentLoadingBackdrop = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var elem = getBackdropContainer();
|
const elem = getBackdropContainer();
|
||||||
var existingBackdropImage = elem.querySelector('.displayingBackdropImage');
|
const existingBackdropImage = elem.querySelector('.displayingBackdropImage');
|
||||||
|
|
||||||
if (existingBackdropImage && existingBackdropImage.getAttribute('data-url') === url) {
|
if (existingBackdropImage && existingBackdropImage.getAttribute('data-url') === url) {
|
||||||
if (existingBackdropImage.getAttribute('data-url') === url) {
|
if (existingBackdropImage.getAttribute('data-url') === url) {
|
||||||
|
@ -168,7 +168,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
existingBackdropImage.classList.remove('displayingBackdropImage');
|
existingBackdropImage.classList.remove('displayingBackdropImage');
|
||||||
}
|
}
|
||||||
|
|
||||||
var instance = new Backdrop();
|
const instance = new Backdrop();
|
||||||
instance.load(url, elem, existingBackdropImage);
|
instance.load(url, elem, existingBackdropImage);
|
||||||
currentLoadingBackdrop = instance;
|
currentLoadingBackdrop = instance;
|
||||||
}
|
}
|
||||||
|
@ -176,9 +176,9 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
function getItemImageUrls(item, imageOptions) {
|
function getItemImageUrls(item, imageOptions) {
|
||||||
imageOptions = imageOptions || {};
|
imageOptions = imageOptions || {};
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
if (item.BackdropImageTags && item.BackdropImageTags.length > 0) {
|
if (item.BackdropImageTags && item.BackdropImageTags.length > 0) {
|
||||||
return item.BackdropImageTags.map(function (imgTag, index) {
|
return item.BackdropImageTags.map((imgTag, index) => {
|
||||||
return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, {
|
return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, {
|
||||||
type: 'Backdrop',
|
type: 'Backdrop',
|
||||||
tag: imgTag,
|
tag: imgTag,
|
||||||
|
@ -189,7 +189,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
|
if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
|
||||||
return item.ParentBackdropImageTags.map(function (imgTag, index) {
|
return item.ParentBackdropImageTags.map((imgTag, index) => {
|
||||||
return apiClient.getScaledImageUrl(item.ParentBackdropItemId, Object.assign(imageOptions, {
|
return apiClient.getScaledImageUrl(item.ParentBackdropItemId, Object.assign(imageOptions, {
|
||||||
type: 'Backdrop',
|
type: 'Backdrop',
|
||||||
tag: imgTag,
|
tag: imgTag,
|
||||||
|
@ -203,13 +203,13 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImageUrls(items, imageOptions) {
|
function getImageUrls(items, imageOptions) {
|
||||||
var list = [];
|
const list = [];
|
||||||
var onImg = function (img) {
|
const onImg = img => {
|
||||||
list.push(img);
|
list.push(img);
|
||||||
};
|
};
|
||||||
|
|
||||||
for (var i = 0, length = items.length; i < length; i++) {
|
for (let i = 0, length = items.length; i < length; i++) {
|
||||||
var itemImages = getItemImageUrls(items[i], imageOptions);
|
const itemImages = getItemImageUrls(items[i], imageOptions);
|
||||||
itemImages.forEach(onImg);
|
itemImages.forEach(onImg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
|
|
||||||
// If you don't care about the order of the elements inside
|
// If you don't care about the order of the elements inside
|
||||||
// the array, you should sort both arrays here.
|
// the array, you should sort both arrays here.
|
||||||
for (var i = 0; i < a.length; ++i) {
|
for (let i = 0; i < a.length; ++i) {
|
||||||
if (a[i] !== b[i]) {
|
if (a[i] !== b[i]) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -242,12 +242,12 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
return userSettings.enableBackdrops();
|
return userSettings.enableBackdrops();
|
||||||
}
|
}
|
||||||
|
|
||||||
var rotationInterval;
|
let rotationInterval;
|
||||||
var currentRotatingImages = [];
|
let currentRotatingImages = [];
|
||||||
var currentRotationIndex = -1;
|
let currentRotationIndex = -1;
|
||||||
function setBackdrops(items, imageOptions, enableImageRotation) {
|
export function setBackdrops(items, imageOptions, enableImageRotation) {
|
||||||
if (enabled()) {
|
if (enabled()) {
|
||||||
var images = getImageUrls(items, imageOptions);
|
const images = getImageUrls(items, imageOptions);
|
||||||
|
|
||||||
if (images.length) {
|
if (images.length) {
|
||||||
startRotation(images, enableImageRotation);
|
startRotation(images, enableImageRotation);
|
||||||
|
@ -279,7 +279,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newIndex = currentRotationIndex + 1;
|
let newIndex = currentRotationIndex + 1;
|
||||||
if (newIndex >= currentRotatingImages.length) {
|
if (newIndex >= currentRotatingImages.length) {
|
||||||
newIndex = 0;
|
newIndex = 0;
|
||||||
}
|
}
|
||||||
|
@ -289,7 +289,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
}
|
}
|
||||||
|
|
||||||
function clearRotation() {
|
function clearRotation() {
|
||||||
var interval = rotationInterval;
|
const interval = rotationInterval;
|
||||||
if (interval) {
|
if (interval) {
|
||||||
clearInterval(interval);
|
clearInterval(interval);
|
||||||
}
|
}
|
||||||
|
@ -299,7 +299,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
currentRotationIndex = -1;
|
currentRotationIndex = -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBackdrop(url, imageOptions) {
|
export function setBackdrop(url, imageOptions) {
|
||||||
if (url && typeof url !== 'string') {
|
if (url && typeof url !== 'string') {
|
||||||
url = getImageUrls([url], imageOptions)[0];
|
url = getImageUrls([url], imageOptions)[0];
|
||||||
}
|
}
|
||||||
|
@ -312,10 +312,11 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
/* eslint-enable indent */
|
||||||
|
|
||||||
|
export default {
|
||||||
setBackdrops: setBackdrops,
|
setBackdrops: setBackdrops,
|
||||||
setBackdrop: setBackdrop,
|
setBackdrop: setBackdrop,
|
||||||
clear: clearBackdrop,
|
clearBackdrop: clearBackdrop,
|
||||||
externalBackdrop: externalBackdrop
|
externalBackdrop: externalBackdrop
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
|
@ -209,6 +209,10 @@ button::-moz-focus-inner {
|
||||||
contain: strict;
|
contain: strict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.defaultCardBackground {
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.cardContent:not(.defaultCardBackground) {
|
.cardContent:not(.defaultCardBackground) {
|
||||||
background-color: transparent;
|
background-color: transparent;
|
||||||
}
|
}
|
||||||
|
@ -239,33 +243,13 @@ button::-moz-focus-inner {
|
||||||
border: none;
|
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 {
|
.coveredImage {
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-position: center center;
|
background-position: center center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.coveredImage-noScale {
|
.coveredImage.coveredImage-contain {
|
||||||
background-size: cover;
|
background-size: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cardFooter {
|
.cardFooter {
|
||||||
|
@ -372,6 +356,8 @@ button::-moz-focus-inner {
|
||||||
.cardDefaultText {
|
.cardDefaultText {
|
||||||
white-space: normal;
|
white-space: normal;
|
||||||
text-align: center;
|
text-align: center;
|
||||||
|
font-size: 2em;
|
||||||
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cardImageContainer .cardImageIcon {
|
.cardImageContainer .cardImageIcon {
|
||||||
|
|
|
@ -7,7 +7,6 @@
|
||||||
|
|
||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
import imageLoader from 'imageLoader';
|
import imageLoader from 'imageLoader';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import itemHelper from 'itemHelper';
|
import itemHelper from 'itemHelper';
|
||||||
import focusManager from 'focusManager';
|
import focusManager from 'focusManager';
|
||||||
import indicators from 'indicators';
|
import indicators from 'indicators';
|
||||||
|
@ -277,7 +276,7 @@ import 'programStyles';
|
||||||
*/
|
*/
|
||||||
function getImageWidth(shape, screenWidth, isOrientationLandscape) {
|
function getImageWidth(shape, screenWidth, isOrientationLandscape) {
|
||||||
const imagesPerRow = getPostersPerRow(shape, screenWidth, isOrientationLandscape);
|
const imagesPerRow = getPostersPerRow(shape, screenWidth, isOrientationLandscape);
|
||||||
return Math.round(screenWidth / imagesPerRow) * 2;
|
return Math.round(screenWidth / imagesPerRow);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -291,12 +290,10 @@ import 'programStyles';
|
||||||
const primaryImageAspectRatio = imageLoader.getPrimaryImageAspectRatio(items);
|
const primaryImageAspectRatio = imageLoader.getPrimaryImageAspectRatio(items);
|
||||||
|
|
||||||
if (['auto', 'autohome', 'autooverflow', 'autoVertical'].includes(options.shape)) {
|
if (['auto', 'autohome', 'autooverflow', 'autoVertical'].includes(options.shape)) {
|
||||||
|
|
||||||
const requestedShape = options.shape;
|
const requestedShape = options.shape;
|
||||||
options.shape = null;
|
options.shape = null;
|
||||||
|
|
||||||
if (primaryImageAspectRatio) {
|
if (primaryImageAspectRatio) {
|
||||||
|
|
||||||
if (primaryImageAspectRatio >= 3) {
|
if (primaryImageAspectRatio >= 3) {
|
||||||
options.shape = 'banner';
|
options.shape = 'banner';
|
||||||
options.coverImage = true;
|
options.coverImage = true;
|
||||||
|
@ -364,16 +361,16 @@ import 'programStyles';
|
||||||
let hasOpenRow;
|
let hasOpenRow;
|
||||||
let hasOpenSection;
|
let hasOpenSection;
|
||||||
|
|
||||||
let sectionTitleTagName = options.sectionTitleTagName || 'div';
|
const sectionTitleTagName = options.sectionTitleTagName || 'div';
|
||||||
let apiClient;
|
let apiClient;
|
||||||
let lastServerId;
|
let lastServerId;
|
||||||
|
|
||||||
for (const [i, item] of items.entries()) {
|
for (const [i, item] of items.entries()) {
|
||||||
let serverId = item.ServerId || options.serverId;
|
const serverId = item.ServerId || options.serverId;
|
||||||
|
|
||||||
if (serverId !== lastServerId) {
|
if (serverId !== lastServerId) {
|
||||||
lastServerId = serverId;
|
lastServerId = serverId;
|
||||||
apiClient = connectionManager.getApiClient(lastServerId);
|
apiClient = window.connectionManager.getApiClient(lastServerId);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.indexBy) {
|
if (options.indexBy) {
|
||||||
|
@ -394,7 +391,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newIndexValue !== currentIndexValue) {
|
if (newIndexValue !== currentIndexValue) {
|
||||||
|
|
||||||
if (hasOpenRow) {
|
if (hasOpenRow) {
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
hasOpenRow = false;
|
hasOpenRow = false;
|
||||||
|
@ -402,7 +398,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (hasOpenSection) {
|
if (hasOpenSection) {
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (isVertical) {
|
if (isVertical) {
|
||||||
|
@ -426,7 +421,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.rows && itemsInRow === 0) {
|
if (options.rows && itemsInRow === 0) {
|
||||||
|
|
||||||
if (hasOpenRow) {
|
if (hasOpenRow) {
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
hasOpenRow = false;
|
hasOpenRow = false;
|
||||||
|
@ -626,7 +620,7 @@ import 'programStyles';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
let blurHashes = options.imageBlurhashes || item.ImageBlurHashes || {};
|
const blurHashes = options.imageBlurhashes || item.ImageBlurHashes || {};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
imgUrl: imgUrl,
|
imgUrl: imgUrl,
|
||||||
|
@ -661,7 +655,7 @@ import 'programStyles';
|
||||||
for (let i = 0; i < character.length; i++) {
|
for (let i = 0; i < character.length; i++) {
|
||||||
sum += parseInt(character.charAt(i));
|
sum += parseInt(character.charAt(i));
|
||||||
}
|
}
|
||||||
let index = String(sum).substr(-1);
|
const index = String(sum).substr(-1);
|
||||||
|
|
||||||
return (index % numRandomColors) + 1;
|
return (index % numRandomColors) + 1;
|
||||||
} else {
|
} else {
|
||||||
|
@ -686,9 +680,8 @@ import 'programStyles';
|
||||||
let valid = 0;
|
let valid = 0;
|
||||||
|
|
||||||
for (let i = 0; i < lines.length; i++) {
|
for (let i = 0; i < lines.length; i++) {
|
||||||
|
|
||||||
let currentCssClass = cssClass;
|
let currentCssClass = cssClass;
|
||||||
let text = lines[i];
|
const text = lines[i];
|
||||||
|
|
||||||
if (valid > 0 && isOuterFooter) {
|
if (valid > 0 && isOuterFooter) {
|
||||||
currentCssClass += ' cardText-secondary';
|
currentCssClass += ' cardText-secondary';
|
||||||
|
@ -713,8 +706,7 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (forceLines) {
|
if (forceLines) {
|
||||||
|
const linesLength = maxLines || Math.min(lines.length, maxLines || lines.length);
|
||||||
let linesLength = maxLines || Math.min(lines.length, maxLines || lines.length);
|
|
||||||
|
|
||||||
while (valid < linesLength) {
|
while (valid < linesLength) {
|
||||||
html += "<div class='" + cssClass + "'> </div>";
|
html += "<div class='" + cssClass + "'> </div>";
|
||||||
|
@ -745,7 +737,6 @@ import 'programStyles';
|
||||||
let airTimeText = '';
|
let airTimeText = '';
|
||||||
|
|
||||||
if (item.StartDate) {
|
if (item.StartDate) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
let date = datetime.parseISO8601Date(item.StartDate);
|
let date = datetime.parseISO8601Date(item.StartDate);
|
||||||
|
|
||||||
|
@ -792,7 +783,6 @@ import 'programStyles';
|
||||||
const showOtherText = isOuterFooter ? !overlayText : overlayText;
|
const showOtherText = isOuterFooter ? !overlayText : overlayText;
|
||||||
|
|
||||||
if (isOuterFooter && options.cardLayout && layoutManager.mobile) {
|
if (isOuterFooter && options.cardLayout && layoutManager.mobile) {
|
||||||
|
|
||||||
if (options.cardFooterAside !== 'none') {
|
if (options.cardFooterAside !== 'none') {
|
||||||
html += '<button is="paper-icon-button-light" class="itemAction btnCardOptions cardText-secondary" data-action="menu"><span class="material-icons more_vert"></span></button>';
|
html += '<button is="paper-icon-button-light" class="itemAction btnCardOptions cardText-secondary" data-action="menu"><span class="material-icons more_vert"></span></button>';
|
||||||
}
|
}
|
||||||
|
@ -807,9 +797,7 @@ import 'programStyles';
|
||||||
|
|
||||||
if (showOtherText) {
|
if (showOtherText) {
|
||||||
if ((options.showParentTitle || options.showParentTitleOrTitle) && !parentTitleUnderneath) {
|
if ((options.showParentTitle || options.showParentTitleOrTitle) && !parentTitleUnderneath) {
|
||||||
|
|
||||||
if (isOuterFooter && item.Type === 'Episode' && item.SeriesName) {
|
if (isOuterFooter && item.Type === 'Episode' && item.SeriesName) {
|
||||||
|
|
||||||
if (item.SeriesId) {
|
if (item.SeriesId) {
|
||||||
lines.push(getTextActionButton({
|
lines.push(getTextActionButton({
|
||||||
Id: item.SeriesId,
|
Id: item.SeriesId,
|
||||||
|
@ -822,15 +810,12 @@ import 'programStyles';
|
||||||
lines.push(item.SeriesName);
|
lines.push(item.SeriesName);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (isUsingLiveTvNaming(item)) {
|
if (isUsingLiveTvNaming(item)) {
|
||||||
|
|
||||||
lines.push(item.Name);
|
lines.push(item.Name);
|
||||||
|
|
||||||
if (!item.EpisodeTitle) {
|
if (!item.EpisodeTitle) {
|
||||||
titleAdded = true;
|
titleAdded = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
const parentTitle = item.SeriesName || item.Series || item.Album || item.AlbumArtist || '';
|
const parentTitle = item.SeriesName || item.Series || item.Album || item.AlbumArtist || '';
|
||||||
|
|
||||||
|
@ -848,7 +833,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (showMediaTitle) {
|
if (showMediaTitle) {
|
||||||
|
|
||||||
const name = options.showTitle === 'auto' && !item.IsFolder && item.MediaType === 'Photo' ? '' : itemHelper.getDisplayName(item, {
|
const name = options.showTitle === 'auto' && !item.IsFolder && item.MediaType === 'Photo' ? '' : itemHelper.getDisplayName(item, {
|
||||||
includeParentInfo: options.includeParentInfoInTitle
|
includeParentInfo: options.includeParentInfoInTitle
|
||||||
});
|
});
|
||||||
|
@ -865,7 +849,6 @@ import 'programStyles';
|
||||||
|
|
||||||
if (showOtherText) {
|
if (showOtherText) {
|
||||||
if (options.showParentTitle && parentTitleUnderneath) {
|
if (options.showParentTitle && parentTitleUnderneath) {
|
||||||
|
|
||||||
if (isOuterFooter && item.AlbumArtists && item.AlbumArtists.length) {
|
if (isOuterFooter && item.AlbumArtists && item.AlbumArtists.length) {
|
||||||
item.AlbumArtists[0].Type = 'MusicArtist';
|
item.AlbumArtists[0].Type = 'MusicArtist';
|
||||||
item.AlbumArtists[0].IsFolder = true;
|
item.AlbumArtists[0].IsFolder = true;
|
||||||
|
@ -899,7 +882,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.showPremiereDate) {
|
if (options.showPremiereDate) {
|
||||||
|
|
||||||
if (item.PremiereDate) {
|
if (item.PremiereDate) {
|
||||||
try {
|
try {
|
||||||
lines.push(datetime.toLocaleDateString(
|
lines.push(datetime.toLocaleDateString(
|
||||||
|
@ -908,7 +890,6 @@ import 'programStyles';
|
||||||
));
|
));
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
lines.push('');
|
lines.push('');
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
lines.push('');
|
lines.push('');
|
||||||
|
@ -916,14 +897,10 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.showYear || options.showSeriesYear) {
|
if (options.showYear || options.showSeriesYear) {
|
||||||
|
|
||||||
if (item.Type === 'Series') {
|
if (item.Type === 'Series') {
|
||||||
if (item.Status === 'Continuing') {
|
if (item.Status === 'Continuing') {
|
||||||
|
|
||||||
lines.push(globalize.translate('SeriesYearToPresent', item.ProductionYear || ''));
|
lines.push(globalize.translate('SeriesYearToPresent', item.ProductionYear || ''));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (item.EndDate && item.ProductionYear) {
|
if (item.EndDate && item.ProductionYear) {
|
||||||
const endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
|
const endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||||
lines.push(item.ProductionYear + ((endYear === item.ProductionYear) ? '' : (' - ' + endYear)));
|
lines.push(item.ProductionYear + ((endYear === item.ProductionYear) ? '' : (' - ' + endYear)));
|
||||||
|
@ -937,9 +914,7 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.showRuntime) {
|
if (options.showRuntime) {
|
||||||
|
|
||||||
if (item.RunTimeTicks) {
|
if (item.RunTimeTicks) {
|
||||||
|
|
||||||
lines.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
|
lines.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
|
||||||
} else {
|
} else {
|
||||||
lines.push('');
|
lines.push('');
|
||||||
|
@ -947,14 +922,11 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.showAirTime) {
|
if (options.showAirTime) {
|
||||||
|
|
||||||
lines.push(getAirTimeText(item, options.showAirDateTime, options.showAirEndTime) || '');
|
lines.push(getAirTimeText(item, options.showAirDateTime, options.showAirEndTime) || '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.showChannelName) {
|
if (options.showChannelName) {
|
||||||
|
|
||||||
if (item.ChannelId) {
|
if (item.ChannelId) {
|
||||||
|
|
||||||
lines.push(getTextActionButton({
|
lines.push(getTextActionButton({
|
||||||
|
|
||||||
Id: item.ChannelId,
|
Id: item.ChannelId,
|
||||||
|
@ -971,7 +943,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.showCurrentProgram && item.Type === 'TvChannel') {
|
if (options.showCurrentProgram && item.Type === 'TvChannel') {
|
||||||
|
|
||||||
if (item.CurrentProgram) {
|
if (item.CurrentProgram) {
|
||||||
lines.push(item.CurrentProgram.Name);
|
lines.push(item.CurrentProgram.Name);
|
||||||
} else {
|
} else {
|
||||||
|
@ -980,7 +951,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.showCurrentProgramTime && item.Type === 'TvChannel') {
|
if (options.showCurrentProgramTime && item.Type === 'TvChannel') {
|
||||||
|
|
||||||
if (item.CurrentProgram) {
|
if (item.CurrentProgram) {
|
||||||
lines.push(getAirTimeText(item.CurrentProgram, false, true) || '');
|
lines.push(getAirTimeText(item.CurrentProgram, false, true) || '');
|
||||||
} else {
|
} else {
|
||||||
|
@ -990,7 +960,6 @@ import 'programStyles';
|
||||||
|
|
||||||
if (options.showSeriesTimerTime) {
|
if (options.showSeriesTimerTime) {
|
||||||
if (item.RecordAnyTime) {
|
if (item.RecordAnyTime) {
|
||||||
|
|
||||||
lines.push(globalize.translate('Anytime'));
|
lines.push(globalize.translate('Anytime'));
|
||||||
} else {
|
} else {
|
||||||
lines.push(datetime.getDisplayTime(item.StartDate));
|
lines.push(datetime.getDisplayTime(item.StartDate));
|
||||||
|
@ -1016,6 +985,10 @@ import 'programStyles';
|
||||||
lines = [];
|
lines = [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (overlayText && showTitle) {
|
||||||
|
lines = [item.Name];
|
||||||
|
}
|
||||||
|
|
||||||
const addRightTextMargin = isOuterFooter && options.cardLayout && !options.centerText && options.cardFooterAside !== 'none' && layoutManager.mobile;
|
const addRightTextMargin = isOuterFooter && options.cardLayout && !options.centerText && options.cardFooterAside !== 'none' && layoutManager.mobile;
|
||||||
|
|
||||||
html += getCardTextLines(lines, cssClass, !options.overlayText, isOuterFooter, options.cardLayout, addRightTextMargin, options.lines);
|
html += getCardTextLines(lines, cssClass, !options.overlayText, isOuterFooter, options.cardLayout, addRightTextMargin, options.lines);
|
||||||
|
@ -1025,7 +998,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (html) {
|
if (html) {
|
||||||
|
|
||||||
if (!isOuterFooter || logoUrl || options.cardLayout) {
|
if (!isOuterFooter || logoUrl || options.cardLayout) {
|
||||||
html = '<div class="' + footerClass + '">' + html;
|
html = '<div class="' + footerClass + '">' + html;
|
||||||
|
|
||||||
|
@ -1067,31 +1039,25 @@ import 'programStyles';
|
||||||
* @returns {string} HTML markup for the item count indicator.
|
* @returns {string} HTML markup for the item count indicator.
|
||||||
*/
|
*/
|
||||||
function getItemCountsHtml(options, item) {
|
function getItemCountsHtml(options, item) {
|
||||||
let counts = [];
|
const counts = [];
|
||||||
let childText;
|
let childText;
|
||||||
|
|
||||||
if (item.Type === 'Playlist') {
|
if (item.Type === 'Playlist') {
|
||||||
|
|
||||||
childText = '';
|
childText = '';
|
||||||
|
|
||||||
if (item.RunTimeTicks) {
|
if (item.RunTimeTicks) {
|
||||||
|
|
||||||
let minutes = item.RunTimeTicks / 600000000;
|
let minutes = item.RunTimeTicks / 600000000;
|
||||||
|
|
||||||
minutes = minutes || 1;
|
minutes = minutes || 1;
|
||||||
|
|
||||||
childText += globalize.translate('ValueMinutes', Math.round(minutes));
|
childText += globalize.translate('ValueMinutes', Math.round(minutes));
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
childText += globalize.translate('ValueMinutes', 0);
|
childText += globalize.translate('ValueMinutes', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
counts.push(childText);
|
counts.push(childText);
|
||||||
|
|
||||||
} else if (item.Type === 'Genre' || item.Type === 'Studio') {
|
} else if (item.Type === 'Genre' || item.Type === 'Studio') {
|
||||||
|
|
||||||
if (item.MovieCount) {
|
if (item.MovieCount) {
|
||||||
|
|
||||||
childText = item.MovieCount === 1 ?
|
childText = item.MovieCount === 1 ?
|
||||||
globalize.translate('ValueOneMovie') :
|
globalize.translate('ValueOneMovie') :
|
||||||
globalize.translate('ValueMovieCount', item.MovieCount);
|
globalize.translate('ValueMovieCount', item.MovieCount);
|
||||||
|
@ -1100,7 +1066,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.SeriesCount) {
|
if (item.SeriesCount) {
|
||||||
|
|
||||||
childText = item.SeriesCount === 1 ?
|
childText = item.SeriesCount === 1 ?
|
||||||
globalize.translate('ValueOneSeries') :
|
globalize.translate('ValueOneSeries') :
|
||||||
globalize.translate('ValueSeriesCount', item.SeriesCount);
|
globalize.translate('ValueSeriesCount', item.SeriesCount);
|
||||||
|
@ -1108,18 +1073,14 @@ import 'programStyles';
|
||||||
counts.push(childText);
|
counts.push(childText);
|
||||||
}
|
}
|
||||||
if (item.EpisodeCount) {
|
if (item.EpisodeCount) {
|
||||||
|
|
||||||
childText = item.EpisodeCount === 1 ?
|
childText = item.EpisodeCount === 1 ?
|
||||||
globalize.translate('ValueOneEpisode') :
|
globalize.translate('ValueOneEpisode') :
|
||||||
globalize.translate('ValueEpisodeCount', item.EpisodeCount);
|
globalize.translate('ValueEpisodeCount', item.EpisodeCount);
|
||||||
|
|
||||||
counts.push(childText);
|
counts.push(childText);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (item.Type === 'MusicGenre' || options.context === 'MusicArtist') {
|
} else if (item.Type === 'MusicGenre' || options.context === 'MusicArtist') {
|
||||||
|
|
||||||
if (item.AlbumCount) {
|
if (item.AlbumCount) {
|
||||||
|
|
||||||
childText = item.AlbumCount === 1 ?
|
childText = item.AlbumCount === 1 ?
|
||||||
globalize.translate('ValueOneAlbum') :
|
globalize.translate('ValueOneAlbum') :
|
||||||
globalize.translate('ValueAlbumCount', item.AlbumCount);
|
globalize.translate('ValueAlbumCount', item.AlbumCount);
|
||||||
|
@ -1127,7 +1088,6 @@ import 'programStyles';
|
||||||
counts.push(childText);
|
counts.push(childText);
|
||||||
}
|
}
|
||||||
if (item.SongCount) {
|
if (item.SongCount) {
|
||||||
|
|
||||||
childText = item.SongCount === 1 ?
|
childText = item.SongCount === 1 ?
|
||||||
globalize.translate('ValueOneSong') :
|
globalize.translate('ValueOneSong') :
|
||||||
globalize.translate('ValueSongCount', item.SongCount);
|
globalize.translate('ValueSongCount', item.SongCount);
|
||||||
|
@ -1135,16 +1095,13 @@ import 'programStyles';
|
||||||
counts.push(childText);
|
counts.push(childText);
|
||||||
}
|
}
|
||||||
if (item.MusicVideoCount) {
|
if (item.MusicVideoCount) {
|
||||||
|
|
||||||
childText = item.MusicVideoCount === 1 ?
|
childText = item.MusicVideoCount === 1 ?
|
||||||
globalize.translate('ValueOneMusicVideo') :
|
globalize.translate('ValueOneMusicVideo') :
|
||||||
globalize.translate('ValueMusicVideoCount', item.MusicVideoCount);
|
globalize.translate('ValueMusicVideoCount', item.MusicVideoCount);
|
||||||
|
|
||||||
counts.push(childText);
|
counts.push(childText);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (item.Type === 'Series') {
|
} else if (item.Type === 'Series') {
|
||||||
|
|
||||||
childText = item.RecursiveItemCount === 1 ?
|
childText = item.RecursiveItemCount === 1 ?
|
||||||
globalize.translate('ValueOneEpisode') :
|
globalize.translate('ValueOneEpisode') :
|
||||||
globalize.translate('ValueEpisodeCount', item.RecursiveItemCount);
|
globalize.translate('ValueEpisodeCount', item.RecursiveItemCount);
|
||||||
|
@ -1160,10 +1117,11 @@ import 'programStyles';
|
||||||
/**
|
/**
|
||||||
* Imports the refresh indicator element.
|
* Imports the refresh indicator element.
|
||||||
*/
|
*/
|
||||||
function requireRefreshIndicator() {
|
function importRefreshIndicator() {
|
||||||
if (!refreshIndicatorLoaded) {
|
if (!refreshIndicatorLoaded) {
|
||||||
refreshIndicatorLoaded = true;
|
refreshIndicatorLoaded = true;
|
||||||
require(['emby-itemrefreshindicator']);
|
/* eslint-disable-next-line @babel/no-unused-expressions */
|
||||||
|
import('emby-itemrefreshindicator');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1197,13 +1155,11 @@ import 'programStyles';
|
||||||
let shape = options.shape;
|
let shape = options.shape;
|
||||||
|
|
||||||
if (shape === 'mixed') {
|
if (shape === 'mixed') {
|
||||||
|
|
||||||
shape = null;
|
shape = null;
|
||||||
|
|
||||||
const primaryImageAspectRatio = item.PrimaryImageAspectRatio;
|
const primaryImageAspectRatio = item.PrimaryImageAspectRatio;
|
||||||
|
|
||||||
if (primaryImageAspectRatio) {
|
if (primaryImageAspectRatio) {
|
||||||
|
|
||||||
if (primaryImageAspectRatio >= 1.33) {
|
if (primaryImageAspectRatio >= 1.33) {
|
||||||
shape = 'mixedBackdrop';
|
shape = 'mixedBackdrop';
|
||||||
} else if (primaryImageAspectRatio > 0.71) {
|
} else if (primaryImageAspectRatio > 0.71) {
|
||||||
|
@ -1259,8 +1215,8 @@ import 'programStyles';
|
||||||
if (coveredImage) {
|
if (coveredImage) {
|
||||||
cardImageContainerClass += ' coveredImage';
|
cardImageContainerClass += ' coveredImage';
|
||||||
|
|
||||||
if (item.MediaType === 'Photo' || item.Type === 'PhotoAlbum' || item.Type === 'Folder' || item.ProgramInfo || item.Type === 'Program' || item.Type === 'Recording') {
|
if (item.Type === 'TvChannel') {
|
||||||
cardImageContainerClass += ' coveredImage-noScale';
|
cardImageContainerClass += ' coveredImage-contain';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1295,7 +1251,6 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (overlayText) {
|
if (overlayText) {
|
||||||
|
|
||||||
logoUrl = null;
|
logoUrl = null;
|
||||||
|
|
||||||
footerCssClass = progressHtml ? 'innerCardFooter fullInnerCardFooter' : 'innerCardFooter';
|
footerCssClass = progressHtml ? 'innerCardFooter fullInnerCardFooter' : 'innerCardFooter';
|
||||||
|
@ -1366,7 +1321,7 @@ import 'programStyles';
|
||||||
let cardBoxClose = '';
|
let cardBoxClose = '';
|
||||||
let cardScalableClose = '';
|
let cardScalableClose = '';
|
||||||
|
|
||||||
let cardContentClass = 'cardContent';
|
const cardContentClass = 'cardContent';
|
||||||
|
|
||||||
let blurhashAttrib = '';
|
let blurhashAttrib = '';
|
||||||
if (blurhash && blurhash.length > 0) {
|
if (blurhash && blurhash.length > 0) {
|
||||||
|
@ -1385,7 +1340,7 @@ import 'programStyles';
|
||||||
cardImageContainerClose = '</button>';
|
cardImageContainerClose = '</button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
let cardScalableClass = 'cardScalable';
|
const cardScalableClass = 'cardScalable';
|
||||||
|
|
||||||
cardImageContainerOpen = '<div class="' + cardBoxClass + '"><div class="' + cardScalableClass + '"><div class="cardPadder cardPadder-' + shape + '"></div>' + cardImageContainerOpen;
|
cardImageContainerOpen = '<div class="' + cardBoxClass + '"><div class="' + cardScalableClass + '"><div class="cardPadder cardPadder-' + shape + '"></div>' + cardImageContainerOpen;
|
||||||
cardBoxClose = '</div>';
|
cardBoxClose = '</div>';
|
||||||
|
@ -1404,7 +1359,6 @@ import 'programStyles';
|
||||||
indicatorsHtml += indicators.getTypeIndicator(item);
|
indicatorsHtml += indicators.getTypeIndicator(item);
|
||||||
|
|
||||||
if (options.showGroupCount) {
|
if (options.showGroupCount) {
|
||||||
|
|
||||||
indicatorsHtml += indicators.getChildCountIndicatorHtml(item, {
|
indicatorsHtml += indicators.getChildCountIndicatorHtml(item, {
|
||||||
minCount: 1
|
minCount: 1
|
||||||
});
|
});
|
||||||
|
@ -1415,7 +1369,7 @@ import 'programStyles';
|
||||||
if (item.Type === 'CollectionFolder' || item.CollectionType) {
|
if (item.Type === 'CollectionFolder' || item.CollectionType) {
|
||||||
const refreshClass = item.RefreshProgress ? '' : ' class="hide"';
|
const refreshClass = item.RefreshProgress ? '' : ' class="hide"';
|
||||||
indicatorsHtml += '<div is="emby-itemrefreshindicator"' + refreshClass + ' data-progress="' + (item.RefreshProgress || 0) + '" data-status="' + item.RefreshStatus + '"></div>';
|
indicatorsHtml += '<div is="emby-itemrefreshindicator"' + refreshClass + ' data-progress="' + (item.RefreshProgress || 0) + '" data-status="' + item.RefreshStatus + '"></div>';
|
||||||
requireRefreshIndicator();
|
importRefreshIndicator();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indicatorsHtml) {
|
if (indicatorsHtml) {
|
||||||
|
@ -1498,15 +1452,16 @@ import 'programStyles';
|
||||||
const userData = item.UserData || {};
|
const userData = item.UserData || {};
|
||||||
|
|
||||||
if (itemHelper.canMarkPlayed(item)) {
|
if (itemHelper.canMarkPlayed(item)) {
|
||||||
require(['emby-playstatebutton']);
|
/* eslint-disable-next-line @babel/no-unused-expressions */
|
||||||
|
import('emby-playstatebutton');
|
||||||
html += '<button is="emby-playstatebutton" type="button" data-action="none" class="' + btnCssClass + '" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-played="' + (userData.Played) + '"><span class="material-icons cardOverlayButtonIcon cardOverlayButtonIcon-hover check"></span></button>';
|
html += '<button is="emby-playstatebutton" type="button" data-action="none" class="' + btnCssClass + '" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-played="' + (userData.Played) + '"><span class="material-icons cardOverlayButtonIcon cardOverlayButtonIcon-hover check"></span></button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (itemHelper.canRate(item)) {
|
if (itemHelper.canRate(item)) {
|
||||||
|
|
||||||
const likes = userData.Likes == null ? '' : userData.Likes;
|
const likes = userData.Likes == null ? '' : userData.Likes;
|
||||||
|
|
||||||
require(['emby-ratingbutton']);
|
/* eslint-disable-next-line @babel/no-unused-expressions */
|
||||||
|
import('emby-ratingbutton');
|
||||||
html += '<button is="emby-ratingbutton" type="button" data-action="none" class="' + btnCssClass + '" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-likes="' + likes + '" data-isfavorite="' + (userData.IsFavorite) + '"><span class="material-icons cardOverlayButtonIcon cardOverlayButtonIcon-hover favorite"></span></button>';
|
html += '<button is="emby-ratingbutton" type="button" data-action="none" class="' + btnCssClass + '" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-likes="' + likes + '" data-isfavorite="' + (userData.IsFavorite) + '"><span class="material-icons cardOverlayButtonIcon cardOverlayButtonIcon-hover favorite"></span></button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1583,7 +1538,6 @@ import 'programStyles';
|
||||||
const html = buildCardsHtmlInternal(items, options);
|
const html = buildCardsHtmlInternal(items, options);
|
||||||
|
|
||||||
if (html) {
|
if (html) {
|
||||||
|
|
||||||
if (options.itemsContainer.cardBuilderHtml !== html) {
|
if (options.itemsContainer.cardBuilderHtml !== html) {
|
||||||
options.itemsContainer.innerHTML = html;
|
options.itemsContainer.innerHTML = html;
|
||||||
|
|
||||||
|
@ -1596,7 +1550,6 @@ import 'programStyles';
|
||||||
|
|
||||||
imageLoader.lazyChildren(options.itemsContainer);
|
imageLoader.lazyChildren(options.itemsContainer);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
options.itemsContainer.innerHTML = html;
|
options.itemsContainer.innerHTML = html;
|
||||||
options.itemsContainer.cardBuilderHtml = null;
|
options.itemsContainer.cardBuilderHtml = null;
|
||||||
}
|
}
|
||||||
|
@ -1620,7 +1573,6 @@ import 'programStyles';
|
||||||
indicatorsElem = card.querySelector('.cardIndicators');
|
indicatorsElem = card.querySelector('.cardIndicators');
|
||||||
|
|
||||||
if (!indicatorsElem) {
|
if (!indicatorsElem) {
|
||||||
|
|
||||||
const cardImageContainer = card.querySelector('.cardImageContainer');
|
const cardImageContainer = card.querySelector('.cardImageContainer');
|
||||||
indicatorsElem = document.createElement('div');
|
indicatorsElem = document.createElement('div');
|
||||||
indicatorsElem.classList.add('cardIndicators');
|
indicatorsElem.classList.add('cardIndicators');
|
||||||
|
@ -1644,11 +1596,9 @@ import 'programStyles';
|
||||||
let itemProgressBar = null;
|
let itemProgressBar = null;
|
||||||
|
|
||||||
if (userData.Played) {
|
if (userData.Played) {
|
||||||
|
|
||||||
playedIndicator = card.querySelector('.playedIndicator');
|
playedIndicator = card.querySelector('.playedIndicator');
|
||||||
|
|
||||||
if (!playedIndicator) {
|
if (!playedIndicator) {
|
||||||
|
|
||||||
playedIndicator = document.createElement('div');
|
playedIndicator = document.createElement('div');
|
||||||
playedIndicator.classList.add('playedIndicator');
|
playedIndicator.classList.add('playedIndicator');
|
||||||
playedIndicator.classList.add('indicator');
|
playedIndicator.classList.add('indicator');
|
||||||
|
@ -1657,10 +1607,8 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
playedIndicator.innerHTML = '<span class="material-icons indicatorIcon check"></span>';
|
playedIndicator.innerHTML = '<span class="material-icons indicatorIcon check"></span>';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
playedIndicator = card.querySelector('.playedIndicator');
|
playedIndicator = card.querySelector('.playedIndicator');
|
||||||
if (playedIndicator) {
|
if (playedIndicator) {
|
||||||
|
|
||||||
playedIndicator.parentNode.removeChild(playedIndicator);
|
playedIndicator.parentNode.removeChild(playedIndicator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1668,7 +1616,6 @@ import 'programStyles';
|
||||||
countIndicator = card.querySelector('.countIndicator');
|
countIndicator = card.querySelector('.countIndicator');
|
||||||
|
|
||||||
if (!countIndicator) {
|
if (!countIndicator) {
|
||||||
|
|
||||||
countIndicator = document.createElement('div');
|
countIndicator = document.createElement('div');
|
||||||
countIndicator.classList.add('countIndicator');
|
countIndicator.classList.add('countIndicator');
|
||||||
indicatorsElem = ensureIndicators(card, indicatorsElem);
|
indicatorsElem = ensureIndicators(card, indicatorsElem);
|
||||||
|
@ -1676,10 +1623,8 @@ import 'programStyles';
|
||||||
}
|
}
|
||||||
countIndicator.innerHTML = userData.UnplayedItemCount;
|
countIndicator.innerHTML = userData.UnplayedItemCount;
|
||||||
} else if (enableCountIndicator) {
|
} else if (enableCountIndicator) {
|
||||||
|
|
||||||
countIndicator = card.querySelector('.countIndicator');
|
countIndicator = card.querySelector('.countIndicator');
|
||||||
if (countIndicator) {
|
if (countIndicator) {
|
||||||
|
|
||||||
countIndicator.parentNode.removeChild(countIndicator);
|
countIndicator.parentNode.removeChild(countIndicator);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1691,7 +1636,6 @@ import 'programStyles';
|
||||||
});
|
});
|
||||||
|
|
||||||
if (progressHtml) {
|
if (progressHtml) {
|
||||||
|
|
||||||
itemProgressBar = card.querySelector('.itemProgressBar');
|
itemProgressBar = card.querySelector('.itemProgressBar');
|
||||||
|
|
||||||
if (!itemProgressBar) {
|
if (!itemProgressBar) {
|
||||||
|
@ -1710,7 +1654,6 @@ import 'programStyles';
|
||||||
|
|
||||||
itemProgressBar.innerHTML = progressHtml;
|
itemProgressBar.innerHTML = progressHtml;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
itemProgressBar = card.querySelector('.itemProgressBar');
|
itemProgressBar = card.querySelector('.itemProgressBar');
|
||||||
if (itemProgressBar) {
|
if (itemProgressBar) {
|
||||||
itemProgressBar.parentNode.removeChild(itemProgressBar);
|
itemProgressBar.parentNode.removeChild(itemProgressBar);
|
||||||
|
@ -1741,7 +1684,7 @@ import 'programStyles';
|
||||||
const cells = itemsContainer.querySelectorAll('.card[data-id="' + programId + '"]');
|
const cells = itemsContainer.querySelectorAll('.card[data-id="' + programId + '"]');
|
||||||
|
|
||||||
for (let i = 0, length = cells.length; i < length; i++) {
|
for (let i = 0, length = cells.length; i < length; i++) {
|
||||||
let cell = cells[i];
|
const cell = cells[i];
|
||||||
const icon = cell.querySelector('.timerIndicator');
|
const icon = cell.querySelector('.timerIndicator');
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
const indicatorsElem = ensureIndicators(cell);
|
const indicatorsElem = ensureIndicators(cell);
|
||||||
|
@ -1760,8 +1703,8 @@ import 'programStyles';
|
||||||
const cells = itemsContainer.querySelectorAll('.card[data-timerid="' + timerId + '"]');
|
const cells = itemsContainer.querySelectorAll('.card[data-timerid="' + timerId + '"]');
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++) {
|
for (let i = 0; i < cells.length; i++) {
|
||||||
let cell = cells[i];
|
const cell = cells[i];
|
||||||
let icon = cell.querySelector('.timerIndicator');
|
const icon = cell.querySelector('.timerIndicator');
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.parentNode.removeChild(icon);
|
icon.parentNode.removeChild(icon);
|
||||||
}
|
}
|
||||||
|
@ -1778,8 +1721,8 @@ import 'programStyles';
|
||||||
const cells = itemsContainer.querySelectorAll('.card[data-seriestimerid="' + cancelledTimerId + '"]');
|
const cells = itemsContainer.querySelectorAll('.card[data-seriestimerid="' + cancelledTimerId + '"]');
|
||||||
|
|
||||||
for (let i = 0; i < cells.length; i++) {
|
for (let i = 0; i < cells.length; i++) {
|
||||||
let cell = cells[i];
|
const cell = cells[i];
|
||||||
let icon = cell.querySelector('.timerIndicator');
|
const icon = cell.querySelector('.timerIndicator');
|
||||||
if (icon) {
|
if (icon) {
|
||||||
icon.parentNode.removeChild(icon);
|
icon.parentNode.removeChild(icon);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,14 +7,12 @@
|
||||||
|
|
||||||
import datetime from 'datetime';
|
import datetime from 'datetime';
|
||||||
import imageLoader from 'imageLoader';
|
import imageLoader from 'imageLoader';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import layoutManager from 'layoutManager';
|
import layoutManager from 'layoutManager';
|
||||||
import browser from 'browser';
|
import browser from 'browser';
|
||||||
|
|
||||||
const enableFocusTransform = !browser.slow && !browser.edge;
|
const enableFocusTransform = !browser.slow && !browser.edge;
|
||||||
|
|
||||||
function buildChapterCardsHtml(item, chapters, options) {
|
function buildChapterCardsHtml(item, chapters, options) {
|
||||||
|
|
||||||
// TODO move card creation code to Card component
|
// TODO move card creation code to Card component
|
||||||
|
|
||||||
let className = 'card itemAction chapterCard';
|
let className = 'card itemAction chapterCard';
|
||||||
|
@ -35,7 +33,6 @@ import browser from 'browser';
|
||||||
let shape = (options.backdropShape || 'backdrop');
|
let shape = (options.backdropShape || 'backdrop');
|
||||||
|
|
||||||
if (videoStream.Width && videoStream.Height) {
|
if (videoStream.Width && videoStream.Height) {
|
||||||
|
|
||||||
if ((videoStream.Width / videoStream.Height) <= 1.2) {
|
if ((videoStream.Width / videoStream.Height) <= 1.2) {
|
||||||
shape = (options.squareShape || 'square');
|
shape = (options.squareShape || 'square');
|
||||||
}
|
}
|
||||||
|
@ -50,10 +47,9 @@ import browser from 'browser';
|
||||||
let html = '';
|
let html = '';
|
||||||
let itemsInRow = 0;
|
let itemsInRow = 0;
|
||||||
|
|
||||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||||
|
|
||||||
for (let i = 0, length = chapters.length; i < length; i++) {
|
for (let i = 0, length = chapters.length; i < length; i++) {
|
||||||
|
|
||||||
if (options.rows && itemsInRow === 0) {
|
if (options.rows && itemsInRow === 0) {
|
||||||
html += '<div class="cardColumn">';
|
html += '<div class="cardColumn">';
|
||||||
}
|
}
|
||||||
|
@ -73,12 +69,10 @@ import browser from 'browser';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getImgUrl({Id}, {ImageTag}, index, maxWidth, apiClient) {
|
function getImgUrl({Id}, {ImageTag}, index, maxWidth, apiClient) {
|
||||||
|
|
||||||
if (ImageTag) {
|
if (ImageTag) {
|
||||||
|
|
||||||
return apiClient.getScaledImageUrl(Id, {
|
return apiClient.getScaledImageUrl(Id, {
|
||||||
|
|
||||||
maxWidth: maxWidth * 2,
|
maxWidth: maxWidth,
|
||||||
tag: ImageTag,
|
tag: ImageTag,
|
||||||
type: 'Chapter',
|
type: 'Chapter',
|
||||||
index
|
index
|
||||||
|
@ -89,7 +83,6 @@ import browser from 'browser';
|
||||||
}
|
}
|
||||||
|
|
||||||
function buildChapterCard(item, apiClient, chapter, index, {width, coverImage}, className, shape) {
|
function buildChapterCard(item, apiClient, chapter, index, {width, coverImage}, className, shape) {
|
||||||
|
|
||||||
const imgUrl = getImgUrl(item, chapter, index, width || 400, apiClient);
|
const imgUrl = getImgUrl(item, chapter, index, width || 400, apiClient);
|
||||||
|
|
||||||
let cardImageContainerClass = 'cardContent cardContent-shadow cardImageContainer chapterCardImageContainer';
|
let cardImageContainerClass = 'cardContent cardContent-shadow cardImageContainer chapterCardImageContainer';
|
||||||
|
@ -110,13 +103,10 @@ import browser from 'browser';
|
||||||
const cardBoxCssClass = 'cardBox';
|
const cardBoxCssClass = 'cardBox';
|
||||||
const cardScalableClass = 'cardScalable';
|
const cardScalableClass = 'cardScalable';
|
||||||
|
|
||||||
const html = `<button type="button" class="${className}"${dataAttributes}><div class="${cardBoxCssClass}"><div class="${cardScalableClass}"><div class="cardPadder-${shape}"></div>${cardImageContainer}</div><div class="innerCardFooter">${nameHtml}</div></div></div></button>`;
|
return `<button type="button" class="${className}"${dataAttributes}><div class="${cardBoxCssClass}"><div class="${cardScalableClass}"><div class="cardPadder-${shape}"></div>${cardImageContainer}</div><div class="innerCardFooter">${nameHtml}</div></div></div></button>`;
|
||||||
|
|
||||||
return html;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export function buildChapterCards(item, chapters, options) {
|
export function buildChapterCards(item, chapters, options) {
|
||||||
|
|
||||||
if (options.parentContainer) {
|
if (options.parentContainer) {
|
||||||
// Abort if the container has been disposed
|
// Abort if the container has been disposed
|
||||||
if (!document.body.contains(options.parentContainer)) {
|
if (!document.body.contains(options.parentContainer)) {
|
||||||
|
|
|
@ -8,7 +8,6 @@
|
||||||
import cardBuilder from 'cardBuilder';
|
import cardBuilder from 'cardBuilder';
|
||||||
|
|
||||||
export function buildPeopleCards(items, options) {
|
export function buildPeopleCards(items, options) {
|
||||||
|
|
||||||
options = Object.assign(options || {}, {
|
options = Object.assign(options || {}, {
|
||||||
cardLayout: false,
|
cardLayout: false,
|
||||||
centerText: true,
|
centerText: true,
|
||||||
|
|
|
@ -1,23 +1,16 @@
|
||||||
define([], function() {
|
class CastSenderApi {
|
||||||
'use strict';
|
load() {
|
||||||
|
|
||||||
if (window.appMode === 'cordova' || window.appMode === 'android') {
|
if (window.appMode === 'cordova' || window.appMode === 'android') {
|
||||||
return {
|
|
||||||
load: function () {
|
|
||||||
window.chrome = window.chrome || {};
|
window.chrome = window.chrome || {};
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
|
||||||
};
|
|
||||||
} else {
|
} else {
|
||||||
var ccLoaded = false;
|
let ccLoaded = false;
|
||||||
return {
|
|
||||||
load: function () {
|
|
||||||
if (ccLoaded) {
|
if (ccLoaded) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve) {
|
||||||
var fileref = document.createElement('script');
|
const fileref = document.createElement('script');
|
||||||
fileref.setAttribute('type', 'text/javascript');
|
fileref.setAttribute('type', 'text/javascript');
|
||||||
|
|
||||||
fileref.onload = function () {
|
fileref.onload = function () {
|
||||||
|
@ -29,6 +22,7 @@ define([], function() {
|
||||||
document.querySelector('head').appendChild(fileref);
|
document.querySelector('head').appendChild(fileref);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
export default CastSenderApi;
|
||||||
|
|
|
@ -1,21 +1,32 @@
|
||||||
define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'actionsheet', 'emby-input', 'paper-icon-button-light', 'emby-button', 'listViewStyle', 'material-icons', 'formDialogStyle'], function (dom, dialogHelper, loading, connectionManager, globalize, actionsheet) {
|
import dom from 'dom';
|
||||||
'use strict';
|
import dialogHelper from 'dialogHelper';
|
||||||
|
import loading from 'loading';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import actionsheet from 'actionsheet';
|
||||||
|
import 'emby-input';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'listViewStyle';
|
||||||
|
import 'material-icons';
|
||||||
|
import 'formDialogStyle';
|
||||||
|
|
||||||
return function (options) {
|
export default class channelMapper {
|
||||||
|
constructor(options) {
|
||||||
function mapChannel(button, channelId, providerChannelId) {
|
function mapChannel(button, channelId, providerChannelId) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var providerId = options.providerId;
|
const providerId = options.providerId;
|
||||||
connectionManager.getApiClient(options.serverId).ajax({
|
window.connectionManager.getApiClient(options.serverId).ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: ApiClient.getUrl('LiveTv/ChannelMappings'),
|
url: ApiClient.getUrl('LiveTv/ChannelMappings'),
|
||||||
data: {
|
data: JSON.stringify({
|
||||||
providerId: providerId,
|
providerId: providerId,
|
||||||
tunerChannelId: channelId,
|
tunerChannelId: channelId,
|
||||||
providerChannelId: providerChannelId
|
providerChannelId: providerChannelId
|
||||||
},
|
}),
|
||||||
|
contentType: 'application/json',
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
}).then(function (mapping) {
|
}).then(mapping => {
|
||||||
var listItem = dom.parentWithClass(button, 'listItem');
|
const listItem = dom.parentWithClass(button, 'listItem');
|
||||||
button.setAttribute('data-providerid', mapping.ProviderChannelId);
|
button.setAttribute('data-providerid', mapping.ProviderChannelId);
|
||||||
listItem.querySelector('.secondary').innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName);
|
listItem.querySelector('.secondary').innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
@ -23,42 +34,42 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChannelsElementClick(e) {
|
function onChannelsElementClick(e) {
|
||||||
var btnMap = dom.parentWithClass(e.target, 'btnMap');
|
const btnMap = dom.parentWithClass(e.target, 'btnMap');
|
||||||
|
|
||||||
if (btnMap) {
|
if (btnMap) {
|
||||||
var channelId = btnMap.getAttribute('data-id');
|
const channelId = btnMap.getAttribute('data-id');
|
||||||
var providerChannelId = btnMap.getAttribute('data-providerid');
|
const providerChannelId = btnMap.getAttribute('data-providerid');
|
||||||
var menuItems = currentMappingOptions.ProviderChannels.map(function (m) {
|
const menuItems = currentMappingOptions.ProviderChannels.map(m => {
|
||||||
return {
|
return {
|
||||||
name: m.Name,
|
name: m.Name,
|
||||||
id: m.Id,
|
id: m.Id,
|
||||||
selected: m.Id.toLowerCase() === providerChannelId.toLowerCase()
|
selected: m.Id.toLowerCase() === providerChannelId.toLowerCase()
|
||||||
};
|
};
|
||||||
}).sort(function (a, b) {
|
}).sort((a, b) => {
|
||||||
return a.name.localeCompare(b.name);
|
return a.name.localeCompare(b.name);
|
||||||
});
|
});
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
positionTo: btnMap,
|
positionTo: btnMap,
|
||||||
items: menuItems
|
items: menuItems
|
||||||
}).then(function (newChannelId) {
|
}).then(newChannelId => {
|
||||||
mapChannel(btnMap, channelId, newChannelId);
|
mapChannel(btnMap, channelId, newChannelId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChannelMappingOptions(serverId, providerId) {
|
function getChannelMappingOptions(serverId, providerId) {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getJSON(apiClient.getUrl('LiveTv/ChannelMappingOptions', {
|
return apiClient.getJSON(apiClient.getUrl('LiveTv/ChannelMappingOptions', {
|
||||||
providerId: providerId
|
providerId: providerId
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMappingSecondaryName(mapping, providerName) {
|
function getMappingSecondaryName(mapping, providerName) {
|
||||||
return (mapping.ProviderChannelName || '') + ' - ' + providerName;
|
return `${mapping.ProviderChannelName || ''} - ${providerName}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTunerChannelHtml(channel, providerName) {
|
function getTunerChannelHtml(channel, providerName) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="listItem">';
|
html += '<div class="listItem">';
|
||||||
html += '<span class="material-icons listItemIcon dvr"></span>';
|
html += '<span class="material-icons listItemIcon dvr"></span>';
|
||||||
html += '<div class="listItemBody two-line">';
|
html += '<div class="listItemBody two-line">';
|
||||||
|
@ -73,16 +84,16 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-id="' + channel.Id + '" data-providerid="' + channel.ProviderChannelId + '"><span class="material-icons mode_edit"></span></button>';
|
html += `<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-id="${channel.Id}" data-providerid="${channel.ProviderChannelId}"><span class="material-icons mode_edit"></span></button>`;
|
||||||
return html += '</div>';
|
return html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditorHtml() {
|
function getEditorHtml() {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="formDialogContent smoothScrollY">';
|
html += '<div class="formDialogContent smoothScrollY">';
|
||||||
html += '<div class="dialogContentInner dialog-content-centered">';
|
html += '<div class="dialogContentInner dialog-content-centered">';
|
||||||
html += '<form style="margin:auto;">';
|
html += '<form style="margin:auto;">';
|
||||||
html += '<h1>' + globalize.translate('HeaderChannels') + '</h1>';
|
html += `<h1>${globalize.translate('Channels')}</h1>`;
|
||||||
html += '<div class="channels paperList">';
|
html += '<div class="channels paperList">';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</form>';
|
html += '</form>';
|
||||||
|
@ -91,30 +102,29 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(dlg, options) {
|
function initEditor(dlg, options) {
|
||||||
getChannelMappingOptions(options.serverId, options.providerId).then(function (result) {
|
getChannelMappingOptions(options.serverId, options.providerId).then(result => {
|
||||||
currentMappingOptions = result;
|
currentMappingOptions = result;
|
||||||
var channelsElement = dlg.querySelector('.channels');
|
const channelsElement = dlg.querySelector('.channels');
|
||||||
channelsElement.innerHTML = result.TunerChannels.map(function (channel) {
|
channelsElement.innerHTML = result.TunerChannels.map(channel => {
|
||||||
return getTunerChannelHtml(channel, result.ProviderName);
|
return getTunerChannelHtml(channel, result.ProviderName);
|
||||||
}).join('');
|
}).join('');
|
||||||
channelsElement.addEventListener('click', onChannelsElementClick);
|
channelsElement.addEventListener('click', onChannelsElementClick);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentMappingOptions;
|
let currentMappingOptions;
|
||||||
var self = this;
|
|
||||||
|
|
||||||
self.show = function () {
|
this.show = () => {
|
||||||
var dialogOptions = {
|
const dialogOptions = {
|
||||||
removeOnClose: true
|
removeOnClose: true
|
||||||
};
|
};
|
||||||
dialogOptions.size = 'small';
|
dialogOptions.size = 'small';
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
dlg.classList.add('ui-body-a');
|
dlg.classList.add('ui-body-a');
|
||||||
dlg.classList.add('background-theme-a');
|
dlg.classList.add('background-theme-a');
|
||||||
var html = '';
|
let html = '';
|
||||||
var title = globalize.translate('MapChannels');
|
const title = globalize.translate('MapChannels');
|
||||||
html += '<div class="formDialogHeader">';
|
html += '<div class="formDialogHeader">';
|
||||||
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||||
html += '<h3 class="formDialogHeaderTitle">';
|
html += '<h3 class="formDialogHeaderTitle">';
|
||||||
|
@ -124,13 +134,13 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||||
html += getEditorHtml();
|
html += getEditorHtml();
|
||||||
dlg.innerHTML = html;
|
dlg.innerHTML = html;
|
||||||
initEditor(dlg, options);
|
initEditor(dlg, options);
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(resolve => {
|
||||||
dlg.addEventListener('close', resolve);
|
dlg.addEventListener('close', resolve);
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
});
|
}
|
||||||
|
|
|
@ -1,16 +1,30 @@
|
||||||
define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button', 'flexStyles'], function (dom, dialogHelper, loading, appHost, layoutManager, connectionManager, appRouter, globalize) {
|
import dom from 'dom';
|
||||||
'use strict';
|
import dialogHelper from 'dialogHelper';
|
||||||
|
import loading from 'loading';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import appRouter from 'appRouter';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-input';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'emby-select';
|
||||||
|
import 'material-icons';
|
||||||
|
import 'css!./../formdialog';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'flexStyles';
|
||||||
|
|
||||||
var currentServerId;
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
let currentServerId;
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var panel = dom.parentWithClass(this, 'dialog');
|
const panel = dom.parentWithClass(this, 'dialog');
|
||||||
|
|
||||||
var collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
const collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
|
|
||||||
if (collectionId) {
|
if (collectionId) {
|
||||||
addToCollection(apiClient, panel, collectionId);
|
addToCollection(apiClient, panel, collectionId);
|
||||||
|
@ -23,8 +37,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
}
|
}
|
||||||
|
|
||||||
function createCollection(apiClient, dlg) {
|
function createCollection(apiClient, dlg) {
|
||||||
|
const url = apiClient.getUrl('Collections', {
|
||||||
var url = apiClient.getUrl('Collections', {
|
|
||||||
|
|
||||||
Name: dlg.querySelector('#txtNewCollectionName').value,
|
Name: dlg.querySelector('#txtNewCollectionName').value,
|
||||||
IsLocked: !dlg.querySelector('#chkEnableInternetMetadata').checked,
|
IsLocked: !dlg.querySelector('#chkEnableInternetMetadata').checked,
|
||||||
|
@ -36,27 +49,23 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
url: url,
|
url: url,
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
|
|
||||||
}).then(function (result) {
|
}).then(result => {
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
var id = result.Id;
|
const id = result.Id;
|
||||||
|
|
||||||
dlg.submitted = true;
|
dlg.submitted = true;
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
redirectToCollection(apiClient, id);
|
redirectToCollection(apiClient, id);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function redirectToCollection(apiClient, id) {
|
function redirectToCollection(apiClient, id) {
|
||||||
|
|
||||||
appRouter.showItem(id, apiClient.serverId());
|
appRouter.showItem(id, apiClient.serverId());
|
||||||
}
|
}
|
||||||
|
|
||||||
function addToCollection(apiClient, dlg, id) {
|
function addToCollection(apiClient, dlg, id) {
|
||||||
|
const url = apiClient.getUrl(`Collections/${id}/Items`, {
|
||||||
var url = apiClient.getUrl('Collections/' + id + '/Items', {
|
|
||||||
|
|
||||||
Ids: dlg.querySelector('.fldSelectedItemIds').value || ''
|
Ids: dlg.querySelector('.fldSelectedItemIds').value || ''
|
||||||
});
|
});
|
||||||
|
@ -65,14 +74,13 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: url
|
url: url
|
||||||
|
|
||||||
}).then(function () {
|
}).then(() => {
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
dlg.submitted = true;
|
dlg.submitted = true;
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
|
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('MessageItemsAdded'));
|
toast(globalize.translate('MessageItemsAdded'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -83,14 +91,13 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateCollections(panel) {
|
function populateCollections(panel) {
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var select = panel.querySelector('#selectCollectionToAddTo');
|
const select = panel.querySelector('#selectCollectionToAddTo');
|
||||||
|
|
||||||
panel.querySelector('.newCollectionInfo').classList.add('hide');
|
panel.querySelector('.newCollectionInfo').classList.add('hide');
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
|
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
IncludeItemTypes: 'BoxSet',
|
IncludeItemTypes: 'BoxSet',
|
||||||
|
@ -98,16 +105,14 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
EnableTotalRecordCount: false
|
EnableTotalRecordCount: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
const apiClient = window.connectionManager.getApiClient(currentServerId);
|
||||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
|
||||||
|
let html = '';
|
||||||
|
|
||||||
var html = '';
|
html += `<option value="">${globalize.translate('OptionNew')}</option>`;
|
||||||
|
|
||||||
html += '<option value="">' + globalize.translate('OptionNew') + '</option>';
|
html += result.Items.map(i => {
|
||||||
|
return `<option value="${i.Id}">${i.Name}</option>`;
|
||||||
html += result.Items.map(function (i) {
|
|
||||||
|
|
||||||
return '<option value="' + i.Id + '">' + i.Name + '</option>';
|
|
||||||
});
|
});
|
||||||
|
|
||||||
select.innerHTML = html;
|
select.innerHTML = html;
|
||||||
|
@ -119,8 +124,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditorHtml() {
|
function getEditorHtml() {
|
||||||
|
let html = '';
|
||||||
var html = '';
|
|
||||||
|
|
||||||
html += '<div class="formDialogContent smoothScrollY" style="padding-top:2em;">';
|
html += '<div class="formDialogContent smoothScrollY" style="padding-top:2em;">';
|
||||||
html += '<div class="dialogContentInner dialog-content-centered">';
|
html += '<div class="dialogContentInner dialog-content-centered">';
|
||||||
|
@ -134,27 +138,27 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
html += '<div class="selectContainer">';
|
html += '<div class="selectContainer">';
|
||||||
html += '<select is="emby-select" label="' + globalize.translate('LabelCollection') + '" id="selectCollectionToAddTo" autofocus></select>';
|
html += `<select is="emby-select" label="${globalize.translate('LabelCollection')}" id="selectCollectionToAddTo" autofocus></select>`;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '<div class="newCollectionInfo">';
|
html += '<div class="newCollectionInfo">';
|
||||||
|
|
||||||
html += '<div class="inputContainer">';
|
html += '<div class="inputContainer">';
|
||||||
html += '<input is="emby-input" type="text" id="txtNewCollectionName" required="required" label="' + globalize.translate('LabelName') + '" />';
|
html += `<input is="emby-input" type="text" id="txtNewCollectionName" required="required" label="${globalize.translate('LabelName')}" />`;
|
||||||
html += '<div class="fieldDescription">' + globalize.translate('NewCollectionNameExample') + '</div>';
|
html += `<div class="fieldDescription">${globalize.translate('NewCollectionNameExample')}</div>`;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '<label class="checkboxContainer">';
|
html += '<label class="checkboxContainer">';
|
||||||
html += '<input is="emby-checkbox" type="checkbox" id="chkEnableInternetMetadata" />';
|
html += '<input is="emby-checkbox" type="checkbox" id="chkEnableInternetMetadata" />';
|
||||||
html += '<span>' + globalize.translate('SearchForCollectionInternetMetadata') + '</span>';
|
html += `<span>${globalize.translate('SearchForCollectionInternetMetadata')}</span>`;
|
||||||
html += '</label>';
|
html += '</label>';
|
||||||
|
|
||||||
// newCollectionInfo
|
// newCollectionInfo
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '<div class="formDialogFooter">';
|
html += '<div class="formDialogFooter">';
|
||||||
html += '<button is="emby-button" type="submit" class="raised btnSubmit block formDialogFooterItem button-submit">' + globalize.translate('ButtonOk') + '</button>';
|
html += `<button is="emby-button" type="submit" class="raised btnSubmit block formDialogFooterItem button-submit">${globalize.translate('ButtonOk')}</button>`;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += '<input type="hidden" class="fldSelectedItemIds" />';
|
html += '<input type="hidden" class="fldSelectedItemIds" />';
|
||||||
|
@ -167,7 +171,6 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(content, items) {
|
function initEditor(content, items) {
|
||||||
|
|
||||||
content.querySelector('#selectCollectionToAddTo').addEventListener('change', function () {
|
content.querySelector('#selectCollectionToAddTo').addEventListener('change', function () {
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
content.querySelector('.newCollectionInfo').classList.add('hide');
|
content.querySelector('.newCollectionInfo').classList.add('hide');
|
||||||
|
@ -188,7 +191,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
} else {
|
} else {
|
||||||
content.querySelector('.fldSelectCollection').classList.add('hide');
|
content.querySelector('.fldSelectCollection').classList.add('hide');
|
||||||
|
|
||||||
var selectCollectionToAddTo = content.querySelector('#selectCollectionToAddTo');
|
const selectCollectionToAddTo = content.querySelector('#selectCollectionToAddTo');
|
||||||
selectCollectionToAddTo.innerHTML = '';
|
selectCollectionToAddTo.innerHTML = '';
|
||||||
selectCollectionToAddTo.value = '';
|
selectCollectionToAddTo.value = '';
|
||||||
triggerChange(selectCollectionToAddTo);
|
triggerChange(selectCollectionToAddTo);
|
||||||
|
@ -196,22 +199,18 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
import('scrollHelper').then((scrollHelper) => {
|
||||||
var fn = on ? 'on' : 'off';
|
const fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function CollectionEditor() {
|
export class showEditor {
|
||||||
|
constructor(options) {
|
||||||
}
|
const items = options.items || {};
|
||||||
|
|
||||||
CollectionEditor.prototype.show = function (options) {
|
|
||||||
|
|
||||||
var items = options.items || {};
|
|
||||||
currentServerId = options.serverId;
|
currentServerId = options.serverId;
|
||||||
|
|
||||||
var dialogOptions = {
|
const dialogOptions = {
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
@ -222,12 +221,12 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
dialogOptions.size = 'small';
|
dialogOptions.size = 'small';
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
var title = items.length ? globalize.translate('HeaderAddToCollection') : globalize.translate('NewCollection');
|
const title = items.length ? globalize.translate('HeaderAddToCollection') : globalize.translate('NewCollection');
|
||||||
|
|
||||||
html += '<div class="formDialogHeader">';
|
html += '<div class="formDialogHeader">';
|
||||||
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||||
|
@ -235,10 +234,6 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
html += title;
|
html += title;
|
||||||
html += '</h3>';
|
html += '</h3>';
|
||||||
|
|
||||||
if (appHost.supports('externallinks')) {
|
|
||||||
html += '<a is="emby-linkbutton" class="button-link btnHelp flex align-items-center" href="https://web.archive.org/web/20181216120305/https://github.com/MediaBrowser/Wiki/wiki/Collections" target="_blank" style="margin-left:auto;margin-right:.5em;padding:.25em;" title="' + globalize.translate('Help') + '"><span class="material-icons info"></span><span style="margin-left:.25em;">' + globalize.translate('Help') + '</span></a>';
|
|
||||||
}
|
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
html += getEditorHtml();
|
html += getEditorHtml();
|
||||||
|
@ -247,8 +242,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
|
|
||||||
initEditor(dlg, items);
|
initEditor(dlg, items);
|
||||||
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||||
|
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -256,8 +250,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dialogHelper.open(dlg).then(function () {
|
return dialogHelper.open(dlg).then(() => {
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||||
}
|
}
|
||||||
|
@ -268,7 +261,8 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||||
|
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return CollectionEditor;
|
/* eslint-enable indent */
|
||||||
});
|
export default showEditor;
|
||||||
|
|
|
@ -1,13 +1,16 @@
|
||||||
define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import dialog from 'dialog';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
export default (() => {
|
||||||
function replaceAll(str, find, replace) {
|
function replaceAll(str, find, replace) {
|
||||||
return str.split(find).join(replace);
|
return str.split(find).join(replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.tv && window.confirm) {
|
if (browser.tv && window.confirm) {
|
||||||
// Use the native confirm dialog
|
// Use the native confirm dialog
|
||||||
return function (options) {
|
return options => {
|
||||||
if (typeof options === 'string') {
|
if (typeof options === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: '',
|
title: '',
|
||||||
|
@ -15,8 +18,8 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = replaceAll(options.text || '', '<br/>', '\n');
|
const text = replaceAll(options.text || '', '<br/>', '\n');
|
||||||
var result = confirm(text);
|
const result = window.confirm(text);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
@ -26,8 +29,8 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// Use our own dialog
|
// Use our own dialog
|
||||||
return function (text, title) {
|
return (text, title) => {
|
||||||
var options;
|
let options;
|
||||||
if (typeof text === 'string') {
|
if (typeof text === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -37,7 +40,7 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
options = text;
|
options = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
var items = [];
|
const items = [];
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
name: options.cancelText || globalize.translate('ButtonCancel'),
|
name: options.cancelText || globalize.translate('ButtonCancel'),
|
||||||
|
@ -53,7 +56,7 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
|
|
||||||
options.buttons = items;
|
options.buttons = items;
|
||||||
|
|
||||||
return dialog(options).then(function (result) {
|
return dialog.show(options).then(result => {
|
||||||
if (result === 'ok') {
|
if (result === 'ok') {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
@ -62,4 +65,5 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
})();
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,20 +1,30 @@
|
||||||
define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 'require', 'material-icons', 'emby-button', 'paper-icon-button-light', 'emby-input', 'formDialogStyle', 'flexStyles'], function (dialogHelper, dom, layoutManager, scrollHelper, globalize, require) {
|
import dialogHelper from 'dialogHelper';
|
||||||
'use strict';
|
import dom from 'dom';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import scrollHelper from 'scrollHelper';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'material-icons';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'emby-input';
|
||||||
|
import 'formDialogStyle';
|
||||||
|
import 'flexStyles';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function showDialog(options, template) {
|
function showDialog(options, template) {
|
||||||
|
const dialogOptions = {
|
||||||
var dialogOptions = {
|
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
|
||||||
var enableTvLayout = layoutManager.tv;
|
const enableTvLayout = layoutManager.tv;
|
||||||
|
|
||||||
if (enableTvLayout) {
|
if (enableTvLayout) {
|
||||||
dialogOptions.size = 'fullscreen';
|
dialogOptions.size = 'fullscreen';
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
|
@ -22,7 +32,7 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||||
|
|
||||||
dlg.classList.add('align-items-center');
|
dlg.classList.add('align-items-center');
|
||||||
dlg.classList.add('justify-content-center');
|
dlg.classList.add('justify-content-center');
|
||||||
var formDialogContent = dlg.querySelector('.formDialogContent');
|
const formDialogContent = dlg.querySelector('.formDialogContent');
|
||||||
formDialogContent.classList.add('no-grow');
|
formDialogContent.classList.add('no-grow');
|
||||||
|
|
||||||
if (enableTvLayout) {
|
if (enableTvLayout) {
|
||||||
|
@ -30,41 +40,36 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||||
formDialogContent.style['max-height'] = '60%';
|
formDialogContent.style['max-height'] = '60%';
|
||||||
scrollHelper.centerFocus.on(formDialogContent, false);
|
scrollHelper.centerFocus.on(formDialogContent, false);
|
||||||
} else {
|
} else {
|
||||||
formDialogContent.style.maxWidth = (Math.min((options.buttons.length * 150) + 200, dom.getWindowSize().innerWidth - 50)) + 'px';
|
formDialogContent.style.maxWidth = `${Math.min((options.buttons.length * 150) + 200, dom.getWindowSize().innerWidth - 50)}px`;
|
||||||
dlg.classList.add('dialog-fullscreen-lowres');
|
dlg.classList.add('dialog-fullscreen-lowres');
|
||||||
}
|
}
|
||||||
|
|
||||||
//dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
|
||||||
// dialogHelper.close(dlg);
|
|
||||||
//});
|
|
||||||
|
|
||||||
if (options.title) {
|
if (options.title) {
|
||||||
dlg.querySelector('.formDialogHeaderTitle').innerHTML = options.title || '';
|
dlg.querySelector('.formDialogHeaderTitle').innerHTML = options.title || '';
|
||||||
} else {
|
} else {
|
||||||
dlg.querySelector('.formDialogHeaderTitle').classList.add('hide');
|
dlg.querySelector('.formDialogHeaderTitle').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var displayText = options.html || options.text || '';
|
const displayText = options.html || options.text || '';
|
||||||
dlg.querySelector('.text').innerHTML = displayText;
|
dlg.querySelector('.text').innerHTML = displayText;
|
||||||
|
|
||||||
if (!displayText) {
|
if (!displayText) {
|
||||||
dlg.querySelector('.dialogContentInner').classList.add('hide');
|
dlg.querySelector('.dialogContentInner').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var i;
|
let i;
|
||||||
var length;
|
let length;
|
||||||
var html = '';
|
let html = '';
|
||||||
var hasDescriptions = false;
|
let hasDescriptions = false;
|
||||||
|
|
||||||
for (i = 0, length = options.buttons.length; i < length; i++) {
|
for (i = 0, length = options.buttons.length; i < length; i++) {
|
||||||
|
const item = options.buttons[i];
|
||||||
|
const autoFocus = i === 0 ? ' autofocus' : '';
|
||||||
|
|
||||||
var item = options.buttons[i];
|
let buttonClass = 'btnOption raised formDialogFooterItem formDialogFooterItem-autosize';
|
||||||
var autoFocus = i === 0 ? ' autofocus' : '';
|
|
||||||
|
|
||||||
var buttonClass = 'btnOption raised formDialogFooterItem formDialogFooterItem-autosize';
|
|
||||||
|
|
||||||
if (item.type) {
|
if (item.type) {
|
||||||
buttonClass += ' button-' + item.type;
|
buttonClass += ` button-${item.type}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.description) {
|
if (item.description) {
|
||||||
|
@ -75,10 +80,10 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||||
buttonClass += ' formDialogFooterItem-vertical formDialogFooterItem-nomarginbottom';
|
buttonClass += ' formDialogFooterItem-vertical formDialogFooterItem-nomarginbottom';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<button is="emby-button" type="button" class="' + buttonClass + '" data-id="' + item.id + '"' + autoFocus + '>' + item.name + '</button>';
|
html += `<button is="emby-button" type="button" class="${buttonClass}" data-id="${item.id}"${autoFocus}>${item.name}</button>`;
|
||||||
|
|
||||||
if (item.description) {
|
if (item.description) {
|
||||||
html += '<div class="formDialogFooterItem formDialogFooterItem-autosize fieldDescription" style="margin-top:.25em!important;margin-bottom:1.25em!important;">' + item.description + '</div>';
|
html += `<div class="formDialogFooterItem formDialogFooterItem-autosize fieldDescription" style="margin-top:.25em!important;margin-bottom:1.25em!important;">${item.description}</div>`;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,19 +93,18 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||||
dlg.querySelector('.formDialogFooter').classList.add('formDialogFooter-vertical');
|
dlg.querySelector('.formDialogFooter').classList.add('formDialogFooter-vertical');
|
||||||
}
|
}
|
||||||
|
|
||||||
var dialogResult;
|
let dialogResult;
|
||||||
function onButtonClick() {
|
function onButtonClick() {
|
||||||
dialogResult = this.getAttribute('data-id');
|
dialogResult = this.getAttribute('data-id');
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
var buttons = dlg.querySelectorAll('.btnOption');
|
const buttons = dlg.querySelectorAll('.btnOption');
|
||||||
for (i = 0, length = buttons.length; i < length; i++) {
|
for (i = 0, length = buttons.length; i < length; i++) {
|
||||||
buttons[i].addEventListener('click', onButtonClick);
|
buttons[i].addEventListener('click', onButtonClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
return dialogHelper.open(dlg).then(function () {
|
return dialogHelper.open(dlg).then(() => {
|
||||||
|
|
||||||
if (enableTvLayout) {
|
if (enableTvLayout) {
|
||||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||||
}
|
}
|
||||||
|
@ -113,9 +117,8 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (text, title) {
|
export async function show(text, title) {
|
||||||
|
let options;
|
||||||
var options;
|
|
||||||
if (typeof text === 'string') {
|
if (typeof text === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -125,10 +128,13 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||||
options = text;
|
options = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
const { default: template } = await import('text!./dialog.template.html');
|
||||||
require(['text!./dialog.template.html'], function (template) {
|
return new Promise((resolve, reject) => {
|
||||||
showDialog(options, template).then(resolve, reject);
|
showDialog(options, template).then(resolve, reject);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
export default {
|
||||||
|
show: show
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
|
@ -1,10 +1,17 @@
|
||||||
define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager', 'dom', 'css!./dialoghelper.css', 'scrollStyles'], function (appRouter, focusManager, browser, layoutManager, inputManager, dom) {
|
import appRouter from 'appRouter';
|
||||||
'use strict';
|
import focusManager from 'focusManager';
|
||||||
|
import browser from 'browser';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import inputManager from 'inputManager';
|
||||||
|
import dom from 'dom';
|
||||||
|
import 'css!./dialoghelper.css';
|
||||||
|
import 'scrollStyles';
|
||||||
|
|
||||||
var globalOnOpenCallback;
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
let globalOnOpenCallback;
|
||||||
|
|
||||||
function enableAnimation() {
|
function enableAnimation() {
|
||||||
|
|
||||||
// too slow
|
// too slow
|
||||||
if (browser.tv) {
|
if (browser.tv) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -14,7 +21,6 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeCenterFocus(dlg) {
|
function removeCenterFocus(dlg) {
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
if (dlg.classList.contains('scrollX')) {
|
if (dlg.classList.contains('scrollX')) {
|
||||||
centerFocus(dlg, true, false);
|
centerFocus(dlg, true, false);
|
||||||
|
@ -25,9 +31,8 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function tryRemoveElement(elem) {
|
function tryRemoveElement(elem) {
|
||||||
var parentNode = elem.parentNode;
|
const parentNode = elem.parentNode;
|
||||||
if (parentNode) {
|
if (parentNode) {
|
||||||
|
|
||||||
// Seeing crashes in edge webview
|
// Seeing crashes in edge webview
|
||||||
try {
|
try {
|
||||||
parentNode.removeChild(elem);
|
parentNode.removeChild(elem);
|
||||||
|
@ -38,15 +43,13 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function DialogHashHandler(dlg, hash, resolve) {
|
function DialogHashHandler(dlg, hash, resolve) {
|
||||||
|
const self = this;
|
||||||
var self = this;
|
|
||||||
self.originalUrl = window.location.href;
|
self.originalUrl = window.location.href;
|
||||||
var activeElement = document.activeElement;
|
const activeElement = document.activeElement;
|
||||||
var removeScrollLockOnClose = false;
|
let removeScrollLockOnClose = false;
|
||||||
|
|
||||||
function onHashChange(e) {
|
function onHashChange(e) {
|
||||||
|
const isBack = self.originalUrl === window.location.href;
|
||||||
var isBack = self.originalUrl === window.location.href;
|
|
||||||
|
|
||||||
if (isBack || !isOpened(dlg)) {
|
if (isBack || !isOpened(dlg)) {
|
||||||
window.removeEventListener('popstate', onHashChange);
|
window.removeEventListener('popstate', onHashChange);
|
||||||
|
@ -59,7 +62,6 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBackCommand(e) {
|
function onBackCommand(e) {
|
||||||
|
|
||||||
if (e.detail.command === 'back') {
|
if (e.detail.command === 'back') {
|
||||||
self.closedByBack = true;
|
self.closedByBack = true;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -69,7 +71,6 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
||||||
if (!isHistoryEnabled(dlg)) {
|
if (!isHistoryEnabled(dlg)) {
|
||||||
inputManager.off(dlg, onBackCommand);
|
inputManager.off(dlg, onBackCommand);
|
||||||
}
|
}
|
||||||
|
@ -84,9 +85,9 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self.closedByBack && isHistoryEnabled(dlg)) {
|
if (!self.closedByBack && isHistoryEnabled(dlg)) {
|
||||||
var state = history.state || {};
|
const state = window.history.state || {};
|
||||||
if (state.dialogId === hash) {
|
if (state.dialogId === hash) {
|
||||||
history.back();
|
window.history.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +98,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
if (dlg.getAttribute('data-removeonclose') !== 'false') {
|
if (dlg.getAttribute('data-removeonclose') !== 'false') {
|
||||||
removeCenterFocus(dlg);
|
removeCenterFocus(dlg);
|
||||||
|
|
||||||
var dialogContainer = dlg.dialogContainer;
|
const dialogContainer = dlg.dialogContainer;
|
||||||
if (dialogContainer) {
|
if (dialogContainer) {
|
||||||
tryRemoveElement(dialogContainer);
|
tryRemoveElement(dialogContainer);
|
||||||
dlg.dialogContainer = null;
|
dlg.dialogContainer = null;
|
||||||
|
@ -108,7 +109,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
|
|
||||||
//resolve();
|
//resolve();
|
||||||
// if we just called history.back(), then use a timeout to allow the history events to fire first
|
// if we just called history.back(), then use a timeout to allow the history events to fire first
|
||||||
setTimeout(function () {
|
setTimeout(() => {
|
||||||
resolve({
|
resolve({
|
||||||
element: dlg,
|
element: dlg,
|
||||||
closedByBack: self.closedByBack
|
closedByBack: self.closedByBack
|
||||||
|
@ -118,7 +119,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
|
|
||||||
dlg.addEventListener('close', onDialogClosed);
|
dlg.addEventListener('close', onDialogClosed);
|
||||||
|
|
||||||
var center = !dlg.classList.contains('dialog-fixedSize');
|
const center = !dlg.classList.contains('dialog-fixedSize');
|
||||||
if (center) {
|
if (center) {
|
||||||
dlg.classList.add('centeredDialog');
|
dlg.classList.add('centeredDialog');
|
||||||
}
|
}
|
||||||
|
@ -141,7 +142,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
animateDialogOpen(dlg);
|
animateDialogOpen(dlg);
|
||||||
|
|
||||||
if (isHistoryEnabled(dlg)) {
|
if (isHistoryEnabled(dlg)) {
|
||||||
appRouter.pushState({ dialogId: hash }, 'Dialog', '#' + hash);
|
appRouter.pushState({ dialogId: hash }, 'Dialog', `#${hash}`);
|
||||||
|
|
||||||
window.addEventListener('popstate', onHashChange);
|
window.addEventListener('popstate', onHashChange);
|
||||||
} else {
|
} else {
|
||||||
|
@ -150,11 +151,10 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function addBackdropOverlay(dlg) {
|
function addBackdropOverlay(dlg) {
|
||||||
|
const backdrop = document.createElement('div');
|
||||||
var backdrop = document.createElement('div');
|
|
||||||
backdrop.classList.add('dialogBackdrop');
|
backdrop.classList.add('dialogBackdrop');
|
||||||
|
|
||||||
var backdropParent = dlg.dialogContainer || dlg;
|
const backdropParent = dlg.dialogContainer || dlg;
|
||||||
backdropParent.parentNode.insertBefore(backdrop, backdropParent);
|
backdropParent.parentNode.insertBefore(backdrop, backdropParent);
|
||||||
dlg.backdrop = backdrop;
|
dlg.backdrop = backdrop;
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
void backdrop.offsetWidth;
|
void backdrop.offsetWidth;
|
||||||
backdrop.classList.add('dialogBackdropOpened');
|
backdrop.classList.add('dialogBackdropOpened');
|
||||||
|
|
||||||
dom.addEventListener((dlg.dialogContainer || backdrop), 'click', function (e) {
|
dom.addEventListener((dlg.dialogContainer || backdrop), 'click', e => {
|
||||||
if (e.target === dlg.dialogContainer) {
|
if (e.target === dlg.dialogContainer) {
|
||||||
close(dlg);
|
close(dlg);
|
||||||
}
|
}
|
||||||
|
@ -170,7 +170,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
passive: true
|
passive: true
|
||||||
});
|
});
|
||||||
|
|
||||||
dom.addEventListener((dlg.dialogContainer || backdrop), 'contextmenu', function (e) {
|
dom.addEventListener((dlg.dialogContainer || backdrop), 'contextmenu', e => {
|
||||||
if (e.target === dlg.dialogContainer) {
|
if (e.target === dlg.dialogContainer) {
|
||||||
// Close the application dialog menu
|
// Close the application dialog menu
|
||||||
close(dlg);
|
close(dlg);
|
||||||
|
@ -184,40 +184,36 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
return dlg.getAttribute('data-history') === 'true';
|
return dlg.getAttribute('data-history') === 'true';
|
||||||
}
|
}
|
||||||
|
|
||||||
function open(dlg) {
|
export function open(dlg) {
|
||||||
|
|
||||||
if (globalOnOpenCallback) {
|
if (globalOnOpenCallback) {
|
||||||
globalOnOpenCallback(dlg);
|
globalOnOpenCallback(dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = dlg.parentNode;
|
const parent = dlg.parentNode;
|
||||||
if (parent) {
|
if (parent) {
|
||||||
parent.removeChild(dlg);
|
parent.removeChild(dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
var dialogContainer = document.createElement('div');
|
const dialogContainer = document.createElement('div');
|
||||||
dialogContainer.classList.add('dialogContainer');
|
dialogContainer.classList.add('dialogContainer');
|
||||||
dialogContainer.appendChild(dlg);
|
dialogContainer.appendChild(dlg);
|
||||||
dlg.dialogContainer = dialogContainer;
|
dlg.dialogContainer = dialogContainer;
|
||||||
document.body.appendChild(dialogContainer);
|
document.body.appendChild(dialogContainer);
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise((resolve, reject) => {
|
||||||
|
new DialogHashHandler(dlg, `dlg${new Date().getTime()}`, resolve);
|
||||||
new DialogHashHandler(dlg, 'dlg' + new Date().getTime(), resolve);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function isOpened(dlg) {
|
function isOpened(dlg) {
|
||||||
|
|
||||||
//return dlg.opened;
|
//return dlg.opened;
|
||||||
return !dlg.classList.contains('hide');
|
return !dlg.classList.contains('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
function close(dlg) {
|
export function close(dlg) {
|
||||||
|
|
||||||
if (isOpened(dlg)) {
|
if (isOpened(dlg)) {
|
||||||
if (isHistoryEnabled(dlg)) {
|
if (isHistoryEnabled(dlg)) {
|
||||||
history.back();
|
window.history.back();
|
||||||
} else {
|
} else {
|
||||||
closeDialog(dlg);
|
closeDialog(dlg);
|
||||||
}
|
}
|
||||||
|
@ -225,15 +221,13 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function closeDialog(dlg) {
|
function closeDialog(dlg) {
|
||||||
|
|
||||||
if (!dlg.classList.contains('hide')) {
|
if (!dlg.classList.contains('hide')) {
|
||||||
|
|
||||||
dlg.dispatchEvent(new CustomEvent('closing', {
|
dlg.dispatchEvent(new CustomEvent('closing', {
|
||||||
bubbles: false,
|
bubbles: false,
|
||||||
cancelable: false
|
cancelable: false
|
||||||
}));
|
}));
|
||||||
|
|
||||||
var onAnimationFinish = function () {
|
const onAnimationFinish = () => {
|
||||||
focusManager.popScope(dlg);
|
focusManager.popScope(dlg);
|
||||||
|
|
||||||
dlg.classList.add('hide');
|
dlg.classList.add('hide');
|
||||||
|
@ -248,8 +242,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function animateDialogOpen(dlg) {
|
function animateDialogOpen(dlg) {
|
||||||
|
const onAnimationFinish = () => {
|
||||||
var onAnimationFinish = function () {
|
|
||||||
focusManager.pushScope(dlg);
|
focusManager.pushScope(dlg);
|
||||||
|
|
||||||
if (dlg.getAttribute('data-autofocus') === 'true') {
|
if (dlg.getAttribute('data-autofocus') === 'true') {
|
||||||
|
@ -263,8 +256,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
};
|
};
|
||||||
|
|
||||||
if (enableAnimation()) {
|
if (enableAnimation()) {
|
||||||
|
const onFinish = () => {
|
||||||
var onFinish = function () {
|
|
||||||
dom.removeEventListener(dlg, dom.whichAnimationEvent(), onFinish, {
|
dom.removeEventListener(dlg, dom.whichAnimationEvent(), onFinish, {
|
||||||
once: true
|
once: true
|
||||||
});
|
});
|
||||||
|
@ -280,27 +272,24 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function animateDialogClose(dlg, onAnimationFinish) {
|
function animateDialogClose(dlg, onAnimationFinish) {
|
||||||
|
|
||||||
if (enableAnimation()) {
|
if (enableAnimation()) {
|
||||||
|
let animated = true;
|
||||||
var animated = true;
|
|
||||||
|
|
||||||
switch (dlg.animationConfig.exit.name) {
|
switch (dlg.animationConfig.exit.name) {
|
||||||
|
|
||||||
case 'fadeout':
|
case 'fadeout':
|
||||||
dlg.style.animation = 'fadeout ' + dlg.animationConfig.exit.timing.duration + 'ms ease-out normal both';
|
dlg.style.animation = `fadeout ${dlg.animationConfig.exit.timing.duration}ms ease-out normal both`;
|
||||||
break;
|
break;
|
||||||
case 'scaledown':
|
case 'scaledown':
|
||||||
dlg.style.animation = 'scaledown ' + dlg.animationConfig.exit.timing.duration + 'ms ease-out normal both';
|
dlg.style.animation = `scaledown ${dlg.animationConfig.exit.timing.duration}ms ease-out normal both`;
|
||||||
break;
|
break;
|
||||||
case 'slidedown':
|
case 'slidedown':
|
||||||
dlg.style.animation = 'slidedown ' + dlg.animationConfig.exit.timing.duration + 'ms ease-out normal both';
|
dlg.style.animation = `slidedown ${dlg.animationConfig.exit.timing.duration}ms ease-out normal both`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
animated = false;
|
animated = false;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
var onFinish = function () {
|
const onFinish = () => {
|
||||||
dom.removeEventListener(dlg, dom.whichAnimationEvent(), onFinish, {
|
dom.removeEventListener(dlg, dom.whichAnimationEvent(), onFinish, {
|
||||||
once: true
|
once: true
|
||||||
});
|
});
|
||||||
|
@ -318,10 +307,9 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
onAnimationFinish();
|
onAnimationFinish();
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportsOverscrollBehavior = 'overscroll-behavior-y' in document.body.style;
|
const supportsOverscrollBehavior = 'overscroll-behavior-y' in document.body.style;
|
||||||
|
|
||||||
function shouldLockDocumentScroll(options) {
|
function shouldLockDocumentScroll(options) {
|
||||||
|
|
||||||
if (supportsOverscrollBehavior && (options.size || !browser.touch)) {
|
if (supportsOverscrollBehavior && (options.size || !browser.touch)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -342,8 +330,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeBackdrop(dlg) {
|
function removeBackdrop(dlg) {
|
||||||
|
const backdrop = dlg.backdrop;
|
||||||
var backdrop = dlg.backdrop;
|
|
||||||
|
|
||||||
if (!backdrop) {
|
if (!backdrop) {
|
||||||
return;
|
return;
|
||||||
|
@ -351,12 +338,11 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
|
|
||||||
dlg.backdrop = null;
|
dlg.backdrop = null;
|
||||||
|
|
||||||
var onAnimationFinish = function () {
|
const onAnimationFinish = () => {
|
||||||
tryRemoveElement(backdrop);
|
tryRemoveElement(backdrop);
|
||||||
};
|
};
|
||||||
|
|
||||||
if (enableAnimation()) {
|
if (enableAnimation()) {
|
||||||
|
|
||||||
backdrop.classList.remove('dialogBackdropOpened');
|
backdrop.classList.remove('dialogBackdropOpened');
|
||||||
|
|
||||||
// this is not firing animatonend
|
// this is not firing animatonend
|
||||||
|
@ -368,20 +354,19 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
function centerFocus(elem, horiz, on) {
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
import('scrollHelper').then((scrollHelper) => {
|
||||||
var fn = on ? 'on' : 'off';
|
const fn = on ? 'on' : 'off';
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDialog(options) {
|
export function createDialog(options) {
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
// If there's no native dialog support, use a plain div
|
// If there's no native dialog support, use a plain div
|
||||||
// Also not working well in samsung tizen browser, content inside not clickable
|
// Also not working well in samsung tizen browser, content inside not clickable
|
||||||
// Just go ahead and always use a plain div because we're seeing issues overlaying absoltutely positioned content over a modal dialog
|
// Just go ahead and always use a plain div because we're seeing issues overlaying absoltutely positioned content over a modal dialog
|
||||||
var dlg = document.createElement('div');
|
const dlg = document.createElement('div');
|
||||||
|
|
||||||
dlg.classList.add('focuscontainer');
|
dlg.classList.add('focuscontainer');
|
||||||
dlg.classList.add('hide');
|
dlg.classList.add('hide');
|
||||||
|
@ -390,7 +375,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
dlg.setAttribute('data-lockscroll', 'true');
|
dlg.setAttribute('data-lockscroll', 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.enableHistory !== false && appRouter.enableNativeHistory()) {
|
if (options.enableHistory === true) {
|
||||||
dlg.setAttribute('data-history', 'true');
|
dlg.setAttribute('data-history', 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -406,17 +391,14 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
dlg.setAttribute('data-autofocus', 'true');
|
dlg.setAttribute('data-autofocus', 'true');
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultEntryAnimation;
|
const defaultEntryAnimation = 'scaleup';
|
||||||
var defaultExitAnimation;
|
const defaultExitAnimation = 'scaledown';
|
||||||
|
const entryAnimation = options.entryAnimation || defaultEntryAnimation;
|
||||||
defaultEntryAnimation = 'scaleup';
|
const exitAnimation = options.exitAnimation || defaultExitAnimation;
|
||||||
defaultExitAnimation = 'scaledown';
|
|
||||||
var entryAnimation = options.entryAnimation || defaultEntryAnimation;
|
|
||||||
var exitAnimation = options.exitAnimation || defaultExitAnimation;
|
|
||||||
|
|
||||||
// If it's not fullscreen then lower the default animation speed to make it open really fast
|
// If it's not fullscreen then lower the default animation speed to make it open really fast
|
||||||
var entryAnimationDuration = options.entryAnimationDuration || (options.size !== 'fullscreen' ? 180 : 280);
|
const entryAnimationDuration = options.entryAnimationDuration || (options.size !== 'fullscreen' ? 180 : 280);
|
||||||
var exitAnimationDuration = options.exitAnimationDuration || (options.size !== 'fullscreen' ? 120 : 220);
|
const exitAnimationDuration = options.exitAnimationDuration || (options.size !== 'fullscreen' ? 120 : 220);
|
||||||
|
|
||||||
dlg.animationConfig = {
|
dlg.animationConfig = {
|
||||||
// scale up
|
// scale up
|
||||||
|
@ -461,24 +443,22 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
|
|
||||||
if (options.size) {
|
if (options.size) {
|
||||||
dlg.classList.add('dialog-fixedSize');
|
dlg.classList.add('dialog-fixedSize');
|
||||||
dlg.classList.add('dialog-' + options.size);
|
dlg.classList.add(`dialog-${options.size}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableAnimation()) {
|
if (enableAnimation()) {
|
||||||
|
|
||||||
switch (dlg.animationConfig.entry.name) {
|
switch (dlg.animationConfig.entry.name) {
|
||||||
|
|
||||||
case 'fadein':
|
case 'fadein':
|
||||||
dlg.style.animation = 'fadein ' + entryAnimationDuration + 'ms ease-out normal';
|
dlg.style.animation = `fadein ${entryAnimationDuration}ms ease-out normal`;
|
||||||
break;
|
break;
|
||||||
case 'scaleup':
|
case 'scaleup':
|
||||||
dlg.style.animation = 'scaleup ' + entryAnimationDuration + 'ms ease-out normal both';
|
dlg.style.animation = `scaleup ${entryAnimationDuration}ms ease-out normal both`;
|
||||||
break;
|
break;
|
||||||
case 'slideup':
|
case 'slideup':
|
||||||
dlg.style.animation = 'slideup ' + entryAnimationDuration + 'ms ease-out normal';
|
dlg.style.animation = `slideup ${entryAnimationDuration}ms ease-out normal`;
|
||||||
break;
|
break;
|
||||||
case 'slidedown':
|
case 'slidedown':
|
||||||
dlg.style.animation = 'slidedown ' + entryAnimationDuration + 'ms ease-out normal';
|
dlg.style.animation = `slidedown ${entryAnimationDuration}ms ease-out normal`;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -488,12 +468,15 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
return dlg;
|
return dlg;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export function setOnOpen(val) {
|
||||||
|
globalOnOpenCallback = val;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
||||||
|
export default {
|
||||||
open: open,
|
open: open,
|
||||||
close: close,
|
close: close,
|
||||||
createDialog: createDialog,
|
createDialog: createDialog,
|
||||||
setOnOpen: function (val) {
|
setOnOpen: setOnOpen
|
||||||
globalOnOpenCallback = val;
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-input', 'paper-icon-button-light', 'css!./directorybrowser', 'formDialogStyle', 'emby-button'], function(loading, dialogHelper, dom, globalize) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import dialogHelper from 'dialogHelper';
|
||||||
|
import dom from 'dom';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'listViewStyle';
|
||||||
|
import 'emby-input';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'css!./directorybrowser';
|
||||||
|
import 'formDialogStyle';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function getSystemInfo() {
|
function getSystemInfo() {
|
||||||
return systemInfo ? Promise.resolve(systemInfo) : ApiClient.getPublicSystemInfo().then(
|
return systemInfo ? Promise.resolve(systemInfo) : ApiClient.getPublicSystemInfo().then(
|
||||||
function(info) {
|
info => {
|
||||||
systemInfo = info;
|
systemInfo = info;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
@ -21,9 +31,9 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var promises = [];
|
const promises = [];
|
||||||
|
|
||||||
if ('Network' === path) {
|
if (path === 'Network') {
|
||||||
promises.push(ApiClient.getNetworkDevices());
|
promises.push(ApiClient.getNetworkDevices());
|
||||||
} else {
|
} else {
|
||||||
if (path) {
|
if (path) {
|
||||||
|
@ -35,10 +45,10 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(promises).then(
|
Promise.all(promises).then(
|
||||||
function(responses) {
|
responses => {
|
||||||
var folders = responses[0];
|
const folders = responses[0];
|
||||||
var parentPath = responses[1] || '';
|
const parentPath = responses[1] || '';
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
page.querySelector('.results').scrollTop = 0;
|
page.querySelector('.results').scrollTop = 0;
|
||||||
page.querySelector('#txtDirectoryPickerPath').value = path || '';
|
page.querySelector('#txtDirectoryPickerPath').value = path || '';
|
||||||
|
@ -46,9 +56,9 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
if (path) {
|
if (path) {
|
||||||
html += getItem('lnkPath lnkDirectory', '', parentPath, '...');
|
html += getItem('lnkPath lnkDirectory', '', parentPath, '...');
|
||||||
}
|
}
|
||||||
for (var i = 0, length = folders.length; i < length; i++) {
|
for (let i = 0, length = folders.length; i < length; i++) {
|
||||||
var folder = folders[i];
|
const folder = folders[i];
|
||||||
var cssClass = 'File' === folder.Type ? 'lnkPath lnkFile' : 'lnkPath lnkDirectory';
|
const cssClass = folder.Type === 'File' ? 'lnkPath lnkFile' : 'lnkPath lnkDirectory';
|
||||||
html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
|
html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -58,7 +68,7 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
|
|
||||||
page.querySelector('.results').innerHTML = html;
|
page.querySelector('.results').innerHTML = html;
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}, function() {
|
}, () => {
|
||||||
if (updatePathOnError) {
|
if (updatePathOnError) {
|
||||||
page.querySelector('#txtDirectoryPickerPath').value = '';
|
page.querySelector('#txtDirectoryPickerPath').value = '';
|
||||||
page.querySelector('.results').innerHTML = '';
|
page.querySelector('.results').innerHTML = '';
|
||||||
|
@ -69,8 +79,8 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItem(cssClass, type, path, name) {
|
function getItem(cssClass, type, path, name) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="listItem listItem-border ' + cssClass + '" data-type="' + type + '" data-path="' + path + '">';
|
html += `<div class="listItem listItem-border ${cssClass}" data-type="${type}" data-path="${path}">`;
|
||||||
html += '<div class="listItemBody" style="padding-left:0;padding-top:.5em;padding-bottom:.5em;">';
|
html += '<div class="listItemBody" style="padding-left:0;padding-top:.5em;padding-bottom:.5em;">';
|
||||||
html += '<div class="listItemBodyText">';
|
html += '<div class="listItemBodyText">';
|
||||||
html += name;
|
html += name;
|
||||||
|
@ -82,19 +92,19 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditorHtml(options, systemInfo) {
|
function getEditorHtml(options, systemInfo) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="formDialogContent scrollY">';
|
html += '<div class="formDialogContent scrollY">';
|
||||||
html += '<div class="dialogContentInner dialog-content-centered" style="padding-top:2em;">';
|
html += '<div class="dialogContentInner dialog-content-centered" style="padding-top:2em;">';
|
||||||
if (!options.pathReadOnly) {
|
if (!options.pathReadOnly) {
|
||||||
var instruction = options.instruction ? options.instruction + '<br/><br/>' : '';
|
const instruction = options.instruction ? `${options.instruction}<br/><br/>` : '';
|
||||||
html += '<div class="infoBanner" style="margin-bottom:1.5em;">';
|
html += '<div class="infoBanner" style="margin-bottom:1.5em;">';
|
||||||
html += instruction;
|
html += instruction;
|
||||||
if ('bsd' === systemInfo.OperatingSystem.toLowerCase()) {
|
if (systemInfo.OperatingSystem.toLowerCase() === 'bsd') {
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
html += globalize.translate('MessageDirectoryPickerBSDInstruction');
|
html += globalize.translate('MessageDirectoryPickerBSDInstruction');
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
} else if ('linux' === systemInfo.OperatingSystem.toLowerCase()) {
|
} else if (systemInfo.OperatingSystem.toLowerCase() === 'linux') {
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
html += '<br/>';
|
html += '<br/>';
|
||||||
html += globalize.translate('MessageDirectoryPickerLinuxInstruction');
|
html += globalize.translate('MessageDirectoryPickerLinuxInstruction');
|
||||||
|
@ -105,17 +115,17 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
html += '<form style="margin:auto;">';
|
html += '<form style="margin:auto;">';
|
||||||
html += '<div class="inputContainer" style="display: flex; align-items: center;">';
|
html += '<div class="inputContainer" style="display: flex; align-items: center;">';
|
||||||
html += '<div style="flex-grow:1;">';
|
html += '<div style="flex-grow:1;">';
|
||||||
var labelKey;
|
let labelKey;
|
||||||
if (options.includeFiles !== true) {
|
if (options.includeFiles !== true) {
|
||||||
labelKey = 'LabelFolder';
|
labelKey = 'LabelFolder';
|
||||||
} else {
|
} else {
|
||||||
labelKey = 'LabelPath';
|
labelKey = 'LabelPath';
|
||||||
}
|
}
|
||||||
var readOnlyAttribute = options.pathReadOnly ? ' readonly' : '';
|
const readOnlyAttribute = options.pathReadOnly ? ' readonly' : '';
|
||||||
html += '<input is="emby-input" id="txtDirectoryPickerPath" type="text" required="required" ' + readOnlyAttribute + ' label="' + globalize.translate(labelKey) + '"/>';
|
html += `<input is="emby-input" id="txtDirectoryPickerPath" type="text" required="required" ${readOnlyAttribute} label="${globalize.translate(labelKey)}"/>`;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
if (!readOnlyAttribute) {
|
if (!readOnlyAttribute) {
|
||||||
html += '<button type="button" is="paper-icon-button-light" class="btnRefreshDirectories emby-input-iconbutton" title="' + globalize.translate('ButtonRefresh') + '"><span class="material-icons search"></span></button>';
|
html += `<button type="button" is="paper-icon-button-light" class="btnRefreshDirectories emby-input-iconbutton" title="${globalize.translate('Refresh')}"><span class="material-icons search"></span></button>`;
|
||||||
}
|
}
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
if (!readOnlyAttribute) {
|
if (!readOnlyAttribute) {
|
||||||
|
@ -123,14 +133,14 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
}
|
}
|
||||||
if (options.enableNetworkSharePath) {
|
if (options.enableNetworkSharePath) {
|
||||||
html += '<div class="inputContainer" style="margin-top:2em;">';
|
html += '<div class="inputContainer" style="margin-top:2em;">';
|
||||||
html += '<input is="emby-input" id="txtNetworkPath" type="text" label="' + globalize.translate('LabelOptionalNetworkPath') + '"/>';
|
html += `<input is="emby-input" id="txtNetworkPath" type="text" label="${globalize.translate('LabelOptionalNetworkPath')}"/>`;
|
||||||
html += '<div class="fieldDescription">';
|
html += '<div class="fieldDescription">';
|
||||||
html += globalize.translate('LabelOptionalNetworkPathHelp', '<b>\\\\server</b>', '<b>\\\\192.168.1.101</b>');
|
html += globalize.translate('LabelOptionalNetworkPathHelp', '<b>\\\\server</b>', '<b>\\\\192.168.1.101</b>');
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
html += '<div class="formDialogFooter">';
|
html += '<div class="formDialogFooter">';
|
||||||
html += '<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">' + globalize.translate('ButtonOk') + '</button>';
|
html += `<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">${globalize.translate('ButtonOk')}</button>`;
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</form>';
|
html += '</form>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
@ -147,7 +157,7 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function alertTextWithOptions(options) {
|
function alertTextWithOptions(options) {
|
||||||
require(['alert'], function(alert) {
|
import('alert').then(({default: alert}) => {
|
||||||
alert(options);
|
alert(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -156,11 +166,12 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
return apiClient.ajax({
|
return apiClient.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: apiClient.getUrl('Environment/ValidatePath'),
|
url: apiClient.getUrl('Environment/ValidatePath'),
|
||||||
data: {
|
data: JSON.stringify({
|
||||||
ValidateWriteable: validateWriteable,
|
ValidateWriteable: validateWriteable,
|
||||||
Path: path
|
Path: path
|
||||||
}
|
}),
|
||||||
}).catch(function(response) {
|
contentType: 'application/json'
|
||||||
|
}).catch(response => {
|
||||||
if (response) {
|
if (response) {
|
||||||
if (response.status === 404) {
|
if (response.status === 404) {
|
||||||
alertText(globalize.translate('PathNotFound'));
|
alertText(globalize.translate('PathNotFound'));
|
||||||
|
@ -180,10 +191,10 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(content, options, fileOptions) {
|
function initEditor(content, options, fileOptions) {
|
||||||
content.addEventListener('click', function(e) {
|
content.addEventListener('click', e => {
|
||||||
var lnkPath = dom.parentWithClass(e.target, 'lnkPath');
|
const lnkPath = dom.parentWithClass(e.target, 'lnkPath');
|
||||||
if (lnkPath) {
|
if (lnkPath) {
|
||||||
var path = lnkPath.getAttribute('data-path');
|
const path = lnkPath.getAttribute('data-path');
|
||||||
if (lnkPath.classList.contains('lnkFile')) {
|
if (lnkPath.classList.contains('lnkFile')) {
|
||||||
content.querySelector('#txtDirectoryPickerPath').value = path;
|
content.querySelector('#txtDirectoryPickerPath').value = path;
|
||||||
} else {
|
} else {
|
||||||
|
@ -192,25 +203,25 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
content.addEventListener('click', function(e) {
|
content.addEventListener('click', e => {
|
||||||
if (dom.parentWithClass(e.target, 'btnRefreshDirectories')) {
|
if (dom.parentWithClass(e.target, 'btnRefreshDirectories')) {
|
||||||
var path = content.querySelector('#txtDirectoryPickerPath').value;
|
const path = content.querySelector('#txtDirectoryPickerPath').value;
|
||||||
refreshDirectoryBrowser(content, path, fileOptions);
|
refreshDirectoryBrowser(content, path, fileOptions);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
content.addEventListener('change', function(e) {
|
content.addEventListener('change', e => {
|
||||||
var txtDirectoryPickerPath = dom.parentWithTag(e.target, 'INPUT');
|
const txtDirectoryPickerPath = dom.parentWithTag(e.target, 'INPUT');
|
||||||
if (txtDirectoryPickerPath && 'txtDirectoryPickerPath' === txtDirectoryPickerPath.id) {
|
if (txtDirectoryPickerPath && txtDirectoryPickerPath.id === 'txtDirectoryPickerPath') {
|
||||||
refreshDirectoryBrowser(content, txtDirectoryPickerPath.value, fileOptions);
|
refreshDirectoryBrowser(content, txtDirectoryPickerPath.value, fileOptions);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
content.querySelector('form').addEventListener('submit', function(e) {
|
content.querySelector('form').addEventListener('submit', function(e) {
|
||||||
if (options.callback) {
|
if (options.callback) {
|
||||||
var networkSharePath = this.querySelector('#txtNetworkPath');
|
let networkSharePath = this.querySelector('#txtNetworkPath');
|
||||||
networkSharePath = networkSharePath ? networkSharePath.value : null;
|
networkSharePath = networkSharePath ? networkSharePath.value : null;
|
||||||
var path = this.querySelector('#txtDirectoryPickerPath').value;
|
const path = this.querySelector('#txtDirectoryPickerPath').value;
|
||||||
validatePath(path, options.validateWriteable, ApiClient).then(options.callback(path, networkSharePath));
|
validatePath(path, options.validateWriteable, ApiClient).then(options.callback(path, networkSharePath));
|
||||||
}
|
}
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -224,21 +235,21 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
return Promise.resolve(options.path);
|
return Promise.resolve(options.path);
|
||||||
} else {
|
} else {
|
||||||
return ApiClient.getJSON(ApiClient.getUrl('Environment/DefaultDirectoryBrowser')).then(
|
return ApiClient.getJSON(ApiClient.getUrl('Environment/DefaultDirectoryBrowser')).then(
|
||||||
function(result) {
|
result => {
|
||||||
return result.Path || '';
|
return result.Path || '';
|
||||||
}, function() {
|
}, () => {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function directoryBrowser() {
|
class directoryBrowser {
|
||||||
var currentDialog;
|
constructor() {
|
||||||
var self = this;
|
let currentDialog;
|
||||||
self.show = function(options) {
|
this.show = options => {
|
||||||
options = options || {};
|
options = options || {};
|
||||||
var fileOptions = {
|
const fileOptions = {
|
||||||
includeDirectories: true
|
includeDirectories: true
|
||||||
};
|
};
|
||||||
if (options.includeDirectories != null) {
|
if (options.includeDirectories != null) {
|
||||||
|
@ -248,10 +259,10 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
fileOptions.includeFiles = options.includeFiles;
|
fileOptions.includeFiles = options.includeFiles;
|
||||||
}
|
}
|
||||||
Promise.all([getSystemInfo(), getDefaultPath(options)]).then(
|
Promise.all([getSystemInfo(), getDefaultPath(options)]).then(
|
||||||
function(responses) {
|
responses => {
|
||||||
var systemInfo = responses[0];
|
const systemInfo = responses[0];
|
||||||
var initialPath = responses[1];
|
const initialPath = responses[1];
|
||||||
var dlg = dialogHelper.createDialog({
|
const dlg = dialogHelper.createDialog({
|
||||||
size: 'small',
|
size: 'small',
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
|
@ -261,7 +272,7 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
dlg.classList.add('directoryPicker');
|
dlg.classList.add('directoryPicker');
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="formDialogHeader">';
|
html += '<div class="formDialogHeader">';
|
||||||
html += '<button is="paper-icon-button-light" class="btnCloseDialog autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
html += '<button is="paper-icon-button-light" class="btnCloseDialog autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||||
html += '<h3 class="formDialogHeaderTitle">';
|
html += '<h3 class="formDialogHeaderTitle">';
|
||||||
|
@ -273,12 +284,12 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
initEditor(dlg, options, fileOptions);
|
initEditor(dlg, options, fileOptions);
|
||||||
dlg.addEventListener('close', onDialogClosed);
|
dlg.addEventListener('close', onDialogClosed);
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
dlg.querySelector('.btnCloseDialog').addEventListener('click', function() {
|
dlg.querySelector('.btnCloseDialog').addEventListener('click', () => {
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
currentDialog = dlg;
|
currentDialog = dlg;
|
||||||
dlg.querySelector('#txtDirectoryPickerPath').value = initialPath;
|
dlg.querySelector('#txtDirectoryPickerPath').value = initialPath;
|
||||||
var txtNetworkPath = dlg.querySelector('#txtNetworkPath');
|
const txtNetworkPath = dlg.querySelector('#txtNetworkPath');
|
||||||
if (txtNetworkPath) {
|
if (txtNetworkPath) {
|
||||||
txtNetworkPath.value = options.networkSharePath || '';
|
txtNetworkPath.value = options.networkSharePath || '';
|
||||||
}
|
}
|
||||||
|
@ -288,13 +299,15 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
self.close = function() {
|
this.close = () => {
|
||||||
if (currentDialog) {
|
if (currentDialog) {
|
||||||
dialogHelper.close(currentDialog);
|
dialogHelper.close(currentDialog);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var systemInfo;
|
let systemInfo;
|
||||||
return directoryBrowser;
|
|
||||||
});
|
/* eslint-enable indent */
|
||||||
|
export default directoryBrowser;
|
||||||
|
|
|
@ -1,22 +1,40 @@
|
||||||
define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', 'apphost', 'focusManager', 'datetime', 'globalize', 'loading', 'connectionManager', 'skinManager', 'dom', 'events', 'emby-select', 'emby-checkbox', 'emby-button'], function (require, browser, layoutManager, appSettings, pluginManager, appHost, focusManager, datetime, globalize, loading, connectionManager, skinManager, dom, events) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import layoutManager from 'layoutManager';
|
||||||
|
import pluginManager from 'pluginManager';
|
||||||
|
import appHost from 'apphost';
|
||||||
|
import focusManager from 'focusManager';
|
||||||
|
import datetime from 'datetime';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import loading from 'loading';
|
||||||
|
import skinManager from 'skinManager';
|
||||||
|
import events from 'events';
|
||||||
|
import 'emby-select';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
function fillThemes(select, isDashboard) {
|
/* eslint-disable indent */
|
||||||
select.innerHTML = skinManager.getThemes().map(function (t) {
|
|
||||||
var value = t.id;
|
|
||||||
if (t.isDefault && !isDashboard) {
|
|
||||||
value = '';
|
|
||||||
} else if (t.isDefaultServerDashboard && isDashboard) {
|
|
||||||
value = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
return '<option value="' + value + '">' + t.name + '</option>';
|
function fillThemes(context, userSettings) {
|
||||||
|
const select = context.querySelector('#selectTheme');
|
||||||
|
|
||||||
|
skinManager.getThemes().then(themes => {
|
||||||
|
select.innerHTML = themes.map(t => {
|
||||||
|
return `<option value="${t.id}">${t.name}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
|
// get default theme
|
||||||
|
const defaultTheme = themes.find(theme => {
|
||||||
|
return theme.default;
|
||||||
|
});
|
||||||
|
|
||||||
|
// set the current theme
|
||||||
|
select.value = userSettings.theme() || defaultTheme.id;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadScreensavers(context, userSettings) {
|
function loadScreensavers(context, userSettings) {
|
||||||
var selectScreensaver = context.querySelector('.selectScreensaver');
|
const selectScreensaver = context.querySelector('.selectScreensaver');
|
||||||
var options = pluginManager.ofType('screensaver').map(function (plugin) {
|
const options = pluginManager.ofType('screensaver').map(plugin => {
|
||||||
return {
|
return {
|
||||||
name: plugin.name,
|
name: plugin.name,
|
||||||
value: plugin.id
|
value: plugin.id
|
||||||
|
@ -28,9 +46,10 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
value: 'none'
|
value: 'none'
|
||||||
});
|
});
|
||||||
|
|
||||||
selectScreensaver.innerHTML = options.map(function (o) {
|
selectScreensaver.innerHTML = options.map(o => {
|
||||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
return `<option value="${o.value}">${o.name}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
selectScreensaver.value = userSettings.screensaver();
|
selectScreensaver.value = userSettings.screensaver();
|
||||||
|
|
||||||
if (!selectScreensaver.value) {
|
if (!selectScreensaver.value) {
|
||||||
|
@ -39,61 +58,7 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSoundEffects(context, userSettings) {
|
function showOrHideMissingEpisodesField(context) {
|
||||||
|
|
||||||
var selectSoundEffects = context.querySelector('.selectSoundEffects');
|
|
||||||
var options = pluginManager.ofType('soundeffects').map(function (plugin) {
|
|
||||||
return {
|
|
||||||
name: plugin.name,
|
|
||||||
value: plugin.id
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
options.unshift({
|
|
||||||
name: globalize.translate('None'),
|
|
||||||
value: 'none'
|
|
||||||
});
|
|
||||||
|
|
||||||
selectSoundEffects.innerHTML = options.map(function (o) {
|
|
||||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
|
||||||
}).join('');
|
|
||||||
selectSoundEffects.value = userSettings.soundEffects();
|
|
||||||
|
|
||||||
if (!selectSoundEffects.value) {
|
|
||||||
// TODO: set the default instead of none
|
|
||||||
selectSoundEffects.value = 'none';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadSkins(context, userSettings) {
|
|
||||||
|
|
||||||
var selectSkin = context.querySelector('.selectSkin');
|
|
||||||
|
|
||||||
var options = pluginManager.ofType('skin').map(function (plugin) {
|
|
||||||
return {
|
|
||||||
name: plugin.name,
|
|
||||||
value: plugin.id
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
||||||
selectSkin.innerHTML = options.map(function (o) {
|
|
||||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
|
||||||
}).join('');
|
|
||||||
selectSkin.value = userSettings.skin();
|
|
||||||
|
|
||||||
if (!selectSkin.value && options.length) {
|
|
||||||
selectSkin.value = options[0].value;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (options.length > 1 && appHost.supports('skins')) {
|
|
||||||
context.querySelector('.selectSkinContainer').classList.remove('hide');
|
|
||||||
} else {
|
|
||||||
context.querySelector('.selectSkinContainer').classList.add('hide');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showOrHideMissingEpisodesField(context, user, apiClient) {
|
|
||||||
|
|
||||||
if (browser.tizen || browser.web0s) {
|
if (browser.tizen || browser.web0s) {
|
||||||
context.querySelector('.fldDisplayMissingEpisodes').classList.add('hide');
|
context.querySelector('.fldDisplayMissingEpisodes').classList.add('hide');
|
||||||
return;
|
return;
|
||||||
|
@ -102,17 +67,7 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
context.querySelector('.fldDisplayMissingEpisodes').classList.remove('hide');
|
context.querySelector('.fldDisplayMissingEpisodes').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadForm(context, user, userSettings, apiClient) {
|
function loadForm(context, user, userSettings) {
|
||||||
|
|
||||||
var loggedInUserId = apiClient.getCurrentUserId();
|
|
||||||
var userId = user.Id;
|
|
||||||
|
|
||||||
if (user.Policy.IsAdministrator) {
|
|
||||||
context.querySelector('.selectDashboardThemeContainer').classList.remove('hide');
|
|
||||||
} else {
|
|
||||||
context.querySelector('.selectDashboardThemeContainer').classList.add('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (appHost.supports('displaylanguage')) {
|
if (appHost.supports('displaylanguage')) {
|
||||||
context.querySelector('.languageSection').classList.remove('hide');
|
context.querySelector('.languageSection').classList.remove('hide');
|
||||||
} else {
|
} else {
|
||||||
|
@ -131,18 +86,6 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
context.querySelector('.learnHowToContributeContainer').classList.add('hide');
|
context.querySelector('.learnHowToContributeContainer').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (appHost.supports('runatstartup')) {
|
|
||||||
context.querySelector('.fldAutorun').classList.remove('hide');
|
|
||||||
} else {
|
|
||||||
context.querySelector('.fldAutorun').classList.add('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (appHost.supports('soundeffects')) {
|
|
||||||
context.querySelector('.fldSoundEffects').classList.remove('hide');
|
|
||||||
} else {
|
|
||||||
context.querySelector('.fldSoundEffects').classList.add('hide');
|
|
||||||
}
|
|
||||||
|
|
||||||
if (appHost.supports('screensaver')) {
|
if (appHost.supports('screensaver')) {
|
||||||
context.querySelector('.selectScreensaverContainer').classList.remove('hide');
|
context.querySelector('.selectScreensaverContainer').classList.remove('hide');
|
||||||
} else {
|
} else {
|
||||||
|
@ -165,16 +108,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
context.querySelector('.fldThemeVideo').classList.add('hide');
|
context.querySelector('.fldThemeVideo').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
context.querySelector('.chkRunAtStartup').checked = appSettings.runAtStartup();
|
fillThemes(context, userSettings);
|
||||||
|
|
||||||
var selectTheme = context.querySelector('#selectTheme');
|
|
||||||
var selectDashboardTheme = context.querySelector('#selectDashboardTheme');
|
|
||||||
|
|
||||||
fillThemes(selectTheme);
|
|
||||||
fillThemes(selectDashboardTheme, true);
|
|
||||||
loadScreensavers(context, userSettings);
|
loadScreensavers(context, userSettings);
|
||||||
loadSoundEffects(context, userSettings);
|
|
||||||
loadSkins(context, userSettings);
|
|
||||||
|
|
||||||
context.querySelector('.chkDisplayMissingEpisodes').checked = user.Configuration.DisplayMissingEpisodes || false;
|
context.querySelector('.chkDisplayMissingEpisodes').checked = user.Configuration.DisplayMissingEpisodes || false;
|
||||||
|
|
||||||
|
@ -190,20 +125,14 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
|
|
||||||
context.querySelector('#txtLibraryPageSize').value = userSettings.libraryPageSize();
|
context.querySelector('#txtLibraryPageSize').value = userSettings.libraryPageSize();
|
||||||
|
|
||||||
selectDashboardTheme.value = userSettings.dashboardTheme() || '';
|
|
||||||
selectTheme.value = userSettings.theme() || '';
|
|
||||||
|
|
||||||
context.querySelector('.selectLayout').value = layoutManager.getSavedLayout() || '';
|
context.querySelector('.selectLayout').value = layoutManager.getSavedLayout() || '';
|
||||||
|
|
||||||
showOrHideMissingEpisodesField(context, user, apiClient);
|
showOrHideMissingEpisodesField(context);
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveUser(context, user, userSettingsInstance, apiClient) {
|
function saveUser(context, user, userSettingsInstance, apiClient) {
|
||||||
|
|
||||||
appSettings.runAtStartup(context.querySelector('.chkRunAtStartup').checked);
|
|
||||||
|
|
||||||
user.Configuration.DisplayMissingEpisodes = context.querySelector('.chkDisplayMissingEpisodes').checked;
|
user.Configuration.DisplayMissingEpisodes = context.querySelector('.chkDisplayMissingEpisodes').checked;
|
||||||
|
|
||||||
if (appHost.supports('displaylanguage')) {
|
if (appHost.supports('displaylanguage')) {
|
||||||
|
@ -214,15 +143,11 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
|
|
||||||
userSettingsInstance.enableThemeSongs(context.querySelector('#chkThemeSong').checked);
|
userSettingsInstance.enableThemeSongs(context.querySelector('#chkThemeSong').checked);
|
||||||
userSettingsInstance.enableThemeVideos(context.querySelector('#chkThemeVideo').checked);
|
userSettingsInstance.enableThemeVideos(context.querySelector('#chkThemeVideo').checked);
|
||||||
userSettingsInstance.dashboardTheme(context.querySelector('#selectDashboardTheme').value);
|
|
||||||
userSettingsInstance.theme(context.querySelector('#selectTheme').value);
|
userSettingsInstance.theme(context.querySelector('#selectTheme').value);
|
||||||
userSettingsInstance.soundEffects(context.querySelector('.selectSoundEffects').value);
|
|
||||||
userSettingsInstance.screensaver(context.querySelector('.selectScreensaver').value);
|
userSettingsInstance.screensaver(context.querySelector('.selectScreensaver').value);
|
||||||
|
|
||||||
userSettingsInstance.libraryPageSize(context.querySelector('#txtLibraryPageSize').value);
|
userSettingsInstance.libraryPageSize(context.querySelector('#txtLibraryPageSize').value);
|
||||||
|
|
||||||
userSettingsInstance.skin(context.querySelector('.selectSkin').value);
|
|
||||||
|
|
||||||
userSettingsInstance.enableFastFadein(context.querySelector('#chkFadein').checked);
|
userSettingsInstance.enableFastFadein(context.querySelector('#chkFadein').checked);
|
||||||
userSettingsInstance.enableBlurhash(context.querySelector('#chkBlurhash').checked);
|
userSettingsInstance.enableBlurhash(context.querySelector('#chkBlurhash').checked);
|
||||||
userSettingsInstance.enableBackdrops(context.querySelector('#chkBackdrops').checked);
|
userSettingsInstance.enableBackdrops(context.querySelector('#chkBackdrops').checked);
|
||||||
|
@ -239,29 +164,29 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
apiClient.getUser(userId).then(function (user) {
|
apiClient.getUser(userId).then(user => {
|
||||||
saveUser(context, user, userSettings, apiClient).then(function () {
|
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
if (enableSaveConfirmation) {
|
if (enableSaveConfirmation) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
events.trigger(instance, 'saved');
|
events.trigger(instance, 'saved');
|
||||||
}, function () {
|
}, () => {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
var self = this;
|
const self = this;
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
var userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
var userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||||
var enableSaveConfirmation = self.options.enableSaveConfirmation;
|
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -272,50 +197,51 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function embed(options, self) {
|
async function embed(options, self) {
|
||||||
require(['text!./displaySettings.template.html'], function (template) {
|
const { default: template } = await import('text!./displaySettings.template.html');
|
||||||
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
options.element.innerHTML = globalize.translateHtml(template, 'core');
|
||||||
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
||||||
if (options.enableSaveButton) {
|
if (options.enableSaveButton) {
|
||||||
options.element.querySelector('.btnSave').classList.remove('hide');
|
options.element.querySelector('.btnSave').classList.remove('hide');
|
||||||
}
|
}
|
||||||
self.loadData(options.autoFocus);
|
self.loadData(options.autoFocus);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DisplaySettings(options) {
|
class DisplaySettings {
|
||||||
|
constructor(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
embed(options, this);
|
embed(options, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplaySettings.prototype.loadData = function (autoFocus) {
|
loadData(autoFocus) {
|
||||||
var self = this;
|
const self = this;
|
||||||
var context = self.options.element;
|
const context = self.options.element;
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
var userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
return apiClient.getUser(userId).then(function (user) {
|
return apiClient.getUser(userId).then(user => {
|
||||||
return userSettings.setUserInfo(userId, apiClient).then(function () {
|
return userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||||
self.dataLoaded = true;
|
self.dataLoaded = true;
|
||||||
loadForm(context, user, userSettings, apiClient);
|
loadForm(context, user, userSettings);
|
||||||
if (autoFocus) {
|
if (autoFocus) {
|
||||||
focusManager.autoFocus(context);
|
focusManager.autoFocus(context);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
DisplaySettings.prototype.submit = function () {
|
submit() {
|
||||||
onSubmit.call(this);
|
onSubmit.call(this);
|
||||||
};
|
}
|
||||||
|
|
||||||
DisplaySettings.prototype.destroy = function () {
|
destroy() {
|
||||||
this.options = null;
|
this.options = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return DisplaySettings;
|
/* eslint-enable indent */
|
||||||
});
|
export default DisplaySettings;
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
<form style="margin: 0 auto;">
|
<form style="margin: 0 auto;">
|
||||||
|
|
||||||
<h2 class="sectionTitle">
|
<h2 class="sectionTitle">
|
||||||
${Display}
|
${Display}
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -123,26 +122,14 @@
|
||||||
<div class="fieldDescription">${LabelPleaseRestart}</div>
|
<div class="fieldDescription">${LabelPleaseRestart}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="selectContainer hide selectSkinContainer">
|
|
||||||
<select is="emby-select" class="selectSkin" label="${LabelSkin}"></select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="selectContainer">
|
<div class="selectContainer">
|
||||||
<select id="selectTheme" is="emby-select" label="${LabelTheme}"></select>
|
<select id="selectTheme" is="emby-select" label="${LabelTheme}"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="selectContainer selectDashboardThemeContainer hide">
|
|
||||||
<select id="selectDashboardTheme" is="emby-select" label="${LabelDashboardTheme}"></select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="selectContainer hide selectScreensaverContainer">
|
<div class="selectContainer hide selectScreensaverContainer">
|
||||||
<select is="emby-select" class="selectScreensaver" label="${LabelScreensaver}"></select>
|
<select is="emby-select" class="selectScreensaver" label="${LabelScreensaver}"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="selectContainer fldSoundEffects hide">
|
|
||||||
<select is="emby-select" class="selectSoundEffects" label="${LabelSoundEffects}"></select>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="inputContainer inputContainer-withDescription">
|
<div class="inputContainer inputContainer-withDescription">
|
||||||
<input is="emby-input" type="number" id="txtLibraryPageSize" pattern="[0-9]*" required="required" min="0" max="1000" step="1" label="${LabelLibraryPageSize}" />
|
<input is="emby-input" type="number" id="txtLibraryPageSize" pattern="[0-9]*" required="required" min="0" max="1000" step="1" label="${LabelLibraryPageSize}" />
|
||||||
<div class="fieldDescription">${LabelLibraryPageSizeHelp}</div>
|
<div class="fieldDescription">${LabelLibraryPageSizeHelp}</div>
|
||||||
|
@ -159,9 +146,9 @@
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" id="chkBlurhash" />
|
<input type="checkbox" is="emby-checkbox" id="chkBlurhash" />
|
||||||
<span>${EnableBlurhash}</span>
|
<span>${EnableBlurHash}</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="fieldDescription checkboxFieldDescription">${EnableBlurhashHelp}</div>
|
<div class="fieldDescription checkboxFieldDescription">${EnableBlurHashHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||||
|
@ -175,7 +162,7 @@
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription fldBackdrops hide">
|
<div class="checkboxContainer checkboxContainer-withDescription fldBackdrops hide">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" id="chkBackdrops" />
|
<input type="checkbox" is="emby-checkbox" id="chkBackdrops" />
|
||||||
<span>${EnableBackdrops}</span>
|
<span>${Backdrops}</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="fieldDescription checkboxFieldDescription">${EnableBackdropsHelp}</div>
|
<div class="fieldDescription checkboxFieldDescription">${EnableBackdropsHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -183,7 +170,7 @@
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription fldThemeSong hide">
|
<div class="checkboxContainer checkboxContainer-withDescription fldThemeSong hide">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" id="chkThemeSong" />
|
<input type="checkbox" is="emby-checkbox" id="chkThemeSong" />
|
||||||
<span>${EnableThemeSongs}</span>
|
<span>${ThemeSongs}</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="fieldDescription checkboxFieldDescription">${EnableThemeSongsHelp}</div>
|
<div class="fieldDescription checkboxFieldDescription">${EnableThemeSongsHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -191,18 +178,11 @@
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription fldThemeVideo hide">
|
<div class="checkboxContainer checkboxContainer-withDescription fldThemeVideo hide">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" id="chkThemeVideo" />
|
<input type="checkbox" is="emby-checkbox" id="chkThemeVideo" />
|
||||||
<span>${EnableThemeVideos}</span>
|
<span>${ThemeVideos}</span>
|
||||||
</label>
|
</label>
|
||||||
<div class="fieldDescription checkboxFieldDescription">${EnableThemeVideosHelp}</div>
|
<div class="fieldDescription checkboxFieldDescription">${EnableThemeVideosHelp}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="checkboxContainer hide fldAutorun">
|
|
||||||
<label>
|
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkRunAtStartup" />
|
|
||||||
<span>${RunAtStartup}</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription fldDisplayMissingEpisodes hide">
|
<div class="checkboxContainer checkboxContainer-withDescription fldDisplayMissingEpisodes hide">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkDisplayMissingEpisodes" />
|
<input type="checkbox" is="emby-checkbox" class="chkDisplayMissingEpisodes" />
|
||||||
|
|
|
@ -1,5 +1,14 @@
|
||||||
define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoader', 'globalize', 'layoutManager', 'scrollStyles', 'emby-itemscontainer'], function (loading, libraryBrowser, cardBuilder, dom, appHost, imageLoader, globalize, layoutManager) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import dom from 'dom';
|
||||||
|
import appHost from 'apphost';
|
||||||
|
import imageLoader from 'imageLoader';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import 'scrollStyles';
|
||||||
|
import 'emby-itemscontainer';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function enableScrollX() {
|
function enableScrollX() {
|
||||||
return !layoutManager.desktop;
|
return !layoutManager.desktop;
|
||||||
|
@ -19,21 +28,21 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
|
|
||||||
function getSections() {
|
function getSections() {
|
||||||
return [{
|
return [{
|
||||||
name: 'HeaderFavoriteMovies',
|
name: 'Movies',
|
||||||
types: 'Movie',
|
types: 'Movie',
|
||||||
id: 'favoriteMovies',
|
id: 'favoriteMovies',
|
||||||
shape: getPosterShape(),
|
shape: getPosterShape(),
|
||||||
showTitle: false,
|
showTitle: false,
|
||||||
overlayPlayButton: true
|
overlayPlayButton: true
|
||||||
}, {
|
}, {
|
||||||
name: 'HeaderFavoriteShows',
|
name: 'Shows',
|
||||||
types: 'Series',
|
types: 'Series',
|
||||||
id: 'favoriteShows',
|
id: 'favoriteShows',
|
||||||
shape: getPosterShape(),
|
shape: getPosterShape(),
|
||||||
showTitle: false,
|
showTitle: false,
|
||||||
overlayPlayButton: true
|
overlayPlayButton: true
|
||||||
}, {
|
}, {
|
||||||
name: 'HeaderFavoriteEpisodes',
|
name: 'Episodes',
|
||||||
types: 'Episode',
|
types: 'Episode',
|
||||||
id: 'favoriteEpisode',
|
id: 'favoriteEpisode',
|
||||||
shape: getThumbShape(),
|
shape: getThumbShape(),
|
||||||
|
@ -44,7 +53,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
overlayText: false,
|
overlayText: false,
|
||||||
centerText: true
|
centerText: true
|
||||||
}, {
|
}, {
|
||||||
name: 'HeaderFavoriteVideos',
|
name: 'Videos',
|
||||||
types: 'Video,MusicVideo',
|
types: 'Video,MusicVideo',
|
||||||
id: 'favoriteVideos',
|
id: 'favoriteVideos',
|
||||||
shape: getThumbShape(),
|
shape: getThumbShape(),
|
||||||
|
@ -54,7 +63,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
overlayText: false,
|
overlayText: false,
|
||||||
centerText: true
|
centerText: true
|
||||||
}, {
|
}, {
|
||||||
name: 'HeaderFavoriteArtists',
|
name: 'Artists',
|
||||||
types: 'MusicArtist',
|
types: 'MusicArtist',
|
||||||
id: 'favoriteArtists',
|
id: 'favoriteArtists',
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
|
@ -66,7 +75,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
overlayPlayButton: true,
|
overlayPlayButton: true,
|
||||||
coverImage: true
|
coverImage: true
|
||||||
}, {
|
}, {
|
||||||
name: 'HeaderFavoriteAlbums',
|
name: 'Albums',
|
||||||
types: 'MusicAlbum',
|
types: 'MusicAlbum',
|
||||||
id: 'favoriteAlbums',
|
id: 'favoriteAlbums',
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
|
@ -78,7 +87,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
overlayPlayButton: true,
|
overlayPlayButton: true,
|
||||||
coverImage: true
|
coverImage: true
|
||||||
}, {
|
}, {
|
||||||
name: 'HeaderFavoriteSongs',
|
name: 'Songs',
|
||||||
types: 'Audio',
|
types: 'Audio',
|
||||||
id: 'favoriteSongs',
|
id: 'favoriteSongs',
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
|
@ -94,8 +103,8 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSection(elem, userId, topParentId, section, isSingleSection) {
|
function loadSection(elem, userId, topParentId, section, isSingleSection) {
|
||||||
var screenWidth = dom.getWindowSize().innerWidth;
|
const screenWidth = dom.getWindowSize().innerWidth;
|
||||||
var options = {
|
const options = {
|
||||||
SortBy: 'SortName',
|
SortBy: 'SortName',
|
||||||
SortOrder: 'Ascending',
|
SortOrder: 'Ascending',
|
||||||
Filters: 'IsFavorite',
|
Filters: 'IsFavorite',
|
||||||
|
@ -118,9 +127,9 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var promise;
|
let promise;
|
||||||
|
|
||||||
if ('MusicArtist' === section.types) {
|
if (section.types === 'MusicArtist') {
|
||||||
promise = ApiClient.getArtists(userId, options);
|
promise = ApiClient.getArtists(userId, options);
|
||||||
} else {
|
} else {
|
||||||
options.IncludeItemTypes = section.types;
|
options.IncludeItemTypes = section.types;
|
||||||
|
@ -128,7 +137,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.then(function (result) {
|
return promise.then(function (result) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
if (html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">', !layoutManager.tv && options.Limit && result.Items.length >= options.Limit) {
|
if (html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">', !layoutManager.tv && options.Limit && result.Items.length >= options.Limit) {
|
||||||
|
@ -144,7 +153,7 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
var scrollXClass = 'scrollX hiddenScrollX';
|
let scrollXClass = 'scrollX hiddenScrollX';
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollXClass += ' smoothScrollX';
|
scrollXClass += ' smoothScrollX';
|
||||||
}
|
}
|
||||||
|
@ -154,14 +163,13 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportsImageAnalysis = appHost.supports('imageanalysis');
|
let cardLayout = appHost.preferVisualCards && section.autoCardLayout && section.showTitle;
|
||||||
var cardLayout = (appHost.preferVisualCards || supportsImageAnalysis) && section.autoCardLayout && section.showTitle;
|
|
||||||
cardLayout = false;
|
cardLayout = false;
|
||||||
html += cardBuilder.getCardsHtml(result.Items, {
|
html += cardBuilder.getCardsHtml(result.Items, {
|
||||||
preferThumb: section.preferThumb,
|
preferThumb: section.preferThumb,
|
||||||
shape: section.shape,
|
shape: section.shape,
|
||||||
centerText: section.centerText && !cardLayout,
|
centerText: section.centerText && !cardLayout,
|
||||||
overlayText: false !== section.overlayText,
|
overlayText: section.overlayText !== false,
|
||||||
showTitle: section.showTitle,
|
showTitle: section.showTitle,
|
||||||
showParentTitle: section.showParentTitle,
|
showParentTitle: section.showParentTitle,
|
||||||
scalable: true,
|
scalable: true,
|
||||||
|
@ -180,10 +188,10 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSections(page, userId, topParentId, types) {
|
export function loadSections(page, userId, topParentId, types) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var sections = getSections();
|
let sections = getSections();
|
||||||
var sectionid = getParameterByName('sectionid');
|
const sectionid = getParameterByName('sectionid');
|
||||||
|
|
||||||
if (sectionid) {
|
if (sectionid) {
|
||||||
sections = sections.filter(function (s) {
|
sections = sections.filter(function (s) {
|
||||||
|
@ -193,30 +201,28 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
|
|
||||||
if (types) {
|
if (types) {
|
||||||
sections = sections.filter(function (s) {
|
sections = sections.filter(function (s) {
|
||||||
return -1 !== types.indexOf(s.id);
|
return types.indexOf(s.id) !== -1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var i;
|
let elem = page.querySelector('.favoriteSections');
|
||||||
var length;
|
|
||||||
var elem = page.querySelector('.favoriteSections');
|
|
||||||
|
|
||||||
if (!elem.innerHTML) {
|
if (!elem.innerHTML) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
for (i = 0, length = sections.length; i < length; i++) {
|
for (let i = 0, length = sections.length; i < length; i++) {
|
||||||
html += '<div class="verticalSection section' + sections[i].id + '"></div>';
|
html += '<div class="verticalSection section' + sections[i].id + '"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
var promises = [];
|
const promises = [];
|
||||||
|
|
||||||
for (i = 0, length = sections.length; i < length; i++) {
|
for (let i = 0, length = sections.length; i < length; i++) {
|
||||||
var section = sections[i];
|
const section = sections[i];
|
||||||
elem = page.querySelector('.section' + section.id);
|
elem = page.querySelector('.section' + section.id);
|
||||||
promises.push(loadSection(elem, userId, topParentId, section, 1 === sections.length));
|
promises.push(loadSection(elem, userId, topParentId, section, sections.length === 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
Promise.all(promises).then(function () {
|
Promise.all(promises).then(function () {
|
||||||
|
@ -224,7 +230,8 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoad
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
render: loadSections
|
render: loadSections
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
/* eslint-disable indent */
|
/* eslint-disable indent */
|
||||||
export function getFetchPromise(request) {
|
export function getFetchPromise(request) {
|
||||||
|
|
||||||
const headers = request.headers || {};
|
const headers = request.headers || {};
|
||||||
|
|
||||||
if (request.dataType === 'json') {
|
if (request.dataType === 'json') {
|
||||||
|
@ -16,7 +15,6 @@
|
||||||
let contentType = request.contentType;
|
let contentType = request.contentType;
|
||||||
|
|
||||||
if (request.data) {
|
if (request.data) {
|
||||||
|
|
||||||
if (typeof request.data === 'string') {
|
if (typeof request.data === 'string') {
|
||||||
fetchRequest.body = request.data;
|
fetchRequest.body = request.data;
|
||||||
} else {
|
} else {
|
||||||
|
@ -27,7 +25,6 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (contentType) {
|
if (contentType) {
|
||||||
|
|
||||||
headers['Content-Type'] = contentType;
|
headers['Content-Type'] = contentType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -48,11 +45,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function fetchWithTimeout(url, options, timeoutMs) {
|
function fetchWithTimeout(url, options, timeoutMs) {
|
||||||
|
|
||||||
console.debug(`fetchWithTimeout: timeoutMs: ${timeoutMs}, url: ${url}`);
|
console.debug(`fetchWithTimeout: timeoutMs: ${timeoutMs}, url: ${url}`);
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
const timeout = setTimeout(reject, timeoutMs);
|
const timeout = setTimeout(reject, timeoutMs);
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
@ -65,7 +60,6 @@
|
||||||
|
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
|
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
||||||
console.debug(`fetchWithTimeout: timed out connecting to url: ${url}`);
|
console.debug(`fetchWithTimeout: timed out connecting to url: ${url}`);
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import dom from 'dom';
|
import dom from 'dom';
|
||||||
import dialogHelper from 'dialogHelper';
|
import dialogHelper from 'dialogHelper';
|
||||||
import globalize from 'globalize';
|
import globalize from 'globalize';
|
||||||
import connectionManager from 'connectionManager';
|
|
||||||
import events from 'events';
|
import events from 'events';
|
||||||
import 'emby-checkbox';
|
import 'emby-checkbox';
|
||||||
import 'emby-collapse';
|
import 'emby-collapse';
|
||||||
|
@ -412,7 +411,7 @@ import 'css!./style.css';
|
||||||
dlg.classList.add('background-theme-a');
|
dlg.classList.add('background-theme-a');
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
dlg.classList.add('filterDialog');
|
dlg.classList.add('filterDialog');
|
||||||
dlg.innerHTML = globalize.translateDocument(template);
|
dlg.innerHTML = globalize.translateHtml(template);
|
||||||
setVisibility(dlg, this.options);
|
setVisibility(dlg, this.options);
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
dlg.addEventListener('close', resolve);
|
dlg.addEventListener('close', resolve);
|
||||||
|
@ -420,7 +419,7 @@ import 'css!./style.css';
|
||||||
this.bindEvents(dlg);
|
this.bindEvents(dlg);
|
||||||
if (enableDynamicFilters(this.options.mode)) {
|
if (enableDynamicFilters(this.options.mode)) {
|
||||||
dlg.classList.add('dynamicFilterDialog');
|
dlg.classList.add('dynamicFilterDialog');
|
||||||
const apiClient = connectionManager.getApiClient(this.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(this.options.serverId);
|
||||||
loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), this.options.query);
|
loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), this.options.query);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
<div style="margin: 0;padding:1.5em 2em;" class="filterDialogContent">
|
<div style="margin: 0;padding:1.5em 2em;" class="filterDialogContent">
|
||||||
|
|
||||||
<div is="emby-collapse" title="${HeaderFilters}">
|
<div is="emby-collapse" title="${Filters}">
|
||||||
<div class="collapseContent">
|
<div class="collapseContent">
|
||||||
<div class="checkboxList">
|
<div class="checkboxList">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
|
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
|
||||||
data-filter="IsPlayed" />
|
data-filter="IsPlayed" />
|
||||||
<span>${OptionPlayed}</span>
|
<span>${Played}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
|
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
|
||||||
data-filter="IsUnPlayed" />
|
data-filter="IsUnPlayed" />
|
||||||
<span>${OptionUnplayed}</span>
|
<span>${Unplayed}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
|
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter videoStandard"
|
||||||
|
@ -21,7 +21,7 @@
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkFavorite"
|
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkFavorite"
|
||||||
data-filter="IsFavorite" />
|
data-filter="IsFavorite" />
|
||||||
<span>${OptionFavorite}</span>
|
<span>${Favorites}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkLikes" data-filter="Likes" />
|
<input type="checkbox" is="emby-checkbox" class="chkStandardFilter chkLikes" data-filter="Likes" />
|
||||||
|
@ -53,30 +53,30 @@
|
||||||
<div class="checkboxList">
|
<div class="checkboxList">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Continuing" />
|
<input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Continuing" />
|
||||||
<span>${OptionContinuing}</span>
|
<span>${Continuing}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Ended" />
|
<input type="checkbox" is="emby-checkbox" class="chkStatus" data-filter="Ended" />
|
||||||
<span>${OptionEnded}</span>
|
<span>${Ended}</span>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div is="emby-collapse" title="${HeaderFeatures}" class="features hide">
|
<div is="emby-collapse" title="${Features}" class="features hide">
|
||||||
<div class="collapseContent">
|
<div class="collapseContent">
|
||||||
<div class="checkboxList">
|
<div class="checkboxList">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSubtitle" />
|
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSubtitle" />
|
||||||
<span>${OptionHasSubtitles}</span>
|
<span>${Subtitles}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkTrailer" />
|
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkTrailer" />
|
||||||
<span>${OptionHasTrailer}</span>
|
<span>${ButtonTrailer}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSpecialFeature" />
|
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkSpecialFeature" />
|
||||||
<span>${OptionHasSpecialFeatures}</span>
|
<span>${SpecialFeatures}</span>
|
||||||
</label>
|
</label>
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkThemeSong" />
|
<input type="checkbox" is="emby-checkbox" class="chkFeatureFilter" id="chkThemeSong" />
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div is="emby-collapse" title="${HeaderGenres}" class="genreFilters hide">
|
<div is="emby-collapse" title="${Genres}" class="genreFilters hide">
|
||||||
<div class="collapseContent filterOptions">
|
<div class="collapseContent filterOptions">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -100,7 +100,7 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div is="emby-collapse" title="${HeaderTags}" class="tagFilters hide">
|
<div is="emby-collapse" title="${Tags}" class="tagFilters hide">
|
||||||
<div class="collapseContent filterOptions">
|
<div class="collapseContent filterOptions">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,104 +1,164 @@
|
||||||
define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost', 'inputManager', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'userSettings', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button', 'flexStyles'], function (require, dom, focusManager, dialogHelper, loading, appHost, inputManager, layoutManager, connectionManager, appRouter, globalize, userSettings) {
|
import dom from 'dom';
|
||||||
'use strict';
|
import focusManager from 'focusManager';
|
||||||
|
import dialogHelper from 'dialogHelper';
|
||||||
|
import inputManager from 'inputManager';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-input';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'emby-select';
|
||||||
|
import 'material-icons';
|
||||||
|
import 'css!./../formdialog';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'flexStyles';
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
|
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
|
||||||
|
const elem = context.querySelector(selector);
|
||||||
var elem = context.querySelector(selector);
|
|
||||||
|
|
||||||
if (items.length) {
|
if (items.length) {
|
||||||
|
|
||||||
elem.classList.remove('hide');
|
elem.classList.remove('hide');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
elem.classList.add('hide');
|
elem.classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += items.map(function (filter) {
|
html += items.map(function (filter) {
|
||||||
|
let itemHtml = '';
|
||||||
|
|
||||||
var itemHtml = '';
|
const checkedHtml = isCheckedFn(filter) ? ' checked' : '';
|
||||||
|
|
||||||
var checkedHtml = isCheckedFn(filter) ? ' checked' : '';
|
|
||||||
itemHtml += '<label>';
|
itemHtml += '<label>';
|
||||||
itemHtml += '<input is="emby-checkbox" type="checkbox"' + checkedHtml + ' data-filter="' + filter.Id + '" class="' + cssClass + '"/>';
|
itemHtml += '<input is="emby-checkbox" type="checkbox"' + checkedHtml + ' data-filter="' + filter.Id + '" class="' + cssClass + '"/>';
|
||||||
itemHtml += '<span>' + filter.Name + '</span>';
|
itemHtml += '<span>' + filter.Name + '</span>';
|
||||||
itemHtml += '</label>';
|
itemHtml += '</label>';
|
||||||
|
|
||||||
return itemHtml;
|
return itemHtml;
|
||||||
|
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
elem.querySelector('.filterOptions').innerHTML = html;
|
elem.querySelector('.filterOptions').innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderDynamicFilters(context, result, options) {
|
function renderDynamicFilters(context, result, options) {
|
||||||
|
|
||||||
// If there's a huge number of these they will be really show to render
|
|
||||||
//if (result.Tags) {
|
|
||||||
// result.Tags.length = Math.min(result.Tags.length, 50);
|
|
||||||
//}
|
|
||||||
|
|
||||||
renderOptions(context, '.genreFilters', 'chkGenreFilter', result.Genres, function (i) {
|
renderOptions(context, '.genreFilters', 'chkGenreFilter', result.Genres, function (i) {
|
||||||
|
|
||||||
// Switching from | to ,
|
// Switching from | to ,
|
||||||
var delimeter = (options.settings.GenreIds || '').indexOf('|') === -1 ? ',' : '|';
|
const delimeter = (options.settings.GenreIds || '').indexOf('|') === -1 ? ',' : '|';
|
||||||
return (delimeter + (options.settings.GenreIds || '') + delimeter).indexOf(delimeter + i.Id + delimeter) !== -1;
|
return (delimeter + (options.settings.GenreIds || '') + delimeter).indexOf(delimeter + i.Id + delimeter) !== -1;
|
||||||
});
|
});
|
||||||
|
|
||||||
//renderOptions(context, '.officialRatingFilters', 'chkOfficialRatingFilter', result.OfficialRatings, function (i) {
|
|
||||||
// var delimeter = '|';
|
|
||||||
// return (delimeter + (query.OfficialRatings || '') + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
|
||||||
//});
|
|
||||||
|
|
||||||
//renderOptions(context, '.tagFilters', 'chkTagFilter', result.Tags, function (i) {
|
|
||||||
// var delimeter = '|';
|
|
||||||
// return (delimeter + (query.Tags || '') + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
|
||||||
//});
|
|
||||||
|
|
||||||
//renderOptions(context, '.yearFilters', 'chkYearFilter', result.Years, function (i) {
|
|
||||||
|
|
||||||
// var delimeter = ',';
|
|
||||||
// return (delimeter + (query.Years || '') + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
|
||||||
//});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadDynamicFilters(context, options) {
|
function setBasicFilter(context, key, elem) {
|
||||||
|
let value = elem.checked;
|
||||||
|
value = value ? value : null;
|
||||||
|
userSettings.setFilter(key, value);
|
||||||
|
}
|
||||||
|
function moveCheckboxFocus(elem, offset) {
|
||||||
|
const parent = dom.parentWithClass(elem, 'checkboxList-verticalwrap');
|
||||||
|
const elems = focusManager.getFocusableElements(parent);
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
let index = -1;
|
||||||
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
var filterMenuOptions = Object.assign(options.filterMenuOptions, {
|
if (elems[i] === elem) {
|
||||||
|
index = i;
|
||||||
UserId: apiClient.getCurrentUserId(),
|
break;
|
||||||
ParentId: options.parentId,
|
}
|
||||||
IncludeItemTypes: options.itemTypes.join(',')
|
|
||||||
});
|
|
||||||
|
|
||||||
apiClient.getFilters(filterMenuOptions).then(function (result) {
|
|
||||||
|
|
||||||
renderDynamicFilters(context, result, options);
|
|
||||||
}, function () {
|
|
||||||
|
|
||||||
// older server
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
index += offset;
|
||||||
|
|
||||||
|
index = Math.min(elems.length - 1, index);
|
||||||
|
index = Math.max(0, index);
|
||||||
|
|
||||||
|
const newElem = elems[index];
|
||||||
|
if (newElem) {
|
||||||
|
focusManager.focus(newElem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function centerFocus(elem, horiz, on) {
|
||||||
|
import('scrollHelper').then(({ default: scrollHelper }) => {
|
||||||
|
const fn = on ? 'on' : 'off';
|
||||||
|
scrollHelper.centerFocus[fn](elem, horiz);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
function onInputCommand(e) {
|
||||||
|
switch (e.detail.command) {
|
||||||
|
case 'left':
|
||||||
|
moveCheckboxFocus(e.target, -1);
|
||||||
|
e.preventDefault();
|
||||||
|
break;
|
||||||
|
case 'right':
|
||||||
|
moveCheckboxFocus(e.target, 1);
|
||||||
|
e.preventDefault();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
function saveValues(context, settings, settingsKey) {
|
||||||
|
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]);
|
||||||
|
} else {
|
||||||
|
setBasicFilter(context, settingsKey + '-filter-' + elems[i].getAttribute('data-settingname'), elems[i].querySelector('input'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Video type
|
||||||
|
const videoTypes = [];
|
||||||
|
elems = context.querySelectorAll('.chkVideoTypeFilter');
|
||||||
|
|
||||||
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
|
if (elems[i].checked) {
|
||||||
|
videoTypes.push(elems[i].getAttribute('data-filter'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userSettings.setFilter(settingsKey + '-filter-VideoTypes', videoTypes.join(','));
|
||||||
|
|
||||||
|
// Series status
|
||||||
|
const seriesStatuses = [];
|
||||||
|
elems = context.querySelectorAll('.chkSeriesStatus');
|
||||||
|
|
||||||
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
|
if (elems[i].checked) {
|
||||||
|
seriesStatuses.push(elems[i].getAttribute('data-filter'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Genres
|
||||||
|
const genres = [];
|
||||||
|
elems = context.querySelectorAll('.chkGenreFilter');
|
||||||
|
|
||||||
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
|
if (elems[i].checked) {
|
||||||
|
genres.push(elems[i].getAttribute('data-filter'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
userSettings.setFilter(settingsKey + '-filter-GenreIds', genres.join(','));
|
||||||
|
}
|
||||||
|
function bindCheckboxInput(context, on) {
|
||||||
|
const elems = context.querySelectorAll('.checkboxList-verticalwrap');
|
||||||
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
|
if (on) {
|
||||||
|
inputManager.on(elems[i], onInputCommand);
|
||||||
|
} else {
|
||||||
|
inputManager.off(elems[i], onInputCommand);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
function initEditor(context, settings) {
|
function initEditor(context, settings) {
|
||||||
|
|
||||||
context.querySelector('form').addEventListener('submit', onSubmit);
|
context.querySelector('form').addEventListener('submit', onSubmit);
|
||||||
|
|
||||||
var elems = context.querySelectorAll('.simpleFilter');
|
let elems = context.querySelectorAll('.simpleFilter');
|
||||||
var i;
|
let i;
|
||||||
var length;
|
let length;
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
|
|
||||||
if (elems[i].tagName === 'INPUT') {
|
if (elems[i].tagName === 'INPUT') {
|
||||||
elems[i].checked = settings[elems[i].getAttribute('data-settingname')] || false;
|
elems[i].checked = settings[elems[i].getAttribute('data-settingname')] || false;
|
||||||
} else {
|
} else {
|
||||||
|
@ -106,19 +166,17 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var videoTypes = settings.VideoTypes ? settings.VideoTypes.split(',') : [];
|
const videoTypes = settings.VideoTypes ? settings.VideoTypes.split(',') : [];
|
||||||
elems = context.querySelectorAll('.chkVideoTypeFilter');
|
elems = context.querySelectorAll('.chkVideoTypeFilter');
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
|
|
||||||
elems[i].checked = videoTypes.indexOf(elems[i].getAttribute('data-filter')) !== -1;
|
elems[i].checked = videoTypes.indexOf(elems[i].getAttribute('data-filter')) !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
var seriesStatuses = settings.SeriesStatus ? settings.SeriesStatus.split(',') : [];
|
const seriesStatuses = settings.SeriesStatus ? settings.SeriesStatus.split(',') : [];
|
||||||
elems = context.querySelectorAll('.chkSeriesStatus');
|
elems = context.querySelectorAll('.chkSeriesStatus');
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
|
|
||||||
elems[i].checked = seriesStatuses.indexOf(elems[i].getAttribute('data-filter')) !== -1;
|
elems[i].checked = seriesStatuses.indexOf(elems[i].getAttribute('data-filter')) !== -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -134,149 +192,39 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||||
context.querySelector('.featureSection').classList.add('hide');
|
context.querySelector('.featureSection').classList.add('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
function loadDynamicFilters(context, options) {
|
||||||
|
const apiClient = window.connectionManager.getApiClient(options.serverId);
|
||||||
|
|
||||||
function saveValues(context, settings, settingsKey) {
|
const filterMenuOptions = Object.assign(options.filterMenuOptions, {
|
||||||
|
|
||||||
var elems = context.querySelectorAll('.simpleFilter');
|
UserId: apiClient.getCurrentUserId(),
|
||||||
var i;
|
ParentId: options.parentId,
|
||||||
var length;
|
IncludeItemTypes: options.itemTypes.join(',')
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
});
|
||||||
|
|
||||||
if (elems[i].tagName === 'INPUT') {
|
apiClient.getFilters(filterMenuOptions).then((result) => {
|
||||||
setBasicFilter(context, settingsKey + '-filter-' + elems[i].getAttribute('data-settingname'), elems[i]);
|
renderDynamicFilters(context, result, options);
|
||||||
} else {
|
|
||||||
setBasicFilter(context, settingsKey + '-filter-' + elems[i].getAttribute('data-settingname'), elems[i].querySelector('input'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Video type
|
|
||||||
var videoTypes = [];
|
|
||||||
elems = context.querySelectorAll('.chkVideoTypeFilter');
|
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
|
||||||
|
|
||||||
if (elems[i].checked) {
|
|
||||||
videoTypes.push(elems[i].getAttribute('data-filter'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
userSettings.setFilter(settingsKey + '-filter-VideoTypes', videoTypes.join(','));
|
|
||||||
|
|
||||||
// Series status
|
|
||||||
var seriesStatuses = [];
|
|
||||||
elems = context.querySelectorAll('.chkSeriesStatus');
|
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
|
||||||
|
|
||||||
if (elems[i].checked) {
|
|
||||||
seriesStatuses.push(elems[i].getAttribute('data-filter'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Genres
|
|
||||||
var genres = [];
|
|
||||||
elems = context.querySelectorAll('.chkGenreFilter');
|
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
|
||||||
|
|
||||||
if (elems[i].checked) {
|
|
||||||
genres.push(elems[i].getAttribute('data-filter'));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
userSettings.setFilter(settingsKey + '-filter-GenreIds', genres.join(','));
|
|
||||||
}
|
|
||||||
|
|
||||||
function setBasicFilter(context, key, elem) {
|
|
||||||
|
|
||||||
var value = elem.checked;
|
|
||||||
value = value ? value : null;
|
|
||||||
userSettings.setFilter(key, value);
|
|
||||||
}
|
|
||||||
|
|
||||||
function centerFocus(elem, horiz, on) {
|
|
||||||
require(['scrollHelper'], function (scrollHelper) {
|
|
||||||
var fn = on ? 'on' : 'off';
|
|
||||||
scrollHelper.centerFocus[fn](elem, horiz);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
class FilterMenu {
|
||||||
function moveCheckboxFocus(elem, offset) {
|
show(options) {
|
||||||
|
return new Promise( (resolve, reject) => {
|
||||||
var parent = dom.parentWithClass(elem, 'checkboxList-verticalwrap');
|
import('text!./filtermenu.template.html').then(({ default: template }) => {
|
||||||
var elems = focusManager.getFocusableElements(parent);
|
const dialogOptions = {
|
||||||
|
|
||||||
var index = -1;
|
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
|
||||||
if (elems[i] === elem) {
|
|
||||||
index = i;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
index += offset;
|
|
||||||
|
|
||||||
index = Math.min(elems.length - 1, index);
|
|
||||||
index = Math.max(0, index);
|
|
||||||
|
|
||||||
var newElem = elems[index];
|
|
||||||
if (newElem) {
|
|
||||||
focusManager.focus(newElem);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onInputCommand(e) {
|
|
||||||
switch (e.detail.command) {
|
|
||||||
|
|
||||||
case 'left':
|
|
||||||
moveCheckboxFocus(e.target, -1);
|
|
||||||
e.preventDefault();
|
|
||||||
break;
|
|
||||||
case 'right':
|
|
||||||
moveCheckboxFocus(e.target, 1);
|
|
||||||
e.preventDefault();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function FilterMenu() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
function bindCheckboxInput(context, on) {
|
|
||||||
|
|
||||||
var elems = context.querySelectorAll('.checkboxList-verticalwrap');
|
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
|
||||||
if (on) {
|
|
||||||
inputManager.on(elems[i], onInputCommand);
|
|
||||||
} else {
|
|
||||||
inputManager.off(elems[i], onInputCommand);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
FilterMenu.prototype.show = function (options) {
|
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
|
||||||
|
|
||||||
require(['text!./filtermenu.template.html'], function (template) {
|
|
||||||
|
|
||||||
var dialogOptions = {
|
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
dialogOptions.size = 'fullscreen';
|
dialogOptions.size = 'fullscreen';
|
||||||
} else {
|
} else {
|
||||||
dialogOptions.size = 'small';
|
dialogOptions.size = 'small';
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="formDialogHeader">';
|
html += '<div class="formDialogHeader">';
|
||||||
html += '<button is="paper-icon-button-light" class="btnCancel hide-mouse-idle-tv" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
html += '<button is="paper-icon-button-light" class="btnCancel hide-mouse-idle-tv" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||||
|
@ -286,10 +234,10 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||||
|
|
||||||
html += template;
|
html += template;
|
||||||
|
|
||||||
dlg.innerHTML = globalize.translateDocument(html, 'core');
|
dlg.innerHTML = globalize.translateHtml(html, 'core');
|
||||||
|
|
||||||
var settingElements = dlg.querySelectorAll('.viewSetting');
|
const settingElements = dlg.querySelectorAll('.viewSetting');
|
||||||
for (var i = 0, length = settingElements.length; i < length; i++) {
|
for (let i = 0, length = settingElements.length; i < length; i++) {
|
||||||
if (options.visibleSettings.indexOf(settingElements[i].getAttribute('data-settingname')) === -1) {
|
if (options.visibleSettings.indexOf(settingElements[i].getAttribute('data-settingname')) === -1) {
|
||||||
settingElements[i].classList.add('hide');
|
settingElements[i].classList.add('hide');
|
||||||
} else {
|
} else {
|
||||||
|
@ -301,9 +249,7 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||||
loadDynamicFilters(dlg, options);
|
loadDynamicFilters(dlg, options);
|
||||||
|
|
||||||
bindCheckboxInput(dlg, true);
|
bindCheckboxInput(dlg, true);
|
||||||
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||||
|
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -311,20 +257,13 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||||
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
var submitted;
|
let submitted;
|
||||||
|
|
||||||
dlg.querySelector('form').addEventListener('change', function () {
|
dlg.querySelector('form').addEventListener('change', function () {
|
||||||
|
|
||||||
submitted = true;
|
submitted = true;
|
||||||
//if (options.onChange) {
|
|
||||||
// saveValues(dlg, options.settings, options.settingsKey);
|
|
||||||
// options.onChange();
|
|
||||||
//}
|
|
||||||
|
|
||||||
}, true);
|
}, true);
|
||||||
|
|
||||||
dialogHelper.open(dlg).then( function() {
|
dialogHelper.open(dlg).then( function() {
|
||||||
|
|
||||||
bindCheckboxInput(dlg, false);
|
bindCheckboxInput(dlg, false);
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
|
@ -332,19 +271,16 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (submitted) {
|
if (submitted) {
|
||||||
|
|
||||||
//if (!options.onChange) {
|
//if (!options.onChange) {
|
||||||
saveValues(dlg, options.settings, options.settingsKey);
|
saveValues(dlg, options.settings, options.settingsKey);
|
||||||
resolve();
|
return resolve();
|
||||||
//}
|
//}
|
||||||
return;
|
}
|
||||||
|
return resolve();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reject();
|
export default FilterMenu;
|
||||||
});
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
return FilterMenu;
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,21 +1,21 @@
|
||||||
define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
/* eslint-disable indent */
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var scopes = [];
|
import dom from 'dom';
|
||||||
|
import scrollManager from 'scrollManager';
|
||||||
|
|
||||||
|
const scopes = [];
|
||||||
function pushScope(elem) {
|
function pushScope(elem) {
|
||||||
scopes.push(elem);
|
scopes.push(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
function popScope(elem) {
|
function popScope(elem) {
|
||||||
|
|
||||||
if (scopes.length) {
|
if (scopes.length) {
|
||||||
scopes.length -= 1;
|
scopes.length -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function autoFocus(view, defaultToFirst, findAutoFocusElement) {
|
function autoFocus(view, defaultToFirst, findAutoFocusElement) {
|
||||||
|
let element;
|
||||||
var element;
|
|
||||||
if (findAutoFocusElement !== false) {
|
if (findAutoFocusElement !== false) {
|
||||||
element = view.querySelector('*[autofocus]');
|
element = view.querySelector('*[autofocus]');
|
||||||
if (element) {
|
if (element) {
|
||||||
|
@ -37,7 +37,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function focus(element) {
|
function focus(element) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
element.focus({
|
element.focus({
|
||||||
preventScroll: scrollManager.isEnabled()
|
preventScroll: scrollManager.isEnabled()
|
||||||
|
@ -47,19 +46,16 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var focusableTagNames = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'A'];
|
const focusableTagNames = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'A'];
|
||||||
var focusableContainerTagNames = ['BODY', 'DIALOG'];
|
const focusableContainerTagNames = ['BODY', 'DIALOG'];
|
||||||
var focusableQuery = focusableTagNames.map(function (t) {
|
const focusableQuery = focusableTagNames.map(function (t) {
|
||||||
|
|
||||||
if (t === 'INPUT') {
|
if (t === 'INPUT') {
|
||||||
t += ':not([type="range"]):not([type="file"])';
|
t += ':not([type="range"]):not([type="file"])';
|
||||||
}
|
}
|
||||||
return t + ':not([tabindex="-1"]):not(:disabled)';
|
return t + ':not([tabindex="-1"]):not(:disabled)';
|
||||||
|
|
||||||
}).join(',') + ',.focusable';
|
}).join(',') + ',.focusable';
|
||||||
|
|
||||||
function isFocusable(elem) {
|
function isFocusable(elem) {
|
||||||
|
|
||||||
if (focusableTagNames.indexOf(elem.tagName) !== -1) {
|
if (focusableTagNames.indexOf(elem.tagName) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -73,7 +69,7 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
|
|
||||||
function normalizeFocusable(elem, originalElement) {
|
function normalizeFocusable(elem, originalElement) {
|
||||||
if (elem) {
|
if (elem) {
|
||||||
var tagName = elem.tagName;
|
const tagName = elem.tagName;
|
||||||
if (!tagName || tagName === 'HTML' || tagName === 'BODY') {
|
if (!tagName || tagName === 'HTML' || tagName === 'BODY') {
|
||||||
elem = originalElement;
|
elem = originalElement;
|
||||||
}
|
}
|
||||||
|
@ -83,11 +79,10 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusableParent(elem) {
|
function focusableParent(elem) {
|
||||||
|
const originalElement = elem;
|
||||||
var originalElement = elem;
|
|
||||||
|
|
||||||
while (!isFocusable(elem)) {
|
while (!isFocusable(elem)) {
|
||||||
var parent = elem.parentNode;
|
const parent = elem.parentNode;
|
||||||
|
|
||||||
if (!parent) {
|
if (!parent) {
|
||||||
return normalizeFocusable(elem, originalElement);
|
return normalizeFocusable(elem, originalElement);
|
||||||
|
@ -101,7 +96,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
|
|
||||||
// Determines if a focusable element can be focused at a given point in time
|
// Determines if a focusable element can be focused at a given point in time
|
||||||
function isCurrentlyFocusableInternal(elem) {
|
function isCurrentlyFocusableInternal(elem) {
|
||||||
|
|
||||||
// http://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
|
// http://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
|
||||||
if (elem.offsetParent === null) {
|
if (elem.offsetParent === null) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -112,7 +106,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
|
|
||||||
// Determines if a focusable element can be focused at a given point in time
|
// Determines if a focusable element can be focused at a given point in time
|
||||||
function isCurrentlyFocusable(elem) {
|
function isCurrentlyFocusable(elem) {
|
||||||
|
|
||||||
if (elem.disabled) {
|
if (elem.disabled) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -122,7 +115,7 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem.tagName === 'INPUT') {
|
if (elem.tagName === 'INPUT') {
|
||||||
var type = elem.type;
|
const type = elem.type;
|
||||||
if (type === 'range') {
|
if (type === 'range') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -139,12 +132,11 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFocusableElements(parent, limit, excludeClass) {
|
function getFocusableElements(parent, limit, excludeClass) {
|
||||||
var elems = (parent || getDefaultScope()).querySelectorAll(focusableQuery);
|
const elems = (parent || getDefaultScope()).querySelectorAll(focusableQuery);
|
||||||
var focusableElements = [];
|
const focusableElements = [];
|
||||||
|
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
|
const elem = elems[i];
|
||||||
var elem = elems[i];
|
|
||||||
|
|
||||||
if (excludeClass && elem.classList.contains(excludeClass)) {
|
if (excludeClass && elem.classList.contains(excludeClass)) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -163,12 +155,11 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function isFocusContainer(elem, direction) {
|
function isFocusContainer(elem, direction) {
|
||||||
|
|
||||||
if (focusableContainerTagNames.indexOf(elem.tagName) !== -1) {
|
if (focusableContainerTagNames.indexOf(elem.tagName) !== -1) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var classList = elem.classList;
|
const classList = elem.classList;
|
||||||
|
|
||||||
if (classList.contains('focuscontainer')) {
|
if (classList.contains('focuscontainer')) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -217,8 +208,7 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOffset(elem) {
|
function getOffset(elem) {
|
||||||
|
let box;
|
||||||
var box;
|
|
||||||
|
|
||||||
// Support: BlackBerry 5, iOS 3 (original iPhone)
|
// Support: BlackBerry 5, iOS 3 (original iPhone)
|
||||||
// If we don't have gBCR, just use 0,0 rather than error
|
// If we don't have gBCR, just use 0,0 rather than error
|
||||||
|
@ -234,9 +224,8 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (box.right === null) {
|
if (box.right === null) {
|
||||||
|
|
||||||
// Create a new object because some browsers will throw an error when trying to set data onto the Rect object
|
// Create a new object because some browsers will throw an error when trying to set data onto the Rect object
|
||||||
var newBox = {
|
const newBox = {
|
||||||
top: box.top,
|
top: box.top,
|
||||||
left: box.left,
|
left: box.left,
|
||||||
width: box.width,
|
width: box.width,
|
||||||
|
@ -253,7 +242,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function nav(activeElement, direction, container, focusableElements) {
|
function nav(activeElement, direction, container, focusableElements) {
|
||||||
|
|
||||||
activeElement = activeElement || document.activeElement;
|
activeElement = activeElement || document.activeElement;
|
||||||
|
|
||||||
if (activeElement) {
|
if (activeElement) {
|
||||||
|
@ -267,31 +255,27 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var focusableContainer = dom.parentWithClass(activeElement, 'focusable');
|
const focusableContainer = dom.parentWithClass(activeElement, 'focusable');
|
||||||
|
|
||||||
var rect = getOffset(activeElement);
|
const rect = getOffset(activeElement);
|
||||||
|
|
||||||
// Get elements and work out x/y points
|
// Get elements and work out x/y points
|
||||||
var cache = [];
|
const point1x = parseFloat(rect.left) || 0;
|
||||||
var point1x = parseFloat(rect.left) || 0;
|
const point1y = parseFloat(rect.top) || 0;
|
||||||
var point1y = parseFloat(rect.top) || 0;
|
const point2x = parseFloat(point1x + rect.width - 1) || point1x;
|
||||||
var point2x = parseFloat(point1x + rect.width - 1) || point1x;
|
const point2y = parseFloat(point1y + rect.height - 1) || point1y;
|
||||||
var point2y = parseFloat(point1y + rect.height - 1) || point1y;
|
|
||||||
// Shortcuts to help with compression
|
|
||||||
var min = Math.min;
|
|
||||||
var max = Math.max;
|
|
||||||
|
|
||||||
var sourceMidX = rect.left + (rect.width / 2);
|
const sourceMidX = rect.left + (rect.width / 2);
|
||||||
var sourceMidY = rect.top + (rect.height / 2);
|
const sourceMidY = rect.top + (rect.height / 2);
|
||||||
|
|
||||||
var focusable = focusableElements || container.querySelectorAll(focusableQuery);
|
const focusable = focusableElements || container.querySelectorAll(focusableQuery);
|
||||||
|
|
||||||
var maxDistance = Infinity;
|
const maxDistance = Infinity;
|
||||||
var minDistance = maxDistance;
|
let minDistance = maxDistance;
|
||||||
var nearestElement;
|
let nearestElement;
|
||||||
|
|
||||||
for (var i = 0, length = focusable.length; i < length; i++) {
|
for (let i = 0, length = focusable.length; i < length; i++) {
|
||||||
var curr = focusable[i];
|
const curr = focusable[i];
|
||||||
|
|
||||||
if (curr === activeElement) {
|
if (curr === activeElement) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -301,11 +285,7 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//if (!isCurrentlyFocusableInternal(curr)) {
|
const elementRect = getOffset(curr);
|
||||||
// continue;
|
|
||||||
//}
|
|
||||||
|
|
||||||
var elementRect = getOffset(curr);
|
|
||||||
|
|
||||||
// not currently visible
|
// not currently visible
|
||||||
if (!elementRect.width && !elementRect.height) {
|
if (!elementRect.width && !elementRect.height) {
|
||||||
|
@ -313,7 +293,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
// left
|
// left
|
||||||
if (elementRect.left >= rect.left) {
|
if (elementRect.left >= rect.left) {
|
||||||
|
@ -354,22 +333,21 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var x = elementRect.left;
|
const x = elementRect.left;
|
||||||
var y = elementRect.top;
|
const y = elementRect.top;
|
||||||
var x2 = x + elementRect.width - 1;
|
const x2 = x + elementRect.width - 1;
|
||||||
var y2 = y + elementRect.height - 1;
|
const y2 = y + elementRect.height - 1;
|
||||||
|
|
||||||
var intersectX = intersects(point1x, point2x, x, x2);
|
const intersectX = intersects(point1x, point2x, x, x2);
|
||||||
var intersectY = intersects(point1y, point2y, y, y2);
|
const intersectY = intersects(point1y, point2y, y, y2);
|
||||||
|
|
||||||
var midX = elementRect.left + (elementRect.width / 2);
|
const midX = elementRect.left + (elementRect.width / 2);
|
||||||
var midY = elementRect.top + (elementRect.height / 2);
|
const midY = elementRect.top + (elementRect.height / 2);
|
||||||
|
|
||||||
var distX;
|
let distX;
|
||||||
var distY;
|
let distY;
|
||||||
|
|
||||||
switch (direction) {
|
switch (direction) {
|
||||||
|
|
||||||
case 0:
|
case 0:
|
||||||
// left
|
// left
|
||||||
distX = Math.abs(point1x - Math.min(point1x, x2));
|
distX = Math.abs(point1x - Math.min(point1x, x2));
|
||||||
|
@ -394,7 +372,7 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
var dist = Math.sqrt(distX * distX + distY * distY);
|
const dist = Math.sqrt(distX * distX + distY * distY);
|
||||||
|
|
||||||
if (dist < minDistance) {
|
if (dist < minDistance) {
|
||||||
nearestElement = curr;
|
nearestElement = curr;
|
||||||
|
@ -403,10 +381,9 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nearestElement) {
|
if (nearestElement) {
|
||||||
|
|
||||||
// See if there's a focusable container, and if so, send the focus command to that
|
// See if there's a focusable container, and if so, send the focus command to that
|
||||||
if (activeElement) {
|
if (activeElement) {
|
||||||
var nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable');
|
const nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable');
|
||||||
if (nearestElementFocusableParent && nearestElementFocusableParent !== nearestElement) {
|
if (nearestElementFocusableParent && nearestElementFocusableParent !== nearestElement) {
|
||||||
if (focusableContainer !== nearestElementFocusableParent) {
|
if (focusableContainer !== nearestElementFocusableParent) {
|
||||||
nearestElement = nearestElementFocusableParent;
|
nearestElement = nearestElementFocusableParent;
|
||||||
|
@ -418,28 +395,24 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function intersectsInternal(a1, a2, b1, b2) {
|
function intersectsInternal(a1, a2, b1, b2) {
|
||||||
|
|
||||||
return (b1 >= a1 && b1 <= a2) || (b2 >= a1 && b2 <= a2);
|
return (b1 >= a1 && b1 <= a2) || (b2 >= a1 && b2 <= a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function intersects(a1, a2, b1, b2) {
|
function intersects(a1, a2, b1, b2) {
|
||||||
|
|
||||||
return intersectsInternal(a1, a2, b1, b2) || intersectsInternal(b1, b2, a1, a2);
|
return intersectsInternal(a1, a2, b1, b2) || intersectsInternal(b1, b2, a1, a2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function sendText(text) {
|
function sendText(text) {
|
||||||
var elem = document.activeElement;
|
const elem = document.activeElement;
|
||||||
|
|
||||||
elem.value = text;
|
elem.value = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusFirst(container, focusableSelector) {
|
function focusFirst(container, focusableSelector) {
|
||||||
|
const elems = container.querySelectorAll(focusableSelector);
|
||||||
|
|
||||||
var elems = container.querySelectorAll(focusableSelector);
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
|
const elem = elems[i];
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
|
||||||
|
|
||||||
var elem = elems[i];
|
|
||||||
|
|
||||||
if (isCurrentlyFocusableInternal(elem)) {
|
if (isCurrentlyFocusableInternal(elem)) {
|
||||||
focus(elem);
|
focus(elem);
|
||||||
|
@ -449,12 +422,10 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function focusLast(container, focusableSelector) {
|
function focusLast(container, focusableSelector) {
|
||||||
|
const elems = [].slice.call(container.querySelectorAll(focusableSelector), 0).reverse();
|
||||||
|
|
||||||
var elems = [].slice.call(container.querySelectorAll(focusableSelector), 0).reverse();
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
|
const elem = elems[i];
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
|
||||||
|
|
||||||
var elem = elems[i];
|
|
||||||
|
|
||||||
if (isCurrentlyFocusableInternal(elem)) {
|
if (isCurrentlyFocusableInternal(elem)) {
|
||||||
focus(elem);
|
focus(elem);
|
||||||
|
@ -464,15 +435,13 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function moveFocus(sourceElement, container, focusableSelector, offset) {
|
function moveFocus(sourceElement, container, focusableSelector, offset) {
|
||||||
|
const elems = container.querySelectorAll(focusableSelector);
|
||||||
var elems = container.querySelectorAll(focusableSelector);
|
const list = [];
|
||||||
var list = [];
|
let i;
|
||||||
var i;
|
let length;
|
||||||
var length;
|
let elem;
|
||||||
var elem;
|
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
|
|
||||||
elem = elems[i];
|
elem = elems[i];
|
||||||
|
|
||||||
if (isCurrentlyFocusableInternal(elem)) {
|
if (isCurrentlyFocusableInternal(elem)) {
|
||||||
|
@ -480,10 +449,9 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentIndex = -1;
|
let currentIndex = -1;
|
||||||
|
|
||||||
for (i = 0, length = list.length; i < length; i++) {
|
for (i = 0, length = list.length; i < length; i++) {
|
||||||
|
|
||||||
elem = list[i];
|
elem = list[i];
|
||||||
|
|
||||||
if (sourceElement === elem || elem.contains(sourceElement)) {
|
if (sourceElement === elem || elem.contains(sourceElement)) {
|
||||||
|
@ -496,39 +464,41 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var newIndex = currentIndex + offset;
|
let newIndex = currentIndex + offset;
|
||||||
newIndex = Math.max(0, newIndex);
|
newIndex = Math.max(0, newIndex);
|
||||||
newIndex = Math.min(newIndex, list.length - 1);
|
newIndex = Math.min(newIndex, list.length - 1);
|
||||||
|
|
||||||
var newElem = list[newIndex];
|
const newElem = list[newIndex];
|
||||||
if (newElem) {
|
if (newElem) {
|
||||||
focus(newElem);
|
focus(newElem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
/* eslint-enable indent */
|
||||||
|
|
||||||
|
export default {
|
||||||
autoFocus: autoFocus,
|
autoFocus: autoFocus,
|
||||||
focus: focus,
|
focus: focus,
|
||||||
focusableParent: focusableParent,
|
focusableParent: focusableParent,
|
||||||
getFocusableElements: getFocusableElements,
|
getFocusableElements: getFocusableElements,
|
||||||
moveLeft: function (sourceElement, options) {
|
moveLeft: function (sourceElement, options) {
|
||||||
var container = options ? options.container : null;
|
const container = options ? options.container : null;
|
||||||
var focusableElements = options ? options.focusableElements : null;
|
const focusableElements = options ? options.focusableElements : null;
|
||||||
nav(sourceElement, 0, container, focusableElements);
|
nav(sourceElement, 0, container, focusableElements);
|
||||||
},
|
},
|
||||||
moveRight: function (sourceElement, options) {
|
moveRight: function (sourceElement, options) {
|
||||||
var container = options ? options.container : null;
|
const container = options ? options.container : null;
|
||||||
var focusableElements = options ? options.focusableElements : null;
|
const focusableElements = options ? options.focusableElements : null;
|
||||||
nav(sourceElement, 1, container, focusableElements);
|
nav(sourceElement, 1, container, focusableElements);
|
||||||
},
|
},
|
||||||
moveUp: function (sourceElement, options) {
|
moveUp: function (sourceElement, options) {
|
||||||
var container = options ? options.container : null;
|
const container = options ? options.container : null;
|
||||||
var focusableElements = options ? options.focusableElements : null;
|
const focusableElements = options ? options.focusableElements : null;
|
||||||
nav(sourceElement, 2, container, focusableElements);
|
nav(sourceElement, 2, container, focusableElements);
|
||||||
},
|
},
|
||||||
moveDown: function (sourceElement, options) {
|
moveDown: function (sourceElement, options) {
|
||||||
var container = options ? options.container : null;
|
const container = options ? options.container : null;
|
||||||
var focusableElements = options ? options.focusableElements : null;
|
const focusableElements = options ? options.focusableElements : null;
|
||||||
nav(sourceElement, 3, container, focusableElements);
|
nav(sourceElement, 3, container, focusableElements);
|
||||||
},
|
},
|
||||||
sendText: sendText,
|
sendText: sendText,
|
||||||
|
@ -539,4 +509,3 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
focusLast: focusLast,
|
focusLast: focusLast,
|
||||||
moveFocus: moveFocus
|
moveFocus: moveFocus
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
|
@ -1,28 +1,30 @@
|
||||||
define(['dom', 'appRouter', 'connectionManager'], function (dom, appRouter, connectionManager) {
|
/* eslint-disable indent */
|
||||||
'use strict';
|
|
||||||
|
import dom from 'dom';
|
||||||
|
import appRouter from 'appRouter';
|
||||||
|
|
||||||
function onGroupedCardClick(e, card) {
|
function onGroupedCardClick(e, card) {
|
||||||
var itemId = card.getAttribute('data-id');
|
const itemId = card.getAttribute('data-id');
|
||||||
var serverId = card.getAttribute('data-serverid');
|
const serverId = card.getAttribute('data-serverid');
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
var userId = apiClient.getCurrentUserId();
|
const userId = apiClient.getCurrentUserId();
|
||||||
var playedIndicator = card.querySelector('.playedIndicator');
|
const playedIndicator = card.querySelector('.playedIndicator');
|
||||||
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
const playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
||||||
var options = {
|
const options = {
|
||||||
Limit: parseInt(playedIndicatorHtml || '10'),
|
Limit: parseInt(playedIndicatorHtml || '10'),
|
||||||
Fields: 'PrimaryImageAspectRatio,DateCreated',
|
Fields: 'PrimaryImageAspectRatio,DateCreated',
|
||||||
ParentId: itemId,
|
ParentId: itemId,
|
||||||
GroupItems: false
|
GroupItems: false
|
||||||
};
|
};
|
||||||
var actionableParent = dom.parentWithTag(e.target, ['A', 'BUTTON', 'INPUT']);
|
const actionableParent = dom.parentWithTag(e.target, ['A', 'BUTTON', 'INPUT']);
|
||||||
|
|
||||||
if (!actionableParent || actionableParent.classList.contains('cardContent')) {
|
if (!actionableParent || actionableParent.classList.contains('cardContent')) {
|
||||||
apiClient.getJSON(apiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
apiClient.getJSON(apiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
||||||
if (1 === items.length) {
|
if (items.length === 1) {
|
||||||
return void appRouter.showItem(items[0]);
|
return void appRouter.showItem(items[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = 'details?id=' + itemId + '&serverId=' + serverId;
|
const url = 'details?id=' + itemId + '&serverId=' + serverId;
|
||||||
Dashboard.navigate(url);
|
Dashboard.navigate(url);
|
||||||
});
|
});
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -31,15 +33,12 @@ define(['dom', 'appRouter', 'connectionManager'], function (dom, appRouter, conn
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onItemsContainerClick(e) {
|
export default function onItemsContainerClick(e) {
|
||||||
var groupedCard = dom.parentWithClass(e.target, 'groupedCard');
|
const groupedCard = dom.parentWithClass(e.target, 'groupedCard');
|
||||||
|
|
||||||
if (groupedCard) {
|
if (groupedCard) {
|
||||||
onGroupedCardClick(e, groupedCard);
|
onGroupedCardClick(e, groupedCard);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
/* eslint-enable indent */
|
||||||
onItemsContainerClick: onItemsContainerClick
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectionManager', 'require', 'loading', 'scrollHelper', 'emby-checkbox', 'emby-radio', 'css!./../formdialog', 'material-icons'], function (dialogHelper, globalize, userSettings, layoutManager, connectionManager, require, loading, scrollHelper) {
|
import dialogHelper from 'dialogHelper';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import scrollHelper from 'scrollHelper';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-radio';
|
||||||
|
import 'css!./../formdialog';
|
||||||
|
import 'material-icons';
|
||||||
|
|
||||||
function saveCategories(context, options) {
|
function saveCategories(context, options) {
|
||||||
|
const categories = [];
|
||||||
|
|
||||||
var categories = [];
|
const chkCategorys = context.querySelectorAll('.chkCategory');
|
||||||
|
for (const chkCategory of chkCategorys) {
|
||||||
|
const type = chkCategory.getAttribute('data-type');
|
||||||
|
|
||||||
var chkCategorys = context.querySelectorAll('.chkCategory');
|
if (chkCategory.checked) {
|
||||||
for (var i = 0, length = chkCategorys.length; i < length; i++) {
|
|
||||||
|
|
||||||
var type = chkCategorys[i].getAttribute('data-type');
|
|
||||||
|
|
||||||
if (chkCategorys[i].checked) {
|
|
||||||
categories.push(type);
|
categories.push(type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -25,79 +30,66 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadCategories(context, options) {
|
function loadCategories(context, options) {
|
||||||
|
const selectedCategories = options.categories || [];
|
||||||
|
|
||||||
var selectedCategories = options.categories || [];
|
const chkCategorys = context.querySelectorAll('.chkCategory');
|
||||||
|
for (const chkCategory of chkCategorys) {
|
||||||
|
const type = chkCategory.getAttribute('data-type');
|
||||||
|
|
||||||
var chkCategorys = context.querySelectorAll('.chkCategory');
|
chkCategory.checked = !selectedCategories.length || selectedCategories.indexOf(type) !== -1;
|
||||||
for (var i = 0, length = chkCategorys.length; i < length; i++) {
|
|
||||||
|
|
||||||
var type = chkCategorys[i].getAttribute('data-type');
|
|
||||||
|
|
||||||
chkCategorys[i].checked = !selectedCategories.length || selectedCategories.indexOf(type) !== -1;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(context) {
|
function save(context) {
|
||||||
|
const chkIndicators = context.querySelectorAll('.chkIndicator');
|
||||||
|
|
||||||
var i;
|
for (const chkIndicator of chkIndicators) {
|
||||||
var length;
|
const type = chkIndicator.getAttribute('data-type');
|
||||||
|
userSettings.set('guide-indicator-' + type, chkIndicator.checked);
|
||||||
var chkIndicators = context.querySelectorAll('.chkIndicator');
|
|
||||||
for (i = 0, length = chkIndicators.length; i < length; i++) {
|
|
||||||
|
|
||||||
var type = chkIndicators[i].getAttribute('data-type');
|
|
||||||
userSettings.set('guide-indicator-' + type, chkIndicators[i].checked);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
userSettings.set('guide-colorcodedbackgrounds', context.querySelector('.chkColorCodedBackgrounds').checked);
|
userSettings.set('guide-colorcodedbackgrounds', context.querySelector('.chkColorCodedBackgrounds').checked);
|
||||||
userSettings.set('livetv-favoritechannelsattop', context.querySelector('.chkFavoriteChannelsAtTop').checked);
|
userSettings.set('livetv-favoritechannelsattop', context.querySelector('.chkFavoriteChannelsAtTop').checked);
|
||||||
|
|
||||||
var sortBys = context.querySelectorAll('.chkSortOrder');
|
const sortBys = context.querySelectorAll('.chkSortOrder');
|
||||||
for (i = 0, length = sortBys.length; i < length; i++) {
|
for (const sortBy of sortBys) {
|
||||||
if (sortBys[i].checked) {
|
if (sortBy.checked) {
|
||||||
userSettings.set('livetv-channelorder', sortBys[i].value);
|
userSettings.set('livetv-channelorder', sortBy.value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function load(context) {
|
function load(context) {
|
||||||
|
const chkIndicators = context.querySelectorAll('.chkIndicator');
|
||||||
|
|
||||||
var i;
|
for (const chkIndicator of chkIndicators) {
|
||||||
var length;
|
const type = chkIndicator.getAttribute('data-type');
|
||||||
|
|
||||||
var chkIndicators = context.querySelectorAll('.chkIndicator');
|
if (chkIndicator.getAttribute('data-default') === 'true') {
|
||||||
for (i = 0, length = chkIndicators.length; i < length; i++) {
|
chkIndicator.checked = userSettings.get('guide-indicator-' + type) !== 'false';
|
||||||
|
|
||||||
var type = chkIndicators[i].getAttribute('data-type');
|
|
||||||
|
|
||||||
if (chkIndicators[i].getAttribute('data-default') === 'true') {
|
|
||||||
chkIndicators[i].checked = userSettings.get('guide-indicator-' + type) !== 'false';
|
|
||||||
} else {
|
} else {
|
||||||
chkIndicators[i].checked = userSettings.get('guide-indicator-' + type) === 'true';
|
chkIndicator.checked = userSettings.get('guide-indicator-' + type) === 'true';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
context.querySelector('.chkColorCodedBackgrounds').checked = userSettings.get('guide-colorcodedbackgrounds') === 'true';
|
context.querySelector('.chkColorCodedBackgrounds').checked = userSettings.get('guide-colorcodedbackgrounds') === 'true';
|
||||||
context.querySelector('.chkFavoriteChannelsAtTop').checked = userSettings.get('livetv-favoritechannelsattop') !== 'false';
|
context.querySelector('.chkFavoriteChannelsAtTop').checked = userSettings.get('livetv-favoritechannelsattop') !== 'false';
|
||||||
|
|
||||||
var sortByValue = userSettings.get('livetv-channelorder') || 'Number';
|
const sortByValue = userSettings.get('livetv-channelorder') || 'Number';
|
||||||
|
|
||||||
var sortBys = context.querySelectorAll('.chkSortOrder');
|
const sortBys = context.querySelectorAll('.chkSortOrder');
|
||||||
for (i = 0, length = sortBys.length; i < length; i++) {
|
for (const sortBy of sortBys) {
|
||||||
sortBys[i].checked = sortBys[i].value === sortByValue;
|
sortBy.checked = sortBy.value === sortByValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEditor(options) {
|
function showEditor(options) {
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
let settingsChanged = false;
|
||||||
|
|
||||||
var settingsChanged = false;
|
import('text!./guide-settings.template.html').then(({ default: template }) => {
|
||||||
|
const dialogOptions = {
|
||||||
require(['text!./guide-settings.template.html'], function (template) {
|
|
||||||
|
|
||||||
var dialogOptions = {
|
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
@ -108,23 +100,21 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
||||||
dialogOptions.size = 'small';
|
dialogOptions.size = 'small';
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += globalize.translateDocument(template, 'core');
|
html += globalize.translateHtml(template, 'core');
|
||||||
|
|
||||||
dlg.innerHTML = html;
|
dlg.innerHTML = html;
|
||||||
|
|
||||||
dlg.addEventListener('change', function () {
|
dlg.addEventListener('change', function () {
|
||||||
|
|
||||||
settingsChanged = true;
|
settingsChanged = true;
|
||||||
});
|
});
|
||||||
|
|
||||||
dlg.addEventListener('close', function () {
|
dlg.addEventListener('close', function () {
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||||
}
|
}
|
||||||
|
@ -154,7 +144,6 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
show: showEditor
|
show: showEditor
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="formDialogHeader">
|
<div class="formDialogHeader">
|
||||||
<button is="paper-icon-button-light" class="btnCancel autoSize" title="${LabelPrevious}" tabindex="-1">
|
<button is="paper-icon-button-light" class="btnCancel autoSize" title="${Previous}" tabindex="-1">
|
||||||
<span class="material-icons arrow_back" aria-hidden="true"></span>
|
<span class="material-icons arrow_back" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
<h3 class="formDialogHeaderTitle">
|
<h3 class="formDialogHeaderTitle">
|
||||||
|
|
|
@ -70,6 +70,10 @@
|
||||||
contain: strict;
|
contain: strict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.programContainer.emby-scroller {
|
||||||
|
margin: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.channelPrograms {
|
.channelPrograms {
|
||||||
height: 4.42em;
|
height: 4.42em;
|
||||||
contain: strict;
|
contain: strict;
|
||||||
|
|
|
@ -29,10 +29,10 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="guideOptions hide">
|
<div class="guideOptions hide">
|
||||||
<button is="paper-icon-button-light" type="button" class="btnPreviousPage" title="${LabelPrevious}">
|
<button is="paper-icon-button-light" type="button" class="btnPreviousPage" title="${Previous}">
|
||||||
<span class="material-icons arrow_back" aria-hidden="true"></span>
|
<span class="material-icons arrow_back" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
<button is="paper-icon-button-light" type="button" class="btnNextPage" title="${LabelNext}">
|
<button is="paper-icon-button-light" type="button" class="btnNextPage" title="${Next}">
|
||||||
<span class="material-icons arrow_forward" aria-hidden="true"></span>
|
<span class="material-icons arrow_forward" aria-hidden="true"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,30 +1,37 @@
|
||||||
define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loading', 'connectionManager', 'homeSections', 'dom', 'events', 'listViewStyle', 'emby-select', 'emby-checkbox'], function (require, appHost, layoutManager, focusManager, globalize, loading, connectionManager, homeSections, dom, events) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import focusManager from 'focusManager';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import loading from 'loading';
|
||||||
|
import homeSections from 'homeSections';
|
||||||
|
import dom from 'dom';
|
||||||
|
import events from 'events';
|
||||||
|
import 'listViewStyle';
|
||||||
|
import 'emby-select';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
|
||||||
var numConfigurableSections = 7;
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
const numConfigurableSections = 7;
|
||||||
|
|
||||||
function renderViews(page, user, result) {
|
function renderViews(page, user, result) {
|
||||||
|
let folderHtml = '';
|
||||||
var folderHtml = '';
|
|
||||||
|
|
||||||
folderHtml += '<div class="checkboxList">';
|
folderHtml += '<div class="checkboxList">';
|
||||||
folderHtml += result.map(function (i) {
|
folderHtml += result.map(i => {
|
||||||
|
let currentHtml = '';
|
||||||
|
|
||||||
var currentHtml = '';
|
const id = `chkGroupFolder${i.Id}`;
|
||||||
|
|
||||||
var id = 'chkGroupFolder' + i.Id;
|
const isChecked = user.Configuration.GroupedFolders.includes(i.Id);
|
||||||
|
|
||||||
var isChecked = user.Configuration.GroupedFolders.indexOf(i.Id) !== -1;
|
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||||
|
|
||||||
var checkedHtml = isChecked ? ' checked="checked"' : '';
|
|
||||||
|
|
||||||
currentHtml += '<label>';
|
currentHtml += '<label>';
|
||||||
currentHtml += '<input type="checkbox" is="emby-checkbox" class="chkGroupFolder" data-folderid="' + i.Id + '" id="' + id + '"' + checkedHtml + '/>';
|
currentHtml += `<input type="checkbox" is="emby-checkbox" class="chkGroupFolder" data-folderid="${i.Id}" id="${id}"${checkedHtml}/>`;
|
||||||
currentHtml += '<span>' + i.Name + '</span>';
|
currentHtml += `<span>${i.Name}</span>`;
|
||||||
currentHtml += '</label>';
|
currentHtml += '</label>';
|
||||||
|
|
||||||
return currentHtml;
|
return currentHtml;
|
||||||
|
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
folderHtml += '</div>';
|
folderHtml += '</div>';
|
||||||
|
@ -33,8 +40,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLandingScreenOptions(type) {
|
function getLandingScreenOptions(type) {
|
||||||
|
const list = [];
|
||||||
var list = [];
|
|
||||||
|
|
||||||
if (type === 'movies') {
|
if (type === 'movies') {
|
||||||
list.push({
|
list.push({
|
||||||
|
@ -69,26 +75,30 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
value: 'suggestions'
|
value: 'suggestions'
|
||||||
});
|
});
|
||||||
list.push({
|
list.push({
|
||||||
name: globalize.translate('Latest'),
|
name: globalize.translate('Upcoming'),
|
||||||
value: 'latest'
|
value: 'upcoming'
|
||||||
});
|
});
|
||||||
list.push({
|
list.push({
|
||||||
name: globalize.translate('Genres'),
|
name: globalize.translate('Genres'),
|
||||||
value: 'genres'
|
value: 'genres'
|
||||||
});
|
});
|
||||||
list.push({
|
list.push({
|
||||||
name: globalize.translate('Favorites'),
|
name: globalize.translate('Networks'),
|
||||||
value: 'favorites'
|
value: 'networks'
|
||||||
|
});
|
||||||
|
list.push({
|
||||||
|
name: globalize.translate('Episodes'),
|
||||||
|
value: 'episodes'
|
||||||
});
|
});
|
||||||
} else if (type === 'music') {
|
} else if (type === 'music') {
|
||||||
list.push({
|
list.push({
|
||||||
name: globalize.translate('Suggestions'),
|
name: globalize.translate('Albums'),
|
||||||
value: 'suggestions',
|
value: 'albums',
|
||||||
isDefault: true
|
isDefault: true
|
||||||
});
|
});
|
||||||
list.push({
|
list.push({
|
||||||
name: globalize.translate('Albums'),
|
name: globalize.translate('Suggestions'),
|
||||||
value: 'albums'
|
value: 'suggestions'
|
||||||
});
|
});
|
||||||
list.push({
|
list.push({
|
||||||
name: globalize.translate('HeaderAlbumArtists'),
|
name: globalize.translate('HeaderAlbumArtists'),
|
||||||
|
@ -122,28 +132,22 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLandingScreenOptionsHtml(type, userValue) {
|
function getLandingScreenOptionsHtml(type, userValue) {
|
||||||
|
return getLandingScreenOptions(type).map(o => {
|
||||||
|
const selected = userValue === o.value || (o.isDefault && !userValue);
|
||||||
|
const selectedHtml = selected ? ' selected' : '';
|
||||||
|
const optionValue = o.isDefault ? '' : o.value;
|
||||||
|
|
||||||
return getLandingScreenOptions(type).map(function (o) {
|
return `<option value="${optionValue}"${selectedHtml}>${o.name}</option>`;
|
||||||
|
|
||||||
var selected = userValue === o.value || (o.isDefault && !userValue);
|
|
||||||
var selectedHtml = selected ? ' selected' : '';
|
|
||||||
var optionValue = o.isDefault ? '' : o.value;
|
|
||||||
|
|
||||||
return '<option value="' + optionValue + '"' + selectedHtml + '>' + o.name + '</option>';
|
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderViewOrder(context, user, result) {
|
function renderViewOrder(context, user, result) {
|
||||||
|
let html = '';
|
||||||
|
|
||||||
var html = '';
|
html += result.Items.map((view) => {
|
||||||
|
let currentHtml = '';
|
||||||
|
|
||||||
var index = 0;
|
currentHtml += `<div class="listItem viewItem" data-viewid="${view.Id}">`;
|
||||||
|
|
||||||
html += result.Items.map(function (view) {
|
|
||||||
|
|
||||||
var currentHtml = '';
|
|
||||||
|
|
||||||
currentHtml += '<div class="listItem viewItem" data-viewid="' + view.Id + '">';
|
|
||||||
|
|
||||||
currentHtml += '<span class="material-icons listItemIcon folder_open"></span>';
|
currentHtml += '<span class="material-icons listItemIcon folder_open"></span>';
|
||||||
|
|
||||||
|
@ -155,29 +159,25 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
currentHtml += '</div>';
|
currentHtml += '</div>';
|
||||||
|
|
||||||
currentHtml += '<button type="button" is="paper-icon-button-light" class="btnViewItemUp btnViewItemMove autoSize" title="' + globalize.translate('Up') + '"><span class="material-icons keyboard_arrow_up"></span></button>';
|
currentHtml += `<button type="button" is="paper-icon-button-light" class="btnViewItemUp btnViewItemMove autoSize" title="${globalize.translate('Up')}"><span class="material-icons keyboard_arrow_up"></span></button>`;
|
||||||
currentHtml += '<button type="button" is="paper-icon-button-light" class="btnViewItemDown btnViewItemMove autoSize" title="' + globalize.translate('Down') + '"><span class="material-icons keyboard_arrow_down"></span></button>';
|
currentHtml += `<button type="button" is="paper-icon-button-light" class="btnViewItemDown btnViewItemMove autoSize" title="${globalize.translate('Down')}"><span class="material-icons keyboard_arrow_down"></span></button>`;
|
||||||
|
|
||||||
currentHtml += '</div>';
|
currentHtml += '</div>';
|
||||||
|
|
||||||
index++;
|
|
||||||
return currentHtml;
|
return currentHtml;
|
||||||
|
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
context.querySelector('.viewOrderList').innerHTML = html;
|
context.querySelector('.viewOrderList').innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateHomeSectionValues(context, userSettings) {
|
function updateHomeSectionValues(context, userSettings) {
|
||||||
|
for (let i = 1; i <= 7; i++) {
|
||||||
|
const select = context.querySelector(`#selectHomeSection${i}`);
|
||||||
|
const defaultValue = homeSections.getDefaultSection(i - 1);
|
||||||
|
|
||||||
for (var i = 1; i <= 7; i++) {
|
const option = select.querySelector(`option[value=${defaultValue}]`) || select.querySelector('option[value=""]');
|
||||||
|
|
||||||
var select = context.querySelector('#selectHomeSection' + i);
|
const userValue = userSettings.get(`homesection${i - 1}`);
|
||||||
var defaultValue = homeSections.getDefaultSection(i - 1);
|
|
||||||
|
|
||||||
var option = select.querySelector('option[value=' + defaultValue + ']') || select.querySelector('option[value=""]');
|
|
||||||
|
|
||||||
var userValue = userSettings.get('homesection' + (i - 1));
|
|
||||||
|
|
||||||
option.value = '';
|
option.value = '';
|
||||||
|
|
||||||
|
@ -192,43 +192,39 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPerLibrarySettingsHtml(item, user, userSettings, apiClient) {
|
function getPerLibrarySettingsHtml(item, user, userSettings, apiClient) {
|
||||||
|
let html = '';
|
||||||
|
|
||||||
var html = '';
|
let isChecked;
|
||||||
|
|
||||||
var isChecked;
|
|
||||||
|
|
||||||
if (item.Type === 'Channel' || item.CollectionType === 'boxsets' || item.CollectionType === 'playlists') {
|
if (item.Type === 'Channel' || item.CollectionType === 'boxsets' || item.CollectionType === 'playlists') {
|
||||||
isChecked = (user.Configuration.MyMediaExcludes || []).indexOf(item.Id) === -1;
|
isChecked = !(user.Configuration.MyMediaExcludes || []).includes(item.Id);
|
||||||
html += '<div>';
|
html += '<div>';
|
||||||
html += '<label>';
|
html += '<label>';
|
||||||
html += '<input type="checkbox" is="emby-checkbox" class="chkIncludeInMyMedia" data-folderid="' + item.Id + '"' + (isChecked ? ' checked="checked"' : '') + '/>';
|
html += `<input type="checkbox" is="emby-checkbox" class="chkIncludeInMyMedia" data-folderid="${item.Id}"${isChecked ? ' checked="checked"' : ''}/>`;
|
||||||
html += '<span>' + globalize.translate('DisplayInMyMedia') + '</span>';
|
html += `<span>${globalize.translate('DisplayInMyMedia')}</span>`;
|
||||||
html += '</label>';
|
html += '</label>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var excludeFromLatest = ['playlists', 'livetv', 'boxsets', 'channels'];
|
const excludeFromLatest = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||||
if (excludeFromLatest.indexOf(item.CollectionType || '') === -1) {
|
if (!excludeFromLatest.includes(item.CollectionType || '')) {
|
||||||
|
isChecked = !user.Configuration.LatestItemsExcludes.includes(item.Id);
|
||||||
isChecked = user.Configuration.LatestItemsExcludes.indexOf(item.Id) === -1;
|
|
||||||
html += '<label class="fldIncludeInLatest">';
|
html += '<label class="fldIncludeInLatest">';
|
||||||
html += '<input type="checkbox" is="emby-checkbox" class="chkIncludeInLatest" data-folderid="' + item.Id + '"' + (isChecked ? ' checked="checked"' : '') + '/>';
|
html += `<input type="checkbox" is="emby-checkbox" class="chkIncludeInLatest" data-folderid="${item.Id}"${isChecked ? ' checked="checked"' : ''}/>`;
|
||||||
html += '<span>' + globalize.translate('DisplayInOtherHomeScreenSections') + '</span>';
|
html += `<span>${globalize.translate('DisplayInOtherHomeScreenSections')}</span>`;
|
||||||
html += '</label>';
|
html += '</label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (html) {
|
if (html) {
|
||||||
|
html = `<div class="checkboxListContainer">${html}</div>`;
|
||||||
html = '<div class="checkboxListContainer">' + html + '</div>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item.CollectionType === 'movies' || item.CollectionType === 'tvshows' || item.CollectionType === 'music' || item.CollectionType === 'livetv') {
|
if (item.CollectionType === 'movies' || item.CollectionType === 'tvshows' || item.CollectionType === 'music' || item.CollectionType === 'livetv') {
|
||||||
|
const idForLanding = item.CollectionType === 'livetv' ? item.CollectionType : item.Id;
|
||||||
var idForLanding = item.CollectionType === 'livetv' ? item.CollectionType : item.Id;
|
|
||||||
html += '<div class="selectContainer">';
|
html += '<div class="selectContainer">';
|
||||||
html += '<select is="emby-select" class="selectLanding" data-folderid="' + idForLanding + '" label="' + globalize.translate('LabelDefaultScreen') + '">';
|
html += `<select is="emby-select" class="selectLanding" data-folderid="${idForLanding}" label="${globalize.translate('LabelDefaultScreen')}">`;
|
||||||
|
|
||||||
var userValue = userSettings.get('landing-' + idForLanding);
|
const userValue = userSettings.get(`landing-${idForLanding}`);
|
||||||
|
|
||||||
html += getLandingScreenOptionsHtml(item.CollectionType, userValue);
|
html += getLandingScreenOptionsHtml(item.CollectionType, userValue);
|
||||||
|
|
||||||
|
@ -237,8 +233,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (html) {
|
if (html) {
|
||||||
|
let prefix = '';
|
||||||
var prefix = '';
|
|
||||||
prefix += '<div class="verticalSection">';
|
prefix += '<div class="verticalSection">';
|
||||||
|
|
||||||
prefix += '<h2 class="sectionTitle">';
|
prefix += '<h2 class="sectionTitle">';
|
||||||
|
@ -253,12 +248,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderPerLibrarySettings(context, user, userViews, userSettings, apiClient) {
|
function renderPerLibrarySettings(context, user, userViews, userSettings, apiClient) {
|
||||||
|
const elem = context.querySelector('.perLibrarySettings');
|
||||||
|
let html = '';
|
||||||
|
|
||||||
var elem = context.querySelector('.perLibrarySettings');
|
for (let i = 0, length = userViews.length; i < length; i++) {
|
||||||
var html = '';
|
|
||||||
|
|
||||||
for (var i = 0, length = userViews.length; i < length; i++) {
|
|
||||||
|
|
||||||
html += getPerLibrarySettingsHtml(userViews[i], user, userSettings, apiClient);
|
html += getPerLibrarySettingsHtml(userViews[i], user, userSettings, apiClient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -266,16 +259,14 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadForm(context, user, userSettings, apiClient) {
|
function loadForm(context, user, userSettings, apiClient) {
|
||||||
|
|
||||||
context.querySelector('.chkHidePlayedFromLatest').checked = user.Configuration.HidePlayedInLatest || false;
|
context.querySelector('.chkHidePlayedFromLatest').checked = user.Configuration.HidePlayedInLatest || false;
|
||||||
|
|
||||||
updateHomeSectionValues(context, userSettings);
|
updateHomeSectionValues(context, userSettings);
|
||||||
|
|
||||||
var promise1 = apiClient.getUserViews({ IncludeHidden: true }, user.Id);
|
const promise1 = apiClient.getUserViews({ IncludeHidden: true }, user.Id);
|
||||||
var promise2 = apiClient.getJSON(apiClient.getUrl('Users/' + user.Id + '/GroupingOptions'));
|
const promise2 = apiClient.getJSON(apiClient.getUrl(`Users/${user.Id}/GroupingOptions`));
|
||||||
|
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
|
||||||
|
|
||||||
|
Promise.all([promise1, promise2]).then(responses => {
|
||||||
renderViewOrder(context, user, responses[0]);
|
renderViewOrder(context, user, responses[0]);
|
||||||
|
|
||||||
renderPerLibrarySettings(context, user, responses[0].Items, userSettings, apiClient);
|
renderPerLibrarySettings(context, user, responses[0].Items, userSettings, apiClient);
|
||||||
|
@ -286,48 +277,23 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSibling(elem, type, className) {
|
|
||||||
|
|
||||||
var sibling = elem[type];
|
|
||||||
|
|
||||||
while (sibling != null) {
|
|
||||||
if (sibling.classList.contains(className)) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (sibling != null) {
|
|
||||||
if (!sibling.classList.contains(className)) {
|
|
||||||
sibling = null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return sibling;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSectionOrderListClick(e) {
|
function onSectionOrderListClick(e) {
|
||||||
|
const target = dom.parentWithClass(e.target, 'btnViewItemMove');
|
||||||
var target = dom.parentWithClass(e.target, 'btnViewItemMove');
|
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
var viewItem = dom.parentWithClass(target, 'viewItem');
|
const viewItem = dom.parentWithClass(target, 'viewItem');
|
||||||
|
|
||||||
if (viewItem) {
|
if (viewItem) {
|
||||||
var ul = dom.parentWithClass(viewItem, 'paperList');
|
|
||||||
|
|
||||||
if (target.classList.contains('btnViewItemDown')) {
|
if (target.classList.contains('btnViewItemDown')) {
|
||||||
|
const next = viewItem.nextSibling;
|
||||||
var next = viewItem.nextSibling;
|
|
||||||
|
|
||||||
if (next) {
|
if (next) {
|
||||||
viewItem.parentNode.removeChild(viewItem);
|
viewItem.parentNode.removeChild(viewItem);
|
||||||
next.parentNode.insertBefore(viewItem, next.nextSibling);
|
next.parentNode.insertBefore(viewItem, next.nextSibling);
|
||||||
focusManager.focus(e.target);
|
focusManager.focus(e.target);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
const prev = viewItem.previousSibling;
|
||||||
var prev = viewItem.previousSibling;
|
|
||||||
|
|
||||||
if (prev) {
|
if (prev) {
|
||||||
viewItem.parentNode.removeChild(viewItem);
|
viewItem.parentNode.removeChild(viewItem);
|
||||||
|
@ -340,44 +306,37 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function getCheckboxItems(selector, context, isChecked) {
|
function getCheckboxItems(selector, context, isChecked) {
|
||||||
|
const inputs = context.querySelectorAll(selector);
|
||||||
|
const list = [];
|
||||||
|
|
||||||
var inputs = context.querySelectorAll(selector);
|
for (let i = 0, length = inputs.length; i < length; i++) {
|
||||||
var list = [];
|
|
||||||
|
|
||||||
for (var i = 0, length = inputs.length; i < length; i++) {
|
|
||||||
|
|
||||||
if (inputs[i].checked === isChecked) {
|
if (inputs[i].checked === isChecked) {
|
||||||
list.push(inputs[i]);
|
list.push(inputs[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveUser(context, user, userSettingsInstance, apiClient) {
|
function saveUser(context, user, userSettingsInstance, apiClient) {
|
||||||
|
|
||||||
user.Configuration.HidePlayedInLatest = context.querySelector('.chkHidePlayedFromLatest').checked;
|
user.Configuration.HidePlayedInLatest = context.querySelector('.chkHidePlayedFromLatest').checked;
|
||||||
|
|
||||||
user.Configuration.LatestItemsExcludes = getCheckboxItems('.chkIncludeInLatest', context, false).map(function (i) {
|
user.Configuration.LatestItemsExcludes = getCheckboxItems('.chkIncludeInLatest', context, false).map(i => {
|
||||||
|
|
||||||
return i.getAttribute('data-folderid');
|
return i.getAttribute('data-folderid');
|
||||||
});
|
});
|
||||||
|
|
||||||
user.Configuration.MyMediaExcludes = getCheckboxItems('.chkIncludeInMyMedia', context, false).map(function (i) {
|
user.Configuration.MyMediaExcludes = getCheckboxItems('.chkIncludeInMyMedia', context, false).map(i => {
|
||||||
|
|
||||||
return i.getAttribute('data-folderid');
|
return i.getAttribute('data-folderid');
|
||||||
});
|
});
|
||||||
|
|
||||||
user.Configuration.GroupedFolders = getCheckboxItems('.chkGroupFolder', context, true).map(function (i) {
|
user.Configuration.GroupedFolders = getCheckboxItems('.chkGroupFolder', context, true).map(i => {
|
||||||
|
|
||||||
return i.getAttribute('data-folderid');
|
return i.getAttribute('data-folderid');
|
||||||
});
|
});
|
||||||
|
|
||||||
var viewItems = context.querySelectorAll('.viewItem');
|
const viewItems = context.querySelectorAll('.viewItem');
|
||||||
var orderedViews = [];
|
const orderedViews = [];
|
||||||
var i;
|
let i;
|
||||||
var length;
|
let length;
|
||||||
for (i = 0, length = viewItems.length; i < length; i++) {
|
for (i = 0, length = viewItems.length; i < length; i++) {
|
||||||
orderedViews.push(viewItems[i].getAttribute('data-viewid'));
|
orderedViews.push(viewItems[i].getAttribute('data-viewid'));
|
||||||
}
|
}
|
||||||
|
@ -394,48 +353,42 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
userSettingsInstance.set('homesection5', context.querySelector('#selectHomeSection6').value);
|
userSettingsInstance.set('homesection5', context.querySelector('#selectHomeSection6').value);
|
||||||
userSettingsInstance.set('homesection6', context.querySelector('#selectHomeSection7').value);
|
userSettingsInstance.set('homesection6', context.querySelector('#selectHomeSection7').value);
|
||||||
|
|
||||||
var selectLandings = context.querySelectorAll('.selectLanding');
|
const selectLandings = context.querySelectorAll('.selectLanding');
|
||||||
for (i = 0, length = selectLandings.length; i < length; i++) {
|
for (i = 0, length = selectLandings.length; i < length; i++) {
|
||||||
var selectLanding = selectLandings[i];
|
const selectLanding = selectLandings[i];
|
||||||
userSettingsInstance.set('landing-' + selectLanding.getAttribute('data-folderid'), selectLanding.value);
|
userSettingsInstance.set(`landing-${selectLanding.getAttribute('data-folderid')}`, selectLanding.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiClient.updateUserConfiguration(user.Id, user.Configuration);
|
return apiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
apiClient.getUser(userId).then(function (user) {
|
apiClient.getUser(userId).then(user => {
|
||||||
|
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||||
saveUser(context, user, userSettings, apiClient).then(function () {
|
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
if (enableSaveConfirmation) {
|
if (enableSaveConfirmation) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
events.trigger(instance, 'saved');
|
events.trigger(instance, 'saved');
|
||||||
|
}, () => {
|
||||||
}, function () {
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
|
const self = this;
|
||||||
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
|
const userId = self.options.userId;
|
||||||
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
var self = this;
|
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||||
var userId = self.options.userId;
|
|
||||||
var userSettings = self.options.userSettings;
|
|
||||||
|
|
||||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
|
||||||
|
|
||||||
var enableSaveConfirmation = self.options.enableSaveConfirmation;
|
|
||||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -447,14 +400,13 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChange(e) {
|
function onChange(e) {
|
||||||
|
const chkIncludeInMyMedia = dom.parentWithClass(e.target, 'chkIncludeInMyMedia');
|
||||||
var chkIncludeInMyMedia = dom.parentWithClass(e.target, 'chkIncludeInMyMedia');
|
|
||||||
if (!chkIncludeInMyMedia) {
|
if (!chkIncludeInMyMedia) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var section = dom.parentWithClass(chkIncludeInMyMedia, 'verticalSection');
|
const section = dom.parentWithClass(chkIncludeInMyMedia, 'verticalSection');
|
||||||
var fldIncludeInLatest = section.querySelector('.fldIncludeInLatest');
|
const fldIncludeInLatest = section.querySelector('.fldIncludeInLatest');
|
||||||
if (fldIncludeInLatest) {
|
if (fldIncludeInLatest) {
|
||||||
if (chkIncludeInMyMedia.checked) {
|
if (chkIncludeInMyMedia.checked) {
|
||||||
fldIncludeInLatest.classList.remove('hide');
|
fldIncludeInLatest.classList.remove('hide');
|
||||||
|
@ -465,14 +417,12 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
|
|
||||||
function embed(options, self) {
|
function embed(options, self) {
|
||||||
|
return import('text!./homeScreenSettings.template.html').then(({default: template}) => {
|
||||||
require(['text!./homeScreenSettings.template.html'], function (template) {
|
for (let i = 1; i <= numConfigurableSections; i++) {
|
||||||
|
template = template.replace(`{section${i}label}`, globalize.translate('LabelHomeScreenSectionValue', i));
|
||||||
for (var i = 1; i <= numConfigurableSections; i++) {
|
|
||||||
template = template.replace('{section' + i + 'label}', globalize.translate('LabelHomeScreenSectionValue', i));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
options.element.innerHTML = globalize.translateHtml(template, 'core');
|
||||||
|
|
||||||
options.element.querySelector('.viewOrderList').addEventListener('click', onSectionOrderListClick);
|
options.element.querySelector('.viewOrderList').addEventListener('click', onSectionOrderListClick);
|
||||||
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
||||||
|
@ -492,28 +442,24 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function HomeScreenSettings(options) {
|
class HomeScreenSettings {
|
||||||
|
constructor(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
|
|
||||||
embed(options, this);
|
embed(options, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeScreenSettings.prototype.loadData = function (autoFocus) {
|
loadData(autoFocus) {
|
||||||
|
const self = this;
|
||||||
var self = this;
|
const context = self.options.element;
|
||||||
var context = self.options.element;
|
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = window.connectionManager.getApiClient(self.options.serverId);
|
||||||
var userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
apiClient.getUser(userId).then(function (user) {
|
|
||||||
|
|
||||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
|
||||||
|
|
||||||
|
apiClient.getUser(userId).then(user => {
|
||||||
|
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||||
self.dataLoaded = true;
|
self.dataLoaded = true;
|
||||||
|
|
||||||
loadForm(context, user, userSettings, apiClient);
|
loadForm(context, user, userSettings, apiClient);
|
||||||
|
@ -523,16 +469,17 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
|
|
||||||
HomeScreenSettings.prototype.submit = function () {
|
submit() {
|
||||||
onSubmit.call(this);
|
onSubmit.call(this);
|
||||||
};
|
}
|
||||||
|
|
||||||
HomeScreenSettings.prototype.destroy = function () {
|
|
||||||
|
|
||||||
|
destroy() {
|
||||||
this.options = null;
|
this.options = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return HomeScreenSettings;
|
/* eslint-enable indent */
|
||||||
});
|
|
||||||
|
export default HomeScreenSettings;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<form style="margin:0 auto;">
|
<form style="margin:0 auto;">
|
||||||
<div class="verticalSection verticalSection-extrabottompadding">
|
<div class="verticalSection verticalSection-extrabottompadding">
|
||||||
<h2 class="sectionTitle">${HeaderHome}</h2>
|
<h2 class="sectionTitle">${Home}</h2>
|
||||||
|
|
||||||
<div class="selectContainer hide selectTVHomeScreenContainer">
|
<div class="selectContainer hide selectTVHomeScreenContainer">
|
||||||
<select is="emby-select" class="selectTVHomeScreen" label="${LabelTVHomeScreen}">
|
<select is="emby-select" class="selectTVHomeScreen" label="${LabelTVHomeScreen}">
|
||||||
|
@ -25,7 +25,7 @@
|
||||||
<option value="resume">${HeaderContinueWatching}</option>
|
<option value="resume">${HeaderContinueWatching}</option>
|
||||||
<option value="resumeaudio">${HeaderContinueListening}</option>
|
<option value="resumeaudio">${HeaderContinueListening}</option>
|
||||||
<option value="latestmedia">${HeaderLatestMedia}</option>
|
<option value="latestmedia">${HeaderLatestMedia}</option>
|
||||||
<option value="nextup">${HeaderNextUp}</option>
|
<option value="nextup">${NextUp}</option>
|
||||||
<option value="livetv">${LiveTV}</option>
|
<option value="livetv">${LiveTV}</option>
|
||||||
<option value="none">${None}</option>
|
<option value="none">${None}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
<option value="resume">${HeaderContinueWatching}</option>
|
<option value="resume">${HeaderContinueWatching}</option>
|
||||||
<option value="resumeaudio">${HeaderContinueListening}</option>
|
<option value="resumeaudio">${HeaderContinueListening}</option>
|
||||||
<option value="latestmedia">${HeaderLatestMedia}</option>
|
<option value="latestmedia">${HeaderLatestMedia}</option>
|
||||||
<option value="nextup">${HeaderNextUp}</option>
|
<option value="nextup">${NextUp}</option>
|
||||||
<option value="livetv">${LiveTV}</option>
|
<option value="livetv">${LiveTV}</option>
|
||||||
<option value="none">${None}</option>
|
<option value="none">${None}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
<option value="resume">${HeaderContinueWatching}</option>
|
<option value="resume">${HeaderContinueWatching}</option>
|
||||||
<option value="resumeaudio">${HeaderContinueListening}</option>
|
<option value="resumeaudio">${HeaderContinueListening}</option>
|
||||||
<option value="latestmedia">${HeaderLatestMedia}</option>
|
<option value="latestmedia">${HeaderLatestMedia}</option>
|
||||||
<option value="nextup">${HeaderNextUp}</option>
|
<option value="nextup">${NextUp}</option>
|
||||||
<option value="livetv">${LiveTV}</option>
|
<option value="livetv">${LiveTV}</option>
|
||||||
<option value="none">${None}</option>
|
<option value="none">${None}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -64,7 +64,7 @@
|
||||||
<option value="resume">${HeaderContinueWatching}</option>
|
<option value="resume">${HeaderContinueWatching}</option>
|
||||||
<option value="resumeaudio">${HeaderContinueListening}</option>
|
<option value="resumeaudio">${HeaderContinueListening}</option>
|
||||||
<option value="latestmedia">${HeaderLatestMedia}</option>
|
<option value="latestmedia">${HeaderLatestMedia}</option>
|
||||||
<option value="nextup">${HeaderNextUp}</option>
|
<option value="nextup">${NextUp}</option>
|
||||||
<option value="livetv">${LiveTV}</option>
|
<option value="livetv">${LiveTV}</option>
|
||||||
<option value="none">${None}</option>
|
<option value="none">${None}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
<option value="resume">${HeaderContinueWatching}</option>
|
<option value="resume">${HeaderContinueWatching}</option>
|
||||||
<option value="resumeaudio">${HeaderContinueListening}</option>
|
<option value="resumeaudio">${HeaderContinueListening}</option>
|
||||||
<option value="latestmedia">${HeaderLatestMedia}</option>
|
<option value="latestmedia">${HeaderLatestMedia}</option>
|
||||||
<option value="nextup">${HeaderNextUp}</option>
|
<option value="nextup">${NextUp}</option>
|
||||||
<option value="livetv">${LiveTV}</option>
|
<option value="livetv">${LiveTV}</option>
|
||||||
<option value="none">${None}</option>
|
<option value="none">${None}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -90,7 +90,7 @@
|
||||||
<option value="resume">${HeaderContinueWatching}</option>
|
<option value="resume">${HeaderContinueWatching}</option>
|
||||||
<option value="resumeaudio">${HeaderContinueListening}</option>
|
<option value="resumeaudio">${HeaderContinueListening}</option>
|
||||||
<option value="latestmedia">${HeaderLatestMedia}</option>
|
<option value="latestmedia">${HeaderLatestMedia}</option>
|
||||||
<option value="nextup">${HeaderNextUp}</option>
|
<option value="nextup">${NextUp}</option>
|
||||||
<option value="livetv">${LiveTV}</option>
|
<option value="livetv">${LiveTV}</option>
|
||||||
<option value="none">${None}</option>
|
<option value="none">${None}</option>
|
||||||
</select>
|
</select>
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
<option value="resume">${HeaderContinueWatching}</option>
|
<option value="resume">${HeaderContinueWatching}</option>
|
||||||
<option value="resumeaudio">${HeaderContinueListening}</option>
|
<option value="resumeaudio">${HeaderContinueListening}</option>
|
||||||
<option value="latestmedia">${HeaderLatestMedia}</option>
|
<option value="latestmedia">${HeaderLatestMedia}</option>
|
||||||
<option value="nextup">${HeaderNextUp}</option>
|
<option value="nextup">${NextUp}</option>
|
||||||
<option value="livetv">${LiveTV}</option>
|
<option value="livetv">${LiveTV}</option>
|
||||||
<option value="none">${None}</option>
|
<option value="none">${None}</option>
|
||||||
</select>
|
</select>
|
||||||
|
|
|
@ -1,7 +1,19 @@
|
||||||
define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'layoutManager', 'imageLoader', 'globalize', 'itemShortcuts', 'itemHelper', 'appRouter', 'scripts/imagehelper', 'paper-icon-button-light', 'emby-itemscontainer', 'emby-scroller', 'emby-button', 'css!./homesections'], function (connectionManager, cardBuilder, appSettings, dom, appHost, layoutManager, imageLoader, globalize, itemShortcuts, itemHelper, appRouter, imageHelper) {
|
import cardBuilder from 'cardBuilder';
|
||||||
'use strict';
|
import dom from 'dom';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import imageLoader from 'imageLoader';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import appRouter from 'appRouter';
|
||||||
|
import imageHelper from 'scripts/imagehelper';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'emby-itemscontainer';
|
||||||
|
import 'emby-scroller';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'css!./homesections';
|
||||||
|
|
||||||
function getDefaultSection(index) {
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
export function getDefaultSection(index) {
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
return 'smalllibrarytiles';
|
return 'smalllibrarytiles';
|
||||||
|
@ -23,9 +35,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllSectionsToShow(userSettings, sectionCount) {
|
function getAllSectionsToShow(userSettings, sectionCount) {
|
||||||
var sections = [];
|
const sections = [];
|
||||||
for (var i = 0, length = sectionCount; i < length; i++) {
|
for (let i = 0, length = sectionCount; i < length; i++) {
|
||||||
var section = userSettings.get('homesection' + i) || getDefaultSection(i);
|
let section = userSettings.get('homesection' + i) || getDefaultSection(i);
|
||||||
if (section === 'folders') {
|
if (section === 'folders') {
|
||||||
section = getDefaultSection(0);
|
section = getDefaultSection(0);
|
||||||
}
|
}
|
||||||
|
@ -36,22 +48,22 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
return sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSections(elem, apiClient, user, userSettings) {
|
export function loadSections(elem, apiClient, user, userSettings) {
|
||||||
return getUserViews(apiClient, user.Id).then(function (userViews) {
|
return getUserViews(apiClient, user.Id).then(function (userViews) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
if (userViews.length) {
|
if (userViews.length) {
|
||||||
var sectionCount = 7;
|
const sectionCount = 7;
|
||||||
for (var i = 0; i < sectionCount; i++) {
|
for (let i = 0; i < sectionCount; i++) {
|
||||||
html += '<div class="verticalSection section' + i + '"></div>';
|
html += '<div class="verticalSection section' + i + '"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
elem.classList.add('homeSectionsContainer');
|
elem.classList.add('homeSectionsContainer');
|
||||||
|
|
||||||
var promises = [];
|
const promises = [];
|
||||||
var sections = getAllSectionsToShow(userSettings, sectionCount);
|
const sections = getAllSectionsToShow(userSettings, sectionCount);
|
||||||
for (var i = 0; i < sections.length; i++) {
|
for (let i = 0; i < sections.length; i++) {
|
||||||
promises.push(loadSection(elem, apiClient, user, userSettings, userViews, sections, i));
|
promises.push(loadSection(elem, apiClient, user, userSettings, userViews, sections, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +74,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var noLibDescription;
|
let noLibDescription;
|
||||||
if (user['Policy'] && user['Policy']['IsAdministrator']) {
|
if (user['Policy'] && user['Policy']['IsAdministrator']) {
|
||||||
noLibDescription = globalize.translate('NoCreatedLibraries', '<br><a id="button-createLibrary" class="button-link">', '</a>');
|
noLibDescription = globalize.translate('NoCreatedLibraries', '<br><a id="button-createLibrary" class="button-link">', '</a>');
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,7 +87,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var createNowLink = elem.querySelector('#button-createLibrary');
|
const createNowLink = elem.querySelector('#button-createLibrary');
|
||||||
if (createNowLink) {
|
if (createNowLink) {
|
||||||
createNowLink.addEventListener('click', function () {
|
createNowLink.addEventListener('click', function () {
|
||||||
Dashboard.navigate('library.html');
|
Dashboard.navigate('library.html');
|
||||||
|
@ -85,9 +97,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function destroySections(elem) {
|
export function destroySections(elem) {
|
||||||
var elems = elem.querySelectorAll('.itemsContainer');
|
const elems = elem.querySelectorAll('.itemsContainer');
|
||||||
for (var i = 0; i < elems.length; i++) {
|
for (let i = 0; i < elems.length; i++) {
|
||||||
elems[i].fetchData = null;
|
elems[i].fetchData = null;
|
||||||
elems[i].parentContainer = null;
|
elems[i].parentContainer = null;
|
||||||
elems[i].getItemsHtml = null;
|
elems[i].getItemsHtml = null;
|
||||||
|
@ -96,35 +108,32 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.innerHTML = '';
|
elem.innerHTML = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function pause(elem) {
|
export function pause(elem) {
|
||||||
var elems = elem.querySelectorAll('.itemsContainer');
|
const elems = elem.querySelectorAll('.itemsContainer');
|
||||||
for (var i = 0; i < elems.length; i++) {
|
for (let i = 0; i < elems.length; i++) {
|
||||||
elems[i].pause();
|
elems[i].pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resume(elem, options) {
|
export function resume(elem, options) {
|
||||||
var elems = elem.querySelectorAll('.itemsContainer');
|
const elems = elem.querySelectorAll('.itemsContainer');
|
||||||
var i;
|
const promises = [];
|
||||||
var length;
|
|
||||||
var promises = [];
|
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
promises.push(elems[i].resume(options));
|
promises.push(elems[i].resume(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
var promise = Promise.all(promises);
|
const promise = Promise.all(promises);
|
||||||
if (!options || options.returnPromise !== false) {
|
if (!options || options.returnPromise !== false) {
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSection(page, apiClient, user, userSettings, userViews, allSections, index) {
|
function loadSection(page, apiClient, user, userSettings, userViews, allSections, index) {
|
||||||
|
const section = allSections[index];
|
||||||
|
const userId = user.Id;
|
||||||
|
|
||||||
var section = allSections[index];
|
const elem = page.querySelector('.section' + index);
|
||||||
var userId = user.Id;
|
|
||||||
|
|
||||||
var elem = page.querySelector('.section' + index);
|
|
||||||
|
|
||||||
if (section === 'latestmedia') {
|
if (section === 'latestmedia') {
|
||||||
loadRecentlyAdded(elem, apiClient, user, userViews);
|
loadRecentlyAdded(elem, apiClient, user, userViews);
|
||||||
|
@ -172,7 +181,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLibraryButtonsHtml(items) {
|
function getLibraryButtonsHtml(items) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="verticalSection verticalSection-extrabottompadding">';
|
html += '<div class="verticalSection verticalSection-extrabottompadding">';
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
||||||
|
@ -180,9 +189,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-multiselect="false">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-multiselect="false">';
|
||||||
|
|
||||||
// library card background images
|
// library card background images
|
||||||
for (var i = 0, length = items.length; i < length; i++) {
|
for (let i = 0, length = items.length; i < length; i++) {
|
||||||
var item = items[i];
|
const item = items[i];
|
||||||
var icon = imageHelper.getLibraryIcon(item.CollectionType);
|
const icon = imageHelper.getLibraryIcon(item.CollectionType);
|
||||||
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl(item) + '" class="raised homeLibraryButton"><span class="material-icons homeLibraryIcon ' + icon + '"></span><span class="homeLibraryText">' + item.Name + '</span></a>';
|
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl(item) + '" class="raised homeLibraryButton"><span class="material-icons homeLibraryIcon ' + icon + '"></span><span class="homeLibraryText">' + item.Name + '</span></a>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,24 +203,16 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function loadlibraryButtons(elem, apiClient, user, userSettings, userViews) {
|
function loadlibraryButtons(elem, apiClient, user, userSettings, userViews) {
|
||||||
elem.classList.remove('verticalSection');
|
elem.classList.remove('verticalSection');
|
||||||
var html = getLibraryButtonsHtml(userViews);
|
const html = getLibraryButtonsHtml(userViews);
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
imageLoader.lazyChildren(elem);
|
imageLoader.lazyChildren(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Returns a random integer between min (inclusive) and max (inclusive)
|
|
||||||
* Using Math.round() will give you a non-uniform distribution!
|
|
||||||
*/
|
|
||||||
function getRandomInt(min, max) {
|
|
||||||
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getFetchLatestItemsFn(serverId, parentId, collectionType) {
|
function getFetchLatestItemsFn(serverId, parentId, collectionType) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
var limit = 16;
|
let limit = 16;
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
if (collectionType === 'music') {
|
if (collectionType === 'music') {
|
||||||
|
@ -227,7 +228,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo,Path',
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo,Path',
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
|
@ -241,8 +242,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getLatestItemsHtmlFn(itemType, viewType) {
|
function getLatestItemsHtmlFn(itemType, viewType) {
|
||||||
return function (items) {
|
return function (items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
var shape;
|
let shape;
|
||||||
if (itemType === 'Channel' || viewType === 'movies' || viewType === 'books' || viewType === 'tvshows') {
|
if (itemType === 'Channel' || viewType === 'movies' || viewType === 'books' || viewType === 'tvshows') {
|
||||||
shape = getPortraitShape();
|
shape = getPortraitShape();
|
||||||
} else if (viewType === 'music' || viewType === 'homevideos') {
|
} else if (viewType === 'music' || viewType === 'homevideos') {
|
||||||
|
@ -272,7 +273,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderLatestSection(elem, apiClient, user, parent) {
|
function renderLatestSection(elem, apiClient, user, parent) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||||
if (!layoutManager.tv) {
|
if (!layoutManager.tv) {
|
||||||
|
@ -303,7 +304,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getFetchLatestItemsFn(apiClient.serverId(), parent.Id, parent.CollectionType);
|
itemsContainer.fetchData = getFetchLatestItemsFn(apiClient.serverId(), parent.Id, parent.CollectionType);
|
||||||
itemsContainer.getItemsHtml = getLatestItemsHtmlFn(parent.Type, parent.CollectionType);
|
itemsContainer.getItemsHtml = getLatestItemsHtmlFn(parent.Type, parent.CollectionType);
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
|
@ -311,10 +312,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function loadRecentlyAdded(elem, apiClient, user, userViews) {
|
function loadRecentlyAdded(elem, apiClient, user, userViews) {
|
||||||
elem.classList.remove('verticalSection');
|
elem.classList.remove('verticalSection');
|
||||||
var excludeViewTypes = ['playlists', 'livetv', 'boxsets', 'channels'];
|
const excludeViewTypes = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||||
|
|
||||||
for (var i = 0, length = userViews.length; i < length; i++) {
|
for (let i = 0, length = userViews.length; i < length; i++) {
|
||||||
var item = userViews[i];
|
const item = userViews[i];
|
||||||
if (user.Configuration.LatestItemsExcludes.indexOf(item.Id) !== -1) {
|
if (user.Configuration.LatestItemsExcludes.indexOf(item.Id) !== -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +324,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var frag = document.createElement('div');
|
const frag = document.createElement('div');
|
||||||
frag.classList.add('verticalSection');
|
frag.classList.add('verticalSection');
|
||||||
frag.classList.add('hide');
|
frag.classList.add('hide');
|
||||||
elem.appendChild(frag);
|
elem.appendChild(frag);
|
||||||
|
@ -332,14 +333,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRequirePromise(deps) {
|
export function loadLibraryTiles(elem, apiClient, user, userSettings, shape, userViews, allSections) {
|
||||||
return new Promise(function (resolve, reject) {
|
let html = '';
|
||||||
require(deps, resolve);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function loadLibraryTiles(elem, apiClient, user, userSettings, shape, userViews, allSections) {
|
|
||||||
var html = '';
|
|
||||||
if (userViews.length) {
|
if (userViews.length) {
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
|
@ -372,10 +367,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getContinueWatchingFetchFn(serverId) {
|
function getContinueWatchingFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
var screenWidth = dom.getWindowSize().innerWidth;
|
const screenWidth = dom.getWindowSize().innerWidth;
|
||||||
|
|
||||||
var limit;
|
let limit;
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
limit = 12;
|
limit = 12;
|
||||||
} else {
|
} else {
|
||||||
|
@ -383,7 +378,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
limit = Math.min(limit, 5);
|
limit = Math.min(limit, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
|
@ -398,7 +393,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getContinueWatchingItemsHtml(items) {
|
function getContinueWatchingItemsHtml(items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
|
@ -419,7 +414,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadResumeVideo(elem, apiClient, userId) {
|
function loadResumeVideo(elem, apiClient, userId) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
|
@ -437,7 +432,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.classList.add('hide');
|
elem.classList.add('hide');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getContinueWatchingFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getContinueWatchingFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getContinueWatchingItemsHtml;
|
itemsContainer.getItemsHtml = getContinueWatchingItemsHtml;
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
|
@ -445,10 +440,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getContinueListeningFetchFn(serverId) {
|
function getContinueListeningFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
var screenWidth = dom.getWindowSize().innerWidth;
|
const screenWidth = dom.getWindowSize().innerWidth;
|
||||||
|
|
||||||
var limit;
|
let limit;
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
limit = 12;
|
limit = 12;
|
||||||
} else {
|
} else {
|
||||||
|
@ -456,7 +451,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
limit = Math.min(limit, 5);
|
limit = Math.min(limit, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
|
@ -471,7 +466,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getContinueListeningItemsHtml(items) {
|
function getContinueListeningItemsHtml(items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
|
@ -492,7 +487,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadResumeAudio(elem, apiClient, userId) {
|
function loadResumeAudio(elem, apiClient, userId) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
|
@ -510,7 +505,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.classList.add('hide');
|
elem.classList.add('hide');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getContinueListeningFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getContinueListeningFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getContinueListeningItemsHtml;
|
itemsContainer.getItemsHtml = getContinueListeningItemsHtml;
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
|
@ -518,7 +513,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getOnNowFetchFn(serverId) {
|
function getOnNowFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getLiveTvRecommendedPrograms({
|
return apiClient.getLiveTvRecommendedPrograms({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
|
@ -532,7 +527,6 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOnNowItemsHtml(items) {
|
function getOnNowItemsHtml(items) {
|
||||||
var cardLayout = false;
|
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: 'auto',
|
preferThumb: 'auto',
|
||||||
|
@ -559,7 +553,6 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
var userId = user.Id;
|
|
||||||
return apiClient.getLiveTvRecommendedPrograms({
|
return apiClient.getLiveTvRecommendedPrograms({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
|
@ -569,7 +562,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
Fields: 'ChannelInfo,PrimaryImageAspectRatio'
|
Fields: 'ChannelInfo,PrimaryImageAspectRatio'
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
var html = '';
|
let html = '';
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
elem.classList.remove('padded-left');
|
elem.classList.remove('padded-left');
|
||||||
elem.classList.remove('padded-right');
|
elem.classList.remove('padded-right');
|
||||||
|
@ -632,7 +625,6 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '</h2>';
|
html += '</h2>';
|
||||||
html += '<span class="material-icons chevron_right"></span>';
|
html += '<span class="material-icons chevron_right"></span>';
|
||||||
html += '</a>';
|
html += '</a>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('HeaderOnNow') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('HeaderOnNow') + '</h2>';
|
||||||
}
|
}
|
||||||
|
@ -654,7 +646,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
itemsContainer.fetchData = getOnNowFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getOnNowFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getOnNowItemsHtml;
|
itemsContainer.getItemsHtml = getOnNowItemsHtml;
|
||||||
|
@ -664,7 +656,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getNextUpFetchFn(serverId) {
|
function getNextUpFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getNextUpEpisodes({
|
return apiClient.getNextUpEpisodes({
|
||||||
Limit: enableScrollX() ? 24 : 15,
|
Limit: enableScrollX() ? 24 : 15,
|
||||||
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
|
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
|
||||||
|
@ -677,7 +669,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextUpItemsHtml(items) {
|
function getNextUpItemsHtml(items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
|
@ -695,7 +687,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNextUp(elem, apiClient, userId) {
|
function loadNextUp(elem, apiClient, userId) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||||
if (!layoutManager.tv) {
|
if (!layoutManager.tv) {
|
||||||
|
@ -703,12 +695,12 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
serverId: apiClient.serverId()
|
serverId: apiClient.serverId()
|
||||||
}) + '" class="button-flat button-flat-mini sectionTitleTextButton">';
|
}) + '" class="button-flat button-flat-mini sectionTitleTextButton">';
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
||||||
html += globalize.translate('HeaderNextUp');
|
html += globalize.translate('NextUp');
|
||||||
html += '</h2>';
|
html += '</h2>';
|
||||||
html += '<span class="material-icons chevron_right"></span>';
|
html += '<span class="material-icons chevron_right"></span>';
|
||||||
html += '</a>';
|
html += '</a>';
|
||||||
} else {
|
} else {
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('HeaderNextUp') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('NextUp') + '</h2>';
|
||||||
}
|
}
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
|
@ -727,7 +719,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.classList.add('hide');
|
elem.classList.add('hide');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getNextUpItemsHtml;
|
itemsContainer.getItemsHtml = getNextUpItemsHtml;
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
|
@ -735,7 +727,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
|
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getLiveTvRecordings({
|
return apiClient.getLiveTvRecordings({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
Limit: enableScrollX() ? 12 : 5,
|
Limit: enableScrollX() ? 12 : 5,
|
||||||
|
@ -749,7 +741,6 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getLatestRecordingItemsHtml(activeRecordingsOnly) {
|
function getLatestRecordingItemsHtml(activeRecordingsOnly) {
|
||||||
return function (items) {
|
return function (items) {
|
||||||
var cardLayout = false;
|
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
shape: enableScrollX() ? 'autooverflow' : 'auto',
|
shape: enableScrollX() ? 'autooverflow' : 'auto',
|
||||||
|
@ -774,11 +765,11 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLatestLiveTvRecordings(elem, activeRecordingsOnly, apiClient, userId) {
|
function loadLatestLiveTvRecordings(elem, activeRecordingsOnly, apiClient, userId) {
|
||||||
var title = activeRecordingsOnly ?
|
const title = activeRecordingsOnly ?
|
||||||
globalize.translate('HeaderActiveRecordings') :
|
globalize.translate('HeaderActiveRecordings') :
|
||||||
globalize.translate('HeaderLatestRecordings');
|
globalize.translate('HeaderLatestRecordings');
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards">';
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + title + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + title + '</h2>';
|
||||||
|
@ -799,13 +790,13 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.classList.add('hide');
|
elem.classList.add('hide');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getLatestRecordingsFetchFn(apiClient.serverId(), activeRecordingsOnly);
|
itemsContainer.fetchData = getLatestRecordingsFetchFn(apiClient.serverId(), activeRecordingsOnly);
|
||||||
itemsContainer.getItemsHtml = getLatestRecordingItemsHtml(activeRecordingsOnly);
|
itemsContainer.getItemsHtml = getLatestRecordingItemsHtml(activeRecordingsOnly);
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
loadLibraryTiles: loadLibraryTiles,
|
loadLibraryTiles: loadLibraryTiles,
|
||||||
getDefaultSection: getDefaultSection,
|
getDefaultSection: getDefaultSection,
|
||||||
loadSections: loadSections,
|
loadSections: loadSections,
|
||||||
|
@ -813,4 +804,5 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
pause: pause,
|
pause: pause,
|
||||||
resume: resume
|
resume: resume
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|