mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge remote-tracking branch 'upstream/master' into quickconnect
This commit is contained in:
commit
e5f0d77c30
401 changed files with 19558 additions and 12514 deletions
|
@ -1,110 +1,111 @@
|
|||
define(['dom', 'focusManager'], function (dom, focusManager) {
|
||||
'use strict';
|
||||
import dom from 'dom';
|
||||
import focusManager from 'focusManager';
|
||||
|
||||
var inputDisplayElement;
|
||||
var currentDisplayText = '';
|
||||
var currentDisplayTextContainer;
|
||||
let inputDisplayElement;
|
||||
let currentDisplayText = '';
|
||||
let currentDisplayTextContainer;
|
||||
|
||||
function onKeyDown(e) {
|
||||
function onKeyDown(e) {
|
||||
|
||||
if (e.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
if (e.altKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
var key = e.key;
|
||||
var chr = key ? alphanumeric(key) : null;
|
||||
|
||||
if (chr) {
|
||||
|
||||
chr = chr.toString().toUpperCase();
|
||||
|
||||
if (chr.length === 1) {
|
||||
currentDisplayTextContainer = this.options.itemsContainer;
|
||||
onAlphanumericKeyPress(e, chr);
|
||||
}
|
||||
}
|
||||
if (e.ctrlKey) {
|
||||
return;
|
||||
}
|
||||
if (e.shiftKey) {
|
||||
return;
|
||||
}
|
||||
if (e.altKey) {
|
||||
return;
|
||||
}
|
||||
|
||||
function alphanumeric(value) {
|
||||
var letterNumber = /^[0-9a-zA-Z]+$/;
|
||||
return value.match(letterNumber);
|
||||
}
|
||||
const key = e.key;
|
||||
let chr = key ? alphanumeric(key) : null;
|
||||
|
||||
function ensureInputDisplayElement() {
|
||||
if (!inputDisplayElement) {
|
||||
inputDisplayElement = document.createElement('div');
|
||||
inputDisplayElement.classList.add('alphanumeric-shortcut');
|
||||
inputDisplayElement.classList.add('hide');
|
||||
if (chr) {
|
||||
|
||||
document.body.appendChild(inputDisplayElement);
|
||||
chr = chr.toString().toUpperCase();
|
||||
|
||||
if (chr.length === 1) {
|
||||
currentDisplayTextContainer = this.options.itemsContainer;
|
||||
onAlphanumericKeyPress(e, chr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var alpanumericShortcutTimeout;
|
||||
function clearAlphaNumericShortcutTimeout() {
|
||||
if (alpanumericShortcutTimeout) {
|
||||
clearTimeout(alpanumericShortcutTimeout);
|
||||
alpanumericShortcutTimeout = null;
|
||||
}
|
||||
}
|
||||
function resetAlphaNumericShortcutTimeout() {
|
||||
clearAlphaNumericShortcutTimeout();
|
||||
alpanumericShortcutTimeout = setTimeout(onAlphanumericShortcutTimeout, 2000);
|
||||
}
|
||||
function alphanumeric(value) {
|
||||
const letterNumber = /^[0-9a-zA-Z]+$/;
|
||||
return value.match(letterNumber);
|
||||
}
|
||||
|
||||
function onAlphanumericKeyPress(e, chr) {
|
||||
if (currentDisplayText.length >= 3) {
|
||||
return;
|
||||
}
|
||||
ensureInputDisplayElement();
|
||||
currentDisplayText += chr;
|
||||
inputDisplayElement.innerHTML = currentDisplayText;
|
||||
inputDisplayElement.classList.remove('hide');
|
||||
resetAlphaNumericShortcutTimeout();
|
||||
}
|
||||
|
||||
function onAlphanumericShortcutTimeout() {
|
||||
var value = currentDisplayText;
|
||||
var container = currentDisplayTextContainer;
|
||||
|
||||
currentDisplayText = '';
|
||||
currentDisplayTextContainer = null;
|
||||
inputDisplayElement.innerHTML = '';
|
||||
function ensureInputDisplayElement() {
|
||||
if (!inputDisplayElement) {
|
||||
inputDisplayElement = document.createElement('div');
|
||||
inputDisplayElement.classList.add('alphanumeric-shortcut');
|
||||
inputDisplayElement.classList.add('hide');
|
||||
clearAlphaNumericShortcutTimeout();
|
||||
selectByShortcutValue(container, value);
|
||||
|
||||
document.body.appendChild(inputDisplayElement);
|
||||
}
|
||||
}
|
||||
|
||||
let alpanumericShortcutTimeout;
|
||||
function clearAlphaNumericShortcutTimeout() {
|
||||
if (alpanumericShortcutTimeout) {
|
||||
clearTimeout(alpanumericShortcutTimeout);
|
||||
alpanumericShortcutTimeout = null;
|
||||
}
|
||||
}
|
||||
function resetAlphaNumericShortcutTimeout() {
|
||||
clearAlphaNumericShortcutTimeout();
|
||||
alpanumericShortcutTimeout = setTimeout(onAlphanumericShortcutTimeout, 2000);
|
||||
}
|
||||
|
||||
function onAlphanumericKeyPress(e, chr) {
|
||||
if (currentDisplayText.length >= 3) {
|
||||
return;
|
||||
}
|
||||
ensureInputDisplayElement();
|
||||
currentDisplayText += chr;
|
||||
inputDisplayElement.innerHTML = currentDisplayText;
|
||||
inputDisplayElement.classList.remove('hide');
|
||||
resetAlphaNumericShortcutTimeout();
|
||||
}
|
||||
|
||||
function onAlphanumericShortcutTimeout() {
|
||||
const value = currentDisplayText;
|
||||
const container = currentDisplayTextContainer;
|
||||
|
||||
currentDisplayText = '';
|
||||
currentDisplayTextContainer = null;
|
||||
inputDisplayElement.innerHTML = '';
|
||||
inputDisplayElement.classList.add('hide');
|
||||
clearAlphaNumericShortcutTimeout();
|
||||
selectByShortcutValue(container, value);
|
||||
}
|
||||
|
||||
function selectByShortcutValue(container, value) {
|
||||
|
||||
value = value.toUpperCase();
|
||||
|
||||
let focusElem;
|
||||
if (value === '#') {
|
||||
|
||||
focusElem = container.querySelector('*[data-prefix]');
|
||||
}
|
||||
|
||||
function selectByShortcutValue(container, value) {
|
||||
|
||||
value = value.toUpperCase();
|
||||
|
||||
var focusElem;
|
||||
if (value === '#') {
|
||||
|
||||
focusElem = container.querySelector('*[data-prefix]');
|
||||
}
|
||||
|
||||
if (!focusElem) {
|
||||
focusElem = container.querySelector('*[data-prefix^=\'' + value + '\']');
|
||||
}
|
||||
|
||||
if (focusElem) {
|
||||
focusManager.focus(focusElem);
|
||||
}
|
||||
if (!focusElem) {
|
||||
focusElem = container.querySelector('*[data-prefix^=\'' + value + '\']');
|
||||
}
|
||||
|
||||
function AlphaNumericShortcuts(options) {
|
||||
if (focusElem) {
|
||||
focusManager.focus(focusElem);
|
||||
}
|
||||
}
|
||||
|
||||
class AlphaNumericShortcuts {
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
|
||||
var keyDownHandler = onKeyDown.bind(this);
|
||||
const keyDownHandler = onKeyDown.bind(this);
|
||||
|
||||
dom.addEventListener(window, 'keydown', keyDownHandler, {
|
||||
passive: true
|
||||
|
@ -112,10 +113,9 @@ define(['dom', 'focusManager'], function (dom, focusManager) {
|
|||
|
||||
this.keyDownHandler = keyDownHandler;
|
||||
}
|
||||
destroy() {
|
||||
|
||||
AlphaNumericShortcuts.prototype.destroy = function () {
|
||||
|
||||
var keyDownHandler = this.keyDownHandler;
|
||||
const keyDownHandler = this.keyDownHandler;
|
||||
|
||||
if (keyDownHandler) {
|
||||
dom.removeEventListener(window, 'keydown', keyDownHandler, {
|
||||
|
@ -124,7 +124,7 @@ define(['dom', 'focusManager'], function (dom, focusManager) {
|
|||
this.keyDownHandler = null;
|
||||
}
|
||||
this.options = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return AlphaNumericShortcuts;
|
||||
});
|
||||
export default AlphaNumericShortcuts;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
src += `?v=${self.dashboardVersion}`;
|
||||
}
|
||||
script.src = src;
|
||||
script.setAttribute('async', '');
|
||||
|
||||
if (onload) {
|
||||
script.onload = onload;
|
||||
|
|
|
@ -1,77 +1,78 @@
|
|||
define(['backdrop', 'userSettings', 'libraryMenu'], function (backdrop, userSettings, libraryMenu) {
|
||||
'use strict';
|
||||
import backdrop from 'backdrop';
|
||||
import * as userSettings from 'userSettings';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
|
||||
var cache = {};
|
||||
const cache = {};
|
||||
|
||||
function enabled() {
|
||||
return userSettings.enableBackdrops();
|
||||
function enabled() {
|
||||
return userSettings.enableBackdrops();
|
||||
}
|
||||
|
||||
function getBackdropItemIds(apiClient, userId, types, parentId) {
|
||||
const key = `backdrops2_${userId + (types || '') + (parentId || '')}`;
|
||||
let data = cache[key];
|
||||
|
||||
if (data) {
|
||||
console.debug(`Found backdrop id list in cache. Key: ${key}`);
|
||||
data = JSON.parse(data);
|
||||
return Promise.resolve(data);
|
||||
}
|
||||
|
||||
function getBackdropItemIds(apiClient, userId, types, parentId) {
|
||||
var key = `backdrops2_${userId + (types || '') + (parentId || '')}`;
|
||||
var data = cache[key];
|
||||
const options = {
|
||||
SortBy: 'IsFavoriteOrLiked,Random',
|
||||
Limit: 20,
|
||||
Recursive: true,
|
||||
IncludeItemTypes: types,
|
||||
ImageTypes: 'Backdrop',
|
||||
ParentId: parentId,
|
||||
EnableTotalRecordCount: false
|
||||
};
|
||||
return apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
||||
const images = result.Items.map(function (i) {
|
||||
return {
|
||||
Id: i.Id,
|
||||
tag: i.BackdropImageTags[0],
|
||||
ServerId: i.ServerId
|
||||
};
|
||||
});
|
||||
cache[key] = JSON.stringify(images);
|
||||
return images;
|
||||
});
|
||||
}
|
||||
|
||||
if (data) {
|
||||
console.debug(`Found backdrop id list in cache. Key: ${key}`);
|
||||
data = JSON.parse(data);
|
||||
return Promise.resolve(data);
|
||||
}
|
||||
function showBackdrop(type, parentId) {
|
||||
const apiClient = window.ApiClient;
|
||||
|
||||
var options = {
|
||||
SortBy: 'IsFavoriteOrLiked,Random',
|
||||
Limit: 20,
|
||||
Recursive: true,
|
||||
IncludeItemTypes: types,
|
||||
ImageTypes: 'Backdrop',
|
||||
ParentId: parentId,
|
||||
EnableTotalRecordCount: false
|
||||
};
|
||||
return apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
||||
var images = result.Items.map(function (i) {
|
||||
return {
|
||||
Id: i.Id,
|
||||
tag: i.BackdropImageTags[0],
|
||||
ServerId: i.ServerId
|
||||
};
|
||||
});
|
||||
cache[key] = JSON.stringify(images);
|
||||
return images;
|
||||
if (apiClient) {
|
||||
getBackdropItemIds(apiClient, apiClient.getCurrentUserId(), type, parentId).then(function (images) {
|
||||
if (images.length) {
|
||||
backdrop.setBackdrops(images.map(function (i) {
|
||||
i.BackdropImageTags = [i.tag];
|
||||
return i;
|
||||
}));
|
||||
} else {
|
||||
backdrop.clearBackdrop();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function showBackdrop(type, parentId) {
|
||||
var apiClient = window.ApiClient;
|
||||
pageClassOn('pageshow', 'page', function () {
|
||||
const page = this;
|
||||
|
||||
if (apiClient) {
|
||||
getBackdropItemIds(apiClient, apiClient.getCurrentUserId(), type, parentId).then(function (images) {
|
||||
if (images.length) {
|
||||
backdrop.setBackdrops(images.map(function (i) {
|
||||
i.BackdropImageTags = [i.tag];
|
||||
return i;
|
||||
}));
|
||||
} else {
|
||||
backdrop.clear();
|
||||
}
|
||||
});
|
||||
if (!page.classList.contains('selfBackdropPage')) {
|
||||
if (page.classList.contains('backdropPage')) {
|
||||
if (enabled()) {
|
||||
const type = page.getAttribute('data-backdroptype');
|
||||
const parentId = page.classList.contains('globalBackdropPage') ? '' : libraryMenu.getTopParentId();
|
||||
showBackdrop(type, parentId);
|
||||
} else {
|
||||
page.classList.remove('backdropPage');
|
||||
backdrop.clearBackdrop();
|
||||
}
|
||||
} else {
|
||||
backdrop.clearBackdrop();
|
||||
}
|
||||
}
|
||||
|
||||
pageClassOn('pageshow', 'page', function () {
|
||||
var page = this;
|
||||
|
||||
if (!page.classList.contains('selfBackdropPage')) {
|
||||
if (page.classList.contains('backdropPage')) {
|
||||
if (enabled()) {
|
||||
var type = page.getAttribute('data-backdroptype');
|
||||
var parentId = page.classList.contains('globalBackdropPage') ? '' : libraryMenu.getTopParentId();
|
||||
showBackdrop(type, parentId);
|
||||
} else {
|
||||
page.classList.remove('backdropPage');
|
||||
backdrop.clear();
|
||||
}
|
||||
} else {
|
||||
backdrop.clear();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
|
|
@ -14,10 +14,6 @@ define([], function () {
|
|||
return true;
|
||||
}
|
||||
|
||||
if (userAgent.indexOf('nintendo') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (userAgent.indexOf('viera') !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
@ -93,7 +89,7 @@ define([], function () {
|
|||
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;
|
||||
|
@ -145,7 +141,6 @@ define([], function () {
|
|||
/(chrome)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(safari)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(firefox)[ \/]([\w.]+)/.exec(ua) ||
|
||||
/(msie) ([\w.]+)/.exec(ua) ||
|
||||
ua.indexOf('compatible') < 0 && /(mozilla)(?:.*? rv:([\w.]+)|)/.exec(ua) ||
|
||||
[];
|
||||
|
||||
|
@ -161,14 +156,6 @@ define([], function () {
|
|||
|
||||
if (browser === 'edge') {
|
||||
platform_match = [''];
|
||||
} else {
|
||||
if (ua.indexOf('windows phone') !== -1 || ua.indexOf('iemobile') !== -1) {
|
||||
|
||||
// http://www.neowin.net/news/ie11-fakes-user-agent-to-fool-gmail-in-windows-phone-81-gdr1-update
|
||||
browser = 'msie';
|
||||
} else if (ua.indexOf('like gecko') !== -1 && ua.indexOf('webkit') === -1 && ua.indexOf('opera') === -1 && ua.indexOf('chrome') === -1 && ua.indexOf('safari') === -1) {
|
||||
browser = 'msie';
|
||||
}
|
||||
}
|
||||
|
||||
if (browser === 'opr') {
|
||||
|
@ -211,7 +198,7 @@ define([], function () {
|
|||
browser[matched.platform] = true;
|
||||
}
|
||||
|
||||
if (!browser.chrome && !browser.msie && !browser.edge && !browser.opera && userAgent.toLowerCase().indexOf('webkit') !== -1) {
|
||||
if (!browser.chrome && !browser.edge && !browser.opera && userAgent.toLowerCase().indexOf('webkit') !== -1) {
|
||||
browser.safari = true;
|
||||
}
|
||||
|
||||
|
@ -224,7 +211,10 @@ define([], function () {
|
|||
browser.mobile = true;
|
||||
}
|
||||
|
||||
browser.xboxOne = userAgent.toLowerCase().indexOf('xbox') !== -1;
|
||||
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;
|
||||
|
|
|
@ -6,18 +6,10 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function canPlayH265(videoTestElement, options) {
|
||||
if (browser.tizen || browser.orsay || browser.xboxOne || browser.web0s || options.supportsHevc) {
|
||||
if (browser.tizen || browser.xboxOne || browser.web0s || options.supportsHevc) {
|
||||
return true;
|
||||
}
|
||||
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
if (browser.chromecast) {
|
||||
var isChromecastUltra = userAgent.indexOf('aarch64') !== -1;
|
||||
if (isChromecastUltra) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
if (browser.ps4) {
|
||||
return false;
|
||||
}
|
||||
|
@ -31,7 +23,7 @@ define(['browser'], function (browser) {
|
|||
|
||||
var _supportsTextTracks;
|
||||
function supportsTextTracks() {
|
||||
if (browser.tizen || browser.orsay) {
|
||||
if (browser.tizen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -53,7 +45,7 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function canPlayNativeHls() {
|
||||
if (browser.tizen || browser.orsay) {
|
||||
if (browser.tizen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -68,11 +60,11 @@ define(['browser'], function (browser) {
|
|||
|
||||
function canPlayHlsWithMSE() {
|
||||
// text tracks don’t work with this in firefox
|
||||
return window.MediaSource != null;
|
||||
return window.MediaSource != null; /* eslint-disable-line compat/compat */
|
||||
}
|
||||
|
||||
function supportsAc3(videoTestElement) {
|
||||
if (browser.edgeUwp || browser.tizen || browser.orsay || browser.web0s) {
|
||||
if (browser.edgeUwp || browser.tizen || browser.web0s) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -80,7 +72,7 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function supportsEac3(videoTestElement) {
|
||||
if (browser.tizen || browser.orsay || browser.web0s) {
|
||||
if (browser.tizen || browser.web0s) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -88,7 +80,7 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function supportsAc3InHls(videoTestElement) {
|
||||
if (browser.tizen || browser.orsay || browser.web0s) {
|
||||
if (browser.tizen || browser.web0s) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -104,11 +96,11 @@ define(['browser'], function (browser) {
|
|||
var typeString;
|
||||
|
||||
if (format === 'flac') {
|
||||
if (browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp) {
|
||||
if (browser.tizen || browser.web0s || browser.edgeUwp) {
|
||||
return true;
|
||||
}
|
||||
} else if (format === 'wma') {
|
||||
if (browser.tizen || browser.orsay || browser.edgeUwp) {
|
||||
if (browser.tizen || browser.edgeUwp) {
|
||||
return true;
|
||||
}
|
||||
} else if (format === 'asf') {
|
||||
|
@ -143,7 +135,7 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function testCanPlayMkv(videoTestElement) {
|
||||
if (browser.tizen || browser.orsay || browser.web0s) {
|
||||
if (browser.tizen || browser.web0s) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -152,23 +144,6 @@ define(['browser'], function (browser) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// Unfortunately there's no real way to detect mkv support
|
||||
if (browser.chrome) {
|
||||
// Not supported on opera tv
|
||||
if (browser.operaTv) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
|
||||
// Filter out browsers based on chromium that don't support mkv
|
||||
if (userAgent.indexOf('vivaldi') !== -1 || userAgent.indexOf('opera') !== -1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
if (browser.edgeUwp) {
|
||||
return true;
|
||||
}
|
||||
|
@ -176,30 +151,26 @@ define(['browser'], function (browser) {
|
|||
return false;
|
||||
}
|
||||
|
||||
function testCanPlayAv1(videoTestElement) {
|
||||
if (browser.tizenVersion >= 5.5) {
|
||||
return true;
|
||||
} else if (browser.web0sVersion >= 5 && window.outerHeight >= 2160) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return videoTestElement.canPlayType('video/webm; codecs="av01.0.15M.10"').replace(/no/, '');
|
||||
}
|
||||
|
||||
function testCanPlayTs() {
|
||||
return browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp;
|
||||
return browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
}
|
||||
|
||||
function supportsMpeg2Video() {
|
||||
return browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp;
|
||||
return browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
}
|
||||
|
||||
function supportsVc1() {
|
||||
return browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp;
|
||||
}
|
||||
|
||||
function getFlvMseDirectPlayProfile() {
|
||||
var videoAudioCodecs = ['aac'];
|
||||
if (!browser.edge && !browser.msie) {
|
||||
videoAudioCodecs.push('mp3');
|
||||
}
|
||||
|
||||
return {
|
||||
Container: 'flv',
|
||||
Type: 'Video',
|
||||
VideoCodec: 'h264',
|
||||
AudioCodec: videoAudioCodecs.join(',')
|
||||
};
|
||||
function supportsVc1(videoTestElement) {
|
||||
return browser.tizen || browser.web0s || browser.edgeUwp || videoTestElement.canPlayType('video/mp4; codecs="vc-1"').replace(/no/, '');
|
||||
}
|
||||
|
||||
function getDirectPlayProfileForVideoContainer(container, videoAudioCodecs, videoTestElement, options) {
|
||||
|
@ -209,11 +180,11 @@ define(['browser'], function (browser) {
|
|||
|
||||
switch (container) {
|
||||
case 'asf':
|
||||
supported = browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp;
|
||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
videoAudioCodecs = [];
|
||||
break;
|
||||
case 'avi':
|
||||
supported = browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp;
|
||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
// New Samsung TV don't support XviD/DivX
|
||||
// Explicitly add supported codecs to make other codecs be transcoded
|
||||
if (browser.tizenVersion >= 4) {
|
||||
|
@ -226,29 +197,26 @@ define(['browser'], function (browser) {
|
|||
break;
|
||||
case 'mpg':
|
||||
case 'mpeg':
|
||||
supported = browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp;
|
||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
break;
|
||||
case 'flv':
|
||||
supported = browser.tizen || browser.orsay;
|
||||
//if (!supported && window.MediaSource != null && window.MediaSource.isTypeSupported('video/mp4; codecs="avc1.42E01E,mp4a.40.2"')) {
|
||||
// return getFlvMseDirectPlayProfile();
|
||||
//}
|
||||
supported = browser.tizen;
|
||||
break;
|
||||
case '3gp':
|
||||
case 'mts':
|
||||
case 'trp':
|
||||
case 'vob':
|
||||
case 'vro':
|
||||
supported = browser.tizen || browser.orsay;
|
||||
supported = browser.tizen;
|
||||
break;
|
||||
case 'mov':
|
||||
supported = browser.tizen || browser.orsay || browser.web0s || browser.chrome || browser.edgeUwp;
|
||||
supported = browser.tizen || browser.web0s || browser.chrome || browser.edgeUwp;
|
||||
videoCodecs.push('h264');
|
||||
break;
|
||||
case 'm2ts':
|
||||
supported = browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp;
|
||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
videoCodecs.push('h264');
|
||||
if (supportsVc1()) {
|
||||
if (supportsVc1(videoTestElement)) {
|
||||
videoCodecs.push('vc1');
|
||||
}
|
||||
if (supportsMpeg2Video()) {
|
||||
|
@ -256,7 +224,7 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
break;
|
||||
case 'wmv':
|
||||
supported = browser.tizen || browser.orsay || browser.web0s || browser.edgeUwp;
|
||||
supported = browser.tizen || browser.web0s || browser.edgeUwp;
|
||||
videoAudioCodecs = [];
|
||||
break;
|
||||
case 'ts':
|
||||
|
@ -266,7 +234,7 @@ define(['browser'], function (browser) {
|
|||
videoCodecs.push('h265');
|
||||
videoCodecs.push('hevc');
|
||||
}
|
||||
if (supportsVc1()) {
|
||||
if (supportsVc1(videoTestElement)) {
|
||||
videoCodecs.push('vc1');
|
||||
}
|
||||
if (supportsMpeg2Video()) {
|
||||
|
@ -291,21 +259,6 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function getGlobalMaxVideoBitrate() {
|
||||
var userAgent = navigator.userAgent.toLowerCase();
|
||||
if (browser.chromecast) {
|
||||
var isChromecastUltra = userAgent.indexOf('aarch64') !== -1;
|
||||
if (isChromecastUltra) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// This is a hack to try and detect chromecast on vizio
|
||||
if (self.screen && self.screen.width >= 3800) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return 30000000;
|
||||
}
|
||||
|
||||
var isTizenFhd = false;
|
||||
if (browser.tizen) {
|
||||
try {
|
||||
|
@ -334,7 +287,6 @@ define(['browser'], function (browser) {
|
|||
|
||||
var canPlayVp8 = videoTestElement.canPlayType('video/webm; codecs="vp8"').replace(/no/, '');
|
||||
var canPlayVp9 = videoTestElement.canPlayType('video/webm; codecs="vp9"').replace(/no/, '');
|
||||
var canPlayAv1 = videoTestElement.canPlayType('video/webm; codecs="av1"').replace(/no/, '');
|
||||
var webmAudioCodecs = ['vorbis'];
|
||||
|
||||
var canPlayMkv = testCanPlayMkv(videoTestElement);
|
||||
|
@ -350,11 +302,12 @@ define(['browser'], function (browser) {
|
|||
var videoAudioCodecs = [];
|
||||
var hlsVideoAudioCodecs = [];
|
||||
|
||||
var supportsMp3VideoAudio = videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.69"').replace(/no/, '') ||
|
||||
videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.6B"').replace(/no/, '');
|
||||
var supportsMp3VideoAudio = videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.69"').replace(/no/, '')
|
||||
|| videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.6B"').replace(/no/, '')
|
||||
|| videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp3"').replace(/no/, '');
|
||||
|
||||
// Not sure how to test for this
|
||||
var supportsMp2VideoAudio = browser.edgeUwp || browser.tizen || browser.orsay || browser.web0s;
|
||||
var supportsMp2VideoAudio = browser.edgeUwp || browser.tizen || browser.web0s;
|
||||
|
||||
var maxVideoWidth = browser.xboxOne ?
|
||||
(self.screen ? self.screen.width : null) :
|
||||
|
@ -366,11 +319,6 @@ define(['browser'], function (browser) {
|
|||
|
||||
var canPlayAacVideoAudio = videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.2"').replace(/no/, '');
|
||||
|
||||
if (canPlayAacVideoAudio && browser.chromecast && physicalAudioChannels <= 2) {
|
||||
// prioritize this first
|
||||
videoAudioCodecs.push('aac');
|
||||
}
|
||||
|
||||
// Only put mp3 first if mkv support is there
|
||||
// Otherwise with HLS and mp3 audio we're seeing some browsers
|
||||
// safari is lying
|
||||
|
@ -393,11 +341,6 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
}
|
||||
|
||||
if (canPlayAacVideoAudio && browser.chromecast && videoAudioCodecs.indexOf('aac') === -1) {
|
||||
// prioritize this first
|
||||
videoAudioCodecs.push('aac');
|
||||
}
|
||||
|
||||
if (supportsMp3VideoAudio) {
|
||||
videoAudioCodecs.push('mp3');
|
||||
|
||||
|
@ -432,7 +375,7 @@ define(['browser'], function (browser) {
|
|||
videoAudioCodecs.push('mp2');
|
||||
}
|
||||
|
||||
var supportsDts = browser.tizen || browser.orsay || browser.web0s || options.supportsDts;
|
||||
var supportsDts = browser.tizen || browser.web0s || options.supportsDts || videoTestElement.canPlayType('video/mp4; codecs="dts-"').replace(/no/, '') || videoTestElement.canPlayType('video/mp4; codecs="dts+"').replace(/no/, '');
|
||||
|
||||
// DTS audio not supported in 2018 models (Tizen 4.0)
|
||||
if (browser.tizenVersion >= 4) {
|
||||
|
@ -444,7 +387,7 @@ define(['browser'], function (browser) {
|
|||
videoAudioCodecs.push('dts');
|
||||
}
|
||||
|
||||
if (browser.tizen || browser.orsay || browser.web0s) {
|
||||
if (browser.tizen || browser.web0s) {
|
||||
videoAudioCodecs.push('pcm_s16le');
|
||||
videoAudioCodecs.push('pcm_s24le');
|
||||
}
|
||||
|
@ -453,7 +396,7 @@ define(['browser'], function (browser) {
|
|||
videoAudioCodecs.push('truehd');
|
||||
}
|
||||
|
||||
if (browser.tizen || browser.orsay) {
|
||||
if (browser.tizen) {
|
||||
videoAudioCodecs.push('aac_latm');
|
||||
}
|
||||
|
||||
|
@ -476,6 +419,7 @@ define(['browser'], function (browser) {
|
|||
});
|
||||
|
||||
var mp4VideoCodecs = [];
|
||||
var webmVideoCodecs = [];
|
||||
var hlsVideoCodecs = [];
|
||||
|
||||
if (canPlayH264(videoTestElement)) {
|
||||
|
@ -497,26 +441,42 @@ define(['browser'], function (browser) {
|
|||
mp4VideoCodecs.push('mpeg2video');
|
||||
}
|
||||
|
||||
if (supportsVc1()) {
|
||||
if (supportsVc1(videoTestElement)) {
|
||||
mp4VideoCodecs.push('vc1');
|
||||
}
|
||||
|
||||
if (browser.tizen || browser.orsay) {
|
||||
if (browser.tizen) {
|
||||
mp4VideoCodecs.push('msmpeg4v2');
|
||||
}
|
||||
|
||||
if (canPlayVp8) {
|
||||
mp4VideoCodecs.push('vp8');
|
||||
webmVideoCodecs.push('vp8');
|
||||
}
|
||||
|
||||
if (canPlayVp9) {
|
||||
mp4VideoCodecs.push('vp9');
|
||||
webmVideoCodecs.push('vp9');
|
||||
}
|
||||
|
||||
if (canPlayVp8 || browser.tizen || browser.orsay) {
|
||||
if (testCanPlayAv1(videoTestElement)) {
|
||||
mp4VideoCodecs.push('av1');
|
||||
webmVideoCodecs.push('av1');
|
||||
}
|
||||
|
||||
if (canPlayVp8 || browser.tizen) {
|
||||
videoAudioCodecs.push('vorbis');
|
||||
}
|
||||
|
||||
if (webmVideoCodecs.length) {
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'webm',
|
||||
Type: 'Video',
|
||||
VideoCodec: webmVideoCodecs.join(','),
|
||||
AudioCodec: webmAudioCodecs.join(',')
|
||||
});
|
||||
}
|
||||
|
||||
if (mp4VideoCodecs.length) {
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'mp4,m4v',
|
||||
|
@ -575,33 +535,6 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
});
|
||||
|
||||
if (canPlayVp8) {
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'webm',
|
||||
Type: 'Video',
|
||||
AudioCodec: webmAudioCodecs.join(','),
|
||||
VideoCodec: 'VP8'
|
||||
});
|
||||
}
|
||||
|
||||
if (canPlayVp9) {
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'webm',
|
||||
Type: 'Video',
|
||||
AudioCodec: webmAudioCodecs.join(','),
|
||||
VideoCodec: 'VP9'
|
||||
});
|
||||
}
|
||||
|
||||
if (canPlayAv1) {
|
||||
profile.DirectPlayProfiles.push({
|
||||
Container: 'webm',
|
||||
Type: 'Video',
|
||||
AudioCodec: webmAudioCodecs.join(','),
|
||||
VideoCodec: 'AV1'
|
||||
});
|
||||
}
|
||||
|
||||
profile.TranscodingProfiles = [];
|
||||
|
||||
var hlsBreakOnNonKeyFrames = browser.iOS || browser.osx || browser.edge || !canPlayNativeHls() ? true : false;
|
||||
|
@ -645,7 +578,7 @@ define(['browser'], function (browser) {
|
|||
});
|
||||
});
|
||||
|
||||
if (canPlayMkv && !browser.tizen && !browser.orsay && options.enableMkvProgressive !== false) {
|
||||
if (canPlayMkv && !browser.tizen && options.enableMkvProgressive !== false) {
|
||||
profile.TranscodingProfiles.push({
|
||||
Container: 'mkv',
|
||||
Type: 'Video',
|
||||
|
@ -710,7 +643,7 @@ define(['browser'], function (browser) {
|
|||
|
||||
profile.CodecProfiles = [];
|
||||
|
||||
var supportsSecondaryAudio = browser.tizen || browser.orsay || videoTestElement.audioTracks;
|
||||
var supportsSecondaryAudio = browser.tizen || videoTestElement.audioTracks;
|
||||
|
||||
var aacCodecProfileConditions = [];
|
||||
|
||||
|
@ -733,15 +666,6 @@ define(['browser'], function (browser) {
|
|||
});
|
||||
}
|
||||
|
||||
if (browser.chromecast) {
|
||||
aacCodecProfileConditions.push({
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioChannels',
|
||||
Value: '2',
|
||||
IsRequired: true
|
||||
});
|
||||
}
|
||||
|
||||
if (aacCodecProfileConditions.length) {
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'VideoAudio',
|
||||
|
@ -767,7 +691,7 @@ define(['browser'], function (browser) {
|
|||
var maxH264Level = 42;
|
||||
var h264Profiles = 'high|main|baseline|constrained baseline';
|
||||
|
||||
if (browser.tizen || browser.orsay || browser.web0s ||
|
||||
if (browser.tizen || browser.web0s ||
|
||||
videoTestElement.canPlayType('video/mp4; codecs="avc1.640833"').replace(/no/, '')) {
|
||||
maxH264Level = 51;
|
||||
}
|
||||
|
@ -777,7 +701,7 @@ define(['browser'], function (browser) {
|
|||
maxH264Level = 52;
|
||||
}
|
||||
|
||||
if (browser.tizen || browser.orsay ||
|
||||
if (browser.tizen ||
|
||||
videoTestElement.canPlayType('video/mp4; codecs="avc1.6e0033"').replace(/no/, '')) {
|
||||
|
||||
// These tests are passing in safari, but playback is failing
|
||||
|
@ -811,20 +735,13 @@ define(['browser'], function (browser) {
|
|||
]
|
||||
});
|
||||
|
||||
if (!browser.edgeUwp && !browser.tizen && !browser.orsay && !browser.web0s) {
|
||||
//profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
|
||||
// Condition: 'NotEquals',
|
||||
// Property: 'IsAVC',
|
||||
// Value: 'false',
|
||||
// IsRequired: false
|
||||
//});
|
||||
|
||||
//profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
|
||||
// Condition: 'NotEquals',
|
||||
// Property: 'IsInterlaced',
|
||||
// Value: 'true',
|
||||
// IsRequired: false
|
||||
//});
|
||||
if (!browser.edgeUwp && !browser.tizen && !browser.web0s) {
|
||||
profile.CodecProfiles[profile.CodecProfiles.length - 1].Conditions.push({
|
||||
Condition: 'NotEquals',
|
||||
Property: 'IsInterlaced',
|
||||
Value: 'true',
|
||||
IsRequired: false
|
||||
});
|
||||
}
|
||||
|
||||
if (maxVideoWidth) {
|
||||
|
@ -875,19 +792,6 @@ define(['browser'], function (browser) {
|
|||
});
|
||||
}
|
||||
|
||||
if (browser.chromecast) {
|
||||
profile.CodecProfiles.push({
|
||||
Type: 'Audio',
|
||||
Codec: 'flac',
|
||||
Conditions: [
|
||||
{
|
||||
Condition: 'LessThanEqual',
|
||||
Property: 'AudioSampleRate',
|
||||
Value: '96000'
|
||||
}]
|
||||
});
|
||||
}
|
||||
|
||||
// Subtitle profiles
|
||||
// External vtt or burn in
|
||||
profile.SubtitleProfiles = [];
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
define(['globalize'], function (globalize) {
|
||||
'use strict';
|
||||
import globalize from 'globalize';
|
||||
|
||||
function parseISO8601Date(s, toLocal) {
|
||||
/* eslint-disable indent */
|
||||
|
||||
export function parseISO8601Date(s, toLocal) {
|
||||
|
||||
// parenthese matches:
|
||||
// year month day hours minutes seconds
|
||||
// dotmilliseconds
|
||||
// tzstring plusminus hours minutes
|
||||
var re = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|([+-])(\d{2}):(\d{2}))?/;
|
||||
const re = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|([+-])(\d{2}):(\d{2}))?/;
|
||||
|
||||
var d = s.match(re);
|
||||
const d = s.match(re);
|
||||
|
||||
// "2010-12-07T11:00:00.000-09:00" parses to:
|
||||
// ["2010-12-07T11:00:00.000-09:00", "2010", "12", "07", "11",
|
||||
|
@ -24,8 +25,8 @@ define(['globalize'], function (globalize) {
|
|||
}
|
||||
|
||||
// parse strings, leading zeros into proper ints
|
||||
var a = [1, 2, 3, 4, 5, 6, 10, 11];
|
||||
for (var i in a) {
|
||||
const a = [1, 2, 3, 4, 5, 6, 10, 11];
|
||||
for (let i in a) {
|
||||
d[a[i]] = parseInt(d[a[i]], 10);
|
||||
}
|
||||
d[7] = parseFloat(d[7]);
|
||||
|
@ -33,7 +34,7 @@ define(['globalize'], function (globalize) {
|
|||
// Date.UTC(year, month[, date[, hrs[, min[, sec[, ms]]]]])
|
||||
// note that month is 0-11, not 1-12
|
||||
// see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC
|
||||
var ms = Date.UTC(d[1], d[2] - 1, d[3], d[4], d[5], d[6]);
|
||||
let ms = Date.UTC(d[1], d[2] - 1, d[3], d[4], d[5], d[6]);
|
||||
|
||||
// if there are milliseconds, add them
|
||||
if (d[7] > 0) {
|
||||
|
@ -42,7 +43,7 @@ define(['globalize'], function (globalize) {
|
|||
|
||||
// if there's a timezone, calculate it
|
||||
if (d[8] !== 'Z' && d[10]) {
|
||||
var offset = d[10] * 60 * 60 * 1000;
|
||||
let offset = d[10] * 60 * 60 * 1000;
|
||||
if (d[11]) {
|
||||
offset += d[11] * 60 * 1000;
|
||||
}
|
||||
|
@ -58,14 +59,14 @@ define(['globalize'], function (globalize) {
|
|||
return new Date(ms);
|
||||
}
|
||||
|
||||
function getDisplayRunningTime(ticks) {
|
||||
var ticksPerHour = 36000000000;
|
||||
var ticksPerMinute = 600000000;
|
||||
var ticksPerSecond = 10000000;
|
||||
export function getDisplayRunningTime(ticks) {
|
||||
const ticksPerHour = 36000000000;
|
||||
const ticksPerMinute = 600000000;
|
||||
const ticksPerSecond = 10000000;
|
||||
|
||||
var parts = [];
|
||||
const parts = [];
|
||||
|
||||
var hours = ticks / ticksPerHour;
|
||||
let hours = ticks / ticksPerHour;
|
||||
hours = Math.floor(hours);
|
||||
|
||||
if (hours) {
|
||||
|
@ -74,7 +75,7 @@ define(['globalize'], function (globalize) {
|
|||
|
||||
ticks -= (hours * ticksPerHour);
|
||||
|
||||
var minutes = ticks / ticksPerMinute;
|
||||
let minutes = ticks / ticksPerMinute;
|
||||
minutes = Math.floor(minutes);
|
||||
|
||||
ticks -= (minutes * ticksPerMinute);
|
||||
|
@ -84,7 +85,7 @@ define(['globalize'], function (globalize) {
|
|||
}
|
||||
parts.push(minutes);
|
||||
|
||||
var seconds = ticks / ticksPerSecond;
|
||||
let seconds = ticks / ticksPerSecond;
|
||||
seconds = Math.floor(seconds);
|
||||
|
||||
if (seconds < 10) {
|
||||
|
@ -95,7 +96,7 @@ define(['globalize'], function (globalize) {
|
|||
return parts.join(':');
|
||||
}
|
||||
|
||||
var toLocaleTimeStringSupportsLocales = function () {
|
||||
const toLocaleTimeStringSupportsLocales = function () {
|
||||
try {
|
||||
new Date().toLocaleTimeString('i');
|
||||
} catch (e) {
|
||||
|
@ -106,9 +107,9 @@ define(['globalize'], function (globalize) {
|
|||
|
||||
function getOptionList(options) {
|
||||
|
||||
var list = [];
|
||||
const list = [];
|
||||
|
||||
for (var i in options) {
|
||||
for (const i in options) {
|
||||
list.push({
|
||||
name: i,
|
||||
value: options[i]
|
||||
|
@ -118,7 +119,7 @@ define(['globalize'], function (globalize) {
|
|||
return list;
|
||||
}
|
||||
|
||||
function toLocaleString(date, options) {
|
||||
export function toLocaleString(date, options) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
|
@ -128,7 +129,7 @@ define(['globalize'], function (globalize) {
|
|||
|
||||
if (toLocaleTimeStringSupportsLocales) {
|
||||
|
||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
|
||||
if (currentLocale) {
|
||||
return date.toLocaleString(currentLocale, options);
|
||||
|
@ -138,7 +139,7 @@ define(['globalize'], function (globalize) {
|
|||
return date.toLocaleString();
|
||||
}
|
||||
|
||||
function toLocaleDateString(date, options) {
|
||||
export function toLocaleDateString(date, options) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
|
@ -148,7 +149,7 @@ define(['globalize'], function (globalize) {
|
|||
|
||||
if (toLocaleTimeStringSupportsLocales) {
|
||||
|
||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
|
||||
if (currentLocale) {
|
||||
return date.toLocaleDateString(currentLocale, options);
|
||||
|
@ -156,9 +157,9 @@ define(['globalize'], function (globalize) {
|
|||
}
|
||||
|
||||
// This is essentially a hard-coded polyfill
|
||||
var optionList = getOptionList(options);
|
||||
const optionList = getOptionList(options);
|
||||
if (optionList.length === 1 && optionList[0].name === 'weekday') {
|
||||
var weekday = [];
|
||||
const weekday = [];
|
||||
weekday[0] = 'Sun';
|
||||
weekday[1] = 'Mon';
|
||||
weekday[2] = 'Tue';
|
||||
|
@ -172,7 +173,7 @@ define(['globalize'], function (globalize) {
|
|||
return date.toLocaleDateString();
|
||||
}
|
||||
|
||||
function toLocaleTimeString(date, options) {
|
||||
export function toLocaleTimeString(date, options) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
|
@ -182,7 +183,7 @@ define(['globalize'], function (globalize) {
|
|||
|
||||
if (toLocaleTimeStringSupportsLocales) {
|
||||
|
||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||
|
||||
if (currentLocale) {
|
||||
return date.toLocaleTimeString(currentLocale, options);
|
||||
|
@ -192,7 +193,7 @@ define(['globalize'], function (globalize) {
|
|||
return date.toLocaleTimeString();
|
||||
}
|
||||
|
||||
function getDisplayTime(date) {
|
||||
export function getDisplayTime(date) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
|
@ -217,19 +218,19 @@ define(['globalize'], function (globalize) {
|
|||
});
|
||||
}
|
||||
|
||||
var time = toLocaleTimeString(date);
|
||||
let time = toLocaleTimeString(date);
|
||||
|
||||
var timeLower = time.toLowerCase();
|
||||
const timeLower = time.toLowerCase();
|
||||
|
||||
if (timeLower.indexOf('am') !== -1 || timeLower.indexOf('pm') !== -1) {
|
||||
|
||||
time = timeLower;
|
||||
var hour = date.getHours() % 12;
|
||||
var suffix = date.getHours() > 11 ? 'pm' : 'am';
|
||||
let hour = date.getHours() % 12;
|
||||
const suffix = date.getHours() > 11 ? 'pm' : 'am';
|
||||
if (!hour) {
|
||||
hour = 12;
|
||||
}
|
||||
var minutes = date.getMinutes();
|
||||
let minutes = date.getMinutes();
|
||||
|
||||
if (minutes < 10) {
|
||||
minutes = '0' + minutes;
|
||||
|
@ -239,7 +240,7 @@ define(['globalize'], function (globalize) {
|
|||
time = hour + minutes + suffix;
|
||||
} else {
|
||||
|
||||
var timeParts = time.split(':');
|
||||
const timeParts = time.split(':');
|
||||
|
||||
// Trim off seconds
|
||||
if (timeParts.length > 2) {
|
||||
|
@ -253,21 +254,21 @@ define(['globalize'], function (globalize) {
|
|||
return time;
|
||||
}
|
||||
|
||||
function isRelativeDay(date, offsetInDays) {
|
||||
export function isRelativeDay(date, offsetInDays) {
|
||||
|
||||
if (!date) {
|
||||
throw new Error('date cannot be null');
|
||||
}
|
||||
|
||||
var yesterday = new Date();
|
||||
var day = yesterday.getDate() + offsetInDays;
|
||||
const yesterday = new Date();
|
||||
const day = yesterday.getDate() + offsetInDays;
|
||||
|
||||
yesterday.setDate(day); // automatically adjusts month/year appropriately
|
||||
|
||||
return date.getFullYear() === yesterday.getFullYear() && date.getMonth() === yesterday.getMonth() && date.getDate() === day;
|
||||
}
|
||||
|
||||
return {
|
||||
export default {
|
||||
parseISO8601Date: parseISO8601Date,
|
||||
getDisplayRunningTime: getDisplayRunningTime,
|
||||
toLocaleDateString: toLocaleDateString,
|
||||
|
@ -279,4 +280,5 @@ define(['globalize'], function (globalize) {
|
|||
return toLocaleTimeStringSupportsLocales;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
|
|
@ -7,7 +7,7 @@ function alertText(options) {
|
|||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(options).then(resolve, resolve);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -211,7 +211,7 @@
|
|||
'MozAnimation': 'animationend',
|
||||
'WebkitAnimation': 'webkitAnimationEnd'
|
||||
};
|
||||
for (let t in animations) {
|
||||
for (const t in animations) {
|
||||
if (el.style[t] !== undefined) {
|
||||
_animationEvent = animations[t];
|
||||
return animations[t];
|
||||
|
@ -251,7 +251,7 @@
|
|||
'MozTransition': 'transitionend',
|
||||
'WebkitTransition': 'webkitTransitionEnd'
|
||||
};
|
||||
for (let t in transitions) {
|
||||
for (const t in transitions) {
|
||||
if (el.style[t] !== undefined) {
|
||||
_transitionEvent = transitions[t];
|
||||
return transitions[t];
|
||||
|
|
|
@ -1,5 +1,9 @@
|
|||
define(['datetime', 'jQuery', 'globalize', 'material-icons'], function (datetime, $, globalize) {
|
||||
'use strict';
|
||||
import datetime from 'datetime';
|
||||
import $ from 'jQuery';
|
||||
import globalize from 'globalize';
|
||||
import 'material-icons';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getNode(item, folderState, selected) {
|
||||
var htmlName = getNodeInnerHtml(item);
|
||||
|
@ -179,7 +183,7 @@ define(['datetime', 'jQuery', 'globalize', 'material-icons'], function (datetime
|
|||
}
|
||||
|
||||
function initializeTree(page, currentUser, openItems, selectedId) {
|
||||
require(['jstree'], function () {
|
||||
import('jstree').then(() => {
|
||||
initializeTreeInternal(page, currentUser, openItems, selectedId);
|
||||
});
|
||||
}
|
||||
|
@ -209,7 +213,7 @@ define(['datetime', 'jQuery', 'globalize', 'material-icons'], function (datetime
|
|||
function onNodeOpen(event, data) {
|
||||
var page = $(this).parents('.page')[0];
|
||||
var node = data.node;
|
||||
if (node.children && node.children) {
|
||||
if (node.children) {
|
||||
loadNodesToLoad(page, node);
|
||||
}
|
||||
if (node.li_attr && node.id != '#' && !node.li_attr.loadedFromServer) {
|
||||
|
@ -221,7 +225,7 @@ define(['datetime', 'jQuery', 'globalize', 'material-icons'], function (datetime
|
|||
function onNodeLoad(event, data) {
|
||||
var page = $(this).parents('.page')[0];
|
||||
var node = data.node;
|
||||
if (node.children && node.children) {
|
||||
if (node.children) {
|
||||
loadNodesToLoad(page, node);
|
||||
}
|
||||
if (node.li_attr && node.id != '#' && !node.li_attr.loadedFromServer) {
|
||||
|
@ -299,7 +303,7 @@ define(['datetime', 'jQuery', 'globalize', 'material-icons'], function (datetime
|
|||
$(document).on('itemsaved', '.metadataEditorPage', function (e, item) {
|
||||
updateEditorNode(this, item);
|
||||
}).on('pagebeforeshow', '.metadataEditorPage', function () {
|
||||
require(['css!assets/css/metadataeditor.css']);
|
||||
import('css!assets/css/metadataeditor.css');
|
||||
}).on('pagebeforeshow', '.metadataEditorPage', function () {
|
||||
var page = this;
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
|
@ -331,4 +335,5 @@ define(['datetime', 'jQuery', 'globalize', 'material-icons'], function (datetime
|
|||
getCurrentItemId: getCurrentItemId,
|
||||
setCurrentItemId: setCurrentItemId
|
||||
};
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
|
|
@ -1,21 +1,24 @@
|
|||
define(['userSettings', 'events'], function (userSettings, events) {
|
||||
'use strict';
|
||||
var fallbackCulture = 'en-us';
|
||||
import * as userSettings from 'userSettings';
|
||||
import events from 'events';
|
||||
|
||||
var allTranslations = {};
|
||||
var currentCulture;
|
||||
var currentDateTimeCulture;
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getCurrentLocale() {
|
||||
const fallbackCulture = 'en-us';
|
||||
|
||||
const allTranslations = {};
|
||||
let currentCulture;
|
||||
let currentDateTimeCulture;
|
||||
|
||||
export function getCurrentLocale() {
|
||||
return currentCulture;
|
||||
}
|
||||
|
||||
function getCurrentDateTimeLocale() {
|
||||
export function getCurrentDateTimeLocale() {
|
||||
return currentDateTimeCulture;
|
||||
}
|
||||
|
||||
function getDefaultLanguage() {
|
||||
var culture = document.documentElement.getAttribute('data-culture');
|
||||
const culture = document.documentElement.getAttribute('data-culture');
|
||||
if (culture) {
|
||||
return culture;
|
||||
}
|
||||
|
@ -33,8 +36,8 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
return fallbackCulture;
|
||||
}
|
||||
|
||||
function updateCurrentCulture() {
|
||||
var culture;
|
||||
export function updateCurrentCulture() {
|
||||
let culture;
|
||||
try {
|
||||
culture = userSettings.language();
|
||||
} catch (err) {
|
||||
|
@ -44,7 +47,7 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
|
||||
currentCulture = normalizeLocaleName(culture);
|
||||
|
||||
var dateTimeCulture;
|
||||
let dateTimeCulture;
|
||||
try {
|
||||
dateTimeCulture = userSettings.dateTimeLocale();
|
||||
} catch (err) {
|
||||
|
@ -60,11 +63,11 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
}
|
||||
|
||||
function ensureTranslations(culture) {
|
||||
for (var i in allTranslations) {
|
||||
for (let i in allTranslations) {
|
||||
ensureTranslation(allTranslations[i], culture);
|
||||
}
|
||||
if (culture !== fallbackCulture) {
|
||||
for (var i in allTranslations) {
|
||||
for (let i in allTranslations) {
|
||||
ensureTranslation(allTranslations[i], fallbackCulture);
|
||||
}
|
||||
}
|
||||
|
@ -85,14 +88,14 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
culture = culture.replace('_', '-');
|
||||
|
||||
// convert de-DE to de
|
||||
var parts = culture.split('-');
|
||||
const parts = culture.split('-');
|
||||
if (parts.length === 2) {
|
||||
if (parts[0].toLowerCase() === parts[1].toLowerCase()) {
|
||||
culture = parts[0].toLowerCase();
|
||||
}
|
||||
}
|
||||
|
||||
var lower = culture.toLowerCase();
|
||||
const lower = culture.toLowerCase();
|
||||
if (lower === 'ca-es') {
|
||||
return 'ca';
|
||||
}
|
||||
|
@ -110,7 +113,7 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
module = defaultModule();
|
||||
}
|
||||
|
||||
var translations = allTranslations[module];
|
||||
const translations = allTranslations[module];
|
||||
if (!translations) {
|
||||
return {};
|
||||
}
|
||||
|
@ -118,17 +121,17 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
return translations.dictionaries[locale];
|
||||
}
|
||||
|
||||
function register(options) {
|
||||
export function register(options) {
|
||||
allTranslations[options.name] = {
|
||||
translations: options.strings || options.translations,
|
||||
dictionaries: {}
|
||||
};
|
||||
}
|
||||
|
||||
function loadStrings(options) {
|
||||
var locale = getCurrentLocale();
|
||||
var promises = [];
|
||||
var optionsName;
|
||||
export function loadStrings(options) {
|
||||
const locale = getCurrentLocale();
|
||||
const promises = [];
|
||||
let optionsName;
|
||||
if (typeof options === 'string') {
|
||||
optionsName = options;
|
||||
} else {
|
||||
|
@ -140,10 +143,10 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
var cacheParam = new Date().getTime();
|
||||
const cacheParam = new Date().getTime();
|
||||
function loadTranslation(translations, lang) {
|
||||
lang = normalizeLocaleName(lang);
|
||||
var filtered = translations.filter(function (t) {
|
||||
let filtered = translations.filter(function (t) {
|
||||
return normalizeLocaleName(t.lang) === lang;
|
||||
});
|
||||
|
||||
|
@ -159,12 +162,12 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
return;
|
||||
}
|
||||
|
||||
var url = filtered[0].path;
|
||||
let url = filtered[0].path;
|
||||
|
||||
url += url.indexOf('?') === -1 ? '?' : '&';
|
||||
url += 'v=' + cacheParam;
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', url, true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
|
@ -183,8 +186,8 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
}
|
||||
|
||||
function translateKey(key) {
|
||||
var parts = key.split('#');
|
||||
var module;
|
||||
const parts = key.split('#');
|
||||
let module;
|
||||
|
||||
if (parts.length > 1) {
|
||||
module = parts[0];
|
||||
|
@ -195,7 +198,7 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
}
|
||||
|
||||
function translateKeyFromModule(key, module) {
|
||||
var dictionary = getDictionary(module, getCurrentLocale());
|
||||
let dictionary = getDictionary(module, getCurrentLocale());
|
||||
if (!dictionary || !dictionary[key]) {
|
||||
dictionary = getDictionary(module, fallbackCulture);
|
||||
}
|
||||
|
@ -209,15 +212,15 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
return str.split(find).join(replace);
|
||||
}
|
||||
|
||||
function translate(key) {
|
||||
var val = translateKey(key);
|
||||
for (var i = 1; i < arguments.length; i++) {
|
||||
export function translate(key) {
|
||||
let val = translateKey(key);
|
||||
for (let i = 1; i < arguments.length; i++) {
|
||||
val = replaceAll(val, '{' + (i - 1) + '}', arguments[i]);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
function translateHtml(html, module) {
|
||||
export function translateHtml(html, module) {
|
||||
if (!module) {
|
||||
module = defaultModule();
|
||||
}
|
||||
|
@ -225,26 +228,26 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
throw new Error('module cannot be null or empty');
|
||||
}
|
||||
|
||||
var startIndex = html.indexOf('${');
|
||||
let startIndex = html.indexOf('${');
|
||||
if (startIndex === -1) {
|
||||
return html;
|
||||
}
|
||||
|
||||
startIndex += 2;
|
||||
var endIndex = html.indexOf('}', startIndex);
|
||||
const endIndex = html.indexOf('}', startIndex);
|
||||
if (endIndex === -1) {
|
||||
return html;
|
||||
}
|
||||
|
||||
var key = html.substring(startIndex, endIndex);
|
||||
var val = translateKeyFromModule(key, module);
|
||||
const key = html.substring(startIndex, endIndex);
|
||||
const val = translateKeyFromModule(key, module);
|
||||
|
||||
html = html.replace('${' + key + '}', val);
|
||||
return translateHtml(html, module);
|
||||
}
|
||||
|
||||
var _defaultModule;
|
||||
function defaultModule(val) {
|
||||
let _defaultModule;
|
||||
export function defaultModule(val) {
|
||||
if (val) {
|
||||
_defaultModule = val;
|
||||
}
|
||||
|
@ -259,16 +262,15 @@ define(['userSettings', 'events'], function (userSettings, events) {
|
|||
}
|
||||
});
|
||||
|
||||
return {
|
||||
getString: translate,
|
||||
translate: translate,
|
||||
translateDocument: translateHtml,
|
||||
translateHtml: translateHtml,
|
||||
loadStrings: loadStrings,
|
||||
defaultModule: defaultModule,
|
||||
getCurrentLocale: getCurrentLocale,
|
||||
getCurrentDateTimeLocale: getCurrentDateTimeLocale,
|
||||
register: register,
|
||||
updateCurrentCulture: updateCurrentCulture
|
||||
};
|
||||
});
|
||||
export default {
|
||||
translate,
|
||||
translateHtml,
|
||||
loadStrings,
|
||||
defaultModule,
|
||||
getCurrentLocale,
|
||||
getCurrentDateTimeLocale,
|
||||
register,
|
||||
updateCurrentCulture
|
||||
};
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
|
|
@ -66,9 +66,12 @@ import appHost from 'apphost';
|
|||
if (!sourceElement) {
|
||||
sourceElement = document.activeElement || window;
|
||||
|
||||
const dlg = document.querySelector('.dialogContainer .dialog.opened');
|
||||
const dialogs = document.querySelectorAll('.dialogContainer .dialog.opened');
|
||||
|
||||
if (dlg && (!sourceElement || !dlg.contains(sourceElement))) {
|
||||
// Suppose the top open dialog is active
|
||||
const dlg = dialogs.length ? dialogs[dialogs.length - 1] : null;
|
||||
|
||||
if (dlg && !dlg.contains(sourceElement)) {
|
||||
sourceElement = dlg;
|
||||
}
|
||||
}
|
||||
|
@ -201,6 +204,9 @@ import appHost from 'apphost';
|
|||
'rewind': () => {
|
||||
playbackManager.rewind();
|
||||
},
|
||||
'seek': () => {
|
||||
playbackManager.seekMs(options);
|
||||
},
|
||||
'togglefullscreen': () => {
|
||||
playbackManager.toggleFullscreen();
|
||||
},
|
||||
|
@ -235,9 +241,6 @@ import appHost from 'apphost';
|
|||
}
|
||||
}
|
||||
|
||||
// Alias for backward compatibility
|
||||
export const trigger = handleCommand;
|
||||
|
||||
dom.addEventListener(document, 'click', notify, {
|
||||
passive: true
|
||||
});
|
||||
|
@ -245,8 +248,7 @@ import appHost from 'apphost';
|
|||
/* eslint-enable indent */
|
||||
|
||||
export default {
|
||||
trigger: handleCommand,
|
||||
handle: handleCommand,
|
||||
handleCommand: handleCommand,
|
||||
notify: notify,
|
||||
notifyMouseMove: notifyMouseMove,
|
||||
idleTime: idleTime,
|
||||
|
|
|
@ -71,12 +71,12 @@ define(['connectionManager', 'listView', 'cardBuilder', 'imageLoader', 'libraryB
|
|||
|
||||
html += '<div class="' + sectionClass + '" data-type="' + section.type + '">';
|
||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards">';
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">';
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards">';
|
||||
html += section.name;
|
||||
html += '</h2>';
|
||||
html += '<a is="emby-linkbutton" href="#" class="clearLink hide" style="margin-left:1em;vertical-align:middle;"><button is="emby-button" type="button" class="raised more raised-mini noIcon">' + globalize.translate('ButtonMore') + '</button></a>';
|
||||
html += '</div>';
|
||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right">';
|
||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-right">';
|
||||
html += '</div>';
|
||||
return html += '</div>';
|
||||
}).join('');
|
||||
|
|
|
@ -78,7 +78,7 @@ export function isNavigationKey(key) {
|
|||
}
|
||||
|
||||
export function enable() {
|
||||
document.addEventListener('keydown', function (e) {
|
||||
window.addEventListener('keydown', function (e) {
|
||||
const key = getKeyName(e);
|
||||
|
||||
// Ignore navigation keys for non-TV
|
||||
|
@ -90,53 +90,53 @@ export function enable() {
|
|||
|
||||
switch (key) {
|
||||
case 'ArrowLeft':
|
||||
inputManager.handle('left');
|
||||
inputManager.handleCommand('left');
|
||||
break;
|
||||
case 'ArrowUp':
|
||||
inputManager.handle('up');
|
||||
inputManager.handleCommand('up');
|
||||
break;
|
||||
case 'ArrowRight':
|
||||
inputManager.handle('right');
|
||||
inputManager.handleCommand('right');
|
||||
break;
|
||||
case 'ArrowDown':
|
||||
inputManager.handle('down');
|
||||
inputManager.handleCommand('down');
|
||||
break;
|
||||
|
||||
case 'Back':
|
||||
inputManager.handle('back');
|
||||
inputManager.handleCommand('back');
|
||||
break;
|
||||
|
||||
case 'Escape':
|
||||
if (layoutManager.tv) {
|
||||
inputManager.handle('back');
|
||||
inputManager.handleCommand('back');
|
||||
} else {
|
||||
capture = false;
|
||||
}
|
||||
break;
|
||||
|
||||
case 'MediaPlay':
|
||||
inputManager.handle('play');
|
||||
inputManager.handleCommand('play');
|
||||
break;
|
||||
case 'Pause':
|
||||
inputManager.handle('pause');
|
||||
inputManager.handleCommand('pause');
|
||||
break;
|
||||
case 'MediaPlayPause':
|
||||
inputManager.handle('playpause');
|
||||
inputManager.handleCommand('playpause');
|
||||
break;
|
||||
case 'MediaRewind':
|
||||
inputManager.handle('rewind');
|
||||
inputManager.handleCommand('rewind');
|
||||
break;
|
||||
case 'MediaFastForward':
|
||||
inputManager.handle('fastforward');
|
||||
inputManager.handleCommand('fastforward');
|
||||
break;
|
||||
case 'MediaStop':
|
||||
inputManager.handle('stop');
|
||||
inputManager.handleCommand('stop');
|
||||
break;
|
||||
case 'MediaTrackPrevious':
|
||||
inputManager.handle('previoustrack');
|
||||
inputManager.handleCommand('previoustrack');
|
||||
break;
|
||||
case 'MediaTrackNext':
|
||||
inputManager.handle('nexttrack');
|
||||
inputManager.handleCommand('nexttrack');
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -155,7 +155,7 @@ export function enable() {
|
|||
function attachGamepadScript(e) {
|
||||
console.log('Gamepad connected! Attaching gamepadtokey.js script');
|
||||
window.removeEventListener('gamepadconnected', attachGamepadScript);
|
||||
require(['scripts/gamepadtokey']);
|
||||
import('scripts/gamepadtokey');
|
||||
}
|
||||
|
||||
// No need to check for gamepads manually at load time, the eventhandler will be fired for that
|
||||
|
|
|
@ -12,10 +12,10 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
html += '</div>';
|
||||
html += '<div class="headerRight">';
|
||||
html += '<span class="headerSelectedPlayer"></span>';
|
||||
html += '<button is="paper-icon-button-light" class="headerSyncButton syncButton headerButton headerButtonRight hide"><span class="material-icons sync_disabled"></span></button>';
|
||||
html += '<button is="paper-icon-button-light" class="headerAudioPlayerButton audioPlayerButton headerButton headerButtonRight hide"><span class="material-icons music_note"></span></button>';
|
||||
html += '<button is="paper-icon-button-light" class="headerCastButton castButton headerButton headerButtonRight hide"><span class="material-icons cast"></span></button>';
|
||||
html += '<button type="button" is="paper-icon-button-light" class="headerButton headerButtonRight headerSearchButton hide"><span class="material-icons search"></span></button>';
|
||||
html += `<button is="paper-icon-button-light" class="headerSyncButton syncButton headerButton headerButtonRight hide" title="${globalize.translate('ButtonSyncPlay')}"><span class="material-icons sync_disabled"></span></button>`;
|
||||
html += `<button is="paper-icon-button-light" class="headerAudioPlayerButton audioPlayerButton headerButton headerButtonRight hide" title="${globalize.translate('ButtonPlayer')}"><span class="material-icons music_note"></span></button>`;
|
||||
html += `<button is="paper-icon-button-light" class="headerCastButton castButton headerButton headerButtonRight hide" title="${globalize.translate('ButtonCast')}"><span class="material-icons cast"></span></button>`;
|
||||
html += `<button type="button" is="paper-icon-button-light" class="headerButton headerButtonRight headerSearchButton hide" title="${globalize.translate('ButtonSearch')}"><span class="material-icons search"></span></button>`;
|
||||
html += '<button is="paper-icon-button-light" class="headerButton headerButtonRight headerUserButton hide"><span class="material-icons person"></span></button>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
@ -64,7 +64,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
updateHeaderUserButton(url);
|
||||
hasImage = true;
|
||||
}
|
||||
|
||||
headerUserButton.title = user.name;
|
||||
headerUserButton.classList.remove('hide');
|
||||
} else {
|
||||
headerUserButton.classList.add('hide');
|
||||
|
@ -89,7 +89,8 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
|
||||
var policy = user.Policy ? user.Policy : user.localUser.Policy;
|
||||
|
||||
if (headerSyncButton && policy && policy.SyncPlayAccess !== 'None') {
|
||||
var apiClient = getCurrentApiClient();
|
||||
if (headerSyncButton && policy && policy.SyncPlayAccess !== 'None' && apiClient.isMinServerVersion('10.6.0')) {
|
||||
headerSyncButton.classList.remove('hide');
|
||||
}
|
||||
} else {
|
||||
|
@ -116,7 +117,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
}
|
||||
|
||||
function showSearch() {
|
||||
inputManager.trigger('search');
|
||||
inputManager.handleCommand('search');
|
||||
}
|
||||
|
||||
function onHeaderUserButtonClick(e) {
|
||||
|
@ -608,27 +609,25 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
if (libraryMenuOptions) {
|
||||
getUserViews(apiClient, userId).then(function (result) {
|
||||
var items = result;
|
||||
var html = '';
|
||||
html += '<h3 class="sidebarHeader">';
|
||||
html += globalize.translate('HeaderMedia');
|
||||
html += '</h3>';
|
||||
var html = `<h3 class="sidebarHeader">${globalize.translate('HeaderMedia')}</h3>`;
|
||||
html += items.map(function (i) {
|
||||
var icon = i.icon || imageHelper.getLibraryIcon(i.CollectionType);
|
||||
var itemId = i.Id;
|
||||
|
||||
if (i.onclick) {
|
||||
i.onclick;
|
||||
}
|
||||
const linkHtml = `<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 '<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;
|
||||
var sidebarLinks = elem.querySelectorAll('.navMenuOption');
|
||||
|
||||
for (var i = 0, length = sidebarLinks.length; i < length; i++) {
|
||||
sidebarLinks[i].removeEventListener('click', onSidebarLinkClick);
|
||||
sidebarLinks[i].addEventListener('click', onSidebarLinkClick);
|
||||
for (const sidebarLink of sidebarLinks) {
|
||||
sidebarLink.removeEventListener('click', onSidebarLinkClick);
|
||||
sidebarLink.addEventListener('click', onSidebarLinkClick);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
@ -842,6 +841,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
var headerAudioPlayerButton;
|
||||
var headerSyncButton;
|
||||
var enableLibraryNavDrawer = layoutManager.desktop;
|
||||
var enableLibraryNavDrawerHome = !layoutManager.tv;
|
||||
var skinHeader = document.querySelector('.skinHeader');
|
||||
var requiresUserRefresh = true;
|
||||
var lastOpenTime = new Date().getTime();
|
||||
|
@ -928,7 +928,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
refreshDashboardInfoInDrawer(apiClient);
|
||||
} else {
|
||||
if (mainDrawerButton) {
|
||||
if (enableLibraryNavDrawer || isHomePage) {
|
||||
if (enableLibraryNavDrawer || (isHomePage && enableLibraryNavDrawerHome)) {
|
||||
mainDrawerButton.classList.remove('hide');
|
||||
} else {
|
||||
mainDrawerButton.classList.add('hide');
|
||||
|
@ -942,6 +942,7 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
|
||||
updateMenuForPageType(isDashboardPage, isLibraryPage);
|
||||
|
||||
// TODO: Seems to do nothing? Check if needed (also in other views).
|
||||
if (!e.detail.isRestored) {
|
||||
window.scrollTo(0, 0);
|
||||
}
|
||||
|
@ -973,8 +974,10 @@ define(['dom', 'layoutManager', 'inputManager', 'connectionManager', 'events', '
|
|||
updateUserInHeader();
|
||||
});
|
||||
events.on(playbackManager, 'playerchange', updateCastIcon);
|
||||
|
||||
events.on(syncPlayManager, 'enabled', onSyncPlayEnabled);
|
||||
events.on(syncPlayManager, 'syncing', onSyncPlaySyncing);
|
||||
|
||||
loadNavDrawer();
|
||||
return LibraryMenu;
|
||||
});
|
||||
|
|
|
@ -136,6 +136,7 @@ define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'd
|
|||
|
||||
stopMouseInterval();
|
||||
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
dom.removeEventListener(document, (window.PointerEvent ? 'pointermove' : 'mousemove'), onPointerMove, {
|
||||
passive: true
|
||||
});
|
||||
|
@ -148,6 +149,7 @@ define(['inputManager', 'focusManager', 'browser', 'layoutManager', 'events', 'd
|
|||
});
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
dom.removeEventListener(document, (window.PointerEvent ? 'pointerenter' : 'mouseenter'), onPointerEnter, {
|
||||
capture: true,
|
||||
passive: true
|
||||
|
|
|
@ -1,194 +1,202 @@
|
|||
define(['loading', 'listView', 'cardBuilder', 'libraryMenu', 'libraryBrowser', 'apphost', 'imageLoader', 'userSettings', 'emby-itemscontainer'], function (loading, listView, cardBuilder, libraryMenu, libraryBrowser, appHost, imageLoader, userSettings) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import listView from 'listView';
|
||||
import cardBuilder from 'cardBuilder';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import libraryBrowser from 'libraryBrowser';
|
||||
import appHost from 'apphost';
|
||||
import imageLoader from 'imageLoader';
|
||||
import userSettings from 'userSettings';
|
||||
import 'emby-itemscontainer';
|
||||
|
||||
return function (view, params) {
|
||||
function getPageData(context) {
|
||||
var key = getSavedQueryKey(context);
|
||||
var pageData = data[key];
|
||||
export default function (view, params) {
|
||||
function getPageData(context) {
|
||||
const key = getSavedQueryKey(context);
|
||||
let pageData = data[key];
|
||||
|
||||
if (!pageData) {
|
||||
pageData = data[key] = {
|
||||
query: {
|
||||
SortBy: 'SortName',
|
||||
SortOrder: 'Ascending',
|
||||
IncludeItemTypes: 'Playlist',
|
||||
Recursive: true,
|
||||
Fields: 'PrimaryImageAspectRatio,SortName,CumulativeRunTimeTicks,CanDelete',
|
||||
StartIndex: 0
|
||||
},
|
||||
view: libraryBrowser.getSavedView(key) || 'Poster'
|
||||
};
|
||||
if (!pageData) {
|
||||
pageData = data[key] = {
|
||||
query: {
|
||||
SortBy: 'SortName',
|
||||
SortOrder: 'Ascending',
|
||||
IncludeItemTypes: 'Playlist',
|
||||
Recursive: true,
|
||||
Fields: 'PrimaryImageAspectRatio,SortName,CumulativeRunTimeTicks,CanDelete',
|
||||
StartIndex: 0
|
||||
},
|
||||
view: libraryBrowser.getSavedView(key) || 'Poster'
|
||||
};
|
||||
|
||||
if (userSettings.libraryPageSize() > 0) {
|
||||
pageData.query['Limit'] = userSettings.libraryPageSize();
|
||||
}
|
||||
|
||||
pageData.query.ParentId = libraryMenu.getTopParentId();
|
||||
libraryBrowser.loadSavedQueryValues(key, pageData.query);
|
||||
if (userSettings.libraryPageSize() > 0) {
|
||||
pageData.query['Limit'] = userSettings.libraryPageSize();
|
||||
}
|
||||
|
||||
return pageData;
|
||||
pageData.query.ParentId = libraryMenu.getTopParentId();
|
||||
libraryBrowser.loadSavedQueryValues(key, pageData.query);
|
||||
}
|
||||
|
||||
function getQuery(context) {
|
||||
return getPageData(context).query;
|
||||
return pageData;
|
||||
}
|
||||
|
||||
function getQuery(context) {
|
||||
return getPageData(context).query;
|
||||
}
|
||||
|
||||
function getSavedQueryKey(context) {
|
||||
if (!context.savedQueryKey) {
|
||||
context.savedQueryKey = libraryBrowser.getSavedQueryKey();
|
||||
}
|
||||
|
||||
function getSavedQueryKey(context) {
|
||||
if (!context.savedQueryKey) {
|
||||
context.savedQueryKey = libraryBrowser.getSavedQueryKey();
|
||||
}
|
||||
return context.savedQueryKey;
|
||||
}
|
||||
|
||||
return context.savedQueryKey;
|
||||
function showLoadingMessage() {
|
||||
loading.show();
|
||||
}
|
||||
|
||||
function hideLoadingMessage() {
|
||||
loading.hide();
|
||||
}
|
||||
|
||||
function onViewStyleChange() {
|
||||
const viewStyle = getPageData(view).view;
|
||||
const itemsContainer = view.querySelector('.itemsContainer');
|
||||
|
||||
if ('List' == viewStyle) {
|
||||
itemsContainer.classList.add('vertical-list');
|
||||
itemsContainer.classList.remove('vertical-wrap');
|
||||
} else {
|
||||
itemsContainer.classList.remove('vertical-list');
|
||||
itemsContainer.classList.add('vertical-wrap');
|
||||
}
|
||||
|
||||
function showLoadingMessage() {
|
||||
loading.show();
|
||||
}
|
||||
itemsContainer.innerHTML = '';
|
||||
}
|
||||
|
||||
function hideLoadingMessage() {
|
||||
loading.hide();
|
||||
}
|
||||
function reloadItems() {
|
||||
showLoadingMessage();
|
||||
const query = getQuery(view);
|
||||
const promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
||||
// TODO: promise2 is unused, check if necessary.
|
||||
const promise2 = Dashboard.getCurrentUser();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
const result = responses[0];
|
||||
// TODO: Is the scroll necessary?
|
||||
window.scrollTo(0, 0);
|
||||
let html = '';
|
||||
const viewStyle = getPageData(view).view;
|
||||
view.querySelector('.listTopPaging').innerHTML = libraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: false,
|
||||
showLimit: false,
|
||||
updatePageSizeSetting: false,
|
||||
addLayoutButton: true,
|
||||
layouts: 'List,Poster,PosterCard,Thumb,ThumbCard',
|
||||
currentLayout: viewStyle
|
||||
});
|
||||
|
||||
function onViewStyleChange() {
|
||||
var viewStyle = getPageData(view).view;
|
||||
var itemsContainer = view.querySelector('.itemsContainer');
|
||||
|
||||
if ('List' == viewStyle) {
|
||||
itemsContainer.classList.add('vertical-list');
|
||||
itemsContainer.classList.remove('vertical-wrap');
|
||||
} else {
|
||||
itemsContainer.classList.remove('vertical-list');
|
||||
itemsContainer.classList.add('vertical-wrap');
|
||||
}
|
||||
|
||||
itemsContainer.innerHTML = '';
|
||||
}
|
||||
|
||||
function reloadItems() {
|
||||
showLoadingMessage();
|
||||
var query = getQuery(view);
|
||||
var promise1 = ApiClient.getItems(Dashboard.getCurrentUserId(), query);
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
var result = responses[0];
|
||||
responses[1];
|
||||
window.scrollTo(0, 0);
|
||||
var html = '';
|
||||
var viewStyle = getPageData(view).view;
|
||||
view.querySelector('.listTopPaging').innerHTML = libraryBrowser.getQueryPagingHtml({
|
||||
startIndex: query.StartIndex,
|
||||
limit: query.Limit,
|
||||
totalRecordCount: result.TotalRecordCount,
|
||||
viewButton: false,
|
||||
showLimit: false,
|
||||
updatePageSizeSetting: false,
|
||||
addLayoutButton: true,
|
||||
layouts: 'List,Poster,PosterCard,Thumb,ThumbCard',
|
||||
currentLayout: viewStyle
|
||||
});
|
||||
|
||||
if (result.TotalRecordCount) {
|
||||
if (viewStyle == 'List') {
|
||||
html = listView.getListViewHtml({
|
||||
items: result.Items,
|
||||
sortBy: query.SortBy
|
||||
});
|
||||
} else if (viewStyle == 'PosterCard') {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: 'square',
|
||||
coverImage: true,
|
||||
showTitle: true,
|
||||
cardLayout: true
|
||||
});
|
||||
} else if (viewStyle == 'Thumb') {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: 'backdrop',
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
preferThumb: true,
|
||||
overlayPlayButton: true
|
||||
});
|
||||
} else if (viewStyle == 'ThumbCard') {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: 'backdrop',
|
||||
showTitle: true,
|
||||
preferThumb: true,
|
||||
cardLayout: true
|
||||
});
|
||||
} else {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: 'square',
|
||||
showTitle: true,
|
||||
coverImage: true,
|
||||
centerText: true,
|
||||
overlayPlayButton: true
|
||||
});
|
||||
}
|
||||
view.querySelector('.noItemsMessage').classList.add('hide');
|
||||
if (result.TotalRecordCount) {
|
||||
if (viewStyle == 'List') {
|
||||
html = listView.getListViewHtml({
|
||||
items: result.Items,
|
||||
sortBy: query.SortBy
|
||||
});
|
||||
} else if (viewStyle == 'PosterCard') {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: 'square',
|
||||
coverImage: true,
|
||||
showTitle: true,
|
||||
cardLayout: true
|
||||
});
|
||||
} else if (viewStyle == 'Thumb') {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: 'backdrop',
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
preferThumb: true,
|
||||
overlayPlayButton: true
|
||||
});
|
||||
} else if (viewStyle == 'ThumbCard') {
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: 'backdrop',
|
||||
showTitle: true,
|
||||
preferThumb: true,
|
||||
cardLayout: true
|
||||
});
|
||||
} else {
|
||||
view.querySelector('.noItemsMessage').classList.remove('hide');
|
||||
}
|
||||
|
||||
var elem = view.querySelector('.itemsContainer');
|
||||
elem.innerHTML = html;
|
||||
imageLoader.lazyChildren(elem);
|
||||
var btnNextPage = view.querySelector('.btnNextPage');
|
||||
|
||||
if (btnNextPage) {
|
||||
btnNextPage.addEventListener('click', function () {
|
||||
if (userSettings.libraryPageSize() > 0) {
|
||||
query.StartIndex += query.Limit;
|
||||
}
|
||||
reloadItems();
|
||||
html = cardBuilder.getCardsHtml({
|
||||
items: result.Items,
|
||||
shape: 'square',
|
||||
showTitle: true,
|
||||
coverImage: true,
|
||||
centerText: true,
|
||||
overlayPlayButton: true
|
||||
});
|
||||
}
|
||||
view.querySelector('.noItemsMessage').classList.add('hide');
|
||||
} else {
|
||||
view.querySelector('.noItemsMessage').classList.remove('hide');
|
||||
}
|
||||
|
||||
var btnPreviousPage = view.querySelector('.btnPreviousPage');
|
||||
const elem = view.querySelector('.itemsContainer');
|
||||
elem.innerHTML = html;
|
||||
imageLoader.lazyChildren(elem);
|
||||
const btnNextPage = view.querySelector('.btnNextPage');
|
||||
|
||||
if (btnPreviousPage) {
|
||||
btnPreviousPage.addEventListener('click', function () {
|
||||
if (userSettings.libraryPageSize() > 0) {
|
||||
query.StartIndex = Math.max(0, query.StartIndex - query.Limit);
|
||||
}
|
||||
reloadItems();
|
||||
});
|
||||
}
|
||||
|
||||
var btnChangeLayout = view.querySelector('.btnChangeLayout');
|
||||
|
||||
if (btnChangeLayout) {
|
||||
btnChangeLayout.addEventListener('layoutchange', function (e) {
|
||||
var layout = e.detail.viewStyle;
|
||||
getPageData(view).view = layout;
|
||||
libraryBrowser.saveViewSetting(getSavedQueryKey(view), layout);
|
||||
onViewStyleChange();
|
||||
reloadItems();
|
||||
});
|
||||
}
|
||||
|
||||
libraryBrowser.saveQueryValues(getSavedQueryKey(view), query);
|
||||
hideLoadingMessage();
|
||||
});
|
||||
}
|
||||
|
||||
var data = {};
|
||||
view.addEventListener('viewbeforeshow', function () {
|
||||
reloadItems();
|
||||
});
|
||||
view.querySelector('.btnNewPlaylist').addEventListener('click', function () {
|
||||
require(['playlistEditor'], function (playlistEditor) {
|
||||
var serverId = ApiClient.serverInfo().Id;
|
||||
new playlistEditor().show({
|
||||
items: [],
|
||||
serverId: serverId
|
||||
if (btnNextPage) {
|
||||
btnNextPage.addEventListener('click', function () {
|
||||
if (userSettings.libraryPageSize() > 0) {
|
||||
query.StartIndex += query.Limit;
|
||||
}
|
||||
reloadItems();
|
||||
});
|
||||
}
|
||||
|
||||
const btnPreviousPage = view.querySelector('.btnPreviousPage');
|
||||
|
||||
if (btnPreviousPage) {
|
||||
btnPreviousPage.addEventListener('click', function () {
|
||||
if (userSettings.libraryPageSize() > 0) {
|
||||
query.StartIndex = Math.max(0, query.StartIndex - query.Limit);
|
||||
}
|
||||
reloadItems();
|
||||
});
|
||||
}
|
||||
|
||||
const btnChangeLayout = view.querySelector('.btnChangeLayout');
|
||||
|
||||
if (btnChangeLayout) {
|
||||
btnChangeLayout.addEventListener('layoutchange', function (e) {
|
||||
const layout = e.detail.viewStyle;
|
||||
getPageData(view).view = layout;
|
||||
libraryBrowser.saveViewSetting(getSavedQueryKey(view), layout);
|
||||
onViewStyleChange();
|
||||
reloadItems();
|
||||
});
|
||||
}
|
||||
|
||||
libraryBrowser.saveQueryValues(getSavedQueryKey(view), query);
|
||||
hideLoadingMessage();
|
||||
});
|
||||
}
|
||||
|
||||
const data = {};
|
||||
view.addEventListener('viewbeforeshow', function () {
|
||||
reloadItems();
|
||||
});
|
||||
view.querySelector('.btnNewPlaylist').addEventListener('click', function () {
|
||||
import('playlistEditor').then(({default: playlistEditor}) => {
|
||||
const serverId = ApiClient.serverInfo().Id;
|
||||
new playlistEditor({
|
||||
items: [],
|
||||
serverId: serverId
|
||||
});
|
||||
});
|
||||
onViewStyleChange();
|
||||
};
|
||||
});
|
||||
});
|
||||
onViewStyleChange();
|
||||
}
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ define([
|
|||
'detailtablecss'], function () {
|
||||
|
||||
function defineRoute(newRoute) {
|
||||
var path = newRoute.path;
|
||||
var path = newRoute.alias ? newRoute.alias : newRoute.path;
|
||||
console.debug('defining route: ' + path);
|
||||
newRoute.dictionary = 'core';
|
||||
Emby.Page.addRoute(path, newRoute);
|
||||
|
@ -24,59 +24,74 @@ define([
|
|||
console.debug('defining core routes');
|
||||
|
||||
defineRoute({
|
||||
path: '/addserver.html',
|
||||
alias: '/addserver.html',
|
||||
path: '/controllers/session/addServer/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'auth/addserver'
|
||||
controller: 'session/addServer/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/selectserver.html',
|
||||
alias: '/selectserver.html',
|
||||
path: '/controllers/session/selectServer/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'auth/selectserver',
|
||||
controller: 'session/selectServer/index',
|
||||
type: 'selectserver'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/login.html',
|
||||
alias: '/login.html',
|
||||
path: '/controllers/session/login/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'auth/login',
|
||||
controller: 'session/login/index',
|
||||
type: 'login'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/forgotpassword.html',
|
||||
alias: '/forgotpassword.html',
|
||||
path: '/controllers/session/forgotPassword/index.html',
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'auth/forgotpassword'
|
||||
controller: 'session/forgotPassword/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/forgotpasswordpin.html',
|
||||
alias: '/forgotpasswordpin.html',
|
||||
path: '/controllers/session/redeemPassword/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'auth/forgotpasswordpin'
|
||||
controller: 'session/redeemPassword/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/mypreferencesmenu.html',
|
||||
alias: '/mypreferencesmenu.html',
|
||||
path: '/controllers/user/menu/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/menu'
|
||||
controller: 'user/menu/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/myprofile.html',
|
||||
alias: '/myprofile.html',
|
||||
path: '/controllers/user/profile/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/profile'
|
||||
controller: 'user/profile/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/mypreferencesdisplay.html',
|
||||
alias: '/mypreferencesdisplay.html',
|
||||
path: '/controllers/user/display/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/display'
|
||||
controller: 'user/display/index'
|
||||
});
|
||||
defineRoute({
|
||||
alias: '/mypreferenceshome.html',
|
||||
path: '/controllers/user/home/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/home/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/myPreferencesQuickConnect.html',
|
||||
|
@ -84,24 +99,19 @@ define([
|
|||
transition: 'fade',
|
||||
controller: 'user/quickConnect'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/mypreferenceshome.html',
|
||||
alias: '/mypreferencesplayback.html',
|
||||
path: '/controllers/user/playback/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/home'
|
||||
controller: 'user/playback/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/mypreferencesplayback.html',
|
||||
alias: '/mypreferencessubtitles.html',
|
||||
path: '/controllers/user/subtitles/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/playback'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/mypreferencessubtitles.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/subtitles'
|
||||
controller: 'user/subtitles/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
|
@ -153,10 +163,11 @@ define([
|
|||
controller: 'dashboard/dlna/profiles'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/addplugin.html',
|
||||
alias: '/addplugin.html',
|
||||
path: '/controllers/dashboard/plugins/add/index.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/plugins/add'
|
||||
controller: 'dashboard/plugins/add/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/library.html',
|
||||
|
@ -205,14 +216,16 @@ define([
|
|||
controller: 'dashboard/metadatanfo'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/notificationsetting.html',
|
||||
alias: '/notificationsetting.html',
|
||||
path: '/controllers/dashboard/notifications/notification/index.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/notifications/notification'
|
||||
controller: 'dashboard/notifications/notification/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/notificationsettings.html',
|
||||
controller: 'dashboard/notifications/notifications',
|
||||
alias: '/notificationsettings.html',
|
||||
path: '/controllers/dashboard/notifications/notifications/index.html',
|
||||
controller: 'dashboard/notifications/notifications/index',
|
||||
autoFocus: false,
|
||||
roles: 'admin'
|
||||
});
|
||||
|
@ -223,10 +236,18 @@ define([
|
|||
controller: 'dashboard/playback'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/availableplugins.html',
|
||||
alias: '/availableplugins.html',
|
||||
path: '/controllers/dashboard/plugins/available/index.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/plugins/available'
|
||||
controller: 'dashboard/plugins/available/index'
|
||||
});
|
||||
defineRoute({
|
||||
alias: '/repositories.html',
|
||||
path: '/controllers/dashboard/plugins/repositories/index.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/plugins/repositories/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
|
@ -247,8 +268,9 @@ define([
|
|||
transition: 'fade'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/itemdetails.html',
|
||||
controller: 'itemDetails',
|
||||
alias: '/details',
|
||||
path: '/controllers/itemDetails/index.html',
|
||||
controller: 'itemDetails/index',
|
||||
autoFocus: false,
|
||||
transition: 'fade'
|
||||
});
|
||||
|
@ -294,10 +316,11 @@ define([
|
|||
transition: 'fade'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/installedplugins.html',
|
||||
alias: '/installedplugins.html',
|
||||
path: '/controllers/dashboard/plugins/installed/index.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/plugins/installed'
|
||||
controller: 'dashboard/plugins/installed/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/scheduledtask.html',
|
||||
|
@ -373,16 +396,18 @@ define([
|
|||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/wizardremoteaccess.html',
|
||||
alias: '/wizardremoteaccess.html',
|
||||
path: '/controllers/wizard/remote/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'wizard/remoteaccess'
|
||||
controller: 'wizard/remote/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/wizardfinish.html',
|
||||
alias: '/wizardfinish.html',
|
||||
path: '/controllers/wizard/finish/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'wizard/finish'
|
||||
controller: 'wizard/finish/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/wizardlibrary.html',
|
||||
|
@ -391,28 +416,32 @@ define([
|
|||
controller: 'dashboard/mediaLibrary'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/wizardsettings.html',
|
||||
alias: '/wizardsettings.html',
|
||||
path: '/controllers/wizard/settings/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'wizard/settings'
|
||||
controller: 'wizard/settings/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/wizardstart.html',
|
||||
alias: '/wizardstart.html',
|
||||
path: '/controllers/wizard/start/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
controller: 'wizard/start'
|
||||
controller: 'wizard/start/index'
|
||||
});
|
||||
defineRoute({
|
||||
path: '/wizarduser.html',
|
||||
controller: 'wizard/user',
|
||||
alias: '/wizarduser.html',
|
||||
path: '/controllers/wizard/user/index.html',
|
||||
controller: 'wizard/user/index',
|
||||
autoFocus: false,
|
||||
anonymous: true
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
path: '/videoosd.html',
|
||||
alias: '/video',
|
||||
path: '/controllers/playback/video/index.html',
|
||||
transition: 'fade',
|
||||
controller: 'playback/videoosd',
|
||||
controller: 'playback/video/index',
|
||||
autoFocus: false,
|
||||
type: 'video-osd',
|
||||
supportsThemeMedia: true,
|
||||
|
@ -420,8 +449,9 @@ define([
|
|||
enableMediaControl: false
|
||||
});
|
||||
defineRoute({
|
||||
path: '/nowplaying.html',
|
||||
controller: 'playback/nowplaying',
|
||||
alias: '/queue',
|
||||
path: '/controllers/playback/queue/index.html',
|
||||
controller: 'playback/queue/index',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
fullscreen: true,
|
||||
|
|
|
@ -1,6 +1,9 @@
|
|||
define(['searchFields', 'searchResults', 'events'], function (SearchFields, SearchResults, events) {
|
||||
'use strict';
|
||||
|
||||
SearchFields = SearchFields.default || SearchFields;
|
||||
SearchResults = SearchResults.default || SearchResults;
|
||||
|
||||
function init(instance, tabContent, options) {
|
||||
tabContent.innerHTML = '<div class="padded-left padded-right searchFields"></div><div class="searchResults padded-top" style="padding-top:1.5em;"></div>';
|
||||
instance.searchFields = new SearchFields({
|
||||
|
|
|
@ -15,7 +15,7 @@ define(['connectionManager', 'playbackManager', 'syncPlayManager', 'events', 'in
|
|||
});
|
||||
} else {
|
||||
require(['alert'], function (alert) {
|
||||
alert({ title: args.Header, text: args.Text });
|
||||
alert.default({ title: args.Header, text: args.Text });
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -36,28 +36,28 @@ define(['connectionManager', 'playbackManager', 'syncPlayManager', 'events', 'in
|
|||
console.debug('Received command: ' + cmd.Name);
|
||||
switch (cmd.Name) {
|
||||
case 'Select':
|
||||
inputManager.trigger('select');
|
||||
inputManager.handleCommand('select');
|
||||
return;
|
||||
case 'Back':
|
||||
inputManager.trigger('back');
|
||||
inputManager.handleCommand('back');
|
||||
return;
|
||||
case 'MoveUp':
|
||||
inputManager.trigger('up');
|
||||
inputManager.handleCommand('up');
|
||||
return;
|
||||
case 'MoveDown':
|
||||
inputManager.trigger('down');
|
||||
inputManager.handleCommand('down');
|
||||
return;
|
||||
case 'MoveLeft':
|
||||
inputManager.trigger('left');
|
||||
inputManager.handleCommand('left');
|
||||
return;
|
||||
case 'MoveRight':
|
||||
inputManager.trigger('right');
|
||||
inputManager.handleCommand('right');
|
||||
return;
|
||||
case 'PageUp':
|
||||
inputManager.trigger('pageup');
|
||||
inputManager.handleCommand('pageup');
|
||||
return;
|
||||
case 'PageDown':
|
||||
inputManager.trigger('pagedown');
|
||||
inputManager.handleCommand('pagedown');
|
||||
return;
|
||||
case 'PlayTrailers':
|
||||
playTrailers(apiClient, cmd.Arguments.ItemId);
|
||||
|
@ -65,26 +65,29 @@ define(['connectionManager', 'playbackManager', 'syncPlayManager', 'events', 'in
|
|||
case 'SetRepeatMode':
|
||||
playbackManager.setRepeatMode(cmd.Arguments.RepeatMode);
|
||||
break;
|
||||
case 'SetShuffleQueue':
|
||||
playbackManager.setQueueShuffleMode(cmd.Arguments.ShuffleMode);
|
||||
break;
|
||||
case 'VolumeUp':
|
||||
inputManager.trigger('volumeup');
|
||||
inputManager.handleCommand('volumeup');
|
||||
return;
|
||||
case 'VolumeDown':
|
||||
inputManager.trigger('volumedown');
|
||||
inputManager.handleCommand('volumedown');
|
||||
return;
|
||||
case 'ChannelUp':
|
||||
inputManager.trigger('channelup');
|
||||
inputManager.handleCommand('channelup');
|
||||
return;
|
||||
case 'ChannelDown':
|
||||
inputManager.trigger('channeldown');
|
||||
inputManager.handleCommand('channeldown');
|
||||
return;
|
||||
case 'Mute':
|
||||
inputManager.trigger('mute');
|
||||
inputManager.handleCommand('mute');
|
||||
return;
|
||||
case 'Unmute':
|
||||
inputManager.trigger('unmute');
|
||||
inputManager.handleCommand('unmute');
|
||||
return;
|
||||
case 'ToggleMute':
|
||||
inputManager.trigger('togglemute');
|
||||
inputManager.handleCommand('togglemute');
|
||||
return;
|
||||
case 'SetVolume':
|
||||
notifyApp();
|
||||
|
@ -99,19 +102,19 @@ define(['connectionManager', 'playbackManager', 'syncPlayManager', 'events', 'in
|
|||
playbackManager.setSubtitleStreamIndex(parseInt(cmd.Arguments.Index));
|
||||
break;
|
||||
case 'ToggleFullscreen':
|
||||
inputManager.trigger('togglefullscreen');
|
||||
inputManager.handleCommand('togglefullscreen');
|
||||
return;
|
||||
case 'GoHome':
|
||||
inputManager.trigger('home');
|
||||
inputManager.handleCommand('home');
|
||||
return;
|
||||
case 'GoToSettings':
|
||||
inputManager.trigger('settings');
|
||||
inputManager.handleCommand('settings');
|
||||
return;
|
||||
case 'DisplayContent':
|
||||
displayContent(cmd, apiClient);
|
||||
break;
|
||||
case 'GoToSearch':
|
||||
inputManager.trigger('search');
|
||||
inputManager.handleCommand('search');
|
||||
return;
|
||||
case 'DisplayMessage':
|
||||
displayMessage(cmd);
|
||||
|
@ -162,19 +165,19 @@ define(['connectionManager', 'playbackManager', 'syncPlayManager', 'events', 'in
|
|||
}
|
||||
} else if (msg.MessageType === 'Playstate') {
|
||||
if (msg.Data.Command === 'Stop') {
|
||||
inputManager.trigger('stop');
|
||||
inputManager.handleCommand('stop');
|
||||
} else if (msg.Data.Command === 'Pause') {
|
||||
inputManager.trigger('pause');
|
||||
inputManager.handleCommand('pause');
|
||||
} else if (msg.Data.Command === 'Unpause') {
|
||||
inputManager.trigger('play');
|
||||
inputManager.handleCommand('play');
|
||||
} else if (msg.Data.Command === 'PlayPause') {
|
||||
inputManager.trigger('playpause');
|
||||
inputManager.handleCommand('playpause');
|
||||
} else if (msg.Data.Command === 'Seek') {
|
||||
playbackManager.seek(msg.Data.SeekPositionTicks);
|
||||
} else if (msg.Data.Command === 'NextTrack') {
|
||||
inputManager.trigger('next');
|
||||
inputManager.handleCommand('next');
|
||||
} else if (msg.Data.Command === 'PreviousTrack') {
|
||||
inputManager.trigger('previous');
|
||||
inputManager.handleCommand('previous');
|
||||
} else {
|
||||
notifyApp();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function enableAutomaticBitrateDetection(isInNetwork, mediaType, val) {
|
||||
var key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork;
|
||||
const key = 'enableautobitratebitrate-' + mediaType + '-' + isInNetwork;
|
||||
if (val !== undefined) {
|
||||
if (isInNetwork && mediaType === 'Audio') {
|
||||
val = true;
|
||||
|
@ -45,7 +45,7 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function maxStreamingBitrate(isInNetwork, mediaType, val) {
|
||||
var key = 'maxbitrate-' + mediaType + '-' + isInNetwork;
|
||||
const key = 'maxbitrate-' + mediaType + '-' + isInNetwork;
|
||||
if (val !== undefined) {
|
||||
if (isInNetwork && mediaType === 'Audio') {
|
||||
// nothing to do, this is always a max value
|
||||
|
@ -67,7 +67,7 @@ import events from 'events';
|
|||
this.set('maxStaticMusicBitrate', val);
|
||||
}
|
||||
|
||||
var defaultValue = 320000;
|
||||
const defaultValue = 320000;
|
||||
return parseInt(this.get('maxStaticMusicBitrate') || defaultValue.toString()) || defaultValue;
|
||||
}
|
||||
|
||||
|
@ -118,7 +118,7 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function set(name, value, userId) {
|
||||
var currentValue = this.get(name, userId);
|
||||
const currentValue = this.get(name, userId);
|
||||
appStorage.setItem(getKey(name, userId), value);
|
||||
|
||||
if (currentValue !== value) {
|
||||
|
|
|
@ -1,23 +1,30 @@
|
|||
/* eslint-disable indent */
|
||||
|
||||
import appSettings from 'appSettings';
|
||||
import events from 'events';
|
||||
|
||||
function onSaveTimeout() {
|
||||
var self = this;
|
||||
self.saveTimeout = null;
|
||||
self.currentApiClient.updateDisplayPreferences('usersettings', self.displayPrefs, self.currentUserId, 'emby');
|
||||
function onSaveTimeout() {
|
||||
const self = this;
|
||||
self.saveTimeout = null;
|
||||
self.currentApiClient.updateDisplayPreferences('usersettings', self.displayPrefs, self.currentUserId, 'emby');
|
||||
}
|
||||
|
||||
function saveServerPreferences(instance) {
|
||||
if (instance.saveTimeout) {
|
||||
clearTimeout(instance.saveTimeout);
|
||||
}
|
||||
|
||||
function saveServerPreferences(instance) {
|
||||
if (instance.saveTimeout) {
|
||||
clearTimeout(instance.saveTimeout);
|
||||
}
|
||||
instance.saveTimeout = setTimeout(onSaveTimeout.bind(instance), 50);
|
||||
}
|
||||
|
||||
instance.saveTimeout = setTimeout(onSaveTimeout.bind(instance), 50);
|
||||
export class UserSettings {
|
||||
constructor() {
|
||||
}
|
||||
|
||||
export function setUserInfo(userId, apiClient) {
|
||||
/**
|
||||
* Bind UserSettings instance to user.
|
||||
* @param {string} - User identifier.
|
||||
* @param {Object} - ApiClient instance.
|
||||
*/
|
||||
setUserInfo(userId, apiClient) {
|
||||
if (this.saveTimeout) {
|
||||
clearTimeout(this.saveTimeout);
|
||||
}
|
||||
|
@ -30,7 +37,7 @@ import events from 'events';
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
return apiClient.getDisplayPreferences('usersettings', userId, 'emby').then(function (result) {
|
||||
result.CustomPrefs = result.CustomPrefs || {};
|
||||
|
@ -38,18 +45,27 @@ import events from 'events';
|
|||
});
|
||||
}
|
||||
|
||||
export function getData() {
|
||||
// FIXME: Seems unused
|
||||
getData() {
|
||||
return this.displayPrefs;
|
||||
}
|
||||
|
||||
export function importFrom(instance) {
|
||||
// FIXME: Seems unused
|
||||
importFrom(instance) {
|
||||
this.displayPrefs = instance.getData();
|
||||
}
|
||||
|
||||
export function set(name, value, enableOnServer) {
|
||||
var userId = this.currentUserId;
|
||||
var currentValue = this.get(name, enableOnServer);
|
||||
var result = appSettings.set(name, value, userId);
|
||||
// FIXME: 'appSettings.set' doesn't return any value
|
||||
/**
|
||||
* Set value of setting.
|
||||
* @param {string} name - Name of setting.
|
||||
* @param {mixed} value - Value of setting.
|
||||
* @param {boolean} enableOnServer - Flag to save preferences on server.
|
||||
*/
|
||||
set(name, value, enableOnServer) {
|
||||
const userId = this.currentUserId;
|
||||
const currentValue = this.get(name, enableOnServer);
|
||||
const result = appSettings.set(name, value, userId);
|
||||
|
||||
if (enableOnServer !== false && this.displayPrefs) {
|
||||
this.displayPrefs.CustomPrefs[name] = value == null ? value : value.toString();
|
||||
|
@ -63,8 +79,14 @@ import events from 'events';
|
|||
return result;
|
||||
}
|
||||
|
||||
export function get(name, enableOnServer) {
|
||||
var userId = this.currentUserId;
|
||||
/**
|
||||
* Get value of setting.
|
||||
* @param {string} name - Name of setting.
|
||||
* @param {boolean} enableOnServer - Flag to return preferences from server (cached).
|
||||
* @return {string} Value of setting.
|
||||
*/
|
||||
get(name, enableOnServer) {
|
||||
const userId = this.currentUserId;
|
||||
if (enableOnServer !== false && this.displayPrefs) {
|
||||
return this.displayPrefs.CustomPrefs[name];
|
||||
}
|
||||
|
@ -72,8 +94,13 @@ import events from 'events';
|
|||
return appSettings.get(name, userId);
|
||||
}
|
||||
|
||||
export function serverConfig(config) {
|
||||
var apiClient = this.currentApiClient;
|
||||
/**
|
||||
* Get or set user config.
|
||||
* @param {Object|undefined} config - Configuration or undefined.
|
||||
* @return {Object|Promise} Configuration or Promise.
|
||||
*/
|
||||
serverConfig(config) {
|
||||
const apiClient = this.currentApiClient;
|
||||
if (config) {
|
||||
return apiClient.updateUserConfiguration(this.currentUserId, config);
|
||||
}
|
||||
|
@ -83,7 +110,12 @@ import events from 'events';
|
|||
});
|
||||
}
|
||||
|
||||
export function enableCinemaMode(val) {
|
||||
/**
|
||||
* Get or set 'Cinema Mode' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Cinema Mode' or undefined.
|
||||
* @return {boolean} 'Cinema Mode' state.
|
||||
*/
|
||||
enableCinemaMode(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableCinemaMode', val.toString(), false);
|
||||
}
|
||||
|
@ -92,7 +124,12 @@ import events from 'events';
|
|||
return val !== 'false';
|
||||
}
|
||||
|
||||
export function enableNextVideoInfoOverlay(val) {
|
||||
/**
|
||||
* Get or set 'Next Video Info Overlay' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Next Video Info Overlay' or undefined.
|
||||
* @return {boolean} 'Next Video Info Overlay' state.
|
||||
*/
|
||||
enableNextVideoInfoOverlay(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableNextVideoInfoOverlay', val.toString());
|
||||
}
|
||||
|
@ -101,7 +138,12 @@ import events from 'events';
|
|||
return val !== 'false';
|
||||
}
|
||||
|
||||
export function enableThemeSongs(val) {
|
||||
/**
|
||||
* Get or set 'Theme Songs' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Theme Songs' or undefined.
|
||||
* @return {boolean} 'Theme Songs' state.
|
||||
*/
|
||||
enableThemeSongs(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableThemeSongs', val.toString(), false);
|
||||
}
|
||||
|
@ -110,7 +152,12 @@ import events from 'events';
|
|||
return val === 'true';
|
||||
}
|
||||
|
||||
export function enableThemeVideos(val) {
|
||||
/**
|
||||
* Get or set 'Theme Videos' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Theme Videos' or undefined.
|
||||
* @return {boolean} 'Theme Videos' state.
|
||||
*/
|
||||
enableThemeVideos(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableThemeVideos', val.toString(), false);
|
||||
}
|
||||
|
@ -119,7 +166,12 @@ import events from 'events';
|
|||
return val === 'true';
|
||||
}
|
||||
|
||||
export function enableFastFadein(val) {
|
||||
/**
|
||||
* Get or set 'Fast Fade-in' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Fast Fade-in' or undefined.
|
||||
* @return {boolean} 'Fast Fade-in' state.
|
||||
*/
|
||||
enableFastFadein(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('fastFadein', val.toString(), false);
|
||||
}
|
||||
|
@ -128,7 +180,26 @@ import events from 'events';
|
|||
return val !== 'false';
|
||||
}
|
||||
|
||||
export function enableBackdrops(val) {
|
||||
/**
|
||||
* Get or set 'Blurhash' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Blurhash' or undefined.
|
||||
* @return {boolean} 'Blurhash' state.
|
||||
*/
|
||||
enableBlurhash(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('blurhash', val.toString(), false);
|
||||
}
|
||||
|
||||
val = this.get('blurhash', false);
|
||||
return val !== 'false';
|
||||
}
|
||||
|
||||
/**
|
||||
* Get or set 'Backdrops' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Backdrops' or undefined.
|
||||
* @return {boolean} 'Backdrops' state.
|
||||
*/
|
||||
enableBackdrops(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('enableBackdrops', val.toString(), false);
|
||||
}
|
||||
|
@ -137,7 +208,12 @@ import events from 'events';
|
|||
return val !== 'false';
|
||||
}
|
||||
|
||||
export function detailsBanner(val) {
|
||||
/**
|
||||
* Get or set 'Details Banner' state.
|
||||
* @param {boolean|undefined} val - Flag to enable 'Details Banner' or undefined.
|
||||
* @return {boolean} 'Details Banner' state.
|
||||
*/
|
||||
detailsBanner(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('detailsBanner', val.toString(), false);
|
||||
}
|
||||
|
@ -146,7 +222,12 @@ import events from 'events';
|
|||
return val !== 'false';
|
||||
}
|
||||
|
||||
export function language(val) {
|
||||
/**
|
||||
* Get or set language.
|
||||
* @param {string|undefined} val - Language.
|
||||
* @return {string} Language.
|
||||
*/
|
||||
language(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('language', val.toString(), false);
|
||||
}
|
||||
|
@ -154,7 +235,12 @@ import events from 'events';
|
|||
return this.get('language', false);
|
||||
}
|
||||
|
||||
export function dateTimeLocale(val) {
|
||||
/**
|
||||
* Get or set datetime locale.
|
||||
* @param {string|undefined} val - Datetime locale.
|
||||
* @return {string} Datetime locale.
|
||||
*/
|
||||
dateTimeLocale(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('datetimelocale', val.toString(), false);
|
||||
}
|
||||
|
@ -162,7 +248,12 @@ import events from 'events';
|
|||
return this.get('datetimelocale', false);
|
||||
}
|
||||
|
||||
export function chromecastVersion(val) {
|
||||
/**
|
||||
* Get or set Chromecast version.
|
||||
* @param {string|undefined} val - Chromecast version.
|
||||
* @return {string} Chromecast version.
|
||||
*/
|
||||
chromecastVersion(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('chromecastVersion', val.toString());
|
||||
}
|
||||
|
@ -170,7 +261,12 @@ import events from 'events';
|
|||
return this.get('chromecastVersion') || 'stable';
|
||||
}
|
||||
|
||||
export function skipBackLength(val) {
|
||||
/**
|
||||
* Get or set amount of rewind.
|
||||
* @param {number|undefined} val - Amount of rewind.
|
||||
* @return {number} Amount of rewind.
|
||||
*/
|
||||
skipBackLength(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('skipBackLength', val.toString());
|
||||
}
|
||||
|
@ -178,7 +274,12 @@ import events from 'events';
|
|||
return parseInt(this.get('skipBackLength') || '10000');
|
||||
}
|
||||
|
||||
export function skipForwardLength(val) {
|
||||
/**
|
||||
* Get or set amount of fast forward.
|
||||
* @param {number|undefined} val - Amount of fast forward.
|
||||
* @return {number} Amount of fast forward.
|
||||
*/
|
||||
skipForwardLength(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('skipForwardLength', val.toString());
|
||||
}
|
||||
|
@ -186,7 +287,12 @@ import events from 'events';
|
|||
return parseInt(this.get('skipForwardLength') || '30000');
|
||||
}
|
||||
|
||||
export function dashboardTheme(val) {
|
||||
/**
|
||||
* Get or set theme for Dashboard.
|
||||
* @param {string|undefined} val - Theme for Dashboard.
|
||||
* @return {string} Theme for Dashboard.
|
||||
*/
|
||||
dashboardTheme(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('dashboardTheme', val);
|
||||
}
|
||||
|
@ -194,7 +300,12 @@ import events from 'events';
|
|||
return this.get('dashboardTheme');
|
||||
}
|
||||
|
||||
export function skin(val) {
|
||||
/**
|
||||
* Get or set skin.
|
||||
* @param {string|undefined} val - Skin.
|
||||
* @return {string} Skin.
|
||||
*/
|
||||
skin(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('skin', val, false);
|
||||
}
|
||||
|
@ -202,7 +313,12 @@ import events from 'events';
|
|||
return this.get('skin', false);
|
||||
}
|
||||
|
||||
export function theme(val) {
|
||||
/**
|
||||
* Get or set main theme.
|
||||
* @param {string|undefined} val - Main theme.
|
||||
* @return {string} Main theme.
|
||||
*/
|
||||
theme(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('appTheme', val, false);
|
||||
}
|
||||
|
@ -210,7 +326,12 @@ import events from 'events';
|
|||
return this.get('appTheme', false);
|
||||
}
|
||||
|
||||
export function screensaver(val) {
|
||||
/**
|
||||
* Get or set screensaver.
|
||||
* @param {string|undefined} val - Screensaver.
|
||||
* @return {string} Screensaver.
|
||||
*/
|
||||
screensaver(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('screensaver', val, false);
|
||||
}
|
||||
|
@ -218,12 +339,17 @@ import events from 'events';
|
|||
return this.get('screensaver', false);
|
||||
}
|
||||
|
||||
export function libraryPageSize(val) {
|
||||
/**
|
||||
* Get or set library page size.
|
||||
* @param {number|undefined} val - Library page size.
|
||||
* @return {number} Library page size.
|
||||
*/
|
||||
libraryPageSize(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('libraryPageSize', parseInt(val, 10), false);
|
||||
}
|
||||
|
||||
var libraryPageSize = parseInt(this.get('libraryPageSize', false), 10);
|
||||
const libraryPageSize = parseInt(this.get('libraryPageSize', false), 10);
|
||||
if (libraryPageSize === 0) {
|
||||
// Explicitly return 0 to avoid returning 100 because 0 is falsy.
|
||||
return 0;
|
||||
|
@ -232,7 +358,12 @@ import events from 'events';
|
|||
}
|
||||
}
|
||||
|
||||
export function soundEffects(val) {
|
||||
/**
|
||||
* Get or set sound effects.
|
||||
* @param {string|undefined} val - Sound effects.
|
||||
* @return {string} Sound effects.
|
||||
*/
|
||||
soundEffects(val) {
|
||||
if (val !== undefined) {
|
||||
return this.set('soundeffects', val, false);
|
||||
}
|
||||
|
@ -240,8 +371,14 @@ import events from 'events';
|
|||
return this.get('soundeffects', false);
|
||||
}
|
||||
|
||||
export function loadQuerySettings(key, query) {
|
||||
var values = this.get(key);
|
||||
/**
|
||||
* Load query settings.
|
||||
* @param {string} key - Query key.
|
||||
* @param {Object} query - Query base.
|
||||
* @return {Object} Query.
|
||||
*/
|
||||
loadQuerySettings(key, query) {
|
||||
let values = this.get(key);
|
||||
if (values) {
|
||||
values = JSON.parse(values);
|
||||
return Object.assign(query, values);
|
||||
|
@ -250,8 +387,13 @@ import events from 'events';
|
|||
return query;
|
||||
}
|
||||
|
||||
export function saveQuerySettings(key, query) {
|
||||
var values = {};
|
||||
/**
|
||||
* Save query settings.
|
||||
* @param {string} key - Query key.
|
||||
* @param {Object} query - Query.
|
||||
*/
|
||||
saveQuerySettings(key, query) {
|
||||
const values = {};
|
||||
if (query.SortBy) {
|
||||
values.SortBy = query.SortBy;
|
||||
}
|
||||
|
@ -263,52 +405,76 @@ import events from 'events';
|
|||
return this.set(key, JSON.stringify(values));
|
||||
}
|
||||
|
||||
export function getSubtitleAppearanceSettings(key) {
|
||||
/**
|
||||
* Get subtitle appearance settings.
|
||||
* @param {string|undefined} key - Settings key.
|
||||
* @return {Object} Subtitle appearance settings.
|
||||
*/
|
||||
getSubtitleAppearanceSettings(key) {
|
||||
key = key || 'localplayersubtitleappearance3';
|
||||
return JSON.parse(this.get(key, false) || '{}');
|
||||
}
|
||||
|
||||
export function setSubtitleAppearanceSettings(value, key) {
|
||||
/**
|
||||
* Set subtitle appearance settings.
|
||||
* @param {Object} value - Subtitle appearance settings.
|
||||
* @param {string|undefined} key - Settings key.
|
||||
*/
|
||||
setSubtitleAppearanceSettings(value, key) {
|
||||
key = key || 'localplayersubtitleappearance3';
|
||||
return this.set(key, JSON.stringify(value), false);
|
||||
}
|
||||
|
||||
export function setFilter(key, value) {
|
||||
/**
|
||||
* Set filter.
|
||||
* @param {string} key - Filter key.
|
||||
* @param {string} value - Filter value.
|
||||
*/
|
||||
setFilter(key, value) {
|
||||
return this.set(key, value, true);
|
||||
}
|
||||
|
||||
export function getFilter(key) {
|
||||
/**
|
||||
* Get filter.
|
||||
* @param {string} key - Filter key.
|
||||
* @return {string} Filter value.
|
||||
*/
|
||||
getFilter(key) {
|
||||
return this.get(key, true);
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default {
|
||||
setUserInfo: setUserInfo,
|
||||
getData: getData,
|
||||
importFrom: importFrom,
|
||||
set: set,
|
||||
get: get,
|
||||
serverConfig: serverConfig,
|
||||
enableCinemaMode: enableCinemaMode,
|
||||
enableNextVideoInfoOverlay: enableNextVideoInfoOverlay,
|
||||
enableThemeSongs: enableThemeSongs,
|
||||
enableThemeVideos: enableThemeVideos,
|
||||
enableFastFadein: enableFastFadein,
|
||||
enableBackdrops: enableBackdrops,
|
||||
language: language,
|
||||
dateTimeLocale: dateTimeLocale,
|
||||
skipBackLength: skipBackLength,
|
||||
skipForwardLength: skipForwardLength,
|
||||
dashboardTheme: dashboardTheme,
|
||||
skin: skin,
|
||||
theme: theme,
|
||||
screensaver: screensaver,
|
||||
libraryPageSize: libraryPageSize,
|
||||
soundEffects: soundEffects,
|
||||
loadQuerySettings: loadQuerySettings,
|
||||
saveQuerySettings: saveQuerySettings,
|
||||
getSubtitleAppearanceSettings: getSubtitleAppearanceSettings,
|
||||
setSubtitleAppearanceSettings: setSubtitleAppearanceSettings,
|
||||
setFilter: setFilter,
|
||||
getFilter: getFilter
|
||||
};
|
||||
export const currentSettings = new UserSettings;
|
||||
|
||||
// Wrappers for non-ES6 modules and backward compatibility
|
||||
export const setUserInfo = currentSettings.setUserInfo.bind(currentSettings);
|
||||
export const getData = currentSettings.getData.bind(currentSettings);
|
||||
export const importFrom = currentSettings.importFrom.bind(currentSettings);
|
||||
export const set = currentSettings.set.bind(currentSettings);
|
||||
export const get = currentSettings.get.bind(currentSettings);
|
||||
export const serverConfig = currentSettings.serverConfig.bind(currentSettings);
|
||||
export const enableCinemaMode = currentSettings.enableCinemaMode.bind(currentSettings);
|
||||
export const enableNextVideoInfoOverlay = currentSettings.enableNextVideoInfoOverlay.bind(currentSettings);
|
||||
export const enableThemeSongs = currentSettings.enableThemeSongs.bind(currentSettings);
|
||||
export const enableThemeVideos = currentSettings.enableThemeVideos.bind(currentSettings);
|
||||
export const enableFastFadein = currentSettings.enableFastFadein.bind(currentSettings);
|
||||
export const enableBlurhash = currentSettings.enableBlurhash.bind(currentSettings);
|
||||
export const enableBackdrops = currentSettings.enableBackdrops.bind(currentSettings);
|
||||
export const detailsBanner = currentSettings.detailsBanner.bind(currentSettings);
|
||||
export const language = currentSettings.language.bind(currentSettings);
|
||||
export const dateTimeLocale = currentSettings.dateTimeLocale.bind(currentSettings);
|
||||
export const chromecastVersion = currentSettings.chromecastVersion.bind(currentSettings);
|
||||
export const skipBackLength = currentSettings.skipBackLength.bind(currentSettings);
|
||||
export const skipForwardLength = currentSettings.skipForwardLength.bind(currentSettings);
|
||||
export const dashboardTheme = currentSettings.dashboardTheme.bind(currentSettings);
|
||||
export const skin = currentSettings.skin.bind(currentSettings);
|
||||
export const theme = currentSettings.theme.bind(currentSettings);
|
||||
export const screensaver = currentSettings.screensaver.bind(currentSettings);
|
||||
export const libraryPageSize = currentSettings.libraryPageSize.bind(currentSettings);
|
||||
export const soundEffects = currentSettings.soundEffects.bind(currentSettings);
|
||||
export const loadQuerySettings = currentSettings.loadQuerySettings.bind(currentSettings);
|
||||
export const saveQuerySettings = currentSettings.saveQuerySettings.bind(currentSettings);
|
||||
export const getSubtitleAppearanceSettings = currentSettings.getSubtitleAppearanceSettings.bind(currentSettings);
|
||||
export const setSubtitleAppearanceSettings = currentSettings.setSubtitleAppearanceSettings.bind(currentSettings);
|
||||
export const setFilter = currentSettings.setFilter.bind(currentSettings);
|
||||
export const getFilter = currentSettings.getFilter.bind(currentSettings);
|
||||
|
|
|
@ -2,7 +2,7 @@ let data;
|
|||
|
||||
function getConfig() {
|
||||
if (data) return Promise.resolve(data);
|
||||
return fetch('/config.json?nocache=' + new Date().getUTCMilliseconds()).then(response => {
|
||||
return fetch('config.json?nocache=' + new Date().getUTCMilliseconds()).then(response => {
|
||||
data = response.json();
|
||||
return data;
|
||||
}).catch(error => {
|
||||
|
@ -12,7 +12,7 @@ function getConfig() {
|
|||
}
|
||||
|
||||
function getDefaultConfig() {
|
||||
return fetch('/config.template.json').then(function (response) {
|
||||
return fetch('config.template.json').then(function (response) {
|
||||
data = response.json();
|
||||
return data;
|
||||
});
|
||||
|
|
|
@ -187,35 +187,16 @@ var Dashboard = {
|
|||
}
|
||||
|
||||
require(['alert'], function (alert) {
|
||||
alert({
|
||||
alert.default({
|
||||
title: options.title || Globalize.translate('HeaderAlert'),
|
||||
text: options.message
|
||||
}).then(options.callback || function () {});
|
||||
});
|
||||
},
|
||||
restartServer: function () {
|
||||
var apiClient = window.ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
require(['serverRestartDialog', 'events'], function (ServerRestartDialog, events) {
|
||||
var dialog = new ServerRestartDialog({
|
||||
apiClient: apiClient
|
||||
});
|
||||
events.on(dialog, 'restarted', function () {
|
||||
if (AppInfo.isNativeApp) {
|
||||
apiClient.ensureWebSocket();
|
||||
} else {
|
||||
window.location.reload(true);
|
||||
}
|
||||
});
|
||||
dialog.show();
|
||||
});
|
||||
}
|
||||
},
|
||||
capabilities: function (appHost) {
|
||||
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', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'],
|
||||
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,
|
||||
SupportsMediaControl: true
|
||||
};
|
||||
|
@ -228,6 +209,28 @@ var Dashboard = {
|
|||
} else {
|
||||
Dashboard.navigate('selectserver.html');
|
||||
}
|
||||
},
|
||||
hideLoadingMsg: function() {
|
||||
'use strict';
|
||||
require(['loading'], function(loading) {
|
||||
loading.hide();
|
||||
});
|
||||
},
|
||||
showLoadingMsg: function() {
|
||||
'use strict';
|
||||
require(['loading'], function(loading) {
|
||||
loading.show();
|
||||
});
|
||||
},
|
||||
confirm: function(message, title, callback) {
|
||||
'use strict';
|
||||
require(['confirm'], function(confirm) {
|
||||
confirm(message, title).then(function() {
|
||||
callback(!0);
|
||||
}).catch(function() {
|
||||
callback(!1);
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -357,7 +360,7 @@ var AppInfo = {};
|
|||
return layoutManager;
|
||||
}
|
||||
|
||||
function createSharedAppFooter(appFooter) {
|
||||
function createSharedAppFooter({default: appFooter}) {
|
||||
return new appFooter({});
|
||||
}
|
||||
|
||||
|
@ -375,8 +378,7 @@ var AppInfo = {};
|
|||
}
|
||||
}
|
||||
|
||||
function initRequireWithBrowser(browser) {
|
||||
var bowerPath = getBowerPath();
|
||||
function initRequireWithBrowser() {
|
||||
var componentsPath = getComponentsPath();
|
||||
var scriptsPath = getScriptsPath();
|
||||
|
||||
|
@ -385,14 +387,6 @@ var AppInfo = {};
|
|||
define('lazyLoader', [componentsPath + '/lazyLoader/lazyLoaderIntersectionObserver'], returnFirstDependency);
|
||||
define('shell', [scriptsPath + '/shell'], returnFirstDependency);
|
||||
|
||||
if ('registerElement' in document) {
|
||||
define('registerElement', []);
|
||||
} else if (browser.msie) {
|
||||
define('registerElement', ['webcomponents'], returnFirstDependency);
|
||||
} else {
|
||||
define('registerElement', ['document-register-element'], returnFirstDependency);
|
||||
}
|
||||
|
||||
define('alert', [componentsPath + '/alert'], returnFirstDependency);
|
||||
|
||||
defineResizeObserver();
|
||||
|
@ -426,7 +420,7 @@ var AppInfo = {};
|
|||
require(['globalize', 'browser'], function (globalize, browser) {
|
||||
window.Globalize = globalize;
|
||||
loadCoreDictionary(globalize).then(function () {
|
||||
onGlobalizeInit(browser);
|
||||
onGlobalizeInit(browser, globalize);
|
||||
});
|
||||
});
|
||||
require(['keyboardnavigation'], function(keyboardnavigation) {
|
||||
|
@ -459,14 +453,14 @@ var AppInfo = {};
|
|||
});
|
||||
}
|
||||
|
||||
function onGlobalizeInit(browser) {
|
||||
function onGlobalizeInit(browser, globalize) {
|
||||
if ('android' === self.appMode) {
|
||||
if (-1 !== self.location.href.toString().toLowerCase().indexOf('start=backgroundsync')) {
|
||||
return onAppReady(browser);
|
||||
}
|
||||
}
|
||||
|
||||
document.title = Globalize.translateDocument(document.title, 'core');
|
||||
document.title = globalize.translateHtml(document.title, 'core');
|
||||
|
||||
if (browser.tv && !browser.android) {
|
||||
console.debug('using system fonts with explicit sizes');
|
||||
|
@ -486,21 +480,22 @@ var AppInfo = {};
|
|||
function loadPlugins(appHost, browser, shell) {
|
||||
console.debug('loading installed plugins');
|
||||
var list = [
|
||||
'components/playback/playaccessvalidation',
|
||||
'components/playback/experimentalwarnings',
|
||||
'components/htmlAudioPlayer/plugin',
|
||||
'components/htmlVideoPlayer/plugin',
|
||||
'components/photoPlayer/plugin',
|
||||
'components/youtubeplayer/plugin',
|
||||
'components/backdropScreensaver/plugin',
|
||||
'components/logoScreensaver/plugin'
|
||||
'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('components/sessionPlayer');
|
||||
list.push('plugins/sessionPlayer/plugin');
|
||||
|
||||
if (browser.chrome || browser.opera) {
|
||||
list.push('components/chromecast/chromecastplayer');
|
||||
list.push('plugins/chromecastPlayer/plugin');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,6 +556,7 @@ var AppInfo = {};
|
|||
require(['components/playback/volumeosd']);
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
if (navigator.mediaSession || window.NativeShell) {
|
||||
require(['mediaSession']);
|
||||
}
|
||||
|
@ -616,8 +612,8 @@ var AppInfo = {};
|
|||
/* eslint-enable compat/compat */
|
||||
}
|
||||
|
||||
function onWebComponentsReady(browser) {
|
||||
initRequireWithBrowser(browser);
|
||||
function onWebComponentsReady() {
|
||||
initRequireWithBrowser();
|
||||
|
||||
if (self.appMode === 'cordova' || self.appMode === 'android' || self.appMode === 'standalone') {
|
||||
AppInfo.isNativeApp = true;
|
||||
|
@ -658,8 +654,9 @@ var AppInfo = {};
|
|||
playQueueManager: componentsPath + '/playback/playqueuemanager',
|
||||
nowPlayingHelper: componentsPath + '/playback/nowplayinghelper',
|
||||
pluginManager: componentsPath + '/pluginManager',
|
||||
packageManager: componentsPath + '/packagemanager',
|
||||
screensaverManager: componentsPath + '/screensavermanager'
|
||||
packageManager: componentsPath + '/packageManager',
|
||||
screensaverManager: componentsPath + '/screensavermanager',
|
||||
chromecastHelper: 'plugins/chromecastPlayer/chromecastHelpers'
|
||||
};
|
||||
|
||||
requirejs.onError = onRequireJsError;
|
||||
|
@ -673,10 +670,10 @@ var AppInfo = {};
|
|||
},
|
||||
bundles: {
|
||||
bundle: [
|
||||
'document-register-element',
|
||||
'fetch',
|
||||
'flvjs',
|
||||
'jstree',
|
||||
'epubjs',
|
||||
'jQuery',
|
||||
'hlsjs',
|
||||
'howler',
|
||||
|
@ -737,12 +734,6 @@ var AppInfo = {};
|
|||
define('cardStyle', ['css!' + componentsPath + '/cardbuilder/card'], returnFirstDependency);
|
||||
define('flexStyles', ['css!assets/css/flexstyles'], returnFirstDependency);
|
||||
|
||||
// define legacy features
|
||||
// TODO delete the rest of these
|
||||
define('fnchecked', ['legacy/fnchecked'], returnFirstDependency);
|
||||
define('legacyDashboard', ['legacy/dashboard'], returnFirstDependency);
|
||||
define('legacySelectMenu', ['legacy/selectmenu'], returnFirstDependency);
|
||||
|
||||
// there are several objects that need to be instantiated
|
||||
// TODO find a better way to do this
|
||||
define('appFooter', [componentsPath + '/appFooter/appFooter'], returnFirstDependency);
|
||||
|
@ -778,7 +769,6 @@ var AppInfo = {};
|
|||
define('appSettings', [scriptsPath + '/settings/appSettings'], returnFirstDependency);
|
||||
define('userSettings', [scriptsPath + '/settings/userSettings'], returnFirstDependency);
|
||||
|
||||
define('chromecastHelper', [componentsPath + '/chromecast/chromecasthelpers'], returnFirstDependency);
|
||||
define('mediaSession', [componentsPath + '/playback/mediasession'], returnFirstDependency);
|
||||
define('actionsheet', [componentsPath + '/actionSheet/actionSheet'], returnFirstDependency);
|
||||
define('tunerPicker', [componentsPath + '/tunerPicker'], returnFirstDependency);
|
||||
|
@ -797,7 +787,6 @@ var AppInfo = {};
|
|||
define('tabbedView', [componentsPath + '/tabbedview/tabbedview'], returnFirstDependency);
|
||||
define('itemsTab', [componentsPath + '/tabbedview/itemstab'], returnFirstDependency);
|
||||
define('collectionEditor', [componentsPath + '/collectionEditor/collectionEditor'], returnFirstDependency);
|
||||
define('serverRestartDialog', [componentsPath + '/serverRestartDialog'], returnFirstDependency);
|
||||
define('playlistEditor', [componentsPath + '/playlisteditor/playlisteditor'], returnFirstDependency);
|
||||
define('recordingCreator', [componentsPath + '/recordingcreator/recordingcreator'], returnFirstDependency);
|
||||
define('recordingEditor', [componentsPath + '/recordingcreator/recordingeditor'], returnFirstDependency);
|
||||
|
@ -820,15 +809,16 @@ var AppInfo = {};
|
|||
define('upNextDialog', [componentsPath + '/upnextdialog/upnextdialog'], returnFirstDependency);
|
||||
define('subtitleAppearanceHelper', [componentsPath + '/subtitlesettings/subtitleappearancehelper'], returnFirstDependency);
|
||||
define('subtitleSettings', [componentsPath + '/subtitlesettings/subtitlesettings'], returnFirstDependency);
|
||||
define('settingsHelper', [componentsPath + '/settingshelper'], returnFirstDependency);
|
||||
define('displaySettings', [componentsPath + '/displaySettings/displaySettings'], returnFirstDependency);
|
||||
define('playbackSettings', [componentsPath + '/playbackSettings/playbackSettings'], returnFirstDependency);
|
||||
define('homescreenSettings', [componentsPath + '/homeScreenSettings/homeScreenSettings'], returnFirstDependency);
|
||||
define('quickConnectSettings', [componentsPath + '/quickConnectSettings/quickConnectSettings'], returnFirstDependency);
|
||||
define('playbackManager', [componentsPath + '/playback/playbackmanager'], getPlaybackManager);
|
||||
define('timeSyncManager', [componentsPath + '/syncplay/timeSyncManager'], returnDefault);
|
||||
define('groupSelectionMenu', [componentsPath + '/syncplay/groupSelectionMenu'], returnFirstDependency);
|
||||
define('syncPlayManager', [componentsPath + '/syncplay/syncPlayManager'], returnDefault);
|
||||
define('playbackPermissionManager', [componentsPath + '/syncplay/playbackPermissionManager'], returnDefault);
|
||||
define('timeSyncManager', [componentsPath + '/syncPlay/timeSyncManager'], returnDefault);
|
||||
define('groupSelectionMenu', [componentsPath + '/syncPlay/groupSelectionMenu'], returnFirstDependency);
|
||||
define('syncPlayManager', [componentsPath + '/syncPlay/syncPlayManager'], returnDefault);
|
||||
define('playbackPermissionManager', [componentsPath + '/syncPlay/playbackPermissionManager'], returnDefault);
|
||||
define('layoutManager', [componentsPath + '/layoutManager', 'apphost'], getLayoutManager);
|
||||
define('homeSections', [componentsPath + '/homesections/homesections'], returnFirstDependency);
|
||||
define('playMenu', [componentsPath + '/playmenu'], returnFirstDependency);
|
||||
|
@ -841,7 +831,6 @@ var AppInfo = {};
|
|||
define('deleteHelper', [scriptsPath + '/deleteHelper'], returnFirstDependency);
|
||||
define('tvguide', [componentsPath + '/guide/guide'], returnFirstDependency);
|
||||
define('guide-settings-dialog', [componentsPath + '/guide/guide-settings'], returnFirstDependency);
|
||||
define('loadingDialog', [componentsPath + '/loadingDialog/loadingDialog'], returnFirstDependency);
|
||||
define('viewManager', [componentsPath + '/viewManager/viewManager'], function (viewManager) {
|
||||
window.ViewManager = viewManager;
|
||||
viewManager.dispatchPageEvents(true);
|
||||
|
@ -852,7 +841,7 @@ var AppInfo = {};
|
|||
define('userdataButtons', [componentsPath + '/userdatabuttons/userdatabuttons'], returnFirstDependency);
|
||||
define('listView', [componentsPath + '/listview/listview'], returnFirstDependency);
|
||||
define('indicators', [componentsPath + '/indicators/indicators'], returnFirstDependency);
|
||||
define('viewSettings', [componentsPath + '/viewsettings/viewsettings'], returnFirstDependency);
|
||||
define('viewSettings', [componentsPath + '/viewSettings/viewSettings'], returnFirstDependency);
|
||||
define('filterMenu', [componentsPath + '/filtermenu/filtermenu'], returnFirstDependency);
|
||||
define('sortMenu', [componentsPath + '/sortmenu/sortmenu'], returnFirstDependency);
|
||||
define('sanitizefilename', [componentsPath + '/sanitizeFilename'], returnFirstDependency);
|
||||
|
@ -902,7 +891,7 @@ var AppInfo = {};
|
|||
};
|
||||
|
||||
appRouter.showVideoOsd = function () {
|
||||
return Dashboard.navigate('videoosd.html');
|
||||
return Dashboard.navigate('video');
|
||||
};
|
||||
|
||||
appRouter.showSelectServer = function () {
|
||||
|
@ -1043,7 +1032,7 @@ var AppInfo = {};
|
|||
}
|
||||
|
||||
if ('SeriesTimer' == itemType) {
|
||||
return 'itemdetails.html?seriesTimerId=' + id + '&serverId=' + serverId;
|
||||
return 'details?seriesTimerId=' + id + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
if ('livetv' == item.CollectionType) {
|
||||
|
@ -1113,13 +1102,13 @@ var AppInfo = {};
|
|||
var itemTypes = ['Playlist', 'TvChannel', 'Program', 'BoxSet', 'MusicAlbum', 'MusicGenre', 'Person', 'Recording', 'MusicArtist'];
|
||||
|
||||
if (itemTypes.indexOf(itemType) >= 0) {
|
||||
return 'itemdetails.html?id=' + id + '&serverId=' + serverId;
|
||||
return 'details?id=' + id + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
var contextSuffix = context ? '&context=' + context : '';
|
||||
|
||||
if ('Series' == itemType || 'Season' == itemType || 'Episode' == itemType) {
|
||||
return 'itemdetails.html?id=' + id + contextSuffix + '&serverId=' + serverId;
|
||||
return 'details?id=' + id + contextSuffix + '&serverId=' + serverId;
|
||||
}
|
||||
|
||||
if (item.IsFolder) {
|
||||
|
@ -1130,7 +1119,7 @@ var AppInfo = {};
|
|||
return '#';
|
||||
}
|
||||
|
||||
return 'itemdetails.html?id=' + id + '&serverId=' + serverId;
|
||||
return 'details?id=' + id + '&serverId=' + serverId;
|
||||
};
|
||||
|
||||
appRouter.showItem = showItem;
|
||||
|
@ -1138,7 +1127,7 @@ var AppInfo = {};
|
|||
});
|
||||
})();
|
||||
|
||||
return require(['browser'], onWebComponentsReady);
|
||||
return onWebComponentsReady();
|
||||
}();
|
||||
|
||||
pageClassOn('viewshow', 'standalonePage', function () {
|
||||
|
|
|
@ -1,119 +1,122 @@
|
|||
define(['events', 'userSettings', 'serverNotifications', 'connectionManager', 'globalize', 'emby-button'], function (events, userSettings, serverNotifications, connectionManager, globalize) {
|
||||
'use strict';
|
||||
import events from 'events';
|
||||
import * as userSettings from 'userSettings';
|
||||
import serverNotifications from 'serverNotifications';
|
||||
import connectionManager from 'connectionManager';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-button';
|
||||
|
||||
return function (options) {
|
||||
function pollTasks() {
|
||||
connectionManager.getApiClient(serverId).getScheduledTasks({
|
||||
IsEnabled: true
|
||||
}).then(updateTasks);
|
||||
}
|
||||
export default function (options) {
|
||||
function pollTasks() {
|
||||
connectionManager.getApiClient(serverId).getScheduledTasks({
|
||||
IsEnabled: true
|
||||
}).then(updateTasks);
|
||||
}
|
||||
|
||||
function updateTasks(tasks) {
|
||||
var task = tasks.filter(function (t) {
|
||||
return t.Key == options.taskKey;
|
||||
})[0];
|
||||
|
||||
if (options.panel) {
|
||||
if (task) {
|
||||
options.panel.classList.remove('hide');
|
||||
} else {
|
||||
options.panel.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
if (!task) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (task.State == 'Idle') {
|
||||
button.removeAttribute('disabled');
|
||||
} else {
|
||||
button.setAttribute('disabled', 'disabled');
|
||||
}
|
||||
|
||||
button.setAttribute('data-taskid', task.Id);
|
||||
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
|
||||
|
||||
if (options.progressElem) {
|
||||
options.progressElem.value = progress;
|
||||
|
||||
if (task.State == 'Running') {
|
||||
options.progressElem.classList.remove('hide');
|
||||
} else {
|
||||
options.progressElem.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.lastResultElem) {
|
||||
var lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
|
||||
|
||||
if (lastResult == 'Failed') {
|
||||
options.lastResultElem.html('<span style="color:#FF0000;">(' + globalize.translate('LabelFailed') + ')</span>');
|
||||
} else if (lastResult == 'Cancelled') {
|
||||
options.lastResultElem.html('<span style="color:#0026FF;">(' + globalize.translate('LabelCancelled') + ')</span>');
|
||||
} else if (lastResult == 'Aborted') {
|
||||
options.lastResultElem.html('<span style="color:#FF0000;">' + globalize.translate('LabelAbortedByServerShutdown') + '</span>');
|
||||
} else {
|
||||
options.lastResultElem.html(lastResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onScheduledTaskMessageConfirmed(id) {
|
||||
connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
|
||||
}
|
||||
|
||||
function onButtonClick() {
|
||||
onScheduledTaskMessageConfirmed(this.getAttribute('data-taskid'));
|
||||
}
|
||||
|
||||
function onScheduledTasksUpdate(e, apiClient, info) {
|
||||
if (apiClient.serverId() === serverId) {
|
||||
updateTasks(info);
|
||||
}
|
||||
}
|
||||
|
||||
var pollInterval;
|
||||
var button = options.button;
|
||||
var serverId = ApiClient.serverId();
|
||||
|
||||
function onPollIntervalFired() {
|
||||
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
||||
pollTasks();
|
||||
}
|
||||
}
|
||||
|
||||
function startInterval() {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (pollInterval) {
|
||||
clearInterval(pollInterval);
|
||||
}
|
||||
apiClient.sendMessage('ScheduledTasksInfoStart', '1000,1000');
|
||||
pollInterval = setInterval(onPollIntervalFired, 5000);
|
||||
}
|
||||
|
||||
function stopInterval() {
|
||||
connectionManager.getApiClient(serverId).sendMessage('ScheduledTasksInfoStop');
|
||||
|
||||
if (pollInterval) {
|
||||
clearInterval(pollInterval);
|
||||
}
|
||||
}
|
||||
function updateTasks(tasks) {
|
||||
const task = tasks.filter(function (t) {
|
||||
return t.Key == options.taskKey;
|
||||
})[0];
|
||||
|
||||
if (options.panel) {
|
||||
options.panel.classList.add('hide');
|
||||
if (task) {
|
||||
options.panel.classList.remove('hide');
|
||||
} else {
|
||||
options.panel.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.mode == 'off') {
|
||||
button.removeEventListener('click', onButtonClick);
|
||||
events.off(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
|
||||
stopInterval();
|
||||
} else {
|
||||
button.addEventListener('click', onButtonClick);
|
||||
pollTasks();
|
||||
startInterval();
|
||||
events.on(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
|
||||
if (!task) {
|
||||
return;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
if (task.State == 'Idle') {
|
||||
button.removeAttribute('disabled');
|
||||
} else {
|
||||
button.setAttribute('disabled', 'disabled');
|
||||
}
|
||||
|
||||
button.setAttribute('data-taskid', task.Id);
|
||||
const progress = (task.CurrentProgressPercentage || 0).toFixed(1);
|
||||
|
||||
if (options.progressElem) {
|
||||
options.progressElem.value = progress;
|
||||
|
||||
if (task.State == 'Running') {
|
||||
options.progressElem.classList.remove('hide');
|
||||
} else {
|
||||
options.progressElem.classList.add('hide');
|
||||
}
|
||||
}
|
||||
|
||||
if (options.lastResultElem) {
|
||||
const lastResult = task.LastExecutionResult ? task.LastExecutionResult.Status : '';
|
||||
|
||||
if (lastResult == 'Failed') {
|
||||
options.lastResultElem.html('<span style="color:#FF0000;">(' + globalize.translate('LabelFailed') + ')</span>');
|
||||
} else if (lastResult == 'Cancelled') {
|
||||
options.lastResultElem.html('<span style="color:#0026FF;">(' + globalize.translate('LabelCancelled') + ')</span>');
|
||||
} else if (lastResult == 'Aborted') {
|
||||
options.lastResultElem.html('<span style="color:#FF0000;">' + globalize.translate('LabelAbortedByServerShutdown') + '</span>');
|
||||
} else {
|
||||
options.lastResultElem.html(lastResult);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function onScheduledTaskMessageConfirmed(id) {
|
||||
connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
|
||||
}
|
||||
|
||||
function onButtonClick() {
|
||||
onScheduledTaskMessageConfirmed(this.getAttribute('data-taskid'));
|
||||
}
|
||||
|
||||
function onScheduledTasksUpdate(e, apiClient, info) {
|
||||
if (apiClient.serverId() === serverId) {
|
||||
updateTasks(info);
|
||||
}
|
||||
}
|
||||
|
||||
let pollInterval;
|
||||
const button = options.button;
|
||||
const serverId = ApiClient.serverId();
|
||||
|
||||
function onPollIntervalFired() {
|
||||
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
||||
pollTasks();
|
||||
}
|
||||
}
|
||||
|
||||
function startInterval() {
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (pollInterval) {
|
||||
clearInterval(pollInterval);
|
||||
}
|
||||
apiClient.sendMessage('ScheduledTasksInfoStart', '1000,1000');
|
||||
pollInterval = setInterval(onPollIntervalFired, 5000);
|
||||
}
|
||||
|
||||
function stopInterval() {
|
||||
connectionManager.getApiClient(serverId).sendMessage('ScheduledTasksInfoStop');
|
||||
|
||||
if (pollInterval) {
|
||||
clearInterval(pollInterval);
|
||||
}
|
||||
}
|
||||
|
||||
if (options.panel) {
|
||||
options.panel.classList.add('hide');
|
||||
}
|
||||
|
||||
if (options.mode == 'off') {
|
||||
button.removeEventListener('click', onButtonClick);
|
||||
events.off(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
|
||||
stopInterval();
|
||||
} else {
|
||||
button.addEventListener('click', onButtonClick);
|
||||
pollTasks();
|
||||
startInterval();
|
||||
events.on(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,27 +1,29 @@
|
|||
define(['userSettings', 'skinManager', 'connectionManager', 'events'], function (userSettings, skinManager, connectionManager, events) {
|
||||
'use strict';
|
||||
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';
|
||||
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 (viewType !== currentViewType) {
|
||||
currentViewType = viewType;
|
||||
var theme;
|
||||
var context;
|
||||
|
||||
if ('a' === viewType) {
|
||||
theme = userSettings.dashboardTheme();
|
||||
context = 'serverdashboard';
|
||||
} else {
|
||||
theme = userSettings.theme();
|
||||
}
|
||||
|
||||
skinManager.setTheme(theme, context);
|
||||
if ('a' === viewType) {
|
||||
theme = userSettings.dashboardTheme();
|
||||
context = 'serverdashboard';
|
||||
} else {
|
||||
theme = userSettings.theme();
|
||||
}
|
||||
});
|
||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||
currentViewType = null;
|
||||
});
|
||||
|
||||
skinManager.setTheme(theme, context);
|
||||
}
|
||||
});
|
||||
|
||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||
currentViewType = null;
|
||||
});
|
||||
|
|
|
@ -1,31 +1,31 @@
|
|||
define(['dom', 'events'], function (dom, events) {
|
||||
'use strict';
|
||||
import dom from 'dom';
|
||||
import events from 'events';
|
||||
|
||||
function getTouches(e) {
|
||||
function getTouches(e) {
|
||||
return e.changedTouches || e.targetTouches || e.touches;
|
||||
}
|
||||
|
||||
return e.changedTouches || e.targetTouches || e.touches;
|
||||
}
|
||||
|
||||
function TouchHelper(elem, options) {
|
||||
class TouchHelper {
|
||||
constructor(elem, options) {
|
||||
|
||||
options = options || {};
|
||||
var touchTarget;
|
||||
var touchStartX;
|
||||
var touchStartY;
|
||||
var lastDeltaX;
|
||||
var lastDeltaY;
|
||||
var thresholdYMet;
|
||||
var self = this;
|
||||
let touchTarget;
|
||||
let touchStartX;
|
||||
let touchStartY;
|
||||
let lastDeltaX;
|
||||
let lastDeltaY;
|
||||
let thresholdYMet;
|
||||
const self = this;
|
||||
|
||||
var swipeXThreshold = options.swipeXThreshold || 50;
|
||||
var swipeYThreshold = options.swipeYThreshold || 50;
|
||||
var swipeXMaxY = 30;
|
||||
const swipeXThreshold = options.swipeXThreshold || 50;
|
||||
const swipeYThreshold = options.swipeYThreshold || 50;
|
||||
const swipeXMaxY = 30;
|
||||
|
||||
var excludeTagNames = options.ignoreTagNames || [];
|
||||
const excludeTagNames = options.ignoreTagNames || [];
|
||||
|
||||
var touchStart = function (e) {
|
||||
const touchStart = function (e) {
|
||||
|
||||
var touch = getTouches(e)[0];
|
||||
const touch = getTouches(e)[0];
|
||||
touchTarget = null;
|
||||
touchStartX = 0;
|
||||
touchStartY = 0;
|
||||
|
@ -35,7 +35,7 @@ define(['dom', 'events'], function (dom, events) {
|
|||
|
||||
if (touch) {
|
||||
|
||||
var currentTouchTarget = touch.target;
|
||||
const currentTouchTarget = touch.target;
|
||||
|
||||
if (dom.parentWithTag(currentTouchTarget, excludeTagNames)) {
|
||||
return;
|
||||
|
@ -47,18 +47,18 @@ define(['dom', 'events'], function (dom, events) {
|
|||
}
|
||||
};
|
||||
|
||||
var touchEnd = function (e) {
|
||||
const touchEnd = function (e) {
|
||||
|
||||
var isTouchMove = e.type === 'touchmove';
|
||||
const isTouchMove = e.type === 'touchmove';
|
||||
|
||||
if (touchTarget) {
|
||||
var touch = getTouches(e)[0];
|
||||
const touch = getTouches(e)[0];
|
||||
|
||||
var deltaX;
|
||||
var deltaY;
|
||||
let deltaX;
|
||||
let deltaY;
|
||||
|
||||
var clientX;
|
||||
var clientY;
|
||||
let clientX;
|
||||
let clientY;
|
||||
|
||||
if (touch) {
|
||||
clientX = touch.clientX || 0;
|
||||
|
@ -70,8 +70,8 @@ define(['dom', 'events'], function (dom, events) {
|
|||
deltaY = 0;
|
||||
}
|
||||
|
||||
var currentDeltaX = lastDeltaX == null ? deltaX : (deltaX - lastDeltaX);
|
||||
var currentDeltaY = lastDeltaY == null ? deltaY : (deltaY - lastDeltaY);
|
||||
const currentDeltaX = lastDeltaX == null ? deltaX : (deltaX - lastDeltaX);
|
||||
const currentDeltaY = lastDeltaY == null ? deltaY : (deltaY - lastDeltaY);
|
||||
|
||||
lastDeltaX = deltaX;
|
||||
lastDeltaY = deltaY;
|
||||
|
@ -138,14 +138,13 @@ define(['dom', 'events'], function (dom, events) {
|
|||
passive: true
|
||||
});
|
||||
}
|
||||
destroy() {
|
||||
|
||||
TouchHelper.prototype.destroy = function () {
|
||||
|
||||
var elem = this.elem;
|
||||
const elem = this.elem;
|
||||
|
||||
if (elem) {
|
||||
var touchStart = this.touchStart;
|
||||
var touchEnd = this.touchEnd;
|
||||
const touchStart = this.touchStart;
|
||||
const touchEnd = this.touchEnd;
|
||||
|
||||
dom.removeEventListener(elem, 'touchstart', touchStart, {
|
||||
passive: true
|
||||
|
@ -165,7 +164,7 @@ define(['dom', 'events'], function (dom, events) {
|
|||
this.touchEnd = null;
|
||||
|
||||
this.elem = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return TouchHelper;
|
||||
});
|
||||
export default TouchHelper;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue