Disallow block padding
This commit is contained in:
parent
454b81a037
commit
5e1b6acffe
126 changed files with 2 additions and 2127 deletions
|
@ -28,7 +28,7 @@ module.exports = {
|
|||
],
|
||||
rules: {
|
||||
'block-spacing': ['error'],
|
||||
'brace-style': ['error'],
|
||||
'brace-style': ['error', "1tbs", { "allowSingleLine": true }],
|
||||
'comma-dangle': ['error', 'never'],
|
||||
'comma-spacing': ['error'],
|
||||
'eol-last': ['error'],
|
||||
|
@ -42,6 +42,7 @@ module.exports = {
|
|||
'no-unused-expressions': ['error', { 'allowShortCircuit': true, 'allowTernary': true, 'allowTaggedTemplates': true }],
|
||||
"no-unused-vars": ["error", { "vars": "all", "args": "none", "ignoreRestSiblings": true }],
|
||||
'one-var': ['error', 'never'],
|
||||
'padded-blocks': ['error', 'never'],
|
||||
'quotes': ['error', 'single', { 'avoidEscape': true, 'allowTemplateLiterals': false }],
|
||||
'semi': ['error'],
|
||||
'space-before-blocks': ['error'],
|
||||
|
|
|
@ -9,7 +9,6 @@ import 'scrollStyles';
|
|||
import 'listViewStyle';
|
||||
|
||||
function getOffsets(elems) {
|
||||
|
||||
let results = [];
|
||||
|
||||
if (!document) {
|
||||
|
@ -31,7 +30,6 @@ function getOffsets(elems) {
|
|||
}
|
||||
|
||||
function getPosition(options, dlg) {
|
||||
|
||||
const windowSize = dom.getWindowSize();
|
||||
const windowHeight = windowSize.innerHeight;
|
||||
const windowWidth = windowSize.innerWidth;
|
||||
|
@ -80,7 +78,6 @@ function centerFocus(elem, horiz, on) {
|
|||
}
|
||||
|
||||
export function show(options) {
|
||||
|
||||
// items
|
||||
// positionTo
|
||||
// showCancel
|
||||
|
@ -98,7 +95,6 @@ export function show(options) {
|
|||
isFullscreen = true;
|
||||
dialogOptions.autoFocus = true;
|
||||
} else {
|
||||
|
||||
dialogOptions.modal = false;
|
||||
dialogOptions.entryAnimation = options.entryAnimation;
|
||||
dialogOptions.exitAnimation = options.exitAnimation;
|
||||
|
@ -136,7 +132,6 @@ export function show(options) {
|
|||
let icons = [];
|
||||
let itemIcon;
|
||||
for (const item of options.items) {
|
||||
|
||||
itemIcon = item.icon || (item.selected ? 'check' : null);
|
||||
|
||||
if (itemIcon) {
|
||||
|
@ -161,7 +156,6 @@ export function show(options) {
|
|||
}
|
||||
|
||||
if (options.title) {
|
||||
|
||||
html += '<h1 class="actionSheetTitle">' + options.title + '</h1>';
|
||||
}
|
||||
if (options.text) {
|
||||
|
@ -197,7 +191,6 @@ export function show(options) {
|
|||
const item = options.items[i];
|
||||
|
||||
if (item.divider) {
|
||||
|
||||
html += '<div class="actionsheetDivider"></div>';
|
||||
continue;
|
||||
}
|
||||
|
@ -265,26 +258,20 @@ export function show(options) {
|
|||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
let isResolved;
|
||||
|
||||
dlg.addEventListener('click', function (e) {
|
||||
|
||||
const actionSheetMenuItem = dom.parentWithClass(e.target, 'actionSheetMenuItem');
|
||||
|
||||
if (actionSheetMenuItem) {
|
||||
selectedId = actionSheetMenuItem.getAttribute('data-id');
|
||||
|
||||
if (options.resolveOnClick) {
|
||||
|
||||
if (options.resolveOnClick.indexOf) {
|
||||
|
||||
if (options.resolveOnClick.indexOf(selectedId) !== -1) {
|
||||
|
||||
resolve(selectedId);
|
||||
isResolved = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
resolve(selectedId);
|
||||
isResolved = true;
|
||||
|
@ -293,11 +280,9 @@ export function show(options) {
|
|||
|
||||
dialogHelper.close(dlg);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.actionSheetScroller'), false, false);
|
||||
}
|
||||
|
|
|
@ -10,7 +10,6 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
export default function (text, title) {
|
||||
|
||||
let options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
|
|
|
@ -26,7 +26,6 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function getAlphaPickerButtonClassName(vertical) {
|
||||
|
||||
let alphaPickerButtonClassName = 'alphaPickerButton';
|
||||
|
||||
if (layoutManager.tv) {
|
||||
|
@ -45,14 +44,12 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function mapLetters(letters, vertical) {
|
||||
|
||||
return letters.map(l => {
|
||||
return getLetterButton(l, vertical);
|
||||
});
|
||||
}
|
||||
|
||||
function render(element, options) {
|
||||
|
||||
element.classList.add('alphaPicker');
|
||||
|
||||
if (layoutManager.tv) {
|
||||
|
@ -137,7 +134,6 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function onAlphaPickerInKeyboardModeClick(e) {
|
||||
|
||||
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||
|
||||
if (alphaPickerButton) {
|
||||
|
@ -153,7 +149,6 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function onAlphaPickerClick(e) {
|
||||
|
||||
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||
|
||||
if (alphaPickerButton) {
|
||||
|
@ -167,7 +162,6 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function onAlphaPickerFocusIn(e) {
|
||||
|
||||
if (alphaFocusTimeout) {
|
||||
clearTimeout(alphaFocusTimeout);
|
||||
alphaFocusTimeout = null;
|
||||
|
@ -182,13 +176,11 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
function onItemsFocusIn(e) {
|
||||
|
||||
const item = dom.parentWithClass(e.target, itemClass);
|
||||
|
||||
if (item) {
|
||||
const prefix = item.getAttribute('data-prefix');
|
||||
if (prefix && prefix.length) {
|
||||
|
||||
itemFocusValue = prefix[0];
|
||||
if (itemFocusTimeout) {
|
||||
clearTimeout(itemFocusTimeout);
|
||||
|
@ -199,9 +191,7 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
this.enabled = function (enabled) {
|
||||
|
||||
if (enabled) {
|
||||
|
||||
if (itemsContainer) {
|
||||
itemsContainer.addEventListener('focus', onItemsFocusIn, true);
|
||||
}
|
||||
|
@ -215,9 +205,7 @@ import 'material-icons';
|
|||
} else {
|
||||
element.addEventListener('click', onAlphaPickerClick.bind(this));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
if (itemsContainer) {
|
||||
itemsContainer.removeEventListener('focus', onItemsFocusIn, true);
|
||||
}
|
||||
|
@ -235,14 +223,12 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
value(value, applyValue) {
|
||||
|
||||
const element = this.options.element;
|
||||
let btn;
|
||||
let selected;
|
||||
|
||||
if (value !== undefined) {
|
||||
if (value != null) {
|
||||
|
||||
value = value.toUpperCase();
|
||||
this._currentValue = value;
|
||||
|
||||
|
@ -295,33 +281,27 @@ import 'material-icons';
|
|||
}
|
||||
|
||||
visible(visible) {
|
||||
|
||||
const element = this.options.element;
|
||||
element.style.visibility = visible ? 'visible' : 'hidden';
|
||||
}
|
||||
|
||||
values() {
|
||||
|
||||
const element = this.options.element;
|
||||
const elems = element.querySelectorAll('.alphaPickerButton');
|
||||
const values = [];
|
||||
for (let i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
values.push(elems[i].getAttribute('data-value'));
|
||||
|
||||
}
|
||||
|
||||
return values;
|
||||
}
|
||||
|
||||
focus() {
|
||||
|
||||
const element = this.options.element;
|
||||
focusManager.autoFocus(element, true);
|
||||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
const element = this.options.element;
|
||||
this.enabled(false);
|
||||
element.classList.remove('focuscontainer-x');
|
||||
|
|
|
@ -161,7 +161,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
route: route,
|
||||
path: ctx.path
|
||||
};
|
||||
|
||||
}).catch(function (result) {
|
||||
if (!result || !result.cancelled) {
|
||||
onNewViewNeeded();
|
||||
|
@ -192,12 +191,10 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
}
|
||||
|
||||
function onRequestFail(e, data) {
|
||||
|
||||
var apiClient = this;
|
||||
|
||||
if (data.status === 403) {
|
||||
if (data.errorCode === 'ParentalControl') {
|
||||
|
||||
var isCurrentAllowed = currentRouteInfo ? (currentRouteInfo.route.anonymous || currentRouteInfo.route.startup) : true;
|
||||
|
||||
// Bounce to the login screen, but not if a password entry fails, obviously
|
||||
|
@ -205,7 +202,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
showForcedLogoutMessage(globalize.translate('AccessRestrictedTryAgainLater'));
|
||||
appRouter.showLocalLogin(apiClient.serverId());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -232,7 +228,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
if (navigator.connection) {
|
||||
var max = navigator.connection.downlinkMax;
|
||||
if (max && max > 0 && max < Number.POSITIVE_INFINITY) {
|
||||
|
||||
max /= 8;
|
||||
max *= 1000000;
|
||||
max *= 0.7;
|
||||
|
@ -250,7 +245,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
}
|
||||
|
||||
function onApiClientCreated(e, newApiClient) {
|
||||
|
||||
newApiClient.normalizeImageOptions = normalizeImageOptions;
|
||||
|
||||
if (browser.iOS) {
|
||||
|
@ -264,12 +258,10 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
}
|
||||
|
||||
function initApiClient(apiClient) {
|
||||
|
||||
onApiClientCreated({}, apiClient);
|
||||
}
|
||||
|
||||
function initApiClients() {
|
||||
|
||||
connectionManager.getApiClients().forEach(initApiClient);
|
||||
|
||||
events.on(connectionManager, 'apiclientcreated', onApiClientCreated);
|
||||
|
@ -285,7 +277,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
|
||||
var firstConnectionResult;
|
||||
function start(options) {
|
||||
|
||||
loading.show();
|
||||
|
||||
initApiClients();
|
||||
|
@ -297,7 +288,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
enableAutoLogin: appSettings.enableAutoLogin()
|
||||
|
||||
}).then(function (result) {
|
||||
|
||||
firstConnectionResult = result;
|
||||
|
||||
options = options || {};
|
||||
|
@ -316,14 +306,11 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
}
|
||||
|
||||
function authenticate(ctx, route, callback) {
|
||||
|
||||
var firstResult = firstConnectionResult;
|
||||
if (firstResult) {
|
||||
|
||||
firstConnectionResult = null;
|
||||
|
||||
if (firstResult.State !== 'SignedIn' && !route.anonymous) {
|
||||
|
||||
handleConnectionResult(firstResult);
|
||||
return;
|
||||
}
|
||||
|
@ -352,7 +339,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
}
|
||||
|
||||
if (apiClient && apiClient.isLoggedIn()) {
|
||||
|
||||
console.debug('appRouter - user is authenticated');
|
||||
|
||||
if (route.isDefaultRoute) {
|
||||
|
@ -360,11 +346,8 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
loadUserSkinWithOptions(ctx);
|
||||
return;
|
||||
} else if (route.roles) {
|
||||
|
||||
validateRoles(apiClient, route.roles).then(function () {
|
||||
|
||||
callback();
|
||||
|
||||
}, beginConnectionWizard);
|
||||
return;
|
||||
}
|
||||
|
@ -406,7 +389,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
var isDummyBackToHome;
|
||||
|
||||
function loadContent(ctx, route, html, request) {
|
||||
|
||||
html = globalize.translateHtml(html, route.dictionary);
|
||||
request.view = html;
|
||||
|
||||
|
@ -466,7 +448,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
}
|
||||
|
||||
function getWindowLocationSearch(win) {
|
||||
|
||||
var currentPath = currentRouteInfo ? (currentRouteInfo.path || '') : '';
|
||||
|
||||
var index = currentPath.indexOf('?');
|
||||
|
@ -617,7 +598,6 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
|||
function pushState(state, title, url) {
|
||||
state.navigate = false;
|
||||
history.pushState(state, title, url);
|
||||
|
||||
}
|
||||
|
||||
function setBaseRoute() {
|
||||
|
|
|
@ -291,12 +291,10 @@ import 'programStyles';
|
|||
const primaryImageAspectRatio = imageLoader.getPrimaryImageAspectRatio(items);
|
||||
|
||||
if (['auto', 'autohome', 'autooverflow', 'autoVertical'].includes(options.shape)) {
|
||||
|
||||
const requestedShape = options.shape;
|
||||
options.shape = null;
|
||||
|
||||
if (primaryImageAspectRatio) {
|
||||
|
||||
if (primaryImageAspectRatio >= 3) {
|
||||
options.shape = 'banner';
|
||||
options.coverImage = true;
|
||||
|
@ -394,7 +392,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (newIndexValue !== currentIndexValue) {
|
||||
|
||||
if (hasOpenRow) {
|
||||
html += '</div>';
|
||||
hasOpenRow = false;
|
||||
|
@ -402,7 +399,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (hasOpenSection) {
|
||||
|
||||
html += '</div>';
|
||||
|
||||
if (isVertical) {
|
||||
|
@ -426,7 +422,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (options.rows && itemsInRow === 0) {
|
||||
|
||||
if (hasOpenRow) {
|
||||
html += '</div>';
|
||||
hasOpenRow = false;
|
||||
|
@ -686,7 +681,6 @@ import 'programStyles';
|
|||
let valid = 0;
|
||||
|
||||
for (let i = 0; i < lines.length; i++) {
|
||||
|
||||
let currentCssClass = cssClass;
|
||||
let text = lines[i];
|
||||
|
||||
|
@ -713,7 +707,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (forceLines) {
|
||||
|
||||
let linesLength = maxLines || Math.min(lines.length, maxLines || lines.length);
|
||||
|
||||
while (valid < linesLength) {
|
||||
|
@ -745,7 +738,6 @@ import 'programStyles';
|
|||
let airTimeText = '';
|
||||
|
||||
if (item.StartDate) {
|
||||
|
||||
try {
|
||||
let date = datetime.parseISO8601Date(item.StartDate);
|
||||
|
||||
|
@ -792,7 +784,6 @@ import 'programStyles';
|
|||
const showOtherText = isOuterFooter ? !overlayText : overlayText;
|
||||
|
||||
if (isOuterFooter && options.cardLayout && layoutManager.mobile) {
|
||||
|
||||
if (options.cardFooterAside !== 'none') {
|
||||
html += '<button is="paper-icon-button-light" class="itemAction btnCardOptions cardText-secondary" data-action="menu"><span class="material-icons more_vert"></span></button>';
|
||||
}
|
||||
|
@ -807,9 +798,7 @@ import 'programStyles';
|
|||
|
||||
if (showOtherText) {
|
||||
if ((options.showParentTitle || options.showParentTitleOrTitle) && !parentTitleUnderneath) {
|
||||
|
||||
if (isOuterFooter && item.Type === 'Episode' && item.SeriesName) {
|
||||
|
||||
if (item.SeriesId) {
|
||||
lines.push(getTextActionButton({
|
||||
Id: item.SeriesId,
|
||||
|
@ -822,15 +811,12 @@ import 'programStyles';
|
|||
lines.push(item.SeriesName);
|
||||
}
|
||||
} else {
|
||||
|
||||
if (isUsingLiveTvNaming(item)) {
|
||||
|
||||
lines.push(item.Name);
|
||||
|
||||
if (!item.EpisodeTitle) {
|
||||
titleAdded = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
const parentTitle = item.SeriesName || item.Series || item.Album || item.AlbumArtist || '';
|
||||
|
||||
|
@ -848,7 +834,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (showMediaTitle) {
|
||||
|
||||
const name = options.showTitle === 'auto' && !item.IsFolder && item.MediaType === 'Photo' ? '' : itemHelper.getDisplayName(item, {
|
||||
includeParentInfo: options.includeParentInfoInTitle
|
||||
});
|
||||
|
@ -865,7 +850,6 @@ import 'programStyles';
|
|||
|
||||
if (showOtherText) {
|
||||
if (options.showParentTitle && parentTitleUnderneath) {
|
||||
|
||||
if (isOuterFooter && item.AlbumArtists && item.AlbumArtists.length) {
|
||||
item.AlbumArtists[0].Type = 'MusicArtist';
|
||||
item.AlbumArtists[0].IsFolder = true;
|
||||
|
@ -899,7 +883,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (options.showPremiereDate) {
|
||||
|
||||
if (item.PremiereDate) {
|
||||
try {
|
||||
lines.push(datetime.toLocaleDateString(
|
||||
|
@ -908,7 +891,6 @@ import 'programStyles';
|
|||
));
|
||||
} catch (err) {
|
||||
lines.push('');
|
||||
|
||||
}
|
||||
} else {
|
||||
lines.push('');
|
||||
|
@ -916,14 +898,10 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (options.showYear || options.showSeriesYear) {
|
||||
|
||||
if (item.Type === 'Series') {
|
||||
if (item.Status === 'Continuing') {
|
||||
|
||||
lines.push(globalize.translate('SeriesYearToPresent', item.ProductionYear || ''));
|
||||
|
||||
} else {
|
||||
|
||||
if (item.EndDate && item.ProductionYear) {
|
||||
const endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||
lines.push(item.ProductionYear + ((endYear === item.ProductionYear) ? '' : (' - ' + endYear)));
|
||||
|
@ -937,9 +915,7 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (options.showRuntime) {
|
||||
|
||||
if (item.RunTimeTicks) {
|
||||
|
||||
lines.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
|
||||
} else {
|
||||
lines.push('');
|
||||
|
@ -947,14 +923,11 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (options.showAirTime) {
|
||||
|
||||
lines.push(getAirTimeText(item, options.showAirDateTime, options.showAirEndTime) || '');
|
||||
}
|
||||
|
||||
if (options.showChannelName) {
|
||||
|
||||
if (item.ChannelId) {
|
||||
|
||||
lines.push(getTextActionButton({
|
||||
|
||||
Id: item.ChannelId,
|
||||
|
@ -971,7 +944,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (options.showCurrentProgram && item.Type === 'TvChannel') {
|
||||
|
||||
if (item.CurrentProgram) {
|
||||
lines.push(item.CurrentProgram.Name);
|
||||
} else {
|
||||
|
@ -980,7 +952,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (options.showCurrentProgramTime && item.Type === 'TvChannel') {
|
||||
|
||||
if (item.CurrentProgram) {
|
||||
lines.push(getAirTimeText(item.CurrentProgram, false, true) || '');
|
||||
} else {
|
||||
|
@ -990,7 +961,6 @@ import 'programStyles';
|
|||
|
||||
if (options.showSeriesTimerTime) {
|
||||
if (item.RecordAnyTime) {
|
||||
|
||||
lines.push(globalize.translate('Anytime'));
|
||||
} else {
|
||||
lines.push(datetime.getDisplayTime(item.StartDate));
|
||||
|
@ -1025,7 +995,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (html) {
|
||||
|
||||
if (!isOuterFooter || logoUrl || options.cardLayout) {
|
||||
html = '<div class="' + footerClass + '">' + html;
|
||||
|
||||
|
@ -1071,27 +1040,21 @@ import 'programStyles';
|
|||
let childText;
|
||||
|
||||
if (item.Type === 'Playlist') {
|
||||
|
||||
childText = '';
|
||||
|
||||
if (item.RunTimeTicks) {
|
||||
|
||||
let minutes = item.RunTimeTicks / 600000000;
|
||||
|
||||
minutes = minutes || 1;
|
||||
|
||||
childText += globalize.translate('ValueMinutes', Math.round(minutes));
|
||||
|
||||
} else {
|
||||
childText += globalize.translate('ValueMinutes', 0);
|
||||
}
|
||||
|
||||
counts.push(childText);
|
||||
|
||||
} else if (item.Type === 'Genre' || item.Type === 'Studio') {
|
||||
|
||||
if (item.MovieCount) {
|
||||
|
||||
childText = item.MovieCount === 1 ?
|
||||
globalize.translate('ValueOneMovie') :
|
||||
globalize.translate('ValueMovieCount', item.MovieCount);
|
||||
|
@ -1100,7 +1063,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (item.SeriesCount) {
|
||||
|
||||
childText = item.SeriesCount === 1 ?
|
||||
globalize.translate('ValueOneSeries') :
|
||||
globalize.translate('ValueSeriesCount', item.SeriesCount);
|
||||
|
@ -1108,18 +1070,14 @@ import 'programStyles';
|
|||
counts.push(childText);
|
||||
}
|
||||
if (item.EpisodeCount) {
|
||||
|
||||
childText = item.EpisodeCount === 1 ?
|
||||
globalize.translate('ValueOneEpisode') :
|
||||
globalize.translate('ValueEpisodeCount', item.EpisodeCount);
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
|
||||
} else if (item.Type === 'MusicGenre' || options.context === 'MusicArtist') {
|
||||
|
||||
if (item.AlbumCount) {
|
||||
|
||||
childText = item.AlbumCount === 1 ?
|
||||
globalize.translate('ValueOneAlbum') :
|
||||
globalize.translate('ValueAlbumCount', item.AlbumCount);
|
||||
|
@ -1127,7 +1085,6 @@ import 'programStyles';
|
|||
counts.push(childText);
|
||||
}
|
||||
if (item.SongCount) {
|
||||
|
||||
childText = item.SongCount === 1 ?
|
||||
globalize.translate('ValueOneSong') :
|
||||
globalize.translate('ValueSongCount', item.SongCount);
|
||||
|
@ -1135,16 +1092,13 @@ import 'programStyles';
|
|||
counts.push(childText);
|
||||
}
|
||||
if (item.MusicVideoCount) {
|
||||
|
||||
childText = item.MusicVideoCount === 1 ?
|
||||
globalize.translate('ValueOneMusicVideo') :
|
||||
globalize.translate('ValueMusicVideoCount', item.MusicVideoCount);
|
||||
|
||||
counts.push(childText);
|
||||
}
|
||||
|
||||
} else if (item.Type === 'Series') {
|
||||
|
||||
childText = item.RecursiveItemCount === 1 ?
|
||||
globalize.translate('ValueOneEpisode') :
|
||||
globalize.translate('ValueEpisodeCount', item.RecursiveItemCount);
|
||||
|
@ -1198,13 +1152,11 @@ import 'programStyles';
|
|||
let shape = options.shape;
|
||||
|
||||
if (shape === 'mixed') {
|
||||
|
||||
shape = null;
|
||||
|
||||
const primaryImageAspectRatio = item.PrimaryImageAspectRatio;
|
||||
|
||||
if (primaryImageAspectRatio) {
|
||||
|
||||
if (primaryImageAspectRatio >= 1.33) {
|
||||
shape = 'mixedBackdrop';
|
||||
} else if (primaryImageAspectRatio > 0.71) {
|
||||
|
@ -1296,7 +1248,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (overlayText) {
|
||||
|
||||
logoUrl = null;
|
||||
|
||||
footerCssClass = progressHtml ? 'innerCardFooter fullInnerCardFooter' : 'innerCardFooter';
|
||||
|
@ -1405,7 +1356,6 @@ import 'programStyles';
|
|||
indicatorsHtml += indicators.getTypeIndicator(item);
|
||||
|
||||
if (options.showGroupCount) {
|
||||
|
||||
indicatorsHtml += indicators.getChildCountIndicatorHtml(item, {
|
||||
minCount: 1
|
||||
});
|
||||
|
@ -1505,7 +1455,6 @@ import 'programStyles';
|
|||
}
|
||||
|
||||
if (itemHelper.canRate(item)) {
|
||||
|
||||
const likes = userData.Likes == null ? '' : userData.Likes;
|
||||
|
||||
/* eslint-disable-next-line no-unused-expressions */
|
||||
|
@ -1586,7 +1535,6 @@ import 'programStyles';
|
|||
const html = buildCardsHtmlInternal(items, options);
|
||||
|
||||
if (html) {
|
||||
|
||||
if (options.itemsContainer.cardBuilderHtml !== html) {
|
||||
options.itemsContainer.innerHTML = html;
|
||||
|
||||
|
@ -1599,7 +1547,6 @@ import 'programStyles';
|
|||
|
||||
imageLoader.lazyChildren(options.itemsContainer);
|
||||
} else {
|
||||
|
||||
options.itemsContainer.innerHTML = html;
|
||||
options.itemsContainer.cardBuilderHtml = null;
|
||||
}
|
||||
|
@ -1623,7 +1570,6 @@ import 'programStyles';
|
|||
indicatorsElem = card.querySelector('.cardIndicators');
|
||||
|
||||
if (!indicatorsElem) {
|
||||
|
||||
const cardImageContainer = card.querySelector('.cardImageContainer');
|
||||
indicatorsElem = document.createElement('div');
|
||||
indicatorsElem.classList.add('cardIndicators');
|
||||
|
@ -1647,11 +1593,9 @@ import 'programStyles';
|
|||
let itemProgressBar = null;
|
||||
|
||||
if (userData.Played) {
|
||||
|
||||
playedIndicator = card.querySelector('.playedIndicator');
|
||||
|
||||
if (!playedIndicator) {
|
||||
|
||||
playedIndicator = document.createElement('div');
|
||||
playedIndicator.classList.add('playedIndicator');
|
||||
playedIndicator.classList.add('indicator');
|
||||
|
@ -1660,10 +1604,8 @@ import 'programStyles';
|
|||
}
|
||||
playedIndicator.innerHTML = '<span class="material-icons indicatorIcon check"></span>';
|
||||
} else {
|
||||
|
||||
playedIndicator = card.querySelector('.playedIndicator');
|
||||
if (playedIndicator) {
|
||||
|
||||
playedIndicator.parentNode.removeChild(playedIndicator);
|
||||
}
|
||||
}
|
||||
|
@ -1671,7 +1613,6 @@ import 'programStyles';
|
|||
countIndicator = card.querySelector('.countIndicator');
|
||||
|
||||
if (!countIndicator) {
|
||||
|
||||
countIndicator = document.createElement('div');
|
||||
countIndicator.classList.add('countIndicator');
|
||||
indicatorsElem = ensureIndicators(card, indicatorsElem);
|
||||
|
@ -1679,10 +1620,8 @@ import 'programStyles';
|
|||
}
|
||||
countIndicator.innerHTML = userData.UnplayedItemCount;
|
||||
} else if (enableCountIndicator) {
|
||||
|
||||
countIndicator = card.querySelector('.countIndicator');
|
||||
if (countIndicator) {
|
||||
|
||||
countIndicator.parentNode.removeChild(countIndicator);
|
||||
}
|
||||
}
|
||||
|
@ -1694,7 +1633,6 @@ import 'programStyles';
|
|||
});
|
||||
|
||||
if (progressHtml) {
|
||||
|
||||
itemProgressBar = card.querySelector('.itemProgressBar');
|
||||
|
||||
if (!itemProgressBar) {
|
||||
|
@ -1713,7 +1651,6 @@ import 'programStyles';
|
|||
|
||||
itemProgressBar.innerHTML = progressHtml;
|
||||
} else {
|
||||
|
||||
itemProgressBar = card.querySelector('.itemProgressBar');
|
||||
if (itemProgressBar) {
|
||||
itemProgressBar.parentNode.removeChild(itemProgressBar);
|
||||
|
|
|
@ -14,7 +14,6 @@ import browser from 'browser';
|
|||
const enableFocusTransform = !browser.slow && !browser.edge;
|
||||
|
||||
function buildChapterCardsHtml(item, chapters, options) {
|
||||
|
||||
// TODO move card creation code to Card component
|
||||
|
||||
let className = 'card itemAction chapterCard';
|
||||
|
@ -35,7 +34,6 @@ import browser from 'browser';
|
|||
let shape = (options.backdropShape || 'backdrop');
|
||||
|
||||
if (videoStream.Width && videoStream.Height) {
|
||||
|
||||
if ((videoStream.Width / videoStream.Height) <= 1.2) {
|
||||
shape = (options.squareShape || 'square');
|
||||
}
|
||||
|
@ -53,7 +51,6 @@ import browser from 'browser';
|
|||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
for (let i = 0, length = chapters.length; i < length; i++) {
|
||||
|
||||
if (options.rows && itemsInRow === 0) {
|
||||
html += '<div class="cardColumn">';
|
||||
}
|
||||
|
@ -73,9 +70,7 @@ import browser from 'browser';
|
|||
}
|
||||
|
||||
function getImgUrl({Id}, {ImageTag}, index, maxWidth, apiClient) {
|
||||
|
||||
if (ImageTag) {
|
||||
|
||||
return apiClient.getScaledImageUrl(Id, {
|
||||
|
||||
maxWidth: maxWidth * 2,
|
||||
|
@ -89,7 +84,6 @@ import browser from 'browser';
|
|||
}
|
||||
|
||||
function buildChapterCard(item, apiClient, chapter, index, {width, coverImage}, className, shape) {
|
||||
|
||||
const imgUrl = getImgUrl(item, chapter, index, width || 400, apiClient);
|
||||
|
||||
let cardImageContainerClass = 'cardContent cardContent-shadow cardImageContainer chapterCardImageContainer';
|
||||
|
@ -116,7 +110,6 @@ import browser from 'browser';
|
|||
}
|
||||
|
||||
export function buildChapterCards(item, chapters, options) {
|
||||
|
||||
if (options.parentContainer) {
|
||||
// Abort if the container has been disposed
|
||||
if (!document.body.contains(options.parentContainer)) {
|
||||
|
|
|
@ -8,7 +8,6 @@
|
|||
import cardBuilder from 'cardBuilder';
|
||||
|
||||
export function buildPeopleCards(items, options) {
|
||||
|
||||
options = Object.assign(options || {}, {
|
||||
cardLayout: false,
|
||||
centerText: true,
|
||||
|
|
|
@ -38,7 +38,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function createCollection(apiClient, dlg) {
|
||||
|
||||
const url = apiClient.getUrl('Collections', {
|
||||
|
||||
Name: dlg.querySelector('#txtNewCollectionName').value,
|
||||
|
@ -52,7 +51,6 @@ import 'flexStyles';
|
|||
dataType: 'json'
|
||||
|
||||
}).then(result => {
|
||||
|
||||
loading.hide();
|
||||
|
||||
const id = result.Id;
|
||||
|
@ -60,17 +58,14 @@ import 'flexStyles';
|
|||
dlg.submitted = true;
|
||||
dialogHelper.close(dlg);
|
||||
redirectToCollection(apiClient, id);
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function redirectToCollection(apiClient, id) {
|
||||
|
||||
appRouter.showItem(id, apiClient.serverId());
|
||||
}
|
||||
|
||||
function addToCollection(apiClient, dlg, id) {
|
||||
|
||||
const url = apiClient.getUrl(`Collections/${id}/Items`, {
|
||||
|
||||
Ids: dlg.querySelector('.fldSelectedItemIds').value || ''
|
||||
|
@ -81,7 +76,6 @@ import 'flexStyles';
|
|||
url: url
|
||||
|
||||
}).then(() => {
|
||||
|
||||
loading.hide();
|
||||
|
||||
dlg.submitted = true;
|
||||
|
@ -98,7 +92,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function populateCollections(panel) {
|
||||
|
||||
loading.show();
|
||||
|
||||
const select = panel.querySelector('#selectCollectionToAddTo');
|
||||
|
@ -115,13 +108,11 @@ import 'flexStyles';
|
|||
|
||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += `<option value="">${globalize.translate('OptionNew')}</option>`;
|
||||
|
||||
html += result.Items.map(i => {
|
||||
|
||||
return `<option value="${i.Id}">${i.Name}</option>`;
|
||||
});
|
||||
|
||||
|
@ -134,7 +125,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getEditorHtml() {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += '<div class="formDialogContent smoothScrollY" style="padding-top:2em;">';
|
||||
|
@ -182,7 +172,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function initEditor(content, items) {
|
||||
|
||||
content.querySelector('#selectCollectionToAddTo').addEventListener('change', function () {
|
||||
if (this.value) {
|
||||
content.querySelector('.newCollectionInfo').classList.add('hide');
|
||||
|
@ -219,7 +208,6 @@ import 'flexStyles';
|
|||
|
||||
export class showEditor {
|
||||
constructor(options) {
|
||||
|
||||
const items = options.items || {};
|
||||
currentServerId = options.serverId;
|
||||
|
||||
|
@ -256,7 +244,6 @@ import 'flexStyles';
|
|||
initEditor(dlg, items);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
|
@ -265,7 +252,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
return dialogHelper.open(dlg).then(() => {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import globalize from 'globalize';
|
|||
|
||||
/* eslint-disable indent */
|
||||
export default (() => {
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import 'flexStyles';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function showDialog(options, template) {
|
||||
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -64,7 +63,6 @@ import 'flexStyles';
|
|||
let hasDescriptions = false;
|
||||
|
||||
for (i = 0, length = options.buttons.length; i < length; i++) {
|
||||
|
||||
const item = options.buttons[i];
|
||||
const autoFocus = i === 0 ? ' autofocus' : '';
|
||||
|
||||
|
@ -107,7 +105,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
return dialogHelper.open(dlg).then(() => {
|
||||
|
||||
if (enableTvLayout) {
|
||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||
}
|
||||
|
@ -121,7 +118,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
export async function show(text, title) {
|
||||
|
||||
let options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
|
|
|
@ -12,7 +12,6 @@ import 'scrollStyles';
|
|||
let globalOnOpenCallback;
|
||||
|
||||
function enableAnimation() {
|
||||
|
||||
// too slow
|
||||
if (browser.tv) {
|
||||
return false;
|
||||
|
@ -22,7 +21,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function removeCenterFocus(dlg) {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
if (dlg.classList.contains('scrollX')) {
|
||||
centerFocus(dlg, true, false);
|
||||
|
@ -35,7 +33,6 @@ import 'scrollStyles';
|
|||
function tryRemoveElement(elem) {
|
||||
const parentNode = elem.parentNode;
|
||||
if (parentNode) {
|
||||
|
||||
// Seeing crashes in edge webview
|
||||
try {
|
||||
parentNode.removeChild(elem);
|
||||
|
@ -46,14 +43,12 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function DialogHashHandler(dlg, hash, resolve) {
|
||||
|
||||
const self = this;
|
||||
self.originalUrl = window.location.href;
|
||||
const activeElement = document.activeElement;
|
||||
let removeScrollLockOnClose = false;
|
||||
|
||||
function onHashChange(e) {
|
||||
|
||||
const isBack = self.originalUrl === window.location.href;
|
||||
|
||||
if (isBack || !isOpened(dlg)) {
|
||||
|
@ -67,7 +62,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function onBackCommand(e) {
|
||||
|
||||
if (e.detail.command === 'back') {
|
||||
self.closedByBack = true;
|
||||
e.preventDefault();
|
||||
|
@ -77,7 +71,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function onDialogClosed() {
|
||||
|
||||
if (!isHistoryEnabled(dlg)) {
|
||||
inputManager.off(dlg, onBackCommand);
|
||||
}
|
||||
|
@ -158,7 +151,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function addBackdropOverlay(dlg) {
|
||||
|
||||
const backdrop = document.createElement('div');
|
||||
backdrop.classList.add('dialogBackdrop');
|
||||
|
||||
|
@ -193,7 +185,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
export function open(dlg) {
|
||||
|
||||
if (globalOnOpenCallback) {
|
||||
globalOnOpenCallback(dlg);
|
||||
}
|
||||
|
@ -210,19 +201,16 @@ import 'scrollStyles';
|
|||
document.body.appendChild(dialogContainer);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
new DialogHashHandler(dlg, `dlg${new Date().getTime()}`, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
function isOpened(dlg) {
|
||||
|
||||
//return dlg.opened;
|
||||
return !dlg.classList.contains('hide');
|
||||
}
|
||||
|
||||
export function close(dlg) {
|
||||
|
||||
if (isOpened(dlg)) {
|
||||
if (isHistoryEnabled(dlg)) {
|
||||
history.back();
|
||||
|
@ -233,9 +221,7 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function closeDialog(dlg) {
|
||||
|
||||
if (!dlg.classList.contains('hide')) {
|
||||
|
||||
dlg.dispatchEvent(new CustomEvent('closing', {
|
||||
bubbles: false,
|
||||
cancelable: false
|
||||
|
@ -256,7 +242,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function animateDialogOpen(dlg) {
|
||||
|
||||
const onAnimationFinish = () => {
|
||||
focusManager.pushScope(dlg);
|
||||
|
||||
|
@ -271,7 +256,6 @@ import 'scrollStyles';
|
|||
};
|
||||
|
||||
if (enableAnimation()) {
|
||||
|
||||
const onFinish = () => {
|
||||
dom.removeEventListener(dlg, dom.whichAnimationEvent(), onFinish, {
|
||||
once: true
|
||||
|
@ -288,13 +272,10 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function animateDialogClose(dlg, onAnimationFinish) {
|
||||
|
||||
if (enableAnimation()) {
|
||||
|
||||
let animated = true;
|
||||
|
||||
switch (dlg.animationConfig.exit.name) {
|
||||
|
||||
case 'fadeout':
|
||||
dlg.style.animation = `fadeout ${dlg.animationConfig.exit.timing.duration}ms ease-out normal both`;
|
||||
break;
|
||||
|
@ -329,7 +310,6 @@ import 'scrollStyles';
|
|||
const supportsOverscrollBehavior = 'overscroll-behavior-y' in document.body.style;
|
||||
|
||||
function shouldLockDocumentScroll(options) {
|
||||
|
||||
if (supportsOverscrollBehavior && (options.size || !browser.touch)) {
|
||||
return false;
|
||||
}
|
||||
|
@ -350,7 +330,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
function removeBackdrop(dlg) {
|
||||
|
||||
const backdrop = dlg.backdrop;
|
||||
|
||||
if (!backdrop) {
|
||||
|
@ -364,7 +343,6 @@ import 'scrollStyles';
|
|||
};
|
||||
|
||||
if (enableAnimation()) {
|
||||
|
||||
backdrop.classList.remove('dialogBackdropOpened');
|
||||
|
||||
// this is not firing animatonend
|
||||
|
@ -383,7 +361,6 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
export function createDialog(options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
// If there's no native dialog support, use a plain div
|
||||
|
@ -473,9 +450,7 @@ import 'scrollStyles';
|
|||
}
|
||||
|
||||
if (enableAnimation()) {
|
||||
|
||||
switch (dlg.animationConfig.entry.name) {
|
||||
|
||||
case 'fadein':
|
||||
dlg.style.animation = `fadein ${entryAnimationDuration}ms ease-out normal`;
|
||||
break;
|
||||
|
|
|
@ -55,7 +55,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function loadSoundEffects(context, userSettings) {
|
||||
|
||||
const selectSoundEffects = context.querySelector('.selectSoundEffects');
|
||||
const options = pluginManager.ofType('soundeffects').map(plugin => {
|
||||
return {
|
||||
|
@ -81,7 +80,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function loadSkins(context, userSettings) {
|
||||
|
||||
const selectSkin = context.querySelector('.selectSkin');
|
||||
|
||||
const options = pluginManager.ofType('skin').map(plugin => {
|
||||
|
@ -108,7 +106,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function showOrHideMissingEpisodesField(context) {
|
||||
|
||||
if (browser.tizen || browser.web0s) {
|
||||
context.querySelector('.fldDisplayMissingEpisodes').classList.add('hide');
|
||||
return;
|
||||
|
@ -118,7 +115,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function loadForm(context, user, userSettings) {
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
context.querySelector('.selectDashboardThemeContainer').classList.remove('hide');
|
||||
} else {
|
||||
|
@ -213,7 +209,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function saveUser(context, user, userSettingsInstance, apiClient) {
|
||||
|
||||
appSettings.runAtStartup(context.querySelector('.chkRunAtStartup').checked);
|
||||
|
||||
user.Configuration.DisplayMissingEpisodes = context.querySelector('.chkDisplayMissingEpisodes').checked;
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
/* eslint-disable indent */
|
||||
export function getFetchPromise(request) {
|
||||
|
||||
const headers = request.headers || {};
|
||||
|
||||
if (request.dataType === 'json') {
|
||||
|
@ -16,7 +15,6 @@
|
|||
let contentType = request.contentType;
|
||||
|
||||
if (request.data) {
|
||||
|
||||
if (typeof request.data === 'string') {
|
||||
fetchRequest.body = request.data;
|
||||
} else {
|
||||
|
@ -27,7 +25,6 @@
|
|||
}
|
||||
|
||||
if (contentType) {
|
||||
|
||||
headers['Content-Type'] = contentType;
|
||||
}
|
||||
|
||||
|
@ -48,11 +45,9 @@
|
|||
}
|
||||
|
||||
function fetchWithTimeout(url, options, timeoutMs) {
|
||||
|
||||
console.debug(`fetchWithTimeout: timeoutMs: ${timeoutMs}, url: ${url}`);
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
const timeout = setTimeout(reject, timeoutMs);
|
||||
|
||||
options = options || {};
|
||||
|
@ -65,7 +60,6 @@
|
|||
|
||||
resolve(response);
|
||||
}, function (error) {
|
||||
|
||||
clearTimeout(timeout);
|
||||
|
||||
console.debug(`fetchWithTimeout: timed out connecting to url: ${url}`);
|
||||
|
|
|
@ -2,19 +2,15 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
'use strict';
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function renderOptions(context, selector, cssClass, items, isCheckedFn) {
|
||||
|
||||
var elem = context.querySelector(selector);
|
||||
|
||||
if (items.length) {
|
||||
|
||||
elem.classList.remove('hide');
|
||||
|
||||
} else {
|
||||
elem.classList.add('hide');
|
||||
}
|
||||
|
@ -22,7 +18,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
var html = '';
|
||||
|
||||
html += items.map(function (filter) {
|
||||
|
||||
var itemHtml = '';
|
||||
|
||||
var checkedHtml = isCheckedFn(filter) ? ' checked' : '';
|
||||
|
@ -32,7 +27,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
itemHtml += '</label>';
|
||||
|
||||
return itemHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
elem.querySelector('.filterOptions').innerHTML = html;
|
||||
|
@ -47,7 +41,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}
|
||||
|
||||
function loadDynamicFilters(context, options) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
|
||||
var filterMenuOptions = Object.assign(options.filterMenuOptions, {
|
||||
|
@ -63,7 +56,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}
|
||||
|
||||
function initEditor(context, settings) {
|
||||
|
||||
context.querySelector('form').addEventListener('submit', onSubmit);
|
||||
|
||||
var elems = context.querySelectorAll('.simpleFilter');
|
||||
|
@ -71,7 +63,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
var length;
|
||||
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
if (elems[i].tagName === 'INPUT') {
|
||||
elems[i].checked = settings[elems[i].getAttribute('data-settingname')] || false;
|
||||
} else {
|
||||
|
@ -83,7 +74,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
elems = context.querySelectorAll('.chkVideoTypeFilter');
|
||||
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
elems[i].checked = videoTypes.indexOf(elems[i].getAttribute('data-filter')) !== -1;
|
||||
}
|
||||
|
||||
|
@ -91,7 +81,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
elems = context.querySelectorAll('.chkSeriesStatus');
|
||||
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
elems[i].checked = seriesStatuses.indexOf(elems[i].getAttribute('data-filter')) !== -1;
|
||||
}
|
||||
|
||||
|
@ -109,12 +98,10 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}
|
||||
|
||||
function saveValues(context, settings, settingsKey) {
|
||||
|
||||
var elems = context.querySelectorAll('.simpleFilter');
|
||||
var i;
|
||||
var length;
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
if (elems[i].tagName === 'INPUT') {
|
||||
setBasicFilter(context, settingsKey + '-filter-' + elems[i].getAttribute('data-settingname'), elems[i]);
|
||||
} else {
|
||||
|
@ -127,7 +114,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
elems = context.querySelectorAll('.chkVideoTypeFilter');
|
||||
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
if (elems[i].checked) {
|
||||
videoTypes.push(elems[i].getAttribute('data-filter'));
|
||||
}
|
||||
|
@ -139,7 +125,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
elems = context.querySelectorAll('.chkSeriesStatus');
|
||||
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
if (elems[i].checked) {
|
||||
seriesStatuses.push(elems[i].getAttribute('data-filter'));
|
||||
}
|
||||
|
@ -150,7 +135,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
elems = context.querySelectorAll('.chkGenreFilter');
|
||||
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
if (elems[i].checked) {
|
||||
genres.push(elems[i].getAttribute('data-filter'));
|
||||
}
|
||||
|
@ -159,7 +143,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}
|
||||
|
||||
function setBasicFilter(context, key, elem) {
|
||||
|
||||
var value = elem.checked;
|
||||
value = value ? value : null;
|
||||
userSettings.setFilter(key, value);
|
||||
|
@ -173,7 +156,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}
|
||||
|
||||
function moveCheckboxFocus(elem, offset) {
|
||||
|
||||
var parent = dom.parentWithClass(elem, 'checkboxList-verticalwrap');
|
||||
var elems = focusManager.getFocusableElements(parent);
|
||||
|
||||
|
@ -198,7 +180,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
|
||||
function onInputCommand(e) {
|
||||
switch (e.detail.command) {
|
||||
|
||||
case 'left':
|
||||
moveCheckboxFocus(e.target, -1);
|
||||
e.preventDefault();
|
||||
|
@ -217,7 +198,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}
|
||||
|
||||
function bindCheckboxInput(context, on) {
|
||||
|
||||
var elems = context.querySelectorAll('.checkboxList-verticalwrap');
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
if (on) {
|
||||
|
@ -229,11 +209,8 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}
|
||||
|
||||
FilterMenu.prototype.show = function (options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['text!./filtermenu.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -276,7 +253,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
bindCheckboxInput(dlg, true);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
|
@ -291,7 +267,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}, true);
|
||||
|
||||
dialogHelper.open(dlg).then(function () {
|
||||
|
||||
bindCheckboxInput(dlg, false);
|
||||
|
||||
if (layoutManager.tv) {
|
||||
|
@ -299,7 +274,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
|||
}
|
||||
|
||||
if (submitted) {
|
||||
|
||||
//if (!options.onChange) {
|
||||
saveValues(dlg, options.settings, options.settingsKey);
|
||||
resolve();
|
||||
|
|
|
@ -7,14 +7,12 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function popScope(elem) {
|
||||
|
||||
if (scopes.length) {
|
||||
scopes.length -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
function autoFocus(view, defaultToFirst, findAutoFocusElement) {
|
||||
|
||||
var element;
|
||||
if (findAutoFocusElement !== false) {
|
||||
element = view.querySelector('*[autofocus]');
|
||||
|
@ -37,7 +35,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function focus(element) {
|
||||
|
||||
try {
|
||||
element.focus({
|
||||
preventScroll: scrollManager.isEnabled()
|
||||
|
@ -50,16 +47,13 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
var focusableTagNames = ['INPUT', 'TEXTAREA', 'SELECT', 'BUTTON', 'A'];
|
||||
var focusableContainerTagNames = ['BODY', 'DIALOG'];
|
||||
var focusableQuery = focusableTagNames.map(function (t) {
|
||||
|
||||
if (t === 'INPUT') {
|
||||
t += ':not([type="range"]):not([type="file"])';
|
||||
}
|
||||
return t + ':not([tabindex="-1"]):not(:disabled)';
|
||||
|
||||
}).join(',') + ',.focusable';
|
||||
|
||||
function isFocusable(elem) {
|
||||
|
||||
if (focusableTagNames.indexOf(elem.tagName) !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
@ -83,7 +77,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function focusableParent(elem) {
|
||||
|
||||
var originalElement = elem;
|
||||
|
||||
while (!isFocusable(elem)) {
|
||||
|
@ -101,7 +94,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
|
||||
// Determines if a focusable element can be focused at a given point in time
|
||||
function isCurrentlyFocusableInternal(elem) {
|
||||
|
||||
// http://stackoverflow.com/questions/19669786/check-if-element-is-visible-in-dom
|
||||
if (elem.offsetParent === null) {
|
||||
return false;
|
||||
|
@ -112,7 +104,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
|
||||
// Determines if a focusable element can be focused at a given point in time
|
||||
function isCurrentlyFocusable(elem) {
|
||||
|
||||
if (elem.disabled) {
|
||||
return false;
|
||||
}
|
||||
|
@ -143,7 +134,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
var focusableElements = [];
|
||||
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
var elem = elems[i];
|
||||
|
||||
if (excludeClass && elem.classList.contains(excludeClass)) {
|
||||
|
@ -163,7 +153,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function isFocusContainer(elem, direction) {
|
||||
|
||||
if (focusableContainerTagNames.indexOf(elem.tagName) !== -1) {
|
||||
return true;
|
||||
}
|
||||
|
@ -217,7 +206,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function getOffset(elem) {
|
||||
|
||||
var box;
|
||||
|
||||
// Support: BlackBerry 5, iOS 3 (original iPhone)
|
||||
|
@ -234,7 +222,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
if (box.right === null) {
|
||||
|
||||
// Create a new object because some browsers will throw an error when trying to set data onto the Rect object
|
||||
var newBox = {
|
||||
top: box.top,
|
||||
|
@ -253,7 +240,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function nav(activeElement, direction, container, focusableElements) {
|
||||
|
||||
activeElement = activeElement || document.activeElement;
|
||||
|
||||
if (activeElement) {
|
||||
|
@ -305,7 +291,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
switch (direction) {
|
||||
|
||||
case 0:
|
||||
// left
|
||||
if (elementRect.left >= rect.left) {
|
||||
|
@ -361,7 +346,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
var distY;
|
||||
|
||||
switch (direction) {
|
||||
|
||||
case 0:
|
||||
// left
|
||||
distX = Math.abs(point1x - Math.min(point1x, x2));
|
||||
|
@ -395,7 +379,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
if (nearestElement) {
|
||||
|
||||
// See if there's a focusable container, and if so, send the focus command to that
|
||||
if (activeElement) {
|
||||
var nearestElementFocusableParent = dom.parentWithClass(nearestElement, 'focusable');
|
||||
|
@ -410,12 +393,10 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function intersectsInternal(a1, a2, b1, b2) {
|
||||
|
||||
return (b1 >= a1 && b1 <= a2) || (b2 >= a1 && b2 <= a2);
|
||||
}
|
||||
|
||||
function intersects(a1, a2, b1, b2) {
|
||||
|
||||
return intersectsInternal(a1, a2, b1, b2) || intersectsInternal(b1, b2, a1, a2);
|
||||
}
|
||||
|
||||
|
@ -426,11 +407,9 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function focusFirst(container, focusableSelector) {
|
||||
|
||||
var elems = container.querySelectorAll(focusableSelector);
|
||||
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
var elem = elems[i];
|
||||
|
||||
if (isCurrentlyFocusableInternal(elem)) {
|
||||
|
@ -441,11 +420,9 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function focusLast(container, focusableSelector) {
|
||||
|
||||
var elems = [].slice.call(container.querySelectorAll(focusableSelector), 0).reverse();
|
||||
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
var elem = elems[i];
|
||||
|
||||
if (isCurrentlyFocusableInternal(elem)) {
|
||||
|
@ -456,7 +433,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
}
|
||||
|
||||
function moveFocus(sourceElement, container, focusableSelector, offset) {
|
||||
|
||||
var elems = container.querySelectorAll(focusableSelector);
|
||||
var list = [];
|
||||
var i;
|
||||
|
@ -464,7 +440,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
var elem;
|
||||
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
elem = elems[i];
|
||||
|
||||
if (isCurrentlyFocusableInternal(elem)) {
|
||||
|
@ -475,7 +450,6 @@ define(['dom', 'scrollManager'], function (dom, scrollManager) {
|
|||
var currentIndex = -1;
|
||||
|
||||
for (i = 0, length = list.length; i < length; i++) {
|
||||
|
||||
elem = list[i];
|
||||
|
||||
if (sourceElement === elem || elem.contains(sourceElement)) {
|
||||
|
|
|
@ -2,12 +2,10 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
|||
'use strict';
|
||||
|
||||
function saveCategories(context, options) {
|
||||
|
||||
var categories = [];
|
||||
|
||||
var chkCategorys = context.querySelectorAll('.chkCategory');
|
||||
for (var i = 0, length = chkCategorys.length; i < length; i++) {
|
||||
|
||||
var type = chkCategorys[i].getAttribute('data-type');
|
||||
|
||||
if (chkCategorys[i].checked) {
|
||||
|
@ -25,12 +23,10 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
|||
}
|
||||
|
||||
function loadCategories(context, options) {
|
||||
|
||||
var selectedCategories = options.categories || [];
|
||||
|
||||
var chkCategorys = context.querySelectorAll('.chkCategory');
|
||||
for (var i = 0, length = chkCategorys.length; i < length; i++) {
|
||||
|
||||
var type = chkCategorys[i].getAttribute('data-type');
|
||||
|
||||
chkCategorys[i].checked = !selectedCategories.length || selectedCategories.indexOf(type) !== -1;
|
||||
|
@ -38,13 +34,11 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
|||
}
|
||||
|
||||
function save(context) {
|
||||
|
||||
var i;
|
||||
var length;
|
||||
|
||||
var chkIndicators = context.querySelectorAll('.chkIndicator');
|
||||
for (i = 0, length = chkIndicators.length; i < length; i++) {
|
||||
|
||||
var type = chkIndicators[i].getAttribute('data-type');
|
||||
userSettings.set('guide-indicator-' + type, chkIndicators[i].checked);
|
||||
}
|
||||
|
@ -62,13 +56,11 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
|||
}
|
||||
|
||||
function load(context) {
|
||||
|
||||
var i;
|
||||
var length;
|
||||
|
||||
var chkIndicators = context.querySelectorAll('.chkIndicator');
|
||||
for (i = 0, length = chkIndicators.length; i < length; i++) {
|
||||
|
||||
var type = chkIndicators[i].getAttribute('data-type');
|
||||
|
||||
if (chkIndicators[i].getAttribute('data-default') === 'true') {
|
||||
|
@ -90,13 +82,10 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
|||
}
|
||||
|
||||
function showEditor(options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var settingsChanged = false;
|
||||
|
||||
require(['text!./guide-settings.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -119,12 +108,10 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
|||
dlg.innerHTML = html;
|
||||
|
||||
dlg.addEventListener('change', function () {
|
||||
|
||||
settingsChanged = true;
|
||||
});
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
'use strict';
|
||||
|
||||
function showViewSettings(instance) {
|
||||
|
||||
require(['guide-settings-dialog'], function (guideSettingsDialog) {
|
||||
guideSettingsDialog.show(instance.categoryOptions).then(function () {
|
||||
instance.refresh();
|
||||
|
@ -11,7 +10,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function updateProgramCellOnScroll(cell, scrollPct) {
|
||||
|
||||
var left = cell.posLeft;
|
||||
if (!left) {
|
||||
left = parseFloat(cell.style.left.replace('%', ''));
|
||||
|
@ -54,7 +52,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
|
||||
var isUpdatingProgramCellScroll = false;
|
||||
function updateProgramCellsOnScroll(programGrid, programCells) {
|
||||
|
||||
if (isUpdatingProgramCellScroll) {
|
||||
return;
|
||||
}
|
||||
|
@ -62,13 +59,11 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
isUpdatingProgramCellScroll = true;
|
||||
|
||||
requestAnimationFrame(function () {
|
||||
|
||||
var scrollLeft = programGrid.scrollLeft;
|
||||
|
||||
var scrollPct = scrollLeft ? (scrollLeft / programGrid.scrollWidth) * 100 : 0;
|
||||
|
||||
for (var i = 0, length = programCells.length; i < length; i++) {
|
||||
|
||||
updateProgramCellOnScroll(programCells[i], scrollPct);
|
||||
}
|
||||
|
||||
|
@ -77,14 +72,12 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function onProgramGridClick(e) {
|
||||
|
||||
if (!layoutManager.tv) {
|
||||
return;
|
||||
}
|
||||
|
||||
var programCell = dom.parentWithClass(e.target, 'programCell');
|
||||
if (programCell) {
|
||||
|
||||
var startDate = programCell.getAttribute('data-startdate');
|
||||
var endDate = programCell.getAttribute('data-enddate');
|
||||
startDate = datetime.parseISO8601Date(startDate, { toLocal: true }).getTime();
|
||||
|
@ -92,7 +85,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
|
||||
var now = new Date().getTime();
|
||||
if (now >= startDate && now < endDate) {
|
||||
|
||||
var channelId = programCell.getAttribute('data-channelid');
|
||||
var serverId = programCell.getAttribute('data-serverid');
|
||||
|
||||
|
@ -108,7 +100,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function Guide(options) {
|
||||
|
||||
var self = this;
|
||||
var items = {};
|
||||
|
||||
|
@ -129,7 +120,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
var programGrid;
|
||||
|
||||
self.refresh = function () {
|
||||
|
||||
currentDate = null;
|
||||
reloadPage(options.element);
|
||||
restartAutoRefresh();
|
||||
|
@ -148,7 +138,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
};
|
||||
|
||||
self.destroy = function () {
|
||||
|
||||
stopAutoRefresh();
|
||||
|
||||
events.off(serverNotifications, 'TimerCreated', onTimerCreated);
|
||||
|
@ -162,7 +151,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
};
|
||||
|
||||
function restartAutoRefresh() {
|
||||
|
||||
stopAutoRefresh();
|
||||
|
||||
var intervalMs = 60000 * 15; // (minutes)
|
||||
|
@ -180,15 +168,11 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function normalizeDateToTimeslot(date) {
|
||||
|
||||
var minutesOffset = date.getMinutes() - cellCurationMinutes;
|
||||
|
||||
if (minutesOffset >= 0) {
|
||||
|
||||
date.setHours(date.getHours(), cellCurationMinutes, 0, 0);
|
||||
|
||||
} else {
|
||||
|
||||
date.setHours(date.getHours(), 0, 0, 0);
|
||||
}
|
||||
|
||||
|
@ -204,7 +188,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function reloadGuide(context, newStartDate, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs, focusProgramOnRender) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
|
||||
var channelQuery = {
|
||||
|
@ -287,12 +270,10 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
};
|
||||
|
||||
apiClient.getLiveTvChannels(channelQuery).then(function (channelsResult) {
|
||||
|
||||
var btnPreviousPage = context.querySelector('.btnPreviousPage');
|
||||
var btnNextPage = context.querySelector('.btnNextPage');
|
||||
|
||||
if (channelsResult.TotalRecordCount > channelLimit) {
|
||||
|
||||
context.querySelector('.guideOptions').classList.remove('hide');
|
||||
|
||||
btnPreviousPage.classList.remove('hide');
|
||||
|
@ -309,7 +290,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
} else {
|
||||
btnNextPage.disabled = true;
|
||||
}
|
||||
|
||||
} else {
|
||||
context.querySelector('.guideOptions').classList.add('hide');
|
||||
}
|
||||
|
@ -340,22 +320,17 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
apiClient.getLiveTvPrograms(programQuery).then(function (programsResult) {
|
||||
|
||||
renderGuide(context, date, channelsResult.Items, programsResult.Items, renderOptions, apiClient, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs, focusProgramOnRender);
|
||||
|
||||
hideLoading();
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function getDisplayTime(date) {
|
||||
|
||||
if ((typeof date).toString().toLowerCase() === 'string') {
|
||||
try {
|
||||
|
||||
date = datetime.parseISO8601Date(date, { toLocal: true });
|
||||
|
||||
} catch (err) {
|
||||
return date;
|
||||
}
|
||||
|
@ -365,7 +340,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function getTimeslotHeadersHtml(startDate, endDateTime) {
|
||||
|
||||
var html = '';
|
||||
|
||||
// clone
|
||||
|
@ -374,7 +348,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
html += '<div class="timeslotHeadersInner">';
|
||||
|
||||
while (startDate.getTime() < endDateTime) {
|
||||
|
||||
html += '<div class="timeslotHeader">';
|
||||
|
||||
html += getDisplayTime(startDate);
|
||||
|
@ -408,23 +381,19 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function getTimerIndicator(item) {
|
||||
|
||||
var status;
|
||||
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return '<span class="material-icons programIcon seriesTimerIcon fiber_smart_record"></span>';
|
||||
} else if (item.TimerId || item.SeriesTimerId) {
|
||||
|
||||
status = item.Status || 'Cancelled';
|
||||
} else if (item.Type === 'Timer') {
|
||||
|
||||
status = item.Status;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (item.SeriesTimerId) {
|
||||
|
||||
if (status !== 'Cancelled') {
|
||||
return '<span class="material-icons programIcon seriesTimerIcon fiber_smart_record"></span>';
|
||||
}
|
||||
|
@ -436,7 +405,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function getChannelProgramsHtml(context, date, channel, programs, options, listInfo) {
|
||||
|
||||
var html = '';
|
||||
|
||||
var startMs = date.getTime();
|
||||
|
@ -460,11 +428,9 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
var now = new Date().getTime();
|
||||
|
||||
for (var i = listInfo.startIndex, length = programs.length; i < length; i++) {
|
||||
|
||||
var program = programs[i];
|
||||
|
||||
if (program.ChannelId !== channel.Id) {
|
||||
|
||||
if (programsFound) {
|
||||
break;
|
||||
}
|
||||
|
@ -595,11 +561,9 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function renderChannelHeaders(context, channels, apiClient) {
|
||||
|
||||
var html = '';
|
||||
|
||||
for (var i = 0, length = channels.length; i < length; i++) {
|
||||
|
||||
var channel = channels[i];
|
||||
var hasChannelImage = channel.ImageTags.Primary;
|
||||
|
||||
|
@ -611,18 +575,15 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
|
||||
var title = [];
|
||||
if (channel.ChannelNumber) {
|
||||
|
||||
title.push(channel.ChannelNumber);
|
||||
}
|
||||
if (channel.Name) {
|
||||
|
||||
title.push(channel.Name);
|
||||
}
|
||||
|
||||
html += '<button title="' + title.join(' ') + '" type="button" class="' + cssClass + '"' + ' data-action="link" data-isfolder="' + channel.IsFolder + '" data-id="' + channel.Id + '" data-serverid="' + channel.ServerId + '" data-type="' + channel.Type + '">';
|
||||
|
||||
if (hasChannelImage) {
|
||||
|
||||
var url = apiClient.getScaledImageUrl(channel.Id, {
|
||||
maxHeight: 220,
|
||||
tag: channel.ImageTags.Primary,
|
||||
|
@ -633,7 +594,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
if (channel.ChannelNumber) {
|
||||
|
||||
html += '<h3 class="guideChannelNumber">' + channel.ChannelNumber + '</h3>';
|
||||
}
|
||||
|
||||
|
@ -650,7 +610,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function renderPrograms(context, date, channels, programs, options) {
|
||||
|
||||
var listInfo = {
|
||||
startIndex: 0
|
||||
};
|
||||
|
@ -658,7 +617,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
var html = [];
|
||||
|
||||
for (var i = 0, length = channels.length; i < length; i++) {
|
||||
|
||||
html.push(getChannelProgramsHtml(context, date, channels[i], programs, options, listInfo));
|
||||
}
|
||||
|
||||
|
@ -670,7 +628,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function getProgramSortOrder(program, channels) {
|
||||
|
||||
var channelId = program.ChannelId;
|
||||
var channelIndex = -1;
|
||||
|
||||
|
@ -687,7 +644,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function renderGuide(context, date, channels, programs, renderOptions, apiClient, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs, focusProgramOnRender) {
|
||||
|
||||
programs.sort(function (a, b) {
|
||||
return getProgramSortOrder(a, channels) - getProgramSortOrder(b, channels);
|
||||
});
|
||||
|
@ -717,7 +673,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function scrollProgramGridToTimeMs(context, scrollToTimeMs, startTimeOfDayMs) {
|
||||
|
||||
scrollToTimeMs -= startTimeOfDayMs;
|
||||
|
||||
var pct = scrollToTimeMs / msPerDay;
|
||||
|
@ -730,7 +685,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function focusProgram(context, itemId, channelRowId, focusToTimeMs, startTimeOfDayMs) {
|
||||
|
||||
var focusElem;
|
||||
if (itemId) {
|
||||
focusElem = context.querySelector('[data-id="' + itemId + '"]');
|
||||
|
@ -739,7 +693,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
if (focusElem) {
|
||||
focusManager.focus(focusElem);
|
||||
} else {
|
||||
|
||||
var autoFocusParent;
|
||||
|
||||
if (channelRowId) {
|
||||
|
@ -757,7 +710,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
var programCell = autoFocusParent.querySelector('.programCell');
|
||||
|
||||
while (programCell) {
|
||||
|
||||
var left = (programCell.style.left || '').replace('%', '');
|
||||
left = left ? parseFloat(left) : 0;
|
||||
var width = (programCell.style.width || '').replace('%', '');
|
||||
|
@ -778,7 +730,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function nativeScrollTo(container, pos, horizontal) {
|
||||
|
||||
if (container.scrollTo) {
|
||||
if (horizontal) {
|
||||
container.scrollTo(pos, 0);
|
||||
|
@ -798,7 +749,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
var lastHeaderScroll = 0;
|
||||
var scrollXPct = 0;
|
||||
function onProgramGridScroll(context, elem, timeslotHeaders) {
|
||||
|
||||
if ((new Date().getTime() - lastHeaderScroll) >= 1000) {
|
||||
lastGridScroll = new Date().getTime();
|
||||
|
||||
|
@ -811,7 +761,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function onTimeslotHeadersScroll(context, elem) {
|
||||
|
||||
if ((new Date().getTime() - lastGridScroll) >= 1000) {
|
||||
lastHeaderScroll = new Date().getTime();
|
||||
nativeScrollTo(programGrid, elem.scrollLeft, true);
|
||||
|
@ -819,7 +768,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function changeDate(page, date, scrollToTimeMs, focusToTimeMs, startTimeOfDayMs, focusProgramOnRender) {
|
||||
|
||||
var newStartDate = normalizeDateToTimeslot(date);
|
||||
currentDate = newStartDate;
|
||||
|
||||
|
@ -827,7 +775,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function getDateTabText(date, isActive, tabIndex) {
|
||||
|
||||
var cssClass = isActive ? 'emby-tab-button guide-date-tab-button emby-tab-button-active' : 'emby-tab-button guide-date-tab-button';
|
||||
|
||||
var html = '<button is="emby-button" class="' + cssClass + '" data-index="' + tabIndex + '" data-date="' + date.getTime() + '">';
|
||||
|
@ -842,7 +789,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function setDateRange(page, guideInfo) {
|
||||
|
||||
var today = new Date();
|
||||
var nowHours = today.getHours();
|
||||
today.setHours(nowHours, 0, 0, 0);
|
||||
|
@ -875,7 +821,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
startTimeOfDayMs += start.getMinutes() * 60 * 1000;
|
||||
|
||||
while (start <= end) {
|
||||
|
||||
var isActive = date.getDate() === start.getDate() && date.getMonth() === start.getMonth() && date.getFullYear() === start.getFullYear();
|
||||
|
||||
dateTabsHtml += getDateTabText(start, isActive, tabIndex);
|
||||
|
@ -902,19 +847,16 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function reloadPage(page) {
|
||||
|
||||
showLoading();
|
||||
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
|
||||
apiClient.getLiveTvGuideInfo().then(function (guideInfo) {
|
||||
|
||||
setDateRange(page, guideInfo);
|
||||
});
|
||||
}
|
||||
|
||||
function getChannelProgramsFocusableElements(container) {
|
||||
|
||||
var elements = container.querySelectorAll('.programCell');
|
||||
|
||||
var list = [];
|
||||
|
@ -922,7 +864,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
var currentScrollXPct = scrollXPct + 1;
|
||||
|
||||
for (var i = 0, length = elements.length; i < length; i++) {
|
||||
|
||||
var elem = elements[i];
|
||||
|
||||
var left = (elem.style.left || '').replace('%', '');
|
||||
|
@ -939,7 +880,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function onInputCommand(e) {
|
||||
|
||||
var target = e.target;
|
||||
var programCell = dom.parentWithClass(target, 'programCell');
|
||||
var container;
|
||||
|
@ -948,7 +888,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
var newRow;
|
||||
|
||||
switch (e.detail.command) {
|
||||
|
||||
case 'up':
|
||||
if (programCell) {
|
||||
container = programGrid;
|
||||
|
@ -1030,7 +969,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function onScrollerFocus(e) {
|
||||
|
||||
var target = e.target;
|
||||
var programCell = dom.parentWithClass(target, 'programCell');
|
||||
|
||||
|
@ -1049,22 +987,16 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
if (lastFocusDirection === 'left') {
|
||||
|
||||
if (programCell) {
|
||||
|
||||
scrollHelper.toStart(programGrid, programCell, true, true);
|
||||
}
|
||||
} else if (lastFocusDirection === 'right') {
|
||||
|
||||
if (programCell) {
|
||||
|
||||
scrollHelper.toCenter(programGrid, programCell, true, true);
|
||||
}
|
||||
} else if (lastFocusDirection === 'up' || lastFocusDirection === 'down') {
|
||||
|
||||
var verticalScroller = dom.parentWithClass(target, 'guideVerticalScroller');
|
||||
if (verticalScroller) {
|
||||
|
||||
var focusedElement = programCell || dom.parentWithTag(target, 'BUTTON');
|
||||
verticalScroller.toCenter(focusedElement, true);
|
||||
}
|
||||
|
@ -1072,7 +1004,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function setScrollEvents(view, enabled) {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
var guideVerticalScroller = view.querySelector('.guideVerticalScroller');
|
||||
|
||||
|
@ -1085,7 +1016,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
function onTimerCreated(e, apiClient, data) {
|
||||
|
||||
var programId = data.ProgramId;
|
||||
// This could be null, not supported by all tv providers
|
||||
var newTimerId = data.Id;
|
||||
|
@ -1138,7 +1068,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
require(['text!./tvguide.template.html'], function (template) {
|
||||
|
||||
var context = options.element;
|
||||
|
||||
context.classList.add('tvguide');
|
||||
|
@ -1195,12 +1124,10 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
});
|
||||
|
||||
context.querySelector('.guideDateTabs').addEventListener('tabchange', function (e) {
|
||||
|
||||
var allTabButtons = e.target.querySelectorAll('.guide-date-tab-button');
|
||||
|
||||
var tabButton = allTabButtons[parseInt(e.detail.selectedTabIndex)];
|
||||
if (tabButton) {
|
||||
|
||||
var previousButton = e.detail.previousIndex == null ? null : allTabButtons[parseInt(e.detail.previousIndex)];
|
||||
|
||||
var date = new Date();
|
||||
|
@ -1215,7 +1142,6 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
|||
}
|
||||
|
||||
if (previousButton) {
|
||||
|
||||
var previousDate = new Date();
|
||||
previousDate.setTime(parseInt(previousButton.getAttribute('data-date')));
|
||||
|
||||
|
|
|
@ -15,12 +15,10 @@ import 'emby-checkbox';
|
|||
const numConfigurableSections = 7;
|
||||
|
||||
function renderViews(page, user, result) {
|
||||
|
||||
let folderHtml = '';
|
||||
|
||||
folderHtml += '<div class="checkboxList">';
|
||||
folderHtml += result.map(i => {
|
||||
|
||||
let currentHtml = '';
|
||||
|
||||
const id = `chkGroupFolder${i.Id}`;
|
||||
|
@ -35,7 +33,6 @@ import 'emby-checkbox';
|
|||
currentHtml += '</label>';
|
||||
|
||||
return currentHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
folderHtml += '</div>';
|
||||
|
@ -44,7 +41,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function getLandingScreenOptions(type) {
|
||||
|
||||
const list = [];
|
||||
|
||||
if (type === 'movies') {
|
||||
|
@ -133,9 +129,7 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function getLandingScreenOptionsHtml(type, userValue) {
|
||||
|
||||
return getLandingScreenOptions(type).map(o => {
|
||||
|
||||
const selected = userValue === o.value || (o.isDefault && !userValue);
|
||||
const selectedHtml = selected ? ' selected' : '';
|
||||
const optionValue = o.isDefault ? '' : o.value;
|
||||
|
@ -145,11 +139,9 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function renderViewOrder(context, user, result) {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += result.Items.map((view) => {
|
||||
|
||||
let currentHtml = '';
|
||||
|
||||
currentHtml += `<div class="listItem viewItem" data-viewid="${view.Id}">`;
|
||||
|
@ -170,16 +162,13 @@ import 'emby-checkbox';
|
|||
currentHtml += '</div>';
|
||||
|
||||
return currentHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
context.querySelector('.viewOrderList').innerHTML = html;
|
||||
}
|
||||
|
||||
function updateHomeSectionValues(context, userSettings) {
|
||||
|
||||
for (let i = 1; i <= 7; i++) {
|
||||
|
||||
const select = context.querySelector(`#selectHomeSection${i}`);
|
||||
const defaultValue = homeSections.getDefaultSection(i - 1);
|
||||
|
||||
|
@ -200,7 +189,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function getPerLibrarySettingsHtml(item, user, userSettings, apiClient) {
|
||||
|
||||
let html = '';
|
||||
|
||||
let isChecked;
|
||||
|
@ -217,7 +205,6 @@ import 'emby-checkbox';
|
|||
|
||||
const excludeFromLatest = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||
if (!excludeFromLatest.includes(item.CollectionType || '')) {
|
||||
|
||||
isChecked = !user.Configuration.LatestItemsExcludes.includes(item.Id);
|
||||
html += '<label class="fldIncludeInLatest">';
|
||||
html += `<input type="checkbox" is="emby-checkbox" class="chkIncludeInLatest" data-folderid="${item.Id}"${isChecked ? ' checked="checked"' : ''}/>`;
|
||||
|
@ -226,12 +213,10 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
if (html) {
|
||||
|
||||
html = `<div class="checkboxListContainer">${html}</div>`;
|
||||
}
|
||||
|
||||
if (item.CollectionType === 'movies' || item.CollectionType === 'tvshows' || item.CollectionType === 'music' || item.CollectionType === 'livetv') {
|
||||
|
||||
const idForLanding = item.CollectionType === 'livetv' ? item.CollectionType : item.Id;
|
||||
html += '<div class="selectContainer">';
|
||||
html += `<select is="emby-select" class="selectLanding" data-folderid="${idForLanding}" label="${globalize.translate('LabelDefaultScreen')}">`;
|
||||
|
@ -245,7 +230,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
if (html) {
|
||||
|
||||
let prefix = '';
|
||||
prefix += '<div class="verticalSection">';
|
||||
|
||||
|
@ -261,12 +245,10 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function renderPerLibrarySettings(context, user, userViews, userSettings, apiClient) {
|
||||
|
||||
const elem = context.querySelector('.perLibrarySettings');
|
||||
let html = '';
|
||||
|
||||
for (let i = 0, length = userViews.length; i < length; i++) {
|
||||
|
||||
html += getPerLibrarySettingsHtml(userViews[i], user, userSettings, apiClient);
|
||||
}
|
||||
|
||||
|
@ -274,7 +256,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function loadForm(context, user, userSettings, apiClient) {
|
||||
|
||||
context.querySelector('.chkHidePlayedFromLatest').checked = user.Configuration.HidePlayedInLatest || false;
|
||||
|
||||
updateHomeSectionValues(context, userSettings);
|
||||
|
@ -283,7 +264,6 @@ import 'emby-checkbox';
|
|||
const promise2 = apiClient.getJSON(apiClient.getUrl(`Users/${user.Id}/GroupingOptions`));
|
||||
|
||||
Promise.all([promise1, promise2]).then(responses => {
|
||||
|
||||
renderViewOrder(context, user, responses[0]);
|
||||
|
||||
renderPerLibrarySettings(context, user, responses[0].Items, userSettings, apiClient);
|
||||
|
@ -295,7 +275,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function onSectionOrderListClick(e) {
|
||||
|
||||
const target = dom.parentWithClass(e.target, 'btnViewItemMove');
|
||||
|
||||
if (target) {
|
||||
|
@ -303,7 +282,6 @@ import 'emby-checkbox';
|
|||
|
||||
if (viewItem) {
|
||||
if (target.classList.contains('btnViewItemDown')) {
|
||||
|
||||
const next = viewItem.nextSibling;
|
||||
|
||||
if (next) {
|
||||
|
@ -311,9 +289,7 @@ import 'emby-checkbox';
|
|||
next.parentNode.insertBefore(viewItem, next.nextSibling);
|
||||
focusManager.focus(e.target);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
const prev = viewItem.previousSibling;
|
||||
|
||||
if (prev) {
|
||||
|
@ -327,37 +303,30 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function getCheckboxItems(selector, context, isChecked) {
|
||||
|
||||
const inputs = context.querySelectorAll(selector);
|
||||
const list = [];
|
||||
|
||||
for (let i = 0, length = inputs.length; i < length; i++) {
|
||||
|
||||
if (inputs[i].checked === isChecked) {
|
||||
list.push(inputs[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
function saveUser(context, user, userSettingsInstance, apiClient) {
|
||||
|
||||
user.Configuration.HidePlayedInLatest = context.querySelector('.chkHidePlayedFromLatest').checked;
|
||||
|
||||
user.Configuration.LatestItemsExcludes = getCheckboxItems('.chkIncludeInLatest', context, false).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
user.Configuration.MyMediaExcludes = getCheckboxItems('.chkIncludeInMyMedia', context, false).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
user.Configuration.GroupedFolders = getCheckboxItems('.chkGroupFolder', context, true).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
|
@ -391,13 +360,10 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||
|
||||
loading.show();
|
||||
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
|
@ -406,7 +372,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
events.trigger(instance, 'saved');
|
||||
|
||||
}, () => {
|
||||
loading.hide();
|
||||
});
|
||||
|
@ -414,14 +379,12 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
const self = this;
|
||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
const userId = self.options.userId;
|
||||
const userSettings = self.options.userSettings;
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||
});
|
||||
|
@ -434,7 +397,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function onChange(e) {
|
||||
|
||||
const chkIncludeInMyMedia = dom.parentWithClass(e.target, 'chkIncludeInMyMedia');
|
||||
if (!chkIncludeInMyMedia) {
|
||||
return;
|
||||
|
@ -452,9 +414,7 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function embed(options, self) {
|
||||
|
||||
return import('text!./homeScreenSettings.template.html').then(({default: template}) => {
|
||||
|
||||
for (let i = 1; i <= numConfigurableSections; i++) {
|
||||
template = template.replace(`{section${i}label}`, globalize.translate('LabelHomeScreenSectionValue', i));
|
||||
}
|
||||
|
@ -486,7 +446,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
loadData(autoFocus) {
|
||||
|
||||
const self = this;
|
||||
const context = self.options.element;
|
||||
|
||||
|
@ -497,9 +456,7 @@ import 'emby-checkbox';
|
|||
const userSettings = self.options.userSettings;
|
||||
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
self.dataLoaded = true;
|
||||
|
||||
loadForm(context, user, userSettings, apiClient);
|
||||
|
@ -516,7 +473,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
this.options = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -131,7 +131,6 @@ import 'css!./homesections';
|
|||
}
|
||||
|
||||
function loadSection(page, apiClient, user, userSettings, userViews, allSections, index) {
|
||||
|
||||
const section = allSections[index];
|
||||
const userId = user.Id;
|
||||
|
||||
|
@ -627,7 +626,6 @@ import 'css!./homesections';
|
|||
html += '</h2>';
|
||||
html += '<span class="material-icons chevron_right"></span>';
|
||||
html += '</a>';
|
||||
|
||||
} else {
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards">' + globalize.translate('HeaderOnNow') + '</h2>';
|
||||
}
|
||||
|
|
|
@ -34,7 +34,6 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function enableHlsJsPlayer(runTimeTicks, mediaType) {
|
||||
|
||||
if (window.MediaSource == null) {
|
||||
return false;
|
||||
}
|
||||
|
@ -50,7 +49,6 @@ import events from 'events';
|
|||
}
|
||||
|
||||
if (canPlayNativeHls()) {
|
||||
|
||||
// Having trouble with chrome's native support and transcoded music
|
||||
if (browser.android && mediaType === 'Audio') {
|
||||
return true;
|
||||
|
@ -76,7 +74,6 @@ import events from 'events';
|
|||
var recoverDecodingErrorDate;
|
||||
var recoverSwapAudioCodecDate;
|
||||
export function handleHlsJsMediaError(instance, reject) {
|
||||
|
||||
var hlsPlayer = instance._hlsPlayer;
|
||||
|
||||
if (!hlsPlayer) {
|
||||
|
@ -112,7 +109,6 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function onErrorInternal(instance, type) {
|
||||
|
||||
// Needed for video
|
||||
if (instance.destroyCustomTrack) {
|
||||
instance.destroyCustomTrack(instance._mediaElement);
|
||||
|
@ -140,11 +136,9 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function seekOnPlaybackStart(instance, element, ticks, onMediaReady) {
|
||||
|
||||
var seconds = (ticks || 0) / 10000000;
|
||||
|
||||
if (seconds) {
|
||||
|
||||
// Appending #t=xxx to the query string doesn't seem to work with HLS
|
||||
// For plain video files, not all browsers support it either
|
||||
|
||||
|
@ -177,11 +171,8 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function applySrc(elem, src, options) {
|
||||
|
||||
if (window.Windows && options.mediaSource && options.mediaSource.IsLocal) {
|
||||
|
||||
return Windows.Storage.StorageFile.getFileFromPathAsync(options.url).then(function (file) {
|
||||
|
||||
var playlist = new Windows.Media.Playback.MediaPlaybackList();
|
||||
|
||||
var source1 = Windows.Media.Core.MediaSource.createFromStorageFile(file);
|
||||
|
@ -190,9 +181,7 @@ import events from 'events';
|
|||
elem.src = URL.createObjectURL(playlist, { oneTimeOnly: true });
|
||||
return Promise.resolve();
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
elem.src = src;
|
||||
}
|
||||
|
||||
|
@ -200,18 +189,15 @@ import events from 'events';
|
|||
}
|
||||
|
||||
function onSuccessfulPlay(elem, onErrorFn) {
|
||||
|
||||
elem.addEventListener('error', onErrorFn);
|
||||
}
|
||||
|
||||
export function playWithPromise(elem, onErrorFn) {
|
||||
|
||||
try {
|
||||
var promise = elem.play();
|
||||
if (promise && promise.then) {
|
||||
// Chrome now returns a promise
|
||||
return promise.catch(function (e) {
|
||||
|
||||
var errorName = (e.name || '').toLowerCase();
|
||||
// safari uses aborterror
|
||||
if (errorName === 'notallowederror' ||
|
||||
|
@ -233,7 +219,6 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function destroyCastPlayer(instance) {
|
||||
|
||||
var player = instance._castPlayer;
|
||||
if (player) {
|
||||
try {
|
||||
|
@ -275,10 +260,8 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function bindEventsToHlsPlayer(instance, hls, elem, onErrorFn, resolve, reject) {
|
||||
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
||||
playWithPromise(elem, onErrorFn).then(resolve, function () {
|
||||
|
||||
if (reject) {
|
||||
reject();
|
||||
reject = null;
|
||||
|
@ -287,14 +270,12 @@ import events from 'events';
|
|||
});
|
||||
|
||||
hls.on(Hls.Events.ERROR, function (event, data) {
|
||||
|
||||
console.error('HLS Error: Type: ' + data.type + ' Details: ' + (data.details || '') + ' Fatal: ' + (data.fatal || false));
|
||||
|
||||
switch (data.type) {
|
||||
case Hls.ErrorTypes.NETWORK_ERROR:
|
||||
// try to recover network error
|
||||
if (data.response && data.response.code && data.response.code >= 400) {
|
||||
|
||||
console.debug('hls.js response error code: ' + data.response.code);
|
||||
|
||||
// Trigger failure differently depending on whether this is prior to start of playback, or after
|
||||
|
@ -308,7 +289,6 @@ import events from 'events';
|
|||
}
|
||||
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
|
@ -321,7 +301,6 @@ import events from 'events';
|
|||
case Hls.ErrorTypes.NETWORK_ERROR:
|
||||
|
||||
if (data.response && data.response.code === 0) {
|
||||
|
||||
// This could be a CORS error related to access control response headers
|
||||
|
||||
console.debug('hls.js response error code: ' + data.response.code);
|
||||
|
@ -367,7 +346,6 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function onEndedInternal(instance, elem, onErrorFn) {
|
||||
|
||||
elem.removeEventListener('error', onErrorFn);
|
||||
|
||||
elem.src = '';
|
||||
|
@ -390,7 +368,6 @@ import events from 'events';
|
|||
}
|
||||
|
||||
export function getBufferedRanges(instance, elem) {
|
||||
|
||||
var ranges = [];
|
||||
var seekable = elem.buffered || [];
|
||||
|
||||
|
@ -403,7 +380,6 @@ import events from 'events';
|
|||
offset = offset || 0;
|
||||
|
||||
for (var i = 0, length = seekable.length; i < length; i++) {
|
||||
|
||||
var start = seekable.start(i);
|
||||
var end = seekable.end(i);
|
||||
|
||||
|
|
|
@ -17,7 +17,6 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
var selectedProvider;
|
||||
|
||||
function getBaseRemoteOptions() {
|
||||
|
||||
var options = {};
|
||||
|
||||
options.itemId = currentItemId;
|
||||
|
@ -26,7 +25,6 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
}
|
||||
|
||||
function reloadBrowsableImages(page, apiClient) {
|
||||
|
||||
loading.show();
|
||||
|
||||
var options = getBaseRemoteOptions();
|
||||
|
@ -43,7 +41,6 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
}
|
||||
|
||||
apiClient.getAvailableRemoteImages(options).then(function (result) {
|
||||
|
||||
renderRemoteImages(page, apiClient, result, browsableImageType, options.startIndex, options.limit);
|
||||
|
||||
page.querySelector('#selectBrowsableImageType').value = browsableImageType;
|
||||
|
@ -58,17 +55,14 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
|
||||
loading.hide();
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
function renderRemoteImages(page, apiClient, imagesResult, imageType, startIndex, limit) {
|
||||
|
||||
page.querySelector('.availableImagesPaging').innerHTML = getPagingHtml(startIndex, limit, imagesResult.TotalRecordCount);
|
||||
|
||||
var html = '';
|
||||
|
||||
for (var i = 0, length = imagesResult.Images.length; i < length; i++) {
|
||||
|
||||
html += getRemoteImageHtml(imagesResult.Images[i], imageType, apiClient);
|
||||
}
|
||||
|
||||
|
@ -92,11 +86,9 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
reloadBrowsableImages(page, apiClient);
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function getPagingHtml(startIndex, limit, totalRecordCount) {
|
||||
|
||||
var html = '';
|
||||
|
||||
var recordsEnd = Math.min(startIndex + limit, totalRecordCount);
|
||||
|
@ -136,7 +128,6 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
loading.show();
|
||||
|
||||
apiClient.downloadRemoteImage(options).then(function () {
|
||||
|
||||
hasChanges = true;
|
||||
var dlg = dom.parentWithClass(page, 'dialog');
|
||||
dialogHelper.close(dlg);
|
||||
|
@ -166,7 +157,6 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
} else if (imageType === 'Disc') {
|
||||
shape = 'square';
|
||||
} else {
|
||||
|
||||
if (currentItemType === 'Episode') {
|
||||
shape = 'backdrop';
|
||||
} else if (currentItemType === 'MusicAlbum' || currentItemType === 'MusicArtist') {
|
||||
|
@ -217,19 +207,16 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
html += '<div class="cardText cardTextCentered">' + image.ProviderName + '</div>';
|
||||
|
||||
if (image.Width || image.Height || image.Language) {
|
||||
|
||||
html += '<div class="cardText cardText-secondary cardTextCentered">';
|
||||
|
||||
if (image.Width && image.Height) {
|
||||
html += image.Width + ' x ' + image.Height;
|
||||
|
||||
if (image.Language) {
|
||||
|
||||
html += ' • ' + image.Language;
|
||||
}
|
||||
} else {
|
||||
if (image.Language) {
|
||||
|
||||
html += image.Language;
|
||||
}
|
||||
}
|
||||
|
@ -238,13 +225,11 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
}
|
||||
|
||||
if (image.CommunityRating != null) {
|
||||
|
||||
html += '<div class="cardText cardText-secondary cardTextCentered">';
|
||||
|
||||
if (image.RatingType === 'Likes') {
|
||||
html += image.CommunityRating + (image.CommunityRating === 1 ? ' like' : ' likes');
|
||||
} else {
|
||||
|
||||
if (image.CommunityRating) {
|
||||
html += image.CommunityRating.toFixed(1);
|
||||
|
||||
|
@ -286,7 +271,6 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
});
|
||||
|
||||
page.querySelector('#selectImageProvider').addEventListener('change', function () {
|
||||
|
||||
browsableImageStartIndex = 0;
|
||||
selectedProvider = this.value;
|
||||
|
||||
|
@ -294,14 +278,12 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
});
|
||||
|
||||
page.querySelector('#chkAllLanguages').addEventListener('change', function () {
|
||||
|
||||
browsableImageStartIndex = 0;
|
||||
|
||||
reloadBrowsableImages(page, apiClient);
|
||||
});
|
||||
|
||||
page.addEventListener('click', function (e) {
|
||||
|
||||
var btnDownloadRemoteImage = dom.parentWithClass(e.target, 'btnDownloadRemoteImage');
|
||||
if (btnDownloadRemoteImage) {
|
||||
var card = dom.parentWithClass(btnDownloadRemoteImage, 'card');
|
||||
|
@ -320,7 +302,6 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
loading.show();
|
||||
|
||||
require(['text!./imageDownloader.template.html'], function (template) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
currentItemId = itemId;
|
||||
|
@ -353,7 +334,6 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
|||
initEditor(editorContent, apiClient);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
|
|
|
@ -23,7 +23,6 @@ import 'css!./style';
|
|||
let hasChanges = false;
|
||||
|
||||
function onFileReaderError(evt) {
|
||||
|
||||
loading.hide();
|
||||
|
||||
switch (evt.target.error.code) {
|
||||
|
@ -43,7 +42,6 @@ import 'css!./style';
|
|||
}
|
||||
|
||||
function setFiles(page, files) {
|
||||
|
||||
const file = files[0];
|
||||
|
||||
if (!file || !file.type.match('image.*')) {
|
||||
|
@ -69,7 +67,6 @@ import 'css!./style';
|
|||
// Closure to capture the file information.
|
||||
reader.onload = (theFile => {
|
||||
return e => {
|
||||
|
||||
// Render thumbnail.
|
||||
const html = ['<img style="max-width:100%;max-height:100%;" src="', e.target.result, '" title="', escape(theFile.name), '"/>'].join('');
|
||||
|
||||
|
@ -84,7 +81,6 @@ import 'css!./style';
|
|||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
const file = currentFile;
|
||||
|
||||
if (!file) {
|
||||
|
@ -113,7 +109,6 @@ import 'css!./style';
|
|||
}
|
||||
|
||||
connectionManager.getApiClient(currentServerId).uploadItemImage(currentItemId, imageType, file).then(() => {
|
||||
|
||||
dlg.querySelector('#uploadImage').value = '';
|
||||
|
||||
loading.hide();
|
||||
|
@ -126,7 +121,6 @@ import 'css!./style';
|
|||
}
|
||||
|
||||
function initEditor(page) {
|
||||
|
||||
page.querySelector('form').addEventListener('submit', onSubmit);
|
||||
|
||||
page.querySelector('#uploadImage').addEventListener('change', function () {
|
||||
|
@ -139,11 +133,9 @@ import 'css!./style';
|
|||
}
|
||||
|
||||
function showEditor(options, resolve) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
return import('text!./imageUploader.template.html').then(({default: template}) => {
|
||||
|
||||
currentItemId = options.itemId;
|
||||
currentServerId = options.serverId;
|
||||
|
||||
|
@ -169,7 +161,6 @@ import 'css!./style';
|
|||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
dlg.addEventListener('close', () => {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.off(dlg, false);
|
||||
}
|
||||
|
@ -185,16 +176,13 @@ import 'css!./style';
|
|||
dlg.querySelector('#selectImageType').value = options.imageType || 'Primary';
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
export function show(options) {
|
||||
|
||||
return new Promise(resolve => {
|
||||
|
||||
hasChanges = false;
|
||||
|
||||
showEditor(options, resolve);
|
||||
|
|
|
@ -7,7 +7,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
var hasChanges = false;
|
||||
|
||||
function getBaseRemoteOptions() {
|
||||
|
||||
var options = {};
|
||||
|
||||
options.itemId = currentItem.Id;
|
||||
|
@ -16,7 +15,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function reload(page, item, focusContext) {
|
||||
|
||||
loading.show();
|
||||
|
||||
var apiClient;
|
||||
|
@ -25,7 +23,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
reloadItem(page, item, apiClient, focusContext);
|
||||
} else {
|
||||
|
||||
apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), currentItem.Id).then(function (item) {
|
||||
reloadItem(page, item, apiClient, focusContext);
|
||||
|
@ -34,7 +31,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function addListeners(container, className, eventName, fn) {
|
||||
|
||||
container.addEventListener(eventName, function (e) {
|
||||
var elem = dom.parentWithClass(e.target, className);
|
||||
if (elem) {
|
||||
|
@ -44,14 +40,11 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function reloadItem(page, item, apiClient, focusContext) {
|
||||
|
||||
currentItem = item;
|
||||
|
||||
apiClient.getRemoteImageProviders(getBaseRemoteOptions()).then(function (providers) {
|
||||
|
||||
var btnBrowseAllImages = page.querySelectorAll('.btnBrowseAllImages');
|
||||
for (var i = 0, length = btnBrowseAllImages.length; i < length; i++) {
|
||||
|
||||
if (providers.length) {
|
||||
btnBrowseAllImages[i].classList.remove('hide');
|
||||
} else {
|
||||
|
@ -60,7 +53,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
apiClient.getItemImageInfos(currentItem.Id).then(function (imageInfos) {
|
||||
|
||||
renderStandardImages(page, apiClient, item, imageInfos, providers);
|
||||
renderBackdrops(page, apiClient, item, imageInfos, providers);
|
||||
renderScreenshots(page, apiClient, item, imageInfos, providers);
|
||||
|
@ -74,7 +66,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function getImageUrl(item, apiClient, type, index, options) {
|
||||
|
||||
options = options || {};
|
||||
options.type = type;
|
||||
options.index = index;
|
||||
|
@ -94,7 +85,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function getCardHtml(image, index, numImages, apiClient, imageProviders, imageSize, tagName, enableFooterButtons) {
|
||||
|
||||
// TODO move card creation code to Card component
|
||||
|
||||
var html = '';
|
||||
|
@ -153,7 +143,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
html += '<div class="cardText cardTextCentered">';
|
||||
|
||||
if (image.ImageType === 'Backdrop' || image.ImageType === 'Screenshot') {
|
||||
|
||||
if (index > 0) {
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnMoveImage autoSize" data-imagetype="' + image.ImageType + '" data-index="' + image.ImageIndex + '" data-newindex="' + (image.ImageIndex - 1) + '" title="' + globalize.translate('MoveLeft') + '"><span class="material-icons chevron_left"></span></button>';
|
||||
} else {
|
||||
|
@ -183,13 +172,10 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function deleteImage(context, itemId, type, index, apiClient, enableConfirmation) {
|
||||
|
||||
var afterConfirm = function () {
|
||||
apiClient.deleteItemImage(itemId, type, index).then(function () {
|
||||
|
||||
hasChanges = true;
|
||||
reload(context);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
@ -199,7 +185,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm.default({
|
||||
|
||||
text: globalize.translate('ConfirmDeleteImage'),
|
||||
|
@ -211,13 +196,10 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function moveImage(context, apiClient, itemId, type, index, newIndex, focusContext) {
|
||||
|
||||
apiClient.updateItemImageIndex(itemId, type, index, newIndex).then(function () {
|
||||
|
||||
hasChanges = true;
|
||||
reload(context, null, focusContext);
|
||||
}, function () {
|
||||
|
||||
require(['alert'], function (alert) {
|
||||
alert(globalize.translate('DefaultErrorMessage'));
|
||||
});
|
||||
|
@ -225,7 +207,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function renderImages(page, item, apiClient, images, imageProviders, elem) {
|
||||
|
||||
var html = '';
|
||||
|
||||
var imageSize = 300;
|
||||
|
@ -238,7 +219,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
var enableFooterButtons = !layoutManager.tv;
|
||||
|
||||
for (var i = 0, length = images.length; i < length; i++) {
|
||||
|
||||
var image = images[i];
|
||||
|
||||
html += getCardHtml(image, i, length, apiClient, imageProviders, imageSize, tagName, enableFooterButtons);
|
||||
|
@ -249,7 +229,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function renderStandardImages(page, apiClient, item, imageInfos, imageProviders) {
|
||||
|
||||
var images = imageInfos.filter(function (i) {
|
||||
return i.ImageType !== 'Screenshot' && i.ImageType !== 'Backdrop' && i.ImageType !== 'Chapter';
|
||||
});
|
||||
|
@ -258,10 +237,8 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function renderBackdrops(page, apiClient, item, imageInfos, imageProviders) {
|
||||
|
||||
var images = imageInfos.filter(function (i) {
|
||||
return i.ImageType === 'Backdrop';
|
||||
|
||||
}).sort(function (a, b) {
|
||||
return a.ImageIndex - b.ImageIndex;
|
||||
});
|
||||
|
@ -275,10 +252,8 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function renderScreenshots(page, apiClient, item, imageInfos, imageProviders) {
|
||||
|
||||
var images = imageInfos.filter(function (i) {
|
||||
return i.ImageType === 'Screenshot';
|
||||
|
||||
}).sort(function (a, b) {
|
||||
return a.ImageIndex - b.ImageIndex;
|
||||
});
|
||||
|
@ -292,20 +267,15 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function showImageDownloader(page, imageType) {
|
||||
|
||||
require(['imageDownloader'], function (ImageDownloader) {
|
||||
|
||||
ImageDownloader.show(currentItem.Id, currentItem.ServerId, currentItem.Type, imageType).then(function () {
|
||||
|
||||
hasChanges = true;
|
||||
reload(page);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function showActionSheet(context, imageCard) {
|
||||
|
||||
var itemId = imageCard.getAttribute('data-id');
|
||||
var serverId = imageCard.getAttribute('data-serverid');
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
@ -316,7 +286,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
var numImages = parseInt(imageCard.getAttribute('data-numimages'));
|
||||
|
||||
require(['actionsheet'], function (actionSheet) {
|
||||
|
||||
var commands = [];
|
||||
|
||||
commands.push({
|
||||
|
@ -353,9 +322,7 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
positionTo: imageCard
|
||||
|
||||
}).then(function (id) {
|
||||
|
||||
switch (id) {
|
||||
|
||||
case 'delete':
|
||||
deleteImage(context, itemId, type, index, apiClient, false);
|
||||
break;
|
||||
|
@ -371,13 +338,11 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function initEditor(context, options) {
|
||||
|
||||
var uploadButtons = context.querySelectorAll('.btnOpenUploadMenu');
|
||||
var isFileInputSupported = appHost.supports('fileinput');
|
||||
for (var i = 0, length = uploadButtons.length; i < length; i++) {
|
||||
|
@ -392,7 +357,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
var imageType = this.getAttribute('data-imagetype');
|
||||
|
||||
require(['imageUploader'], function (imageUploader) {
|
||||
|
||||
imageUploader.show({
|
||||
|
||||
theme: options.theme,
|
||||
|
@ -401,7 +365,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
serverId: currentItem.ServerId
|
||||
|
||||
}).then(function (hasChanged) {
|
||||
|
||||
if (hasChanged) {
|
||||
hasChanges = true;
|
||||
reload(context);
|
||||
|
@ -440,7 +403,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
}
|
||||
|
||||
function showEditor(options, resolve, reject) {
|
||||
|
||||
var itemId = options.itemId;
|
||||
var serverId = options.serverId;
|
||||
|
||||
|
@ -449,7 +411,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
require(['text!./imageeditor.template.html'], function (template) {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true
|
||||
};
|
||||
|
@ -474,7 +435,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.off(dlg, false);
|
||||
}
|
||||
|
@ -493,7 +453,6 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
reload(dlg, item);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
});
|
||||
|
@ -502,9 +461,7 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
|||
|
||||
return {
|
||||
show: function (options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
hasChanges = false;
|
||||
|
||||
showEditor(options, resolve, reject);
|
||||
|
|
|
@ -133,11 +133,9 @@ import 'css!./style';
|
|||
}
|
||||
|
||||
export function getPrimaryImageAspectRatio(items) {
|
||||
|
||||
var values = [];
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
var ratio = items[i].PrimaryImageAspectRatio || 0;
|
||||
|
||||
if (!ratio) {
|
||||
|
@ -193,7 +191,6 @@ import 'css!./style';
|
|||
}
|
||||
|
||||
export function fillImages(elems) {
|
||||
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
var elem = elems[0];
|
||||
fillImage(elem);
|
||||
|
|
|
@ -142,7 +142,6 @@ import actionsheet from 'actionsheet';
|
|||
}
|
||||
|
||||
if (item.CanDelete && options.deleteItem !== false) {
|
||||
|
||||
if (item.Type === 'Playlist' || item.Type === 'BoxSet') {
|
||||
commands.push({
|
||||
name: globalize.translate('Delete'),
|
||||
|
|
|
@ -2,7 +2,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
'use strict';
|
||||
|
||||
function getDisplayName(item, options = {}) {
|
||||
|
||||
if (!item) {
|
||||
throw new Error('null item passed into getDisplayName');
|
||||
}
|
||||
|
@ -22,7 +21,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
if (item.Type === 'Episode' && item.ParentIndexNumber === 0) {
|
||||
name = globalize.translate('ValueSpecialEpisodeName', name);
|
||||
} else if ((item.Type === 'Episode' || item.Type === 'Program') && item.IndexNumber != null && item.ParentIndexNumber != null && options.includeIndexNumber !== false) {
|
||||
|
||||
var displayIndexNumber = item.IndexNumber;
|
||||
|
||||
var number = displayIndexNumber;
|
||||
|
@ -35,7 +33,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
}
|
||||
|
||||
if (item.IndexNumberEnd) {
|
||||
|
||||
displayIndexNumber = item.IndexNumberEnd;
|
||||
number += '-' + displayIndexNumber;
|
||||
}
|
||||
|
@ -49,7 +46,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
}
|
||||
|
||||
function supportsAddingToCollection(item) {
|
||||
|
||||
var invalidTypes = ['Genre', 'MusicGenre', 'Studio', 'UserView', 'CollectionFolder', 'Audio', 'Program', 'Timer', 'SeriesTimer'];
|
||||
|
||||
if (item.Type === 'Recording') {
|
||||
|
@ -62,7 +58,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
}
|
||||
|
||||
function supportsAddingToPlaylist(item) {
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
return false;
|
||||
}
|
||||
|
@ -96,7 +91,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
}
|
||||
|
||||
function canEdit(user, item) {
|
||||
|
||||
var itemType = item.Type;
|
||||
|
||||
if (itemType === 'UserRootFolder' || itemType === 'UserView') {
|
||||
|
@ -129,7 +123,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
}
|
||||
|
||||
function isLocalItem(item) {
|
||||
|
||||
if (item && item.Id && item.Id.indexOf('local') === 0) {
|
||||
return true;
|
||||
}
|
||||
|
@ -144,7 +137,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
isLocalItem: isLocalItem,
|
||||
|
||||
canIdentify: function (user, item) {
|
||||
|
||||
var itemType = item.Type;
|
||||
|
||||
if (itemType === 'Movie' ||
|
||||
|
@ -156,9 +148,7 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
itemType === 'MusicAlbum' ||
|
||||
itemType === 'MusicArtist' ||
|
||||
itemType === 'MusicVideo') {
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
|
||||
if (!isLocalItem(item)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -171,7 +161,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
canEdit: canEdit,
|
||||
|
||||
canEditImages: function (user, item) {
|
||||
|
||||
var itemType = item.Type;
|
||||
|
||||
if (item.MediaType === 'Photo') {
|
||||
|
@ -180,7 +169,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
|
||||
if (itemType === 'UserView') {
|
||||
if (user.Policy.IsAdministrator) {
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -197,7 +185,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
},
|
||||
|
||||
canSync: function (user, item) {
|
||||
|
||||
if (user && !user.Policy.EnableContentDownloading) {
|
||||
return false;
|
||||
}
|
||||
|
@ -210,7 +197,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
},
|
||||
|
||||
canShare: function (item, user) {
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
return false;
|
||||
}
|
||||
|
@ -239,7 +225,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
},
|
||||
|
||||
canMarkPlayed: function (item) {
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
return false;
|
||||
}
|
||||
|
@ -269,7 +254,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
},
|
||||
|
||||
canRate: function (item) {
|
||||
|
||||
if (item.Type === 'Program'
|
||||
|| item.Type === 'Timer'
|
||||
|| item.Type === 'SeriesTimer'
|
||||
|
@ -284,7 +268,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
},
|
||||
|
||||
canConvert: function (item, user) {
|
||||
|
||||
if (!user.Policy.EnableMediaConversion) {
|
||||
return false;
|
||||
}
|
||||
|
@ -320,16 +303,13 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
},
|
||||
|
||||
canRefreshMetadata: function (item, user) {
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
|
||||
var collectionType = item.CollectionType;
|
||||
if (collectionType === 'livetv') {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (item.Type !== 'Timer' && item.Type !== 'SeriesTimer' && item.Type !== 'Program' && item.Type !== 'TvChannel' && !(item.Type === 'Recording' && item.Status !== 'Completed')) {
|
||||
|
||||
if (!isLocalItem(item)) {
|
||||
return true;
|
||||
}
|
||||
|
@ -340,7 +320,6 @@ define(['apphost', 'globalize'], function (appHost, globalize) {
|
|||
},
|
||||
|
||||
supportsMediaSourceSelection: function (item) {
|
||||
|
||||
if (item.MediaType !== 'Video') {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -35,7 +35,6 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
function searchForIdentificationResults(page) {
|
||||
|
||||
let lookupInfo = {
|
||||
ProviderIds: {}
|
||||
};
|
||||
|
@ -45,11 +44,9 @@ import 'cardStyle';
|
|||
const identifyField = page.querySelectorAll('.identifyField');
|
||||
let value;
|
||||
for (i = 0, length = identifyField.length; i < length; i++) {
|
||||
|
||||
value = identifyField[i].value;
|
||||
|
||||
if (value) {
|
||||
|
||||
if (identifyField[i].type === 'number') {
|
||||
value = parseInt(value);
|
||||
}
|
||||
|
@ -62,7 +59,6 @@ import 'cardStyle';
|
|||
|
||||
const txtLookupId = page.querySelectorAll('.txtLookupId');
|
||||
for (i = 0, length = txtLookupId.length; i < length; i++) {
|
||||
|
||||
value = txtLookupId[i].value;
|
||||
|
||||
if (value) {
|
||||
|
@ -100,14 +96,12 @@ import 'cardStyle';
|
|||
dataType: 'json'
|
||||
|
||||
}).then(results => {
|
||||
|
||||
loading.hide();
|
||||
showIdentificationSearchResults(page, results);
|
||||
});
|
||||
}
|
||||
|
||||
function showIdentificationSearchResults(page, results) {
|
||||
|
||||
const identificationSearchResults = page.querySelector('.identificationSearchResults');
|
||||
|
||||
page.querySelector('.popupIdentifyForm').classList.add('hide');
|
||||
|
@ -119,7 +113,6 @@ import 'cardStyle';
|
|||
let i;
|
||||
let length;
|
||||
for (i = 0, length = results.length; i < length; i++) {
|
||||
|
||||
const result = results[i];
|
||||
html += getSearchResultHtml(result, i);
|
||||
}
|
||||
|
@ -133,17 +126,14 @@ import 'cardStyle';
|
|||
const currentResult = results[index];
|
||||
|
||||
if (currentItem != null) {
|
||||
|
||||
showIdentifyOptions(page, currentResult);
|
||||
} else {
|
||||
|
||||
finishFindNewDialog(page, currentResult);
|
||||
}
|
||||
}
|
||||
|
||||
const searchImages = elem.querySelectorAll('.card');
|
||||
for (i = 0, length = searchImages.length; i < length; i++) {
|
||||
|
||||
searchImages[i].addEventListener('click', onSearchImageClick);
|
||||
}
|
||||
|
||||
|
@ -161,7 +151,6 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
function showIdentifyOptions(page, identifyResult) {
|
||||
|
||||
const identifyOptionsForm = page.querySelector('.identifyOptionsForm');
|
||||
|
||||
page.querySelector('.popupIdentifyForm').classList.add('hide');
|
||||
|
@ -193,7 +182,6 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
function getSearchResultHtml(result, index) {
|
||||
|
||||
// TODO move card creation code to Card component
|
||||
|
||||
let html = '';
|
||||
|
@ -234,7 +222,6 @@ import 'cardStyle';
|
|||
|
||||
html += `<div class="cardImageContainer coveredImage" style="background-image:url('${displayUrl}');"></div>`;
|
||||
} else {
|
||||
|
||||
html += `<div class="cardImageContainer coveredImage defaultCardBackground defaultCardBackground1"><div class="cardText cardCenteredText">${result.Name}</div></div>`;
|
||||
}
|
||||
html += '</div>';
|
||||
|
@ -257,7 +244,6 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
for (let i = 0; i < numLines; i++) {
|
||||
|
||||
if (i === 0) {
|
||||
html += '<div class="cardText cardText-first cardTextCentered">';
|
||||
} else {
|
||||
|
@ -279,7 +265,6 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
function submitIdentficationResult(page) {
|
||||
|
||||
loading.show();
|
||||
|
||||
const options = {
|
||||
|
@ -295,14 +280,11 @@ import 'cardStyle';
|
|||
contentType: 'application/json'
|
||||
|
||||
}).then(() => {
|
||||
|
||||
hasChanges = true;
|
||||
loading.hide();
|
||||
|
||||
dialogHelper.close(page);
|
||||
|
||||
}, () => {
|
||||
|
||||
loading.hide();
|
||||
|
||||
dialogHelper.close(page);
|
||||
|
@ -310,15 +292,12 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
function showIdentificationForm(page, item) {
|
||||
|
||||
const apiClient = getApiClient();
|
||||
|
||||
apiClient.getJSON(apiClient.getUrl(`Items/${item.Id}/ExternalIdInfos`)).then(idList => {
|
||||
|
||||
let html = '';
|
||||
|
||||
for (let i = 0, length = idList.length; i < length; i++) {
|
||||
|
||||
const idInfo = idList[i];
|
||||
|
||||
const id = `txtLookup${idInfo.Key}`;
|
||||
|
@ -340,11 +319,9 @@ import 'cardStyle';
|
|||
page.querySelector('#txtLookupName').value = '';
|
||||
|
||||
if (item.Type === 'Person' || item.Type === 'BoxSet') {
|
||||
|
||||
page.querySelector('.fldLookupYear').classList.add('hide');
|
||||
page.querySelector('#txtLookupYear').value = '';
|
||||
} else {
|
||||
|
||||
page.querySelector('.fldLookupYear').classList.remove('hide');
|
||||
page.querySelector('#txtLookupYear').value = '';
|
||||
}
|
||||
|
@ -356,15 +333,12 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
function showEditor(itemId) {
|
||||
|
||||
loading.show();
|
||||
|
||||
return import('text!./itemidentifier.template.html').then(({default: template}) => {
|
||||
|
||||
const apiClient = getApiClient();
|
||||
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
|
||||
|
||||
currentItem = item;
|
||||
currentItemType = currentItem.Type;
|
||||
|
||||
|
@ -406,21 +380,18 @@ import 'cardStyle';
|
|||
dialogHelper.open(dlg);
|
||||
|
||||
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', e => {
|
||||
|
||||
e.preventDefault();
|
||||
searchForIdentificationResults(dlg);
|
||||
return false;
|
||||
});
|
||||
|
||||
dlg.querySelector('.identifyOptionsForm').addEventListener('submit', e => {
|
||||
|
||||
e.preventDefault();
|
||||
submitIdentficationResult(dlg);
|
||||
return false;
|
||||
});
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
|
@ -433,7 +404,6 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
function onDialogClosed() {
|
||||
|
||||
loading.hide();
|
||||
if (hasChanges) {
|
||||
currentResolve();
|
||||
|
@ -444,12 +414,10 @@ import 'cardStyle';
|
|||
|
||||
// TODO investigate where this was used
|
||||
function showEditorFindNew(itemName, itemYear, itemType, resolveFunc) {
|
||||
|
||||
currentItem = null;
|
||||
currentItemType = itemType;
|
||||
|
||||
return import('text!./itemidentifier.template.html').then(({default: template}) => {
|
||||
|
||||
const dialogOptions = {
|
||||
size: 'small',
|
||||
removeOnClose: true,
|
||||
|
@ -477,19 +445,16 @@ import 'cardStyle';
|
|||
dialogHelper.open(dlg);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', e => {
|
||||
|
||||
e.preventDefault();
|
||||
searchForIdentificationResults(dlg);
|
||||
return false;
|
||||
});
|
||||
|
||||
dlg.addEventListener('close', () => {
|
||||
|
||||
loading.hide();
|
||||
const foundItem = hasChanges ? currentSearchResult : null;
|
||||
|
||||
|
@ -503,16 +468,12 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
function showIdentificationFormFindNew(dlg, itemName, itemYear, itemType) {
|
||||
|
||||
dlg.querySelector('#txtLookupName').value = itemName;
|
||||
|
||||
if (itemType === 'Person' || itemType === 'BoxSet') {
|
||||
|
||||
dlg.querySelector('.fldLookupYear').classList.add('hide');
|
||||
dlg.querySelector('#txtLookupYear').value = '';
|
||||
|
||||
} else {
|
||||
|
||||
dlg.querySelector('.fldLookupYear').classList.remove('hide');
|
||||
dlg.querySelector('#txtLookupYear').value = itemYear;
|
||||
}
|
||||
|
@ -521,9 +482,7 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
export function show(itemId, serverId) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
currentResolve = resolve;
|
||||
currentReject = reject;
|
||||
currentServerId = serverId;
|
||||
|
@ -534,9 +493,7 @@ import 'cardStyle';
|
|||
}
|
||||
|
||||
export function showFindNew(itemName, itemYear, itemType, serverId) {
|
||||
|
||||
return new Promise((resolve) => {
|
||||
|
||||
currentServerId = serverId;
|
||||
|
||||
hasChanges = false;
|
||||
|
|
|
@ -2,23 +2,19 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
'use strict';
|
||||
|
||||
function onUserDataChanged(e, apiClient, userData) {
|
||||
|
||||
var instance = this;
|
||||
|
||||
var eventsToMonitor = getEventsToMonitor(instance);
|
||||
|
||||
// TODO: Check user data change reason?
|
||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
||||
|
||||
instance.notifyRefreshNeeded();
|
||||
} else if (eventsToMonitor.indexOf('markplayed') !== -1) {
|
||||
|
||||
instance.notifyRefreshNeeded();
|
||||
}
|
||||
}
|
||||
|
||||
function getEventsToMonitor(instance) {
|
||||
|
||||
var options = instance.options;
|
||||
var monitor = options ? options.monitorEvents : null;
|
||||
if (monitor) {
|
||||
|
@ -29,21 +25,17 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
function onTimerCreated(e, apiClient, data) {
|
||||
|
||||
var instance = this;
|
||||
|
||||
if (getEventsToMonitor(instance).indexOf('timers') !== -1) {
|
||||
|
||||
instance.notifyRefreshNeeded();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function onSeriesTimerCreated(e, apiClient, data) {
|
||||
|
||||
var instance = this;
|
||||
if (getEventsToMonitor(instance).indexOf('seriestimers') !== -1) {
|
||||
|
||||
instance.notifyRefreshNeeded();
|
||||
return;
|
||||
}
|
||||
|
@ -53,28 +45,23 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
var instance = this;
|
||||
|
||||
if (getEventsToMonitor(instance).indexOf('timers') !== -1) {
|
||||
|
||||
instance.notifyRefreshNeeded();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function onSeriesTimerCancelled(e, apiClient, data) {
|
||||
|
||||
var instance = this;
|
||||
if (getEventsToMonitor(instance).indexOf('seriestimers') !== -1) {
|
||||
|
||||
instance.notifyRefreshNeeded();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
function onLibraryChanged(e, apiClient, data) {
|
||||
|
||||
var instance = this;
|
||||
var eventsToMonitor = getEventsToMonitor(instance);
|
||||
if (eventsToMonitor.indexOf('seriestimers') !== -1 || eventsToMonitor.indexOf('timers') !== -1) {
|
||||
|
||||
// yes this is an assumption
|
||||
return;
|
||||
}
|
||||
|
@ -101,23 +88,18 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
function onPlaybackStopped(e, stopInfo) {
|
||||
|
||||
var instance = this;
|
||||
|
||||
var state = stopInfo.state;
|
||||
|
||||
var eventsToMonitor = getEventsToMonitor(instance);
|
||||
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') {
|
||||
|
||||
if (eventsToMonitor.indexOf('videoplayback') !== -1) {
|
||||
|
||||
instance.notifyRefreshNeeded(true);
|
||||
return;
|
||||
}
|
||||
} else if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Audio') {
|
||||
|
||||
if (eventsToMonitor.indexOf('audioplayback') !== -1) {
|
||||
|
||||
instance.notifyRefreshNeeded(true);
|
||||
return;
|
||||
}
|
||||
|
@ -125,7 +107,6 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
function addNotificationEvent(instance, name, handler, owner) {
|
||||
|
||||
var localHandler = handler.bind(instance);
|
||||
owner = owner || serverNotifications;
|
||||
events.on(owner, name, localHandler);
|
||||
|
@ -133,7 +114,6 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
function removeNotificationEvent(instance, name, owner) {
|
||||
|
||||
var handler = instance['event_' + name];
|
||||
if (handler) {
|
||||
owner = owner || serverNotifications;
|
||||
|
@ -143,7 +123,6 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
function ItemsRefresher(options) {
|
||||
|
||||
this.options = options || {};
|
||||
|
||||
addNotificationEvent(this, 'UserDataChanged', onUserDataChanged);
|
||||
|
@ -156,24 +135,19 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
ItemsRefresher.prototype.pause = function () {
|
||||
|
||||
clearRefreshInterval(this, true);
|
||||
|
||||
this.paused = true;
|
||||
};
|
||||
|
||||
ItemsRefresher.prototype.resume = function (options) {
|
||||
|
||||
this.paused = false;
|
||||
|
||||
var refreshIntervalEndTime = this.refreshIntervalEndTime;
|
||||
if (refreshIntervalEndTime) {
|
||||
|
||||
var remainingMs = refreshIntervalEndTime - new Date().getTime();
|
||||
if (remainingMs > 0 && !this.needsRefresh) {
|
||||
|
||||
resetRefreshInterval(this, remainingMs);
|
||||
|
||||
} else {
|
||||
this.needsRefresh = true;
|
||||
this.refreshIntervalEndTime = null;
|
||||
|
@ -188,7 +162,6 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
};
|
||||
|
||||
ItemsRefresher.prototype.refreshItems = function () {
|
||||
|
||||
if (!this.fetchData) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
@ -204,7 +177,6 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
};
|
||||
|
||||
ItemsRefresher.prototype.notifyRefreshNeeded = function (isInForeground) {
|
||||
|
||||
if (this.paused) {
|
||||
this.needsRefresh = true;
|
||||
return;
|
||||
|
@ -223,9 +195,7 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
};
|
||||
|
||||
function clearRefreshInterval(instance, isPausing) {
|
||||
|
||||
if (instance.refreshInterval) {
|
||||
|
||||
clearInterval(instance.refreshInterval);
|
||||
instance.refreshInterval = null;
|
||||
|
||||
|
@ -236,7 +206,6 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
function resetRefreshInterval(instance, intervalMs) {
|
||||
|
||||
clearRefreshInterval(instance);
|
||||
|
||||
if (!intervalMs) {
|
||||
|
@ -253,7 +222,6 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
function onDataFetched(result) {
|
||||
|
||||
resetRefreshInterval(this);
|
||||
|
||||
if (this.afterRefresh) {
|
||||
|
@ -262,7 +230,6 @@ define(['playbackManager', 'serverNotifications', 'events'], function (playbackM
|
|||
}
|
||||
|
||||
ItemsRefresher.prototype.destroy = function () {
|
||||
|
||||
clearRefreshInterval(this);
|
||||
|
||||
removeNotificationEvent(this, 'UserDataChanged');
|
||||
|
|
|
@ -16,7 +16,6 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
|
|||
}
|
||||
|
||||
LayoutManager.prototype.setLayout = function (layout, save) {
|
||||
|
||||
if (!layout || layout === 'auto') {
|
||||
this.autoLayout();
|
||||
|
||||
|
@ -41,7 +40,6 @@ define(['browser', 'appSettings', 'events'], function (browser, appSettings, eve
|
|||
};
|
||||
|
||||
LayoutManager.prototype.autoLayout = function () {
|
||||
|
||||
// Take a guess at initial layout. The consuming app can override
|
||||
if (browser.mobile) {
|
||||
this.setLayout('mobile', false);
|
||||
|
|
|
@ -18,9 +18,7 @@ import 'emby-ratingbutton';
|
|||
import 'emby-playstatebutton';
|
||||
|
||||
function getIndex(item, options) {
|
||||
|
||||
if (options.index === 'disc') {
|
||||
|
||||
return item.ParentIndexNumber == null ? '' : globalize.translate('ValueDiscNumber', item.ParentIndexNumber);
|
||||
}
|
||||
|
||||
|
@ -29,7 +27,6 @@ import 'emby-playstatebutton';
|
|||
let name;
|
||||
|
||||
if (sortBy.indexOf('sortname') === 0) {
|
||||
|
||||
if (item.Type === 'Episode') {
|
||||
return '';
|
||||
}
|
||||
|
@ -45,11 +42,9 @@ import 'emby-playstatebutton';
|
|||
return name.toUpperCase();
|
||||
}
|
||||
if (sortBy.indexOf('officialrating') === 0) {
|
||||
|
||||
return item.OfficialRating || globalize.translate('Unrated');
|
||||
}
|
||||
if (sortBy.indexOf('communityrating') === 0) {
|
||||
|
||||
if (item.CommunityRating == null) {
|
||||
return globalize.translate('Unrated');
|
||||
}
|
||||
|
@ -57,7 +52,6 @@ import 'emby-playstatebutton';
|
|||
return Math.floor(item.CommunityRating);
|
||||
}
|
||||
if (sortBy.indexOf('criticrating') === 0) {
|
||||
|
||||
if (item.CriticRating == null) {
|
||||
return globalize.translate('Unrated');
|
||||
}
|
||||
|
@ -65,7 +59,6 @@ import 'emby-playstatebutton';
|
|||
return Math.floor(item.CriticRating);
|
||||
}
|
||||
if (sortBy.indexOf('albumartist') === 0) {
|
||||
|
||||
// SortName
|
||||
if (!item.AlbumArtist) {
|
||||
return '';
|
||||
|
@ -84,7 +77,6 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
function getImageUrl(item, width) {
|
||||
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
let itemId;
|
||||
|
||||
|
@ -114,7 +106,6 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
function getChannelImageUrl(item, width) {
|
||||
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
const options = {
|
||||
maxWidth: width * 2,
|
||||
|
@ -161,11 +152,9 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
function getRightButtonsHtml(options) {
|
||||
|
||||
let html = '';
|
||||
|
||||
for (let i = 0, length = options.rightButtons.length; i < length; i++) {
|
||||
|
||||
const button = options.rightButtons[i];
|
||||
|
||||
html += `<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="custom" data-customaction="${button.id}" title="${button.title}"><span class="material-icons ${button.icon}"></span></button>`;
|
||||
|
@ -179,7 +168,6 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
export function getListViewHtml(options) {
|
||||
|
||||
const items = options.items;
|
||||
|
||||
let groupTitle = '';
|
||||
|
@ -198,17 +186,14 @@ import 'emby-playstatebutton';
|
|||
const containerAlbumArtistIds = (options.containerAlbumArtists || []).map(getId);
|
||||
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
const item = items[i];
|
||||
|
||||
let html = '';
|
||||
|
||||
if (options.showIndex) {
|
||||
|
||||
const itemGroupTitle = getIndex(item, options);
|
||||
|
||||
if (itemGroupTitle !== groupTitle) {
|
||||
|
||||
if (html) {
|
||||
html += '</div>';
|
||||
}
|
||||
|
@ -258,14 +243,12 @@ import 'emby-playstatebutton';
|
|||
const channelIdData = item.ChannelId ? (` data-channelid="${item.ChannelId}"`) : '';
|
||||
|
||||
if (enableContentWrapper) {
|
||||
|
||||
cssClass += ' listItem-withContentWrapper';
|
||||
}
|
||||
|
||||
html += `<${outerTagName} class="${cssClass}"${playlistItemId} data-action="${action}" data-isfolder="${item.IsFolder}" data-id="${item.Id}" data-serverid="${item.ServerId}" data-type="${item.Type}"${mediaTypeData}${collectionTypeData}${channelIdData}${positionTicksData}${collectionIdData}${playlistIdData}>`;
|
||||
|
||||
if (enableContentWrapper) {
|
||||
|
||||
html += '<div class="listItem-content">';
|
||||
}
|
||||
|
||||
|
@ -317,7 +300,6 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
if (options.showIndexNumberLeft) {
|
||||
|
||||
html += '<div class="listItem-indexnumberleft">';
|
||||
html += (item.IndexNumber || ' ');
|
||||
html += '</div>';
|
||||
|
@ -365,9 +347,7 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
if (options.showParentTitle && options.parentTitleWithTitle) {
|
||||
|
||||
if (displayName) {
|
||||
|
||||
if (parentTitle) {
|
||||
parentTitle += ' - ';
|
||||
}
|
||||
|
@ -385,18 +365,15 @@ import 'emby-playstatebutton';
|
|||
|
||||
if (item.IsFolder) {
|
||||
if (options.artist !== false) {
|
||||
|
||||
if (item.AlbumArtist && item.Type === 'MusicAlbum') {
|
||||
textlines.push(item.AlbumArtist);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
let showArtist = options.artist === true;
|
||||
const artistItems = item.ArtistItems;
|
||||
|
||||
if (!showArtist && options.artist !== false) {
|
||||
|
||||
if (!artistItems || !artistItems.length) {
|
||||
showArtist = true;
|
||||
} else if (artistItems.length > 1 || !containerAlbumArtistIds.includes(artistItems[0].Id)) {
|
||||
|
@ -405,7 +382,6 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
if (showArtist) {
|
||||
|
||||
if (artistItems && item.Type !== 'MusicAlbum') {
|
||||
textlines.push(artistItems.map(a => {
|
||||
return a.Name;
|
||||
|
@ -415,7 +391,6 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
if (item.Type === 'TvChannel') {
|
||||
|
||||
if (item.CurrentProgram) {
|
||||
textlines.push(itemHelper.getDisplayName(item.CurrentProgram));
|
||||
}
|
||||
|
@ -436,7 +411,6 @@ import 'emby-playstatebutton';
|
|||
|
||||
if (options.mediaInfo !== false) {
|
||||
if (!enableSideMediaInfo) {
|
||||
|
||||
const mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText';
|
||||
|
||||
html += `<div class="${mediaInfoClass}">`;
|
||||
|
@ -481,7 +455,6 @@ import 'emby-playstatebutton';
|
|||
html += '<div class="listViewUserDataButtons">';
|
||||
|
||||
if (!clickEntireItem) {
|
||||
|
||||
if (options.addToListButton) {
|
||||
html += '<button is="paper-icon-button-light" class="listItemButton itemAction" data-action="addtoplaylist"><span class="material-icons playlist_add"></span></button>';
|
||||
}
|
||||
|
@ -495,7 +468,6 @@ import 'emby-playstatebutton';
|
|||
}
|
||||
|
||||
if (options.enableUserDataButtons !== false) {
|
||||
|
||||
const userData = item.UserData || {};
|
||||
const likes = userData.Likes == null ? '' : userData.Likes;
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ define(['css!./loading'], function () {
|
|||
var elem = loadingElem;
|
||||
|
||||
if (!elem) {
|
||||
|
||||
elem = document.createElement('div');
|
||||
loadingElem = elem;
|
||||
|
||||
|
@ -56,7 +55,6 @@ define(['css!./loading'], function () {
|
|||
var elem = loadingElem;
|
||||
|
||||
if (elem) {
|
||||
|
||||
elem.classList.remove('mdlSpinnerActive');
|
||||
|
||||
elem.classList.remove('mdl-spinner__layer-1-active');
|
||||
|
|
|
@ -23,9 +23,7 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function allowSwipe(target) {
|
||||
|
||||
function allowSwipeOn(elem) {
|
||||
|
||||
if (dom.parentWithTag(elem, 'input')) {
|
||||
return false;
|
||||
}
|
||||
|
@ -50,7 +48,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function configureSwipeTabs(view, tabsElem, getTabContainersFn) {
|
||||
|
||||
if (!browser.touch) {
|
||||
return;
|
||||
}
|
||||
|
@ -69,7 +66,6 @@ import 'emby-button';
|
|||
};
|
||||
|
||||
import('touchHelper').then(({default: TouchHelper}) => {
|
||||
|
||||
const touchHelper = new TouchHelper(view.parentNode.parentNode);
|
||||
|
||||
events.on(touchHelper, 'swipeleft', onSwipeLeft);
|
||||
|
@ -84,7 +80,6 @@ import 'emby-button';
|
|||
export function setTabs(view, selectedIndex, getTabsFn, getTabContainersFn, onBeforeTabChange, onTabChange, setSelectedIndex) {
|
||||
if (!view) {
|
||||
if (tabOwnerView) {
|
||||
|
||||
if (!headerTabsContainer) {
|
||||
headerTabsContainer = queryScope.querySelector('.headerTabs');
|
||||
}
|
||||
|
@ -113,12 +108,10 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (tabOwnerView !== view) {
|
||||
|
||||
let index = 0;
|
||||
|
||||
const indexAttribute = selectedIndex == null ? '' : (' data-index="' + selectedIndex + '"');
|
||||
const tabsHtml = '<div is="emby-tabs"' + indexAttribute + ' class="tabs-viewmenubar"><div class="emby-tabs-slider" style="white-space:nowrap;">' + getTabsFn().map(function (t) {
|
||||
|
||||
let tabClass = 'emby-tab-button';
|
||||
|
||||
if (t.enabled === false) {
|
||||
|
@ -139,7 +132,6 @@ import 'emby-button';
|
|||
|
||||
index++;
|
||||
return tabHtml;
|
||||
|
||||
}).join('') + '</div></div>';
|
||||
|
||||
tabsContainerElem.innerHTML = tabsHtml;
|
||||
|
@ -153,10 +145,8 @@ import 'emby-button';
|
|||
configureSwipeTabs(view, tabsElem, getTabContainersFn);
|
||||
|
||||
tabsElem.addEventListener('beforetabchange', function (e) {
|
||||
|
||||
const tabContainers = getTabContainersFn();
|
||||
if (e.detail.previousIndex != null) {
|
||||
|
||||
const previousPanel = tabContainers[e.detail.previousIndex];
|
||||
if (previousPanel) {
|
||||
previousPanel.classList.remove('is-active');
|
||||
|
@ -181,7 +171,6 @@ import 'emby-button';
|
|||
if (tabsElem.selectedIndex) {
|
||||
tabsElem.selectedIndex(selectedIndex);
|
||||
} else {
|
||||
|
||||
tabsElem.readySelectedIndex = selectedIndex;
|
||||
tabsElem.addEventListener('ready', onViewTabsReady);
|
||||
}
|
||||
|
@ -209,7 +198,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
export function selectedTabIndex(index) {
|
||||
|
||||
const tabsContainerElem = headerTabsContainer;
|
||||
|
||||
if (!tabsElem) {
|
||||
|
|
|
@ -11,23 +11,19 @@ import 'emby-button';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function getTimerIndicator(item) {
|
||||
|
||||
let status;
|
||||
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return '<span class="material-icons mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon fiber_smart_record"></span>';
|
||||
} else if (item.TimerId || item.SeriesTimerId) {
|
||||
|
||||
status = item.Status || 'Cancelled';
|
||||
} else if (item.Type === 'Timer') {
|
||||
|
||||
status = item.Status;
|
||||
} else {
|
||||
return '';
|
||||
}
|
||||
|
||||
if (item.SeriesTimerId) {
|
||||
|
||||
if (status !== 'Cancelled') {
|
||||
return '<span class="material-icons mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon fiber_smart_record"></span>';
|
||||
}
|
||||
|
@ -46,9 +42,7 @@ import 'emby-button';
|
|||
let date;
|
||||
|
||||
if (item.StartDate && options.programTime !== false) {
|
||||
|
||||
try {
|
||||
|
||||
text = '';
|
||||
|
||||
date = datetime.parseISO8601Date(item.StartDate);
|
||||
|
@ -75,7 +69,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (item.ChannelName) {
|
||||
|
||||
if (options.interactive && item.ChannelId) {
|
||||
miscInfo.push({
|
||||
html: `<a is="emby-linkbutton" class="button-flat mediaInfoItem" href="${appRouter.getRouteUrl({
|
||||
|
@ -121,11 +114,9 @@ import 'emby-button';
|
|||
const showFolderRuntime = item.Type === 'MusicAlbum' || item.MediaType === 'MusicArtist' || item.MediaType === 'Playlist' || item.MediaType === 'MusicGenre';
|
||||
|
||||
if (showFolderRuntime) {
|
||||
|
||||
count = item.SongCount || item.ChildCount;
|
||||
|
||||
if (count) {
|
||||
|
||||
miscInfo.push(globalize.translate('TrackCount', count));
|
||||
}
|
||||
|
||||
|
@ -133,19 +124,15 @@ import 'emby-button';
|
|||
miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
|
||||
}
|
||||
} else if (item.Type === 'PhotoAlbum' || item.Type === 'BoxSet') {
|
||||
|
||||
count = item.ChildCount;
|
||||
|
||||
if (count) {
|
||||
|
||||
miscInfo.push(globalize.translate('ItemCount', count));
|
||||
}
|
||||
}
|
||||
|
||||
if ((item.Type === 'Episode' || item.MediaType === 'Photo') && options.originalAirDate !== false) {
|
||||
|
||||
if (item.PremiereDate) {
|
||||
|
||||
try {
|
||||
date = datetime.parseISO8601Date(item.PremiereDate);
|
||||
|
||||
|
@ -159,7 +146,6 @@ import 'emby-button';
|
|||
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
if (item.RecordAnyTime) {
|
||||
|
||||
miscInfo.push(globalize.translate('Anytime'));
|
||||
} else {
|
||||
miscInfo.push(datetime.getDisplayTime(item.StartDate));
|
||||
|
@ -173,7 +159,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (item.StartDate && item.Type !== 'Program' && item.Type !== 'SeriesTimer') {
|
||||
|
||||
try {
|
||||
date = datetime.parseISO8601Date(item.StartDate);
|
||||
|
||||
|
@ -190,24 +175,18 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (options.year !== false && item.ProductionYear && item.Type === 'Series') {
|
||||
|
||||
if (item.Status === 'Continuing') {
|
||||
miscInfo.push(globalize.translate('SeriesYearToPresent', item.ProductionYear));
|
||||
|
||||
} else if (item.ProductionYear) {
|
||||
|
||||
text = item.ProductionYear;
|
||||
|
||||
if (item.EndDate) {
|
||||
|
||||
try {
|
||||
|
||||
const endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||
|
||||
if (endYear !== item.ProductionYear) {
|
||||
text += `-${datetime.parseISO8601Date(item.EndDate).getFullYear()}`;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('error parsing date:', item.EndDate);
|
||||
}
|
||||
|
@ -218,7 +197,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (item.Type === 'Program') {
|
||||
|
||||
if (options.programIndicator !== false) {
|
||||
if (item.IsLive) {
|
||||
miscInfo.push({
|
||||
|
@ -240,7 +218,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if ((item.IsSeries || item.EpisodeTitle) && options.episodeTitle !== false) {
|
||||
|
||||
text = itemHelper.getDisplayName(item, {
|
||||
includeIndexNumber: options.episodeTitleIndexNumber
|
||||
});
|
||||
|
@ -251,7 +228,6 @@ import 'emby-button';
|
|||
} else if (item.IsMovie && item.ProductionYear && options.originalAirDate !== false) {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
} else if (item.PremiereDate && options.originalAirDate !== false) {
|
||||
|
||||
try {
|
||||
date = datetime.parseISO8601Date(item.PremiereDate);
|
||||
text = globalize.translate('OriginalAirDateValue', datetime.toLocaleDateString(date));
|
||||
|
@ -266,12 +242,9 @@ import 'emby-button';
|
|||
|
||||
if (options.year !== false) {
|
||||
if (item.Type !== 'Series' && item.Type !== 'Episode' && item.Type !== 'Person' && item.MediaType !== 'Photo' && item.Type !== 'Program' && item.Type !== 'Season') {
|
||||
|
||||
if (item.ProductionYear) {
|
||||
|
||||
miscInfo.push(item.ProductionYear);
|
||||
} else if (item.PremiereDate) {
|
||||
|
||||
try {
|
||||
text = datetime.parseISO8601Date(item.PremiereDate).getFullYear();
|
||||
miscInfo.push(text);
|
||||
|
@ -283,11 +256,8 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (item.RunTimeTicks && item.Type !== 'Series' && item.Type !== 'Program' && item.Type !== 'Book' && !showFolderRuntime && options.runtime !== false) {
|
||||
|
||||
if (item.Type === 'Audio') {
|
||||
|
||||
miscInfo.push(datetime.getDisplayRunningTime(item.RunTimeTicks));
|
||||
|
||||
} else {
|
||||
minutes = item.RunTimeTicks / 600000000;
|
||||
|
||||
|
@ -327,7 +297,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (item.CriticRating && options.criticRating !== false) {
|
||||
|
||||
if (item.CriticRating >= 60) {
|
||||
html += `<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingFresh">${item.CriticRating}</div>`;
|
||||
} else {
|
||||
|
@ -336,7 +305,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (options.endsAt !== false) {
|
||||
|
||||
const endsAt = getEndsAt(item);
|
||||
if (endsAt) {
|
||||
html += getMediaInfoItem(endsAt, 'endsAt');
|
||||
|
@ -349,9 +317,7 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
export function getEndsAt(item) {
|
||||
|
||||
if (item.MediaType === 'Video' && item.RunTimeTicks) {
|
||||
|
||||
if (!item.StartDate) {
|
||||
let endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
|
||||
endDate = new Date(endDate);
|
||||
|
@ -365,7 +331,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
export function getEndsAtFromPosition(runtimeTicks, positionTicks, includeText) {
|
||||
|
||||
let endDate = new Date().getTime() + ((runtimeTicks - (positionTicks || 0)) / 10000);
|
||||
endDate = new Date(endDate);
|
||||
|
||||
|
@ -378,12 +343,10 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function getMediaInfoItem(m, cssClass) {
|
||||
|
||||
cssClass = cssClass ? (`${cssClass} mediaInfoItem`) : 'mediaInfoItem';
|
||||
let mediaInfoText = m;
|
||||
|
||||
if (typeof (m) !== 'string' && typeof (m) !== 'number') {
|
||||
|
||||
if (m.html) {
|
||||
return m.html;
|
||||
}
|
||||
|
@ -408,17 +371,13 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function dynamicEndTime(elem, item) {
|
||||
|
||||
const interval = setInterval(() => {
|
||||
|
||||
if (!document.body.contains(elem)) {
|
||||
|
||||
clearInterval(interval);
|
||||
return;
|
||||
}
|
||||
|
||||
elem.innerHTML = getEndsAt(item);
|
||||
|
||||
}, 60000);
|
||||
}
|
||||
|
||||
|
@ -437,7 +396,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function afterFill(elem, item, options) {
|
||||
|
||||
if (options.endsAt !== false) {
|
||||
const endsAtElem = elem.querySelector('.endsAt');
|
||||
if (endsAtElem) {
|
||||
|
@ -452,7 +410,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function onChannelLinkClick(e) {
|
||||
|
||||
const channelId = this.getAttribute('data-id');
|
||||
const serverId = this.getAttribute('data-serverid');
|
||||
|
||||
|
@ -463,7 +420,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
export function getPrimaryMediaInfoHtml(item, options) {
|
||||
|
||||
options = options || {};
|
||||
if (options.interactive == null) {
|
||||
options.interactive = false;
|
||||
|
@ -473,7 +429,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
export function getSecondaryMediaInfoHtml(item, options) {
|
||||
|
||||
options = options || {};
|
||||
if (options.interactive == null) {
|
||||
options.interactive = false;
|
||||
|
@ -486,12 +441,10 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
export function getResolutionText(i) {
|
||||
|
||||
const width = i.Width;
|
||||
const height = i.Height;
|
||||
|
||||
if (width && height) {
|
||||
|
||||
if (width >= 3800 || height >= 2000) {
|
||||
return '4K';
|
||||
}
|
||||
|
@ -514,19 +467,16 @@ import 'emby-button';
|
|||
return '720p';
|
||||
}
|
||||
if (width >= 700 || height >= 400) {
|
||||
|
||||
if (i.IsInterlaced) {
|
||||
return '480i';
|
||||
}
|
||||
return '480p';
|
||||
}
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function getAudioStreamForDisplay(item) {
|
||||
|
||||
if (!item.MediaSources) {
|
||||
return null;
|
||||
}
|
||||
|
@ -542,7 +492,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
export function getMediaInfoStats(item, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
const list = [];
|
||||
|
@ -587,19 +536,12 @@ import 'emby-button';
|
|||
let channelText;
|
||||
|
||||
if (channels === 8) {
|
||||
|
||||
channelText = '7.1';
|
||||
|
||||
} else if (channels === 7) {
|
||||
|
||||
channelText = '6.1';
|
||||
|
||||
} else if (channels === 6) {
|
||||
|
||||
channelText = '5.1';
|
||||
|
||||
} else if (channels === 2) {
|
||||
|
||||
channelText = '2.0';
|
||||
}
|
||||
|
||||
|
@ -625,7 +567,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (item.DateCreated && itemHelper.enableDateAddedDisplay(item)) {
|
||||
|
||||
const dateCreated = datetime.parseISO8601Date(item.DateCreated);
|
||||
|
||||
list.push({
|
||||
|
|
|
@ -30,16 +30,13 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function closeDialog(isSubmitted) {
|
||||
|
||||
if (isDialog()) {
|
||||
dialogHelper.close(currentContext);
|
||||
}
|
||||
}
|
||||
|
||||
function submitUpdatedItem(form, item) {
|
||||
|
||||
function afterContentTypeUpdated() {
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
toast(globalize.translate('MessageItemSaved'));
|
||||
});
|
||||
|
@ -51,11 +48,9 @@ import 'flexStyles';
|
|||
const apiClient = getApiClient();
|
||||
|
||||
apiClient.updateItem(item).then(function () {
|
||||
|
||||
const newContentType = form.querySelector('#selectContentType').value || '';
|
||||
|
||||
if ((metadataEditorInfo.ContentType || '') !== newContentType) {
|
||||
|
||||
apiClient.ajax({
|
||||
|
||||
url: apiClient.getUrl('Items/' + item.Id + '/ContentType', {
|
||||
|
@ -67,11 +62,9 @@ import 'flexStyles';
|
|||
}).then(function () {
|
||||
afterContentTypeUpdated();
|
||||
});
|
||||
|
||||
} else {
|
||||
afterContentTypeUpdated();
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -83,13 +76,9 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getAlbumArtists(form) {
|
||||
|
||||
return form.querySelector('#txtAlbumArtist').value.trim().split(';').filter(function (s) {
|
||||
|
||||
return s.length > 0;
|
||||
|
||||
}).map(function (a) {
|
||||
|
||||
return {
|
||||
Name: a
|
||||
};
|
||||
|
@ -97,13 +86,9 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getArtists(form) {
|
||||
|
||||
return form.querySelector('#txtArtist').value.trim().split(';').filter(function (s) {
|
||||
|
||||
return s.length > 0;
|
||||
|
||||
}).map(function (a) {
|
||||
|
||||
return {
|
||||
Name: a
|
||||
};
|
||||
|
@ -111,7 +96,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getDateValue(form, element, property) {
|
||||
|
||||
let val = form.querySelector(element).value;
|
||||
|
||||
if (!val) {
|
||||
|
@ -119,14 +103,12 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
if (currentItem[property]) {
|
||||
|
||||
const date = datetime.parseISO8601Date(currentItem[property], true);
|
||||
|
||||
const parts = date.toISOString().split('T');
|
||||
|
||||
// If the date is the same, preserve the time
|
||||
if (parts[0].indexOf(val) === 0) {
|
||||
|
||||
const iso = parts[1];
|
||||
|
||||
val += 'T' + iso;
|
||||
|
@ -137,7 +119,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
loading.show();
|
||||
|
||||
const form = this;
|
||||
|
@ -198,14 +179,12 @@ import 'flexStyles';
|
|||
item.PreferredMetadataCountryCode = form.querySelector('#selectCountry').value;
|
||||
|
||||
if (currentItem.Type === 'Person') {
|
||||
|
||||
const placeOfBirth = form.querySelector('#txtPlaceOfBirth').value;
|
||||
|
||||
item.ProductionLocations = placeOfBirth ? [placeOfBirth] : [];
|
||||
}
|
||||
|
||||
if (currentItem.Type === 'Series') {
|
||||
|
||||
// 600000000
|
||||
const seriesRuntime = form.querySelector('#txtSeriesRuntime').value;
|
||||
item.RunTimeTicks = seriesRuntime ? (seriesRuntime * 600000000) : null;
|
||||
|
@ -248,11 +227,8 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function editPerson(context, person, index) {
|
||||
|
||||
require(['personEditor'], function (personEditor) {
|
||||
|
||||
personEditor.show(person).then(function (updatedPerson) {
|
||||
|
||||
const isNew = index === -1;
|
||||
|
||||
if (isNew) {
|
||||
|
@ -302,7 +278,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function onEditorClick(e) {
|
||||
|
||||
const btnRemoveFromEditorList = dom.parentWithClass(e.target, 'btnRemoveFromEditorList');
|
||||
if (btnRemoveFromEditorList) {
|
||||
removeElementFromList(btnRemoveFromEditorList);
|
||||
|
@ -375,12 +350,10 @@ import 'flexStyles';
|
|||
form.addEventListener('submit', onSubmit);
|
||||
|
||||
context.querySelector('#btnAddPerson').addEventListener('click', function (event, data) {
|
||||
|
||||
editPerson(context, {}, -1);
|
||||
});
|
||||
|
||||
context.querySelector('#peopleList').addEventListener('click', function (e) {
|
||||
|
||||
let index;
|
||||
const btnDeletePerson = dom.parentWithClass(e.target, 'btnDeletePerson');
|
||||
if (btnDeletePerson) {
|
||||
|
@ -398,7 +371,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getItem(itemId, serverId) {
|
||||
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (itemId) {
|
||||
|
@ -409,7 +381,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getEditorConfig(itemId, serverId) {
|
||||
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (itemId) {
|
||||
|
@ -420,13 +391,11 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function populateCountries(select, allCountries) {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (let i = 0, length = allCountries.length; i < length; i++) {
|
||||
|
||||
const culture = allCountries[i];
|
||||
|
||||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + '</option>';
|
||||
|
@ -436,13 +405,11 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function populateLanguages(select, languages) {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (let i = 0, length = languages.length; i < length; i++) {
|
||||
|
||||
const culture = languages[i];
|
||||
|
||||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
||||
|
@ -452,7 +419,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function renderContentTypeOptions(context, metadataInfo) {
|
||||
|
||||
if (!metadataInfo.ContentTypeOptions.length) {
|
||||
hideElement('#fldContentType', context);
|
||||
} else {
|
||||
|
@ -460,9 +426,7 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
const html = metadataInfo.ContentTypeOptions.map(function (i) {
|
||||
|
||||
return '<option value="' + i.Value + '">' + i.Name + '</option>';
|
||||
|
||||
}).join('');
|
||||
|
||||
const selectEl = context.querySelector('#selectContentType');
|
||||
|
@ -471,13 +435,11 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function loadExternalIds(context, item, externalIds) {
|
||||
|
||||
let html = '';
|
||||
|
||||
const providerIds = item.ProviderIds || {};
|
||||
|
||||
for (let i = 0, length = externalIds.length; i < length; i++) {
|
||||
|
||||
const idInfo = externalIds[i];
|
||||
|
||||
const id = 'txt1' + idInfo.Key;
|
||||
|
@ -523,7 +485,6 @@ import 'flexStyles';
|
|||
function hideElement(selector, context, multiple) {
|
||||
context = context || document;
|
||||
if (typeof selector === 'string') {
|
||||
|
||||
const elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
|
||||
|
||||
Array.prototype.forEach.call(elements, function (el) {
|
||||
|
@ -542,7 +503,6 @@ import 'flexStyles';
|
|||
function showElement(selector, context, multiple) {
|
||||
context = context || document;
|
||||
if (typeof selector === 'string') {
|
||||
|
||||
const elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
|
||||
|
||||
Array.prototype.forEach.call(elements, function (el) {
|
||||
|
@ -744,7 +704,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function fillItemInfo(context, item, parentalRatingOptions) {
|
||||
|
||||
let select = context.querySelector('#selectOfficialRating');
|
||||
|
||||
populateRatings(parentalRatingOptions, select, item.OfficialRating);
|
||||
|
@ -866,7 +825,6 @@ import 'flexStyles';
|
|||
context.querySelector('#selectCountry').value = item.PreferredMetadataCountryCode || '';
|
||||
|
||||
if (item.RunTimeTicks) {
|
||||
|
||||
const minutes = item.RunTimeTicks / 600000000;
|
||||
|
||||
context.querySelector('#txtSeriesRuntime').value = Math.round(minutes);
|
||||
|
@ -876,7 +834,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function populateRatings(allParentalRatings, select, currentValue) {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
@ -887,7 +844,6 @@ import 'flexStyles';
|
|||
let currentValueFound = false;
|
||||
|
||||
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
|
||||
rating = allParentalRatings[i];
|
||||
|
||||
ratings.push({ Name: rating.Name, Value: rating.Name });
|
||||
|
@ -902,7 +858,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
for (let i = 0, length = ratings.length; i < length; i++) {
|
||||
|
||||
rating = ratings[i];
|
||||
|
||||
html += "<option value='" + rating.Value + "'>" + rating.Name + '</option>';
|
||||
|
@ -921,7 +876,6 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function populateListView(list, items, sortCallback) {
|
||||
|
||||
items = items || [];
|
||||
if (typeof (sortCallback) === 'undefined') {
|
||||
items.sort(function (a, b) {
|
||||
|
@ -953,14 +907,12 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function populatePeople(context, people) {
|
||||
|
||||
let lastType = '';
|
||||
let html = '';
|
||||
|
||||
const elem = context.querySelector('#peopleList');
|
||||
|
||||
for (let i = 0, length = people.length; i < length; i++) {
|
||||
|
||||
const person = people[i];
|
||||
|
||||
html += '<div class="listItem">';
|
||||
|
@ -990,10 +942,8 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getLockedFieldsHtml(fields, currentFields) {
|
||||
|
||||
let html = '';
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
|
||||
const field = fields[i];
|
||||
const name = field.name;
|
||||
const value = field.value || field.name;
|
||||
|
@ -1040,11 +990,9 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function reload(context, itemId, serverId) {
|
||||
|
||||
loading.show();
|
||||
|
||||
Promise.all([getItem(itemId, serverId), getEditorConfig(itemId, serverId)]).then(function (responses) {
|
||||
|
||||
const item = responses[0];
|
||||
metadataEditorInfo = responses[1];
|
||||
|
||||
|
@ -1136,7 +1084,6 @@ import 'flexStyles';
|
|||
|
||||
embed: function (elem, itemId, serverId) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
loading.show();
|
||||
|
||||
import('text!./metadataEditor.template.html').then(({default: template}) => {
|
||||
|
|
|
@ -17,9 +17,7 @@ import 'css!./../formdialog';
|
|||
|
||||
function show(person) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
import('text!./personEditor.template.html').then(({default: template}) => {
|
||||
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -53,7 +51,6 @@ import 'css!./../formdialog';
|
|||
dialogHelper.open(dlg);
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||
}
|
||||
|
@ -66,7 +63,6 @@ import 'css!./../formdialog';
|
|||
});
|
||||
|
||||
dlg.querySelector('.selectPersonType').addEventListener('change', function (e) {
|
||||
|
||||
if (this.value === 'Actor') {
|
||||
dlg.querySelector('.fldRole').classList.remove('hide');
|
||||
} else {
|
||||
|
@ -75,12 +71,10 @@ import 'css!./../formdialog';
|
|||
});
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
dlg.querySelector('form').addEventListener('submit', function (e) {
|
||||
|
||||
submitted = true;
|
||||
|
||||
person.Name = dlg.querySelector('.txtPersonName', dlg).value;
|
||||
|
|
|
@ -13,10 +13,8 @@ import 'css!./multiSelect';
|
|||
let currentSelectionCommandsPanel;
|
||||
|
||||
function hideSelections() {
|
||||
|
||||
const selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||
if (selectionCommandsPanel) {
|
||||
|
||||
selectionCommandsPanel.parentNode.removeChild(selectionCommandsPanel);
|
||||
currentSelectionCommandsPanel = null;
|
||||
|
||||
|
@ -24,7 +22,6 @@ import 'css!./multiSelect';
|
|||
selectedElements = [];
|
||||
const elems = document.querySelectorAll('.itemSelectionPanel');
|
||||
for (let i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
const parent = elems[i].parentNode;
|
||||
parent.removeChild(elems[i]);
|
||||
parent.classList.remove('withMultiSelect');
|
||||
|
@ -33,13 +30,11 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onItemSelectionPanelClick(e, itemSelectionPanel) {
|
||||
|
||||
// toggle the checkbox, if it wasn't clicked on
|
||||
if (!dom.parentWithClass(e.target, 'chkItemSelect')) {
|
||||
const chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||
|
||||
if (chkItemSelect) {
|
||||
|
||||
if (chkItemSelect.classList.contains('checkedInitial')) {
|
||||
chkItemSelect.classList.remove('checkedInitial');
|
||||
} else {
|
||||
|
@ -56,11 +51,9 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function updateItemSelection(chkItemSelect, selected) {
|
||||
|
||||
const id = dom.parentWithAttribute(chkItemSelect, 'data-id').getAttribute('data-id');
|
||||
|
||||
if (selected) {
|
||||
|
||||
const current = selectedItems.filter(i => {
|
||||
return i === id;
|
||||
});
|
||||
|
@ -69,7 +62,6 @@ import 'css!./multiSelect';
|
|||
selectedItems.push(id);
|
||||
selectedElements.push(chkItemSelect);
|
||||
}
|
||||
|
||||
} else {
|
||||
selectedItems = selectedItems.filter(i => {
|
||||
return i !== id;
|
||||
|
@ -94,11 +86,9 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function showSelection(item, isChecked) {
|
||||
|
||||
let itemSelectionPanel = item.querySelector('.itemSelectionPanel');
|
||||
|
||||
if (!itemSelectionPanel) {
|
||||
|
||||
itemSelectionPanel = document.createElement('div');
|
||||
itemSelectionPanel.classList.add('itemSelectionPanel');
|
||||
|
||||
|
@ -120,11 +110,9 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function showSelectionCommands() {
|
||||
|
||||
let selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||
|
||||
if (!selectionCommandsPanel) {
|
||||
|
||||
selectionCommandsPanel = document.createElement('div');
|
||||
selectionCommandsPanel.classList.add('selectionCommandsPanel');
|
||||
|
||||
|
@ -150,9 +138,7 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function alertText(options) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(options).then(resolve, resolve);
|
||||
});
|
||||
|
@ -160,9 +146,7 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function deleteItems(apiClient, itemIds) {
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
let msg = globalize.translate('ConfirmDeleteItem');
|
||||
let title = globalize.translate('HeaderDeleteItem');
|
||||
|
||||
|
@ -172,28 +156,23 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
|
||||
confirm(msg, title).then(() => {
|
||||
const promises = itemIds.map(itemId => {
|
||||
apiClient.deleteItem(itemId);
|
||||
});
|
||||
|
||||
Promise.all(promises).then(resolve, () => {
|
||||
|
||||
alertText(globalize.translate('ErrorDeletingItem')).then(reject, reject);
|
||||
});
|
||||
}, reject);
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function showMenuForSelectedItems(e) {
|
||||
|
||||
const apiClient = connectionManager.currentApiClient();
|
||||
|
||||
apiClient.getCurrentUser().then(user => {
|
||||
|
||||
const menuItems = [];
|
||||
|
||||
menuItems.push({
|
||||
|
@ -317,17 +296,14 @@ import 'css!./multiSelect';
|
|||
}
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function dispatchNeedsRefresh() {
|
||||
|
||||
const elems = [];
|
||||
|
||||
[].forEach.call(selectedElements, i => {
|
||||
|
||||
const container = dom.parentWithAttribute(i, 'is', 'emby-itemscontainer');
|
||||
|
||||
if (container && !elems.includes(container)) {
|
||||
|
@ -341,9 +317,7 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function combineVersions(apiClient, selection) {
|
||||
|
||||
if (selection.length < 2) {
|
||||
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert({
|
||||
|
||||
|
@ -361,7 +335,6 @@ import 'css!./multiSelect';
|
|||
url: apiClient.getUrl('Videos/MergeVersions', { Ids: selection.join(',') })
|
||||
|
||||
}).then(() => {
|
||||
|
||||
loading.hide();
|
||||
hideSelections();
|
||||
dispatchNeedsRefresh();
|
||||
|
@ -369,7 +342,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function showSelections(initialCard) {
|
||||
|
||||
import('emby-checkbox').then(() => {
|
||||
const cards = document.querySelectorAll('.card');
|
||||
for (let i = 0, length = cards.length; i < length; i++) {
|
||||
|
@ -382,11 +354,9 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onContainerClick(e) {
|
||||
|
||||
const target = e.target;
|
||||
|
||||
if (selectedItems.length) {
|
||||
|
||||
const card = dom.parentWithClass(target, 'card');
|
||||
if (card) {
|
||||
const itemSelectionPanel = card.querySelector('.itemSelectionPanel');
|
||||
|
@ -404,17 +374,14 @@ import 'css!./multiSelect';
|
|||
document.addEventListener('viewbeforehide', hideSelections);
|
||||
|
||||
export default function (options) {
|
||||
|
||||
const self = this;
|
||||
|
||||
const container = options.container;
|
||||
|
||||
function onTapHold(e) {
|
||||
|
||||
const card = dom.parentWithClass(e.target, 'card');
|
||||
|
||||
if (card) {
|
||||
|
||||
showSelections(card);
|
||||
}
|
||||
|
||||
|
@ -427,7 +394,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function getTouches(e) {
|
||||
|
||||
return e.changedTouches || e.targetTouches || e.touches;
|
||||
}
|
||||
|
||||
|
@ -436,7 +402,6 @@ import 'css!./multiSelect';
|
|||
let touchStartX;
|
||||
let touchStartY;
|
||||
function onTouchStart(e) {
|
||||
|
||||
const touch = getTouches(e)[0];
|
||||
touchTarget = null;
|
||||
touchStartX = 0;
|
||||
|
@ -451,7 +416,6 @@ import 'css!./multiSelect';
|
|||
const card = dom.parentWithClass(element, 'card');
|
||||
|
||||
if (card) {
|
||||
|
||||
if (touchStartTimeout) {
|
||||
clearTimeout(touchStartTimeout);
|
||||
touchStartTimeout = null;
|
||||
|
@ -465,7 +429,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onTouchMove(e) {
|
||||
|
||||
if (touchTarget) {
|
||||
const touch = getTouches(e)[0];
|
||||
let deltaX;
|
||||
|
@ -487,12 +450,10 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onTouchEnd(e) {
|
||||
|
||||
onMouseOut(e);
|
||||
}
|
||||
|
||||
function onMouseDown(e) {
|
||||
|
||||
if (touchStartTimeout) {
|
||||
clearTimeout(touchStartTimeout);
|
||||
touchStartTimeout = null;
|
||||
|
@ -503,7 +464,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onMouseOut(e) {
|
||||
|
||||
if (touchStartTimeout) {
|
||||
clearTimeout(touchStartTimeout);
|
||||
touchStartTimeout = null;
|
||||
|
@ -512,7 +472,6 @@ import 'css!./multiSelect';
|
|||
}
|
||||
|
||||
function onTouchStartTimerFired() {
|
||||
|
||||
if (!touchTarget) {
|
||||
return;
|
||||
}
|
||||
|
@ -521,13 +480,11 @@ import 'css!./multiSelect';
|
|||
touchTarget = null;
|
||||
|
||||
if (card) {
|
||||
|
||||
showSelections(card);
|
||||
}
|
||||
}
|
||||
|
||||
function initTapHold(element) {
|
||||
|
||||
// mobile safari doesn't allow contextmenu override
|
||||
if (browser.touch && !browser.safari) {
|
||||
element.addEventListener('contextmenu', onTapHold);
|
||||
|
@ -565,7 +522,6 @@ import 'css!./multiSelect';
|
|||
self.onContainerClick = onContainerClick;
|
||||
|
||||
self.destroy = () => {
|
||||
|
||||
container.removeEventListener('click', onContainerClick);
|
||||
container.removeEventListener('contextmenu', onTapHold);
|
||||
|
||||
|
|
|
@ -44,7 +44,6 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
}
|
||||
|
||||
function showNonPersistentNotification(title, options, timeoutMs) {
|
||||
|
||||
try {
|
||||
var notif = new Notification(title, options); /* eslint-disable-line compat/compat */
|
||||
|
||||
|
@ -66,7 +65,6 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
}
|
||||
|
||||
function showNotification(options, timeoutMs, apiClient) {
|
||||
|
||||
var title = options.title;
|
||||
|
||||
options.data = options.data || {};
|
||||
|
@ -85,7 +83,6 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
}
|
||||
|
||||
function showNewItemNotification(item, apiClient) {
|
||||
|
||||
if (playbackManager.isPlayingLocally(['Video'])) {
|
||||
return;
|
||||
}
|
||||
|
@ -107,7 +104,6 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
var imageTags = item.ImageTags || {};
|
||||
|
||||
if (imageTags.Primary) {
|
||||
|
||||
notification.icon = apiClient.getScaledImageUrl(item.Id, {
|
||||
width: 80,
|
||||
tag: imageTags.Primary,
|
||||
|
@ -119,7 +115,6 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
}
|
||||
|
||||
function onLibraryChanged(data, apiClient) {
|
||||
|
||||
var newItems = data.ItemsAdded;
|
||||
|
||||
if (!newItems.length) {
|
||||
|
@ -143,11 +138,9 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
EnableTotalRecordCount: false
|
||||
|
||||
}).then(function (result) {
|
||||
|
||||
var items = result.Items;
|
||||
|
||||
for (var i = 0, length = items.length ; i < length; i++) {
|
||||
|
||||
showNewItemNotification(items[i], apiClient);
|
||||
}
|
||||
});
|
||||
|
@ -159,9 +152,7 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
}
|
||||
|
||||
function showPackageInstallNotification(apiClient, installation, status) {
|
||||
|
||||
apiClient.getCurrentUser().then(function (user) {
|
||||
|
||||
if (!user.Policy.IsAdministrator) {
|
||||
return;
|
||||
}
|
||||
|
@ -195,7 +186,6 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
}
|
||||
|
||||
if (status === 'progress') {
|
||||
|
||||
var percentComplete = Math.round(installation.PercentComplete || 0);
|
||||
|
||||
notification.body = percentComplete + '% complete.';
|
||||
|
@ -246,7 +236,6 @@ define(['serverNotifications', 'playbackManager', 'events', 'globalize', 'requir
|
|||
});
|
||||
|
||||
events.on(serverNotifications, 'RestartRequired', function (e, apiClient) {
|
||||
|
||||
var serverId = apiClient.serverInfo().Id;
|
||||
var notification = {
|
||||
tag: 'restart' + serverId,
|
||||
|
|
|
@ -37,7 +37,6 @@ import 'emby-ratingbutton';
|
|||
let isVisibilityAllowed = true;
|
||||
|
||||
function getNowPlayingBarHtml() {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += '<div class="nowPlayingBar hide nowPlayingBar-hidden">';
|
||||
|
@ -97,12 +96,10 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function onSlideDownComplete() {
|
||||
|
||||
this.classList.add('hide');
|
||||
}
|
||||
|
||||
function slideDown(elem) {
|
||||
|
||||
// trigger reflow
|
||||
void elem.offsetWidth;
|
||||
|
||||
|
@ -114,7 +111,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function slideUp(elem) {
|
||||
|
||||
dom.removeEventListener(elem, dom.whichTransitionEvent(), onSlideDownComplete, {
|
||||
once: true
|
||||
});
|
||||
|
@ -132,7 +128,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function bindEvents(elem) {
|
||||
|
||||
currentTimeElement = elem.querySelector('.nowPlayingBarCurrentTime');
|
||||
nowPlayingImageElement = elem.querySelector('.nowPlayingImage');
|
||||
nowPlayingTextElement = elem.querySelector('.nowPlayingBarText');
|
||||
|
@ -145,15 +140,12 @@ import 'emby-ratingbutton';
|
|||
volumeSliderContainer = elem.querySelector('.nowPlayingBarVolumeSliderContainer');
|
||||
|
||||
muteButton.addEventListener('click', function () {
|
||||
|
||||
if (currentPlayer) {
|
||||
playbackManager.toggleMute(currentPlayer);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
elem.querySelector('.stopButton').addEventListener('click', function () {
|
||||
|
||||
if (currentPlayer) {
|
||||
playbackManager.stop(currentPlayer);
|
||||
}
|
||||
|
@ -164,7 +156,6 @@ import 'emby-ratingbutton';
|
|||
});
|
||||
|
||||
elem.querySelector('.nextTrackButton').addEventListener('click', function () {
|
||||
|
||||
if (currentPlayer) {
|
||||
playbackManager.nextTrack(currentPlayer);
|
||||
}
|
||||
|
@ -224,18 +215,14 @@ import 'emby-ratingbutton';
|
|||
});
|
||||
|
||||
positionSlider.addEventListener('change', function () {
|
||||
|
||||
if (currentPlayer) {
|
||||
|
||||
const newPercent = parseFloat(this.value);
|
||||
|
||||
playbackManager.seekPercent(newPercent, currentPlayer);
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
positionSlider.getBubbleText = function (value) {
|
||||
|
||||
const state = lastPlayerState;
|
||||
|
||||
if (!state || !state.NowPlayingItem || !currentRuntimeTicks) {
|
||||
|
@ -250,7 +237,6 @@ import 'emby-ratingbutton';
|
|||
};
|
||||
|
||||
elem.addEventListener('click', function (e) {
|
||||
|
||||
if (!dom.parentWithTag(e.target, ['BUTTON', 'INPUT'])) {
|
||||
showRemoteControl();
|
||||
}
|
||||
|
@ -258,7 +244,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function showRemoteControl() {
|
||||
|
||||
import('appRouter').then(({default: appRouter}) => {
|
||||
appRouter.showNowPlaying();
|
||||
});
|
||||
|
@ -266,7 +251,6 @@ import 'emby-ratingbutton';
|
|||
|
||||
let nowPlayingBarElement;
|
||||
function getNowPlayingBar() {
|
||||
|
||||
if (nowPlayingBarElement) {
|
||||
return Promise.resolve(nowPlayingBarElement);
|
||||
}
|
||||
|
@ -327,7 +311,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function updatePlayerStateInternal(event, state, player) {
|
||||
|
||||
showNowPlayingBar();
|
||||
|
||||
lastPlayerState = state;
|
||||
|
@ -415,7 +398,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function updatePlayerVolumeState(isMuted, volumeLevel) {
|
||||
|
||||
const supportedCommands = currentPlayerSupportedCommands;
|
||||
|
||||
let showMuteButton = true;
|
||||
|
@ -446,7 +428,6 @@ import 'emby-ratingbutton';
|
|||
|
||||
// See bindEvents for why this is necessary
|
||||
if (volumeSlider) {
|
||||
|
||||
volumeSliderContainer.classList.toggle('hide', !showVolumeSlider);
|
||||
|
||||
if (!volumeSlider.dragging) {
|
||||
|
@ -456,7 +437,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function seriesImageUrl(item, options) {
|
||||
|
||||
if (!item) {
|
||||
throw new Error('item cannot be null!');
|
||||
}
|
||||
|
@ -469,9 +449,7 @@ import 'emby-ratingbutton';
|
|||
options.type = options.type || 'Primary';
|
||||
|
||||
if (options.type === 'Primary') {
|
||||
|
||||
if (item.SeriesPrimaryImageTag) {
|
||||
|
||||
options.tag = item.SeriesPrimaryImageTag;
|
||||
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||
|
@ -479,15 +457,12 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
if (options.type === 'Thumb') {
|
||||
|
||||
if (item.SeriesThumbImageTag) {
|
||||
|
||||
options.tag = item.SeriesThumbImageTag;
|
||||
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||
}
|
||||
if (item.ParentThumbImageTag) {
|
||||
|
||||
options.tag = item.ParentThumbImageTag;
|
||||
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
||||
|
@ -498,7 +473,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function imageUrl(item, options) {
|
||||
|
||||
if (!item) {
|
||||
throw new Error('item cannot be null!');
|
||||
}
|
||||
|
@ -507,13 +481,11 @@ import 'emby-ratingbutton';
|
|||
options.type = options.type || 'Primary';
|
||||
|
||||
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||
|
||||
options.tag = item.ImageTags[options.type];
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
||||
}
|
||||
|
||||
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||
|
||||
options.tag = item.AlbumPrimaryImageTag;
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
||||
}
|
||||
|
@ -523,7 +495,6 @@ import 'emby-ratingbutton';
|
|||
|
||||
let currentImgUrl;
|
||||
function updateNowPlayingInfo(state) {
|
||||
|
||||
const nowPlayingItem = state.NowPlayingItem;
|
||||
|
||||
const textLines = nowPlayingItem ? nowPlayingHelper.getNowPlayingNames(nowPlayingItem) : [];
|
||||
|
@ -577,7 +548,6 @@ import 'emby-ratingbutton';
|
|||
|
||||
if (nowPlayingItem.Id) {
|
||||
if (isRefreshing) {
|
||||
|
||||
const apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId);
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
|
||||
const userData = item.UserData || {};
|
||||
|
@ -655,7 +625,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function hideNowPlayingBar() {
|
||||
|
||||
isEnabled = false;
|
||||
|
||||
// Use a timeout to prevent the bar from hiding and showing quickly
|
||||
|
@ -664,13 +633,11 @@ import 'emby-ratingbutton';
|
|||
// Don't call getNowPlayingBar here because we don't want to end up creating it just to hide it
|
||||
const elem = document.getElementsByClassName('nowPlayingBar')[0];
|
||||
if (elem) {
|
||||
|
||||
slideDown(elem);
|
||||
}
|
||||
}
|
||||
|
||||
function onPlaybackStopped(e, state) {
|
||||
|
||||
console.debug('nowplaying event: ' + e.type);
|
||||
const player = this;
|
||||
|
||||
|
@ -686,7 +653,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function onPlayPauseStateChanged(e) {
|
||||
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -696,7 +662,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function onStateChanged(event, state) {
|
||||
|
||||
console.debug('nowplaying event: ' + event.type);
|
||||
const player = this;
|
||||
|
||||
|
@ -723,7 +688,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function onTimeUpdate(e) {
|
||||
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -731,7 +695,6 @@ import 'emby-ratingbutton';
|
|||
// Try to avoid hammering the document with changes
|
||||
const now = new Date().getTime();
|
||||
if ((now - lastUpdateTime) < 700) {
|
||||
|
||||
return;
|
||||
}
|
||||
lastUpdateTime = now;
|
||||
|
@ -742,7 +705,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function releaseCurrentPlayer() {
|
||||
|
||||
const player = currentPlayer;
|
||||
|
||||
if (player) {
|
||||
|
@ -762,7 +724,6 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function onVolumeChanged(e) {
|
||||
|
||||
if (!isEnabled) {
|
||||
return;
|
||||
}
|
||||
|
@ -773,14 +734,12 @@ import 'emby-ratingbutton';
|
|||
}
|
||||
|
||||
function refreshFromPlayer(player) {
|
||||
|
||||
const state = playbackManager.getPlayerState(player);
|
||||
|
||||
onStateChanged.call(player, { type: 'init' }, state);
|
||||
}
|
||||
|
||||
function bindToPlayer(player) {
|
||||
|
||||
if (player === currentPlayer) {
|
||||
return;
|
||||
}
|
||||
|
@ -813,16 +772,12 @@ import 'emby-ratingbutton';
|
|||
bindToPlayer(playbackManager.getCurrentPlayer());
|
||||
|
||||
document.addEventListener('viewbeforeshow', function (e) {
|
||||
|
||||
if (!e.detail.options.enableMediaControl) {
|
||||
|
||||
if (isVisibilityAllowed) {
|
||||
isVisibilityAllowed = false;
|
||||
hideNowPlayingBar();
|
||||
}
|
||||
|
||||
} else if (!isVisibilityAllowed) {
|
||||
|
||||
isVisibilityAllowed = true;
|
||||
if (currentPlayer) {
|
||||
refreshFromPlayer(currentPlayer);
|
||||
|
|
|
@ -4,9 +4,7 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
var settingsKey = 'installedpackages1';
|
||||
|
||||
function addPackage(packageManager, pkg) {
|
||||
|
||||
packageManager.packagesList = packageManager.packagesList.filter(function (p) {
|
||||
|
||||
return p.name !== pkg.name;
|
||||
});
|
||||
|
||||
|
@ -14,7 +12,6 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
}
|
||||
|
||||
function removeUrl(url) {
|
||||
|
||||
var manifestUrls = JSON.parse(appSettings.get(settingsKey) || '[]');
|
||||
|
||||
manifestUrls = manifestUrls.filter(function (i) {
|
||||
|
@ -25,9 +22,7 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
}
|
||||
|
||||
function loadPackage(packageManager, url, throwError) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
var xhr = new XMLHttpRequest();
|
||||
var originalUrl = url;
|
||||
url += url.indexOf('?') === -1 ? '?' : '&';
|
||||
|
@ -36,7 +31,6 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
xhr.open('GET', url, true);
|
||||
|
||||
var onError = function () {
|
||||
|
||||
if (throwError === true) {
|
||||
reject();
|
||||
} else {
|
||||
|
@ -47,7 +41,6 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
|
||||
xhr.onload = function (e) {
|
||||
if (this.status < 400) {
|
||||
|
||||
var pkg = JSON.parse(this.response);
|
||||
pkg.url = originalUrl;
|
||||
|
||||
|
@ -61,7 +54,6 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
return pluginManager.loadPlugin(packageManager.mapPath(pkg, pluginUrl));
|
||||
});
|
||||
Promise.all(promises).then(resolve, resolve);
|
||||
|
||||
} else {
|
||||
onError();
|
||||
}
|
||||
|
@ -74,7 +66,6 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
}
|
||||
|
||||
function PackageManager() {
|
||||
|
||||
this.packagesList = [];
|
||||
}
|
||||
|
||||
|
@ -83,9 +74,7 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
|
||||
var instance = this;
|
||||
return Promise.all(manifestUrls.map(function (u) {
|
||||
|
||||
return loadPackage(instance, u);
|
||||
|
||||
})).then(function () {
|
||||
return Promise.resolve();
|
||||
}, function () {
|
||||
|
@ -98,9 +87,7 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
};
|
||||
|
||||
PackageManager.prototype.install = function (url) {
|
||||
|
||||
return loadPackage(this, url, true).then(function (pkg) {
|
||||
|
||||
var manifestUrls = JSON.parse(appSettings.get(settingsKey) || '[]');
|
||||
|
||||
if (manifestUrls.indexOf(url) === -1) {
|
||||
|
@ -113,16 +100,12 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
};
|
||||
|
||||
PackageManager.prototype.uninstall = function (name) {
|
||||
|
||||
var pkg = this.packagesList.filter(function (p) {
|
||||
|
||||
return p.name === name;
|
||||
})[0];
|
||||
|
||||
if (pkg) {
|
||||
|
||||
this.packagesList = this.packagesList.filter(function (p) {
|
||||
|
||||
return p.name !== name;
|
||||
});
|
||||
|
||||
|
@ -133,7 +116,6 @@ define(['appSettings', 'pluginManager'], function (appSettings, pluginManager) {
|
|||
};
|
||||
|
||||
PackageManager.prototype.mapPath = function (pkg, pluginUrl) {
|
||||
|
||||
var urlLower = pluginUrl.toLowerCase();
|
||||
if (urlLower.indexOf('http:') === 0 || urlLower.indexOf('https:') === 0 || urlLower.indexOf('file:') === 0) {
|
||||
return pluginUrl;
|
||||
|
|
|
@ -23,10 +23,8 @@ function getOsdElementHtml() {
|
|||
}
|
||||
|
||||
function ensureOsdElement() {
|
||||
|
||||
var elem = osdElement;
|
||||
if (!elem) {
|
||||
|
||||
enableAnimation = browser.supportsCssAnimation();
|
||||
|
||||
elem = document.createElement('div');
|
||||
|
@ -50,7 +48,6 @@ function onHideComplete() {
|
|||
|
||||
var hideTimeout;
|
||||
function showOsd() {
|
||||
|
||||
clearHideTimeout();
|
||||
|
||||
var elem = osdElement;
|
||||
|
@ -79,12 +76,10 @@ function clearHideTimeout() {
|
|||
}
|
||||
|
||||
function hideOsd() {
|
||||
|
||||
clearHideTimeout();
|
||||
|
||||
var elem = osdElement;
|
||||
if (elem) {
|
||||
|
||||
if (enableAnimation) {
|
||||
// trigger reflow
|
||||
void elem.offsetWidth;
|
||||
|
@ -108,7 +103,6 @@ function setIcon(iconElement, icon) {
|
|||
}
|
||||
|
||||
function updateElementsFromPlayer(brightness) {
|
||||
|
||||
if (iconElement) {
|
||||
if (brightness >= 80) {
|
||||
setIcon(iconElement, 'brightness_high');
|
||||
|
@ -124,7 +118,6 @@ function updateElementsFromPlayer(brightness) {
|
|||
}
|
||||
|
||||
function releaseCurrentPlayer() {
|
||||
|
||||
var player = currentPlayer;
|
||||
|
||||
if (player) {
|
||||
|
@ -135,7 +128,6 @@ function releaseCurrentPlayer() {
|
|||
}
|
||||
|
||||
function onBrightnessChanged(e) {
|
||||
|
||||
var player = this;
|
||||
|
||||
ensureOsdElement();
|
||||
|
@ -146,7 +138,6 @@ function onBrightnessChanged(e) {
|
|||
}
|
||||
|
||||
function bindToPlayer(player) {
|
||||
|
||||
if (player === currentPlayer) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
export function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) {
|
||||
|
||||
var topItem = nowPlayingItem;
|
||||
var bottomItem = null;
|
||||
var topText = nowPlayingItem.Name;
|
||||
|
@ -25,7 +24,6 @@ export function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) {
|
|||
var bottomText = '';
|
||||
|
||||
if (nowPlayingItem.ArtistItems && nowPlayingItem.ArtistItems.length) {
|
||||
|
||||
bottomItem = {
|
||||
Id: nowPlayingItem.ArtistItems[0].Id,
|
||||
Name: nowPlayingItem.ArtistItems[0].Name,
|
||||
|
@ -36,9 +34,7 @@ export function getNowPlayingNames(nowPlayingItem, includeNonNameInfo) {
|
|||
bottomText = nowPlayingItem.ArtistItems.map(function (a) {
|
||||
return a.Name;
|
||||
}).join(', ');
|
||||
|
||||
} else if (nowPlayingItem.Artists && nowPlayingItem.Artists.length) {
|
||||
|
||||
bottomText = nowPlayingItem.Artists.join(', ');
|
||||
} else if (nowPlayingItem.SeriesName || nowPlayingItem.Album) {
|
||||
bottomText = topText;
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -14,7 +14,6 @@ function onOrientationChangeError(err) {
|
|||
}
|
||||
|
||||
events.on(playbackManager, 'playbackstart', function (e, player, state) {
|
||||
|
||||
var isLocalVideo = player.isLocalPlayer && !player.isExternalPlayer && playbackManager.isPlayingVideo(player);
|
||||
|
||||
if (isLocalVideo && layoutManager.mobile) {
|
||||
|
@ -22,7 +21,6 @@ events.on(playbackManager, 'playbackstart', function (e, player, state) {
|
|||
var lockOrientation = screen.lockOrientation || screen.mozLockOrientation || screen.msLockOrientation || (screen.orientation && screen.orientation.lock);
|
||||
|
||||
if (lockOrientation) {
|
||||
|
||||
try {
|
||||
var promise = lockOrientation('landscape');
|
||||
if (promise.then) {
|
||||
|
@ -39,9 +37,7 @@ events.on(playbackManager, 'playbackstart', function (e, player, state) {
|
|||
});
|
||||
|
||||
events.on(playbackManager, 'playbackstop', function (e, playbackStopInfo) {
|
||||
|
||||
if (orientationLocked && !playbackStopInfo.nextMediaType) {
|
||||
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
var unlockOrientation = screen.unlockOrientation || screen.mozUnlockOrientation || screen.msUnlockOrientation || (screen.orientation && screen.orientation.unlock);
|
||||
|
||||
|
|
|
@ -8,7 +8,6 @@ import globalize from 'globalize';
|
|||
import appHost from 'apphost';
|
||||
|
||||
function mirrorItem(info, player) {
|
||||
|
||||
var item = info.item;
|
||||
|
||||
playbackManager.displayContent({
|
||||
|
@ -21,9 +20,7 @@ function mirrorItem(info, player) {
|
|||
}
|
||||
|
||||
function mirrorIfEnabled(info) {
|
||||
|
||||
if (info && playbackManager.enableDisplayMirroring()) {
|
||||
|
||||
var getPlayerInfo = playbackManager.getPlayerInfo();
|
||||
|
||||
if (getPlayerInfo) {
|
||||
|
@ -39,9 +36,7 @@ function emptyCallback() {
|
|||
}
|
||||
|
||||
function getTargetSecondaryText(target) {
|
||||
|
||||
if (target.user) {
|
||||
|
||||
return target.user.Name;
|
||||
}
|
||||
|
||||
|
@ -49,7 +44,6 @@ function getTargetSecondaryText(target) {
|
|||
}
|
||||
|
||||
function getIcon(target) {
|
||||
|
||||
var deviceType = target.deviceType;
|
||||
|
||||
if (!deviceType && target.isLocalPlayer) {
|
||||
|
@ -67,7 +61,6 @@ function getIcon(target) {
|
|||
}
|
||||
|
||||
switch (deviceType) {
|
||||
|
||||
case 'smartphone':
|
||||
return 'smartphone';
|
||||
case 'tablet':
|
||||
|
@ -84,7 +77,6 @@ function getIcon(target) {
|
|||
}
|
||||
|
||||
export function show(button) {
|
||||
|
||||
var currentPlayerInfo = playbackManager.getPlayerInfo();
|
||||
|
||||
if (currentPlayerInfo) {
|
||||
|
@ -99,9 +91,7 @@ export function show(button) {
|
|||
loading.show();
|
||||
|
||||
playbackManager.getTargets().then(function (targets) {
|
||||
|
||||
var menuItems = targets.map(function (t) {
|
||||
|
||||
var name = t.name;
|
||||
|
||||
if (t.appName && t.appName !== t.name) {
|
||||
|
@ -115,11 +105,9 @@ export function show(button) {
|
|||
secondaryText: getTargetSecondaryText(t),
|
||||
icon: getIcon(t)
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
|
||||
loading.hide();
|
||||
|
||||
var menuOptions = {
|
||||
|
@ -138,7 +126,6 @@ export function show(button) {
|
|||
}
|
||||
|
||||
actionsheet.show(menuOptions).then(function (id) {
|
||||
|
||||
var target = targets.filter(function (t) {
|
||||
return t.id === id;
|
||||
})[0];
|
||||
|
@ -146,7 +133,6 @@ export function show(button) {
|
|||
playbackManager.trySetActivePlayer(target.playerName, target);
|
||||
|
||||
mirrorIfEnabled();
|
||||
|
||||
}, emptyCallback);
|
||||
});
|
||||
});
|
||||
|
@ -164,11 +150,8 @@ function showActivePlayerMenu(playerInfo) {
|
|||
}
|
||||
|
||||
function disconnectFromPlayer(currentDeviceName) {
|
||||
|
||||
if (playbackManager.getSupportedCommands().indexOf('EndSession') !== -1) {
|
||||
|
||||
import('dialog').then(({default: dialog}) => {
|
||||
|
||||
var menuItems = [];
|
||||
|
||||
menuItems.push({
|
||||
|
@ -186,7 +169,6 @@ function disconnectFromPlayer(currentDeviceName) {
|
|||
|
||||
}).then(function (id) {
|
||||
switch (id) {
|
||||
|
||||
case 'yes':
|
||||
playbackManager.getCurrentPlayer().endSession();
|
||||
playbackManager.setDefaultPlayerActive();
|
||||
|
@ -198,17 +180,13 @@ function disconnectFromPlayer(currentDeviceName) {
|
|||
break;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
playbackManager.setDefaultPlayerActive();
|
||||
}
|
||||
}
|
||||
|
||||
function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
|
||||
|
||||
var html = '';
|
||||
|
||||
var dialogOptions = {
|
||||
|
@ -234,7 +212,6 @@ function showActivePlayerMenuInternal(dialogHelper, playerInfo) {
|
|||
html += '<div>';
|
||||
|
||||
if (playerInfo.supportedCommands.indexOf('DisplayContent') !== -1) {
|
||||
|
||||
html += '<label class="checkboxContainer">';
|
||||
var checkedHtml = playbackManager.enableDisplayMirroring() ? ' checked' : '';
|
||||
html += '<input type="checkbox" is="emby-checkbox" class="chkMirror"' + checkedHtml + '/>';
|
||||
|
@ -293,7 +270,6 @@ function onMirrorChange() {
|
|||
}
|
||||
|
||||
document.addEventListener('viewshow', function (e) {
|
||||
|
||||
var state = e.detail.state || {};
|
||||
var item = state.item;
|
||||
|
||||
|
|
|
@ -5,7 +5,6 @@ import globalize from 'globalize';
|
|||
import qualityoptions from 'qualityoptions';
|
||||
|
||||
function showQualityMenu(player, btn) {
|
||||
|
||||
var videoStream = playbackManager.currentMediaSource(player).MediaStreams.filter(function (stream) {
|
||||
return stream.Type === 'Video';
|
||||
})[0];
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
export function getDisplayPlayMethod(session) {
|
||||
|
||||
if (!session.NowPlayingItem) {
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -3,16 +3,13 @@ define([], function () {
|
|||
|
||||
var currentId = 0;
|
||||
function addUniquePlaylistItemId(item) {
|
||||
|
||||
if (!item.PlaylistItemId) {
|
||||
|
||||
item.PlaylistItemId = 'playlistItem' + currentId;
|
||||
currentId++;
|
||||
}
|
||||
}
|
||||
|
||||
function findPlaylistIndex(playlistItemId, list) {
|
||||
|
||||
for (var i = 0, length = list.length; i < length; i++) {
|
||||
if (list[i].PlaylistItemId === playlistItemId) {
|
||||
return i;
|
||||
|
@ -23,7 +20,6 @@ define([], function () {
|
|||
}
|
||||
|
||||
function PlayQueueManager() {
|
||||
|
||||
this._sortedPlaylist = [];
|
||||
this._playlist = [];
|
||||
this._repeatMode = 'RepeatNone';
|
||||
|
@ -35,11 +31,9 @@ define([], function () {
|
|||
};
|
||||
|
||||
PlayQueueManager.prototype.setPlaylist = function (items) {
|
||||
|
||||
items = items.slice(0);
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
addUniquePlaylistItemId(items[i]);
|
||||
}
|
||||
|
||||
|
@ -49,9 +43,7 @@ define([], function () {
|
|||
};
|
||||
|
||||
PlayQueueManager.prototype.queue = function (items) {
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
addUniquePlaylistItemId(items[i]);
|
||||
|
||||
this._playlist.push(items[i]);
|
||||
|
@ -105,7 +97,6 @@ define([], function () {
|
|||
var length;
|
||||
|
||||
for (i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
addUniquePlaylistItemId(items[i]);
|
||||
}
|
||||
|
||||
|
@ -121,12 +112,10 @@ define([], function () {
|
|||
};
|
||||
|
||||
PlayQueueManager.prototype.getCurrentPlaylistIndex = function () {
|
||||
|
||||
return findPlaylistIndex(this.getCurrentPlaylistItemId(), this._playlist);
|
||||
};
|
||||
|
||||
PlayQueueManager.prototype.getCurrentItem = function () {
|
||||
|
||||
var index = findPlaylistIndex(this.getCurrentPlaylistItemId(), this._playlist);
|
||||
|
||||
return index === -1 ? null : this._playlist[index];
|
||||
|
@ -137,12 +126,10 @@ define([], function () {
|
|||
};
|
||||
|
||||
PlayQueueManager.prototype.setPlaylistState = function (playlistItemId, playlistIndex) {
|
||||
|
||||
this._currentPlaylistItemId = playlistItemId;
|
||||
};
|
||||
|
||||
PlayQueueManager.prototype.setPlaylistIndex = function (playlistIndex) {
|
||||
|
||||
if (playlistIndex < 0) {
|
||||
this.setPlaylistState(null);
|
||||
} else {
|
||||
|
@ -151,7 +138,6 @@ define([], function () {
|
|||
};
|
||||
|
||||
PlayQueueManager.prototype.removeFromPlaylist = function (playlistItemIds) {
|
||||
|
||||
if (this._playlist.length <= playlistItemIds.length) {
|
||||
return {
|
||||
result: 'empty'
|
||||
|
@ -180,7 +166,6 @@ define([], function () {
|
|||
}
|
||||
|
||||
PlayQueueManager.prototype.movePlaylistItem = function (playlistItemId, newIndex) {
|
||||
|
||||
var playlist = this.getPlaylist();
|
||||
|
||||
var oldIndex;
|
||||
|
@ -213,7 +198,6 @@ define([], function () {
|
|||
};
|
||||
|
||||
PlayQueueManager.prototype.reset = function () {
|
||||
|
||||
this._sortedPlaylist = [];
|
||||
this._playlist = [];
|
||||
this._currentPlaylistItemId = null;
|
||||
|
@ -265,13 +249,11 @@ define([], function () {
|
|||
};
|
||||
|
||||
PlayQueueManager.prototype.getNextItemInfo = function () {
|
||||
|
||||
var newIndex;
|
||||
var playlist = this.getPlaylist();
|
||||
var playlistLength = playlist.length;
|
||||
|
||||
switch (this.getRepeatMode()) {
|
||||
|
||||
case 'RepeatOne':
|
||||
newIndex = this.getCurrentPlaylistIndex();
|
||||
break;
|
||||
|
|
|
@ -23,10 +23,8 @@ function getOsdElementHtml() {
|
|||
}
|
||||
|
||||
function ensureOsdElement() {
|
||||
|
||||
var elem = osdElement;
|
||||
if (!elem) {
|
||||
|
||||
enableAnimation = browser.supportsCssAnimation();
|
||||
|
||||
elem = document.createElement('div');
|
||||
|
@ -50,7 +48,6 @@ function onHideComplete() {
|
|||
|
||||
var hideTimeout;
|
||||
function showOsd() {
|
||||
|
||||
clearHideTimeout();
|
||||
|
||||
var elem = osdElement;
|
||||
|
@ -79,12 +76,10 @@ function clearHideTimeout() {
|
|||
}
|
||||
|
||||
function hideOsd() {
|
||||
|
||||
clearHideTimeout();
|
||||
|
||||
var elem = osdElement;
|
||||
if (elem) {
|
||||
|
||||
if (enableAnimation) {
|
||||
// trigger reflow
|
||||
void elem.offsetWidth;
|
||||
|
@ -103,7 +98,6 @@ function hideOsd() {
|
|||
}
|
||||
|
||||
function updatePlayerVolumeState(isMuted, volume) {
|
||||
|
||||
if (iconElement) {
|
||||
iconElement.classList.remove('volume_off', 'volume_up');
|
||||
iconElement.classList.add(isMuted ? 'volume_off' : 'volume_up');
|
||||
|
@ -114,7 +108,6 @@ function updatePlayerVolumeState(isMuted, volume) {
|
|||
}
|
||||
|
||||
function releaseCurrentPlayer() {
|
||||
|
||||
var player = currentPlayer;
|
||||
|
||||
if (player) {
|
||||
|
@ -125,7 +118,6 @@ function releaseCurrentPlayer() {
|
|||
}
|
||||
|
||||
function onVolumeChanged(e) {
|
||||
|
||||
var player = this;
|
||||
|
||||
ensureOsdElement();
|
||||
|
@ -136,7 +128,6 @@ function onVolumeChanged(e) {
|
|||
}
|
||||
|
||||
function bindToPlayer(player) {
|
||||
|
||||
if (player === currentPlayer) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -13,7 +13,6 @@ import 'emby-checkbox';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function fillSkipLengths(select) {
|
||||
|
||||
const options = [5, 10, 15, 20, 25, 30];
|
||||
|
||||
select.innerHTML = options.map(option => {
|
||||
|
@ -27,13 +26,11 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function populateLanguages(select, languages) {
|
||||
|
||||
let html = '';
|
||||
|
||||
html += `<option value=''>${globalize.translate('AnyLanguage')}</option>`;
|
||||
|
||||
for (let i = 0, length = languages.length; i < length; i++) {
|
||||
|
||||
const culture = languages[i];
|
||||
|
||||
html += `<option value='${culture.ThreeLetterISOLanguageName}'>${culture.DisplayName}</option>`;
|
||||
|
@ -43,7 +40,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function setMaxBitrateIntoField(select, isInNetwork, mediatype) {
|
||||
|
||||
const options = mediatype === 'Audio' ? qualityoptions.getAudioQualityOptions({
|
||||
|
||||
currentMaxBitrate: appSettings.maxStreamingBitrate(isInNetwork, mediatype),
|
||||
|
@ -59,7 +55,6 @@ import 'emby-checkbox';
|
|||
});
|
||||
|
||||
select.innerHTML = options.map(i => {
|
||||
|
||||
// render empty string instead of 0 for the auto option
|
||||
return `<option value="${i.bitrate || ''}">${i.name}</option>`;
|
||||
}).join('');
|
||||
|
@ -72,7 +67,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function fillChromecastQuality(select) {
|
||||
|
||||
const options = qualityoptions.getVideoQualityOptions({
|
||||
|
||||
currentMaxBitrate: appSettings.maxChromecastBitrate(),
|
||||
|
@ -81,7 +75,6 @@ import 'emby-checkbox';
|
|||
});
|
||||
|
||||
select.innerHTML = options.map(i => {
|
||||
|
||||
// render empty string instead of 0 for the auto option
|
||||
return `<option value="${i.bitrate || ''}">${i.name}</option>`;
|
||||
}).join('');
|
||||
|
@ -90,7 +83,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function setMaxBitrateFromField(select, isInNetwork, mediatype) {
|
||||
|
||||
if (select.value) {
|
||||
appSettings.maxStreamingBitrate(isInNetwork, mediatype, select.value);
|
||||
appSettings.enableAutomaticBitrateDetection(isInNetwork, mediatype, false);
|
||||
|
@ -100,7 +92,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function showHideQualityFields(context, user, apiClient) {
|
||||
|
||||
if (user.Policy.EnableVideoPlaybackTranscoding) {
|
||||
context.querySelector('.videoQualitySection').classList.remove('hide');
|
||||
} else {
|
||||
|
@ -108,7 +99,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
if (appHost.supports('multiserver')) {
|
||||
|
||||
context.querySelector('.fldVideoInNetworkQuality').classList.remove('hide');
|
||||
context.querySelector('.fldVideoInternetQuality').classList.remove('hide');
|
||||
|
||||
|
@ -122,15 +112,12 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
apiClient.getEndpointInfo().then(endpointInfo => {
|
||||
|
||||
if (endpointInfo.IsInNetwork) {
|
||||
|
||||
context.querySelector('.fldVideoInNetworkQuality').classList.remove('hide');
|
||||
|
||||
context.querySelector('.fldVideoInternetQuality').classList.add('hide');
|
||||
context.querySelector('.musicQualitySection').classList.add('hide');
|
||||
} else {
|
||||
|
||||
context.querySelector('.fldVideoInNetworkQuality').classList.add('hide');
|
||||
|
||||
context.querySelector('.fldVideoInternetQuality').classList.remove('hide');
|
||||
|
@ -145,7 +132,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function showOrHideEpisodesField(context) {
|
||||
|
||||
if (browser.tizen || browser.web0s) {
|
||||
context.querySelector('.fldEpisodeAutoPlay').classList.add('hide');
|
||||
return;
|
||||
|
@ -155,14 +141,12 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function loadForm(context, user, userSettings, apiClient) {
|
||||
|
||||
const loggedInUserId = apiClient.getCurrentUserId();
|
||||
const userId = user.Id;
|
||||
|
||||
showHideQualityFields(context, user, apiClient);
|
||||
|
||||
apiClient.getCultures().then(allCultures => {
|
||||
|
||||
populateLanguages(context.querySelector('#selectAudioLanguage'), allCultures);
|
||||
|
||||
context.querySelector('#selectAudioLanguage', context).value = user.Configuration.AudioLanguagePreference || '';
|
||||
|
@ -171,7 +155,6 @@ import 'emby-checkbox';
|
|||
|
||||
// hide cinema mode options if disabled at server level
|
||||
apiClient.getNamedConfiguration('cinemamode').then(cinemaConfig => {
|
||||
|
||||
if (cinemaConfig.EnableIntrosForMovies || cinemaConfig.EnableIntrosForEpisodes) {
|
||||
context.querySelector('.cinemaModeOptions').classList.remove('hide');
|
||||
} else {
|
||||
|
@ -232,7 +215,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function saveUser(context, user, userSettingsInstance, apiClient) {
|
||||
|
||||
appSettings.enableSystemExternalPlayers(context.querySelector('.chkExternalVideoPlayer').checked);
|
||||
|
||||
appSettings.maxChromecastBitrate(context.querySelector('.selectChromecastVideoQuality').value);
|
||||
|
@ -256,13 +238,10 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||
|
||||
loading.show();
|
||||
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
|
@ -271,7 +250,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
events.trigger(instance, 'saved');
|
||||
|
||||
}, () => {
|
||||
loading.hide();
|
||||
});
|
||||
|
@ -279,14 +257,12 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
const self = this;
|
||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
const userId = self.options.userId;
|
||||
const userSettings = self.options.userSettings;
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||
});
|
||||
|
@ -299,9 +275,7 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function embed(options, self) {
|
||||
|
||||
return import('text!./playbackSettings.template.html').then(({default: template}) => {
|
||||
|
||||
options.element.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
||||
|
@ -325,7 +299,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
loadData() {
|
||||
|
||||
const self = this;
|
||||
const context = self.options.element;
|
||||
|
||||
|
@ -336,9 +309,7 @@ import 'emby-checkbox';
|
|||
const userSettings = self.options.userSettings;
|
||||
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
self.dataLoaded = true;
|
||||
|
||||
loadForm(context, user, userSettings, apiClient);
|
||||
|
@ -351,7 +322,6 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
this.options = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import 'css!./playerstats';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function init(instance) {
|
||||
|
||||
const parent = document.createElement('div');
|
||||
|
||||
parent.classList.add('playerStats');
|
||||
|
@ -50,9 +49,7 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
function renderStats(elem, categories) {
|
||||
|
||||
elem.querySelector('.playerStats-stats').innerHTML = categories.map(function (category) {
|
||||
|
||||
let categoryHtml = '';
|
||||
|
||||
const stats = category.stats;
|
||||
|
@ -72,7 +69,6 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
for (let i = 0, length = stats.length; i < length; i++) {
|
||||
|
||||
categoryHtml += '<div class="playerStats-stat">';
|
||||
|
||||
const stat = stats[i];
|
||||
|
@ -89,12 +85,10 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
return categoryHtml;
|
||||
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function getSession(instance, player) {
|
||||
|
||||
const now = new Date().getTime();
|
||||
|
||||
if ((now - (instance.lastSessionTime || 0)) < 10000) {
|
||||
|
@ -106,19 +100,16 @@ import 'css!./playerstats';
|
|||
return apiClient.getSessions({
|
||||
deviceId: apiClient.deviceId()
|
||||
}).then(function (sessions) {
|
||||
|
||||
instance.lastSession = sessions[0] || {};
|
||||
instance.lastSessionTime = new Date().getTime();
|
||||
|
||||
return Promise.resolve(instance.lastSession);
|
||||
|
||||
}, function () {
|
||||
return Promise.resolve({});
|
||||
});
|
||||
}
|
||||
|
||||
function translateReason(reason) {
|
||||
|
||||
return globalize.translate('' + reason);
|
||||
}
|
||||
|
||||
|
@ -160,28 +151,24 @@ import 'css!./playerstats';
|
|||
|
||||
if (displayPlayMethod === 'Transcode') {
|
||||
if (totalBitrate) {
|
||||
|
||||
sessionStats.push({
|
||||
label: globalize.translate('LabelBitrate'),
|
||||
value: getDisplayBitrate(totalBitrate)
|
||||
});
|
||||
}
|
||||
if (session.TranscodingInfo.CompletionPercentage) {
|
||||
|
||||
sessionStats.push({
|
||||
label: globalize.translate('LabelTranscodingProgress'),
|
||||
value: session.TranscodingInfo.CompletionPercentage.toFixed(1) + '%'
|
||||
});
|
||||
}
|
||||
if (session.TranscodingInfo.Framerate) {
|
||||
|
||||
sessionStats.push({
|
||||
label: globalize.translate('LabelTranscodingFramerate'),
|
||||
value: session.TranscodingInfo.Framerate + ' fps'
|
||||
});
|
||||
}
|
||||
if (session.TranscodingInfo.TranscodeReasons && session.TranscodingInfo.TranscodeReasons.length) {
|
||||
|
||||
sessionStats.push({
|
||||
label: globalize.translate('LabelReasonForTranscoding'),
|
||||
value: session.TranscodingInfo.TranscodeReasons.map(translateReason).join('<br/>')
|
||||
|
@ -193,7 +180,6 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
function getDisplayBitrate(bitrate) {
|
||||
|
||||
if (bitrate > 1000000) {
|
||||
return (bitrate / 1000000).toFixed(1) + ' Mbps';
|
||||
} else {
|
||||
|
@ -212,7 +198,6 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
function getMediaSourceStats(session, player, displayPlayMethod) {
|
||||
|
||||
const sessionStats = [];
|
||||
|
||||
const mediaSource = playbackManager.currentMediaSource(player) || {};
|
||||
|
@ -234,7 +219,6 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
if (totalBitrate) {
|
||||
|
||||
sessionStats.push({
|
||||
label: globalize.translate('LabelBitrate'),
|
||||
value: getDisplayBitrate(totalBitrate)
|
||||
|
@ -243,18 +227,14 @@ import 'css!./playerstats';
|
|||
|
||||
const mediaStreams = mediaSource.MediaStreams || [];
|
||||
const videoStream = mediaStreams.filter(function (s) {
|
||||
|
||||
return s.Type === 'Video';
|
||||
|
||||
})[0] || {};
|
||||
|
||||
const videoCodec = videoStream.Codec;
|
||||
|
||||
const audioStreamIndex = playbackManager.getAudioStreamIndex(player);
|
||||
const audioStream = playbackManager.audioTracks(player).filter(function (s) {
|
||||
|
||||
return s.Type === 'Audio' && s.Index === audioStreamIndex;
|
||||
|
||||
})[0] || {};
|
||||
|
||||
const audioCodec = audioStream.Codec;
|
||||
|
@ -355,12 +335,10 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
function getStats(instance, player) {
|
||||
|
||||
const statsPromise = player.getStats ? player.getStats() : Promise.resolve({});
|
||||
const sessionPromise = getSession(instance, player);
|
||||
|
||||
return Promise.all([statsPromise, sessionPromise]).then(function (responses) {
|
||||
|
||||
const playerStatsResult = responses[0];
|
||||
const playerStats = playerStatsResult.categories || [];
|
||||
const session = responses[1];
|
||||
|
@ -387,7 +365,6 @@ import 'css!./playerstats';
|
|||
categories.push(baseCategory);
|
||||
|
||||
for (let i = 0, length = playerStats.length; i < length; i++) {
|
||||
|
||||
const category = playerStats[i];
|
||||
if (category.type === 'audio') {
|
||||
category.name = 'Audio Info';
|
||||
|
@ -398,7 +375,6 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
if (session.TranscodingInfo) {
|
||||
|
||||
categories.push({
|
||||
stats: getTranscodingStats(session, player, displayPlayMethod),
|
||||
name: displayPlayMethod === 'Transcode' ? 'Transcoding Info' : 'Direct Stream Info'
|
||||
|
@ -423,7 +399,6 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
function renderPlayerStats(instance, player) {
|
||||
|
||||
const now = new Date().getTime();
|
||||
|
||||
if ((now - (instance.lastRender || 0)) < 700) {
|
||||
|
@ -433,7 +408,6 @@ import 'css!./playerstats';
|
|||
instance.lastRender = now;
|
||||
|
||||
getStats(instance, player).then(function (stats) {
|
||||
|
||||
const elem = instance.element;
|
||||
if (!elem) {
|
||||
return;
|
||||
|
@ -444,7 +418,6 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
function bindEvents(instance, player) {
|
||||
|
||||
const localOnTimeUpdate = function () {
|
||||
renderPlayerStats(instance, player);
|
||||
};
|
||||
|
@ -454,7 +427,6 @@ import 'css!./playerstats';
|
|||
}
|
||||
|
||||
function unbindEvents(instance, player) {
|
||||
|
||||
const localOnTimeUpdate = instance.onTimeUpdate;
|
||||
|
||||
if (localOnTimeUpdate) {
|
||||
|
@ -464,7 +436,6 @@ import 'css!./playerstats';
|
|||
|
||||
class PlayerStats {
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
|
||||
init(this);
|
||||
|
@ -473,7 +444,6 @@ class PlayerStats {
|
|||
}
|
||||
|
||||
enabled(enabled) {
|
||||
|
||||
if (enabled == null) {
|
||||
return this._enabled;
|
||||
}
|
||||
|
@ -499,11 +469,9 @@ class PlayerStats {
|
|||
}
|
||||
|
||||
destroy() {
|
||||
|
||||
const options = this.options;
|
||||
|
||||
if (options) {
|
||||
|
||||
this.options = null;
|
||||
unbindEvents(this, options.player);
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@ import playbackManager from 'playbackManager';
|
|||
import globalize from 'globalize';
|
||||
|
||||
export function show(options) {
|
||||
|
||||
var item = options.item;
|
||||
|
||||
var resumePositionTicks = item.UserData ? item.UserData.PlaybackPositionTicks : null;
|
||||
|
@ -38,7 +37,6 @@ export function show(options) {
|
|||
|
||||
}).then(function (id) {
|
||||
switch (id) {
|
||||
|
||||
case 'play':
|
||||
playbackManager.play({
|
||||
ids: [playableItemId],
|
||||
|
|
|
@ -13,7 +13,6 @@ define(['events', 'globalize'], function (events, globalize) {
|
|||
}
|
||||
|
||||
function definePluginRoute(pluginManager, route, plugin) {
|
||||
|
||||
route.contentPath = pluginManager.mapPath(plugin, route.path);
|
||||
route.path = pluginManager.mapRoute(plugin, route);
|
||||
|
||||
|
@ -21,12 +20,10 @@ define(['events', 'globalize'], function (events, globalize) {
|
|||
}
|
||||
|
||||
function PluginManager() {
|
||||
|
||||
this.pluginsList = [];
|
||||
}
|
||||
|
||||
PluginManager.prototype.loadPlugin = function(pluginSpec) {
|
||||
|
||||
var instance = this;
|
||||
|
||||
function registerPlugin(plugin) {
|
||||
|
@ -39,7 +36,6 @@ define(['events', 'globalize'], function (events, globalize) {
|
|||
}
|
||||
|
||||
if (plugin.type === 'skin') {
|
||||
|
||||
// translations won't be loaded for skins until needed
|
||||
return Promise.resolve(plugin);
|
||||
} else {
|
||||
|
@ -104,13 +100,11 @@ define(['events', 'globalize'], function (events, globalize) {
|
|||
// name
|
||||
// type (skin, screensaver, etc)
|
||||
PluginManager.prototype.register = function (obj) {
|
||||
|
||||
this.pluginsList.push(obj);
|
||||
events.trigger(this, 'registered', [obj]);
|
||||
};
|
||||
|
||||
PluginManager.prototype.ofType = function (type) {
|
||||
|
||||
return this.pluginsList.filter(function (o) {
|
||||
return o.type === type;
|
||||
});
|
||||
|
@ -121,7 +115,6 @@ define(['events', 'globalize'], function (events, globalize) {
|
|||
};
|
||||
|
||||
PluginManager.prototype.mapRoute = function (plugin, route) {
|
||||
|
||||
if (typeof plugin === 'string') {
|
||||
plugin = this.pluginsList.filter(function (p) {
|
||||
return (p.id || p.packageName) === plugin;
|
||||
|
@ -138,7 +131,6 @@ define(['events', 'globalize'], function (events, globalize) {
|
|||
};
|
||||
|
||||
PluginManager.prototype.mapPath = function (plugin, path, addCacheParam) {
|
||||
|
||||
if (typeof plugin === 'string') {
|
||||
plugin = this.pluginsList.filter(function (p) {
|
||||
return (p.id || p.packageName) === plugin;
|
||||
|
|
|
@ -12,7 +12,6 @@ import 'formDialogStyle';
|
|||
|
||||
/* eslint-disable indent */
|
||||
export default (() => {
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
@ -68,7 +67,6 @@ export default (() => {
|
|||
let submitValue;
|
||||
|
||||
dlg.querySelector('form').addEventListener('submit', e => {
|
||||
|
||||
submitValue = dlg.querySelector('#txtInput').value;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
|
|
@ -2,7 +2,6 @@ define(['globalize'], function (globalize) {
|
|||
'use strict';
|
||||
|
||||
function getVideoQualityOptions(options) {
|
||||
|
||||
var maxStreamingBitrate = options.currentMaxBitrate;
|
||||
var videoWidth = options.videoWidth;
|
||||
var videoHeight = options.videoHeight;
|
||||
|
@ -25,7 +24,6 @@ define(['globalize'], function (globalize) {
|
|||
|
||||
// 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 @@ define(['globalize'], function (globalize) {
|
|||
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 @@ define(['globalize'], function (globalize) {
|
|||
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) {
|
||||
|
@ -92,7 +87,6 @@ define(['globalize'], function (globalize) {
|
|||
}
|
||||
|
||||
if (selectedIndex === -1) {
|
||||
|
||||
selectedIndex = qualityOptions.length - 1;
|
||||
}
|
||||
|
||||
|
@ -109,7 +103,6 @@ define(['globalize'], function (globalize) {
|
|||
}
|
||||
|
||||
function getAudioQualityOptions(options) {
|
||||
|
||||
var maxStreamingBitrate = options.currentMaxBitrate;
|
||||
|
||||
var qualityOptions = [];
|
||||
|
@ -137,7 +130,6 @@ define(['globalize'], function (globalize) {
|
|||
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) {
|
||||
|
@ -146,7 +138,6 @@ define(['globalize'], function (globalize) {
|
|||
}
|
||||
|
||||
if (selectedIndex === -1) {
|
||||
|
||||
selectedIndex = qualityOptions.length - 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -2,11 +2,9 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
|||
'use strict';
|
||||
|
||||
function onRecordingButtonClick(e) {
|
||||
|
||||
var item = this.item;
|
||||
|
||||
if (item) {
|
||||
|
||||
var serverId = item.ServerId;
|
||||
var programId = item.Id;
|
||||
var timerId = item.TimerId;
|
||||
|
@ -50,23 +48,19 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
|||
}
|
||||
|
||||
function getIndicatorIcon(item) {
|
||||
|
||||
var status;
|
||||
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return 'fiber_smart_record';
|
||||
} else if (item.TimerId || item.SeriesTimerId) {
|
||||
|
||||
status = item.Status || 'Cancelled';
|
||||
} else if (item.Type === 'Timer') {
|
||||
|
||||
status = item.Status;
|
||||
} else {
|
||||
return 'fiber_manual_record';
|
||||
}
|
||||
|
||||
if (item.SeriesTimerId) {
|
||||
|
||||
if (status !== 'Cancelled') {
|
||||
return 'fiber_smart_record';
|
||||
}
|
||||
|
@ -76,7 +70,6 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
|||
}
|
||||
|
||||
RecordingButton.prototype.refresh = function (serverId, itemId) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
var self = this;
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||
|
@ -85,7 +78,6 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
|||
};
|
||||
|
||||
RecordingButton.prototype.refreshItem = function (item) {
|
||||
|
||||
var options = this.options;
|
||||
var button = options.button;
|
||||
this.item = item;
|
||||
|
@ -99,7 +91,6 @@ define(['globalize', 'connectionManager', 'require', 'loading', 'apphost', 'dom'
|
|||
};
|
||||
|
||||
RecordingButton.prototype.destroy = function () {
|
||||
|
||||
var options = this.options;
|
||||
|
||||
if (options) {
|
||||
|
|
|
@ -6,27 +6,22 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
var currentRecordingFields;
|
||||
|
||||
function closeDialog() {
|
||||
|
||||
dialogHelper.close(currentDialog);
|
||||
}
|
||||
|
||||
function init(context) {
|
||||
|
||||
context.querySelector('.btnPlay').addEventListener('click', function () {
|
||||
|
||||
closeAction = 'play';
|
||||
closeDialog();
|
||||
});
|
||||
|
||||
context.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
closeAction = null;
|
||||
closeDialog();
|
||||
});
|
||||
}
|
||||
|
||||
function getImageUrl(item, apiClient, imageHeight) {
|
||||
|
||||
var imageTags = item.ImageTags || {};
|
||||
|
||||
if (item.PrimaryImageTag) {
|
||||
|
@ -34,14 +29,12 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
if (imageTags.Primary) {
|
||||
|
||||
return apiClient.getScaledImageUrl(item.Id, {
|
||||
type: 'Primary',
|
||||
maxHeight: imageHeight,
|
||||
tag: item.ImageTags.Primary
|
||||
});
|
||||
} else if (imageTags.Thumb) {
|
||||
|
||||
return apiClient.getScaledImageUrl(item.Id, {
|
||||
type: 'Thumb',
|
||||
maxHeight: imageHeight,
|
||||
|
@ -53,7 +46,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function renderRecording(context, defaultTimer, program, apiClient, refreshRecordingStateOnly) {
|
||||
|
||||
if (!refreshRecordingStateOnly) {
|
||||
var imgUrl = getImageUrl(program, apiClient, 200);
|
||||
var imageContainer = context.querySelector('.recordingDialog-imageContainer');
|
||||
|
@ -91,7 +83,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function reload(context, programId, serverId, refreshRecordingStateOnly) {
|
||||
|
||||
loading.show();
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
@ -100,7 +91,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
var promise2 = apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId());
|
||||
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
|
||||
var defaults = responses[0];
|
||||
var program = responses[1];
|
||||
|
||||
|
@ -109,15 +99,11 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function executeCloseAction(action, programId, serverId) {
|
||||
|
||||
if (action === 'play') {
|
||||
|
||||
require(['playbackManager'], function (playbackManager) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
apiClient.getLiveTvProgram(programId, apiClient.getCurrentUserId()).then(function (item) {
|
||||
|
||||
playbackManager.play({
|
||||
ids: [item.ChannelId],
|
||||
serverId: serverId
|
||||
|
@ -129,15 +115,12 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function showEditor(itemId, serverId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
closeAction = null;
|
||||
|
||||
loading.show();
|
||||
|
||||
require(['text!./recordingcreator.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -167,7 +150,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
events.off(currentRecordingFields, 'recordingchanged', onRecordingChanged);
|
||||
executeCloseAction(closeAction, itemId, serverId);
|
||||
|
||||
|
|
|
@ -8,11 +8,8 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
var currentResolve;
|
||||
|
||||
function deleteTimer(apiClient, timerId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['recordingHelper'], function (recordingHelper) {
|
||||
|
||||
recordingHelper.cancelTimerWithConfirmation(timerId, apiClient.serverId()).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
|
@ -26,14 +23,12 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function closeDialog(isDeleted) {
|
||||
|
||||
recordingDeleted = isDeleted;
|
||||
|
||||
dialogHelper.close(currentDialog);
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
var form = this;
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
|
@ -51,14 +46,11 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function init(context) {
|
||||
|
||||
context.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
closeDialog(false);
|
||||
});
|
||||
|
||||
context.querySelector('.btnCancelRecording').addEventListener('click', function () {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
deleteTimer(apiClient, currentItemId).then(function () {
|
||||
closeDialog(true);
|
||||
|
@ -69,22 +61,18 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function reload(context, id) {
|
||||
|
||||
loading.show();
|
||||
currentItemId = id;
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
apiClient.getLiveTvTimer(id).then(function (result) {
|
||||
|
||||
renderTimer(context, result, apiClient);
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function showEditor(itemId, serverId, options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
recordingDeleted = false;
|
||||
currentServerId = serverId;
|
||||
loading.show();
|
||||
|
@ -124,14 +112,12 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
currentDialog = dlg;
|
||||
|
||||
dlg.addEventListener('closing', function () {
|
||||
|
||||
if (!recordingDeleted) {
|
||||
dlg.querySelector('.btnSubmit').click();
|
||||
}
|
||||
});
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (recordingDeleted) {
|
||||
resolve({
|
||||
updated: true,
|
||||
|
|
|
@ -34,7 +34,6 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
}
|
||||
|
||||
function fetchData(instance) {
|
||||
|
||||
var options = instance.options;
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
|
||||
|
@ -121,7 +120,6 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
}
|
||||
|
||||
function onManageSeriesRecordingClick(e) {
|
||||
|
||||
var options = this.options;
|
||||
|
||||
if (!this.SeriesTimerId) {
|
||||
|
@ -131,7 +129,6 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
var self = this;
|
||||
|
||||
require(['seriesRecordingEditor'], function (seriesRecordingEditor) {
|
||||
|
||||
seriesRecordingEditor.show(self.SeriesTimerId, options.serverId, {
|
||||
|
||||
enableCancel: false
|
||||
|
@ -143,7 +140,6 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
}
|
||||
|
||||
function onRecordChange(e) {
|
||||
|
||||
this.changed = true;
|
||||
|
||||
var self = this;
|
||||
|
@ -183,7 +179,6 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
|||
}
|
||||
|
||||
function onRecordSeriesChange(e) {
|
||||
|
||||
this.changed = true;
|
||||
|
||||
var self = this;
|
||||
|
|
|
@ -2,17 +2,13 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
'use strict';
|
||||
|
||||
function changeRecordingToSeries(apiClient, timerId, programId, confirmTimerCancellation) {
|
||||
|
||||
loading.show();
|
||||
|
||||
return apiClient.getItem(apiClient.getCurrentUserId(), programId).then(function (item) {
|
||||
|
||||
if (item.IsSeries) {
|
||||
// create series
|
||||
return apiClient.getNewLiveTvTimerDefaults({ programId: programId }).then(function (timerDefaults) {
|
||||
|
||||
return apiClient.createLiveTvSeriesTimer(timerDefaults).then(function () {
|
||||
|
||||
loading.hide();
|
||||
sendToast(globalize.translate('SeriesRecordingScheduled'));
|
||||
});
|
||||
|
@ -29,11 +25,8 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
}
|
||||
|
||||
function cancelTimerWithConfirmation(timerId, serverId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm.default({
|
||||
|
||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||
|
@ -42,23 +35,18 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
cancelText: globalize.translate('HeaderKeepRecording')
|
||||
|
||||
}).then(function () {
|
||||
|
||||
loading.show();
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
cancelTimer(apiClient, timerId, true).then(resolve, reject);
|
||||
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function cancelSeriesTimerWithConfirmation(timerId, serverId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm.default({
|
||||
|
||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||
|
@ -67,12 +55,10 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
cancelText: globalize.translate('HeaderKeepSeries')
|
||||
|
||||
}).then(function () {
|
||||
|
||||
loading.show();
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
apiClient.cancelLiveTvSeriesTimer(timerId).then(function () {
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
toast(globalize.translate('SeriesCancelled'));
|
||||
});
|
||||
|
@ -80,7 +66,6 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
loading.hide();
|
||||
resolve();
|
||||
}, reject);
|
||||
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
|
@ -89,7 +74,6 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
function cancelTimer(apiClient, timerId, hideLoading) {
|
||||
loading.show();
|
||||
return apiClient.cancelLiveTvTimer(timerId).then(function () {
|
||||
|
||||
if (hideLoading !== false) {
|
||||
loading.hide();
|
||||
sendToast(globalize.translate('RecordingCancelled'));
|
||||
|
@ -98,16 +82,13 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
}
|
||||
|
||||
function createRecording(apiClient, programId, isSeries) {
|
||||
|
||||
loading.show();
|
||||
return apiClient.getNewLiveTvTimerDefaults({ programId: programId }).then(function (item) {
|
||||
|
||||
var promise = isSeries ?
|
||||
apiClient.createLiveTvSeriesTimer(item) :
|
||||
apiClient.createLiveTvTimer(item);
|
||||
|
||||
return promise.then(function () {
|
||||
|
||||
loading.hide();
|
||||
sendToast(globalize.translate('RecordingScheduled'));
|
||||
});
|
||||
|
@ -122,9 +103,7 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
|
||||
function showMultiCancellationPrompt(serverId, programId, timerId, timerStatus, seriesTimerId) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['dialog'], function (dialog) {
|
||||
|
||||
var items = [];
|
||||
|
||||
items.push({
|
||||
|
@ -159,7 +138,6 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
buttons: items
|
||||
|
||||
}).then(function (result) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (result === 'canceltimer') {
|
||||
|
@ -167,11 +145,9 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
|
||||
cancelTimer(apiClient, timerId, true).then(resolve, reject);
|
||||
} else if (result === 'cancelseriestimer') {
|
||||
|
||||
loading.show();
|
||||
|
||||
apiClient.cancelLiveTvSeriesTimer(seriesTimerId).then(function () {
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
toast(globalize.translate('SeriesCancelled'));
|
||||
});
|
||||
|
@ -182,7 +158,6 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
|||
} else {
|
||||
resolve();
|
||||
}
|
||||
|
||||
}, reject);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,18 +8,14 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
var currentServerId;
|
||||
|
||||
function deleteTimer(apiClient, timerId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['recordingHelper'], function (recordingHelper) {
|
||||
|
||||
recordingHelper.cancelSeriesTimerWithConfirmation(timerId, apiClient.serverId()).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function renderTimer(context, item, apiClient) {
|
||||
|
||||
context.querySelector('#txtPrePaddingMinutes').value = item.PrePaddingSeconds / 60;
|
||||
context.querySelector('#txtPostPaddingMinutes').value = item.PostPaddingSeconds / 60;
|
||||
|
||||
|
@ -42,7 +38,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function closeDialog(isDeleted) {
|
||||
|
||||
recordingUpdated = true;
|
||||
recordingDeleted = isDeleted;
|
||||
|
||||
|
@ -50,13 +45,11 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
var form = this;
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
|
||||
apiClient.getLiveTvSeriesTimer(currentItemId).then(function (item) {
|
||||
|
||||
item.PrePaddingSeconds = form.querySelector('#txtPrePaddingMinutes').value * 60;
|
||||
item.PostPaddingSeconds = form.querySelector('#txtPostPaddingMinutes').value * 60;
|
||||
item.RecordAnyChannel = form.querySelector('.selectChannels').value === 'all';
|
||||
|
@ -75,16 +68,13 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function init(context) {
|
||||
|
||||
fillKeepUpTo(context);
|
||||
|
||||
context.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
closeDialog(false);
|
||||
});
|
||||
|
||||
context.querySelector('.btnCancelRecording').addEventListener('click', function () {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
deleteTimer(apiClient, currentItemId).then(function () {
|
||||
closeDialog(true);
|
||||
|
@ -95,7 +85,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function reload(context, id) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
|
||||
loading.show();
|
||||
|
@ -103,12 +92,10 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
currentItemId = id;
|
||||
|
||||
apiClient.getLiveTvSeriesTimer(id).then(function (result) {
|
||||
|
||||
renderTimer(context, result, apiClient);
|
||||
loading.hide();
|
||||
});
|
||||
} else if (id) {
|
||||
|
||||
currentItemId = id.Id;
|
||||
|
||||
renderTimer(context, id, apiClient);
|
||||
|
@ -117,11 +104,9 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function fillKeepUpTo(context) {
|
||||
|
||||
var html = '';
|
||||
|
||||
for (var i = 0; i <= 50; i++) {
|
||||
|
||||
var text;
|
||||
|
||||
if (i === 0) {
|
||||
|
@ -143,7 +128,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function embed(itemId, serverId, options) {
|
||||
|
||||
recordingUpdated = false;
|
||||
recordingDeleted = false;
|
||||
currentServerId = serverId;
|
||||
|
@ -151,7 +135,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
options = options || {};
|
||||
|
||||
require(['text!./seriesrecordingeditor.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -186,9 +169,7 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
}
|
||||
|
||||
function showEditor(itemId, serverId, options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
recordingUpdated = false;
|
||||
recordingDeleted = false;
|
||||
currentServerId = serverId;
|
||||
|
@ -196,7 +177,6 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
options = options || {};
|
||||
|
||||
require(['text!./seriesrecordingeditor.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -230,14 +210,12 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
|||
currentDialog = dlg;
|
||||
|
||||
dlg.addEventListener('closing', function () {
|
||||
|
||||
if (!recordingDeleted) {
|
||||
this.querySelector('.btnSubmit').click();
|
||||
}
|
||||
});
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (recordingUpdated) {
|
||||
resolve({
|
||||
updated: true,
|
||||
|
|
|
@ -2,7 +2,6 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionM
|
|||
'use strict';
|
||||
|
||||
function getEditorHtml() {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="formDialogContent smoothScrollY" style="padding-top:2em;">';
|
||||
|
@ -48,7 +47,6 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionM
|
|||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
loading.show();
|
||||
|
||||
var instance = this;
|
||||
|
@ -90,7 +88,6 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionM
|
|||
}
|
||||
|
||||
RefreshDialog.prototype.show = function () {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -124,7 +121,6 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionM
|
|||
dlg.querySelector('form').addEventListener('submit', onSubmit.bind(this));
|
||||
|
||||
dlg.querySelector('#selectMetadataRefreshMode').addEventListener('change', function () {
|
||||
|
||||
if (this.value === 'scan') {
|
||||
dlg.querySelector('.fldReplaceExistingImages').classList.add('hide');
|
||||
} else {
|
||||
|
@ -139,7 +135,6 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionM
|
|||
dlg.querySelector('#selectMetadataRefreshMode').dispatchEvent(new CustomEvent('change'));
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
|
@ -148,7 +143,6 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'connectionM
|
|||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||
}
|
||||
|
|
|
@ -418,7 +418,6 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
|
|||
var nowPlayingVolumeSliderContainer = context.querySelector('.nowPlayingVolumeSliderContainer');
|
||||
|
||||
if (nowPlayingVolumeSlider) {
|
||||
|
||||
nowPlayingVolumeSliderContainer.classList.toggle('hide', !showVolumeSlider);
|
||||
|
||||
if (!nowPlayingVolumeSlider.dragging) {
|
||||
|
|
|
@ -18,7 +18,6 @@ define(function () {
|
|||
}
|
||||
|
||||
function removeFromLoadHistory(url) {
|
||||
|
||||
url = url.toLowerCase();
|
||||
|
||||
importedCss = importedCss.filter(function (c) {
|
||||
|
@ -27,7 +26,6 @@ define(function () {
|
|||
}
|
||||
|
||||
requireCss.load = function (cssId, req, load, config) {
|
||||
|
||||
// Somehow if the url starts with /css, require will get all screwed up since this extension is also called css
|
||||
var srch = 'components/require/requirecss';
|
||||
var index = cssId.indexOf(srch);
|
||||
|
@ -65,7 +63,6 @@ define(function () {
|
|||
|
||||
window.requireCss = {
|
||||
removeStylesheet: function (stylesheet) {
|
||||
|
||||
stylesheet.parentNode.removeChild(stylesheet);
|
||||
removeFromLoadHistory(stylesheet.href);
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ define(function () {
|
|||
return {
|
||||
|
||||
load: function (url, req, load, config) {
|
||||
|
||||
if (url.indexOf('://') === -1) {
|
||||
url = config.baseUrl + url;
|
||||
}
|
||||
|
|
|
@ -376,7 +376,6 @@ import layoutManager from 'layoutManager';
|
|||
* @param {number} scrollY - Vertical coordinate.
|
||||
*/
|
||||
function animateScroll(xScroller, scrollX, yScroller, scrollY) {
|
||||
|
||||
const ox = xScroller.scrollLeft;
|
||||
const oy = yScroller.scrollTop;
|
||||
const dx = scrollX - ox;
|
||||
|
@ -389,7 +388,6 @@ import layoutManager from 'layoutManager';
|
|||
let start;
|
||||
|
||||
function scrollAnim(currentTimestamp) {
|
||||
|
||||
start = start || currentTimestamp;
|
||||
|
||||
let k = Math.min(1, (currentTimestamp - start) / ScrollTime);
|
||||
|
@ -423,7 +421,6 @@ import layoutManager from 'layoutManager';
|
|||
* @param {boolean} smooth - Smooth scrolling.
|
||||
*/
|
||||
function doScroll(xScroller, scrollX, yScroller, scrollY, smooth) {
|
||||
|
||||
resetScrollTimer();
|
||||
|
||||
if (smooth && useAnimatedScroll()) {
|
||||
|
@ -437,7 +434,6 @@ import layoutManager from 'layoutManager';
|
|||
* Returns true if smooth scroll must be used.
|
||||
*/
|
||||
function useSmoothScroll() {
|
||||
|
||||
if (browser.tizen) {
|
||||
return true;
|
||||
}
|
||||
|
@ -469,7 +465,6 @@ import layoutManager from 'layoutManager';
|
|||
* @param {boolean} [smooth=false] - Smooth scrolling.
|
||||
*/
|
||||
export function scrollTo(scrollX, scrollY, smooth) {
|
||||
|
||||
smooth = !!smooth;
|
||||
|
||||
// Scroller is document itself by default
|
||||
|
@ -491,7 +486,6 @@ import layoutManager from 'layoutManager';
|
|||
* @param {boolean} [smooth=false] - Smooth scrolling.
|
||||
*/
|
||||
export function scrollToElement(element, smooth) {
|
||||
|
||||
smooth = !!smooth;
|
||||
|
||||
let scrollCenterX = true;
|
||||
|
|
|
@ -11,7 +11,6 @@ import 'css!./searchfields';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function onSearchTimeout() {
|
||||
|
||||
const instance = this;
|
||||
let value = instance.nextSearchValue;
|
||||
|
||||
|
@ -20,7 +19,6 @@ import 'css!./searchfields';
|
|||
}
|
||||
|
||||
function triggerSearch(instance, value) {
|
||||
|
||||
if (instance.searchTimeout) {
|
||||
clearTimeout(instance.searchTimeout);
|
||||
}
|
||||
|
@ -30,17 +28,14 @@ import 'css!./searchfields';
|
|||
}
|
||||
|
||||
function onAlphaValueClicked(e) {
|
||||
|
||||
const value = e.detail.value;
|
||||
const searchFieldsInstance = this;
|
||||
|
||||
const txtSearch = searchFieldsInstance.options.element.querySelector('.searchfields-txtSearch');
|
||||
|
||||
if (value === 'backspace') {
|
||||
|
||||
const val = txtSearch.value;
|
||||
txtSearch.value = val.length ? val.substring(0, val.length - 1) : '';
|
||||
|
||||
} else {
|
||||
txtSearch.value += value;
|
||||
}
|
||||
|
@ -51,7 +46,6 @@ import 'css!./searchfields';
|
|||
}
|
||||
|
||||
function initAlphaPicker(alphaPickerElement, instance) {
|
||||
|
||||
instance.alphaPicker = new AlphaPicker({
|
||||
element: alphaPickerElement,
|
||||
mode: 'keyboard'
|
||||
|
@ -61,16 +55,13 @@ import 'css!./searchfields';
|
|||
}
|
||||
|
||||
function onSearchInput(e) {
|
||||
|
||||
const value = e.target.value;
|
||||
const searchFieldsInstance = this;
|
||||
triggerSearch(searchFieldsInstance, value);
|
||||
}
|
||||
|
||||
function embed(elem, instance, options) {
|
||||
|
||||
import('text!./searchfields.template.html').then(({default: template}) => {
|
||||
|
||||
let html = globalize.translateHtml(template, 'core');
|
||||
|
||||
if (browser.tizen || browser.orsay) {
|
||||
|
@ -98,16 +89,13 @@ import 'css!./searchfields';
|
|||
|
||||
class SearchFields {
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
embed(options.element, this, options);
|
||||
}
|
||||
focus() {
|
||||
|
||||
this.options.element.querySelector('.searchfields-txtSearch').focus();
|
||||
}
|
||||
destroy() {
|
||||
|
||||
const options = this.options;
|
||||
if (options) {
|
||||
options.element.classList.remove('searchFields');
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'emby-button';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function loadSuggestions(instance, context, apiClient) {
|
||||
|
||||
const options = {
|
||||
|
||||
SortBy: 'IsFavoriteOrLiked,Random',
|
||||
|
@ -24,20 +23,17 @@ import 'emby-button';
|
|||
};
|
||||
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
||||
|
||||
if (instance.mode !== 'suggestions') {
|
||||
result.Items = [];
|
||||
}
|
||||
|
||||
const html = result.Items.map(function (i) {
|
||||
|
||||
const href = appRouter.getRouteUrl(i);
|
||||
|
||||
let itemHtml = '<div><a is="emby-linkbutton" class="button-link" style="display:inline-block;padding:.5em 1em;" href="' + href + '">';
|
||||
itemHtml += i.Name;
|
||||
itemHtml += '</a></div>';
|
||||
return itemHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
const searchSuggestions = context.querySelector('.searchSuggestions');
|
||||
|
@ -50,7 +46,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function getSearchHints(instance, apiClient, query) {
|
||||
|
||||
if (!query.searchTerm) {
|
||||
return Promise.resolve({
|
||||
SearchHints: []
|
||||
|
@ -129,7 +124,6 @@ import 'emby-button';
|
|||
|
||||
// Convert the search hint query to a regular item query
|
||||
if (apiClient.isMinServerVersion('3.4.1.31')) {
|
||||
|
||||
query.Fields = 'PrimaryImageAspectRatio,CanDelete,BasicSyncInfo,MediaSourceCount';
|
||||
query.Recursive = true;
|
||||
query.EnableTotalRecordCount = false;
|
||||
|
@ -140,7 +134,6 @@ import 'emby-button';
|
|||
if (!query.IncludeMedia) {
|
||||
if (query.IncludePeople) {
|
||||
methodName = 'getPeople';
|
||||
|
||||
} else if (query.IncludeArtists) {
|
||||
methodName = 'getArtists';
|
||||
}
|
||||
|
@ -155,7 +148,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function search(instance, apiClient, context, value) {
|
||||
|
||||
if (value || layoutManager.tv) {
|
||||
instance.mode = 'search';
|
||||
context.querySelector('.searchSuggestions').classList.add('hide');
|
||||
|
@ -165,7 +157,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
if (instance.options.collectionType === 'livetv') {
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
|
@ -194,7 +185,6 @@ import 'emby-button';
|
|||
showChannelName: true
|
||||
});
|
||||
} else {
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
|
@ -231,7 +221,6 @@ import 'emby-button';
|
|||
});
|
||||
|
||||
if (instance.options.collectionType === 'livetv') {
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
|
@ -260,9 +249,7 @@ import 'emby-button';
|
|||
showAirDateTime: true,
|
||||
showChannelName: true
|
||||
});
|
||||
|
||||
} else {
|
||||
|
||||
searchType(instance, apiClient, {
|
||||
searchTerm: value,
|
||||
IncludePeople: false,
|
||||
|
@ -560,18 +547,15 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function searchType(instance, apiClient, query, context, section, cardOptions) {
|
||||
|
||||
query.Limit = enableScrollX() ? 24 : 16;
|
||||
query.ParentId = instance.options.parentId;
|
||||
|
||||
getSearchHints(instance, apiClient, query).then(function (result) {
|
||||
|
||||
populateResults(result, context, section, cardOptions);
|
||||
});
|
||||
}
|
||||
|
||||
function populateResults(result, context, section, cardOptions) {
|
||||
|
||||
section = context.querySelector(section);
|
||||
|
||||
const items = result.Items || result.SearchHints;
|
||||
|
@ -601,9 +585,7 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function embed(elem, instance, options) {
|
||||
|
||||
import('text!./searchresults.template.html').then(({default: template}) => {
|
||||
|
||||
if (!enableScrollX()) {
|
||||
template = replaceAll(template, 'data-horizontal="true"', 'data-horizontal="false"');
|
||||
template = replaceAll(template, 'itemsContainer scrollSlider', 'itemsContainer scrollSlider vertical-wrap');
|
||||
|
@ -620,24 +602,20 @@ import 'emby-button';
|
|||
|
||||
class SearchResults {
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
embed(options.element, this, options);
|
||||
}
|
||||
search(value) {
|
||||
|
||||
const apiClient = connectionManager.getApiClient(this.options.serverId);
|
||||
|
||||
search(this, apiClient, this.options.element, value);
|
||||
}
|
||||
destroy() {
|
||||
|
||||
const options = this.options;
|
||||
if (options) {
|
||||
options.element.classList.remove('searchFields');
|
||||
}
|
||||
this.options = null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@ import dom from 'dom';
|
|||
import recordingHelper from 'recordingHelper';
|
||||
|
||||
function playAllFromHere(card, serverId, queue) {
|
||||
|
||||
const parent = card.parentNode;
|
||||
const className = card.classList.length ? (`.${card.classList[0]}`) : '';
|
||||
const cards = parent.querySelectorAll(`${className}[data-id]`);
|
||||
|
@ -36,17 +35,14 @@ import recordingHelper from 'recordingHelper';
|
|||
|
||||
const itemsContainer = dom.parentWithClass(card, 'itemsContainer');
|
||||
if (itemsContainer && itemsContainer.fetchData) {
|
||||
|
||||
const queryOptions = queue ? { StartIndex: startIndex } : {};
|
||||
|
||||
return itemsContainer.fetchData(queryOptions).then(result => {
|
||||
|
||||
if (queue) {
|
||||
return playbackManager.queue({
|
||||
items: result.Items
|
||||
});
|
||||
} else {
|
||||
|
||||
return playbackManager.play({
|
||||
items: result.Items,
|
||||
startIndex: startIndex
|
||||
|
@ -65,7 +61,6 @@ import recordingHelper from 'recordingHelper';
|
|||
serverId: serverId
|
||||
});
|
||||
} else {
|
||||
|
||||
return playbackManager.play({
|
||||
ids: ids,
|
||||
serverId: serverId,
|
||||
|
@ -75,15 +70,12 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function showProgramDialog(item) {
|
||||
|
||||
import('recordingCreator').then(({default:recordingCreator}) => {
|
||||
|
||||
recordingCreator.show(item.Id, item.ServerId);
|
||||
});
|
||||
}
|
||||
|
||||
function getItem(button) {
|
||||
|
||||
button = dom.parentWithAttribute(button, 'data-id');
|
||||
const serverId = button.getAttribute('data-serverid');
|
||||
const id = button.getAttribute('data-id');
|
||||
|
@ -101,7 +93,6 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function notifyRefreshNeeded(childElement, itemsContainer) {
|
||||
|
||||
itemsContainer = itemsContainer || dom.parentWithAttribute(childElement, 'is', 'emby-itemscontainer');
|
||||
|
||||
if (itemsContainer) {
|
||||
|
@ -110,9 +101,7 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function showContextMenu(card, options) {
|
||||
|
||||
getItem(card).then(item => {
|
||||
|
||||
const playlistId = card.getAttribute('data-playlistid');
|
||||
const collectionId = card.getAttribute('data-collectionid');
|
||||
|
||||
|
@ -122,7 +111,6 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
import('itemContextMenu').then(({default: itemContextMenu}) => {
|
||||
|
||||
connectionManager.getApiClient(item.ServerId).getCurrentUser().then(user => {
|
||||
itemContextMenu.show(Object.assign({
|
||||
item: item,
|
||||
|
@ -135,7 +123,6 @@ import recordingHelper from 'recordingHelper';
|
|||
user: user
|
||||
|
||||
}, options || {})).then(result => {
|
||||
|
||||
if (result.command === 'playallfromhere' || result.command === 'queueallfromhere') {
|
||||
executeAction(card, options.positionTo, result.command);
|
||||
} else if (result.updated || result.deleted) {
|
||||
|
@ -148,7 +135,6 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function getItemInfoFromCard(card) {
|
||||
|
||||
return {
|
||||
Type: card.getAttribute('data-type'),
|
||||
Id: card.getAttribute('data-id'),
|
||||
|
@ -166,11 +152,9 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function showPlayMenu(card, target) {
|
||||
|
||||
const item = getItemInfoFromCard(card);
|
||||
|
||||
import('playMenu').then(({default: playMenu}) => {
|
||||
|
||||
playMenu.show({
|
||||
|
||||
item: item,
|
||||
|
@ -186,7 +170,6 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function executeAction(card, target, action) {
|
||||
|
||||
target = target || card;
|
||||
|
||||
let id = card.getAttribute('data-id');
|
||||
|
@ -208,13 +191,11 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
if (action === 'link') {
|
||||
|
||||
appRouter.showItem(item, {
|
||||
context: card.getAttribute('data-context'),
|
||||
parentId: card.getAttribute('data-parentid')
|
||||
});
|
||||
} else if (action === 'programdialog') {
|
||||
|
||||
showProgramDialog(item);
|
||||
} else if (action === 'instantmix') {
|
||||
playbackManager.instantMix({
|
||||
|
@ -222,7 +203,6 @@ import recordingHelper from 'recordingHelper';
|
|||
ServerId: serverId
|
||||
});
|
||||
} else if (action === 'play' || action === 'resume') {
|
||||
|
||||
const startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0');
|
||||
|
||||
playbackManager.play({
|
||||
|
@ -231,7 +211,6 @@ import recordingHelper from 'recordingHelper';
|
|||
serverId: serverId
|
||||
});
|
||||
} else if (action === 'queue') {
|
||||
|
||||
if (playbackManager.isPlaying()) {
|
||||
playbackManager.queue({
|
||||
ids: [playableItemId],
|
||||
|
@ -253,7 +232,6 @@ import recordingHelper from 'recordingHelper';
|
|||
} else if (action === 'record') {
|
||||
onRecordCommand(serverId, id, type, card.getAttribute('data-timerid'), card.getAttribute('data-seriestimerid'));
|
||||
} else if (action === 'menu') {
|
||||
|
||||
const options = target.getAttribute('data-playoptions') === 'false' ?
|
||||
{
|
||||
shuffle: false,
|
||||
|
@ -279,7 +257,6 @@ import recordingHelper from 'recordingHelper';
|
|||
} else if (action === 'addtoplaylist') {
|
||||
getItem(target).then(addToPlaylist);
|
||||
} else if (action === 'custom') {
|
||||
|
||||
const customAction = target.getAttribute('data-customaction');
|
||||
|
||||
card.dispatchEvent(new CustomEvent(`action-${customAction}`, {
|
||||
|
@ -294,7 +271,6 @@ import recordingHelper from 'recordingHelper';
|
|||
|
||||
function addToPlaylist(item) {
|
||||
import('playlistEditor').then(({default: playlistEditor}) => {
|
||||
|
||||
new playlistEditor().show({
|
||||
items: [item.Id],
|
||||
serverId: item.ServerId
|
||||
|
@ -304,7 +280,6 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function playTrailer(item) {
|
||||
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(trailers => {
|
||||
|
@ -313,28 +288,23 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function editItem(item, serverId) {
|
||||
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const serverId = apiClient.serverInfo().Id;
|
||||
|
||||
if (item.Type === 'Timer') {
|
||||
if (item.ProgramId) {
|
||||
import('recordingCreator').then(({default: recordingCreator}) => {
|
||||
|
||||
recordingCreator.show(item.ProgramId, serverId).then(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
import('recordingEditor').then(({default: recordingEditor}) => {
|
||||
|
||||
recordingEditor.show(item.Id, serverId).then(resolve, reject);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
import('metadataEditor').then(({default: metadataEditor}) => {
|
||||
|
||||
metadataEditor.show(item.Id, serverId).then(resolve, reject);
|
||||
});
|
||||
}
|
||||
|
@ -342,20 +312,16 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function onRecordCommand(serverId, id, type, timerId, seriesTimerId) {
|
||||
|
||||
if (type === 'Program' || timerId || seriesTimerId) {
|
||||
|
||||
const programId = type === 'Program' ? id : null;
|
||||
recordingHelper.toggleRecording(serverId, programId, timerId, seriesTimerId);
|
||||
}
|
||||
}
|
||||
|
||||
export function onClick(e) {
|
||||
|
||||
const card = dom.parentWithClass(e.target, 'itemAction');
|
||||
|
||||
if (card) {
|
||||
|
||||
let actionElement = card;
|
||||
let action = actionElement.getAttribute('data-action');
|
||||
|
||||
|
@ -377,11 +343,9 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
function onCommand(e) {
|
||||
|
||||
const cmd = e.detail.command;
|
||||
|
||||
if (cmd === 'play' || cmd === 'resume' || cmd === 'record' || cmd === 'menu' || cmd === 'info') {
|
||||
|
||||
const target = e.target;
|
||||
const card = dom.parentWithClass(target, 'itemAction') || dom.parentWithAttribute(target, 'data-id');
|
||||
|
||||
|
@ -394,7 +358,6 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
export function on(context, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
if (options.click !== false) {
|
||||
|
@ -417,7 +380,6 @@ import recordingHelper from 'recordingHelper';
|
|||
}
|
||||
|
||||
export function getShortcutAttributesHtml(item, serverId) {
|
||||
|
||||
let html = `data-id="${item.Id}" data-serverid="${serverId || item.ServerId}" data-type="${item.Type}" data-mediatype="${item.MediaType}" data-channelid="${item.ChannelId}" data-isfolder="${item.IsFolder}"`;
|
||||
|
||||
const collectionType = item.CollectionType;
|
||||
|
|
|
@ -38,7 +38,6 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
|
|||
|
||||
if (options.type === 'Primary') {
|
||||
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||
|
||||
options.tag = item.AlbumPrimaryImageTag;
|
||||
return apiClient.getScaledImageUrl(item.AlbumId, options);
|
||||
}
|
||||
|
@ -64,7 +63,6 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
|
|||
}
|
||||
|
||||
if (item.BackdropImageTags && item.BackdropImageTags.length) {
|
||||
|
||||
options.tag = item.BackdropImageTags[0];
|
||||
return apiClient.getScaledImageUrl(item.Id, options);
|
||||
}
|
||||
|
@ -184,7 +182,6 @@ define(['dialogHelper', 'inputManager', 'connectionManager', 'layoutManager', 'f
|
|||
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
} else {
|
||||
html += '<div class="slideshowImage"></div><h1 class="slideshowImageText"></h1>';
|
||||
}
|
||||
|
|
|
@ -2,13 +2,11 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
|||
'use strict';
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function initEditor(context, settings) {
|
||||
|
||||
context.querySelector('form').addEventListener('submit', onSubmit);
|
||||
|
||||
context.querySelector('.selectSortOrder').value = settings.sortOrder;
|
||||
|
@ -26,14 +24,11 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
|||
var selectSortBy = context.querySelector('.selectSortBy');
|
||||
|
||||
selectSortBy.innerHTML = options.map(function (o) {
|
||||
|
||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
||||
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function saveValues(context, settings, settingsKey) {
|
||||
|
||||
userSettings.setFilter(settingsKey + '-sortorder', context.querySelector('.selectSortOrder').value);
|
||||
userSettings.setFilter(settingsKey + '-sortby', context.querySelector('.selectSortBy').value);
|
||||
}
|
||||
|
@ -43,11 +38,8 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
|||
}
|
||||
|
||||
SortMenu.prototype.show = function (options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['text!./sortmenu.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -79,7 +71,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
|||
initEditor(dlg, options.settings);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
|
@ -94,7 +85,6 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
|||
}, true);
|
||||
|
||||
dialogHelper.open(dlg).then(function () {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||
}
|
||||
|
|
|
@ -5,7 +5,6 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
var hasChanges;
|
||||
|
||||
function downloadRemoteSubtitles(context, id) {
|
||||
|
||||
var url = 'Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + id;
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentItem.ServerId);
|
||||
|
@ -15,7 +14,6 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
url: apiClient.getUrl(url)
|
||||
|
||||
}).then(function () {
|
||||
|
||||
hasChanges = true;
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
|
@ -27,11 +25,9 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
}
|
||||
|
||||
function deleteLocalSubtitle(context, index) {
|
||||
|
||||
var msg = globalize.translate('MessageAreYouSureDeleteSubtitles');
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm.default({
|
||||
|
||||
title: globalize.translate('ConfirmDeletion'),
|
||||
|
@ -40,7 +36,6 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
primary: 'delete'
|
||||
|
||||
}).then(function () {
|
||||
|
||||
loading.show();
|
||||
|
||||
var itemId = currentItem.Id;
|
||||
|
@ -54,34 +49,28 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
url: apiClient.getUrl(url)
|
||||
|
||||
}).then(function () {
|
||||
|
||||
hasChanges = true;
|
||||
reload(context, apiClient, itemId);
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function fillSubtitleList(context, item) {
|
||||
|
||||
var streams = item.MediaStreams || [];
|
||||
|
||||
var subs = streams.filter(function (s) {
|
||||
|
||||
return s.Type === 'Subtitle';
|
||||
});
|
||||
|
||||
var html = '';
|
||||
|
||||
if (subs.length) {
|
||||
|
||||
html += '<h2>' + globalize.translate('MySubtitles') + '</h2>';
|
||||
|
||||
html += '<div>';
|
||||
|
||||
html += subs.map(function (s) {
|
||||
|
||||
var itemHtml = '';
|
||||
|
||||
var tagName = layoutManager.tv ? 'button' : 'div';
|
||||
|
@ -119,7 +108,6 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
itemHtml += '</' + tagName + '>';
|
||||
|
||||
return itemHtml;
|
||||
|
||||
}).join('');
|
||||
|
||||
html += '</div>';
|
||||
|
@ -136,11 +124,9 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
}
|
||||
|
||||
function fillLanguages(context, apiClient, languages) {
|
||||
|
||||
var selectLanguage = context.querySelector('#selectLanguage');
|
||||
|
||||
selectLanguage.innerHTML = languages.map(function (l) {
|
||||
|
||||
return '<option value="' + l.ThreeLetterISOLanguageName + '">' + l.DisplayName + '</option>';
|
||||
});
|
||||
|
||||
|
@ -148,9 +134,7 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
if (lastLanguage) {
|
||||
selectLanguage.value = lastLanguage;
|
||||
} else {
|
||||
|
||||
apiClient.getCurrentUser().then(function (user) {
|
||||
|
||||
var lang = user.Configuration.SubtitleLanguagePreference;
|
||||
|
||||
if (lang) {
|
||||
|
@ -161,12 +145,10 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
}
|
||||
|
||||
function renderSearchResults(context, results) {
|
||||
|
||||
var lastProvider = '';
|
||||
var html = '';
|
||||
|
||||
if (!results.length) {
|
||||
|
||||
context.querySelector('.noSearchResults').classList.remove('hide');
|
||||
context.querySelector('.subtitleResults').innerHTML = '';
|
||||
loading.hide();
|
||||
|
@ -176,13 +158,11 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
context.querySelector('.noSearchResults').classList.add('hide');
|
||||
|
||||
for (var i = 0, length = results.length; i < length; i++) {
|
||||
|
||||
var result = results[i];
|
||||
|
||||
var provider = result.ProviderName;
|
||||
|
||||
if (provider !== lastProvider) {
|
||||
|
||||
if (i > 0) {
|
||||
html += '</div>';
|
||||
}
|
||||
|
@ -245,7 +225,6 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
}
|
||||
|
||||
function searchForSubtitles(context, language) {
|
||||
|
||||
userSettings.set('subtitleeditor-language', language);
|
||||
|
||||
loading.show();
|
||||
|
@ -254,17 +233,14 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
var url = apiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
|
||||
|
||||
apiClient.getJSON(url).then(function (results) {
|
||||
|
||||
renderSearchResults(context, results);
|
||||
});
|
||||
}
|
||||
|
||||
function reload(context, apiClient, itemId) {
|
||||
|
||||
context.querySelector('.noSearchResults').classList.add('hide');
|
||||
|
||||
function onGetItem(item) {
|
||||
|
||||
currentItem = item;
|
||||
|
||||
fillSubtitleList(context, item);
|
||||
|
@ -304,7 +280,6 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
}
|
||||
|
||||
function onSubtitleListClick(e) {
|
||||
|
||||
var btnDelete = dom.parentWithClass(e.target, 'btnDelete');
|
||||
if (btnDelete) {
|
||||
var index = btnDelete.getAttribute('data-index');
|
||||
|
@ -333,7 +308,6 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
}
|
||||
|
||||
function showDownloadOptions(button, context, subtitleId) {
|
||||
|
||||
var items = [];
|
||||
|
||||
items.push({
|
||||
|
@ -342,15 +316,12 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
});
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
|
||||
actionsheet.show({
|
||||
items: items,
|
||||
positionTo: button
|
||||
|
||||
}).then(function (id) {
|
||||
|
||||
switch (id) {
|
||||
|
||||
case 'download':
|
||||
downloadRemoteSubtitles(context, subtitleId);
|
||||
break;
|
||||
|
@ -358,7 +329,6 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
break;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -370,12 +340,10 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
}
|
||||
|
||||
function showEditorInternal(itemId, serverId, template) {
|
||||
|
||||
hasChanges = false;
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -413,19 +381,15 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
dlg.querySelector('.subtitleResults').addEventListener('click', onSubtitleResultsClick);
|
||||
|
||||
apiClient.getCultures().then(function (languages) {
|
||||
|
||||
fillLanguages(editorContent, apiClient, languages);
|
||||
});
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||
}
|
||||
|
@ -445,17 +409,13 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
|||
}
|
||||
|
||||
function showEditor(itemId, serverId) {
|
||||
|
||||
loading.show();
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['text!./subtitleeditor.template.html'], function (template) {
|
||||
|
||||
showEditorInternal(itemId, serverId, template).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
return {
|
||||
|
|
|
@ -4,12 +4,10 @@
|
|||
*/
|
||||
|
||||
function getTextStyles(settings, isCue) {
|
||||
|
||||
let list = [];
|
||||
|
||||
if (isCue) {
|
||||
switch (settings.textSize || '') {
|
||||
|
||||
case 'smaller':
|
||||
list.push({ name: 'font-size', value: '.5em' });
|
||||
break;
|
||||
|
@ -31,7 +29,6 @@ function getTextStyles(settings, isCue) {
|
|||
}
|
||||
} else {
|
||||
switch (settings.textSize || '') {
|
||||
|
||||
case 'smaller':
|
||||
list.push({ name: 'font-size', value: '.8em' });
|
||||
break;
|
||||
|
@ -55,7 +52,6 @@ function getTextStyles(settings, isCue) {
|
|||
}
|
||||
|
||||
switch (settings.dropShadow || '') {
|
||||
|
||||
case 'raised':
|
||||
list.push({ name: 'text-shadow', value: '-1px -1px white, 0px -1px white, -1px 0px white, 1px 1px black, 0px 1px black, 1px 0px black' });
|
||||
break;
|
||||
|
@ -85,7 +81,6 @@ function getTextStyles(settings, isCue) {
|
|||
}
|
||||
|
||||
switch (settings.font || '') {
|
||||
|
||||
case 'typewriter':
|
||||
list.push({ name: 'font-family', value: '"Courier New",monospace' });
|
||||
list.push({ name: 'font-variant', value: 'none' });
|
||||
|
@ -120,7 +115,6 @@ function getTextStyles(settings, isCue) {
|
|||
}
|
||||
|
||||
export function getStyles(settings, isCue) {
|
||||
|
||||
return {
|
||||
text: getTextStyles(settings, isCue),
|
||||
window: []
|
||||
|
@ -128,9 +122,7 @@ export function getStyles(settings, isCue) {
|
|||
}
|
||||
|
||||
function applyStyleList(styles, elem) {
|
||||
|
||||
for (let i = 0, length = styles.length; i < length; i++) {
|
||||
|
||||
let style = styles[i];
|
||||
|
||||
elem.style[style.name] = style.value;
|
||||
|
@ -138,7 +130,6 @@ function applyStyleList(styles, elem) {
|
|||
}
|
||||
|
||||
export function applyStyles(elements, appearanceSettings) {
|
||||
|
||||
let styles = getStyles(appearanceSettings);
|
||||
|
||||
if (elements.text) {
|
||||
|
|
|
@ -32,9 +32,7 @@ function getSubtitleAppearanceObject(context) {
|
|||
}
|
||||
|
||||
function loadForm(context, user, userSettings, appearanceSettings, apiClient) {
|
||||
|
||||
apiClient.getCultures().then(function (allCultures) {
|
||||
|
||||
if (appHost.supports('subtitleburnsettings') && user.Policy.EnableVideoPlaybackTranscoding) {
|
||||
context.querySelector('.fldBurnIn').classList.remove('hide');
|
||||
}
|
||||
|
@ -65,7 +63,6 @@ function loadForm(context, user, userSettings, appearanceSettings, apiClient) {
|
|||
}
|
||||
|
||||
function saveUser(context, user, userSettingsInstance, appearanceKey, apiClient) {
|
||||
|
||||
let appearanceSettings = userSettingsInstance.getSubtitleAppearanceSettings(appearanceKey);
|
||||
appearanceSettings = Object.assign(appearanceSettings, getSubtitleAppearanceObject(context));
|
||||
|
||||
|
@ -78,15 +75,12 @@ function saveUser(context, user, userSettingsInstance, appearanceKey, apiClient)
|
|||
}
|
||||
|
||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||
|
||||
loading.show();
|
||||
|
||||
appSettings.set('subtitleburnin', context.querySelector('#selectSubtitleBurnIn').value);
|
||||
|
||||
apiClient.getUser(userId).then(function (user) {
|
||||
|
||||
saveUser(context, user, userSettings, instance.appearanceKey, apiClient).then(function () {
|
||||
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
|
@ -95,7 +89,6 @@ function save(instance, context, userId, userSettings, apiClient, enableSaveConf
|
|||
}
|
||||
|
||||
events.trigger(instance, 'saved');
|
||||
|
||||
}, function () {
|
||||
loading.hide();
|
||||
});
|
||||
|
@ -103,7 +96,6 @@ function save(instance, context, userId, userSettings, apiClient, enableSaveConf
|
|||
}
|
||||
|
||||
function onSubtitleModeChange(e) {
|
||||
|
||||
let view = dom.parentWithClass(e.target, 'subtitlesettings');
|
||||
|
||||
let subtitlesHelp = view.querySelectorAll('.subtitlesHelp');
|
||||
|
@ -114,7 +106,6 @@ function onSubtitleModeChange(e) {
|
|||
}
|
||||
|
||||
function onAppearanceFieldChange(e) {
|
||||
|
||||
let view = dom.parentWithClass(e.target, 'subtitlesettings');
|
||||
|
||||
let appearanceSettings = getSubtitleAppearanceObject(view);
|
||||
|
@ -128,9 +119,7 @@ function onAppearanceFieldChange(e) {
|
|||
}
|
||||
|
||||
function embed(options, self) {
|
||||
|
||||
import('text!./subtitlesettings.template.html').then(({default: template}) => {
|
||||
|
||||
options.element.classList.add('subtitlesettings');
|
||||
options.element.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
|
@ -160,9 +149,7 @@ function embed(options, self) {
|
|||
}
|
||||
|
||||
export class SubtitleSettings {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
|
||||
embed(options, this);
|
||||
|
@ -204,7 +191,6 @@ export class SubtitleSettings {
|
|||
let userSettings = self.options.userSettings;
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
||||
|
||||
let enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||
});
|
||||
|
|
|
@ -8,7 +8,6 @@ define(['playbackManager', 'layoutManager', 'text!./subtitlesync.template.html',
|
|||
var subtitleSyncContainer;
|
||||
|
||||
function init(instance) {
|
||||
|
||||
var parent = document.createElement('div');
|
||||
document.body.appendChild(parent);
|
||||
parent.innerHTML = template;
|
||||
|
@ -141,7 +140,6 @@ define(['playbackManager', 'layoutManager', 'text!./subtitlesync.template.html',
|
|||
};
|
||||
|
||||
SubtitleSync.prototype.toggle = function(action) {
|
||||
|
||||
if (player && playbackManager.supportSubtitleOffset(player)) {
|
||||
/* eslint-disable no-fallthrough */
|
||||
switch (action) {
|
||||
|
|
|
@ -3,7 +3,6 @@
|
|||
* @returns {HTMLMediaElement} The audio element.
|
||||
*/
|
||||
function createTestMediaElement () {
|
||||
|
||||
const elem = document.createElement('audio');
|
||||
elem.classList.add('testMediaPlayerAudio');
|
||||
elem.classList.add('hide');
|
||||
|
|
|
@ -554,7 +554,6 @@ class SyncPlayManager {
|
|||
this.syncTimeout = setTimeout(() => {
|
||||
this.syncEnabled = true;
|
||||
}, SyncMethodThreshold / 2);
|
||||
|
||||
}, playTimeout);
|
||||
|
||||
console.debug('Scheduled play in', playTimeout / 1000.0, 'seconds.');
|
||||
|
|
|
@ -140,7 +140,6 @@ class TimeSyncManager {
|
|||
}).finally(() => {
|
||||
this.requestPing();
|
||||
});
|
||||
|
||||
}, this.pollingInterval);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,7 +2,6 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
|||
'use strict';
|
||||
|
||||
function onViewDestroy(e) {
|
||||
|
||||
var tabControllers = this.tabControllers;
|
||||
|
||||
if (tabControllers) {
|
||||
|
@ -26,7 +25,6 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
|||
}
|
||||
|
||||
function TabbedView(view, params) {
|
||||
|
||||
this.tabControllers = [];
|
||||
this.view = view;
|
||||
this.params = params;
|
||||
|
@ -37,15 +35,12 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
|||
this.initialTabIndex = currentTabIndex;
|
||||
|
||||
function validateTabLoad(index) {
|
||||
|
||||
return self.validateTabLoad ? self.validateTabLoad(index) : Promise.resolve();
|
||||
}
|
||||
|
||||
function loadTab(index, previousIndex) {
|
||||
|
||||
validateTabLoad(index).then(function () {
|
||||
self.getTabController(index).then(function (controller) {
|
||||
|
||||
var refresh = !controller.refreshed;
|
||||
|
||||
controller.onResume({
|
||||
|
@ -80,12 +75,10 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
|||
view.addEventListener('viewbeforehide', this.onPause.bind(this));
|
||||
|
||||
view.addEventListener('viewbeforeshow', function (e) {
|
||||
|
||||
mainTabsManager.setTabs(view, currentTabIndex, self.getTabs, getTabContainers, onBeforeTabChange, onTabChange, false);
|
||||
});
|
||||
|
||||
view.addEventListener('viewshow', function (e) {
|
||||
|
||||
self.onResume(e.detail);
|
||||
});
|
||||
|
||||
|
@ -93,7 +86,6 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
|||
}
|
||||
|
||||
TabbedView.prototype.onResume = function (options) {
|
||||
|
||||
this.setTitle();
|
||||
backdrop.clearBackdrop();
|
||||
|
||||
|
@ -107,7 +99,6 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
|||
};
|
||||
|
||||
TabbedView.prototype.onPause = function () {
|
||||
|
||||
var currentTabController = this.currentTabController;
|
||||
|
||||
if (currentTabController && currentTabController.onPause) {
|
||||
|
|
|
@ -5,13 +5,11 @@ define(['playbackManager', 'userSettings', 'connectionManager'], function (playb
|
|||
var currentThemeIds = [];
|
||||
|
||||
function playThemeMedia(items, ownerId) {
|
||||
|
||||
var currentThemeItems = items.filter(function (i) {
|
||||
return enabled(i.MediaType);
|
||||
});
|
||||
|
||||
if (currentThemeItems.length) {
|
||||
|
||||
// Stop if a theme song from another ownerId
|
||||
// Leave it alone if anything else (e.g user playing a movie)
|
||||
if (!currentOwnerId && playbackManager.isPlaying()) {
|
||||
|
@ -29,7 +27,6 @@ define(['playbackManager', 'userSettings', 'connectionManager'], function (playb
|
|||
}).then(function () {
|
||||
currentOwnerId = ownerId;
|
||||
});
|
||||
|
||||
} else {
|
||||
stopIfPlaying();
|
||||
}
|
||||
|
@ -44,7 +41,6 @@ define(['playbackManager', 'userSettings', 'connectionManager'], function (playb
|
|||
}
|
||||
|
||||
function enabled(mediaType) {
|
||||
|
||||
if (mediaType === 'Video') {
|
||||
return userSettings.enableThemeVideos();
|
||||
}
|
||||
|
@ -55,7 +51,6 @@ define(['playbackManager', 'userSettings', 'connectionManager'], function (playb
|
|||
var excludeTypes = ['CollectionFolder', 'UserView', 'Program', 'SeriesTimer', 'Person', 'TvChannel', 'Channel'];
|
||||
|
||||
function loadThemeMedia(item) {
|
||||
|
||||
if (item.CollectionType) {
|
||||
stopIfPlaying();
|
||||
return;
|
||||
|
@ -68,11 +63,9 @@ define(['playbackManager', 'userSettings', 'connectionManager'], function (playb
|
|||
|
||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
apiClient.getThemeMedia(apiClient.getCurrentUserId(), item.Id, true).then(function (themeMediaResult) {
|
||||
|
||||
var ownerId = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.OwnerId : themeMediaResult.ThemeSongsResult.OwnerId;
|
||||
|
||||
if (ownerId !== currentOwnerId) {
|
||||
|
||||
var items = themeMediaResult.ThemeVideosResult.Items.length ? themeMediaResult.ThemeVideosResult.Items : themeMediaResult.ThemeSongsResult.Items;
|
||||
|
||||
playThemeMedia(items, ownerId);
|
||||
|
@ -81,7 +74,6 @@ define(['playbackManager', 'userSettings', 'connectionManager'], function (playb
|
|||
}
|
||||
|
||||
document.addEventListener('viewshow', function (e) {
|
||||
|
||||
var state = e.detail.state || {};
|
||||
var item = state.item;
|
||||
|
||||
|
@ -97,7 +89,6 @@ define(['playbackManager', 'userSettings', 'connectionManager'], function (playb
|
|||
} else {
|
||||
playThemeMedia([], null);
|
||||
}
|
||||
|
||||
}, true);
|
||||
|
||||
Events.on(playbackManager, 'playbackstart', function (e, player) {
|
||||
|
@ -107,5 +98,4 @@ define(['playbackManager', 'userSettings', 'connectionManager'], function (playb
|
|||
currentOwnerId = null;
|
||||
}
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -2,24 +2,19 @@ define(['css!./toast'], function () {
|
|||
'use strict';
|
||||
|
||||
function remove(elem) {
|
||||
|
||||
setTimeout(function () {
|
||||
elem.parentNode.removeChild(elem);
|
||||
}, 300);
|
||||
}
|
||||
|
||||
function animateRemove(elem) {
|
||||
|
||||
setTimeout(function () {
|
||||
|
||||
elem.classList.remove('toastVisible');
|
||||
remove(elem);
|
||||
|
||||
}, 3300);
|
||||
}
|
||||
|
||||
return function (options) {
|
||||
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
text: options
|
||||
|
@ -36,7 +31,6 @@ define(['css!./toast'], function () {
|
|||
elem.classList.add('toastVisible');
|
||||
|
||||
animateRemove(elem);
|
||||
|
||||
}, 300);
|
||||
};
|
||||
});
|
||||
|
|
|
@ -4,7 +4,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
var transitionEndEventName = dom.whichTransitionEvent();
|
||||
|
||||
function seriesImageUrl(item, options) {
|
||||
|
||||
if (item.Type !== 'Episode') {
|
||||
return null;
|
||||
}
|
||||
|
@ -13,9 +12,7 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
options.type = options.type || 'Primary';
|
||||
|
||||
if (options.type === 'Primary') {
|
||||
|
||||
if (item.SeriesPrimaryImageTag) {
|
||||
|
||||
options.tag = item.SeriesPrimaryImageTag;
|
||||
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||
|
@ -23,15 +20,12 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
if (options.type === 'Thumb') {
|
||||
|
||||
if (item.SeriesThumbImageTag) {
|
||||
|
||||
options.tag = item.SeriesThumbImageTag;
|
||||
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.SeriesId, options);
|
||||
}
|
||||
if (item.ParentThumbImageTag) {
|
||||
|
||||
options.tag = item.ParentThumbImageTag;
|
||||
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.ParentThumbItemId, options);
|
||||
|
@ -42,19 +36,16 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function imageUrl(item, options) {
|
||||
|
||||
options = options || {};
|
||||
options.type = options.type || 'Primary';
|
||||
|
||||
if (item.ImageTags && item.ImageTags[options.type]) {
|
||||
|
||||
options.tag = item.ImageTags[options.type];
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.PrimaryImageItemId || item.Id, options);
|
||||
}
|
||||
|
||||
if (options.type === 'Primary') {
|
||||
if (item.AlbumId && item.AlbumPrimaryImageTag) {
|
||||
|
||||
options.tag = item.AlbumPrimaryImageTag;
|
||||
return connectionManager.getApiClient(item.ServerId).getScaledImageUrl(item.AlbumId, options);
|
||||
}
|
||||
|
@ -64,9 +55,7 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function setPoster(osdPoster, item, secondaryItem) {
|
||||
|
||||
if (item) {
|
||||
|
||||
var imgUrl = seriesImageUrl(item, { type: 'Primary' }) ||
|
||||
seriesImageUrl(item, { type: 'Thumb' }) ||
|
||||
imageUrl(item, { type: 'Primary' });
|
||||
|
@ -87,7 +76,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function getHtml() {
|
||||
|
||||
var html = '';
|
||||
|
||||
html += '<div class="upNextDialog-poster">';
|
||||
|
@ -124,7 +112,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function setNextVideoText() {
|
||||
|
||||
var instance = this;
|
||||
|
||||
var elem = instance.options.parent;
|
||||
|
@ -143,7 +130,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function fillItem(item) {
|
||||
|
||||
var instance = this;
|
||||
|
||||
var elem = instance.options.parent;
|
||||
|
@ -175,11 +161,9 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function onStartNowClick() {
|
||||
|
||||
var options = this.options;
|
||||
|
||||
if (options) {
|
||||
|
||||
var player = options.player;
|
||||
|
||||
this.hide();
|
||||
|
@ -189,7 +173,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function init(instance, options) {
|
||||
|
||||
options.parent.innerHTML = getHtml();
|
||||
|
||||
options.parent.classList.add('hide');
|
||||
|
@ -203,7 +186,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function clearHideAnimationEventListeners(instance, elem) {
|
||||
|
||||
var fn = instance._onHideAnimationComplete;
|
||||
|
||||
if (fn) {
|
||||
|
@ -214,7 +196,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function onHideAnimationComplete(e) {
|
||||
|
||||
var instance = this;
|
||||
var elem = e.target;
|
||||
|
||||
|
@ -225,7 +206,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function hideComingUpNext() {
|
||||
|
||||
var instance = this;
|
||||
clearCountdownTextTimeout(this);
|
||||
|
||||
|
@ -259,10 +239,8 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function getTimeRemainingMs(instance) {
|
||||
|
||||
var options = instance.options;
|
||||
if (options) {
|
||||
|
||||
var runtimeTicks = playbackManager.duration(options.player);
|
||||
|
||||
if (runtimeTicks) {
|
||||
|
@ -276,7 +254,6 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function startComingUpNextHideTimer(instance) {
|
||||
|
||||
var timeRemainingMs = getTimeRemainingMs(instance);
|
||||
|
||||
if (timeRemainingMs <= 0) {
|
||||
|
@ -290,14 +267,12 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
}
|
||||
|
||||
function UpNextDialog(options) {
|
||||
|
||||
this.options = options;
|
||||
|
||||
init(this, options);
|
||||
}
|
||||
|
||||
UpNextDialog.prototype.show = function () {
|
||||
|
||||
var elem = this.options.parent;
|
||||
|
||||
clearHideAnimationEventListeners(this, elem);
|
||||
|
@ -319,12 +294,10 @@ define(['dom', 'playbackManager', 'connectionManager', 'events', 'mediaInfo', 'l
|
|||
};
|
||||
|
||||
UpNextDialog.prototype.hide = function () {
|
||||
|
||||
hideComingUpNext.call(this);
|
||||
};
|
||||
|
||||
UpNextDialog.prototype.destroy = function () {
|
||||
|
||||
hideComingUpNext.call(this);
|
||||
|
||||
this.options = null;
|
||||
|
|
|
@ -9,7 +9,6 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
};
|
||||
|
||||
function getUserDataButtonHtml(method, itemId, serverId, buttonCssClass, iconCssClass, icon, tooltip, style) {
|
||||
|
||||
if (style === 'fab-mini') {
|
||||
style = 'fab';
|
||||
buttonCssClass = buttonCssClass ? (buttonCssClass + ' mini') : 'mini';
|
||||
|
@ -34,7 +33,6 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function onContainerClick(e) {
|
||||
|
||||
var btnUserData = dom.parentWithClass(e.target, 'btnUserData');
|
||||
|
||||
if (!btnUserData) {
|
||||
|
@ -46,7 +44,6 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function fill(options) {
|
||||
|
||||
var html = getIconsHtml(options);
|
||||
|
||||
if (options.fillMode === 'insertAdjacent') {
|
||||
|
@ -65,7 +62,6 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function destroy(options) {
|
||||
|
||||
options.element.innerHTML = '';
|
||||
|
||||
dom.removeEventListener(options.element, 'click', onContainerClick, {
|
||||
|
@ -74,7 +70,6 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function getIconsHtml(options) {
|
||||
|
||||
var item = options.item;
|
||||
var includePlayed = options.includePlayed;
|
||||
var cssClass = options.cssClass;
|
||||
|
@ -114,7 +109,6 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
|
||||
var tooltipFavorite = globalize.translate('Favorite');
|
||||
if (userData.IsFavorite) {
|
||||
|
||||
html += getUserDataButtonHtml('markFavorite', itemId, serverId, btnCssClass + ' btnUserData btnUserDataOn', iconCssClass, 'favorite', tooltipFavorite, style);
|
||||
} else {
|
||||
html += getUserDataButtonHtml('markFavorite', itemId, serverId, btnCssClass + ' btnUserData', iconCssClass, 'favorite', tooltipFavorite, style);
|
||||
|
@ -124,7 +118,6 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function markFavorite(link) {
|
||||
|
||||
var id = link.getAttribute('data-itemid');
|
||||
var serverId = link.getAttribute('data-serverid');
|
||||
|
||||
|
@ -140,18 +133,14 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function markLike(link) {
|
||||
|
||||
var id = link.getAttribute('data-itemid');
|
||||
var serverId = link.getAttribute('data-serverid');
|
||||
|
||||
if (!link.classList.contains('btnUserDataOn')) {
|
||||
|
||||
likes(id, serverId, true);
|
||||
|
||||
link.classList.add('btnUserDataOn');
|
||||
|
||||
} else {
|
||||
|
||||
clearLike(id, serverId);
|
||||
|
||||
link.classList.remove('btnUserDataOn');
|
||||
|
@ -161,18 +150,14 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function markDislike(link) {
|
||||
|
||||
var id = link.getAttribute('data-itemid');
|
||||
var serverId = link.getAttribute('data-serverid');
|
||||
|
||||
if (!link.classList.contains('btnUserDataOn')) {
|
||||
|
||||
likes(id, serverId, false);
|
||||
|
||||
link.classList.add('btnUserDataOn');
|
||||
|
||||
} else {
|
||||
|
||||
clearLike(id, serverId);
|
||||
|
||||
link.classList.remove('btnUserDataOn');
|
||||
|
@ -182,18 +167,14 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function markPlayed(link) {
|
||||
|
||||
var id = link.getAttribute('data-itemid');
|
||||
var serverId = link.getAttribute('data-serverid');
|
||||
|
||||
if (!link.classList.contains('btnUserDataOn')) {
|
||||
|
||||
played(id, serverId, true);
|
||||
|
||||
link.classList.add('btnUserDataOn');
|
||||
|
||||
} else {
|
||||
|
||||
played(id, serverId, false);
|
||||
|
||||
link.classList.remove('btnUserDataOn');
|
||||
|
@ -220,7 +201,6 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
}
|
||||
|
||||
function clearLike(id, serverId) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
return apiClient.clearUserItemRating(apiClient.getCurrentUserId(), id);
|
||||
|
@ -231,5 +211,4 @@ define(['connectionManager', 'globalize', 'dom', 'itemHelper', 'paper-icon-butto
|
|||
destroy: destroy,
|
||||
getIconsHtml: getIconsHtml
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
@ -5,10 +5,8 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
var dispatchPageEvents;
|
||||
|
||||
viewContainer.setOnBeforeChange(function (newView, isRestored, options) {
|
||||
|
||||
var lastView = currentView;
|
||||
if (lastView) {
|
||||
|
||||
var beforeHideResult = dispatchViewEvent(lastView, null, 'viewbeforehide', true);
|
||||
|
||||
if (!beforeHideResult) {
|
||||
|
@ -36,7 +34,6 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
});
|
||||
|
||||
function onViewChange(view, options, isRestore) {
|
||||
|
||||
var lastView = currentView;
|
||||
if (lastView) {
|
||||
dispatchViewEvent(lastView, null, 'viewhide');
|
||||
|
@ -76,7 +73,6 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
}
|
||||
|
||||
function dispatchViewEvent(view, eventInfo, eventName, isCancellable) {
|
||||
|
||||
if (!eventInfo) {
|
||||
eventInfo = {
|
||||
detail: {
|
||||
|
@ -101,7 +97,6 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
}
|
||||
|
||||
function getViewEventDetail(view, options, isRestore) {
|
||||
|
||||
var url = options.url;
|
||||
var index = url.indexOf('?');
|
||||
var params = index === -1 ? {} : queryString.parse(url.substring(index + 1));
|
||||
|
@ -133,7 +128,6 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
}
|
||||
|
||||
ViewManager.prototype.loadView = function (options) {
|
||||
|
||||
var lastView = currentView;
|
||||
|
||||
// Record the element that has focus
|
||||
|
@ -146,13 +140,11 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
}
|
||||
|
||||
viewContainer.loadView(options).then(function (view) {
|
||||
|
||||
onViewChange(view, options);
|
||||
});
|
||||
};
|
||||
|
||||
ViewManager.prototype.tryRestoreView = function (options, onViewChanging) {
|
||||
|
||||
if (options.cancel) {
|
||||
return Promise.reject({ cancelled: true });
|
||||
}
|
||||
|
@ -163,10 +155,8 @@ define(['viewContainer', 'focusManager', 'queryString', 'layoutManager'], functi
|
|||
}
|
||||
|
||||
return viewContainer.tryRestoreView(options).then(function (view) {
|
||||
|
||||
onViewChanging();
|
||||
onViewChange(view, options, true);
|
||||
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -2,19 +2,16 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
|||
'use strict';
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
function initEditor(context, settings) {
|
||||
|
||||
context.querySelector('form').addEventListener('submit', onSubmit);
|
||||
|
||||
var elems = context.querySelectorAll('.viewSetting-checkboxContainer');
|
||||
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
elems[i].querySelector('input').checked = settings[elems[i].getAttribute('data-settingname')] || false;
|
||||
}
|
||||
|
||||
|
@ -22,7 +19,6 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
|||
}
|
||||
|
||||
function saveValues(context, settings, settingsKey) {
|
||||
|
||||
var elems = context.querySelectorAll('.viewSetting-checkboxContainer');
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
userSettings.set(settingsKey + '-' + elems[i].getAttribute('data-settingname'), elems[i].querySelector('input').checked);
|
||||
|
@ -39,7 +35,6 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
|||
}
|
||||
|
||||
function showIfAllowed(context, selector, visible) {
|
||||
|
||||
var elem = context.querySelector(selector);
|
||||
|
||||
if (visible && !elem.classList.contains('hiddenFromViewSettings')) {
|
||||
|
@ -54,11 +49,8 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
|||
}
|
||||
|
||||
ViewSettings.prototype.show = function (options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['text!./viewSettings.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
|
@ -100,13 +92,11 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
|||
initEditor(dlg, options.settings);
|
||||
|
||||
dlg.querySelector('.selectImageType').addEventListener('change', function () {
|
||||
|
||||
showIfAllowed(dlg, '.chkTitleContainer', this.value !== 'list');
|
||||
showIfAllowed(dlg, '.chkYearContainer', this.value !== 'list');
|
||||
});
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
|
@ -119,13 +109,10 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
|||
dlg.querySelector('.selectImageType').dispatchEvent(new CustomEvent('change', {}));
|
||||
|
||||
dlg.querySelector('form').addEventListener('change', function () {
|
||||
|
||||
submitted = true;
|
||||
|
||||
}, true);
|
||||
|
||||
dialogHelper.open(dlg).then(function () {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||
}
|
||||
|
|
|
@ -257,7 +257,6 @@ import 'listViewStyle';
|
|||
let currentType;
|
||||
|
||||
for (const [index, profile] of profiles.entries()) {
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||
currentType = profile.Type;
|
||||
|
|
|
@ -393,7 +393,6 @@ import 'emby-itemrefreshindicator';
|
|||
});
|
||||
});
|
||||
pageIdOn('pagebeforehide', 'mediaLibraryPage', function () {
|
||||
|
||||
const page = this;
|
||||
taskButton({
|
||||
mode: 'off',
|
||||
|
|
|
@ -10,7 +10,6 @@ import 'emby-select';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function fillTimeOfDay(select) {
|
||||
|
||||
const options = [];
|
||||
|
||||
for (let i = 0; i < 86400000; i += 900000) {
|
||||
|
@ -99,7 +98,6 @@ import 'emby-select';
|
|||
}
|
||||
|
||||
if (trigger.Type == 'IntervalTrigger') {
|
||||
|
||||
const hours = trigger.IntervalTicks / 36e9;
|
||||
|
||||
if (hours == 0.25) {
|
||||
|
|
|
@ -228,7 +228,6 @@ import 'paper-icon-button-light';
|
|||
}
|
||||
|
||||
function showBlockedTagPopup(page) {
|
||||
|
||||
import('prompt').then(({default: prompt}) => {
|
||||
prompt({
|
||||
label: globalize.translate('LabelTag')
|
||||
|
|
|
@ -75,7 +75,6 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
|||
ParentId: params.topParentId
|
||||
};
|
||||
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then(function (result) {
|
||||
|
||||
if (viewStyle == 'Thumb') {
|
||||
cardBuilder.buildCards(result.Items, {
|
||||
itemsContainer: elem,
|
||||
|
|
|
@ -963,7 +963,6 @@ import 'css!assets/css/videoosd';
|
|||
const player = currentPlayer;
|
||||
|
||||
if (player) {
|
||||
|
||||
// show subtitle offset feature only if player and media support it
|
||||
const showSubOffset = playbackManager.supportSubtitleOffset(player) &&
|
||||
playbackManager.canHandleOffsetOnCurrentSubtitle(player);
|
||||
|
|
|
@ -55,7 +55,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function onButtonClick(e) {
|
||||
|
||||
const button = this;
|
||||
const collapseContent = button.parentNode.querySelector('.collapseContent');
|
||||
|
||||
|
@ -69,7 +68,6 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
EmbyButtonPrototype.attachedCallback = function () {
|
||||
|
||||
if (this.classList.contains('emby-collapse')) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import 'webcomponents';
|
|||
let supportsFloatingLabel = false;
|
||||
|
||||
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
|
||||
|
||||
const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
||||
|
||||
// descriptor returning null in webos
|
||||
|
@ -94,16 +93,13 @@ import 'webcomponents';
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
function onChange() {
|
||||
|
||||
const label = this.labelElement;
|
||||
if (this.value) {
|
||||
label.classList.remove('inputLabel-float');
|
||||
} else {
|
||||
|
||||
const instanceSupportsFloat = supportsFloatingLabel && this.type !== 'date' && this.type !== 'time';
|
||||
|
||||
if (instanceSupportsFloat) {
|
||||
|
|
|
@ -7,14 +7,12 @@ import 'webcomponents';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function addNotificationEvent(instance, name, handler) {
|
||||
|
||||
const localHandler = handler.bind(instance);
|
||||
events.on(serverNotifications, name, localHandler);
|
||||
instance[name] = localHandler;
|
||||
}
|
||||
|
||||
function removeNotificationEvent(instance, name) {
|
||||
|
||||
const handler = instance[name];
|
||||
if (handler) {
|
||||
events.off(serverNotifications, name, handler);
|
||||
|
@ -23,7 +21,6 @@ import 'webcomponents';
|
|||
}
|
||||
|
||||
function onRefreshProgress(e, apiClient, info) {
|
||||
|
||||
const indicator = this;
|
||||
|
||||
if (!indicator.itemId) {
|
||||
|
@ -31,7 +28,6 @@ import 'webcomponents';
|
|||
}
|
||||
|
||||
if (info.ItemId === indicator.itemId) {
|
||||
|
||||
const progress = parseFloat(info.Progress);
|
||||
|
||||
if (progress && progress < 100) {
|
||||
|
@ -47,7 +43,6 @@ import 'webcomponents';
|
|||
let EmbyItemRefreshIndicatorPrototype = Object.create(EmbyProgressRing);
|
||||
|
||||
EmbyItemRefreshIndicatorPrototype.createdCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyProgressRing.createdCallback) {
|
||||
EmbyProgressRing.createdCallback.call(this);
|
||||
|
@ -57,7 +52,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
EmbyItemRefreshIndicatorPrototype.attachedCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyProgressRing.attachedCallback) {
|
||||
EmbyProgressRing.attachedCallback.call(this);
|
||||
|
@ -65,7 +59,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
EmbyItemRefreshIndicatorPrototype.detachedCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyProgressRing.detachedCallback) {
|
||||
EmbyProgressRing.detachedCallback.call(this);
|
||||
|
|
|
@ -147,7 +147,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
function onUserDataChanged(e, apiClient, userData) {
|
||||
|
||||
const itemsContainer = this;
|
||||
|
||||
import('cardBuilder').then(({default: cardBuilder}) => {
|
||||
|
@ -174,7 +173,6 @@ import 'webcomponents';
|
|||
}
|
||||
|
||||
function onTimerCreated(e, apiClient, data) {
|
||||
|
||||
const itemsContainer = this;
|
||||
|
||||
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
||||
|
@ -360,7 +358,6 @@ import 'webcomponents';
|
|||
|
||||
let refreshIntervalEndTime = this.refreshIntervalEndTime;
|
||||
if (refreshIntervalEndTime) {
|
||||
|
||||
const remainingMs = refreshIntervalEndTime - new Date().getTime();
|
||||
if (remainingMs > 0 && !this.needsRefresh) {
|
||||
resetRefreshInterval(this, remainingMs);
|
||||
|
|
|
@ -21,7 +21,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
}
|
||||
|
||||
function onClick(e) {
|
||||
|
||||
const button = this;
|
||||
const id = button.getAttribute('data-id');
|
||||
const serverId = button.getAttribute('data-serverid');
|
||||
|
@ -70,7 +69,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
}
|
||||
|
||||
function setTitle(button, itemType) {
|
||||
|
||||
if (itemType !== 'AudioBook' && itemType !== 'AudioPodcast') {
|
||||
button.title = globalize.translate('Watched');
|
||||
} else {
|
||||
|
@ -84,13 +82,11 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
}
|
||||
|
||||
function clearEvents(button) {
|
||||
|
||||
button.removeEventListener('click', onClick);
|
||||
removeNotificationEvent(button, 'UserDataChanged');
|
||||
}
|
||||
|
||||
function bindEvents(button) {
|
||||
|
||||
clearEvents(button);
|
||||
|
||||
button.addEventListener('click', onClick);
|
||||
|
@ -100,7 +96,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
const EmbyPlaystateButtonPrototype = Object.create(EmbyButtonPrototype);
|
||||
|
||||
EmbyPlaystateButtonPrototype.createdCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyButtonPrototype.createdCallback) {
|
||||
EmbyButtonPrototype.createdCallback.call(this);
|
||||
|
@ -108,7 +103,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
};
|
||||
|
||||
EmbyPlaystateButtonPrototype.attachedCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyButtonPrototype.attachedCallback) {
|
||||
EmbyButtonPrototype.attachedCallback.call(this);
|
||||
|
@ -117,7 +111,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
const itemId = this.getAttribute('data-id');
|
||||
const serverId = this.getAttribute('data-serverid');
|
||||
if (itemId && serverId) {
|
||||
|
||||
setState(this, this.getAttribute('data-played') === 'true', false);
|
||||
bindEvents(this);
|
||||
setTitle(this, this.getAttribute('data-type'));
|
||||
|
@ -125,7 +118,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
};
|
||||
|
||||
EmbyPlaystateButtonPrototype.detachedCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyButtonPrototype.detachedCallback) {
|
||||
EmbyButtonPrototype.detachedCallback.call(this);
|
||||
|
@ -136,9 +128,7 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
};
|
||||
|
||||
EmbyPlaystateButtonPrototype.setItem = function (item) {
|
||||
|
||||
if (item) {
|
||||
|
||||
this.setAttribute('data-id', item.Id);
|
||||
this.setAttribute('data-serverid', item.ServerId);
|
||||
|
||||
|
@ -147,9 +137,7 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
bindEvents(this);
|
||||
|
||||
setTitle(this, item.Type);
|
||||
|
||||
} else {
|
||||
|
||||
this.removeAttribute('data-id');
|
||||
this.removeAttribute('data-serverid');
|
||||
this.removeAttribute('data-played');
|
||||
|
|
|
@ -6,7 +6,6 @@ import 'webcomponents';
|
|||
let EmbyProgressRing = Object.create(HTMLDivElement.prototype);
|
||||
|
||||
EmbyProgressRing.createdCallback = function () {
|
||||
|
||||
this.classList.add('progressring');
|
||||
const instance = this;
|
||||
|
||||
|
@ -35,7 +34,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
EmbyProgressRing.setProgress = function (progress) {
|
||||
|
||||
progress = Math.floor(progress);
|
||||
|
||||
let angle;
|
||||
|
@ -49,7 +47,6 @@ import 'webcomponents';
|
|||
this.querySelector('.animate-50-75-b').style.transform = 'rotate(-90deg)';
|
||||
this.querySelector('.animate-75-100-b').style.transform = 'rotate(-90deg)';
|
||||
} else if (progress >= 25 && progress < 50) {
|
||||
|
||||
angle = -90 + ((progress - 25) / 100) * 360;
|
||||
|
||||
this.querySelector('.animate-0-25-b').style.transform = 'none';
|
||||
|
@ -82,7 +79,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
EmbyProgressRing.detachedCallback = function () {
|
||||
|
||||
let observer = this.observer;
|
||||
|
||||
if (observer) {
|
||||
|
|
|
@ -7,7 +7,6 @@ import 'webcomponents';
|
|||
let EmbyRadioPrototype = Object.create(HTMLInputElement.prototype);
|
||||
|
||||
function onKeyDown(e) {
|
||||
|
||||
// Don't submit form on enter
|
||||
// Real (non-emulator) Tizen does nothing on Space
|
||||
if (e.keyCode === 13 || e.keyCode === 32) {
|
||||
|
|
|
@ -7,14 +7,12 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function addNotificationEvent(instance, name, handler) {
|
||||
|
||||
const localHandler = handler.bind(instance);
|
||||
events.on(serverNotifications, name, localHandler);
|
||||
instance[name] = localHandler;
|
||||
}
|
||||
|
||||
function removeNotificationEvent(instance, name) {
|
||||
|
||||
const handler = instance[name];
|
||||
if (handler) {
|
||||
events.off(serverNotifications, name, handler);
|
||||
|
@ -23,12 +21,10 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
}
|
||||
|
||||
function showPicker(button, apiClient, itemId, likes, isFavorite) {
|
||||
|
||||
return apiClient.updateFavoriteStatus(apiClient.getCurrentUserId(), itemId, !isFavorite);
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
|
||||
const button = this;
|
||||
const id = button.getAttribute('data-id');
|
||||
const serverId = button.getAttribute('data-serverid');
|
||||
|
@ -45,52 +41,41 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
}
|
||||
|
||||
showPicker(button, apiClient, id, likes, isFavorite).then(function (userData) {
|
||||
|
||||
setState(button, userData.Likes, userData.IsFavorite);
|
||||
});
|
||||
}
|
||||
|
||||
function onUserDataChanged(e, apiClient, userData) {
|
||||
|
||||
const button = this;
|
||||
|
||||
if (userData.ItemId === button.getAttribute('data-id')) {
|
||||
|
||||
setState(button, userData.Likes, userData.IsFavorite);
|
||||
}
|
||||
}
|
||||
|
||||
function setState(button, likes, isFavorite, updateAttribute) {
|
||||
|
||||
const icon = button.querySelector('.material-icons');
|
||||
|
||||
if (isFavorite) {
|
||||
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
icon.classList.add('ratingbutton-icon-withrating');
|
||||
}
|
||||
|
||||
button.classList.add('ratingbutton-withrating');
|
||||
|
||||
} else if (likes) {
|
||||
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
icon.classList.remove('ratingbutton-icon-withrating');
|
||||
}
|
||||
button.classList.remove('ratingbutton-withrating');
|
||||
|
||||
} else if (likes === false) {
|
||||
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
icon.classList.remove('ratingbutton-icon-withrating');
|
||||
}
|
||||
button.classList.remove('ratingbutton-withrating');
|
||||
|
||||
} else {
|
||||
|
||||
if (icon) {
|
||||
icon.classList.add('favorite');
|
||||
icon.classList.remove('ratingbutton-icon-withrating');
|
||||
|
@ -115,13 +100,11 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
}
|
||||
|
||||
function clearEvents(button) {
|
||||
|
||||
button.removeEventListener('click', onClick);
|
||||
removeNotificationEvent(button, 'UserDataChanged');
|
||||
}
|
||||
|
||||
function bindEvents(button) {
|
||||
|
||||
clearEvents(button);
|
||||
|
||||
button.addEventListener('click', onClick);
|
||||
|
@ -131,7 +114,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
const EmbyRatingButtonPrototype = Object.create(EmbyButtonPrototype);
|
||||
|
||||
EmbyRatingButtonPrototype.createdCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyButtonPrototype.createdCallback) {
|
||||
EmbyButtonPrototype.createdCallback.call(this);
|
||||
|
@ -139,7 +121,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
};
|
||||
|
||||
EmbyRatingButtonPrototype.attachedCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyButtonPrototype.attachedCallback) {
|
||||
EmbyButtonPrototype.attachedCallback.call(this);
|
||||
|
@ -148,7 +129,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
const itemId = this.getAttribute('data-id');
|
||||
const serverId = this.getAttribute('data-serverid');
|
||||
if (itemId && serverId) {
|
||||
|
||||
let likes = this.getAttribute('data-likes');
|
||||
const isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
||||
if (likes === 'true') {
|
||||
|
@ -167,7 +147,6 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
};
|
||||
|
||||
EmbyRatingButtonPrototype.detachedCallback = function () {
|
||||
|
||||
// base method
|
||||
if (EmbyButtonPrototype.detachedCallback) {
|
||||
EmbyButtonPrototype.detachedCallback.call(this);
|
||||
|
@ -177,18 +156,14 @@ import EmbyButtonPrototype from 'emby-button';
|
|||
};
|
||||
|
||||
EmbyRatingButtonPrototype.setItem = function (item) {
|
||||
|
||||
if (item) {
|
||||
|
||||
this.setAttribute('data-id', item.Id);
|
||||
this.setAttribute('data-serverid', item.ServerId);
|
||||
|
||||
const userData = item.UserData || {};
|
||||
setState(this, userData.Likes, userData.IsFavorite);
|
||||
bindEvents(this);
|
||||
|
||||
} else {
|
||||
|
||||
this.removeAttribute('data-id');
|
||||
this.removeAttribute('data-serverid');
|
||||
this.removeAttribute('data-likes');
|
||||
|
|
|
@ -9,7 +9,6 @@ import 'webcomponents';
|
|||
const EmbySelectPrototype = Object.create(HTMLSelectElement.prototype);
|
||||
|
||||
function enableNativeMenu() {
|
||||
|
||||
if (browser.edgeUwp || browser.xboxOne) {
|
||||
return true;
|
||||
}
|
||||
|
@ -38,12 +37,10 @@ import 'webcomponents';
|
|||
}
|
||||
|
||||
function setValue(select, value) {
|
||||
|
||||
select.value = value;
|
||||
}
|
||||
|
||||
function showActionSheet(select) {
|
||||
|
||||
const labelElem = getLabel(select);
|
||||
const title = labelElem ? (labelElem.textContent || labelElem.innerText) : null;
|
||||
|
||||
|
@ -112,7 +109,6 @@ import 'webcomponents';
|
|||
let inputId = 0;
|
||||
|
||||
EmbySelectPrototype.createdCallback = function () {
|
||||
|
||||
if (!this.id) {
|
||||
this.id = 'embyselect' + inputId;
|
||||
inputId++;
|
||||
|
@ -132,7 +128,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
EmbySelectPrototype.attachedCallback = function () {
|
||||
|
||||
if (this.classList.contains('emby-select')) {
|
||||
return;
|
||||
}
|
||||
|
@ -151,7 +146,6 @@ import 'webcomponents';
|
|||
};
|
||||
|
||||
EmbySelectPrototype.setLabel = function (text) {
|
||||
|
||||
const label = this.parentNode.querySelector('label');
|
||||
|
||||
label.innerHTML = text;
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue