mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge branch 'master' into migrate-to-ES6-42
This commit is contained in:
commit
a39834c705
270 changed files with 6321 additions and 8694 deletions
|
@ -6,7 +6,6 @@ let currentDisplayText = '';
|
|||
let currentDisplayTextContainer;
|
||||
|
||||
function onKeyDown(e) {
|
||||
|
||||
if (e.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
|
@ -21,7 +20,6 @@ function onKeyDown(e) {
|
|||
let chr = key ? alphanumeric(key) : null;
|
||||
|
||||
if (chr) {
|
||||
|
||||
chr = chr.toString().toUpperCase();
|
||||
|
||||
if (chr.length === 1) {
|
||||
|
@ -82,12 +80,10 @@ function onAlphanumericShortcutTimeout() {
|
|||
}
|
||||
|
||||
function selectByShortcutValue(container, value) {
|
||||
|
||||
value = value.toUpperCase();
|
||||
|
||||
let focusElem;
|
||||
if (value === '#') {
|
||||
|
||||
focusElem = container.querySelector('*[data-prefix]');
|
||||
}
|
||||
|
||||
|
@ -102,7 +98,6 @@ function selectByShortcutValue(container, value) {
|
|||
|
||||
class AlphaNumericShortcuts {
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
|
||||
const keyDownHandler = onKeyDown.bind(this);
|
||||
|
@ -114,7 +109,6 @@ class AlphaNumericShortcuts {
|
|||
this.keyDownHandler = keyDownHandler;
|
||||
}
|
||||
destroy() {
|
||||
|
||||
const keyDownHandler = this.keyDownHandler;
|
||||
|
||||
if (keyDownHandler) {
|
||||
|
|
8
src/scripts/autoThemes.js
Normal file
8
src/scripts/autoThemes.js
Normal file
|
@ -0,0 +1,8 @@
|
|||
import * as userSettings from 'userSettings';
|
||||
import skinManager from 'skinManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import events from 'events';
|
||||
|
||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||
skinManager.setTheme(userSettings.theme());
|
||||
});
|
|
@ -1,257 +1,256 @@
|
|||
define([], function () {
|
||||
'use strict';
|
||||
function isTv() {
|
||||
// This is going to be really difficult to get right
|
||||
const userAgent = navigator.userAgent.toLowerCase();
|
||||
|
||||
function isTv() {
|
||||
|
||||
// This is going to be really difficult to get right
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
|
||||
if (userAgent.indexOf('tv') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userAgent.indexOf('samsungbrowser') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userAgent.indexOf('viera') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userAgent.indexOf('web0s') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (userAgent.indexOf('tv') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function isMobile(userAgent) {
|
||||
var terms = [
|
||||
'mobi',
|
||||
'ipad',
|
||||
'iphone',
|
||||
'ipod',
|
||||
'silk',
|
||||
'gt-p1000',
|
||||
'nexus 7',
|
||||
'kindle fire',
|
||||
'opera mini'
|
||||
];
|
||||
|
||||
var lower = userAgent.toLowerCase();
|
||||
|
||||
for (var i = 0, length = terms.length; i < length; i++) {
|
||||
if (lower.indexOf(terms[i]) !== -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
if (userAgent.indexOf('samsungbrowser') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function hasKeyboard(browser) {
|
||||
|
||||
if (browser.touch) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.xboxOne) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.ps4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.edgeUwp) {
|
||||
// This is OK for now, but this won't always be true
|
||||
// Should we use this?
|
||||
// https://gist.github.com/wagonli/40d8a31bd0d6f0dd7a5d
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.tv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
if (userAgent.indexOf('viera') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
function iOSversion() {
|
||||
// MacIntel: Apple iPad Pro 11 iOS 13.1
|
||||
if (/iP(hone|od|ad)|MacIntel/.test(navigator.platform)) {
|
||||
// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
|
||||
var v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
|
||||
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
|
||||
if (userAgent.indexOf('web0s') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function isMobile(userAgent) {
|
||||
const terms = [
|
||||
'mobi',
|
||||
'ipad',
|
||||
'iphone',
|
||||
'ipod',
|
||||
'silk',
|
||||
'gt-p1000',
|
||||
'nexus 7',
|
||||
'kindle fire',
|
||||
'opera mini'
|
||||
];
|
||||
|
||||
const lower = userAgent.toLowerCase();
|
||||
|
||||
for (let i = 0, length = terms.length; i < length; i++) {
|
||||
if (lower.indexOf(terms[i]) !== -1) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
var _supportsCssAnimation;
|
||||
var _supportsCssAnimationWithPrefix;
|
||||
function supportsCssAnimation(allowPrefix) {
|
||||
// TODO: Assess if this is still needed, as all of our targets should natively support CSS animations.
|
||||
if (allowPrefix) {
|
||||
if (_supportsCssAnimationWithPrefix === true || _supportsCssAnimationWithPrefix === false) {
|
||||
return _supportsCssAnimationWithPrefix;
|
||||
}
|
||||
} else {
|
||||
if (_supportsCssAnimation === true || _supportsCssAnimation === false) {
|
||||
return _supportsCssAnimation;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
var animation = false;
|
||||
var domPrefixes = ['Webkit', 'O', 'Moz'];
|
||||
var elm = document.createElement('div');
|
||||
function hasKeyboard(browser) {
|
||||
if (browser.touch) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (elm.style.animationName !== undefined) {
|
||||
animation = true;
|
||||
}
|
||||
if (browser.xboxOne) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (animation === false && allowPrefix) {
|
||||
for (var i = 0; i < domPrefixes.length; i++) {
|
||||
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
|
||||
animation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (browser.ps4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (allowPrefix) {
|
||||
_supportsCssAnimationWithPrefix = animation;
|
||||
if (browser.edgeUwp) {
|
||||
// This is OK for now, but this won't always be true
|
||||
// Should we use this?
|
||||
// https://gist.github.com/wagonli/40d8a31bd0d6f0dd7a5d
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.tv) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function iOSversion() {
|
||||
// MacIntel: Apple iPad Pro 11 iOS 13.1
|
||||
if (/iP(hone|od|ad)|MacIntel/.test(navigator.platform)) {
|
||||
// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
|
||||
const v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
|
||||
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
|
||||
}
|
||||
}
|
||||
|
||||
let _supportsCssAnimation;
|
||||
let _supportsCssAnimationWithPrefix;
|
||||
function supportsCssAnimation(allowPrefix) {
|
||||
// TODO: Assess if this is still needed, as all of our targets should natively support CSS animations.
|
||||
if (allowPrefix) {
|
||||
if (_supportsCssAnimationWithPrefix === true || _supportsCssAnimationWithPrefix === false) {
|
||||
return _supportsCssAnimationWithPrefix;
|
||||
} else {
|
||||
_supportsCssAnimation = animation;
|
||||
}
|
||||
} else {
|
||||
if (_supportsCssAnimation === true || _supportsCssAnimation === false) {
|
||||
return _supportsCssAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
var uaMatch = function (ua) {
|
||||
ua = ua.toLowerCase();
|
||||
let animation = false;
|
||||
const domPrefixes = ['Webkit', 'O', 'Moz'];
|
||||
const elm = document.createElement('div');
|
||||
|
||||
var match = /(edge)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opera)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opr)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(chrome)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(safari)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(firefox)[ \/]([\w.]+)/.exec(ua) ||
|
||||
ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||
[];
|
||||
if (elm.style.animationName !== undefined) {
|
||||
animation = true;
|
||||
}
|
||||
|
||||
var versionMatch = /(version)[ \/]([\w.]+)/.exec(ua);
|
||||
|
||||
var platform_match = /(ipad)/.exec(ua) ||
|
||||
/(iphone)/.exec(ua) ||
|
||||
/(windows)/.exec(ua) ||
|
||||
/(android)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
var browser = match[1] || '';
|
||||
|
||||
if (browser === 'edge') {
|
||||
platform_match = [''];
|
||||
if (animation === false && allowPrefix) {
|
||||
for (let i = 0; i < domPrefixes.length; i++) {
|
||||
if (elm.style[domPrefixes[i] + 'AnimationName'] !== undefined) {
|
||||
animation = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (browser === 'opr') {
|
||||
browser = 'opera';
|
||||
}
|
||||
|
||||
var version;
|
||||
if (versionMatch && versionMatch.length > 2) {
|
||||
version = versionMatch[2];
|
||||
}
|
||||
|
||||
version = version || match[2] || '0';
|
||||
|
||||
var versionMajor = parseInt(version.split('.')[0]);
|
||||
|
||||
if (isNaN(versionMajor)) {
|
||||
versionMajor = 0;
|
||||
}
|
||||
|
||||
return {
|
||||
browser: browser,
|
||||
version: version,
|
||||
platform: platform_match[0] || '',
|
||||
versionMajor: versionMajor
|
||||
};
|
||||
};
|
||||
|
||||
var userAgent = navigator.userAgent;
|
||||
|
||||
var matched = uaMatch(userAgent);
|
||||
var browser = {};
|
||||
|
||||
if (matched.browser) {
|
||||
browser[matched.browser] = true;
|
||||
browser.version = matched.version;
|
||||
browser.versionMajor = matched.versionMajor;
|
||||
}
|
||||
|
||||
if (matched.platform) {
|
||||
browser[matched.platform] = true;
|
||||
}
|
||||
|
||||
if (!browser.chrome && !browser.edge && !browser.opera && userAgent.toLowerCase().indexOf('webkit') !== -1) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().indexOf('playstation 4') !== -1) {
|
||||
browser.ps4 = true;
|
||||
browser.tv = true;
|
||||
}
|
||||
|
||||
if (isMobile(userAgent)) {
|
||||
browser.mobile = true;
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().indexOf('xbox') !== -1) {
|
||||
browser.xboxOne = true;
|
||||
browser.tv = true;
|
||||
}
|
||||
browser.animate = typeof document !== 'undefined' && document.documentElement.animate != null;
|
||||
browser.tizen = userAgent.toLowerCase().indexOf('tizen') !== -1 || self.tizen != null;
|
||||
browser.web0s = userAgent.toLowerCase().indexOf('Web0S'.toLowerCase()) !== -1;
|
||||
browser.edgeUwp = browser.edge && (userAgent.toLowerCase().indexOf('msapphost') !== -1 || userAgent.toLowerCase().indexOf('webview') !== -1);
|
||||
|
||||
if (!browser.tizen) {
|
||||
browser.orsay = userAgent.toLowerCase().indexOf('smarthub') !== -1;
|
||||
if (allowPrefix) {
|
||||
_supportsCssAnimationWithPrefix = animation;
|
||||
return _supportsCssAnimationWithPrefix;
|
||||
} else {
|
||||
var v = (navigator.appVersion).match(/Tizen (\d+).(\d+)/);
|
||||
browser.tizenVersion = parseInt(v[1]);
|
||||
_supportsCssAnimation = animation;
|
||||
return _supportsCssAnimation;
|
||||
}
|
||||
}
|
||||
|
||||
const uaMatch = function (ua) {
|
||||
ua = ua.toLowerCase();
|
||||
|
||||
const match = /(edg)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(edga)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(edgios)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(edge)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opera)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(opr)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(chrome)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(safari)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(firefox)[ \/]([\w.]+)/.exec(ua) ||
|
||||
ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
const versionMatch = /(version)[ \/]([\w.]+)/.exec(ua);
|
||||
|
||||
let platform_match = /(ipad)/.exec(ua) ||
|
||||
/(iphone)/.exec(ua) ||
|
||||
/(windows)/.exec(ua) ||
|
||||
/(android)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
let browser = match[1] || '';
|
||||
|
||||
if (browser === 'edge') {
|
||||
platform_match = [''];
|
||||
}
|
||||
|
||||
if (browser.edgeUwp) {
|
||||
browser.edge = true;
|
||||
if (browser === 'opr') {
|
||||
browser = 'opera';
|
||||
}
|
||||
|
||||
browser.tv = isTv();
|
||||
browser.operaTv = browser.tv && userAgent.toLowerCase().indexOf('opr/') !== -1;
|
||||
|
||||
if (browser.mobile || browser.tv) {
|
||||
browser.slow = true;
|
||||
let version;
|
||||
if (versionMatch && versionMatch.length > 2) {
|
||||
version = versionMatch[2];
|
||||
}
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0)) {
|
||||
browser.touch = true;
|
||||
}
|
||||
version = version || match[2] || '0';
|
||||
|
||||
let versionMajor = parseInt(version.split('.')[0]);
|
||||
|
||||
if (isNaN(versionMajor)) {
|
||||
versionMajor = 0;
|
||||
}
|
||||
|
||||
browser.keyboard = hasKeyboard(browser);
|
||||
browser.supportsCssAnimation = supportsCssAnimation;
|
||||
return {
|
||||
browser: browser,
|
||||
version: version,
|
||||
platform: platform_match[0] || '',
|
||||
versionMajor: versionMajor
|
||||
};
|
||||
};
|
||||
|
||||
browser.osx = userAgent.toLowerCase().indexOf('os x') !== -1;
|
||||
browser.iOS = browser.ipad || browser.iphone || browser.ipod;
|
||||
const userAgent = navigator.userAgent;
|
||||
|
||||
if (browser.iOS) {
|
||||
browser.iOSVersion = iOSversion();
|
||||
const matched = uaMatch(userAgent);
|
||||
const browser = {};
|
||||
|
||||
if (browser.iOSVersion && browser.iOSVersion.length >= 2) {
|
||||
browser.iOSVersion = browser.iOSVersion[0] + (browser.iOSVersion[1] / 10);
|
||||
}
|
||||
if (matched.browser) {
|
||||
browser[matched.browser] = true;
|
||||
browser.version = matched.version;
|
||||
browser.versionMajor = matched.versionMajor;
|
||||
}
|
||||
|
||||
if (matched.platform) {
|
||||
browser[matched.platform] = true;
|
||||
}
|
||||
|
||||
browser.edgeChromium = browser.edg || browser.edga || browser.edgios;
|
||||
|
||||
if (!browser.chrome && !browser.edgeChromium && !browser.edge && !browser.opera && userAgent.toLowerCase().indexOf('webkit') !== -1) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().indexOf('playstation 4') !== -1) {
|
||||
browser.ps4 = true;
|
||||
browser.tv = true;
|
||||
}
|
||||
|
||||
if (isMobile(userAgent)) {
|
||||
browser.mobile = true;
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().indexOf('xbox') !== -1) {
|
||||
browser.xboxOne = true;
|
||||
browser.tv = true;
|
||||
}
|
||||
browser.animate = typeof document !== 'undefined' && document.documentElement.animate != null;
|
||||
browser.tizen = userAgent.toLowerCase().indexOf('tizen') !== -1 || self.tizen != null;
|
||||
browser.web0s = userAgent.toLowerCase().indexOf('Web0S'.toLowerCase()) !== -1;
|
||||
browser.edgeUwp = browser.edge && (userAgent.toLowerCase().indexOf('msapphost') !== -1 || userAgent.toLowerCase().indexOf('webview') !== -1);
|
||||
|
||||
if (!browser.tizen) {
|
||||
browser.orsay = userAgent.toLowerCase().indexOf('smarthub') !== -1;
|
||||
} else {
|
||||
const v = (navigator.appVersion).match(/Tizen (\d+).(\d+)/);
|
||||
browser.tizenVersion = parseInt(v[1]);
|
||||
}
|
||||
|
||||
if (browser.edgeUwp) {
|
||||
browser.edge = true;
|
||||
}
|
||||
|
||||
browser.tv = isTv();
|
||||
browser.operaTv = browser.tv && userAgent.toLowerCase().indexOf('opr/') !== -1;
|
||||
|
||||
if (browser.mobile || browser.tv) {
|
||||
browser.slow = true;
|
||||
}
|
||||
|
||||
if (typeof document !== 'undefined') {
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
if (('ontouchstart' in window) || (navigator.maxTouchPoints > 0)) {
|
||||
browser.touch = true;
|
||||
}
|
||||
}
|
||||
|
||||
return browser;
|
||||
});
|
||||
browser.keyboard = hasKeyboard(browser);
|
||||
browser.supportsCssAnimation = supportsCssAnimation;
|
||||
|
||||
browser.osx = userAgent.toLowerCase().indexOf('os x') !== -1;
|
||||
browser.iOS = browser.ipad || browser.iphone || browser.ipod;
|
||||
|
||||
if (browser.iOS) {
|
||||
browser.iOSVersion = iOSversion();
|
||||
|
||||
if (browser.iOSVersion && browser.iOSVersion.length >= 2) {
|
||||
browser.iOSVersion = browser.iOSVersion[0] + (browser.iOSVersion[1] / 10);
|
||||
}
|
||||
}
|
||||
|
||||
export default browser;
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
define(['browser'], function (browser) {
|
||||
'use strict';
|
||||
|
||||
browser = browser.default || browser;
|
||||
|
||||
function canPlayH264(videoTestElement) {
|
||||
return !!(videoTestElement.canPlayType && videoTestElement.canPlayType('video/mp4; codecs="avc1.42E01E, mp4a.40.2"').replace(/no/, ''));
|
||||
}
|
||||
|
@ -144,6 +146,10 @@ define(['browser'], function (browser) {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (browser.edgeChromium && browser.windows) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.edgeUwp) {
|
||||
return true;
|
||||
}
|
||||
|
@ -210,7 +216,7 @@ define(['browser'], function (browser) {
|
|||
supported = browser.tizen;
|
||||
break;
|
||||
case 'mov':
|
||||
supported = browser.tizen || browser.web0s || browser.chrome || browser.edgeUwp;
|
||||
supported = browser.tizen || browser.web0s || browser.chrome || browser.edgeChromium || browser.edgeUwp;
|
||||
videoCodecs.push('h264');
|
||||
break;
|
||||
case 'm2ts':
|
||||
|
@ -323,7 +329,6 @@ define(['browser'], function (browser) {
|
|||
// Otherwise with HLS and mp3 audio we're seeing some browsers
|
||||
// safari is lying
|
||||
if (supportsAc3(videoTestElement)) {
|
||||
|
||||
videoAudioCodecs.push('ac3');
|
||||
|
||||
var eAc3 = supportsEac3(videoTestElement);
|
||||
|
@ -505,7 +510,6 @@ define(['browser'], function (browser) {
|
|||
});
|
||||
|
||||
['opus', 'mp3', 'mp2', 'aac', 'flac', 'alac', 'webma', 'wma', 'wav', 'ogg', 'oga'].filter(canPlayAudioFormat).forEach(function (audioFormat) {
|
||||
|
||||
if (audioFormat === 'mp2') {
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'mp2,mp3',
|
||||
|
@ -703,40 +707,35 @@ define(['browser'], function (browser) {
|
|||
|
||||
if (browser.tizen ||
|
||||
videoTestElement.canPlayType('video/mp4; codecs="avc1.6e0033"').replace(/no/, '')) {
|
||||
|
||||
// These tests are passing in safari, but playback is failing
|
||||
if (!browser.safari && !browser.iOS && !browser.web0s && !browser.edge && !browser.mobile) {
|
||||
h264Profiles += '|high 10';
|
||||
}
|
||||
}
|
||||
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'Video',
|
||||
Codec: 'h264',
|
||||
Conditions: [
|
||||
{
|
||||
Condition: 'NotEquals',
|
||||
Property: 'IsAnamorphic',
|
||||
Value: 'true',
|
||||
IsRequired: false
|
||||
},
|
||||
{
|
||||
Condition: 'EqualsAny',
|
||||
Property: 'VideoProfile',
|
||||
Value: h264Profiles,
|
||||
IsRequired: false
|
||||
},
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'VideoLevel',
|
||||
Value: maxH264Level.toString(),
|
||||
IsRequired: false
|
||||
}
|
||||
]
|
||||
});
|
||||
const h264CodecProfileConditions = [
|
||||
{
|
||||
Condition: 'NotEquals',
|
||||
Property: 'IsAnamorphic',
|
||||
Value: 'true',
|
||||
IsRequired: false
|
||||
},
|
||||
{
|
||||
Condition: 'EqualsAny',
|
||||
Property: 'VideoProfile',
|
||||
Value: h264Profiles,
|
||||
IsRequired: false
|
||||
},
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'VideoLevel',
|
||||
Value: maxH264Level.toString(),
|
||||
IsRequired: false
|
||||
}
|
||||
];
|
||||
|
||||
if (!browser.edgeUwp && !browser.tizen && !browser.web0s) {
|
||||
profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
|
||||
h264CodecProfileConditions.push({
|
||||
Condition: 'NotEquals',
|
||||
Property: 'IsInterlaced',
|
||||
Value: 'true',
|
||||
|
@ -745,7 +744,7 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
if (maxVideoWidth) {
|
||||
profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
|
||||
h264CodecProfileConditions.push({
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'Width',
|
||||
Value: maxVideoWidth.toString(),
|
||||
|
@ -758,7 +757,7 @@ define(['browser'], function (browser) {
|
|||
var h264MaxVideoBitrate = globalMaxVideoBitrate;
|
||||
|
||||
if (h264MaxVideoBitrate) {
|
||||
profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
|
||||
h264CodecProfileConditions.push({
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'VideoBitrate',
|
||||
Value: h264MaxVideoBitrate,
|
||||
|
@ -766,6 +765,33 @@ define(['browser'], function (browser) {
|
|||
});
|
||||
}
|
||||
|
||||
// On iOS 12.x, for TS container max h264 level is 4.2
|
||||
if (browser.iOS && browser.iOSVersion < 13) {
|
||||
const codecProfile = {
|
||||
Type: 'Video',
|
||||
Codec: 'h264',
|
||||
Container: 'ts',
|
||||
Conditions: h264CodecProfileConditions.filter((condition) => {
|
||||
return condition.Property !== 'VideoLevel';
|
||||
})
|
||||
};
|
||||
|
||||
codecProfile.Conditions.push({
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'VideoLevel',
|
||||
Value: '42',
|
||||
IsRequired: false
|
||||
});
|
||||
|
||||
profile.CodecProfiles.push(codecProfile);
|
||||
}
|
||||
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'Video',
|
||||
Codec: 'h264',
|
||||
Conditions: h264CodecProfileConditions
|
||||
});
|
||||
|
||||
var globalVideoConditions = [];
|
||||
|
||||
if (globalMaxVideoBitrate) {
|
||||
|
|
|
@ -3,7 +3,6 @@ import globalize from 'globalize';
|
|||
/* eslint-disable indent */
|
||||
|
||||
export function parseISO8601Date(s, toLocal) {
|
||||
|
||||
// parenthese matches:
|
||||
// year month day hours minutes seconds
|
||||
// dotmilliseconds
|
||||
|
@ -20,7 +19,6 @@ import globalize from 'globalize';
|
|||
// "00", "00", ".000", "Z", undefined, undefined, undefined]
|
||||
|
||||
if (!d) {
|
||||
|
||||
throw "Couldn't parse ISO 8601 date string '" + s + "'";
|
||||
}
|
||||
|
||||
|
@ -106,7 +104,6 @@ import globalize from 'globalize';
|
|||
}();
|
||||
|
||||
function getOptionList(options) {
|
||||
|
||||
const list = [];
|
||||
|
||||
for (const i in options) {
|
||||
|
@ -120,7 +117,6 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
export function toLocaleString(date, options) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
}
|
||||
|
@ -128,7 +124,6 @@ import globalize from 'globalize';
|
|||
options = options || {};
|
||||
|
||||
if (toLocaleTimeStringSupportsLocales) {
|
||||
|
||||
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
|
||||
if (currentLocale) {
|
||||
|
@ -140,7 +135,6 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
export function toLocaleDateString(date, options) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
}
|
||||
|
@ -148,7 +142,6 @@ import globalize from 'globalize';
|
|||
options = options || {};
|
||||
|
||||
if (toLocaleTimeStringSupportsLocales) {
|
||||
|
||||
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
|
||||
if (currentLocale) {
|
||||
|
@ -174,7 +167,6 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
export function toLocaleTimeString(date, options) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
}
|
||||
|
@ -182,7 +174,6 @@ import globalize from 'globalize';
|
|||
options = options || {};
|
||||
|
||||
if (toLocaleTimeStringSupportsLocales) {
|
||||
|
||||
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
|
||||
if (currentLocale) {
|
||||
|
@ -194,16 +185,13 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
export function getDisplayTime(date) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
}
|
||||
|
||||
if ((typeof date).toString().toLowerCase() === 'string') {
|
||||
try {
|
||||
|
||||
date = parseISO8601Date(date, true);
|
||||
|
||||
} catch (err) {
|
||||
return date;
|
||||
}
|
||||
|
@ -223,7 +211,6 @@ import globalize from 'globalize';
|
|||
const timeLower = time.toLowerCase();
|
||||
|
||||
if (timeLower.indexOf('am') !== -1 || timeLower.indexOf('pm') !== -1) {
|
||||
|
||||
time = timeLower;
|
||||
let hour = date.getHours() % 12;
|
||||
const suffix = date.getHours() > 11 ? 'pm' : 'am';
|
||||
|
@ -239,12 +226,10 @@ import globalize from 'globalize';
|
|||
minutes = ':' + minutes;
|
||||
time = hour + minutes + suffix;
|
||||
} else {
|
||||
|
||||
const timeParts = time.split(':');
|
||||
|
||||
// Trim off seconds
|
||||
if (timeParts.length > 2) {
|
||||
|
||||
// setting to 2 also handles '21:00:28 GMT+9:30'
|
||||
timeParts.length = 2;
|
||||
time = timeParts.join(':');
|
||||
|
@ -255,7 +240,6 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
export function isRelativeDay(date, offsetInDays) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
}
|
||||
|
|
|
@ -4,9 +4,7 @@ import appRouter from 'appRouter';
|
|||
import globalize from 'globalize';
|
||||
|
||||
function alertText(options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(options).then(resolve, resolve);
|
||||
});
|
||||
|
@ -14,7 +12,6 @@ function alertText(options) {
|
|||
}
|
||||
|
||||
export function deleteItem(options) {
|
||||
|
||||
const item = options.item;
|
||||
const parentId = item.SeasonId || item.SeriesId || item.ParentId;
|
||||
|
||||
|
@ -28,9 +25,7 @@ export function deleteItem(options) {
|
|||
primary: 'delete'
|
||||
|
||||
}).then(function () {
|
||||
|
||||
return apiClient.deleteItem(item.Id).then(function () {
|
||||
|
||||
if (options.navigate) {
|
||||
if (parentId) {
|
||||
appRouter.showItem(parentId, item.ServerId);
|
||||
|
@ -39,7 +34,6 @@ export function deleteItem(options) {
|
|||
}
|
||||
}
|
||||
}, function (err) {
|
||||
|
||||
let result = function () {
|
||||
return Promise.reject(err);
|
||||
};
|
||||
|
|
|
@ -183,11 +183,9 @@
|
|||
width = height * (16.0 / 9.0);
|
||||
}
|
||||
|
||||
const closest = standardWidths.sort(function (a, b) {
|
||||
return standardWidths.sort(function (a, b) {
|
||||
return Math.abs(width - a) - Math.abs(width - b);
|
||||
})[0];
|
||||
|
||||
return closest;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import multiDownload from 'multi-download';
|
||||
|
||||
export function download(items) {
|
||||
|
||||
if (window.NativeShell) {
|
||||
items.map(function (item) {
|
||||
window.NativeShell.downloadFile(item);
|
||||
|
|
|
@ -182,7 +182,6 @@ require(['apphost'], function (appHost) {
|
|||
|
||||
var isElectron = navigator.userAgent.toLowerCase().indexOf('electron') !== -1;
|
||||
function allowInput() {
|
||||
|
||||
// This would be nice but always seems to return true with electron
|
||||
if (!isElectron && document.hidden) { /* eslint-disable-line compat/compat */
|
||||
return false;
|
||||
|
@ -196,7 +195,6 @@ require(['apphost'], function (appHost) {
|
|||
}
|
||||
|
||||
function raiseEvent(name, key, keyCode) {
|
||||
|
||||
if (!allowInput()) {
|
||||
return;
|
||||
}
|
||||
|
@ -209,7 +207,6 @@ require(['apphost'], function (appHost) {
|
|||
}
|
||||
|
||||
function clickElement(elem) {
|
||||
|
||||
if (!allowInput()) {
|
||||
return;
|
||||
}
|
||||
|
@ -218,10 +215,8 @@ require(['apphost'], function (appHost) {
|
|||
}
|
||||
|
||||
function raiseKeyEvent(oldPressedState, newPressedState, key, keyCode, enableRepeatKeyDown, clickonKeyUp) {
|
||||
|
||||
// No-op if oldPressedState === newPressedState
|
||||
if (newPressedState === true) {
|
||||
|
||||
// button down
|
||||
var fire = false;
|
||||
|
||||
|
@ -236,9 +231,7 @@ require(['apphost'], function (appHost) {
|
|||
if (fire && keyCode) {
|
||||
raiseEvent('keydown', key, keyCode);
|
||||
}
|
||||
|
||||
} else if (newPressedState === false && oldPressedState === true) {
|
||||
|
||||
resetThrottle(key);
|
||||
|
||||
// button up
|
||||
|
@ -406,5 +399,4 @@ require(['apphost'], function (appHost) {
|
|||
// and provide input to the DOM navigator.getGamepads API.
|
||||
window.navigator.gamepadInputEmulation = 'gamepad';
|
||||
}
|
||||
|
||||
});
|
||||
|
|
|
@ -31,6 +31,11 @@
|
|||
case 'Safari iPad':
|
||||
case 'Safari iPhone':
|
||||
return baseUrl + 'safari.svg';
|
||||
case 'Edge Chromium':
|
||||
case 'Edge Chromium Android':
|
||||
case 'Edge Chromium iPad':
|
||||
case 'Edge Chromium iPhone':
|
||||
return baseUrl + 'edgechromium.svg';
|
||||
case 'Edge':
|
||||
return baseUrl + 'edge.svg';
|
||||
case 'Internet Explorer':
|
||||
|
|
|
@ -35,13 +35,13 @@ import appHost from 'apphost';
|
|||
if (eventListenerCount) {
|
||||
eventListenerCount--;
|
||||
}
|
||||
|
||||
dom.removeEventListener(scope, 'command', fn, {});
|
||||
}
|
||||
|
||||
let commandTimes = {};
|
||||
|
||||
function checkCommandTime(command) {
|
||||
|
||||
const last = commandTimes[command] || 0;
|
||||
const now = new Date().getTime();
|
||||
|
||||
|
@ -54,7 +54,6 @@ import appHost from 'apphost';
|
|||
}
|
||||
|
||||
export function handleCommand(commandName, options) {
|
||||
|
||||
lastInputTime = new Date().getTime();
|
||||
|
||||
let sourceElement = (options ? options.sourceElement : null);
|
||||
|
|
|
@ -11,7 +11,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
|
|||
});
|
||||
}
|
||||
|
||||
if (item.ProgramCount && 'Person' == item.Type) {
|
||||
if (item.ProgramCount && item.Type == 'Person') {
|
||||
sections.push({
|
||||
name: globalize.translate('HeaderUpcomingOnTV'),
|
||||
type: 'Program'
|
||||
|
@ -65,7 +65,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
|
|||
var html = '';
|
||||
var sectionClass = 'verticalSection';
|
||||
|
||||
if ('Audio' === section.type) {
|
||||
if (section.type === 'Audio') {
|
||||
sectionClass += ' verticalSection-extrabottompadding';
|
||||
}
|
||||
|
||||
|
@ -272,7 +272,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
|
|||
listOptions.items = result.Items;
|
||||
var itemsContainer = element.querySelector('.itemsContainer');
|
||||
|
||||
if ('Audio' == type) {
|
||||
if (type == 'Audio') {
|
||||
html = listView.getListViewHtml(listOptions);
|
||||
itemsContainer.classList.remove('vertical-wrap');
|
||||
itemsContainer.classList.add('vertical-list');
|
||||
|
@ -288,23 +288,23 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
|
|||
}
|
||||
|
||||
function getMoreItemsHref(item, type) {
|
||||
if ('Genre' == item.Type) {
|
||||
if (item.Type == 'Genre') {
|
||||
return 'list.html?type=' + type + '&genreId=' + item.Id + '&serverId=' + item.ServerId;
|
||||
}
|
||||
|
||||
if ('MusicGenre' == item.Type) {
|
||||
if (item.Type == 'MusicGenre') {
|
||||
return 'list.html?type=' + type + '&musicGenreId=' + item.Id + '&serverId=' + item.ServerId;
|
||||
}
|
||||
|
||||
if ('Studio' == item.Type) {
|
||||
if (item.Type == 'Studio') {
|
||||
return 'list.html?type=' + type + '&studioId=' + item.Id + '&serverId=' + item.ServerId;
|
||||
}
|
||||
|
||||
if ('MusicArtist' == item.Type) {
|
||||
if (item.Type == 'MusicArtist') {
|
||||
return 'list.html?type=' + type + '&artistId=' + item.Id + '&serverId=' + item.ServerId;
|
||||
}
|
||||
|
||||
if ('Person' == item.Type) {
|
||||
if (item.Type == 'Person') {
|
||||
return 'list.html?type=' + type + '&personId=' + item.Id + '&serverId=' + item.ServerId;
|
||||
}
|
||||
|
||||
|
@ -354,7 +354,7 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
|
|||
|
||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
if ('MusicArtist' === query.IncludeItemTypes) {
|
||||
if (query.IncludeItemTypes === 'MusicArtist') {
|
||||
query.IncludeItemTypes = null;
|
||||
return apiClient.getAlbumArtists(apiClient.getCurrentUserId(), query);
|
||||
}
|
||||
|
|
|
@ -1,199 +1,216 @@
|
|||
define(['userSettings', 'globalize'], function (userSettings, globalize) {
|
||||
'use strict';
|
||||
import * as userSettings from 'userSettings';
|
||||
import globalize from 'globalize';
|
||||
|
||||
var libraryBrowser = {
|
||||
getSavedQueryKey: function (modifier) {
|
||||
return window.location.href.split('#')[0] + (modifier || '');
|
||||
},
|
||||
loadSavedQueryValues: function (key, query) {
|
||||
var values = userSettings.get(key);
|
||||
export function getSavedQueryKey(modifier) {
|
||||
return window.location.href.split('#')[0] + (modifier || '');
|
||||
}
|
||||
|
||||
if (values) {
|
||||
values = JSON.parse(values);
|
||||
return Object.assign(query, values);
|
||||
}
|
||||
export function loadSavedQueryValues(key, query) {
|
||||
var values = userSettings.get(key);
|
||||
|
||||
return query;
|
||||
},
|
||||
saveQueryValues: function (key, query) {
|
||||
var values = {};
|
||||
if (values) {
|
||||
values = JSON.parse(values);
|
||||
return Object.assign(query, values);
|
||||
}
|
||||
|
||||
if (query.SortBy) {
|
||||
values.SortBy = query.SortBy;
|
||||
}
|
||||
return query;
|
||||
}
|
||||
|
||||
if (query.SortOrder) {
|
||||
values.SortOrder = query.SortOrder;
|
||||
}
|
||||
export function saveQueryValues(key, query) {
|
||||
var values = {};
|
||||
|
||||
userSettings.set(key, JSON.stringify(values));
|
||||
},
|
||||
saveViewSetting: function (key, value) {
|
||||
userSettings.set(key + '-_view', value);
|
||||
},
|
||||
getSavedView: function (key) {
|
||||
return userSettings.get(key + '-_view');
|
||||
},
|
||||
showLayoutMenu: function (button, currentLayout, views) {
|
||||
var dispatchEvent = true;
|
||||
if (query.SortBy) {
|
||||
values.SortBy = query.SortBy;
|
||||
}
|
||||
|
||||
if (!views) {
|
||||
dispatchEvent = false;
|
||||
views = button.getAttribute('data-layouts');
|
||||
views = views ? views.split(',') : ['List', 'Poster', 'PosterCard', 'Thumb', 'ThumbCard'];
|
||||
}
|
||||
if (query.SortOrder) {
|
||||
values.SortOrder = query.SortOrder;
|
||||
}
|
||||
|
||||
var menuItems = views.map(function (v) {
|
||||
return {
|
||||
name: globalize.translate('Option' + v),
|
||||
id: v,
|
||||
selected: currentLayout == v
|
||||
};
|
||||
});
|
||||
userSettings.set(key, JSON.stringify(values));
|
||||
}
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: button,
|
||||
callback: function (id) {
|
||||
button.dispatchEvent(new CustomEvent('layoutchange', {
|
||||
detail: {
|
||||
viewStyle: id
|
||||
},
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
export function saveViewSetting (key, value) {
|
||||
userSettings.set(key + '-_view', value);
|
||||
}
|
||||
|
||||
if (!dispatchEvent) {
|
||||
if (window.$) {
|
||||
$(button).trigger('layoutchange', [id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
},
|
||||
getQueryPagingHtml: function (options) {
|
||||
var startIndex = options.startIndex;
|
||||
var limit = options.limit;
|
||||
var totalRecordCount = options.totalRecordCount;
|
||||
var html = '';
|
||||
var recordsEnd = Math.min(startIndex + limit, totalRecordCount);
|
||||
var showControls = limit < totalRecordCount;
|
||||
export function getSavedView (key) {
|
||||
return userSettings.get(key + '-_view');
|
||||
}
|
||||
|
||||
if (html += '<div class="listPaging">', showControls) {
|
||||
html += '<span style="vertical-align:middle;">';
|
||||
html += globalize.translate('ListPaging', (totalRecordCount ? startIndex + 1 : 0), recordsEnd, totalRecordCount);
|
||||
html += '</span>';
|
||||
}
|
||||
export function showLayoutMenu (button, currentLayout, views) {
|
||||
var dispatchEvent = true;
|
||||
|
||||
if (showControls || options.viewButton || options.filterButton || options.sortButton || options.addLayoutButton) {
|
||||
html += '<div style="display:inline-block;">';
|
||||
if (!views) {
|
||||
dispatchEvent = false;
|
||||
views = button.getAttribute('data-layouts');
|
||||
views = views ? views.split(',') : ['List', 'Poster', 'PosterCard', 'Thumb', 'ThumbCard'];
|
||||
}
|
||||
|
||||
if (showControls) {
|
||||
html += '<button is="paper-icon-button-light" class="btnPreviousPage autoSize" ' + (startIndex ? '' : 'disabled') + '><span class="material-icons arrow_back"></span></button>';
|
||||
html += '<button is="paper-icon-button-light" class="btnNextPage autoSize" ' + (startIndex + limit >= totalRecordCount ? 'disabled' : '') + '><span class="material-icons arrow_forward"></span></button>';
|
||||
}
|
||||
var menuItems = views.map(function (v) {
|
||||
return {
|
||||
name: globalize.translate('Option' + v),
|
||||
id: v,
|
||||
selected: currentLayout == v
|
||||
};
|
||||
});
|
||||
|
||||
if (options.addLayoutButton) {
|
||||
html += '<button is="paper-icon-button-light" title="' + globalize.translate('ButtonSelectView') + '" class="btnChangeLayout autoSize" data-layouts="' + (options.layouts || '') + '" onclick="LibraryBrowser.showLayoutMenu(this, \'' + (options.currentLayout || '') + '\');"><span class="material-icons view_comfy"></span></button>';
|
||||
}
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: button,
|
||||
callback: function (id) {
|
||||
button.dispatchEvent(new CustomEvent('layoutchange', {
|
||||
detail: {
|
||||
viewStyle: id
|
||||
},
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
|
||||
if (options.sortButton) {
|
||||
html += '<button is="paper-icon-button-light" class="btnSort autoSize" title="' + globalize.translate('ButtonSort') + '"><span class="material-icons sort_by_alpha"></span></button>';
|
||||
}
|
||||
|
||||
if (options.filterButton) {
|
||||
html += '<button is="paper-icon-button-light" class="btnFilter autoSize" title="' + globalize.translate('ButtonFilter') + '"><span class="material-icons filter_list"></span></button>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
return html += '</div>';
|
||||
},
|
||||
showSortMenu: function (options) {
|
||||
require(['dialogHelper', 'emby-radio'], function (dialogHelper) {
|
||||
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();
|
||||
}
|
||||
if (!dispatchEvent) {
|
||||
if (window.$) {
|
||||
$(button).trigger('layoutchange', [id]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onSortOrderChange() {
|
||||
var newValue = this.value;
|
||||
export function getQueryPagingHtml (options) {
|
||||
var startIndex = options.startIndex;
|
||||
var limit = options.limit;
|
||||
var totalRecordCount = options.totalRecordCount;
|
||||
var html = '';
|
||||
var recordsEnd = Math.min(startIndex + limit, totalRecordCount);
|
||||
var showControls = limit < totalRecordCount;
|
||||
|
||||
if (this.checked) {
|
||||
var changed = options.query.SortOrder != newValue;
|
||||
options.query.SortOrder = newValue;
|
||||
options.query.StartIndex = 0;
|
||||
if (html += '<div class="listPaging">', showControls) {
|
||||
html += '<span style="vertical-align:middle;">';
|
||||
html += globalize.translate('ListPaging', (totalRecordCount ? startIndex + 1 : 0), recordsEnd, totalRecordCount);
|
||||
html += '</span>';
|
||||
}
|
||||
|
||||
if (options.callback && changed) {
|
||||
options.callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (showControls || options.viewButton || options.filterButton || options.sortButton || options.addLayoutButton) {
|
||||
html += '<div style="display:inline-block;">';
|
||||
|
||||
var dlg = dialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
modal: false,
|
||||
entryAnimationDuration: 160,
|
||||
exitAnimationDuration: 200
|
||||
});
|
||||
dlg.classList.add('ui-body-a');
|
||||
dlg.classList.add('background-theme-a');
|
||||
dlg.classList.add('formDialog');
|
||||
var html = '';
|
||||
html += '<div style="margin:0;padding:1.25em 1.5em 1.5em;">';
|
||||
html += '<h2 style="margin:0 0 .5em;">';
|
||||
html += globalize.translate('HeaderSortBy');
|
||||
html += '</h2>';
|
||||
var i;
|
||||
var length;
|
||||
var isChecked;
|
||||
html += '<div>';
|
||||
for (i = 0, length = options.items.length; i < length; i++) {
|
||||
var option = options.items[i];
|
||||
var radioValue = option.id.replace(',', '_');
|
||||
isChecked = (options.query.SortBy || '').replace(',', '_') == radioValue ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortBy" data-id="' + option.id + '" value="' + radioValue + '" class="menuSortBy" ' + isChecked + ' /><span>' + option.name + '</span></label>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
html += '<h2 style="margin: 1em 0 .5em;">';
|
||||
html += globalize.translate('HeaderSortOrder');
|
||||
html += '</h2>';
|
||||
html += '<div>';
|
||||
isChecked = 'Ascending' == options.query.SortOrder ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Ascending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionAscending') + '</span></label>';
|
||||
isChecked = 'Descending' == options.query.SortOrder ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Descending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionDescending') + '</span></label>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
dlg.innerHTML = html;
|
||||
dialogHelper.open(dlg);
|
||||
var sortBys = dlg.querySelectorAll('.menuSortBy');
|
||||
|
||||
for (i = 0, length = sortBys.length; i < length; i++) {
|
||||
sortBys[i].addEventListener('change', onSortByChange);
|
||||
}
|
||||
|
||||
var sortOrders = dlg.querySelectorAll('.menuSortOrder');
|
||||
|
||||
for (i = 0, length = sortOrders.length; i < length; i++) {
|
||||
sortOrders[i].addEventListener('change', onSortOrderChange);
|
||||
}
|
||||
});
|
||||
if (showControls) {
|
||||
html += '<button is="paper-icon-button-light" class="btnPreviousPage autoSize" ' + (startIndex ? '' : 'disabled') + '><span class="material-icons arrow_back"></span></button>';
|
||||
html += '<button is="paper-icon-button-light" class="btnNextPage autoSize" ' + (startIndex + limit >= totalRecordCount ? 'disabled' : '') + '><span class="material-icons arrow_forward"></span></button>';
|
||||
}
|
||||
};
|
||||
window.LibraryBrowser = libraryBrowser;
|
||||
return libraryBrowser;
|
||||
});
|
||||
|
||||
if (options.addLayoutButton) {
|
||||
html += '<button is="paper-icon-button-light" title="' + globalize.translate('ButtonSelectView') + '" class="btnChangeLayout autoSize" data-layouts="' + (options.layouts || '') + '" onclick="LibraryBrowser.showLayoutMenu(this, \'' + (options.currentLayout || '') + '\');"><span class="material-icons view_comfy"></span></button>';
|
||||
}
|
||||
|
||||
if (options.sortButton) {
|
||||
html += '<button is="paper-icon-button-light" class="btnSort autoSize" title="' + globalize.translate('ButtonSort') + '"><span class="material-icons sort_by_alpha"></span></button>';
|
||||
}
|
||||
|
||||
if (options.filterButton) {
|
||||
html += '<button is="paper-icon-button-light" class="btnFilter autoSize" title="' + globalize.translate('ButtonFilter') + '"><span class="material-icons filter_list"></span></button>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
return html += '</div>';
|
||||
}
|
||||
|
||||
export function showSortMenu (options) {
|
||||
require(['dialogHelper', 'emby-radio'], function (dialogHelper) {
|
||||
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 onSortOrderChange() {
|
||||
var newValue = this.value;
|
||||
|
||||
if (this.checked) {
|
||||
var changed = options.query.SortOrder != newValue;
|
||||
options.query.SortOrder = newValue;
|
||||
options.query.StartIndex = 0;
|
||||
|
||||
if (options.callback && changed) {
|
||||
options.callback();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
modal: false,
|
||||
entryAnimationDuration: 160,
|
||||
exitAnimationDuration: 200
|
||||
});
|
||||
dlg.classList.add('ui-body-a');
|
||||
dlg.classList.add('background-theme-a');
|
||||
dlg.classList.add('formDialog');
|
||||
var html = '';
|
||||
html += '<div style="margin:0;padding:1.25em 1.5em 1.5em;">';
|
||||
html += '<h2 style="margin:0 0 .5em;">';
|
||||
html += globalize.translate('HeaderSortBy');
|
||||
html += '</h2>';
|
||||
var i;
|
||||
var length;
|
||||
var isChecked;
|
||||
html += '<div>';
|
||||
for (i = 0, length = options.items.length; i < length; i++) {
|
||||
var option = options.items[i];
|
||||
var radioValue = option.id.replace(',', '_');
|
||||
isChecked = (options.query.SortBy || '').replace(',', '_') == radioValue ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortBy" data-id="' + option.id + '" value="' + radioValue + '" class="menuSortBy" ' + isChecked + ' /><span>' + option.name + '</span></label>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
html += '<h2 style="margin: 1em 0 .5em;">';
|
||||
html += globalize.translate('HeaderSortOrder');
|
||||
html += '</h2>';
|
||||
html += '<div>';
|
||||
isChecked = options.query.SortOrder == 'Ascending' ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Ascending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionAscending') + '</span></label>';
|
||||
isChecked = options.query.SortOrder == 'Descending' ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Descending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionDescending') + '</span></label>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
dlg.innerHTML = html;
|
||||
dialogHelper.open(dlg);
|
||||
var sortBys = dlg.querySelectorAll('.menuSortBy');
|
||||
|
||||
for (i = 0, length = sortBys.length; i < length; i++) {
|
||||
sortBys[i].addEventListener('change', onSortByChange);
|
||||
}
|
||||
|
||||
var sortOrders = dlg.querySelectorAll('.menuSortOrder');
|
||||
|
||||
for (i = 0, length = sortOrders.length; i < length; i++) {
|
||||
sortOrders[i].addEventListener('change', onSortOrderChange);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const libraryBrowser = {
|
||||
getSavedQueryKey,
|
||||
loadSavedQueryValues,
|
||||
saveQueryValues,
|
||||
saveViewSetting,
|
||||
getSavedView,
|
||||
showLayoutMenu,
|
||||
getQueryPagingHtml,
|
||||
showSortMenu
|
||||
};
|
||||
|
||||
window.LibraryBrowser = libraryBrowser;
|
||||
|
||||
export default libraryBrowser;
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', 'viewManager', 'libraryBrowser', 'appRouter', 'apphost', 'playbackManager', 'syncPlayManager', 'groupSelectionMenu', 'browser', 'globalize', 'scripts/imagehelper', 'paper-icon-button-light', 'material-icons', 'scrollStyles', 'flexStyles'], function (dom, layoutManager, inputManager, connectionManager, events, viewManager, libraryBrowser, appRouter, appHost, playbackManager, syncPlayManager, groupSelectionMenu, browser, globalize, imageHelper) {
|
||||
'use strict';
|
||||
|
||||
playbackManager = playbackManager.default || playbackManager;
|
||||
browser = browser.default || browser;
|
||||
|
||||
function renderHeader() {
|
||||
var html = '';
|
||||
html += '<div class="flex align-items-center flex-grow headerTop">';
|
||||
|
@ -309,7 +312,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
}
|
||||
|
||||
function isUrlInCurrentView(url) {
|
||||
return -1 !== window.location.href.toString().toLowerCase().indexOf(url.toLowerCase());
|
||||
return window.location.href.toString().toLowerCase().indexOf(url.toLowerCase()) !== -1;
|
||||
}
|
||||
|
||||
function updateDashboardMenuSelectedItem() {
|
||||
|
@ -323,7 +326,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
|
||||
if (pageIds) {
|
||||
pageIds = pageIds.split('|');
|
||||
selected = -1 != pageIds.indexOf(currentViewId);
|
||||
selected = pageIds.indexOf(currentViewId) != -1;
|
||||
}
|
||||
|
||||
var pageUrls = link.getAttribute('data-pageurls');
|
||||
|
@ -545,7 +548,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
var view = items[i];
|
||||
list.push(view);
|
||||
|
||||
if ('livetv' == view.CollectionType) {
|
||||
if (view.CollectionType == 'livetv') {
|
||||
view.ImageTags = {};
|
||||
view.icon = 'live_tv';
|
||||
var guideView = Object.assign({}, view);
|
||||
|
@ -604,12 +607,10 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
var icon = i.icon || imageHelper.getLibraryIcon(i.CollectionType);
|
||||
var itemId = i.Id;
|
||||
|
||||
const linkHtml = `<a is="emby-linkbutton" data-itemid="${itemId}" class="lnkMediaFolder navMenuOption" href="${getItemHref(i, i.CollectionType)}">
|
||||
return `<a is="emby-linkbutton" data-itemid="${itemId}" class="lnkMediaFolder navMenuOption" href="${getItemHref(i, i.CollectionType)}">
|
||||
<span class="material-icons navMenuOptionIcon ${icon}"></span>
|
||||
<span class="sectionName navMenuOptionText">${i.Name}</span>
|
||||
</a>`;
|
||||
|
||||
return linkHtml;
|
||||
}).join('');
|
||||
libraryMenuOptions.innerHTML = html;
|
||||
var elem = libraryMenuOptions;
|
||||
|
@ -673,15 +674,15 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
var lnkMediaFolder = elems[i];
|
||||
var itemId = lnkMediaFolder.getAttribute('data-itemid');
|
||||
|
||||
if (isChannelsPage && 'channels' === itemId) {
|
||||
if (isChannelsPage && itemId === 'channels') {
|
||||
lnkMediaFolder.classList.add('navMenuOption-selected');
|
||||
} else if (isLiveTvPage && 'livetv' === itemId) {
|
||||
} else if (isLiveTvPage && itemId === 'livetv') {
|
||||
lnkMediaFolder.classList.add('navMenuOption-selected');
|
||||
} else if (isEditorPage && 'editor' === itemId) {
|
||||
} else if (isEditorPage && itemId === 'editor') {
|
||||
lnkMediaFolder.classList.add('navMenuOption-selected');
|
||||
} else if (isMySyncPage && 'manageoffline' === itemId && -1 != window.location.href.toString().indexOf('mode=download')) {
|
||||
} else if (isMySyncPage && itemId === 'manageoffline' && window.location.href.toString().indexOf('mode=download') != -1) {
|
||||
lnkMediaFolder.classList.add('navMenuOption-selected');
|
||||
} else if (isMySyncPage && 'syncotherdevices' === itemId && -1 == window.location.href.toString().indexOf('mode=download')) {
|
||||
} else if (isMySyncPage && itemId === 'syncotherdevices' && window.location.href.toString().indexOf('mode=download') == -1) {
|
||||
lnkMediaFolder.classList.add('navMenuOption-selected');
|
||||
} else if (id && itemId == id) {
|
||||
lnkMediaFolder.classList.add('navMenuOption-selected');
|
||||
|
@ -755,7 +756,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
}
|
||||
|
||||
if (headerBackButton) {
|
||||
if ('false' !== page.getAttribute('data-backbutton') && appRouter.canGoBack()) {
|
||||
if (page.getAttribute('data-backbutton') !== 'false' && appRouter.canGoBack()) {
|
||||
headerBackButton.classList.remove('hide');
|
||||
} else {
|
||||
headerBackButton.classList.add('hide');
|
||||
|
@ -865,11 +866,11 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
document.title = 'Jellyfin';
|
||||
},
|
||||
setTitle: function (title) {
|
||||
if (null == title) {
|
||||
if (title == null) {
|
||||
return void LibraryMenu.setDefaultTitle();
|
||||
}
|
||||
|
||||
if ('-' === title) {
|
||||
if (title === '-') {
|
||||
title = '';
|
||||
}
|
||||
|
||||
|
@ -924,7 +925,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
}
|
||||
}
|
||||
|
||||
if ('library' !== currentDrawerType) {
|
||||
if (currentDrawerType !== 'library') {
|
||||
refreshLibraryDrawer();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,31 +1,33 @@
|
|||
define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'dom'], function (inputManager, focusManager, browser, layoutManager, events, dom) {
|
||||
'use strict';
|
||||
import inputManager from 'inputManager';
|
||||
import focusManager from 'focusManager';
|
||||
import browser from 'browser';
|
||||
import layoutManager from 'layoutManager';
|
||||
import events from 'events';
|
||||
import dom from 'dom';
|
||||
/* eslint-disable indent */
|
||||
|
||||
var self = {};
|
||||
const self = {};
|
||||
|
||||
var lastMouseInputTime = new Date().getTime();
|
||||
var isMouseIdle;
|
||||
let lastMouseInputTime = new Date().getTime();
|
||||
let isMouseIdle;
|
||||
|
||||
function mouseIdleTime() {
|
||||
return new Date().getTime() - lastMouseInputTime;
|
||||
}
|
||||
|
||||
function notifyApp() {
|
||||
|
||||
inputManager.notifyMouseMove();
|
||||
}
|
||||
|
||||
function removeIdleClasses() {
|
||||
|
||||
var classList = document.body.classList;
|
||||
const classList = document.body.classList;
|
||||
|
||||
classList.remove('mouseIdle');
|
||||
classList.remove('mouseIdle-tv');
|
||||
}
|
||||
|
||||
function addIdleClasses() {
|
||||
|
||||
var classList = document.body.classList;
|
||||
const classList = document.body.classList;
|
||||
|
||||
classList.add('mouseIdle');
|
||||
|
||||
|
@ -34,18 +36,33 @@ define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'd
|
|||
}
|
||||
}
|
||||
|
||||
var lastPointerMoveData;
|
||||
function onPointerMove(e) {
|
||||
export function showCursor() {
|
||||
if (isMouseIdle) {
|
||||
isMouseIdle = false;
|
||||
removeIdleClasses();
|
||||
events.trigger(self, 'mouseactive');
|
||||
}
|
||||
}
|
||||
|
||||
var eventX = e.screenX;
|
||||
var eventY = e.screenY;
|
||||
export function hideCursor() {
|
||||
if (!isMouseIdle) {
|
||||
isMouseIdle = true;
|
||||
addIdleClasses();
|
||||
events.trigger(self, 'mouseidle');
|
||||
}
|
||||
}
|
||||
|
||||
let lastPointerMoveData;
|
||||
function onPointerMove(e) {
|
||||
const eventX = e.screenX;
|
||||
const eventY = e.screenY;
|
||||
|
||||
// if coord don't exist how could it move
|
||||
if (typeof eventX === 'undefined' && typeof eventY === 'undefined') {
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = lastPointerMoveData;
|
||||
const obj = lastPointerMoveData;
|
||||
if (!obj) {
|
||||
lastPointerMoveData = {
|
||||
x: eventX,
|
||||
|
@ -65,20 +82,15 @@ define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'd
|
|||
lastMouseInputTime = new Date().getTime();
|
||||
notifyApp();
|
||||
|
||||
if (isMouseIdle) {
|
||||
isMouseIdle = false;
|
||||
removeIdleClasses();
|
||||
events.trigger(self, 'mouseactive');
|
||||
}
|
||||
showCursor();
|
||||
}
|
||||
|
||||
function onPointerEnter(e) {
|
||||
|
||||
var pointerType = e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse');
|
||||
const pointerType = e.pointerType || (layoutManager.mobile ? 'touch' : 'mouse');
|
||||
|
||||
if (pointerType === 'mouse') {
|
||||
if (!isMouseIdle) {
|
||||
var parent = focusManager.focusableParent(e.target);
|
||||
const parent = focusManager.focusableParent(e.target);
|
||||
if (parent) {
|
||||
focusManager.focus(parent);
|
||||
}
|
||||
|
@ -87,7 +99,6 @@ define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'd
|
|||
}
|
||||
|
||||
function enableFocusWithMouse() {
|
||||
|
||||
if (!layoutManager.tv) {
|
||||
return false;
|
||||
}
|
||||
|
@ -104,25 +115,20 @@ define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'd
|
|||
}
|
||||
|
||||
function onMouseInterval() {
|
||||
|
||||
if (!isMouseIdle && mouseIdleTime() >= 5000) {
|
||||
isMouseIdle = true;
|
||||
addIdleClasses();
|
||||
events.trigger(self, 'mouseidle');
|
||||
hideCursor();
|
||||
}
|
||||
}
|
||||
|
||||
var mouseInterval;
|
||||
let mouseInterval;
|
||||
function startMouseInterval() {
|
||||
|
||||
if (!mouseInterval) {
|
||||
mouseInterval = setInterval(onMouseInterval, 5000);
|
||||
}
|
||||
}
|
||||
|
||||
function stopMouseInterval() {
|
||||
|
||||
var interval = mouseInterval;
|
||||
const interval = mouseInterval;
|
||||
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
|
@ -133,7 +139,6 @@ define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'd
|
|||
}
|
||||
|
||||
function initMouse() {
|
||||
|
||||
stopMouseInterval();
|
||||
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
|
@ -167,5 +172,10 @@ define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'd
|
|||
|
||||
events.on(layoutManager, 'modechange', initMouse);
|
||||
|
||||
return self;
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
|
||||
export default {
|
||||
hideCursor,
|
||||
showCursor
|
||||
};
|
||||
|
||||
|
|
|
@ -1,66 +1,65 @@
|
|||
define(['browser'], function (browser) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
|
||||
function fallback(urls) {
|
||||
var i = 0;
|
||||
function fallback(urls) {
|
||||
var i = 0;
|
||||
|
||||
(function createIframe() {
|
||||
var frame = document.createElement('iframe');
|
||||
frame.style.display = 'none';
|
||||
frame.src = urls[i++];
|
||||
document.documentElement.appendChild(frame);
|
||||
(function createIframe() {
|
||||
var frame = document.createElement('iframe');
|
||||
frame.style.display = 'none';
|
||||
frame.src = urls[i++];
|
||||
document.documentElement.appendChild(frame);
|
||||
|
||||
// the download init has to be sequential otherwise IE only use the first
|
||||
var interval = setInterval(function () {
|
||||
if (frame.contentWindow.document.readyState === 'complete' || frame.contentWindow.document.readyState === 'interactive') {
|
||||
clearInterval(interval);
|
||||
// the download init has to be sequential otherwise IE only use the first
|
||||
var interval = setInterval(function () {
|
||||
if (frame.contentWindow.document.readyState === 'complete' || frame.contentWindow.document.readyState === 'interactive') {
|
||||
clearInterval(interval);
|
||||
|
||||
// Safari needs a timeout
|
||||
setTimeout(function () {
|
||||
frame.parentNode.removeChild(frame);
|
||||
}, 1000);
|
||||
// Safari needs a timeout
|
||||
setTimeout(function () {
|
||||
frame.parentNode.removeChild(frame);
|
||||
}, 1000);
|
||||
|
||||
if (i < urls.length) {
|
||||
createIframe();
|
||||
}
|
||||
if (i < urls.length) {
|
||||
createIframe();
|
||||
}
|
||||
}, 100);
|
||||
})();
|
||||
}
|
||||
|
||||
function sameDomain(url) {
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
|
||||
return location.hostname === a.hostname && location.protocol === a.protocol;
|
||||
}
|
||||
|
||||
function download(url) {
|
||||
var a = document.createElement('a');
|
||||
a.download = '';
|
||||
a.href = url;
|
||||
// firefox doesn't support `a.click()`...
|
||||
a.dispatchEvent(new MouseEvent('click'));
|
||||
}
|
||||
|
||||
return function (urls) {
|
||||
if (!urls) {
|
||||
throw new Error('`urls` required');
|
||||
}
|
||||
|
||||
if (typeof document.createElement('a').download === 'undefined') {
|
||||
return fallback(urls);
|
||||
}
|
||||
|
||||
var delay = 0;
|
||||
|
||||
urls.forEach(function (url) {
|
||||
// the download init has to be sequential for firefox if the urls are not on the same domain
|
||||
if (browser.firefox && !sameDomain(url)) {
|
||||
return setTimeout(download.bind(null, url), 100 * ++delay);
|
||||
}
|
||||
}, 100);
|
||||
})();
|
||||
}
|
||||
|
||||
function sameDomain(url) {
|
||||
var a = document.createElement('a');
|
||||
a.href = url;
|
||||
|
||||
return location.hostname === a.hostname && location.protocol === a.protocol;
|
||||
}
|
||||
|
||||
function download(url) {
|
||||
var a = document.createElement('a');
|
||||
a.download = '';
|
||||
a.href = url;
|
||||
// firefox doesn't support `a.click()`...
|
||||
a.dispatchEvent(new MouseEvent('click'));
|
||||
}
|
||||
|
||||
export default function (urls) {
|
||||
if (!urls) {
|
||||
throw new Error('`urls` required');
|
||||
}
|
||||
|
||||
if (typeof document.createElement('a').download === 'undefined') {
|
||||
return fallback(urls);
|
||||
}
|
||||
|
||||
var delay = 0;
|
||||
|
||||
urls.forEach(function (url) {
|
||||
// the download init has to be sequential for firefox if the urls are not on the same domain
|
||||
if (browser.firefox && !sameDomain(url)) {
|
||||
return setTimeout(download.bind(null, url), 100 * ++delay);
|
||||
}
|
||||
|
||||
download(url);
|
||||
});
|
||||
}
|
||||
|
||||
download(url);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
@ -60,7 +60,7 @@ export default function (view, params) {
|
|||
const viewStyle = getPageData(view).view;
|
||||
const itemsContainer = view.querySelector('.itemsContainer');
|
||||
|
||||
if ('List' == viewStyle) {
|
||||
if (viewStyle == 'List') {
|
||||
itemsContainer.classList.add('vertical-list');
|
||||
itemsContainer.classList.remove('vertical-wrap');
|
||||
} else {
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
define([
|
||||
'jQuery',
|
||||
'emby-button',
|
||||
'emby-input',
|
||||
'scripts/livetvcomponents',
|
||||
'paper-icon-button-light',
|
||||
'emby-itemscontainer',
|
||||
'emby-collapse',
|
||||
'emby-select',
|
||||
'livetvcss',
|
||||
'emby-checkbox',
|
||||
'emby-slider',
|
||||
'listViewStyle',
|
||||
'dashboardcss',
|
||||
'detailtablecss'], function () {
|
||||
import 'emby-button';
|
||||
import 'emby-input';
|
||||
import 'scripts/livetvcomponents';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-itemscontainer';
|
||||
import 'emby-collapse';
|
||||
import 'emby-select';
|
||||
import 'livetvcss';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-slider';
|
||||
import 'listViewStyle';
|
||||
import 'dashboardcss';
|
||||
import 'detailtablecss';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
console.groupCollapsed('defining core routes');
|
||||
|
||||
function defineRoute(newRoute) {
|
||||
var path = newRoute.alias ? newRoute.alias : newRoute.path;
|
||||
|
@ -21,8 +23,6 @@ define([
|
|||
Emby.Page.addRoute(path, newRoute);
|
||||
}
|
||||
|
||||
console.debug('defining core routes');
|
||||
|
||||
defineRoute({
|
||||
alias: '/addserver.html',
|
||||
path: '/controllers/session/addServer/index.html',
|
||||
|
@ -31,6 +31,7 @@ define([
|
|||
startup: true,
|
||||
controller: 'session/addServer/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/selectserver.html',
|
||||
path: '/controllers/session/selectServer/index.html',
|
||||
|
@ -40,6 +41,7 @@ define([
|
|||
controller: 'session/selectServer/index',
|
||||
type: 'selectserver'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/login.html',
|
||||
path: '/controllers/session/login/index.html',
|
||||
|
@ -49,6 +51,7 @@ define([
|
|||
controller: 'session/login/index',
|
||||
type: 'login'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/forgotpassword.html',
|
||||
path: '/controllers/session/forgotPassword/index.html',
|
||||
|
@ -56,6 +59,7 @@ define([
|
|||
startup: true,
|
||||
controller: 'session/forgotPassword/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/forgotpasswordpin.html',
|
||||
path: '/controllers/session/redeemPassword/index.html',
|
||||
|
@ -69,42 +73,41 @@ define([
|
|||
alias: '/mypreferencesmenu.html',
|
||||
path: '/controllers/user/menu/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/menu/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/myprofile.html',
|
||||
path: '/controllers/user/profile/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/profile/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/mypreferencesdisplay.html',
|
||||
path: '/controllers/user/display/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/display/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/mypreferenceshome.html',
|
||||
path: '/controllers/user/home/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/home/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/mypreferencesplayback.html',
|
||||
path: '/controllers/user/playback/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/playback/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/mypreferencessubtitles.html',
|
||||
path: '/controllers/user/subtitles/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/subtitles/index'
|
||||
});
|
||||
|
||||
|
@ -114,42 +117,49 @@ define([
|
|||
roles: 'admin',
|
||||
controller: 'dashboard/dashboard'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/dashboardgeneral.html',
|
||||
controller: 'dashboard/general',
|
||||
autoFocus: false,
|
||||
roles: 'admin'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/networking.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/networking'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/devices.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/devices/devices'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/device.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/devices/device'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/dlnaprofile.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/dlna/profile'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/dlnaprofiles.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/dlna/profiles'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/addplugin.html',
|
||||
path: '/controllers/dashboard/plugins/add/index.html',
|
||||
|
@ -157,52 +167,61 @@ define([
|
|||
roles: 'admin',
|
||||
controller: 'dashboard/plugins/add/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/library.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/mediaLibrary'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/librarydisplay.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/librarydisplay'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/dlnasettings.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/dlna/settings'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/edititemmetadata.html',
|
||||
controller: 'edititemmetadata',
|
||||
autoFocus: false
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/encodingsettings.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/encodingsettings'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/log.html',
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/logs'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/metadataimages.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/metadataImages'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/metadatanfo.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/metadatanfo'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/notificationsetting.html',
|
||||
path: '/controllers/dashboard/notifications/notification/index.html',
|
||||
|
@ -210,6 +229,7 @@ define([
|
|||
roles: 'admin',
|
||||
controller: 'dashboard/notifications/notification/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/notificationsettings.html',
|
||||
path: '/controllers/dashboard/notifications/notifications/index.html',
|
||||
|
@ -217,12 +237,14 @@ define([
|
|||
autoFocus: false,
|
||||
roles: 'admin'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/playbackconfiguration.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/playback'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/availableplugins.html',
|
||||
path: '/controllers/dashboard/plugins/available/index.html',
|
||||
|
@ -230,6 +252,7 @@ define([
|
|||
roles: 'admin',
|
||||
controller: 'dashboard/plugins/available/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/repositories.html',
|
||||
path: '/controllers/dashboard/plugins/repositories/index.html',
|
||||
|
@ -242,67 +265,72 @@ define([
|
|||
path: '/home.html',
|
||||
autoFocus: false,
|
||||
controller: 'home',
|
||||
transition: 'fade',
|
||||
type: 'home'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/search.html',
|
||||
controller: 'searchpage'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/list.html',
|
||||
autoFocus: false,
|
||||
controller: 'list',
|
||||
transition: 'fade'
|
||||
controller: 'list'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/details',
|
||||
path: '/controllers/itemDetails/index.html',
|
||||
controller: 'itemDetails/index',
|
||||
autoFocus: false,
|
||||
transition: 'fade'
|
||||
autoFocus: false
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/livetv.html',
|
||||
controller: 'livetv/livetvsuggested',
|
||||
autoFocus: false,
|
||||
transition: 'fade'
|
||||
autoFocus: false
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/livetvguideprovider.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'livetvguideprovider'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/livetvsettings.html',
|
||||
autoFocus: false,
|
||||
controller: 'livetvsettings'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/livetvstatus.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'livetvstatus'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/livetvtuner.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'livetvtuner'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/movies.html',
|
||||
autoFocus: false,
|
||||
controller: 'movies/moviesrecommended',
|
||||
transition: 'fade'
|
||||
controller: 'movies/moviesrecommended'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/music.html',
|
||||
controller: 'music/musicrecommended',
|
||||
autoFocus: false,
|
||||
transition: 'fade'
|
||||
autoFocus: false
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/installedplugins.html',
|
||||
path: '/controllers/dashboard/plugins/installed/index.html',
|
||||
|
@ -310,41 +338,46 @@ define([
|
|||
roles: 'admin',
|
||||
controller: 'dashboard/plugins/installed/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/scheduledtask.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/scheduledtasks/scheduledtask'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/scheduledtasks.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/scheduledtasks/scheduledtasks'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/serveractivity.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/serveractivity'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/apikeys.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/apikeys'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/streamingsettings.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/streaming'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/tv.html',
|
||||
autoFocus: false,
|
||||
controller: 'shows/tvrecommended',
|
||||
transition: 'fade'
|
||||
controller: 'shows/tvrecommended'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
|
@ -353,29 +386,34 @@ define([
|
|||
roles: 'admin',
|
||||
controller: 'dashboard/users/useredit'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/userlibraryaccess.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/users/userlibraryaccess'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/usernew.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/users/usernew'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/userparentalcontrol.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/users/userparentalcontrol'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/userpassword.html',
|
||||
autoFocus: false,
|
||||
controller: 'dashboard/users/userpasswordpage'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/userprofiles.html',
|
||||
autoFocus: false,
|
||||
|
@ -390,6 +428,7 @@ define([
|
|||
anonymous: true,
|
||||
controller: 'wizard/remote/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizardfinish.html',
|
||||
path: '/controllers/wizard/finish/index.html',
|
||||
|
@ -397,12 +436,14 @@ define([
|
|||
anonymous: true,
|
||||
controller: 'wizard/finish/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/wizardlibrary.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'dashboard/mediaLibrary'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizardsettings.html',
|
||||
path: '/controllers/wizard/settings/index.html',
|
||||
|
@ -410,6 +451,7 @@ define([
|
|||
anonymous: true,
|
||||
controller: 'wizard/settings/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizardstart.html',
|
||||
path: '/controllers/wizard/start/index.html',
|
||||
|
@ -417,6 +459,7 @@ define([
|
|||
anonymous: true,
|
||||
controller: 'wizard/start/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/wizarduser.html',
|
||||
path: '/controllers/wizard/user/index.html',
|
||||
|
@ -428,7 +471,6 @@ define([
|
|||
defineRoute({
|
||||
alias: '/video',
|
||||
path: '/controllers/playback/video/index.html',
|
||||
transition: 'fade',
|
||||
controller: 'playback/video/index',
|
||||
autoFocus: false,
|
||||
type: 'video-osd',
|
||||
|
@ -436,16 +478,17 @@ define([
|
|||
fullscreen: true,
|
||||
enableMediaControl: false
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/queue',
|
||||
path: '/controllers/playback/queue/index.html',
|
||||
controller: 'playback/queue/index',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
fullscreen: true,
|
||||
supportsThemeMedia: true,
|
||||
enableMediaControl: false
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/configurationpage',
|
||||
autoFocus: false,
|
||||
|
@ -459,9 +502,13 @@ define([
|
|||
isDefaultRoute: true,
|
||||
autoFocus: false
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/index.html',
|
||||
autoFocus: false,
|
||||
isDefaultRoute: true
|
||||
});
|
||||
});
|
||||
|
||||
console.groupEnd('defining core routes');
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
|
|
@ -2,7 +2,6 @@ define(['focusManager', 'dom', 'scrollStyles'], function (focusManager, dom) {
|
|||
'use strict';
|
||||
|
||||
function getBoundingClientRect(elem) {
|
||||
|
||||
// Support: BlackBerry 5, iOS 3 (original iPhone)
|
||||
// If we don't have gBCR, just use 0,0 rather than error
|
||||
if (elem.getBoundingClientRect) {
|
||||
|
@ -13,7 +12,6 @@ define(['focusManager', 'dom', 'scrollStyles'], function (focusManager, dom) {
|
|||
}
|
||||
|
||||
function getPosition(scrollContainer, item, horizontal) {
|
||||
|
||||
var slideeOffset = getBoundingClientRect(scrollContainer);
|
||||
var itemOffset = getBoundingClientRect(item);
|
||||
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
define(['connectionManager', 'playbackManager', 'syncPlayManager', 'events', 'inputManager', 'focusManager', 'appRouter'], function (connectionManager, playbackManager, syncPlayManager, events, inputManager, focusManager, appRouter) {
|
||||
'use strict';
|
||||
|
||||
playbackManager = playbackManager.default || playbackManager;
|
||||
|
||||
var serverNotifications = {};
|
||||
|
||||
function notifyApp() {
|
||||
|
|
|
@ -80,43 +80,6 @@ import events from 'events';
|
|||
return val ? parseInt(val) : null;
|
||||
}
|
||||
|
||||
export function syncOnlyOnWifi(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('syncOnlyOnWifi', val.toString());
|
||||
}
|
||||
|
||||
return this.get('syncOnlyOnWifi') !== 'false';
|
||||
}
|
||||
|
||||
export function syncPath(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('syncPath', val);
|
||||
}
|
||||
|
||||
return this.get('syncPath');
|
||||
}
|
||||
|
||||
export function cameraUploadServers(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('cameraUploadServers', val.join(','));
|
||||
}
|
||||
|
||||
val = this.get('cameraUploadServers');
|
||||
if (val) {
|
||||
return val.split(',');
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
export function runAtStartup(val) {
|
||||
if (val !== undefined) {
|
||||
this.set('runatstartup', val.toString());
|
||||
}
|
||||
|
||||
return this.get('runatstartup') === 'true';
|
||||
}
|
||||
|
||||
export function set(name, value, userId) {
|
||||
const currentValue = this.get(name, userId);
|
||||
appStorage.setItem(getKey(name, userId), value);
|
||||
|
@ -139,10 +102,6 @@ export default {
|
|||
maxStreamingBitrate: maxStreamingBitrate,
|
||||
maxStaticMusicBitrate: maxStaticMusicBitrate,
|
||||
maxChromecastBitrate: maxChromecastBitrate,
|
||||
syncOnlyOnWifi: syncOnlyOnWifi,
|
||||
syncPath: syncPath,
|
||||
cameraUploadServers: cameraUploadServers,
|
||||
runAtStartup: runAtStartup,
|
||||
set: set,
|
||||
get: get
|
||||
};
|
||||
|
|
|
@ -18,7 +18,7 @@ function getDefaultConfig() {
|
|||
});
|
||||
}
|
||||
|
||||
export function enableMultiServer() {
|
||||
export function getMultiServer() {
|
||||
return getConfig().then(config => {
|
||||
return config.multiserver;
|
||||
}).catch(error => {
|
||||
|
@ -26,3 +26,21 @@ export function enableMultiServer() {
|
|||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
export function getThemes() {
|
||||
return getConfig().then(config => {
|
||||
return config.themes;
|
||||
}).catch(error => {
|
||||
console.log('cannot get web config:', error);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
|
||||
export function getPlugins() {
|
||||
return getConfig().then(config => {
|
||||
return config.plugins;
|
||||
}).catch(error => {
|
||||
console.log('cannot get web config:', error);
|
||||
return [];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -8,7 +8,6 @@ define([], function () {
|
|||
} else {
|
||||
window.open(url, target || '_blank');
|
||||
}
|
||||
|
||||
},
|
||||
enableFullscreen: function () {
|
||||
if (window.NativeShell) {
|
||||
|
|
|
@ -6,7 +6,7 @@ function getWindowLocationSearch(win) {
|
|||
if (!search) {
|
||||
var index = window.location.href.indexOf('?');
|
||||
|
||||
if (-1 != index) {
|
||||
if (index != -1) {
|
||||
search = window.location.href.substring(index);
|
||||
}
|
||||
}
|
||||
|
@ -22,7 +22,7 @@ window.getParameterByName = function (name, url) {
|
|||
var regex = new RegExp(regexS, 'i');
|
||||
var results = regex.exec(url || getWindowLocationSearch());
|
||||
|
||||
if (null == results) {
|
||||
if (results == null) {
|
||||
return '';
|
||||
}
|
||||
|
||||
|
@ -73,7 +73,7 @@ var Dashboard = {
|
|||
var urlLower = window.location.href.toLowerCase();
|
||||
var index = urlLower.lastIndexOf('/web');
|
||||
|
||||
if (-1 != index) {
|
||||
if (index != -1) {
|
||||
return urlLower.substring(0, index);
|
||||
}
|
||||
|
||||
|
@ -178,7 +178,7 @@ var Dashboard = {
|
|||
});
|
||||
},
|
||||
alert: function (options) {
|
||||
if ('string' == typeof options) {
|
||||
if (typeof options == 'string') {
|
||||
return void require(['toast'], function (toast) {
|
||||
toast.default({
|
||||
text: options
|
||||
|
@ -197,7 +197,7 @@ var Dashboard = {
|
|||
var capabilities = {
|
||||
PlayableMediaTypes: ['Audio', 'Video'],
|
||||
SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'],
|
||||
SupportsPersistentIdentifier: 'cordova' === self.appMode || 'android' === self.appMode,
|
||||
SupportsPersistentIdentifier: self.appMode === 'cordova' || self.appMode === 'android',
|
||||
SupportsMediaControl: true
|
||||
};
|
||||
appHost.getPushTokenInfo();
|
||||
|
@ -452,8 +452,8 @@ function initClient() {
|
|||
}
|
||||
|
||||
function onGlobalizeInit(browser, globalize) {
|
||||
if ('android' === self.appMode) {
|
||||
if (-1 !== self.location.href.toString().toLowerCase().indexOf('start=backgroundsync')) {
|
||||
if (self.appMode === 'android') {
|
||||
if (self.location.href.toString().toLowerCase().indexOf('start=backgroundsync') !== -1) {
|
||||
return onAppReady(browser);
|
||||
}
|
||||
}
|
||||
|
@ -477,36 +477,30 @@ function initClient() {
|
|||
|
||||
function loadPlugins(appHost, browser, shell) {
|
||||
console.debug('loading installed plugins');
|
||||
var list = [
|
||||
'plugins/playAccessValidation/plugin',
|
||||
'plugins/experimentalWarnings/plugin',
|
||||
'plugins/htmlAudioPlayer/plugin',
|
||||
'plugins/htmlVideoPlayer/plugin',
|
||||
'plugins/photoPlayer/plugin',
|
||||
'plugins/bookPlayer/plugin',
|
||||
'plugins/youtubePlayer/plugin',
|
||||
'plugins/backdropScreensaver/plugin',
|
||||
'plugins/logoScreensaver/plugin'
|
||||
];
|
||||
|
||||
if (appHost.supports('remotecontrol')) {
|
||||
list.push('plugins/sessionPlayer/plugin');
|
||||
|
||||
if (browser.chrome || browser.opera) {
|
||||
list.push('plugins/chromecastPlayer/plugin');
|
||||
}
|
||||
}
|
||||
|
||||
if (window.NativeShell) {
|
||||
list = list.concat(window.NativeShell.getPlugins());
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
Promise.all(list.map(loadPlugin)).then(function () {
|
||||
require(['packageManager'], function (packageManager) {
|
||||
packageManager.init().then(resolve, reject);
|
||||
require(['webSettings'], function (webSettings) {
|
||||
webSettings.getPlugins().then(function (list) {
|
||||
// these two plugins are dependent on features
|
||||
if (!appHost.supports('remotecontrol')) {
|
||||
list.splice(list.indexOf('sessionPlayer'), 1);
|
||||
|
||||
if (!browser.chrome && !browser.opera) {
|
||||
list.splice(list.indexOf('chromecastPlayer', 1));
|
||||
}
|
||||
}
|
||||
|
||||
// add any native plugins
|
||||
if (window.NativeShell) {
|
||||
list = list.concat(window.NativeShell.getPlugins());
|
||||
}
|
||||
|
||||
Promise.all(list.map(loadPlugin)).then(function () {
|
||||
require(['packageManager'], function (packageManager) {
|
||||
packageManager.init().then(resolve, reject);
|
||||
});
|
||||
}, reject);
|
||||
});
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -532,7 +526,7 @@ function initClient() {
|
|||
|
||||
window.Emby.Page = appRouter;
|
||||
|
||||
require(['emby-button', 'scripts/themeLoader', 'libraryMenu', 'scripts/routes'], function () {
|
||||
require(['emby-button', 'scripts/autoThemes', 'libraryMenu', 'scripts/routes'], function () {
|
||||
Emby.Page.start({
|
||||
click: false,
|
||||
hashbang: true
|
||||
|
@ -653,8 +647,7 @@ function initClient() {
|
|||
nowPlayingHelper: componentsPath + '/playback/nowplayinghelper',
|
||||
pluginManager: componentsPath + '/pluginManager',
|
||||
packageManager: componentsPath + '/packageManager',
|
||||
screensaverManager: componentsPath + '/screensavermanager',
|
||||
chromecastHelper: 'plugins/chromecastPlayer/chromecastHelpers'
|
||||
screensaverManager: componentsPath + '/screensavermanager'
|
||||
};
|
||||
|
||||
requirejs.onError = onRequireJsError;
|
||||
|
@ -848,7 +841,7 @@ function initClient() {
|
|||
define('viewContainer', [componentsPath + '/viewContainer'], returnFirstDependency);
|
||||
define('dialogHelper', [componentsPath + '/dialogHelper/dialogHelper'], returnFirstDependency);
|
||||
define('serverNotifications', [scriptsPath + '/serverNotifications'], returnFirstDependency);
|
||||
define('skinManager', [componentsPath + '/skinManager'], returnFirstDependency);
|
||||
define('skinManager', [scriptsPath + '/themeManager'], returnFirstDependency);
|
||||
define('keyboardnavigation', [scriptsPath + '/keyboardNavigation'], returnFirstDependency);
|
||||
define('mouseManager', [scriptsPath + '/mouseManager'], returnFirstDependency);
|
||||
define('scrollManager', [componentsPath + '/scrollManager'], returnFirstDependency);
|
||||
|
@ -863,7 +856,7 @@ function initClient() {
|
|||
});
|
||||
define('appRouter', [componentsPath + '/appRouter', 'itemHelper'], function (appRouter, itemHelper) {
|
||||
function showItem(item, serverId, options) {
|
||||
if ('string' == typeof item) {
|
||||
if (typeof item == 'string') {
|
||||
require(['connectionManager'], function (connectionManager) {
|
||||
var apiClient = connectionManager.currentApiClient();
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), item).then(function (item) {
|
||||
|
@ -871,7 +864,7 @@ function initClient() {
|
|||
});
|
||||
});
|
||||
} else {
|
||||
if (2 == arguments.length) {
|
||||
if (arguments.length == 2) {
|
||||
options = arguments[1];
|
||||
}
|
||||
|
||||
|
@ -953,27 +946,27 @@ function initClient() {
|
|||
var itemType = item.Type || (options ? options.itemType : null);
|
||||
var serverId = item.ServerId || options.serverId;
|
||||
|
||||
if ('settings' === item) {
|
||||
if (item === 'settings') {
|
||||
return 'mypreferencesmenu.html';
|
||||
}
|
||||
|
||||
if ('wizard' === item) {
|
||||
if (item === 'wizard') {
|
||||
return 'wizardstart.html';
|
||||
}
|
||||
|
||||
if ('manageserver' === item) {
|
||||
if (item === 'manageserver') {
|
||||
return 'dashboard.html';
|
||||
}
|
||||
|
||||
if ('recordedtv' === item) {
|
||||
if (item === 'recordedtv') {
|
||||
return 'livetv.html?tab=3&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('nextup' === item) {
|
||||
if (item === 'nextup') {
|
||||
return 'list.html?type=nextup&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('list' === item) {
|
||||
if (item === 'list') {
|
||||
var url = 'list.html?serverId=' + options.serverId + '&type=' + options.itemTypes;
|
||||
|
||||
if (options.isFavorite) {
|
||||
|
@ -983,61 +976,61 @@ function initClient() {
|
|||
return url;
|
||||
}
|
||||
|
||||
if ('livetv' === item) {
|
||||
if ('programs' === options.section) {
|
||||
if (item === 'livetv') {
|
||||
if (options.section === 'programs') {
|
||||
return 'livetv.html?tab=0&serverId=' + options.serverId;
|
||||
}
|
||||
if ('guide' === options.section) {
|
||||
if (options.section === 'guide') {
|
||||
return 'livetv.html?tab=1&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('movies' === options.section) {
|
||||
if (options.section === 'movies') {
|
||||
return 'list.html?type=Programs&IsMovie=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('shows' === options.section) {
|
||||
if (options.section === 'shows') {
|
||||
return 'list.html?type=Programs&IsSeries=true&IsMovie=false&IsNews=false&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('sports' === options.section) {
|
||||
if (options.section === 'sports') {
|
||||
return 'list.html?type=Programs&IsSports=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('kids' === options.section) {
|
||||
if (options.section === 'kids') {
|
||||
return 'list.html?type=Programs&IsKids=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('news' === options.section) {
|
||||
if (options.section === 'news') {
|
||||
return 'list.html?type=Programs&IsNews=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('onnow' === options.section) {
|
||||
if (options.section === 'onnow') {
|
||||
return 'list.html?type=Programs&IsAiring=true&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('dvrschedule' === options.section) {
|
||||
if (options.section === 'dvrschedule') {
|
||||
return 'livetv.html?tab=4&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('seriesrecording' === options.section) {
|
||||
if (options.section === 'seriesrecording') {
|
||||
return 'livetv.html?tab=5&serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
return 'livetv.html?serverId=' + options.serverId;
|
||||
}
|
||||
|
||||
if ('SeriesTimer' == itemType) {
|
||||
if (itemType == 'SeriesTimer') {
|
||||
return 'details?seriesTimerId=' + id + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
if ('livetv' == item.CollectionType) {
|
||||
if (item.CollectionType == 'livetv') {
|
||||
return 'livetv.html';
|
||||
}
|
||||
|
||||
if ('Genre' === item.Type) {
|
||||
if (item.Type === 'Genre') {
|
||||
url = 'list.html?genreId=' + item.Id + '&serverId=' + serverId;
|
||||
|
||||
if ('livetv' === context) {
|
||||
if (context === 'livetv') {
|
||||
url += '&type=Programs';
|
||||
}
|
||||
|
||||
|
@ -1048,7 +1041,7 @@ function initClient() {
|
|||
return url;
|
||||
}
|
||||
|
||||
if ('MusicGenre' === item.Type) {
|
||||
if (item.Type === 'MusicGenre') {
|
||||
url = 'list.html?musicGenreId=' + item.Id + '&serverId=' + serverId;
|
||||
|
||||
if (options.parentId) {
|
||||
|
@ -1058,7 +1051,7 @@ function initClient() {
|
|||
return url;
|
||||
}
|
||||
|
||||
if ('Studio' === item.Type) {
|
||||
if (item.Type === 'Studio') {
|
||||
url = 'list.html?studioId=' + item.Id + '&serverId=' + serverId;
|
||||
|
||||
if (options.parentId) {
|
||||
|
@ -1068,28 +1061,28 @@ function initClient() {
|
|||
return url;
|
||||
}
|
||||
|
||||
if ('folders' !== context && !itemHelper.isLocalItem(item)) {
|
||||
if ('movies' == item.CollectionType) {
|
||||
if (context !== 'folders' && !itemHelper.isLocalItem(item)) {
|
||||
if (item.CollectionType == 'movies') {
|
||||
url = 'movies.html?topParentId=' + item.Id;
|
||||
|
||||
if (options && 'latest' === options.section) {
|
||||
if (options && options.section === 'latest') {
|
||||
url += '&tab=1';
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if ('tvshows' == item.CollectionType) {
|
||||
if (item.CollectionType == 'tvshows') {
|
||||
url = 'tv.html?topParentId=' + item.Id;
|
||||
|
||||
if (options && 'latest' === options.section) {
|
||||
if (options && options.section === 'latest') {
|
||||
url += '&tab=2';
|
||||
}
|
||||
|
||||
return url;
|
||||
}
|
||||
|
||||
if ('music' == item.CollectionType) {
|
||||
if (item.CollectionType == 'music') {
|
||||
return 'music.html?topParentId=' + item.Id;
|
||||
}
|
||||
}
|
||||
|
@ -1102,7 +1095,7 @@ function initClient() {
|
|||
|
||||
var contextSuffix = context ? '&context=' + context : '';
|
||||
|
||||
if ('Series' == itemType || 'Season' == itemType || 'Episode' == itemType) {
|
||||
if (itemType == 'Series' || itemType == 'Season' || itemType == 'Episode') {
|
||||
return 'details?id=' + id + contextSuffix + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
|
|
|
@ -1,29 +0,0 @@
|
|||
import * as userSettings from 'userSettings';
|
||||
import skinManager from 'skinManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import events from 'events';
|
||||
|
||||
var currentViewType;
|
||||
pageClassOn('viewbeforeshow', 'page', function () {
|
||||
var classList = this.classList;
|
||||
var viewType = classList.contains('type-interior') || classList.contains('wizardPage') ? 'a' : 'b';
|
||||
|
||||
if (viewType !== currentViewType) {
|
||||
currentViewType = viewType;
|
||||
var theme;
|
||||
var context;
|
||||
|
||||
if ('a' === viewType) {
|
||||
theme = userSettings.dashboardTheme();
|
||||
context = 'serverdashboard';
|
||||
} else {
|
||||
theme = userSettings.theme();
|
||||
}
|
||||
|
||||
skinManager.setTheme(theme, context);
|
||||
}
|
||||
});
|
||||
|
||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||
currentViewType = null;
|
||||
});
|
66
src/scripts/themeManager.js
Normal file
66
src/scripts/themeManager.js
Normal file
|
@ -0,0 +1,66 @@
|
|||
import * as webSettings from 'webSettings';
|
||||
|
||||
var themeStyleElement;
|
||||
var currentThemeId;
|
||||
|
||||
function unloadTheme() {
|
||||
var elem = themeStyleElement;
|
||||
if (elem) {
|
||||
elem.parentNode.removeChild(elem);
|
||||
themeStyleElement = null;
|
||||
currentThemeId = null;
|
||||
}
|
||||
}
|
||||
|
||||
function getThemes() {
|
||||
return webSettings.getThemes();
|
||||
}
|
||||
|
||||
function getThemeStylesheetInfo(id) {
|
||||
return getThemes().then(themes => {
|
||||
var theme = themes.find(theme => {
|
||||
return id ? theme.id === id : theme.default;
|
||||
});
|
||||
|
||||
return {
|
||||
stylesheetPath: 'themes/' + theme.id + '/theme.css',
|
||||
themeId: theme.id
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function setTheme(id) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
if (currentThemeId && currentThemeId === id) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
getThemeStylesheetInfo(id).then(function (info) {
|
||||
if (currentThemeId && currentThemeId === info.themeId) {
|
||||
resolve();
|
||||
return;
|
||||
}
|
||||
|
||||
var linkUrl = info.stylesheetPath;
|
||||
unloadTheme();
|
||||
|
||||
var link = document.createElement('link');
|
||||
link.setAttribute('rel', 'stylesheet');
|
||||
link.setAttribute('type', 'text/css');
|
||||
link.onload = function () {
|
||||
resolve();
|
||||
};
|
||||
|
||||
link.setAttribute('href', linkUrl);
|
||||
document.head.appendChild(link);
|
||||
themeStyleElement = link;
|
||||
currentThemeId = info.themeId;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export default {
|
||||
getThemes: getThemes,
|
||||
setTheme: setTheme
|
||||
};
|
|
@ -7,7 +7,6 @@ function getTouches(e) {
|
|||
|
||||
class TouchHelper {
|
||||
constructor(elem, options) {
|
||||
|
||||
options = options || {};
|
||||
let touchTarget;
|
||||
let touchStartX;
|
||||
|
@ -24,7 +23,6 @@ class TouchHelper {
|
|||
const excludeTagNames = options.ignoreTagNames || [];
|
||||
|
||||
const touchStart = function (e) {
|
||||
|
||||
const touch = getTouches(e)[0];
|
||||
touchTarget = null;
|
||||
touchStartX = 0;
|
||||
|
@ -34,7 +32,6 @@ class TouchHelper {
|
|||
thresholdYMet = false;
|
||||
|
||||
if (touch) {
|
||||
|
||||
const currentTouchTarget = touch.target;
|
||||
|
||||
if (dom.parentWithTag(currentTouchTarget, excludeTagNames)) {
|
||||
|
@ -48,7 +45,6 @@ class TouchHelper {
|
|||
};
|
||||
|
||||
const touchEnd = function (e) {
|
||||
|
||||
const isTouchMove = e.type === 'touchmove';
|
||||
|
||||
if (touchTarget) {
|
||||
|
@ -81,7 +77,6 @@ class TouchHelper {
|
|||
} else if (deltaX < (0 - swipeXThreshold) && Math.abs(deltaY) < swipeXMaxY) {
|
||||
events.trigger(self, 'swipeleft', [touchTarget]);
|
||||
} else if ((deltaY < (0 - swipeYThreshold) || thresholdYMet) && Math.abs(deltaX) < swipeXMaxY) {
|
||||
|
||||
thresholdYMet = true;
|
||||
|
||||
events.trigger(self, 'swipeup', [touchTarget, {
|
||||
|
@ -139,7 +134,6 @@ class TouchHelper {
|
|||
});
|
||||
}
|
||||
destroy() {
|
||||
|
||||
const elem = this.elem;
|
||||
|
||||
if (elem) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue