mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
merge branch master into pdf-reader
This commit is contained in:
commit
6b302ed20b
292 changed files with 7971 additions and 6918 deletions
|
@ -1,12 +1,11 @@
|
|||
import * as userSettings from 'userSettings';
|
||||
import skinManager from 'skinManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import events from 'events';
|
||||
|
||||
// Set the default theme when loading
|
||||
skinManager.setTheme(userSettings.theme());
|
||||
|
||||
// Set the user's prefered theme when signing in
|
||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||
events.on(window.connectionManager, 'localusersignedin', function (e, user) {
|
||||
skinManager.setTheme(userSettings.theme());
|
||||
});
|
||||
|
|
47
src/scripts/autocast.js
Normal file
47
src/scripts/autocast.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
import events from 'events';
|
||||
import playbackManager from 'playbackManager';
|
||||
|
||||
export function supported() {
|
||||
return typeof(Storage) !== 'undefined';
|
||||
}
|
||||
|
||||
export function enable(enabled) {
|
||||
if (!supported()) return;
|
||||
|
||||
if (enabled) {
|
||||
const currentPlayerInfo = playbackManager.getPlayerInfo();
|
||||
|
||||
if (currentPlayerInfo && currentPlayerInfo.id) {
|
||||
localStorage.setItem('autocastPlayerId', currentPlayerInfo.id);
|
||||
}
|
||||
} else {
|
||||
localStorage.removeItem('autocastPlayerId');
|
||||
}
|
||||
}
|
||||
|
||||
export function isEnabled() {
|
||||
if (!supported()) return false;
|
||||
|
||||
const playerId = localStorage.getItem('autocastPlayerId');
|
||||
const currentPlayerInfo = playbackManager.getPlayerInfo();
|
||||
|
||||
return (currentPlayerInfo && playerId && currentPlayerInfo.id === playerId);
|
||||
}
|
||||
|
||||
function onOpen() {
|
||||
const playerId = localStorage.getItem('autocastPlayerId');
|
||||
|
||||
playbackManager.getTargets().then(function (targets) {
|
||||
for (let i = 0; i < targets.length; i++) {
|
||||
if (targets[i].id == playerId) {
|
||||
playbackManager.trySetActivePlayer(targets[i].playerName, targets[i]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
const apiClient = window.connectionManager.currentApiClient();
|
||||
if (apiClient && supported()) {
|
||||
events.on(apiClient, 'websocketopen', onOpen);
|
||||
}
|
|
@ -75,10 +75,24 @@ function hasKeyboard(browser) {
|
|||
function iOSversion() {
|
||||
// MacIntel: Apple iPad Pro 11 iOS 13.1
|
||||
if (/iP(hone|od|ad)|MacIntel/.test(navigator.platform)) {
|
||||
// supports iOS 2.0 and later: <http://bit.ly/TJjs1V>
|
||||
const v = (navigator.appVersion).match(/OS (\d+)_(\d+)_?(\d+)?/);
|
||||
return [parseInt(v[1], 10), parseInt(v[2], 10), parseInt(v[3] || 0, 10)];
|
||||
const tests = [
|
||||
// Original test for getting full iOS version number in iOS 2.0+
|
||||
/OS (\d+)_(\d+)_?(\d+)?/,
|
||||
// Test for iPads running iOS 13+ that can only get the major OS version
|
||||
/Version\/(\d+)/
|
||||
];
|
||||
for (const test of tests) {
|
||||
const matches = (navigator.appVersion).match(test);
|
||||
if (matches) {
|
||||
return [
|
||||
parseInt(matches[1], 10),
|
||||
parseInt(matches[2] || 0, 10),
|
||||
parseInt(matches[3] || 0, 10)
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
return [];
|
||||
}
|
||||
|
||||
let _supportsCssAnimation;
|
||||
|
@ -196,6 +210,15 @@ if (!browser.chrome && !browser.edgeChromium && !browser.edge && !browser.opera
|
|||
browser.safari = true;
|
||||
}
|
||||
|
||||
browser.osx = userAgent.toLowerCase().indexOf('os x') !== -1;
|
||||
|
||||
// This is a workaround to detect iPads on iOS 13+ that report as desktop Safari
|
||||
// This may break in the future if Apple releases a touchscreen Mac
|
||||
// https://forums.developer.apple.com/thread/119186
|
||||
if (browser.osx && !browser.iphone && !browser.ipod && !browser.ipad && navigator.maxTouchPoints > 1) {
|
||||
browser.ipad = true;
|
||||
}
|
||||
|
||||
if (userAgent.toLowerCase().indexOf('playstation 4') !== -1) {
|
||||
browser.ps4 = true;
|
||||
browser.tv = true;
|
||||
|
@ -242,7 +265,6 @@ if (typeof document !== 'undefined') {
|
|||
browser.keyboard = hasKeyboard(browser);
|
||||
browser.supportsCssAnimation = supportsCssAnimation;
|
||||
|
||||
browser.osx = userAgent.toLowerCase().indexOf('os x') !== -1;
|
||||
browser.iOS = browser.ipad || browser.iphone || browser.ipod;
|
||||
|
||||
if (browser.iOS) {
|
||||
|
|
|
@ -23,7 +23,7 @@ define(['browser'], function (browser) {
|
|||
videoTestElement.canPlayType('video/mp4; codecs="hev1.1.0.L120"').replace(/no/, ''));
|
||||
}
|
||||
|
||||
var _supportsTextTracks;
|
||||
let _supportsTextTracks;
|
||||
function supportsTextTracks() {
|
||||
if (browser.tizen) {
|
||||
return true;
|
||||
|
@ -37,7 +37,7 @@ define(['browser'], function (browser) {
|
|||
return _supportsTextTracks;
|
||||
}
|
||||
|
||||
var _canPlayHls;
|
||||
let _canPlayHls;
|
||||
function canPlayHls() {
|
||||
if (_canPlayHls == null) {
|
||||
_canPlayHls = canPlayNativeHls() || canPlayHlsWithMSE();
|
||||
|
@ -51,7 +51,7 @@ define(['browser'], function (browser) {
|
|||
return true;
|
||||
}
|
||||
|
||||
var media = document.createElement('video');
|
||||
const media = document.createElement('video');
|
||||
if (media.canPlayType('application/x-mpegURL').replace(/no/, '') ||
|
||||
media.canPlayType('application/vnd.apple.mpegURL').replace(/no/, '')) {
|
||||
return true;
|
||||
|
@ -70,6 +70,12 @@ define(['browser'], function (browser) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// iPhones 5c and older and old model iPads do not support AC-3/E-AC-3
|
||||
// These models can only run iOS 10.x or lower
|
||||
if (browser.iOS && browser.iOSVersion < 11) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return videoTestElement.canPlayType('audio/mp4; codecs="ac-3"').replace(/no/, '');
|
||||
}
|
||||
|
||||
|
@ -78,6 +84,12 @@ define(['browser'], function (browser) {
|
|||
return true;
|
||||
}
|
||||
|
||||
// iPhones 5c and older and old model iPads do not support AC-3/E-AC-3
|
||||
// These models can only run iOS 10.x or lower
|
||||
if (browser.iOS && browser.iOSVersion < 11) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return videoTestElement.canPlayType('audio/mp4; codecs="ec-3"').replace(/no/, '');
|
||||
}
|
||||
|
||||
|
@ -95,7 +107,7 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function canPlayAudioFormat(format) {
|
||||
var typeString;
|
||||
let typeString;
|
||||
|
||||
if (format === 'flac') {
|
||||
if (browser.tizen || browser.web0s || browser.edgeUwp) {
|
||||
|
@ -180,9 +192,9 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function getDirectPlayProfileForVideoContainer(container, videoAudioCodecs, videoTestElement, options) {
|
||||
var supported = false;
|
||||
var profileContainer = container;
|
||||
var videoCodecs = [];
|
||||
let supported = false;
|
||||
let profileContainer = container;
|
||||
const videoCodecs = [];
|
||||
|
||||
switch (container) {
|
||||
case 'asf':
|
||||
|
@ -265,10 +277,10 @@ define(['browser'], function (browser) {
|
|||
}
|
||||
|
||||
function getGlobalMaxVideoBitrate() {
|
||||
var isTizenFhd = false;
|
||||
let isTizenFhd = false;
|
||||
if (browser.tizen) {
|
||||
try {
|
||||
var isTizenUhd = webapis.productinfo.isUdPanelSupported();
|
||||
const isTizenUhd = webapis.productinfo.isUdPanelSupported();
|
||||
isTizenFhd = !isTizenUhd;
|
||||
console.debug('isTizenFhd = ' + isTizenFhd);
|
||||
} catch (error) {
|
||||
|
@ -285,19 +297,19 @@ define(['browser'], function (browser) {
|
|||
return function (options) {
|
||||
options = options || {};
|
||||
|
||||
var physicalAudioChannels = options.audioChannels || (browser.tv || browser.ps4 || browser.xboxOne ? 6 : 2);
|
||||
const physicalAudioChannels = options.audioChannels || (browser.tv || browser.ps4 || browser.xboxOne ? 6 : 2);
|
||||
|
||||
var bitrateSetting = getMaxBitrate();
|
||||
const bitrateSetting = getMaxBitrate();
|
||||
|
||||
var videoTestElement = document.createElement('video');
|
||||
const videoTestElement = document.createElement('video');
|
||||
|
||||
var canPlayVp8 = videoTestElement.canPlayType('video/webm; codecs="vp8"').replace(/no/, '');
|
||||
var canPlayVp9 = videoTestElement.canPlayType('video/webm; codecs="vp9"').replace(/no/, '');
|
||||
var webmAudioCodecs = ['vorbis'];
|
||||
const canPlayVp8 = videoTestElement.canPlayType('video/webm; codecs="vp8"').replace(/no/, '');
|
||||
const canPlayVp9 = videoTestElement.canPlayType('video/webm; codecs="vp9"').replace(/no/, '');
|
||||
const webmAudioCodecs = ['vorbis'];
|
||||
|
||||
var canPlayMkv = testCanPlayMkv(videoTestElement);
|
||||
const canPlayMkv = testCanPlayMkv(videoTestElement);
|
||||
|
||||
var profile = {};
|
||||
const profile = {};
|
||||
|
||||
profile.MaxStreamingBitrate = bitrateSetting;
|
||||
profile.MaxStaticBitrate = 100000000;
|
||||
|
@ -305,18 +317,18 @@ define(['browser'], function (browser) {
|
|||
|
||||
profile.DirectPlayProfiles = [];
|
||||
|
||||
var videoAudioCodecs = [];
|
||||
var hlsVideoAudioCodecs = [];
|
||||
let videoAudioCodecs = [];
|
||||
let hlsVideoAudioCodecs = [];
|
||||
|
||||
var supportsMp3VideoAudio = videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.69"').replace(/no/, '')
|
||||
const 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.web0s;
|
||||
const supportsMp2VideoAudio = browser.edgeUwp || browser.tizen || browser.web0s;
|
||||
|
||||
/* eslint-disable compat/compat */
|
||||
var maxVideoWidth = browser.xboxOne ?
|
||||
let maxVideoWidth = browser.xboxOne ?
|
||||
(window.screen ? window.screen.width : null) :
|
||||
null;
|
||||
|
||||
|
@ -325,7 +337,7 @@ define(['browser'], function (browser) {
|
|||
maxVideoWidth = options.maxVideoWidth;
|
||||
}
|
||||
|
||||
var canPlayAacVideoAudio = videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.2"').replace(/no/, '');
|
||||
const canPlayAacVideoAudio = videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.2"').replace(/no/, '');
|
||||
|
||||
// Only put mp3 first if mkv support is there
|
||||
// Otherwise with HLS and mp3 audio we're seeing some browsers
|
||||
|
@ -333,7 +345,7 @@ define(['browser'], function (browser) {
|
|||
if (supportsAc3(videoTestElement)) {
|
||||
videoAudioCodecs.push('ac3');
|
||||
|
||||
var eAc3 = supportsEac3(videoTestElement);
|
||||
const eAc3 = supportsEac3(videoTestElement);
|
||||
if (eAc3) {
|
||||
videoAudioCodecs.push('eac3');
|
||||
}
|
||||
|
@ -382,7 +394,7 @@ define(['browser'], function (browser) {
|
|||
videoAudioCodecs.push('mp2');
|
||||
}
|
||||
|
||||
var supportsDts = browser.tizen || browser.web0s || options.supportsDts || videoTestElement.canPlayType('video/mp4; codecs="dts-"').replace(/no/, '') || videoTestElement.canPlayType('video/mp4; codecs="dts+"').replace(/no/, '');
|
||||
let 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) {
|
||||
|
@ -425,9 +437,9 @@ define(['browser'], function (browser) {
|
|||
return (options.disableHlsVideoAudioCodecs || []).indexOf(c) === -1;
|
||||
});
|
||||
|
||||
var mp4VideoCodecs = [];
|
||||
var webmVideoCodecs = [];
|
||||
var hlsVideoCodecs = [];
|
||||
const mp4VideoCodecs = [];
|
||||
const webmVideoCodecs = [];
|
||||
const hlsVideoCodecs = [];
|
||||
|
||||
if (canPlayH264(videoTestElement)) {
|
||||
mp4VideoCodecs.push('h264');
|
||||
|
@ -543,7 +555,7 @@ define(['browser'], function (browser) {
|
|||
|
||||
profile.TranscodingProfiles = [];
|
||||
|
||||
var hlsBreakOnNonKeyFrames = browser.iOS || browser.osx || browser.edge || !canPlayNativeHls() ? true : false;
|
||||
const hlsBreakOnNonKeyFrames = browser.iOS || browser.osx || browser.edge || !canPlayNativeHls() ? true : false;
|
||||
|
||||
if (canPlayHls() && browser.enableHlsAudio !== false) {
|
||||
profile.TranscodingProfiles.push({
|
||||
|
@ -649,9 +661,9 @@ define(['browser'], function (browser) {
|
|||
|
||||
profile.CodecProfiles = [];
|
||||
|
||||
var supportsSecondaryAudio = browser.tizen || videoTestElement.audioTracks;
|
||||
const supportsSecondaryAudio = browser.tizen || videoTestElement.audioTracks;
|
||||
|
||||
var aacCodecProfileConditions = [];
|
||||
const aacCodecProfileConditions = [];
|
||||
|
||||
// Handle he-aac not supported
|
||||
if (!videoTestElement.canPlayType('video/mp4; codecs="avc1.640029, mp4a.40.5"').replace(/no/, '')) {
|
||||
|
@ -694,8 +706,8 @@ define(['browser'], function (browser) {
|
|||
});
|
||||
}
|
||||
|
||||
var maxH264Level = 42;
|
||||
var h264Profiles = 'high|main|baseline|constrained baseline';
|
||||
let maxH264Level = 42;
|
||||
let h264Profiles = 'high|main|baseline|constrained baseline';
|
||||
|
||||
if (browser.tizen || browser.web0s ||
|
||||
videoTestElement.canPlayType('video/mp4; codecs="avc1.640833"').replace(/no/, '')) {
|
||||
|
@ -754,9 +766,9 @@ define(['browser'], function (browser) {
|
|||
});
|
||||
}
|
||||
|
||||
var globalMaxVideoBitrate = (getGlobalMaxVideoBitrate() || '').toString();
|
||||
const globalMaxVideoBitrate = (getGlobalMaxVideoBitrate() || '').toString();
|
||||
|
||||
var h264MaxVideoBitrate = globalMaxVideoBitrate;
|
||||
const h264MaxVideoBitrate = globalMaxVideoBitrate;
|
||||
|
||||
if (h264MaxVideoBitrate) {
|
||||
h264CodecProfileConditions.push({
|
||||
|
@ -794,7 +806,7 @@ define(['browser'], function (browser) {
|
|||
Conditions: h264CodecProfileConditions
|
||||
});
|
||||
|
||||
var globalVideoConditions = [];
|
||||
const globalVideoConditions = [];
|
||||
|
||||
if (globalMaxVideoBitrate) {
|
||||
globalVideoConditions.push({
|
||||
|
|
|
@ -48,7 +48,7 @@ export function onServerChanged(userId, accessToken, apiClient) {
|
|||
}
|
||||
|
||||
export function logout() {
|
||||
ConnectionManager.logout().then(function () {
|
||||
window.connectionManager.logout().then(function () {
|
||||
let loginPage;
|
||||
|
||||
if (AppInfo.isNativeApp) {
|
||||
|
@ -62,20 +62,10 @@ export function logout() {
|
|||
});
|
||||
}
|
||||
|
||||
export function getConfigurationPageUrl(name) {
|
||||
export function getPluginUrl(name) {
|
||||
return 'configurationpage?name=' + encodeURIComponent(name);
|
||||
}
|
||||
|
||||
export function getConfigurationResourceUrl(name) {
|
||||
if (AppInfo.isNativeApp) {
|
||||
return ApiClient.getUrl('web/ConfigurationPage', {
|
||||
name: name
|
||||
});
|
||||
}
|
||||
|
||||
return getConfigurationPageUrl(name);
|
||||
}
|
||||
|
||||
export function navigate(url, preserveQueryString) {
|
||||
if (!url) {
|
||||
throw new Error('url cannot be null or empty');
|
||||
|
@ -151,7 +141,7 @@ export function alert(options) {
|
|||
}
|
||||
|
||||
export function capabilities(appHost) {
|
||||
let capabilities = {
|
||||
const capabilities = {
|
||||
PlayableMediaTypes: ['Audio', 'Video'],
|
||||
SupportedCommands: ['MoveUp', 'MoveDown', 'MoveLeft', 'MoveRight', 'PageUp', 'PageDown', 'PreviousLetter', 'NextLetter', 'ToggleOsd', 'ToggleContextMenu', 'Select', 'Back', 'SendKey', 'SendString', 'GoHome', 'GoToSettings', 'VolumeUp', 'VolumeDown', 'Mute', 'Unmute', 'ToggleMute', 'SetVolume', 'SetAudioStreamIndex', 'SetSubtitleStreamIndex', 'DisplayContent', 'GoToSearch', 'DisplayMessage', 'SetRepeatMode', 'SetShuffleQueue', 'ChannelUp', 'ChannelDown', 'PlayMediaSource', 'PlayTrailers'],
|
||||
SupportsPersistentIdentifier: window.appMode === 'cordova' || window.appMode === 'android',
|
||||
|
@ -196,8 +186,7 @@ window.Dashboard = {
|
|||
alert,
|
||||
capabilities,
|
||||
confirm,
|
||||
getConfigurationPageUrl,
|
||||
getConfigurationResourceUrl,
|
||||
getPluginUrl,
|
||||
getCurrentUser,
|
||||
getCurrentUserId,
|
||||
hideLoadingMsg,
|
||||
|
@ -216,8 +205,7 @@ export default {
|
|||
alert,
|
||||
capabilities,
|
||||
confirm,
|
||||
getConfigurationPageUrl,
|
||||
getConfigurationResourceUrl,
|
||||
getPluginUrl,
|
||||
getCurrentUser,
|
||||
getCurrentUserId,
|
||||
hideLoadingMsg,
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import connectionManager from 'connectionManager';
|
||||
import confirm from 'confirm';
|
||||
import appRouter from 'appRouter';
|
||||
import globalize from 'globalize';
|
||||
|
@ -15,7 +14,7 @@ export function deleteItem(options) {
|
|||
const item = options.item;
|
||||
const parentId = item.SeasonId || item.SeriesId || item.ParentId;
|
||||
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
return confirm({
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import 'material-icons';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function getNode(item, folderState, selected) {
|
||||
var htmlName = getNodeInnerHtml(item);
|
||||
var node = {
|
||||
const htmlName = getNodeInnerHtml(item);
|
||||
const node = {
|
||||
id: item.Id,
|
||||
text: htmlName,
|
||||
state: {
|
||||
|
@ -37,14 +37,14 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function getNodeInnerHtml(item) {
|
||||
var name = item.Name;
|
||||
let name = item.Name;
|
||||
if (item.Number) {
|
||||
name = item.Number + ' - ' + name;
|
||||
}
|
||||
if (item.IndexNumber != null && item.Type != 'Season') {
|
||||
name = item.IndexNumber + ' - ' + name;
|
||||
}
|
||||
var htmlName = "<div class='editorNode'>";
|
||||
let htmlName = "<div class='editorNode'>";
|
||||
if (item.IsFolder) {
|
||||
htmlName += '<span class="material-icons metadataSidebarIcon folder"></span>';
|
||||
} else if (item.MediaType === 'Video') {
|
||||
|
@ -70,7 +70,7 @@ import 'material-icons';
|
|||
ApiClient.getLiveTvChannels({
|
||||
limit: 0
|
||||
}).then(function (result) {
|
||||
var nodes = [];
|
||||
const nodes = [];
|
||||
nodes.push({
|
||||
id: 'MediaFolders',
|
||||
text: globalize.translate('HeaderMediaFolders'),
|
||||
|
@ -110,8 +110,8 @@ import 'material-icons';
|
|||
ServiceName: service,
|
||||
AddCurrentProgram: false
|
||||
}).then(function (result) {
|
||||
var nodes = result.Items.map(function (i) {
|
||||
var state = openItems.indexOf(i.Id) == -1 ? 'closed' : 'open';
|
||||
const nodes = result.Items.map(function (i) {
|
||||
const state = openItems.indexOf(i.Id) == -1 ? 'closed' : 'open';
|
||||
return getNode(i, state, false);
|
||||
});
|
||||
callback(nodes);
|
||||
|
@ -120,12 +120,12 @@ import 'material-icons';
|
|||
|
||||
function loadMediaFolders(page, scope, openItems, callback) {
|
||||
ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders')).then(function (result) {
|
||||
var nodes = result.Items.map(function (n) {
|
||||
var state = openItems.indexOf(n.Id) == -1 ? 'closed' : 'open';
|
||||
const nodes = result.Items.map(function (n) {
|
||||
const state = openItems.indexOf(n.Id) == -1 ? 'closed' : 'open';
|
||||
return getNode(n, state, false);
|
||||
});
|
||||
callback.call(scope, nodes);
|
||||
for (var i = 0, length = nodes.length; i < length; i++) {
|
||||
for (let i = 0, length = nodes.length; i < length; i++) {
|
||||
if (nodes[i].state.opened) {
|
||||
nodesToLoad.push(nodes[i].id);
|
||||
}
|
||||
|
@ -134,7 +134,7 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function loadNode(page, scope, node, openItems, selectedId, currentUser, callback) {
|
||||
var id = node.id;
|
||||
const id = node.id;
|
||||
if (id == '#') {
|
||||
loadChildrenOfRootNode(page, scope, callback);
|
||||
return;
|
||||
|
@ -147,7 +147,7 @@ import 'material-icons';
|
|||
loadMediaFolders(page, scope, openItems, callback);
|
||||
return;
|
||||
}
|
||||
var query = {
|
||||
const query = {
|
||||
ParentId: id,
|
||||
Fields: 'Settings',
|
||||
IsVirtualUnaired: false,
|
||||
|
@ -156,17 +156,17 @@ import 'material-icons';
|
|||
EnableImages: false,
|
||||
EnableUserData: false
|
||||
};
|
||||
var itemtype = node.li_attr.itemtype;
|
||||
const itemtype = node.li_attr.itemtype;
|
||||
if (itemtype != 'Season' && itemtype != 'Series') {
|
||||
query.SortBy = 'SortName';
|
||||
}
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||
var nodes = result.Items.map(function (n) {
|
||||
var state = openItems.indexOf(n.Id) == -1 ? 'closed' : 'open';
|
||||
const nodes = result.Items.map(function (n) {
|
||||
const state = openItems.indexOf(n.Id) == -1 ? 'closed' : 'open';
|
||||
return getNode(n, state, n.Id == selectedId);
|
||||
});
|
||||
callback.call(scope, nodes);
|
||||
for (var i = 0, length = nodes.length; i < length; i++) {
|
||||
for (let i = 0, length = nodes.length; i < length; i++) {
|
||||
if (nodes[i].state.opened) {
|
||||
nodesToLoad.push(nodes[i].id);
|
||||
}
|
||||
|
@ -175,7 +175,7 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function scrollToNode(id) {
|
||||
var elem = $('#' + id)[0];
|
||||
const elem = $('#' + id)[0];
|
||||
if (elem) {
|
||||
elem.scrollIntoView();
|
||||
}
|
||||
|
@ -188,8 +188,8 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function onNodeSelect(event, data) {
|
||||
var node = data.node;
|
||||
var eventData = {
|
||||
const node = data.node;
|
||||
const eventData = {
|
||||
id: node.id,
|
||||
itemType: node.li_attr.itemtype,
|
||||
serverItemType: node.li_attr.serveritemtype,
|
||||
|
@ -210,8 +210,8 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function onNodeOpen(event, data) {
|
||||
var page = $(this).parents('.page')[0];
|
||||
var node = data.node;
|
||||
const page = $(this).parents('.page')[0];
|
||||
const node = data.node;
|
||||
if (node.children) {
|
||||
loadNodesToLoad(page, node);
|
||||
}
|
||||
|
@ -222,8 +222,8 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function onNodeLoad(event, data) {
|
||||
var page = $(this).parents('.page')[0];
|
||||
var node = data.node;
|
||||
const page = $(this).parents('.page')[0];
|
||||
const node = data.node;
|
||||
if (node.children) {
|
||||
loadNodesToLoad(page, node);
|
||||
}
|
||||
|
@ -252,9 +252,9 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function loadNodesToLoad(page, node) {
|
||||
var children = node.children;
|
||||
for (var i = 0, length = children.length; i < length; i++) {
|
||||
var child = children[i];
|
||||
const children = node.children;
|
||||
for (let i = 0, length = children.length; i < length; i++) {
|
||||
const child = children[i];
|
||||
if (nodesToLoad.indexOf(child) != -1) {
|
||||
nodesToLoad = nodesToLoad.filter(function (n) {
|
||||
return n != child;
|
||||
|
@ -273,15 +273,15 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function updateEditorNode(page, item) {
|
||||
var elem = $('#' + item.Id + '>a', page)[0];
|
||||
const elem = $('#' + item.Id + '>a', page)[0];
|
||||
if (elem == null) {
|
||||
return;
|
||||
}
|
||||
$('.editorNode', elem).remove();
|
||||
$(elem).append(getNodeInnerHtml(item));
|
||||
if (item.IsFolder) {
|
||||
var tree = jQuery.jstree._reference('.libraryTree');
|
||||
var currentNode = tree._get_node(null, false);
|
||||
const tree = jQuery.jstree._reference('.libraryTree');
|
||||
const currentNode = tree._get_node(null, false);
|
||||
tree.refresh(currentNode);
|
||||
}
|
||||
}
|
||||
|
@ -294,23 +294,23 @@ import 'material-icons';
|
|||
if (itemId) {
|
||||
return itemId;
|
||||
}
|
||||
var url = window.location.hash || window.location.href;
|
||||
const url = window.location.hash || window.location.href;
|
||||
return getParameterByName('id', url);
|
||||
}
|
||||
var nodesToLoad = [];
|
||||
var selectedNodeId;
|
||||
let nodesToLoad = [];
|
||||
let selectedNodeId;
|
||||
$(document).on('itemsaved', '.metadataEditorPage', function (e, item) {
|
||||
updateEditorNode(this, item);
|
||||
}).on('pagebeforeshow', '.metadataEditorPage', function () {
|
||||
/* eslint-disable-next-line @babel/no-unused-expressions */
|
||||
import('css!assets/css/metadataeditor.css');
|
||||
}).on('pagebeforeshow', '.metadataEditorPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
Dashboard.getCurrentUser().then(function (user) {
|
||||
var id = getCurrentItemId();
|
||||
const id = getCurrentItemId();
|
||||
if (id) {
|
||||
ApiClient.getAncestorItems(id, user.Id).then(function (ancestors) {
|
||||
var ids = ancestors.map(function (i) {
|
||||
const ids = ancestors.map(function (i) {
|
||||
return i.Id;
|
||||
});
|
||||
initializeTree(page, user, ids, id);
|
||||
|
@ -320,13 +320,13 @@ import 'material-icons';
|
|||
}
|
||||
});
|
||||
}).on('pagebeforehide', '.metadataEditorPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('.libraryTree', page).off('select_node.jstree', onNodeSelect).off('open_node.jstree', onNodeOpen).off('load_node.jstree', onNodeLoad);
|
||||
});
|
||||
var itemId;
|
||||
let itemId;
|
||||
window.MetadataEditor = {
|
||||
getItemPromise: function () {
|
||||
var currentItemId = getCurrentItemId();
|
||||
const currentItemId = getCurrentItemId();
|
||||
if (currentItemId) {
|
||||
return ApiClient.getItem(Dashboard.getCurrentUserId(), currentItemId);
|
||||
}
|
||||
|
|
|
@ -1,11 +1,8 @@
|
|||
import multiDownload from 'multi-download';
|
||||
import shell from 'shell';
|
||||
|
||||
export function download(items) {
|
||||
if (window.NativeShell) {
|
||||
items.map(function (item) {
|
||||
window.NativeShell.downloadFile(item);
|
||||
});
|
||||
} else {
|
||||
if (!shell.downloadFiles(items)) {
|
||||
multiDownload(items.map(function (item) {
|
||||
return item.url;
|
||||
}));
|
||||
|
|
|
@ -22,47 +22,47 @@
|
|||
|
||||
import appHost from 'apphost';
|
||||
|
||||
var _GAMEPAD_A_BUTTON_INDEX = 0;
|
||||
var _GAMEPAD_B_BUTTON_INDEX = 1;
|
||||
var _GAMEPAD_DPAD_UP_BUTTON_INDEX = 12;
|
||||
var _GAMEPAD_DPAD_DOWN_BUTTON_INDEX = 13;
|
||||
var _GAMEPAD_DPAD_LEFT_BUTTON_INDEX = 14;
|
||||
var _GAMEPAD_DPAD_RIGHT_BUTTON_INDEX = 15;
|
||||
var _GAMEPAD_A_KEY = 'GamepadA';
|
||||
var _GAMEPAD_B_KEY = 'GamepadB';
|
||||
var _GAMEPAD_DPAD_UP_KEY = 'GamepadDPadUp';
|
||||
var _GAMEPAD_DPAD_DOWN_KEY = 'GamepadDPadDown';
|
||||
var _GAMEPAD_DPAD_LEFT_KEY = 'GamepadDPadLeft';
|
||||
var _GAMEPAD_DPAD_RIGHT_KEY = 'GamepadDPadRight';
|
||||
var _GAMEPAD_LEFT_THUMBSTICK_UP_KEY = 'GamepadLeftThumbStickUp';
|
||||
var _GAMEPAD_LEFT_THUMBSTICK_DOWN_KEY = 'GamepadLeftThumbStickDown';
|
||||
var _GAMEPAD_LEFT_THUMBSTICK_LEFT_KEY = 'GamepadLeftThumbStickLeft';
|
||||
var _GAMEPAD_LEFT_THUMBSTICK_RIGHT_KEY = 'GamepadLeftThumbStickRight';
|
||||
var _GAMEPAD_A_KEYCODE = 0;
|
||||
var _GAMEPAD_B_KEYCODE = 27;
|
||||
var _GAMEPAD_DPAD_UP_KEYCODE = 38;
|
||||
var _GAMEPAD_DPAD_DOWN_KEYCODE = 40;
|
||||
var _GAMEPAD_DPAD_LEFT_KEYCODE = 37;
|
||||
var _GAMEPAD_DPAD_RIGHT_KEYCODE = 39;
|
||||
var _GAMEPAD_LEFT_THUMBSTICK_UP_KEYCODE = 38;
|
||||
var _GAMEPAD_LEFT_THUMBSTICK_DOWN_KEYCODE = 40;
|
||||
var _GAMEPAD_LEFT_THUMBSTICK_LEFT_KEYCODE = 37;
|
||||
var _GAMEPAD_LEFT_THUMBSTICK_RIGHT_KEYCODE = 39;
|
||||
var _THUMB_STICK_THRESHOLD = 0.75;
|
||||
const _GAMEPAD_A_BUTTON_INDEX = 0;
|
||||
const _GAMEPAD_B_BUTTON_INDEX = 1;
|
||||
const _GAMEPAD_DPAD_UP_BUTTON_INDEX = 12;
|
||||
const _GAMEPAD_DPAD_DOWN_BUTTON_INDEX = 13;
|
||||
const _GAMEPAD_DPAD_LEFT_BUTTON_INDEX = 14;
|
||||
const _GAMEPAD_DPAD_RIGHT_BUTTON_INDEX = 15;
|
||||
const _GAMEPAD_A_KEY = 'GamepadA';
|
||||
const _GAMEPAD_B_KEY = 'GamepadB';
|
||||
const _GAMEPAD_DPAD_UP_KEY = 'GamepadDPadUp';
|
||||
const _GAMEPAD_DPAD_DOWN_KEY = 'GamepadDPadDown';
|
||||
const _GAMEPAD_DPAD_LEFT_KEY = 'GamepadDPadLeft';
|
||||
const _GAMEPAD_DPAD_RIGHT_KEY = 'GamepadDPadRight';
|
||||
const _GAMEPAD_LEFT_THUMBSTICK_UP_KEY = 'GamepadLeftThumbStickUp';
|
||||
const _GAMEPAD_LEFT_THUMBSTICK_DOWN_KEY = 'GamepadLeftThumbStickDown';
|
||||
const _GAMEPAD_LEFT_THUMBSTICK_LEFT_KEY = 'GamepadLeftThumbStickLeft';
|
||||
const _GAMEPAD_LEFT_THUMBSTICK_RIGHT_KEY = 'GamepadLeftThumbStickRight';
|
||||
const _GAMEPAD_A_KEYCODE = 0;
|
||||
const _GAMEPAD_B_KEYCODE = 27;
|
||||
const _GAMEPAD_DPAD_UP_KEYCODE = 38;
|
||||
const _GAMEPAD_DPAD_DOWN_KEYCODE = 40;
|
||||
const _GAMEPAD_DPAD_LEFT_KEYCODE = 37;
|
||||
const _GAMEPAD_DPAD_RIGHT_KEYCODE = 39;
|
||||
const _GAMEPAD_LEFT_THUMBSTICK_UP_KEYCODE = 38;
|
||||
const _GAMEPAD_LEFT_THUMBSTICK_DOWN_KEYCODE = 40;
|
||||
const _GAMEPAD_LEFT_THUMBSTICK_LEFT_KEYCODE = 37;
|
||||
const _GAMEPAD_LEFT_THUMBSTICK_RIGHT_KEYCODE = 39;
|
||||
const _THUMB_STICK_THRESHOLD = 0.75;
|
||||
|
||||
var _leftThumbstickUpPressed = false;
|
||||
var _leftThumbstickDownPressed = false;
|
||||
var _leftThumbstickLeftPressed = false;
|
||||
var _leftThumbstickRightPressed = false;
|
||||
var _dPadUpPressed = false;
|
||||
var _dPadDownPressed = false;
|
||||
var _dPadLeftPressed = false;
|
||||
var _dPadRightPressed = false;
|
||||
var _gamepadAPressed = false;
|
||||
var _gamepadBPressed = false;
|
||||
let _leftThumbstickUpPressed = false;
|
||||
let _leftThumbstickDownPressed = false;
|
||||
let _leftThumbstickLeftPressed = false;
|
||||
let _leftThumbstickRightPressed = false;
|
||||
let _dPadUpPressed = false;
|
||||
let _dPadDownPressed = false;
|
||||
let _dPadLeftPressed = false;
|
||||
let _dPadRightPressed = false;
|
||||
let _gamepadAPressed = false;
|
||||
let _gamepadBPressed = false;
|
||||
|
||||
// The set of buttons on the gamepad we listen for.
|
||||
var ProcessedButtons = [
|
||||
const ProcessedButtons = [
|
||||
_GAMEPAD_DPAD_UP_BUTTON_INDEX,
|
||||
_GAMEPAD_DPAD_DOWN_BUTTON_INDEX,
|
||||
_GAMEPAD_DPAD_LEFT_BUTTON_INDEX,
|
||||
|
@ -71,7 +71,7 @@ var ProcessedButtons = [
|
|||
_GAMEPAD_B_BUTTON_INDEX
|
||||
];
|
||||
|
||||
var _ButtonPressedState = {};
|
||||
const _ButtonPressedState = {};
|
||||
_ButtonPressedState.getgamepadA = function () {
|
||||
return _gamepadAPressed;
|
||||
};
|
||||
|
@ -162,11 +162,11 @@ _ButtonPressedState.setdPadRight = function (newPressedState) {
|
|||
_dPadRightPressed = newPressedState;
|
||||
};
|
||||
|
||||
var times = {};
|
||||
const times = {};
|
||||
|
||||
function throttle(key) {
|
||||
var time = times[key] || 0;
|
||||
var now = new Date().getTime();
|
||||
const time = times[key] || 0;
|
||||
const now = new Date().getTime();
|
||||
|
||||
if ((now - time) >= 200) {
|
||||
//times[key] = now;
|
||||
|
@ -180,7 +180,7 @@ function resetThrottle(key) {
|
|||
times[key] = new Date().getTime();
|
||||
}
|
||||
|
||||
var isElectron = navigator.userAgent.toLowerCase().indexOf('electron') !== -1;
|
||||
const isElectron = navigator.userAgent.toLowerCase().indexOf('electron') !== -1;
|
||||
function allowInput() {
|
||||
// This would be nice but always seems to return true with electron
|
||||
if (!isElectron && document.hidden) { /* eslint-disable-line compat/compat */
|
||||
|
@ -199,7 +199,7 @@ function raiseEvent(name, key, keyCode) {
|
|||
return;
|
||||
}
|
||||
|
||||
var event = document.createEvent('Event');
|
||||
const event = document.createEvent('Event');
|
||||
event.initEvent(name, true, true);
|
||||
event.key = key;
|
||||
event.keyCode = keyCode;
|
||||
|
@ -218,7 +218,7 @@ function raiseKeyEvent(oldPressedState, newPressedState, key, keyCode, enableRep
|
|||
// No-op if oldPressedState === newPressedState
|
||||
if (newPressedState === true) {
|
||||
// button down
|
||||
var fire = false;
|
||||
let fire = false;
|
||||
|
||||
// always fire if this is the initial down press
|
||||
if (oldPressedState === false) {
|
||||
|
@ -244,19 +244,19 @@ function raiseKeyEvent(oldPressedState, newPressedState, key, keyCode, enableRep
|
|||
}
|
||||
}
|
||||
|
||||
var inputLoopTimer;
|
||||
let inputLoopTimer;
|
||||
function runInputLoop() {
|
||||
// Get the latest gamepad state.
|
||||
var gamepads = navigator.getGamepads(); /* eslint-disable-line compat/compat */
|
||||
for (var i = 0, len = gamepads.length; i < len; i++) {
|
||||
var gamepad = gamepads[i];
|
||||
const gamepads = navigator.getGamepads(); /* eslint-disable-line compat/compat */
|
||||
for (let i = 0, len = gamepads.length; i < len; i++) {
|
||||
const gamepad = gamepads[i];
|
||||
if (!gamepad) {
|
||||
continue;
|
||||
}
|
||||
// Iterate through the axes
|
||||
var axes = gamepad.axes;
|
||||
var leftStickX = axes[0];
|
||||
var leftStickY = axes[1];
|
||||
const axes = gamepad.axes;
|
||||
const leftStickX = axes[0];
|
||||
const leftStickY = axes[1];
|
||||
if (leftStickX > _THUMB_STICK_THRESHOLD) { // Right
|
||||
_ButtonPressedState.setleftThumbstickRight(true);
|
||||
} else if (leftStickX < -_THUMB_STICK_THRESHOLD) { // Left
|
||||
|
@ -272,8 +272,8 @@ function runInputLoop() {
|
|||
_ButtonPressedState.setleftThumbstickDown(false);
|
||||
}
|
||||
// Iterate through the buttons to see if Left thumbstick, DPad, A and B are pressed.
|
||||
var buttons = gamepad.buttons;
|
||||
for (var j = 0, len = buttons.length; j < len; j++) {
|
||||
const buttons = gamepad.buttons;
|
||||
for (let j = 0, len = buttons.length; j < len; j++) {
|
||||
if (ProcessedButtons.indexOf(j) !== -1) {
|
||||
if (buttons[j].pressed) {
|
||||
switch (j) {
|
||||
|
@ -355,9 +355,9 @@ function stopInputLoop() {
|
|||
}
|
||||
|
||||
function isGamepadConnected() {
|
||||
var gamepads = navigator.getGamepads(); /* eslint-disable-line compat/compat */
|
||||
for (var i = 0, len = gamepads.length; i < len; i++) {
|
||||
var gamepad = gamepads[i];
|
||||
const gamepads = navigator.getGamepads(); /* eslint-disable-line compat/compat */
|
||||
for (let i = 0, len = gamepads.length; i < len; i++) {
|
||||
const gamepad = gamepads[i];
|
||||
if (gamepad && gamepad.connected) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
/* eslint-disable indent */
|
||||
|
||||
export function getDeviceIcon(device) {
|
||||
var baseUrl = 'assets/img/devices/';
|
||||
const baseUrl = 'assets/img/devices/';
|
||||
switch (device.AppName || device.Client) {
|
||||
case 'Samsung Smart TV':
|
||||
return baseUrl + 'samsung.svg';
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import connectionManager from 'connectionManager';
|
||||
import listView from 'listView';
|
||||
import cardBuilder from 'cardBuilder';
|
||||
import imageLoader from 'imageLoader';
|
||||
|
@ -60,7 +59,7 @@ function renderItems(page, item) {
|
|||
|
||||
if (item.MusicVideoCount) {
|
||||
sections.push({
|
||||
name: globalize.translate('HeaderMusicVideos'),
|
||||
name: globalize.translate('MusicVideos'),
|
||||
type: 'MusicVideo'
|
||||
});
|
||||
}
|
||||
|
@ -358,7 +357,7 @@ function getItemsFunction(options, item) {
|
|||
query.Fields += ',' + fields;
|
||||
}
|
||||
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = window.connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
if (query.IncludeItemTypes === 'MusicArtist') {
|
||||
query.IncludeItemTypes = null;
|
||||
|
|
|
@ -6,7 +6,7 @@ export function getSavedQueryKey(modifier) {
|
|||
}
|
||||
|
||||
export function loadSavedQueryValues(key, query) {
|
||||
var values = userSettings.get(key);
|
||||
let values = userSettings.get(key);
|
||||
|
||||
if (values) {
|
||||
values = JSON.parse(values);
|
||||
|
@ -17,7 +17,7 @@ export function loadSavedQueryValues(key, query) {
|
|||
}
|
||||
|
||||
export function saveQueryValues(key, query) {
|
||||
var values = {};
|
||||
const values = {};
|
||||
|
||||
if (query.SortBy) {
|
||||
values.SortBy = query.SortBy;
|
||||
|
@ -39,7 +39,7 @@ export function getSavedView (key) {
|
|||
}
|
||||
|
||||
export function showLayoutMenu (button, currentLayout, views) {
|
||||
var dispatchEvent = true;
|
||||
let dispatchEvent = true;
|
||||
|
||||
if (!views) {
|
||||
dispatchEvent = false;
|
||||
|
@ -47,9 +47,9 @@ export function showLayoutMenu (button, currentLayout, views) {
|
|||
views = views ? views.split(',') : ['List', 'Poster', 'PosterCard', 'Thumb', 'ThumbCard'];
|
||||
}
|
||||
|
||||
var menuItems = views.map(function (v) {
|
||||
const menuItems = views.map(function (v) {
|
||||
return {
|
||||
name: globalize.translate('Option' + v),
|
||||
name: globalize.translate(v),
|
||||
id: v,
|
||||
selected: currentLayout == v
|
||||
};
|
||||
|
@ -79,12 +79,12 @@ export function showLayoutMenu (button, currentLayout, views) {
|
|||
}
|
||||
|
||||
export function getQueryPagingHtml (options) {
|
||||
var startIndex = options.startIndex;
|
||||
var limit = options.limit;
|
||||
var totalRecordCount = options.totalRecordCount;
|
||||
var html = '';
|
||||
var recordsEnd = Math.min(startIndex + limit, totalRecordCount);
|
||||
var showControls = limit < totalRecordCount;
|
||||
const startIndex = options.startIndex;
|
||||
const limit = options.limit;
|
||||
const totalRecordCount = options.totalRecordCount;
|
||||
let html = '';
|
||||
const recordsEnd = Math.min(startIndex + limit, totalRecordCount);
|
||||
const showControls = limit < totalRecordCount;
|
||||
|
||||
if (html += '<div class="listPaging">', showControls) {
|
||||
html += '<span style="vertical-align:middle;">';
|
||||
|
@ -124,10 +124,10 @@ export function showSortMenu (options) {
|
|||
import('emby-radio')
|
||||
]).then(([{default: dialogHelper}]) => {
|
||||
function onSortByChange() {
|
||||
var newValue = this.value;
|
||||
const newValue = this.value;
|
||||
|
||||
if (this.checked) {
|
||||
var changed = options.query.SortBy != newValue;
|
||||
const changed = options.query.SortBy != newValue;
|
||||
options.query.SortBy = newValue.replace('_', ',');
|
||||
options.query.StartIndex = 0;
|
||||
|
||||
|
@ -138,10 +138,10 @@ export function showSortMenu (options) {
|
|||
}
|
||||
|
||||
function onSortOrderChange() {
|
||||
var newValue = this.value;
|
||||
const newValue = this.value;
|
||||
|
||||
if (this.checked) {
|
||||
var changed = options.query.SortOrder != newValue;
|
||||
const changed = options.query.SortOrder != newValue;
|
||||
options.query.SortOrder = newValue;
|
||||
options.query.StartIndex = 0;
|
||||
|
||||
|
@ -151,7 +151,7 @@ export function showSortMenu (options) {
|
|||
}
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog({
|
||||
const dlg = dialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
modal: false,
|
||||
entryAnimationDuration: 160,
|
||||
|
@ -160,18 +160,18 @@ export function showSortMenu (options) {
|
|||
dlg.classList.add('ui-body-a');
|
||||
dlg.classList.add('background-theme-a');
|
||||
dlg.classList.add('formDialog');
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<div style="margin:0;padding:1.25em 1.5em 1.5em;">';
|
||||
html += '<h2 style="margin:0 0 .5em;">';
|
||||
html += globalize.translate('HeaderSortBy');
|
||||
html += '</h2>';
|
||||
var i;
|
||||
var length;
|
||||
var isChecked;
|
||||
let i;
|
||||
let length;
|
||||
let isChecked;
|
||||
html += '<div>';
|
||||
for (i = 0, length = options.items.length; i < length; i++) {
|
||||
var option = options.items[i];
|
||||
var radioValue = option.id.replace(',', '_');
|
||||
const option = options.items[i];
|
||||
const radioValue = option.id.replace(',', '_');
|
||||
isChecked = (options.query.SortBy || '').replace(',', '_') == radioValue ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortBy" data-id="' + option.id + '" value="' + radioValue + '" class="menuSortBy" ' + isChecked + ' /><span>' + option.name + '</span></label>';
|
||||
}
|
||||
|
@ -182,20 +182,20 @@ export function showSortMenu (options) {
|
|||
html += '</h2>';
|
||||
html += '<div>';
|
||||
isChecked = options.query.SortOrder == 'Ascending' ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Ascending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionAscending') + '</span></label>';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Ascending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('Ascending') + '</span></label>';
|
||||
isChecked = options.query.SortOrder == 'Descending' ? ' checked' : '';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Descending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('OptionDescending') + '</span></label>';
|
||||
html += '<label class="radio-label-block"><input type="radio" is="emby-radio" name="SortOrder" value="Descending" class="menuSortOrder" ' + isChecked + ' /><span>' + globalize.translate('Descending') + '</span></label>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
dlg.innerHTML = html;
|
||||
dialogHelper.open(dlg);
|
||||
var sortBys = dlg.querySelectorAll('.menuSortBy');
|
||||
const sortBys = dlg.querySelectorAll('.menuSortBy');
|
||||
|
||||
for (i = 0, length = sortBys.length; i < length; i++) {
|
||||
sortBys[i].addEventListener('change', onSortByChange);
|
||||
}
|
||||
|
||||
var sortOrders = dlg.querySelectorAll('.menuSortOrder');
|
||||
const sortOrders = dlg.querySelectorAll('.menuSortOrder');
|
||||
|
||||
for (i = 0, length = sortOrders.length; i < length; i++) {
|
||||
sortOrders[i].addEventListener('change', onSortOrderChange);
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
import dom from 'dom';
|
||||
import layoutManager from 'layoutManager';
|
||||
import inputManager from 'inputManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import events from 'events';
|
||||
import viewManager from 'viewManager';
|
||||
import appRouter from 'appRouter';
|
||||
|
@ -30,10 +29,10 @@ import 'flexStyles';
|
|||
html += '</div>';
|
||||
html += '<div class="headerRight">';
|
||||
html += '<span class="headerSelectedPlayer"></span>';
|
||||
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('Search')}"><span class="material-icons search"></span></button>`;
|
||||
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="headerButton headerButtonRight headerUserButton hide"><span class="material-icons person"></span></button>';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
@ -44,23 +43,27 @@ import 'flexStyles';
|
|||
skinHeader.classList.add('skinHeader-blurred');
|
||||
skinHeader.innerHTML = html;
|
||||
|
||||
headerBackButton = skinHeader.querySelector('.headerBackButton');
|
||||
headerHomeButton = skinHeader.querySelector('.headerHomeButton');
|
||||
mainDrawerButton = skinHeader.querySelector('.mainDrawerButton');
|
||||
headerUserButton = skinHeader.querySelector('.headerUserButton');
|
||||
headerCastButton = skinHeader.querySelector('.headerCastButton');
|
||||
headerAudioPlayerButton = skinHeader.querySelector('.headerAudioPlayerButton');
|
||||
headerSearchButton = skinHeader.querySelector('.headerSearchButton');
|
||||
headerSyncButton = skinHeader.querySelector('.headerSyncButton');
|
||||
|
||||
retranslateUi();
|
||||
lazyLoadViewMenuBarImages();
|
||||
bindMenuEvents();
|
||||
updateCastIcon();
|
||||
}
|
||||
|
||||
function getCurrentApiClient() {
|
||||
if (currentUser && currentUser.localUser) {
|
||||
return connectionManager.getApiClient(currentUser.localUser.ServerId);
|
||||
return window.connectionManager.getApiClient(currentUser.localUser.ServerId);
|
||||
}
|
||||
|
||||
return connectionManager.currentApiClient();
|
||||
return window.connectionManager.currentApiClient();
|
||||
}
|
||||
|
||||
function lazyLoadViewMenuBarImages() {
|
||||
|
@ -73,7 +76,27 @@ import 'flexStyles';
|
|||
appRouter.back();
|
||||
}
|
||||
|
||||
function retranslateUi() {
|
||||
if (headerSyncButton) {
|
||||
headerSyncButton.title = globalize.translate('ButtonSyncPlay');
|
||||
}
|
||||
|
||||
if (headerAudioPlayerButton) {
|
||||
headerAudioPlayerButton.title = globalize.translate('ButtonPlayer');
|
||||
}
|
||||
|
||||
if (headerCastButton) {
|
||||
headerCastButton.title = globalize.translate('ButtonCast');
|
||||
}
|
||||
|
||||
if (headerSearchButton) {
|
||||
headerSearchButton.title = globalize.translate('Search');
|
||||
}
|
||||
}
|
||||
|
||||
function updateUserInHeader(user) {
|
||||
retranslateUi();
|
||||
|
||||
let hasImage;
|
||||
|
||||
if (user && user.name) {
|
||||
|
@ -151,14 +174,10 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function bindMenuEvents() {
|
||||
mainDrawerButton = document.querySelector('.mainDrawerButton');
|
||||
|
||||
if (mainDrawerButton) {
|
||||
mainDrawerButton.addEventListener('click', toggleMainDrawer);
|
||||
}
|
||||
|
||||
const headerBackButton = skinHeader.querySelector('.headerBackButton');
|
||||
|
||||
if (headerBackButton) {
|
||||
headerBackButton.addEventListener('click', onBackClick);
|
||||
}
|
||||
|
@ -293,10 +312,10 @@ import 'flexStyles';
|
|||
html += '</h3>';
|
||||
|
||||
if (appHost.supports('multiserver')) {
|
||||
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder" data-itemid="selectserver" href="selectserver.html?showuser=1"><span class="material-icons navMenuOptionIcon wifi"></span><span class="navMenuOptionText">' + globalize.translate('ButtonSelectServer') + '</span></a>';
|
||||
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder" data-itemid="selectserver" href="selectserver.html?showuser=1"><span class="material-icons navMenuOptionIcon wifi"></span><span class="navMenuOptionText">' + globalize.translate('SelectServer') + '</span></a>';
|
||||
}
|
||||
|
||||
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder btnSettings" data-itemid="settings" href="#"><span class="material-icons navMenuOptionIcon settings"></span><span class="navMenuOptionText">' + globalize.translate('ButtonSettings') + '</span></a>';
|
||||
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder btnSettings" data-itemid="settings" href="#"><span class="material-icons navMenuOptionIcon settings"></span><span class="navMenuOptionText">' + globalize.translate('Settings') + '</span></a>';
|
||||
html += '<a is="emby-linkbutton" class="navMenuOption lnkMediaFolder btnLogout" data-itemid="logout" href="#"><span class="material-icons navMenuOptionIcon exit_to_app"></span><span class="navMenuOptionText">' + globalize.translate('ButtonSignOut') + '</span></a>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
@ -403,6 +422,12 @@ import 'flexStyles';
|
|||
pageIds: ['devicesPage', 'devicePage'],
|
||||
icon: 'devices'
|
||||
});
|
||||
links.push({
|
||||
name: globalize.translate('QuickConnect'),
|
||||
href: 'quickConnect.html',
|
||||
pageIds: ['quickConnectPage'],
|
||||
icon: 'tap_and_play'
|
||||
});
|
||||
links.push({
|
||||
name: globalize.translate('HeaderActivity'),
|
||||
href: 'serveractivity.html',
|
||||
|
@ -483,8 +508,8 @@ import 'flexStyles';
|
|||
links.push({
|
||||
name: pluginItem.DisplayName,
|
||||
icon: pluginItem.MenuIcon || 'folder',
|
||||
href: Dashboard.getConfigurationPageUrl(pluginItem.Name),
|
||||
pageUrls: [Dashboard.getConfigurationPageUrl(pluginItem.Name)]
|
||||
href: Dashboard.getPluginUrl(pluginItem.Name),
|
||||
pageUrls: [Dashboard.getPluginUrl(pluginItem.Name)]
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -749,7 +774,7 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
if (requiresUserRefresh) {
|
||||
connectionManager.user(getCurrentApiClient()).then(updateUserInHeader);
|
||||
window.connectionManager.user(getCurrentApiClient()).then(updateUserInHeader);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -764,10 +789,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function updateBackButton(page) {
|
||||
if (!headerBackButton) {
|
||||
headerBackButton = document.querySelector('.headerBackButton');
|
||||
}
|
||||
|
||||
if (headerBackButton) {
|
||||
if (page.getAttribute('data-backbutton') !== 'false' && appRouter.canGoBack()) {
|
||||
headerBackButton.classList.remove('hide');
|
||||
|
@ -791,7 +812,7 @@ import 'flexStyles';
|
|||
if (user) {
|
||||
Promise.resolve(user);
|
||||
} else {
|
||||
connectionManager.user(getCurrentApiClient()).then(function (user) {
|
||||
window.connectionManager.user(getCurrentApiClient()).then(function (user) {
|
||||
refreshLibraryInfoInDrawer(user);
|
||||
updateLibraryMenu(user.localUser);
|
||||
});
|
||||
|
@ -955,10 +976,8 @@ import 'flexStyles';
|
|||
updateLibraryNavLinks(page);
|
||||
});
|
||||
|
||||
renderHeader();
|
||||
|
||||
events.on(connectionManager, 'localusersignedin', function (e, user) {
|
||||
const currentApiClient = connectionManager.getApiClient(user.ServerId);
|
||||
events.on(window.connectionManager, 'localusersignedin', function (e, user) {
|
||||
const currentApiClient = window.connectionManager.getApiClient(user.ServerId);
|
||||
|
||||
currentDrawerType = null;
|
||||
currentUser = {
|
||||
|
@ -967,13 +986,13 @@ import 'flexStyles';
|
|||
|
||||
loadNavDrawer();
|
||||
|
||||
connectionManager.user(currentApiClient).then(function (user) {
|
||||
window.connectionManager.user(currentApiClient).then(function (user) {
|
||||
currentUser = user;
|
||||
updateUserInHeader(user);
|
||||
});
|
||||
});
|
||||
|
||||
events.on(connectionManager, 'localusersignedout', function () {
|
||||
events.on(window.connectionManager, 'localusersignedout', function () {
|
||||
currentUser = {};
|
||||
updateUserInHeader();
|
||||
});
|
||||
|
@ -997,6 +1016,7 @@ import 'flexStyles';
|
|||
};
|
||||
|
||||
window.LibraryMenu = LibraryMenu;
|
||||
renderHeader();
|
||||
|
||||
export default LibraryMenu;
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import browser from 'browser';
|
||||
|
||||
function fallback(urls) {
|
||||
var i = 0;
|
||||
let i = 0;
|
||||
|
||||
(function createIframe() {
|
||||
var frame = document.createElement('iframe');
|
||||
const frame = document.createElement('iframe');
|
||||
frame.style.display = 'none';
|
||||
frame.src = urls[i++];
|
||||
document.documentElement.appendChild(frame);
|
||||
|
||||
// the download init has to be sequential otherwise IE only use the first
|
||||
var interval = setInterval(function () {
|
||||
const interval = setInterval(function () {
|
||||
if (frame.contentWindow.document.readyState === 'complete' || frame.contentWindow.document.readyState === 'interactive') {
|
||||
clearInterval(interval);
|
||||
|
||||
|
@ -28,14 +28,14 @@ function fallback(urls) {
|
|||
}
|
||||
|
||||
function sameDomain(url) {
|
||||
var a = document.createElement('a');
|
||||
const a = document.createElement('a');
|
||||
a.href = url;
|
||||
|
||||
return window.location.hostname === a.hostname && window.location.protocol === a.protocol;
|
||||
}
|
||||
|
||||
function download(url) {
|
||||
var a = document.createElement('a');
|
||||
const a = document.createElement('a');
|
||||
a.download = '';
|
||||
a.href = url;
|
||||
// firefox doesn't support `a.click()`...
|
||||
|
@ -51,7 +51,7 @@ export default function (urls) {
|
|||
return fallback(urls);
|
||||
}
|
||||
|
||||
var delay = 0;
|
||||
let delay = 0;
|
||||
|
||||
urls.forEach(function (url) {
|
||||
// the download init has to be sequential for firefox if the urls are not on the same domain
|
||||
|
|
|
@ -3,7 +3,7 @@ define(['listView'], function (listView) {
|
|||
|
||||
function getFetchPlaylistItemsFn(itemId) {
|
||||
return function () {
|
||||
var query = {
|
||||
const query = {
|
||||
Fields: 'PrimaryImageAspectRatio,UserData',
|
||||
EnableImageTypes: 'Primary,Backdrop,Banner,Thumb',
|
||||
UserId: ApiClient.getCurrentUserId()
|
||||
|
@ -28,7 +28,7 @@ define(['listView'], function (listView) {
|
|||
}
|
||||
|
||||
function init(page, item) {
|
||||
var elem = page.querySelector('#childrenContent .itemsContainer');
|
||||
const elem = page.querySelector('#childrenContent .itemsContainer');
|
||||
elem.classList.add('vertical-list');
|
||||
elem.classList.remove('vertical-wrap');
|
||||
elem.enableDragReordering(true);
|
||||
|
|
|
@ -17,7 +17,7 @@ import 'detailtablecss';
|
|||
console.groupCollapsed('defining core routes');
|
||||
|
||||
function defineRoute(newRoute) {
|
||||
var path = newRoute.alias ? newRoute.alias : newRoute.path;
|
||||
const path = newRoute.alias ? newRoute.alias : newRoute.path;
|
||||
console.debug('defining route: ' + path);
|
||||
newRoute.dictionary = 'core';
|
||||
Emby.Page.addRoute(path, newRoute);
|
||||
|
@ -62,11 +62,11 @@ import 'detailtablecss';
|
|||
|
||||
defineRoute({
|
||||
alias: '/forgotpasswordpin.html',
|
||||
path: '/controllers/session/redeemPassword/index.html',
|
||||
path: '/controllers/session/resetPassword/index.html',
|
||||
autoFocus: false,
|
||||
anonymous: true,
|
||||
startup: true,
|
||||
controller: 'session/redeemPassword/index'
|
||||
controller: 'session/resetPassword/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
|
@ -97,6 +97,13 @@ import 'detailtablecss';
|
|||
controller: 'user/home/index'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/mypreferencesquickconnect.html',
|
||||
path: '/controllers/user/quickConnect/index.html',
|
||||
autoFocus: false,
|
||||
transition: 'fade',
|
||||
controller: 'user/quickConnect/index'
|
||||
});
|
||||
defineRoute({
|
||||
alias: '/mypreferencesplayback.html',
|
||||
path: '/controllers/user/playback/index.html',
|
||||
|
@ -151,6 +158,14 @@ import 'detailtablecss';
|
|||
controller: 'dashboard/devices/device'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/quickConnect.html',
|
||||
path: '/controllers/dashboard/quickConnect.html',
|
||||
autoFocus: false,
|
||||
roles: 'admin',
|
||||
controller: 'dashboard/quickConnect'
|
||||
});
|
||||
|
||||
defineRoute({
|
||||
alias: '/dlnaprofile.html',
|
||||
path: '/controllers/dashboard/dlna/profile.html',
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
import connectionManager from 'connectionManager';
|
||||
import playbackManager from 'playbackManager';
|
||||
import syncPlayManager from 'syncPlayManager';
|
||||
import events from 'events';
|
||||
|
@ -208,8 +207,8 @@ function bindEvents(apiClient) {
|
|||
events.on(apiClient, 'message', onMessageReceived);
|
||||
}
|
||||
|
||||
connectionManager.getApiClients().forEach(bindEvents);
|
||||
events.on(connectionManager, 'apiclientcreated', function (e, newApiClient) {
|
||||
window.connectionManager.getApiClients().forEach(bindEvents);
|
||||
events.on(window.connectionManager, 'apiclientcreated', function (e, newApiClient) {
|
||||
bindEvents(newApiClient);
|
||||
});
|
||||
|
||||
|
|
|
@ -209,7 +209,7 @@ export class UserSettings {
|
|||
}
|
||||
|
||||
val = this.get('enableBackdrops', false);
|
||||
return val !== 'false';
|
||||
return val === 'true';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,9 +1,48 @@
|
|||
let data;
|
||||
|
||||
const urlResolver = document.createElement('a');
|
||||
|
||||
// `fetch` with `file:` support
|
||||
// Recent browsers seem to support `file` protocol under some conditions.
|
||||
// Based on https://github.com/github/fetch/pull/92#issuecomment-174730593
|
||||
// https://github.com/github/fetch/pull/92#issuecomment-512187452
|
||||
async function fetchLocal(url, options) {
|
||||
urlResolver.href = url;
|
||||
|
||||
const requestURL = urlResolver.href;
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest;
|
||||
|
||||
xhr.onload = () => {
|
||||
// `file` protocol has invalid OK status
|
||||
let status = xhr.status;
|
||||
if (requestURL.startsWith('file:') && status === 0) {
|
||||
status = 200;
|
||||
}
|
||||
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
resolve(new Response(xhr.responseText, {status: status}));
|
||||
};
|
||||
|
||||
xhr.onerror = () => {
|
||||
reject(new TypeError('Local request failed'));
|
||||
};
|
||||
|
||||
xhr.open('GET', url);
|
||||
|
||||
if (options && options.cache) {
|
||||
xhr.setRequestHeader('Cache-Control', options.cache);
|
||||
}
|
||||
|
||||
xhr.send(null);
|
||||
});
|
||||
}
|
||||
|
||||
async function getConfig() {
|
||||
if (data) return Promise.resolve(data);
|
||||
try {
|
||||
const response = await fetch('config.json', {
|
||||
const response = await fetchLocal('config.json', {
|
||||
cache: 'no-cache'
|
||||
});
|
||||
|
||||
|
@ -22,7 +61,7 @@ async function getConfig() {
|
|||
|
||||
async function getDefaultConfig() {
|
||||
try {
|
||||
const response = await fetch('config.template.json', {
|
||||
const response = await fetchLocal('config.template.json', {
|
||||
cache: 'no-cache'
|
||||
});
|
||||
|
||||
|
|
|
@ -1,20 +1,43 @@
|
|||
// TODO: This seems like a good candidate for deprecation
|
||||
export default {
|
||||
openUrl: function (url, target) {
|
||||
enableFullscreen: function() {
|
||||
window.NativeShell?.enableFullscreen();
|
||||
},
|
||||
disableFullscreen: function() {
|
||||
window.NativeShell?.disableFullscreen();
|
||||
},
|
||||
openUrl: function(url, target) {
|
||||
if (window.NativeShell) {
|
||||
window.NativeShell.openUrl(url, target);
|
||||
} else {
|
||||
window.open(url, target || '_blank');
|
||||
}
|
||||
},
|
||||
enableFullscreen: function () {
|
||||
if (window.NativeShell) {
|
||||
window.NativeShell.enableFullscreen();
|
||||
}
|
||||
updateMediaSession(mediaInfo) {
|
||||
window.NativeShell?.updateMediaSession(mediaInfo);
|
||||
},
|
||||
disableFullscreen: function () {
|
||||
hideMediaSession() {
|
||||
window.NativeShell?.hideMediaSession();
|
||||
},
|
||||
/**
|
||||
* Notify the NativeShell about volume level changes.
|
||||
* Useful for e.g. remote playback.
|
||||
*/
|
||||
updateVolumeLevel(volume) {
|
||||
window.NativeShell?.updateVolumeLevel(volume);
|
||||
},
|
||||
/**
|
||||
* Download specified files with NativeShell if possible
|
||||
*
|
||||
* @returns true on success
|
||||
*/
|
||||
downloadFiles(items) {
|
||||
if (window.NativeShell) {
|
||||
window.NativeShell.disableFullscreen();
|
||||
items.map(function(item) {
|
||||
window.NativeShell.downloadFile(item);
|
||||
});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
window.getWindowLocationSearch = function(win) {
|
||||
'use strict';
|
||||
|
||||
var search = (win || window).location.search;
|
||||
let search = (win || window).location.search;
|
||||
|
||||
if (!search) {
|
||||
var index = window.location.href.indexOf('?');
|
||||
const index = window.location.href.indexOf('?');
|
||||
|
||||
if (index != -1) {
|
||||
search = window.location.href.substring(index);
|
||||
|
@ -18,9 +18,9 @@ window.getParameterByName = function(name, url) {
|
|||
'use strict';
|
||||
|
||||
name = name.replace(/[\[]/, '\\[').replace(/[\]]/, '\\]');
|
||||
var regexS = '[\\?&]' + name + '=([^&#]*)';
|
||||
var regex = new RegExp(regexS, 'i');
|
||||
var results = regex.exec(url || getWindowLocationSearch());
|
||||
const regexS = '[\\?&]' + name + '=([^&#]*)';
|
||||
const regex = new RegExp(regexS, 'i');
|
||||
const results = regex.exec(url || getWindowLocationSearch());
|
||||
|
||||
if (results == null) {
|
||||
return '';
|
||||
|
@ -33,7 +33,7 @@ window.pageClassOn = function(eventName, className, fn) {
|
|||
'use strict';
|
||||
|
||||
document.addEventListener(eventName, function (event) {
|
||||
var target = event.target;
|
||||
const target = event.target;
|
||||
|
||||
if (target.classList.contains(className)) {
|
||||
fn.call(target, event);
|
||||
|
@ -45,7 +45,7 @@ window.pageIdOn = function(eventName, id, fn) {
|
|||
'use strict';
|
||||
|
||||
document.addEventListener(eventName, function (event) {
|
||||
var target = event.target;
|
||||
const target = event.target;
|
||||
|
||||
if (target.id === id) {
|
||||
fn.call(target, event);
|
||||
|
@ -53,33 +53,26 @@ window.pageIdOn = function(eventName, id, fn) {
|
|||
});
|
||||
};
|
||||
|
||||
var AppInfo = {};
|
||||
const AppInfo = {};
|
||||
|
||||
function initClient() {
|
||||
function defineConnectionManager(connectionManager) {
|
||||
window.ConnectionManager = connectionManager;
|
||||
define('connectionManager', [], function () {
|
||||
return connectionManager;
|
||||
});
|
||||
}
|
||||
|
||||
function bindConnectionManagerEvents(connectionManager, events, userSettings) {
|
||||
window.Events = events;
|
||||
|
||||
connectionManager.currentApiClient = function () {
|
||||
window.connectionManager.currentApiClient = function () {
|
||||
if (!localApiClient) {
|
||||
var server = connectionManager.getLastUsedServer();
|
||||
const server = window.connectionManager.getLastUsedServer();
|
||||
|
||||
if (server) {
|
||||
localApiClient = connectionManager.getApiClient(server.Id);
|
||||
localApiClient = window.connectionManager.getApiClient(server.Id);
|
||||
}
|
||||
}
|
||||
|
||||
return localApiClient;
|
||||
};
|
||||
|
||||
connectionManager.onLocalUserSignedIn = function (user) {
|
||||
localApiClient = connectionManager.getApiClient(user.ServerId);
|
||||
window.connectionManager.onLocalUserSignedIn = function (user) {
|
||||
localApiClient = window.connectionManager.getApiClient(user.ServerId);
|
||||
window.ApiClient = localApiClient;
|
||||
return userSettings.setUserInfo(user.Id, localApiClient);
|
||||
};
|
||||
|
@ -93,16 +86,15 @@ function initClient() {
|
|||
return require(['connectionManagerFactory', 'apphost', 'credentialprovider', 'events', 'userSettings'], function (ConnectionManager, appHost, credentialProvider, events, userSettings) {
|
||||
appHost = appHost.default || appHost;
|
||||
|
||||
var credentialProviderInstance = new credentialProvider();
|
||||
var promises = [appHost.init()];
|
||||
const credentialProviderInstance = new credentialProvider();
|
||||
const promises = [appHost.init()];
|
||||
|
||||
return Promise.all(promises).then(function (responses) {
|
||||
var capabilities = Dashboard.capabilities(appHost);
|
||||
const capabilities = Dashboard.capabilities(appHost);
|
||||
|
||||
var connectionManager = new ConnectionManager(credentialProviderInstance, appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId(), capabilities);
|
||||
window.connectionManager = new ConnectionManager(credentialProviderInstance, appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId(), capabilities);
|
||||
|
||||
defineConnectionManager(connectionManager);
|
||||
bindConnectionManagerEvents(connectionManager, events, userSettings);
|
||||
bindConnectionManagerEvents(window.connectionManager, events, userSettings);
|
||||
|
||||
if (!AppInfo.isNativeApp) {
|
||||
console.debug('loading ApiClient singleton');
|
||||
|
@ -110,12 +102,12 @@ function initClient() {
|
|||
return require(['apiclient', 'clientUtils'], function (apiClientFactory, clientUtils) {
|
||||
console.debug('creating ApiClient singleton');
|
||||
|
||||
var apiClient = new apiClientFactory(Dashboard.serverAddress(), appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId());
|
||||
const apiClient = new apiClientFactory(Dashboard.serverAddress(), appHost.appName(), appHost.appVersion(), appHost.deviceName(), appHost.deviceId());
|
||||
|
||||
apiClient.enableAutomaticNetworking = false;
|
||||
apiClient.manualAddressOnly = true;
|
||||
|
||||
connectionManager.addApiClient(apiClient);
|
||||
window.connectionManager.addApiClient(apiClient);
|
||||
|
||||
window.ApiClient = apiClient;
|
||||
localApiClient = apiClient;
|
||||
|
@ -202,7 +194,7 @@ function initClient() {
|
|||
|
||||
require(['clientUtils']);
|
||||
|
||||
var promises = [];
|
||||
const promises = [];
|
||||
if (!window.fetch) {
|
||||
promises.push(require(['fetch']));
|
||||
}
|
||||
|
@ -211,7 +203,7 @@ function initClient() {
|
|||
createConnectionManager().then(function () {
|
||||
console.debug('initAfterDependencies promises resolved');
|
||||
|
||||
require(['globalize', 'browser'], function (globalize, browser) {
|
||||
require(['globalize', 'browser'], function (globalize, {default: browser}) {
|
||||
window.Globalize = globalize;
|
||||
loadCoreDictionary(globalize).then(function () {
|
||||
onGlobalizeInit(browser, globalize);
|
||||
|
@ -226,16 +218,16 @@ function initClient() {
|
|||
require(['autoFocuser'], function(autoFocuser) {
|
||||
autoFocuser.enable();
|
||||
});
|
||||
require(['globalize', 'connectionManager', 'events'], function (globalize, connectionManager, events) {
|
||||
events.on(connectionManager, 'localusersignedin', globalize.updateCurrentCulture);
|
||||
require(['globalize', 'events'], function (globalize, events) {
|
||||
events.on(window.connectionManager, 'localusersignedin', globalize.updateCurrentCulture);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadCoreDictionary(globalize) {
|
||||
var languages = ['ar', 'be-by', 'bg-bg', 'ca', 'cs', 'da', 'de', 'el', 'en-gb', 'en-us', 'es', 'es-ar', 'es-mx', 'fa', 'fi', 'fr', 'fr-ca', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'kk', 'ko', 'lt-lt', 'ms', 'nb', 'nl', 'pl', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sv', 'tr', 'uk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw'];
|
||||
var translations = languages.map(function (language) {
|
||||
const languages = ['ar', 'be-by', 'bg-bg', 'ca', 'cs', 'da', 'de', 'el', 'en-gb', 'en-us', 'es', 'es-ar', 'es-mx', 'fa', 'fi', 'fr', 'fr-ca', 'gsw', 'he', 'hi-in', 'hr', 'hu', 'id', 'it', 'kk', 'ko', 'lt-lt', 'ms', 'nb', 'nl', 'pl', 'pt-br', 'pt-pt', 'ro', 'ru', 'sk', 'sl-si', 'sv', 'tr', 'uk', 'vi', 'zh-cn', 'zh-hk', 'zh-tw'];
|
||||
const translations = languages.map(function (language) {
|
||||
return {
|
||||
lang: language,
|
||||
path: 'strings/' + language + '.json'
|
||||
|
@ -375,7 +367,7 @@ function initClient() {
|
|||
|
||||
require(['playerSelectionMenu']);
|
||||
|
||||
var apiClient = window.ConnectionManager && window.ConnectionManager.currentApiClient();
|
||||
const apiClient = window.connectionManager && window.connectionManager.currentApiClient();
|
||||
if (apiClient) {
|
||||
fetch(apiClient.getUrl('Branding/Css'))
|
||||
.then(function(response) {
|
||||
|
@ -418,8 +410,8 @@ function initClient() {
|
|||
}
|
||||
|
||||
function onWebComponentsReady() {
|
||||
var componentsPath = getComponentsPath();
|
||||
var scriptsPath = getScriptsPath();
|
||||
const componentsPath = getComponentsPath();
|
||||
const scriptsPath = getScriptsPath();
|
||||
|
||||
define('filesystem', [scriptsPath + '/filesystem'], returnFirstDependency);
|
||||
|
||||
|
@ -449,18 +441,18 @@ function initClient() {
|
|||
init();
|
||||
}
|
||||
|
||||
var promise;
|
||||
var localApiClient;
|
||||
let promise;
|
||||
let localApiClient;
|
||||
|
||||
function initRequireJs() {
|
||||
var urlArgs = 'v=' + (window.dashboardVersion || new Date().getDate());
|
||||
const urlArgs = 'v=' + (window.dashboardVersion || new Date().getDate());
|
||||
|
||||
var bowerPath = getBowerPath();
|
||||
var componentsPath = getComponentsPath();
|
||||
var elementsPath = getElementsPath();
|
||||
var scriptsPath = getScriptsPath();
|
||||
const bowerPath = getBowerPath();
|
||||
const componentsPath = getComponentsPath();
|
||||
const elementsPath = getElementsPath();
|
||||
const scriptsPath = getScriptsPath();
|
||||
|
||||
var paths = {
|
||||
const paths = {
|
||||
browserdeviceprofile: 'scripts/browserDeviceProfile',
|
||||
browser: 'scripts/browser',
|
||||
libraryBrowser: 'scripts/libraryBrowser',
|
||||
|
@ -590,6 +582,7 @@ function initClient() {
|
|||
define('webSettings', [scriptsPath + '/settings/webSettings'], returnFirstDependency);
|
||||
define('appSettings', [scriptsPath + '/settings/appSettings'], returnFirstDependency);
|
||||
define('userSettings', [scriptsPath + '/settings/userSettings'], returnFirstDependency);
|
||||
define('autocast', [scriptsPath + '/autocast'], returnFirstDependency);
|
||||
|
||||
define('mediaSession', [componentsPath + '/playback/mediasession'], returnFirstDependency);
|
||||
define('actionsheet', [componentsPath + '/actionSheet/actionSheet'], returnFirstDependency);
|
||||
|
@ -634,6 +627,7 @@ function initClient() {
|
|||
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);
|
||||
|
@ -679,9 +673,6 @@ function initClient() {
|
|||
define('mouseManager', [scriptsPath + '/mouseManager'], returnFirstDependency);
|
||||
define('scrollManager', [componentsPath + '/scrollManager'], returnFirstDependency);
|
||||
define('autoFocuser', [componentsPath + '/autoFocuser'], returnFirstDependency);
|
||||
define('connectionManager', [], function () {
|
||||
return ConnectionManager;
|
||||
});
|
||||
define('apiClientResolver', [], function () {
|
||||
return function () {
|
||||
return window.ApiClient;
|
||||
|
|
|
@ -1,13 +1,12 @@
|
|||
|
||||
import events from 'events';
|
||||
import serverNotifications from 'serverNotifications';
|
||||
import connectionManager from 'connectionManager';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-button';
|
||||
|
||||
export default function (options) {
|
||||
function pollTasks() {
|
||||
connectionManager.getApiClient(serverId).getScheduledTasks({
|
||||
window.connectionManager.getApiClient(serverId).getScheduledTasks({
|
||||
IsEnabled: true
|
||||
}).then(updateTasks);
|
||||
}
|
||||
|
@ -64,7 +63,7 @@ export default function (options) {
|
|||
}
|
||||
|
||||
function onScheduledTaskMessageConfirmed(id) {
|
||||
connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
|
||||
window.connectionManager.getApiClient(serverId).startScheduledTask(id).then(pollTasks);
|
||||
}
|
||||
|
||||
function onButtonClick() {
|
||||
|
@ -82,13 +81,13 @@ export default function (options) {
|
|||
const serverId = ApiClient.serverId();
|
||||
|
||||
function onPollIntervalFired() {
|
||||
if (!connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
||||
if (!window.connectionManager.getApiClient(serverId).isMessageChannelOpen()) {
|
||||
pollTasks();
|
||||
}
|
||||
}
|
||||
|
||||
function startInterval() {
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = window.connectionManager.getApiClient(serverId);
|
||||
|
||||
if (pollInterval) {
|
||||
clearInterval(pollInterval);
|
||||
|
@ -98,7 +97,7 @@ export default function (options) {
|
|||
}
|
||||
|
||||
function stopInterval() {
|
||||
connectionManager.getApiClient(serverId).sendMessage('ScheduledTasksInfoStop');
|
||||
window.connectionManager.getApiClient(serverId).sendMessage('ScheduledTasksInfoStop');
|
||||
|
||||
if (pollInterval) {
|
||||
clearInterval(pollInterval);
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import * as webSettings from 'webSettings';
|
||||
|
||||
var themeStyleElement = document.querySelector('#cssTheme');
|
||||
var currentThemeId;
|
||||
let themeStyleElement = document.querySelector('#cssTheme');
|
||||
let currentThemeId;
|
||||
|
||||
function unloadTheme() {
|
||||
var elem = themeStyleElement;
|
||||
const elem = themeStyleElement;
|
||||
if (elem) {
|
||||
elem.removeAttribute('href');
|
||||
currentThemeId = null;
|
||||
|
@ -17,7 +17,7 @@ function getThemes() {
|
|||
|
||||
function getThemeStylesheetInfo(id) {
|
||||
return getThemes().then(themes => {
|
||||
var theme = themes.find(theme => {
|
||||
const theme = themes.find(theme => {
|
||||
return id ? theme.id === id : theme.default;
|
||||
});
|
||||
|
||||
|
@ -41,7 +41,7 @@ function setTheme(id) {
|
|||
return;
|
||||
}
|
||||
|
||||
var linkUrl = info.stylesheetPath;
|
||||
const linkUrl = info.stylesheetPath;
|
||||
unloadTheme();
|
||||
|
||||
let link = themeStyleElement;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue