Fix appHost.supports

This commit is contained in:
MrTimscampi 2020-07-19 17:38:42 +02:00
parent 9675bd57b8
commit a7df7ad720
20 changed files with 48 additions and 66 deletions

View file

@ -78,12 +78,6 @@ _define('webcomponents', function() {
return webcomponents;
});
// shaka
const shaka = require('shaka-player');
_define('shaka', function() {
return shaka;
});
// libass-wasm
const libassWasm = require('libass-wasm');
_define('JavascriptSubtitlesOctopus', function() {

View file

@ -16,7 +16,7 @@ import actionsheet from 'actionsheet';
const canPlay = playbackManager.canPlay(item);
const restrictOptions = (browser.operaTv || browser.web0s) && !user.Policy.IsAdministrator;
let commands = [];
const commands = [];
if (canPlay && item.MediaType !== 'Photo') {
if (options.play !== false) {
@ -367,7 +367,7 @@ import actionsheet from 'actionsheet';
case 'copy-stream': {
const downloadHref = apiClient.getItemDownloadUrl(itemId);
const textAreaCopy = function () {
let textArea = document.createElement('textarea');
const textArea = document.createElement('textarea');
textArea.value = downloadHref;
document.body.appendChild(textArea);
textArea.focus();

View file

@ -907,7 +907,7 @@ import 'flexStyles';
}
function populatePeople(context, people) {
let lastType = '';
const lastType = '';
let html = '';
const elem = context.querySelector('#peopleList');

View file

@ -500,20 +500,20 @@ import 'emby-ratingbutton';
const textLines = nowPlayingItem ? nowPlayingHelper.getNowPlayingNames(nowPlayingItem) : [];
nowPlayingTextElement.innerHTML = '';
if (textLines) {
let itemText = document.createElement('div');
let secondaryText = document.createElement('div');
const itemText = document.createElement('div');
const secondaryText = document.createElement('div');
secondaryText.classList.add('nowPlayingBarSecondaryText');
if (textLines.length > 1) {
textLines[1].secondary = true;
if (textLines[1].text) {
let text = document.createElement('a');
const text = document.createElement('a');
text.innerHTML = textLines[1].text;
secondaryText.appendChild(text);
}
}
if (textLines[0].text) {
let text = document.createElement('a');
const text = document.createElement('a');
text.innerHTML = textLines[0].text;
itemText.appendChild(text);
}
@ -555,10 +555,10 @@ import 'emby-ratingbutton';
if (!layoutManager.mobile) {
let contextButton = nowPlayingBarElement.querySelector('.btnToggleContextMenu');
// We remove the previous event listener by replacing the item in each update event
let contextButtonClone = contextButton.cloneNode(true);
const contextButtonClone = contextButton.cloneNode(true);
contextButton.parentNode.replaceChild(contextButtonClone, contextButton);
contextButton = nowPlayingBarElement.querySelector('.btnToggleContextMenu');
let options = {
const options = {
play: false,
queue: false,
clearQueue: true,
@ -600,10 +600,10 @@ import 'emby-ratingbutton';
return;
}
let shuffleMode = playbackManager.getQueueShuffleMode();
let context = nowPlayingBarElement;
const shuffleMode = playbackManager.getQueueShuffleMode();
const context = nowPlayingBarElement;
const cssClass = 'buttonActive';
let toggleShuffleButton = context.querySelector('.btnShuffleQueue');
const toggleShuffleButton = context.querySelector('.btnShuffleQueue');
switch (shuffleMode) {
case 'Shuffle':
toggleShuffleButton.classList.add(cssClass);

View file

@ -1,7 +1,6 @@
import globalize from 'globalize';
export function getVideoQualityOptions(options) {
var maxStreamingBitrate = options.currentMaxBitrate;
var videoWidth = options.videoWidth;
var videoHeight = options.videoHeight;
@ -25,7 +24,6 @@ export function getVideoQualityOptions(options) {
// Some 1080- videos are reported as 1912?
if (maxAllowedWidth >= 1900) {
qualityOptions.push({ name: '1080p - 60 Mbps', maxHeight: 1080, bitrate: 60000000 });
qualityOptions.push({ name: '1080p - 50 Mbps', maxHeight: 1080, bitrate: 50000000 });
qualityOptions.push({ name: '1080p - 40 Mbps', maxHeight: 1080, bitrate: 40000000 });
@ -38,13 +36,11 @@ export function getVideoQualityOptions(options) {
qualityOptions.push({ name: '1080p - 6 Mbps', maxHeight: 1080, bitrate: 6000001 });
qualityOptions.push({ name: '1080p - 5 Mbps', maxHeight: 1080, bitrate: 5000001 });
qualityOptions.push({ name: '1080p - 4 Mbps', maxHeight: 1080, bitrate: 4000002 });
} else if (maxAllowedWidth >= 1260) {
qualityOptions.push({ name: '720p - 10 Mbps', maxHeight: 720, bitrate: 10000000 });
qualityOptions.push({ name: '720p - 8 Mbps', maxHeight: 720, bitrate: 8000000 });
qualityOptions.push({ name: '720p - 6 Mbps', maxHeight: 720, bitrate: 6000000 });
qualityOptions.push({ name: '720p - 5 Mbps', maxHeight: 720, bitrate: 5000000 });
} else if (maxAllowedWidth >= 620) {
qualityOptions.push({ name: '480p - 4 Mbps', maxHeight: 480, bitrate: 4000001 });
qualityOptions.push({ name: '480p - 3 Mbps', maxHeight: 480, bitrate: 3000001 });
@ -83,7 +79,6 @@ export function getVideoQualityOptions(options) {
if (maxStreamingBitrate) {
var selectedIndex = -1;
for (var i = 0, length = qualityOptions.length; i < length; i++) {
var option = qualityOptions[i];
if (selectedIndex === -1 && option.bitrate <= maxStreamingBitrate) {
@ -143,7 +138,6 @@ export function getAudioQualityOptions(options) {
}
if (selectedIndex === -1) {
selectedIndex = qualityOptions.length - 1;
}

View file

@ -127,8 +127,8 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
if (item.Artists != null) {
if (item.ArtistItems != null) {
for (const artist of item.ArtistItems) {
let artistName = artist.Name;
let artistId = artist.Id;
const artistName = artist.Name;
const artistId = artist.Id;
artistsSeries += `<a class="button-link emby-button" is="emby-linkbutton" href="details?id=${artistId}&serverId=${nowPlayingServerId}">${artistName}</a>`;
if (artist !== item.ArtistItems.slice(-1)[0]) {
artistsSeries += ', ';
@ -185,7 +185,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
let contextButton = context.querySelector('.btnToggleContextMenu');
// We remove the previous event listener by replacing the item in each update event
const autoFocusContextButton = document.activeElement === contextButton;
let contextButtonClone = contextButton.cloneNode(true);
const contextButtonClone = contextButton.cloneNode(true);
contextButton.parentNode.replaceChild(contextButtonClone, contextButton);
contextButton = context.querySelector('.btnToggleContextMenu');
if (autoFocusContextButton) {
@ -362,7 +362,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
function updateRepeatModeDisplay(repeatMode) {
var context = dlg;
let toggleRepeatButtons = context.querySelectorAll('.repeatToggleButton');
const toggleRepeatButtons = context.querySelectorAll('.repeatToggleButton');
const cssClass = 'buttonActive';
let innHtml = '<span class="material-icons repeat"></span>';
let repeatOn = true;
@ -529,12 +529,12 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
}
function onShuffleQueueModeChange(updateView = true) {
let shuffleMode = playbackManager.getQueueShuffleMode(this);
let context = dlg;
const shuffleMode = playbackManager.getQueueShuffleMode(this);
const context = dlg;
const cssClass = 'buttonActive';
let shuffleButtons = context.querySelectorAll('.btnShuffleQueue');
const shuffleButtons = context.querySelectorAll('.btnShuffleQueue');
for (let shuffleButton of shuffleButtons) {
for (const shuffleButton of shuffleButtons) {
switch (shuffleMode) {
case 'Shuffle':
shuffleButton.classList.add(cssClass);
@ -873,15 +873,11 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
}
function init(ownerView, context) {
<<<<<<< HEAD
=======
const contextmenuHtml = `<button id="toggleContextMenu" is="paper-icon-button-light" class="btnToggleContextMenu" title=${globalize.translate('ButtonToggleContextMenu')}><span class="material-icons more_vert"></span></button>`;
>>>>>>> 4f0443b2d... Fix linting errors
let volumecontrolHtml = '<div class="volumecontrol flex align-items-center flex-wrap-wrap justify-content-center">';
volumecontrolHtml += `<button is="paper-icon-button-light" class="buttonMute autoSize" title=${globalize.translate('Mute')}><span class="xlargePaperIconButton material-icons volume_up"></span></button>`;
volumecontrolHtml += '<div class="sliderContainer nowPlayingVolumeSliderContainer"><input is="emby-slider" type="range" step="1" min="0" max="100" value="0" class="nowPlayingVolumeSlider"/></div>';
volumecontrolHtml += '</div>';
let optionsSection = context.querySelector('.playlistSectionButton');
const optionsSection = context.querySelector('.playlistSectionButton');
if (!layoutManager.mobile) {
context.querySelector('.nowPlayingSecondaryButtons').insertAdjacentHTML('beforeend', volumecontrolHtml);
optionsSection.classList.remove('align-items-center', 'justify-content-center');

View file

@ -136,7 +136,7 @@ function embed(options, self) {
options.element.querySelector('.btnSave').classList.remove('hide');
}
if (appHost.supports('subtitleappearancesettings')) {
if (appHost.default.supports('subtitleappearancesettings')) {
options.element.querySelector('.subtitleAppearanceSection').classList.remove('hide');
}

View file

@ -24,7 +24,7 @@ import 'emby-itemscontainer';
function showPlaybackInfo(btn, session) {
import('alert').then(({default: alert}) => {
let title;
let text = [];
const text = [];
const displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
if (displayPlayMethod === 'DirectStream') {

View file

@ -38,7 +38,7 @@ import 'cardStyle';
}
function showDeviceMenu(view, btn, deviceId) {
let menuItems = [];
const menuItems = [];
if (canEdit) {
menuItems.push({

View file

@ -315,7 +315,7 @@ import 'listViewStyle';
let currentType;
for (let i = 0, length = profiles.length; i < length; i++) {
let profile = profiles[i];
const profile = profiles[i];
if (profile.Type !== currentType) {
html += '<li data-role="list-divider">' + profile.Type + '</li>';
@ -401,7 +401,7 @@ import 'listViewStyle';
let currentType;
for (let i = 0, length = profiles.length; i < length; i++) {
let profile = profiles[i];
const profile = profiles[i];
if (profile.Type !== currentType) {
html += '<li data-role="list-divider">' + profile.Type + '</li>';
@ -472,7 +472,7 @@ import 'listViewStyle';
let currentType;
for (let i = 0, length = profiles.length; i < length; i++) {
let profile = profiles[i];
const profile = profiles[i];
const type = profile.Type.replace('VideoAudio', 'Video Audio');
if (type !== currentType) {

View file

@ -36,7 +36,7 @@ import 'emby-button';
}
for (let i = 0, length = profiles.length; i < length; i++) {
let profile = profiles[i];
const profile = profiles[i];
html += '<div class="listItem listItem-border">';
html += '<span class="listItemIcon material-icons live_tv"></span>';
html += '<div class="listItemBody two-line">';

View file

@ -33,7 +33,7 @@ import 'emby-select';
const ScheduledTaskPage = {
refreshScheduledTask: function (view) {
loading.show();
let id = getParameterByName('id');
const id = getParameterByName('id');
ApiClient.getScheduledTask(id).then(function (task) {
ScheduledTaskPage.loadScheduledTask(view, task);
});
@ -143,7 +143,7 @@ import 'emby-select';
},
deleteTrigger: function (view, index) {
loading.show();
let id = getParameterByName('id');
const id = getParameterByName('id');
ApiClient.getScheduledTask(id).then(function (task) {
task.Triggers.remove(index);
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
@ -211,7 +211,7 @@ import 'emby-select';
export default function (view, params) {
function onSubmit(e) {
loading.show();
let id = getParameterByName('id');
const id = getParameterByName('id');
ApiClient.getScheduledTask(id).then(function (task) {
task.Triggers.push(ScheduledTaskPage.getTriggerToAdd(view));
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {

View file

@ -103,7 +103,7 @@ import 'emby-button';
}
function setTaskButtonIcon(button, icon) {
let inner = button.querySelector('.material-icons');
const inner = button.querySelector('.material-icons');
inner.classList.remove('stop', 'play_arrow');
inner.classList.add(icon);
}
@ -160,7 +160,7 @@ import 'emby-button';
$('.divScheduledTasks', view).on('click', '.btnStartTask', function() {
const button = this;
let id = button.getAttribute('data-taskid');
const id = button.getAttribute('data-taskid');
ApiClient.startScheduledTask(id).then(function() {
updateTaskButton(button, 'Running');
reloadList(view);
@ -169,7 +169,7 @@ import 'emby-button';
$('.divScheduledTasks', view).on('click', '.btnStopTask', function() {
const button = this;
let id = button.getAttribute('data-taskid');
const id = button.getAttribute('data-taskid');
ApiClient.stopScheduledTask(id).then(function() {
updateTaskButton(button, '');
reloadList(view);

View file

@ -373,7 +373,7 @@ import 'emby-select';
}
function getArtistLinksHtml(artists, serverId, context) {
let html = [];
const html = [];
for (const artist of artists) {
const href = appRouter.getRouteUrl(artist, {

View file

@ -172,9 +172,7 @@ import 'css!assets/css/videoosd';
}
setTitle(displayItem, parentName);
let titleElement;
const osdTitle = view.querySelector('.osdTitle');
titleElement = osdTitle;
const titleElement = view.querySelector('.osdTitle');
let displayName = itemHelper.getDisplayName(displayItem, {
includeParentInfo: displayItem.Type !== 'Program',
includeIndexNumber: displayItem.Type !== 'Program'
@ -1619,7 +1617,7 @@ import 'css!assets/css/videoosd';
const item = currentItem;
if (item && item.Chapters && item.Chapters.length && item.Chapters[0].ImageTag) {
let html = getChapterBubbleHtml(connectionManager.getApiClient(item.ServerId), item, item.Chapters, ticks);
const html = getChapterBubbleHtml(connectionManager.getApiClient(item.ServerId), item, item.Chapters, ticks);
if (html) {
return html;

View file

@ -18,7 +18,7 @@ import 'webcomponents';
function onClick(e) {
const itemsContainer = this;
let multiSelect = itemsContainer.multiSelect;
const multiSelect = itemsContainer.multiSelect;
if (multiSelect) {
if (multiSelect.onContainerClick.call(itemsContainer, e) === false) {
@ -164,7 +164,7 @@ import 'webcomponents';
}
function getEventsToMonitor(itemsContainer) {
let monitor = itemsContainer.getAttribute('data-monitor');
const monitor = itemsContainer.getAttribute('data-monitor');
if (monitor) {
return monitor.split(',');
}
@ -356,7 +356,7 @@ import 'webcomponents';
ItemsContainerPrototype.resume = function (options) {
this.paused = false;
let refreshIntervalEndTime = this.refreshIntervalEndTime;
const refreshIntervalEndTime = this.refreshIntervalEndTime;
if (refreshIntervalEndTime) {
const remainingMs = refreshIntervalEndTime - new Date().getTime();
if (remainingMs > 0 && !this.needsRefresh) {
@ -395,7 +395,7 @@ import 'webcomponents';
return;
}
let timeout = this.refreshTimeout;
const timeout = this.refreshTimeout;
if (timeout) {
clearTimeout(timeout);
}
@ -434,7 +434,7 @@ import 'webcomponents';
function onDataFetched(result) {
const items = result.Items || result;
let parentContainer = this.parentContainer;
const parentContainer = this.parentContainer;
if (parentContainer) {
if (items.length) {
parentContainer.classList.remove('hide');

View file

@ -75,7 +75,7 @@ import EmbyButtonPrototype from 'emby-button';
button.title = globalize.translate('Played');
}
let text = button.querySelector('.button-text');
const text = button.querySelector('.button-text');
if (text) {
text.innerHTML = button.title;
}

View file

@ -118,7 +118,7 @@ const EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
}
function onScrollButtonClick(e) {
let scroller = this.parentNode.nextSibling;
const scroller = this.parentNode.nextSibling;
const direction = this.getAttribute('data-direction');
const scrollSize = getScrollSize(scroller);
@ -161,7 +161,7 @@ const EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
const parent = this.scroller;
this.scroller = null;
let scrollHandler = this.scrollHandler;
const scrollHandler = this.scrollHandler;
if (parent && scrollHandler) {
parent.removeScrollEventListener(scrollHandler, {
capture: false,

View file

@ -24,7 +24,7 @@ import globalize from 'globalize';
// parse strings, leading zeros into proper ints
const a = [1, 2, 3, 4, 5, 6, 10, 11];
for (let i in a) {
for (const i in a) {
d[a[i]] = parseInt(d[a[i]], 10);
}
d[7] = parseFloat(d[7]);

View file

@ -63,11 +63,11 @@ import events from 'events';
}
function ensureTranslations(culture) {
for (let i in allTranslations) {
for (const i in allTranslations) {
ensureTranslation(allTranslations[i], culture);
}
if (culture !== fallbackCulture) {
for (let i in allTranslations) {
for (const i in allTranslations) {
ensureTranslation(allTranslations[i], fallbackCulture);
}
}