1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

Merge remote-tracking branch 'upstream/master' into return-of-the-scrollbar

This commit is contained in:
Dmitry Lyzo 2020-09-26 21:15:30 +03:00
commit 4e5ba66fb6
132 changed files with 4325 additions and 1418 deletions

View file

@ -120,6 +120,18 @@ import 'flexStyles';
if (stream.BitDepth) {
attributes.push(createAttribute(globalize.translate('MediaInfoBitDepth'), `${stream.BitDepth} bit`));
}
if (stream.VideoRange) {
attributes.push(createAttribute(globalize.translate('MediaInfoVideoRange'), stream.VideoRange));
}
if (stream.ColorSpace) {
attributes.push(createAttribute(globalize.translate('MediaInfoColorSpace'), stream.ColorSpace));
}
if (stream.ColorTransfer) {
attributes.push(createAttribute(globalize.translate('MediaInfoColorTransfer'), stream.ColorTransfer));
}
if (stream.ColorPrimaries) {
attributes.push(createAttribute(globalize.translate('MediaInfoColorPrimaries'), stream.ColorPrimaries));
}
if (stream.PixelFormat) {
attributes.push(createAttribute(globalize.translate('MediaInfoPixelFormat'), stream.PixelFormat));
}

View file

@ -185,6 +185,17 @@
.listItemBody {
padding-right: 0.5em;
}
.listItemMediaInfo {
display: none;
}
}
@media all and (max-width: 40em) {
[data-type='Movie'] .listItemImage,
[data-type='Series'] .listItemImage {
display: none;
}
}
.listItemImage-large-tv {

View file

@ -31,7 +31,7 @@ function closeAfter(notification, timeoutMs) {
function resetRegistration() {
/* eslint-disable-next-line compat/compat */
let serviceWorker = navigator.serviceWorker;
const serviceWorker = navigator.serviceWorker;
if (serviceWorker) {
serviceWorker.ready.then(function (registration) {
serviceWorkerRegistration = registration;
@ -47,7 +47,7 @@ function showPersistentNotification(title, options, timeoutMs) {
function showNonPersistentNotification(title, options, timeoutMs) {
try {
let notif = new Notification(title, options); /* eslint-disable-line compat/compat */
const notif = new Notification(title, options); /* eslint-disable-line compat/compat */
if (notif.show) {
notif.show();
@ -67,7 +67,7 @@ function showNonPersistentNotification(title, options, timeoutMs) {
}
function showNotification(options, timeoutMs, apiClient) {
let title = options.title;
const title = options.title;
options.data = options.data || {};
options.data.serverId = apiClient.serverInfo().Id;
@ -95,7 +95,7 @@ function showNewItemNotification(item, apiClient) {
body = item.SeriesName + ' - ' + body;
}
let notification = {
const notification = {
title: 'New ' + item.Type,
body: body,
vibrate: true,
@ -103,7 +103,7 @@ function showNewItemNotification(item, apiClient) {
data: {}
};
let imageTags = item.ImageTags || {};
const imageTags = item.ImageTags || {};
if (imageTags.Primary) {
notification.icon = apiClient.getScaledImageUrl(item.Id, {
@ -117,7 +117,7 @@ function showNewItemNotification(item, apiClient) {
}
function onLibraryChanged(data, apiClient) {
let newItems = data.ItemsAdded;
const newItems = data.ItemsAdded;
if (!newItems.length) {
return;
@ -140,7 +140,7 @@ function onLibraryChanged(data, apiClient) {
EnableTotalRecordCount: false
}).then(function (result) {
let items = result.Items;
const items = result.Items;
for (const item of items) {
showNewItemNotification(item, apiClient);
@ -159,7 +159,7 @@ function showPackageInstallNotification(apiClient, installation, status) {
return;
}
let notification = {
const notification = {
tag: 'install' + installation.Id,
data: {}
};
@ -188,12 +188,12 @@ function showPackageInstallNotification(apiClient, installation, status) {
}
if (status === 'progress') {
let percentComplete = Math.round(installation.PercentComplete || 0);
const percentComplete = Math.round(installation.PercentComplete || 0);
notification.body = percentComplete + '% complete.';
}
let timeout = status === 'cancelled' ? 5000 : 0;
const timeout = status === 'cancelled' ? 5000 : 0;
showNotification(notification, timeout, apiClient);
});
@ -220,8 +220,8 @@ events.on(serverNotifications, 'PackageInstalling', function (e, apiClient, data
});
events.on(serverNotifications, 'ServerShuttingDown', function (e, apiClient, data) {
let serverId = apiClient.serverInfo().Id;
let notification = {
const serverId = apiClient.serverInfo().Id;
const notification = {
tag: 'restart' + serverId,
title: globalize.translate('ServerNameIsShuttingDown', apiClient.serverInfo().Name)
};
@ -229,8 +229,8 @@ events.on(serverNotifications, 'ServerShuttingDown', function (e, apiClient, dat
});
events.on(serverNotifications, 'ServerRestarting', function (e, apiClient, data) {
let serverId = apiClient.serverInfo().Id;
let notification = {
const serverId = apiClient.serverInfo().Id;
const notification = {
tag: 'restart' + serverId,
title: globalize.translate('ServerNameIsRestarting', apiClient.serverInfo().Name)
};
@ -238,8 +238,8 @@ events.on(serverNotifications, 'ServerRestarting', function (e, apiClient, data)
});
events.on(serverNotifications, 'RestartRequired', function (e, apiClient) {
let serverId = apiClient.serverInfo().Id;
let notification = {
const serverId = apiClient.serverInfo().Id;
const notification = {
tag: 'restart' + serverId,
title: globalize.translate('PleaseRestartServerName', apiClient.serverInfo().Name)
};

View file

@ -639,22 +639,18 @@ function supportsDirectPlay(apiClient, item, mediaSource) {
function validatePlaybackInfoResult(instance, result) {
if (result.ErrorCode) {
showPlaybackInfoErrorMessage(instance, result.ErrorCode);
showPlaybackInfoErrorMessage(instance, 'PlaybackError' + result.ErrorCode);
return false;
}
return true;
}
function showPlaybackInfoErrorMessage(instance, errorCode, playNextTrack) {
function showPlaybackInfoErrorMessage(instance, errorCode) {
import('alert').then(({ default: alert }) => {
alert({
text: globalize.translate('PlaybackError' + errorCode),
text: globalize.translate(errorCode),
title: globalize.translate('HeaderPlaybackError')
}).then(function () {
if (playNextTrack) {
instance.nextTrack();
}
});
});
}
@ -1114,8 +1110,8 @@ class PlaybackManager {
self.increasePlaybackRate = function (player) {
player = player || self._currentPlayer;
if (player) {
let current = self.getPlaybackRate(player);
let supported = self.getSupportedPlaybackRates(player);
const current = self.getPlaybackRate(player);
const supported = self.getSupportedPlaybackRates(player);
let index = -1;
for (let i = 0, length = supported.length; i < length; i++) {
@ -1133,8 +1129,8 @@ class PlaybackManager {
self.decreasePlaybackRate = function (player) {
player = player || self._currentPlayer;
if (player) {
let current = self.getPlaybackRate(player);
let supported = self.getSupportedPlaybackRates(player);
const current = self.getPlaybackRate(player);
const supported = self.getSupportedPlaybackRates(player);
let index = -1;
for (let i = 0, length = supported.length; i < length; i++) {
@ -1701,7 +1697,7 @@ class PlaybackManager {
streamInfo.lastMediaInfoQuery = lastMediaInfoQuery;
if (!streamInfo.url) {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream', true);
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return;
}
@ -2061,7 +2057,7 @@ class PlaybackManager {
// If it's still null then there's nothing to play
if (!firstItem) {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream', false);
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return Promise.reject();
}
@ -2110,7 +2106,7 @@ class PlaybackManager {
function playInternal(item, playOptions, onPlaybackStartedFn) {
if (item.IsPlaceHolder) {
loading.hide();
showPlaybackInfoErrorMessage(self, 'PlaceHolder', true);
showPlaybackInfoErrorMessage(self, 'PlaybackErrorPlaceHolder');
return Promise.reject();
}
@ -2479,7 +2475,7 @@ class PlaybackManager {
return mediaSource;
}
} else {
showPlaybackInfoErrorMessage(self, 'NoCompatibleStream');
showPlaybackInfoErrorMessage(self, 'PlaybackErrorNoCompatibleStream');
return Promise.reject();
}
});
@ -2968,7 +2964,7 @@ class PlaybackManager {
}
if (displayErrorCode && typeof (displayErrorCode) === 'string') {
showPlaybackInfoErrorMessage(self, displayErrorCode, nextItem);
showPlaybackInfoErrorMessage(self, 'PlaybackError' + displayErrorCode);
} else if (nextItem) {
self.nextTrack();
} else {

View file

@ -6,6 +6,7 @@ import playbackManager from 'playbackManager';
import appRouter from 'appRouter';
import globalize from 'globalize';
import appHost from 'apphost';
import * as autocast from 'autocast';
function mirrorItem(info, player) {
var item = info.item;
@ -221,6 +222,14 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
html += '</div>';
if (autocast.supported()) {
html += '<div><label class="checkboxContainer">';
var checkedHtmlAC = autocast.isEnabled() ? ' checked' : '';
html += '<input type="checkbox" is="emby-checkbox" class="chkAutoCast"' + checkedHtmlAC + '/>';
html += '<span>' + globalize.translate('EnableAutoCast') + '</span>';
html += '</label></div>';
}
html += '<div style="margin-top:1em;display:flex;justify-content: flex-end;">';
html += '<button is="emby-button" type="button" class="button-flat btnRemoteControl promptDialogButton">' + globalize.translate('HeaderRemoteControl') + '</button>';
@ -237,6 +246,12 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
chkMirror.addEventListener('change', onMirrorChange);
}
var chkAutoCast = dlg.querySelector('.chkAutoCast');
if (chkAutoCast) {
chkAutoCast.addEventListener('change', onAutoCastChange);
}
var destination = '';
var btnRemoteControl = dlg.querySelector('.btnRemoteControl');
@ -269,6 +284,10 @@ function onMirrorChange() {
playbackManager.enableDisplayMirroring(this.checked);
}
function onAutoCastChange() {
autocast.enable(this.checked);
}
document.addEventListener('viewshow', function (e) {
var state = e.detail.state || {};
var item = state.item;

View file

@ -263,6 +263,34 @@ import 'css!./playerstats';
});
}
if (videoStream.VideoRange) {
sessionStats.push({
label: globalize.translate('LabelVideoRange'),
value: videoStream.VideoRange
});
}
if (videoStream.ColorSpace) {
sessionStats.push({
label: globalize.translate('LabelColorSpace'),
value: videoStream.ColorSpace
});
}
if (videoStream.ColorTransfer) {
sessionStats.push({
label: globalize.translate('LabelColorTransfer'),
value: videoStream.ColorTransfer
});
}
if (videoStream.ColorPrimaries) {
sessionStats.push({
label: globalize.translate('LabelColorPrimaries'),
value: videoStream.ColorPrimaries
});
}
const audioInfos = [];
if (audioCodec) {

View file

@ -0,0 +1,41 @@
import globalize from 'globalize';
import toast from 'toast';
export class QuickConnectSettings {
constructor() { }
authorize(code) {
const url = ApiClient.getUrl('/QuickConnect/Authorize?Code=' + code);
ApiClient.ajax({
type: 'POST',
url: url
}, true).then(() => {
toast(globalize.translate('QuickConnectAuthorizeSuccess'));
}).catch(() => {
toast(globalize.translate('QuickConnectAuthorizeFail'));
});
// prevent bubbling
return false;
}
activate() {
const url = ApiClient.getUrl('/QuickConnect/Activate');
return ApiClient.ajax({
type: 'POST',
url: url
}).then(() => {
toast(globalize.translate('QuickConnectActivationSuccessful'));
return true;
}).catch((e) => {
console.error('Error activating quick connect. Error:', e);
Dashboard.alert({
title: globalize.translate('HeaderError'),
message: globalize.translate('DefaultErrorMessage')
});
throw e;
});
}
}
export default QuickConnectSettings;

View file

@ -18,9 +18,9 @@ let currentItem;
let hasChanges;
function downloadRemoteSubtitles(context, id) {
let url = 'Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + id;
const url = 'Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + id;
let apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
apiClient.ajax({
type: 'POST',
@ -38,7 +38,7 @@ function downloadRemoteSubtitles(context, id) {
}
function deleteLocalSubtitle(context, index) {
let msg = globalize.translate('MessageAreYouSureDeleteSubtitles');
const msg = globalize.translate('MessageAreYouSureDeleteSubtitles');
import('confirm').then(({default: confirm}) => {
confirm({
@ -51,10 +51,10 @@ function deleteLocalSubtitle(context, index) {
}).then(function () {
loading.show();
let itemId = currentItem.Id;
let url = 'Videos/' + itemId + '/Subtitles/' + index;
const itemId = currentItem.Id;
const url = 'Videos/' + itemId + '/Subtitles/' + index;
let apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
apiClient.ajax({
@ -70,9 +70,9 @@ function deleteLocalSubtitle(context, index) {
}
function fillSubtitleList(context, item) {
let streams = item.MediaStreams || [];
const streams = item.MediaStreams || [];
let subs = streams.filter(function (s) {
const subs = streams.filter(function (s) {
return s.Type === 'Subtitle';
});
@ -86,7 +86,7 @@ function fillSubtitleList(context, item) {
html += subs.map(function (s) {
let itemHtml = '';
let tagName = layoutManager.tv ? 'button' : 'div';
const tagName = layoutManager.tv ? 'button' : 'div';
let className = layoutManager.tv && s.Path ? 'listItem listItem-border btnDelete' : 'listItem listItem-border';
if (layoutManager.tv) {
@ -126,7 +126,7 @@ function fillSubtitleList(context, item) {
html += '</div>';
}
let elem = context.querySelector('.subtitleList');
const elem = context.querySelector('.subtitleList');
if (subs.length) {
elem.classList.remove('hide');
@ -137,18 +137,18 @@ function fillSubtitleList(context, item) {
}
function fillLanguages(context, apiClient, languages) {
let selectLanguage = context.querySelector('#selectLanguage');
const selectLanguage = context.querySelector('#selectLanguage');
selectLanguage.innerHTML = languages.map(function (l) {
return '<option value="' + l.ThreeLetterISOLanguageName + '">' + l.DisplayName + '</option>';
});
let lastLanguage = userSettings.get('subtitleeditor-language');
const lastLanguage = userSettings.get('subtitleeditor-language');
if (lastLanguage) {
selectLanguage.value = lastLanguage;
} else {
apiClient.getCurrentUser().then(function (user) {
let lang = user.Configuration.SubtitleLanguagePreference;
const lang = user.Configuration.SubtitleLanguagePreference;
if (lang) {
selectLanguage.value = lang;
@ -171,9 +171,9 @@ function renderSearchResults(context, results) {
context.querySelector('.noSearchResults').classList.add('hide');
for (let i = 0, length = results.length; i < length; i++) {
let result = results[i];
const result = results[i];
let provider = result.ProviderName;
const provider = result.ProviderName;
if (provider !== lastProvider) {
if (i > 0) {
@ -184,7 +184,7 @@ function renderSearchResults(context, results) {
lastProvider = provider;
}
let tagName = layoutManager.tv ? 'button' : 'div';
const tagName = layoutManager.tv ? 'button' : 'div';
let className = layoutManager.tv ? 'listItem listItem-border btnOptions' : 'listItem listItem-border';
if (layoutManager.tv) {
className += ' listItem-focusscale listItem-button';
@ -194,7 +194,7 @@ function renderSearchResults(context, results) {
html += '<span class="listItemIcon material-icons closed_caption"></span>';
let bodyClass = result.Comment || result.IsHashMatch ? 'three-line' : 'two-line';
const bodyClass = result.Comment || result.IsHashMatch ? 'three-line' : 'two-line';
html += '<div class="listItemBody ' + bodyClass + '">';
@ -231,7 +231,7 @@ function renderSearchResults(context, results) {
html += '</div>';
}
let elem = context.querySelector('.subtitleResults');
const elem = context.querySelector('.subtitleResults');
elem.innerHTML = html;
loading.hide();
@ -242,8 +242,8 @@ function searchForSubtitles(context, language) {
loading.show();
let apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
let url = apiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
const apiClient = window.connectionManager.getApiClient(currentItem.ServerId);
const url = apiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
apiClient.getJSON(url).then(function (results) {
renderSearchResults(context, results);
@ -258,7 +258,7 @@ function reload(context, apiClient, itemId) {
fillSubtitleList(context, item);
let file = item.Path || '';
let index = Math.max(file.lastIndexOf('/'), file.lastIndexOf('\\'));
const index = Math.max(file.lastIndexOf('/'), file.lastIndexOf('\\'));
if (index > -1) {
file = file.substring(index + 1);
}
@ -282,9 +282,9 @@ function reload(context, apiClient, itemId) {
}
function onSearchSubmit(e) {
let form = this;
const form = this;
let lang = form.querySelector('#selectLanguage', form).value;
const lang = form.querySelector('#selectLanguage', form).value;
searchForSubtitles(dom.parentWithClass(form, 'formDialogContent'), lang);
@ -293,10 +293,10 @@ function onSearchSubmit(e) {
}
function onSubtitleListClick(e) {
let btnDelete = dom.parentWithClass(e.target, 'btnDelete');
const btnDelete = dom.parentWithClass(e.target, 'btnDelete');
if (btnDelete) {
let index = btnDelete.getAttribute('data-index');
let context = dom.parentWithClass(btnDelete, 'subtitleEditorDialog');
const index = btnDelete.getAttribute('data-index');
const context = dom.parentWithClass(btnDelete, 'subtitleEditorDialog');
deleteLocalSubtitle(context, index);
}
}
@ -305,14 +305,14 @@ function onSubtitleResultsClick(e) {
let subtitleId;
let context;
let btnOptions = dom.parentWithClass(e.target, 'btnOptions');
const btnOptions = dom.parentWithClass(e.target, 'btnOptions');
if (btnOptions) {
subtitleId = btnOptions.getAttribute('data-subid');
context = dom.parentWithClass(btnOptions, 'subtitleEditorDialog');
showDownloadOptions(btnOptions, context, subtitleId);
}
let btnDownload = dom.parentWithClass(e.target, 'btnDownload');
const btnDownload = dom.parentWithClass(e.target, 'btnDownload');
if (btnDownload) {
subtitleId = btnDownload.getAttribute('data-subid');
context = dom.parentWithClass(btnDownload, 'subtitleEditorDialog');
@ -321,7 +321,7 @@ function onSubtitleResultsClick(e) {
}
function showDownloadOptions(button, context, subtitleId) {
let items = [];
const items = [];
items.push({
name: globalize.translate('Download'),
@ -347,7 +347,7 @@ function showDownloadOptions(button, context, subtitleId) {
function centerFocus(elem, horiz, on) {
import('scrollHelper').then(({default: scrollHelper}) => {
let fn = on ? 'on' : 'off';
const fn = on ? 'on' : 'off';
scrollHelper.centerFocus[fn](elem, horiz);
});
}
@ -355,9 +355,9 @@ function centerFocus(elem, horiz, on) {
function showEditorInternal(itemId, serverId, template) {
hasChanges = false;
let apiClient = window.connectionManager.getApiClient(serverId);
const apiClient = window.connectionManager.getApiClient(serverId);
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
let dialogOptions = {
const dialogOptions = {
removeOnClose: true,
scrollY: false
};
@ -368,7 +368,7 @@ function showEditorInternal(itemId, serverId, template) {
dialogOptions.size = 'small';
}
let dlg = dialogHelper.createDialog(dialogOptions);
const dlg = dialogHelper.createDialog(dialogOptions);
dlg.classList.add('formDialog');
dlg.classList.add('subtitleEditorDialog');
@ -379,7 +379,7 @@ function showEditorInternal(itemId, serverId, template) {
dlg.querySelector('.subtitleSearchForm').addEventListener('submit', onSearchSubmit);
let btnSubmit = dlg.querySelector('.btnSubmit');
const btnSubmit = dlg.querySelector('.btnSubmit');
if (layoutManager.tv) {
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
@ -388,7 +388,7 @@ function showEditorInternal(itemId, serverId, template) {
btnSubmit.classList.add('hide');
}
let editorContent = dlg.querySelector('.formDialogContent');
const editorContent = dlg.querySelector('.formDialogContent');
dlg.querySelector('.subtitleList').addEventListener('click', onSubtitleListClick);
dlg.querySelector('.subtitleResults').addEventListener('click', onSubtitleResultsClick);

View file

@ -14,7 +14,7 @@ import 'css!components/viewManager/viewContainer';
}
controllerUrl = Dashboard.getPluginUrl(controllerUrl);
let apiUrl = ApiClient.getUrl('/web/' + controllerUrl);
const apiUrl = ApiClient.getUrl('/web/' + controllerUrl);
return import(apiUrl).then((ControllerFactory) => {
options.controllerFactory = ControllerFactory;
});