mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge branch 'master' into youtube-keybindings
This commit is contained in:
commit
e1e42b8557
506 changed files with 28972 additions and 18142 deletions
|
@ -2,62 +2,104 @@ trigger:
|
||||||
batch: true
|
batch: true
|
||||||
branches:
|
branches:
|
||||||
include:
|
include:
|
||||||
- master
|
- '*'
|
||||||
- release-*
|
|
||||||
tags:
|
tags:
|
||||||
include:
|
include:
|
||||||
- '*'
|
- '*'
|
||||||
|
pr:
|
||||||
|
branches:
|
||||||
|
include:
|
||||||
|
- '*'
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
- job: main_build
|
- job: Build
|
||||||
displayName: 'Main Build'
|
displayName: 'Build'
|
||||||
|
|
||||||
dependsOn: lint
|
strategy:
|
||||||
condition: succeeded()
|
matrix:
|
||||||
|
Development:
|
||||||
|
BuildConfiguration: development
|
||||||
|
Production:
|
||||||
|
BuildConfiguration: production
|
||||||
|
Standalone:
|
||||||
|
BuildConfiguration: standalone
|
||||||
|
|
||||||
pool:
|
pool:
|
||||||
vmImage: 'ubuntu-latest'
|
vmImage: 'ubuntu-latest'
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- task: NodeTool@0
|
- task: NodeTool@0
|
||||||
displayName: 'Install Node'
|
displayName: 'Install Node'
|
||||||
inputs:
|
inputs:
|
||||||
versionSpec: '10.x'
|
versionSpec: '12.x'
|
||||||
|
|
||||||
- script: 'yarn install'
|
- task: Cache@2
|
||||||
displayName: 'Install Dependencies'
|
displayName: 'Check Cache'
|
||||||
|
inputs:
|
||||||
|
key: 'yarn | yarn.lock'
|
||||||
|
path: 'node_modules'
|
||||||
|
cacheHitVar: CACHE_RESTORED
|
||||||
|
|
||||||
- script: 'test -d dist'
|
- script: 'yarn install --frozen-lockfile'
|
||||||
displayName: 'Check Build'
|
displayName: 'Install Dependencies'
|
||||||
|
condition: ne(variables.CACHE_RESTORED, 'true')
|
||||||
|
|
||||||
- script: 'yarn pack --filename jellyfin-web.tgz'
|
- script: 'yarn build:development'
|
||||||
displayName: 'Bundle Release'
|
displayName: 'Build Development'
|
||||||
|
condition: eq(variables['BuildConfiguration'], 'development')
|
||||||
|
|
||||||
- task: PublishPipelineArtifact@1
|
- script: 'yarn build:production'
|
||||||
displayName: 'Publish Release'
|
displayName: 'Build Bundle'
|
||||||
condition: succeeded()
|
condition: eq(variables['BuildConfiguration'], 'production')
|
||||||
inputs:
|
|
||||||
targetPath: '$(Build.SourcesDirectory)/jellyfin-web.tgz'
|
|
||||||
artifactName: 'jellyfin-web'
|
|
||||||
|
|
||||||
- job: lint
|
- script: 'yarn build:standalone'
|
||||||
displayName: 'Lint'
|
displayName: 'Build Standalone'
|
||||||
|
condition: eq(variables['BuildConfiguration'], 'standalone')
|
||||||
|
|
||||||
pool:
|
- script: 'test -d dist'
|
||||||
vmImage: 'ubuntu-latest'
|
displayName: 'Check Build'
|
||||||
|
|
||||||
steps:
|
- script: 'mv dist jellyfin-web'
|
||||||
- task: NodeTool@0
|
displayName: 'Rename Directory'
|
||||||
displayName: 'Install Node'
|
|
||||||
inputs:
|
|
||||||
versionSpec: '10.x'
|
|
||||||
|
|
||||||
- script: 'yarn install'
|
- task: ArchiveFiles@2
|
||||||
displayName: 'Install Dependencies'
|
displayName: 'Archive Directory'
|
||||||
|
inputs:
|
||||||
|
rootFolderOrFile: 'jellyfin-web'
|
||||||
|
includeRootFolder: true
|
||||||
|
archiveFile: 'jellyfin-web-$(BuildConfiguration)'
|
||||||
|
|
||||||
- script: 'yarn run lint'
|
- task: PublishPipelineArtifact@1
|
||||||
displayName: 'Run ESLint'
|
displayName: 'Publish Release'
|
||||||
|
inputs:
|
||||||
|
targetPath: '$(Build.SourcesDirectory)/jellyfin-web-$(BuildConfiguration).zip'
|
||||||
|
artifactName: 'jellyfin-web-$(BuildConfiguration)'
|
||||||
|
|
||||||
- script: |
|
- job: Lint
|
||||||
yarn run stylelint
|
displayName: 'Lint'
|
||||||
displayName: 'Run stylelint'
|
|
||||||
|
pool:
|
||||||
|
vmImage: 'ubuntu-latest'
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- task: NodeTool@0
|
||||||
|
displayName: 'Install Node'
|
||||||
|
inputs:
|
||||||
|
versionSpec: '12.x'
|
||||||
|
|
||||||
|
- task: Cache@2
|
||||||
|
displayName: 'Check Cache'
|
||||||
|
inputs:
|
||||||
|
key: 'yarn | yarn.lock'
|
||||||
|
path: 'node_modules'
|
||||||
|
cacheHitVar: CACHE_RESTORED
|
||||||
|
|
||||||
|
- script: 'yarn install --frozen-lockfile'
|
||||||
|
displayName: 'Install Dependencies'
|
||||||
|
condition: ne(variables.CACHE_RESTORED, 'true')
|
||||||
|
|
||||||
|
- script: 'yarn run lint --quiet'
|
||||||
|
displayName: 'Run ESLint'
|
||||||
|
|
||||||
|
- script: 'yarn run stylelint'
|
||||||
|
displayName: 'Run Stylelint'
|
||||||
|
|
1
.copr/Makefile
Symbolic link
1
.copr/Makefile
Symbolic link
|
@ -0,0 +1 @@
|
||||||
|
../fedora/Makefile
|
|
@ -7,3 +7,6 @@ charset = utf-8
|
||||||
trim_trailing_whitespace = true
|
trim_trailing_whitespace = true
|
||||||
insert_final_newline = true
|
insert_final_newline = true
|
||||||
end_of_line = lf
|
end_of_line = lf
|
||||||
|
|
||||||
|
[json]
|
||||||
|
indent_size = 2
|
||||||
|
|
|
@ -1 +1,5 @@
|
||||||
libraries/
|
node_modules
|
||||||
|
dist
|
||||||
|
.idea
|
||||||
|
.vscode
|
||||||
|
src/libraries
|
||||||
|
|
191
.eslintrc.js
Normal file
191
.eslintrc.js
Normal file
|
@ -0,0 +1,191 @@
|
||||||
|
module.exports = {
|
||||||
|
root: true,
|
||||||
|
plugins: [
|
||||||
|
'promise',
|
||||||
|
'import',
|
||||||
|
'eslint-comments'
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
node: true,
|
||||||
|
es6: true,
|
||||||
|
es2017: true,
|
||||||
|
es2020: true
|
||||||
|
},
|
||||||
|
parserOptions: {
|
||||||
|
ecmaVersion: 2020,
|
||||||
|
sourceType: 'module',
|
||||||
|
ecmaFeatures: {
|
||||||
|
impliedStrict: true
|
||||||
|
}
|
||||||
|
},
|
||||||
|
extends: [
|
||||||
|
'eslint:recommended',
|
||||||
|
// 'plugin:promise/recommended',
|
||||||
|
'plugin:import/errors',
|
||||||
|
'plugin:import/warnings',
|
||||||
|
'plugin:eslint-comments/recommended',
|
||||||
|
'plugin:compat/recommended'
|
||||||
|
],
|
||||||
|
rules: {
|
||||||
|
'block-spacing': ["error"],
|
||||||
|
'brace-style': ["error"],
|
||||||
|
'comma-dangle': ["error", "never"],
|
||||||
|
'comma-spacing': ["error"],
|
||||||
|
'eol-last': ["error"],
|
||||||
|
'indent': ["error", 4, { "SwitchCase": 1 }],
|
||||||
|
'keyword-spacing': ["error"],
|
||||||
|
'max-statements-per-line': ["error"],
|
||||||
|
'no-floating-decimal': ["error"],
|
||||||
|
'no-multi-spaces': ["error"],
|
||||||
|
'no-multiple-empty-lines': ["error", { "max": 1 }],
|
||||||
|
'no-trailing-spaces': ["error"],
|
||||||
|
'one-var': ["error", "never"],
|
||||||
|
'quotes': ["error", "single", { "avoidEscape": true, "allowTemplateLiterals": false }],
|
||||||
|
'semi': ["error"],
|
||||||
|
'space-before-blocks': ["error"]
|
||||||
|
},
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
files: [
|
||||||
|
'./src/**/*.js'
|
||||||
|
],
|
||||||
|
env: {
|
||||||
|
node: false,
|
||||||
|
amd: true,
|
||||||
|
browser: true,
|
||||||
|
es6: true,
|
||||||
|
es2017: true,
|
||||||
|
es2020: true
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
// Browser globals
|
||||||
|
'MediaMetadata': 'readonly',
|
||||||
|
// Tizen globals
|
||||||
|
'tizen': 'readonly',
|
||||||
|
'webapis': 'readonly',
|
||||||
|
// WebOS globals
|
||||||
|
'webOS': 'readonly',
|
||||||
|
// Dependency globals
|
||||||
|
'$': 'readonly',
|
||||||
|
'jQuery': 'readonly',
|
||||||
|
'requirejs': 'readonly',
|
||||||
|
// Jellyfin globals
|
||||||
|
'ApiClient': 'writable',
|
||||||
|
'AppInfo': 'writable',
|
||||||
|
'chrome': 'writable',
|
||||||
|
'ConnectionManager': 'writable',
|
||||||
|
'DlnaProfilePage': 'writable',
|
||||||
|
'Dashboard': 'writable',
|
||||||
|
'DashboardPage': 'writable',
|
||||||
|
'Emby': 'readonly',
|
||||||
|
'Events': 'writable',
|
||||||
|
'getParameterByName': 'writable',
|
||||||
|
'getWindowLocationSearch': 'writable',
|
||||||
|
'Globalize': 'writable',
|
||||||
|
'Hls': 'writable',
|
||||||
|
'dfnshelper': 'writable',
|
||||||
|
'LibraryMenu': 'writable',
|
||||||
|
'LinkParser': 'writable',
|
||||||
|
'LiveTvHelpers': 'writable',
|
||||||
|
'MetadataEditor': 'writable',
|
||||||
|
'pageClassOn': 'writable',
|
||||||
|
'pageIdOn': 'writable',
|
||||||
|
'PlaylistViewer': 'writable',
|
||||||
|
'UserParentalControlPage': 'writable',
|
||||||
|
'Windows': 'readonly'
|
||||||
|
},
|
||||||
|
rules: {
|
||||||
|
// TODO: Fix warnings and remove these rules
|
||||||
|
'no-redeclare': ["warn"],
|
||||||
|
'no-unused-vars': ["warn"],
|
||||||
|
'no-useless-escape': ["warn"],
|
||||||
|
// TODO: Remove after ES6 migration is complete
|
||||||
|
'import/no-unresolved': ["off"]
|
||||||
|
},
|
||||||
|
settings: {
|
||||||
|
polyfills: [
|
||||||
|
// Native Promises Only
|
||||||
|
'Promise',
|
||||||
|
// whatwg-fetch
|
||||||
|
'fetch',
|
||||||
|
// document-register-element
|
||||||
|
'document.registerElement',
|
||||||
|
// resize-observer-polyfill
|
||||||
|
'ResizeObserver',
|
||||||
|
// fast-text-encoding
|
||||||
|
'TextEncoder',
|
||||||
|
// intersection-observer
|
||||||
|
'IntersectionObserver',
|
||||||
|
// Core-js
|
||||||
|
'Object.assign',
|
||||||
|
'Object.is',
|
||||||
|
'Object.setPrototypeOf',
|
||||||
|
'Object.toString',
|
||||||
|
'Object.freeze',
|
||||||
|
'Object.seal',
|
||||||
|
'Object.preventExtensions',
|
||||||
|
'Object.isFrozen',
|
||||||
|
'Object.isSealed',
|
||||||
|
'Object.isExtensible',
|
||||||
|
'Object.getOwnPropertyDescriptor',
|
||||||
|
'Object.getPrototypeOf',
|
||||||
|
'Object.keys',
|
||||||
|
'Object.getOwnPropertyNames',
|
||||||
|
'Function.name',
|
||||||
|
'Function.hasInstance',
|
||||||
|
'Array.from',
|
||||||
|
'Array.arrayOf',
|
||||||
|
'Array.copyWithin',
|
||||||
|
'Array.fill',
|
||||||
|
'Array.find',
|
||||||
|
'Array.findIndex',
|
||||||
|
'Array.iterator',
|
||||||
|
'String.fromCodePoint',
|
||||||
|
'String.raw',
|
||||||
|
'String.iterator',
|
||||||
|
'String.codePointAt',
|
||||||
|
'String.endsWith',
|
||||||
|
'String.includes',
|
||||||
|
'String.repeat',
|
||||||
|
'String.startsWith',
|
||||||
|
'String.trim',
|
||||||
|
'String.anchor',
|
||||||
|
'String.big',
|
||||||
|
'String.blink',
|
||||||
|
'String.bold',
|
||||||
|
'String.fixed',
|
||||||
|
'String.fontcolor',
|
||||||
|
'String.fontsize',
|
||||||
|
'String.italics',
|
||||||
|
'String.link',
|
||||||
|
'String.small',
|
||||||
|
'String.strike',
|
||||||
|
'String.sub',
|
||||||
|
'String.sup',
|
||||||
|
'RegExp',
|
||||||
|
'Number',
|
||||||
|
'Math',
|
||||||
|
'Date',
|
||||||
|
'async',
|
||||||
|
'Symbol',
|
||||||
|
'Map',
|
||||||
|
'Set',
|
||||||
|
'WeakMap',
|
||||||
|
'WeakSet',
|
||||||
|
'ArrayBuffer',
|
||||||
|
'DataView',
|
||||||
|
'Int8Array',
|
||||||
|
'Uint8Array',
|
||||||
|
'Uint8ClampedArray',
|
||||||
|
'Int16Array',
|
||||||
|
'Uint16Array',
|
||||||
|
'Int32Array',
|
||||||
|
'Uint32Array',
|
||||||
|
'Float32Array',
|
||||||
|
'Float64Array',
|
||||||
|
'Reflect'
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
|
@ -1,27 +0,0 @@
|
||||||
env:
|
|
||||||
es6: true
|
|
||||||
browser: true
|
|
||||||
amd: true
|
|
||||||
|
|
||||||
rules:
|
|
||||||
block-spacing: ["error"]
|
|
||||||
brace-style: ["error"]
|
|
||||||
comma-dangle: ["error", "never"]
|
|
||||||
comma-spacing: ["error"]
|
|
||||||
eol-last: ["off"]
|
|
||||||
indent: ["error", 4, { "SwitchCase": 1 }]
|
|
||||||
keyword-spacing: ["error"]
|
|
||||||
line-comment-position: ["off"]
|
|
||||||
max-statements-per-line: ["error"]
|
|
||||||
no-empty: ["error"]
|
|
||||||
no-extra-semi: ["error"]
|
|
||||||
no-floating-decimal: ["error"]
|
|
||||||
no-multi-spaces: ["error"]
|
|
||||||
no-multiple-empty-lines: ["error", { "max": 1 }]
|
|
||||||
no-trailing-spaces: ["error"]
|
|
||||||
no-void: ["off"]
|
|
||||||
one-var: ["error", "never"]
|
|
||||||
padding-line-between-statements: ["off"]
|
|
||||||
semi: ["off"]
|
|
||||||
space-before-blocks: ["error"]
|
|
||||||
yoda: ["off"]
|
|
36
.gitattributes
vendored
36
.gitattributes
vendored
|
@ -1 +1,35 @@
|
||||||
/CONTRIBUTORS.md merge=union
|
* text=auto
|
||||||
|
|
||||||
|
CONTRIBUTORS.md merge=union
|
||||||
|
README.md text
|
||||||
|
LICENSE text
|
||||||
|
|
||||||
|
*.css text
|
||||||
|
*.eot binary
|
||||||
|
*.gif binary
|
||||||
|
*.html text diff=html
|
||||||
|
*.ico binary
|
||||||
|
*.*ignore text
|
||||||
|
*.jpg binary
|
||||||
|
*.js text
|
||||||
|
*.json text
|
||||||
|
*.lock text -diff
|
||||||
|
*.map text -diff
|
||||||
|
*.md text
|
||||||
|
*.otf binary
|
||||||
|
*.png binary
|
||||||
|
*.py text diff=python
|
||||||
|
*.svg binary
|
||||||
|
*.ts text
|
||||||
|
*.ttf binary
|
||||||
|
*.sass text
|
||||||
|
*.vue text
|
||||||
|
*.webp binary
|
||||||
|
*.woff binary
|
||||||
|
*.woff2 binary
|
||||||
|
|
||||||
|
.editorconfig text
|
||||||
|
.gitattributes export-ignore
|
||||||
|
.gitignore export-ignore
|
||||||
|
|
||||||
|
*.gitattributes linguist-language=gitattributes
|
||||||
|
|
4
.github/CODEOWNERS
vendored
Normal file
4
.github/CODEOWNERS
vendored
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
.ci @dkanada @EraYaN
|
||||||
|
.github @jellyfin/core
|
||||||
|
build.sh @joshuaboniface
|
||||||
|
deployment @joshuaboniface
|
585
.gitignore
vendored
585
.gitignore
vendored
|
@ -1,578 +1,11 @@
|
||||||
|
# config
|
||||||
|
config.json
|
||||||
|
|
||||||
# Created by https://www.gitignore.io/api/node,rider,macos,linux,windows,visualstudio,visualstudiocode
|
# npm
|
||||||
# Edit at https://www.gitignore.io/?templates=node,rider,macos,linux,windows,visualstudio,visualstudiocode
|
dist
|
||||||
|
web
|
||||||
|
node_modules
|
||||||
|
|
||||||
### Linux ###
|
# ide
|
||||||
*~
|
.idea
|
||||||
|
.vscode
|
||||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
|
||||||
.fuse_hidden*
|
|
||||||
|
|
||||||
# KDE directory preferences
|
|
||||||
.directory
|
|
||||||
|
|
||||||
# Linux trash folder which might appear on any partition or disk
|
|
||||||
.Trash-*
|
|
||||||
|
|
||||||
# .nfs files are created when an open file is removed but is still being accessed
|
|
||||||
.nfs*
|
|
||||||
|
|
||||||
### macOS ###
|
|
||||||
# General
|
|
||||||
.DS_Store
|
|
||||||
.AppleDouble
|
|
||||||
.LSOverride
|
|
||||||
|
|
||||||
# Icon must end with two \r
|
|
||||||
Icon
|
|
||||||
|
|
||||||
# Thumbnails
|
|
||||||
._*
|
|
||||||
|
|
||||||
# Files that might appear in the root of a volume
|
|
||||||
.DocumentRevisions-V100
|
|
||||||
.fseventsd
|
|
||||||
.Spotlight-V100
|
|
||||||
.TemporaryItems
|
|
||||||
.Trashes
|
|
||||||
.VolumeIcon.icns
|
|
||||||
.com.apple.timemachine.donotpresent
|
|
||||||
|
|
||||||
# Directories potentially created on remote AFP share
|
|
||||||
.AppleDB
|
|
||||||
.AppleDesktop
|
|
||||||
Network Trash Folder
|
|
||||||
Temporary Items
|
|
||||||
.apdisk
|
|
||||||
|
|
||||||
### Node ###
|
|
||||||
# Logs
|
|
||||||
logs
|
|
||||||
*.log
|
|
||||||
npm-debug.log*
|
|
||||||
yarn-debug.log*
|
|
||||||
yarn-error.log*
|
|
||||||
|
|
||||||
# Runtime data
|
|
||||||
pids
|
|
||||||
*.pid
|
|
||||||
*.seed
|
|
||||||
*.pid.lock
|
|
||||||
|
|
||||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
|
||||||
lib-cov
|
|
||||||
|
|
||||||
# Coverage directory used by tools like istanbul
|
|
||||||
coverage
|
|
||||||
|
|
||||||
# nyc test coverage
|
|
||||||
.nyc_output
|
|
||||||
|
|
||||||
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
|
|
||||||
.grunt
|
|
||||||
|
|
||||||
# node-waf configuration
|
|
||||||
.lock-wscript
|
|
||||||
|
|
||||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
|
||||||
build/Release
|
|
||||||
|
|
||||||
# Dependency directories
|
|
||||||
node_modules/
|
|
||||||
jspm_packages/
|
|
||||||
|
|
||||||
# Dependency lockfile
|
|
||||||
package-lock.json
|
|
||||||
|
|
||||||
# TypeScript v1 declaration files
|
|
||||||
typings/
|
|
||||||
|
|
||||||
# Optional npm cache directory
|
|
||||||
.npm
|
|
||||||
|
|
||||||
# Optional eslint cache
|
|
||||||
.eslintcache
|
|
||||||
|
|
||||||
# Optional REPL history
|
|
||||||
.node_repl_history
|
|
||||||
|
|
||||||
# Output of 'npm pack'
|
|
||||||
*.tgz
|
|
||||||
|
|
||||||
# Yarn Integrity file
|
|
||||||
.yarn-integrity
|
|
||||||
|
|
||||||
# dotenv environment variables file
|
|
||||||
.env
|
|
||||||
.env.test
|
|
||||||
|
|
||||||
# parcel-bundler cache (https://parceljs.org/)
|
|
||||||
.cache
|
|
||||||
|
|
||||||
# next.js build output
|
|
||||||
.next
|
|
||||||
|
|
||||||
# nuxt.js build output
|
|
||||||
.nuxt
|
|
||||||
|
|
||||||
# vuepress build output
|
|
||||||
.vuepress/dist
|
|
||||||
|
|
||||||
# Serverless directories
|
|
||||||
.serverless/
|
|
||||||
|
|
||||||
# FuseBox cache
|
|
||||||
.fusebox/
|
|
||||||
|
|
||||||
# DynamoDB Local files
|
|
||||||
.dynamodb/
|
|
||||||
|
|
||||||
### Rider ###
|
|
||||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
|
||||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
|
||||||
|
|
||||||
# User-specific stuff
|
|
||||||
.idea/**/workspace.xml
|
|
||||||
.idea/**/tasks.xml
|
|
||||||
.idea/**/usage.statistics.xml
|
|
||||||
.idea/**/dictionaries
|
|
||||||
.idea/**/shelf
|
|
||||||
|
|
||||||
# Generated files
|
|
||||||
.idea/**/contentModel.xml
|
|
||||||
|
|
||||||
# Sensitive or high-churn files
|
|
||||||
.idea/**/dataSources/
|
|
||||||
.idea/**/dataSources.ids
|
|
||||||
.idea/**/dataSources.local.xml
|
|
||||||
.idea/**/sqlDataSources.xml
|
|
||||||
.idea/**/dynamic.xml
|
|
||||||
.idea/**/uiDesigner.xml
|
|
||||||
.idea/**/dbnavigator.xml
|
|
||||||
|
|
||||||
# Gradle
|
|
||||||
.idea/**/gradle.xml
|
|
||||||
.idea/**/libraries
|
|
||||||
|
|
||||||
# Gradle and Maven with auto-import
|
|
||||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
|
||||||
# since they will be recreated, and may cause churn. Uncomment if using
|
|
||||||
# auto-import.
|
|
||||||
# .idea/modules.xml
|
|
||||||
# .idea/*.iml
|
|
||||||
# .idea/modules
|
|
||||||
|
|
||||||
# CMake
|
|
||||||
cmake-build-*/
|
|
||||||
|
|
||||||
# Mongo Explorer plugin
|
|
||||||
.idea/**/mongoSettings.xml
|
|
||||||
|
|
||||||
# File-based project format
|
|
||||||
*.iws
|
|
||||||
|
|
||||||
# IntelliJ
|
|
||||||
out/
|
|
||||||
|
|
||||||
# mpeltonen/sbt-idea plugin
|
|
||||||
.idea_modules/
|
|
||||||
|
|
||||||
# JIRA plugin
|
|
||||||
atlassian-ide-plugin.xml
|
|
||||||
|
|
||||||
# Cursive Clojure plugin
|
|
||||||
.idea/replstate.xml
|
|
||||||
|
|
||||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
|
||||||
com_crashlytics_export_strings.xml
|
|
||||||
crashlytics.properties
|
|
||||||
crashlytics-build.properties
|
|
||||||
fabric.properties
|
|
||||||
|
|
||||||
# Editor-based Rest Client
|
|
||||||
.idea/httpRequests
|
|
||||||
|
|
||||||
# Android studio 3.1+ serialized cache file
|
|
||||||
.idea/caches/build_file_checksums.ser
|
|
||||||
|
|
||||||
### VisualStudioCode ###
|
|
||||||
.vscode/*
|
|
||||||
!.vscode/settings.json
|
|
||||||
!.vscode/tasks.json
|
|
||||||
!.vscode/launch.json
|
|
||||||
!.vscode/extensions.json
|
|
||||||
|
|
||||||
### VisualStudioCode Patch ###
|
|
||||||
# Ignore all local history of files
|
|
||||||
.history
|
|
||||||
|
|
||||||
### Windows ###
|
|
||||||
# Windows thumbnail cache files
|
|
||||||
Thumbs.db
|
|
||||||
ehthumbs.db
|
|
||||||
ehthumbs_vista.db
|
|
||||||
|
|
||||||
# Dump file
|
|
||||||
*.stackdump
|
|
||||||
|
|
||||||
# Folder config file
|
|
||||||
[Dd]esktop.ini
|
|
||||||
|
|
||||||
# Recycle Bin used on file shares
|
|
||||||
$RECYCLE.BIN/
|
|
||||||
|
|
||||||
# Windows Installer files
|
|
||||||
*.cab
|
|
||||||
*.msi
|
|
||||||
*.msix
|
|
||||||
*.msm
|
|
||||||
*.msp
|
|
||||||
|
|
||||||
# Windows shortcuts
|
|
||||||
*.lnk
|
|
||||||
|
|
||||||
### VisualStudio ###
|
|
||||||
## Ignore Visual Studio temporary files, build results, and
|
|
||||||
## files generated by popular Visual Studio add-ons.
|
|
||||||
##
|
|
||||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
|
||||||
|
|
||||||
# User-specific files
|
|
||||||
*.rsuser
|
|
||||||
*.suo
|
|
||||||
*.user
|
|
||||||
*.userosscache
|
|
||||||
*.sln.docstates
|
|
||||||
|
|
||||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
|
||||||
*.userprefs
|
|
||||||
|
|
||||||
# Build results
|
|
||||||
[Dd]ebug/
|
|
||||||
[Dd]ebugPublic/
|
|
||||||
[Rr]elease/
|
|
||||||
[Rr]eleases/
|
|
||||||
x64/
|
|
||||||
x86/
|
|
||||||
[Aa][Rr][Mm]/
|
|
||||||
[Aa][Rr][Mm]64/
|
|
||||||
bld/
|
|
||||||
[Bb]in/
|
|
||||||
[Oo]bj/
|
|
||||||
[Ll]og/
|
|
||||||
|
|
||||||
# Visual Studio 2015/2017 cache/options directory
|
|
||||||
.vs/
|
|
||||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
|
||||||
#wwwroot/
|
|
||||||
|
|
||||||
# Visual Studio 2017 auto generated files
|
|
||||||
Generated\ Files/
|
|
||||||
|
|
||||||
# MSTest test Results
|
|
||||||
[Tt]est[Rr]esult*/
|
|
||||||
[Bb]uild[Ll]og.*
|
|
||||||
|
|
||||||
# NUNIT
|
|
||||||
*.VisualState.xml
|
|
||||||
TestResult.xml
|
|
||||||
|
|
||||||
# Build Results of an ATL Project
|
|
||||||
[Dd]ebugPS/
|
|
||||||
[Rr]eleasePS/
|
|
||||||
dlldata.c
|
|
||||||
|
|
||||||
# Benchmark Results
|
|
||||||
BenchmarkDotNet.Artifacts/
|
|
||||||
|
|
||||||
# .NET Core
|
|
||||||
project.lock.json
|
|
||||||
project.fragment.lock.json
|
|
||||||
artifacts/
|
|
||||||
|
|
||||||
# StyleCop
|
|
||||||
StyleCopReport.xml
|
|
||||||
|
|
||||||
# Files built by Visual Studio
|
|
||||||
*_i.c
|
|
||||||
*_p.c
|
|
||||||
*_h.h
|
|
||||||
*.ilk
|
|
||||||
*.meta
|
|
||||||
*.obj
|
|
||||||
*.iobj
|
|
||||||
*.pch
|
|
||||||
*.pdb
|
|
||||||
*.ipdb
|
|
||||||
*.pgc
|
|
||||||
*.pgd
|
|
||||||
*.rsp
|
|
||||||
*.sbr
|
|
||||||
*.tlb
|
|
||||||
*.tli
|
|
||||||
*.tlh
|
|
||||||
*.tmp
|
|
||||||
*.tmp_proj
|
|
||||||
*_wpftmp.csproj
|
|
||||||
*.vspscc
|
|
||||||
*.vssscc
|
|
||||||
.builds
|
|
||||||
*.pidb
|
|
||||||
*.svclog
|
|
||||||
*.scc
|
|
||||||
|
|
||||||
# Chutzpah Test files
|
|
||||||
_Chutzpah*
|
|
||||||
|
|
||||||
# Visual C++ cache files
|
|
||||||
ipch/
|
|
||||||
*.aps
|
|
||||||
*.ncb
|
|
||||||
*.opendb
|
|
||||||
*.opensdf
|
|
||||||
*.sdf
|
|
||||||
*.cachefile
|
|
||||||
*.VC.db
|
|
||||||
*.VC.VC.opendb
|
|
||||||
|
|
||||||
# Visual Studio profiler
|
|
||||||
*.psess
|
|
||||||
*.vsp
|
|
||||||
*.vspx
|
|
||||||
*.sap
|
|
||||||
|
|
||||||
# Visual Studio Trace Files
|
|
||||||
*.e2e
|
|
||||||
|
|
||||||
# TFS 2012 Local Workspace
|
|
||||||
$tf/
|
|
||||||
|
|
||||||
# Guidance Automation Toolkit
|
|
||||||
*.gpState
|
|
||||||
|
|
||||||
# ReSharper is a .NET coding add-in
|
|
||||||
_ReSharper*/
|
|
||||||
*.[Rr]e[Ss]harper
|
|
||||||
*.DotSettings.user
|
|
||||||
|
|
||||||
# JustCode is a .NET coding add-in
|
|
||||||
.JustCode
|
|
||||||
|
|
||||||
# TeamCity is a build add-in
|
|
||||||
_TeamCity*
|
|
||||||
|
|
||||||
# DotCover is a Code Coverage Tool
|
|
||||||
*.dotCover
|
|
||||||
|
|
||||||
# AxoCover is a Code Coverage Tool
|
|
||||||
.axoCover/*
|
|
||||||
!.axoCover/settings.json
|
|
||||||
|
|
||||||
# Visual Studio code coverage results
|
|
||||||
*.coverage
|
|
||||||
*.coveragexml
|
|
||||||
|
|
||||||
# NCrunch
|
|
||||||
_NCrunch_*
|
|
||||||
.*crunch*.local.xml
|
|
||||||
nCrunchTemp_*
|
|
||||||
|
|
||||||
# MightyMoose
|
|
||||||
*.mm.*
|
|
||||||
AutoTest.Net/
|
|
||||||
|
|
||||||
# Web workbench (sass)
|
|
||||||
.sass-cache/
|
|
||||||
|
|
||||||
# Installshield output folder
|
|
||||||
[Ee]xpress/
|
|
||||||
|
|
||||||
# DocProject is a documentation generator add-in
|
|
||||||
DocProject/buildhelp/
|
|
||||||
DocProject/Help/*.HxT
|
|
||||||
DocProject/Help/*.HxC
|
|
||||||
DocProject/Help/*.hhc
|
|
||||||
DocProject/Help/*.hhk
|
|
||||||
DocProject/Help/*.hhp
|
|
||||||
DocProject/Help/Html2
|
|
||||||
DocProject/Help/html
|
|
||||||
|
|
||||||
# Click-Once directory
|
|
||||||
publish/
|
|
||||||
|
|
||||||
# Publish Web Output
|
|
||||||
*.[Pp]ublish.xml
|
|
||||||
*.azurePubxml
|
|
||||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
|
||||||
# but database connection strings (with potential passwords) will be unencrypted
|
|
||||||
*.pubxml
|
|
||||||
*.publishproj
|
|
||||||
|
|
||||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
|
||||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
|
||||||
# in these scripts will be unencrypted
|
|
||||||
PublishScripts/
|
|
||||||
|
|
||||||
# NuGet Packages
|
|
||||||
*.nupkg
|
|
||||||
# The packages folder can be ignored because of Package Restore
|
|
||||||
**/[Pp]ackages/*
|
|
||||||
# except build/, which is used as an MSBuild target.
|
|
||||||
!**/[Pp]ackages/build/
|
|
||||||
# Uncomment if necessary however generally it will be regenerated when needed
|
|
||||||
#!**/[Pp]ackages/repositories.config
|
|
||||||
# NuGet v3's project.json files produces more ignorable files
|
|
||||||
*.nuget.props
|
|
||||||
*.nuget.targets
|
|
||||||
|
|
||||||
# Microsoft Azure Build Output
|
|
||||||
csx/
|
|
||||||
*.build.csdef
|
|
||||||
|
|
||||||
# Microsoft Azure Emulator
|
|
||||||
ecf/
|
|
||||||
rcf/
|
|
||||||
|
|
||||||
# Windows Store app package directories and files
|
|
||||||
AppPackages/
|
|
||||||
BundleArtifacts/
|
|
||||||
Package.StoreAssociation.xml
|
|
||||||
_pkginfo.txt
|
|
||||||
*.appx
|
|
||||||
|
|
||||||
# Visual Studio cache files
|
|
||||||
# files ending in .cache can be ignored
|
|
||||||
*.[Cc]ache
|
|
||||||
# but keep track of directories ending in .cache
|
|
||||||
!?*.[Cc]ache/
|
|
||||||
|
|
||||||
# Others
|
|
||||||
ClientBin/
|
|
||||||
~$*
|
|
||||||
*.dbmdl
|
|
||||||
*.dbproj.schemaview
|
|
||||||
*.jfm
|
|
||||||
*.pfx
|
|
||||||
*.publishsettings
|
|
||||||
orleans.codegen.cs
|
|
||||||
|
|
||||||
# Including strong name files can present a security risk
|
|
||||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
|
||||||
#*.snk
|
|
||||||
|
|
||||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
|
||||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
|
||||||
#bower_components/
|
|
||||||
# ASP.NET Core default setup: bower directory is configured as wwwroot/lib/ and bower restore is true
|
|
||||||
**/wwwroot/lib/
|
|
||||||
|
|
||||||
# RIA/Silverlight projects
|
|
||||||
Generated_Code/
|
|
||||||
|
|
||||||
# Backup & report files from converting an old project file
|
|
||||||
# to a newer Visual Studio version. Backup files are not needed,
|
|
||||||
# because we have git ;-)
|
|
||||||
_UpgradeReport_Files/
|
|
||||||
Backup*/
|
|
||||||
UpgradeLog*.XML
|
|
||||||
UpgradeLog*.htm
|
|
||||||
ServiceFabricBackup/
|
|
||||||
*.rptproj.bak
|
|
||||||
|
|
||||||
# SQL Server files
|
|
||||||
*.mdf
|
|
||||||
*.ldf
|
|
||||||
*.ndf
|
|
||||||
|
|
||||||
# Business Intelligence projects
|
|
||||||
*.rdl.data
|
|
||||||
*.bim.layout
|
|
||||||
*.bim_*.settings
|
|
||||||
*.rptproj.rsuser
|
|
||||||
*- Backup*.rdl
|
|
||||||
|
|
||||||
# Microsoft Fakes
|
|
||||||
FakesAssemblies/
|
|
||||||
|
|
||||||
# GhostDoc plugin setting file
|
|
||||||
*.GhostDoc.xml
|
|
||||||
|
|
||||||
# Node.js Tools for Visual Studio
|
|
||||||
.ntvs_analysis.dat
|
|
||||||
|
|
||||||
# Visual Studio 6 build log
|
|
||||||
*.plg
|
|
||||||
|
|
||||||
# Visual Studio 6 workspace options file
|
|
||||||
*.opt
|
|
||||||
|
|
||||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
|
||||||
*.vbw
|
|
||||||
|
|
||||||
# Visual Studio LightSwitch build output
|
|
||||||
**/*.HTMLClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/GeneratedArtifacts
|
|
||||||
**/*.DesktopClient/ModelManifest.xml
|
|
||||||
**/*.Server/GeneratedArtifacts
|
|
||||||
**/*.Server/ModelManifest.xml
|
|
||||||
_Pvt_Extensions
|
|
||||||
|
|
||||||
# Paket dependency manager
|
|
||||||
.paket/paket.exe
|
|
||||||
paket-files/
|
|
||||||
|
|
||||||
# FAKE - F# Make
|
|
||||||
.fake/
|
|
||||||
|
|
||||||
# JetBrains Rider
|
|
||||||
.idea/
|
|
||||||
*.sln.iml
|
|
||||||
|
|
||||||
# CodeRush personal settings
|
|
||||||
.cr/personal
|
|
||||||
|
|
||||||
# Python Tools for Visual Studio (PTVS)
|
|
||||||
__pycache__/
|
|
||||||
*.pyc
|
|
||||||
|
|
||||||
# Cake - Uncomment if you are using it
|
|
||||||
# tools/**
|
|
||||||
# !tools/packages.config
|
|
||||||
|
|
||||||
# Tabs Studio
|
|
||||||
*.tss
|
|
||||||
|
|
||||||
# Telerik's JustMock configuration file
|
|
||||||
*.jmconfig
|
|
||||||
|
|
||||||
# BizTalk build output
|
|
||||||
*.btp.cs
|
|
||||||
*.btm.cs
|
|
||||||
*.odx.cs
|
|
||||||
*.xsd.cs
|
|
||||||
|
|
||||||
# OpenCover UI analysis results
|
|
||||||
OpenCover/
|
|
||||||
|
|
||||||
# Azure Stream Analytics local run output
|
|
||||||
ASALocalRun/
|
|
||||||
|
|
||||||
# MSBuild Binary and Structured Log
|
|
||||||
*.binlog
|
|
||||||
|
|
||||||
# NVidia Nsight GPU debugger configuration file
|
|
||||||
*.nvuser
|
|
||||||
|
|
||||||
# MFractors (Xamarin productivity tool) working folder
|
|
||||||
.mfractor/
|
|
||||||
|
|
||||||
# Local History for Visual Studio
|
|
||||||
.localhistory/
|
|
||||||
|
|
||||||
# BeatPulse healthcheck temp database
|
|
||||||
healthchecksdb
|
|
||||||
|
|
||||||
# End of https://www.gitignore.io/api/node,rider,macos,linux,windows,visualstudio,visualstudiocode
|
|
||||||
|
|
||||||
# dist for webpack output
|
|
||||||
dist
|
|
|
@ -140,4 +140,4 @@
|
||||||
"value-list-comma-space-before": "never",
|
"value-list-comma-space-before": "never",
|
||||||
"value-list-max-empty-lines": 0,
|
"value-list-max-empty-lines": 0,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
- [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)
|
||||||
|
- [Sarab Singh](https://github.com/sarab97)
|
||||||
|
|
||||||
# Emby Contributors
|
# Emby Contributors
|
||||||
|
|
||||||
|
|
17
README.md
17
README.md
|
@ -45,20 +45,37 @@ Jellyfin Web is the frontend used for most of the clients available for end user
|
||||||
### Dependencies
|
### Dependencies
|
||||||
|
|
||||||
- Yarn
|
- Yarn
|
||||||
|
- Gulp-cli
|
||||||
|
|
||||||
### Getting Started
|
### Getting Started
|
||||||
|
|
||||||
1. Clone or download this repository.
|
1. Clone or download this repository.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
git clone https://github.com/jellyfin/jellyfin-web.git
|
git clone https://github.com/jellyfin/jellyfin-web.git
|
||||||
cd jellyfin-web
|
cd jellyfin-web
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Install build dependencies in the project directory.
|
2. Install build dependencies in the project directory.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
yarn install
|
yarn install
|
||||||
```
|
```
|
||||||
|
|
||||||
3. Run the web client with webpack for local development.
|
3. Run the web client with webpack for local development.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
yarn serve
|
yarn serve
|
||||||
```
|
```
|
||||||
|
|
||||||
|
4. Build the client with sourcemaps.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn build:development
|
||||||
|
```
|
||||||
|
|
||||||
|
You can build a nginx compatible version as well.
|
||||||
|
|
||||||
|
```sh
|
||||||
|
yarn build:standalone
|
||||||
|
```
|
3
babel.config.json
Normal file
3
babel.config.json
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
{
|
||||||
|
"presets": ["@babel/preset-env"]
|
||||||
|
}
|
110
build.sh
Executable file
110
build.sh
Executable file
|
@ -0,0 +1,110 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# build.sh - Build Jellyfin binary packages
|
||||||
|
# Part of the Jellyfin Project
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo -e "build.sh - Build Jellyfin binary packages"
|
||||||
|
echo -e "Usage:"
|
||||||
|
echo -e " $0 -t/--type <BUILD_TYPE> -p/--platform <PLATFORM> [-k/--keep-artifacts] [-l/--list-platforms]"
|
||||||
|
echo -e "Notes:"
|
||||||
|
echo -e " * BUILD_TYPE can be one of: [native, docker] and must be specified"
|
||||||
|
echo -e " * native: Build using the build script in the host OS"
|
||||||
|
echo -e " * docker: Build using the build script in a standardized Docker container"
|
||||||
|
echo -e " * PLATFORM can be any platform shown by -l/--list-platforms and must be specified"
|
||||||
|
echo -e " * If -k/--keep-artifacts is specified, transient artifacts (e.g. Docker containers) will be"
|
||||||
|
echo -e " retained after the build is finished; the source directory will still be cleaned"
|
||||||
|
echo -e " * If -l/--list-platforms is specified, all other arguments are ignored; the script will print"
|
||||||
|
echo -e " the list of supported platforms and exit"
|
||||||
|
}
|
||||||
|
|
||||||
|
list_platforms() {
|
||||||
|
declare -a platforms
|
||||||
|
platforms=(
|
||||||
|
$( find deployment -maxdepth 1 -mindepth 1 -name "build.*" | awk -F'.' '{ $1=""; printf $2; if ($3 != ""){ printf "." $3; }; if ($4 != ""){ printf "." $4; }; print ""; }' | sort )
|
||||||
|
)
|
||||||
|
echo -e "Valid platforms:"
|
||||||
|
echo
|
||||||
|
for platform in ${platforms[@]}; do
|
||||||
|
echo -e "* ${platform} : $( grep '^#=' deployment/build.${platform} | sed 's/^#= //' )"
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
|
do_build_native() {
|
||||||
|
export IS_DOCKER=NO
|
||||||
|
deployment/build.${PLATFORM}
|
||||||
|
}
|
||||||
|
|
||||||
|
do_build_docker() {
|
||||||
|
if ! dpkg --print-architecture | grep -q 'amd64'; then
|
||||||
|
echo "Docker-based builds only support amd64-based cross-building; use a 'native' build instead."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ ! -f deployment/Dockerfile.${PLATFORM} ]]; then
|
||||||
|
echo "Missing Dockerfile for platform ${PLATFORM}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
if [[ ${KEEP_ARTIFACTS} == YES ]]; then
|
||||||
|
docker_args=""
|
||||||
|
else
|
||||||
|
docker_args="--rm"
|
||||||
|
fi
|
||||||
|
|
||||||
|
docker build . -t "jellyfin-builder.${PLATFORM}" -f deployment/Dockerfile.${PLATFORM}
|
||||||
|
mkdir -p ${ARTIFACT_DIR}
|
||||||
|
docker run $docker_args -v "${SOURCE_DIR}:/jellyfin" -v "${ARTIFACT_DIR}:/dist" "jellyfin-builder.${PLATFORM}"
|
||||||
|
}
|
||||||
|
|
||||||
|
while [[ $# -gt 0 ]]; do
|
||||||
|
key="$1"
|
||||||
|
case $key in
|
||||||
|
-t|--type)
|
||||||
|
BUILD_TYPE="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-p|--platform)
|
||||||
|
PLATFORM="$2"
|
||||||
|
shift
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-k|--keep-artifacts)
|
||||||
|
KEEP_ARTIFACTS=YES
|
||||||
|
shift
|
||||||
|
;;
|
||||||
|
-l|--list-platforms)
|
||||||
|
list_platforms
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
-h|--help)
|
||||||
|
usage
|
||||||
|
exit 0
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unknown option $1"
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
||||||
|
|
||||||
|
if [[ -z ${BUILD_TYPE} || -z ${PLATFORM} ]]; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
export SOURCE_DIR="$( pwd )"
|
||||||
|
export ARTIFACT_DIR="${SOURCE_DIR}/../bin/${PLATFORM}"
|
||||||
|
|
||||||
|
# Determine build type
|
||||||
|
case ${BUILD_TYPE} in
|
||||||
|
native)
|
||||||
|
do_build_native
|
||||||
|
;;
|
||||||
|
docker)
|
||||||
|
do_build_docker
|
||||||
|
;;
|
||||||
|
esac
|
9
build.yaml
Normal file
9
build.yaml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
---
|
||||||
|
# We just wrap `build` so this is really it
|
||||||
|
name: "jellyfin-web"
|
||||||
|
version: "10.6.0"
|
||||||
|
packages:
|
||||||
|
- debian.all
|
||||||
|
- fedora.all
|
||||||
|
- centos.all
|
||||||
|
- portable
|
96
bump_version
Executable file
96
bump_version
Executable file
|
@ -0,0 +1,96 @@
|
||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
# bump_version - increase the shared version and generate changelogs
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o pipefail
|
||||||
|
|
||||||
|
usage() {
|
||||||
|
echo -e "bump_version - increase the shared version and generate changelogs"
|
||||||
|
echo -e ""
|
||||||
|
echo -e "Usage:"
|
||||||
|
echo -e " $ bump_version <new_version>"
|
||||||
|
}
|
||||||
|
|
||||||
|
if [[ -z $1 ]]; then
|
||||||
|
usage
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
shared_version_file="src/components/apphost.js"
|
||||||
|
build_file="./build.yaml"
|
||||||
|
|
||||||
|
new_version="$1"
|
||||||
|
|
||||||
|
# Parse the version from shared version file
|
||||||
|
old_version="$(
|
||||||
|
grep "appVersion" ${shared_version_file} | head -1 \
|
||||||
|
| sed -E 's/var appVersion = "([0-9\.]+)";/\1/'
|
||||||
|
)"
|
||||||
|
echo "Old version in appHost is: $old_version"
|
||||||
|
|
||||||
|
# Set the shared version to the specified new_version
|
||||||
|
old_version_sed="$( sed 's/\./\\./g' <<<"${old_version}" )" # Escape the '.' chars
|
||||||
|
new_version_sed="$( cut -f1 -d'-' <<<"${new_version}" )"
|
||||||
|
sed -i "s/${old_version_sed}/${new_version_sed}/g" ${shared_version_file}
|
||||||
|
|
||||||
|
old_version="$(
|
||||||
|
grep "version:" ${build_file} \
|
||||||
|
| 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
|
||||||
|
old_version_sed="$( sed 's/\./\\./g' <<<"${old_version}" )" # Escape the '.' chars
|
||||||
|
sed -i "s/${old_version_sed}/${new_version}/g" ${build_file}
|
||||||
|
|
||||||
|
if [[ ${new_version} == *"-"* ]]; then
|
||||||
|
new_version_deb="$( sed 's/-/~/g' <<<"${new_version}" )"
|
||||||
|
else
|
||||||
|
new_version_deb="${new_version}-1"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Write out a temporary Debian changelog with our new stuff appended and some templated formatting
|
||||||
|
debian_changelog_file="debian/changelog"
|
||||||
|
debian_changelog_temp="$( mktemp )"
|
||||||
|
# Create new temp file with our changelog
|
||||||
|
echo -e "jellyfin (${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}
|
||||||
|
|
||||||
|
-- Jellyfin Packaging Team <packaging@jellyfin.org> $( date --rfc-2822 )
|
||||||
|
" >> ${debian_changelog_temp}
|
||||||
|
cat ${debian_changelog_file} >> ${debian_changelog_temp}
|
||||||
|
# Move into place
|
||||||
|
mv ${debian_changelog_temp} ${debian_changelog_file}
|
||||||
|
|
||||||
|
# Write out a temporary Yum changelog with our new stuff prepended and some templated formatting
|
||||||
|
fedora_spec_file="fedora/jellyfin.spec"
|
||||||
|
fedora_changelog_temp="$( mktemp )"
|
||||||
|
fedora_spec_temp_dir="$( mktemp -d )"
|
||||||
|
fedora_spec_temp="${fedora_spec_temp_dir}/jellyfin.spec.tmp"
|
||||||
|
# Make a copy of our spec file for hacking
|
||||||
|
cp ${fedora_spec_file} ${fedora_spec_temp_dir}/
|
||||||
|
pushd ${fedora_spec_temp_dir}
|
||||||
|
# Split out the stuff before and after changelog
|
||||||
|
csplit jellyfin.spec "/^%changelog/" # produces xx00 xx01
|
||||||
|
# Update the version in xx00
|
||||||
|
sed -i "s/${old_version_sed}/${new_version_sed}/g" xx00
|
||||||
|
# Remove the header from xx01
|
||||||
|
sed -i '/^%changelog/d' xx01
|
||||||
|
# Create new temp file with our changelog
|
||||||
|
echo -e "%changelog
|
||||||
|
* $( LANG=C date '+%a %b %d %Y' ) Jellyfin Packaging Team <packaging@jellyfin.org>
|
||||||
|
- New upstream version ${new_version}; release changelog at https://github.com/jellyfin/jellyfin-web/releases/tag/v${new_version}" >> ${fedora_changelog_temp}
|
||||||
|
cat xx01 >> ${fedora_changelog_temp}
|
||||||
|
# Reassembble
|
||||||
|
cat xx00 ${fedora_changelog_temp} > ${fedora_spec_temp}
|
||||||
|
popd
|
||||||
|
# Move into place
|
||||||
|
mv ${fedora_spec_temp} ${fedora_spec_file}
|
||||||
|
# Clean up
|
||||||
|
rm -rf ${fedora_changelog_temp} ${fedora_spec_temp_dir}
|
||||||
|
|
||||||
|
# Stage the changed files for commit
|
||||||
|
git add ${shared_version_file} ${build_file} ${debian_changelog_file} ${fedora_spec_file} Dockerfile*
|
||||||
|
git status
|
5
debian/changelog
vendored
Normal file
5
debian/changelog
vendored
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
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
|
||||||
|
|
||||||
|
-- Jellyfin Packaging Team <packaging@jellyfin.org> Mon, 16 Mar 2020 11:15:00 -0400
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
8
|
16
debian/control
vendored
Normal file
16
debian/control
vendored
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
Source: jellyfin-web
|
||||||
|
Section: misc
|
||||||
|
Priority: optional
|
||||||
|
Maintainer: Jellyfin Team <team@jellyfin.org>
|
||||||
|
Build-Depends: debhelper (>= 9),
|
||||||
|
npm | nodejs
|
||||||
|
Standards-Version: 3.9.4
|
||||||
|
Homepage: https://jellyfin.org/
|
||||||
|
Vcs-Git: https://github.org/jellyfin/jellyfin-web.git
|
||||||
|
Vcs-Browser: https://github.org/jellyfin/jellyfin-web
|
||||||
|
|
||||||
|
Package: jellyfin-web
|
||||||
|
Recommends: jellyfin-server
|
||||||
|
Architecture: all
|
||||||
|
Description: Jellyfin is the Free Software Media System.
|
||||||
|
This package provides the Jellyfin web client.
|
28
debian/copyright
vendored
Normal file
28
debian/copyright
vendored
Normal file
|
@ -0,0 +1,28 @@
|
||||||
|
Format: http://dep.debian.net/deps/dep5
|
||||||
|
Upstream-Name: jellyfin-web
|
||||||
|
Source: https://github.com/jellyfin/jellyfin-web
|
||||||
|
|
||||||
|
Files: *
|
||||||
|
Copyright: 2018-2020 Jellyfin Team
|
||||||
|
License: GPL-3.0
|
||||||
|
|
||||||
|
Files: debian/*
|
||||||
|
Copyright: 2020 Joshua Boniface <joshua@boniface.me>
|
||||||
|
License: GPL-3.0
|
||||||
|
|
||||||
|
License: GPL-3.0
|
||||||
|
This package is free software; you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation; either version 2 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
.
|
||||||
|
This package is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
.
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>
|
||||||
|
.
|
||||||
|
On Debian systems, the complete text of the GNU General
|
||||||
|
Public License version 2 can be found in "/usr/share/common-licenses/GPL-2".
|
6
debian/gbp.conf
vendored
Normal file
6
debian/gbp.conf
vendored
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
[DEFAULT]
|
||||||
|
pristine-tar = False
|
||||||
|
cleaner = fakeroot debian/rules clean
|
||||||
|
|
||||||
|
[import-orig]
|
||||||
|
filter = [ ".git*", ".hg*", ".vs*", ".vscode*" ]
|
1
debian/install
vendored
Normal file
1
debian/install
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
web usr/share/jellyfin/
|
1
debian/po/POTFILES.in
vendored
Normal file
1
debian/po/POTFILES.in
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
[type: gettext/rfc822deb] templates
|
57
debian/po/templates.pot
vendored
Normal file
57
debian/po/templates.pot
vendored
Normal file
|
@ -0,0 +1,57 @@
|
||||||
|
# SOME DESCRIPTIVE TITLE.
|
||||||
|
# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
|
||||||
|
# This file is distributed under the same license as the PACKAGE package.
|
||||||
|
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
|
||||||
|
#
|
||||||
|
#, fuzzy
|
||||||
|
msgid ""
|
||||||
|
msgstr ""
|
||||||
|
"Project-Id-Version: jellyfin-server\n"
|
||||||
|
"Report-Msgid-Bugs-To: jellyfin-server@packages.debian.org\n"
|
||||||
|
"POT-Creation-Date: 2015-06-12 20:51-0600\n"
|
||||||
|
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
|
||||||
|
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
||||||
|
"Language-Team: LANGUAGE <LL@li.org>\n"
|
||||||
|
"Language: \n"
|
||||||
|
"MIME-Version: 1.0\n"
|
||||||
|
"Content-Type: text/plain; charset=CHARSET\n"
|
||||||
|
"Content-Transfer-Encoding: 8bit\n"
|
||||||
|
|
||||||
|
#. Type: note
|
||||||
|
#. Description
|
||||||
|
#: ../templates:1001
|
||||||
|
msgid "Jellyfin permission info:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Type: note
|
||||||
|
#. Description
|
||||||
|
#: ../templates:1001
|
||||||
|
msgid ""
|
||||||
|
"Jellyfin by default runs under a user named \"jellyfin\". Please ensure that the "
|
||||||
|
"user jellyfin has read and write access to any folders you wish to add to your "
|
||||||
|
"library. Otherwise please run jellyfin under a different user."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Type: string
|
||||||
|
#. Description
|
||||||
|
#: ../templates:2001
|
||||||
|
msgid "Username to run Jellyfin as:"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Type: string
|
||||||
|
#. Description
|
||||||
|
#: ../templates:2001
|
||||||
|
msgid "The user that jellyfin will run as."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Type: note
|
||||||
|
#. Description
|
||||||
|
#: ../templates:3001
|
||||||
|
msgid "Jellyfin still running"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
#. Type: note
|
||||||
|
#. Description
|
||||||
|
#: ../templates:3001
|
||||||
|
msgid "Jellyfin is currently running. Please close it and try again."
|
||||||
|
msgstr ""
|
20
debian/rules
vendored
Executable file
20
debian/rules
vendored
Executable file
|
@ -0,0 +1,20 @@
|
||||||
|
#! /usr/bin/make -f
|
||||||
|
export DH_VERBOSE=1
|
||||||
|
|
||||||
|
%:
|
||||||
|
dh $@
|
||||||
|
|
||||||
|
# disable "make check"
|
||||||
|
override_dh_auto_test:
|
||||||
|
|
||||||
|
# disable stripping debugging symbols
|
||||||
|
override_dh_clistrip:
|
||||||
|
|
||||||
|
override_dh_auto_build:
|
||||||
|
npx yarn install
|
||||||
|
mv $(CURDIR)/dist $(CURDIR)/web
|
||||||
|
|
||||||
|
override_dh_auto_clean:
|
||||||
|
test -d $(CURDIR)/dist && rm -rf '$(CURDIR)/dist' || true
|
||||||
|
test -d $(CURDIR)/web && rm -rf '$(CURDIR)/web' || true
|
||||||
|
test -d $(CURDIR)/node_modules && rm -rf '$(CURDIR)/node_modules' || true
|
1
debian/source/format
vendored
Normal file
1
debian/source/format
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
1.0
|
7
debian/source/options
vendored
Normal file
7
debian/source/options
vendored
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
tar-ignore='.git*'
|
||||||
|
tar-ignore='**/.git'
|
||||||
|
tar-ignore='**/.hg'
|
||||||
|
tar-ignore='**/.vs'
|
||||||
|
tar-ignore='**/.vscode'
|
||||||
|
tar-ignore='deployment'
|
||||||
|
tar-ignore='*.deb'
|
27
deployment/Dockerfile.centos.all
Normal file
27
deployment/Dockerfile.centos.all
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
FROM centos:7
|
||||||
|
# Docker build arguments
|
||||||
|
ARG SOURCE_DIR=/jellyfin
|
||||||
|
ARG ARTIFACT_DIR=/dist
|
||||||
|
# Docker run environment
|
||||||
|
ENV SOURCE_DIR=/jellyfin
|
||||||
|
ENV ARTIFACT_DIR=/dist
|
||||||
|
ENV IS_DOCKER=YES
|
||||||
|
|
||||||
|
# Prepare CentOS environment
|
||||||
|
RUN yum update -y \
|
||||||
|
&& yum install -y epel-release \
|
||||||
|
&& yum install -y @buildsys-build rpmdevtools git yum-plugins-core nodejs-yarn autoconf automake glibc-devel
|
||||||
|
|
||||||
|
# Install recent NodeJS and Yarn
|
||||||
|
RUN curl -fSsLo /etc/yum.repos.d/yarn.repo https://dl.yarnpkg.com/rpm/yarn.repo \
|
||||||
|
&& rpm -i https://rpm.nodesource.com/pub_10.x/el/7/x86_64/nodesource-release-el7-1.noarch.rpm \
|
||||||
|
&& yum install -y yarn
|
||||||
|
|
||||||
|
# Link to build script
|
||||||
|
RUN ln -sf ${SOURCE_DIR}/deployment/build.centos.all /build.sh
|
||||||
|
|
||||||
|
VOLUME ${SOURCE_DIR}/
|
||||||
|
|
||||||
|
VOLUME ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
ENTRYPOINT ["/build.sh"]
|
25
deployment/Dockerfile.debian.all
Normal file
25
deployment/Dockerfile.debian.all
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
FROM debian:10
|
||||||
|
# Docker build arguments
|
||||||
|
ARG SOURCE_DIR=/jellyfin
|
||||||
|
ARG ARTIFACT_DIR=/dist
|
||||||
|
# Docker run environment
|
||||||
|
ENV SOURCE_DIR=/jellyfin
|
||||||
|
ENV ARTIFACT_DIR=/dist
|
||||||
|
ENV DEB_BUILD_OPTIONS=noddebs
|
||||||
|
ENV IS_DOCKER=YES
|
||||||
|
|
||||||
|
# Prepare Debian build environment
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y debhelper mmv npm git
|
||||||
|
|
||||||
|
# Prepare Yarn
|
||||||
|
RUN npm install -g yarn
|
||||||
|
|
||||||
|
# Link to build script
|
||||||
|
RUN ln -sf ${SOURCE_DIR}/deployment/build.debian.all /build.sh
|
||||||
|
|
||||||
|
VOLUME ${SOURCE_DIR}/
|
||||||
|
|
||||||
|
VOLUME ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
ENTRYPOINT ["/build.sh"]
|
21
deployment/Dockerfile.fedora.all
Normal file
21
deployment/Dockerfile.fedora.all
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
FROM fedora:31
|
||||||
|
# Docker build arguments
|
||||||
|
ARG SOURCE_DIR=/jellyfin
|
||||||
|
ARG ARTIFACT_DIR=/dist
|
||||||
|
# Docker run environment
|
||||||
|
ENV SOURCE_DIR=/jellyfin
|
||||||
|
ENV ARTIFACT_DIR=/dist
|
||||||
|
ENV IS_DOCKER=YES
|
||||||
|
|
||||||
|
# Prepare Fedora environment
|
||||||
|
RUN dnf update -y \
|
||||||
|
&& dnf install -y @buildsys-build rpmdevtools git dnf-plugins-core nodejs-yarn autoconf automake glibc-devel
|
||||||
|
|
||||||
|
# Link to build script
|
||||||
|
RUN ln -sf ${SOURCE_DIR}/deployment/build.fedora.all /build.sh
|
||||||
|
|
||||||
|
VOLUME ${SOURCE_DIR}/
|
||||||
|
|
||||||
|
VOLUME ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
ENTRYPOINT ["/build.sh"]
|
25
deployment/Dockerfile.portable
Normal file
25
deployment/Dockerfile.portable
Normal file
|
@ -0,0 +1,25 @@
|
||||||
|
FROM debian:10
|
||||||
|
# Docker build arguments
|
||||||
|
ARG SOURCE_DIR=/jellyfin
|
||||||
|
ARG ARTIFACT_DIR=/dist
|
||||||
|
# Docker run environment
|
||||||
|
ENV SOURCE_DIR=/jellyfin
|
||||||
|
ENV ARTIFACT_DIR=/dist
|
||||||
|
ENV DEB_BUILD_OPTIONS=noddebs
|
||||||
|
ENV IS_DOCKER=YES
|
||||||
|
|
||||||
|
# Prepare Debian build environment
|
||||||
|
RUN apt-get update \
|
||||||
|
&& apt-get install -y mmv npm git
|
||||||
|
|
||||||
|
# Prepare Yarn
|
||||||
|
RUN npm install -g yarn
|
||||||
|
|
||||||
|
# Link to build script
|
||||||
|
RUN ln -sf ${SOURCE_DIR}/deployment/build.portable /build.sh
|
||||||
|
|
||||||
|
VOLUME ${SOURCE_DIR}/
|
||||||
|
|
||||||
|
VOLUME ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
ENTRYPOINT ["/build.sh"]
|
27
deployment/build.centos.all
Executable file
27
deployment/build.centos.all
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#= CentOS 7 all .rpm
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
# Move to source directory
|
||||||
|
pushd ${SOURCE_DIR}
|
||||||
|
|
||||||
|
cp -a yarn.lock /tmp/yarn.lock
|
||||||
|
|
||||||
|
# Build RPM
|
||||||
|
make -f fedora/Makefile srpm outdir=/root/rpmbuild/SRPMS
|
||||||
|
rpmbuild --rebuild -bb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm
|
||||||
|
|
||||||
|
# Move the artifacts out
|
||||||
|
mv /root/rpmbuild/RPMS/noarch/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
if [[ ${IS_DOCKER} == YES ]]; then
|
||||||
|
chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f fedora/jellyfin*.tar.gz
|
||||||
|
cp -a /tmp/yarn.lock yarn.lock
|
||||||
|
|
||||||
|
popd
|
25
deployment/build.debian.all
Executable file
25
deployment/build.debian.all
Executable file
|
@ -0,0 +1,25 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#= Debian/Ubuntu all .deb
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
# Move to source directory
|
||||||
|
pushd ${SOURCE_DIR}
|
||||||
|
|
||||||
|
cp -a yarn.lock /tmp/yarn.lock
|
||||||
|
|
||||||
|
# Build DEB
|
||||||
|
dpkg-buildpackage -us -uc --pre-clean --post-clean
|
||||||
|
|
||||||
|
mkdir -p ${ARTIFACT_DIR}/
|
||||||
|
mv ../jellyfin*.{deb,dsc,tar.gz,buildinfo,changes} ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
cp -a /tmp/yarn.lock yarn.lock
|
||||||
|
|
||||||
|
if [[ ${IS_DOCKER} == YES ]]; then
|
||||||
|
chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd
|
27
deployment/build.fedora.all
Executable file
27
deployment/build.fedora.all
Executable file
|
@ -0,0 +1,27 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#= Fedora 29+ all .rpm
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
# Move to source directory
|
||||||
|
pushd ${SOURCE_DIR}
|
||||||
|
|
||||||
|
cp -a yarn.lock /tmp/yarn.lock
|
||||||
|
|
||||||
|
# Build RPM
|
||||||
|
make -f fedora/Makefile srpm outdir=/root/rpmbuild/SRPMS
|
||||||
|
rpmbuild -rb /root/rpmbuild/SRPMS/jellyfin-*.src.rpm
|
||||||
|
|
||||||
|
# Move the artifacts out
|
||||||
|
mv /root/rpmbuild/RPMS/noarch/jellyfin-*.rpm /root/rpmbuild/SRPMS/jellyfin-*.src.rpm ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
if [[ ${IS_DOCKER} == YES ]]; then
|
||||||
|
chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
rm -f fedora/jellyfin*.tar.gz
|
||||||
|
cp -a /tmp/yarn.lock yarn.lock
|
||||||
|
|
||||||
|
popd
|
28
deployment/build.portable
Executable file
28
deployment/build.portable
Executable file
|
@ -0,0 +1,28 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
#= Portable .NET DLL .tar.gz
|
||||||
|
|
||||||
|
set -o errexit
|
||||||
|
set -o xtrace
|
||||||
|
|
||||||
|
# Move to source directory
|
||||||
|
pushd ${SOURCE_DIR}
|
||||||
|
|
||||||
|
# Get version
|
||||||
|
version="$( grep "version:" ./build.yaml | sed -E 's/version: "([0-9\.]+.*)"/\1/' )"
|
||||||
|
|
||||||
|
# Build archives
|
||||||
|
npx yarn install
|
||||||
|
mv dist/ jellyfin-web_${version}
|
||||||
|
tar -czf jellyfin-web_${version}_portable.tar.gz jellyfin-web_${version}
|
||||||
|
rm -rf dist/
|
||||||
|
|
||||||
|
# Move the artifacts out
|
||||||
|
mkdir -p ${ARTIFACT_DIR}/
|
||||||
|
mv jellyfin[-_]*.tar.gz ${ARTIFACT_DIR}/
|
||||||
|
|
||||||
|
if [[ ${IS_DOCKER} == YES ]]; then
|
||||||
|
chown -Rc $(stat -c %u:%g ${ARTIFACT_DIR}) ${ARTIFACT_DIR}
|
||||||
|
fi
|
||||||
|
|
||||||
|
popd
|
21
fedora/Makefile
Normal file
21
fedora/Makefile
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
VERSION := $(shell sed -ne '/^Version:/s/.* *//p' fedora/jellyfin-web.spec)
|
||||||
|
|
||||||
|
srpm:
|
||||||
|
cd fedora/; \
|
||||||
|
SOURCE_DIR=.. \
|
||||||
|
WORKDIR="$${PWD}"; \
|
||||||
|
tar \
|
||||||
|
--transform "s,^\.,jellyfin-web-$(VERSION)," \
|
||||||
|
--exclude='.git*' \
|
||||||
|
--exclude='**/.git' \
|
||||||
|
--exclude='**/.hg' \
|
||||||
|
--exclude='deployment' \
|
||||||
|
--exclude='*.deb' \
|
||||||
|
--exclude='*.rpm' \
|
||||||
|
--exclude='jellyfin-web-$(VERSION).tar.gz' \
|
||||||
|
-czf "jellyfin-web-$(VERSION).tar.gz" \
|
||||||
|
-C $${SOURCE_DIR} ./
|
||||||
|
cd fedora/; \
|
||||||
|
rpmbuild -bs jellyfin-web.spec \
|
||||||
|
--define "_sourcedir $$PWD/" \
|
||||||
|
--define "_srcrpmdir $(outdir)"
|
43
fedora/jellyfin-web.spec
Normal file
43
fedora/jellyfin-web.spec
Normal file
|
@ -0,0 +1,43 @@
|
||||||
|
%global debug_package %{nil}
|
||||||
|
|
||||||
|
Name: jellyfin-web
|
||||||
|
Version: 10.6.0
|
||||||
|
Release: 1%{?dist}
|
||||||
|
Summary: The Free Software Media System web client
|
||||||
|
License: GPLv3
|
||||||
|
URL: https://jellyfin.org
|
||||||
|
# Jellyfin Server tarball created by `make -f .copr/Makefile srpm`, real URL ends with `v%{version}.tar.gz`
|
||||||
|
Source0: jellyfin-web-%{version}.tar.gz
|
||||||
|
|
||||||
|
%if 0%{?centos}
|
||||||
|
BuildRequires: yarn
|
||||||
|
%else
|
||||||
|
BuildRequires nodejs-yarn
|
||||||
|
%endif
|
||||||
|
BuildArch: noarch
|
||||||
|
|
||||||
|
# Disable Automatic Dependency Processing
|
||||||
|
AutoReqProv: no
|
||||||
|
|
||||||
|
%description
|
||||||
|
Jellyfin is a free software media system that puts you in control of managing and streaming your media.
|
||||||
|
|
||||||
|
|
||||||
|
%prep
|
||||||
|
%autosetup -n jellyfin-web-%{version} -b 0
|
||||||
|
|
||||||
|
%build
|
||||||
|
|
||||||
|
%install
|
||||||
|
yarn install
|
||||||
|
%{__mkdir} -p %{buildroot}%{_datadir}
|
||||||
|
mv dist %{buildroot}%{_datadir}/jellyfin-web
|
||||||
|
%{__install} -D -m 0644 LICENSE %{buildroot}%{_datadir}/licenses/jellyfin/LICENSE
|
||||||
|
|
||||||
|
%files
|
||||||
|
%attr(755,root,root) %{_datadir}/jellyfin-web
|
||||||
|
%{_datadir}/licenses/jellyfin/LICENSE
|
||||||
|
|
||||||
|
%changelog
|
||||||
|
* Mon Mar 23 2020 Jellyfin Packaging Team <packaging@jellyfin.org>
|
||||||
|
- Forthcoming stable release
|
205
gulpfile.js
Normal file
205
gulpfile.js
Normal file
|
@ -0,0 +1,205 @@
|
||||||
|
const { src, dest, series, parallel, watch } = require('gulp');
|
||||||
|
const browserSync = require('browser-sync').create();
|
||||||
|
const del = require('del');
|
||||||
|
const babel = require('gulp-babel');
|
||||||
|
const concat = require('gulp-concat');
|
||||||
|
const terser = require('gulp-terser');
|
||||||
|
const htmlmin = require('gulp-htmlmin');
|
||||||
|
const imagemin = require('gulp-imagemin');
|
||||||
|
const sourcemaps = require('gulp-sourcemaps');
|
||||||
|
const mode = require('gulp-mode')({
|
||||||
|
modes: ['development', 'production'],
|
||||||
|
default: 'development',
|
||||||
|
verbose: false
|
||||||
|
});
|
||||||
|
const stream = require('webpack-stream');
|
||||||
|
const inject = require('gulp-inject');
|
||||||
|
const postcss = require('gulp-postcss');
|
||||||
|
const sass = require('gulp-sass');
|
||||||
|
const gulpif = require('gulp-if');
|
||||||
|
const lazypipe = require('lazypipe');
|
||||||
|
|
||||||
|
sass.compiler = require('node-sass');
|
||||||
|
|
||||||
|
let config;
|
||||||
|
if (mode.production()) {
|
||||||
|
config = require('./webpack.prod.js');
|
||||||
|
} else {
|
||||||
|
config = require('./webpack.dev.js');
|
||||||
|
}
|
||||||
|
|
||||||
|
const options = {
|
||||||
|
javascript: {
|
||||||
|
query: ['src/**/*.js', '!src/bundle.js', '!src/standalone.js', '!src/scripts/apploader.js']
|
||||||
|
},
|
||||||
|
apploader: {
|
||||||
|
query: ['src/standalone.js', 'src/scripts/apploader.js']
|
||||||
|
},
|
||||||
|
css: {
|
||||||
|
query: ['src/**/*.css', 'src/**/*.scss']
|
||||||
|
},
|
||||||
|
html: {
|
||||||
|
query: ['src/**/*.html', '!src/index.html']
|
||||||
|
},
|
||||||
|
images: {
|
||||||
|
query: ['src/**/*.png', 'src/**/*.jpg', 'src/**/*.gif', 'src/**/*.svg']
|
||||||
|
},
|
||||||
|
copy: {
|
||||||
|
query: ['src/**/*.json', 'src/**/*.ico']
|
||||||
|
},
|
||||||
|
injectBundle: {
|
||||||
|
query: 'src/index.html'
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
function serve() {
|
||||||
|
browserSync.init({
|
||||||
|
server: {
|
||||||
|
baseDir: './dist'
|
||||||
|
},
|
||||||
|
port: 8080
|
||||||
|
});
|
||||||
|
|
||||||
|
const events = ['add', 'change'];
|
||||||
|
|
||||||
|
watch(options.javascript.query).on('all', function (event, path) {
|
||||||
|
if (events.includes(event)) {
|
||||||
|
javascript(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(options.apploader.query, apploader(true));
|
||||||
|
|
||||||
|
watch('src/bundle.js', webpack);
|
||||||
|
|
||||||
|
watch(options.css.query).on('all', function (event, path) {
|
||||||
|
if (events.includes(event)) {
|
||||||
|
css(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(options.html.query).on('all', function (event, path) {
|
||||||
|
if (events.includes(event)) {
|
||||||
|
html(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(options.images.query).on('all', function (event, path) {
|
||||||
|
if (events.includes(event)) {
|
||||||
|
images(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(options.copy.query).on('all', function (event, path) {
|
||||||
|
if (events.includes(event)) {
|
||||||
|
copy(path);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
watch(options.injectBundle.query, injectBundle);
|
||||||
|
}
|
||||||
|
|
||||||
|
function clean() {
|
||||||
|
return del(['dist/']);
|
||||||
|
}
|
||||||
|
|
||||||
|
const pipelineJavascript = lazypipe()
|
||||||
|
.pipe(function () {
|
||||||
|
return mode.development(sourcemaps.init({ loadMaps: true }));
|
||||||
|
})
|
||||||
|
.pipe(function () {
|
||||||
|
return babel({
|
||||||
|
presets: [
|
||||||
|
['@babel/preset-env']
|
||||||
|
]
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.pipe(function () {
|
||||||
|
return terser({
|
||||||
|
keep_fnames: true,
|
||||||
|
mangle: false
|
||||||
|
});
|
||||||
|
})
|
||||||
|
.pipe(function () {
|
||||||
|
return mode.development(sourcemaps.write('.'));
|
||||||
|
});
|
||||||
|
|
||||||
|
function javascript(query) {
|
||||||
|
return src(typeof query !== 'function' ? query : options.javascript.query, { base: './src/' })
|
||||||
|
.pipe(pipelineJavascript())
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
function apploader(standalone) {
|
||||||
|
function task() {
|
||||||
|
return src(options.apploader.query, { base: './src/' })
|
||||||
|
.pipe(gulpif(standalone, concat('scripts/apploader.js')))
|
||||||
|
.pipe(pipelineJavascript())
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
task.displayName = 'apploader';
|
||||||
|
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
function webpack() {
|
||||||
|
return stream(config)
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
function css(query) {
|
||||||
|
return src(typeof query !== 'function' ? query : options.css.query, { base: './src/' })
|
||||||
|
.pipe(mode.development(sourcemaps.init({ loadMaps: true })))
|
||||||
|
.pipe(sass().on('error', sass.logError))
|
||||||
|
.pipe(postcss())
|
||||||
|
.pipe(mode.development(sourcemaps.write('.')))
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
function html(query) {
|
||||||
|
return src(typeof query !== 'function' ? query : options.html.query, { base: './src/' })
|
||||||
|
.pipe(mode.production(htmlmin({ collapseWhitespace: true })))
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
function images(query) {
|
||||||
|
return src(typeof query !== 'function' ? query : options.images.query, { base: './src/' })
|
||||||
|
.pipe(mode.production(imagemin()))
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
function copy(query) {
|
||||||
|
return src(typeof query !== 'function' ? query : options.copy.query, { base: './src/' })
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
function copyIndex() {
|
||||||
|
return src(options.injectBundle.query, { base: './src/' })
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
function injectBundle() {
|
||||||
|
return src(options.injectBundle.query, { base: './src/' })
|
||||||
|
.pipe(inject(
|
||||||
|
src(['src/scripts/apploader.js'], { read: false }, { base: './src/' }), { relative: true }
|
||||||
|
))
|
||||||
|
.pipe(dest('dist/'))
|
||||||
|
.pipe(browserSync.stream());
|
||||||
|
}
|
||||||
|
|
||||||
|
function build(standalone) {
|
||||||
|
return series(clean, parallel(javascript, apploader(standalone), webpack, css, html, images, copy));
|
||||||
|
}
|
||||||
|
|
||||||
|
exports.default = series(build(false), copyIndex);
|
||||||
|
exports.standalone = series(build(true), injectBundle);
|
||||||
|
exports.serve = series(exports.standalone, serve);
|
97
package.json
97
package.json
|
@ -5,12 +5,42 @@
|
||||||
"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.8.6",
|
||||||
|
"@babel/plugin-transform-modules-amd": "^7.8.3",
|
||||||
|
"@babel/polyfill": "^7.8.7",
|
||||||
|
"@babel/preset-env": "^7.8.6",
|
||||||
|
"autoprefixer": "^9.7.6",
|
||||||
|
"babel-loader": "^8.0.6",
|
||||||
|
"browser-sync": "^2.26.7",
|
||||||
"clean-webpack-plugin": "^3.0.0",
|
"clean-webpack-plugin": "^3.0.0",
|
||||||
"copy-webpack-plugin": "^5.1.1",
|
"copy-webpack-plugin": "^5.1.1",
|
||||||
"css-loader": "^3.4.2",
|
"css-loader": "^3.4.2",
|
||||||
|
"cssnano": "^4.1.10",
|
||||||
|
"del": "^5.1.0",
|
||||||
"eslint": "^6.8.0",
|
"eslint": "^6.8.0",
|
||||||
"file-loader": "^5.0.2",
|
"eslint-plugin-compat": "^3.5.1",
|
||||||
"html-webpack-plugin": "^3.2.0",
|
"eslint-plugin-eslint-comments": "^3.1.2",
|
||||||
|
"eslint-plugin-import": "^2.20.2",
|
||||||
|
"eslint-plugin-promise": "^4.2.1",
|
||||||
|
"file-loader": "^6.0.0",
|
||||||
|
"gulp": "^4.0.2",
|
||||||
|
"gulp-babel": "^8.0.0",
|
||||||
|
"gulp-cli": "^2.2.0",
|
||||||
|
"gulp-concat": "^2.6.1",
|
||||||
|
"gulp-htmlmin": "^5.0.1",
|
||||||
|
"gulp-if": "^3.0.0",
|
||||||
|
"gulp-imagemin": "^7.1.0",
|
||||||
|
"gulp-inject": "^5.0.5",
|
||||||
|
"gulp-mode": "^1.0.2",
|
||||||
|
"gulp-postcss": "^8.0.0",
|
||||||
|
"gulp-sass": "^4.0.2",
|
||||||
|
"gulp-sourcemaps": "^2.6.5",
|
||||||
|
"gulp-terser": "^1.2.0",
|
||||||
|
"html-webpack-plugin": "^4.0.2",
|
||||||
|
"lazypipe": "^1.0.2",
|
||||||
|
"node-sass": "^4.13.1",
|
||||||
|
"postcss-loader": "^3.0.0",
|
||||||
|
"postcss-preset-env": "^6.7.0",
|
||||||
"style-loader": "^1.1.3",
|
"style-loader": "^1.1.3",
|
||||||
"stylelint": "^13.1.0",
|
"stylelint": "^13.1.0",
|
||||||
"stylelint-config-rational-order": "^0.1.2",
|
"stylelint-config-rational-order": "^0.1.2",
|
||||||
|
@ -20,29 +50,65 @@
|
||||||
"webpack-cli": "^3.3.10",
|
"webpack-cli": "^3.3.10",
|
||||||
"webpack-concat-plugin": "^3.0.0",
|
"webpack-concat-plugin": "^3.0.0",
|
||||||
"webpack-dev-server": "^3.10.3",
|
"webpack-dev-server": "^3.10.3",
|
||||||
"webpack-merge": "^4.2.2"
|
"webpack-merge": "^4.2.2",
|
||||||
|
"webpack-stream": "^5.2.1"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"alameda": "^1.4.0",
|
"alameda": "^1.4.0",
|
||||||
|
"classlist.js": "https://github.com/eligrey/classList.js/archive/1.2.20180112.tar.gz",
|
||||||
|
"core-js": "^3.6.4",
|
||||||
|
"date-fns": "^2.11.1",
|
||||||
"document-register-element": "^1.14.3",
|
"document-register-element": "^1.14.3",
|
||||||
|
"fast-text-encoding": "^1.0.1",
|
||||||
"flv.js": "^1.5.0",
|
"flv.js": "^1.5.0",
|
||||||
|
"headroom.js": "^0.11.0",
|
||||||
"hls.js": "^0.13.1",
|
"hls.js": "^0.13.1",
|
||||||
"howler": "^2.1.3",
|
"howler": "^2.1.3",
|
||||||
|
"intersection-observer": "^0.7.0",
|
||||||
"jellyfin-noto": "https://github.com/jellyfin/jellyfin-noto",
|
"jellyfin-noto": "https://github.com/jellyfin/jellyfin-noto",
|
||||||
"jquery": "^3.4.1",
|
"jquery": "^3.5.0",
|
||||||
"jstree": "^3.3.7",
|
"jstree": "^3.3.7",
|
||||||
"libass-wasm": "^2.1.1",
|
"libass-wasm": "https://github.com/jellyfin/JavascriptSubtitlesOctopus#4.0.0-jf-cordova",
|
||||||
"libjass": "^0.11.0",
|
|
||||||
"material-design-icons-iconfont": "^5.0.1",
|
"material-design-icons-iconfont": "^5.0.1",
|
||||||
"native-promise-only": "^0.8.0-a",
|
"native-promise-only": "^0.8.0-a",
|
||||||
"requirejs": "^2.3.5",
|
"page": "^1.11.5",
|
||||||
|
"query-string": "^6.11.1",
|
||||||
"resize-observer-polyfill": "^1.5.1",
|
"resize-observer-polyfill": "^1.5.1",
|
||||||
"shaka-player": "^2.5.9",
|
"screenfull": "^5.0.2",
|
||||||
|
"shaka-player": "^2.5.10",
|
||||||
"sortablejs": "^1.10.2",
|
"sortablejs": "^1.10.2",
|
||||||
"swiper": "^5.3.1",
|
"swiper": "^5.3.7",
|
||||||
"webcomponents.js": "^0.7.24",
|
"webcomponents.js": "^0.7.24",
|
||||||
"whatwg-fetch": "^3.0.0"
|
"whatwg-fetch": "^3.0.0"
|
||||||
},
|
},
|
||||||
|
"babel": {
|
||||||
|
"presets": [
|
||||||
|
"@babel/preset-env"
|
||||||
|
],
|
||||||
|
"overrides": [
|
||||||
|
{
|
||||||
|
"test": [
|
||||||
|
"src/components/autoFocuser.js",
|
||||||
|
"src/components/cardbuilder/cardBuilder.js",
|
||||||
|
"src/scripts/dom.js",
|
||||||
|
"src/components/filedownloader.js",
|
||||||
|
"src/scripts/filesystem.js",
|
||||||
|
"src/scripts/keyboardnavigation.js",
|
||||||
|
"src/components/sanatizefilename.js",
|
||||||
|
"src/components/scrollManager.js",
|
||||||
|
"src/scripts/settings/appSettings.js",
|
||||||
|
"src/scripts/settings/userSettings.js",
|
||||||
|
"src/scripts/settings/webSettings.js",
|
||||||
|
"src/scripts/dfnshelper.js",
|
||||||
|
"src/scripts/imagehelper.js",
|
||||||
|
"src/scripts/inputManager.js"
|
||||||
|
],
|
||||||
|
"plugins": [
|
||||||
|
"@babel/plugin-transform-modules-amd"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
"browserslist": [
|
"browserslist": [
|
||||||
"last 2 Firefox versions",
|
"last 2 Firefox versions",
|
||||||
"last 2 Chrome versions",
|
"last 2 Chrome versions",
|
||||||
|
@ -50,6 +116,7 @@
|
||||||
"last 2 Safari versions",
|
"last 2 Safari versions",
|
||||||
"last 2 iOS versions",
|
"last 2 iOS versions",
|
||||||
"last 2 Edge versions",
|
"last 2 Edge versions",
|
||||||
|
"Chrome 27",
|
||||||
"Chrome 38",
|
"Chrome 38",
|
||||||
"Chrome 47",
|
"Chrome 47",
|
||||||
"Chrome 53",
|
"Chrome 53",
|
||||||
|
@ -58,10 +125,12 @@
|
||||||
"Firefox ESR"
|
"Firefox ESR"
|
||||||
],
|
],
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"serve": "webpack-dev-server --config webpack.dev.js --open",
|
"serve": "gulp serve --development",
|
||||||
"build": "webpack --config webpack.prod.js",
|
"prepare": "gulp --production",
|
||||||
"lint": "eslint \"src\"",
|
"build:development": "gulp --development",
|
||||||
"stylelint": "stylelint \"src/**/*.css\"",
|
"build:production": "gulp --production",
|
||||||
"prepare": "webpack --config webpack.prod.js"
|
"build:standalone": "gulp standalone --development",
|
||||||
|
"lint": "eslint \".\"",
|
||||||
|
"stylelint": "stylelint \"src/**/*.css\""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
13
postcss.config.js
Normal file
13
postcss.config.js
Normal file
|
@ -0,0 +1,13 @@
|
||||||
|
const postcssPresetEnv = require('postcss-preset-env');
|
||||||
|
const autoprefixer = require('autoprefixer');
|
||||||
|
const cssnano = require('cssnano');
|
||||||
|
|
||||||
|
const config = () => ({
|
||||||
|
plugins: [
|
||||||
|
postcssPresetEnv(),
|
||||||
|
autoprefixer(),
|
||||||
|
cssnano()
|
||||||
|
]
|
||||||
|
});
|
||||||
|
|
||||||
|
module.exports = config;
|
|
@ -8,9 +8,8 @@
|
||||||
<a is="emby-linkbutton" class="raised button-alt headerHelpButton" target="_blank" href="https://docs.jellyfin.org/general/server/plugins/index.html">${Help}</a>
|
<a is="emby-linkbutton" class="raised button-alt headerHelpButton" target="_blank" href="https://docs.jellyfin.org/general/server/plugins/index.html">${Help}</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p id="tagline" style="font-style: italic;"></p>
|
<p id="overview" style="font-style: italic;"></p>
|
||||||
<p id="pPreviewImage"></p>
|
<p id="description"></p>
|
||||||
<p id="overview"></p>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="verticalSection">
|
<div class="verticalSection">
|
||||||
|
@ -28,7 +27,6 @@
|
||||||
</button>
|
</button>
|
||||||
<div class="fieldDescription">${ServerRestartNeededAfterPluginInstall}</div>
|
<div class="fieldDescription">${ServerRestartNeededAfterPluginInstall}</div>
|
||||||
</div>
|
</div>
|
||||||
<p id="nonServerMsg"></p>
|
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -37,9 +35,6 @@
|
||||||
<div is="emby-collapse" title="${HeaderDeveloperInfo}">
|
<div is="emby-collapse" title="${HeaderDeveloperInfo}">
|
||||||
<div class="collapseContent">
|
<div class="collapseContent">
|
||||||
<p id="developer"></p>
|
<p id="developer"></p>
|
||||||
<p id="pViewWebsite" style="display: none;">
|
|
||||||
<a is="emby-linkbutton" class="button-link" href="#" target="_blank">${ButtonViewWebsite}</a>
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
<div class="detailSectionHeader">
|
<div class="detailSectionHeader">
|
||||||
<h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;">${HeaderApiKeys}</h2>
|
<h2 style="margin:.6em 0;vertical-align:middle;display:inline-block;">${HeaderApiKeys}</h2>
|
||||||
<button is="emby-button" type="button" class="fab btnNewKey submit" style="margin-left:1em;" title="${ButtonAdd}">
|
<button is="emby-button" type="button" class="fab btnNewKey submit" style="margin-left:1em;" title="${ButtonAdd}">
|
||||||
<i class="material-icons">add</i>
|
<span class="material-icons add"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<p>${HeaderApiKeysHelp}</p>
|
<p>${HeaderApiKeysHelp}</p>
|
||||||
|
|
|
@ -63,6 +63,10 @@ progress[aria-valuenow]::before {
|
||||||
}
|
}
|
||||||
|
|
||||||
.adminDrawerLogo {
|
.adminDrawerLogo {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-mobile .adminDrawerLogo {
|
||||||
padding: 1.5em 1em 1.2em;
|
padding: 1.5em 1em 1.2em;
|
||||||
border-bottom: 1px solid #e0e0e0;
|
border-bottom: 1px solid #e0e0e0;
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
|
@ -161,7 +165,7 @@ div[data-role=controlgroup] a.ui-btn-active {
|
||||||
|
|
||||||
@media all and (min-width: 40em) {
|
@media all and (min-width: 40em) {
|
||||||
.content-primary {
|
.content-primary {
|
||||||
padding-top: 7em;
|
padding-top: 4.6em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.withTabs .content-primary {
|
.withTabs .content-primary {
|
||||||
|
|
|
@ -29,7 +29,7 @@ h3 {
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-tv {
|
.layout-tv {
|
||||||
font-size: 2.5vh;
|
font-size: 130%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-mobile {
|
.layout-mobile {
|
||||||
|
|
|
@ -24,6 +24,10 @@
|
||||||
padding-top: 7em !important;
|
padding-top: 7em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-mobile .libraryPage {
|
||||||
|
padding-top: 4em !important;
|
||||||
|
}
|
||||||
|
|
||||||
.itemDetailPage {
|
.itemDetailPage {
|
||||||
padding-top: 0 !important;
|
padding-top: 0 !important;
|
||||||
}
|
}
|
||||||
|
@ -115,7 +119,7 @@
|
||||||
display: -webkit-inline-box;
|
display: -webkit-inline-box;
|
||||||
display: -webkit-inline-flex;
|
display: -webkit-inline-flex;
|
||||||
display: inline-flex;
|
display: inline-flex;
|
||||||
margin: 0.3em 0 0 0.5em;
|
margin: 0 0 0 0.5em;
|
||||||
height: 1.7em;
|
height: 1.7em;
|
||||||
-webkit-box-align: center;
|
-webkit-box-align: center;
|
||||||
-webkit-align-items: center;
|
-webkit-align-items: center;
|
||||||
|
@ -268,12 +272,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 60em) {
|
|
||||||
.libraryDocument .mainDrawerButton {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (max-width: 84em) {
|
@media all and (max-width: 84em) {
|
||||||
.withSectionTabs .headerTop {
|
.withSectionTabs .headerTop {
|
||||||
padding-bottom: 0.55em;
|
padding-bottom: 0.55em;
|
||||||
|
@ -316,7 +314,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.dashboardDocument .mainDrawer-scrollContainer {
|
.dashboardDocument .mainDrawer-scrollContainer {
|
||||||
margin-top: 6em !important;
|
margin-top: 4.65em !important;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -439,10 +437,46 @@
|
||||||
background-size: cover;
|
background-size: cover;
|
||||||
background-repeat: no-repeat;
|
background-repeat: no-repeat;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
|
background-attachment: fixed;
|
||||||
height: 50vh;
|
height: 50vh;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-mobile .itemBackdrop {
|
||||||
|
background-attachment: scroll;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-desktop .itemBackdrop::after,
|
||||||
|
.layout-tv .itemBackdrop::after {
|
||||||
|
content: "";
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background: rgba(0, 0, 0, 0.65);
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-desktop .noBackdrop .itemBackdrop,
|
||||||
|
.layout-tv .noBackdrop .itemBackdrop {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailPageContent {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
padding-left: 2%;
|
||||||
|
padding-right: 2%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-desktop .noBackdrop .detailPageContent,
|
||||||
|
.layout-tv .noBackdrop .detailPageContent {
|
||||||
|
margin-top: 2.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-desktop .noBackdrop .detailImageContainer img,
|
||||||
|
.layout-tv .noBackdrop .detailImageContainer img {
|
||||||
|
margin-top: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.personBackdrop {
|
.personBackdrop {
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
}
|
}
|
||||||
|
@ -483,6 +517,13 @@
|
||||||
|
|
||||||
.itemName {
|
.itemName {
|
||||||
margin: 0.5em 0;
|
margin: 0.5em 0;
|
||||||
|
font-weight: 600;
|
||||||
|
}
|
||||||
|
|
||||||
|
.nameContainer {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
flex-wrap: wrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemMiscInfo {
|
.itemMiscInfo {
|
||||||
|
@ -500,17 +541,15 @@
|
||||||
.layout-mobile .itemName,
|
.layout-mobile .itemName,
|
||||||
.layout-mobile .itemMiscInfo,
|
.layout-mobile .itemMiscInfo,
|
||||||
.layout-mobile .mainDetailButtons {
|
.layout-mobile .mainDetailButtons {
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
|
text-align: center;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailPagePrimaryContainer {
|
.detailPagePrimaryContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
align-content: center;
|
align-content: center;
|
||||||
position: sticky;
|
|
||||||
top: 3.85em;
|
|
||||||
z-index: 2;
|
z-index: 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -520,13 +559,21 @@
|
||||||
top: 0;
|
top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-tv .detailPagePrimaryContainer {
|
.layout-tv #itemDetailPage:not(.noBackdrop) .detailPagePrimaryContainer,
|
||||||
|
.layout-desktop #itemDetailPage:not(.noBackdrop) .detailPagePrimaryContainer {
|
||||||
position: relative;
|
position: relative;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
padding-left: 32.45vw;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailSticky {
|
.layout-desktop .detailSticky,
|
||||||
background-color: #101010;
|
.layout-tv .detailSticky {
|
||||||
|
margin-top: -7.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-desktop .noBackdrop .detailSticky,
|
||||||
|
.layout-tv .noBackdrop .detailSticky {
|
||||||
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.infoWrapper {
|
.infoWrapper {
|
||||||
|
@ -535,7 +582,6 @@
|
||||||
|
|
||||||
.infoText {
|
.infoText {
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
overflow: hidden;
|
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
text-align: left;
|
text-align: left;
|
||||||
}
|
}
|
||||||
|
@ -548,23 +594,17 @@
|
||||||
margin: 1.25em 0;
|
margin: 1.25em 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailPageContent {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
padding-left: 2%;
|
|
||||||
padding-right: 2%;
|
|
||||||
}
|
|
||||||
|
|
||||||
.detailImageContainer {
|
.detailImageContainer {
|
||||||
position: sticky;
|
position: relative;
|
||||||
top: 25%;
|
margin-top: -25vh;
|
||||||
float: left;
|
float: left;
|
||||||
width: 22.786458333333332vw;
|
width: 25vw;
|
||||||
|
z-index: 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
.layout-mobile .detailImageContainer,
|
.layout-desktop .noBackdrop .detailImageContainer,
|
||||||
.layout-tv .detailImageContainer {
|
.layout-tv .noBackdrop .detailImageContainer {
|
||||||
position: relative;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailPagePrimaryContent {
|
.detailPagePrimaryContent {
|
||||||
|
@ -572,43 +612,28 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
.detailLogo {
|
.detailLogo {
|
||||||
width: 25em;
|
width: 30vw;
|
||||||
height: 9.375em;
|
height: 25vh;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 14.5%;
|
top: 10vh;
|
||||||
right: 10.5%;
|
right: 20vw;
|
||||||
-webkit-background-size: contain;
|
|
||||||
background-size: contain;
|
background-size: contain;
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 87.5em) {
|
.noBackdrop .detailLogo {
|
||||||
.detailLogo {
|
display: none;
|
||||||
right: 5%;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@media all and (max-width: 75em) {
|
|
||||||
.detailLogo {
|
|
||||||
right: 2%;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@media all and (max-width: 68.75em) {
|
@media all and (max-width: 68.75em) {
|
||||||
.detailLogo {
|
.detailLogo {
|
||||||
width: 14.91em;
|
|
||||||
height: 3.5em;
|
|
||||||
right: 5%;
|
|
||||||
bottom: 5%;
|
|
||||||
top: auto;
|
|
||||||
background-position: center right;
|
|
||||||
display: none;
|
display: none;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.itemDetailImage {
|
.itemDetailImage {
|
||||||
width: 100% !important;
|
width: 100% !important;
|
||||||
box-shadow: 0 0.0725em 0.29em 0 rgba(0, 0, 0, 0.37);
|
-webkit-box-shadow: 0 0.1em 0.5em 0 rgba(0, 0, 0, 0.75);
|
||||||
-webkit-box-shadow: 0 0.0725em 0.29em 0 rgba(0, 0, 0, 0.37);
|
box-shadow: 0 0.1em 0.5em 0 rgba(0, 0, 0, 0.75);
|
||||||
}
|
}
|
||||||
|
|
||||||
div.itemDetailGalleryLink.defaultCardBackground {
|
div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
|
@ -619,12 +644,7 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
height: 23vw; /* Dirty hack to get it to look somewhat square. Less than ideal. */
|
height: 23vw; /* Dirty hack to get it to look somewhat square. Less than ideal. */
|
||||||
}
|
}
|
||||||
|
|
||||||
.btnSyncComplete i {
|
.itemDetailGalleryLink.defaultCardBackground > .material-icons {
|
||||||
-webkit-border-radius: 100em;
|
|
||||||
border-radius: 100em;
|
|
||||||
}
|
|
||||||
|
|
||||||
.itemDetailGalleryLink.defaultCardBackground > i {
|
|
||||||
font-size: 15vw;
|
font-size: 15vw;
|
||||||
margin-top: 50%;
|
margin-top: 50%;
|
||||||
transform: translateY(-50%);
|
transform: translateY(-50%);
|
||||||
|
@ -635,6 +655,16 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-desktop .detailPageWrapperContainer,
|
||||||
|
.layout-tv .detailPageWrapperContainer {
|
||||||
|
margin-top: 7.2em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.layout-tv #itemDetailPage:not(.noBackdrop) .detailPagePrimaryContainer,
|
||||||
|
.layout-desktop #itemDetailPage:not(.noBackdrop) .detailPagePrimaryContainer {
|
||||||
|
padding-left: 3.3%;
|
||||||
|
}
|
||||||
|
|
||||||
.btnPlaySimple {
|
.btnPlaySimple {
|
||||||
display: none !important;
|
display: none !important;
|
||||||
}
|
}
|
||||||
|
@ -646,10 +676,6 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.btnSyncComplete {
|
|
||||||
background: #673ab7 !important;
|
|
||||||
}
|
|
||||||
|
|
||||||
.emby-button.detailFloatingButton {
|
.emby-button.detailFloatingButton {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
background-color: rgba(0, 0, 0, 0.5) !important;
|
background-color: rgba(0, 0, 0, 0.5) !important;
|
||||||
|
@ -661,7 +687,7 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
color: rgba(255, 255, 255, 0.76);
|
color: rgba(255, 255, 255, 0.76);
|
||||||
}
|
}
|
||||||
|
|
||||||
.emby-button.detailFloatingButton i {
|
.emby-button.detailFloatingButton .material-icons {
|
||||||
font-size: 3.5em;
|
font-size: 3.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,7 +829,7 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
width: auto;
|
width: auto;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
margin-top: -4.3em;
|
margin-top: -4.2em;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -849,6 +875,11 @@ div.itemDetailGalleryLink.defaultCardBackground {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-desktop .noBackdrop .detailPageWrapperContainer,
|
||||||
|
.layout-tv .noBackdrop .detailPageWrapperContainer {
|
||||||
|
margin-top: 3.8em;
|
||||||
|
}
|
||||||
|
|
||||||
.mediaInfoStream {
|
.mediaInfoStream {
|
||||||
margin: 0 3em 0 0;
|
margin: 0 3em 0 0;
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
|
@ -1066,3 +1097,50 @@ div:not(.sectionTitleContainer-cards) > .sectionTitle-cards {
|
||||||
.itemsViewSettingsContainer > .button-flat {
|
.itemsViewSettingsContainer > .button-flat {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.layout-mobile #myPreferencesMenuPage {
|
||||||
|
padding-top: 3.75em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.itemDetailsGroup {
|
||||||
|
margin-bottom: 1.5em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trackSelections {
|
||||||
|
max-width: 44em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailsGroupItem,
|
||||||
|
.trackSelections .selectContainer {
|
||||||
|
display: flex;
|
||||||
|
max-width: 44em;
|
||||||
|
margin: 0 0 0.5em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trackSelections .selectContainer {
|
||||||
|
margin: 0 0 0.3em !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.detailsGroupItem .label,
|
||||||
|
.trackSelections .selectContainer .selectLabel {
|
||||||
|
cursor: default;
|
||||||
|
flex-grow: 0;
|
||||||
|
flex-shrink: 0;
|
||||||
|
flex-basis: 6.25em;
|
||||||
|
margin: 0 0.6em 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trackSelections .selectContainer .selectLabel {
|
||||||
|
margin: 0 0.2em 0 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trackSelections .selectContainer .detailTrackSelect {
|
||||||
|
font-size: inherit;
|
||||||
|
padding: 0;
|
||||||
|
overflow: hidden;
|
||||||
|
}
|
||||||
|
|
||||||
|
.trackSelections .selectContainer .selectArrowContainer .selectArrow {
|
||||||
|
margin-top: 0;
|
||||||
|
font-size: 1.4em;
|
||||||
|
}
|
||||||
|
|
|
@ -96,3 +96,16 @@ div[data-role=page] {
|
||||||
margin-right: auto;
|
margin-right: auto;
|
||||||
width: 85%;
|
width: 85%;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.headroom {
|
||||||
|
will-change: transform;
|
||||||
|
transition: transform 200ms linear;
|
||||||
|
}
|
||||||
|
|
||||||
|
.headroom--pinned {
|
||||||
|
transform: translateY(0%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.headroom--unpinned {
|
||||||
|
transform: translateY(-100%);
|
||||||
|
}
|
||||||
|
|
|
@ -5,4 +5,4 @@
|
||||||
<div id="pluginTiles" style="text-align:left;"></div>
|
<div id="pluginTiles" style="text-align:left;"></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
145
src/bundle.js
145
src/bundle.js
|
@ -5,105 +5,150 @@
|
||||||
var _define = window.define;
|
var _define = window.define;
|
||||||
|
|
||||||
// document-register-element
|
// document-register-element
|
||||||
var docRegister = require("document-register-element");
|
var docRegister = require('document-register-element');
|
||||||
_define("document-register-element", function() {
|
_define('document-register-element', function() {
|
||||||
return docRegister;
|
return docRegister;
|
||||||
});
|
});
|
||||||
|
|
||||||
// fetch
|
// fetch
|
||||||
var fetch = require("whatwg-fetch");
|
var fetch = require('whatwg-fetch');
|
||||||
_define("fetch", function() {
|
_define('fetch', function() {
|
||||||
return fetch
|
return fetch;
|
||||||
|
});
|
||||||
|
|
||||||
|
// query-string
|
||||||
|
var query = require('query-string');
|
||||||
|
_define('queryString', function() {
|
||||||
|
return query;
|
||||||
});
|
});
|
||||||
|
|
||||||
// flvjs
|
// flvjs
|
||||||
var flvjs = require("flv.js/dist/flv").default;
|
var flvjs = require('flv.js/dist/flv').default;
|
||||||
_define("flvjs", function() {
|
_define('flvjs', function() {
|
||||||
return flvjs;
|
return flvjs;
|
||||||
});
|
});
|
||||||
|
|
||||||
// jstree
|
// jstree
|
||||||
var jstree = require("jstree");
|
var 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");
|
var jquery = require('jquery');
|
||||||
_define("jQuery", function() {
|
_define('jQuery', function() {
|
||||||
return jquery;
|
return jquery;
|
||||||
});
|
});
|
||||||
|
|
||||||
// hlsjs
|
// hlsjs
|
||||||
var hlsjs = require("hls.js");
|
var hlsjs = require('hls.js');
|
||||||
_define("hlsjs", function() {
|
_define('hlsjs', function() {
|
||||||
return hlsjs;
|
return hlsjs;
|
||||||
});
|
});
|
||||||
|
|
||||||
// howler
|
// howler
|
||||||
var howler = require("howler");
|
var howler = require('howler');
|
||||||
_define("howler", function() {
|
_define('howler', function() {
|
||||||
return howler;
|
return howler;
|
||||||
});
|
});
|
||||||
|
|
||||||
// native-promise-only
|
|
||||||
var nativePromise = require("native-promise-only");
|
|
||||||
_define("native-promise-only", function() {
|
|
||||||
return nativePromise;
|
|
||||||
});
|
|
||||||
|
|
||||||
// resize-observer-polyfill
|
// resize-observer-polyfill
|
||||||
var resize = require("resize-observer-polyfill").default;
|
var resize = require('resize-observer-polyfill').default;
|
||||||
_define("resize-observer-polyfill", function() {
|
_define('resize-observer-polyfill', function() {
|
||||||
return resize;
|
return resize;
|
||||||
});
|
});
|
||||||
|
|
||||||
// shaka
|
// shaka
|
||||||
var shaka = require("shaka-player");
|
var shaka = require('shaka-player');
|
||||||
_define("shaka", function() {
|
_define('shaka', function() {
|
||||||
return shaka;
|
return shaka;
|
||||||
});
|
});
|
||||||
|
|
||||||
// swiper
|
// swiper
|
||||||
var swiper = require("swiper/js/swiper");
|
var swiper = require('swiper/js/swiper');
|
||||||
require("swiper/css/swiper.min.css");
|
require('swiper/css/swiper.min.css');
|
||||||
_define("swiper", function() {
|
_define('swiper', function() {
|
||||||
return swiper;
|
return swiper;
|
||||||
});
|
});
|
||||||
|
|
||||||
// sortable
|
// sortable
|
||||||
var sortable = require("sortablejs").default;
|
var sortable = require('sortablejs').default;
|
||||||
_define("sortable", function() {
|
_define('sortable', function() {
|
||||||
return sortable;
|
return sortable;
|
||||||
});
|
});
|
||||||
|
|
||||||
// webcomponents
|
// webcomponents
|
||||||
var webcomponents = require("webcomponents.js/webcomponents-lite");
|
var webcomponents = require('webcomponents.js/webcomponents-lite');
|
||||||
_define("webcomponents", function() {
|
_define('webcomponents', function() {
|
||||||
return webcomponents
|
return webcomponents;
|
||||||
});
|
|
||||||
|
|
||||||
// libjass
|
|
||||||
var libjass = require("libjass");
|
|
||||||
require("libjass/libjass.css");
|
|
||||||
_define("libjass", function() {
|
|
||||||
return libjass;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// libass-wasm
|
// libass-wasm
|
||||||
var libass_wasm = require("libass-wasm");
|
var libassWasm = require('libass-wasm');
|
||||||
_define("JavascriptSubtitlesOctopus", function() {
|
_define('JavascriptSubtitlesOctopus', function() {
|
||||||
return libass_wasm;
|
return libassWasm;
|
||||||
});
|
});
|
||||||
|
|
||||||
// material-icons
|
// material-icons
|
||||||
var material_icons = require("material-design-icons-iconfont/dist/material-design-icons.css");
|
var materialIcons = require('material-design-icons-iconfont/dist/material-design-icons.css');
|
||||||
_define("material-icons", function() {
|
_define('material-icons', function() {
|
||||||
return material_icons;
|
return materialIcons;
|
||||||
});
|
});
|
||||||
|
|
||||||
var jellyfin_noto = require("jellyfin-noto");
|
// noto font
|
||||||
_define("jellyfin-noto", function () {
|
var noto = require('jellyfin-noto');
|
||||||
return jellyfin_noto;
|
_define('jellyfin-noto', function () {
|
||||||
|
return noto;
|
||||||
|
});
|
||||||
|
|
||||||
|
// page.js
|
||||||
|
var page = require('page');
|
||||||
|
_define('page', function() {
|
||||||
|
return page;
|
||||||
|
});
|
||||||
|
|
||||||
|
var polyfill = require('@babel/polyfill/dist/polyfill');
|
||||||
|
_define('polyfill', function () {
|
||||||
|
return polyfill;
|
||||||
|
});
|
||||||
|
|
||||||
|
// domtokenlist-shim
|
||||||
|
var classlist = require('classlist.js');
|
||||||
|
_define('classlist-polyfill', function () {
|
||||||
|
return classlist;
|
||||||
|
});
|
||||||
|
|
||||||
|
// Date-FNS
|
||||||
|
var dateFns = require('date-fns');
|
||||||
|
_define('date-fns', function () {
|
||||||
|
return dateFns;
|
||||||
|
});
|
||||||
|
|
||||||
|
var dateFnsLocale = require('date-fns/locale');
|
||||||
|
_define('date-fns/locale', function () {
|
||||||
|
return dateFnsLocale;
|
||||||
|
});
|
||||||
|
|
||||||
|
var fast_text_encoding = require('fast-text-encoding');
|
||||||
|
_define('fast-text-encoding', function () {
|
||||||
|
return fast_text_encoding;
|
||||||
|
});
|
||||||
|
|
||||||
|
// intersection-observer
|
||||||
|
var intersection_observer = require('intersection-observer');
|
||||||
|
_define('intersection-observer', function () {
|
||||||
|
return intersection_observer;
|
||||||
|
});
|
||||||
|
|
||||||
|
// screenfull
|
||||||
|
var screenfull = require('screenfull');
|
||||||
|
_define('screenfull', function () {
|
||||||
|
return screenfull;
|
||||||
|
});
|
||||||
|
|
||||||
|
// headroom.js
|
||||||
|
var headroom = require('headroom.js/dist/headroom');
|
||||||
|
_define('headroom', function () {
|
||||||
|
return headroom;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
define(["dialogHelper", "datetime", "emby-select", "paper-icon-button-light", "formDialogStyle"], function (dialogHelper, datetime) {
|
define(['dialogHelper', 'datetime', 'globalize', 'emby-select', 'paper-icon-button-light', 'formDialogStyle'], function (dialogHelper, datetime, globalize) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
function getDisplayTime(hours) {
|
function getDisplayTime(hours) {
|
||||||
var minutes = 0;
|
var minutes = 0;
|
||||||
|
@ -13,32 +13,32 @@ define(["dialogHelper", "datetime", "emby-select", "paper-icon-button-light", "f
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateHours(context) {
|
function populateHours(context) {
|
||||||
var html = "";
|
var html = '';
|
||||||
|
|
||||||
for (var i = 0; i < 24; i++) {
|
for (var i = 0; i < 24; i++) {
|
||||||
html += '<option value="' + i + '">' + getDisplayTime(i) + "</option>";
|
html += '<option value="' + i + '">' + getDisplayTime(i) + '</option>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<option value="24">' + getDisplayTime(0) + "</option>";
|
html += '<option value="24">' + getDisplayTime(0) + '</option>';
|
||||||
context.querySelector("#selectStart").innerHTML = html;
|
context.querySelector('#selectStart').innerHTML = html;
|
||||||
context.querySelector("#selectEnd").innerHTML = html;
|
context.querySelector('#selectEnd').innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSchedule(context, schedule) {
|
function loadSchedule(context, schedule) {
|
||||||
context.querySelector("#selectDay").value = schedule.DayOfWeek || "Sunday";
|
context.querySelector('#selectDay').value = schedule.DayOfWeek || 'Sunday';
|
||||||
context.querySelector("#selectStart").value = schedule.StartHour || 0;
|
context.querySelector('#selectStart').value = schedule.StartHour || 0;
|
||||||
context.querySelector("#selectEnd").value = schedule.EndHour || 0;
|
context.querySelector('#selectEnd').value = schedule.EndHour || 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function submitSchedule(context, options) {
|
function submitSchedule(context, options) {
|
||||||
var updatedSchedule = {
|
var updatedSchedule = {
|
||||||
DayOfWeek: context.querySelector("#selectDay").value,
|
DayOfWeek: context.querySelector('#selectDay').value,
|
||||||
StartHour: context.querySelector("#selectStart").value,
|
StartHour: context.querySelector('#selectStart').value,
|
||||||
EndHour: context.querySelector("#selectEnd").value
|
EndHour: context.querySelector('#selectEnd').value
|
||||||
};
|
};
|
||||||
|
|
||||||
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('ErrorMessageStartHourGreaterThanEnd'));
|
||||||
}
|
}
|
||||||
|
|
||||||
context.submitted = true;
|
context.submitted = true;
|
||||||
|
@ -50,32 +50,32 @@ define(["dialogHelper", "datetime", "emby-select", "paper-icon-button-light", "f
|
||||||
show: function (options) {
|
show: function (options) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var xhr = new XMLHttpRequest();
|
var xhr = new XMLHttpRequest();
|
||||||
xhr.open("GET", "components/accessschedule/accessschedule.template.html", true);
|
xhr.open('GET', 'components/accessschedule/accessschedule.template.html', true);
|
||||||
|
|
||||||
xhr.onload = function (e) {
|
xhr.onload = function (e) {
|
||||||
var template = this.response;
|
var template = this.response;
|
||||||
var dlg = dialogHelper.createDialog({
|
var dlg = dialogHelper.createDialog({
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
size: "small"
|
size: 'small'
|
||||||
});
|
});
|
||||||
dlg.classList.add("formDialog");
|
dlg.classList.add('formDialog');
|
||||||
var html = "";
|
var html = '';
|
||||||
html += Globalize.translateDocument(template);
|
html += globalize.translateDocument(template);
|
||||||
dlg.innerHTML = html;
|
dlg.innerHTML = html;
|
||||||
populateHours(dlg);
|
populateHours(dlg);
|
||||||
loadSchedule(dlg, options.schedule);
|
loadSchedule(dlg, options.schedule);
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
dlg.addEventListener("close", function () {
|
dlg.addEventListener('close', function () {
|
||||||
if (dlg.submitted) {
|
if (dlg.submitted) {
|
||||||
resolve(options.schedule);
|
resolve(options.schedule);
|
||||||
} else {
|
} else {
|
||||||
reject();
|
reject();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
dlg.querySelector(".btnCancel").addEventListener("click", function (e) {
|
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
dlg.querySelector("form").addEventListener("submit", function (e) {
|
dlg.querySelector('form').addEventListener('submit', function (e) {
|
||||||
submitSchedule(dlg, options);
|
submitSchedule(dlg, options);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
<div class="formDialogHeader">
|
<div class="formDialogHeader">
|
||||||
<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1">
|
<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1">
|
||||||
<i class="material-icons arrow_back"></i>
|
<span class="material-icons arrow_back"></span>
|
||||||
</button>
|
</button>
|
||||||
<h3 class="formDialogHeaderTitle">
|
<h3 class="formDialogHeaderTitle">
|
||||||
${HeaderAccessSchedule}
|
${HeaderAccessSchedule}
|
||||||
|
|
|
@ -136,7 +136,7 @@ define(['dialogHelper', 'layoutManager', 'globalize', 'browser', 'dom', 'emby-bu
|
||||||
// Admittedly a hack but right now the scrollbar is being factored into the width which is causing truncation
|
// Admittedly a hack but right now the scrollbar is being factored into the width which is causing truncation
|
||||||
if (options.items.length > 20) {
|
if (options.items.length > 20) {
|
||||||
var minWidth = dom.getWindowSize().innerWidth >= 300 ? 240 : 200;
|
var minWidth = dom.getWindowSize().innerWidth >= 300 ? 240 : 200;
|
||||||
style += "min-width:" + minWidth + "px;";
|
style += 'min-width:' + minWidth + 'px;';
|
||||||
}
|
}
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
|
@ -158,7 +158,7 @@ define(['dialogHelper', 'layoutManager', 'globalize', 'browser', 'dom', 'emby-bu
|
||||||
}
|
}
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
html += '<button is="paper-icon-button-light" class="btnCloseActionSheet hide-mouse-idle-tv" tabindex="-1"><i class="material-icons arrow_back"></i></button>';
|
html += '<button is="paper-icon-button-light" class="btnCloseActionSheet hide-mouse-idle-tv" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
// If any items have an icon, give them all an icon just to make sure they're all lined up evenly
|
// If any items have an icon, give them all an icon just to make sure they're all lined up evenly
|
||||||
|
@ -226,9 +226,9 @@ define(['dialogHelper', 'layoutManager', 'globalize', 'browser', 'dom', 'emby-bu
|
||||||
|
|
||||||
if (itemIcon) {
|
if (itemIcon) {
|
||||||
|
|
||||||
html += '<i class="actionsheetMenuItemIcon listItemIcon listItemIcon-transparent material-icons">' + itemIcon + '</i>';
|
html += '<span class="actionsheetMenuItemIcon listItemIcon listItemIcon-transparent material-icons ' + itemIcon + '"></span>';
|
||||||
} else if (renderIcon && !center) {
|
} else if (renderIcon && !center) {
|
||||||
html += '<i class="actionsheetMenuItemIcon listItemIcon listItemIcon-transparent material-icons" style="visibility:hidden;">check</i>';
|
html += '<span class="actionsheetMenuItemIcon listItemIcon listItemIcon-transparent material-icons check" style="visibility:hidden;"></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<div class="listItemBody actionsheetListItemBody">';
|
html += '<div class="listItemBody actionsheetListItemBody">';
|
||||||
|
|
|
@ -1,60 +1,59 @@
|
||||||
define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotifications", "connectionManager", "emby-button", "listViewStyle"], function (events, globalize, dom, datetime, userSettings, serverNotifications, connectionManager) {
|
define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings', 'serverNotifications', 'connectionManager', 'emby-button', 'listViewStyle'], function (events, globalize, dom, datefns, dfnshelper, userSettings, serverNotifications, connectionManager) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
function getEntryHtml(entry, apiClient) {
|
function getEntryHtml(entry, apiClient) {
|
||||||
var html = "";
|
var html = '';
|
||||||
html += '<div class="listItem listItem-border">';
|
html += '<div class="listItem listItem-border">';
|
||||||
var color = "#00a4dc";
|
var color = '#00a4dc';
|
||||||
var icon = "notifications";
|
var icon = 'notifications';
|
||||||
|
|
||||||
if ("Error" == entry.Severity || "Fatal" == entry.Severity || "Warn" == entry.Severity) {
|
if ('Error' == entry.Severity || 'Fatal' == entry.Severity || 'Warn' == entry.Severity) {
|
||||||
color = "#cc0000";
|
color = '#cc0000';
|
||||||
icon = "notification_important";
|
icon = 'notification_important';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (entry.UserId && entry.UserPrimaryImageTag) {
|
if (entry.UserId && entry.UserPrimaryImageTag) {
|
||||||
html += '<i class="listItemIcon material-icons" style="width:2em!important;height:2em!important;padding:0;color:transparent;background-color:' + color + ";background-image:url('" + apiClient.getUserImageUrl(entry.UserId, {
|
html += '<span class="listItemIcon material-icons dvr" style="width:2em!important;height:2em!important;padding:0;color:transparent;background-color:' + color + ";background-image:url('" + apiClient.getUserImageUrl(entry.UserId, {
|
||||||
type: "Primary",
|
type: 'Primary',
|
||||||
tag: entry.UserPrimaryImageTag
|
tag: entry.UserPrimaryImageTag
|
||||||
}) + "');background-repeat:no-repeat;background-position:center center;background-size: cover;\">dvr</i>"
|
}) + "');background-repeat:no-repeat;background-position:center center;background-size: cover;\"></span>";
|
||||||
} else {
|
} else {
|
||||||
html += '<i class="listItemIcon material-icons" style="background-color:' + color + '">' + icon + '</i>';
|
html += '<span class="listItemIcon material-icons ' + icon + '" style="background-color:' + color + '"></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<div class="listItemBody three-line">';
|
html += '<div class="listItemBody three-line">';
|
||||||
html += '<div class="listItemBodyText">';
|
html += '<div class="listItemBodyText">';
|
||||||
html += entry.Name;
|
html += entry.Name;
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
html += '<div class="listItemBodyText secondary">';
|
html += '<div class="listItemBodyText secondary">';
|
||||||
var date = datetime.parseISO8601Date(entry.Date, true);
|
html += datefns.formatRelative(Date.parse(entry.Date), Date.parse(new Date()), { locale: dfnshelper.getLocale() });
|
||||||
html += datetime.toLocaleString(date).toLowerCase();
|
html += '</div>';
|
||||||
html += "</div>";
|
|
||||||
html += '<div class="listItemBodyText secondary listItemBodyText-nowrap">';
|
html += '<div class="listItemBodyText secondary listItemBodyText-nowrap">';
|
||||||
html += entry.ShortOverview || "";
|
html += entry.ShortOverview || '';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
|
|
||||||
if (entry.Overview) {
|
if (entry.Overview) {
|
||||||
html += '<button type="button" is="paper-icon-button-light" class="btnEntryInfo" data-id="' + entry.Id + '" title="' + globalize.translate("Info") + '"><i class="material-icons">info</i></button>';
|
html += '<button type="button" is="paper-icon-button-light" class="btnEntryInfo" data-id="' + entry.Id + '" title="' + globalize.translate('Info') + '"><span class="material-icons info"></span></button>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return html += "</div>";
|
return html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderList(elem, apiClient, result, startIndex, limit) {
|
function renderList(elem, apiClient, result, startIndex, limit) {
|
||||||
elem.innerHTML = result.Items.map(function (i) {
|
elem.innerHTML = result.Items.map(function (i) {
|
||||||
return getEntryHtml(i, apiClient);
|
return getEntryHtml(i, apiClient);
|
||||||
}).join("");
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadData(instance, elem, apiClient, startIndex, limit) {
|
function reloadData(instance, elem, apiClient, startIndex, limit) {
|
||||||
if (null == startIndex) {
|
if (null == startIndex) {
|
||||||
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();
|
var minDate = new Date();
|
||||||
var hasUserId = "false" !== elem.getAttribute("data-useractivity");
|
var hasUserId = 'false' !== elem.getAttribute('data-useractivity');
|
||||||
|
|
||||||
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
|
||||||
|
@ -62,22 +61,22 @@ define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotific
|
||||||
minDate.setTime(minDate.getTime() - 7 * 24 * 60 * 60 * 1000); // one week back
|
minDate.setTime(minDate.getTime() - 7 * 24 * 60 * 60 * 1000); // one week back
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.getJSON(ApiClient.getUrl("System/ActivityLog/Entries", {
|
ApiClient.getJSON(ApiClient.getUrl('System/ActivityLog/Entries', {
|
||||||
startIndex: startIndex,
|
startIndex: startIndex,
|
||||||
limit: limit,
|
limit: limit,
|
||||||
minDate: minDate.toISOString(),
|
minDate: minDate.toISOString(),
|
||||||
hasUserId: hasUserId
|
hasUserId: hasUserId
|
||||||
})).then(function (result) {
|
})).then(function (result) {
|
||||||
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");
|
var activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
||||||
|
|
||||||
if (activityContainer) {
|
if (activityContainer) {
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
activityContainer.classList.remove("hide");
|
activityContainer.classList.remove('hide');
|
||||||
} else {
|
} else {
|
||||||
activityContainer.classList.add("hide");
|
activityContainer.classList.add('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,10 +95,10 @@ define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotific
|
||||||
}
|
}
|
||||||
|
|
||||||
function onListClick(e) {
|
function onListClick(e) {
|
||||||
var btnEntryInfo = dom.parentWithClass(e.target, "btnEntryInfo");
|
var btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
||||||
|
|
||||||
if (btnEntryInfo) {
|
if (btnEntryInfo) {
|
||||||
var id = btnEntryInfo.getAttribute("data-id");
|
var id = btnEntryInfo.getAttribute('data-id');
|
||||||
var items = this.items;
|
var items = this.items;
|
||||||
|
|
||||||
if (items) {
|
if (items) {
|
||||||
|
@ -115,7 +114,7 @@ define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotific
|
||||||
}
|
}
|
||||||
|
|
||||||
function showItemOverview(item) {
|
function showItemOverview(item) {
|
||||||
require(["alert"], function (alert) {
|
require(['alert'], function (alert) {
|
||||||
alert({
|
alert({
|
||||||
text: item.Overview
|
text: item.Overview
|
||||||
});
|
});
|
||||||
|
@ -125,28 +124,28 @@ define(["events", "globalize", "dom", "datetime", "userSettings", "serverNotific
|
||||||
function ActivityLog(options) {
|
function ActivityLog(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
var element = options.element;
|
var 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);
|
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||||
reloadData(this, element, apiClient);
|
reloadData(this, element, apiClient);
|
||||||
var onUpdate = onActivityLogUpdate.bind(this);
|
var 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');
|
||||||
}
|
}
|
||||||
|
|
||||||
ActivityLog.prototype.destroy = function () {
|
ActivityLog.prototype.destroy = function () {
|
||||||
var 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");
|
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
||||||
}
|
}
|
||||||
|
|
||||||
var onUpdate = this.updateFn;
|
var onUpdate = this.updateFn;
|
||||||
|
|
||||||
if (onUpdate) {
|
if (onUpdate) {
|
||||||
events.off(serverNotifications, "ActivityLogEntry", onUpdate);
|
events.off(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
this.items = null;
|
this.items = null;
|
||||||
|
|
|
@ -42,4 +42,4 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -67,7 +67,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
|
|
||||||
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 + '"><i class="material-icons alphaPickerButtonIcon space_bar"></i></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,7 +77,7 @@ 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 + '"><i class="material-icons alphaPickerButtonIcon">backspace</i></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'];
|
||||||
|
@ -132,7 +132,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
if (alphaPickerButton) {
|
if (alphaPickerButton) {
|
||||||
var value = alphaPickerButton.getAttribute('data-value');
|
var value = alphaPickerButton.getAttribute('data-value');
|
||||||
|
|
||||||
element.dispatchEvent(new CustomEvent("alphavalueclicked", {
|
element.dispatchEvent(new CustomEvent('alphavalueclicked', {
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
detail: {
|
detail: {
|
||||||
value: value
|
value: value
|
||||||
|
@ -241,7 +241,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
try {
|
try {
|
||||||
btn = element.querySelector('.alphaPickerButton[data-value=\'' + value + '\']');
|
btn = element.querySelector('.alphaPickerButton[data-value=\'' + value + '\']');
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error in querySelector: ' + err);
|
console.error('error in querySelector: ' + err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (btn && btn !== selected) {
|
if (btn && btn !== selected) {
|
||||||
|
@ -262,7 +262,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||||
}
|
}
|
||||||
|
|
||||||
if (applyValue) {
|
if (applyValue) {
|
||||||
element.dispatchEvent(new CustomEvent("alphavaluechanged", {
|
element.dispatchEvent(new CustomEvent('alphavaluechanged', {
|
||||||
cancelable: false,
|
cancelable: false,
|
||||||
detail: {
|
detail: {
|
||||||
value: value
|
value: value
|
||||||
|
|
|
@ -14,6 +14,9 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
},
|
},
|
||||||
showSettings: function () {
|
showSettings: function () {
|
||||||
show('/settings/settings.html');
|
show('/settings/settings.html');
|
||||||
|
},
|
||||||
|
showNowPlaying: function () {
|
||||||
|
show('/nowplaying.html');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -197,8 +200,8 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
|
|
||||||
var apiClient = this;
|
var apiClient = this;
|
||||||
|
|
||||||
if (data.status === 401) {
|
if (data.status === 403) {
|
||||||
if (data.errorCode === "ParentalControl") {
|
if (data.errorCode === 'ParentalControl') {
|
||||||
|
|
||||||
var isCurrentAllowed = currentRouteInfo ? (currentRouteInfo.route.anonymous || currentRouteInfo.route.startup) : true;
|
var isCurrentAllowed = currentRouteInfo ? (currentRouteInfo.route.anonymous || currentRouteInfo.route.startup) : true;
|
||||||
|
|
||||||
|
@ -265,6 +268,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMaxBandwidth() {
|
function getMaxBandwidth() {
|
||||||
|
/* eslint-disable compat/compat */
|
||||||
if (navigator.connection) {
|
if (navigator.connection) {
|
||||||
var max = navigator.connection.downlinkMax;
|
var max = navigator.connection.downlinkMax;
|
||||||
if (max && max > 0 && max < Number.POSITIVE_INFINITY) {
|
if (max && max > 0 && max < Number.POSITIVE_INFINITY) {
|
||||||
|
@ -276,6 +280,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
return max;
|
return max;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
/* eslint-enable compat/compat */
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -367,7 +372,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableNativeHistory() {
|
function enableNativeHistory() {
|
||||||
return page.enableNativeHistory();
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function authenticate(ctx, route, callback) {
|
function authenticate(ctx, route, callback) {
|
||||||
|
@ -387,13 +392,13 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
var apiClient = connectionManager.currentApiClient();
|
var apiClient = connectionManager.currentApiClient();
|
||||||
var pathname = ctx.pathname.toLowerCase();
|
var pathname = ctx.pathname.toLowerCase();
|
||||||
|
|
||||||
console.log('appRouter - processing path request ' + pathname);
|
console.debug('appRouter - processing path request ' + pathname);
|
||||||
|
|
||||||
var isCurrentRouteStartup = currentRouteInfo ? currentRouteInfo.route.startup : true;
|
var isCurrentRouteStartup = currentRouteInfo ? currentRouteInfo.route.startup : true;
|
||||||
var shouldExitApp = ctx.isBack && route.isDefaultRoute && isCurrentRouteStartup;
|
var shouldExitApp = ctx.isBack && route.isDefaultRoute && isCurrentRouteStartup;
|
||||||
|
|
||||||
if (!shouldExitApp && (!apiClient || !apiClient.isLoggedIn()) && !route.anonymous) {
|
if (!shouldExitApp && (!apiClient || !apiClient.isLoggedIn()) && !route.anonymous) {
|
||||||
console.log('appRouter - route does not allow anonymous access, redirecting to login');
|
console.debug('appRouter - route does not allow anonymous access, redirecting to login');
|
||||||
beginConnectionWizard();
|
beginConnectionWizard();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -408,10 +413,10 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
|
|
||||||
if (apiClient && apiClient.isLoggedIn()) {
|
if (apiClient && apiClient.isLoggedIn()) {
|
||||||
|
|
||||||
console.log('appRouter - user is authenticated');
|
console.debug('appRouter - user is authenticated');
|
||||||
|
|
||||||
if (route.isDefaultRoute) {
|
if (route.isDefaultRoute) {
|
||||||
console.log('appRouter - loading skin home page');
|
console.debug('appRouter - loading skin home page');
|
||||||
loadUserSkinWithOptions(ctx);
|
loadUserSkinWithOptions(ctx);
|
||||||
return;
|
return;
|
||||||
} else if (route.roles) {
|
} else if (route.roles) {
|
||||||
|
@ -425,7 +430,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('appRouter - proceeding to ' + pathname);
|
console.debug('appRouter - proceeding to ' + pathname);
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,9 +513,16 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
return baseRoute;
|
return baseRoute;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var popstateOccurred = false;
|
||||||
|
window.addEventListener('popstate', function () {
|
||||||
|
popstateOccurred = true;
|
||||||
|
});
|
||||||
|
|
||||||
function getHandler(route) {
|
function getHandler(route) {
|
||||||
return function (ctx, next) {
|
return function (ctx, next) {
|
||||||
|
ctx.isBack = popstateOccurred;
|
||||||
handleRoute(ctx, next, route);
|
handleRoute(ctx, next, route);
|
||||||
|
popstateOccurred = false;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -529,15 +541,15 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
}
|
}
|
||||||
|
|
||||||
function param(name, url) {
|
function param(name, url) {
|
||||||
name = name.replace(/[\[]/, "\\\[").replace(/[\]]/, "\\\]");
|
name = name.replace(/[\[]/, '\\\[').replace(/[\]]/, '\\\]');
|
||||||
var regexS = "[\\?&]" + name + "=([^&#]*)";
|
var regexS = '[\\?&]' + name + '=([^&#]*)';
|
||||||
var regex = new RegExp(regexS, "i");
|
var regex = new RegExp(regexS, 'i');
|
||||||
|
|
||||||
var results = regex.exec(url || getWindowLocationSearch());
|
var results = regex.exec(url || getWindowLocationSearch());
|
||||||
if (results == null) {
|
if (results == null) {
|
||||||
return "";
|
return '';
|
||||||
} else {
|
} else {
|
||||||
return decodeURIComponent(results[1].replace(/\+/g, " "));
|
return decodeURIComponent(results[1].replace(/\+/g, ' '));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -559,13 +571,17 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
if (!document.querySelector('.dialogContainer') && startPages.indexOf(curr.type) !== -1) {
|
if (!document.querySelector('.dialogContainer') && startPages.indexOf(curr.type) !== -1) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return page.canGoBack();
|
if (enableHistory()) {
|
||||||
|
return history.length > 1;
|
||||||
|
}
|
||||||
|
return (page.len || 0) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDirect(path) {
|
function showDirect(path) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise(function(resolve, reject) {
|
||||||
resolveOnNextShow = resolve, page.show(baseUrl()+path)
|
resolveOnNextShow = resolve;
|
||||||
})
|
page.show(baseUrl() + path);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function show(path, options) {
|
function show(path, options) {
|
||||||
|
@ -663,7 +679,8 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
|
|
||||||
function pushState(state, title, url) {
|
function pushState(state, title, url) {
|
||||||
state.navigate = false;
|
state.navigate = false;
|
||||||
page.pushState(state, title, url);
|
history.pushState(state, title, url);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setBaseRoute() {
|
function setBaseRoute() {
|
||||||
|
@ -672,7 +689,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
baseRoute = baseRoute.substring(0, baseRoute.length - 1);
|
baseRoute = baseRoute.substring(0, baseRoute.length - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('Setting page base to ' + baseRoute);
|
console.debug('setting page base to ' + baseRoute);
|
||||||
page.base(baseRoute);
|
page.base(baseRoute);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -713,7 +730,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'layoutManager', 'skinM
|
||||||
appRouter.getRoutes = getRoutes;
|
appRouter.getRoutes = getRoutes;
|
||||||
appRouter.pushState = pushState;
|
appRouter.pushState = pushState;
|
||||||
appRouter.enableNativeHistory = enableNativeHistory;
|
appRouter.enableNativeHistory = enableNativeHistory;
|
||||||
appRouter.handleAnchorClick = page.handleAnchorClick;
|
appRouter.handleAnchorClick = page.clickHandler;
|
||||||
appRouter.TransparencyLevel = {
|
appRouter.TransparencyLevel = {
|
||||||
None: 0,
|
None: 0,
|
||||||
Backdrop: 1,
|
Backdrop: 1,
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
position: fixed;
|
position: fixed;
|
||||||
left: 0;
|
left: 0;
|
||||||
right: 0;
|
right: 0;
|
||||||
z-index: 1;
|
z-index: 10;
|
||||||
bottom: 0;
|
bottom: 0;
|
||||||
transition: transform 180ms linear;
|
transition: transform 180ms linear;
|
||||||
contain: layout style;
|
contain: layout style;
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSettings, browser, events, htmlMediaHelper) {
|
define(['appSettings', 'browser', 'events', 'htmlMediaHelper', 'webSettings', 'globalize'], function (appSettings, browser, events, htmlMediaHelper, webSettings, globalize) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
function getBaseProfileOptions(item) {
|
function getBaseProfileOptions(item) {
|
||||||
var disableHlsVideoAudioCodecs = [];
|
var disableHlsVideoAudioCodecs = [];
|
||||||
|
|
||||||
if (item && htmlMediaHelper.enableHlsJsPlayer(item.RunTimeTicks, item.MediaType)) {
|
if (item && htmlMediaHelper.enableHlsJsPlayer(item.RunTimeTicks, item.MediaType)) {
|
||||||
if (browser.edge || browser.msie) {
|
if (browser.edge || browser.msie) {
|
||||||
disableHlsVideoAudioCodecs.push("mp3");
|
disableHlsVideoAudioCodecs.push('mp3');
|
||||||
}
|
}
|
||||||
|
|
||||||
disableHlsVideoAudioCodecs.push("ac3");
|
disableHlsVideoAudioCodecs.push('ac3');
|
||||||
disableHlsVideoAudioCodecs.push("eac3");
|
disableHlsVideoAudioCodecs.push('eac3');
|
||||||
disableHlsVideoAudioCodecs.push("opus");
|
disableHlsVideoAudioCodecs.push('opus');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
@ -22,7 +22,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
|
|
||||||
function getDeviceProfileForWindowsUwp(item) {
|
function getDeviceProfileForWindowsUwp(item) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
require(["browserdeviceprofile", "environments/windows-uwp/mediacaps"], function (profileBuilder, uwpMediaCaps) {
|
require(['browserdeviceprofile', 'environments/windows-uwp/mediacaps'], function (profileBuilder, uwpMediaCaps) {
|
||||||
var profileOptions = getBaseProfileOptions(item);
|
var profileOptions = getBaseProfileOptions(item);
|
||||||
profileOptions.supportsDts = uwpMediaCaps.supportsDTS();
|
profileOptions.supportsDts = uwpMediaCaps.supportsDTS();
|
||||||
profileOptions.supportsTrueHd = uwpMediaCaps.supportsDolby();
|
profileOptions.supportsTrueHd = uwpMediaCaps.supportsDolby();
|
||||||
|
@ -40,26 +40,15 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
require(["browserdeviceprofile"], function (profileBuilder) {
|
require(['browserdeviceprofile'], function (profileBuilder) {
|
||||||
var profile;
|
var profile;
|
||||||
|
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell) {
|
||||||
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
|
profile = window.NativeShell.AppHost.getDeviceProfile(profileBuilder);
|
||||||
} else {
|
} else {
|
||||||
profile = profileBuilder(getBaseProfileOptions(item));
|
var builderOpts = getBaseProfileOptions(item);
|
||||||
|
builderOpts.enableSsaRender = (item && !options.isRetry && 'allcomplexformats' !== appSettings.get('subtitleburnin'));
|
||||||
if (item && !options.isRetry && "allcomplexformats" !== appSettings.get("subtitleburnin")) {
|
profile = profileBuilder(builderOpts);
|
||||||
if (!browser.orsay && !browser.tizen) {
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: "ass",
|
|
||||||
Method: "External"
|
|
||||||
});
|
|
||||||
profile.SubtitleProfiles.push({
|
|
||||||
Format: "ssa",
|
|
||||||
Method: "External"
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
resolve(profile);
|
resolve(profile);
|
||||||
|
@ -68,12 +57,12 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
}
|
}
|
||||||
|
|
||||||
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);
|
var strReplace2 = escapeRegExp(strReplace);
|
||||||
var reg = new RegExp(strReplace2, "ig");
|
var reg = new RegExp(strReplace2, 'ig');
|
||||||
return originalString.replace(reg, strWith);
|
return originalString.replace(reg, strWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -81,7 +70,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
var keys = [];
|
var keys = [];
|
||||||
|
|
||||||
if (keys.push(navigator.userAgent), keys.push(new Date().getTime()), self.btoa) {
|
if (keys.push(navigator.userAgent), keys.push(new Date().getTime()), self.btoa) {
|
||||||
var result = replaceAll(btoa(keys.join("|")), "=", "1");
|
var result = replaceAll(btoa(keys.join('|')), '=', '1');
|
||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -89,7 +78,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDeviceId() {
|
function getDeviceId() {
|
||||||
var key = "_deviceId2";
|
var key = '_deviceId2';
|
||||||
var deviceId = appSettings.get(key);
|
var deviceId = appSettings.get(key);
|
||||||
|
|
||||||
if (deviceId) {
|
if (deviceId) {
|
||||||
|
@ -104,16 +93,16 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
|
|
||||||
function getDeviceName() {
|
function getDeviceName() {
|
||||||
var deviceName;
|
var deviceName;
|
||||||
deviceName = browser.tizen ? "Samsung Smart TV" : browser.web0s ? "LG Smart TV" : browser.operaTv ? "Opera TV" : browser.xboxOne ? "Xbox One" : browser.ps4 ? "Sony PS4" : browser.chrome ? "Chrome" : browser.edge ? "Edge" : browser.firefox ? "Firefox" : browser.msie ? "Internet Explorer" : browser.opera ? "Opera" : browser.safari ? "Safari" : "Web Browser";
|
deviceName = browser.tizen ? 'Samsung Smart TV' : browser.web0s ? 'LG Smart TV' : browser.operaTv ? 'Opera TV' : browser.xboxOne ? 'Xbox One' : browser.ps4 ? 'Sony PS4' : browser.chrome ? 'Chrome' : browser.edge ? 'Edge' : browser.firefox ? 'Firefox' : browser.msie ? 'Internet Explorer' : browser.opera ? 'Opera' : browser.safari ? 'Safari' : 'Web Browser';
|
||||||
|
|
||||||
if (browser.ipad) {
|
if (browser.ipad) {
|
||||||
deviceName += " iPad";
|
deviceName += ' iPad';
|
||||||
} else {
|
} else {
|
||||||
if (browser.iphone) {
|
if (browser.iphone) {
|
||||||
deviceName += " iPhone";
|
deviceName += ' iPhone';
|
||||||
} else {
|
} else {
|
||||||
if (browser.android) {
|
if (browser.android) {
|
||||||
deviceName += " Android";
|
deviceName += ' Android';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -135,12 +124,12 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
}
|
}
|
||||||
|
|
||||||
var element = document.documentElement;
|
var 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() {
|
function getSyncProfile() {
|
||||||
return new Promise(function (resolve) {
|
return new Promise(function (resolve) {
|
||||||
require(["browserdeviceprofile", "appSettings"], function (profileBuilder, appSettings) {
|
require(['browserdeviceprofile', 'appSettings'], function (profileBuilder, appSettings) {
|
||||||
var profile;
|
var profile;
|
||||||
|
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell) {
|
||||||
|
@ -156,7 +145,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDefaultLayout() {
|
function getDefaultLayout() {
|
||||||
return "desktop";
|
return 'desktop';
|
||||||
}
|
}
|
||||||
|
|
||||||
function supportsHtmlMediaAutoplay() {
|
function supportsHtmlMediaAutoplay() {
|
||||||
|
@ -173,20 +162,20 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
|
|
||||||
function supportsCue() {
|
function supportsCue() {
|
||||||
try {
|
try {
|
||||||
var video = document.createElement("video");
|
var video = document.createElement('video');
|
||||||
var style = document.createElement("style");
|
var 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;
|
var cue = window.getComputedStyle(video, '::cue').background;
|
||||||
document.body.removeChild(style);
|
document.body.removeChild(style);
|
||||||
document.body.removeChild(video);
|
document.body.removeChild(video);
|
||||||
|
|
||||||
return !!cue.length;
|
return !!cue.length;
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("error detecting cue support: " + err);
|
console.error('error detecting cue support: ' + err);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -194,15 +183,15 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
function onAppVisible() {
|
function onAppVisible() {
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
isHidden = false;
|
isHidden = false;
|
||||||
console.log("triggering app resume event");
|
console.debug('triggering app resume event');
|
||||||
events.trigger(appHost, "resume");
|
events.trigger(appHost, 'resume');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onAppHidden() {
|
function onAppHidden() {
|
||||||
if (!isHidden) {
|
if (!isHidden) {
|
||||||
isHidden = true;
|
isHidden = true;
|
||||||
console.log("app is hidden");
|
console.debug('app is hidden');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,90 +199,88 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
var features = [];
|
var features = [];
|
||||||
|
|
||||||
if (navigator.share) {
|
if (navigator.share) {
|
||||||
features.push("sharing");
|
features.push('sharing');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser.edgeUwp && !browser.tv && !browser.xboxOne && !browser.ps4) {
|
if (!browser.edgeUwp && !browser.tv && !browser.xboxOne && !browser.ps4) {
|
||||||
features.push("filedownload");
|
features.push('filedownload');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.operaTv || browser.tizen || browser.orsay || browser.web0s) {
|
if (browser.operaTv || browser.tizen || browser.orsay || browser.web0s) {
|
||||||
features.push("exit");
|
features.push('exit');
|
||||||
} else {
|
} else {
|
||||||
features.push("exitmenu");
|
features.push('exitmenu');
|
||||||
features.push("plugins");
|
features.push('plugins');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.ps4) {
|
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.ps4) {
|
||||||
features.push("externallinks");
|
features.push('externallinks');
|
||||||
features.push("externalpremium");
|
features.push('externalpremium');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser.operaTv) {
|
if (!browser.operaTv) {
|
||||||
features.push("externallinkdisplay");
|
features.push('externallinkdisplay');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportsVoiceInput()) {
|
if (supportsVoiceInput()) {
|
||||||
features.push("voiceinput");
|
features.push('voiceinput');
|
||||||
}
|
|
||||||
|
|
||||||
if (!browser.tv && !browser.xboxOne) {
|
|
||||||
browser.ps4;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportsHtmlMediaAutoplay()) {
|
if (supportsHtmlMediaAutoplay()) {
|
||||||
features.push("htmlaudioautoplay");
|
features.push('htmlaudioautoplay');
|
||||||
features.push("htmlvideoautoplay");
|
features.push('htmlvideoautoplay');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.edgeUwp) {
|
if (browser.edgeUwp) {
|
||||||
features.push("sync");
|
features.push('sync');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportsFullscreen()) {
|
if (supportsFullscreen()) {
|
||||||
features.push("fullscreenchange");
|
features.push('fullscreenchange');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.chrome || browser.edge && !browser.slow) {
|
if (browser.chrome || browser.edge && !browser.slow) {
|
||||||
if (!browser.noAnimation && !browser.edgeUwp && !browser.xboxOne) {
|
if (!browser.noAnimation && !browser.edgeUwp && !browser.xboxOne) {
|
||||||
features.push("imageanalysis");
|
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');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
|
if (!browser.tv && !browser.xboxOne && !browser.ps4) {
|
||||||
features.push("remotecontrol");
|
features.push('remotecontrol');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.edgeUwp) {
|
if (!browser.operaTv && !browser.tizen && !browser.orsay && !browser.web0s && !browser.edgeUwp) {
|
||||||
features.push("remotevideo");
|
features.push('remotevideo');
|
||||||
}
|
}
|
||||||
|
|
||||||
features.push("displaylanguage");
|
features.push('displaylanguage');
|
||||||
features.push("otherapppromotions");
|
features.push('otherapppromotions');
|
||||||
features.push("displaymode");
|
features.push('displaymode');
|
||||||
features.push("targetblank");
|
features.push('targetblank');
|
||||||
// allows users to connect to more than one server
|
features.push('screensaver');
|
||||||
//features.push("multiserver");
|
|
||||||
features.push("screensaver");
|
|
||||||
|
|
||||||
if (!browser.orsay && !browser.tizen && !browser.msie && (browser.firefox || browser.ps4 || browser.edge || supportsCue())) {
|
webSettings.enableMultiServer().then(enabled => {
|
||||||
features.push("subtitleappearancesettings");
|
if (enabled) features.push('multiserver');
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!browser.orsay && !browser.msie && (browser.firefox || browser.ps4 || browser.edge || supportsCue())) {
|
||||||
|
features.push('subtitleappearancesettings');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser.orsay && !browser.tizen) {
|
if (!browser.orsay) {
|
||||||
features.push("subtitleburnsettings");
|
features.push('subtitleburnsettings');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!browser.tv && !browser.ps4 && !browser.xboxOne) {
|
if (!browser.tv && !browser.ps4 && !browser.xboxOne) {
|
||||||
features.push("fileinput");
|
features.push('fileinput');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.chrome) {
|
if (browser.chrome) {
|
||||||
features.push("chromecast");
|
features.push('chromecast');
|
||||||
}
|
}
|
||||||
|
|
||||||
return features;
|
return features;
|
||||||
|
@ -314,7 +301,7 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
window.close();
|
window.close();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log("error closing application: " + err);
|
console.error('error closing application: ' + err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,19 +311,19 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
* Ask user for exit
|
* Ask user for exit
|
||||||
*/
|
*/
|
||||||
function askForExit() {
|
function askForExit() {
|
||||||
if (!!exitPromise) {
|
if (exitPromise) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require(["actionsheet"], function (actionsheet) {
|
require(['actionsheet'], function (actionsheet) {
|
||||||
exitPromise = actionsheet.show({
|
exitPromise = actionsheet.show({
|
||||||
title: Globalize.translate("MessageConfirmAppExit"),
|
title: globalize.translate('MessageConfirmAppExit'),
|
||||||
items: [
|
items: [
|
||||||
{id: "yes", name: Globalize.translate("Yes")},
|
{id: 'yes', name: globalize.translate('Yes')},
|
||||||
{id: "no", name: Globalize.translate("No")}
|
{id: 'no', name: globalize.translate('No')}
|
||||||
]
|
]
|
||||||
}).then(function (value) {
|
}).then(function (value) {
|
||||||
if (value === "yes") {
|
if (value === 'yes') {
|
||||||
doExit();
|
doExit();
|
||||||
}
|
}
|
||||||
}).finally(function () {
|
}).finally(function () {
|
||||||
|
@ -347,17 +334,15 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
|
|
||||||
var deviceId;
|
var deviceId;
|
||||||
var deviceName;
|
var deviceName;
|
||||||
var appName = "Jellyfin Web";
|
var appName = 'Jellyfin Web';
|
||||||
var appVersion = "10.5.0";
|
var appVersion = '10.6.0';
|
||||||
var visibilityChange;
|
|
||||||
var visibilityState;
|
|
||||||
|
|
||||||
var appHost = {
|
var appHost = {
|
||||||
getWindowState: function () {
|
getWindowState: function () {
|
||||||
return document.windowState || "Normal";
|
return document.windowState || 'Normal';
|
||||||
},
|
},
|
||||||
setWindowState: function (state) {
|
setWindowState: function (state) {
|
||||||
alert("setWindowState is not supported and should not be called");
|
alert('setWindowState is not supported and should not be called');
|
||||||
},
|
},
|
||||||
exit: function () {
|
exit: function () {
|
||||||
if (!!window.appMode && browser.tizen) {
|
if (!!window.appMode && browser.tizen) {
|
||||||
|
@ -374,14 +359,14 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
return -1 !== supportedFeatures.indexOf(command.toLowerCase());
|
return -1 !== supportedFeatures.indexOf(command.toLowerCase());
|
||||||
},
|
},
|
||||||
preferVisualCards: browser.android || browser.chrome,
|
preferVisualCards: browser.android || browser.chrome,
|
||||||
moreIcon: browser.android ? "dots-vert" : "dots-horiz",
|
moreIcon: browser.android ? 'more_vert' : 'more_horiz',
|
||||||
getSyncProfile: getSyncProfile,
|
getSyncProfile: getSyncProfile,
|
||||||
getDefaultLayout: function () {
|
getDefaultLayout: function () {
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell) {
|
||||||
return window.NativeShell.AppHost.getDefaultLayout();
|
return window.NativeShell.AppHost.getDefaultLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
return getDefaultLayout()
|
return getDefaultLayout();
|
||||||
},
|
},
|
||||||
getDeviceProfile: getDeviceProfile,
|
getDeviceProfile: getDeviceProfile,
|
||||||
init: function () {
|
init: function () {
|
||||||
|
@ -410,58 +395,44 @@ define(["appSettings", "browser", "events", "htmlMediaHelper"], function (appSet
|
||||||
return {};
|
return {};
|
||||||
},
|
},
|
||||||
setThemeColor: function (color) {
|
setThemeColor: function (color) {
|
||||||
var metaThemeColor = document.querySelector("meta[name=theme-color]");
|
var metaThemeColor = document.querySelector('meta[name=theme-color]');
|
||||||
|
|
||||||
if (metaThemeColor) {
|
if (metaThemeColor) {
|
||||||
metaThemeColor.setAttribute("content", color);
|
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";
|
var att = scalable ? 'width=device-width, initial-scale=1, minimum-scale=1, user-scalable=yes' : 'width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1, user-scalable=no';
|
||||||
document.querySelector("meta[name=viewport]").setAttribute("content", att);
|
document.querySelector('meta[name=viewport]').setAttribute('content', att);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var doc = self.document;
|
|
||||||
var isHidden = false;
|
var isHidden = false;
|
||||||
|
var hidden;
|
||||||
|
var visibilityChange;
|
||||||
|
|
||||||
if (doc) {
|
if (typeof document.hidden !== 'undefined') { /* eslint-disable-line compat/compat */
|
||||||
if (void 0 !== doc.visibilityState) {
|
hidden = 'hidden';
|
||||||
visibilityChange = "visibilitychange";
|
visibilityChange = 'visibilitychange';
|
||||||
visibilityState = "hidden";
|
} else if (typeof document.webkitHidden !== 'undefined') {
|
||||||
|
hidden = 'webkitHidden';
|
||||||
|
visibilityChange = 'webkitvisibilitychange';
|
||||||
|
}
|
||||||
|
|
||||||
|
document.addEventListener(visibilityChange, function () {
|
||||||
|
/* eslint-disable-next-line compat/compat */
|
||||||
|
if (document[hidden]) {
|
||||||
|
onAppHidden();
|
||||||
} else {
|
} else {
|
||||||
if (void 0 !== doc.mozHidden) {
|
onAppVisible();
|
||||||
visibilityChange = "mozvisibilitychange";
|
|
||||||
visibilityState = "mozVisibilityState";
|
|
||||||
} else {
|
|
||||||
if (void 0 !== doc.msHidden) {
|
|
||||||
visibilityChange = "msvisibilitychange";
|
|
||||||
visibilityState = "msVisibilityState";
|
|
||||||
} else {
|
|
||||||
if (void 0 !== doc.webkitHidden) {
|
|
||||||
visibilityChange = "webkitvisibilitychange";
|
|
||||||
visibilityState = "webkitVisibilityState";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}, false);
|
||||||
|
|
||||||
if (doc) {
|
|
||||||
doc.addEventListener(visibilityChange, function () {
|
|
||||||
if (document[visibilityState]) {
|
|
||||||
onAppHidden();
|
|
||||||
} else {
|
|
||||||
onAppVisible();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.addEventListener) {
|
if (self.addEventListener) {
|
||||||
self.addEventListener("focus", onAppVisible);
|
self.addEventListener('focus', onAppVisible);
|
||||||
self.addEventListener("blur", onAppHidden);
|
self.addEventListener('blur', onAppHidden);
|
||||||
}
|
}
|
||||||
|
|
||||||
return appHost;
|
return appHost;
|
||||||
|
|
|
@ -1,71 +1,73 @@
|
||||||
define(["focusManager", "layoutManager"], function (focusManager, layoutManager) {
|
/* eslint-disable indent */
|
||||||
"use strict";
|
|
||||||
|
/**
|
||||||
|
* Module for performing auto-focus.
|
||||||
|
* @module components/autoFocuser
|
||||||
|
*/
|
||||||
|
|
||||||
|
import focusManager from 'focusManager';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Previously selected element.
|
* Previously selected element.
|
||||||
*/
|
*/
|
||||||
var activeElement;
|
let activeElement;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns true if AutoFocuser is enabled.
|
* Returns _true_ if AutoFocuser is enabled.
|
||||||
*/
|
*/
|
||||||
function isEnabled() {
|
export function isEnabled() {
|
||||||
return layoutManager.tv;
|
return layoutManager.tv;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start AutoFocuser
|
* Start AutoFocuser.
|
||||||
*/
|
*/
|
||||||
function enable() {
|
export function enable() {
|
||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
window.addEventListener("focusin", function (e) {
|
window.addEventListener('focusin', function (e) {
|
||||||
activeElement = e.target;
|
activeElement = e.target;
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log("AutoFocuser enabled");
|
console.debug('AutoFocuser enabled');
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create an array from some source.
|
|
||||||
*/
|
|
||||||
var arrayFrom = Array.prototype.from || function (src) {
|
|
||||||
return Array.prototype.slice.call(src);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set focus on a suitable element, taking into account the previously selected.
|
* Set focus on a suitable element, taking into account the previously selected.
|
||||||
|
* @param {HTMLElement} [container] - Element to limit scope.
|
||||||
|
* @returns {HTMLElement} Focused element.
|
||||||
*/
|
*/
|
||||||
function autoFocus(container) {
|
export function autoFocus(container) {
|
||||||
if (!isEnabled()) {
|
if (!isEnabled()) {
|
||||||
return;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
container = container || document.body;
|
container = container || document.body;
|
||||||
|
|
||||||
var candidates = [];
|
let candidates = [];
|
||||||
|
|
||||||
if (activeElement) {
|
if (activeElement) {
|
||||||
// These elements are recreated
|
// These elements are recreated
|
||||||
if (activeElement.classList.contains("btnPreviousPage")) {
|
if (activeElement.classList.contains('btnPreviousPage')) {
|
||||||
candidates.push(container.querySelector(".btnPreviousPage"));
|
candidates.push(container.querySelector('.btnPreviousPage'));
|
||||||
candidates.push(container.querySelector(".btnNextPage"));
|
candidates.push(container.querySelector('.btnNextPage'));
|
||||||
} else if (activeElement.classList.contains("btnNextPage")) {
|
} else if (activeElement.classList.contains('btnNextPage')) {
|
||||||
candidates.push(container.querySelector(".btnNextPage"));
|
candidates.push(container.querySelector('.btnNextPage'));
|
||||||
candidates.push(container.querySelector(".btnPreviousPage"));
|
candidates.push(container.querySelector('.btnPreviousPage'));
|
||||||
} else if (activeElement.classList.contains("btnSelectView")) {
|
} else if (activeElement.classList.contains('btnSelectView')) {
|
||||||
candidates.push(container.querySelector(".btnSelectView"));
|
candidates.push(container.querySelector('.btnSelectView'));
|
||||||
}
|
}
|
||||||
|
|
||||||
candidates.push(activeElement);
|
candidates.push(activeElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
candidates = candidates.concat(arrayFrom(container.querySelectorAll(".btnResume")));
|
candidates = candidates.concat(Array.from(container.querySelectorAll('.btnResume')));
|
||||||
candidates = candidates.concat(arrayFrom(container.querySelectorAll(".btnPlay")));
|
candidates = candidates.concat(Array.from(container.querySelectorAll('.btnPlay')));
|
||||||
|
|
||||||
var focusedElement;
|
let focusedElement;
|
||||||
|
|
||||||
candidates.every(function (element) {
|
candidates.every(function (element) {
|
||||||
if (focusManager.isCurrentlyFocusable(element)) {
|
if (focusManager.isCurrentlyFocusable(element)) {
|
||||||
|
@ -79,7 +81,7 @@ define(["focusManager", "layoutManager"], function (focusManager, layoutManager)
|
||||||
|
|
||||||
if (!focusedElement) {
|
if (!focusedElement) {
|
||||||
// FIXME: Multiple itemsContainers
|
// FIXME: Multiple itemsContainers
|
||||||
var itemsContainer = container.querySelector(".itemsContainer");
|
const itemsContainer = container.querySelector('.itemsContainer');
|
||||||
|
|
||||||
if (itemsContainer) {
|
if (itemsContainer) {
|
||||||
focusedElement = focusManager.autoFocus(itemsContainer);
|
focusedElement = focusManager.autoFocus(itemsContainer);
|
||||||
|
@ -93,9 +95,10 @@ define(["focusManager", "layoutManager"], function (focusManager, layoutManager)
|
||||||
return focusedElement;
|
return focusedElement;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
/* eslint-enable indent */
|
||||||
isEnabled: isEnabled,
|
|
||||||
enable: enable,
|
export default {
|
||||||
autoFocus: autoFocus
|
isEnabled: isEnabled,
|
||||||
};
|
enable: enable,
|
||||||
});
|
autoFocus: autoFocus
|
||||||
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['browser', 'connectionManager', 'playbackManager', 'dom', "userSettings", 'css!./backdrop'], function (browser, connectionManager, playbackManager, dom, userSettings) {
|
define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings', 'css!./backdrop'], function (browser, connectionManager, playbackManager, dom, userSettings) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function enableAnimation(elem) {
|
function enableAnimation(elem) {
|
||||||
|
@ -180,8 +180,9 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', "userSettings"
|
||||||
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(function (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,
|
||||||
|
maxWidth: dom.getScreenWidth(),
|
||||||
index: index
|
index: index
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
@ -190,8 +191,9 @@ 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(function (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,
|
||||||
|
maxWidth: dom.getScreenWidth(),
|
||||||
index: index
|
index: index
|
||||||
}));
|
}));
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
define(["connectionManager"], function (connectionManager) {
|
define(['connectionManager'], function (connectionManager) {
|
||||||
|
|
||||||
return function () {
|
return function () {
|
||||||
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.name = "Backdrop ScreenSaver";
|
self.name = 'Backdrop ScreenSaver';
|
||||||
self.type = "screensaver";
|
self.type = 'screensaver';
|
||||||
self.id = "backdropscreensaver";
|
self.id = 'backdropscreensaver';
|
||||||
self.supportsAnonymous = false;
|
self.supportsAnonymous = false;
|
||||||
|
|
||||||
var currentSlideshow;
|
var currentSlideshow;
|
||||||
|
@ -14,12 +14,12 @@ define(["connectionManager"], function (connectionManager) {
|
||||||
self.show = function () {
|
self.show = function () {
|
||||||
|
|
||||||
var query = {
|
var query = {
|
||||||
ImageTypes: "Backdrop",
|
ImageTypes: 'Backdrop',
|
||||||
EnableImageTypes: "Backdrop",
|
EnableImageTypes: 'Backdrop',
|
||||||
IncludeItemTypes: "Movie,Series,MusicArtist",
|
IncludeItemTypes: 'Movie,Series,MusicArtist',
|
||||||
SortBy: "Random",
|
SortBy: 'Random',
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "Taglines",
|
Fields: 'Taglines',
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
StartIndex: 0,
|
StartIndex: 0,
|
||||||
Limit: 200
|
Limit: 200
|
||||||
|
@ -30,7 +30,7 @@ define(["connectionManager"], function (connectionManager) {
|
||||||
|
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
|
|
||||||
require(["slideshow"], function (slideshow) {
|
require(['slideshow'], function (slideshow) {
|
||||||
|
|
||||||
var newSlideShow = new slideshow({
|
var newSlideShow = new slideshow({
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
|
@ -52,5 +52,5 @@ define(["connectionManager"], function (connectionManager) {
|
||||||
currentSlideshow = null;
|
currentSlideshow = null;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -429,6 +429,12 @@ button::-moz-focus-inner {
|
||||||
font-size: 1.66956521739130434em !important;
|
font-size: 1.66956521739130434em !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.cardOverlayButtonIcon.material-icons {
|
||||||
|
/* material-icons override display, so we need to
|
||||||
|
make a better matching selector to set it to flex */
|
||||||
|
display: flex;
|
||||||
|
}
|
||||||
|
|
||||||
.cardOverlayButton-centered {
|
.cardOverlayButton-centered {
|
||||||
bottom: initial;
|
bottom: initial;
|
||||||
right: initial;
|
right: initial;
|
||||||
|
@ -784,7 +790,7 @@ button::-moz-focus-inner {
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
transition: 0.2s;
|
transition: 0.2s;
|
||||||
background: transparent;
|
background: transparent;
|
||||||
padding: 0.5em;
|
padding: 0.25em;
|
||||||
}
|
}
|
||||||
|
|
||||||
.cardOverlayButtonIcon-hover {
|
.cardOverlayButtonIcon-hover {
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -68,9 +68,9 @@ define(['datetime', 'imageLoader', 'connectionManager', 'layoutManager', 'browse
|
||||||
|
|
||||||
return apiClient.getScaledImageUrl(item.Id, {
|
return apiClient.getScaledImageUrl(item.Id, {
|
||||||
|
|
||||||
maxWidth: maxWidth,
|
maxWidth: maxWidth * 2,
|
||||||
tag: chapter.ImageTag,
|
tag: chapter.ImageTag,
|
||||||
type: "Chapter",
|
type: 'Chapter',
|
||||||
index: index
|
index: index
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,7 @@ define(['datetime', 'imageLoader', 'connectionManager', 'layoutManager', 'browse
|
||||||
var cardImageContainer = imgUrl ? ('<div class="' + cardImageContainerClass + ' lazy" data-src="' + imgUrl + '">') : ('<div class="' + cardImageContainerClass + '">');
|
var cardImageContainer = imgUrl ? ('<div class="' + cardImageContainerClass + ' lazy" data-src="' + imgUrl + '">') : ('<div class="' + cardImageContainerClass + '">');
|
||||||
|
|
||||||
if (!imgUrl) {
|
if (!imgUrl) {
|
||||||
cardImageContainer += '<i class="material-icons cardImageIcon">local_movies</i>';
|
cardImageContainer += '<span class="material-icons cardImageIcon local_movies"></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var nameHtml = '';
|
var nameHtml = '';
|
||||||
|
|
34
src/components/castSenderApi.js
Normal file
34
src/components/castSenderApi.js
Normal file
|
@ -0,0 +1,34 @@
|
||||||
|
define([], function() {
|
||||||
|
'use strict';
|
||||||
|
|
||||||
|
if (window.appMode === 'cordova' || window.appMode === 'android') {
|
||||||
|
return {
|
||||||
|
load: function () {
|
||||||
|
window.chrome = window.chrome || {};
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
var ccLoaded = false;
|
||||||
|
return {
|
||||||
|
load: function () {
|
||||||
|
if (ccLoaded) {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
return new Promise(function (resolve, reject) {
|
||||||
|
var fileref = document.createElement('script');
|
||||||
|
fileref.setAttribute('type', 'text/javascript');
|
||||||
|
|
||||||
|
fileref.onload = function () {
|
||||||
|
ccLoaded = true;
|
||||||
|
resolve();
|
||||||
|
};
|
||||||
|
|
||||||
|
fileref.setAttribute('src', 'https://www.gstatic.com/cv/js/sender/v1/cast_sender.js');
|
||||||
|
document.querySelector('head').appendChild(fileref);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
|
@ -1,44 +1,33 @@
|
||||||
define(["dialogHelper", "loading", "connectionManager", "globalize", "actionsheet", "emby-input", "paper-icon-button-light", "emby-button", "listViewStyle", "material-icons", "formDialogStyle"], function (dialogHelper, loading, connectionManager, globalize, actionsheet) {
|
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) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
return function (options) {
|
return function (options) {
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function mapChannel(button, channelId, providerChannelId) {
|
function mapChannel(button, channelId, providerChannelId) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var providerId = options.providerId;
|
var providerId = options.providerId;
|
||||||
connectionManager.getApiClient(options.serverId).ajax({
|
connectionManager.getApiClient(options.serverId).ajax({
|
||||||
type: "POST",
|
type: 'POST',
|
||||||
url: ApiClient.getUrl("LiveTv/ChannelMappings"),
|
url: ApiClient.getUrl('LiveTv/ChannelMappings'),
|
||||||
data: {
|
data: {
|
||||||
providerId: providerId,
|
providerId: providerId,
|
||||||
tunerChannelId: channelId,
|
tunerChannelId: channelId,
|
||||||
providerChannelId: providerChannelId
|
providerChannelId: providerChannelId
|
||||||
},
|
},
|
||||||
dataType: "json"
|
dataType: 'json'
|
||||||
}).then(function (mapping) {
|
}).then(function (mapping) {
|
||||||
var listItem = parentWithClass(button, "listItem");
|
var 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();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onChannelsElementClick(e) {
|
function onChannelsElementClick(e) {
|
||||||
var btnMap = parentWithClass(e.target, "btnMap");
|
var btnMap = dom.parentWithClass(e.target, 'btnMap');
|
||||||
|
|
||||||
if (btnMap) {
|
if (btnMap) {
|
||||||
var channelId = btnMap.getAttribute("data-id");
|
var channelId = btnMap.getAttribute('data-id');
|
||||||
var providerChannelId = btnMap.getAttribute("data-providerid");
|
var providerChannelId = btnMap.getAttribute('data-providerid');
|
||||||
var menuItems = currentMappingOptions.ProviderChannels.map(function (m) {
|
var menuItems = currentMappingOptions.ProviderChannels.map(function (m) {
|
||||||
return {
|
return {
|
||||||
name: m.Name,
|
name: m.Name,
|
||||||
|
@ -59,56 +48,56 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee
|
||||||
|
|
||||||
function getChannelMappingOptions(serverId, providerId) {
|
function getChannelMappingOptions(serverId, providerId) {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
var apiClient = 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 = "";
|
var html = '';
|
||||||
html += '<div class="listItem">';
|
html += '<div class="listItem">';
|
||||||
html += '<i class="material-icons listItemIcon">dvr</i>';
|
html += '<span class="material-icons listItemIcon dvr"></span>';
|
||||||
html += '<div class="listItemBody two-line">';
|
html += '<div class="listItemBody two-line">';
|
||||||
html += '<h3 class="listItemBodyText">';
|
html += '<h3 class="listItemBodyText">';
|
||||||
html += channel.Name;
|
html += channel.Name;
|
||||||
html += "</h3>";
|
html += '</h3>';
|
||||||
html += '<div class="secondary listItemBodyText">';
|
html += '<div class="secondary listItemBodyText">';
|
||||||
|
|
||||||
if (channel.ProviderChannelName) {
|
if (channel.ProviderChannelName) {
|
||||||
html += getMappingSecondaryName(channel, providerName);
|
html += getMappingSecondaryName(channel, providerName);
|
||||||
}
|
}
|
||||||
|
|
||||||
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 + '"><i class="material-icons">mode_edit</i></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 = "";
|
var html = '';
|
||||||
html += '<div class="formDialogContent">';
|
html += '<div class="formDialogContent">';
|
||||||
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('HeaderChannels') + '</h1>';
|
||||||
html += '<div class="channels paperList">';
|
html += '<div class="channels paperList">';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
html += "</form>";
|
html += '</form>';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
return html += "</div>";
|
return html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(dlg, options) {
|
function initEditor(dlg, options) {
|
||||||
getChannelMappingOptions(options.serverId, options.providerId).then(function (result) {
|
getChannelMappingOptions(options.serverId, options.providerId).then(function (result) {
|
||||||
currentMappingOptions = result;
|
currentMappingOptions = result;
|
||||||
var channelsElement = dlg.querySelector(".channels");
|
var channelsElement = dlg.querySelector('.channels');
|
||||||
channelsElement.innerHTML = result.TunerChannels.map(function (channel) {
|
channelsElement.innerHTML = result.TunerChannels.map(function (channel) {
|
||||||
return getTunerChannelHtml(channel, result.ProviderName);
|
return getTunerChannelHtml(channel, result.ProviderName);
|
||||||
}).join("");
|
}).join('');
|
||||||
channelsElement.addEventListener("click", onChannelsElementClick);
|
channelsElement.addEventListener('click', onChannelsElementClick);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,27 +108,27 @@ define(["dialogHelper", "loading", "connectionManager", "globalize", "actionshee
|
||||||
var dialogOptions = {
|
var dialogOptions = {
|
||||||
removeOnClose: true
|
removeOnClose: true
|
||||||
};
|
};
|
||||||
dialogOptions.size = "small";
|
dialogOptions.size = 'small';
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
var 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 = "";
|
var html = '';
|
||||||
var title = globalize.translate("MapChannels");
|
var title = globalize.translate('MapChannels');
|
||||||
html += '<div class="formDialogHeader">';
|
html += '<div class="formDialogHeader">';
|
||||||
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><i class="material-icons arrow_back"></i></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">';
|
||||||
html += title;
|
html += title;
|
||||||
html += "</h3>";
|
html += '</h3>';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
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', function () {
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
dlg.addEventListener("close", resolve);
|
dlg.addEventListener('close', resolve);
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -37,69 +37,69 @@ define(['events'], function (events) {
|
||||||
// 5) It wasn't as smart as it could have been about what should be part of a
|
// 5) It wasn't as smart as it could have been about what should be part of a
|
||||||
// URL and what should be part of human language.
|
// URL and what should be part of human language.
|
||||||
|
|
||||||
var protocols = "(?:(?:http|https|rtsp|ftp):\\/\\/)";
|
var protocols = '(?:(?:http|https|rtsp|ftp):\\/\\/)';
|
||||||
var credentials = "(?:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,64}" // username (1-64 normal or url escaped characters)
|
var credentials = "(?:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,64}" // username (1-64 normal or url escaped characters)
|
||||||
+ "(?:\\:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,25})?" // followed by optional password (: + 1-25 normal or url escaped characters)
|
+ "(?:\\:(?:[a-z0-9\\$\\-\\_\\.\\+\\!\\*\\'\\(\\)\\,\\;\\?\\&\\=]|(?:\\%[a-f0-9]{2})){1,25})?" // followed by optional password (: + 1-25 normal or url escaped characters)
|
||||||
+ "\\@)";
|
+ '\\@)';
|
||||||
|
|
||||||
// IPv6 Regex http://forums.intermapper.com/viewtopic.php?t=452
|
// IPv6 Regex http://forums.intermapper.com/viewtopic.php?t=452
|
||||||
// by Dartware, LLC is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
|
// by Dartware, LLC is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License
|
||||||
// http://intermapper.com/
|
// http://intermapper.com/
|
||||||
var ipv6 = "("
|
var ipv6 = '('
|
||||||
+ "(([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))"
|
+ '(([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))'
|
||||||
+ "|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))"
|
+ '|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))'
|
||||||
+ "|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))"
|
+ '|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))'
|
||||||
+ "|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
+ '|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))'
|
||||||
+ "|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
+ '|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))'
|
||||||
+ "|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
+ '|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))'
|
||||||
+ "|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
+ '|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))'
|
||||||
+ "|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))"
|
+ '|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))'
|
||||||
+ ")(%.+)?";
|
+ ')(%.+)?';
|
||||||
|
|
||||||
var ipv4 = "(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\."
|
var ipv4 = '(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9])\\.'
|
||||||
+ "(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\."
|
+ '(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.'
|
||||||
+ "(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\."
|
+ '(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[1-9]|0)\\.'
|
||||||
+ "(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])";
|
+ '(?:25[0-5]|2[0-4][0-9]|[0-1][0-9]{2}|[1-9][0-9]|[0-9])';
|
||||||
|
|
||||||
// This would have been a lot cleaner if JS RegExp supported conditionals...
|
// This would have been a lot cleaner if JS RegExp supported conditionals...
|
||||||
var linkRegExpString =
|
var linkRegExpString =
|
||||||
|
|
||||||
// begin match for protocol / username / password / host
|
// begin match for protocol / username / password / host
|
||||||
"(?:"
|
'(?:'
|
||||||
|
|
||||||
// ============================
|
// ============================
|
||||||
// If we have a recognized protocol at the beginning of the URL, we're
|
// If we have a recognized protocol at the beginning of the URL, we're
|
||||||
// more relaxed about what we accept, because we assume the user wants
|
// more relaxed about what we accept, because we assume the user wants
|
||||||
// this to be a URL, and we're not accidentally matching human language
|
// this to be a URL, and we're not accidentally matching human language
|
||||||
+ protocols + "?"
|
+ protocols + '?'
|
||||||
|
|
||||||
// optional username:password@
|
// optional username:password@
|
||||||
+ credentials + "?"
|
+ credentials + '?'
|
||||||
|
|
||||||
// IP address (both v4 and v6)
|
// IP address (both v4 and v6)
|
||||||
+ "(?:"
|
+ '(?:'
|
||||||
|
|
||||||
// IPv6
|
// IPv6
|
||||||
+ ipv6
|
+ ipv6
|
||||||
|
|
||||||
// IPv4
|
// IPv4
|
||||||
+ "|" + ipv4
|
+ '|' + ipv4
|
||||||
|
|
||||||
+ ")"
|
+ ')'
|
||||||
|
|
||||||
// end match for protocol / username / password / host
|
// end match for protocol / username / password / host
|
||||||
+ ")"
|
+ ')'
|
||||||
|
|
||||||
// optional port number
|
// optional port number
|
||||||
+ "(?:\\:\\d{1,5})?"
|
+ '(?:\\:\\d{1,5})?'
|
||||||
|
|
||||||
// plus optional path and query params (no unicode allowed here?)
|
// plus optional path and query params (no unicode allowed here?)
|
||||||
+ "(?:"
|
+ '(?:'
|
||||||
+ "\\/(?:"
|
+ '\\/(?:'
|
||||||
// some characters we'll accept because it's unlikely human language
|
// some characters we'll accept because it's unlikely human language
|
||||||
// would use them after a URL unless they were part of the url
|
// would use them after a URL unless they were part of the url
|
||||||
+ "(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])"
|
+ '(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])'
|
||||||
+ "|(?:\\%[a-f0-9]{2})"
|
+ '|(?:\\%[a-f0-9]{2})'
|
||||||
// some characters are much more likely to be used AFTER a url and
|
// some characters are much more likely to be used AFTER a url and
|
||||||
// were not intended to be included in the url itself. Mostly end
|
// were not intended to be included in the url itself. Mostly end
|
||||||
// of sentence type things. It's also likely that the URL would
|
// of sentence type things. It's also likely that the URL would
|
||||||
|
@ -108,9 +108,9 @@ define(['events'], function (events) {
|
||||||
// they must be followed by another character that we're reasonably
|
// they must be followed by another character that we're reasonably
|
||||||
// sure is part of the url
|
// sure is part of the url
|
||||||
+ "|(?:[\\;\\?\\:\\.\\!\\'\\(\\)\\,\\=]+(?=(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])|(?:\\%[a-f0-9]{2})))"
|
+ "|(?:[\\;\\?\\:\\.\\!\\'\\(\\)\\,\\=]+(?=(?:[a-z0-9\\/\\@\\&\\#\\~\\*\\_\\-\\+])|(?:\\%[a-f0-9]{2})))"
|
||||||
+ ")*"
|
+ ')*'
|
||||||
+ "|\\b|\$"
|
+ '|\\b|\$'
|
||||||
+ ")";
|
+ ')';
|
||||||
|
|
||||||
// regex = XRegExp(regex,'gi');
|
// regex = XRegExp(regex,'gi');
|
||||||
var linkRegExp = RegExp(linkRegExpString, 'gi');
|
var linkRegExp = RegExp(linkRegExpString, 'gi');
|
||||||
|
@ -120,7 +120,7 @@ define(['events'], function (events) {
|
||||||
// if url doesn't begin with a known protocol, add http by default
|
// if url doesn't begin with a known protocol, add http by default
|
||||||
function ensureProtocol(url) {
|
function ensureProtocol(url) {
|
||||||
if (!url.match(protocolRegExp)) {
|
if (!url.match(protocolRegExp)) {
|
||||||
url = "http://" + url;
|
url = 'http://' + url;
|
||||||
}
|
}
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
@ -131,8 +131,9 @@ define(['events'], function (events) {
|
||||||
var links = [];
|
var links = [];
|
||||||
var match;
|
var match;
|
||||||
|
|
||||||
|
// eslint-disable-next-line no-cond-assign
|
||||||
while (match = linkRegExp.exec(text)) {
|
while (match = linkRegExp.exec(text)) {
|
||||||
// console.log(matches);
|
console.debug(match);
|
||||||
var txt = match[0];
|
var txt = match[0];
|
||||||
var pos = match.index;
|
var pos = match.index;
|
||||||
var len = txt.length;
|
var len = txt.length;
|
||||||
|
@ -187,9 +188,9 @@ define(['events'], function (events) {
|
||||||
return apiClient.getEndpointInfo().then(function (endpoint) {
|
return apiClient.getEndpointInfo().then(function (endpoint) {
|
||||||
if (endpoint.IsInNetwork) {
|
if (endpoint.IsInNetwork) {
|
||||||
return apiClient.getPublicSystemInfo().then(function (info) {
|
return apiClient.getPublicSystemInfo().then(function (info) {
|
||||||
var localAddress = info.LocalAddress
|
var localAddress = info.LocalAddress;
|
||||||
if (!localAddress) {
|
if (!localAddress) {
|
||||||
console.log("No valid local address returned, defaulting to external one")
|
console.debug('No valid local address returned, defaulting to external one');
|
||||||
localAddress = serverAddress;
|
localAddress = serverAddress;
|
||||||
}
|
}
|
||||||
addToCache(serverAddress, localAddress);
|
addToCache(serverAddress, localAddress);
|
||||||
|
@ -230,4 +231,4 @@ define(['events'], function (events) {
|
||||||
return {
|
return {
|
||||||
getServerAddress: getServerAddress
|
getServerAddress: getServerAddress
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
var currentResolve;
|
var currentResolve;
|
||||||
var currentReject;
|
var currentReject;
|
||||||
|
|
||||||
var PlayerName = 'Chromecast';
|
var PlayerName = 'Google Cast';
|
||||||
|
|
||||||
function sendConnectionResult(isOk) {
|
function sendConnectionResult(isOk) {
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
|
|
||||||
// production version registered with google
|
// production version registered with google
|
||||||
// replace this value if you want to test changes on another instance
|
// replace this value if you want to test changes on another instance
|
||||||
var applicationID = "F007D354";
|
var applicationID = 'F007D354';
|
||||||
|
|
||||||
var messageNamespace = 'urn:x-cast:com.connectsdk';
|
var messageNamespace = 'urn:x-cast:com.connectsdk';
|
||||||
|
|
||||||
|
@ -105,7 +105,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
this.sessionListener.bind(this),
|
this.sessionListener.bind(this),
|
||||||
this.receiverListener.bind(this));
|
this.receiverListener.bind(this));
|
||||||
|
|
||||||
console.log('chromecast.initialize');
|
console.debug('chromecast.initialize');
|
||||||
chrome.cast.initialize(apiConfig, this.onInitSuccess.bind(this), this.errorHandler);
|
chrome.cast.initialize(apiConfig, this.onInitSuccess.bind(this), this.errorHandler);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -114,14 +114,14 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.onInitSuccess = function () {
|
CastPlayer.prototype.onInitSuccess = function () {
|
||||||
this.isInitialized = true;
|
this.isInitialized = true;
|
||||||
console.log("chromecast init success");
|
console.debug('chromecast init success');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Generic error callback function
|
* Generic error callback function
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.onError = function () {
|
CastPlayer.prototype.onError = function () {
|
||||||
console.log("chromecast error");
|
console.debug('chromecast error');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -177,10 +177,10 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.receiverListener = function (e) {
|
CastPlayer.prototype.receiverListener = function (e) {
|
||||||
if (e === 'available') {
|
if (e === 'available') {
|
||||||
console.log("chromecast receiver found");
|
console.debug('chromecast receiver found');
|
||||||
this.hasReceivers = true;
|
this.hasReceivers = true;
|
||||||
} else {
|
} else {
|
||||||
console.log("chromecast receiver list empty");
|
console.debug('chromecast receiver list empty');
|
||||||
this.hasReceivers = false;
|
this.hasReceivers = false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -190,15 +190,15 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.sessionUpdateListener = function (isAlive) {
|
CastPlayer.prototype.sessionUpdateListener = function (isAlive) {
|
||||||
if (isAlive) {
|
if (isAlive) {
|
||||||
console.log('sessionUpdateListener: already alive');
|
console.debug('sessionUpdateListener: already alive');
|
||||||
} else {
|
} else {
|
||||||
this.session = null;
|
this.session = null;
|
||||||
this.deviceState = DEVICE_STATE.IDLE;
|
this.deviceState = DEVICE_STATE.IDLE;
|
||||||
this.castPlayerState = PLAYER_STATE.IDLE;
|
this.castPlayerState = PLAYER_STATE.IDLE;
|
||||||
document.removeEventListener("volumeupbutton", onVolumeUpKeyDown, false);
|
document.removeEventListener('volumeupbutton', onVolumeUpKeyDown, false);
|
||||||
document.removeEventListener("volumedownbutton", onVolumeDownKeyDown, false);
|
document.removeEventListener('volumedownbutton', onVolumeDownKeyDown, false);
|
||||||
|
|
||||||
console.log('sessionUpdateListener: setting currentMediaSession to null');
|
console.debug('sessionUpdateListener: setting currentMediaSession to null');
|
||||||
this.currentMediaSession = null;
|
this.currentMediaSession = null;
|
||||||
|
|
||||||
sendConnectionResult(false);
|
sendConnectionResult(false);
|
||||||
|
@ -211,7 +211,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
* session request in opt_sessionRequest.
|
* session request in opt_sessionRequest.
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.launchApp = function () {
|
CastPlayer.prototype.launchApp = function () {
|
||||||
console.log("chromecast launching app...");
|
console.debug('chromecast launching app...');
|
||||||
chrome.cast.requestSession(this.onRequestSessionSuccess.bind(this), this.onLaunchError.bind(this));
|
chrome.cast.requestSession(this.onRequestSessionSuccess.bind(this), this.onLaunchError.bind(this));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -220,7 +220,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
* @param {Object} e A chrome.cast.Session object
|
* @param {Object} e A chrome.cast.Session object
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.onRequestSessionSuccess = function (e) {
|
CastPlayer.prototype.onRequestSessionSuccess = function (e) {
|
||||||
console.log("chromecast session success: " + e.sessionId);
|
console.debug('chromecast session success: ' + e.sessionId);
|
||||||
this.onSessionConnected(e);
|
this.onSessionConnected(e);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -232,8 +232,8 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
this.session.addMediaListener(this.sessionMediaListener.bind(this));
|
this.session.addMediaListener(this.sessionMediaListener.bind(this));
|
||||||
this.session.addUpdateListener(this.sessionUpdateListener.bind(this));
|
this.session.addUpdateListener(this.sessionUpdateListener.bind(this));
|
||||||
|
|
||||||
document.addEventListener("volumeupbutton", onVolumeUpKeyDown, false);
|
document.addEventListener('volumeupbutton', onVolumeUpKeyDown, false);
|
||||||
document.addEventListener("volumedownbutton", onVolumeDownKeyDown, false);
|
document.addEventListener('volumedownbutton', onVolumeDownKeyDown, false);
|
||||||
|
|
||||||
events.trigger(this, 'connect');
|
events.trigger(this, 'connect');
|
||||||
this.sendMessage({
|
this.sendMessage({
|
||||||
|
@ -262,7 +262,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
* Callback function for launch error
|
* Callback function for launch error
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.onLaunchError = function () {
|
CastPlayer.prototype.onLaunchError = function () {
|
||||||
console.log("chromecast launch error");
|
console.debug('chromecast launch error');
|
||||||
this.deviceState = DEVICE_STATE.ERROR;
|
this.deviceState = DEVICE_STATE.ERROR;
|
||||||
sendConnectionResult(false);
|
sendConnectionResult(false);
|
||||||
};
|
};
|
||||||
|
@ -280,12 +280,12 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
* Callback function for stop app success
|
* Callback function for stop app success
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.onStopAppSuccess = function (message) {
|
CastPlayer.prototype.onStopAppSuccess = function (message) {
|
||||||
console.log(message);
|
console.debug(message);
|
||||||
|
|
||||||
this.deviceState = DEVICE_STATE.IDLE;
|
this.deviceState = DEVICE_STATE.IDLE;
|
||||||
this.castPlayerState = PLAYER_STATE.IDLE;
|
this.castPlayerState = PLAYER_STATE.IDLE;
|
||||||
document.removeEventListener("volumeupbutton", onVolumeUpKeyDown, false);
|
document.removeEventListener('volumeupbutton', onVolumeUpKeyDown, false);
|
||||||
document.removeEventListener("volumedownbutton", onVolumeDownKeyDown, false);
|
document.removeEventListener('volumedownbutton', onVolumeDownKeyDown, false);
|
||||||
|
|
||||||
this.currentMediaSession = null;
|
this.currentMediaSession = null;
|
||||||
};
|
};
|
||||||
|
@ -296,7 +296,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.loadMedia = function (options, command) {
|
CastPlayer.prototype.loadMedia = function (options, command) {
|
||||||
if (!this.session) {
|
if (!this.session) {
|
||||||
console.log("no session");
|
console.debug('no session');
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -377,7 +377,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
};
|
};
|
||||||
|
|
||||||
CastPlayer.prototype.onPlayCommandSuccess = function () {
|
CastPlayer.prototype.onPlayCommandSuccess = function () {
|
||||||
//console.log('Message was sent to receiver ok.');
|
console.debug('Message was sent to receiver ok.');
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -386,7 +386,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.onMediaDiscovered = function (how, mediaSession) {
|
CastPlayer.prototype.onMediaDiscovered = function (how, mediaSession) {
|
||||||
|
|
||||||
//console.log("chromecast new media session ID:" + mediaSession.mediaSessionId + ' (' + how + ')');
|
console.debug('chromecast new media session ID:' + mediaSession.mediaSessionId + ' (' + how + ')');
|
||||||
this.currentMediaSession = mediaSession;
|
this.currentMediaSession = mediaSession;
|
||||||
|
|
||||||
if (how === 'loadMedia') {
|
if (how === 'loadMedia') {
|
||||||
|
@ -405,7 +405,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
* @param {!Boolean} e true/false
|
* @param {!Boolean} e true/false
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.onMediaStatusUpdate = function (e) {
|
CastPlayer.prototype.onMediaStatusUpdate = function (e) {
|
||||||
//console.log("chromecast updating media: " + e);
|
console.debug('chromecast updating media: ' + e);
|
||||||
if (e === false) {
|
if (e === false) {
|
||||||
this.castPlayerState = PLAYER_STATE.IDLE;
|
this.castPlayerState = PLAYER_STATE.IDLE;
|
||||||
}
|
}
|
||||||
|
@ -417,7 +417,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.setReceiverVolume = function (mute, vol) {
|
CastPlayer.prototype.setReceiverVolume = function (mute, vol) {
|
||||||
if (!this.currentMediaSession) {
|
if (!this.currentMediaSession) {
|
||||||
//console.log('this.currentMediaSession is null');
|
console.debug('this.currentMediaSession is null');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -443,7 +443,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
* Callback function for media command success
|
* Callback function for media command success
|
||||||
*/
|
*/
|
||||||
CastPlayer.prototype.mediaCommandSuccessCallback = function (info, e) {
|
CastPlayer.prototype.mediaCommandSuccessCallback = function (info, e) {
|
||||||
//console.log(info);
|
console.debug(info);
|
||||||
};
|
};
|
||||||
|
|
||||||
function normalizeImages(state) {
|
function normalizeImages(state) {
|
||||||
|
@ -482,7 +482,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
query.Limit = query.Limit || 100;
|
query.Limit = query.Limit || 100;
|
||||||
query.ExcludeLocationTypes = "Virtual";
|
query.ExcludeLocationTypes = 'Virtual';
|
||||||
query.EnableTotalRecordCount = false;
|
query.EnableTotalRecordCount = false;
|
||||||
|
|
||||||
return apiClient.getItems(userId, query);
|
return apiClient.getItems(userId, query);
|
||||||
|
@ -493,7 +493,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
|
|
||||||
events.on(instance._castPlayer, eventName, function (e, data) {
|
events.on(instance._castPlayer, eventName, function (e, data) {
|
||||||
|
|
||||||
//console.log('cc: ' + eventName);
|
console.debug('cc: ' + eventName);
|
||||||
var state = instance.getPlayerStateInternal(data);
|
var state = instance.getPlayerStateInternal(data);
|
||||||
|
|
||||||
events.trigger(instance, eventName, [state]);
|
events.trigger(instance, eventName, [state]);
|
||||||
|
@ -506,13 +506,13 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
instance._castPlayer = new CastPlayer();
|
instance._castPlayer = new CastPlayer();
|
||||||
|
|
||||||
// To allow the native android app to override
|
// To allow the native android app to override
|
||||||
document.dispatchEvent(new CustomEvent("chromecastloaded", {
|
document.dispatchEvent(new CustomEvent('chromecastloaded', {
|
||||||
detail: {
|
detail: {
|
||||||
player: instance
|
player: instance
|
||||||
}
|
}
|
||||||
}));
|
}));
|
||||||
|
|
||||||
events.on(instance._castPlayer, "connect", function (e) {
|
events.on(instance._castPlayer, 'connect', function (e) {
|
||||||
|
|
||||||
if (currentResolve) {
|
if (currentResolve) {
|
||||||
sendConnectionResult(true);
|
sendConnectionResult(true);
|
||||||
|
@ -520,27 +520,27 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
playbackManager.setActivePlayer(PlayerName, instance.getCurrentTargetInfo());
|
playbackManager.setActivePlayer(PlayerName, instance.getCurrentTargetInfo());
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('cc: connect');
|
console.debug('cc: connect');
|
||||||
// Reset this so that statechange will fire
|
// Reset this so that statechange will fire
|
||||||
instance.lastPlayerData = null;
|
instance.lastPlayerData = null;
|
||||||
});
|
});
|
||||||
|
|
||||||
events.on(instance._castPlayer, "playbackstart", function (e, data) {
|
events.on(instance._castPlayer, 'playbackstart', function (e, data) {
|
||||||
|
|
||||||
console.log('cc: playbackstart');
|
console.debug('cc: playbackstart');
|
||||||
|
|
||||||
instance._castPlayer.initializeCastPlayer();
|
instance._castPlayer.initializeCastPlayer();
|
||||||
|
|
||||||
var state = instance.getPlayerStateInternal(data);
|
var state = instance.getPlayerStateInternal(data);
|
||||||
events.trigger(instance, "playbackstart", [state]);
|
events.trigger(instance, 'playbackstart', [state]);
|
||||||
});
|
});
|
||||||
|
|
||||||
events.on(instance._castPlayer, "playbackstop", function (e, data) {
|
events.on(instance._castPlayer, 'playbackstop', function (e, data) {
|
||||||
|
|
||||||
console.log('cc: playbackstop');
|
console.debug('cc: playbackstop');
|
||||||
var state = instance.getPlayerStateInternal(data);
|
var state = instance.getPlayerStateInternal(data);
|
||||||
|
|
||||||
events.trigger(instance, "playbackstop", [state]);
|
events.trigger(instance, 'playbackstop', [state]);
|
||||||
|
|
||||||
var state = instance.lastPlayerData.PlayState || {};
|
var state = instance.lastPlayerData.PlayState || {};
|
||||||
var volume = state.VolumeLevel || 0.5;
|
var volume = state.VolumeLevel || 0.5;
|
||||||
|
@ -553,12 +553,12 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
instance.lastPlayerData.PlayState.IsMuted = mute;
|
instance.lastPlayerData.PlayState.IsMuted = mute;
|
||||||
});
|
});
|
||||||
|
|
||||||
events.on(instance._castPlayer, "playbackprogress", function (e, data) {
|
events.on(instance._castPlayer, 'playbackprogress', function (e, data) {
|
||||||
|
|
||||||
//console.log('cc: positionchange');
|
console.debug('cc: positionchange');
|
||||||
var state = instance.getPlayerStateInternal(data);
|
var state = instance.getPlayerStateInternal(data);
|
||||||
|
|
||||||
events.trigger(instance, "timeupdate", [state]);
|
events.trigger(instance, 'timeupdate', [state]);
|
||||||
});
|
});
|
||||||
|
|
||||||
bindEventForRelay(instance, 'timeupdate');
|
bindEventForRelay(instance, 'timeupdate');
|
||||||
|
@ -567,12 +567,12 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
bindEventForRelay(instance, 'volumechange');
|
bindEventForRelay(instance, 'volumechange');
|
||||||
bindEventForRelay(instance, 'repeatmodechange');
|
bindEventForRelay(instance, 'repeatmodechange');
|
||||||
|
|
||||||
events.on(instance._castPlayer, "playstatechange", function (e, data) {
|
events.on(instance._castPlayer, 'playstatechange', function (e, data) {
|
||||||
|
|
||||||
//console.log('cc: playstatechange');
|
console.debug('cc: playstatechange');
|
||||||
var state = instance.getPlayerStateInternal(data);
|
var state = instance.getPlayerStateInternal(data);
|
||||||
|
|
||||||
events.trigger(instance, "pause", [state]);
|
events.trigger(instance, 'pause', [state]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -630,24 +630,24 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
name: PlayerName,
|
name: PlayerName,
|
||||||
id: PlayerName,
|
id: PlayerName,
|
||||||
playerName: PlayerName,
|
playerName: PlayerName,
|
||||||
playableMediaTypes: ["Audio", "Video"],
|
playableMediaTypes: ['Audio', 'Video'],
|
||||||
isLocalPlayer: false,
|
isLocalPlayer: false,
|
||||||
appName: PlayerName,
|
appName: PlayerName,
|
||||||
deviceName: appName,
|
deviceName: appName,
|
||||||
supportedCommands: [
|
supportedCommands: [
|
||||||
"VolumeUp",
|
'VolumeUp',
|
||||||
"VolumeDown",
|
'VolumeDown',
|
||||||
"Mute",
|
'Mute',
|
||||||
"Unmute",
|
'Unmute',
|
||||||
"ToggleMute",
|
'ToggleMute',
|
||||||
"SetVolume",
|
'SetVolume',
|
||||||
"SetAudioStreamIndex",
|
'SetAudioStreamIndex',
|
||||||
"SetSubtitleStreamIndex",
|
'SetSubtitleStreamIndex',
|
||||||
"DisplayContent",
|
'DisplayContent',
|
||||||
"SetRepeatMode",
|
'SetRepeatMode',
|
||||||
"EndSession",
|
'EndSession',
|
||||||
"PlayMediaSource",
|
'PlayMediaSource',
|
||||||
"PlayTrailers"
|
'PlayTrailers'
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
@ -664,10 +664,10 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
|
|
||||||
normalizeImages(data);
|
normalizeImages(data);
|
||||||
|
|
||||||
//console.log(JSON.stringify(data));
|
console.debug(JSON.stringify(data));
|
||||||
|
|
||||||
if (triggerStateChange) {
|
if (triggerStateChange) {
|
||||||
events.trigger(this, "statechange", [data]);
|
events.trigger(this, 'statechange', [data]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return data;
|
return data;
|
||||||
|
|
|
@ -1,25 +1,12 @@
|
||||||
define(['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 (dialogHelper, loading, appHost, layoutManager, connectionManager, appRouter, globalize) {
|
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) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var currentServerId;
|
var currentServerId;
|
||||||
|
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var panel = parentWithClass(this, 'dialog');
|
var panel = dom.parentWithClass(this, 'dialog');
|
||||||
|
|
||||||
var collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
var collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
||||||
|
|
||||||
|
@ -37,7 +24,7 @@ define(['dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManage
|
||||||
|
|
||||||
function createCollection(apiClient, dlg) {
|
function createCollection(apiClient, dlg) {
|
||||||
|
|
||||||
var 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,
|
||||||
|
@ -45,9 +32,9 @@ define(['dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManage
|
||||||
});
|
});
|
||||||
|
|
||||||
apiClient.ajax({
|
apiClient.ajax({
|
||||||
type: "POST",
|
type: 'POST',
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json"
|
dataType: 'json'
|
||||||
|
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
|
@ -69,13 +56,13 @@ define(['dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManage
|
||||||
|
|
||||||
function addToCollection(apiClient, dlg, id) {
|
function addToCollection(apiClient, dlg, id) {
|
||||||
|
|
||||||
var url = apiClient.getUrl("Collections/" + id + "/Items", {
|
var url = apiClient.getUrl('Collections/' + id + '/Items', {
|
||||||
|
|
||||||
Ids: dlg.querySelector('.fldSelectedItemIds').value || ''
|
Ids: dlg.querySelector('.fldSelectedItemIds').value || ''
|
||||||
});
|
});
|
||||||
|
|
||||||
apiClient.ajax({
|
apiClient.ajax({
|
||||||
type: "POST",
|
type: 'POST',
|
||||||
url: url
|
url: url
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
@ -106,8 +93,8 @@ define(['dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManage
|
||||||
var options = {
|
var options = {
|
||||||
|
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
IncludeItemTypes: "BoxSet",
|
IncludeItemTypes: 'BoxSet',
|
||||||
SortBy: "SortName",
|
SortBy: 'SortName',
|
||||||
EnableTotalRecordCount: false
|
EnableTotalRecordCount: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -243,13 +230,13 @@ define(['dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManage
|
||||||
var title = items.length ? globalize.translate('HeaderAddToCollection') : globalize.translate('NewCollection');
|
var 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"><i class="material-icons arrow_back"></i></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">';
|
||||||
html += title;
|
html += title;
|
||||||
html += '</h3>';
|
html += '</h3>';
|
||||||
|
|
||||||
if (appHost.supports('externallinks')) {
|
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') + '"><i class="material-icons">info</i><span style="margin-left:.25em;">' + globalize.translate('Help') + '</span></a>';
|
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>';
|
||||||
|
|
|
@ -1,40 +1,65 @@
|
||||||
define(['dialog', 'globalize'], function (dialog, globalize) {
|
define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
return function (text, title) {
|
function replaceAll(str, find, replace) {
|
||||||
|
return str.split(find).join(replace);
|
||||||
|
}
|
||||||
|
|
||||||
var options;
|
if (browser.tv && window.confirm) {
|
||||||
if (typeof text === 'string') {
|
// Use the native confirm dialog
|
||||||
options = {
|
return function (options) {
|
||||||
title: title,
|
if (typeof options === 'string') {
|
||||||
text: text
|
options = {
|
||||||
};
|
title: '',
|
||||||
} else {
|
text: options
|
||||||
options = text;
|
};
|
||||||
}
|
|
||||||
|
|
||||||
var items = [];
|
|
||||||
|
|
||||||
items.push({
|
|
||||||
name: options.cancelText || globalize.translate('ButtonCancel'),
|
|
||||||
id: 'cancel',
|
|
||||||
type: 'cancel'
|
|
||||||
});
|
|
||||||
|
|
||||||
items.push({
|
|
||||||
name: options.confirmText || globalize.translate('ButtonOk'),
|
|
||||||
id: 'ok',
|
|
||||||
type: options.primary === 'delete' ? 'delete' : 'submit'
|
|
||||||
});
|
|
||||||
|
|
||||||
options.buttons = items;
|
|
||||||
|
|
||||||
return dialog(options).then(function (result) {
|
|
||||||
if (result === 'ok') {
|
|
||||||
return Promise.resolve();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.reject();
|
var text = replaceAll(options.text || '', '<br/>', '\n');
|
||||||
});
|
var result = confirm(text);
|
||||||
};
|
|
||||||
|
if (result) {
|
||||||
|
return Promise.resolve();
|
||||||
|
} else {
|
||||||
|
return Promise.reject();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
// Use our own dialog
|
||||||
|
return function (text, title) {
|
||||||
|
var options;
|
||||||
|
if (typeof text === 'string') {
|
||||||
|
options = {
|
||||||
|
title: title,
|
||||||
|
text: text
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
options = text;
|
||||||
|
}
|
||||||
|
|
||||||
|
var items = [];
|
||||||
|
|
||||||
|
items.push({
|
||||||
|
name: options.cancelText || globalize.translate('ButtonCancel'),
|
||||||
|
id: 'cancel',
|
||||||
|
type: 'cancel'
|
||||||
|
});
|
||||||
|
|
||||||
|
items.push({
|
||||||
|
name: options.confirmText || globalize.translate('ButtonOk'),
|
||||||
|
id: 'ok',
|
||||||
|
type: options.primary === 'delete' ? 'delete' : 'submit'
|
||||||
|
});
|
||||||
|
|
||||||
|
options.buttons = items;
|
||||||
|
|
||||||
|
return dialog(options).then(function (result) {
|
||||||
|
if (result === 'ok') {
|
||||||
|
return Promise.resolve();
|
||||||
|
}
|
||||||
|
|
||||||
|
return Promise.reject();
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,27 +0,0 @@
|
||||||
define([], function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function replaceAll(str, find, replace) {
|
|
||||||
|
|
||||||
return str.split(find).join(replace);
|
|
||||||
}
|
|
||||||
|
|
||||||
return function (options) {
|
|
||||||
|
|
||||||
if (typeof options === 'string') {
|
|
||||||
options = {
|
|
||||||
title: '',
|
|
||||||
text: options
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
var text = replaceAll(options.text || '', '<br/>', '\n');
|
|
||||||
var result = confirm(text);
|
|
||||||
|
|
||||||
if (result) {
|
|
||||||
return Promise.resolve();
|
|
||||||
} else {
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -12,4 +12,4 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="formDialogFooter formDialogFooter-clear formDialogFooter-flex" style="padding-bottom: 1.5em;">
|
<div class="formDialogFooter formDialogFooter-clear formDialogFooter-flex" style="padding-bottom: 1.5em;">
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -32,7 +32,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
try {
|
try {
|
||||||
parentNode.removeChild(elem);
|
parentNode.removeChild(elem);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error removing dialog element: ' + err);
|
console.error('error removing dialog element: ' + err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,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 {
|
||||||
|
@ -169,6 +169,15 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
}, {
|
}, {
|
||||||
passive: true
|
passive: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
dom.addEventListener((dlg.dialogContainer || backdrop), 'contextmenu', function (e) {
|
||||||
|
if (e.target === dlg.dialogContainer) {
|
||||||
|
// Close the application dialog menu
|
||||||
|
close(dlg);
|
||||||
|
// Prevent the default browser context menu from appearing
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function isHistoryEnabled(dlg) {
|
function isHistoryEnabled(dlg) {
|
||||||
|
@ -242,9 +251,15 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
|
|
||||||
var onAnimationFinish = function () {
|
var onAnimationFinish = function () {
|
||||||
focusManager.pushScope(dlg);
|
focusManager.pushScope(dlg);
|
||||||
|
|
||||||
if (dlg.getAttribute('data-autofocus') === 'true') {
|
if (dlg.getAttribute('data-autofocus') === 'true') {
|
||||||
focusManager.autoFocus(dlg);
|
focusManager.autoFocus(dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (document.activeElement && !dlg.contains(document.activeElement)) {
|
||||||
|
// Blur foreign element to prevent triggering of an action from the previous scope
|
||||||
|
document.activeElement.blur();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if (enableAnimation()) {
|
if (enableAnimation()) {
|
||||||
|
@ -481,4 +496,4 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||||
globalOnOpenCallback = val;
|
globalOnOpenCallback = val;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'paper-icon-button-light', 'css!./directorybrowser', 'formDialogStyle', 'emby-button'], function(loading, dialogHelper, dom) {
|
define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-input', 'paper-icon-button-light', 'css!./directorybrowser', 'formDialogStyle', 'emby-button'], function(loading, dialogHelper, dom, globalize) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function getSystemInfo() {
|
function getSystemInfo() {
|
||||||
|
@ -7,24 +7,24 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'paper-
|
||||||
systemInfo = info;
|
systemInfo = info;
|
||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
)
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
loading.hide()
|
loading.hide();
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshDirectoryBrowser(page, path, fileOptions, updatePathOnError) {
|
function refreshDirectoryBrowser(page, path, fileOptions, updatePathOnError) {
|
||||||
if (path && typeof path !== 'string') {
|
if (path && typeof path !== 'string') {
|
||||||
throw new Error("invalid path");
|
throw new Error('invalid path');
|
||||||
}
|
}
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var promises = [];
|
var promises = [];
|
||||||
|
|
||||||
if ("Network" === path) {
|
if ('Network' === path) {
|
||||||
promises.push(ApiClient.getNetworkDevices())
|
promises.push(ApiClient.getNetworkDevices());
|
||||||
} else {
|
} else {
|
||||||
if (path) {
|
if (path) {
|
||||||
promises.push(ApiClient.getDirectoryContents(path, fileOptions));
|
promises.push(ApiClient.getDirectoryContents(path, fileOptions));
|
||||||
|
@ -37,31 +37,31 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'paper-
|
||||||
Promise.all(promises).then(
|
Promise.all(promises).then(
|
||||||
function(responses) {
|
function(responses) {
|
||||||
var folders = responses[0];
|
var folders = responses[0];
|
||||||
var parentPath = responses[1] || "";
|
var parentPath = responses[1] || '';
|
||||||
var html = "";
|
var html = '';
|
||||||
|
|
||||||
page.querySelector(".results").scrollTop = 0;
|
page.querySelector('.results').scrollTop = 0;
|
||||||
page.querySelector("#txtDirectoryPickerPath").value = path || "";
|
page.querySelector('#txtDirectoryPickerPath').value = path || '';
|
||||||
|
|
||||||
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 (var i = 0, length = folders.length; i < length; i++) {
|
||||||
var folder = folders[i];
|
var folder = folders[i];
|
||||||
var cssClass = "File" === folder.Type ? "lnkPath lnkFile" : "lnkPath lnkDirectory";
|
var cssClass = 'File' === folder.Type ? 'lnkPath lnkFile' : 'lnkPath lnkDirectory';
|
||||||
html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
|
html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!path) {
|
if (!path) {
|
||||||
html += getItem("lnkPath lnkDirectory", "", "Network", Globalize.translate("ButtonNetwork"));
|
html += getItem('lnkPath lnkDirectory', '', 'Network', globalize.translate('ButtonNetwork'));
|
||||||
}
|
}
|
||||||
|
|
||||||
page.querySelector(".results").innerHTML = html;
|
page.querySelector('.results').innerHTML = html;
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}, function() {
|
}, function() {
|
||||||
if (updatePathOnError) {
|
if (updatePathOnError) {
|
||||||
page.querySelector("#txtDirectoryPickerPath").value = "";
|
page.querySelector('#txtDirectoryPickerPath').value = '';
|
||||||
page.querySelector(".results").innerHTML = "";
|
page.querySelector('.results').innerHTML = '';
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,74 +69,74 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'paper-
|
||||||
}
|
}
|
||||||
|
|
||||||
function getItem(cssClass, type, path, name) {
|
function getItem(cssClass, type, path, name) {
|
||||||
var html = "";
|
var 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;
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
html += '<i class="material-icons" style="font-size:inherit;">arrow_forward</i>';
|
html += '<span class="material-icons arrow_forward" style="font-size:inherit;"></span>';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEditorHtml(options, systemInfo) {
|
function getEditorHtml(options, systemInfo) {
|
||||||
var html = "";
|
var 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/>" : "";
|
var 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;
|
||||||
html += Globalize.translate("MessageDirectoryPickerInstruction").replace("{0}", "<b>\\\\server</b>").replace("{1}", "<b>\\\\192.168.1.101</b>");
|
html += globalize.translate('MessageDirectoryPickerInstruction', '<b>\\\\server</b>', '<b>\\\\192.168.1.101</b>');
|
||||||
if ("bsd" === systemInfo.OperatingSystem.toLowerCase()) {
|
if ('bsd' === systemInfo.OperatingSystem.toLowerCase()) {
|
||||||
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 ('linux' === systemInfo.OperatingSystem.toLowerCase()) {
|
||||||
html += "<br/>";
|
html += '<br/>';
|
||||||
html += "<br/>";
|
html += '<br/>';
|
||||||
html += Globalize.translate("MessageDirectoryPickerLinuxInstruction");
|
html += globalize.translate('MessageDirectoryPickerLinuxInstruction');
|
||||||
html += "<br/>";
|
html += '<br/>';
|
||||||
}
|
}
|
||||||
html += "</div>"
|
html += '</div>';
|
||||||
}
|
}
|
||||||
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;
|
var labelKey;
|
||||||
if (options.includeFiles !== true) {
|
if (options.includeFiles !== true) {
|
||||||
labelKey = "LabelFolder";
|
labelKey = 'LabelFolder';
|
||||||
} else {
|
} else {
|
||||||
labelKey = "LabelPath";
|
labelKey = 'LabelPath';
|
||||||
}
|
}
|
||||||
var readOnlyAttribute = options.pathReadOnly ? " readonly" : "";
|
var 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") + '"><i class="material-icons">search</i></button>';
|
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 += "</div>";
|
html += '</div>';
|
||||||
if (!readOnlyAttribute) {
|
if (!readOnlyAttribute) {
|
||||||
html += '<div class="results paperList" style="max-height: 200px; overflow-y: auto;"></div>';
|
html += '<div class="results paperList" style="max-height: 200px; overflow-y: auto;"></div>';
|
||||||
}
|
}
|
||||||
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");
|
html += globalize.translate('LabelOptionalNetworkPathHelp');
|
||||||
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>';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
|
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
@ -144,75 +144,74 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'paper-
|
||||||
function alertText(text) {
|
function alertText(text) {
|
||||||
alertTextWithOptions({
|
alertTextWithOptions({
|
||||||
text: text
|
text: text
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function alertTextWithOptions(options) {
|
function alertTextWithOptions(options) {
|
||||||
require(["alert"], function(alert) {
|
require(['alert'], function(alert) {
|
||||||
alert(options)
|
alert(options);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function validatePath(path, validateWriteable, apiClient) {
|
function validatePath(path, validateWriteable, apiClient) {
|
||||||
return apiClient.ajax({
|
return apiClient.ajax({
|
||||||
type: "POST",
|
type: 'POST',
|
||||||
url: apiClient.getUrl("Environment/ValidatePath"),
|
url: apiClient.getUrl('Environment/ValidatePath'),
|
||||||
data: {
|
data: {
|
||||||
ValidateWriteable: validateWriteable,
|
ValidateWriteable: validateWriteable,
|
||||||
Path: path
|
Path: path
|
||||||
}
|
}
|
||||||
}).catch(function(response) {
|
}).catch(function(response) {
|
||||||
if (response) {
|
if (response) {
|
||||||
// TODO All alerts (across the project), should use Globalize.translate()
|
|
||||||
if (response.status === 404) {
|
if (response.status === 404) {
|
||||||
alertText("The path could not be found. Please ensure the path is valid and try again.");
|
alertText(globalize.translate('PathNotFound'));
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
if (response.status === 500) {
|
if (response.status === 500) {
|
||||||
if (validateWriteable) {
|
if (validateWriteable) {
|
||||||
alertText("Jellyfin Server requires write access to this folder. Please ensure write access and try again.");
|
alertText(globalize.translate('WriteAccessRequired'));
|
||||||
} else {
|
} else {
|
||||||
alertText("The path could not be found. Please ensure the path is valid and try again.")
|
alertText(globalize.translate('PathNotFound'));
|
||||||
}
|
}
|
||||||
return Promise.reject()
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return Promise.resolve()
|
return Promise.resolve();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(content, options, fileOptions) {
|
function initEditor(content, options, fileOptions) {
|
||||||
content.addEventListener("click", function(e) {
|
content.addEventListener('click', function(e) {
|
||||||
var lnkPath = dom.parentWithClass(e.target, "lnkPath");
|
var lnkPath = dom.parentWithClass(e.target, 'lnkPath');
|
||||||
if (lnkPath) {
|
if (lnkPath) {
|
||||||
var path = lnkPath.getAttribute("data-path");
|
var 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 {
|
||||||
refreshDirectoryBrowser(content, path, fileOptions, true)
|
refreshDirectoryBrowser(content, path, fileOptions, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
content.addEventListener("click", function(e) {
|
content.addEventListener('click', function(e) {
|
||||||
if (dom.parentWithClass(e.target, "btnRefreshDirectories")) {
|
if (dom.parentWithClass(e.target, 'btnRefreshDirectories')) {
|
||||||
var path = content.querySelector("#txtDirectoryPickerPath").value;
|
var path = content.querySelector('#txtDirectoryPickerPath').value;
|
||||||
refreshDirectoryBrowser(content, path, fileOptions);
|
refreshDirectoryBrowser(content, path, fileOptions);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
content.addEventListener("change", function(e) {
|
content.addEventListener('change', function(e) {
|
||||||
var txtDirectoryPickerPath = dom.parentWithTag(e.target, "INPUT");
|
var txtDirectoryPickerPath = dom.parentWithTag(e.target, 'INPUT');
|
||||||
if (txtDirectoryPickerPath && "txtDirectoryPickerPath" === txtDirectoryPickerPath.id) {
|
if (txtDirectoryPickerPath && 'txtDirectoryPickerPath' === txtDirectoryPickerPath.id) {
|
||||||
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");
|
var networkSharePath = this.querySelector('#txtNetworkPath');
|
||||||
networkSharePath = networkSharePath ? networkSharePath.value : null;
|
networkSharePath = networkSharePath ? networkSharePath.value : null;
|
||||||
var path = this.querySelector("#txtDirectoryPickerPath").value;
|
var 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();
|
||||||
|
@ -225,11 +224,11 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'paper-
|
||||||
if (options.path) {
|
if (options.path) {
|
||||||
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) {
|
function(result) {
|
||||||
return result.Path || "";
|
return result.Path || '';
|
||||||
}, function() {
|
}, function() {
|
||||||
return "";
|
return '';
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -254,35 +253,35 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'paper-
|
||||||
var systemInfo = responses[0];
|
var systemInfo = responses[0];
|
||||||
var initialPath = responses[1];
|
var initialPath = responses[1];
|
||||||
var dlg = dialogHelper.createDialog({
|
var dlg = dialogHelper.createDialog({
|
||||||
size: "medium-tall",
|
size: 'medium-tall',
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
});
|
});
|
||||||
dlg.classList.add("ui-body-a");
|
dlg.classList.add('ui-body-a');
|
||||||
dlg.classList.add("background-theme-a");
|
dlg.classList.add('background-theme-a');
|
||||||
dlg.classList.add("directoryPicker");
|
dlg.classList.add('directoryPicker');
|
||||||
dlg.classList.add("formDialog");
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
var html = "";
|
var html = '';
|
||||||
html += '<div class="formDialogHeader">';
|
html += '<div class="formDialogHeader">';
|
||||||
html += '<button is="paper-icon-button-light" class="btnCloseDialog autoSize" tabindex="-1"><i class="material-icons arrow_back"></i></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">';
|
||||||
html += options.header || Globalize.translate("HeaderSelectPath");
|
html += options.header || globalize.translate('HeaderSelectPath');
|
||||||
html += "</h3>";
|
html += '</h3>';
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
html += getEditorHtml(options, systemInfo);
|
html += getEditorHtml(options, systemInfo);
|
||||||
dlg.innerHTML = html;
|
dlg.innerHTML = html;
|
||||||
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', function() {
|
||||||
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");
|
var txtNetworkPath = dlg.querySelector('#txtNetworkPath');
|
||||||
if (txtNetworkPath) {
|
if (txtNetworkPath) {
|
||||||
txtNetworkPath.value = options.networkSharePath || "";
|
txtNetworkPath.value = options.networkSharePath || '';
|
||||||
}
|
}
|
||||||
if (!options.pathReadOnly) {
|
if (!options.pathReadOnly) {
|
||||||
refreshDirectoryBrowser(dlg, initialPath, fileOptions, true);
|
refreshDirectoryBrowser(dlg, initialPath, fileOptions, true);
|
||||||
|
@ -294,9 +293,9 @@ define(['loading', 'dialogHelper', 'dom', 'listViewStyle', 'emby-input', 'paper-
|
||||||
if (currentDialog) {
|
if (currentDialog) {
|
||||||
dialogHelper.close(currentDialog);
|
dialogHelper.close(currentDialog);
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var systemInfo;
|
var systemInfo;
|
||||||
return directoryBrowser
|
return directoryBrowser;
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
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) {
|
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) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
function fillThemes(select, isDashboard) {
|
function fillThemes(select, isDashboard) {
|
||||||
select.innerHTML = skinManager.getThemes().map(function (t) {
|
select.innerHTML = skinManager.getThemes().map(function (t) {
|
||||||
|
@ -186,6 +186,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
context.querySelector('#selectLanguage').value = userSettings.language() || '';
|
context.querySelector('#selectLanguage').value = userSettings.language() || '';
|
||||||
context.querySelector('.selectDateTimeLocale').value = userSettings.dateTimeLocale() || '';
|
context.querySelector('.selectDateTimeLocale').value = userSettings.dateTimeLocale() || '';
|
||||||
|
|
||||||
|
context.querySelector('#txtLibraryPageSize').value = userSettings.libraryPageSize();
|
||||||
|
|
||||||
selectDashboardTheme.value = userSettings.dashboardTheme() || '';
|
selectDashboardTheme.value = userSettings.dashboardTheme() || '';
|
||||||
selectTheme.value = userSettings.theme() || '';
|
selectTheme.value = userSettings.theme() || '';
|
||||||
|
|
||||||
|
@ -215,6 +217,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
userSettingsInstance.soundEffects(context.querySelector('.selectSoundEffects').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.skin(context.querySelector('.selectSkin').value);
|
userSettingsInstance.skin(context.querySelector('.selectSkin').value);
|
||||||
|
|
||||||
userSettingsInstance.enableFastFadein(context.querySelector('#chkFadein').checked);
|
userSettingsInstance.enableFastFadein(context.querySelector('#chkFadein').checked);
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
|
|
||||||
<div class="selectContainer fldDateTimeLocale hide">
|
<div class="selectContainer fldDateTimeLocale hide">
|
||||||
<select is="emby-select" class="selectDateTimeLocale" label="${LabelDateTimeLocale}">
|
<select is="emby-select" class="selectDateTimeLocale" label="${LabelDateTimeLocale}">
|
||||||
<option value="">${AutoBasedOnLanguageSetting}</option>
|
<option value="">${Auto}</option>
|
||||||
<option value="ar">Arabic</option>
|
<option value="ar">Arabic</option>
|
||||||
<option value="be-BY">Belarusian (Belarus)</option>
|
<option value="be-BY">Belarusian (Belarus)</option>
|
||||||
<option value="bg-BG">Bulgarian (Bulgaria)</option>
|
<option value="bg-BG">Bulgarian (Bulgaria)</option>
|
||||||
|
@ -143,6 +143,11 @@
|
||||||
<select is="emby-select" class="selectSoundEffects" label="${LabelSoundEffects}"></select>
|
<select is="emby-select" class="selectSoundEffects" label="${LabelSoundEffects}"></select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="inputContainer inputContainer-withDescription fldFadein">
|
||||||
|
<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>
|
||||||
|
|
||||||
<div class="checkboxContainer checkboxContainer-withDescription fldFadein">
|
<div class="checkboxContainer checkboxContainer-withDescription fldFadein">
|
||||||
<label>
|
<label>
|
||||||
<input type="checkbox" is="emby-checkbox" id="chkFadein" />
|
<input type="checkbox" is="emby-checkbox" id="chkFadein" />
|
||||||
|
|
|
@ -1,181 +0,0 @@
|
||||||
define([], function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function parentWithAttribute(elem, name, value) {
|
|
||||||
|
|
||||||
while ((value ? elem.getAttribute(name) !== value : !elem.getAttribute(name))) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem || !elem.getAttribute) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parentWithTag(elem, tagNames) {
|
|
||||||
|
|
||||||
// accept both string and array passed in
|
|
||||||
if (!Array.isArray(tagNames)) {
|
|
||||||
tagNames = [tagNames];
|
|
||||||
}
|
|
||||||
|
|
||||||
while (tagNames.indexOf(elem.tagName || '') === -1) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function containsAnyClass(classList, classNames) {
|
|
||||||
|
|
||||||
for (var i = 0, length = classNames.length; i < length; i++) {
|
|
||||||
if (classList.contains(classNames[i])) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
function parentWithClass(elem, classNames) {
|
|
||||||
|
|
||||||
// accept both string and array passed in
|
|
||||||
if (!Array.isArray(classNames)) {
|
|
||||||
classNames = [classNames];
|
|
||||||
}
|
|
||||||
|
|
||||||
while (!elem.classList || !containsAnyClass(elem.classList, classNames)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
var supportsCaptureOption = false;
|
|
||||||
try {
|
|
||||||
var opts = Object.defineProperty({}, 'capture', {
|
|
||||||
get: function () {
|
|
||||||
supportsCaptureOption = true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
window.addEventListener("test", null, opts);
|
|
||||||
} catch (e) {
|
|
||||||
console.log('error checking capture support');
|
|
||||||
}
|
|
||||||
|
|
||||||
function addEventListenerWithOptions(target, type, handler, options) {
|
|
||||||
var optionsOrCapture = options;
|
|
||||||
if (!supportsCaptureOption) {
|
|
||||||
optionsOrCapture = options.capture;
|
|
||||||
}
|
|
||||||
target.addEventListener(type, handler, optionsOrCapture);
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeEventListenerWithOptions(target, type, handler, options) {
|
|
||||||
var optionsOrCapture = options;
|
|
||||||
if (!supportsCaptureOption) {
|
|
||||||
optionsOrCapture = options.capture;
|
|
||||||
}
|
|
||||||
target.removeEventListener(type, handler, optionsOrCapture);
|
|
||||||
}
|
|
||||||
|
|
||||||
var windowSize;
|
|
||||||
var windowSizeEventsBound;
|
|
||||||
function clearWindowSize() {
|
|
||||||
windowSize = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
function getWindowSize() {
|
|
||||||
if (!windowSize) {
|
|
||||||
windowSize = {
|
|
||||||
innerHeight: window.innerHeight,
|
|
||||||
innerWidth: window.innerWidth
|
|
||||||
};
|
|
||||||
|
|
||||||
if (!windowSizeEventsBound) {
|
|
||||||
windowSizeEventsBound = true;
|
|
||||||
addEventListenerWithOptions(window, "orientationchange", clearWindowSize, { passive: true });
|
|
||||||
addEventListenerWithOptions(window, 'resize', clearWindowSize, { passive: true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return windowSize;
|
|
||||||
}
|
|
||||||
|
|
||||||
var _animationEvent;
|
|
||||||
function whichAnimationEvent() {
|
|
||||||
|
|
||||||
if (_animationEvent) {
|
|
||||||
return _animationEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
var t;
|
|
||||||
var el = document.createElement("div");
|
|
||||||
var animations = {
|
|
||||||
"animation": "animationend",
|
|
||||||
"OAnimation": "oAnimationEnd",
|
|
||||||
"MozAnimation": "animationend",
|
|
||||||
"WebkitAnimation": "webkitAnimationEnd"
|
|
||||||
};
|
|
||||||
for (t in animations) {
|
|
||||||
if (el.style[t] !== undefined) {
|
|
||||||
_animationEvent = animations[t];
|
|
||||||
return animations[t];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_animationEvent = 'animationend';
|
|
||||||
return _animationEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
function whichAnimationCancelEvent() {
|
|
||||||
|
|
||||||
return whichAnimationEvent().replace('animationend', 'animationcancel').replace('AnimationEnd', 'AnimationCancel');
|
|
||||||
}
|
|
||||||
|
|
||||||
var _transitionEvent;
|
|
||||||
function whichTransitionEvent() {
|
|
||||||
if (_transitionEvent) {
|
|
||||||
return _transitionEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
var t;
|
|
||||||
var el = document.createElement("div");
|
|
||||||
var transitions = {
|
|
||||||
"transition": "transitionend",
|
|
||||||
"OTransition": "oTransitionEnd",
|
|
||||||
"MozTransition": "transitionend",
|
|
||||||
"WebkitTransition": "webkitTransitionEnd"
|
|
||||||
};
|
|
||||||
for (t in transitions) {
|
|
||||||
if (el.style[t] !== undefined) {
|
|
||||||
_transitionEvent = transitions[t];
|
|
||||||
return transitions[t];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
_transitionEvent = 'transitionend';
|
|
||||||
return _transitionEvent;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
|
||||||
parentWithAttribute: parentWithAttribute,
|
|
||||||
parentWithClass: parentWithClass,
|
|
||||||
parentWithTag: parentWithTag,
|
|
||||||
addEventListener: addEventListenerWithOptions,
|
|
||||||
removeEventListener: removeEventListenerWithOptions,
|
|
||||||
getWindowSize: getWindowSize,
|
|
||||||
whichTransitionEvent: whichTransitionEvent,
|
|
||||||
whichAnimationEvent: whichAnimationEvent,
|
|
||||||
whichAnimationCancelEvent: whichAnimationCancelEvent
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -1,41 +1,41 @@
|
||||||
define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoader", "globalize", "layoutManager", "scrollStyles", "emby-itemscontainer"], function (loading, libraryBrowser, cardBuilder, dom, appHost, imageLoader, globalize, layoutManager) {
|
define(['loading', 'libraryBrowser', 'cardBuilder', 'dom', 'apphost', 'imageLoader', 'globalize', 'layoutManager', 'scrollStyles', 'emby-itemscontainer'], function (loading, libraryBrowser, cardBuilder, dom, appHost, imageLoader, globalize, layoutManager) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
function enableScrollX() {
|
function enableScrollX() {
|
||||||
return !layoutManager.desktop;
|
return !layoutManager.desktop;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getThumbShape() {
|
function getThumbShape() {
|
||||||
return enableScrollX() ? "overflowBackdrop" : "backdrop";
|
return enableScrollX() ? 'overflowBackdrop' : 'backdrop';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPosterShape() {
|
function getPosterShape() {
|
||||||
return enableScrollX() ? "overflowPortrait" : "portrait";
|
return enableScrollX() ? 'overflowPortrait' : 'portrait';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSquareShape() {
|
function getSquareShape() {
|
||||||
return enableScrollX() ? "overflowSquare" : "square";
|
return enableScrollX() ? 'overflowSquare' : 'square';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSections() {
|
function getSections() {
|
||||||
return [{
|
return [{
|
||||||
name: "HeaderFavoriteMovies",
|
name: 'HeaderFavoriteMovies',
|
||||||
types: "Movie",
|
types: 'Movie',
|
||||||
id: "favoriteMovies",
|
id: 'favoriteMovies',
|
||||||
shape: getPosterShape(),
|
shape: getPosterShape(),
|
||||||
showTitle: false,
|
showTitle: false,
|
||||||
overlayPlayButton: true
|
overlayPlayButton: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteShows",
|
name: 'HeaderFavoriteShows',
|
||||||
types: "Series",
|
types: 'Series',
|
||||||
id: "favoriteShows",
|
id: 'favoriteShows',
|
||||||
shape: getPosterShape(),
|
shape: getPosterShape(),
|
||||||
showTitle: false,
|
showTitle: false,
|
||||||
overlayPlayButton: true
|
overlayPlayButton: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteEpisodes",
|
name: 'HeaderFavoriteEpisodes',
|
||||||
types: "Episode",
|
types: 'Episode',
|
||||||
id: "favoriteEpisode",
|
id: 'favoriteEpisode',
|
||||||
shape: getThumbShape(),
|
shape: getThumbShape(),
|
||||||
preferThumb: false,
|
preferThumb: false,
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
|
@ -44,9 +44,9 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
overlayText: false,
|
overlayText: false,
|
||||||
centerText: true
|
centerText: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteVideos",
|
name: 'HeaderFavoriteVideos',
|
||||||
types: "Video,MusicVideo",
|
types: 'Video,MusicVideo',
|
||||||
id: "favoriteVideos",
|
id: 'favoriteVideos',
|
||||||
shape: getThumbShape(),
|
shape: getThumbShape(),
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
|
@ -54,9 +54,9 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
overlayText: false,
|
overlayText: false,
|
||||||
centerText: true
|
centerText: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteArtists",
|
name: 'HeaderFavoriteArtists',
|
||||||
types: "MusicArtist",
|
types: 'MusicArtist',
|
||||||
id: "favoriteArtists",
|
id: 'favoriteArtists',
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
preferThumb: false,
|
preferThumb: false,
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
|
@ -66,9 +66,9 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
overlayPlayButton: true,
|
overlayPlayButton: true,
|
||||||
coverImage: true
|
coverImage: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteAlbums",
|
name: 'HeaderFavoriteAlbums',
|
||||||
types: "MusicAlbum",
|
types: 'MusicAlbum',
|
||||||
id: "favoriteAlbums",
|
id: 'favoriteAlbums',
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
preferThumb: false,
|
preferThumb: false,
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
|
@ -78,9 +78,9 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
overlayPlayButton: true,
|
overlayPlayButton: true,
|
||||||
coverImage: true
|
coverImage: true
|
||||||
}, {
|
}, {
|
||||||
name: "HeaderFavoriteSongs",
|
name: 'HeaderFavoriteSongs',
|
||||||
types: "Audio",
|
types: 'Audio',
|
||||||
id: "favoriteSongs",
|
id: 'favoriteSongs',
|
||||||
shape: getSquareShape(),
|
shape: getSquareShape(),
|
||||||
preferThumb: false,
|
preferThumb: false,
|
||||||
showTitle: true,
|
showTitle: true,
|
||||||
|
@ -88,7 +88,7 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
showParentTitle: true,
|
showParentTitle: true,
|
||||||
centerText: true,
|
centerText: true,
|
||||||
overlayMoreButton: true,
|
overlayMoreButton: true,
|
||||||
action: "instantmix",
|
action: 'instantmix',
|
||||||
coverImage: true
|
coverImage: true
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
@ -96,13 +96,13 @@ 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;
|
var screenWidth = dom.getWindowSize().innerWidth;
|
||||||
var options = {
|
var options = {
|
||||||
SortBy: "SortName",
|
SortBy: 'SortName',
|
||||||
SortOrder: "Ascending",
|
SortOrder: 'Ascending',
|
||||||
Filters: "IsFavorite",
|
Filters: 'IsFavorite',
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
CollapseBoxSetItems: false,
|
CollapseBoxSetItems: false,
|
||||||
ExcludeLocationTypes: "Virtual",
|
ExcludeLocationTypes: 'Virtual',
|
||||||
EnableTotalRecordCount: false
|
EnableTotalRecordCount: false
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
|
|
||||||
var promise;
|
var promise;
|
||||||
|
|
||||||
if ("MusicArtist" === section.types) {
|
if ('MusicArtist' === section.types) {
|
||||||
promise = ApiClient.getArtists(userId, options);
|
promise = ApiClient.getArtists(userId, options);
|
||||||
} else {
|
} else {
|
||||||
options.IncludeItemTypes = section.types;
|
options.IncludeItemTypes = section.types;
|
||||||
|
@ -128,25 +128,25 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
}
|
}
|
||||||
|
|
||||||
return promise.then(function (result) {
|
return promise.then(function (result) {
|
||||||
var html = "";
|
var 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) {
|
||||||
html += '<a is="emby-linkbutton" href="' + ("list.html?serverId=" + ApiClient.serverId() + "&type=" + section.types + "&IsFavorite=true") + '" class="more button-flat button-flat-mini sectionTitleTextButton">';
|
html += '<a is="emby-linkbutton" href="' + ('list.html?serverId=' + ApiClient.serverId() + '&type=' + section.types + '&IsFavorite=true') + '" class="more button-flat button-flat-mini sectionTitleTextButton">';
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
||||||
html += globalize.translate(section.name);
|
html += globalize.translate(section.name);
|
||||||
html += "</h2>";
|
html += '</h2>';
|
||||||
html += '<i class="material-icons chevron_right"></i>';
|
html += '<span class="material-icons chevron_right"></span>';
|
||||||
html += "</a>";
|
html += '</a>';
|
||||||
} else {
|
} else {
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate(section.name) + "</h2>";
|
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate(section.name) + '</h2>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
var scrollXClass = "scrollX hiddenScrollX";
|
var scrollXClass = 'scrollX hiddenScrollX';
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollXClass += " smoothScrollX";
|
scrollXClass += ' smoothScrollX';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer ' + scrollXClass + ' padded-left padded-right">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer ' + scrollXClass + ' padded-left padded-right">';
|
||||||
|
@ -154,7 +154,7 @@ 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");
|
var supportsImageAnalysis = appHost.supports('imageanalysis');
|
||||||
var cardLayout = (appHost.preferVisualCards || supportsImageAnalysis) && 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, {
|
||||||
|
@ -172,7 +172,7 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
allowBottomPadding: !enableScrollX(),
|
allowBottomPadding: !enableScrollX(),
|
||||||
cardLayout: cardLayout
|
cardLayout: cardLayout
|
||||||
});
|
});
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
@ -183,7 +183,7 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
function loadSections(page, userId, topParentId, types) {
|
function loadSections(page, userId, topParentId, types) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var sections = getSections();
|
var sections = getSections();
|
||||||
var sectionid = getParameterByName("sectionid");
|
var sectionid = getParameterByName('sectionid');
|
||||||
|
|
||||||
if (sectionid) {
|
if (sectionid) {
|
||||||
sections = sections.filter(function (s) {
|
sections = sections.filter(function (s) {
|
||||||
|
@ -199,10 +199,10 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
|
|
||||||
var i;
|
var i;
|
||||||
var length;
|
var length;
|
||||||
var elem = page.querySelector(".favoriteSections");
|
var elem = page.querySelector('.favoriteSections');
|
||||||
|
|
||||||
if (!elem.innerHTML) {
|
if (!elem.innerHTML) {
|
||||||
var html = "";
|
var html = '';
|
||||||
|
|
||||||
for (i = 0, length = sections.length; i < length; i++) {
|
for (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>';
|
||||||
|
@ -215,7 +215,7 @@ define(["loading", "libraryBrowser", "cardBuilder", "dom", "apphost", "imageLoad
|
||||||
|
|
||||||
for (i = 0, length = sections.length; i < length; i++) {
|
for (i = 0, length = sections.length; i < length; i++) {
|
||||||
var section = sections[i];
|
var 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, 1 === sections.length));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,7 @@ define([], function () {
|
||||||
|
|
||||||
function fetchWithTimeout(url, options, timeoutMs) {
|
function fetchWithTimeout(url, options, timeoutMs) {
|
||||||
|
|
||||||
console.log('fetchWithTimeout: timeoutMs: ' + timeoutMs + ', url: ' + url);
|
console.debug('fetchWithTimeout: timeoutMs: ' + timeoutMs + ', url: ' + url);
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
|
@ -63,14 +63,14 @@ define([], function () {
|
||||||
fetch(url, options).then(function (response) {
|
fetch(url, options).then(function (response) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
||||||
console.log('fetchWithTimeout: succeeded connecting to url: ' + url);
|
console.debug('fetchWithTimeout: succeeded connecting to url: ' + url);
|
||||||
|
|
||||||
resolve(response);
|
resolve(response);
|
||||||
}, function (error) {
|
}, function (error) {
|
||||||
|
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
|
|
||||||
console.log('fetchWithTimeout: timed out connecting to url: ' + url);
|
console.debug('fetchWithTimeout: timed out connecting to url: ' + url);
|
||||||
|
|
||||||
reject();
|
reject();
|
||||||
});
|
});
|
||||||
|
@ -86,28 +86,24 @@ define([], function () {
|
||||||
var value = params[key];
|
var value = params[key];
|
||||||
|
|
||||||
if (value !== null && value !== undefined && value !== '') {
|
if (value !== null && value !== undefined && value !== '') {
|
||||||
values.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
|
values.push(encodeURIComponent(key) + '=' + encodeURIComponent(value));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return values.join('&');
|
return values.join('&');
|
||||||
}
|
}
|
||||||
|
|
||||||
function ajax(request) {
|
function ajax(request) {
|
||||||
|
|
||||||
if (!request) {
|
if (!request) {
|
||||||
throw new Error("Request cannot be null");
|
throw new Error('Request cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
request.headers = request.headers || {};
|
request.headers = request.headers || {};
|
||||||
|
|
||||||
console.log('requesting url: ' + request.url);
|
console.debug('requesting url: ' + request.url);
|
||||||
|
|
||||||
return getFetchPromise(request).then(function (response) {
|
return getFetchPromise(request).then(function (response) {
|
||||||
|
console.debug('response status: ' + response.status + ', url: ' + request.url);
|
||||||
console.log('response status: ' + response.status + ', url: ' + request.url);
|
|
||||||
|
|
||||||
if (response.status < 400) {
|
if (response.status < 400) {
|
||||||
|
|
||||||
if (request.dataType === 'json' || request.headers.accept === 'application/json') {
|
if (request.dataType === 'json' || request.headers.accept === 'application/json') {
|
||||||
return response.json();
|
return response.json();
|
||||||
} else if (request.dataType === 'text' || (response.headers.get('Content-Type') || '').toLowerCase().indexOf('text/') === 0) {
|
} else if (request.dataType === 'text' || (response.headers.get('Content-Type') || '').toLowerCase().indexOf('text/') === 0) {
|
||||||
|
@ -118,10 +114,8 @@ define([], function () {
|
||||||
} else {
|
} else {
|
||||||
return Promise.reject(response);
|
return Promise.reject(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, function (err) {
|
}, function (err) {
|
||||||
|
console.error('request failed to url: ' + request.url);
|
||||||
console.log('request failed to url: ' + request.url);
|
|
||||||
throw err;
|
throw err;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -129,4 +123,4 @@ define([], function () {
|
||||||
getFetchPromise: getFetchPromise,
|
getFetchPromise: getFetchPromise,
|
||||||
ajax: ajax
|
ajax: ajax
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,18 +1,14 @@
|
||||||
define(['multi-download'], function (multiDownload) {
|
import multiDownload from 'multi-download';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
return {
|
export function download(items) {
|
||||||
download: function (items) {
|
|
||||||
|
|
||||||
if (window.NativeShell) {
|
if (window.NativeShell) {
|
||||||
items.map(function (item) {
|
items.map(function (item) {
|
||||||
window.NativeShell.downloadFile(item.url);
|
window.NativeShell.downloadFile(item);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
multiDownload(items.map(function (item) {
|
multiDownload(items.map(function (item) {
|
||||||
return item.url;
|
return item.url;
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,18 +0,0 @@
|
||||||
define([], function () {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
return {
|
|
||||||
fileExists: function (path) {
|
|
||||||
if (window.NativeShell && window.NativeShell.FileSystem) {
|
|
||||||
return window.NativeShell.FileSystem.fileExists(path);
|
|
||||||
}
|
|
||||||
return Promise.reject();
|
|
||||||
},
|
|
||||||
directoryExists: function (path) {
|
|
||||||
if (window.NativeShell && window.NativeShell.FileSystem) {
|
|
||||||
return window.NativeShell.FileSystem.directoryExists(path);
|
|
||||||
}
|
|
||||||
return Promise.reject();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -1,52 +1,49 @@
|
||||||
define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "require", "emby-checkbox", "emby-collapse", "css!./style"], function (dialogHelper, globalize, connectionManager, events, browser, require) {
|
define(['dom', 'dialogHelper', 'globalize', 'connectionManager', 'events', 'browser', 'require', 'emby-checkbox', 'emby-collapse', 'css!./style'], function (dom, dialogHelper, globalize, connectionManager, events, browser, require) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
|
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
|
||||||
var 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 = "";
|
var html = '';
|
||||||
html += '<div class="checkboxList">';
|
html += '<div class="checkboxList">';
|
||||||
html += items.map(function (filter) {
|
html += items.map(function (filter) {
|
||||||
var itemHtml = "";
|
var itemHtml = '';
|
||||||
var checkedHtml = isCheckedFn(filter) ? " checked" : "";
|
var checkedHtml = isCheckedFn(filter) ? ' checked' : '';
|
||||||
itemHtml += "<label>";
|
itemHtml += '<label>';
|
||||||
itemHtml += '<input is="emby-checkbox" type="checkbox"' + checkedHtml + ' data-filter="' + filter + '" class="' + cssClass + '"/>';
|
itemHtml += '<input is="emby-checkbox" type="checkbox"' + checkedHtml + ' data-filter="' + filter + '" class="' + cssClass + '"/>';
|
||||||
itemHtml += "<span>" + filter + "</span>";
|
itemHtml += '<span>' + filter + '</span>';
|
||||||
itemHtml += "</label>";
|
itemHtml += '</label>';
|
||||||
return itemHtml;
|
return itemHtml;
|
||||||
}).join("");
|
}).join('');
|
||||||
html += "</div>";
|
html += '</div>';
|
||||||
elem.querySelector(".filterOptions").innerHTML = html;
|
elem.querySelector('.filterOptions').innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderFilters(context, result, query) {
|
function renderFilters(context, result, query) {
|
||||||
if (result.Tags) {
|
renderOptions(context, '.genreFilters', 'chkGenreFilter', result.Genres, function (i) {
|
||||||
result.Tags.length = Math.min(result.Tags.length, 50);
|
var delimeter = '|';
|
||||||
}
|
return (delimeter + (query.Genres || '') + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
||||||
renderOptions(context, ".genreFilters", "chkGenreFilter", result.Genres, function (i) {
|
|
||||||
var delimeter = "|";
|
|
||||||
return (delimeter + (query.Genres || "") + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
|
||||||
});
|
});
|
||||||
renderOptions(context, ".officialRatingFilters", "chkOfficialRatingFilter", result.OfficialRatings, function (i) {
|
renderOptions(context, '.officialRatingFilters', 'chkOfficialRatingFilter', result.OfficialRatings, function (i) {
|
||||||
var delimeter = "|";
|
var delimeter = '|';
|
||||||
return (delimeter + (query.OfficialRatings || "") + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
return (delimeter + (query.OfficialRatings || '') + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
||||||
});
|
});
|
||||||
renderOptions(context, ".tagFilters", "chkTagFilter", result.Tags, function (i) {
|
renderOptions(context, '.tagFilters', 'chkTagFilter', result.Tags, function (i) {
|
||||||
var delimeter = "|";
|
var delimeter = '|';
|
||||||
return (delimeter + (query.Tags || "") + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
return (delimeter + (query.Tags || '') + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
||||||
});
|
});
|
||||||
renderOptions(context, ".yearFilters", "chkYearFilter", result.Years, function (i) {
|
renderOptions(context, '.yearFilters', 'chkYearFilter', result.Years, function (i) {
|
||||||
var delimeter = ",";
|
var delimeter = ',';
|
||||||
return (delimeter + (query.Years || "") + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
return (delimeter + (query.Years || '') + delimeter).indexOf(delimeter + i + delimeter) != -1;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadDynamicFilters(context, apiClient, userId, itemQuery) {
|
function loadDynamicFilters(context, apiClient, userId, itemQuery) {
|
||||||
return apiClient.getJSON(apiClient.getUrl("Items/Filters", {
|
return apiClient.getJSON(apiClient.getUrl('Items/Filters', {
|
||||||
UserId: userId,
|
UserId: userId,
|
||||||
ParentId: itemQuery.ParentId,
|
ParentId: itemQuery.ParentId,
|
||||||
IncludeItemTypes: itemQuery.IncludeItemTypes
|
IncludeItemTypes: itemQuery.IncludeItemTypes
|
||||||
|
@ -61,108 +58,98 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
var length;
|
var length;
|
||||||
var query = options.query;
|
var query = options.query;
|
||||||
|
|
||||||
if (options.mode == "livetvchannels") {
|
if (options.mode == 'livetvchannels') {
|
||||||
context.querySelector(".chkFavorite").checked = query.IsFavorite == true;
|
context.querySelector('.chkFavorite').checked = query.IsFavorite == true;
|
||||||
context.querySelector(".chkLikes").checked = query.IsLiked == true;
|
context.querySelector('.chkLikes').checked = query.IsLiked == true;
|
||||||
context.querySelector(".chkDislikes").checked = query.IsDisliked == true;
|
context.querySelector('.chkDislikes').checked = query.IsDisliked == true;
|
||||||
} else {
|
} else {
|
||||||
elems = context.querySelectorAll(".chkStandardFilter");
|
elems = context.querySelectorAll('.chkStandardFilter');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
var chkStandardFilter = elems[i];
|
var chkStandardFilter = elems[i];
|
||||||
var filters = "," + (query.Filters || "");
|
var filters = ',' + (query.Filters || '');
|
||||||
var filterName = chkStandardFilter.getAttribute("data-filter");
|
var filterName = chkStandardFilter.getAttribute('data-filter');
|
||||||
chkStandardFilter.checked = filters.indexOf("," + filterName) != -1;
|
chkStandardFilter.checked = filters.indexOf(',' + filterName) != -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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++) {
|
||||||
var chkVideoTypeFilter = elems[i];
|
var chkVideoTypeFilter = elems[i];
|
||||||
var filters = "," + (query.VideoTypes || "");
|
var filters = ',' + (query.VideoTypes || '');
|
||||||
var filterName = chkVideoTypeFilter.getAttribute("data-filter");
|
var filterName = chkVideoTypeFilter.getAttribute('data-filter');
|
||||||
chkVideoTypeFilter.checked = filters.indexOf("," + filterName) != -1;
|
chkVideoTypeFilter.checked = filters.indexOf(',' + filterName) != -1;
|
||||||
}
|
}
|
||||||
context.querySelector(".chk3DFilter").checked = query.Is3D == true;
|
context.querySelector('.chk3DFilter').checked = query.Is3D == true;
|
||||||
context.querySelector(".chkHDFilter").checked = query.IsHD == true;
|
context.querySelector('.chkHDFilter').checked = query.IsHD == true;
|
||||||
context.querySelector(".chk4KFilter").checked = query.Is4K == true;
|
context.querySelector('.chk4KFilter').checked = query.Is4K == true;
|
||||||
context.querySelector(".chkSDFilter").checked = query.IsHD == true;
|
context.querySelector('.chkSDFilter').checked = query.IsHD == true;
|
||||||
context.querySelector("#chkSubtitle").checked = query.HasSubtitles == true;
|
context.querySelector('#chkSubtitle').checked = query.HasSubtitles == true;
|
||||||
context.querySelector("#chkTrailer").checked = query.HasTrailer == true;
|
context.querySelector('#chkTrailer').checked = query.HasTrailer == true;
|
||||||
context.querySelector("#chkThemeSong").checked = query.HasThemeSong == true;
|
context.querySelector('#chkThemeSong').checked = query.HasThemeSong == true;
|
||||||
context.querySelector("#chkThemeVideo").checked = query.HasThemeVideo == true;
|
context.querySelector('#chkThemeVideo').checked = query.HasThemeVideo == true;
|
||||||
context.querySelector("#chkSpecialFeature").checked = query.HasSpecialFeature == true;
|
context.querySelector('#chkSpecialFeature').checked = query.HasSpecialFeature == true;
|
||||||
context.querySelector("#chkSpecialEpisode").checked = query.ParentIndexNumber == 0;
|
context.querySelector('#chkSpecialEpisode').checked = query.ParentIndexNumber == 0;
|
||||||
context.querySelector("#chkMissingEpisode").checked = query.IsMissing == true;
|
context.querySelector('#chkMissingEpisode').checked = query.IsMissing == true;
|
||||||
context.querySelector("#chkFutureEpisode").checked = query.IsUnaired == true;
|
context.querySelector('#chkFutureEpisode').checked = query.IsUnaired == true;
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
var chkStatus = elems[i];
|
var chkStatus = elems[i];
|
||||||
var filters = "," + (query.SeriesStatus || "");
|
var filters = ',' + (query.SeriesStatus || '');
|
||||||
var filterName = chkStatus.getAttribute("data-filter");
|
var filterName = chkStatus.getAttribute('data-filter');
|
||||||
chkStatus.checked = filters.indexOf("," + filterName) != -1;
|
chkStatus.checked = filters.indexOf(',' + filterName) != -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerChange(instance) {
|
function triggerChange(instance) {
|
||||||
events.trigger(instance, "filterchange");
|
events.trigger(instance, 'filterchange');
|
||||||
}
|
|
||||||
|
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return elem;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function setVisibility(context, options) {
|
function setVisibility(context, options) {
|
||||||
if (options.mode == "livetvchannels" || options.mode == "albums" || options.mode == "artists" || options.mode == "albumartists" || options.mode == "songs") {
|
if (options.mode == 'livetvchannels' || options.mode == 'albums' || options.mode == 'artists' || options.mode == 'albumartists' || options.mode == 'songs') {
|
||||||
hideByClass(context, "videoStandard");
|
hideByClass(context, 'videoStandard');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enableDynamicFilters(options.mode)) {
|
if (enableDynamicFilters(options.mode)) {
|
||||||
context.querySelector(".genreFilters").classList.remove("hide");
|
context.querySelector('.genreFilters').classList.remove('hide');
|
||||||
context.querySelector(".officialRatingFilters").classList.remove("hide");
|
context.querySelector('.officialRatingFilters').classList.remove('hide');
|
||||||
context.querySelector(".tagFilters").classList.remove("hide");
|
context.querySelector('.tagFilters').classList.remove('hide');
|
||||||
context.querySelector(".yearFilters").classList.remove("hide");
|
context.querySelector('.yearFilters').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.mode == "movies" || options.mode == "episodes") {
|
if (options.mode == 'movies' || options.mode == 'episodes') {
|
||||||
context.querySelector(".videoTypeFilters").classList.remove("hide");
|
context.querySelector('.videoTypeFilters').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.mode == "movies" || options.mode == "series" || options.mode == "episodes") {
|
if (options.mode == 'movies' || options.mode == 'series' || options.mode == 'episodes') {
|
||||||
context.querySelector(".features").classList.remove("hide");
|
context.querySelector('.features').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.mode == "series") {
|
if (options.mode == 'series') {
|
||||||
context.querySelector(".seriesStatus").classList.remove("hide");
|
context.querySelector('.seriesStatus').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.mode == "episodes") {
|
if (options.mode == 'episodes') {
|
||||||
showByClass(context, "episodeFilter");
|
showByClass(context, 'episodeFilter');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showByClass(context, className) {
|
function showByClass(context, className) {
|
||||||
var elems = context.querySelectorAll("." + className);
|
var elems = context.querySelectorAll('.' + className);
|
||||||
|
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
for (var i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].classList.remove("hide");
|
elems[i].classList.remove('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function hideByClass(context, className) {
|
function hideByClass(context, className) {
|
||||||
var elems = context.querySelectorAll("." + className);
|
var elems = context.querySelectorAll('.' + className);
|
||||||
|
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
for (var i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].classList.add("hide");
|
elems[i].classList.add('hide');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableDynamicFilters(mode) {
|
function enableDynamicFilters(mode) {
|
||||||
return mode == "movies" || mode == "series" || mode == "albums" || mode == "albumartists" || mode == "artists" || mode == "songs" || mode == "episodes";
|
return mode == 'movies' || mode == 'series' || mode == 'albums' || mode == 'albumartists' || mode == 'artists' || mode == 'songs' || mode == 'episodes';
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (options) {
|
return function (options) {
|
||||||
|
@ -175,12 +162,12 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
|
|
||||||
function onStandardFilterChange() {
|
function onStandardFilterChange() {
|
||||||
var query = options.query;
|
var query = options.query;
|
||||||
var filterName = this.getAttribute("data-filter");
|
var filterName = this.getAttribute('data-filter');
|
||||||
var filters = query.Filters || "";
|
var filters = query.Filters || '';
|
||||||
filters = ("," + filters).replace("," + filterName, "").substring(1);
|
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
||||||
|
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
filters = filters ? filters + "," + filterName : filterName;
|
filters = filters ? filters + ',' + filterName : filterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
|
@ -190,12 +177,12 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
|
|
||||||
function onVideoTypeFilterChange() {
|
function onVideoTypeFilterChange() {
|
||||||
var query = options.query;
|
var query = options.query;
|
||||||
var filterName = this.getAttribute("data-filter");
|
var filterName = this.getAttribute('data-filter');
|
||||||
var filters = query.VideoTypes || "";
|
var filters = query.VideoTypes || '';
|
||||||
filters = ("," + filters).replace("," + filterName, "").substring(1);
|
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
||||||
|
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
filters = filters ? filters + "," + filterName : filterName;
|
filters = filters ? filters + ',' + filterName : filterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
|
@ -205,12 +192,12 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
|
|
||||||
function onStatusChange() {
|
function onStatusChange() {
|
||||||
var query = options.query;
|
var query = options.query;
|
||||||
var filterName = this.getAttribute("data-filter");
|
var filterName = this.getAttribute('data-filter');
|
||||||
var filters = query.SeriesStatus || "";
|
var filters = query.SeriesStatus || '';
|
||||||
filters = ("," + filters).replace("," + filterName, "").substring(1);
|
filters = (',' + filters).replace(',' + filterName, '').substring(1);
|
||||||
|
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
filters = filters ? filters + "," + filterName : filterName;
|
filters = filters ? filters + ',' + filterName : filterName;
|
||||||
}
|
}
|
||||||
|
|
||||||
query.SeriesStatus = filters;
|
query.SeriesStatus = filters;
|
||||||
|
@ -224,86 +211,86 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
var length;
|
var length;
|
||||||
var query = options.query;
|
var query = options.query;
|
||||||
|
|
||||||
if (options.mode == "livetvchannels") {
|
if (options.mode == 'livetvchannels') {
|
||||||
elems = context.querySelectorAll(".chkFavorite");
|
elems = context.querySelectorAll('.chkFavorite');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].addEventListener("change", onFavoriteChange);
|
elems[i].addEventListener('change', onFavoriteChange);
|
||||||
}
|
}
|
||||||
context.querySelector(".chkLikes").addEventListener("change", function () {
|
context.querySelector('.chkLikes').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.IsLiked = this.checked ? true : null;
|
query.IsLiked = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector(".chkDislikes").addEventListener("change", function () {
|
context.querySelector('.chkDislikes').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.IsDisliked = this.checked ? true : null;
|
query.IsDisliked = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
elems = context.querySelectorAll(".chkStandardFilter");
|
elems = context.querySelectorAll('.chkStandardFilter');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].addEventListener("change", onStandardFilterChange);
|
elems[i].addEventListener('change', onStandardFilterChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
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].addEventListener("change", onVideoTypeFilterChange);
|
elems[i].addEventListener('change', onVideoTypeFilterChange);
|
||||||
}
|
}
|
||||||
context.querySelector(".chk3DFilter").addEventListener("change", function () {
|
context.querySelector('.chk3DFilter').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.Is3D = this.checked ? true : null;
|
query.Is3D = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector(".chk4KFilter").addEventListener("change", function () {
|
context.querySelector('.chk4KFilter').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.Is4K = this.checked ? true : null;
|
query.Is4K = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector(".chkHDFilter").addEventListener("change", function () {
|
context.querySelector('.chkHDFilter').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.IsHD = this.checked ? true : null;
|
query.IsHD = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector(".chkSDFilter").addEventListener("change", function () {
|
context.querySelector('.chkSDFilter').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.IsHD = this.checked ? false : null;
|
query.IsHD = this.checked ? false : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
elems = context.querySelectorAll(".chkStatus");
|
elems = context.querySelectorAll('.chkStatus');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].addEventListener("change", onStatusChange);
|
elems[i].addEventListener('change', onStatusChange);
|
||||||
}
|
}
|
||||||
context.querySelector("#chkTrailer").addEventListener("change", function () {
|
context.querySelector('#chkTrailer').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.HasTrailer = this.checked ? true : null;
|
query.HasTrailer = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector("#chkThemeSong").addEventListener("change", function () {
|
context.querySelector('#chkThemeSong').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.HasThemeSong = this.checked ? true : null;
|
query.HasThemeSong = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector("#chkSpecialFeature").addEventListener("change", function () {
|
context.querySelector('#chkSpecialFeature').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.HasSpecialFeature = this.checked ? true : null;
|
query.HasSpecialFeature = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector("#chkThemeVideo").addEventListener("change", function () {
|
context.querySelector('#chkThemeVideo').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.HasThemeVideo = this.checked ? true : null;
|
query.HasThemeVideo = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector("#chkMissingEpisode").addEventListener("change", function () {
|
context.querySelector('#chkMissingEpisode').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.IsMissing = this.checked ? true : false;
|
query.IsMissing = this.checked ? true : false;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector("#chkSpecialEpisode").addEventListener("change", function () {
|
context.querySelector('#chkSpecialEpisode').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.ParentIndexNumber = this.checked ? 0 : null;
|
query.ParentIndexNumber = this.checked ? 0 : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector("#chkFutureEpisode").addEventListener("change", function () {
|
context.querySelector('#chkFutureEpisode').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
query.IsUnaired = true;
|
query.IsUnaired = true;
|
||||||
|
@ -314,18 +301,18 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
}
|
}
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.querySelector("#chkSubtitle").addEventListener("change", function () {
|
context.querySelector('#chkSubtitle').addEventListener('change', function () {
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
query.HasSubtitles = this.checked ? true : null;
|
query.HasSubtitles = this.checked ? true : null;
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
});
|
});
|
||||||
context.addEventListener("change", function (e) {
|
context.addEventListener('change', function (e) {
|
||||||
var chkGenreFilter = parentWithClass(e.target, "chkGenreFilter");
|
var chkGenreFilter = dom.parentWithClass(e.target, 'chkGenreFilter');
|
||||||
if (chkGenreFilter) {
|
if (chkGenreFilter) {
|
||||||
var filterName = chkGenreFilter.getAttribute("data-filter");
|
var filterName = chkGenreFilter.getAttribute('data-filter');
|
||||||
var filters = query.Genres || "";
|
var filters = query.Genres || '';
|
||||||
var delimiter = "|";
|
var delimiter = '|';
|
||||||
filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1);
|
filters = (delimiter + filters).replace(delimiter + filterName, '').substring(1);
|
||||||
if (chkGenreFilter.checked) {
|
if (chkGenreFilter.checked) {
|
||||||
filters = filters ? (filters + delimiter + filterName) : filterName;
|
filters = filters ? (filters + delimiter + filterName) : filterName;
|
||||||
}
|
}
|
||||||
|
@ -334,12 +321,12 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var chkTagFilter = parentWithClass(e.target, "chkTagFilter");
|
var chkTagFilter = dom.parentWithClass(e.target, 'chkTagFilter');
|
||||||
if (chkTagFilter) {
|
if (chkTagFilter) {
|
||||||
var filterName = chkTagFilter.getAttribute("data-filter");
|
var filterName = chkTagFilter.getAttribute('data-filter');
|
||||||
var filters = query.Tags || "";
|
var filters = query.Tags || '';
|
||||||
var delimiter = "|";
|
var delimiter = '|';
|
||||||
filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1);
|
filters = (delimiter + filters).replace(delimiter + filterName, '').substring(1);
|
||||||
if (chkTagFilter.checked) {
|
if (chkTagFilter.checked) {
|
||||||
filters = filters ? (filters + delimiter + filterName) : filterName;
|
filters = filters ? (filters + delimiter + filterName) : filterName;
|
||||||
}
|
}
|
||||||
|
@ -348,12 +335,12 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var chkYearFilter = parentWithClass(e.target, "chkYearFilter");
|
var chkYearFilter = dom.parentWithClass(e.target, 'chkYearFilter');
|
||||||
if (chkYearFilter) {
|
if (chkYearFilter) {
|
||||||
var filterName = chkYearFilter.getAttribute("data-filter");
|
var filterName = chkYearFilter.getAttribute('data-filter');
|
||||||
var filters = query.Years || "";
|
var filters = query.Years || '';
|
||||||
var delimiter = ",";
|
var delimiter = ',';
|
||||||
filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1);
|
filters = (delimiter + filters).replace(delimiter + filterName, '').substring(1);
|
||||||
if (chkYearFilter.checked) {
|
if (chkYearFilter.checked) {
|
||||||
filters = filters ? (filters + delimiter + filterName) : filterName;
|
filters = filters ? (filters + delimiter + filterName) : filterName;
|
||||||
}
|
}
|
||||||
|
@ -362,12 +349,12 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
triggerChange(self);
|
triggerChange(self);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var chkOfficialRatingFilter = parentWithClass(e.target, "chkOfficialRatingFilter");
|
var chkOfficialRatingFilter = dom.parentWithClass(e.target, 'chkOfficialRatingFilter');
|
||||||
if (chkOfficialRatingFilter) {
|
if (chkOfficialRatingFilter) {
|
||||||
var filterName = chkOfficialRatingFilter.getAttribute("data-filter");
|
var filterName = chkOfficialRatingFilter.getAttribute('data-filter');
|
||||||
var filters = query.OfficialRatings || "";
|
var filters = query.OfficialRatings || '';
|
||||||
var delimiter = "|";
|
var delimiter = '|';
|
||||||
filters = (delimiter + filters).replace(delimiter + filterName, "").substring(1);
|
filters = (delimiter + filters).replace(delimiter + filterName, '').substring(1);
|
||||||
if (chkOfficialRatingFilter.checked) {
|
if (chkOfficialRatingFilter.checked) {
|
||||||
filters = filters ? (filters + delimiter + filterName) : filterName;
|
filters = filters ? (filters + delimiter + filterName) : filterName;
|
||||||
}
|
}
|
||||||
|
@ -383,23 +370,23 @@ define(["dialogHelper", "globalize", "connectionManager", "events", "browser", "
|
||||||
|
|
||||||
self.show = function () {
|
self.show = function () {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
require(["text!./filterdialog.template.html"], function (template) {
|
require(['text!./filterdialog.template.html'], function (template) {
|
||||||
var dlg = dialogHelper.createDialog({
|
var dlg = dialogHelper.createDialog({
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
modal: false
|
modal: false
|
||||||
});
|
});
|
||||||
dlg.classList.add("ui-body-a");
|
dlg.classList.add('ui-body-a');
|
||||||
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.translateDocument(template);
|
||||||
setVisibility(dlg, options);
|
setVisibility(dlg, options);
|
||||||
dialogHelper.open(dlg);
|
dialogHelper.open(dlg);
|
||||||
dlg.addEventListener("close", resolve);
|
dlg.addEventListener('close', resolve);
|
||||||
updateFilterControls(dlg, options);
|
updateFilterControls(dlg, options);
|
||||||
bindEvents(dlg);
|
bindEvents(dlg);
|
||||||
if (enableDynamicFilters(options.mode)) {
|
if (enableDynamicFilters(options.mode)) {
|
||||||
dlg.classList.add("dynamicFilterDialog");
|
dlg.classList.add('dynamicFilterDialog');
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||||
loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), options.query);
|
loadDynamicFilters(dlg, apiClient, apiClient.getCurrentUserId(), options.query);
|
||||||
}
|
}
|
||||||
|
|
|
@ -279,7 +279,7 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
html += '<div class="formDialogHeader">';
|
html += '<div class="formDialogHeader">';
|
||||||
html += '<button is="paper-icon-button-light" class="btnCancel hide-mouse-idle-tv" tabindex="-1"><i class="material-icons arrow_back"></i></button>';
|
html += '<button is="paper-icon-button-light" class="btnCancel hide-mouse-idle-tv" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||||
html += '<h3 class="formDialogHeaderTitle">${Filters}</h3>';
|
html += '<h3 class="formDialogHeaderTitle">${Filters}</h3>';
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
|
@ -105,4 +105,4 @@
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -43,7 +43,7 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
preventScroll: scrollManager.isEnabled()
|
preventScroll: scrollManager.isEnabled()
|
||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error in focusManager.autoFocus: ' + err);
|
console.error('Error in focusManager.autoFocus: ' + err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elem.getAttribute('tabindex') === "-1") {
|
if (elem.getAttribute('tabindex') === '-1') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,103 +0,0 @@
|
||||||
define(['events', 'dom', 'apphost', 'browser'], function (events, dom, appHost, browser) {
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function fullscreenManager() {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
fullscreenManager.prototype.requestFullscreen = function (element) {
|
|
||||||
|
|
||||||
element = element || document.documentElement;
|
|
||||||
|
|
||||||
if (element.requestFullscreen) {
|
|
||||||
element.requestFullscreen();
|
|
||||||
return;
|
|
||||||
} else if (element.mozRequestFullScreen) {
|
|
||||||
element.mozRequestFullScreen();
|
|
||||||
return;
|
|
||||||
} else if (element.webkitRequestFullscreen) {
|
|
||||||
element.webkitRequestFullscreen();
|
|
||||||
return;
|
|
||||||
} else if (element.msRequestFullscreen) {
|
|
||||||
element.msRequestFullscreen();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hack - This is only available for video elements in ios safari
|
|
||||||
if (element.tagName !== 'VIDEO') {
|
|
||||||
element = document.querySelector('video') || element;
|
|
||||||
}
|
|
||||||
if (element.webkitEnterFullscreen) {
|
|
||||||
element.webkitEnterFullscreen();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
fullscreenManager.prototype.exitFullscreen = function () {
|
|
||||||
|
|
||||||
if (!this.isFullScreen()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (document.exitFullscreen) {
|
|
||||||
document.exitFullscreen();
|
|
||||||
} else if (document.mozCancelFullScreen) {
|
|
||||||
document.mozCancelFullScreen();
|
|
||||||
} else if (document.webkitExitFullscreen) {
|
|
||||||
document.webkitExitFullscreen();
|
|
||||||
} else if (document.webkitCancelFullscreen) {
|
|
||||||
document.webkitCancelFullscreen();
|
|
||||||
} else if (document.msExitFullscreen) {
|
|
||||||
document.msExitFullscreen();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
// TODO: use screenfull.js
|
|
||||||
fullscreenManager.prototype.isFullScreen = function () {
|
|
||||||
return document.fullscreen ||
|
|
||||||
document.mozFullScreen ||
|
|
||||||
document.webkitIsFullScreen ||
|
|
||||||
document.msFullscreenElement || /* IE/Edge syntax */
|
|
||||||
document.fullscreenElement || /* Standard syntax */
|
|
||||||
document.webkitFullscreenElement || /* Chrome, Safari and Opera syntax */
|
|
||||||
document.mozFullScreenElement; /* Firefox syntax */
|
|
||||||
};
|
|
||||||
|
|
||||||
var manager = new fullscreenManager();
|
|
||||||
|
|
||||||
function onFullScreenChange() {
|
|
||||||
events.trigger(manager, 'fullscreenchange');
|
|
||||||
}
|
|
||||||
|
|
||||||
dom.addEventListener(document, 'fullscreenchange', onFullScreenChange, {
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
|
|
||||||
dom.addEventListener(document, 'webkitfullscreenchange', onFullScreenChange, {
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
|
|
||||||
dom.addEventListener(document, 'mozfullscreenchange', onFullScreenChange, {
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
|
|
||||||
function isTargetValid(target) {
|
|
||||||
return !dom.parentWithTag(target, ['BUTTON', 'INPUT', 'TEXTAREA']);
|
|
||||||
}
|
|
||||||
if (appHost.supports("fullscreenchange") && (browser.edgeUwp || -1 !== navigator.userAgent.toLowerCase().indexOf("electron"))) {
|
|
||||||
|
|
||||||
dom.addEventListener(window, 'dblclick', function (e) {
|
|
||||||
|
|
||||||
if (isTargetValid(e.target)) {
|
|
||||||
if (manager.isFullScreen()) {
|
|
||||||
manager.exitFullscreen();
|
|
||||||
} else {
|
|
||||||
manager.requestFullscreen();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}, {
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
return manager;
|
|
||||||
});
|
|
|
@ -1,28 +1,28 @@
|
||||||
define(["dom", "appRouter", "connectionManager"], function (dom, appRouter, connectionManager) {
|
define(['dom', 'appRouter', 'connectionManager'], function (dom, appRouter, connectionManager) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
function onGroupedCardClick(e, card) {
|
function onGroupedCardClick(e, card) {
|
||||||
var itemId = card.getAttribute("data-id");
|
var itemId = card.getAttribute('data-id');
|
||||||
var serverId = card.getAttribute("data-serverid");
|
var serverId = card.getAttribute('data-serverid');
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
var apiClient = connectionManager.getApiClient(serverId);
|
||||||
var userId = apiClient.getCurrentUserId();
|
var userId = apiClient.getCurrentUserId();
|
||||||
var playedIndicator = card.querySelector(".playedIndicator");
|
var playedIndicator = card.querySelector('.playedIndicator');
|
||||||
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
var playedIndicatorHtml = playedIndicator ? playedIndicator.innerHTML : null;
|
||||||
var options = {
|
var 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"]);
|
var 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 (1 === items.length) {
|
||||||
return void appRouter.showItem(items[0]);
|
return void appRouter.showItem(items[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
var url = "itemdetails.html?id=" + itemId + "&serverId=" + serverId;
|
var url = 'itemdetails.html?id=' + itemId + '&serverId=' + serverId;
|
||||||
Dashboard.navigate(url);
|
Dashboard.navigate(url);
|
||||||
});
|
});
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
@ -32,7 +32,7 @@ define(["dom", "appRouter", "connectionManager"], function (dom, appRouter, conn
|
||||||
}
|
}
|
||||||
|
|
||||||
function onItemsContainerClick(e) {
|
function onItemsContainerClick(e) {
|
||||||
var groupedCard = dom.parentWithClass(e.target, "groupedCard");
|
var groupedCard = dom.parentWithClass(e.target, 'groupedCard');
|
||||||
|
|
||||||
if (groupedCard) {
|
if (groupedCard) {
|
||||||
onGroupedCardClick(e, groupedCard);
|
onGroupedCardClick(e, groupedCard);
|
||||||
|
|
|
@ -89,20 +89,6 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSortByChange() {
|
|
||||||
var newValue = this.value;
|
|
||||||
if (this.checked) {
|
|
||||||
var changed = options.query.SortBy !== newValue;
|
|
||||||
|
|
||||||
options.query.SortBy = newValue.replace('_', ',');
|
|
||||||
options.query.StartIndex = 0;
|
|
||||||
|
|
||||||
if (options.callback && changed) {
|
|
||||||
options.callback();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function showEditor(options) {
|
function showEditor(options) {
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
@ -171,4 +157,4 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
||||||
return {
|
return {
|
||||||
show: showEditor
|
show: showEditor
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
<div class="formDialogHeader">
|
<div class="formDialogHeader">
|
||||||
<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><i class="material-icons arrow_back"></i></button>
|
<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>
|
||||||
<h3 class="formDialogHeaderTitle">
|
<h3 class="formDialogHeaderTitle">
|
||||||
${Settings}
|
${Settings}
|
||||||
</h3>
|
</h3>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager', 'scrollHelper', 'serverNotifications', 'loading', 'datetime', 'focusManager', 'playbackManager', 'userSettings', 'imageLoader', 'events', 'layoutManager', 'itemShortcuts', 'dom', 'css!./guide.css', 'programStyles', 'material-icons', 'scrollStyles', 'emby-button', 'paper-icon-button-light', 'emby-tabs', 'emby-scroller', 'flexStyles', 'registerElement'], function (require, inputManager, browser, globalize, connectionManager, scrollHelper, serverNotifications, loading, datetime, focusManager, playbackManager, userSettings, imageLoader, events, layoutManager, itemShortcuts, dom) {
|
define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager', 'scrollHelper', 'serverNotifications', 'loading', 'datetime', 'focusManager', 'playbackManager', 'userSettings', 'imageLoader', 'events', 'layoutManager', 'itemShortcuts', 'dom', 'css!./guide.css', 'programStyles', 'material-icons', 'scrollStyles', 'emby-programcell', 'emby-button', 'paper-icon-button-light', 'emby-tabs', 'emby-scroller', 'flexStyles', 'registerElement'], function (require, inputManager, browser, globalize, connectionManager, scrollHelper, serverNotifications, loading, datetime, focusManager, playbackManager, userSettings, imageLoader, events, layoutManager, itemShortcuts, dom) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function showViewSettings(instance) {
|
function showViewSettings(instance) {
|
||||||
|
@ -29,7 +29,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
var offset = newPct - left;
|
var offset = newPct - left;
|
||||||
var pctOfWidth = (offset / width) * 100;
|
var pctOfWidth = (offset / width) * 100;
|
||||||
|
|
||||||
//console.log(pctOfWidth);
|
|
||||||
var guideProgramName = cell.guideProgramName;
|
var guideProgramName = cell.guideProgramName;
|
||||||
if (!guideProgramName) {
|
if (!guideProgramName) {
|
||||||
guideProgramName = cell.querySelector('.guideProgramName');
|
guideProgramName = cell.querySelector('.guideProgramName');
|
||||||
|
@ -228,7 +227,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
channelQuery.Limit = channelLimit;
|
channelQuery.Limit = channelLimit;
|
||||||
channelQuery.AddCurrentProgram = false;
|
channelQuery.AddCurrentProgram = false;
|
||||||
channelQuery.EnableUserData = false;
|
channelQuery.EnableUserData = false;
|
||||||
channelQuery.EnableImageTypes = "Primary";
|
channelQuery.EnableImageTypes = 'Primary';
|
||||||
|
|
||||||
var categories = self.categoryOptions.categories || [];
|
var categories = self.categoryOptions.categories || [];
|
||||||
var displayMovieContent = !categories.length || categories.indexOf('movies') !== -1;
|
var displayMovieContent = !categories.length || categories.indexOf('movies') !== -1;
|
||||||
|
@ -262,8 +261,8 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (userSettings.get('livetv-channelorder') === 'DatePlayed') {
|
if (userSettings.get('livetv-channelorder') === 'DatePlayed') {
|
||||||
channelQuery.SortBy = "DatePlayed";
|
channelQuery.SortBy = 'DatePlayed';
|
||||||
channelQuery.SortOrder = "Descending";
|
channelQuery.SortOrder = 'Descending';
|
||||||
} else {
|
} else {
|
||||||
channelQuery.SortBy = null;
|
channelQuery.SortBy = null;
|
||||||
channelQuery.SortOrder = null;
|
channelQuery.SortOrder = null;
|
||||||
|
@ -330,7 +329,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
EnableImages: false,
|
EnableImages: false,
|
||||||
//EnableImageTypes: layoutManager.tv ? "Primary,Backdrop" : "Primary",
|
//EnableImageTypes: layoutManager.tv ? "Primary,Backdrop" : "Primary",
|
||||||
SortBy: "StartDate",
|
SortBy: 'StartDate',
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
EnableUserData: false
|
EnableUserData: false
|
||||||
};
|
};
|
||||||
|
@ -396,7 +395,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
try {
|
try {
|
||||||
program.StartDateLocal = datetime.parseISO8601Date(program.StartDate, { toLocal: true });
|
program.StartDateLocal = datetime.parseISO8601Date(program.StartDate, { toLocal: true });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('error parsing timestamp for start date');
|
console.error('error parsing timestamp for start date');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -404,7 +403,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
try {
|
try {
|
||||||
program.EndDateLocal = datetime.parseISO8601Date(program.EndDate, { toLocal: true });
|
program.EndDateLocal = datetime.parseISO8601Date(program.EndDate, { toLocal: true });
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('error parsing timestamp for end date');
|
console.error('error parsing timestamp for end date');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -416,7 +415,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
var status;
|
var status;
|
||||||
|
|
||||||
if (item.Type === 'SeriesTimer') {
|
if (item.Type === 'SeriesTimer') {
|
||||||
return '<i class="material-icons programIcon seriesTimerIcon fiber_smart_record"></i>';
|
return '<span class="material-icons programIcon seriesTimerIcon fiber_smart_record"></span>';
|
||||||
} else if (item.TimerId || item.SeriesTimerId) {
|
} else if (item.TimerId || item.SeriesTimerId) {
|
||||||
|
|
||||||
status = item.Status || 'Cancelled';
|
status = item.Status || 'Cancelled';
|
||||||
|
@ -430,13 +429,13 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
if (item.SeriesTimerId) {
|
if (item.SeriesTimerId) {
|
||||||
|
|
||||||
if (status !== 'Cancelled') {
|
if (status !== 'Cancelled') {
|
||||||
return '<i class="material-icons programIcon seriesTimerIcon fiber_smart_record"></i>';
|
return '<span class="material-icons programIcon seriesTimerIcon fiber_smart_record"></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<i class="material-icons programIcon seriesTimerIcon seriesTimerIcon-inactive fiber_smart_record"></i>';
|
return '<span class="material-icons programIcon seriesTimerIcon seriesTimerIcon-inactive fiber_smart_record"></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<i class="material-icons programIcon timerIcon fiber_manual_record"></i>';
|
return '<span class="material-icons programIcon timerIcon fiber_manual_record"></span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
function getChannelProgramsHtml(context, date, channel, programs, options, listInfo) {
|
function getChannelProgramsHtml(context, date, channel, programs, options, listInfo) {
|
||||||
|
@ -503,7 +502,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
var endPercent = (renderEndMs - renderStartMs) / msPerDay;
|
var endPercent = (renderEndMs - renderStartMs) / msPerDay;
|
||||||
endPercent *= 100;
|
endPercent *= 100;
|
||||||
|
|
||||||
var cssClass = "programCell itemAction";
|
var cssClass = 'programCell itemAction';
|
||||||
var accentCssClass = null;
|
var accentCssClass = null;
|
||||||
var displayInnerContent = true;
|
var displayInnerContent = true;
|
||||||
|
|
||||||
|
@ -526,11 +525,11 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
if (displayInnerContent && enableColorCodedBackgrounds && accentCssClass) {
|
if (displayInnerContent && enableColorCodedBackgrounds && accentCssClass) {
|
||||||
cssClass += " programCell-" + accentCssClass;
|
cssClass += ' programCell-' + accentCssClass;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (now >= startDateLocalMs && now < endDateLocalMs) {
|
if (now >= startDateLocalMs && now < endDateLocalMs) {
|
||||||
cssClass += " programCell-active";
|
cssClass += ' programCell-active';
|
||||||
}
|
}
|
||||||
|
|
||||||
var timerAttributes = '';
|
var timerAttributes = '';
|
||||||
|
@ -546,11 +545,11 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
html += '<button' + isAttribute + ' data-action="' + clickAction + '"' + timerAttributes + ' data-channelid="' + program.ChannelId + '" data-id="' + program.Id + '" data-serverid="' + program.ServerId + '" data-startdate="' + program.StartDate + '" data-enddate="' + program.EndDate + '" data-type="' + program.Type + '" class="' + cssClass + '" style="left:' + startPercent + '%;width:' + endPercent + '%;">';
|
html += '<button' + isAttribute + ' data-action="' + clickAction + '"' + timerAttributes + ' data-channelid="' + program.ChannelId + '" data-id="' + program.Id + '" data-serverid="' + program.ServerId + '" data-startdate="' + program.StartDate + '" data-enddate="' + program.EndDate + '" data-type="' + program.Type + '" class="' + cssClass + '" style="left:' + startPercent + '%;width:' + endPercent + '%;">';
|
||||||
|
|
||||||
if (displayInnerContent) {
|
if (displayInnerContent) {
|
||||||
var guideProgramNameClass = "guideProgramName";
|
var guideProgramNameClass = 'guideProgramName';
|
||||||
|
|
||||||
html += '<div class="' + guideProgramNameClass + '">';
|
html += '<div class="' + guideProgramNameClass + '">';
|
||||||
|
|
||||||
html += '<div class="guide-programNameCaret hide"><i class="guideProgramNameCaretIcon material-icons keyboard_arrow_left"></i></div>';
|
html += '<div class="guide-programNameCaret hide"><span class="guideProgramNameCaretIcon material-icons keyboard_arrow_left"></span></div>';
|
||||||
|
|
||||||
html += '<div class="guideProgramNameText">' + program.Name;
|
html += '<div class="guideProgramNameText">' + program.Name;
|
||||||
|
|
||||||
|
@ -578,7 +577,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (program.IsHD && options.showHdIcon) {
|
if (program.IsHD && options.showHdIcon) {
|
||||||
//html += '<i class="guideHdIcon material-icons programIcon">hd</i>';
|
//html += '<span class="guideHdIcon material-icons programIcon hd"></span>';
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
html += '<div class="programIcon guide-programTextIcon guide-programTextIcon-tv">HD</div>';
|
html += '<div class="programIcon guide-programTextIcon guide-programTextIcon-tv">HD</div>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -631,7 +630,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
var url = apiClient.getScaledImageUrl(channel.Id, {
|
var url = apiClient.getScaledImageUrl(channel.Id, {
|
||||||
maxHeight: 220,
|
maxHeight: 220,
|
||||||
tag: channel.ImageTags.Primary,
|
tag: channel.ImageTags.Primary,
|
||||||
type: "Primary"
|
type: 'Primary'
|
||||||
});
|
});
|
||||||
|
|
||||||
html += '<div class="guideChannelImage lazy" data-src="' + url + '"></div>';
|
html += '<div class="guideChannelImage lazy" data-src="' + url + '"></div>';
|
||||||
|
@ -1106,7 +1105,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
|
|
||||||
var icon = cell.querySelector('.timerIcon');
|
var icon = cell.querySelector('.timerIcon');
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
cell.querySelector('.guideProgramName').insertAdjacentHTML('beforeend', '<i class="timerIcon material-icons programIcon fiber_manual_record"></i>');
|
cell.querySelector('.guideProgramName').insertAdjacentHTML('beforeend', '<span class="timerIcon material-icons programIcon fiber_manual_record"></span>');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (newTimerId) {
|
if (newTimerId) {
|
||||||
|
@ -1253,18 +1252,5 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var ProgramCellPrototype = Object.create(HTMLButtonElement.prototype);
|
|
||||||
|
|
||||||
ProgramCellPrototype.detachedCallback = function () {
|
|
||||||
this.posLeft = null;
|
|
||||||
this.posWidth = null;
|
|
||||||
this.guideProgramName = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
document.registerElement('emby-programcell', {
|
|
||||||
prototype: ProgramCellPrototype,
|
|
||||||
extends: 'button'
|
|
||||||
});
|
|
||||||
|
|
||||||
return Guide;
|
return Guide;
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
<div class="guide-headerTimeslots">
|
<div class="guide-headerTimeslots">
|
||||||
<div class="guide-channelTimeslotHeader">
|
<div class="guide-channelTimeslotHeader">
|
||||||
<button is="paper-icon-button-light" type="button" class="btnGuideViewSettings">
|
<button is="paper-icon-button-light" type="button" class="btnGuideViewSettings">
|
||||||
<i class="material-icons btnGuideViewSettingsIcon more_horiz"></i>
|
<span class="material-icons btnGuideViewSettingsIcon more_horiz"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="timeslotHeaders scrollX guideScroller"></div>
|
<div class="timeslotHeaders scrollX guideScroller"></div>
|
||||||
|
@ -30,9 +30,9 @@
|
||||||
|
|
||||||
<div class="guideOptions hide">
|
<div class="guideOptions hide">
|
||||||
<button is="paper-icon-button-light" type="button" class="btnPreviousPage">
|
<button is="paper-icon-button-light" type="button" class="btnPreviousPage">
|
||||||
<i class="material-icons arrow_back"></i>
|
<span class="material-icons arrow_back"></span>
|
||||||
</button>
|
</button>
|
||||||
<button is="paper-icon-button-light" type="button" class="btnNextPage">
|
<button is="paper-icon-button-light" type="button" class="btnNextPage">
|
||||||
<i class="material-icons">arrow_forward</i>
|
<span class="material-icons arrow_forward"></span>
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,11 +0,0 @@
|
||||||
.headroom {
|
|
||||||
transition: transform 140ms linear;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headroom--pinned {
|
|
||||||
transform: none;
|
|
||||||
}
|
|
||||||
|
|
||||||
.headroom--unpinned:not(.headroomDisabled) {
|
|
||||||
transform: translateY(-100%);
|
|
||||||
}
|
|
|
@ -1,343 +0,0 @@
|
||||||
/*!
|
|
||||||
* headroom.js v0.7.0 - Give your page some headroom. Hide your header until you need it
|
|
||||||
* Copyright (c) 2014 Nick Williams - http://wicky.nillia.ms/headroom.js
|
|
||||||
* License: MIT
|
|
||||||
*/
|
|
||||||
|
|
||||||
define(['dom', 'layoutManager', 'browser', 'css!./headroom'], function (dom, layoutManager, browser) {
|
|
||||||
|
|
||||||
'use strict';
|
|
||||||
|
|
||||||
/* exported features */
|
|
||||||
|
|
||||||
var requestAnimationFrame = window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles debouncing of events via requestAnimationFrame
|
|
||||||
* @see http://www.html5rocks.com/en/tutorials/speed/animations/
|
|
||||||
* @param {Function} callback The callback to handle whichever event
|
|
||||||
*/
|
|
||||||
function Debouncer(callback) {
|
|
||||||
this.callback = callback;
|
|
||||||
this.ticking = false;
|
|
||||||
}
|
|
||||||
Debouncer.prototype = {
|
|
||||||
constructor: Debouncer,
|
|
||||||
|
|
||||||
/**
|
|
||||||
* dispatches the event to the supplied callback
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
update: function () {
|
|
||||||
if (this.callback) {
|
|
||||||
this.callback();
|
|
||||||
}
|
|
||||||
this.ticking = false;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attach this as the event listeners
|
|
||||||
*/
|
|
||||||
handleEvent: function () {
|
|
||||||
if (!this.ticking) {
|
|
||||||
requestAnimationFrame(this.rafCallback || (this.rafCallback = this.update.bind(this)));
|
|
||||||
this.ticking = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
function onHeadroomClearedExternally() {
|
|
||||||
this.state = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* UI enhancement for fixed headers.
|
|
||||||
* Hides header when scrolling down
|
|
||||||
* Shows header when scrolling up
|
|
||||||
* @constructor
|
|
||||||
* @param {DOMElement} elem the header element
|
|
||||||
* @param {Object} options options for the widget
|
|
||||||
*/
|
|
||||||
function Headroom(elems, options) {
|
|
||||||
options = Object.assign(Headroom.options, options || {});
|
|
||||||
|
|
||||||
this.lastKnownScrollY = 0;
|
|
||||||
this.elems = elems;
|
|
||||||
|
|
||||||
this.scroller = options.scroller;
|
|
||||||
|
|
||||||
this.debouncer = onScroll.bind(this);
|
|
||||||
this.offset = options.offset;
|
|
||||||
this.initialised = false;
|
|
||||||
|
|
||||||
this.initialClass = options.initialClass;
|
|
||||||
this.unPinnedClass = options.unPinnedClass;
|
|
||||||
this.pinnedClass = options.pinnedClass;
|
|
||||||
|
|
||||||
this.state = 'clear';
|
|
||||||
|
|
||||||
this.options = {
|
|
||||||
offset: 0,
|
|
||||||
scroller: window,
|
|
||||||
initialClass: 'headroom',
|
|
||||||
unPinnedClass: 'headroom--unpinned',
|
|
||||||
pinnedClass: 'headroom--pinned'
|
|
||||||
};
|
|
||||||
|
|
||||||
this.add = function (elem) {
|
|
||||||
|
|
||||||
if (browser.supportsCssAnimation()) {
|
|
||||||
elem.classList.add(this.initialClass);
|
|
||||||
elem.addEventListener('clearheadroom', onHeadroomClearedExternally.bind(this));
|
|
||||||
this.elems.push(elem);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.remove = function (elem) {
|
|
||||||
|
|
||||||
elem.classList.remove(this.unPinnedClass);
|
|
||||||
elem.classList.remove(this.initialClass);
|
|
||||||
elem.classList.remove(this.pinnedClass);
|
|
||||||
|
|
||||||
var i = this.elems.indexOf(elem);
|
|
||||||
if (i !== -1) {
|
|
||||||
this.elems.splice(i, 1);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
this.pause = function () {
|
|
||||||
this.paused = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
this.resume = function () {
|
|
||||||
this.paused = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unattaches events and removes any classes that were added
|
|
||||||
*/
|
|
||||||
this.destroy = function () {
|
|
||||||
|
|
||||||
this.initialised = false;
|
|
||||||
|
|
||||||
for (var i = 0, length = this.elems.length; i < length; i++) {
|
|
||||||
|
|
||||||
var classList = this.elems[i].classList;
|
|
||||||
|
|
||||||
classList.remove(this.unPinnedClass);
|
|
||||||
classList.remove(this.initialClass);
|
|
||||||
classList.remove(this.pinnedClass);
|
|
||||||
}
|
|
||||||
|
|
||||||
var scrollEventName = this.scroller.getScrollEventName ? this.scroller.getScrollEventName() : 'scroll';
|
|
||||||
|
|
||||||
dom.removeEventListener(this.scroller, scrollEventName, this.debouncer, {
|
|
||||||
capture: false,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Attaches the scroll event
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
this.attachEvent = function () {
|
|
||||||
if (!this.initialised) {
|
|
||||||
this.lastKnownScrollY = this.getScrollY();
|
|
||||||
this.initialised = true;
|
|
||||||
|
|
||||||
var scrollEventName = this.scroller.getScrollEventName ? this.scroller.getScrollEventName() : 'scroll';
|
|
||||||
|
|
||||||
dom.addEventListener(this.scroller, scrollEventName, this.debouncer, {
|
|
||||||
capture: false,
|
|
||||||
passive: true
|
|
||||||
});
|
|
||||||
|
|
||||||
this.update();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unpins the header if it's currently pinned
|
|
||||||
*/
|
|
||||||
this.clear = function () {
|
|
||||||
|
|
||||||
if (this.state === 'clear') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.state = 'clear';
|
|
||||||
|
|
||||||
var unpinnedClass = this.unPinnedClass;
|
|
||||||
var pinnedClass = this.pinnedClass;
|
|
||||||
|
|
||||||
for (var i = 0, length = this.elems.length; i < length; i++) {
|
|
||||||
var classList = this.elems[i].classList;
|
|
||||||
|
|
||||||
classList.remove(unpinnedClass);
|
|
||||||
//classList.remove(pinnedClass);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unpins the header if it's currently pinned
|
|
||||||
*/
|
|
||||||
this.pin = function () {
|
|
||||||
|
|
||||||
if (this.state === 'pin') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.state = 'pin';
|
|
||||||
|
|
||||||
var unpinnedClass = this.unPinnedClass;
|
|
||||||
var pinnedClass = this.pinnedClass;
|
|
||||||
|
|
||||||
for (var i = 0, length = this.elems.length; i < length; i++) {
|
|
||||||
var classList = this.elems[i].classList;
|
|
||||||
|
|
||||||
classList.remove(unpinnedClass);
|
|
||||||
classList.add(pinnedClass);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Unpins the header if it's currently pinned
|
|
||||||
*/
|
|
||||||
this.unpin = function () {
|
|
||||||
|
|
||||||
if (this.state === 'unpin') {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.state = 'unpin';
|
|
||||||
|
|
||||||
var unpinnedClass = this.unPinnedClass;
|
|
||||||
var pinnedClass = this.pinnedClass;
|
|
||||||
|
|
||||||
for (var i = 0, length = this.elems.length; i < length; i++) {
|
|
||||||
var classList = this.elems[i].classList;
|
|
||||||
|
|
||||||
classList.add(unpinnedClass);
|
|
||||||
//classList.remove(pinnedClass);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Gets the Y scroll position
|
|
||||||
* @see https://developer.mozilla.org/en-US/docs/Web/API/Window.scrollY
|
|
||||||
* @return {Number} pixels the page has scrolled along the Y-axis
|
|
||||||
*/
|
|
||||||
this.getScrollY = function () {
|
|
||||||
|
|
||||||
var scroller = this.scroller;
|
|
||||||
|
|
||||||
if (scroller.getScrollPosition) {
|
|
||||||
return scroller.getScrollPosition();
|
|
||||||
}
|
|
||||||
|
|
||||||
var pageYOffset = scroller.pageYOffset;
|
|
||||||
if (pageYOffset !== undefined) {
|
|
||||||
return pageYOffset;
|
|
||||||
}
|
|
||||||
|
|
||||||
var scrollTop = scroller.scrollTop;
|
|
||||||
if (scrollTop !== undefined) {
|
|
||||||
return scrollTop;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (document.documentElement || document.body).scrollTop;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* determine if it is appropriate to unpin
|
|
||||||
* @param {int} currentScrollY the current y scroll position
|
|
||||||
* @return {bool} true if should unpin, false otherwise
|
|
||||||
*/
|
|
||||||
this.shouldUnpin = function (currentScrollY) {
|
|
||||||
var scrollingDown = currentScrollY > this.lastKnownScrollY;
|
|
||||||
var pastOffset = currentScrollY >= this.offset;
|
|
||||||
|
|
||||||
return scrollingDown && pastOffset;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* determine if it is appropriate to pin
|
|
||||||
* @param {int} currentScrollY the current y scroll position
|
|
||||||
* @return {bool} true if should pin, false otherwise
|
|
||||||
*/
|
|
||||||
this.shouldPin = function (currentScrollY) {
|
|
||||||
var scrollingUp = currentScrollY < this.lastKnownScrollY;
|
|
||||||
var pastOffset = currentScrollY <= this.offset;
|
|
||||||
|
|
||||||
return scrollingUp || pastOffset;
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Handles updating the state of the widget
|
|
||||||
*/
|
|
||||||
this.update = function () {
|
|
||||||
|
|
||||||
if (this.paused) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentScrollY = this.getScrollY();
|
|
||||||
|
|
||||||
var lastKnownScrollY = this.lastKnownScrollY;
|
|
||||||
|
|
||||||
var isTv = layoutManager.tv;
|
|
||||||
|
|
||||||
if (currentScrollY <= (isTv ? 120 : 10)) {
|
|
||||||
this.clear();
|
|
||||||
} else if (this.shouldUnpin(currentScrollY)) {
|
|
||||||
this.unpin();
|
|
||||||
} else if (this.shouldPin(currentScrollY)) {
|
|
||||||
|
|
||||||
var toleranceExceeded = Math.abs(currentScrollY - lastKnownScrollY) >= 14;
|
|
||||||
|
|
||||||
if (currentScrollY && isTv) {
|
|
||||||
this.unpin();
|
|
||||||
} else if (toleranceExceeded) {
|
|
||||||
this.clear();
|
|
||||||
}
|
|
||||||
} else if (isTv) {
|
|
||||||
//this.clear();
|
|
||||||
}
|
|
||||||
|
|
||||||
this.lastKnownScrollY = currentScrollY;
|
|
||||||
};
|
|
||||||
|
|
||||||
if (browser.supportsCssAnimation()) {
|
|
||||||
for (var i = 0, length = this.elems.length; i < length; i++) {
|
|
||||||
this.elems[i].classList.add(this.initialClass);
|
|
||||||
this.elems[i].addEventListener('clearheadroom', onHeadroomClearedExternally.bind(this));
|
|
||||||
}
|
|
||||||
|
|
||||||
this.attachEvent();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onScroll() {
|
|
||||||
|
|
||||||
if (this.paused) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
requestAnimationFrame(this.rafCallback || (this.rafCallback = this.update.bind(this)));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default options
|
|
||||||
* @type {Object}
|
|
||||||
*/
|
|
||||||
Headroom.options = {
|
|
||||||
offset: 0,
|
|
||||||
scroller: window,
|
|
||||||
initialClass: 'headroom',
|
|
||||||
unPinnedClass: 'headroom--unpinned',
|
|
||||||
pinnedClass: 'headroom--pinned'
|
|
||||||
};
|
|
||||||
|
|
||||||
return Headroom;
|
|
||||||
});
|
|
|
@ -1,5 +1,5 @@
|
||||||
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) {
|
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) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
var numConfigurableSections = 7;
|
var numConfigurableSections = 7;
|
||||||
|
|
||||||
|
@ -149,7 +149,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
currentHtml += '<div class="listItem viewItem" data-viewid="' + view.Id + '">';
|
currentHtml += '<div class="listItem viewItem" data-viewid="' + view.Id + '">';
|
||||||
|
|
||||||
currentHtml += '<i class="material-icons listItemIcon folder_open"></i>';
|
currentHtml += '<span class="material-icons listItemIcon folder_open"></span>';
|
||||||
|
|
||||||
currentHtml += '<div class="listItemBody">';
|
currentHtml += '<div class="listItemBody">';
|
||||||
|
|
||||||
|
@ -159,8 +159,8 @@ 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') + '"><i class="material-icons keyboard_arrow_up"></i></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') + '"><i class="material-icons keyboard_arrow_down"></i></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>';
|
||||||
|
|
||||||
|
@ -276,7 +276,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
updateHomeSectionValues(context, userSettings);
|
updateHomeSectionValues(context, userSettings);
|
||||||
|
|
||||||
var promise1 = apiClient.getUserViews({ IncludeHidden: true }, user.Id);
|
var promise1 = apiClient.getUserViews({ IncludeHidden: true }, user.Id);
|
||||||
var promise2 = apiClient.getJSON(apiClient.getUrl("Users/" + user.Id + "/GroupingOptions"));
|
var promise2 = apiClient.getJSON(apiClient.getUrl('Users/' + user.Id + '/GroupingOptions'));
|
||||||
|
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
|
|
||||||
|
@ -363,17 +363,17 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
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(function (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(function (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(function (i) {
|
||||||
|
|
||||||
return i.getAttribute('data-folderid');
|
return i.getAttribute('data-folderid');
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,6 +10,13 @@
|
||||||
<div class="fieldDescription">${LabelPleaseRestart}</div>
|
<div class="fieldDescription">${LabelPleaseRestart}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="verticalSection verticalSection-extrabottompadding">
|
||||||
|
<label class="checkboxContainer">
|
||||||
|
<input class="chkHidePlayedFromLatest" type="checkbox" is="emby-checkbox" />
|
||||||
|
<span>${HideWatchedContentFromLatestMedia}</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="selectContainer">
|
<div class="selectContainer">
|
||||||
<select is="emby-select" id="selectHomeSection1" label="{section1label}">
|
<select is="emby-select" id="selectHomeSection1" label="{section1label}">
|
||||||
<option value="smalllibrarytiles">${HeaderMyMedia}</option>
|
<option value="smalllibrarytiles">${HeaderMyMedia}</option>
|
||||||
|
@ -110,13 +117,6 @@
|
||||||
|
|
||||||
<div class="perLibrarySettings"></div>
|
<div class="perLibrarySettings"></div>
|
||||||
|
|
||||||
<div class="verticalSection verticalSection-extrabottompadding">
|
|
||||||
<label class="checkboxContainer">
|
|
||||||
<input class="chkHidePlayedFromLatest" type="checkbox" is="emby-checkbox" />
|
|
||||||
<span>${HideWatchedContentFromLatestMedia}</span>
|
|
||||||
</label>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="verticalSection verticalSection-extrabottompadding">
|
<div class="verticalSection verticalSection-extrabottompadding">
|
||||||
<h2 class="sectionTitle">${HeaderLibraryFolders}</h2>
|
<h2 class="sectionTitle">${HeaderLibraryFolders}</h2>
|
||||||
<div>
|
<div>
|
||||||
|
@ -129,4 +129,4 @@
|
||||||
<button is="emby-button" type="submit" class="raised button-submit block btnSave hide">
|
<button is="emby-button" type="submit" class="raised button-submit block btnSave hide">
|
||||||
<span>${Save}</span>
|
<span>${Save}</span>
|
||||||
</button>
|
</button>
|
||||||
</form>
|
</form>
|
||||||
|
|
|
@ -64,21 +64,21 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
} else {
|
} else {
|
||||||
var noLibDescription;
|
var noLibDescription;
|
||||||
if (user['Policy'] && user['Policy']['IsAdministrator']) {
|
if (user['Policy'] && user['Policy']['IsAdministrator']) {
|
||||||
noLibDescription = Globalize.translate("NoCreatedLibraries", '<a id="button-createLibrary" class="button-link">', '</a>')
|
noLibDescription = globalize.translate('NoCreatedLibraries', '<br><a id="button-createLibrary" class="button-link">', '</a>');
|
||||||
} else {
|
} else {
|
||||||
noLibDescription = Globalize.translate("AskAdminToCreateLibrary");
|
noLibDescription = globalize.translate('AskAdminToCreateLibrary');
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '<div class="centerMessage padded-left padded-right">';
|
html += '<div class="centerMessage padded-left padded-right">';
|
||||||
html += '<h2>' + Globalize.translate("MessageNothingHere") + '</h2>';
|
html += '<h2>' + globalize.translate('MessageNothingHere') + '</h2>';
|
||||||
html += '<p>' + noLibDescription + '</p>'
|
html += '<p>' + noLibDescription + '</p>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var createNowLink = elem.querySelector("#button-createLibrary")
|
var createNowLink = elem.querySelector('#button-createLibrary');
|
||||||
if (createNowLink) {
|
if (createNowLink) {
|
||||||
createNowLink.addEventListener("click", () => {
|
createNowLink.addEventListener('click', function () {
|
||||||
Dashboard.navigate("library.html");
|
Dashboard.navigate('library.html');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
} else if (section === 'librarytiles' || section === 'smalllibrarytiles' || section === 'smalllibrarytiles-automobile' || section === 'librarytiles-automobile') {
|
} else if (section === 'librarytiles' || section === 'smalllibrarytiles' || section === 'smalllibrarytiles-automobile' || section === 'librarytiles-automobile') {
|
||||||
loadLibraryTiles(elem, apiClient, user, userSettings, 'smallBackdrop', userViews, allSections);
|
loadLibraryTiles(elem, apiClient, user, userSettings, 'smallBackdrop', userViews, allSections);
|
||||||
} else if (section === 'librarybuttons') {
|
} else if (section === 'librarybuttons') {
|
||||||
loadlibraryButtons(elem, apiClient, user, userSettings, userViews, allSections);
|
loadlibraryButtons(elem, apiClient, user, userSettings, userViews);
|
||||||
} else if (section === 'resume') {
|
} else if (section === 'resume') {
|
||||||
loadResumeVideo(elem, apiClient, userId);
|
loadResumeVideo(elem, apiClient, userId);
|
||||||
} else if (section === 'resumeaudio') {
|
} else if (section === 'resumeaudio') {
|
||||||
|
@ -172,7 +172,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLibraryButtonsHtml(items) {
|
function getLibraryButtonsHtml(items) {
|
||||||
var html = "";
|
var 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>';
|
||||||
|
@ -183,7 +183,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
for (var i = 0, length = items.length; i < length; i++) {
|
for (var i = 0, length = items.length; i < length; i++) {
|
||||||
var item = items[i];
|
var item = items[i];
|
||||||
var icon = imageHelper.getLibraryIcon(item.CollectionType);
|
var icon = imageHelper.getLibraryIcon(item.CollectionType);
|
||||||
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl(item) + '" class="raised homeLibraryButton"><i class="material-icons homeLibraryIcon">' + icon + '</i><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>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
@ -229,9 +229,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
var options = {
|
var options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
EnableImageTypes: "Primary,Backdrop,Thumb",
|
EnableImageTypes: 'Primary,Backdrop,Thumb',
|
||||||
ParentId: parentId
|
ParentId: parentId
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -243,9 +243,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
return function (items) {
|
return function (items) {
|
||||||
var cardLayout = false;
|
var cardLayout = false;
|
||||||
var shape;
|
var shape;
|
||||||
if (itemType === 'Channel' || viewType === 'movies' || viewType === 'books') {
|
if (itemType === 'Channel' || viewType === 'movies' || viewType === 'books' || viewType === 'tvshows') {
|
||||||
shape = getPortraitShape();
|
shape = getPortraitShape();
|
||||||
} else if (viewType === 'music') {
|
} else if (viewType === 'music' || viewType === 'homevideos') {
|
||||||
shape = getSquareShape();
|
shape = getSquareShape();
|
||||||
} else {
|
} else {
|
||||||
shape = getThumbShape();
|
shape = getThumbShape();
|
||||||
|
@ -282,7 +282,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
||||||
html += globalize.translate('LatestFromLibrary', parent.Name);
|
html += globalize.translate('LatestFromLibrary', parent.Name);
|
||||||
html += '</h2>';
|
html += '</h2>';
|
||||||
html += '<i class="material-icons chevron_right"></i>';
|
html += '<span class="material-icons chevron_right"></span>';
|
||||||
html += '</a>';
|
html += '</a>';
|
||||||
} else {
|
} else {
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('LatestFromLibrary', parent.Name) + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('LatestFromLibrary', parent.Name) + '</h2>';
|
||||||
|
@ -290,7 +290,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-centerfocus="true">';
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x">';
|
||||||
} else {
|
} else {
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer focuscontainer-x padded-left padded-right vertical-wrap">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer focuscontainer-x padded-left padded-right vertical-wrap">';
|
||||||
|
@ -343,7 +343,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
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()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-centerfocus="true">';
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x">';
|
||||||
} else {
|
} else {
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right focuscontainer-x vertical-wrap">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right focuscontainer-x vertical-wrap">';
|
||||||
|
@ -386,9 +386,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
var options = {
|
var options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
EnableImageTypes: "Primary,Backdrop,Thumb",
|
EnableImageTypes: 'Primary,Backdrop,Thumb',
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
MediaTypes: 'Video'
|
MediaTypes: 'Video'
|
||||||
};
|
};
|
||||||
|
@ -423,7 +423,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
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()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-centerfocus="true">';
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x" data-monitor="videoplayback,markplayed">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x" data-monitor="videoplayback,markplayed">';
|
||||||
} else {
|
} else {
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-monitor="videoplayback,markplayed">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-monitor="videoplayback,markplayed">';
|
||||||
|
@ -459,9 +459,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
var options = {
|
var options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
EnableImageTypes: "Primary,Backdrop,Thumb",
|
EnableImageTypes: 'Primary,Backdrop,Thumb',
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
MediaTypes: 'Audio'
|
MediaTypes: 'Audio'
|
||||||
};
|
};
|
||||||
|
@ -496,7 +496,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
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()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-centerfocus="true">';
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x" data-monitor="audioplayback,markplayed">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x" data-monitor="audioplayback,markplayed">';
|
||||||
} else {
|
} else {
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-monitor="audioplayback,markplayed">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-monitor="audioplayback,markplayed">';
|
||||||
|
@ -524,9 +524,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
limit: 24,
|
limit: 24,
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
EnableImageTypes: "Primary,Thumb,Backdrop",
|
EnableImageTypes: 'Primary,Thumb,Backdrop',
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
Fields: "ChannelInfo,PrimaryImageAspectRatio"
|
Fields: 'ChannelInfo,PrimaryImageAspectRatio'
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -565,9 +565,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
EnableImageTypes: "Primary,Thumb,Backdrop",
|
EnableImageTypes: 'Primary,Thumb,Backdrop',
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
Fields: "ChannelInfo,PrimaryImageAspectRatio"
|
Fields: 'ChannelInfo,PrimaryImageAspectRatio'
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
var html = '';
|
var html = '';
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
|
@ -582,7 +582,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true" data-scrollbuttons="false">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-centerfocus="true" data-scrollbuttons="false">';
|
||||||
html += '<div class="padded-top padded-bottom scrollSlider focuscontainer-x">';
|
html += '<div class="padded-top padded-bottom scrollSlider focuscontainer-x">';
|
||||||
} else {
|
} else {
|
||||||
html += '<div class="padded-top padded-bottom focuscontainer-x">';
|
html += '<div class="padded-top padded-bottom focuscontainer-x">';
|
||||||
|
@ -630,7 +630,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
||||||
html += globalize.translate('HeaderOnNow');
|
html += globalize.translate('HeaderOnNow');
|
||||||
html += '</h2>';
|
html += '</h2>';
|
||||||
html += '<i class="material-icons chevron_right"></i>';
|
html += '<span class="material-icons chevron_right"></span>';
|
||||||
html += '</a>';
|
html += '</a>';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -639,8 +639,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-centerfocus="true">';
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x">'
|
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x">';
|
||||||
} else {
|
} else {
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x">';
|
||||||
}
|
}
|
||||||
|
@ -667,10 +667,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
var apiClient = connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getNextUpEpisodes({
|
return apiClient.getNextUpEpisodes({
|
||||||
Limit: enableScrollX() ? 24 : 15,
|
Limit: enableScrollX() ? 24 : 15,
|
||||||
Fields: "PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo",
|
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo',
|
||||||
UserId: apiClient.getCurrentUserId(),
|
UserId: apiClient.getCurrentUserId(),
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb",
|
EnableImageTypes: 'Primary,Backdrop,Banner,Thumb',
|
||||||
EnableTotalRecordCount: false
|
EnableTotalRecordCount: false
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -705,7 +705,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
||||||
html += globalize.translate('HeaderNextUp');
|
html += globalize.translate('HeaderNextUp');
|
||||||
html += '</h2>';
|
html += '</h2>';
|
||||||
html += '<i class="material-icons chevron_right"></i>';
|
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('HeaderNextUp') + '</h2>';
|
||||||
|
@ -713,8 +713,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-centerfocus="true">';
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x" data-monitor="videoplayback,markplayed">'
|
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x" data-monitor="videoplayback,markplayed">';
|
||||||
} else {
|
} else {
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-monitor="videoplayback,markplayed">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-monitor="videoplayback,markplayed">';
|
||||||
}
|
}
|
||||||
|
@ -739,7 +739,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
return apiClient.getLiveTvRecordings({
|
return apiClient.getLiveTvRecordings({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
Limit: enableScrollX() ? 12 : 5,
|
Limit: enableScrollX() ? 12 : 5,
|
||||||
Fields: "PrimaryImageAspectRatio,BasicSyncInfo",
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
IsLibraryItem: activeRecordingsOnly ? null : false,
|
IsLibraryItem: activeRecordingsOnly ? null : false,
|
||||||
IsInProgress: activeRecordingsOnly ? true : null
|
IsInProgress: activeRecordingsOnly ? true : null
|
||||||
|
@ -785,8 +785,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-mousewheel="false" data-centerfocus="true">';
|
html += '<div is="emby-scroller" class="padded-top-focusscale padded-bottom-focusscale" data-centerfocus="true">';
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x">'
|
html += '<div is="emby-itemscontainer" class="itemsContainer scrollSlider focuscontainer-x">';
|
||||||
} else {
|
} else {
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x">';
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,12 +2,12 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
function getSavedVolume() {
|
function getSavedVolume() {
|
||||||
return appSettings.get("volume") || 1;
|
return appSettings.get('volume') || 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveVolume(value) {
|
function saveVolume(value) {
|
||||||
if (value) {
|
if (value) {
|
||||||
appSettings.set("volume", value);
|
appSettings.set('volume', value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,7 +31,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
}
|
}
|
||||||
|
|
||||||
function enableHlsShakaPlayer(item, mediaSource, mediaType) {
|
function enableHlsShakaPlayer(item, mediaSource, mediaType) {
|
||||||
|
/* eslint-disable-next-line compat/compat */
|
||||||
if (!!window.MediaSource && !!MediaSource.isTypeSupported) {
|
if (!!window.MediaSource && !!MediaSource.isTypeSupported) {
|
||||||
|
|
||||||
if (canPlayNativeHls()) {
|
if (canPlayNativeHls()) {
|
||||||
|
@ -114,12 +114,12 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
|
|
||||||
if (!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {
|
if (!recoverDecodingErrorDate || (now - recoverDecodingErrorDate) > 3000) {
|
||||||
recoverDecodingErrorDate = now;
|
recoverDecodingErrorDate = now;
|
||||||
console.log('try to recover media Error ...');
|
console.debug('try to recover media Error ...');
|
||||||
hlsPlayer.recoverMediaError();
|
hlsPlayer.recoverMediaError();
|
||||||
} else {
|
} else {
|
||||||
if (!recoverSwapAudioCodecDate || (now - recoverSwapAudioCodecDate) > 3000) {
|
if (!recoverSwapAudioCodecDate || (now - recoverSwapAudioCodecDate) > 3000) {
|
||||||
recoverSwapAudioCodecDate = now;
|
recoverSwapAudioCodecDate = now;
|
||||||
console.log('try to swap Audio Codec and recover media Error ...');
|
console.debug('try to swap Audio Codec and recover media Error ...');
|
||||||
hlsPlayer.swapAudioCodec();
|
hlsPlayer.swapAudioCodec();
|
||||||
hlsPlayer.recoverMediaError();
|
hlsPlayer.recoverMediaError();
|
||||||
} else {
|
} else {
|
||||||
|
@ -162,7 +162,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function seekOnPlaybackStart(instance, element, ticks) {
|
function seekOnPlaybackStart(instance, element, ticks, onMediaReady) {
|
||||||
|
|
||||||
var seconds = (ticks || 0) / 10000000;
|
var seconds = (ticks || 0) / 10000000;
|
||||||
|
|
||||||
|
@ -171,13 +171,31 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
|
|
||||||
// Appending #t=xxx to the query string doesn't seem to work with HLS
|
// Appending #t=xxx to the query string doesn't seem to work with HLS
|
||||||
// For plain video files, not all browsers support it either
|
// For plain video files, not all browsers support it either
|
||||||
var delay = browser.safari ? 2500 : 0;
|
|
||||||
if (delay) {
|
if (element.duration >= seconds) {
|
||||||
setTimeout(function () {
|
// media is ready, seek immediately
|
||||||
setCurrentTimeIfNeeded(element, seconds);
|
|
||||||
}, delay);
|
|
||||||
} else {
|
|
||||||
setCurrentTimeIfNeeded(element, seconds);
|
setCurrentTimeIfNeeded(element, seconds);
|
||||||
|
if (onMediaReady) onMediaReady();
|
||||||
|
} else {
|
||||||
|
// update video player position when media is ready to be sought
|
||||||
|
var events = ['durationchange', 'loadeddata', 'play', 'loadedmetadata'];
|
||||||
|
var onMediaChange = function(e) {
|
||||||
|
if (element.currentTime === 0 && element.duration >= seconds) {
|
||||||
|
// seek only when video position is exactly zero,
|
||||||
|
// as this is true only if video hasn't started yet or
|
||||||
|
// user rewound to the very beginning
|
||||||
|
// (but rewinding cannot happen as the first event with media of non-empty duration)
|
||||||
|
console.debug(`seeking to ${seconds} on ${e.type} event`);
|
||||||
|
setCurrentTimeIfNeeded(element, seconds);
|
||||||
|
events.map(function(name) {
|
||||||
|
element.removeEventListener(name, onMediaChange);
|
||||||
|
});
|
||||||
|
if (onMediaReady) onMediaReady();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
events.map(function (name) {
|
||||||
|
element.addEventListener(name, onMediaChange);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -233,7 +251,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('error calling video.play: ' + err);
|
console.error('error calling video.play: ' + err);
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -245,7 +263,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
try {
|
try {
|
||||||
player.unload();
|
player.unload();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
instance._castPlayer = null;
|
instance._castPlayer = null;
|
||||||
|
@ -258,7 +276,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
try {
|
try {
|
||||||
player.destroy();
|
player.destroy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
instance._shakaPlayer = null;
|
instance._shakaPlayer = null;
|
||||||
|
@ -271,7 +289,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
try {
|
try {
|
||||||
player.destroy();
|
player.destroy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
instance._hlsPlayer = null;
|
instance._hlsPlayer = null;
|
||||||
|
@ -286,7 +304,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
player.detachMediaElement();
|
player.detachMediaElement();
|
||||||
player.destroy();
|
player.destroy();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log(err);
|
console.error(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
instance._flvPlayer = null;
|
instance._flvPlayer = null;
|
||||||
|
@ -307,14 +325,14 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
|
|
||||||
hls.on(Hls.Events.ERROR, function (event, data) {
|
hls.on(Hls.Events.ERROR, function (event, data) {
|
||||||
|
|
||||||
console.log('HLS Error: Type: ' + data.type + ' Details: ' + (data.details || '') + ' Fatal: ' + (data.fatal || false));
|
console.error('HLS Error: Type: ' + data.type + ' Details: ' + (data.details || '') + ' Fatal: ' + (data.fatal || false));
|
||||||
|
|
||||||
switch (data.type) {
|
switch (data.type) {
|
||||||
case Hls.ErrorTypes.NETWORK_ERROR:
|
case Hls.ErrorTypes.NETWORK_ERROR:
|
||||||
// try to recover network error
|
// try to recover network error
|
||||||
if (data.response && data.response.code && data.response.code >= 400) {
|
if (data.response && data.response.code && data.response.code >= 400) {
|
||||||
|
|
||||||
console.log('hls.js response error code: ' + data.response.code);
|
console.debug('hls.js response error code: ' + data.response.code);
|
||||||
|
|
||||||
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
||||||
hls.destroy();
|
hls.destroy();
|
||||||
|
@ -343,7 +361,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
|
|
||||||
// This could be a CORS error related to access control response headers
|
// This could be a CORS error related to access control response headers
|
||||||
|
|
||||||
console.log('hls.js response error code: ' + data.response.code);
|
console.debug('hls.js response error code: ' + data.response.code);
|
||||||
|
|
||||||
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
||||||
hls.destroy();
|
hls.destroy();
|
||||||
|
@ -355,20 +373,20 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
onErrorInternal(instance, 'network');
|
onErrorInternal(instance, 'network');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
console.log("fatal network error encountered, try to recover");
|
console.debug('fatal network error encountered, try to recover');
|
||||||
hls.startLoad();
|
hls.startLoad();
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case Hls.ErrorTypes.MEDIA_ERROR:
|
case Hls.ErrorTypes.MEDIA_ERROR:
|
||||||
console.log("fatal media error encountered, try to recover");
|
console.debug('fatal media error encountered, try to recover');
|
||||||
var currentReject = reject;
|
var currentReject = reject;
|
||||||
reject = null;
|
reject = null;
|
||||||
handleHlsJsMediaError(instance, currentReject);
|
handleHlsJsMediaError(instance, currentReject);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
||||||
console.log('Cannot recover from hls error - destroy and trigger error');
|
console.debug('Cannot recover from hls error - destroy and trigger error');
|
||||||
// cannot recover
|
// cannot recover
|
||||||
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
||||||
hls.destroy();
|
hls.destroy();
|
||||||
|
@ -391,7 +409,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
|
|
||||||
elem.src = '';
|
elem.src = '';
|
||||||
elem.innerHTML = '';
|
elem.innerHTML = '';
|
||||||
elem.removeAttribute("src");
|
elem.removeAttribute('src');
|
||||||
|
|
||||||
destroyHlsPlayer(instance);
|
destroyHlsPlayer(instance);
|
||||||
destroyFlvPlayer(instance);
|
destroyFlvPlayer(instance);
|
||||||
|
@ -463,4 +481,4 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||||
getCrossOriginValue: getCrossOriginValue,
|
getCrossOriginValue: getCrossOriginValue,
|
||||||
getBufferedRanges: getBufferedRanges
|
getBufferedRanges: getBufferedRanges
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
define(['events', 'browser', 'require', 'apphost', 'appSettings', 'htmlMediaHelper'], function (events, browser, require, appHost, appSettings, htmlMediaHelper) {
|
define(['events', 'browser', 'require', 'apphost', 'appSettings', 'htmlMediaHelper'], function (events, browser, require, appHost, appSettings, htmlMediaHelper) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
|
||||||
function getDefaultProfile() {
|
function getDefaultProfile() {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
@ -16,7 +16,7 @@ define(['events', 'browser', 'require', 'apphost', 'appSettings', 'htmlMediaHelp
|
||||||
// Need to record the starting volume on each pass rather than querying elem.volume
|
// Need to record the starting volume on each pass rather than querying elem.volume
|
||||||
// This is due to iOS safari not allowing volume changes and always returning the system volume value
|
// This is due to iOS safari not allowing volume changes and always returning the system volume value
|
||||||
var newVolume = Math.max(0, startingVolume - 0.15);
|
var newVolume = Math.max(0, startingVolume - 0.15);
|
||||||
console.log('fading volume to ' + newVolume);
|
console.debug('fading volume to ' + newVolume);
|
||||||
elem.volume = newVolume;
|
elem.volume = newVolume;
|
||||||
|
|
||||||
if (newVolume <= 0) {
|
if (newVolume <= 0) {
|
||||||
|
@ -101,7 +101,7 @@ define(['events', 'browser', 'require', 'apphost', 'appSettings', 'htmlMediaHelp
|
||||||
self._timeUpdated = false;
|
self._timeUpdated = false;
|
||||||
self._currentTime = null;
|
self._currentTime = null;
|
||||||
|
|
||||||
var elem = createMediaElement(options);
|
var elem = createMediaElement();
|
||||||
return setCurrentSrc(elem, options);
|
return setCurrentSrc(elem, options);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -113,7 +113,7 @@ define(['events', 'browser', 'require', 'apphost', 'appSettings', 'htmlMediaHelp
|
||||||
bindEvents(elem);
|
bindEvents(elem);
|
||||||
|
|
||||||
var val = options.url;
|
var val = options.url;
|
||||||
console.log('playing url: ' + val);
|
console.debug('playing url: ' + val);
|
||||||
|
|
||||||
// Convert to seconds
|
// Convert to seconds
|
||||||
var seconds = (options.playerStartPositionTicks || 0) / 10000000;
|
var seconds = (options.playerStartPositionTicks || 0) / 10000000;
|
||||||
|
@ -298,7 +298,7 @@ define(['events', 'browser', 'require', 'apphost', 'appSettings', 'htmlMediaHelp
|
||||||
|
|
||||||
var errorCode = this.error ? (this.error.code || 0) : 0;
|
var errorCode = this.error ? (this.error.code || 0) : 0;
|
||||||
var errorMessage = this.error ? (this.error.message || '') : '';
|
var errorMessage = this.error ? (this.error.message || '') : '';
|
||||||
console.log('Media element error: ' + errorCode.toString() + ' ' + errorMessage);
|
console.error('media element error: ' + errorCode.toString() + ' ' + errorMessage);
|
||||||
|
|
||||||
var type;
|
var type;
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackManager', 'appRouter', 'appSettings', 'connectionManager', 'htmlMediaHelper', 'itemHelper', 'fullscreenManager', 'globalize'], function (browser, require, events, appHost, loading, dom, playbackManager, appRouter, appSettings, connectionManager, htmlMediaHelper, itemHelper, fullscreenManager, globalize) {
|
define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackManager', 'appRouter', 'appSettings', 'connectionManager', 'htmlMediaHelper', 'itemHelper', 'screenfull', 'globalize'], function (browser, require, events, appHost, loading, dom, playbackManager, appRouter, appSettings, connectionManager, htmlMediaHelper, itemHelper, screenfull, globalize) {
|
||||||
"use strict";
|
'use strict';
|
||||||
|
/* globals cast */
|
||||||
|
|
||||||
var mediaManager;
|
var mediaManager;
|
||||||
|
|
||||||
|
@ -11,7 +12,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
try {
|
try {
|
||||||
parentNode.removeChild(elem);
|
parentNode.removeChild(elem);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error removing dialog element: ' + err);
|
console.error('error removing dialog element: ' + err);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,7 +80,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
if (track) {
|
if (track) {
|
||||||
var format = (track.Codec || '').toLowerCase();
|
var format = (track.Codec || '').toLowerCase();
|
||||||
if (format === 'ssa' || format === 'ass') {
|
if (format === 'ssa' || format === 'ass') {
|
||||||
// libjass is needed here
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -116,8 +116,9 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function normalizeTrackEventText(text) {
|
function normalizeTrackEventText(text, useHtml) {
|
||||||
return text.replace(/\\N/gi, '\n');
|
var result = text.replace(/\\N/gi, '\n').replace(/\r/gi, '');
|
||||||
|
return useHtml ? result.replace(/\n/gi, '<br>') : result;
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTracks(elem, tracks, item, mediaSource) {
|
function setTracks(elem, tracks, item, mediaSource) {
|
||||||
|
@ -211,7 +212,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
function incrementFetchQueue() {
|
function incrementFetchQueue() {
|
||||||
if (self._fetchQueue <= 0) {
|
if (self._fetchQueue <= 0) {
|
||||||
self.isFetching = true;
|
self.isFetching = true;
|
||||||
events.trigger(self, "beginFetch");
|
events.trigger(self, 'beginFetch');
|
||||||
}
|
}
|
||||||
|
|
||||||
self._fetchQueue++;
|
self._fetchQueue++;
|
||||||
|
@ -222,7 +223,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
if (self._fetchQueue <= 0) {
|
if (self._fetchQueue <= 0) {
|
||||||
self.isFetching = false;
|
self.isFetching = false;
|
||||||
events.trigger(self, "endFetch");
|
events.trigger(self, 'endFetch');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,7 +243,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
console.log('prefetching hls playlist: ' + hlsPlaylistUrl);
|
console.debug('prefetching hls playlist: ' + hlsPlaylistUrl);
|
||||||
|
|
||||||
return connectionManager.getApiClient(item.ServerId).ajax({
|
return connectionManager.getApiClient(item.ServerId).ajax({
|
||||||
|
|
||||||
|
@ -251,7 +252,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
|
||||||
console.log('completed prefetching hls playlist: ' + hlsPlaylistUrl);
|
console.debug('completed prefetching hls playlist: ' + hlsPlaylistUrl);
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
streamInfo.url = hlsPlaylistUrl;
|
streamInfo.url = hlsPlaylistUrl;
|
||||||
|
@ -260,7 +261,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
}, function () {
|
}, function () {
|
||||||
|
|
||||||
console.log('error prefetching hls playlist: ' + hlsPlaylistUrl);
|
console.error('error prefetching hls playlist: ' + hlsPlaylistUrl);
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
@ -357,6 +358,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
require(['shaka'], function () {
|
require(['shaka'], function () {
|
||||||
|
/* globals shaka */
|
||||||
|
|
||||||
var player = new shaka.Player(elem);
|
var player = new shaka.Player(elem);
|
||||||
|
|
||||||
|
@ -408,7 +410,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
lrd.media.streamType = cast.receiver.media.StreamType.OTHER;
|
lrd.media.streamType = cast.receiver.media.StreamType.OTHER;
|
||||||
lrd.media.customData = options;
|
lrd.media.customData = options;
|
||||||
|
|
||||||
console.log('loading media url into mediaManager');
|
console.debug('loading media url into media manager');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
mediaManager.load(lrd);
|
mediaManager.load(lrd);
|
||||||
|
@ -418,7 +420,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
|
|
||||||
console.log('mediaManager error: ' + err);
|
console.debug('media manager error: ' + err);
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -460,11 +462,11 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
protocol = cast.player.api.CreateSmoothStreamingProtocol(host);
|
protocol = cast.player.api.CreateSmoothStreamingProtocol(host);
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('loading playback url: ' + url);
|
console.debug('loading playback url: ' + url);
|
||||||
console.log('contentType: ' + contentType);
|
console.debug('content type: ' + contentType);
|
||||||
|
|
||||||
host.onError = function (errorCode) {
|
host.onError = function (errorCode) {
|
||||||
console.log("Fatal Error - " + errorCode);
|
console.error('fatal Error - ' + errorCode);
|
||||||
};
|
};
|
||||||
|
|
||||||
mediaElement.autoplay = false;
|
mediaElement.autoplay = false;
|
||||||
|
@ -499,7 +501,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
elem.removeEventListener('error', onError);
|
elem.removeEventListener('error', onError);
|
||||||
|
|
||||||
var val = options.url;
|
var val = options.url;
|
||||||
console.log('playing url: ' + val);
|
console.debug('playing url: ' + val);
|
||||||
|
|
||||||
// Convert to seconds
|
// Convert to seconds
|
||||||
var seconds = (options.playerStartPositionTicks || 0) / 10000000;
|
var seconds = (options.playerStartPositionTicks || 0) / 10000000;
|
||||||
|
@ -566,19 +568,19 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
self.resetSubtitleOffset = function() {
|
self.resetSubtitleOffset = function() {
|
||||||
currentTrackOffset = 0;
|
currentTrackOffset = 0;
|
||||||
showTrackOffset = false;
|
showTrackOffset = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
self.enableShowingSubtitleOffset = function() {
|
self.enableShowingSubtitleOffset = function() {
|
||||||
showTrackOffset = true;
|
showTrackOffset = true;
|
||||||
}
|
};
|
||||||
|
|
||||||
self.disableShowingSubtitleOffset = function() {
|
self.disableShowingSubtitleOffset = function() {
|
||||||
showTrackOffset = false;
|
showTrackOffset = false;
|
||||||
}
|
};
|
||||||
|
|
||||||
self.isShowingSubtitleOffsetEnabled = function() {
|
self.isShowingSubtitleOffsetEnabled = function() {
|
||||||
return showTrackOffset;
|
return showTrackOffset;
|
||||||
}
|
};
|
||||||
|
|
||||||
function getTextTrack() {
|
function getTextTrack() {
|
||||||
var videoElement = self._mediaElement;
|
var videoElement = self._mediaElement;
|
||||||
|
@ -598,8 +600,9 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
var offsetValue = parseFloat(offset);
|
var offsetValue = parseFloat(offset);
|
||||||
|
|
||||||
// if .ass currently rendering
|
// if .ass currently rendering
|
||||||
if (currentAssRenderer) {
|
if (currentSubtitlesOctopus) {
|
||||||
updateCurrentTrackOffset(offsetValue);
|
updateCurrentTrackOffset(offsetValue);
|
||||||
|
currentSubtitlesOctopus.timeOffset = offsetValue;
|
||||||
} else {
|
} else {
|
||||||
var trackElement = getTextTrack();
|
var trackElement = getTextTrack();
|
||||||
// if .vtt currently rendering
|
// if .vtt currently rendering
|
||||||
|
@ -608,7 +611,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
} else if (currentTrackEvents) {
|
} else if (currentTrackEvents) {
|
||||||
setTrackEventsSubtitleOffset(currentTrackEvents, offsetValue);
|
setTrackEventsSubtitleOffset(currentTrackEvents, offsetValue);
|
||||||
} else {
|
} else {
|
||||||
console.log("No available track, cannot apply offset: ", offsetValue);
|
console.debug('No available track, cannot apply offset: ', offsetValue);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -650,7 +653,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
self.getSubtitleOffset = function() {
|
self.getSubtitleOffset = function() {
|
||||||
return currentTrackOffset;
|
return currentTrackOffset;
|
||||||
}
|
};
|
||||||
|
|
||||||
function isAudioStreamSupported(stream, deviceProfile) {
|
function isAudioStreamSupported(stream, deviceProfile) {
|
||||||
|
|
||||||
|
@ -727,22 +730,18 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
// https://msdn.microsoft.com/en-us/library/hh772507(v=vs.85).aspx
|
// https://msdn.microsoft.com/en-us/library/hh772507(v=vs.85).aspx
|
||||||
|
|
||||||
var elemAudioTracks = elem.audioTracks || [];
|
var elemAudioTracks = elem.audioTracks || [];
|
||||||
console.log('found ' + elemAudioTracks.length + ' audio tracks');
|
console.debug('found ' + elemAudioTracks.length + ' audio tracks');
|
||||||
|
|
||||||
for (i = 0, length = elemAudioTracks.length; i < length; i++) {
|
for (i = 0, length = elemAudioTracks.length; i < length; i++) {
|
||||||
|
|
||||||
if (audioIndex === i) {
|
if (audioIndex === i) {
|
||||||
console.log('setting audio track ' + i + ' to enabled');
|
console.debug('setting audio track ' + i + ' to enabled');
|
||||||
elemAudioTracks[i].enabled = true;
|
elemAudioTracks[i].enabled = true;
|
||||||
} else {
|
} else {
|
||||||
console.log('setting audio track ' + i + ' to disabled');
|
console.debug('setting audio track ' + i + ' to disabled');
|
||||||
elemAudioTracks[i].enabled = false;
|
elemAudioTracks[i].enabled = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function () {
|
|
||||||
elem.currentTime = elem.currentTime;
|
|
||||||
}, 100);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.stop = function (destroyPlayer) {
|
self.stop = function (destroyPlayer) {
|
||||||
|
@ -796,7 +795,9 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
dlg.parentNode.removeChild(dlg);
|
dlg.parentNode.removeChild(dlg);
|
||||||
}
|
}
|
||||||
|
|
||||||
fullscreenManager.exitFullscreen();
|
if (screenfull.isEnabled) {
|
||||||
|
screenfull.exit();
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function onEnded() {
|
function onEnded() {
|
||||||
|
@ -858,7 +859,9 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
htmlMediaHelper.seekOnPlaybackStart(self, e.target, self._currentPlayOptions.playerStartPositionTicks);
|
htmlMediaHelper.seekOnPlaybackStart(self, e.target, self._currentPlayOptions.playerStartPositionTicks, function () {
|
||||||
|
if (currentSubtitlesOctopus) currentSubtitlesOctopus.resize();
|
||||||
|
});
|
||||||
|
|
||||||
if (self._currentPlayOptions.fullscreen) {
|
if (self._currentPlayOptions.fullscreen) {
|
||||||
|
|
||||||
|
@ -911,7 +914,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
function onError() {
|
function onError() {
|
||||||
var errorCode = this.error ? (this.error.code || 0) : 0;
|
var errorCode = this.error ? (this.error.code || 0) : 0;
|
||||||
var errorMessage = this.error ? (this.error.message || '') : '';
|
var errorMessage = this.error ? (this.error.message || '') : '';
|
||||||
console.log('Media element error: ' + errorCode.toString() + ' ' + errorMessage);
|
console.error('media element error: ' + errorCode.toString() + ' ' + errorMessage);
|
||||||
|
|
||||||
var type;
|
var type;
|
||||||
|
|
||||||
|
@ -1022,7 +1025,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
xhr.onerror = function (e) {
|
xhr.onerror = function (e) {
|
||||||
reject(e);
|
reject(e);
|
||||||
decrementFetchQueue();
|
decrementFetchQueue();
|
||||||
}
|
};
|
||||||
|
|
||||||
xhr.send();
|
xhr.send();
|
||||||
});
|
});
|
||||||
|
@ -1049,99 +1052,38 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
lastCustomTrackMs = 0;
|
lastCustomTrackMs = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderWithSubtitlesOctopus(videoElement, track, item) {
|
function renderSsaAss(videoElement, track, item) {
|
||||||
var attachments = self._currentPlayOptions.mediaSource.MediaAttachments || [];
|
var attachments = self._currentPlayOptions.mediaSource.MediaAttachments || [];
|
||||||
|
var apiClient = connectionManager.getApiClient(item);
|
||||||
var options = {
|
var options = {
|
||||||
video: videoElement,
|
video: videoElement,
|
||||||
subUrl: getTextTrackUrl(track, item),
|
subUrl: getTextTrackUrl(track, item),
|
||||||
fonts: attachments.map(function (i) {
|
fonts: attachments.map(function (i) {
|
||||||
return i.DeliveryUrl;
|
return apiClient.getUrl(i.DeliveryUrl);
|
||||||
}),
|
}),
|
||||||
workerUrl: appRouter.baseUrl() + "/libraries/subtitles-octopus-worker.js",
|
workerUrl: appRouter.baseUrl() + '/libraries/subtitles-octopus-worker.js',
|
||||||
|
legacyWorkerUrl: appRouter.baseUrl() + '/libraries/subtitles-octopus-worker-legacy.js',
|
||||||
onError: function() {
|
onError: function() {
|
||||||
htmlMediaHelper.onErrorInternal(self, 'mediadecodeerror')
|
htmlMediaHelper.onErrorInternal(self, 'mediadecodeerror');
|
||||||
}
|
},
|
||||||
|
|
||||||
|
// new octopus options; override all, even defaults
|
||||||
|
renderMode: 'blend',
|
||||||
|
dropAllAnimations: false,
|
||||||
|
libassMemoryLimit: 40,
|
||||||
|
libassGlyphLimit: 40,
|
||||||
|
targetFps: 24,
|
||||||
|
prescaleTradeoff: 0.8,
|
||||||
|
softHeightLimit: 1080,
|
||||||
|
hardHeightLimit: 2160,
|
||||||
|
resizeVariation: 0.2,
|
||||||
|
renderAhead: 90
|
||||||
};
|
};
|
||||||
require(['JavascriptSubtitlesOctopus'], function(SubtitlesOctopus) {
|
require(['JavascriptSubtitlesOctopus'], function(SubtitlesOctopus) {
|
||||||
currentSubtitlesOctopus = new SubtitlesOctopus(options);
|
currentSubtitlesOctopus = new SubtitlesOctopus(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderWithLibjass(videoElement, track, item) {
|
|
||||||
|
|
||||||
var rendererSettings = {};
|
|
||||||
|
|
||||||
if (browser.ps4) {
|
|
||||||
// Text outlines are not rendering very well
|
|
||||||
rendererSettings.enableSvg = false;
|
|
||||||
} else if (browser.edge || browser.msie) {
|
|
||||||
// svg not rendering at all
|
|
||||||
rendererSettings.enableSvg = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// probably safer to just disable everywhere
|
|
||||||
rendererSettings.enableSvg = false;
|
|
||||||
|
|
||||||
require(['libjass', 'ResizeObserver'], function (libjass, ResizeObserver) {
|
|
||||||
|
|
||||||
libjass.ASS.fromUrl(getTextTrackUrl(track, item)).then(function (ass) {
|
|
||||||
|
|
||||||
var clock = new libjass.renderers.ManualClock();
|
|
||||||
currentClock = clock;
|
|
||||||
|
|
||||||
// Create a DefaultRenderer using the video element and the ASS object
|
|
||||||
var renderer = new libjass.renderers.WebRenderer(ass, clock, videoElement.parentNode, rendererSettings);
|
|
||||||
|
|
||||||
currentAssRenderer = renderer;
|
|
||||||
|
|
||||||
renderer.addEventListener("ready", function () {
|
|
||||||
try {
|
|
||||||
renderer.resize(videoElement.offsetWidth, videoElement.offsetHeight, 0, 0);
|
|
||||||
|
|
||||||
if (!self._resizeObserver) {
|
|
||||||
self._resizeObserver = new ResizeObserver(onVideoResize, {});
|
|
||||||
self._resizeObserver.observe(videoElement);
|
|
||||||
}
|
|
||||||
//clock.pause();
|
|
||||||
} catch (ex) {
|
|
||||||
//alert(ex);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}, function () {
|
|
||||||
htmlMediaHelper.onErrorInternal(self, 'mediadecodeerror');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function renderSsaAss(videoElement, track, item) {
|
|
||||||
if (supportsCanvas() && supportsWebWorkers()) {
|
|
||||||
renderWithSubtitlesOctopus(videoElement, track, item);
|
|
||||||
} else {
|
|
||||||
console.log('rendering subtitles with libjass');
|
|
||||||
renderWithLibjass(videoElement, track, item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function onVideoResize() {
|
|
||||||
if (browser.iOS) {
|
|
||||||
// the new sizes will be delayed for about 500ms with wkwebview
|
|
||||||
setTimeout(resetVideoRendererSize, 500);
|
|
||||||
} else {
|
|
||||||
resetVideoRendererSize();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function resetVideoRendererSize() {
|
|
||||||
var renderer = currentAssRenderer;
|
|
||||||
if (renderer) {
|
|
||||||
var videoElement = self._mediaElement;
|
|
||||||
var width = videoElement.offsetWidth;
|
|
||||||
var height = videoElement.offsetHeight;
|
|
||||||
console.log('videoElement resized: ' + width + 'x' + height);
|
|
||||||
renderer.resize(width, height, 0, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function requiresCustomSubtitlesElement() {
|
function requiresCustomSubtitlesElement() {
|
||||||
|
|
||||||
// after a system update, ps4 isn't showing anything when creating a track element dynamically
|
// after a system update, ps4 isn't showing anything when creating a track element dynamically
|
||||||
|
@ -1231,7 +1173,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
if (!itemHelper.isLocalItem(item) || track.IsExternal) {
|
if (!itemHelper.isLocalItem(item) || track.IsExternal) {
|
||||||
var format = (track.Codec || '').toLowerCase();
|
var format = (track.Codec || '').toLowerCase();
|
||||||
if (format === 'ssa' || format === 'ass') {
|
if (format === 'ssa' || format === 'ass') {
|
||||||
// libjass is needed here
|
|
||||||
renderSsaAss(videoElement, track, item);
|
renderSsaAss(videoElement, track, item);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1254,7 +1195,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
trackElement.removeCue(trackElement.cues[0]);
|
trackElement.removeCue(trackElement.cues[0]);
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log('Error removing cue from textTrack');
|
console.error('error removing cue from textTrack');
|
||||||
}
|
}
|
||||||
|
|
||||||
trackElement.mode = 'disabled';
|
trackElement.mode = 'disabled';
|
||||||
|
@ -1268,13 +1209,13 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
fetchSubtitles(track, item).then(function (data) {
|
fetchSubtitles(track, item).then(function (data) {
|
||||||
|
|
||||||
// show in ui
|
// show in ui
|
||||||
console.log('downloaded ' + data.TrackEvents.length + ' track events');
|
console.debug('downloaded ' + data.TrackEvents.length + ' track events');
|
||||||
// add some cues to show the text
|
// add some cues to show the text
|
||||||
// in safari, the cues need to be added before setting the track mode to showing
|
// in safari, the cues need to be added before setting the track mode to showing
|
||||||
data.TrackEvents.forEach(function (trackEvent) {
|
data.TrackEvents.forEach(function (trackEvent) {
|
||||||
|
|
||||||
var trackCueObject = window.VTTCue || window.TextTrackCue;
|
var trackCueObject = window.VTTCue || window.TextTrackCue;
|
||||||
var cue = new trackCueObject(trackEvent.StartPositionTicks / 10000000, trackEvent.EndPositionTicks / 10000000, normalizeTrackEventText(trackEvent.Text));
|
var cue = new trackCueObject(trackEvent.StartPositionTicks / 10000000, trackEvent.EndPositionTicks / 10000000, normalizeTrackEventText(trackEvent.Text, false));
|
||||||
|
|
||||||
trackElement.addCue(cue);
|
trackElement.addCue(cue);
|
||||||
});
|
});
|
||||||
|
@ -1284,17 +1225,12 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
function updateSubtitleText(timeMs) {
|
function updateSubtitleText(timeMs) {
|
||||||
|
|
||||||
// handle offset for ass tracks
|
|
||||||
if (currentTrackOffset) {
|
|
||||||
timeMs += (currentTrackOffset * 1000);
|
|
||||||
}
|
|
||||||
|
|
||||||
var clock = currentClock;
|
var clock = currentClock;
|
||||||
if (clock) {
|
if (clock) {
|
||||||
try {
|
try {
|
||||||
clock.seek(timeMs / 1000);
|
clock.seek(timeMs / 1000);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.log('Error in libjass: ' + err);
|
console.error('error in libjass: ' + err);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1315,8 +1251,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedTrackEvent && selectedTrackEvent.Text) {
|
if (selectedTrackEvent && selectedTrackEvent.Text) {
|
||||||
|
subtitleTextElement.innerHTML = normalizeTrackEventText(selectedTrackEvent.Text, true);
|
||||||
subtitleTextElement.innerHTML = normalizeTrackEventText(selectedTrackEvent.Text);
|
|
||||||
subtitleTextElement.classList.remove('hide');
|
subtitleTextElement.classList.remove('hide');
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1327,7 +1262,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
function setCurrentTrackElement(streamIndex) {
|
function setCurrentTrackElement(streamIndex) {
|
||||||
|
|
||||||
console.log('Setting new text track index to: ' + streamIndex);
|
console.debug('setting new text track index to: ' + streamIndex);
|
||||||
|
|
||||||
var mediaStreamTextTracks = getMediaStreamTextTracks(self._currentPlayOptions.mediaSource);
|
var mediaStreamTextTracks = getMediaStreamTextTracks(self._currentPlayOptions.mediaSource);
|
||||||
|
|
||||||
|
@ -1348,38 +1283,6 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateTextStreamUrls(startPositionTicks) {
|
|
||||||
|
|
||||||
if (!supportsTextTracks()) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var allTracks = self._mediaElement.textTracks; // get list of tracks
|
|
||||||
var i;
|
|
||||||
var track;
|
|
||||||
|
|
||||||
for (i = 0; i < allTracks.length; i++) {
|
|
||||||
|
|
||||||
track = allTracks[i];
|
|
||||||
|
|
||||||
// This throws an error in IE, but is fine in chrome
|
|
||||||
// In IE it's not necessary anyway because changing the src seems to be enough
|
|
||||||
try {
|
|
||||||
while (track.cues.length) {
|
|
||||||
track.removeCue(track.cues[0]);
|
|
||||||
}
|
|
||||||
} catch (e) {
|
|
||||||
console.log('Error removing cue from textTrack');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
var tracks = self._mediaElement.querySelectorAll('track');
|
|
||||||
for (i = 0; i < tracks.length; i++) {
|
|
||||||
track = tracks[i];
|
|
||||||
track.src = replaceQueryString(track.src, 'startPositionTicks', startPositionTicks);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function createMediaElement(options) {
|
function createMediaElement(options) {
|
||||||
|
|
||||||
if (browser.tv || browser.iOS || browser.mobile) {
|
if (browser.tv || browser.iOS || browser.mobile) {
|
||||||
|
@ -1509,12 +1412,12 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
var list = [];
|
var list = [];
|
||||||
|
|
||||||
var video = document.createElement('video');
|
var video = document.createElement('video');
|
||||||
if (video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === "function" || document.pictureInPictureEnabled) {
|
if (video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === 'function' || document.pictureInPictureEnabled) {
|
||||||
list.push('PictureInPicture');
|
list.push('PictureInPicture');
|
||||||
} else if (browser.ipad) {
|
} else if (browser.ipad) {
|
||||||
// Unfortunately this creates a false positive on devices where its' not actually supported
|
// Unfortunately this creates a false positive on devices where its' not actually supported
|
||||||
if (navigator.userAgent.toLowerCase().indexOf('os 9') === -1) {
|
if (navigator.userAgent.toLowerCase().indexOf('os 9') === -1) {
|
||||||
if (video.webkitSupportsPresentationMode && video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === "function") {
|
if (video.webkitSupportsPresentationMode && video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === 'function') {
|
||||||
list.push('PictureInPicture');
|
list.push('PictureInPicture');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1525,11 +1428,11 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
}
|
}
|
||||||
|
|
||||||
if (browser.safari || browser.iOS || browser.iPad) {
|
if (browser.safari || browser.iOS || browser.iPad) {
|
||||||
list.push('AirPlay')
|
list.push('AirPlay');
|
||||||
}
|
}
|
||||||
|
|
||||||
list.push('SetBrightness');
|
list.push('SetBrightness');
|
||||||
list.push("SetAspectRatio")
|
list.push('SetAspectRatio');
|
||||||
|
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
@ -1590,7 +1493,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
};
|
};
|
||||||
|
|
||||||
function onPictureInPictureError(err) {
|
function onPictureInPictureError(err) {
|
||||||
console.log('Picture in picture error: ' + err.toString());
|
console.error('Picture in picture error: ' + err.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
HtmlVideoPlayer.prototype.setPictureInPictureEnabled = function (isEnabled) {
|
HtmlVideoPlayer.prototype.setPictureInPictureEnabled = function (isEnabled) {
|
||||||
|
@ -1614,8 +1517,8 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
Windows.UI.ViewManagement.ApplicationView.getForCurrentView().tryEnterViewModeAsync(Windows.UI.ViewManagement.ApplicationViewMode.default);
|
Windows.UI.ViewManagement.ApplicationView.getForCurrentView().tryEnterViewModeAsync(Windows.UI.ViewManagement.ApplicationViewMode.default);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (video && video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === "function") {
|
if (video && video.webkitSupportsPresentationMode && typeof video.webkitSetPresentationMode === 'function') {
|
||||||
video.webkitSetPresentationMode(isEnabled ? "picture-in-picture" : "inline");
|
video.webkitSetPresentationMode(isEnabled ? 'picture-in-picture' : 'inline');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -1629,7 +1532,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
} else {
|
} else {
|
||||||
var video = this._mediaElement;
|
var video = this._mediaElement;
|
||||||
if (video) {
|
if (video) {
|
||||||
return video.webkitPresentationMode === "picture-in-picture";
|
return video.webkitPresentationMode === 'picture-in-picture';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1651,9 +1554,13 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
if (document.AirPlayEnabled) {
|
if (document.AirPlayEnabled) {
|
||||||
if (video) {
|
if (video) {
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
video.requestAirPlay().catch(onAirPlayError);
|
video.requestAirPlay().catch(function(err) {
|
||||||
|
console.error('Error requesting AirPlay', err);
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
document.exitAirPLay().catch(onAirPlayError);
|
document.exitAirPLay().catch(function(err) {
|
||||||
|
console.error('Error exiting AirPlay', err);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -1784,30 +1691,30 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
HtmlVideoPlayer.prototype.setAspectRatio = function (val) {
|
HtmlVideoPlayer.prototype.setAspectRatio = function (val) {
|
||||||
var mediaElement = this._mediaElement;
|
var mediaElement = this._mediaElement;
|
||||||
if (mediaElement) {
|
if (mediaElement) {
|
||||||
if ("auto" === val) {
|
if ('auto' === val) {
|
||||||
mediaElement.style.removeProperty("object-fit")
|
mediaElement.style.removeProperty('object-fit');
|
||||||
} else {
|
} else {
|
||||||
mediaElement.style["object-fit"] = val
|
mediaElement.style['object-fit'] = val;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
this._currentAspectRatio = val
|
this._currentAspectRatio = val;
|
||||||
};
|
};
|
||||||
|
|
||||||
HtmlVideoPlayer.prototype.getAspectRatio = function () {
|
HtmlVideoPlayer.prototype.getAspectRatio = function () {
|
||||||
return this._currentAspectRatio || "auto";
|
return this._currentAspectRatio || 'auto';
|
||||||
};
|
};
|
||||||
|
|
||||||
HtmlVideoPlayer.prototype.getSupportedAspectRatios = function () {
|
HtmlVideoPlayer.prototype.getSupportedAspectRatios = function () {
|
||||||
return [{
|
return [{
|
||||||
name: "Auto",
|
name: 'Auto',
|
||||||
id: "auto"
|
id: 'auto'
|
||||||
}, {
|
}, {
|
||||||
name: "Cover",
|
name: 'Cover',
|
||||||
id: "cover"
|
id: 'cover'
|
||||||
}, {
|
}, {
|
||||||
name: "Fill",
|
name: 'Fill',
|
||||||
id: "fill"
|
id: 'fill'
|
||||||
}]
|
}];
|
||||||
};
|
};
|
||||||
|
|
||||||
HtmlVideoPlayer.prototype.togglePictureInPicture = function () {
|
HtmlVideoPlayer.prototype.togglePictureInPicture = function () {
|
||||||
|
@ -1855,7 +1762,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
if (protocol) {
|
if (protocol) {
|
||||||
mediaCategory.stats.push({
|
mediaCategory.stats.push({
|
||||||
label: globalize.translate("LabelProtocol"),
|
label: globalize.translate('LabelProtocol'),
|
||||||
value: protocol
|
value: protocol
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1865,12 +1772,12 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
if (this._hlsPlayer || this._shakaPlayer) {
|
if (this._hlsPlayer || this._shakaPlayer) {
|
||||||
mediaCategory.stats.push({
|
mediaCategory.stats.push({
|
||||||
label: globalize.translate("LabelStreamType"),
|
label: globalize.translate('LabelStreamType'),
|
||||||
value: 'HLS'
|
value: 'HLS'
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
mediaCategory.stats.push({
|
mediaCategory.stats.push({
|
||||||
label: globalize.translate("LabelStreamType"),
|
label: globalize.translate('LabelStreamType'),
|
||||||
value: 'Video'
|
value: 'Video'
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1888,7 +1795,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
// Don't show player dimensions on smart TVs because the app UI could be lower resolution than the video and this causes users to think there is a problem
|
// Don't show player dimensions on smart TVs because the app UI could be lower resolution than the video and this causes users to think there is a problem
|
||||||
if (width && height && !browser.tv) {
|
if (width && height && !browser.tv) {
|
||||||
videoCategory.stats.push({
|
videoCategory.stats.push({
|
||||||
label: globalize.translate("LabelPlayerDimensions"),
|
label: globalize.translate('LabelPlayerDimensions'),
|
||||||
value: width + 'x' + height
|
value: width + 'x' + height
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1898,7 +1805,7 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
if (width && height) {
|
if (width && height) {
|
||||||
videoCategory.stats.push({
|
videoCategory.stats.push({
|
||||||
label: globalize.translate("LabelVideoResolution"),
|
label: globalize.translate('LabelVideoResolution'),
|
||||||
value: width + 'x' + height
|
value: width + 'x' + height
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -1908,13 +1815,13 @@ define(['browser', 'require', 'events', 'apphost', 'loading', 'dom', 'playbackMa
|
||||||
|
|
||||||
var droppedVideoFrames = playbackQuality.droppedVideoFrames || 0;
|
var droppedVideoFrames = playbackQuality.droppedVideoFrames || 0;
|
||||||
videoCategory.stats.push({
|
videoCategory.stats.push({
|
||||||
label: globalize.translate("LabelDroppedFrames"),
|
label: globalize.translate('LabelDroppedFrames'),
|
||||||
value: droppedVideoFrames
|
value: droppedVideoFrames
|
||||||
});
|
});
|
||||||
|
|
||||||
var corruptedVideoFrames = playbackQuality.corruptedVideoFrames || 0;
|
var corruptedVideoFrames = playbackQuality.corruptedVideoFrames || 0;
|
||||||
videoCategory.stats.push({
|
videoCategory.stats.push({
|
||||||
label: globalize.translate("LabelCorruptedFrames"),
|
label: globalize.translate('LabelCorruptedFrames'),
|
||||||
value: corruptedVideoFrames
|
value: corruptedVideoFrames
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,73 +0,0 @@
|
||||||
define(["datetime"], function (datetime) {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function humaneDate(date_str) {
|
|
||||||
var format;
|
|
||||||
var time_formats = [
|
|
||||||
[90, "a minute"],
|
|
||||||
[3600, "minutes", 60],
|
|
||||||
[5400, "an hour"],
|
|
||||||
[86400, "hours", 3600],
|
|
||||||
[129600, "a day"],
|
|
||||||
[604800, "days", 86400],
|
|
||||||
[907200, "a week"],
|
|
||||||
[2628e3, "weeks", 604800],
|
|
||||||
[3942e3, "a month"],
|
|
||||||
[31536e3, "months", 2628e3],
|
|
||||||
[47304e3, "a year"],
|
|
||||||
[31536e5, "years", 31536e3]
|
|
||||||
];
|
|
||||||
var dt = new Date();
|
|
||||||
var date = datetime.parseISO8601Date(date_str, true);
|
|
||||||
var seconds = (dt - date) / 1000.0;
|
|
||||||
var i = 0;
|
|
||||||
|
|
||||||
if (seconds < 0) {
|
|
||||||
seconds = Math.abs(seconds);
|
|
||||||
}
|
|
||||||
for (; format = time_formats[i++];) {
|
|
||||||
if (seconds < format[0]) {
|
|
||||||
if (2 == format.length) {
|
|
||||||
return format[1] + " ago";
|
|
||||||
}
|
|
||||||
|
|
||||||
return Math.round(seconds / format[2]) + " " + format[1] + " ago";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (seconds > 47304e5) {
|
|
||||||
return Math.round(seconds / 47304e5) + " centuries ago";
|
|
||||||
}
|
|
||||||
|
|
||||||
return date_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
function humaneElapsed(firstDateStr, secondDateStr) {
|
|
||||||
// TODO replace this whole script with a library or something
|
|
||||||
var dateOne = new Date(firstDateStr);
|
|
||||||
var dateTwo = new Date(secondDateStr);
|
|
||||||
var delta = (dateTwo.getTime() - dateOne.getTime()) / 1e3;
|
|
||||||
var days = Math.floor(delta % 31536e3 / 86400);
|
|
||||||
var hours = Math.floor(delta % 31536e3 % 86400 / 3600);
|
|
||||||
var minutes = Math.floor(delta % 31536e3 % 86400 % 3600 / 60);
|
|
||||||
var seconds = Math.round(delta % 31536e3 % 86400 % 3600 % 60);
|
|
||||||
var elapsed = "";
|
|
||||||
elapsed += 1 == days ? days + " day " : "";
|
|
||||||
elapsed += days > 1 ? days + " days " : "";
|
|
||||||
elapsed += 1 == hours ? hours + " hour " : "";
|
|
||||||
elapsed += hours > 1 ? hours + " hours " : "";
|
|
||||||
elapsed += 1 == minutes ? minutes + " minute " : "";
|
|
||||||
elapsed += minutes > 1 ? minutes + " minutes " : "";
|
|
||||||
elapsed += elapsed.length > 0 ? "and " : "";
|
|
||||||
elapsed += 1 == seconds ? seconds + " second" : "";
|
|
||||||
elapsed += 0 == seconds || seconds > 1 ? seconds + " seconds" : "";
|
|
||||||
return elapsed;
|
|
||||||
}
|
|
||||||
|
|
||||||
window.humaneDate = humaneDate;
|
|
||||||
window.humaneElapsed = humaneElapsed;
|
|
||||||
return {
|
|
||||||
humaneDate: humaneDate,
|
|
||||||
humaneElapsed: humaneElapsed
|
|
||||||
};
|
|
||||||
});
|
|
|
@ -1,4 +1,4 @@
|
||||||
define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader', 'browser', 'layoutManager', 'scrollHelper', 'globalize', 'require', 'emby-checkbox', 'paper-icon-button-light', 'emby-button', 'formDialogStyle', 'cardStyle'], function (loading, appHost, dialogHelper, connectionManager, imageLoader, browser, layoutManager, scrollHelper, globalize, require) {
|
define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader', 'browser', 'layoutManager', 'scrollHelper', 'globalize', 'require', 'emby-checkbox', 'paper-icon-button-light', 'emby-button', 'formDialogStyle', 'cardStyle'], function (dom, loading, appHost, dialogHelper, connectionManager, imageLoader, browser, layoutManager, scrollHelper, globalize, require) {
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
var enableFocusTransform = !browser.slow && !browser.edge;
|
var enableFocusTransform = !browser.slow && !browser.edge;
|
||||||
|
@ -109,15 +109,15 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
html += '<span style="margin-right: 10px;">';
|
html += '<span style="margin-right: 10px;">';
|
||||||
|
|
||||||
var startAtDisplay = totalRecordCount ? startIndex + 1 : 0;
|
var startAtDisplay = totalRecordCount ? startIndex + 1 : 0;
|
||||||
html += startAtDisplay + '-' + recordsEnd + ' of ' + totalRecordCount;
|
html += globalize.translate('ListPaging', startAtDisplay, recordsEnd, totalRecordCount);
|
||||||
|
|
||||||
html += '</span>';
|
html += '</span>';
|
||||||
|
|
||||||
if (showControls) {
|
if (showControls) {
|
||||||
html += '<div data-role="controlgroup" data-type="horizontal" style="display:inline-block;">';
|
html += '<div data-role="controlgroup" data-type="horizontal" style="display:inline-block;">';
|
||||||
|
|
||||||
html += '<button is="paper-icon-button-light" title="' + globalize.translate('Previous') + '" class="btnPreviousPage autoSize" ' + (startIndex ? '' : 'disabled') + '><i class="material-icons arrow_back"></i></button>';
|
html += '<button is="paper-icon-button-light" title="' + globalize.translate('Previous') + '" class="btnPreviousPage autoSize" ' + (startIndex ? '' : 'disabled') + '><span class="material-icons arrow_back"></span></button>';
|
||||||
html += '<button is="paper-icon-button-light" title="' + globalize.translate('Next') + '" class="btnNextPage autoSize" ' + (startIndex + limit >= totalRecordCount ? 'disabled' : '') + '><i class="material-icons">arrow_forward</i></button>';
|
html += '<button is="paper-icon-button-light" title="' + globalize.translate('Next') + '" class="btnNextPage autoSize" ' + (startIndex + limit >= totalRecordCount ? 'disabled' : '') + '><span class="material-icons arrow_forward"></span></button>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -126,21 +126,7 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
return html;
|
return html;
|
||||||
}
|
}
|
||||||
|
|
||||||
function parentWithClass(elem, className) {
|
|
||||||
|
|
||||||
while (!elem.classList || !elem.classList.contains(className)) {
|
|
||||||
elem = elem.parentNode;
|
|
||||||
|
|
||||||
if (!elem) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return elem;
|
|
||||||
}
|
|
||||||
|
|
||||||
function downloadRemoteImage(page, apiClient, url, type, provider) {
|
function downloadRemoteImage(page, apiClient, url, type, provider) {
|
||||||
|
|
||||||
var options = getBaseRemoteOptions();
|
var options = getBaseRemoteOptions();
|
||||||
|
|
||||||
options.Type = type;
|
options.Type = type;
|
||||||
|
@ -152,17 +138,16 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
apiClient.downloadRemoteImage(options).then(function () {
|
apiClient.downloadRemoteImage(options).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
var dlg = parentWithClass(page, 'dialog');
|
var dlg = dom.parentWithClass(page, 'dialog');
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayUrl(url, apiClient) {
|
function getDisplayUrl(url, apiClient) {
|
||||||
return apiClient.getUrl("Images/Remote", { imageUrl: url });
|
return apiClient.getUrl('Images/Remote', { imageUrl: url });
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRemoteImageHtml(image, imageType, apiClient) {
|
function getRemoteImageHtml(image, imageType, apiClient) {
|
||||||
|
|
||||||
var tagName = layoutManager.tv ? 'button' : 'div';
|
var tagName = layoutManager.tv ? 'button' : 'div';
|
||||||
var enableFooterButtons = !layoutManager.tv;
|
var enableFooterButtons = !layoutManager.tv;
|
||||||
|
|
||||||
|
@ -170,21 +155,21 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
var cssClass = "card scalableCard imageEditorCard";
|
var cssClass = 'card scalableCard imageEditorCard';
|
||||||
var cardBoxCssClass = 'cardBox visualCardBox';
|
var cardBoxCssClass = 'cardBox visualCardBox';
|
||||||
|
|
||||||
var shape = 'backdrop';
|
var shape = 'backdrop';
|
||||||
if (imageType === "Backdrop" || imageType === "Art" || imageType === "Thumb" || imageType === "Logo") {
|
if (imageType === 'Backdrop' || imageType === 'Art' || imageType === 'Thumb' || imageType === 'Logo') {
|
||||||
shape = 'backdrop';
|
shape = 'backdrop';
|
||||||
} else if (imageType === "Banner") {
|
} else if (imageType === 'Banner') {
|
||||||
shape = 'banner';
|
shape = 'banner';
|
||||||
} else if (imageType === "Disc") {
|
} else if (imageType === 'Disc') {
|
||||||
shape = 'square';
|
shape = 'square';
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (currentItemType === "Episode") {
|
if (currentItemType === 'Episode') {
|
||||||
shape = 'backdrop';
|
shape = 'backdrop';
|
||||||
} else if (currentItemType === "MusicAlbum" || currentItemType === "MusicArtist") {
|
} else if (currentItemType === 'MusicAlbum' || currentItemType === 'MusicArtist') {
|
||||||
shape = 'square';
|
shape = 'square';
|
||||||
} else {
|
} else {
|
||||||
shape = 'portrait';
|
shape = 'portrait';
|
||||||
|
@ -256,18 +241,18 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
|
|
||||||
html += '<div class="cardText cardText-secondary cardTextCentered">';
|
html += '<div class="cardText cardText-secondary cardTextCentered">';
|
||||||
|
|
||||||
if (image.RatingType === "Likes") {
|
if (image.RatingType === 'Likes') {
|
||||||
html += image.CommunityRating + (image.CommunityRating === 1 ? " like" : " likes");
|
html += image.CommunityRating + (image.CommunityRating === 1 ? ' like' : ' likes');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
if (image.CommunityRating) {
|
if (image.CommunityRating) {
|
||||||
html += image.CommunityRating.toFixed(1);
|
html += image.CommunityRating.toFixed(1);
|
||||||
|
|
||||||
if (image.VoteCount) {
|
if (image.VoteCount) {
|
||||||
html += ' • ' + image.VoteCount + (image.VoteCount === 1 ? " vote" : " votes");
|
html += ' • ' + image.VoteCount + (image.VoteCount === 1 ? ' vote' : ' votes');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
html += "Unrated";
|
html += 'Unrated';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -277,7 +262,7 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
if (enableFooterButtons) {
|
if (enableFooterButtons) {
|
||||||
html += '<div class="cardText cardTextCentered">';
|
html += '<div class="cardText cardTextCentered">';
|
||||||
|
|
||||||
html += '<button is="paper-icon-button-light" class="btnDownloadRemoteImage autoSize" raised" title="' + globalize.translate('Download') + '"><i class="material-icons">cloud_download</i></button>';
|
html += '<button is="paper-icon-button-light" class="btnDownloadRemoteImage autoSize" raised" title="' + globalize.translate('Download') + '"><span class="material-icons cloud_download"></span></button>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -293,7 +278,6 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
}
|
}
|
||||||
|
|
||||||
function initEditor(page, apiClient) {
|
function initEditor(page, apiClient) {
|
||||||
|
|
||||||
page.querySelector('#selectBrowsableImageType').addEventListener('change', function () {
|
page.querySelector('#selectBrowsableImageType').addEventListener('change', function () {
|
||||||
browsableImageType = this.value;
|
browsableImageType = this.value;
|
||||||
browsableImageStartIndex = 0;
|
browsableImageStartIndex = 0;
|
||||||
|
@ -319,14 +303,14 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
|
|
||||||
page.addEventListener('click', function (e) {
|
page.addEventListener('click', function (e) {
|
||||||
|
|
||||||
var btnDownloadRemoteImage = parentWithClass(e.target, 'btnDownloadRemoteImage');
|
var btnDownloadRemoteImage = dom.parentWithClass(e.target, 'btnDownloadRemoteImage');
|
||||||
if (btnDownloadRemoteImage) {
|
if (btnDownloadRemoteImage) {
|
||||||
var card = parentWithClass(btnDownloadRemoteImage, 'card');
|
var card = dom.parentWithClass(btnDownloadRemoteImage, 'card');
|
||||||
downloadRemoteImage(page, apiClient, card.getAttribute('data-imageurl'), card.getAttribute('data-imagetype'), card.getAttribute('data-imageprovider'));
|
downloadRemoteImage(page, apiClient, card.getAttribute('data-imageurl'), card.getAttribute('data-imagetype'), card.getAttribute('data-imageprovider'));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var btnImageCard = parentWithClass(e.target, 'btnImageCard');
|
var btnImageCard = dom.parentWithClass(e.target, 'btnImageCard');
|
||||||
if (btnImageCard) {
|
if (btnImageCard) {
|
||||||
downloadRemoteImage(page, apiClient, btnImageCard.getAttribute('data-imageurl'), btnImageCard.getAttribute('data-imagetype'), btnImageCard.getAttribute('data-imageprovider'));
|
downloadRemoteImage(page, apiClient, btnImageCard.getAttribute('data-imageurl'), btnImageCard.getAttribute('data-imagetype'), btnImageCard.getAttribute('data-imageprovider'));
|
||||||
}
|
}
|
||||||
|
@ -334,7 +318,6 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
}
|
}
|
||||||
|
|
||||||
function showEditor(itemId, serverId, itemType) {
|
function showEditor(itemId, serverId, itemType) {
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
require(['text!./imagedownloader.template.html'], function (template) {
|
require(['text!./imagedownloader.template.html'], function (template) {
|
||||||
|
@ -380,7 +363,6 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
||||||
var dlg = this;
|
var dlg = this;
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
|
@ -397,9 +379,7 @@ define(['loading', 'apphost', 'dialogHelper', 'connectionManager', 'imageLoader'
|
||||||
|
|
||||||
return {
|
return {
|
||||||
show: function (itemId, serverId, itemType, imageType) {
|
show: function (itemId, serverId, itemType, imageType) {
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
|
||||||
currentResolve = resolve;
|
currentResolve = resolve;
|
||||||
currentReject = reject;
|
currentReject = reject;
|
||||||
hasChanges = false;
|
hasChanges = false;
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue