mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-15 18:08:17 -07:00
Merge pull request #1634 from MrTimscampi/es6
Merge the ES6 feature branch back into master
This commit is contained in:
commit
feaabb6de9
@ -193,4 +193,4 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
125
package.json
125
package.json
@ -91,13 +91,46 @@
|
||||
"test": [
|
||||
"src/components/accessSchedule/accessSchedule.js",
|
||||
"src/components/actionSheet/actionSheet.js",
|
||||
"src/components/activitylog.js",
|
||||
"src/components/alert.js",
|
||||
"src/components/alphaPicker/alphaPicker.js",
|
||||
"src/components/appFooter/appFooter.js",
|
||||
"src/components/autoFocuser.js",
|
||||
"src/components/backdrop/backdrop.js",
|
||||
"src/components/cardbuilder/cardBuilder.js",
|
||||
"src/components/cardbuilder/chaptercardbuilder.js",
|
||||
"src/components/cardbuilder/peoplecardbuilder.js",
|
||||
"src/components/channelMapper/channelMapper.js",
|
||||
"src/components/collectionEditor/collectionEditor.js",
|
||||
"src/components/confirm/confirm.js",
|
||||
"src/components/dialog/dialog.js",
|
||||
"src/components/dialogHelper/dialogHelper.js",
|
||||
"src/components/directorybrowser/directorybrowser.js",
|
||||
"src/components/displaySettings/displaySettings.js",
|
||||
"src/components/fetchhelper.js",
|
||||
"src/components/filterdialog/filterdialog.js",
|
||||
"src/components/groupedcards.js",
|
||||
"src/components/homeScreenSettings/homeScreenSettings.js",
|
||||
"src/components/homesections/homesections.js",
|
||||
"src/components/htmlMediaHelper.js",
|
||||
"src/components/imageOptionsEditor/imageOptionsEditor.js",
|
||||
"src/components/images/imageLoader.js",
|
||||
"src/components/imageUploader/imageUploader.js",
|
||||
"src/components/indicators/indicators.js",
|
||||
"src/components/itemContextMenu.js",
|
||||
"src/components/itemidentifier/itemidentifier.js",
|
||||
"src/components/itemMediaInfo/itemMediaInfo.js",
|
||||
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
||||
"src/components/libraryoptionseditor/libraryoptionseditor.js",
|
||||
"src/components/listview/listview.js",
|
||||
"src/components/maintabsmanager.js",
|
||||
"src/components/mediainfo/mediainfo.js",
|
||||
"src/components/mediaLibraryCreator/mediaLibraryCreator.js",
|
||||
"src/components/mediaLibraryEditor/mediaLibraryEditor.js",
|
||||
"src/components/metadataEditor/metadataEditor.js",
|
||||
"src/components/metadataEditor/personEditor.js",
|
||||
"src/components/multiSelect/multiSelect.js",
|
||||
"src/components/nowPlayingBar/nowPlayingBar.js",
|
||||
"src/components/playback/brightnessosd.js",
|
||||
"src/components/playback/mediasession.js",
|
||||
"src/components/playback/nowplayinghelper.js",
|
||||
@ -107,38 +140,122 @@
|
||||
"src/components/playback/playmethodhelper.js",
|
||||
"src/components/playback/remotecontrolautoplay.js",
|
||||
"src/components/playback/volumeosd.js",
|
||||
"src/components/playbackSettings/playbackSettings.js",
|
||||
"src/components/playerstats/playerstats.js",
|
||||
"src/components/playlisteditor/playlisteditor.js",
|
||||
"src/components/playmenu.js",
|
||||
"src/components/prompt/prompt.js",
|
||||
"src/components/sanatizefilename.js",
|
||||
"src/components/scrollManager.js",
|
||||
"src/components/search/searchfields.js",
|
||||
"src/components/search/searchresults.js",
|
||||
"src/components/settingshelper.js",
|
||||
"src/components/shortcuts.js",
|
||||
"src/components/subtitlesettings/subtitleappearancehelper.js",
|
||||
"src/components/subtitlesettings/subtitlesettings.js",
|
||||
"src/components/syncPlay/groupSelectionMenu.js",
|
||||
"src/components/syncPlay/playbackPermissionManager.js",
|
||||
"src/components/syncPlay/syncPlayManager.js",
|
||||
"src/components/syncPlay/timeSyncManager.js",
|
||||
"src/controllers/auth/addserver.js",
|
||||
"src/controllers/auth/forgotpassword.js",
|
||||
"src/controllers/auth/forgotpasswordpin.js",
|
||||
"src/controllers/auth/login.js",
|
||||
"src/controllers/auth/selectserver.js",
|
||||
"src/controllers/dashboard/apikeys.js",
|
||||
"src/controllers/dashboard/dashboard.js",
|
||||
"src/controllers/dashboard/devices/device.js",
|
||||
"src/controllers/dashboard/devices/devices.js",
|
||||
"src/controllers/dashboard/dlna/profile.js",
|
||||
"src/controllers/dashboard/dlna/profiles.js",
|
||||
"src/controllers/dashboard/dlna/settings.js",
|
||||
"src/controllers/dashboard/encodingsettings.js",
|
||||
"src/controllers/dashboard/general.js",
|
||||
"src/controllers/dashboard/librarydisplay.js",
|
||||
"src/controllers/dashboard/logs.js",
|
||||
"src/controllers/dashboard/mediaLibrary.js",
|
||||
"src/controllers/dashboard/metadataImages.js",
|
||||
"src/controllers/dashboard/metadatanfo.js",
|
||||
"src/controllers/dashboard/networking.js",
|
||||
"src/controllers/dashboard/playback.js",
|
||||
"src/controllers/dashboard/plugins/repositories.js",
|
||||
"src/controllers/dashboard/scheduledtasks/scheduledtask.js",
|
||||
"src/controllers/dashboard/scheduledtasks/scheduledtasks.js",
|
||||
"src/controllers/dashboard/serveractivity.js",
|
||||
"src/controllers/dashboard/streaming.js",
|
||||
"src/controllers/dashboard/users/useredit.js",
|
||||
"src/controllers/dashboard/users/userlibraryaccess.js",
|
||||
"src/controllers/dashboard/users/usernew.js",
|
||||
"src/controllers/dashboard/users/userparentalcontrol.js",
|
||||
"src/controllers/dashboard/users/userpasswordpage.js",
|
||||
"src/controllers/dashboard/users/userprofilespage.js",
|
||||
"src/controllers/playback/nowplaying.js",
|
||||
"src/controllers/playback/videoosd.js",
|
||||
"src/controllers/searchpage.js",
|
||||
"src/controllers/shows/episodes.js",
|
||||
"src/controllers/shows/tvgenres.js",
|
||||
"src/controllers/shows/tvlatest.js",
|
||||
"src/controllers/shows/tvrecommended.js",
|
||||
"src/controllers/shows/tvshows.js",
|
||||
"src/controllers/shows/tvstudios.js",
|
||||
"src/controllers/shows/tvupcoming.js",
|
||||
"src/controllers/user/display.js",
|
||||
"src/controllers/user/home.js",
|
||||
"src/controllers/user/menu.js",
|
||||
"src/controllers/user/playback.js",
|
||||
"src/controllers/user/profile.js",
|
||||
"src/controllers/user/subtitles.js",
|
||||
"src/controllers/user/subtitles.js",
|
||||
"src/controllers/wizard/finish.js",
|
||||
"src/controllers/wizard/remoteaccess.js",
|
||||
"src/controllers/wizard/settings.js",
|
||||
"src/controllers/wizard/start.js",
|
||||
"src/controllers/wizard/user.js",
|
||||
"src/elements/emby-button/emby-button.js",
|
||||
"src/elements/emby-button/paper-icon-button-light.js",
|
||||
"src/elements/emby-checkbox/emby-checkbox.js",
|
||||
"src/elements/emby-collapse/emby-collapse.js",
|
||||
"src/elements/emby-input/emby-input.js",
|
||||
"src/elements/emby-itemrefreshindicator/emby-itemrefreshindicator.js",
|
||||
"src/elements/emby-itemscontainer/emby-itemscontainer.js",
|
||||
"src/elements/emby-playstatebutton/emby-playstatebutton.js",
|
||||
"src/elements/emby-programcell/emby-programcell.js",
|
||||
"src/elements/emby-progressbar/emby-progressbar.js",
|
||||
"src/elements/emby-progressring/emby-progressring.js",
|
||||
"src/elements/emby-radio/emby-radio.js",
|
||||
"src/elements/emby-ratingbutton/emby-ratingbutton.js",
|
||||
"src/elements/emby-scrollbuttons/emby-scrollbuttons.js",
|
||||
"src/elements/emby-scroller/emby-scroller.js",
|
||||
"src/elements/emby-select/emby-select.js",
|
||||
"src/elements/emby-slider/emby-slider.js",
|
||||
"src/elements/emby-tabs/emby-tabs.js",
|
||||
"src/elements/emby-textarea/emby-textarea.js",
|
||||
"src/elements/emby-toggle/emby-toggle.js",
|
||||
"src/plugins/backdropScreensaver/plugin.js",
|
||||
"src/plugins/bookPlayer/plugin.js",
|
||||
"src/plugins/bookPlayer/tableOfContents.js",
|
||||
"src/plugins/photoPlayer/plugin.js",
|
||||
"src/plugins/youtubePlayer/plugin.js",
|
||||
"src/scripts/alphanumericshortcuts.js",
|
||||
"src/scripts/autoBackdrops.js",
|
||||
"src/scripts/datetime.js",
|
||||
"src/scripts/deleteHelper.js",
|
||||
"src/scripts/dfnshelper.js",
|
||||
"src/scripts/dom.js",
|
||||
"src/scripts/editorsidebar.js",
|
||||
"src/scripts/fileDownloader.js",
|
||||
"src/scripts/filesystem.js",
|
||||
"src/scripts/globalize.js",
|
||||
"src/scripts/imagehelper.js",
|
||||
"src/scripts/inputManager.js",
|
||||
"src/plugins/backdropScreensaver/plugin.js",
|
||||
"src/components/filterdialog/filterdialog.js",
|
||||
"src/components/fetchhelper.js",
|
||||
"src/scripts/keyboardNavigation.js",
|
||||
"src/scripts/playlists.js",
|
||||
"src/scripts/settings/appSettings.js",
|
||||
"src/scripts/settings/userSettings.js",
|
||||
"src/scripts/settings/webSettings.js"
|
||||
"src/scripts/settings/webSettings.js",
|
||||
"src/scripts/taskbutton.js",
|
||||
"src/scripts/themeLoader.js",
|
||||
"src/scripts/touchHelper.js"
|
||||
],
|
||||
"plugins": [
|
||||
"@babel/plugin-transform-modules-amd",
|
||||
|
@ -59,15 +59,14 @@ import 'formDialogStyle';
|
||||
|
||||
export function show(options) {
|
||||
return new Promise((resolve, reject) => {
|
||||
// TODO: remove require
|
||||
require(['text!./components/accessSchedule/accessSchedule.template.html'], template => {
|
||||
import('text!./accessSchedule.template.html').then(({default: template}) => {
|
||||
const dlg = dialogHelper.createDialog({
|
||||
removeOnClose: true,
|
||||
size: 'small'
|
||||
});
|
||||
dlg.classList.add('formDialog');
|
||||
let html = '';
|
||||
html += globalize.translateDocument(template);
|
||||
html += globalize.translateHtml(template);
|
||||
dlg.innerHTML = html;
|
||||
populateHours(dlg);
|
||||
loadSchedule(dlg, options.schedule);
|
||||
|
@ -73,7 +73,7 @@ function getPosition(options, dlg) {
|
||||
}
|
||||
|
||||
function centerFocus(elem, horiz, on) {
|
||||
require(['scrollHelper'], function (scrollHelper) {
|
||||
import('scrollHelper').then(({default: scrollHelper}) => {
|
||||
const fn = on ? 'on' : 'off';
|
||||
scrollHelper.centerFocus[fn](elem, horiz);
|
||||
});
|
||||
|
@ -1,11 +1,21 @@
|
||||
define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings', 'serverNotifications', 'connectionManager', 'emby-button', 'listViewStyle'], function (events, globalize, dom, datefns, dfnshelper, userSettings, serverNotifications, connectionManager) {
|
||||
'use strict';
|
||||
import events from 'events';
|
||||
import globalize from 'globalize';
|
||||
import dom from 'dom';
|
||||
import * as datefns from 'date-fns';
|
||||
import dfnshelper from 'dfnshelper';
|
||||
import userSettings from 'userSettings';
|
||||
import serverNotifications from 'serverNotifications';
|
||||
import connectionManager from 'connectionManager';
|
||||
import 'emby-button';
|
||||
import 'listViewStyle';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getEntryHtml(entry, apiClient) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<div class="listItem listItem-border">';
|
||||
var color = '#00a4dc';
|
||||
var icon = 'notifications';
|
||||
let color = '#00a4dc';
|
||||
let icon = 'notifications';
|
||||
|
||||
if ('Error' == entry.Severity || 'Fatal' == entry.Severity || 'Warn' == entry.Severity) {
|
||||
color = '#cc0000';
|
||||
@ -56,8 +66,8 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||
}
|
||||
|
||||
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
||||
var minDate = new Date();
|
||||
var hasUserId = 'false' !== elem.getAttribute('data-useractivity');
|
||||
const minDate = new Date();
|
||||
const hasUserId = 'false' !== elem.getAttribute('data-useractivity');
|
||||
|
||||
if (hasUserId) {
|
||||
minDate.setTime(minDate.getTime() - 24 * 60 * 60 * 1000); // one day back
|
||||
@ -74,7 +84,7 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||
elem.setAttribute('data-activitystartindex', startIndex);
|
||||
elem.setAttribute('data-activitylimit', limit);
|
||||
if (!startIndex) {
|
||||
var activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
||||
const activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
||||
|
||||
if (activityContainer) {
|
||||
if (result.Items.length) {
|
||||
@ -91,7 +101,7 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||
}
|
||||
|
||||
function onActivityLogUpdate(e, apiClient, data) {
|
||||
var options = this.options;
|
||||
const options = this.options;
|
||||
|
||||
if (options && options.serverId === apiClient.serverId()) {
|
||||
reloadData(this, options.element, apiClient);
|
||||
@ -99,14 +109,14 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||
}
|
||||
|
||||
function onListClick(e) {
|
||||
var btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
||||
const btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
||||
|
||||
if (btnEntryInfo) {
|
||||
var id = btnEntryInfo.getAttribute('data-id');
|
||||
var items = this.items;
|
||||
const id = btnEntryInfo.getAttribute('data-id');
|
||||
const items = this.items;
|
||||
|
||||
if (items) {
|
||||
var item = items.filter(function (i) {
|
||||
const item = items.filter(function (i) {
|
||||
return i.Id.toString() === id;
|
||||
})[0];
|
||||
|
||||
@ -118,35 +128,35 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||
}
|
||||
|
||||
function showItemOverview(item) {
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert({
|
||||
text: item.Overview
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function ActivityLog(options) {
|
||||
class ActivityLog {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
var element = options.element;
|
||||
const element = options.element;
|
||||
element.classList.add('activityLogListWidget');
|
||||
element.addEventListener('click', onListClick.bind(this));
|
||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
||||
const apiClient = connectionManager.getApiClient(options.serverId);
|
||||
reloadData(this, element, apiClient);
|
||||
var onUpdate = onActivityLogUpdate.bind(this);
|
||||
const onUpdate = onActivityLogUpdate.bind(this);
|
||||
this.updateFn = onUpdate;
|
||||
events.on(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||
apiClient.sendMessage('ActivityLogEntryStart', '0,1500');
|
||||
}
|
||||
|
||||
ActivityLog.prototype.destroy = function () {
|
||||
var options = this.options;
|
||||
destroy() {
|
||||
const options = this.options;
|
||||
|
||||
if (options) {
|
||||
options.element.classList.remove('activityLogListWidget');
|
||||
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
||||
}
|
||||
|
||||
var onUpdate = this.updateFn;
|
||||
const onUpdate = this.updateFn;
|
||||
|
||||
if (onUpdate) {
|
||||
events.off(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||
@ -154,7 +164,9 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||
|
||||
this.items = null;
|
||||
this.options = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return ActivityLog;
|
||||
});
|
||||
export default ActivityLog;
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,14 +1,17 @@
|
||||
define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
import dialog from 'dialog';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function replaceAll(originalString, strReplace, strWith) {
|
||||
var reg = new RegExp(strReplace, 'ig');
|
||||
const reg = new RegExp(strReplace, 'ig');
|
||||
return originalString.replace(reg, strWith);
|
||||
}
|
||||
|
||||
return function (text, title) {
|
||||
export default function (text, title) {
|
||||
|
||||
var options;
|
||||
let options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
title: title,
|
||||
@ -21,7 +24,7 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||
if (browser.tv && window.alert) {
|
||||
alert(replaceAll(options.text || '', '<br/>', '\n'));
|
||||
} else {
|
||||
var items = [];
|
||||
const items = [];
|
||||
|
||||
items.push({
|
||||
name: globalize.translate('ButtonGotIt'),
|
||||
@ -31,7 +34,7 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||
|
||||
options.buttons = items;
|
||||
|
||||
return dialog(options).then(function (result) {
|
||||
return dialog.show(options).then(function (result) {
|
||||
if (result === 'ok') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
@ -41,5 +44,6 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||
}
|
||||
|
||||
return Promise.resolve();
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,11 +1,22 @@
|
||||
define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-button-light', 'material-icons'], function (focusManager, layoutManager, dom) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
var selectedButtonClass = 'alphaPickerButton-selected';
|
||||
/**
|
||||
* Module alphaPicker.
|
||||
* @module components/alphaPicker/alphaPicker
|
||||
*/
|
||||
|
||||
import focusManager from 'focusManager';
|
||||
import layoutManager from 'layoutManager';
|
||||
import dom from 'dom';
|
||||
import 'css!./style.css';
|
||||
import 'paper-icon-button-light';
|
||||
import 'material-icons';
|
||||
|
||||
const selectedButtonClass = 'alphaPickerButton-selected';
|
||||
|
||||
function focus() {
|
||||
var scope = this;
|
||||
var selected = scope.querySelector('.' + selectedButtonClass);
|
||||
const scope = this;
|
||||
const selected = scope.querySelector(`.${selectedButtonClass}`);
|
||||
|
||||
if (selected) {
|
||||
focusManager.focus(selected);
|
||||
@ -16,7 +27,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
|
||||
function getAlphaPickerButtonClassName(vertical) {
|
||||
|
||||
var alphaPickerButtonClassName = 'alphaPickerButton';
|
||||
let alphaPickerButtonClassName = 'alphaPickerButton';
|
||||
|
||||
if (layoutManager.tv) {
|
||||
alphaPickerButtonClassName += ' alphaPickerButton-tv';
|
||||
@ -30,12 +41,12 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
}
|
||||
|
||||
function getLetterButton(l, vertical) {
|
||||
return '<button data-value="' + l + '" class="' + getAlphaPickerButtonClassName(vertical) + '">' + l + '</button>';
|
||||
return `<button data-value="${l}" class="${getAlphaPickerButtonClassName(vertical)}">${l}</button>`;
|
||||
}
|
||||
|
||||
function mapLetters(letters, vertical) {
|
||||
|
||||
return letters.map(function (l) {
|
||||
return letters.map(l => {
|
||||
return getLetterButton(l, vertical);
|
||||
});
|
||||
}
|
||||
@ -48,26 +59,26 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
element.classList.add('alphaPicker-tv');
|
||||
}
|
||||
|
||||
var vertical = element.classList.contains('alphaPicker-vertical');
|
||||
const vertical = element.classList.contains('alphaPicker-vertical');
|
||||
|
||||
if (!vertical) {
|
||||
element.classList.add('focuscontainer-x');
|
||||
}
|
||||
|
||||
var html = '';
|
||||
var letters;
|
||||
let html = '';
|
||||
let letters;
|
||||
|
||||
var alphaPickerButtonClassName = getAlphaPickerButtonClassName(vertical);
|
||||
const alphaPickerButtonClassName = getAlphaPickerButtonClassName(vertical);
|
||||
|
||||
var rowClassName = 'alphaPickerRow';
|
||||
let rowClassName = 'alphaPickerRow';
|
||||
|
||||
if (vertical) {
|
||||
rowClassName += ' alphaPickerRow-vertical';
|
||||
}
|
||||
|
||||
html += '<div class="' + rowClassName + '">';
|
||||
html += `<div class="${rowClassName}">`;
|
||||
if (options.mode === 'keyboard') {
|
||||
html += '<button data-value=" " is="paper-icon-button-light" class="' + alphaPickerButtonClassName + '"><span class="material-icons alphaPickerButtonIcon space_bar"></span></button>';
|
||||
html += `<button data-value=" " is="paper-icon-button-light" class="${alphaPickerButtonClassName}"><span class="material-icons alphaPickerButtonIcon space_bar"></span></button>`;
|
||||
} else {
|
||||
letters = ['#'];
|
||||
html += mapLetters(letters, vertical).join('');
|
||||
@ -77,11 +88,11 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
html += mapLetters(letters, vertical).join('');
|
||||
|
||||
if (options.mode === 'keyboard') {
|
||||
html += '<button data-value="backspace" is="paper-icon-button-light" class="' + alphaPickerButtonClassName + '"><span class="material-icons alphaPickerButtonIcon backspace"></span></button>';
|
||||
html += `<button data-value="backspace" is="paper-icon-button-light" class="${alphaPickerButtonClassName}"><span class="material-icons alphaPickerButtonIcon backspace"></span></button>`;
|
||||
html += '</div>';
|
||||
|
||||
letters = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9'];
|
||||
html += '<div class="' + rowClassName + '">';
|
||||
html += `<div class="${rowClassName}">`;
|
||||
html += '<br/>';
|
||||
html += mapLetters(letters, vertical).join('');
|
||||
html += '</div>';
|
||||
@ -95,47 +106,47 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
element.focus = focus;
|
||||
}
|
||||
|
||||
function AlphaPicker(options) {
|
||||
export class AlphaPicker {
|
||||
constructor(options) {
|
||||
const self = this;
|
||||
|
||||
var self = this;
|
||||
this.options = options;
|
||||
|
||||
var element = options.element;
|
||||
var itemsContainer = options.itemsContainer;
|
||||
var itemClass = options.itemClass;
|
||||
const element = options.element;
|
||||
const itemsContainer = options.itemsContainer;
|
||||
const itemClass = options.itemClass;
|
||||
|
||||
var itemFocusValue;
|
||||
var itemFocusTimeout;
|
||||
let itemFocusValue;
|
||||
let itemFocusTimeout;
|
||||
|
||||
function onItemFocusTimeout() {
|
||||
itemFocusTimeout = null;
|
||||
self.value(itemFocusValue);
|
||||
}
|
||||
|
||||
var alphaFocusedElement;
|
||||
var alphaFocusTimeout;
|
||||
let alphaFocusedElement;
|
||||
let alphaFocusTimeout;
|
||||
|
||||
function onAlphaFocusTimeout() {
|
||||
|
||||
alphaFocusTimeout = null;
|
||||
|
||||
if (document.activeElement === alphaFocusedElement) {
|
||||
var value = alphaFocusedElement.getAttribute('data-value');
|
||||
const value = alphaFocusedElement.getAttribute('data-value');
|
||||
self.value(value, true);
|
||||
}
|
||||
}
|
||||
|
||||
function onAlphaPickerInKeyboardModeClick(e) {
|
||||
|
||||
var alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||
|
||||
if (alphaPickerButton) {
|
||||
var value = alphaPickerButton.getAttribute('data-value');
|
||||
const value = alphaPickerButton.getAttribute('data-value');
|
||||
|
||||
element.dispatchEvent(new CustomEvent('alphavalueclicked', {
|
||||
cancelable: false,
|
||||
detail: {
|
||||
value: value
|
||||
value
|
||||
}
|
||||
}));
|
||||
}
|
||||
@ -143,14 +154,14 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
|
||||
function onAlphaPickerClick(e) {
|
||||
|
||||
var alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||
|
||||
if (alphaPickerButton) {
|
||||
var value = alphaPickerButton.getAttribute('data-value');
|
||||
const value = alphaPickerButton.getAttribute('data-value');
|
||||
if ((this._currentValue || '').toUpperCase() === value.toUpperCase()) {
|
||||
self.value(null, true);
|
||||
this.value(null, true);
|
||||
} else {
|
||||
self.value(value, true);
|
||||
this.value(value, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -162,7 +173,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
alphaFocusTimeout = null;
|
||||
}
|
||||
|
||||
var alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||
const alphaPickerButton = dom.parentWithClass(e.target, 'alphaPickerButton');
|
||||
|
||||
if (alphaPickerButton) {
|
||||
alphaFocusedElement = alphaPickerButton;
|
||||
@ -172,10 +183,10 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
|
||||
function onItemsFocusIn(e) {
|
||||
|
||||
var item = dom.parentWithClass(e.target, itemClass);
|
||||
const item = dom.parentWithClass(e.target, itemClass);
|
||||
|
||||
if (item) {
|
||||
var prefix = item.getAttribute('data-prefix');
|
||||
const prefix = item.getAttribute('data-prefix');
|
||||
if (prefix && prefix.length) {
|
||||
|
||||
itemFocusValue = prefix[0];
|
||||
@ -187,7 +198,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
}
|
||||
}
|
||||
|
||||
self.enabled = function (enabled) {
|
||||
this.enabled = function (enabled) {
|
||||
|
||||
if (enabled) {
|
||||
|
||||
@ -223,11 +234,11 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
this.visible(true);
|
||||
}
|
||||
|
||||
AlphaPicker.prototype.value = function (value, applyValue) {
|
||||
value(value, applyValue) {
|
||||
|
||||
var element = this.options.element;
|
||||
var btn;
|
||||
var selected;
|
||||
const element = this.options.element;
|
||||
let btn;
|
||||
let selected;
|
||||
|
||||
if (value !== undefined) {
|
||||
if (value != null) {
|
||||
@ -236,12 +247,12 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
this._currentValue = value;
|
||||
|
||||
if (this.options.mode !== 'keyboard') {
|
||||
selected = element.querySelector('.' + selectedButtonClass);
|
||||
selected = element.querySelector(`.${selectedButtonClass}`);
|
||||
|
||||
try {
|
||||
btn = element.querySelector('.alphaPickerButton[data-value=\'' + value + '\']');
|
||||
btn = element.querySelector(`.alphaPickerButton[data-value='${value}']`);
|
||||
} catch (err) {
|
||||
console.error('error in querySelector: ' + err);
|
||||
console.error('error in querySelector:', err);
|
||||
}
|
||||
|
||||
if (btn && btn !== selected) {
|
||||
@ -254,7 +265,7 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
} else {
|
||||
this._currentValue = value;
|
||||
|
||||
selected = element.querySelector('.' + selectedButtonClass);
|
||||
selected = element.querySelector(`.${selectedButtonClass}`);
|
||||
if (selected) {
|
||||
selected.classList.remove(selectedButtonClass);
|
||||
}
|
||||
@ -265,57 +276,58 @@ define(['focusManager', 'layoutManager', 'dom', 'css!./style.css', 'paper-icon-b
|
||||
element.dispatchEvent(new CustomEvent('alphavaluechanged', {
|
||||
cancelable: false,
|
||||
detail: {
|
||||
value: value
|
||||
value
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
return this._currentValue;
|
||||
};
|
||||
}
|
||||
|
||||
AlphaPicker.prototype.on = function (name, fn) {
|
||||
var element = this.options.element;
|
||||
on(name, fn) {
|
||||
const element = this.options.element;
|
||||
element.addEventListener(name, fn);
|
||||
};
|
||||
}
|
||||
|
||||
AlphaPicker.prototype.off = function (name, fn) {
|
||||
var element = this.options.element;
|
||||
off(name, fn) {
|
||||
const element = this.options.element;
|
||||
element.removeEventListener(name, fn);
|
||||
};
|
||||
}
|
||||
|
||||
AlphaPicker.prototype.visible = function (visible) {
|
||||
visible(visible) {
|
||||
|
||||
var element = this.options.element;
|
||||
const element = this.options.element;
|
||||
element.style.visibility = visible ? 'visible' : 'hidden';
|
||||
};
|
||||
}
|
||||
|
||||
AlphaPicker.prototype.values = function () {
|
||||
values() {
|
||||
|
||||
var element = this.options.element;
|
||||
var elems = element.querySelectorAll('.alphaPickerButton');
|
||||
var values = [];
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
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;
|
||||
};
|
||||
}
|
||||
|
||||
AlphaPicker.prototype.focus = function () {
|
||||
focus() {
|
||||
|
||||
var element = this.options.element;
|
||||
const element = this.options.element;
|
||||
focusManager.autoFocus(element, true);
|
||||
};
|
||||
}
|
||||
|
||||
AlphaPicker.prototype.destroy = function () {
|
||||
destroy() {
|
||||
|
||||
var element = this.options.element;
|
||||
const element = this.options.element;
|
||||
this.enabled(false);
|
||||
element.classList.remove('focuscontainer-x');
|
||||
this.options = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return AlphaPicker;
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
export default AlphaPicker;
|
||||
|
@ -1,17 +1,18 @@
|
||||
define(['browser', 'css!./appFooter'], function (browser) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
import 'css!./appFooter';
|
||||
|
||||
function render(options) {
|
||||
var elem = document.createElement('div');
|
||||
function render(options) {
|
||||
const elem = document.createElement('div');
|
||||
elem.classList.add('appfooter');
|
||||
|
||||
document.body.appendChild(elem);
|
||||
|
||||
return elem;
|
||||
}
|
||||
}
|
||||
|
||||
function appFooter(options) {
|
||||
var self = this;
|
||||
class appFooter {
|
||||
constructor(options) {
|
||||
const self = this;
|
||||
|
||||
self.element = render(options);
|
||||
self.add = function (elem) {
|
||||
@ -26,12 +27,11 @@ define(['browser', 'css!./appFooter'], function (browser) {
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
appFooter.prototype.destroy = function () {
|
||||
destroy() {
|
||||
var self = this;
|
||||
|
||||
self.element = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return appFooter;
|
||||
});
|
||||
export default appFooter;
|
||||
|
@ -21,7 +21,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
||||
};
|
||||
|
||||
function beginConnectionWizard() {
|
||||
backdrop.clear();
|
||||
backdrop.clearBackdrop();
|
||||
loading.show();
|
||||
connectionManager.connect({
|
||||
enableAutoLogin: appSettings.enableAutoLogin()
|
||||
@ -53,7 +53,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
||||
break;
|
||||
case 'ServerUpdateNeeded':
|
||||
require(['alert'], function (alert) {
|
||||
alert({
|
||||
alert.default({
|
||||
text: globalize.translate('ServerUpdateNeeded', 'https://github.com/jellyfin/jellyfin'),
|
||||
html: globalize.translate('ServerUpdateNeeded', '<a href="https://github.com/jellyfin/jellyfin">https://github.com/jellyfin/jellyfin</a>')
|
||||
}).then(function () {
|
||||
@ -432,7 +432,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
||||
|
||||
function loadContent(ctx, route, html, request) {
|
||||
|
||||
html = globalize.translateDocument(html, route.dictionary);
|
||||
html = globalize.translateHtml(html, route.dictionary);
|
||||
request.view = html;
|
||||
|
||||
viewManager.loadView(request);
|
||||
@ -624,7 +624,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
||||
}
|
||||
|
||||
if (level === 'full' || level === 2) {
|
||||
backdrop.clear(true);
|
||||
backdrop.clearBackdrop(true);
|
||||
document.documentElement.classList.add('transparentDocument');
|
||||
backgroundContainer.classList.add('backgroundContainer-transparent');
|
||||
backdropContainer.classList.add('hide');
|
||||
|
@ -1,5 +1,11 @@
|
||||
define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings', 'css!./backdrop'], function (browser, connectionManager, playbackManager, dom, userSettings) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
import connectionManager from 'connectionManager';
|
||||
import playbackManager from 'playbackManager';
|
||||
import dom from 'dom';
|
||||
import * as userSettings from 'userSettings';
|
||||
import 'css!./backdrop';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function enableAnimation(elem) {
|
||||
if (browser.slow) {
|
||||
@ -22,22 +28,20 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
return true;
|
||||
}
|
||||
|
||||
function Backdrop() {
|
||||
}
|
||||
class Backdrop {
|
||||
load(url, parent, existingBackdropImage) {
|
||||
const img = new Image();
|
||||
const self = this;
|
||||
|
||||
Backdrop.prototype.load = function (url, parent, existingBackdropImage) {
|
||||
var img = new Image();
|
||||
var self = this;
|
||||
|
||||
img.onload = function () {
|
||||
img.onload = () => {
|
||||
if (self.isDestroyed) {
|
||||
return;
|
||||
}
|
||||
|
||||
var backdropImage = document.createElement('div');
|
||||
const backdropImage = document.createElement('div');
|
||||
backdropImage.classList.add('backdropImage');
|
||||
backdropImage.classList.add('displayingBackdropImage');
|
||||
backdropImage.style.backgroundImage = "url('" + url + "')";
|
||||
backdropImage.style.backgroundImage = `url('${url}')`;
|
||||
backdropImage.setAttribute('data-url', url);
|
||||
|
||||
backdropImage.classList.add('backdropImageFadeIn');
|
||||
@ -51,7 +55,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
return;
|
||||
}
|
||||
|
||||
var onAnimationComplete = function () {
|
||||
const onAnimationComplete = () => {
|
||||
dom.removeEventListener(backdropImage, dom.whichAnimationEvent(), onAnimationComplete, {
|
||||
once: true
|
||||
});
|
||||
@ -71,22 +75,23 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
};
|
||||
|
||||
img.src = url;
|
||||
};
|
||||
}
|
||||
|
||||
Backdrop.prototype.cancelAnimation = function () {
|
||||
var elem = this.currentAnimatingElement;
|
||||
cancelAnimation() {
|
||||
const elem = this.currentAnimatingElement;
|
||||
if (elem) {
|
||||
elem.classList.remove('backdropImageFadeIn');
|
||||
this.currentAnimatingElement = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Backdrop.prototype.destroy = function () {
|
||||
destroy() {
|
||||
this.isDestroyed = true;
|
||||
this.cancelAnimation();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var backdropContainer;
|
||||
let backdropContainer;
|
||||
function getBackdropContainer() {
|
||||
if (!backdropContainer) {
|
||||
backdropContainer = document.querySelector('.backdropContainer');
|
||||
@ -101,7 +106,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
return backdropContainer;
|
||||
}
|
||||
|
||||
function clearBackdrop(clearAll) {
|
||||
export function clearBackdrop(clearAll) {
|
||||
clearRotation();
|
||||
|
||||
if (currentLoadingBackdrop) {
|
||||
@ -109,7 +114,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
currentLoadingBackdrop = null;
|
||||
}
|
||||
|
||||
var elem = getBackdropContainer();
|
||||
const elem = getBackdropContainer();
|
||||
elem.innerHTML = '';
|
||||
|
||||
if (clearAll) {
|
||||
@ -119,7 +124,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
internalBackdrop(false);
|
||||
}
|
||||
|
||||
var backgroundContainer;
|
||||
let backgroundContainer;
|
||||
function getBackgroundContainer() {
|
||||
if (!backgroundContainer) {
|
||||
backgroundContainer = document.querySelector('.backgroundContainer');
|
||||
@ -135,31 +140,27 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
}
|
||||
}
|
||||
|
||||
var hasInternalBackdrop;
|
||||
let hasInternalBackdrop;
|
||||
function internalBackdrop(enabled) {
|
||||
hasInternalBackdrop = enabled;
|
||||
setBackgroundContainerBackgroundEnabled();
|
||||
}
|
||||
|
||||
var hasExternalBackdrop;
|
||||
function externalBackdrop(enabled) {
|
||||
let hasExternalBackdrop;
|
||||
export function externalBackdrop(enabled) {
|
||||
hasExternalBackdrop = enabled;
|
||||
setBackgroundContainerBackgroundEnabled();
|
||||
}
|
||||
|
||||
function getRandom(min, max) {
|
||||
return Math.floor(Math.random() * (max - min) + min);
|
||||
}
|
||||
|
||||
var currentLoadingBackdrop;
|
||||
let currentLoadingBackdrop;
|
||||
function setBackdropImage(url) {
|
||||
if (currentLoadingBackdrop) {
|
||||
currentLoadingBackdrop.destroy();
|
||||
currentLoadingBackdrop = null;
|
||||
}
|
||||
|
||||
var elem = getBackdropContainer();
|
||||
var existingBackdropImage = elem.querySelector('.displayingBackdropImage');
|
||||
const elem = getBackdropContainer();
|
||||
const existingBackdropImage = elem.querySelector('.displayingBackdropImage');
|
||||
|
||||
if (existingBackdropImage && existingBackdropImage.getAttribute('data-url') === url) {
|
||||
if (existingBackdropImage.getAttribute('data-url') === url) {
|
||||
@ -168,7 +169,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
existingBackdropImage.classList.remove('displayingBackdropImage');
|
||||
}
|
||||
|
||||
var instance = new Backdrop();
|
||||
const instance = new Backdrop();
|
||||
instance.load(url, elem, existingBackdropImage);
|
||||
currentLoadingBackdrop = instance;
|
||||
}
|
||||
@ -176,9 +177,9 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
function getItemImageUrls(item, imageOptions) {
|
||||
imageOptions = imageOptions || {};
|
||||
|
||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
if (item.BackdropImageTags && item.BackdropImageTags.length > 0) {
|
||||
return item.BackdropImageTags.map(function (imgTag, index) {
|
||||
return item.BackdropImageTags.map((imgTag, index) => {
|
||||
return apiClient.getScaledImageUrl(item.BackdropItemId || item.Id, Object.assign(imageOptions, {
|
||||
type: 'Backdrop',
|
||||
tag: imgTag,
|
||||
@ -189,7 +190,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
}
|
||||
|
||||
if (item.ParentBackdropItemId && item.ParentBackdropImageTags && item.ParentBackdropImageTags.length) {
|
||||
return item.ParentBackdropImageTags.map(function (imgTag, index) {
|
||||
return item.ParentBackdropImageTags.map((imgTag, index) => {
|
||||
return apiClient.getScaledImageUrl(item.ParentBackdropItemId, Object.assign(imageOptions, {
|
||||
type: 'Backdrop',
|
||||
tag: imgTag,
|
||||
@ -203,13 +204,13 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
}
|
||||
|
||||
function getImageUrls(items, imageOptions) {
|
||||
var list = [];
|
||||
var onImg = function (img) {
|
||||
const list = [];
|
||||
const onImg = img => {
|
||||
list.push(img);
|
||||
};
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var itemImages = getItemImageUrls(items[i], imageOptions);
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
const itemImages = getItemImageUrls(items[i], imageOptions);
|
||||
itemImages.forEach(onImg);
|
||||
}
|
||||
|
||||
@ -229,7 +230,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
|
||||
// If you don't care about the order of the elements inside
|
||||
// the array, you should sort both arrays here.
|
||||
for (var i = 0; i < a.length; ++i) {
|
||||
for (let i = 0; i < a.length; ++i) {
|
||||
if (a[i] !== b[i]) {
|
||||
return false;
|
||||
}
|
||||
@ -242,12 +243,12 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
return userSettings.enableBackdrops();
|
||||
}
|
||||
|
||||
var rotationInterval;
|
||||
var currentRotatingImages = [];
|
||||
var currentRotationIndex = -1;
|
||||
function setBackdrops(items, imageOptions, enableImageRotation) {
|
||||
let rotationInterval;
|
||||
let currentRotatingImages = [];
|
||||
let currentRotationIndex = -1;
|
||||
export function setBackdrops(items, imageOptions, enableImageRotation) {
|
||||
if (enabled()) {
|
||||
var images = getImageUrls(items, imageOptions);
|
||||
const images = getImageUrls(items, imageOptions);
|
||||
|
||||
if (images.length) {
|
||||
startRotation(images, enableImageRotation);
|
||||
@ -279,7 +280,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
return;
|
||||
}
|
||||
|
||||
var newIndex = currentRotationIndex + 1;
|
||||
let newIndex = currentRotationIndex + 1;
|
||||
if (newIndex >= currentRotatingImages.length) {
|
||||
newIndex = 0;
|
||||
}
|
||||
@ -289,7 +290,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
}
|
||||
|
||||
function clearRotation() {
|
||||
var interval = rotationInterval;
|
||||
const interval = rotationInterval;
|
||||
if (interval) {
|
||||
clearInterval(interval);
|
||||
}
|
||||
@ -299,7 +300,7 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
currentRotationIndex = -1;
|
||||
}
|
||||
|
||||
function setBackdrop(url, imageOptions) {
|
||||
export function setBackdrop(url, imageOptions) {
|
||||
if (url && typeof url !== 'string') {
|
||||
url = getImageUrls([url], imageOptions)[0];
|
||||
}
|
||||
@ -312,10 +313,11 @@ define(['browser', 'connectionManager', 'playbackManager', 'dom', 'userSettings'
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
/* eslint-enable indent */
|
||||
|
||||
export default {
|
||||
setBackdrops: setBackdrops,
|
||||
setBackdrop: setBackdrop,
|
||||
clear: clearBackdrop,
|
||||
clearBackdrop: clearBackdrop,
|
||||
externalBackdrop: externalBackdrop
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -1160,10 +1160,10 @@ import 'programStyles';
|
||||
/**
|
||||
* Imports the refresh indicator element.
|
||||
*/
|
||||
function requireRefreshIndicator() {
|
||||
function importRefreshIndicator() {
|
||||
if (!refreshIndicatorLoaded) {
|
||||
refreshIndicatorLoaded = true;
|
||||
require(['emby-itemrefreshindicator']);
|
||||
import('emby-itemrefreshindicator');
|
||||
}
|
||||
}
|
||||
|
||||
@ -1415,7 +1415,7 @@ import 'programStyles';
|
||||
if (item.Type === 'CollectionFolder' || item.CollectionType) {
|
||||
const refreshClass = item.RefreshProgress ? '' : ' class="hide"';
|
||||
indicatorsHtml += '<div is="emby-itemrefreshindicator"' + refreshClass + ' data-progress="' + (item.RefreshProgress || 0) + '" data-status="' + item.RefreshStatus + '"></div>';
|
||||
requireRefreshIndicator();
|
||||
importRefreshIndicator();
|
||||
}
|
||||
|
||||
if (indicatorsHtml) {
|
||||
@ -1498,7 +1498,7 @@ import 'programStyles';
|
||||
const userData = item.UserData || {};
|
||||
|
||||
if (itemHelper.canMarkPlayed(item)) {
|
||||
require(['emby-playstatebutton']);
|
||||
import('emby-playstatebutton');
|
||||
html += '<button is="emby-playstatebutton" type="button" data-action="none" class="' + btnCssClass + '" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-played="' + (userData.Played) + '"><span class="material-icons cardOverlayButtonIcon cardOverlayButtonIcon-hover check"></span></button>';
|
||||
}
|
||||
|
||||
@ -1506,7 +1506,7 @@ import 'programStyles';
|
||||
|
||||
const likes = userData.Likes == null ? '' : userData.Likes;
|
||||
|
||||
require(['emby-ratingbutton']);
|
||||
import('emby-ratingbutton');
|
||||
html += '<button is="emby-ratingbutton" type="button" data-action="none" class="' + btnCssClass + '" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-likes="' + likes + '" data-isfavorite="' + (userData.IsFavorite) + '"><span class="material-icons cardOverlayButtonIcon cardOverlayButtonIcon-hover favorite"></span></button>';
|
||||
}
|
||||
|
||||
|
@ -1,10 +1,21 @@
|
||||
define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'actionsheet', 'emby-input', 'paper-icon-button-light', 'emby-button', 'listViewStyle', 'material-icons', 'formDialogStyle'], function (dom, dialogHelper, loading, connectionManager, globalize, actionsheet) {
|
||||
'use strict';
|
||||
import dom from 'dom';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import loading from 'loading';
|
||||
import connectionManager from 'connectionManager';
|
||||
import globalize from 'globalize';
|
||||
import actionsheet from 'actionsheet';
|
||||
import 'emby-input';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-button';
|
||||
import 'listViewStyle';
|
||||
import 'material-icons';
|
||||
import 'formDialogStyle';
|
||||
|
||||
return function (options) {
|
||||
export default class channelMapper {
|
||||
constructor(options) {
|
||||
function mapChannel(button, channelId, providerChannelId) {
|
||||
loading.show();
|
||||
var providerId = options.providerId;
|
||||
const providerId = options.providerId;
|
||||
connectionManager.getApiClient(options.serverId).ajax({
|
||||
type: 'POST',
|
||||
url: ApiClient.getUrl('LiveTv/ChannelMappings'),
|
||||
@ -14,8 +25,8 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||
providerChannelId: providerChannelId
|
||||
},
|
||||
dataType: 'json'
|
||||
}).then(function (mapping) {
|
||||
var listItem = dom.parentWithClass(button, 'listItem');
|
||||
}).then(mapping => {
|
||||
const listItem = dom.parentWithClass(button, 'listItem');
|
||||
button.setAttribute('data-providerid', mapping.ProviderChannelId);
|
||||
listItem.querySelector('.secondary').innerHTML = getMappingSecondaryName(mapping, currentMappingOptions.ProviderName);
|
||||
loading.hide();
|
||||
@ -23,42 +34,42 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||
}
|
||||
|
||||
function onChannelsElementClick(e) {
|
||||
var btnMap = dom.parentWithClass(e.target, 'btnMap');
|
||||
const btnMap = dom.parentWithClass(e.target, 'btnMap');
|
||||
|
||||
if (btnMap) {
|
||||
var channelId = btnMap.getAttribute('data-id');
|
||||
var providerChannelId = btnMap.getAttribute('data-providerid');
|
||||
var menuItems = currentMappingOptions.ProviderChannels.map(function (m) {
|
||||
const channelId = btnMap.getAttribute('data-id');
|
||||
const providerChannelId = btnMap.getAttribute('data-providerid');
|
||||
const menuItems = currentMappingOptions.ProviderChannels.map(m => {
|
||||
return {
|
||||
name: m.Name,
|
||||
id: m.Id,
|
||||
selected: m.Id.toLowerCase() === providerChannelId.toLowerCase()
|
||||
};
|
||||
}).sort(function (a, b) {
|
||||
}).sort((a, b) => {
|
||||
return a.name.localeCompare(b.name);
|
||||
});
|
||||
actionsheet.show({
|
||||
positionTo: btnMap,
|
||||
items: menuItems
|
||||
}).then(function (newChannelId) {
|
||||
}).then(newChannelId => {
|
||||
mapChannel(btnMap, channelId, newChannelId);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function getChannelMappingOptions(serverId, providerId) {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getJSON(apiClient.getUrl('LiveTv/ChannelMappingOptions', {
|
||||
providerId: providerId
|
||||
}));
|
||||
}
|
||||
|
||||
function getMappingSecondaryName(mapping, providerName) {
|
||||
return (mapping.ProviderChannelName || '') + ' - ' + providerName;
|
||||
return `${mapping.ProviderChannelName || ''} - ${providerName}`;
|
||||
}
|
||||
|
||||
function getTunerChannelHtml(channel, providerName) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<div class="listItem">';
|
||||
html += '<span class="material-icons listItemIcon dvr"></span>';
|
||||
html += '<div class="listItemBody two-line">';
|
||||
@ -73,16 +84,16 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
html += '<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-id="' + channel.Id + '" data-providerid="' + channel.ProviderChannelId + '"><span class="material-icons mode_edit"></span></button>';
|
||||
html += `<button class="btnMap autoSize" is="paper-icon-button-light" type="button" data-id="${channel.Id}" data-providerid="${channel.ProviderChannelId}"><span class="material-icons mode_edit"></span></button>`;
|
||||
return html += '</div>';
|
||||
}
|
||||
|
||||
function getEditorHtml() {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<div class="formDialogContent smoothScrollY">';
|
||||
html += '<div class="dialogContentInner dialog-content-centered">';
|
||||
html += '<form style="margin:auto;">';
|
||||
html += '<h1>' + globalize.translate('HeaderChannels') + '</h1>';
|
||||
html += `<h1>${globalize.translate('HeaderChannels')}</h1>`;
|
||||
html += '<div class="channels paperList">';
|
||||
html += '</div>';
|
||||
html += '</form>';
|
||||
@ -91,30 +102,29 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||
}
|
||||
|
||||
function initEditor(dlg, options) {
|
||||
getChannelMappingOptions(options.serverId, options.providerId).then(function (result) {
|
||||
getChannelMappingOptions(options.serverId, options.providerId).then(result => {
|
||||
currentMappingOptions = result;
|
||||
var channelsElement = dlg.querySelector('.channels');
|
||||
channelsElement.innerHTML = result.TunerChannels.map(function (channel) {
|
||||
const channelsElement = dlg.querySelector('.channels');
|
||||
channelsElement.innerHTML = result.TunerChannels.map(channel => {
|
||||
return getTunerChannelHtml(channel, result.ProviderName);
|
||||
}).join('');
|
||||
channelsElement.addEventListener('click', onChannelsElementClick);
|
||||
});
|
||||
}
|
||||
|
||||
var currentMappingOptions;
|
||||
var self = this;
|
||||
let currentMappingOptions;
|
||||
|
||||
self.show = function () {
|
||||
var dialogOptions = {
|
||||
this.show = () => {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true
|
||||
};
|
||||
dialogOptions.size = 'small';
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.classList.add('ui-body-a');
|
||||
dlg.classList.add('background-theme-a');
|
||||
var html = '';
|
||||
var title = globalize.translate('MapChannels');
|
||||
let html = '';
|
||||
const title = globalize.translate('MapChannels');
|
||||
html += '<div class="formDialogHeader">';
|
||||
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||
html += '<h3 class="formDialogHeaderTitle">';
|
||||
@ -124,13 +134,13 @@ define(['dom', 'dialogHelper', 'loading', 'connectionManager', 'globalize', 'act
|
||||
html += getEditorHtml();
|
||||
dlg.innerHTML = html;
|
||||
initEditor(dlg, options);
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(resolve => {
|
||||
dlg.addEventListener('close', resolve);
|
||||
dialogHelper.open(dlg);
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -1,16 +1,32 @@
|
||||
define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectionManager', 'appRouter', 'globalize', 'emby-checkbox', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button', 'flexStyles'], function (dom, dialogHelper, loading, appHost, layoutManager, connectionManager, appRouter, globalize) {
|
||||
'use strict';
|
||||
import dom from 'dom';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import loading from 'loading';
|
||||
import appHost from 'apphost';
|
||||
import layoutManager from 'layoutManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import appRouter from 'appRouter';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-input';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-select';
|
||||
import 'material-icons';
|
||||
import 'css!./../formdialog';
|
||||
import 'emby-button';
|
||||
import 'flexStyles';
|
||||
|
||||
var currentServerId;
|
||||
/* eslint-disable indent */
|
||||
|
||||
let currentServerId;
|
||||
|
||||
function onSubmit(e) {
|
||||
loading.show();
|
||||
|
||||
var panel = dom.parentWithClass(this, 'dialog');
|
||||
const panel = dom.parentWithClass(this, 'dialog');
|
||||
|
||||
var collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
||||
const collectionId = panel.querySelector('#selectCollectionToAddTo').value;
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
||||
|
||||
if (collectionId) {
|
||||
addToCollection(apiClient, panel, collectionId);
|
||||
@ -24,7 +40,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
|
||||
function createCollection(apiClient, dlg) {
|
||||
|
||||
var url = apiClient.getUrl('Collections', {
|
||||
const url = apiClient.getUrl('Collections', {
|
||||
|
||||
Name: dlg.querySelector('#txtNewCollectionName').value,
|
||||
IsLocked: !dlg.querySelector('#chkEnableInternetMetadata').checked,
|
||||
@ -36,11 +52,11 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
url: url,
|
||||
dataType: 'json'
|
||||
|
||||
}).then(function (result) {
|
||||
}).then(result => {
|
||||
|
||||
loading.hide();
|
||||
|
||||
var id = result.Id;
|
||||
const id = result.Id;
|
||||
|
||||
dlg.submitted = true;
|
||||
dialogHelper.close(dlg);
|
||||
@ -56,7 +72,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
|
||||
function addToCollection(apiClient, dlg, id) {
|
||||
|
||||
var url = apiClient.getUrl('Collections/' + id + '/Items', {
|
||||
const url = apiClient.getUrl(`Collections/${id}/Items`, {
|
||||
|
||||
Ids: dlg.querySelector('.fldSelectedItemIds').value || ''
|
||||
});
|
||||
@ -65,14 +81,14 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
type: 'POST',
|
||||
url: url
|
||||
|
||||
}).then(function () {
|
||||
}).then(() => {
|
||||
|
||||
loading.hide();
|
||||
|
||||
dlg.submitted = true;
|
||||
dialogHelper.close(dlg);
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('MessageItemsAdded'));
|
||||
});
|
||||
});
|
||||
@ -86,11 +102,11 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
|
||||
loading.show();
|
||||
|
||||
var select = panel.querySelector('#selectCollectionToAddTo');
|
||||
const select = panel.querySelector('#selectCollectionToAddTo');
|
||||
|
||||
panel.querySelector('.newCollectionInfo').classList.add('hide');
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
|
||||
Recursive: true,
|
||||
IncludeItemTypes: 'BoxSet',
|
||||
@ -98,16 +114,16 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
EnableTotalRecordCount: false
|
||||
};
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<option value="">' + globalize.translate('OptionNew') + '</option>';
|
||||
html += `<option value="">${globalize.translate('OptionNew')}</option>`;
|
||||
|
||||
html += result.Items.map(function (i) {
|
||||
html += result.Items.map(i => {
|
||||
|
||||
return '<option value="' + i.Id + '">' + i.Name + '</option>';
|
||||
return `<option value="${i.Id}">${i.Name}</option>`;
|
||||
});
|
||||
|
||||
select.innerHTML = html;
|
||||
@ -120,7 +136,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
|
||||
function getEditorHtml() {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<div class="formDialogContent smoothScrollY" style="padding-top:2em;">';
|
||||
html += '<div class="dialogContentInner dialog-content-centered">';
|
||||
@ -134,27 +150,27 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
html += '<br/>';
|
||||
html += '<br/>';
|
||||
html += '<div class="selectContainer">';
|
||||
html += '<select is="emby-select" label="' + globalize.translate('LabelCollection') + '" id="selectCollectionToAddTo" autofocus></select>';
|
||||
html += `<select is="emby-select" label="${globalize.translate('LabelCollection')}" id="selectCollectionToAddTo" autofocus></select>`;
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="newCollectionInfo">';
|
||||
|
||||
html += '<div class="inputContainer">';
|
||||
html += '<input is="emby-input" type="text" id="txtNewCollectionName" required="required" label="' + globalize.translate('LabelName') + '" />';
|
||||
html += '<div class="fieldDescription">' + globalize.translate('NewCollectionNameExample') + '</div>';
|
||||
html += `<input is="emby-input" type="text" id="txtNewCollectionName" required="required" label="${globalize.translate('LabelName')}" />`;
|
||||
html += `<div class="fieldDescription">${globalize.translate('NewCollectionNameExample')}</div>`;
|
||||
html += '</div>';
|
||||
|
||||
html += '<label class="checkboxContainer">';
|
||||
html += '<input is="emby-checkbox" type="checkbox" id="chkEnableInternetMetadata" />';
|
||||
html += '<span>' + globalize.translate('SearchForCollectionInternetMetadata') + '</span>';
|
||||
html += `<span>${globalize.translate('SearchForCollectionInternetMetadata')}</span>`;
|
||||
html += '</label>';
|
||||
|
||||
// newCollectionInfo
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="formDialogFooter">';
|
||||
html += '<button is="emby-button" type="submit" class="raised btnSubmit block formDialogFooterItem button-submit">' + globalize.translate('ButtonOk') + '</button>';
|
||||
html += `<button is="emby-button" type="submit" class="raised btnSubmit block formDialogFooterItem button-submit">${globalize.translate('ButtonOk')}</button>`;
|
||||
html += '</div>';
|
||||
|
||||
html += '<input type="hidden" class="fldSelectedItemIds" />';
|
||||
@ -188,7 +204,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
} else {
|
||||
content.querySelector('.fldSelectCollection').classList.add('hide');
|
||||
|
||||
var selectCollectionToAddTo = content.querySelector('#selectCollectionToAddTo');
|
||||
const selectCollectionToAddTo = content.querySelector('#selectCollectionToAddTo');
|
||||
selectCollectionToAddTo.innerHTML = '';
|
||||
selectCollectionToAddTo.value = '';
|
||||
triggerChange(selectCollectionToAddTo);
|
||||
@ -196,22 +212,19 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
}
|
||||
|
||||
function centerFocus(elem, horiz, on) {
|
||||
require(['scrollHelper'], function (scrollHelper) {
|
||||
var fn = on ? 'on' : 'off';
|
||||
import('scrollHelper').then(scrollHelper => {
|
||||
const fn = on ? 'on' : 'off';
|
||||
scrollHelper.centerFocus[fn](elem, horiz);
|
||||
});
|
||||
}
|
||||
|
||||
function CollectionEditor() {
|
||||
export class showEditor {
|
||||
constructor(options) {
|
||||
|
||||
}
|
||||
|
||||
CollectionEditor.prototype.show = function (options) {
|
||||
|
||||
var items = options.items || {};
|
||||
const items = options.items || {};
|
||||
currentServerId = options.serverId;
|
||||
|
||||
var dialogOptions = {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
};
|
||||
@ -222,12 +235,12 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
dialogOptions.size = 'small';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
var title = items.length ? globalize.translate('HeaderAddToCollection') : globalize.translate('NewCollection');
|
||||
let html = '';
|
||||
const title = items.length ? globalize.translate('HeaderAddToCollection') : globalize.translate('NewCollection');
|
||||
|
||||
html += '<div class="formDialogHeader">';
|
||||
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||
@ -236,7 +249,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
html += '</h3>';
|
||||
|
||||
if (appHost.supports('externallinks')) {
|
||||
html += '<a is="emby-linkbutton" class="button-link btnHelp flex align-items-center" href="https://web.archive.org/web/20181216120305/https://github.com/MediaBrowser/Wiki/wiki/Collections" target="_blank" style="margin-left:auto;margin-right:.5em;padding:.25em;" title="' + globalize.translate('Help') + '"><span class="material-icons info"></span><span style="margin-left:.25em;">' + globalize.translate('Help') + '</span></a>';
|
||||
html += `<a is="emby-linkbutton" class="button-link btnHelp flex align-items-center" href="https://web.archive.org/web/20181216120305/https://github.com/MediaBrowser/Wiki/wiki/Collections" target="_blank" style="margin-left:auto;margin-right:.5em;padding:.25em;" title="${globalize.translate('Help')}"><span class="material-icons info"></span><span style="margin-left:.25em;">${globalize.translate('Help')}</span></a>`;
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
@ -247,7 +260,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
|
||||
initEditor(dlg, items);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
@ -256,7 +269,7 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
||||
}
|
||||
|
||||
return dialogHelper.open(dlg).then(function () {
|
||||
return dialogHelper.open(dlg).then(() => {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||
@ -268,7 +281,8 @@ define(['dom', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'connectio
|
||||
|
||||
return Promise.reject();
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return CollectionEditor;
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
export default showEditor;
|
||||
|
@ -1,5 +1,9 @@
|
||||
define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
import dialog from 'dialog';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
export default (() => {
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.split(find).join(replace);
|
||||
@ -7,7 +11,7 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||
|
||||
if (browser.tv && window.confirm) {
|
||||
// Use the native confirm dialog
|
||||
return function (options) {
|
||||
return options => {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
@ -15,8 +19,8 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||
};
|
||||
}
|
||||
|
||||
var text = replaceAll(options.text || '', '<br/>', '\n');
|
||||
var result = confirm(text);
|
||||
const text = replaceAll(options.text || '', '<br/>', '\n');
|
||||
const result = confirm(text);
|
||||
|
||||
if (result) {
|
||||
return Promise.resolve();
|
||||
@ -26,8 +30,8 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||
};
|
||||
} else {
|
||||
// Use our own dialog
|
||||
return function (text, title) {
|
||||
var options;
|
||||
return (text, title) => {
|
||||
let options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
title: title,
|
||||
@ -37,7 +41,7 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||
options = text;
|
||||
}
|
||||
|
||||
var items = [];
|
||||
const items = [];
|
||||
|
||||
items.push({
|
||||
name: options.cancelText || globalize.translate('ButtonCancel'),
|
||||
@ -53,7 +57,7 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||
|
||||
options.buttons = items;
|
||||
|
||||
return dialog(options).then(function (result) {
|
||||
return dialog.show(options).then(result => {
|
||||
if (result === 'ok') {
|
||||
return Promise.resolve();
|
||||
}
|
||||
@ -62,4 +66,5 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
})();
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,20 +1,31 @@
|
||||
define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 'require', 'material-icons', 'emby-button', 'paper-icon-button-light', 'emby-input', 'formDialogStyle', 'flexStyles'], function (dialogHelper, dom, layoutManager, scrollHelper, globalize, require) {
|
||||
'use strict';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import dom from 'dom';
|
||||
import layoutManager from 'layoutManager';
|
||||
import scrollHelper from 'scrollHelper';
|
||||
import globalize from 'globalize';
|
||||
import 'material-icons';
|
||||
import 'emby-button';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-input';
|
||||
import 'formDialogStyle';
|
||||
import 'flexStyles';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function showDialog(options, template) {
|
||||
|
||||
var dialogOptions = {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
};
|
||||
|
||||
var enableTvLayout = layoutManager.tv;
|
||||
const enableTvLayout = layoutManager.tv;
|
||||
|
||||
if (enableTvLayout) {
|
||||
dialogOptions.size = 'fullscreen';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
@ -22,7 +33,7 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||
|
||||
dlg.classList.add('align-items-center');
|
||||
dlg.classList.add('justify-content-center');
|
||||
var formDialogContent = dlg.querySelector('.formDialogContent');
|
||||
const formDialogContent = dlg.querySelector('.formDialogContent');
|
||||
formDialogContent.classList.add('no-grow');
|
||||
|
||||
if (enableTvLayout) {
|
||||
@ -30,7 +41,7 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||
formDialogContent.style['max-height'] = '60%';
|
||||
scrollHelper.centerFocus.on(formDialogContent, false);
|
||||
} else {
|
||||
formDialogContent.style.maxWidth = (Math.min((options.buttons.length * 150) + 200, dom.getWindowSize().innerWidth - 50)) + 'px';
|
||||
formDialogContent.style.maxWidth = `${Math.min((options.buttons.length * 150) + 200, dom.getWindowSize().innerWidth - 50)}px`;
|
||||
dlg.classList.add('dialog-fullscreen-lowres');
|
||||
}
|
||||
|
||||
@ -44,27 +55,27 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||
dlg.querySelector('.formDialogHeaderTitle').classList.add('hide');
|
||||
}
|
||||
|
||||
var displayText = options.html || options.text || '';
|
||||
const displayText = options.html || options.text || '';
|
||||
dlg.querySelector('.text').innerHTML = displayText;
|
||||
|
||||
if (!displayText) {
|
||||
dlg.querySelector('.dialogContentInner').classList.add('hide');
|
||||
}
|
||||
|
||||
var i;
|
||||
var length;
|
||||
var html = '';
|
||||
var hasDescriptions = false;
|
||||
let i;
|
||||
let length;
|
||||
let html = '';
|
||||
let hasDescriptions = false;
|
||||
|
||||
for (i = 0, length = options.buttons.length; i < length; i++) {
|
||||
|
||||
var item = options.buttons[i];
|
||||
var autoFocus = i === 0 ? ' autofocus' : '';
|
||||
const item = options.buttons[i];
|
||||
const autoFocus = i === 0 ? ' autofocus' : '';
|
||||
|
||||
var buttonClass = 'btnOption raised formDialogFooterItem formDialogFooterItem-autosize';
|
||||
let buttonClass = 'btnOption raised formDialogFooterItem formDialogFooterItem-autosize';
|
||||
|
||||
if (item.type) {
|
||||
buttonClass += ' button-' + item.type;
|
||||
buttonClass += ` button-${item.type}`;
|
||||
}
|
||||
|
||||
if (item.description) {
|
||||
@ -75,10 +86,10 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||
buttonClass += ' formDialogFooterItem-vertical formDialogFooterItem-nomarginbottom';
|
||||
}
|
||||
|
||||
html += '<button is="emby-button" type="button" class="' + buttonClass + '" data-id="' + item.id + '"' + autoFocus + '>' + item.name + '</button>';
|
||||
html += `<button is="emby-button" type="button" class="${buttonClass}" data-id="${item.id}"${autoFocus}>${item.name}</button>`;
|
||||
|
||||
if (item.description) {
|
||||
html += '<div class="formDialogFooterItem formDialogFooterItem-autosize fieldDescription" style="margin-top:.25em!important;margin-bottom:1.25em!important;">' + item.description + '</div>';
|
||||
html += `<div class="formDialogFooterItem formDialogFooterItem-autosize fieldDescription" style="margin-top:.25em!important;margin-bottom:1.25em!important;">${item.description}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,18 +99,18 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||
dlg.querySelector('.formDialogFooter').classList.add('formDialogFooter-vertical');
|
||||
}
|
||||
|
||||
var dialogResult;
|
||||
let dialogResult;
|
||||
function onButtonClick() {
|
||||
dialogResult = this.getAttribute('data-id');
|
||||
dialogHelper.close(dlg);
|
||||
}
|
||||
|
||||
var buttons = dlg.querySelectorAll('.btnOption');
|
||||
const buttons = dlg.querySelectorAll('.btnOption');
|
||||
for (i = 0, length = buttons.length; i < length; i++) {
|
||||
buttons[i].addEventListener('click', onButtonClick);
|
||||
}
|
||||
|
||||
return dialogHelper.open(dlg).then(function () {
|
||||
return dialogHelper.open(dlg).then(() => {
|
||||
|
||||
if (enableTvLayout) {
|
||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||
@ -113,9 +124,9 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||
});
|
||||
}
|
||||
|
||||
return function (text, title) {
|
||||
export async function show(text, title) {
|
||||
|
||||
var options;
|
||||
let options;
|
||||
if (typeof text === 'string') {
|
||||
options = {
|
||||
title: title,
|
||||
@ -125,10 +136,13 @@ define(['dialogHelper', 'dom', 'layoutManager', 'scrollHelper', 'globalize', 're
|
||||
options = text;
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(['text!./dialog.template.html'], function (template) {
|
||||
const { default: template } = await import('text!./dialog.template.html');
|
||||
return new Promise((resolve, reject) => {
|
||||
showDialog(options, template).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default {
|
||||
show: show
|
||||
};
|
||||
|
@ -1,7 +1,15 @@
|
||||
define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager', 'dom', 'css!./dialoghelper.css', 'scrollStyles'], function (appRouter, focusManager, browser, layoutManager, inputManager, dom) {
|
||||
'use strict';
|
||||
import appRouter from 'appRouter';
|
||||
import focusManager from 'focusManager';
|
||||
import browser from 'browser';
|
||||
import layoutManager from 'layoutManager';
|
||||
import inputManager from 'inputManager';
|
||||
import dom from 'dom';
|
||||
import 'css!./dialoghelper.css';
|
||||
import 'scrollStyles';
|
||||
|
||||
var globalOnOpenCallback;
|
||||
/* eslint-disable indent */
|
||||
|
||||
let globalOnOpenCallback;
|
||||
|
||||
function enableAnimation() {
|
||||
|
||||
@ -25,7 +33,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
}
|
||||
|
||||
function tryRemoveElement(elem) {
|
||||
var parentNode = elem.parentNode;
|
||||
const parentNode = elem.parentNode;
|
||||
if (parentNode) {
|
||||
|
||||
// Seeing crashes in edge webview
|
||||
@ -39,14 +47,14 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
function DialogHashHandler(dlg, hash, resolve) {
|
||||
|
||||
var self = this;
|
||||
const self = this;
|
||||
self.originalUrl = window.location.href;
|
||||
var activeElement = document.activeElement;
|
||||
var removeScrollLockOnClose = false;
|
||||
const activeElement = document.activeElement;
|
||||
let removeScrollLockOnClose = false;
|
||||
|
||||
function onHashChange(e) {
|
||||
|
||||
var isBack = self.originalUrl === window.location.href;
|
||||
const isBack = self.originalUrl === window.location.href;
|
||||
|
||||
if (isBack || !isOpened(dlg)) {
|
||||
window.removeEventListener('popstate', onHashChange);
|
||||
@ -84,7 +92,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
}
|
||||
|
||||
if (!self.closedByBack && isHistoryEnabled(dlg)) {
|
||||
var state = history.state || {};
|
||||
const state = history.state || {};
|
||||
if (state.dialogId === hash) {
|
||||
history.back();
|
||||
}
|
||||
@ -97,7 +105,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
if (dlg.getAttribute('data-removeonclose') !== 'false') {
|
||||
removeCenterFocus(dlg);
|
||||
|
||||
var dialogContainer = dlg.dialogContainer;
|
||||
const dialogContainer = dlg.dialogContainer;
|
||||
if (dialogContainer) {
|
||||
tryRemoveElement(dialogContainer);
|
||||
dlg.dialogContainer = null;
|
||||
@ -108,7 +116,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
//resolve();
|
||||
// if we just called history.back(), then use a timeout to allow the history events to fire first
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
resolve({
|
||||
element: dlg,
|
||||
closedByBack: self.closedByBack
|
||||
@ -118,7 +126,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
dlg.addEventListener('close', onDialogClosed);
|
||||
|
||||
var center = !dlg.classList.contains('dialog-fixedSize');
|
||||
const center = !dlg.classList.contains('dialog-fixedSize');
|
||||
if (center) {
|
||||
dlg.classList.add('centeredDialog');
|
||||
}
|
||||
@ -141,7 +149,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
animateDialogOpen(dlg);
|
||||
|
||||
if (isHistoryEnabled(dlg)) {
|
||||
appRouter.pushState({ dialogId: hash }, 'Dialog', '#' + hash);
|
||||
appRouter.pushState({ dialogId: hash }, 'Dialog', `#${hash}`);
|
||||
|
||||
window.addEventListener('popstate', onHashChange);
|
||||
} else {
|
||||
@ -151,10 +159,10 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
function addBackdropOverlay(dlg) {
|
||||
|
||||
var backdrop = document.createElement('div');
|
||||
const backdrop = document.createElement('div');
|
||||
backdrop.classList.add('dialogBackdrop');
|
||||
|
||||
var backdropParent = dlg.dialogContainer || dlg;
|
||||
const backdropParent = dlg.dialogContainer || dlg;
|
||||
backdropParent.parentNode.insertBefore(backdrop, backdropParent);
|
||||
dlg.backdrop = backdrop;
|
||||
|
||||
@ -162,7 +170,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
void backdrop.offsetWidth;
|
||||
backdrop.classList.add('dialogBackdropOpened');
|
||||
|
||||
dom.addEventListener((dlg.dialogContainer || backdrop), 'click', function (e) {
|
||||
dom.addEventListener((dlg.dialogContainer || backdrop), 'click', e => {
|
||||
if (e.target === dlg.dialogContainer) {
|
||||
close(dlg);
|
||||
}
|
||||
@ -170,7 +178,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
passive: true
|
||||
});
|
||||
|
||||
dom.addEventListener((dlg.dialogContainer || backdrop), 'contextmenu', function (e) {
|
||||
dom.addEventListener((dlg.dialogContainer || backdrop), 'contextmenu', e => {
|
||||
if (e.target === dlg.dialogContainer) {
|
||||
// Close the application dialog menu
|
||||
close(dlg);
|
||||
@ -184,26 +192,26 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
return dlg.getAttribute('data-history') === 'true';
|
||||
}
|
||||
|
||||
function open(dlg) {
|
||||
export function open(dlg) {
|
||||
|
||||
if (globalOnOpenCallback) {
|
||||
globalOnOpenCallback(dlg);
|
||||
}
|
||||
|
||||
var parent = dlg.parentNode;
|
||||
const parent = dlg.parentNode;
|
||||
if (parent) {
|
||||
parent.removeChild(dlg);
|
||||
}
|
||||
|
||||
var dialogContainer = document.createElement('div');
|
||||
const dialogContainer = document.createElement('div');
|
||||
dialogContainer.classList.add('dialogContainer');
|
||||
dialogContainer.appendChild(dlg);
|
||||
dlg.dialogContainer = dialogContainer;
|
||||
document.body.appendChild(dialogContainer);
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
new DialogHashHandler(dlg, 'dlg' + new Date().getTime(), resolve);
|
||||
new DialogHashHandler(dlg, `dlg${new Date().getTime()}`, resolve);
|
||||
});
|
||||
}
|
||||
|
||||
@ -213,7 +221,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
return !dlg.classList.contains('hide');
|
||||
}
|
||||
|
||||
function close(dlg) {
|
||||
export function close(dlg) {
|
||||
|
||||
if (isOpened(dlg)) {
|
||||
if (isHistoryEnabled(dlg)) {
|
||||
@ -233,7 +241,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
cancelable: false
|
||||
}));
|
||||
|
||||
var onAnimationFinish = function () {
|
||||
const onAnimationFinish = () => {
|
||||
focusManager.popScope(dlg);
|
||||
|
||||
dlg.classList.add('hide');
|
||||
@ -249,7 +257,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
function animateDialogOpen(dlg) {
|
||||
|
||||
var onAnimationFinish = function () {
|
||||
const onAnimationFinish = () => {
|
||||
focusManager.pushScope(dlg);
|
||||
|
||||
if (dlg.getAttribute('data-autofocus') === 'true') {
|
||||
@ -264,7 +272,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
if (enableAnimation()) {
|
||||
|
||||
var onFinish = function () {
|
||||
const onFinish = () => {
|
||||
dom.removeEventListener(dlg, dom.whichAnimationEvent(), onFinish, {
|
||||
once: true
|
||||
});
|
||||
@ -283,24 +291,24 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
if (enableAnimation()) {
|
||||
|
||||
var animated = true;
|
||||
let animated = true;
|
||||
|
||||
switch (dlg.animationConfig.exit.name) {
|
||||
|
||||
case 'fadeout':
|
||||
dlg.style.animation = 'fadeout ' + dlg.animationConfig.exit.timing.duration + 'ms ease-out normal both';
|
||||
dlg.style.animation = `fadeout ${dlg.animationConfig.exit.timing.duration}ms ease-out normal both`;
|
||||
break;
|
||||
case 'scaledown':
|
||||
dlg.style.animation = 'scaledown ' + dlg.animationConfig.exit.timing.duration + 'ms ease-out normal both';
|
||||
dlg.style.animation = `scaledown ${dlg.animationConfig.exit.timing.duration}ms ease-out normal both`;
|
||||
break;
|
||||
case 'slidedown':
|
||||
dlg.style.animation = 'slidedown ' + dlg.animationConfig.exit.timing.duration + 'ms ease-out normal both';
|
||||
dlg.style.animation = `slidedown ${dlg.animationConfig.exit.timing.duration}ms ease-out normal both`;
|
||||
break;
|
||||
default:
|
||||
animated = false;
|
||||
break;
|
||||
}
|
||||
var onFinish = function () {
|
||||
const onFinish = () => {
|
||||
dom.removeEventListener(dlg, dom.whichAnimationEvent(), onFinish, {
|
||||
once: true
|
||||
});
|
||||
@ -318,7 +326,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
onAnimationFinish();
|
||||
}
|
||||
|
||||
var supportsOverscrollBehavior = 'overscroll-behavior-y' in document.body.style;
|
||||
const supportsOverscrollBehavior = 'overscroll-behavior-y' in document.body.style;
|
||||
|
||||
function shouldLockDocumentScroll(options) {
|
||||
|
||||
@ -343,7 +351,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
function removeBackdrop(dlg) {
|
||||
|
||||
var backdrop = dlg.backdrop;
|
||||
const backdrop = dlg.backdrop;
|
||||
|
||||
if (!backdrop) {
|
||||
return;
|
||||
@ -351,7 +359,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
dlg.backdrop = null;
|
||||
|
||||
var onAnimationFinish = function () {
|
||||
const onAnimationFinish = () => {
|
||||
tryRemoveElement(backdrop);
|
||||
};
|
||||
|
||||
@ -368,20 +376,20 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
}
|
||||
|
||||
function centerFocus(elem, horiz, on) {
|
||||
require(['scrollHelper'], function (scrollHelper) {
|
||||
var fn = on ? 'on' : 'off';
|
||||
import('scrollHelper').then(scrollHelper => {
|
||||
const fn = on ? 'on' : 'off';
|
||||
scrollHelper.centerFocus[fn](elem, horiz);
|
||||
});
|
||||
}
|
||||
|
||||
function createDialog(options) {
|
||||
export function createDialog(options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
// If there's no native dialog support, use a plain div
|
||||
// Also not working well in samsung tizen browser, content inside not clickable
|
||||
// Just go ahead and always use a plain div because we're seeing issues overlaying absoltutely positioned content over a modal dialog
|
||||
var dlg = document.createElement('div');
|
||||
const dlg = document.createElement('div');
|
||||
|
||||
dlg.classList.add('focuscontainer');
|
||||
dlg.classList.add('hide');
|
||||
@ -406,17 +414,17 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
dlg.setAttribute('data-autofocus', 'true');
|
||||
}
|
||||
|
||||
var defaultEntryAnimation;
|
||||
var defaultExitAnimation;
|
||||
let defaultEntryAnimation;
|
||||
let defaultExitAnimation;
|
||||
|
||||
defaultEntryAnimation = 'scaleup';
|
||||
defaultExitAnimation = 'scaledown';
|
||||
var entryAnimation = options.entryAnimation || defaultEntryAnimation;
|
||||
var exitAnimation = options.exitAnimation || defaultExitAnimation;
|
||||
const entryAnimation = options.entryAnimation || defaultEntryAnimation;
|
||||
const exitAnimation = options.exitAnimation || defaultExitAnimation;
|
||||
|
||||
// If it's not fullscreen then lower the default animation speed to make it open really fast
|
||||
var entryAnimationDuration = options.entryAnimationDuration || (options.size !== 'fullscreen' ? 180 : 280);
|
||||
var exitAnimationDuration = options.exitAnimationDuration || (options.size !== 'fullscreen' ? 120 : 220);
|
||||
const entryAnimationDuration = options.entryAnimationDuration || (options.size !== 'fullscreen' ? 180 : 280);
|
||||
const exitAnimationDuration = options.exitAnimationDuration || (options.size !== 'fullscreen' ? 120 : 220);
|
||||
|
||||
dlg.animationConfig = {
|
||||
// scale up
|
||||
@ -461,7 +469,7 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
|
||||
if (options.size) {
|
||||
dlg.classList.add('dialog-fixedSize');
|
||||
dlg.classList.add('dialog-' + options.size);
|
||||
dlg.classList.add(`dialog-${options.size}`);
|
||||
}
|
||||
|
||||
if (enableAnimation()) {
|
||||
@ -469,16 +477,16 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
switch (dlg.animationConfig.entry.name) {
|
||||
|
||||
case 'fadein':
|
||||
dlg.style.animation = 'fadein ' + entryAnimationDuration + 'ms ease-out normal';
|
||||
dlg.style.animation = `fadein ${entryAnimationDuration}ms ease-out normal`;
|
||||
break;
|
||||
case 'scaleup':
|
||||
dlg.style.animation = 'scaleup ' + entryAnimationDuration + 'ms ease-out normal both';
|
||||
dlg.style.animation = `scaleup ${entryAnimationDuration}ms ease-out normal both`;
|
||||
break;
|
||||
case 'slideup':
|
||||
dlg.style.animation = 'slideup ' + entryAnimationDuration + 'ms ease-out normal';
|
||||
dlg.style.animation = `slideup ${entryAnimationDuration}ms ease-out normal`;
|
||||
break;
|
||||
case 'slidedown':
|
||||
dlg.style.animation = 'slidedown ' + entryAnimationDuration + 'ms ease-out normal';
|
||||
dlg.style.animation = `slidedown ${entryAnimationDuration}ms ease-out normal`;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -488,12 +496,15 @@ define(['appRouter', 'focusManager', 'browser', 'layoutManager', 'inputManager',
|
||||
return dlg;
|
||||
}
|
||||
|
||||
return {
|
||||
export function setOnOpen(val) {
|
||||
globalOnOpenCallback = val;
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
||||
export default {
|
||||
open: open,
|
||||
close: close,
|
||||
createDialog: createDialog,
|
||||
setOnOpen: function (val) {
|
||||
globalOnOpenCallback = val;
|
||||
}
|
||||
};
|
||||
});
|
||||
setOnOpen: setOnOpen
|
||||
};
|
||||
|
@ -1,9 +1,19 @@
|
||||
define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-input', 'paper-icon-button-light', 'css!./directorybrowser', 'formDialogStyle', 'emby-button'], function(loading, dialogHelper, dom, globalize) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import dom from 'dom';
|
||||
import globalize from 'globalize';
|
||||
import 'listViewStyle';
|
||||
import 'emby-input';
|
||||
import 'paper-icon-button-light';
|
||||
import 'css!./directorybrowser';
|
||||
import 'formDialogStyle';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getSystemInfo() {
|
||||
return systemInfo ? Promise.resolve(systemInfo) : ApiClient.getPublicSystemInfo().then(
|
||||
function(info) {
|
||||
info => {
|
||||
systemInfo = info;
|
||||
return info;
|
||||
}
|
||||
@ -21,9 +31,9 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
|
||||
loading.show();
|
||||
|
||||
var promises = [];
|
||||
const promises = [];
|
||||
|
||||
if ('Network' === path) {
|
||||
if (path === 'Network') {
|
||||
promises.push(ApiClient.getNetworkDevices());
|
||||
} else {
|
||||
if (path) {
|
||||
@ -35,10 +45,10 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
}
|
||||
|
||||
Promise.all(promises).then(
|
||||
function(responses) {
|
||||
var folders = responses[0];
|
||||
var parentPath = responses[1] || '';
|
||||
var html = '';
|
||||
responses => {
|
||||
const folders = responses[0];
|
||||
const parentPath = responses[1] || '';
|
||||
let html = '';
|
||||
|
||||
page.querySelector('.results').scrollTop = 0;
|
||||
page.querySelector('#txtDirectoryPickerPath').value = path || '';
|
||||
@ -46,9 +56,9 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
if (path) {
|
||||
html += getItem('lnkPath lnkDirectory', '', parentPath, '...');
|
||||
}
|
||||
for (var i = 0, length = folders.length; i < length; i++) {
|
||||
var folder = folders[i];
|
||||
var cssClass = 'File' === folder.Type ? 'lnkPath lnkFile' : 'lnkPath lnkDirectory';
|
||||
for (let i = 0, length = folders.length; i < length; i++) {
|
||||
const folder = folders[i];
|
||||
const cssClass = folder.Type === 'File' ? 'lnkPath lnkFile' : 'lnkPath lnkDirectory';
|
||||
html += getItem(cssClass, folder.Type, folder.Path, folder.Name);
|
||||
}
|
||||
|
||||
@ -58,7 +68,7 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
|
||||
page.querySelector('.results').innerHTML = html;
|
||||
loading.hide();
|
||||
}, function() {
|
||||
}, () => {
|
||||
if (updatePathOnError) {
|
||||
page.querySelector('#txtDirectoryPickerPath').value = '';
|
||||
page.querySelector('.results').innerHTML = '';
|
||||
@ -69,8 +79,8 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
}
|
||||
|
||||
function getItem(cssClass, type, path, name) {
|
||||
var html = '';
|
||||
html += '<div class="listItem listItem-border ' + cssClass + '" data-type="' + type + '" data-path="' + path + '">';
|
||||
let html = '';
|
||||
html += `<div class="listItem listItem-border ${cssClass}" data-type="${type}" data-path="${path}">`;
|
||||
html += '<div class="listItemBody" style="padding-left:0;padding-top:.5em;padding-bottom:.5em;">';
|
||||
html += '<div class="listItemBodyText">';
|
||||
html += name;
|
||||
@ -82,19 +92,19 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
}
|
||||
|
||||
function getEditorHtml(options, systemInfo) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<div class="formDialogContent scrollY">';
|
||||
html += '<div class="dialogContentInner dialog-content-centered" style="padding-top:2em;">';
|
||||
if (!options.pathReadOnly) {
|
||||
var instruction = options.instruction ? options.instruction + '<br/><br/>' : '';
|
||||
const instruction = options.instruction ? `${options.instruction}<br/><br/>` : '';
|
||||
html += '<div class="infoBanner" style="margin-bottom:1.5em;">';
|
||||
html += instruction;
|
||||
if ('bsd' === systemInfo.OperatingSystem.toLowerCase()) {
|
||||
if (systemInfo.OperatingSystem.toLowerCase() === 'bsd') {
|
||||
html += '<br/>';
|
||||
html += '<br/>';
|
||||
html += globalize.translate('MessageDirectoryPickerBSDInstruction');
|
||||
html += '<br/>';
|
||||
} else if ('linux' === systemInfo.OperatingSystem.toLowerCase()) {
|
||||
} else if (systemInfo.OperatingSystem.toLowerCase() === 'linux') {
|
||||
html += '<br/>';
|
||||
html += '<br/>';
|
||||
html += globalize.translate('MessageDirectoryPickerLinuxInstruction');
|
||||
@ -105,17 +115,17 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
html += '<form style="margin:auto;">';
|
||||
html += '<div class="inputContainer" style="display: flex; align-items: center;">';
|
||||
html += '<div style="flex-grow:1;">';
|
||||
var labelKey;
|
||||
let labelKey;
|
||||
if (options.includeFiles !== true) {
|
||||
labelKey = 'LabelFolder';
|
||||
} else {
|
||||
labelKey = 'LabelPath';
|
||||
}
|
||||
var readOnlyAttribute = options.pathReadOnly ? ' readonly' : '';
|
||||
html += '<input is="emby-input" id="txtDirectoryPickerPath" type="text" required="required" ' + readOnlyAttribute + ' label="' + globalize.translate(labelKey) + '"/>';
|
||||
const readOnlyAttribute = options.pathReadOnly ? ' readonly' : '';
|
||||
html += `<input is="emby-input" id="txtDirectoryPickerPath" type="text" required="required" ${readOnlyAttribute} label="${globalize.translate(labelKey)}"/>`;
|
||||
html += '</div>';
|
||||
if (!readOnlyAttribute) {
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnRefreshDirectories emby-input-iconbutton" title="' + globalize.translate('ButtonRefresh') + '"><span class="material-icons search"></span></button>';
|
||||
html += `<button type="button" is="paper-icon-button-light" class="btnRefreshDirectories emby-input-iconbutton" title="${globalize.translate('ButtonRefresh')}"><span class="material-icons search"></span></button>`;
|
||||
}
|
||||
html += '</div>';
|
||||
if (!readOnlyAttribute) {
|
||||
@ -123,14 +133,14 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
}
|
||||
if (options.enableNetworkSharePath) {
|
||||
html += '<div class="inputContainer" style="margin-top:2em;">';
|
||||
html += '<input is="emby-input" id="txtNetworkPath" type="text" label="' + globalize.translate('LabelOptionalNetworkPath') + '"/>';
|
||||
html += `<input is="emby-input" id="txtNetworkPath" type="text" label="${globalize.translate('LabelOptionalNetworkPath')}"/>`;
|
||||
html += '<div class="fieldDescription">';
|
||||
html += globalize.translate('LabelOptionalNetworkPathHelp', '<b>\\\\server</b>', '<b>\\\\192.168.1.101</b>');
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
}
|
||||
html += '<div class="formDialogFooter">';
|
||||
html += '<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">' + globalize.translate('ButtonOk') + '</button>';
|
||||
html += `<button is="emby-button" type="submit" class="raised button-submit block formDialogFooterItem">${globalize.translate('ButtonOk')}</button>`;
|
||||
html += '</div>';
|
||||
html += '</form>';
|
||||
html += '</div>';
|
||||
@ -147,7 +157,7 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
}
|
||||
|
||||
function alertTextWithOptions(options) {
|
||||
require(['alert'], function(alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(options);
|
||||
});
|
||||
}
|
||||
@ -160,7 +170,7 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
ValidateWriteable: validateWriteable,
|
||||
Path: path
|
||||
}
|
||||
}).catch(function(response) {
|
||||
}).catch(response => {
|
||||
if (response) {
|
||||
if (response.status === 404) {
|
||||
alertText(globalize.translate('PathNotFound'));
|
||||
@ -180,10 +190,10 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
}
|
||||
|
||||
function initEditor(content, options, fileOptions) {
|
||||
content.addEventListener('click', function(e) {
|
||||
var lnkPath = dom.parentWithClass(e.target, 'lnkPath');
|
||||
content.addEventListener('click', e => {
|
||||
const lnkPath = dom.parentWithClass(e.target, 'lnkPath');
|
||||
if (lnkPath) {
|
||||
var path = lnkPath.getAttribute('data-path');
|
||||
const path = lnkPath.getAttribute('data-path');
|
||||
if (lnkPath.classList.contains('lnkFile')) {
|
||||
content.querySelector('#txtDirectoryPickerPath').value = path;
|
||||
} else {
|
||||
@ -192,25 +202,25 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
}
|
||||
});
|
||||
|
||||
content.addEventListener('click', function(e) {
|
||||
content.addEventListener('click', e => {
|
||||
if (dom.parentWithClass(e.target, 'btnRefreshDirectories')) {
|
||||
var path = content.querySelector('#txtDirectoryPickerPath').value;
|
||||
const path = content.querySelector('#txtDirectoryPickerPath').value;
|
||||
refreshDirectoryBrowser(content, path, fileOptions);
|
||||
}
|
||||
});
|
||||
|
||||
content.addEventListener('change', function(e) {
|
||||
var txtDirectoryPickerPath = dom.parentWithTag(e.target, 'INPUT');
|
||||
if (txtDirectoryPickerPath && 'txtDirectoryPickerPath' === txtDirectoryPickerPath.id) {
|
||||
content.addEventListener('change', e => {
|
||||
const txtDirectoryPickerPath = dom.parentWithTag(e.target, 'INPUT');
|
||||
if (txtDirectoryPickerPath && txtDirectoryPickerPath.id === 'txtDirectoryPickerPath') {
|
||||
refreshDirectoryBrowser(content, txtDirectoryPickerPath.value, fileOptions);
|
||||
}
|
||||
});
|
||||
|
||||
content.querySelector('form').addEventListener('submit', function(e) {
|
||||
if (options.callback) {
|
||||
var networkSharePath = this.querySelector('#txtNetworkPath');
|
||||
let networkSharePath = this.querySelector('#txtNetworkPath');
|
||||
networkSharePath = networkSharePath ? networkSharePath.value : null;
|
||||
var path = this.querySelector('#txtDirectoryPickerPath').value;
|
||||
const path = this.querySelector('#txtDirectoryPickerPath').value;
|
||||
validatePath(path, options.validateWriteable, ApiClient).then(options.callback(path, networkSharePath));
|
||||
}
|
||||
e.preventDefault();
|
||||
@ -224,21 +234,21 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
return Promise.resolve(options.path);
|
||||
} else {
|
||||
return ApiClient.getJSON(ApiClient.getUrl('Environment/DefaultDirectoryBrowser')).then(
|
||||
function(result) {
|
||||
result => {
|
||||
return result.Path || '';
|
||||
}, function() {
|
||||
}, () => {
|
||||
return '';
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
function directoryBrowser() {
|
||||
var currentDialog;
|
||||
var self = this;
|
||||
self.show = function(options) {
|
||||
class directoryBrowser {
|
||||
constructor() {
|
||||
let currentDialog;
|
||||
this.show = options => {
|
||||
options = options || {};
|
||||
var fileOptions = {
|
||||
const fileOptions = {
|
||||
includeDirectories: true
|
||||
};
|
||||
if (options.includeDirectories != null) {
|
||||
@ -248,10 +258,10 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
fileOptions.includeFiles = options.includeFiles;
|
||||
}
|
||||
Promise.all([getSystemInfo(), getDefaultPath(options)]).then(
|
||||
function(responses) {
|
||||
var systemInfo = responses[0];
|
||||
var initialPath = responses[1];
|
||||
var dlg = dialogHelper.createDialog({
|
||||
responses => {
|
||||
const systemInfo = responses[0];
|
||||
const initialPath = responses[1];
|
||||
const dlg = dialogHelper.createDialog({
|
||||
size: 'small',
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
@ -261,7 +271,7 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
dlg.classList.add('directoryPicker');
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<div class="formDialogHeader">';
|
||||
html += '<button is="paper-icon-button-light" class="btnCloseDialog autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||
html += '<h3 class="formDialogHeaderTitle">';
|
||||
@ -273,12 +283,12 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
initEditor(dlg, options, fileOptions);
|
||||
dlg.addEventListener('close', onDialogClosed);
|
||||
dialogHelper.open(dlg);
|
||||
dlg.querySelector('.btnCloseDialog').addEventListener('click', function() {
|
||||
dlg.querySelector('.btnCloseDialog').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
currentDialog = dlg;
|
||||
dlg.querySelector('#txtDirectoryPickerPath').value = initialPath;
|
||||
var txtNetworkPath = dlg.querySelector('#txtNetworkPath');
|
||||
const txtNetworkPath = dlg.querySelector('#txtNetworkPath');
|
||||
if (txtNetworkPath) {
|
||||
txtNetworkPath.value = options.networkSharePath || '';
|
||||
}
|
||||
@ -288,13 +298,15 @@ define(['loading', 'dialogHelper', 'dom', 'globalize', 'listViewStyle', 'emby-in
|
||||
}
|
||||
);
|
||||
};
|
||||
self.close = function() {
|
||||
this.close = () => {
|
||||
if (currentDialog) {
|
||||
dialogHelper.close(currentDialog);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var systemInfo;
|
||||
return directoryBrowser;
|
||||
});
|
||||
let systemInfo;
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default directoryBrowser;
|
||||
|
@ -1,22 +1,37 @@
|
||||
define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', 'apphost', 'focusManager', 'datetime', 'globalize', 'loading', 'connectionManager', 'skinManager', 'dom', 'events', 'emby-select', 'emby-checkbox', 'emby-button'], function (require, browser, layoutManager, appSettings, pluginManager, appHost, focusManager, datetime, globalize, loading, connectionManager, skinManager, dom, events) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
import layoutManager from 'layoutManager';
|
||||
import appSettings from 'appSettings';
|
||||
import pluginManager from 'pluginManager';
|
||||
import appHost from 'apphost';
|
||||
import focusManager from 'focusManager';
|
||||
import datetime from 'datetime';
|
||||
import globalize from 'globalize';
|
||||
import loading from 'loading';
|
||||
import connectionManager from 'connectionManager';
|
||||
import skinManager from 'skinManager';
|
||||
import events from 'events';
|
||||
import 'emby-select';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function fillThemes(select, isDashboard) {
|
||||
select.innerHTML = skinManager.getThemes().map(function (t) {
|
||||
var value = t.id;
|
||||
select.innerHTML = skinManager.getThemes().map(t => {
|
||||
let value = t.id;
|
||||
if (t.isDefault && !isDashboard) {
|
||||
value = '';
|
||||
} else if (t.isDefaultServerDashboard && isDashboard) {
|
||||
value = '';
|
||||
}
|
||||
|
||||
return '<option value="' + value + '">' + t.name + '</option>';
|
||||
return `<option value="${value}">${t.name}</option>`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function loadScreensavers(context, userSettings) {
|
||||
var selectScreensaver = context.querySelector('.selectScreensaver');
|
||||
var options = pluginManager.ofType('screensaver').map(function (plugin) {
|
||||
const selectScreensaver = context.querySelector('.selectScreensaver');
|
||||
const options = pluginManager.ofType('screensaver').map(plugin => {
|
||||
return {
|
||||
name: plugin.name,
|
||||
value: plugin.id
|
||||
@ -28,8 +43,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
value: 'none'
|
||||
});
|
||||
|
||||
selectScreensaver.innerHTML = options.map(function (o) {
|
||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
||||
selectScreensaver.innerHTML = options.map(o => {
|
||||
return `<option value="${o.value}">${o.name}</option>`;
|
||||
}).join('');
|
||||
selectScreensaver.value = userSettings.screensaver();
|
||||
|
||||
@ -41,8 +56,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
|
||||
function loadSoundEffects(context, userSettings) {
|
||||
|
||||
var selectSoundEffects = context.querySelector('.selectSoundEffects');
|
||||
var options = pluginManager.ofType('soundeffects').map(function (plugin) {
|
||||
const selectSoundEffects = context.querySelector('.selectSoundEffects');
|
||||
const options = pluginManager.ofType('soundeffects').map(plugin => {
|
||||
return {
|
||||
name: plugin.name,
|
||||
value: plugin.id
|
||||
@ -54,8 +69,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
value: 'none'
|
||||
});
|
||||
|
||||
selectSoundEffects.innerHTML = options.map(function (o) {
|
||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
||||
selectSoundEffects.innerHTML = options.map(o => {
|
||||
return `<option value="${o.value}">${o.name}</option>`;
|
||||
}).join('');
|
||||
selectSoundEffects.value = userSettings.soundEffects();
|
||||
|
||||
@ -67,17 +82,17 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
|
||||
function loadSkins(context, userSettings) {
|
||||
|
||||
var selectSkin = context.querySelector('.selectSkin');
|
||||
const selectSkin = context.querySelector('.selectSkin');
|
||||
|
||||
var options = pluginManager.ofType('skin').map(function (plugin) {
|
||||
const options = pluginManager.ofType('skin').map(plugin => {
|
||||
return {
|
||||
name: plugin.name,
|
||||
value: plugin.id
|
||||
};
|
||||
});
|
||||
|
||||
selectSkin.innerHTML = options.map(function (o) {
|
||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
||||
selectSkin.innerHTML = options.map(o => {
|
||||
return `<option value="${o.value}">${o.name}</option>`;
|
||||
}).join('');
|
||||
selectSkin.value = userSettings.skin();
|
||||
|
||||
@ -92,7 +107,7 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
}
|
||||
}
|
||||
|
||||
function showOrHideMissingEpisodesField(context, user, apiClient) {
|
||||
function showOrHideMissingEpisodesField(context) {
|
||||
|
||||
if (browser.tizen || browser.web0s) {
|
||||
context.querySelector('.fldDisplayMissingEpisodes').classList.add('hide');
|
||||
@ -102,10 +117,7 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
context.querySelector('.fldDisplayMissingEpisodes').classList.remove('hide');
|
||||
}
|
||||
|
||||
function loadForm(context, user, userSettings, apiClient) {
|
||||
|
||||
var loggedInUserId = apiClient.getCurrentUserId();
|
||||
var userId = user.Id;
|
||||
function loadForm(context, user, userSettings) {
|
||||
|
||||
if (user.Policy.IsAdministrator) {
|
||||
context.querySelector('.selectDashboardThemeContainer').classList.remove('hide');
|
||||
@ -167,8 +179,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
|
||||
context.querySelector('.chkRunAtStartup').checked = appSettings.runAtStartup();
|
||||
|
||||
var selectTheme = context.querySelector('#selectTheme');
|
||||
var selectDashboardTheme = context.querySelector('#selectDashboardTheme');
|
||||
const selectTheme = context.querySelector('#selectTheme');
|
||||
const selectDashboardTheme = context.querySelector('#selectDashboardTheme');
|
||||
|
||||
fillThemes(selectTheme);
|
||||
fillThemes(selectDashboardTheme, true);
|
||||
@ -195,7 +207,7 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
|
||||
context.querySelector('.selectLayout').value = layoutManager.getSavedLayout() || '';
|
||||
|
||||
showOrHideMissingEpisodesField(context, user, apiClient);
|
||||
showOrHideMissingEpisodesField(context);
|
||||
|
||||
loading.hide();
|
||||
}
|
||||
@ -239,29 +251,29 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||
loading.show();
|
||||
|
||||
apiClient.getUser(userId).then(function (user) {
|
||||
saveUser(context, user, userSettings, apiClient).then(function () {
|
||||
apiClient.getUser(userId).then(user => {
|
||||
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
events.trigger(instance, 'saved');
|
||||
}, function () {
|
||||
}, () => {
|
||||
loading.hide();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
var self = this;
|
||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
var userId = self.options.userId;
|
||||
var userSettings = self.options.userSettings;
|
||||
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(function () {
|
||||
var enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||
});
|
||||
|
||||
@ -272,50 +284,51 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||
return false;
|
||||
}
|
||||
|
||||
function embed(options, self) {
|
||||
require(['text!./displaySettings.template.html'], function (template) {
|
||||
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
||||
async function embed(options, self) {
|
||||
const { default: template } = await import('text!./displaySettings.template.html');
|
||||
options.element.innerHTML = globalize.translateHtml(template, 'core');
|
||||
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
||||
if (options.enableSaveButton) {
|
||||
options.element.querySelector('.btnSave').classList.remove('hide');
|
||||
}
|
||||
self.loadData(options.autoFocus);
|
||||
});
|
||||
}
|
||||
|
||||
function DisplaySettings(options) {
|
||||
class DisplaySettings {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
embed(options, this);
|
||||
}
|
||||
|
||||
DisplaySettings.prototype.loadData = function (autoFocus) {
|
||||
var self = this;
|
||||
var context = self.options.element;
|
||||
loadData(autoFocus) {
|
||||
const self = this;
|
||||
const context = self.options.element;
|
||||
|
||||
loading.show();
|
||||
|
||||
var userId = self.options.userId;
|
||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
var userSettings = self.options.userSettings;
|
||||
const userId = self.options.userId;
|
||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
const userSettings = self.options.userSettings;
|
||||
|
||||
return apiClient.getUser(userId).then(function (user) {
|
||||
return userSettings.setUserInfo(userId, apiClient).then(function () {
|
||||
return apiClient.getUser(userId).then(user => {
|
||||
return userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
self.dataLoaded = true;
|
||||
loadForm(context, user, userSettings, apiClient);
|
||||
loadForm(context, user, userSettings);
|
||||
if (autoFocus) {
|
||||
focusManager.autoFocus(context);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
DisplaySettings.prototype.submit = function () {
|
||||
submit() {
|
||||
onSubmit.call(this);
|
||||
};
|
||||
}
|
||||
|
||||
DisplaySettings.prototype.destroy = function () {
|
||||
destroy() {
|
||||
this.options = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return DisplaySettings;
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
export default DisplaySettings;
|
||||
|
@ -412,7 +412,7 @@ import 'css!./style.css';
|
||||
dlg.classList.add('background-theme-a');
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.classList.add('filterDialog');
|
||||
dlg.innerHTML = globalize.translateDocument(template);
|
||||
dlg.innerHTML = globalize.translateHtml(template);
|
||||
setVisibility(dlg, this.options);
|
||||
dialogHelper.open(dlg);
|
||||
dlg.addEventListener('close', resolve);
|
||||
|
@ -286,7 +286,7 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'apphost',
|
||||
|
||||
html += template;
|
||||
|
||||
dlg.innerHTML = globalize.translateDocument(html, 'core');
|
||||
dlg.innerHTML = globalize.translateHtml(html, 'core');
|
||||
|
||||
var settingElements = dlg.querySelectorAll('.viewSetting');
|
||||
for (var i = 0, length = settingElements.length; i < length; i++) {
|
||||
|
@ -1,5 +1,8 @@
|
||||
define(['dom', 'appRouter', 'connectionManager'], function (dom, appRouter, connectionManager) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
import dom from 'dom';
|
||||
import appRouter from 'appRouter';
|
||||
import connectionManager from 'connectionManager';
|
||||
|
||||
function onGroupedCardClick(e, card) {
|
||||
var itemId = card.getAttribute('data-id');
|
||||
@ -31,7 +34,7 @@ define(['dom', 'appRouter', 'connectionManager'], function (dom, appRouter, conn
|
||||
}
|
||||
}
|
||||
|
||||
function onItemsContainerClick(e) {
|
||||
export default function onItemsContainerClick(e) {
|
||||
var groupedCard = dom.parentWithClass(e.target, 'groupedCard');
|
||||
|
||||
if (groupedCard) {
|
||||
@ -39,7 +42,4 @@ define(['dom', 'appRouter', 'connectionManager'], function (dom, appRouter, conn
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
onItemsContainerClick: onItemsContainerClick
|
||||
};
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
|
@ -114,7 +114,7 @@ define(['dialogHelper', 'globalize', 'userSettings', 'layoutManager', 'connectio
|
||||
|
||||
var html = '';
|
||||
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
|
@ -1151,7 +1151,7 @@ define(['require', 'inputManager', 'browser', 'globalize', 'connectionManager',
|
||||
|
||||
context.classList.add('tvguide');
|
||||
|
||||
context.innerHTML = globalize.translateDocument(template, 'core');
|
||||
context.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
programGrid = context.querySelector('.programGrid');
|
||||
var timeslotHeaders = context.querySelector('.timeslotHeaders');
|
||||
|
@ -1,26 +1,37 @@
|
||||
define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loading', 'connectionManager', 'homeSections', 'dom', 'events', 'listViewStyle', 'emby-select', 'emby-checkbox'], function (require, appHost, layoutManager, focusManager, globalize, loading, connectionManager, homeSections, dom, events) {
|
||||
'use strict';
|
||||
import layoutManager from 'layoutManager';
|
||||
import focusManager from 'focusManager';
|
||||
import globalize from 'globalize';
|
||||
import loading from 'loading';
|
||||
import connectionManager from 'connectionManager';
|
||||
import homeSections from 'homeSections';
|
||||
import dom from 'dom';
|
||||
import events from 'events';
|
||||
import 'listViewStyle';
|
||||
import 'emby-select';
|
||||
import 'emby-checkbox';
|
||||
|
||||
var numConfigurableSections = 7;
|
||||
/* eslint-disable indent */
|
||||
|
||||
const numConfigurableSections = 7;
|
||||
|
||||
function renderViews(page, user, result) {
|
||||
|
||||
var folderHtml = '';
|
||||
let folderHtml = '';
|
||||
|
||||
folderHtml += '<div class="checkboxList">';
|
||||
folderHtml += result.map(function (i) {
|
||||
folderHtml += result.map(i => {
|
||||
|
||||
var currentHtml = '';
|
||||
let currentHtml = '';
|
||||
|
||||
var id = 'chkGroupFolder' + i.Id;
|
||||
const id = `chkGroupFolder${i.Id}`;
|
||||
|
||||
var isChecked = user.Configuration.GroupedFolders.indexOf(i.Id) !== -1;
|
||||
const isChecked = user.Configuration.GroupedFolders.includes(i.Id);
|
||||
|
||||
var checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
|
||||
currentHtml += '<label>';
|
||||
currentHtml += '<input type="checkbox" is="emby-checkbox" class="chkGroupFolder" data-folderid="' + i.Id + '" id="' + id + '"' + checkedHtml + '/>';
|
||||
currentHtml += '<span>' + i.Name + '</span>';
|
||||
currentHtml += `<input type="checkbox" is="emby-checkbox" class="chkGroupFolder" data-folderid="${i.Id}" id="${id}"${checkedHtml}/>`;
|
||||
currentHtml += `<span>${i.Name}</span>`;
|
||||
currentHtml += '</label>';
|
||||
|
||||
return currentHtml;
|
||||
@ -34,7 +45,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function getLandingScreenOptions(type) {
|
||||
|
||||
var list = [];
|
||||
const list = [];
|
||||
|
||||
if (type === 'movies') {
|
||||
list.push({
|
||||
@ -123,27 +134,27 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function getLandingScreenOptionsHtml(type, userValue) {
|
||||
|
||||
return getLandingScreenOptions(type).map(function (o) {
|
||||
return getLandingScreenOptions(type).map(o => {
|
||||
|
||||
var selected = userValue === o.value || (o.isDefault && !userValue);
|
||||
var selectedHtml = selected ? ' selected' : '';
|
||||
var optionValue = o.isDefault ? '' : o.value;
|
||||
const selected = userValue === o.value || (o.isDefault && !userValue);
|
||||
const selectedHtml = selected ? ' selected' : '';
|
||||
const optionValue = o.isDefault ? '' : o.value;
|
||||
|
||||
return '<option value="' + optionValue + '"' + selectedHtml + '>' + o.name + '</option>';
|
||||
return `<option value="${optionValue}"${selectedHtml}>${o.name}</option>`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function renderViewOrder(context, user, result) {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
var index = 0;
|
||||
let index = 0;
|
||||
|
||||
html += result.Items.map(function (view) {
|
||||
html += result.Items.map(view => {
|
||||
|
||||
var currentHtml = '';
|
||||
let currentHtml = '';
|
||||
|
||||
currentHtml += '<div class="listItem viewItem" data-viewid="' + view.Id + '">';
|
||||
currentHtml += `<div class="listItem viewItem" data-viewid="${view.Id}">`;
|
||||
|
||||
currentHtml += '<span class="material-icons listItemIcon folder_open"></span>';
|
||||
|
||||
@ -155,8 +166,8 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
currentHtml += '</div>';
|
||||
|
||||
currentHtml += '<button type="button" is="paper-icon-button-light" class="btnViewItemUp btnViewItemMove autoSize" title="' + globalize.translate('Up') + '"><span class="material-icons keyboard_arrow_up"></span></button>';
|
||||
currentHtml += '<button type="button" is="paper-icon-button-light" class="btnViewItemDown btnViewItemMove autoSize" title="' + globalize.translate('Down') + '"><span class="material-icons keyboard_arrow_down"></span></button>';
|
||||
currentHtml += `<button type="button" is="paper-icon-button-light" class="btnViewItemUp btnViewItemMove autoSize" title="${globalize.translate('Up')}"><span class="material-icons keyboard_arrow_up"></span></button>`;
|
||||
currentHtml += `<button type="button" is="paper-icon-button-light" class="btnViewItemDown btnViewItemMove autoSize" title="${globalize.translate('Down')}"><span class="material-icons keyboard_arrow_down"></span></button>`;
|
||||
|
||||
currentHtml += '</div>';
|
||||
|
||||
@ -170,14 +181,14 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function updateHomeSectionValues(context, userSettings) {
|
||||
|
||||
for (var i = 1; i <= 7; i++) {
|
||||
for (let i = 1; i <= 7; i++) {
|
||||
|
||||
var select = context.querySelector('#selectHomeSection' + i);
|
||||
var defaultValue = homeSections.getDefaultSection(i - 1);
|
||||
const select = context.querySelector(`#selectHomeSection${i}`);
|
||||
const defaultValue = homeSections.getDefaultSection(i - 1);
|
||||
|
||||
var option = select.querySelector('option[value=' + defaultValue + ']') || select.querySelector('option[value=""]');
|
||||
const option = select.querySelector(`option[value=${defaultValue}]`) || select.querySelector('option[value=""]');
|
||||
|
||||
var userValue = userSettings.get('homesection' + (i - 1));
|
||||
const userValue = userSettings.get(`homesection${i - 1}`);
|
||||
|
||||
option.value = '';
|
||||
|
||||
@ -193,42 +204,42 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function getPerLibrarySettingsHtml(item, user, userSettings, apiClient) {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
var isChecked;
|
||||
let isChecked;
|
||||
|
||||
if (item.Type === 'Channel' || item.CollectionType === 'boxsets' || item.CollectionType === 'playlists') {
|
||||
isChecked = (user.Configuration.MyMediaExcludes || []).indexOf(item.Id) === -1;
|
||||
isChecked = !(user.Configuration.MyMediaExcludes || []).includes(item.Id);
|
||||
html += '<div>';
|
||||
html += '<label>';
|
||||
html += '<input type="checkbox" is="emby-checkbox" class="chkIncludeInMyMedia" data-folderid="' + item.Id + '"' + (isChecked ? ' checked="checked"' : '') + '/>';
|
||||
html += '<span>' + globalize.translate('DisplayInMyMedia') + '</span>';
|
||||
html += `<input type="checkbox" is="emby-checkbox" class="chkIncludeInMyMedia" data-folderid="${item.Id}"${isChecked ? ' checked="checked"' : ''}/>`;
|
||||
html += `<span>${globalize.translate('DisplayInMyMedia')}</span>`;
|
||||
html += '</label>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
var excludeFromLatest = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||
if (excludeFromLatest.indexOf(item.CollectionType || '') === -1) {
|
||||
const excludeFromLatest = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||
if (!excludeFromLatest.includes(item.CollectionType || '')) {
|
||||
|
||||
isChecked = user.Configuration.LatestItemsExcludes.indexOf(item.Id) === -1;
|
||||
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"' : '') + '/>';
|
||||
html += '<span>' + globalize.translate('DisplayInOtherHomeScreenSections') + '</span>';
|
||||
html += `<input type="checkbox" is="emby-checkbox" class="chkIncludeInLatest" data-folderid="${item.Id}"${isChecked ? ' checked="checked"' : ''}/>`;
|
||||
html += `<span>${globalize.translate('DisplayInOtherHomeScreenSections')}</span>`;
|
||||
html += '</label>';
|
||||
}
|
||||
|
||||
if (html) {
|
||||
|
||||
html = '<div class="checkboxListContainer">' + html + '</div>';
|
||||
html = `<div class="checkboxListContainer">${html}</div>`;
|
||||
}
|
||||
|
||||
if (item.CollectionType === 'movies' || item.CollectionType === 'tvshows' || item.CollectionType === 'music' || item.CollectionType === 'livetv') {
|
||||
|
||||
var idForLanding = item.CollectionType === 'livetv' ? item.CollectionType : item.Id;
|
||||
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') + '">';
|
||||
html += `<select is="emby-select" class="selectLanding" data-folderid="${idForLanding}" label="${globalize.translate('LabelDefaultScreen')}">`;
|
||||
|
||||
var userValue = userSettings.get('landing-' + idForLanding);
|
||||
const userValue = userSettings.get(`landing-${idForLanding}`);
|
||||
|
||||
html += getLandingScreenOptionsHtml(item.CollectionType, userValue);
|
||||
|
||||
@ -238,7 +249,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
if (html) {
|
||||
|
||||
var prefix = '';
|
||||
let prefix = '';
|
||||
prefix += '<div class="verticalSection">';
|
||||
|
||||
prefix += '<h2 class="sectionTitle">';
|
||||
@ -254,10 +265,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function renderPerLibrarySettings(context, user, userViews, userSettings, apiClient) {
|
||||
|
||||
var elem = context.querySelector('.perLibrarySettings');
|
||||
var html = '';
|
||||
const elem = context.querySelector('.perLibrarySettings');
|
||||
let html = '';
|
||||
|
||||
for (var i = 0, length = userViews.length; i < length; i++) {
|
||||
for (let i = 0, length = userViews.length; i < length; i++) {
|
||||
|
||||
html += getPerLibrarySettingsHtml(userViews[i], user, userSettings, apiClient);
|
||||
}
|
||||
@ -271,10 +282,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
updateHomeSectionValues(context, userSettings);
|
||||
|
||||
var promise1 = apiClient.getUserViews({ IncludeHidden: true }, user.Id);
|
||||
var promise2 = apiClient.getJSON(apiClient.getUrl('Users/' + user.Id + '/GroupingOptions'));
|
||||
const promise1 = apiClient.getUserViews({ IncludeHidden: true }, user.Id);
|
||||
const promise2 = apiClient.getJSON(apiClient.getUrl(`Users/${user.Id}/GroupingOptions`));
|
||||
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
Promise.all([promise1, promise2]).then(responses => {
|
||||
|
||||
renderViewOrder(context, user, responses[0]);
|
||||
|
||||
@ -286,38 +297,19 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
});
|
||||
}
|
||||
|
||||
function getSibling(elem, type, className) {
|
||||
|
||||
var sibling = elem[type];
|
||||
|
||||
while (sibling != null) {
|
||||
if (sibling.classList.contains(className)) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (sibling != null) {
|
||||
if (!sibling.classList.contains(className)) {
|
||||
sibling = null;
|
||||
}
|
||||
}
|
||||
|
||||
return sibling;
|
||||
}
|
||||
|
||||
function onSectionOrderListClick(e) {
|
||||
|
||||
var target = dom.parentWithClass(e.target, 'btnViewItemMove');
|
||||
const target = dom.parentWithClass(e.target, 'btnViewItemMove');
|
||||
|
||||
if (target) {
|
||||
var viewItem = dom.parentWithClass(target, 'viewItem');
|
||||
const viewItem = dom.parentWithClass(target, 'viewItem');
|
||||
|
||||
if (viewItem) {
|
||||
var ul = dom.parentWithClass(viewItem, 'paperList');
|
||||
const ul = dom.parentWithClass(viewItem, 'paperList');
|
||||
|
||||
if (target.classList.contains('btnViewItemDown')) {
|
||||
|
||||
var next = viewItem.nextSibling;
|
||||
const next = viewItem.nextSibling;
|
||||
|
||||
if (next) {
|
||||
viewItem.parentNode.removeChild(viewItem);
|
||||
@ -327,7 +319,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
} else {
|
||||
|
||||
var prev = viewItem.previousSibling;
|
||||
const prev = viewItem.previousSibling;
|
||||
|
||||
if (prev) {
|
||||
viewItem.parentNode.removeChild(viewItem);
|
||||
@ -341,10 +333,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function getCheckboxItems(selector, context, isChecked) {
|
||||
|
||||
var inputs = context.querySelectorAll(selector);
|
||||
var list = [];
|
||||
const inputs = context.querySelectorAll(selector);
|
||||
const list = [];
|
||||
|
||||
for (var i = 0, length = inputs.length; i < length; i++) {
|
||||
for (let i = 0, length = inputs.length; i < length; i++) {
|
||||
|
||||
if (inputs[i].checked === isChecked) {
|
||||
list.push(inputs[i]);
|
||||
@ -359,25 +351,25 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
user.Configuration.HidePlayedInLatest = context.querySelector('.chkHidePlayedFromLatest').checked;
|
||||
|
||||
user.Configuration.LatestItemsExcludes = getCheckboxItems('.chkIncludeInLatest', context, false).map(function (i) {
|
||||
user.Configuration.LatestItemsExcludes = getCheckboxItems('.chkIncludeInLatest', context, false).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
user.Configuration.MyMediaExcludes = getCheckboxItems('.chkIncludeInMyMedia', context, false).map(function (i) {
|
||||
user.Configuration.MyMediaExcludes = getCheckboxItems('.chkIncludeInMyMedia', context, false).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
user.Configuration.GroupedFolders = getCheckboxItems('.chkGroupFolder', context, true).map(function (i) {
|
||||
user.Configuration.GroupedFolders = getCheckboxItems('.chkGroupFolder', context, true).map(i => {
|
||||
|
||||
return i.getAttribute('data-folderid');
|
||||
});
|
||||
|
||||
var viewItems = context.querySelectorAll('.viewItem');
|
||||
var orderedViews = [];
|
||||
var i;
|
||||
var length;
|
||||
const viewItems = context.querySelectorAll('.viewItem');
|
||||
const orderedViews = [];
|
||||
let i;
|
||||
let length;
|
||||
for (i = 0, length = viewItems.length; i < length; i++) {
|
||||
orderedViews.push(viewItems[i].getAttribute('data-viewid'));
|
||||
}
|
||||
@ -394,10 +386,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
userSettingsInstance.set('homesection5', context.querySelector('#selectHomeSection6').value);
|
||||
userSettingsInstance.set('homesection6', context.querySelector('#selectHomeSection7').value);
|
||||
|
||||
var selectLandings = context.querySelectorAll('.selectLanding');
|
||||
const selectLandings = context.querySelectorAll('.selectLanding');
|
||||
for (i = 0, length = selectLandings.length; i < length; i++) {
|
||||
var selectLanding = selectLandings[i];
|
||||
userSettingsInstance.set('landing-' + selectLanding.getAttribute('data-folderid'), selectLanding.value);
|
||||
const selectLanding = selectLandings[i];
|
||||
userSettingsInstance.set(`landing-${selectLanding.getAttribute('data-folderid')}`, selectLanding.value);
|
||||
}
|
||||
|
||||
return apiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||
@ -407,20 +399,20 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
loading.show();
|
||||
|
||||
apiClient.getUser(userId).then(function (user) {
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
saveUser(context, user, userSettings, apiClient).then(function () {
|
||||
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
events.trigger(instance, 'saved');
|
||||
|
||||
}, function () {
|
||||
}, () => {
|
||||
loading.hide();
|
||||
});
|
||||
});
|
||||
@ -428,14 +420,14 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
var self = this;
|
||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
var userId = self.options.userId;
|
||||
var userSettings = self.options.userSettings;
|
||||
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(function () {
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
var enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||
});
|
||||
|
||||
@ -448,13 +440,13 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function onChange(e) {
|
||||
|
||||
var chkIncludeInMyMedia = dom.parentWithClass(e.target, 'chkIncludeInMyMedia');
|
||||
const chkIncludeInMyMedia = dom.parentWithClass(e.target, 'chkIncludeInMyMedia');
|
||||
if (!chkIncludeInMyMedia) {
|
||||
return;
|
||||
}
|
||||
|
||||
var section = dom.parentWithClass(chkIncludeInMyMedia, 'verticalSection');
|
||||
var fldIncludeInLatest = section.querySelector('.fldIncludeInLatest');
|
||||
const section = dom.parentWithClass(chkIncludeInMyMedia, 'verticalSection');
|
||||
const fldIncludeInLatest = section.querySelector('.fldIncludeInLatest');
|
||||
if (fldIncludeInLatest) {
|
||||
if (chkIncludeInMyMedia.checked) {
|
||||
fldIncludeInLatest.classList.remove('hide');
|
||||
@ -466,13 +458,13 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
|
||||
function embed(options, self) {
|
||||
|
||||
require(['text!./homeScreenSettings.template.html'], function (template) {
|
||||
return import('text!./homeScreenSettings.template.html').then(({default: template}) => {
|
||||
|
||||
for (var i = 1; i <= numConfigurableSections; i++) {
|
||||
template = template.replace('{section' + i + 'label}', globalize.translate('LabelHomeScreenSectionValue', i));
|
||||
for (let i = 1; i <= numConfigurableSections; i++) {
|
||||
template = template.replace(`{section${i}label}`, globalize.translate('LabelHomeScreenSectionValue', i));
|
||||
}
|
||||
|
||||
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
||||
options.element.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
options.element.querySelector('.viewOrderList').addEventListener('click', onSectionOrderListClick);
|
||||
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
||||
@ -492,27 +484,26 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
});
|
||||
}
|
||||
|
||||
function HomeScreenSettings(options) {
|
||||
|
||||
class HomeScreenSettings {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
|
||||
embed(options, this);
|
||||
}
|
||||
|
||||
HomeScreenSettings.prototype.loadData = function (autoFocus) {
|
||||
loadData(autoFocus) {
|
||||
|
||||
var self = this;
|
||||
var context = self.options.element;
|
||||
const self = this;
|
||||
const context = self.options.element;
|
||||
|
||||
loading.show();
|
||||
|
||||
var userId = self.options.userId;
|
||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
var userSettings = self.options.userSettings;
|
||||
const userId = self.options.userId;
|
||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
const userSettings = self.options.userSettings;
|
||||
|
||||
apiClient.getUser(userId).then(function (user) {
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
self.dataLoaded = true;
|
||||
|
||||
@ -523,16 +514,18 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
HomeScreenSettings.prototype.submit = function () {
|
||||
submit() {
|
||||
onSubmit.call(this);
|
||||
};
|
||||
}
|
||||
|
||||
HomeScreenSettings.prototype.destroy = function () {
|
||||
destroy() {
|
||||
|
||||
this.options = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return HomeScreenSettings;
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
|
||||
export default HomeScreenSettings;
|
||||
|
@ -1,7 +1,24 @@
|
||||
define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'layoutManager', 'imageLoader', 'globalize', 'itemShortcuts', 'itemHelper', 'appRouter', 'scripts/imagehelper', 'paper-icon-button-light', 'emby-itemscontainer', 'emby-scroller', 'emby-button', 'css!./homesections'], function (connectionManager, cardBuilder, appSettings, dom, appHost, layoutManager, imageLoader, globalize, itemShortcuts, itemHelper, appRouter, imageHelper) {
|
||||
'use strict';
|
||||
import connectionManager from 'connectionManager';
|
||||
import cardBuilder from 'cardBuilder';
|
||||
import appSettings from 'appSettings';
|
||||
import dom from 'dom';
|
||||
import appHost from 'apphost';
|
||||
import layoutManager from 'layoutManager';
|
||||
import imageLoader from 'imageLoader';
|
||||
import globalize from 'globalize';
|
||||
import itemShortcuts from 'itemShortcuts';
|
||||
import itemHelper from 'itemHelper';
|
||||
import appRouter from 'appRouter';
|
||||
import imageHelper from 'scripts/imagehelper';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-itemscontainer';
|
||||
import 'emby-scroller';
|
||||
import 'emby-button';
|
||||
import 'css!./homesections';
|
||||
|
||||
function getDefaultSection(index) {
|
||||
/* eslint-disable indent */
|
||||
|
||||
export function getDefaultSection(index) {
|
||||
switch (index) {
|
||||
case 0:
|
||||
return 'smalllibrarytiles';
|
||||
@ -23,9 +40,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function getAllSectionsToShow(userSettings, sectionCount) {
|
||||
var sections = [];
|
||||
for (var i = 0, length = sectionCount; i < length; i++) {
|
||||
var section = userSettings.get('homesection' + i) || getDefaultSection(i);
|
||||
const sections = [];
|
||||
for (let i = 0, length = sectionCount; i < length; i++) {
|
||||
let section = userSettings.get('homesection' + i) || getDefaultSection(i);
|
||||
if (section === 'folders') {
|
||||
section = getDefaultSection(0);
|
||||
}
|
||||
@ -36,22 +53,22 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
return sections;
|
||||
}
|
||||
|
||||
function loadSections(elem, apiClient, user, userSettings) {
|
||||
export function loadSections(elem, apiClient, user, userSettings) {
|
||||
return getUserViews(apiClient, user.Id).then(function (userViews) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
if (userViews.length) {
|
||||
var sectionCount = 7;
|
||||
for (var i = 0; i < sectionCount; i++) {
|
||||
const sectionCount = 7;
|
||||
for (let i = 0; i < sectionCount; i++) {
|
||||
html += '<div class="verticalSection section' + i + '"></div>';
|
||||
}
|
||||
|
||||
elem.innerHTML = html;
|
||||
elem.classList.add('homeSectionsContainer');
|
||||
|
||||
var promises = [];
|
||||
var sections = getAllSectionsToShow(userSettings, sectionCount);
|
||||
for (var i = 0; i < sections.length; i++) {
|
||||
const promises = [];
|
||||
const sections = getAllSectionsToShow(userSettings, sectionCount);
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
promises.push(loadSection(elem, apiClient, user, userSettings, userViews, sections, i));
|
||||
}
|
||||
|
||||
@ -62,7 +79,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
});
|
||||
});
|
||||
} else {
|
||||
var noLibDescription;
|
||||
let noLibDescription;
|
||||
if (user['Policy'] && user['Policy']['IsAdministrator']) {
|
||||
noLibDescription = globalize.translate('NoCreatedLibraries', '<br><a id="button-createLibrary" class="button-link">', '</a>');
|
||||
} else {
|
||||
@ -75,7 +92,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
html += '</div>';
|
||||
elem.innerHTML = html;
|
||||
|
||||
var createNowLink = elem.querySelector('#button-createLibrary');
|
||||
const createNowLink = elem.querySelector('#button-createLibrary');
|
||||
if (createNowLink) {
|
||||
createNowLink.addEventListener('click', function () {
|
||||
Dashboard.navigate('library.html');
|
||||
@ -85,9 +102,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
});
|
||||
}
|
||||
|
||||
function destroySections(elem) {
|
||||
var elems = elem.querySelectorAll('.itemsContainer');
|
||||
for (var i = 0; i < elems.length; i++) {
|
||||
export function destroySections(elem) {
|
||||
const elems = elem.querySelectorAll('.itemsContainer');
|
||||
for (let i = 0; i < elems.length; i++) {
|
||||
elems[i].fetchData = null;
|
||||
elems[i].parentContainer = null;
|
||||
elems[i].getItemsHtml = null;
|
||||
@ -96,24 +113,22 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
elem.innerHTML = '';
|
||||
}
|
||||
|
||||
function pause(elem) {
|
||||
var elems = elem.querySelectorAll('.itemsContainer');
|
||||
for (var i = 0; i < elems.length; i++) {
|
||||
export function pause(elem) {
|
||||
const elems = elem.querySelectorAll('.itemsContainer');
|
||||
for (let i = 0; i < elems.length; i++) {
|
||||
elems[i].pause();
|
||||
}
|
||||
}
|
||||
|
||||
function resume(elem, options) {
|
||||
var elems = elem.querySelectorAll('.itemsContainer');
|
||||
var i;
|
||||
var length;
|
||||
var promises = [];
|
||||
export function resume(elem, options) {
|
||||
const elems = elem.querySelectorAll('.itemsContainer');
|
||||
const promises = [];
|
||||
|
||||
for (i = 0, length = elems.length; i < length; i++) {
|
||||
for (let i = 0, length = elems.length; i < length; i++) {
|
||||
promises.push(elems[i].resume(options));
|
||||
}
|
||||
|
||||
var promise = Promise.all(promises);
|
||||
const promise = Promise.all(promises);
|
||||
if (!options || options.returnPromise !== false) {
|
||||
return promise;
|
||||
}
|
||||
@ -121,10 +136,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function loadSection(page, apiClient, user, userSettings, userViews, allSections, index) {
|
||||
|
||||
var section = allSections[index];
|
||||
var userId = user.Id;
|
||||
const section = allSections[index];
|
||||
const userId = user.Id;
|
||||
|
||||
var elem = page.querySelector('.section' + index);
|
||||
const elem = page.querySelector('.section' + index);
|
||||
|
||||
if (section === 'latestmedia') {
|
||||
loadRecentlyAdded(elem, apiClient, user, userViews);
|
||||
@ -172,7 +187,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function getLibraryButtonsHtml(items) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<div class="verticalSection verticalSection-extrabottompadding">';
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
||||
@ -180,9 +195,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-multiselect="false">';
|
||||
|
||||
// library card background images
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var item = items[i];
|
||||
var icon = imageHelper.getLibraryIcon(item.CollectionType);
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
const item = items[i];
|
||||
const icon = imageHelper.getLibraryIcon(item.CollectionType);
|
||||
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl(item) + '" class="raised homeLibraryButton"><span class="material-icons homeLibraryIcon ' + icon + '"></span><span class="homeLibraryText">' + item.Name + '</span></a>';
|
||||
}
|
||||
|
||||
@ -194,7 +209,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function loadlibraryButtons(elem, apiClient, user, userSettings, userViews) {
|
||||
elem.classList.remove('verticalSection');
|
||||
var html = getLibraryButtonsHtml(userViews);
|
||||
const html = getLibraryButtonsHtml(userViews);
|
||||
|
||||
elem.innerHTML = html;
|
||||
imageLoader.lazyChildren(elem);
|
||||
@ -210,8 +225,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getFetchLatestItemsFn(serverId, parentId, collectionType) {
|
||||
return function () {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
var limit = 16;
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
let limit = 16;
|
||||
|
||||
if (enableScrollX()) {
|
||||
if (collectionType === 'music') {
|
||||
@ -227,7 +242,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
}
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
Limit: limit,
|
||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo,Path',
|
||||
ImageTypeLimit: 1,
|
||||
@ -241,8 +256,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getLatestItemsHtmlFn(itemType, viewType) {
|
||||
return function (items) {
|
||||
var cardLayout = false;
|
||||
var shape;
|
||||
const cardLayout = false;
|
||||
let shape;
|
||||
if (itemType === 'Channel' || viewType === 'movies' || viewType === 'books' || viewType === 'tvshows') {
|
||||
shape = getPortraitShape();
|
||||
} else if (viewType === 'music' || viewType === 'homevideos') {
|
||||
@ -272,7 +287,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function renderLatestSection(elem, apiClient, user, parent) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||
if (!layoutManager.tv) {
|
||||
@ -303,7 +318,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
elem.innerHTML = html;
|
||||
|
||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
||||
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||
itemsContainer.fetchData = getFetchLatestItemsFn(apiClient.serverId(), parent.Id, parent.CollectionType);
|
||||
itemsContainer.getItemsHtml = getLatestItemsHtmlFn(parent.Type, parent.CollectionType);
|
||||
itemsContainer.parentContainer = elem;
|
||||
@ -311,10 +326,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function loadRecentlyAdded(elem, apiClient, user, userViews) {
|
||||
elem.classList.remove('verticalSection');
|
||||
var excludeViewTypes = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||
const excludeViewTypes = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||
|
||||
for (var i = 0, length = userViews.length; i < length; i++) {
|
||||
var item = userViews[i];
|
||||
for (let i = 0, length = userViews.length; i < length; i++) {
|
||||
const item = userViews[i];
|
||||
if (user.Configuration.LatestItemsExcludes.indexOf(item.Id) !== -1) {
|
||||
continue;
|
||||
}
|
||||
@ -323,7 +338,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
continue;
|
||||
}
|
||||
|
||||
var frag = document.createElement('div');
|
||||
const frag = document.createElement('div');
|
||||
frag.classList.add('verticalSection');
|
||||
frag.classList.add('hide');
|
||||
elem.appendChild(frag);
|
||||
@ -334,12 +349,14 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getRequirePromise(deps) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(deps, resolve);
|
||||
import(deps).then(() => {
|
||||
return resolve;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function loadLibraryTiles(elem, apiClient, user, userSettings, shape, userViews, allSections) {
|
||||
var html = '';
|
||||
export function loadLibraryTiles(elem, apiClient, user, userSettings, shape, userViews, allSections) {
|
||||
let html = '';
|
||||
if (userViews.length) {
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
||||
if (enableScrollX()) {
|
||||
@ -372,10 +389,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getContinueWatchingFetchFn(serverId) {
|
||||
return function () {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
var screenWidth = dom.getWindowSize().innerWidth;
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
const screenWidth = dom.getWindowSize().innerWidth;
|
||||
|
||||
var limit;
|
||||
let limit;
|
||||
if (enableScrollX()) {
|
||||
limit = 12;
|
||||
} else {
|
||||
@ -383,7 +400,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
limit = Math.min(limit, 5);
|
||||
}
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
Limit: limit,
|
||||
Recursive: true,
|
||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||
@ -398,7 +415,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function getContinueWatchingItemsHtml(items) {
|
||||
var cardLayout = false;
|
||||
const cardLayout = false;
|
||||
return cardBuilder.getCardsHtml({
|
||||
items: items,
|
||||
preferThumb: true,
|
||||
@ -419,7 +436,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function loadResumeVideo(elem, apiClient, userId) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
||||
if (enableScrollX()) {
|
||||
@ -437,7 +454,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
elem.classList.add('hide');
|
||||
elem.innerHTML = html;
|
||||
|
||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
||||
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||
itemsContainer.fetchData = getContinueWatchingFetchFn(apiClient.serverId());
|
||||
itemsContainer.getItemsHtml = getContinueWatchingItemsHtml;
|
||||
itemsContainer.parentContainer = elem;
|
||||
@ -445,10 +462,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getContinueListeningFetchFn(serverId) {
|
||||
return function () {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
var screenWidth = dom.getWindowSize().innerWidth;
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
const screenWidth = dom.getWindowSize().innerWidth;
|
||||
|
||||
var limit;
|
||||
let limit;
|
||||
if (enableScrollX()) {
|
||||
limit = 12;
|
||||
} else {
|
||||
@ -456,7 +473,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
limit = Math.min(limit, 5);
|
||||
}
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
Limit: limit,
|
||||
Recursive: true,
|
||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||
@ -471,7 +488,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function getContinueListeningItemsHtml(items) {
|
||||
var cardLayout = false;
|
||||
const cardLayout = false;
|
||||
return cardBuilder.getCardsHtml({
|
||||
items: items,
|
||||
preferThumb: true,
|
||||
@ -492,7 +509,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function loadResumeAudio(elem, apiClient, userId) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
||||
if (enableScrollX()) {
|
||||
@ -510,7 +527,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
elem.classList.add('hide');
|
||||
elem.innerHTML = html;
|
||||
|
||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
||||
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||
itemsContainer.fetchData = getContinueListeningFetchFn(apiClient.serverId());
|
||||
itemsContainer.getItemsHtml = getContinueListeningItemsHtml;
|
||||
itemsContainer.parentContainer = elem;
|
||||
@ -518,7 +535,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getOnNowFetchFn(serverId) {
|
||||
return function () {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getLiveTvRecommendedPrograms({
|
||||
userId: apiClient.getCurrentUserId(),
|
||||
IsAiring: true,
|
||||
@ -532,7 +549,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function getOnNowItemsHtml(items) {
|
||||
var cardLayout = false;
|
||||
const cardLayout = false;
|
||||
return cardBuilder.getCardsHtml({
|
||||
items: items,
|
||||
preferThumb: 'auto',
|
||||
@ -559,7 +576,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
return Promise.resolve();
|
||||
}
|
||||
|
||||
var userId = user.Id;
|
||||
const userId = user.Id;
|
||||
return apiClient.getLiveTvRecommendedPrograms({
|
||||
userId: apiClient.getCurrentUserId(),
|
||||
IsAiring: true,
|
||||
@ -569,7 +586,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
EnableTotalRecordCount: false,
|
||||
Fields: 'ChannelInfo,PrimaryImageAspectRatio'
|
||||
}).then(function (result) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
if (result.Items.length) {
|
||||
elem.classList.remove('padded-left');
|
||||
elem.classList.remove('padded-right');
|
||||
@ -654,7 +671,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
elem.innerHTML = html;
|
||||
|
||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
||||
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||
itemsContainer.parentContainer = elem;
|
||||
itemsContainer.fetchData = getOnNowFetchFn(apiClient.serverId());
|
||||
itemsContainer.getItemsHtml = getOnNowItemsHtml;
|
||||
@ -664,7 +681,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getNextUpFetchFn(serverId) {
|
||||
return function () {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getNextUpEpisodes({
|
||||
Limit: enableScrollX() ? 24 : 15,
|
||||
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
|
||||
@ -677,7 +694,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function getNextUpItemsHtml(items) {
|
||||
var cardLayout = false;
|
||||
const cardLayout = false;
|
||||
return cardBuilder.getCardsHtml({
|
||||
items: items,
|
||||
preferThumb: true,
|
||||
@ -695,7 +712,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function loadNextUp(elem, apiClient, userId) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||
if (!layoutManager.tv) {
|
||||
@ -727,7 +744,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
elem.classList.add('hide');
|
||||
elem.innerHTML = html;
|
||||
|
||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
||||
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId());
|
||||
itemsContainer.getItemsHtml = getNextUpItemsHtml;
|
||||
itemsContainer.parentContainer = elem;
|
||||
@ -735,7 +752,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
|
||||
return function () {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getLiveTvRecordings({
|
||||
userId: apiClient.getCurrentUserId(),
|
||||
Limit: enableScrollX() ? 12 : 5,
|
||||
@ -749,7 +766,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
|
||||
function getLatestRecordingItemsHtml(activeRecordingsOnly) {
|
||||
return function (items) {
|
||||
var cardLayout = false;
|
||||
const cardLayout = false;
|
||||
return cardBuilder.getCardsHtml({
|
||||
items: items,
|
||||
shape: enableScrollX() ? 'autooverflow' : 'auto',
|
||||
@ -774,11 +791,11 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
}
|
||||
|
||||
function loadLatestLiveTvRecordings(elem, activeRecordingsOnly, apiClient, userId) {
|
||||
var title = activeRecordingsOnly ?
|
||||
const title = activeRecordingsOnly ?
|
||||
globalize.translate('HeaderActiveRecordings') :
|
||||
globalize.translate('HeaderLatestRecordings');
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards">';
|
||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + title + '</h2>';
|
||||
@ -799,18 +816,19 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||
elem.classList.add('hide');
|
||||
elem.innerHTML = html;
|
||||
|
||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
||||
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||
itemsContainer.fetchData = getLatestRecordingsFetchFn(apiClient.serverId(), activeRecordingsOnly);
|
||||
itemsContainer.getItemsHtml = getLatestRecordingItemsHtml(activeRecordingsOnly);
|
||||
itemsContainer.parentContainer = elem;
|
||||
}
|
||||
|
||||
return {
|
||||
export default {
|
||||
loadLibraryTiles: loadLibraryTiles,
|
||||
getDefaultSection: getDefaultSection,
|
||||
loadSections: loadSections,
|
||||
destroySections: destroySections,
|
||||
pause: pause,
|
||||
resume: resume
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,17 +1,20 @@
|
||||
define(['appSettings', 'browser', 'events'], function (appSettings, browser, events) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getSavedVolume() {
|
||||
import appSettings from 'appSettings' ;
|
||||
import browser from 'browser';
|
||||
import events from 'events';
|
||||
|
||||
export function getSavedVolume() {
|
||||
return appSettings.get('volume') || 1;
|
||||
}
|
||||
|
||||
function saveVolume(value) {
|
||||
export function saveVolume(value) {
|
||||
if (value) {
|
||||
appSettings.set('volume', value);
|
||||
}
|
||||
}
|
||||
|
||||
function getCrossOriginValue(mediaSource) {
|
||||
export function getCrossOriginValue(mediaSource) {
|
||||
if (mediaSource.IsRemote) {
|
||||
return null;
|
||||
}
|
||||
@ -30,7 +33,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
return false;
|
||||
}
|
||||
|
||||
function enableHlsShakaPlayer(item, mediaSource, mediaType) {
|
||||
export function enableHlsShakaPlayer(item, mediaSource, mediaType) {
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
if (!!window.MediaSource && !!MediaSource.isTypeSupported) {
|
||||
|
||||
@ -56,7 +59,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
return false;
|
||||
}
|
||||
|
||||
function enableHlsJsPlayer(runTimeTicks, mediaType) {
|
||||
export function enableHlsJsPlayer(runTimeTicks, mediaType) {
|
||||
|
||||
if (window.MediaSource == null) {
|
||||
return false;
|
||||
@ -98,7 +101,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
|
||||
var recoverDecodingErrorDate;
|
||||
var recoverSwapAudioCodecDate;
|
||||
function handleHlsJsMediaError(instance, reject) {
|
||||
export function handleHlsJsMediaError(instance, reject) {
|
||||
|
||||
var hlsPlayer = instance._hlsPlayer;
|
||||
|
||||
@ -134,7 +137,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
}
|
||||
}
|
||||
|
||||
function onErrorInternal(instance, type) {
|
||||
export function onErrorInternal(instance, type) {
|
||||
|
||||
// Needed for video
|
||||
if (instance.destroyCustomTrack) {
|
||||
@ -148,7 +151,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
]);
|
||||
}
|
||||
|
||||
function isValidDuration(duration) {
|
||||
export function isValidDuration(duration) {
|
||||
if (duration && !isNaN(duration) && duration !== Number.POSITIVE_INFINITY && duration !== Number.NEGATIVE_INFINITY) {
|
||||
return true;
|
||||
}
|
||||
@ -162,7 +165,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
}
|
||||
}
|
||||
|
||||
function seekOnPlaybackStart(instance, element, ticks, onMediaReady) {
|
||||
export function seekOnPlaybackStart(instance, element, ticks, onMediaReady) {
|
||||
|
||||
var seconds = (ticks || 0) / 10000000;
|
||||
|
||||
@ -200,7 +203,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
}
|
||||
}
|
||||
|
||||
function applySrc(elem, src, options) {
|
||||
export function applySrc(elem, src, options) {
|
||||
|
||||
if (window.Windows && options.mediaSource && options.mediaSource.IsLocal) {
|
||||
|
||||
@ -228,7 +231,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
elem.addEventListener('error', onErrorFn);
|
||||
}
|
||||
|
||||
function playWithPromise(elem, onErrorFn) {
|
||||
export function playWithPromise(elem, onErrorFn) {
|
||||
|
||||
try {
|
||||
var promise = elem.play();
|
||||
@ -256,7 +259,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
}
|
||||
}
|
||||
|
||||
function destroyCastPlayer(instance) {
|
||||
export function destroyCastPlayer(instance) {
|
||||
|
||||
var player = instance._castPlayer;
|
||||
if (player) {
|
||||
@ -270,7 +273,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
}
|
||||
}
|
||||
|
||||
function destroyShakaPlayer(instance) {
|
||||
export function destroyShakaPlayer(instance) {
|
||||
var player = instance._shakaPlayer;
|
||||
if (player) {
|
||||
try {
|
||||
@ -283,7 +286,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
}
|
||||
}
|
||||
|
||||
function destroyHlsPlayer(instance) {
|
||||
export function destroyHlsPlayer(instance) {
|
||||
var player = instance._hlsPlayer;
|
||||
if (player) {
|
||||
try {
|
||||
@ -296,7 +299,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
}
|
||||
}
|
||||
|
||||
function destroyFlvPlayer(instance) {
|
||||
export function destroyFlvPlayer(instance) {
|
||||
var player = instance._flvPlayer;
|
||||
if (player) {
|
||||
try {
|
||||
@ -311,7 +314,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
}
|
||||
}
|
||||
|
||||
function bindEventsToHlsPlayer(instance, hls, elem, onErrorFn, resolve, reject) {
|
||||
export function bindEventsToHlsPlayer(instance, hls, elem, onErrorFn, resolve, reject) {
|
||||
|
||||
hls.on(Hls.Events.MANIFEST_PARSED, function () {
|
||||
playWithPromise(elem, onErrorFn).then(resolve, function () {
|
||||
@ -403,7 +406,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
});
|
||||
}
|
||||
|
||||
function onEndedInternal(instance, elem, onErrorFn) {
|
||||
export function onEndedInternal(instance, elem, onErrorFn) {
|
||||
|
||||
elem.removeEventListener('error', onErrorFn);
|
||||
|
||||
@ -427,7 +430,7 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
instance._currentPlayOptions = null;
|
||||
}
|
||||
|
||||
function getBufferedRanges(instance, elem) {
|
||||
export function getBufferedRanges(instance, elem) {
|
||||
|
||||
var ranges = [];
|
||||
var seekable = elem.buffered || [];
|
||||
@ -462,23 +465,4 @@ define(['appSettings', 'browser', 'events'], function (appSettings, browser, eve
|
||||
return ranges;
|
||||
}
|
||||
|
||||
return {
|
||||
getSavedVolume: getSavedVolume,
|
||||
saveVolume: saveVolume,
|
||||
enableHlsJsPlayer: enableHlsJsPlayer,
|
||||
enableHlsShakaPlayer: enableHlsShakaPlayer,
|
||||
handleHlsJsMediaError: handleHlsJsMediaError,
|
||||
isValidDuration: isValidDuration,
|
||||
onErrorInternal: onErrorInternal,
|
||||
seekOnPlaybackStart: seekOnPlaybackStart,
|
||||
applySrc: applySrc,
|
||||
playWithPromise: playWithPromise,
|
||||
destroyHlsPlayer: destroyHlsPlayer,
|
||||
destroyFlvPlayer: destroyFlvPlayer,
|
||||
destroyCastPlayer: destroyCastPlayer,
|
||||
bindEventsToHlsPlayer: bindEventsToHlsPlayer,
|
||||
onEndedInternal: onEndedInternal,
|
||||
getCrossOriginValue: getCrossOriginValue,
|
||||
getBufferedRanges: getBufferedRanges
|
||||
};
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
|
@ -339,7 +339,7 @@ define(['dom', 'loading', 'apphost', 'dialogHelper', 'connectionManager', 'image
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.innerHTML = globalize.translateDocument(template, 'core');
|
||||
dlg.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.on(dlg, false);
|
||||
|
@ -1,5 +1,16 @@
|
||||
define(['globalize', 'dom', 'dialogHelper', 'emby-checkbox', 'emby-select', 'emby-input'], function (globalize, dom, dialogHelper) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
/**
|
||||
* Module for image Options Editor.
|
||||
* @module components/imageOptionsEditor/imageOptionsEditor
|
||||
*/
|
||||
|
||||
import globalize from 'globalize';
|
||||
import dom from 'dom';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-select';
|
||||
import 'emby-input';
|
||||
|
||||
function getDefaultImageConfig(itemType, type) {
|
||||
return {
|
||||
@ -10,7 +21,7 @@ define(['globalize', 'dom', 'dialogHelper', 'emby-checkbox', 'emby-select', 'emb
|
||||
}
|
||||
|
||||
function findImageOptions(imageOptions, type) {
|
||||
return imageOptions.filter(function (i) {
|
||||
return imageOptions.filter(i => {
|
||||
return i.Type == type;
|
||||
})[0];
|
||||
}
|
||||
@ -31,14 +42,14 @@ define(['globalize', 'dom', 'dialogHelper', 'emby-checkbox', 'emby-select', 'emb
|
||||
}
|
||||
|
||||
function loadValues(context, itemType, options, availableOptions) {
|
||||
var supportedImageTypes = availableOptions.SupportedImageTypes || [];
|
||||
setVisibilityOfBackdrops(context.querySelector('.backdropFields'), -1 != supportedImageTypes.indexOf('Backdrop'));
|
||||
setVisibilityOfBackdrops(context.querySelector('.screenshotFields'), -1 != supportedImageTypes.indexOf('Screenshot'));
|
||||
Array.prototype.forEach.call(context.querySelectorAll('.imageType'), function (i) {
|
||||
var imageType = i.getAttribute('data-imagetype');
|
||||
var container = dom.parentWithTag(i, 'LABEL');
|
||||
const supportedImageTypes = availableOptions.SupportedImageTypes || [];
|
||||
setVisibilityOfBackdrops(context.querySelector('.backdropFields'), supportedImageTypes.includes('Backdrop'));
|
||||
setVisibilityOfBackdrops(context.querySelector('.screenshotFields'), supportedImageTypes.includes('Screenshot'));
|
||||
Array.prototype.forEach.call(context.querySelectorAll('.imageType'), i => {
|
||||
const imageType = i.getAttribute('data-imagetype');
|
||||
const container = dom.parentWithTag(i, 'LABEL');
|
||||
|
||||
if (-1 == supportedImageTypes.indexOf(imageType)) {
|
||||
if (!supportedImageTypes.includes(imageType)) {
|
||||
container.classList.add('hide');
|
||||
} else {
|
||||
container.classList.remove('hide');
|
||||
@ -50,16 +61,16 @@ define(['globalize', 'dom', 'dialogHelper', 'emby-checkbox', 'emby-select', 'emb
|
||||
i.checked = false;
|
||||
}
|
||||
});
|
||||
var backdropConfig = getImageConfig(options, availableOptions, 'Backdrop', itemType);
|
||||
const backdropConfig = getImageConfig(options, availableOptions, 'Backdrop', itemType);
|
||||
context.querySelector('#txtMaxBackdrops').value = backdropConfig.Limit;
|
||||
context.querySelector('#txtMinBackdropDownloadWidth').value = backdropConfig.MinWidth;
|
||||
var screenshotConfig = getImageConfig(options, availableOptions, 'Screenshot', itemType);
|
||||
const screenshotConfig = getImageConfig(options, availableOptions, 'Screenshot', itemType);
|
||||
context.querySelector('#txtMaxScreenshots').value = screenshotConfig.Limit;
|
||||
context.querySelector('#txtMinScreenshotDownloadWidth').value = screenshotConfig.MinWidth;
|
||||
}
|
||||
|
||||
function saveValues(context, options) {
|
||||
options.ImageOptions = Array.prototype.map.call(context.querySelectorAll('.imageType:not(.hide)'), function (c) {
|
||||
options.ImageOptions = Array.prototype.map.call(context.querySelectorAll('.imageType:not(.hide)'), c => {
|
||||
return {
|
||||
Type: c.getAttribute('data-imagetype'),
|
||||
Limit: c.checked ? 1 : 0,
|
||||
@ -78,35 +89,36 @@ define(['globalize', 'dom', 'dialogHelper', 'emby-checkbox', 'emby-select', 'emb
|
||||
});
|
||||
}
|
||||
|
||||
function editor() {
|
||||
this.show = function (itemType, options, availableOptions) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/imageOptionsEditor/imageOptionsEditor.template.html', true);
|
||||
async function showEditor(itemType, options, availableOptions) {
|
||||
const response = await fetch('components/imageOptionsEditor/imageOptionsEditor.template.html');
|
||||
const template = await response.text();
|
||||
|
||||
xhr.onload = function (e) {
|
||||
var template = this.response;
|
||||
var dlg = dialogHelper.createDialog({
|
||||
size: 'small',
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
});
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.innerHTML = globalize.translateDocument(template);
|
||||
dlg.innerHTML = globalize.translateHtml(template);
|
||||
dlg.addEventListener('close', function () {
|
||||
saveValues(dlg, options);
|
||||
});
|
||||
loadValues(dlg, itemType, options, availableOptions);
|
||||
dialogHelper.open(dlg).then(resolve, resolve);
|
||||
dialogHelper.open(dlg).then(() => {
|
||||
return;
|
||||
}).catch(() => {
|
||||
return;
|
||||
});
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
return editor;
|
||||
});
|
||||
export class editor {
|
||||
constructor() {
|
||||
this.show = showEditor;
|
||||
}
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default editor;
|
||||
|
@ -1,10 +1,26 @@
|
||||
define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', 'layoutManager', 'globalize', 'require', 'emby-button', 'emby-select', 'formDialogStyle', 'css!./style'], function (dialogHelper, connectionManager, dom, loading, scrollHelper, layoutManager, globalize, require) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
var currentItemId;
|
||||
var currentServerId;
|
||||
var currentFile;
|
||||
var hasChanges = false;
|
||||
/**
|
||||
* Module for imageUploader.
|
||||
* @module components/imageUploader/imageUploader
|
||||
*/
|
||||
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import connectionManager from 'connectionManager';
|
||||
import dom from 'dom';
|
||||
import loading from 'loading';
|
||||
import scrollHelper from 'scrollHelper';
|
||||
import layoutManager from 'layoutManager';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-button';
|
||||
import 'emby-select';
|
||||
import 'formDialogStyle';
|
||||
import 'css!./style';
|
||||
|
||||
let currentItemId;
|
||||
let currentServerId;
|
||||
let currentFile;
|
||||
let hasChanges = false;
|
||||
|
||||
function onFileReaderError(evt) {
|
||||
|
||||
@ -12,14 +28,14 @@ define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', '
|
||||
|
||||
switch (evt.target.error.code) {
|
||||
case evt.target.error.NOT_FOUND_ERR:
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('MessageFileReadError'));
|
||||
});
|
||||
break;
|
||||
case evt.target.error.ABORT_ERR:
|
||||
break; // noop
|
||||
default:
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('MessageFileReadError'));
|
||||
});
|
||||
break;
|
||||
@ -28,7 +44,7 @@ define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', '
|
||||
|
||||
function setFiles(page, files) {
|
||||
|
||||
var file = files[0];
|
||||
const file = files[0];
|
||||
|
||||
if (!file || !file.type.match('image.*')) {
|
||||
page.querySelector('#imageOutput').innerHTML = '';
|
||||
@ -39,23 +55,23 @@ define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', '
|
||||
|
||||
currentFile = file;
|
||||
|
||||
var reader = new FileReader();
|
||||
const reader = new FileReader();
|
||||
|
||||
reader.onerror = onFileReaderError;
|
||||
reader.onloadstart = function () {
|
||||
reader.onloadstart = () => {
|
||||
page.querySelector('#fldUpload').classList.add('hide');
|
||||
};
|
||||
reader.onabort = function () {
|
||||
reader.onabort = () => {
|
||||
loading.hide();
|
||||
console.debug('File read cancelled');
|
||||
};
|
||||
|
||||
// Closure to capture the file information.
|
||||
reader.onload = (function (theFile) {
|
||||
return function (e) {
|
||||
reader.onload = (theFile => {
|
||||
return e => {
|
||||
|
||||
// Render thumbnail.
|
||||
var html = ['<img style="max-width:100%;max-height:100%;" src="', e.target.result, '" title="', escape(theFile.name), '"/>'].join('');
|
||||
const html = ['<img style="max-width:100%;max-height:100%;" src="', e.target.result, '" title="', escape(theFile.name), '"/>'].join('');
|
||||
|
||||
page.querySelector('#imageOutput').innerHTML = html;
|
||||
page.querySelector('#dropImageText').classList.add('hide');
|
||||
@ -69,14 +85,14 @@ define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', '
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
var file = currentFile;
|
||||
const file = currentFile;
|
||||
|
||||
if (!file) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!file.type.startsWith('image/')) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('MessageImageFileTypeAllowed'));
|
||||
});
|
||||
e.preventDefault();
|
||||
@ -85,18 +101,18 @@ define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', '
|
||||
|
||||
loading.show();
|
||||
|
||||
var dlg = dom.parentWithClass(this, 'dialog');
|
||||
const dlg = dom.parentWithClass(this, 'dialog');
|
||||
|
||||
var imageType = dlg.querySelector('#selectImageType').value;
|
||||
const imageType = dlg.querySelector('#selectImageType').value;
|
||||
if (imageType === 'None') {
|
||||
require(['toast'], function(toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('MessageImageTypeNotSelected'));
|
||||
});
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
connectionManager.getApiClient(currentServerId).uploadItemImage(currentItemId, imageType, file).then(function () {
|
||||
connectionManager.getApiClient(currentServerId).uploadItemImage(currentItemId, imageType, file).then(() => {
|
||||
|
||||
dlg.querySelector('#uploadImage').value = '';
|
||||
|
||||
@ -117,21 +133,21 @@ define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', '
|
||||
setFiles(page, this.files);
|
||||
});
|
||||
|
||||
page.querySelector('.btnBrowse').addEventListener('click', function () {
|
||||
page.querySelector('.btnBrowse').addEventListener('click', () => {
|
||||
page.querySelector('#uploadImage').click();
|
||||
});
|
||||
}
|
||||
|
||||
function showEditor(options, resolve, reject) {
|
||||
function showEditor(options, resolve) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
require(['text!./imageUploader.template.html'], function (template) {
|
||||
return import('text!./imageUploader.template.html').then(({default: template}) => {
|
||||
|
||||
currentItemId = options.itemId;
|
||||
currentServerId = options.serverId;
|
||||
|
||||
var dialogOptions = {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true
|
||||
};
|
||||
|
||||
@ -141,18 +157,18 @@ define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', '
|
||||
dialogOptions.size = 'small';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
dlg.innerHTML = globalize.translateDocument(template, 'core');
|
||||
dlg.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.on(dlg, false);
|
||||
}
|
||||
|
||||
// Has to be assigned a z-index after the call to .open()
|
||||
dlg.addEventListener('close', function () {
|
||||
dlg.addEventListener('close', () => {
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.off(dlg, false);
|
||||
@ -168,22 +184,24 @@ define(['dialogHelper', 'connectionManager', 'dom', 'loading', 'scrollHelper', '
|
||||
|
||||
dlg.querySelector('#selectImageType').value = options.imageType || 'Primary';
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
show: function (options) {
|
||||
export function show(options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise(resolve => {
|
||||
|
||||
hasChanges = false;
|
||||
|
||||
showEditor(options, resolve, reject);
|
||||
showEditor(options, resolve);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default {
|
||||
show: show
|
||||
};
|
||||
|
@ -200,7 +200,7 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm({
|
||||
confirm.default({
|
||||
|
||||
text: globalize.translate('ConfirmDeleteImage'),
|
||||
confirmText: globalize.translate('Delete'),
|
||||
@ -464,7 +464,7 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
dlg.innerHTML = globalize.translateDocument(template, 'core');
|
||||
dlg.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.on(dlg, false);
|
||||
|
@ -1,14 +1,24 @@
|
||||
define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter', 'playbackManager', 'loading', 'appSettings', 'browser', 'actionsheet'], function (appHost, globalize, connectionManager, itemHelper, appRouter, playbackManager, loading, appSettings, browser, actionsheet) {
|
||||
'use strict';
|
||||
import appHost from 'apphost';
|
||||
import globalize from 'globalize';
|
||||
import connectionManager from 'connectionManager';
|
||||
import itemHelper from 'itemHelper';
|
||||
import appRouter from 'appRouter';
|
||||
import playbackManager from 'playbackManager';
|
||||
import loading from 'loading';
|
||||
import appSettings from 'appSettings';
|
||||
import browser from 'browser';
|
||||
import actionsheet from 'actionsheet';
|
||||
|
||||
function getCommands(options) {
|
||||
var item = options.item;
|
||||
var user = options.user;
|
||||
/* eslint-disable indent */
|
||||
|
||||
var canPlay = playbackManager.canPlay(item);
|
||||
var restrictOptions = (browser.operaTv || browser.web0s) && !user.Policy.IsAdministrator;
|
||||
export function getCommands(options) {
|
||||
const item = options.item;
|
||||
const user = options.user;
|
||||
|
||||
var commands = [];
|
||||
const canPlay = playbackManager.canPlay(item);
|
||||
const restrictOptions = (browser.operaTv || browser.web0s) && !user.Policy.IsAdministrator;
|
||||
|
||||
let commands = [];
|
||||
|
||||
if (canPlay && item.MediaType !== 'Photo') {
|
||||
if (options.play !== false) {
|
||||
@ -171,10 +181,10 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
});
|
||||
}
|
||||
|
||||
var canEdit = itemHelper.canEdit(user, item);
|
||||
const canEdit = itemHelper.canEdit(user, item);
|
||||
if (canEdit) {
|
||||
if (options.edit !== false && item.Type !== 'SeriesTimer') {
|
||||
var text = (item.Type === 'Timer' || item.Type === 'SeriesTimer') ? globalize.translate('Edit') : globalize.translate('EditMetadata');
|
||||
const text = (item.Type === 'Timer' || item.Type === 'SeriesTimer') ? globalize.translate('Edit') : globalize.translate('EditMetadata');
|
||||
commands.push({
|
||||
name: text,
|
||||
id: 'edit',
|
||||
@ -322,31 +332,31 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
}
|
||||
|
||||
function executeCommand(item, id, options) {
|
||||
var itemId = item.Id;
|
||||
var serverId = item.ServerId;
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const itemId = item.Id;
|
||||
const serverId = item.ServerId;
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
switch (id) {
|
||||
case 'addtocollection':
|
||||
require(['collectionEditor'], function (collectionEditor) {
|
||||
new collectionEditor().show({
|
||||
import('collectionEditor').then(({default: collectionEditor}) => {
|
||||
new collectionEditor({
|
||||
items: [itemId],
|
||||
serverId: serverId
|
||||
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||
});
|
||||
break;
|
||||
case 'addtoplaylist':
|
||||
require(['playlistEditor'], function (playlistEditor) {
|
||||
new playlistEditor().show({
|
||||
import('playlistEditor').then(({default: playlistEditor}) => {
|
||||
new playlistEditor({
|
||||
items: [itemId],
|
||||
serverId: serverId
|
||||
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||
});
|
||||
break;
|
||||
case 'download':
|
||||
require(['fileDownloader'], function (fileDownloader) {
|
||||
var downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||
import('fileDownloader').then(({default: fileDownloader}) => {
|
||||
const downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||
fileDownloader.download([{
|
||||
url: downloadHref,
|
||||
itemId: itemId,
|
||||
@ -357,17 +367,17 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
getResolveFunction(getResolveFunction(resolve, id), id)();
|
||||
});
|
||||
break;
|
||||
case 'copy-stream':
|
||||
var downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||
var textAreaCopy = function () {
|
||||
var textArea = document.createElement('textarea');
|
||||
case 'copy-stream': {
|
||||
const downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||
const textAreaCopy = function () {
|
||||
let textArea = document.createElement('textarea');
|
||||
textArea.value = downloadHref;
|
||||
document.body.appendChild(textArea);
|
||||
textArea.focus();
|
||||
textArea.select();
|
||||
|
||||
if (document.execCommand('copy')) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('CopyStreamURLSuccess'));
|
||||
});
|
||||
} else {
|
||||
@ -382,7 +392,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
} else {
|
||||
/* eslint-disable-next-line compat/compat */
|
||||
navigator.clipboard.writeText(downloadHref).then(function () {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('CopyStreamURLSuccess'));
|
||||
});
|
||||
}).catch(function () {
|
||||
@ -391,8 +401,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
}
|
||||
getResolveFunction(resolve, id)();
|
||||
break;
|
||||
}
|
||||
case 'editsubtitles':
|
||||
require(['subtitleEditor'], function (subtitleEditor) {
|
||||
import('subtitleEditor').then(({default: subtitleEditor}) => {
|
||||
subtitleEditor.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||
});
|
||||
break;
|
||||
@ -400,7 +411,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
editItem(apiClient, item).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||
break;
|
||||
case 'editimages':
|
||||
require(['imageEditor'], function (imageEditor) {
|
||||
import('imageEditor').then(({default: imageEditor}) => {
|
||||
imageEditor.show({
|
||||
itemId: itemId,
|
||||
serverId: serverId
|
||||
@ -408,12 +419,12 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
});
|
||||
break;
|
||||
case 'identify':
|
||||
require(['itemIdentifier'], function (itemIdentifier) {
|
||||
import('itemIdentifier').then(({default: itemIdentifier}) => {
|
||||
itemIdentifier.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||
});
|
||||
break;
|
||||
case 'moremediainfo':
|
||||
require(['itemMediaInfo'], function (itemMediaInfo) {
|
||||
import('itemMediaInfo').then(({default: itemMediaInfo}) => {
|
||||
itemMediaInfo.show(itemId, serverId).then(getResolveFunction(resolve, id), getResolveFunction(resolve, id));
|
||||
});
|
||||
break;
|
||||
@ -448,7 +459,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
playbackManager.clearQueue();
|
||||
break;
|
||||
case 'record':
|
||||
require(['recordingCreator'], function (recordingCreator) {
|
||||
import('recordingCreator').then(({default: recordingCreator}) => {
|
||||
recordingCreator.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||
});
|
||||
break;
|
||||
@ -519,8 +530,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
}
|
||||
|
||||
function deleteTimer(apiClient, item, resolve, command) {
|
||||
require(['recordingHelper'], function (recordingHelper) {
|
||||
var timerId = item.TimerId || item.Id;
|
||||
import('recordingHelper').then(({default: recordingHelper}) => {
|
||||
const timerId = item.TimerId || item.Id;
|
||||
recordingHelper.cancelTimerWithConfirmation(timerId, item.ServerId).then(function () {
|
||||
getResolveFunction(resolve, command, true)();
|
||||
});
|
||||
@ -528,7 +539,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
}
|
||||
|
||||
function deleteSeriesTimer(apiClient, item, resolve, command) {
|
||||
require(['recordingHelper'], function (recordingHelper) {
|
||||
import('recordingHelper').then(({default: recordingHelper}) => {
|
||||
recordingHelper.cancelSeriesTimerWithConfirmation(item.Id, item.ServerId).then(function () {
|
||||
getResolveFunction(resolve, command, true)();
|
||||
});
|
||||
@ -536,9 +547,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
}
|
||||
|
||||
function play(item, resume, queue, queueNext) {
|
||||
var method = queue ? (queueNext ? 'queueNext' : 'queue') : 'play';
|
||||
const method = queue ? (queueNext ? 'queueNext' : 'queue') : 'play';
|
||||
|
||||
var startPosition = 0;
|
||||
let startPosition = 0;
|
||||
if (resume && item.UserData && item.UserData.PlaybackPositionTicks) {
|
||||
startPosition = item.UserData.PlaybackPositionTicks;
|
||||
}
|
||||
@ -559,18 +570,18 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
|
||||
function editItem(apiClient, item) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
var serverId = apiClient.serverInfo().Id;
|
||||
const serverId = apiClient.serverInfo().Id;
|
||||
|
||||
if (item.Type === 'Timer') {
|
||||
require(['recordingEditor'], function (recordingEditor) {
|
||||
import('recordingEditor').then(({default: recordingEditor}) => {
|
||||
recordingEditor.show(item.Id, serverId).then(resolve, reject);
|
||||
});
|
||||
} else if (item.Type === 'SeriesTimer') {
|
||||
require(['seriesRecordingEditor'], function (recordingEditor) {
|
||||
import('seriesRecordingEditor').then(({default: recordingEditor}) => {
|
||||
recordingEditor.show(item.Id, serverId).then(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
require(['metadataEditor'], function (metadataEditor) {
|
||||
import('metadataEditor').then(({default: metadataEditor}) => {
|
||||
metadataEditor.show(item.Id, serverId).then(resolve, reject);
|
||||
});
|
||||
}
|
||||
@ -579,7 +590,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
|
||||
function deleteItem(apiClient, item) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(['deleteHelper'], function (deleteHelper) {
|
||||
import('deleteHelper').then(({default: deleteHelper}) => {
|
||||
deleteHelper.deleteItem({
|
||||
item: item,
|
||||
navigate: false
|
||||
@ -591,7 +602,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
}
|
||||
|
||||
function refresh(apiClient, item) {
|
||||
require(['refreshDialog'], function (refreshDialog) {
|
||||
import('refreshDialog').then(({default: refreshDialog}) => {
|
||||
new refreshDialog({
|
||||
itemIds: [item.Id],
|
||||
serverId: apiClient.serverInfo().Id,
|
||||
@ -600,8 +611,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
});
|
||||
}
|
||||
|
||||
function show(options) {
|
||||
var commands = getCommands(options);
|
||||
export function show(options) {
|
||||
const commands = getCommands(options);
|
||||
if (!commands.length) {
|
||||
return Promise.reject();
|
||||
}
|
||||
@ -615,8 +626,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
/* eslint-enable indent */
|
||||
|
||||
export default {
|
||||
getCommands: getCommands,
|
||||
show: show
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -1,44 +1,61 @@
|
||||
define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings', 'connectionManager', 'loading', 'focusManager', 'dom', 'apphost', 'emby-select', 'listViewStyle', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'emby-button', 'flexStyles'], function (dialogHelper, require, layoutManager, globalize, userSettings, connectionManager, loading, focusManager, dom, appHost) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
/**
|
||||
* Module for display media info.
|
||||
* @module components/itemMediaInfo/itemMediaInfo
|
||||
*/
|
||||
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import layoutManager from 'layoutManager';
|
||||
import globalize from 'globalize';
|
||||
import connectionManager from 'connectionManager';
|
||||
import loading from 'loading';
|
||||
import 'emby-select';
|
||||
import 'listViewStyle';
|
||||
import 'paper-icon-button-light';
|
||||
import 'css!./../formdialog';
|
||||
import 'material-icons';
|
||||
import 'emby-button';
|
||||
import 'flexStyles';
|
||||
|
||||
function setMediaInfo(user, page, item) {
|
||||
var html = item.MediaSources.map(function (version) {
|
||||
let html = item.MediaSources.map(version => {
|
||||
return getMediaSourceHtml(user, item, version);
|
||||
}).join('<div style="border-top:1px solid #444;margin: 1em 0;"></div>');
|
||||
if (item.MediaSources.length > 1) {
|
||||
html = '<br/>' + html;
|
||||
html = `<br/>${html}`;
|
||||
}
|
||||
var mediaInfoContent = page.querySelector('#mediaInfoContent');
|
||||
const mediaInfoContent = page.querySelector('#mediaInfoContent');
|
||||
mediaInfoContent.innerHTML = html;
|
||||
}
|
||||
|
||||
function getMediaSourceHtml(user, item, version) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
if (version.Name) {
|
||||
html += '<div><h2 class="mediaInfoStreamType">' + version.Name + '</h2></div>';
|
||||
html += `<div><h2 class="mediaInfoStreamType">${version.Name}</h2></div>`;
|
||||
}
|
||||
if (version.Container) {
|
||||
html += createAttribute(globalize.translate('MediaInfoContainer'), version.Container) + '<br/>';
|
||||
html += `${createAttribute(globalize.translate('MediaInfoContainer'), version.Container)}<br/>`;
|
||||
}
|
||||
if (version.Formats && version.Formats.length) {
|
||||
html += createAttribute(globalize.translate('MediaInfoFormat'), version.Formats.join(',')) + '<br/>';
|
||||
html += `${createAttribute(globalize.translate('MediaInfoFormat'), version.Formats.join(','))}<br/>`;
|
||||
}
|
||||
if (version.Path && user && user.Policy.IsAdministrator) {
|
||||
html += createAttribute(globalize.translate('MediaInfoPath'), version.Path) + '<br/>';
|
||||
html += `${createAttribute(globalize.translate('MediaInfoPath'), version.Path)}<br/>`;
|
||||
}
|
||||
if (version.Size) {
|
||||
var size = (version.Size / (1024 * 1024)).toFixed(0) + ' MB';
|
||||
html += createAttribute(globalize.translate('MediaInfoSize'), size) + '<br/>';
|
||||
const size = `${(version.Size / (1024 * 1024)).toFixed(0)} MB`;
|
||||
html += `${createAttribute(globalize.translate('MediaInfoSize'), size)}<br/>`;
|
||||
}
|
||||
for (var i = 0, length = version.MediaStreams.length; i < length; i++) {
|
||||
var stream = version.MediaStreams[i];
|
||||
for (let i = 0, length = version.MediaStreams.length; i < length; i++) {
|
||||
const stream = version.MediaStreams[i];
|
||||
if (stream.Type === 'Data') {
|
||||
continue;
|
||||
}
|
||||
html += '<div class="mediaInfoStream">';
|
||||
var displayType = globalize.translate('MediaInfoStreamType' + stream.Type);
|
||||
html += '<h2 class="mediaInfoStreamType">' + displayType + '</h2>';
|
||||
var attributes = [];
|
||||
const displayType = globalize.translate(`MediaInfoStreamType${stream.Type}`);
|
||||
html += `<h2 class="mediaInfoStreamType">${displayType}</h2>`;
|
||||
const attributes = [];
|
||||
if (stream.DisplayTitle) {
|
||||
attributes.push(createAttribute('Title', stream.DisplayTitle));
|
||||
}
|
||||
@ -61,7 +78,7 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoLevel'), stream.Level));
|
||||
}
|
||||
if (stream.Width || stream.Height) {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoResolution'), stream.Width + 'x' + stream.Height));
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoResolution'), `${stream.Width}x${stream.Height}`));
|
||||
}
|
||||
if (stream.AspectRatio && stream.Codec !== 'mjpeg') {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoAspectRatio'), stream.AspectRatio));
|
||||
@ -79,16 +96,16 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoLayout'), stream.ChannelLayout));
|
||||
}
|
||||
if (stream.Channels) {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoChannels'), stream.Channels + ' ch'));
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoChannels'), `${stream.Channels} ch`));
|
||||
}
|
||||
if (stream.BitRate && stream.Codec !== 'mjpeg') {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoBitrate'), (parseInt(stream.BitRate / 1000)) + ' kbps'));
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoBitrate'), `${parseInt(stream.BitRate / 1000)} kbps`));
|
||||
}
|
||||
if (stream.SampleRate) {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoSampleRate'), stream.SampleRate + ' Hz'));
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoSampleRate'), `${stream.SampleRate} Hz`));
|
||||
}
|
||||
if (stream.BitDepth) {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoBitDepth'), stream.BitDepth + ' bit'));
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoBitDepth'), `${stream.BitDepth} bit`));
|
||||
}
|
||||
if (stream.PixelFormat) {
|
||||
attributes.push(createAttribute(globalize.translate('MediaInfoPixelFormat'), stream.PixelFormat));
|
||||
@ -116,13 +133,13 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
||||
}
|
||||
|
||||
function createAttribute(label, value) {
|
||||
return '<span class="mediaInfoLabel">' + label + '</span><span class="mediaInfoAttribute">' + value + '</span>';
|
||||
return `<span class="mediaInfoLabel">${label}</span><span class="mediaInfoAttribute">${value}</span>`;
|
||||
}
|
||||
|
||||
function showMediaInfoMore(itemId, serverId, template) {
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||
var dialogOptions = {
|
||||
function loadMediaInfo(itemId, serverId, template) {
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
|
||||
const dialogOptions = {
|
||||
size: 'small',
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
@ -130,35 +147,35 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
||||
if (layoutManager.tv) {
|
||||
dialogOptions.size = 'fullscreen';
|
||||
}
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
dlg.classList.add('formDialog');
|
||||
var html = '';
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
let html = '';
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
dlg.innerHTML = html;
|
||||
if (layoutManager.tv) {
|
||||
dlg.querySelector('.formDialogContent');
|
||||
}
|
||||
dialogHelper.open(dlg);
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
apiClient.getCurrentUser().then(function (user) {
|
||||
apiClient.getCurrentUser().then(user => {
|
||||
setMediaInfo(user, dlg, item);
|
||||
});
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function showMediaInfo(itemId, serverId) {
|
||||
export function show(itemId, serverId) {
|
||||
loading.show();
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(['text!./itemMediaInfo.template.html'], function (template) {
|
||||
showMediaInfoMore(itemId, serverId, template).then(resolve, reject);
|
||||
return import('text!./itemMediaInfo.template.html').then(({default: template}) => {
|
||||
return new Promise((resolve, reject) => {
|
||||
loadMediaInfo(itemId, serverId, template).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
show: showMediaInfo
|
||||
};
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
export default {
|
||||
show: show
|
||||
};
|
||||
|
@ -1,15 +1,34 @@
|
||||
define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize', 'scrollHelper', 'layoutManager', 'focusManager', 'browser', 'emby-input', 'emby-checkbox', 'paper-icon-button-light', 'css!./../formdialog', 'material-icons', 'cardStyle'], function (dialogHelper, loading, connectionManager, require, globalize, scrollHelper, layoutManager, focusManager, browser) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
var enableFocusTransform = !browser.slow && !browser.edge;
|
||||
/**
|
||||
* Module for itemidentifier media item.
|
||||
* @module components/itemidentifier/itemidentifier
|
||||
*/
|
||||
|
||||
var currentItem;
|
||||
var currentItemType;
|
||||
var currentServerId;
|
||||
var currentResolve;
|
||||
var currentReject;
|
||||
var hasChanges = false;
|
||||
var currentSearchResult;
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import loading from 'loading';
|
||||
import connectionManager from 'connectionManager';
|
||||
import globalize from 'globalize';
|
||||
import scrollHelper from 'scrollHelper';
|
||||
import layoutManager from 'layoutManager';
|
||||
import focusManager from 'focusManager';
|
||||
import browser from 'browser';
|
||||
import 'emby-input';
|
||||
import 'emby-checkbox';
|
||||
import 'paper-icon-button-light';
|
||||
import 'css!./../formdialog';
|
||||
import 'material-icons';
|
||||
import 'cardStyle';
|
||||
|
||||
const enableFocusTransform = !browser.slow && !browser.edge;
|
||||
|
||||
let currentItem;
|
||||
let currentItemType;
|
||||
let currentServerId;
|
||||
let currentResolve;
|
||||
let currentReject;
|
||||
let hasChanges = false;
|
||||
let currentSearchResult;
|
||||
|
||||
function getApiClient() {
|
||||
return connectionManager.getApiClient(currentServerId);
|
||||
@ -17,14 +36,14 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
function searchForIdentificationResults(page) {
|
||||
|
||||
var lookupInfo = {
|
||||
let lookupInfo = {
|
||||
ProviderIds: {}
|
||||
};
|
||||
|
||||
var i;
|
||||
var length;
|
||||
var identifyField = page.querySelectorAll('.identifyField');
|
||||
var value;
|
||||
let i;
|
||||
let length;
|
||||
const identifyField = page.querySelectorAll('.identifyField');
|
||||
let value;
|
||||
for (i = 0, length = identifyField.length; i < length; i++) {
|
||||
|
||||
value = identifyField[i].value;
|
||||
@ -39,9 +58,9 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
}
|
||||
}
|
||||
|
||||
var hasId = false;
|
||||
let hasId = false;
|
||||
|
||||
var txtLookupId = page.querySelectorAll('.txtLookupId');
|
||||
const txtLookupId = page.querySelectorAll('.txtLookupId');
|
||||
for (i = 0, length = txtLookupId.length; i < length; i++) {
|
||||
|
||||
value = txtLookupId[i].value;
|
||||
@ -53,7 +72,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
}
|
||||
|
||||
if (!hasId && !lookupInfo.Name) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('PleaseEnterNameOrId'));
|
||||
});
|
||||
return;
|
||||
@ -71,16 +90,16 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
loading.show();
|
||||
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
|
||||
apiClient.ajax({
|
||||
type: 'POST',
|
||||
url: apiClient.getUrl('Items/RemoteSearch/' + currentItemType),
|
||||
url: apiClient.getUrl(`Items/RemoteSearch/${currentItemType}`),
|
||||
data: JSON.stringify(lookupInfo),
|
||||
contentType: 'application/json',
|
||||
dataType: 'json'
|
||||
|
||||
}).then(function (results) {
|
||||
}).then(results => {
|
||||
|
||||
loading.hide();
|
||||
showIdentificationSearchResults(page, results);
|
||||
@ -89,29 +108,29 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
function showIdentificationSearchResults(page, results) {
|
||||
|
||||
var identificationSearchResults = page.querySelector('.identificationSearchResults');
|
||||
const identificationSearchResults = page.querySelector('.identificationSearchResults');
|
||||
|
||||
page.querySelector('.popupIdentifyForm').classList.add('hide');
|
||||
identificationSearchResults.classList.remove('hide');
|
||||
page.querySelector('.identifyOptionsForm').classList.add('hide');
|
||||
page.querySelector('.dialogContentInner').classList.remove('dialog-content-centered');
|
||||
|
||||
var html = '';
|
||||
var i;
|
||||
var length;
|
||||
let html = '';
|
||||
let i;
|
||||
let length;
|
||||
for (i = 0, length = results.length; i < length; i++) {
|
||||
|
||||
var result = results[i];
|
||||
const result = results[i];
|
||||
html += getSearchResultHtml(result, i);
|
||||
}
|
||||
|
||||
var elem = page.querySelector('.identificationSearchResultList');
|
||||
const elem = page.querySelector('.identificationSearchResultList');
|
||||
elem.innerHTML = html;
|
||||
|
||||
function onSearchImageClick() {
|
||||
var index = parseInt(this.getAttribute('data-index'));
|
||||
const index = parseInt(this.getAttribute('data-index'));
|
||||
|
||||
var currentResult = results[index];
|
||||
const currentResult = results[index];
|
||||
|
||||
if (currentItem != null) {
|
||||
|
||||
@ -122,7 +141,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
}
|
||||
}
|
||||
|
||||
var searchImages = elem.querySelectorAll('.card');
|
||||
const searchImages = elem.querySelectorAll('.card');
|
||||
for (i = 0, length = searchImages.length; i < length; i++) {
|
||||
|
||||
searchImages[i].addEventListener('click', onSearchImageClick);
|
||||
@ -143,7 +162,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
function showIdentifyOptions(page, identifyResult) {
|
||||
|
||||
var identifyOptionsForm = page.querySelector('.identifyOptionsForm');
|
||||
const identifyOptionsForm = page.querySelector('.identifyOptionsForm');
|
||||
|
||||
page.querySelector('.popupIdentifyForm').classList.add('hide');
|
||||
page.querySelector('.identificationSearchResults').classList.add('hide');
|
||||
@ -153,19 +172,19 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
currentSearchResult = identifyResult;
|
||||
|
||||
var lines = [];
|
||||
const lines = [];
|
||||
lines.push(identifyResult.Name);
|
||||
|
||||
if (identifyResult.ProductionYear) {
|
||||
lines.push(identifyResult.ProductionYear);
|
||||
}
|
||||
|
||||
var resultHtml = lines.join('<br/>');
|
||||
let resultHtml = lines.join('<br/>');
|
||||
|
||||
if (identifyResult.ImageUrl) {
|
||||
var displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName);
|
||||
const displayUrl = getSearchImageDisplayUrl(identifyResult.ImageUrl, identifyResult.SearchProviderName);
|
||||
|
||||
resultHtml = '<div style="display:flex;align-items:center;"><img src="' + displayUrl + '" style="max-height:240px;" /><div style="margin-left:1em;">' + resultHtml + '</div>';
|
||||
resultHtml = `<div style="display:flex;align-items:center;"><img src="${displayUrl}" style="max-height:240px;" /><div style="margin-left:1em;">${resultHtml}</div>`;
|
||||
}
|
||||
|
||||
page.querySelector('.selectedSearchResult').innerHTML = resultHtml;
|
||||
@ -177,10 +196,10 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
// TODO move card creation code to Card component
|
||||
|
||||
var html = '';
|
||||
var cssClass = 'card scalableCard';
|
||||
var cardBoxCssClass = 'cardBox';
|
||||
var padderClass;
|
||||
let html = '';
|
||||
let cssClass = 'card scalableCard';
|
||||
let cardBoxCssClass = 'cardBox';
|
||||
let padderClass;
|
||||
|
||||
if (currentItemType === 'Episode') {
|
||||
cssClass += ' backdropCard backdropCard-scalable';
|
||||
@ -203,30 +222,30 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
cardBoxCssClass += ' cardBox-bottompadded';
|
||||
|
||||
html += '<button type="button" class="' + cssClass + '" data-index="' + index + '">';
|
||||
html += '<div class="' + cardBoxCssClass + '">';
|
||||
html += `<button type="button" class="${cssClass}" data-index="${index}">`;
|
||||
html += `<div class="${cardBoxCssClass}">`;
|
||||
html += '<div class="cardScalable">';
|
||||
html += '<div class="' + padderClass + '"></div>';
|
||||
html += `<div class="${padderClass}"></div>`;
|
||||
|
||||
html += '<div class="cardContent searchImage">';
|
||||
|
||||
if (result.ImageUrl) {
|
||||
var displayUrl = getSearchImageDisplayUrl(result.ImageUrl, result.SearchProviderName);
|
||||
const displayUrl = getSearchImageDisplayUrl(result.ImageUrl, result.SearchProviderName);
|
||||
|
||||
html += '<div class="cardImageContainer coveredImage" style="background-image:url(\'' + displayUrl + '\');"></div>';
|
||||
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 class="cardImageContainer coveredImage defaultCardBackground defaultCardBackground1"><div class="cardText cardCenteredText">${result.Name}</div></div>`;
|
||||
}
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
||||
var numLines = 3;
|
||||
let numLines = 3;
|
||||
if (currentItemType === 'MusicAlbum') {
|
||||
numLines++;
|
||||
}
|
||||
|
||||
var lines = [result.Name];
|
||||
const lines = [result.Name];
|
||||
|
||||
lines.push(result.SearchProviderName);
|
||||
|
||||
@ -237,7 +256,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
lines.push(result.ProductionYear);
|
||||
}
|
||||
|
||||
for (var i = 0; i < numLines; i++) {
|
||||
for (let i = 0; i < numLines; i++) {
|
||||
|
||||
if (i === 0) {
|
||||
html += '<div class="cardText cardText-first cardTextCentered">';
|
||||
@ -254,7 +273,7 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
}
|
||||
|
||||
function getSearchImageDisplayUrl(url, provider) {
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
|
||||
return apiClient.getUrl('Items/RemoteSearch/Image', { imageUrl: url, ProviderName: provider });
|
||||
}
|
||||
@ -263,26 +282,26 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
loading.show();
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
ReplaceAllImages: page.querySelector('#chkIdentifyReplaceImages').checked
|
||||
};
|
||||
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
|
||||
apiClient.ajax({
|
||||
type: 'POST',
|
||||
url: apiClient.getUrl('Items/RemoteSearch/Apply/' + currentItem.Id, options),
|
||||
url: apiClient.getUrl(`Items/RemoteSearch/Apply/${currentItem.Id}`, options),
|
||||
data: JSON.stringify(currentSearchResult),
|
||||
contentType: 'application/json'
|
||||
|
||||
}).then(function () {
|
||||
}).then(() => {
|
||||
|
||||
hasChanges = true;
|
||||
loading.hide();
|
||||
|
||||
dialogHelper.close(page);
|
||||
|
||||
}, function () {
|
||||
}, () => {
|
||||
|
||||
loading.hide();
|
||||
|
||||
@ -292,28 +311,28 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
function showIdentificationForm(page, item) {
|
||||
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
|
||||
apiClient.getJSON(apiClient.getUrl('Items/' + item.Id + '/ExternalIdInfos')).then(function (idList) {
|
||||
apiClient.getJSON(apiClient.getUrl(`Items/${item.Id}/ExternalIdInfos`)).then(idList => {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
for (var i = 0, length = idList.length; i < length; i++) {
|
||||
for (let i = 0, length = idList.length; i < length; i++) {
|
||||
|
||||
var idInfo = idList[i];
|
||||
const idInfo = idList[i];
|
||||
|
||||
var id = 'txtLookup' + idInfo.Key;
|
||||
const id = `txtLookup${idInfo.Key}`;
|
||||
|
||||
html += '<div class="inputContainer">';
|
||||
|
||||
var fullName = idInfo.Name;
|
||||
let fullName = idInfo.Name;
|
||||
if (idInfo.Type) {
|
||||
fullName = idInfo.Name + ' ' + globalize.translate(idInfo.Type);
|
||||
fullName = `${idInfo.Name} ${globalize.translate(idInfo.Type)}`;
|
||||
}
|
||||
|
||||
var idLabel = globalize.translate('LabelDynamicExternalId', fullName);
|
||||
const idLabel = globalize.translate('LabelDynamicExternalId', fullName);
|
||||
|
||||
html += '<input is="emby-input" class="txtLookupId" data-providerkey="' + idInfo.Key + '" id="' + id + '" label="' + idLabel + '"/>';
|
||||
html += `<input is="emby-input" class="txtLookupId" data-providerkey="${idInfo.Key}" id="${id}" label="${idLabel}"/>`;
|
||||
|
||||
html += '</div>';
|
||||
}
|
||||
@ -340,16 +359,16 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
loading.show();
|
||||
|
||||
require(['text!./itemidentifier.template.html'], function (template) {
|
||||
return import('text!./itemidentifier.template.html').then(({default: template}) => {
|
||||
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(function (item) {
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), itemId).then(item => {
|
||||
|
||||
currentItem = item;
|
||||
currentItemType = currentItem.Type;
|
||||
|
||||
var dialogOptions = {
|
||||
const dialogOptions = {
|
||||
size: 'small',
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
@ -359,13 +378,13 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
dialogOptions.size = 'fullscreen';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.classList.add('recordingDialog');
|
||||
|
||||
var html = '';
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
let html = '';
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
@ -386,21 +405,21 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
dialogHelper.open(dlg);
|
||||
|
||||
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', function (e) {
|
||||
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', e => {
|
||||
|
||||
e.preventDefault();
|
||||
searchForIdentificationResults(dlg);
|
||||
return false;
|
||||
});
|
||||
|
||||
dlg.querySelector('.identifyOptionsForm').addEventListener('submit', function (e) {
|
||||
dlg.querySelector('.identifyOptionsForm').addEventListener('submit', e => {
|
||||
|
||||
e.preventDefault();
|
||||
submitIdentficationResult(dlg);
|
||||
return false;
|
||||
});
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
@ -423,14 +442,15 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
}
|
||||
}
|
||||
|
||||
// TODO investigate where this was used
|
||||
function showEditorFindNew(itemName, itemYear, itemType, resolveFunc) {
|
||||
|
||||
currentItem = null;
|
||||
currentItemType = itemType;
|
||||
|
||||
require(['text!./itemidentifier.template.html'], function (template) {
|
||||
return import('text!./itemidentifier.template.html').then(({default: template}) => {
|
||||
|
||||
var dialogOptions = {
|
||||
const dialogOptions = {
|
||||
size: 'small',
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
@ -440,13 +460,13 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
dialogOptions.size = 'fullscreen';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.classList.add('recordingDialog');
|
||||
|
||||
var html = '';
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
let html = '';
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
@ -456,22 +476,22 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
dialogHelper.open(dlg);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', function (e) {
|
||||
dlg.querySelector('.popupIdentifyForm').addEventListener('submit', e => {
|
||||
|
||||
e.preventDefault();
|
||||
searchForIdentificationResults(dlg);
|
||||
return false;
|
||||
});
|
||||
|
||||
dlg.addEventListener('close', function () {
|
||||
dlg.addEventListener('close', () => {
|
||||
|
||||
loading.hide();
|
||||
var foundItem = hasChanges ? currentSearchResult : null;
|
||||
const foundItem = hasChanges ? currentSearchResult : null;
|
||||
|
||||
resolveFunc(foundItem);
|
||||
});
|
||||
@ -500,10 +520,9 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
dlg.querySelector('.formDialogHeaderTitle').innerHTML = globalize.translate('Search');
|
||||
}
|
||||
|
||||
return {
|
||||
show: function (itemId, serverId) {
|
||||
export function show(itemId, serverId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
currentResolve = resolve;
|
||||
currentReject = reject;
|
||||
@ -512,11 +531,11 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
|
||||
showEditor(itemId);
|
||||
});
|
||||
},
|
||||
}
|
||||
|
||||
showFindNew: function (itemName, itemYear, itemType, serverId) {
|
||||
export function showFindNew(itemName, itemYear, itemType, serverId) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve) => {
|
||||
|
||||
currentServerId = serverId;
|
||||
|
||||
@ -524,5 +543,9 @@ define(['dialogHelper', 'loading', 'connectionManager', 'require', 'globalize',
|
||||
showEditorFindNew(itemName, itemYear, itemType, resolve);
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default {
|
||||
show: show,
|
||||
showFindNew: showFindNew
|
||||
};
|
||||
|
@ -1,63 +1,73 @@
|
||||
define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], function(globalize, dom) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
/**
|
||||
* Module for library options editor.
|
||||
* @module components/libraryoptionseditor/libraryoptionseditor
|
||||
*/
|
||||
|
||||
import globalize from 'globalize';
|
||||
import dom from 'dom';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-select';
|
||||
import 'emby-input';
|
||||
|
||||
function populateLanguages(parent) {
|
||||
return ApiClient.getCultures().then(function(languages) {
|
||||
return ApiClient.getCultures().then(languages => {
|
||||
populateLanguagesIntoSelect(parent.querySelector('#selectLanguage'), languages);
|
||||
populateLanguagesIntoList(parent.querySelector('.subtitleDownloadLanguages'), languages);
|
||||
});
|
||||
}
|
||||
|
||||
function populateLanguagesIntoSelect(select, languages) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<option value=''></option>";
|
||||
for (var i = 0; i < languages.length; i++) {
|
||||
var culture = languages[i];
|
||||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
||||
for (let i = 0; i < languages.length; i++) {
|
||||
const culture = languages[i];
|
||||
html += `<option value='${culture.TwoLetterISOLanguageName}'>${culture.DisplayName}</option>`;
|
||||
}
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
function populateLanguagesIntoList(element, languages) {
|
||||
var html = '';
|
||||
for (var i = 0; i < languages.length; i++) {
|
||||
var culture = languages[i];
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkSubtitleLanguage" data-lang="' + culture.ThreeLetterISOLanguageName.toLowerCase() + '" /><span>' + culture.DisplayName + '</span></label>';
|
||||
let html = '';
|
||||
for (let i = 0; i < languages.length; i++) {
|
||||
const culture = languages[i];
|
||||
html += `<label><input type="checkbox" is="emby-checkbox" class="chkSubtitleLanguage" data-lang="${culture.ThreeLetterISOLanguageName.toLowerCase()}" /><span>${culture.DisplayName}</span></label>`;
|
||||
}
|
||||
element.innerHTML = html;
|
||||
}
|
||||
|
||||
function populateCountries(select) {
|
||||
return ApiClient.getCountries().then(function(allCountries) {
|
||||
var html = '';
|
||||
return ApiClient.getCountries().then(allCountries => {
|
||||
let html = '';
|
||||
html += "<option value=''></option>";
|
||||
for (var i = 0; i < allCountries.length; i++) {
|
||||
var culture = allCountries[i];
|
||||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + '</option>';
|
||||
for (let i = 0; i < allCountries.length; i++) {
|
||||
const culture = allCountries[i];
|
||||
html += `<option value='${culture.TwoLetterISORegionName}'>${culture.DisplayName}</option>`;
|
||||
}
|
||||
select.innerHTML = html;
|
||||
});
|
||||
}
|
||||
|
||||
function populateRefreshInterval(select) {
|
||||
var html = '';
|
||||
html += "<option value='0'>" + globalize.translate('Never') + '</option>';
|
||||
html += [30, 60, 90].map(function(val) {
|
||||
return "<option value='" + val + "'>" + globalize.translate('EveryNDays', val) + '</option>';
|
||||
let html = '';
|
||||
html += `<option value='0'>${globalize.translate('Never')}</option>`;
|
||||
html += [30, 60, 90].map(val => {
|
||||
return `<option value='${val}'>${globalize.translate('EveryNDays', val)}</option>`;
|
||||
}).join('');
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
function renderMetadataReaders(page, plugins) {
|
||||
var html = '';
|
||||
var elem = page.querySelector('.metadataReaders');
|
||||
let html = '';
|
||||
const elem = page.querySelector('.metadataReaders');
|
||||
|
||||
if (plugins.length < 1) return elem.innerHTML = '', elem.classList.add('hide'), !1;
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('LabelMetadataReaders') + '</h3>';
|
||||
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelMetadataReaders')}</h3>`;
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
for (var i = 0; i < plugins.length; i++) {
|
||||
var plugin = plugins[i];
|
||||
html += '<div class="listItem localReaderOption sortableOption" data-pluginname="' + plugin.Name + '">';
|
||||
for (let i = 0; i < plugins.length; i++) {
|
||||
const plugin = plugins[i];
|
||||
html += `<div class="listItem localReaderOption sortableOption" data-pluginname="${plugin.Name}">`;
|
||||
html += '<span class="listItemIcon material-icons live_tv"></span>';
|
||||
html += '<div class="listItemBody">';
|
||||
html += '<h3 class="listItemBodyText">';
|
||||
@ -65,14 +75,14 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
html += '</h3>';
|
||||
html += '</div>';
|
||||
if (i > 0) {
|
||||
html += '<button type="button" is="paper-icon-button-light" title="' + globalize.translate('ButtonUp') + '" class="btnSortableMoveUp btnSortable" data-pluginindex="' + i + '"><span class="material-icons keyboard_arrow_up"></span></button>';
|
||||
html += `<button type="button" is="paper-icon-button-light" title="${globalize.translate('ButtonUp')}" class="btnSortableMoveUp btnSortable" data-pluginindex="${i}"><span class="material-icons keyboard_arrow_up"></span></button>`;
|
||||
} else if (plugins.length > 1) {
|
||||
html += '<button type="button" is="paper-icon-button-light" title="' + globalize.translate('ButtonDown') + '" class="btnSortableMoveDown btnSortable" data-pluginindex="' + i + '"><span class="material-icons keyboard_arrow_down"></span></button>';
|
||||
html += `<button type="button" is="paper-icon-button-light" title="${globalize.translate('ButtonDown')}" class="btnSortableMoveDown btnSortable" data-pluginindex="${i}"><span class="material-icons keyboard_arrow_down"></span></button>`;
|
||||
}
|
||||
html += '</div>';
|
||||
}
|
||||
html += '</div>';
|
||||
html += '<div class="fieldDescription">' + globalize.translate('LabelMetadataReadersHelp') + '</div>';
|
||||
html += `<div class="fieldDescription">${globalize.translate('LabelMetadataReadersHelp')}</div>`;
|
||||
if (plugins.length < 2) {
|
||||
elem.classList.add('hide');
|
||||
} else {
|
||||
@ -83,25 +93,25 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
}
|
||||
|
||||
function renderMetadataSavers(page, metadataSavers) {
|
||||
var html = '';
|
||||
var elem = page.querySelector('.metadataSavers');
|
||||
let html = '';
|
||||
const elem = page.querySelector('.metadataSavers');
|
||||
if (!metadataSavers.length) return elem.innerHTML = '', elem.classList.add('hide'), false;
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('LabelMetadataSavers') + '</h3>';
|
||||
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelMetadataSavers')}</h3>`;
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
for (var i = 0; i < metadataSavers.length; i++) {
|
||||
var plugin = metadataSavers[i];
|
||||
html += '<label><input type="checkbox" data-defaultenabled="' + plugin.DefaultEnabled + '" is="emby-checkbox" class="chkMetadataSaver" data-pluginname="' + plugin.Name + '" ' + false + '><span>' + plugin.Name + '</span></label>';
|
||||
for (let i = 0; i < metadataSavers.length; i++) {
|
||||
const plugin = metadataSavers[i];
|
||||
html += `<label><input type="checkbox" data-defaultenabled="${plugin.DefaultEnabled}" is="emby-checkbox" class="chkMetadataSaver" data-pluginname="${plugin.Name}" ${false}><span>${plugin.Name}</span></label>`;
|
||||
}
|
||||
html += '</div>';
|
||||
html += '<div class="fieldDescription" style="margin-top:.25em;">' + globalize.translate('LabelMetadataSaversHelp') + '</div>';
|
||||
html += `<div class="fieldDescription" style="margin-top:.25em;">${globalize.translate('LabelMetadataSaversHelp')}</div>`;
|
||||
elem.innerHTML = html;
|
||||
elem.classList.remove('hide');
|
||||
return true;
|
||||
}
|
||||
|
||||
function getMetadataFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) {
|
||||
var html = '';
|
||||
var plugins = availableTypeOptions.MetadataFetchers;
|
||||
let html = '';
|
||||
let plugins = availableTypeOptions.MetadataFetchers;
|
||||
|
||||
plugins = getOrderedPlugins(plugins, libraryOptionsForType.MetadataFetcherOrder || []);
|
||||
if (!plugins.length) return html;
|
||||
@ -112,8 +122,8 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
|
||||
plugins.forEach((plugin, index) => {
|
||||
html += '<div class="listItem metadataFetcherItem sortableOption" data-pluginname="' + plugin.Name + '">';
|
||||
var isChecked = libraryOptionsForType.MetadataFetchers ? -1 !== libraryOptionsForType.MetadataFetchers.indexOf(plugin.Name) : plugin.DefaultEnabled;
|
||||
var checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
const isChecked = libraryOptionsForType.MetadataFetchers ? libraryOptionsForType.MetadataFetchers.includes(plugin.Name) : plugin.DefaultEnabled;
|
||||
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkMetadataFetcher" data-pluginname="' + plugin.Name + '" ' + checkedHtml + '><span></span></label>';
|
||||
html += '<div class="listItemBody">';
|
||||
html += '<h3 class="listItemBodyText">';
|
||||
@ -135,19 +145,19 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
}
|
||||
|
||||
function getTypeOptions(allOptions, type) {
|
||||
var allTypeOptions = allOptions.TypeOptions || [];
|
||||
for (var i = 0; i < allTypeOptions.length; i++) {
|
||||
var typeOptions = allTypeOptions[i];
|
||||
const allTypeOptions = allOptions.TypeOptions || [];
|
||||
for (let i = 0; i < allTypeOptions.length; i++) {
|
||||
const typeOptions = allTypeOptions[i];
|
||||
if (typeOptions.Type === type) return typeOptions;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function renderMetadataFetchers(page, availableOptions, libraryOptions) {
|
||||
var html = '';
|
||||
var elem = page.querySelector('.metadataFetchers');
|
||||
for (var i = 0; i < availableOptions.TypeOptions.length; i++) {
|
||||
var availableTypeOptions = availableOptions.TypeOptions[i];
|
||||
let html = '';
|
||||
const elem = page.querySelector('.metadataFetchers');
|
||||
for (let i = 0; i < availableOptions.TypeOptions.length; i++) {
|
||||
const availableTypeOptions = availableOptions.TypeOptions[i];
|
||||
html += getMetadataFetchersForTypeHtml(availableTypeOptions, getTypeOptions(libraryOptions, availableTypeOptions.Type) || {});
|
||||
}
|
||||
elem.innerHTML = html;
|
||||
@ -166,41 +176,41 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
}
|
||||
|
||||
function renderSubtitleFetchers(page, availableOptions, libraryOptions) {
|
||||
var html = '';
|
||||
var elem = page.querySelector('.subtitleFetchers');
|
||||
let html = '';
|
||||
const elem = page.querySelector('.subtitleFetchers');
|
||||
|
||||
var plugins = availableOptions.SubtitleFetchers;
|
||||
let plugins = availableOptions.SubtitleFetchers;
|
||||
plugins = getOrderedPlugins(plugins, libraryOptions.SubtitleFetcherOrder || []);
|
||||
if (!plugins.length) return html;
|
||||
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('LabelSubtitleDownloaders') + '</h3>';
|
||||
html += `<h3 class="checkboxListLabel">${globalize.translate('LabelSubtitleDownloaders')}</h3>`;
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
for (var i = 0; i < plugins.length; i++) {
|
||||
var plugin = plugins[i];
|
||||
html += '<div class="listItem subtitleFetcherItem sortableOption" data-pluginname="' + plugin.Name + '">';
|
||||
var isChecked = libraryOptions.DisabledSubtitleFetchers ? -1 === libraryOptions.DisabledSubtitleFetchers.indexOf(plugin.Name) : plugin.DefaultEnabled;
|
||||
var checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkSubtitleFetcher" data-pluginname="' + plugin.Name + '" ' + checkedHtml + '><span></span></label>';
|
||||
for (let i = 0; i < plugins.length; i++) {
|
||||
const plugin = plugins[i];
|
||||
html += `<div class="listItem subtitleFetcherItem sortableOption" data-pluginname="${plugin.Name}">`;
|
||||
const isChecked = libraryOptions.DisabledSubtitleFetchers ? !libraryOptions.DisabledSubtitleFetchers.includes(plugin.Name) : plugin.DefaultEnabled;
|
||||
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
html += `<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkSubtitleFetcher" data-pluginname="${plugin.Name}" ${checkedHtml}><span></span></label>`;
|
||||
html += '<div class="listItemBody">';
|
||||
html += '<h3 class="listItemBodyText">';
|
||||
html += plugin.Name;
|
||||
html += '</h3>';
|
||||
html += '</div>';
|
||||
if (i > 0) {
|
||||
html += '<button type="button" is="paper-icon-button-light" title="' + globalize.translate('ButtonUp') + '" class="btnSortableMoveUp btnSortable" data-pluginindex="' + i + '"><span class="material-icons keyboard_arrow_up"></span></button>';
|
||||
html += `<button type="button" is="paper-icon-button-light" title="${globalize.translate('ButtonUp')}" class="btnSortableMoveUp btnSortable" data-pluginindex="${i}"><span class="material-icons keyboard_arrow_up"></span></button>`;
|
||||
} else if (plugins.length > 1) {
|
||||
html += '<button type="button" is="paper-icon-button-light" title="' + globalize.translate('ButtonDown') + '" class="btnSortableMoveDown btnSortable" data-pluginindex="' + i + '"><span class="material-icons keyboard_arrow_down"></span></button>';
|
||||
html += `<button type="button" is="paper-icon-button-light" title="${globalize.translate('ButtonDown')}" class="btnSortableMoveDown btnSortable" data-pluginindex="${i}"><span class="material-icons keyboard_arrow_down"></span></button>`;
|
||||
}
|
||||
html += '</div>';
|
||||
}
|
||||
html += '</div>';
|
||||
html += '<div class="fieldDescription">' + globalize.translate('SubtitleDownloadersHelp') + '</div>';
|
||||
html += `<div class="fieldDescription">${globalize.translate('SubtitleDownloadersHelp')}</div>`;
|
||||
elem.innerHTML = html;
|
||||
}
|
||||
|
||||
function getImageFetchersForTypeHtml(availableTypeOptions, libraryOptionsForType) {
|
||||
var html = '';
|
||||
var plugins = availableTypeOptions.ImageFetchers;
|
||||
let html = '';
|
||||
let plugins = availableTypeOptions.ImageFetchers;
|
||||
|
||||
plugins = getOrderedPlugins(plugins, libraryOptionsForType.ImageFetcherOrder || []);
|
||||
if (!plugins.length) return html;
|
||||
@ -208,17 +218,17 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
html += '<div class="imageFetcher" data-type="' + availableTypeOptions.Type + '">';
|
||||
html += '<div class="flex align-items-center" style="margin:1.5em 0 .5em;">';
|
||||
html += '<h3 class="checkboxListLabel" style="margin:0;">' + globalize.translate('HeaderTypeImageFetchers', availableTypeOptions.Type) + '</h3>';
|
||||
var supportedImageTypes = availableTypeOptions.SupportedImageTypes || [];
|
||||
const supportedImageTypes = availableTypeOptions.SupportedImageTypes || [];
|
||||
if (supportedImageTypes.length > 1 || 1 === supportedImageTypes.length && 'Primary' !== supportedImageTypes[0]) {
|
||||
html += '<button is="emby-button" class="raised btnImageOptionsForType" type="button" style="margin-left:1.5em;font-size:90%;"><span>' + globalize.translate('HeaderFetcherSettings') + '</span></button>';
|
||||
}
|
||||
html += '</div>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
for (var i = 0; i < plugins.length; i++) {
|
||||
var plugin = plugins[i];
|
||||
for (let i = 0; i < plugins.length; i++) {
|
||||
const plugin = plugins[i];
|
||||
html += '<div class="listItem imageFetcherItem sortableOption" data-pluginname="' + plugin.Name + '">';
|
||||
var isChecked = libraryOptionsForType.ImageFetchers ? -1 !== libraryOptionsForType.ImageFetchers.indexOf(plugin.Name) : plugin.DefaultEnabled;
|
||||
var checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
const isChecked = libraryOptionsForType.ImageFetchers ? libraryOptionsForType.ImageFetchers.includes(plugin.Name) : plugin.DefaultEnabled;
|
||||
const checkedHtml = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label class="listItemCheckboxContainer"><input type="checkbox" is="emby-checkbox" class="chkImageFetcher" data-pluginname="' + plugin.Name + '" ' + checkedHtml + '><span></span></label>';
|
||||
html += '<div class="listItemBody">';
|
||||
html += '<h3 class="listItemBodyText">';
|
||||
@ -239,10 +249,10 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
}
|
||||
|
||||
function renderImageFetchers(page, availableOptions, libraryOptions) {
|
||||
var html = '';
|
||||
var elem = page.querySelector('.imageFetchers');
|
||||
for (var i = 0; i < availableOptions.TypeOptions.length; i++) {
|
||||
var availableTypeOptions = availableOptions.TypeOptions[i];
|
||||
let html = '';
|
||||
const elem = page.querySelector('.imageFetchers');
|
||||
for (let i = 0; i < availableOptions.TypeOptions.length; i++) {
|
||||
const availableTypeOptions = availableOptions.TypeOptions[i];
|
||||
html += getImageFetchersForTypeHtml(availableTypeOptions, getTypeOptions(libraryOptions, availableTypeOptions.Type) || {});
|
||||
}
|
||||
elem.innerHTML = html;
|
||||
@ -258,12 +268,12 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
return true;
|
||||
}
|
||||
|
||||
function populateMetadataSettings(parent, contentType, isNewLibrary) {
|
||||
var isNewLibrary = parent.classList.contains('newlibrary');
|
||||
function populateMetadataSettings(parent, contentType) {
|
||||
const isNewLibrary = parent.classList.contains('newlibrary');
|
||||
return ApiClient.getJSON(ApiClient.getUrl('Libraries/AvailableOptions', {
|
||||
LibraryContentType: contentType,
|
||||
IsNewLibrary: isNewLibrary
|
||||
})).then(function(availableOptions) {
|
||||
})).then(availableOptions => {
|
||||
currentAvailableOptions = availableOptions;
|
||||
parent.availableOptions = availableOptions;
|
||||
renderMetadataSavers(parent, availableOptions.MetadataSavers);
|
||||
@ -272,14 +282,14 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
renderSubtitleFetchers(parent, availableOptions, {});
|
||||
renderImageFetchers(parent, availableOptions, {});
|
||||
availableOptions.SubtitleFetchers.length ? parent.querySelector('.subtitleDownloadSettings').classList.remove('hide') : parent.querySelector('.subtitleDownloadSettings').classList.add('hide');
|
||||
}).catch(function() {
|
||||
}).catch(() => {
|
||||
return Promise.resolve();
|
||||
});
|
||||
}
|
||||
|
||||
function adjustSortableListElement(elem) {
|
||||
var btnSortable = elem.querySelector('.btnSortable');
|
||||
var inner = btnSortable.querySelector('.material-icons');
|
||||
const btnSortable = elem.querySelector('.btnSortable');
|
||||
const inner = btnSortable.querySelector('.material-icons');
|
||||
if (elem.previousSibling) {
|
||||
btnSortable.title = globalize.translate('ButtonUp');
|
||||
btnSortable.classList.add('btnSortableMoveUp');
|
||||
@ -296,22 +306,22 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
}
|
||||
|
||||
function showImageOptionsForType(type) {
|
||||
require(['imageoptionseditor'], function(ImageOptionsEditor) {
|
||||
var typeOptions = getTypeOptions(currentLibraryOptions, type);
|
||||
import('imageoptionseditor').then(({default: ImageOptionsEditor}) => {
|
||||
let typeOptions = getTypeOptions(currentLibraryOptions, type);
|
||||
if (!typeOptions) {
|
||||
typeOptions = {
|
||||
Type: type
|
||||
};
|
||||
currentLibraryOptions.TypeOptions.push(typeOptions);
|
||||
}
|
||||
var availableOptions = getTypeOptions(currentAvailableOptions || {}, type);
|
||||
var imageOptionsEditor = new ImageOptionsEditor();
|
||||
const availableOptions = getTypeOptions(currentAvailableOptions || {}, type);
|
||||
const imageOptionsEditor = new ImageOptionsEditor();
|
||||
imageOptionsEditor.show(type, typeOptions, availableOptions);
|
||||
});
|
||||
}
|
||||
|
||||
function onImageFetchersContainerClick(e) {
|
||||
var btnImageOptionsForType = dom.parentWithClass(e.target, 'btnImageOptionsForType');
|
||||
const btnImageOptionsForType = dom.parentWithClass(e.target, 'btnImageOptionsForType');
|
||||
if (btnImageOptionsForType) {
|
||||
return void showImageOptionsForType(dom.parentWithClass(btnImageOptionsForType, 'imageFetcher').getAttribute('data-type'));
|
||||
}
|
||||
@ -319,18 +329,18 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
}
|
||||
|
||||
function onSortableContainerClick(e) {
|
||||
var btnSortable = dom.parentWithClass(e.target, 'btnSortable');
|
||||
const btnSortable = dom.parentWithClass(e.target, 'btnSortable');
|
||||
if (btnSortable) {
|
||||
var li = dom.parentWithClass(btnSortable, 'sortableOption');
|
||||
var list = dom.parentWithClass(li, 'paperList');
|
||||
const li = dom.parentWithClass(btnSortable, 'sortableOption');
|
||||
const list = dom.parentWithClass(li, 'paperList');
|
||||
if (btnSortable.classList.contains('btnSortableMoveDown')) {
|
||||
var next = li.nextSibling;
|
||||
const next = li.nextSibling;
|
||||
if (next) {
|
||||
li.parentNode.removeChild(li);
|
||||
next.parentNode.insertBefore(li, next.nextSibling);
|
||||
}
|
||||
} else {
|
||||
var prev = li.previousSibling;
|
||||
const prev = li.previousSibling;
|
||||
if (prev) {
|
||||
li.parentNode.removeChild(li);
|
||||
prev.parentNode.insertBefore(li, prev);
|
||||
@ -347,41 +357,35 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
parent.querySelector('.imageFetchers').addEventListener('click', onImageFetchersContainerClick);
|
||||
}
|
||||
|
||||
function embed(parent, contentType, libraryOptions) {
|
||||
export async function embed(parent, contentType, libraryOptions) {
|
||||
currentLibraryOptions = {
|
||||
TypeOptions: []
|
||||
};
|
||||
currentAvailableOptions = null;
|
||||
var isNewLibrary = null === libraryOptions;
|
||||
const isNewLibrary = null === libraryOptions;
|
||||
isNewLibrary && parent.classList.add('newlibrary');
|
||||
return new Promise(function(resolve, reject) {
|
||||
var xhr = new XMLHttpRequest;
|
||||
xhr.open('GET', 'components/libraryoptionseditor/libraryoptionseditor.template.html', true);
|
||||
xhr.onload = function(e) {
|
||||
var template = this.response;
|
||||
parent.innerHTML = globalize.translateDocument(template);
|
||||
const response = await fetch('components/libraryoptionseditor/libraryoptionseditor.template.html');
|
||||
const template = await response.text();
|
||||
parent.innerHTML = globalize.translateHtml(template);
|
||||
populateRefreshInterval(parent.querySelector('#selectAutoRefreshInterval'));
|
||||
var promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];
|
||||
const promises = [populateLanguages(parent), populateCountries(parent.querySelector('#selectCountry'))];
|
||||
Promise.all(promises).then(function() {
|
||||
return setContentType(parent, contentType).then(function() {
|
||||
libraryOptions && setLibraryOptions(parent, libraryOptions);
|
||||
bindEvents(parent);
|
||||
resolve();
|
||||
return;
|
||||
});
|
||||
});
|
||||
};
|
||||
xhr.send();
|
||||
});
|
||||
}
|
||||
|
||||
function setAdvancedVisible(parent, visible) {
|
||||
var elems = parent.querySelectorAll('.advanced');
|
||||
for (var i = 0; i < elems.length; i++) {
|
||||
export function setAdvancedVisible(parent, visible) {
|
||||
const elems = parent.querySelectorAll('.advanced');
|
||||
for (let i = 0; i < elems.length; i++) {
|
||||
visible ? elems[i].classList.remove('advancedHide') : elems[i].classList.add('advancedHide');
|
||||
}
|
||||
}
|
||||
|
||||
function setContentType(parent, contentType) {
|
||||
export function setContentType(parent, contentType) {
|
||||
if (contentType === 'homevideos' || contentType === 'photos') {
|
||||
parent.querySelector('.chkEnablePhotosContainer').classList.remove('hide');
|
||||
} else {
|
||||
@ -422,47 +426,47 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
}
|
||||
|
||||
function setSubtitleFetchersIntoOptions(parent, options) {
|
||||
options.DisabledSubtitleFetchers = Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkSubtitleFetcher'), function(elem) {
|
||||
options.DisabledSubtitleFetchers = Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkSubtitleFetcher'), elem => {
|
||||
return !elem.checked;
|
||||
}), function(elem) {
|
||||
}), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
|
||||
options.SubtitleFetcherOrder = Array.prototype.map.call(parent.querySelectorAll('.subtitleFetcherItem'), function(elem) {
|
||||
options.SubtitleFetcherOrder = Array.prototype.map.call(parent.querySelectorAll('.subtitleFetcherItem'), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
}
|
||||
|
||||
function setMetadataFetchersIntoOptions(parent, options) {
|
||||
var sections = parent.querySelectorAll('.metadataFetcher');
|
||||
for (var i = 0; i < sections.length; i++) {
|
||||
var section = sections[i];
|
||||
var type = section.getAttribute('data-type');
|
||||
var typeOptions = getTypeOptions(options, type);
|
||||
const sections = parent.querySelectorAll('.metadataFetcher');
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
const section = sections[i];
|
||||
const type = section.getAttribute('data-type');
|
||||
let typeOptions = getTypeOptions(options, type);
|
||||
if (!typeOptions) {
|
||||
typeOptions = {
|
||||
Type: type
|
||||
};
|
||||
options.TypeOptions.push(typeOptions);
|
||||
}
|
||||
typeOptions.MetadataFetchers = Array.prototype.map.call(Array.prototype.filter.call(section.querySelectorAll('.chkMetadataFetcher'), function(elem) {
|
||||
typeOptions.MetadataFetchers = Array.prototype.map.call(Array.prototype.filter.call(section.querySelectorAll('.chkMetadataFetcher'), elem => {
|
||||
return elem.checked;
|
||||
}), function(elem) {
|
||||
}), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
|
||||
typeOptions.MetadataFetcherOrder = Array.prototype.map.call(section.querySelectorAll('.metadataFetcherItem'), function(elem) {
|
||||
typeOptions.MetadataFetcherOrder = Array.prototype.map.call(section.querySelectorAll('.metadataFetcherItem'), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setImageFetchersIntoOptions(parent, options) {
|
||||
var sections = parent.querySelectorAll('.imageFetcher');
|
||||
for (var i = 0; i < sections.length; i++) {
|
||||
var section = sections[i];
|
||||
var type = section.getAttribute('data-type');
|
||||
var typeOptions = getTypeOptions(options, type);
|
||||
const sections = parent.querySelectorAll('.imageFetcher');
|
||||
for (let i = 0; i < sections.length; i++) {
|
||||
const section = sections[i];
|
||||
const type = section.getAttribute('data-type');
|
||||
let typeOptions = getTypeOptions(options, type);
|
||||
if (!typeOptions) {
|
||||
typeOptions = {
|
||||
Type: type
|
||||
@ -470,23 +474,23 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
options.TypeOptions.push(typeOptions);
|
||||
}
|
||||
|
||||
typeOptions.ImageFetchers = Array.prototype.map.call(Array.prototype.filter.call(section.querySelectorAll('.chkImageFetcher'), function(elem) {
|
||||
typeOptions.ImageFetchers = Array.prototype.map.call(Array.prototype.filter.call(section.querySelectorAll('.chkImageFetcher'), elem => {
|
||||
return elem.checked;
|
||||
}), function(elem) {
|
||||
}), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
|
||||
typeOptions.ImageFetcherOrder = Array.prototype.map.call(section.querySelectorAll('.imageFetcherItem'), function(elem) {
|
||||
typeOptions.ImageFetcherOrder = Array.prototype.map.call(section.querySelectorAll('.imageFetcherItem'), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function setImageOptionsIntoOptions(parent, options) {
|
||||
var originalTypeOptions = (currentLibraryOptions || {}).TypeOptions || [];
|
||||
for (var i = 0; i < originalTypeOptions.length; i++) {
|
||||
var originalTypeOption = originalTypeOptions[i];
|
||||
var typeOptions = getTypeOptions(options, originalTypeOption.Type);
|
||||
function setImageOptionsIntoOptions(options) {
|
||||
const originalTypeOptions = (currentLibraryOptions || {}).TypeOptions || [];
|
||||
for (let i = 0; i < originalTypeOptions.length; i++) {
|
||||
const originalTypeOption = originalTypeOptions[i];
|
||||
let typeOptions = getTypeOptions(options, originalTypeOption.Type);
|
||||
|
||||
if (!typeOptions) {
|
||||
typeOptions = {
|
||||
@ -498,8 +502,8 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
}
|
||||
}
|
||||
|
||||
function getLibraryOptions(parent) {
|
||||
var options = {
|
||||
export function getLibraryOptions(parent) {
|
||||
const options = {
|
||||
EnableArchiveMediaFiles: false,
|
||||
EnablePhotos: parent.querySelector('.chkEnablePhotos').checked,
|
||||
EnableRealtimeMonitor: parent.querySelector('.chkEnableRealtimeMonitor').checked,
|
||||
@ -520,39 +524,39 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
SkipSubtitlesIfAudioTrackMatches: parent.querySelector('#chkSkipIfAudioTrackPresent').checked,
|
||||
SaveSubtitlesWithMedia: parent.querySelector('#chkSaveSubtitlesLocally').checked,
|
||||
RequirePerfectSubtitleMatch: parent.querySelector('#chkRequirePerfectMatch').checked,
|
||||
MetadataSavers: Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkMetadataSaver'), function(elem) {
|
||||
MetadataSavers: Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkMetadataSaver'), elem => {
|
||||
return elem.checked;
|
||||
}), function(elem) {
|
||||
}), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
}),
|
||||
TypeOptions: []
|
||||
};
|
||||
|
||||
options.LocalMetadataReaderOrder = Array.prototype.map.call(parent.querySelectorAll('.localReaderOption'), function(elem) {
|
||||
options.LocalMetadataReaderOrder = Array.prototype.map.call(parent.querySelectorAll('.localReaderOption'), elem => {
|
||||
return elem.getAttribute('data-pluginname');
|
||||
});
|
||||
options.SubtitleDownloadLanguages = Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkSubtitleLanguage'), function(elem) {
|
||||
options.SubtitleDownloadLanguages = Array.prototype.map.call(Array.prototype.filter.call(parent.querySelectorAll('.chkSubtitleLanguage'), elem => {
|
||||
return elem.checked;
|
||||
}), function(elem) {
|
||||
}), elem => {
|
||||
return elem.getAttribute('data-lang');
|
||||
});
|
||||
setSubtitleFetchersIntoOptions(parent, options);
|
||||
setMetadataFetchersIntoOptions(parent, options);
|
||||
setImageFetchersIntoOptions(parent, options);
|
||||
setImageOptionsIntoOptions(parent, options);
|
||||
setImageOptionsIntoOptions(options);
|
||||
|
||||
return options;
|
||||
}
|
||||
|
||||
function getOrderedPlugins(plugins, configuredOrder) {
|
||||
plugins = plugins.slice(0);
|
||||
plugins.sort(function(a, b) {
|
||||
plugins.sort((a, b) => {
|
||||
return a = configuredOrder.indexOf(a.Name), b = configuredOrder.indexOf(b.Name), a < b ? -1 : a > b ? 1 : 0;
|
||||
});
|
||||
return plugins;
|
||||
}
|
||||
|
||||
function setLibraryOptions(parent, options) {
|
||||
export function setLibraryOptions(parent, options) {
|
||||
currentLibraryOptions = options;
|
||||
currentAvailableOptions = parent.availableOptions;
|
||||
parent.querySelector('#selectLanguage').value = options.PreferredMetadataLanguage || '';
|
||||
@ -573,11 +577,11 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
parent.querySelector('#chkSaveSubtitlesLocally').checked = options.SaveSubtitlesWithMedia;
|
||||
parent.querySelector('#chkSkipIfAudioTrackPresent').checked = options.SkipSubtitlesIfAudioTrackMatches;
|
||||
parent.querySelector('#chkRequirePerfectMatch').checked = options.RequirePerfectSubtitleMatch;
|
||||
Array.prototype.forEach.call(parent.querySelectorAll('.chkMetadataSaver'), function(elem) {
|
||||
elem.checked = options.MetadataSavers ? -1 !== options.MetadataSavers.indexOf(elem.getAttribute('data-pluginname')) : 'true' === elem.getAttribute('data-defaultenabled');
|
||||
Array.prototype.forEach.call(parent.querySelectorAll('.chkMetadataSaver'), elem => {
|
||||
elem.checked = options.MetadataSavers ? options.MetadataSavers.includes(elem.getAttribute('data-pluginname')) : 'true' === elem.getAttribute('data-defaultenabled');
|
||||
});
|
||||
Array.prototype.forEach.call(parent.querySelectorAll('.chkSubtitleLanguage'), function(elem) {
|
||||
elem.checked = !!options.SubtitleDownloadLanguages && -1 !== options.SubtitleDownloadLanguages.indexOf(elem.getAttribute('data-lang'));
|
||||
Array.prototype.forEach.call(parent.querySelectorAll('.chkSubtitleLanguage'), elem => {
|
||||
elem.checked = !!options.SubtitleDownloadLanguages && options.SubtitleDownloadLanguages.includes(elem.getAttribute('data-lang'));
|
||||
});
|
||||
renderMetadataReaders(parent, getOrderedPlugins(parent.availableOptions.MetadataReaders, options.LocalMetadataReaderOrder || []));
|
||||
renderMetadataFetchers(parent, parent.availableOptions, options);
|
||||
@ -585,14 +589,14 @@ define(['globalize', 'dom', 'emby-checkbox', 'emby-select', 'emby-input'], funct
|
||||
renderSubtitleFetchers(parent, parent.availableOptions, options);
|
||||
}
|
||||
|
||||
var currentLibraryOptions;
|
||||
var currentAvailableOptions;
|
||||
let currentLibraryOptions;
|
||||
let currentAvailableOptions;
|
||||
|
||||
return {
|
||||
/* eslint-enable indent */
|
||||
export default {
|
||||
embed: embed,
|
||||
setContentType: setContentType,
|
||||
getLibraryOptions: getLibraryOptions,
|
||||
setLibraryOptions: setLibraryOptions,
|
||||
setAdvancedVisible: setAdvancedVisible
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -1,5 +1,21 @@
|
||||
define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutManager', 'globalize', 'datetime', 'cardBuilder', 'css!./listview', 'emby-ratingbutton', 'emby-playstatebutton'], function (itemHelper, mediaInfo, indicators, connectionManager, layoutManager, globalize, datetime, cardBuilder) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
/**
|
||||
* Module for display list view.
|
||||
* @module components/listview/listview
|
||||
*/
|
||||
|
||||
import itemHelper from 'itemHelper';
|
||||
import mediaInfo from 'mediaInfo';
|
||||
import indicators from 'indicators';
|
||||
import connectionManager from 'connectionManager';
|
||||
import layoutManager from 'layoutManager';
|
||||
import globalize from 'globalize';
|
||||
import datetime from 'datetime';
|
||||
import cardBuilder from 'cardBuilder';
|
||||
import 'css!./listview';
|
||||
import 'emby-ratingbutton';
|
||||
import 'emby-playstatebutton';
|
||||
|
||||
function getIndex(item, options) {
|
||||
|
||||
@ -8,9 +24,9 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
return item.ParentIndexNumber == null ? '' : globalize.translate('ValueDiscNumber', item.ParentIndexNumber);
|
||||
}
|
||||
|
||||
var sortBy = (options.sortBy || '').toLowerCase();
|
||||
var code;
|
||||
var name;
|
||||
const sortBy = (options.sortBy || '').toLowerCase();
|
||||
let code;
|
||||
let name;
|
||||
|
||||
if (sortBy.indexOf('sortname') === 0) {
|
||||
|
||||
@ -69,10 +85,10 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
|
||||
function getImageUrl(item, width) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
let itemId;
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
maxWidth: width * 2,
|
||||
type: 'Primary'
|
||||
};
|
||||
@ -99,8 +115,8 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
|
||||
function getChannelImageUrl(item, width) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
var options = {
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
const options = {
|
||||
maxWidth: width * 2,
|
||||
type: 'Primary'
|
||||
};
|
||||
@ -115,9 +131,9 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
}
|
||||
|
||||
function getTextLinesHtml(textlines, isLargeStyle) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
var largeTitleTagName = layoutManager.tv ? 'h2' : 'div';
|
||||
const largeTitleTagName = layoutManager.tv ? 'h2' : 'div';
|
||||
|
||||
for (const [i, text] of textlines.entries()) {
|
||||
if (!text) {
|
||||
@ -126,7 +142,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
|
||||
if (i === 0) {
|
||||
if (isLargeStyle) {
|
||||
html += '<' + largeTitleTagName + ' class="listItemBodyText">';
|
||||
html += `<${largeTitleTagName} class="listItemBodyText">`;
|
||||
} else {
|
||||
html += '<div class="listItemBodyText">';
|
||||
}
|
||||
@ -135,7 +151,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
}
|
||||
html += (textlines[i] || ' ');
|
||||
if (i === 0 && isLargeStyle) {
|
||||
html += '</' + largeTitleTagName + '>';
|
||||
html += `</${largeTitleTagName}>`;
|
||||
} else {
|
||||
html += '</div>';
|
||||
}
|
||||
@ -146,13 +162,13 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
|
||||
function getRightButtonsHtml(options) {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
for (var i = 0, length = options.rightButtons.length; i < length; i++) {
|
||||
for (let i = 0, length = options.rightButtons.length; i < length; i++) {
|
||||
|
||||
var button = options.rightButtons[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>';
|
||||
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>`;
|
||||
}
|
||||
|
||||
return html;
|
||||
@ -162,34 +178,34 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
return item.Id;
|
||||
}
|
||||
|
||||
function getListViewHtml(options) {
|
||||
export function getListViewHtml(options) {
|
||||
|
||||
var items = options.items;
|
||||
const items = options.items;
|
||||
|
||||
var groupTitle = '';
|
||||
var action = options.action || 'link';
|
||||
let groupTitle = '';
|
||||
const action = options.action || 'link';
|
||||
|
||||
var isLargeStyle = options.imageSize === 'large';
|
||||
var enableOverview = options.enableOverview;
|
||||
const isLargeStyle = options.imageSize === 'large';
|
||||
const enableOverview = options.enableOverview;
|
||||
|
||||
var clickEntireItem = layoutManager.tv ? true : false;
|
||||
var outerTagName = clickEntireItem ? 'button' : 'div';
|
||||
var enableSideMediaInfo = options.enableSideMediaInfo != null ? options.enableSideMediaInfo : true;
|
||||
const clickEntireItem = layoutManager.tv ? true : false;
|
||||
const outerTagName = clickEntireItem ? 'button' : 'div';
|
||||
const enableSideMediaInfo = options.enableSideMediaInfo != null ? options.enableSideMediaInfo : true;
|
||||
|
||||
var outerHtml = '';
|
||||
let outerHtml = '';
|
||||
|
||||
var enableContentWrapper = options.enableOverview && !layoutManager.tv;
|
||||
var containerAlbumArtistIds = (options.containerAlbumArtists || []).map(getId);
|
||||
const enableContentWrapper = options.enableOverview && !layoutManager.tv;
|
||||
const containerAlbumArtistIds = (options.containerAlbumArtists || []).map(getId);
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
|
||||
var item = items[i];
|
||||
const item = items[i];
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
if (options.showIndex) {
|
||||
|
||||
var itemGroupTitle = getIndex(item, options);
|
||||
const itemGroupTitle = getIndex(item, options);
|
||||
|
||||
if (itemGroupTitle !== groupTitle) {
|
||||
|
||||
@ -211,7 +227,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
}
|
||||
}
|
||||
|
||||
var cssClass = 'listItem';
|
||||
let cssClass = 'listItem';
|
||||
|
||||
if (options.border || (options.highlight !== false && !layoutManager.tv)) {
|
||||
cssClass += ' listItem-border';
|
||||
@ -225,28 +241,28 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
cssClass += ' listItem-focusscale';
|
||||
}
|
||||
|
||||
var downloadWidth = 80;
|
||||
let downloadWidth = 80;
|
||||
|
||||
if (isLargeStyle) {
|
||||
cssClass += ' listItem-largeImage';
|
||||
downloadWidth = 500;
|
||||
}
|
||||
|
||||
var playlistItemId = item.PlaylistItemId ? (' data-playlistitemid="' + item.PlaylistItemId + '"') : '';
|
||||
const playlistItemId = item.PlaylistItemId ? (` data-playlistitemid="${item.PlaylistItemId}"`) : '';
|
||||
|
||||
var positionTicksData = item.UserData && item.UserData.PlaybackPositionTicks ? (' data-positionticks="' + item.UserData.PlaybackPositionTicks + '"') : '';
|
||||
var collectionIdData = options.collectionId ? (' data-collectionid="' + options.collectionId + '"') : '';
|
||||
var playlistIdData = options.playlistId ? (' data-playlistid="' + options.playlistId + '"') : '';
|
||||
var mediaTypeData = item.MediaType ? (' data-mediatype="' + item.MediaType + '"') : '';
|
||||
var collectionTypeData = item.CollectionType ? (' data-collectiontype="' + item.CollectionType + '"') : '';
|
||||
var channelIdData = item.ChannelId ? (' data-channelid="' + item.ChannelId + '"') : '';
|
||||
const positionTicksData = item.UserData && item.UserData.PlaybackPositionTicks ? (` data-positionticks="${item.UserData.PlaybackPositionTicks}"`) : '';
|
||||
const collectionIdData = options.collectionId ? (` data-collectionid="${options.collectionId}"`) : '';
|
||||
const playlistIdData = options.playlistId ? (` data-playlistid="${options.playlistId}"`) : '';
|
||||
const mediaTypeData = item.MediaType ? (` data-mediatype="${item.MediaType}"`) : '';
|
||||
const collectionTypeData = item.CollectionType ? (` data-collectiontype="${item.CollectionType}"`) : '';
|
||||
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 + '>';
|
||||
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) {
|
||||
|
||||
@ -267,13 +283,13 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
imageClass += ' listItemImage-large-tv';
|
||||
}
|
||||
|
||||
var playOnImageClick = options.imagePlayButton && !layoutManager.tv;
|
||||
const playOnImageClick = options.imagePlayButton && !layoutManager.tv;
|
||||
|
||||
if (!clickEntireItem) {
|
||||
imageClass += ' itemAction';
|
||||
}
|
||||
|
||||
var imageAction = playOnImageClick ? 'link' : action;
|
||||
const imageAction = playOnImageClick ? 'link' : action;
|
||||
|
||||
if (imgUrl) {
|
||||
html += '<div data-action="' + imageAction + '" class="' + imageClass + ' lazy" data-src="' + imgUrl + '" item-icon>';
|
||||
@ -281,18 +297,18 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
html += '<div class="' + imageClass + ' cardImageContainer ' + cardBuilder.getDefaultBackgroundClass(item.Name) + '">' + cardBuilder.getDefaultText(item, options);
|
||||
}
|
||||
|
||||
var indicatorsHtml = '';
|
||||
let indicatorsHtml = '';
|
||||
indicatorsHtml += indicators.getPlayedIndicatorHtml(item);
|
||||
|
||||
if (indicatorsHtml) {
|
||||
html += '<div class="indicators listItemIndicators">' + indicatorsHtml + '</div>';
|
||||
html += `<div class="indicators listItemIndicators">${indicatorsHtml}</div>`;
|
||||
}
|
||||
|
||||
if (playOnImageClick) {
|
||||
html += '<button is="paper-icon-button-light" class="listItemImageButton itemAction" data-action="resume"><span class="material-icons listItemImageButton-icon play_arrow"></span></button>';
|
||||
}
|
||||
|
||||
var progressHtml = indicators.getProgressBarHtml(item, {
|
||||
const progressHtml = indicators.getProgressBarHtml(item, {
|
||||
containerClass: 'listItemProgressBar'
|
||||
});
|
||||
|
||||
@ -309,7 +325,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
var textlines = [];
|
||||
const textlines = [];
|
||||
|
||||
if (options.showProgramDateTime) {
|
||||
textlines.push(datetime.toLocaleString(datetime.parseISO8601Date(item.StartDate), {
|
||||
@ -332,7 +348,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
}
|
||||
}
|
||||
|
||||
var parentTitle = null;
|
||||
let parentTitle = null;
|
||||
|
||||
if (options.showParentTitle) {
|
||||
if (item.Type === 'Episode') {
|
||||
@ -342,12 +358,12 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
}
|
||||
}
|
||||
|
||||
var displayName = itemHelper.getDisplayName(item, {
|
||||
let displayName = itemHelper.getDisplayName(item, {
|
||||
includeParentInfo: options.includeParentInfoInTitle
|
||||
});
|
||||
|
||||
if (options.showIndexNumber && item.IndexNumber != null) {
|
||||
displayName = item.IndexNumber + '. ' + displayName;
|
||||
displayName = `${item.IndexNumber}. ${displayName}`;
|
||||
}
|
||||
|
||||
if (options.showParentTitle && options.parentTitleWithTitle) {
|
||||
@ -378,14 +394,14 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
}
|
||||
} else {
|
||||
|
||||
var showArtist = options.artist === true;
|
||||
var artistItems = item.ArtistItems;
|
||||
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.indexOf(artistItems[0].Id) === -1) {
|
||||
} else if (artistItems.length > 1 || !containerAlbumArtistIds.includes(artistItems[0].Id)) {
|
||||
showArtist = true;
|
||||
}
|
||||
}
|
||||
@ -393,7 +409,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
if (showArtist) {
|
||||
|
||||
if (artistItems && item.Type !== 'MusicAlbum') {
|
||||
textlines.push(artistItems.map(function (a) {
|
||||
textlines.push(artistItems.map(a => {
|
||||
return a.Name;
|
||||
}).join(', '));
|
||||
}
|
||||
@ -416,21 +432,23 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
cssClass += ' listItemBody-noleftpadding';
|
||||
}
|
||||
|
||||
html += '<div class="' + cssClass + '">';
|
||||
html += `<div class="${cssClass}">`;
|
||||
|
||||
html += getTextLinesHtml(textlines, isLargeStyle);
|
||||
|
||||
if (options.mediaInfo !== false) {
|
||||
if (!enableSideMediaInfo) {
|
||||
|
||||
var mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText';
|
||||
const mediaInfoClass = 'secondary listItemMediaInfo listItemBodyText';
|
||||
|
||||
html += '<div class="' + mediaInfoClass + '">' + mediaInfo.getPrimaryMediaInfoHtml(item, {
|
||||
html += `<div class="${mediaInfoClass}">`;
|
||||
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
|
||||
episodeTitle: false,
|
||||
originalAirDate: false,
|
||||
subtitles: false
|
||||
|
||||
}) + '</div>';
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -444,7 +462,8 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
|
||||
if (options.mediaInfo !== false) {
|
||||
if (enableSideMediaInfo) {
|
||||
html += '<div class="secondary listItemMediaInfo">' + mediaInfo.getPrimaryMediaInfoHtml(item, {
|
||||
html += '<div class="secondary listItemMediaInfo">';
|
||||
html += mediaInfo.getPrimaryMediaInfoHtml(item, {
|
||||
|
||||
year: false,
|
||||
container: false,
|
||||
@ -452,7 +471,8 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
criticRating: false,
|
||||
endsAt: false
|
||||
|
||||
}) + '</div>';
|
||||
});
|
||||
html += '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
@ -478,8 +498,8 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
|
||||
if (options.enableUserDataButtons !== false) {
|
||||
|
||||
var userData = item.UserData || {};
|
||||
var likes = userData.Likes == null ? '' : userData.Likes;
|
||||
const userData = item.UserData || {};
|
||||
const likes = userData.Likes == null ? '' : userData.Likes;
|
||||
|
||||
if (itemHelper.canMarkPlayed(item) && options.enablePlayedButton !== false) {
|
||||
html += '<button is="emby-playstatebutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + item.Id + '" data-serverid="' + item.ServerId + '" data-itemtype="' + item.Type + '" data-played="' + (userData.Played) + '"><span class="material-icons check"></span></button>';
|
||||
@ -506,7 +526,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
}
|
||||
}
|
||||
|
||||
html += '</' + outerTagName + '>';
|
||||
html += `</${outerTagName}>`;
|
||||
|
||||
outerHtml += html;
|
||||
}
|
||||
@ -514,7 +534,7 @@ define(['itemHelper', 'mediaInfo', 'indicators', 'connectionManager', 'layoutMan
|
||||
return outerHtml;
|
||||
}
|
||||
|
||||
return {
|
||||
/* eslint-enable indent */
|
||||
export default {
|
||||
getListViewHtml: getListViewHtml
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -1,11 +1,16 @@
|
||||
define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom, browser, events) {
|
||||
'use strict';
|
||||
import dom from 'dom';
|
||||
import browser from 'browser';
|
||||
import events from 'events';
|
||||
import 'emby-tabs';
|
||||
import 'emby-button';
|
||||
|
||||
var tabOwnerView;
|
||||
var queryScope = document.querySelector('.skinHeader');
|
||||
var footerTabsContainer;
|
||||
var headerTabsContainer;
|
||||
var tabsElem;
|
||||
/* eslint-disable indent */
|
||||
|
||||
let tabOwnerView;
|
||||
const queryScope = document.querySelector('.skinHeader');
|
||||
let footerTabsContainer;
|
||||
let headerTabsContainer;
|
||||
let tabsElem;
|
||||
|
||||
function enableTabsInFooter() {
|
||||
return false;
|
||||
@ -44,7 +49,7 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
return false;
|
||||
}
|
||||
|
||||
var classList = elem.classList;
|
||||
const classList = elem.classList;
|
||||
if (classList) {
|
||||
return !classList.contains('scrollX') && !classList.contains('animatedScrollX');
|
||||
}
|
||||
@ -52,7 +57,7 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
return true;
|
||||
}
|
||||
|
||||
var parent = target;
|
||||
let parent = target;
|
||||
while (parent != null) {
|
||||
if (!allowSwipeOn(parent)) {
|
||||
return false;
|
||||
@ -70,22 +75,22 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
}
|
||||
|
||||
// implement without hammer
|
||||
var pageCount = getTabContainersFn().length;
|
||||
var onSwipeLeft = function (e, target) {
|
||||
const pageCount = getTabContainersFn().length;
|
||||
const onSwipeLeft = function (e, target) {
|
||||
if (allowSwipe(target) && view.contains(target)) {
|
||||
tabsElem.selectNext();
|
||||
}
|
||||
};
|
||||
|
||||
var onSwipeRight = function (e, target) {
|
||||
const onSwipeRight = function (e, target) {
|
||||
if (allowSwipe(target) && view.contains(target)) {
|
||||
tabsElem.selectPrevious();
|
||||
}
|
||||
};
|
||||
|
||||
require(['touchHelper'], function (TouchHelper) {
|
||||
import('touchHelper').then(({default: TouchHelper}) => {
|
||||
|
||||
var touchHelper = new TouchHelper(view.parentNode.parentNode);
|
||||
const touchHelper = new TouchHelper(view.parentNode.parentNode);
|
||||
|
||||
events.on(touchHelper, 'swipeleft', onSwipeLeft);
|
||||
events.on(touchHelper, 'swiperight', onSwipeRight);
|
||||
@ -96,9 +101,9 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
});
|
||||
}
|
||||
|
||||
function setTabs(view, selectedIndex, getTabsFn, getTabContainersFn, onBeforeTabChange, onTabChange, setSelectedIndex) {
|
||||
export function setTabs(view, selectedIndex, getTabsFn, getTabContainersFn, onBeforeTabChange, onTabChange, setSelectedIndex) {
|
||||
|
||||
var enableInFooter = enableTabsInFooter();
|
||||
const enableInFooter = enableTabsInFooter();
|
||||
|
||||
if (!view) {
|
||||
if (tabOwnerView) {
|
||||
@ -129,7 +134,7 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
|
||||
ensureElements(enableInFooter);
|
||||
|
||||
var tabsContainerElem = enableInFooter ? footerTabsContainer : headerTabsContainer;
|
||||
const tabsContainerElem = enableInFooter ? footerTabsContainer : headerTabsContainer;
|
||||
|
||||
if (!tabOwnerView) {
|
||||
tabsContainerElem.classList.remove('hide');
|
||||
@ -137,18 +142,18 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
|
||||
if (tabOwnerView !== view) {
|
||||
|
||||
var index = 0;
|
||||
let index = 0;
|
||||
|
||||
var indexAttribute = selectedIndex == null ? '' : (' data-index="' + selectedIndex + '"');
|
||||
var tabsHtml = '<div is="emby-tabs"' + indexAttribute + ' class="tabs-viewmenubar"><div class="emby-tabs-slider" style="white-space:nowrap;">' + getTabsFn().map(function (t) {
|
||||
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) {
|
||||
|
||||
var tabClass = 'emby-tab-button';
|
||||
let tabClass = 'emby-tab-button';
|
||||
|
||||
if (t.enabled === false) {
|
||||
tabClass += ' hide';
|
||||
}
|
||||
|
||||
var tabHtml;
|
||||
let tabHtml;
|
||||
|
||||
if (t.cssClass) {
|
||||
tabClass += ' ' + t.cssClass;
|
||||
@ -177,16 +182,16 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
|
||||
tabsElem.addEventListener('beforetabchange', function (e) {
|
||||
|
||||
var tabContainers = getTabContainersFn();
|
||||
const tabContainers = getTabContainersFn();
|
||||
if (e.detail.previousIndex != null) {
|
||||
|
||||
var previousPanel = tabContainers[e.detail.previousIndex];
|
||||
const previousPanel = tabContainers[e.detail.previousIndex];
|
||||
if (previousPanel) {
|
||||
previousPanel.classList.remove('is-active');
|
||||
}
|
||||
}
|
||||
|
||||
var newPanel = tabContainers[e.detail.selectedTabIndex];
|
||||
const newPanel = tabContainers[e.detail.selectedTabIndex];
|
||||
|
||||
//if (e.detail.previousIndex != null && e.detail.previousIndex != e.detail.selectedTabIndex) {
|
||||
// if (newPanel.animate && (animateTabs || []).indexOf(e.detail.selectedTabIndex) != -1) {
|
||||
@ -241,9 +246,9 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
};
|
||||
}
|
||||
|
||||
function selectedTabIndex(index) {
|
||||
export function selectedTabIndex(index) {
|
||||
|
||||
var tabsContainerElem = headerTabsContainer;
|
||||
const tabsContainerElem = headerTabsContainer;
|
||||
|
||||
if (!tabsElem) {
|
||||
tabsElem = tabsContainerElem.querySelector('[is="emby-tabs"]');
|
||||
@ -256,13 +261,8 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||
}
|
||||
}
|
||||
|
||||
function getTabsElement() {
|
||||
export function getTabsElement() {
|
||||
return document.querySelector('.tabs-viewmenubar');
|
||||
}
|
||||
|
||||
return {
|
||||
setTabs: setTabs,
|
||||
getTabsElement: getTabsElement,
|
||||
selectedTabIndex: selectedTabIndex
|
||||
};
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,24 @@
|
||||
define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionseditor/libraryoptionseditor', 'globalize', 'emby-toggle', 'emby-input', 'emby-select', 'paper-icon-button-light', 'listViewStyle', 'formDialogStyle', 'emby-button', 'flexStyles'], function (loading, dialogHelper, dom, $, libraryoptionseditor, globalize) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
/**
|
||||
* Module for media library creator.
|
||||
* @module components/mediaLibraryCreator/mediaLibraryCreator
|
||||
*/
|
||||
|
||||
import loading from 'loading';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import dom from 'dom';
|
||||
import $ from 'jQuery';
|
||||
import libraryoptionseditor from 'components/libraryoptionseditor/libraryoptionseditor';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-toggle';
|
||||
import 'emby-input';
|
||||
import 'emby-select';
|
||||
import 'paper-icon-button-light';
|
||||
import 'listViewStyle';
|
||||
import 'formDialogStyle';
|
||||
import 'emby-button';
|
||||
import 'flexStyles';
|
||||
|
||||
function onAddLibrary() {
|
||||
if (isCreating) {
|
||||
@ -7,7 +26,7 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
if (pathInfos.length == 0) {
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert({
|
||||
text: globalize.translate('PleaseAddAtLeastOneFolder'),
|
||||
type: 'error'
|
||||
@ -19,23 +38,23 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
|
||||
isCreating = true;
|
||||
loading.show();
|
||||
var dlg = dom.parentWithClass(this, 'dlg-librarycreator');
|
||||
var name = $('#txtValue', dlg).val();
|
||||
var type = $('#selectCollectionType', dlg).val();
|
||||
const dlg = dom.parentWithClass(this, 'dlg-librarycreator');
|
||||
const name = $('#txtValue', dlg).val();
|
||||
let type = $('#selectCollectionType', dlg).val();
|
||||
|
||||
if (type == 'mixed') {
|
||||
type = null;
|
||||
}
|
||||
|
||||
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
||||
const libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
||||
libraryOptions.PathInfos = pathInfos;
|
||||
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, libraryOptions).then(function () {
|
||||
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, libraryOptions).then(() => {
|
||||
hasChanges = true;
|
||||
isCreating = false;
|
||||
loading.hide();
|
||||
dialogHelper.close(dlg);
|
||||
}, function () {
|
||||
require(['toast'], function (toast) {
|
||||
}, () => {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
});
|
||||
|
||||
@ -46,15 +65,15 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function getCollectionTypeOptionsHtml(collectionTypeOptions) {
|
||||
return collectionTypeOptions.map(function (i) {
|
||||
return '<option value="' + i.value + '">' + i.name + '</option>';
|
||||
return collectionTypeOptions.map(i => {
|
||||
return `<option value="${i.value}">${i.name}</option>`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function initEditor(page, collectionTypeOptions) {
|
||||
$('#selectCollectionType', page).html(getCollectionTypeOptionsHtml(collectionTypeOptions)).val('').on('change', function () {
|
||||
var value = this.value;
|
||||
var dlg = $(this).parents('.dialog')[0];
|
||||
const value = this.value;
|
||||
const dlg = $(this).parents('.dialog')[0];
|
||||
libraryoptionseditor.setContentType(dlg.querySelector('.libraryOptions'), value == 'mixed' ? '' : value);
|
||||
|
||||
if (value) {
|
||||
@ -64,12 +83,12 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
if (value != 'mixed') {
|
||||
var index = this.selectedIndex;
|
||||
const index = this.selectedIndex;
|
||||
|
||||
if (index != -1) {
|
||||
var name = this.options[index].innerHTML.replace('*', '').replace('&', '&');
|
||||
const name = this.options[index].innerHTML.replace('*', '').replace('&', '&');
|
||||
$('#txtValue', dlg).val(name);
|
||||
var folderOption = collectionTypeOptions.filter(function (i) {
|
||||
const folderOption = collectionTypeOptions.filter(i => {
|
||||
return i.value == value;
|
||||
})[0];
|
||||
$('.collectionTypeFieldDescription', dlg).html(folderOption.message || '');
|
||||
@ -83,15 +102,15 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function onToggleAdvancedChange() {
|
||||
var dlg = dom.parentWithClass(this, 'dlg-librarycreator');
|
||||
const dlg = dom.parentWithClass(this, 'dlg-librarycreator');
|
||||
libraryoptionseditor.setAdvancedVisible(dlg.querySelector('.libraryOptions'), this.checked);
|
||||
}
|
||||
|
||||
function onAddButtonClick() {
|
||||
var page = dom.parentWithClass(this, 'dlg-librarycreator');
|
||||
const page = dom.parentWithClass(this, 'dlg-librarycreator');
|
||||
|
||||
require(['directorybrowser'], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
picker.show({
|
||||
enableNetworkSharePath: true,
|
||||
callback: function (path, networkSharePath) {
|
||||
@ -106,24 +125,24 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function getFolderHtml(pathInfo, index) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<div class="listItem listItem-border lnkPath" style="padding-left:.5em;">';
|
||||
html += '<div class="' + (pathInfo.NetworkPath ? 'listItemBody two-line' : 'listItemBody') + '">';
|
||||
html += '<div class="listItemBodyText">' + pathInfo.Path + '</div>';
|
||||
html += `<div class="${pathInfo.NetworkPath ? 'listItemBody two-line' : 'listItemBody'}">`;
|
||||
html += `<div class="listItemBodyText">${pathInfo.Path}</div>`;
|
||||
|
||||
if (pathInfo.NetworkPath) {
|
||||
html += '<div class="listItemBodyText secondary">' + pathInfo.NetworkPath + '</div>';
|
||||
html += `<div class="listItemBodyText secondary">${pathInfo.NetworkPath}</div>`;
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
html += '<button type="button" is="paper-icon-button-light"" class="listItemButton btnRemovePath" data-index="' + index + '"><span class="material-icons remove_circle"></span></button>';
|
||||
html += `<button type="button" is="paper-icon-button-light"" class="listItemButton btnRemovePath" data-index="${index}"><span class="material-icons remove_circle"></span></button>`;
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
function renderPaths(page) {
|
||||
var foldersHtml = pathInfos.map(getFolderHtml).join('');
|
||||
var folderList = page.querySelector('.folderList');
|
||||
const foldersHtml = pathInfos.map(getFolderHtml).join('');
|
||||
const folderList = page.querySelector('.folderList');
|
||||
folderList.innerHTML = foldersHtml;
|
||||
|
||||
if (foldersHtml) {
|
||||
@ -134,13 +153,13 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function addMediaLocation(page, path, networkSharePath) {
|
||||
var pathLower = path.toLowerCase();
|
||||
var pathFilter = pathInfos.filter(function (p) {
|
||||
const pathLower = path.toLowerCase();
|
||||
const pathFilter = pathInfos.filter(p => {
|
||||
return p.Path.toLowerCase() == pathLower;
|
||||
});
|
||||
|
||||
if (!pathFilter.length) {
|
||||
var pathInfo = {
|
||||
const pathInfo = {
|
||||
Path: path
|
||||
};
|
||||
|
||||
@ -154,11 +173,11 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function onRemoveClick(e) {
|
||||
var button = dom.parentWithClass(e.target, 'btnRemovePath');
|
||||
var index = parseInt(button.getAttribute('data-index'));
|
||||
var location = pathInfos[index].Path;
|
||||
var locationLower = location.toLowerCase();
|
||||
pathInfos = pathInfos.filter(function (p) {
|
||||
const button = dom.parentWithClass(e.target, 'btnRemovePath');
|
||||
const index = parseInt(button.getAttribute('data-index'));
|
||||
const location = pathInfos[index].Path;
|
||||
const locationLower = location.toLowerCase();
|
||||
pathInfos = pathInfos.filter(p => {
|
||||
return p.Path.toLowerCase() != locationLower;
|
||||
});
|
||||
renderPaths(dom.parentWithClass(button, 'dlg-librarycreator'));
|
||||
@ -169,24 +188,20 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function initLibraryOptions(dlg) {
|
||||
libraryoptionseditor.embed(dlg.querySelector('.libraryOptions')).then(function () {
|
||||
libraryoptionseditor.embed(dlg.querySelector('.libraryOptions')).then(() => {
|
||||
$('#selectCollectionType', dlg).trigger('change');
|
||||
onToggleAdvancedChange.call(dlg.querySelector('.chkAdvanced'));
|
||||
});
|
||||
}
|
||||
|
||||
function editor() {
|
||||
this.show = function (options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
export class showEditor {
|
||||
constructor(options) {
|
||||
return new Promise((resolve) => {
|
||||
currentOptions = options;
|
||||
currentResolve = resolve;
|
||||
hasChanges = false;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/mediaLibraryCreator/mediaLibraryCreator.template.html', true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
var template = this.response;
|
||||
var dlg = dialogHelper.createDialog({
|
||||
import('text!./components/mediaLibraryCreator/mediaLibraryCreator.template.html').then(({default: template}) => {
|
||||
const dlg = dialogHelper.createDialog({
|
||||
size: 'small',
|
||||
modal: false,
|
||||
removeOnClose: true,
|
||||
@ -196,27 +211,26 @@ define(['loading', 'dialogHelper', 'dom', 'jQuery', 'components/libraryoptionsed
|
||||
dlg.classList.add('background-theme-a');
|
||||
dlg.classList.add('dlg-librarycreator');
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.innerHTML = globalize.translateDocument(template);
|
||||
dlg.innerHTML = globalize.translateHtml(template);
|
||||
initEditor(dlg, options.collectionTypeOptions);
|
||||
dlg.addEventListener('close', onDialogClosed);
|
||||
dialogHelper.open(dlg);
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
pathInfos = [];
|
||||
renderPaths(dlg);
|
||||
initLibraryOptions(dlg);
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
var pathInfos = [];
|
||||
var currentResolve;
|
||||
var currentOptions;
|
||||
var hasChanges = false;
|
||||
var isCreating = false;
|
||||
return editor;
|
||||
});
|
||||
let pathInfos = [];
|
||||
let currentResolve;
|
||||
let currentOptions;
|
||||
let hasChanges = false;
|
||||
let isCreating = false;
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default showEditor;
|
||||
|
@ -1,5 +1,22 @@
|
||||
define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionseditor/libraryoptionseditor', 'globalize', 'emby-button', 'listViewStyle', 'paper-icon-button-light', 'formDialogStyle', 'emby-toggle', 'flexStyles'], function (jQuery, loading, dialogHelper, dom, libraryoptionseditor, globalize) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
/**
|
||||
* Module for media library editor.
|
||||
* @module components/mediaLibraryEditor/mediaLibraryEditor
|
||||
*/
|
||||
|
||||
import jQuery from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import dom from 'dom';
|
||||
import libraryoptionseditor from 'components/libraryoptionseditor/libraryoptionseditor';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-button';
|
||||
import 'listViewStyle';
|
||||
import 'paper-icon-button-light';
|
||||
import 'formDialogStyle';
|
||||
import 'emby-toggle';
|
||||
import 'flexStyles';
|
||||
|
||||
function onEditLibrary() {
|
||||
if (isCreating) {
|
||||
@ -8,15 +25,15 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
|
||||
isCreating = true;
|
||||
loading.show();
|
||||
var dlg = dom.parentWithClass(this, 'dlg-libraryeditor');
|
||||
var libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
||||
const dlg = dom.parentWithClass(this, 'dlg-libraryeditor');
|
||||
let libraryOptions = libraryoptionseditor.getLibraryOptions(dlg.querySelector('.libraryOptions'));
|
||||
libraryOptions = Object.assign(currentOptions.library.LibraryOptions || {}, libraryOptions);
|
||||
ApiClient.updateVirtualFolderOptions(currentOptions.library.ItemId, libraryOptions).then(function () {
|
||||
ApiClient.updateVirtualFolderOptions(currentOptions.library.ItemId, libraryOptions).then(() => {
|
||||
hasChanges = true;
|
||||
isCreating = false;
|
||||
loading.hide();
|
||||
dialogHelper.close(dlg);
|
||||
}, function () {
|
||||
}, () => {
|
||||
isCreating = false;
|
||||
loading.hide();
|
||||
});
|
||||
@ -24,50 +41,50 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function addMediaLocation(page, path, networkSharePath) {
|
||||
var virtualFolder = currentOptions.library;
|
||||
var refreshAfterChange = currentOptions.refresh;
|
||||
ApiClient.addMediaPath(virtualFolder.Name, path, networkSharePath, refreshAfterChange).then(function () {
|
||||
const virtualFolder = currentOptions.library;
|
||||
const refreshAfterChange = currentOptions.refresh;
|
||||
ApiClient.addMediaPath(virtualFolder.Name, path, networkSharePath, refreshAfterChange).then(() => {
|
||||
hasChanges = true;
|
||||
refreshLibraryFromServer(page);
|
||||
}, function () {
|
||||
require(['toast'], function (toast) {
|
||||
}, () => {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function updateMediaLocation(page, path, networkSharePath) {
|
||||
var virtualFolder = currentOptions.library;
|
||||
const virtualFolder = currentOptions.library;
|
||||
ApiClient.updateMediaPath(virtualFolder.Name, {
|
||||
Path: path,
|
||||
NetworkPath: networkSharePath
|
||||
}).then(function () {
|
||||
}).then(() => {
|
||||
hasChanges = true;
|
||||
refreshLibraryFromServer(page);
|
||||
}, function () {
|
||||
require(['toast'], function (toast) {
|
||||
}, () => {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function onRemoveClick(btnRemovePath, location) {
|
||||
var button = btnRemovePath;
|
||||
var virtualFolder = currentOptions.library;
|
||||
const button = btnRemovePath;
|
||||
const virtualFolder = currentOptions.library;
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
title: globalize.translate('HeaderRemoveMediaLocation'),
|
||||
text: globalize.translate('MessageConfirmRemoveMediaLocation'),
|
||||
confirmText: globalize.translate('ButtonDelete'),
|
||||
primary: 'delete'
|
||||
}).then(function () {
|
||||
var refreshAfterChange = currentOptions.refresh;
|
||||
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).then(function () {
|
||||
}).then(() => {
|
||||
const refreshAfterChange = currentOptions.refresh;
|
||||
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).then(() => {
|
||||
hasChanges = true;
|
||||
refreshLibraryFromServer(dom.parentWithClass(button, 'dlg-libraryeditor'));
|
||||
}, function () {
|
||||
require(['toast'], function (toast) {
|
||||
}, () => {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('DefaultErrorMessage'));
|
||||
});
|
||||
});
|
||||
@ -76,14 +93,14 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function onListItemClick(e) {
|
||||
var listItem = dom.parentWithClass(e.target, 'listItem');
|
||||
const listItem = dom.parentWithClass(e.target, 'listItem');
|
||||
|
||||
if (listItem) {
|
||||
var index = parseInt(listItem.getAttribute('data-index'));
|
||||
var pathInfos = (currentOptions.library.LibraryOptions || {}).PathInfos || [];
|
||||
var pathInfo = null == index ? {} : pathInfos[index] || {};
|
||||
var originalPath = pathInfo.Path || (null == index ? null : currentOptions.library.Locations[index]);
|
||||
var btnRemovePath = dom.parentWithClass(e.target, 'btnRemovePath');
|
||||
const index = parseInt(listItem.getAttribute('data-index'));
|
||||
const pathInfos = (currentOptions.library.LibraryOptions || {}).PathInfos || [];
|
||||
const pathInfo = null == index ? {} : pathInfos[index] || {};
|
||||
const originalPath = pathInfo.Path || (null == index ? null : currentOptions.library.Locations[index]);
|
||||
const btnRemovePath = dom.parentWithClass(e.target, 'btnRemovePath');
|
||||
|
||||
if (btnRemovePath) {
|
||||
onRemoveClick(btnRemovePath, originalPath);
|
||||
@ -95,26 +112,26 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function getFolderHtml(pathInfo, index) {
|
||||
var html = '';
|
||||
html += '<div class="listItem listItem-border lnkPath" data-index="' + index + '" style="padding-left:.5em;">';
|
||||
html += '<div class="' + (pathInfo.NetworkPath ? 'listItemBody two-line' : 'listItemBody') + '">';
|
||||
let html = '';
|
||||
html += `<div class="listItem listItem-border lnkPath" data-index="${index}" style="padding-left:.5em;">`;
|
||||
html += `<div class="${pathInfo.NetworkPath ? 'listItemBody two-line' : 'listItemBody'}">`;
|
||||
html += '<h3 class="listItemBodyText">';
|
||||
html += pathInfo.Path;
|
||||
html += '</h3>';
|
||||
|
||||
if (pathInfo.NetworkPath) {
|
||||
html += '<div class="listItemBodyText secondary">' + pathInfo.NetworkPath + '</div>';
|
||||
html += `<div class="listItemBodyText secondary">${pathInfo.NetworkPath}</div>`;
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
html += '<button type="button" is="paper-icon-button-light" class="listItemButton btnRemovePath" data-index="' + index + '"><span class="material-icons remove_circle"></span></button>';
|
||||
html += `<button type="button" is="paper-icon-button-light" class="listItemButton btnRemovePath" data-index="${index}"><span class="material-icons remove_circle"></span></button>`;
|
||||
html += '</div>';
|
||||
return html;
|
||||
}
|
||||
|
||||
function refreshLibraryFromServer(page) {
|
||||
ApiClient.getVirtualFolders().then(function (result) {
|
||||
var library = result.filter(function (f) {
|
||||
ApiClient.getVirtualFolders().then(result => {
|
||||
const library = result.filter(f => {
|
||||
return f.Name === currentOptions.library.Name;
|
||||
})[0];
|
||||
|
||||
@ -126,10 +143,10 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function renderLibrary(page, options) {
|
||||
var pathInfos = (options.library.LibraryOptions || {}).PathInfos || [];
|
||||
let pathInfos = (options.library.LibraryOptions || {}).PathInfos || [];
|
||||
|
||||
if (!pathInfos.length) {
|
||||
pathInfos = options.library.Locations.map(function (p) {
|
||||
pathInfos = options.library.Locations.map(p => {
|
||||
return {
|
||||
Path: p
|
||||
};
|
||||
@ -150,8 +167,8 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function showDirectoryBrowser(context, originalPath, networkPath) {
|
||||
require(['directorybrowser'], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
picker.show({
|
||||
enableNetworkSharePath: true,
|
||||
pathReadOnly: null != originalPath,
|
||||
@ -173,7 +190,7 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
}
|
||||
|
||||
function onToggleAdvancedChange() {
|
||||
var dlg = dom.parentWithClass(this, 'dlg-libraryeditor');
|
||||
const dlg = dom.parentWithClass(this, 'dlg-libraryeditor');
|
||||
libraryoptionseditor.setAdvancedVisible(dlg.querySelector('.libraryOptions'), this.checked);
|
||||
}
|
||||
|
||||
@ -183,7 +200,7 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
dlg.querySelector('.folderList').addEventListener('click', onListItemClick);
|
||||
dlg.querySelector('.chkAdvanced').addEventListener('change', onToggleAdvancedChange);
|
||||
dlg.querySelector('.btnSubmit').addEventListener('click', onEditLibrary);
|
||||
libraryoptionseditor.embed(dlg.querySelector('.libraryOptions'), options.library.CollectionType, options.library.LibraryOptions).then(function () {
|
||||
libraryoptionseditor.embed(dlg.querySelector('.libraryOptions'), options.library.CollectionType, options.library.LibraryOptions).then(() => {
|
||||
onToggleAdvancedChange.call(dlg.querySelector('.chkAdvanced'));
|
||||
});
|
||||
}
|
||||
@ -192,18 +209,14 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
currentDeferred.resolveWith(null, [hasChanges]);
|
||||
}
|
||||
|
||||
function editor() {
|
||||
this.show = function (options) {
|
||||
var deferred = jQuery.Deferred();
|
||||
export class showEditor {
|
||||
constructor(options) {
|
||||
const deferred = jQuery.Deferred();
|
||||
currentOptions = options;
|
||||
currentDeferred = deferred;
|
||||
hasChanges = false;
|
||||
var xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'components/mediaLibraryEditor/mediaLibraryEditor.template.html', true);
|
||||
|
||||
xhr.onload = function (e) {
|
||||
var template = this.response;
|
||||
var dlg = dialogHelper.createDialog({
|
||||
import('text!./components/mediaLibraryEditor/mediaLibraryEditor.template.html').then(({default: template}) => {
|
||||
const dlg = dialogHelper.createDialog({
|
||||
size: 'small',
|
||||
modal: false,
|
||||
removeOnClose: true,
|
||||
@ -213,25 +226,24 @@ define(['jQuery', 'loading', 'dialogHelper', 'dom', 'components/libraryoptionsed
|
||||
dlg.classList.add('ui-body-a');
|
||||
dlg.classList.add('background-theme-a');
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.innerHTML = globalize.translateDocument(template);
|
||||
dlg.innerHTML = globalize.translateHtml(template);
|
||||
dlg.querySelector('.formDialogHeaderTitle').innerHTML = options.library.Name;
|
||||
initEditor(dlg, options);
|
||||
dlg.addEventListener('close', onDialogClosed);
|
||||
dialogHelper.open(dlg);
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
refreshLibraryFromServer(dlg);
|
||||
};
|
||||
|
||||
xhr.send();
|
||||
});
|
||||
return deferred.promise();
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var currentDeferred;
|
||||
var currentOptions;
|
||||
var hasChanges = false;
|
||||
var isCreating = false;
|
||||
return editor;
|
||||
});
|
||||
let currentDeferred;
|
||||
let currentOptions;
|
||||
let hasChanges = false;
|
||||
let isCreating = false;
|
||||
|
||||
/* eslint-enable indent */
|
||||
export default showEditor;
|
||||
|
@ -1,9 +1,18 @@
|
||||
define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'material-icons', 'css!./mediainfo.css', 'programStyles', 'emby-button'], function (datetime, globalize, appRouter, itemHelper, indicators) {
|
||||
'use strict';
|
||||
import datetime from 'datetime';
|
||||
import globalize from 'globalize';
|
||||
import appRouter from 'appRouter';
|
||||
import itemHelper from 'itemHelper';
|
||||
import indicators from 'indicators';
|
||||
import 'material-icons';
|
||||
import 'css!./mediainfo.css';
|
||||
import 'programStyles';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getTimerIndicator(item) {
|
||||
|
||||
var status;
|
||||
let status;
|
||||
|
||||
if (item.Type === 'SeriesTimer') {
|
||||
return '<span class="material-icons mediaInfoItem mediaInfoIconItem mediaInfoTimerIcon fiber_smart_record"></span>';
|
||||
@ -30,11 +39,11 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
}
|
||||
|
||||
function getProgramInfoHtml(item, options) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
var miscInfo = [];
|
||||
var text;
|
||||
var date;
|
||||
const miscInfo = [];
|
||||
let text;
|
||||
let date;
|
||||
|
||||
if (item.StartDate && options.programTime !== false) {
|
||||
|
||||
@ -48,35 +57,35 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
text += datetime.toLocaleDateString(date, { weekday: 'short', month: 'short', day: 'numeric' });
|
||||
}
|
||||
|
||||
text += ' ' + datetime.getDisplayTime(date);
|
||||
text += ` ${datetime.getDisplayTime(date)}`;
|
||||
|
||||
if (item.EndDate) {
|
||||
date = datetime.parseISO8601Date(item.EndDate);
|
||||
text += ' - ' + datetime.getDisplayTime(date);
|
||||
text += ` - ${datetime.getDisplayTime(date)}`;
|
||||
}
|
||||
|
||||
miscInfo.push(text);
|
||||
} catch (e) {
|
||||
console.error('error parsing date: ' + item.StartDate);
|
||||
console.error('error parsing date:', item.StartDate);
|
||||
}
|
||||
}
|
||||
|
||||
if (item.ChannelNumber) {
|
||||
miscInfo.push('CH ' + item.ChannelNumber);
|
||||
miscInfo.push(`CH ${item.ChannelNumber}`);
|
||||
}
|
||||
|
||||
if (item.ChannelName) {
|
||||
|
||||
if (options.interactive && item.ChannelId) {
|
||||
miscInfo.push({
|
||||
html: '<a is="emby-linkbutton" class="button-flat mediaInfoItem" href="' + appRouter.getRouteUrl({
|
||||
html: `<a is="emby-linkbutton" class="button-flat mediaInfoItem" href="${appRouter.getRouteUrl({
|
||||
|
||||
ServerId: item.ServerId,
|
||||
Type: 'TvChannel',
|
||||
Name: item.ChannelName,
|
||||
Id: item.ChannelId
|
||||
|
||||
}) + '">' + item.ChannelName + '</a>'
|
||||
})}">${item.ChannelName}</a>`
|
||||
});
|
||||
} else {
|
||||
miscInfo.push(item.ChannelName);
|
||||
@ -84,7 +93,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
}
|
||||
|
||||
if (options.timerIndicator !== false) {
|
||||
var timerHtml = getTimerIndicator(item);
|
||||
const timerHtml = getTimerIndicator(item);
|
||||
if (timerHtml) {
|
||||
miscInfo.push({
|
||||
html: timerHtml
|
||||
@ -92,24 +101,24 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
}
|
||||
}
|
||||
|
||||
html += miscInfo.map(function (m) {
|
||||
html += miscInfo.map(m => {
|
||||
return getMediaInfoItem(m);
|
||||
}).join('');
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
function getMediaInfoHtml(item, options) {
|
||||
var html = '';
|
||||
export function getMediaInfoHtml(item, options) {
|
||||
let html = '';
|
||||
|
||||
var miscInfo = [];
|
||||
const miscInfo = [];
|
||||
options = options || {};
|
||||
var text;
|
||||
var date;
|
||||
var minutes;
|
||||
var count;
|
||||
let text;
|
||||
let date;
|
||||
let minutes;
|
||||
let count;
|
||||
|
||||
var showFolderRuntime = item.Type === 'MusicAlbum' || item.MediaType === 'MusicArtist' || item.MediaType === 'Playlist' || item.MediaType === 'MusicGenre';
|
||||
const showFolderRuntime = item.Type === 'MusicAlbum' || item.MediaType === 'MusicArtist' || item.MediaType === 'Playlist' || item.MediaType === 'MusicGenre';
|
||||
|
||||
if (showFolderRuntime) {
|
||||
|
||||
@ -143,7 +152,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
text = datetime.toLocaleDateString(date);
|
||||
miscInfo.push(text);
|
||||
} catch (e) {
|
||||
console.error('error parsing date: ' + item.PremiereDate);
|
||||
console.error('error parsing date:', item.PremiereDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -176,7 +185,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
miscInfo.push(text);
|
||||
}
|
||||
} catch (e) {
|
||||
console.error('error parsing date: ' + item.StartDate);
|
||||
console.error('error parsing date:', item.StartDate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -193,14 +202,14 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
|
||||
try {
|
||||
|
||||
var endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||
const endYear = datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||
|
||||
if (endYear !== item.ProductionYear) {
|
||||
text += '-' + datetime.parseISO8601Date(item.EndDate).getFullYear();
|
||||
text += `-${datetime.parseISO8601Date(item.EndDate).getFullYear()}`;
|
||||
}
|
||||
|
||||
} catch (e) {
|
||||
console.error('error parsing date: ' + item.EndDate);
|
||||
console.error('error parsing date:', item.EndDate);
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,19 +222,19 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
if (options.programIndicator !== false) {
|
||||
if (item.IsLive) {
|
||||
miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem liveTvProgram">' + globalize.translate('Live') + '</div>'
|
||||
html: `<div class="mediaInfoProgramAttribute mediaInfoItem liveTvProgram">${globalize.translate('Live')}</div>`
|
||||
});
|
||||
} else if (item.IsPremiere) {
|
||||
miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem premiereTvProgram">' + globalize.translate('Premiere') + '</div>'
|
||||
html: `<div class="mediaInfoProgramAttribute mediaInfoItem premiereTvProgram">${globalize.translate('Premiere')}</div>`
|
||||
});
|
||||
} else if (item.IsSeries && !item.IsRepeat) {
|
||||
miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem newTvProgram">' + globalize.translate('AttributeNew') + '</div>'
|
||||
html: `<div class="mediaInfoProgramAttribute mediaInfoItem newTvProgram">${globalize.translate('AttributeNew')}</div>`
|
||||
});
|
||||
} else if (item.IsSeries && item.IsRepeat) {
|
||||
miscInfo.push({
|
||||
html: '<div class="mediaInfoProgramAttribute mediaInfoItem repeatTvProgram">' + globalize.translate('Repeat') + '</div>'
|
||||
html: `<div class="mediaInfoProgramAttribute mediaInfoItem repeatTvProgram">${globalize.translate('Repeat')}</div>`
|
||||
});
|
||||
}
|
||||
}
|
||||
@ -248,7 +257,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
text = globalize.translate('OriginalAirDateValue', datetime.toLocaleDateString(date));
|
||||
miscInfo.push(text);
|
||||
} catch (e) {
|
||||
console.error('error parsing date: ' + item.PremiereDate);
|
||||
console.error('error parsing date:', item.PremiereDate);
|
||||
}
|
||||
} else if (item.ProductionYear) {
|
||||
miscInfo.push(item.ProductionYear);
|
||||
@ -267,7 +276,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
text = datetime.parseISO8601Date(item.PremiereDate).getFullYear();
|
||||
miscInfo.push(text);
|
||||
} catch (e) {
|
||||
console.error('error parsing date: ' + item.PremiereDate);
|
||||
console.error('error parsing date:', item.PremiereDate);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -284,7 +293,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
|
||||
minutes = minutes || 1;
|
||||
|
||||
miscInfo.push(Math.round(minutes) + ' mins');
|
||||
miscInfo.push(`${Math.round(minutes)} mins`);
|
||||
}
|
||||
}
|
||||
|
||||
@ -300,14 +309,14 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
}
|
||||
|
||||
if (item.MediaType === 'Photo' && item.Width && item.Height) {
|
||||
miscInfo.push(item.Width + 'x' + item.Height);
|
||||
miscInfo.push(`${item.Width}x${item.Height}`);
|
||||
}
|
||||
|
||||
if (options.container !== false && item.Type === 'Audio' && item.Container) {
|
||||
miscInfo.push(item.Container);
|
||||
}
|
||||
|
||||
html += miscInfo.map(function (m) {
|
||||
html += miscInfo.map(m => {
|
||||
return getMediaInfoItem(m);
|
||||
}).join('');
|
||||
|
||||
@ -320,15 +329,15 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
if (item.CriticRating && options.criticRating !== false) {
|
||||
|
||||
if (item.CriticRating >= 60) {
|
||||
html += '<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingFresh">' + item.CriticRating + '</div>';
|
||||
html += `<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingFresh">${item.CriticRating}</div>`;
|
||||
} else {
|
||||
html += '<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingRotten">' + item.CriticRating + '</div>';
|
||||
html += `<div class="mediaInfoItem mediaInfoCriticRating mediaInfoCriticRatingRotten">${item.CriticRating}</div>`;
|
||||
}
|
||||
}
|
||||
|
||||
if (options.endsAt !== false) {
|
||||
|
||||
var endsAt = getEndsAt(item);
|
||||
const endsAt = getEndsAt(item);
|
||||
if (endsAt) {
|
||||
html += getMediaInfoItem(endsAt, 'endsAt');
|
||||
}
|
||||
@ -339,15 +348,15 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
return html;
|
||||
}
|
||||
|
||||
function getEndsAt(item) {
|
||||
export function getEndsAt(item) {
|
||||
|
||||
if (item.MediaType === 'Video' && item.RunTimeTicks) {
|
||||
|
||||
if (!item.StartDate) {
|
||||
var endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
|
||||
let endDate = new Date().getTime() + (item.RunTimeTicks / 10000);
|
||||
endDate = new Date(endDate);
|
||||
|
||||
var displayTime = datetime.getDisplayTime(endDate);
|
||||
const displayTime = datetime.getDisplayTime(endDate);
|
||||
return globalize.translate('EndsAtValue', displayTime);
|
||||
}
|
||||
}
|
||||
@ -355,12 +364,12 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
return null;
|
||||
}
|
||||
|
||||
function getEndsAtFromPosition(runtimeTicks, positionTicks, includeText) {
|
||||
export function getEndsAtFromPosition(runtimeTicks, positionTicks, includeText) {
|
||||
|
||||
var endDate = new Date().getTime() + ((runtimeTicks - (positionTicks || 0)) / 10000);
|
||||
let endDate = new Date().getTime() + ((runtimeTicks - (positionTicks || 0)) / 10000);
|
||||
endDate = new Date(endDate);
|
||||
|
||||
var displayTime = datetime.getDisplayTime(endDate);
|
||||
const displayTime = datetime.getDisplayTime(endDate);
|
||||
|
||||
if (includeText === false) {
|
||||
return displayTime;
|
||||
@ -370,8 +379,8 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
|
||||
function getMediaInfoItem(m, cssClass) {
|
||||
|
||||
cssClass = cssClass ? (cssClass + ' mediaInfoItem') : 'mediaInfoItem';
|
||||
var mediaInfoText = m;
|
||||
cssClass = cssClass ? (`${cssClass} mediaInfoItem`) : 'mediaInfoItem';
|
||||
let mediaInfoText = m;
|
||||
|
||||
if (typeof (m) !== 'string' && typeof (m) !== 'number') {
|
||||
|
||||
@ -379,13 +388,13 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
return m.html;
|
||||
}
|
||||
mediaInfoText = m.text;
|
||||
cssClass += ' ' + m.cssClass;
|
||||
cssClass += ` ${m.cssClass}`;
|
||||
}
|
||||
return '<div class="' + cssClass + '">' + mediaInfoText + '</div>';
|
||||
return `<div class="${cssClass}">${mediaInfoText}</div>`;
|
||||
}
|
||||
|
||||
function getStarIconsHtml(item) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
if (item.CommunityRating) {
|
||||
html += '<div class="starRatingContainer mediaInfoItem">';
|
||||
@ -400,7 +409,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
|
||||
function dynamicEndTime(elem, item) {
|
||||
|
||||
var interval = setInterval(function () {
|
||||
const interval = setInterval(() => {
|
||||
|
||||
if (!document.body.contains(elem)) {
|
||||
|
||||
@ -413,15 +422,15 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
}, 60000);
|
||||
}
|
||||
|
||||
function fillPrimaryMediaInfo(elem, item, options) {
|
||||
var html = getPrimaryMediaInfoHtml(item, options);
|
||||
export function fillPrimaryMediaInfo(elem, item, options) {
|
||||
const html = getPrimaryMediaInfoHtml(item, options);
|
||||
|
||||
elem.innerHTML = html;
|
||||
afterFill(elem, item, options);
|
||||
}
|
||||
|
||||
function fillSecondaryMediaInfo(elem, item, options) {
|
||||
var html = getSecondaryMediaInfoHtml(item, options);
|
||||
export function fillSecondaryMediaInfo(elem, item, options) {
|
||||
const html = getSecondaryMediaInfoHtml(item, options);
|
||||
|
||||
elem.innerHTML = html;
|
||||
afterFill(elem, item, options);
|
||||
@ -430,13 +439,13 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
function afterFill(elem, item, options) {
|
||||
|
||||
if (options.endsAt !== false) {
|
||||
var endsAtElem = elem.querySelector('.endsAt');
|
||||
const endsAtElem = elem.querySelector('.endsAt');
|
||||
if (endsAtElem) {
|
||||
dynamicEndTime(endsAtElem, item);
|
||||
}
|
||||
}
|
||||
|
||||
var lnkChannel = elem.querySelector('.lnkChannel');
|
||||
const lnkChannel = elem.querySelector('.lnkChannel');
|
||||
if (lnkChannel) {
|
||||
lnkChannel.addEventListener('click', onChannelLinkClick);
|
||||
}
|
||||
@ -444,8 +453,8 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
|
||||
function onChannelLinkClick(e) {
|
||||
|
||||
var channelId = this.getAttribute('data-id');
|
||||
var serverId = this.getAttribute('data-serverid');
|
||||
const channelId = this.getAttribute('data-id');
|
||||
const serverId = this.getAttribute('data-serverid');
|
||||
|
||||
appRouter.showItem(channelId, serverId);
|
||||
|
||||
@ -453,7 +462,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
return false;
|
||||
}
|
||||
|
||||
function getPrimaryMediaInfoHtml(item, options) {
|
||||
export function getPrimaryMediaInfoHtml(item, options) {
|
||||
|
||||
options = options || {};
|
||||
if (options.interactive == null) {
|
||||
@ -463,7 +472,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
return getMediaInfoHtml(item, options);
|
||||
}
|
||||
|
||||
function getSecondaryMediaInfoHtml(item, options) {
|
||||
export function getSecondaryMediaInfoHtml(item, options) {
|
||||
|
||||
options = options || {};
|
||||
if (options.interactive == null) {
|
||||
@ -476,10 +485,10 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
return '';
|
||||
}
|
||||
|
||||
function getResolutionText(i) {
|
||||
export function getResolutionText(i) {
|
||||
|
||||
var width = i.Width;
|
||||
var height = i.Height;
|
||||
const width = i.Width;
|
||||
const height = i.Height;
|
||||
|
||||
if (width && height) {
|
||||
|
||||
@ -522,28 +531,28 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
return null;
|
||||
}
|
||||
|
||||
var mediaSource = item.MediaSources[0];
|
||||
const mediaSource = item.MediaSources[0];
|
||||
if (!mediaSource) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (mediaSource.MediaStreams || []).filter(function (i) {
|
||||
return (mediaSource.MediaStreams || []).filter(i => {
|
||||
return i.Type === 'Audio' && (i.Index === mediaSource.DefaultAudioStreamIndex || mediaSource.DefaultAudioStreamIndex == null);
|
||||
})[0];
|
||||
}
|
||||
|
||||
function getMediaInfoStats(item, options) {
|
||||
export function getMediaInfoStats(item, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
var list = [];
|
||||
const list = [];
|
||||
|
||||
var mediaSource = (item.MediaSources || [])[0] || {};
|
||||
const mediaSource = (item.MediaSources || [])[0] || {};
|
||||
|
||||
var videoStream = (mediaSource.MediaStreams || []).filter(function (i) {
|
||||
const videoStream = (mediaSource.MediaStreams || []).filter(i => {
|
||||
return i.Type === 'Video';
|
||||
})[0] || {};
|
||||
var audioStream = getAudioStreamForDisplay(item) || {};
|
||||
const audioStream = getAudioStreamForDisplay(item) || {};
|
||||
|
||||
if (item.VideoType === 'Dvd') {
|
||||
list.push({
|
||||
@ -563,7 +572,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
// html += '<div class="mediaInfoIcon mediaInfoText">' + mediaSource.Container + '</div>';
|
||||
//}
|
||||
|
||||
var resolutionText = getResolutionText(videoStream);
|
||||
const resolutionText = getResolutionText(videoStream);
|
||||
if (resolutionText) {
|
||||
list.push({
|
||||
type: 'mediainfo',
|
||||
@ -578,8 +587,8 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
});
|
||||
}
|
||||
|
||||
var channels = audioStream.Channels;
|
||||
var channelText;
|
||||
const channels = audioStream.Channels;
|
||||
let channelText;
|
||||
|
||||
if (channels === 8) {
|
||||
|
||||
@ -605,7 +614,7 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
});
|
||||
}
|
||||
|
||||
var audioCodec = (audioStream.Codec || '').toLowerCase();
|
||||
const audioCodec = (audioStream.Codec || '').toLowerCase();
|
||||
|
||||
if ((audioCodec === 'dca' || audioCodec === 'dts') && audioStream.Profile) {
|
||||
list.push({
|
||||
@ -621,20 +630,21 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
|
||||
if (item.DateCreated && itemHelper.enableDateAddedDisplay(item)) {
|
||||
|
||||
var dateCreated = datetime.parseISO8601Date(item.DateCreated);
|
||||
const dateCreated = datetime.parseISO8601Date(item.DateCreated);
|
||||
|
||||
list.push({
|
||||
type: 'added',
|
||||
text: globalize.translate('AddedOnValue', datetime.toLocaleDateString(dateCreated) + ' ' + datetime.getDisplayTime(dateCreated))
|
||||
text: globalize.translate('AddedOnValue', `${datetime.toLocaleDateString(dateCreated)} ${datetime.getDisplayTime(dateCreated)}`)
|
||||
});
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
return {
|
||||
/* eslint-enable indent */
|
||||
|
||||
export default {
|
||||
getMediaInfoHtml: getPrimaryMediaInfoHtml,
|
||||
fill: fillPrimaryMediaInfo,
|
||||
getEndsAt: getEndsAt,
|
||||
getEndsAtFromPosition: getEndsAtFromPosition,
|
||||
getPrimaryMediaInfoHtml: getPrimaryMediaInfoHtml,
|
||||
@ -643,5 +653,4 @@ define(['datetime', 'globalize', 'appRouter', 'itemHelper', 'indicators', 'mater
|
||||
fillSecondaryMediaInfo: fillSecondaryMediaInfo,
|
||||
getMediaInfoStats: getMediaInfoStats,
|
||||
getResolutionText: getResolutionText
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -1,9 +1,30 @@
|
||||
define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loading', 'focusManager', 'connectionManager', 'globalize', 'require', 'shell', 'emby-checkbox', 'emby-input', 'emby-select', 'listViewStyle', 'emby-textarea', 'emby-button', 'paper-icon-button-light', 'css!./../formdialog', 'clearButtonStyle', 'flexStyles'], function (itemHelper, dom, layoutManager, dialogHelper, datetime, loading, focusManager, connectionManager, globalize, require, shell) {
|
||||
'use strict';
|
||||
import itemHelper from 'itemHelper';
|
||||
import dom from 'dom';
|
||||
import layoutManager from 'layoutManager';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import datetime from 'datetime';
|
||||
import loading from 'loading';
|
||||
import focusManager from 'focusManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import globalize from 'globalize';
|
||||
import require from 'require';
|
||||
import shell from 'shell';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-input';
|
||||
import 'emby-select';
|
||||
import 'listViewStyle';
|
||||
import 'emby-textarea';
|
||||
import 'emby-button';
|
||||
import 'paper-icon-button-light';
|
||||
import 'css!./../formdialog';
|
||||
import 'clearButtonStyle';
|
||||
import 'flexStyles';
|
||||
|
||||
var currentContext;
|
||||
var metadataEditorInfo;
|
||||
var currentItem;
|
||||
/* eslint-disable indent */
|
||||
|
||||
let currentContext;
|
||||
let metadataEditorInfo;
|
||||
let currentItem;
|
||||
|
||||
function isDialog() {
|
||||
return currentContext.classList.contains('dialog');
|
||||
@ -28,11 +49,11 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
closeDialog(true);
|
||||
}
|
||||
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
|
||||
apiClient.updateItem(item).then(function () {
|
||||
|
||||
var newContentType = form.querySelector('#selectContentType').value || '';
|
||||
const newContentType = form.querySelector('#selectContentType').value || '';
|
||||
|
||||
if ((metadataEditorInfo.ContentType || '') !== newContentType) {
|
||||
|
||||
@ -56,7 +77,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
}
|
||||
|
||||
function getSelectedAirDays(form) {
|
||||
var checkedItems = form.querySelectorAll('.chkAirDay:checked') || [];
|
||||
const checkedItems = form.querySelectorAll('.chkAirDay:checked') || [];
|
||||
return Array.prototype.map.call(checkedItems, function (c) {
|
||||
return c.getAttribute('data-day');
|
||||
});
|
||||
@ -92,7 +113,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function getDateValue(form, element, property) {
|
||||
|
||||
var val = form.querySelector(element).value;
|
||||
let val = form.querySelector(element).value;
|
||||
|
||||
if (!val) {
|
||||
return null;
|
||||
@ -100,14 +121,14 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
if (currentItem[property]) {
|
||||
|
||||
var date = datetime.parseISO8601Date(currentItem[property], true);
|
||||
const date = datetime.parseISO8601Date(currentItem[property], true);
|
||||
|
||||
var parts = date.toISOString().split('T');
|
||||
const parts = date.toISOString().split('T');
|
||||
|
||||
// If the date is the same, preserve the time
|
||||
if (parts[0].indexOf(val) === 0) {
|
||||
|
||||
var iso = parts[1];
|
||||
const iso = parts[1];
|
||||
|
||||
val += 'T' + iso;
|
||||
}
|
||||
@ -120,9 +141,9 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
loading.show();
|
||||
|
||||
var form = this;
|
||||
const form = this;
|
||||
|
||||
var item = {
|
||||
const item = {
|
||||
Id: currentItem.Id,
|
||||
Name: form.querySelector('#txtName').value,
|
||||
OriginalTitle: form.querySelector('#txtOriginalName').value,
|
||||
@ -168,9 +189,9 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
item.ProviderIds = Object.assign({}, currentItem.ProviderIds);
|
||||
|
||||
var idElements = form.querySelectorAll('.txtExternalId');
|
||||
const idElements = form.querySelectorAll('.txtExternalId');
|
||||
Array.prototype.map.call(idElements, function (idElem) {
|
||||
var providerKey = idElem.getAttribute('data-providerkey');
|
||||
const providerKey = idElem.getAttribute('data-providerkey');
|
||||
item.ProviderIds[providerKey] = idElem.value;
|
||||
});
|
||||
|
||||
@ -179,7 +200,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
if (currentItem.Type === 'Person') {
|
||||
|
||||
var placeOfBirth = form.querySelector('#txtPlaceOfBirth').value;
|
||||
const placeOfBirth = form.querySelector('#txtPlaceOfBirth').value;
|
||||
|
||||
item.ProductionLocations = placeOfBirth ? [placeOfBirth] : [];
|
||||
}
|
||||
@ -187,11 +208,11 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
if (currentItem.Type === 'Series') {
|
||||
|
||||
// 600000000
|
||||
var seriesRuntime = form.querySelector('#txtSeriesRuntime').value;
|
||||
const seriesRuntime = form.querySelector('#txtSeriesRuntime').value;
|
||||
item.RunTimeTicks = seriesRuntime ? (seriesRuntime * 600000000) : null;
|
||||
}
|
||||
|
||||
var tagline = form.querySelector('#txtTagline').value;
|
||||
const tagline = form.querySelector('#txtTagline').value;
|
||||
item.Taglines = tagline ? [tagline] : [];
|
||||
|
||||
submitUpdatedItem(form, item);
|
||||
@ -210,13 +231,12 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
}
|
||||
|
||||
function addElementToList(source, sortCallback) {
|
||||
require(['prompt'], function (prompt) {
|
||||
|
||||
import('prompt').then(({default: prompt}) => {
|
||||
prompt({
|
||||
label: 'Value:'
|
||||
}).then(function (text) {
|
||||
var list = dom.parentWithClass(source, 'editableListviewContainer').querySelector('.paperList');
|
||||
var items = getListValues(list);
|
||||
const list = dom.parentWithClass(source, 'editableListviewContainer').querySelector('.paperList');
|
||||
const items = getListValues(list);
|
||||
items.push(text);
|
||||
populateListView(list, items, sortCallback);
|
||||
});
|
||||
@ -224,7 +244,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
}
|
||||
|
||||
function removeElementFromList(source) {
|
||||
var el = dom.parentWithClass(source, 'listItem');
|
||||
const el = dom.parentWithClass(source, 'listItem');
|
||||
el.parentNode.removeChild(el);
|
||||
}
|
||||
|
||||
@ -234,7 +254,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
personEditor.show(person).then(function (updatedPerson) {
|
||||
|
||||
var isNew = index === -1;
|
||||
const isNew = index === -1;
|
||||
|
||||
if (isNew) {
|
||||
currentItem.People.push(updatedPerson);
|
||||
@ -284,13 +304,13 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function onEditorClick(e) {
|
||||
|
||||
var btnRemoveFromEditorList = dom.parentWithClass(e.target, 'btnRemoveFromEditorList');
|
||||
const btnRemoveFromEditorList = dom.parentWithClass(e.target, 'btnRemoveFromEditorList');
|
||||
if (btnRemoveFromEditorList) {
|
||||
removeElementFromList(btnRemoveFromEditorList);
|
||||
return;
|
||||
}
|
||||
|
||||
var btnAddTextItem = dom.parentWithClass(e.target, 'btnAddTextItem');
|
||||
const btnAddTextItem = dom.parentWithClass(e.target, 'btnAddTextItem');
|
||||
if (btnAddTextItem) {
|
||||
addElementToList(btnAddTextItem);
|
||||
}
|
||||
@ -301,18 +321,18 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
}
|
||||
|
||||
function bindAll(elems, eventName, fn) {
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
for (let i = 0, length = elems.length; i < length; i++) {
|
||||
elems[i].addEventListener(eventName, fn);
|
||||
}
|
||||
}
|
||||
|
||||
function init(context, apiClient) {
|
||||
context.querySelector('.externalIds').addEventListener('click', function (e) {
|
||||
var btnOpenExternalId = dom.parentWithClass(e.target, 'btnOpenExternalId');
|
||||
const btnOpenExternalId = dom.parentWithClass(e.target, 'btnOpenExternalId');
|
||||
if (btnOpenExternalId) {
|
||||
var field = context.querySelector('#' + btnOpenExternalId.getAttribute('data-fieldid'));
|
||||
const field = context.querySelector('#' + btnOpenExternalId.getAttribute('data-fieldid'));
|
||||
|
||||
var formatString = field.getAttribute('data-formatstring');
|
||||
const formatString = field.getAttribute('data-formatstring');
|
||||
|
||||
if (field.value) {
|
||||
shell.openUrl(formatString.replace('{0}', field.value));
|
||||
@ -351,7 +371,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
context.removeEventListener('click', onEditorClick);
|
||||
context.addEventListener('click', onEditorClick);
|
||||
|
||||
var form = context.querySelector('form');
|
||||
const form = context.querySelector('form');
|
||||
form.removeEventListener('submit', onSubmit);
|
||||
form.addEventListener('submit', onSubmit);
|
||||
|
||||
@ -362,15 +382,15 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
context.querySelector('#peopleList').addEventListener('click', function (e) {
|
||||
|
||||
var index;
|
||||
var btnDeletePerson = dom.parentWithClass(e.target, 'btnDeletePerson');
|
||||
let index;
|
||||
const btnDeletePerson = dom.parentWithClass(e.target, 'btnDeletePerson');
|
||||
if (btnDeletePerson) {
|
||||
index = parseInt(btnDeletePerson.getAttribute('data-index'));
|
||||
currentItem.People.splice(index, 1);
|
||||
populatePeople(context, currentItem.People);
|
||||
}
|
||||
|
||||
var btnEditPerson = dom.parentWithClass(e.target, 'btnEditPerson');
|
||||
const btnEditPerson = dom.parentWithClass(e.target, 'btnEditPerson');
|
||||
if (btnEditPerson) {
|
||||
index = parseInt(btnEditPerson.getAttribute('data-index'));
|
||||
editPerson(context, currentItem.People[index], index);
|
||||
@ -380,7 +400,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function getItem(itemId, serverId) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (itemId) {
|
||||
return apiClient.getItem(apiClient.getCurrentUserId(), itemId);
|
||||
@ -391,7 +411,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function getEditorConfig(itemId, serverId) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (itemId) {
|
||||
return apiClient.getJSON(apiClient.getUrl('Items/' + itemId + '/MetadataEditor'));
|
||||
@ -402,13 +422,13 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function populateCountries(select, allCountries) {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (var i = 0, length = allCountries.length; i < length; i++) {
|
||||
for (let i = 0, length = allCountries.length; i < length; i++) {
|
||||
|
||||
var culture = allCountries[i];
|
||||
const culture = allCountries[i];
|
||||
|
||||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + '</option>';
|
||||
}
|
||||
@ -418,13 +438,13 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function populateLanguages(select, languages) {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
for (let i = 0, length = languages.length; i < length; i++) {
|
||||
|
||||
var culture = languages[i];
|
||||
const culture = languages[i];
|
||||
|
||||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
||||
}
|
||||
@ -440,41 +460,41 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
showElement('#fldContentType', context);
|
||||
}
|
||||
|
||||
var html = metadataInfo.ContentTypeOptions.map(function (i) {
|
||||
const html = metadataInfo.ContentTypeOptions.map(function (i) {
|
||||
|
||||
return '<option value="' + i.Value + '">' + i.Name + '</option>';
|
||||
|
||||
}).join('');
|
||||
|
||||
var selectEl = context.querySelector('#selectContentType');
|
||||
const selectEl = context.querySelector('#selectContentType');
|
||||
selectEl.innerHTML = html;
|
||||
selectEl.value = metadataInfo.ContentType || '';
|
||||
}
|
||||
|
||||
function loadExternalIds(context, item, externalIds) {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
var providerIds = item.ProviderIds || {};
|
||||
const providerIds = item.ProviderIds || {};
|
||||
|
||||
for (var i = 0, length = externalIds.length; i < length; i++) {
|
||||
for (let i = 0, length = externalIds.length; i < length; i++) {
|
||||
|
||||
var idInfo = externalIds[i];
|
||||
const idInfo = externalIds[i];
|
||||
|
||||
var id = 'txt1' + idInfo.Key;
|
||||
var formatString = idInfo.UrlFormatString || '';
|
||||
const id = 'txt1' + idInfo.Key;
|
||||
const formatString = idInfo.UrlFormatString || '';
|
||||
|
||||
var fullName = idInfo.Name;
|
||||
let fullName = idInfo.Name;
|
||||
if (idInfo.Type) {
|
||||
fullName = idInfo.Name + ' ' + globalize.translate(idInfo.Type);
|
||||
}
|
||||
|
||||
var labelText = globalize.translate('LabelDynamicExternalId', fullName);
|
||||
const labelText = globalize.translate('LabelDynamicExternalId', fullName);
|
||||
|
||||
html += '<div class="inputContainer">';
|
||||
html += '<div class="flex align-items-center">';
|
||||
|
||||
var value = providerIds[idInfo.Key] || '';
|
||||
const value = providerIds[idInfo.Key] || '';
|
||||
|
||||
html += '<div class="flex-grow">';
|
||||
html += '<input is="emby-input" class="txtExternalId" value="' + value + '" data-providerkey="' + idInfo.Key + '" data-formatstring="' + formatString + '" id="' + id + '" label="' + labelText + '"/>';
|
||||
@ -488,7 +508,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
var elem = context.querySelector('.externalIds', context);
|
||||
const elem = context.querySelector('.externalIds', context);
|
||||
elem.innerHTML = html;
|
||||
|
||||
if (externalIds.length) {
|
||||
@ -505,7 +525,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
context = context || document;
|
||||
if (typeof selector === 'string') {
|
||||
|
||||
var elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
|
||||
const elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
|
||||
|
||||
Array.prototype.forEach.call(elements, function (el) {
|
||||
if (el) {
|
||||
@ -524,7 +544,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
context = context || document;
|
||||
if (typeof selector === 'string') {
|
||||
|
||||
var elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
|
||||
const elements = multiple ? context.querySelectorAll(selector) : [context.querySelector(selector)];
|
||||
|
||||
Array.prototype.forEach.call(elements, function (el) {
|
||||
if (el) {
|
||||
@ -726,7 +746,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function fillItemInfo(context, item, parentalRatingOptions) {
|
||||
|
||||
var select = context.querySelector('#selectOfficialRating');
|
||||
let select = context.querySelector('#selectOfficialRating');
|
||||
|
||||
populateRatings(parentalRatingOptions, select, item.OfficialRating);
|
||||
|
||||
@ -738,7 +758,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
select.value = item.CustomRating || '';
|
||||
|
||||
var selectStatus = context.querySelector('#selectStatus');
|
||||
const selectStatus = context.querySelector('#selectStatus');
|
||||
populateStatus(selectStatus);
|
||||
selectStatus.value = item.Status || '';
|
||||
|
||||
@ -757,8 +777,8 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
populateListView(context.querySelector('#listTags'), item.Tags);
|
||||
|
||||
var lockData = (item.LockData || false);
|
||||
var chkLockData = context.querySelector('#chkLockData');
|
||||
const lockData = (item.LockData || false);
|
||||
const chkLockData = context.querySelector('#chkLockData');
|
||||
chkLockData.checked = lockData;
|
||||
if (chkLockData.checked) {
|
||||
hideElement('.providerSettingsContainer', context);
|
||||
@ -796,7 +816,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
return a.Name;
|
||||
}).join(';');
|
||||
|
||||
var date;
|
||||
let date;
|
||||
|
||||
if (item.DateCreated) {
|
||||
try {
|
||||
@ -838,7 +858,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
context.querySelector('#txtAirTime').value = item.AirTime || '';
|
||||
|
||||
var placeofBirth = item.ProductionLocations && item.ProductionLocations.length ? item.ProductionLocations[0] : '';
|
||||
const placeofBirth = item.ProductionLocations && item.ProductionLocations.length ? item.ProductionLocations[0] : '';
|
||||
context.querySelector('#txtPlaceOfBirth').value = placeofBirth;
|
||||
|
||||
context.querySelector('#txtOriginalAspectRatio').value = item.AspectRatio || '';
|
||||
@ -848,7 +868,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
if (item.RunTimeTicks) {
|
||||
|
||||
var minutes = item.RunTimeTicks / 600000000;
|
||||
const minutes = item.RunTimeTicks / 600000000;
|
||||
|
||||
context.querySelector('#txtSeriesRuntime').value = Math.round(minutes);
|
||||
} else {
|
||||
@ -858,18 +878,16 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function populateRatings(allParentalRatings, select, currentValue) {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += "<option value=''></option>";
|
||||
|
||||
var ratings = [];
|
||||
var i;
|
||||
var length;
|
||||
var rating;
|
||||
const ratings = [];
|
||||
let rating;
|
||||
|
||||
var currentValueFound = false;
|
||||
let currentValueFound = false;
|
||||
|
||||
for (i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
|
||||
rating = allParentalRatings[i];
|
||||
|
||||
@ -884,7 +902,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
ratings.push({ Name: currentValue, Value: currentValue });
|
||||
}
|
||||
|
||||
for (i = 0, length = ratings.length; i < length; i++) {
|
||||
for (let i = 0, length = ratings.length; i < length; i++) {
|
||||
|
||||
rating = ratings[i];
|
||||
|
||||
@ -895,7 +913,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
}
|
||||
|
||||
function populateStatus(select) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += "<option value=''></option>";
|
||||
html += "<option value='Continuing'>" + globalize.translate('Continuing') + '</option>';
|
||||
@ -913,8 +931,8 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
} else {
|
||||
items = sortCallback(items);
|
||||
}
|
||||
var html = '';
|
||||
for (var i = 0; i < items.length; i++) {
|
||||
let html = '';
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
html += '<div class="listItem">';
|
||||
|
||||
html += '<span class="material-icons listItemIcon live_tv" style="background-color:#333;"></span>';
|
||||
@ -937,14 +955,14 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function populatePeople(context, people) {
|
||||
|
||||
var lastType = '';
|
||||
var html = '';
|
||||
let lastType = '';
|
||||
let html = '';
|
||||
|
||||
var elem = context.querySelector('#peopleList');
|
||||
const elem = context.querySelector('#peopleList');
|
||||
|
||||
for (var i = 0, length = people.length; i < length; i++) {
|
||||
for (let i = 0, length = people.length; i < length; i++) {
|
||||
|
||||
var person = people[i];
|
||||
const person = people[i];
|
||||
|
||||
html += '<div class="listItem">';
|
||||
|
||||
@ -974,13 +992,13 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
function getLockedFieldsHtml(fields, currentFields) {
|
||||
|
||||
var html = '';
|
||||
for (var i = 0; i < fields.length; i++) {
|
||||
let html = '';
|
||||
for (let i = 0; i < fields.length; i++) {
|
||||
|
||||
var field = fields[i];
|
||||
var name = field.name;
|
||||
var value = field.value || field.name;
|
||||
var checkedHtml = currentFields.indexOf(value) === -1 ? ' checked' : '';
|
||||
const field = fields[i];
|
||||
const name = field.name;
|
||||
const value = field.value || field.name;
|
||||
const checkedHtml = currentFields.indexOf(value) === -1 ? ' checked' : '';
|
||||
html += '<label>';
|
||||
html += '<input type="checkbox" is="emby-checkbox" class="selectLockedField" data-value="' + value + '"' + checkedHtml + '/>';
|
||||
html += '<span>' + name + '</span>';
|
||||
@ -990,10 +1008,10 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
}
|
||||
|
||||
function fillMetadataSettings(context, item, lockedFields) {
|
||||
var container = context.querySelector('.providerSettingsContainer');
|
||||
const container = context.querySelector('.providerSettingsContainer');
|
||||
lockedFields = lockedFields || [];
|
||||
|
||||
var lockedFieldsList = [
|
||||
const lockedFieldsList = [
|
||||
{ name: globalize.translate('Name'), value: 'Name' },
|
||||
{ name: globalize.translate('Overview'), value: 'Overview' },
|
||||
{ name: globalize.translate('Genres'), value: 'Genres' },
|
||||
@ -1014,7 +1032,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
lockedFieldsList.push({ name: globalize.translate('Studios'), value: 'Studios' });
|
||||
lockedFieldsList.push({ name: globalize.translate('Tags'), value: 'Tags' });
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<h2>' + globalize.translate('HeaderEnabledFields') + '</h2>';
|
||||
html += '<p>' + globalize.translate('HeaderEnabledFieldsHelp') + '</p>';
|
||||
@ -1028,13 +1046,13 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
Promise.all([getItem(itemId, serverId), getEditorConfig(itemId, serverId)]).then(function (responses) {
|
||||
|
||||
var item = responses[0];
|
||||
const item = responses[0];
|
||||
metadataEditorInfo = responses[1];
|
||||
|
||||
currentItem = item;
|
||||
|
||||
var languages = metadataEditorInfo.Cultures;
|
||||
var countries = metadataEditorInfo.Countries;
|
||||
const languages = metadataEditorInfo.Cultures;
|
||||
const countries = metadataEditorInfo.Countries;
|
||||
|
||||
renderContentTypeOptions(context, metadataEditorInfo);
|
||||
|
||||
@ -1057,8 +1075,8 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
}
|
||||
|
||||
function centerFocus(elem, horiz, on) {
|
||||
require(['scrollHelper'], function (scrollHelper) {
|
||||
var fn = on ? 'on' : 'off';
|
||||
import('scrollHelper').then(({default: scrollHelper}) => {
|
||||
const fn = on ? 'on' : 'off';
|
||||
scrollHelper.centerFocus[fn](elem, horiz);
|
||||
});
|
||||
}
|
||||
@ -1066,9 +1084,8 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
function show(itemId, serverId, resolve, reject) {
|
||||
loading.show();
|
||||
|
||||
require(['text!./metadataEditor.template.html'], function (template) {
|
||||
|
||||
var dialogOptions = {
|
||||
import('text!./metadataEditor.template.html').then(({default: template}) => {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
};
|
||||
@ -1079,13 +1096,13 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
dialogOptions.size = 'small';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
@ -1111,7 +1128,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
export default {
|
||||
show: function (itemId, serverId) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
return show(itemId, serverId, resolve, reject);
|
||||
@ -1123,9 +1140,8 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
|
||||
loading.show();
|
||||
|
||||
require(['text!./metadataEditor.template.html'], function (template) {
|
||||
|
||||
elem.innerHTML = globalize.translateDocument(template, 'core');
|
||||
import('text!./metadataEditor.template.html').then(({default: template}) => {
|
||||
elem.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
elem.querySelector('.formDialogFooter').classList.remove('formDialogFooter');
|
||||
elem.querySelector('.btnClose').classList.add('hide');
|
||||
@ -1142,4 +1158,5 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,9 +1,17 @@
|
||||
define(['dialogHelper', 'layoutManager', 'globalize', 'require', 'paper-icon-button-light', 'emby-input', 'emby-select', 'css!./../formdialog'], function (dialogHelper, layoutManager, globalize, require) {
|
||||
'use strict';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import layoutManager from 'layoutManager';
|
||||
import globalize from 'globalize';
|
||||
import require from 'require';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-input';
|
||||
import 'emby-select';
|
||||
import 'css!./../formdialog';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function centerFocus(elem, horiz, on) {
|
||||
require(['scrollHelper'], function (scrollHelper) {
|
||||
var fn = on ? 'on' : 'off';
|
||||
import('scrollHelper').then(({default: scrollHelper}) => {
|
||||
const fn = on ? 'on' : 'off';
|
||||
scrollHelper.centerFocus[fn](elem, horiz);
|
||||
});
|
||||
}
|
||||
@ -11,9 +19,9 @@ define(['dialogHelper', 'layoutManager', 'globalize', 'require', 'paper-icon-but
|
||||
function show(person) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['text!./personEditor.template.html'], function (template) {
|
||||
import('text!./personEditor.template.html').then(({default: template}) => {
|
||||
|
||||
var dialogOptions = {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
};
|
||||
@ -24,14 +32,14 @@ define(['dialogHelper', 'layoutManager', 'globalize', 'require', 'paper-icon-but
|
||||
dialogOptions.size = 'small';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
var submitted = false;
|
||||
let html = '';
|
||||
let submitted = false;
|
||||
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
@ -93,7 +101,8 @@ define(['dialogHelper', 'layoutManager', 'globalize', 'require', 'paper-icon-but
|
||||
});
|
||||
}
|
||||
|
||||
return {
|
||||
export default {
|
||||
show: show
|
||||
};
|
||||
});
|
||||
};
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,13 +1,20 @@
|
||||
define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'globalize', 'appRouter', 'dom', 'css!./multiSelect'], function (browser, appStorage, appHost, loading, connectionManager, globalize, appRouter, dom) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
import appHost from 'apphost';
|
||||
import loading from 'loading';
|
||||
import connectionManager from 'connectionManager';
|
||||
import globalize from 'globalize';
|
||||
import dom from 'dom';
|
||||
import 'css!./multiSelect';
|
||||
|
||||
var selectedItems = [];
|
||||
var selectedElements = [];
|
||||
var currentSelectionCommandsPanel;
|
||||
/* eslint-disable indent */
|
||||
|
||||
let selectedItems = [];
|
||||
let selectedElements = [];
|
||||
let currentSelectionCommandsPanel;
|
||||
|
||||
function hideSelections() {
|
||||
|
||||
var selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||
const selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||
if (selectionCommandsPanel) {
|
||||
|
||||
selectionCommandsPanel.parentNode.removeChild(selectionCommandsPanel);
|
||||
@ -15,10 +22,10 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
selectedItems = [];
|
||||
selectedElements = [];
|
||||
var elems = document.querySelectorAll('.itemSelectionPanel');
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
const elems = document.querySelectorAll('.itemSelectionPanel');
|
||||
for (let i = 0, length = elems.length; i < length; i++) {
|
||||
|
||||
var parent = elems[i].parentNode;
|
||||
const parent = elems[i].parentNode;
|
||||
parent.removeChild(elems[i]);
|
||||
parent.classList.remove('withMultiSelect');
|
||||
}
|
||||
@ -29,14 +36,14 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
// toggle the checkbox, if it wasn't clicked on
|
||||
if (!dom.parentWithClass(e.target, 'chkItemSelect')) {
|
||||
var chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||
const chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||
|
||||
if (chkItemSelect) {
|
||||
|
||||
if (chkItemSelect.classList.contains('checkedInitial')) {
|
||||
chkItemSelect.classList.remove('checkedInitial');
|
||||
} else {
|
||||
var newValue = !chkItemSelect.checked;
|
||||
const newValue = !chkItemSelect.checked;
|
||||
chkItemSelect.checked = newValue;
|
||||
updateItemSelection(chkItemSelect, newValue);
|
||||
}
|
||||
@ -50,11 +57,11 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
function updateItemSelection(chkItemSelect, selected) {
|
||||
|
||||
var id = dom.parentWithAttribute(chkItemSelect, 'data-id').getAttribute('data-id');
|
||||
const id = dom.parentWithAttribute(chkItemSelect, 'data-id').getAttribute('data-id');
|
||||
|
||||
if (selected) {
|
||||
|
||||
var current = selectedItems.filter(function (i) {
|
||||
const current = selectedItems.filter(i => {
|
||||
return i === id;
|
||||
});
|
||||
|
||||
@ -64,16 +71,16 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
}
|
||||
|
||||
} else {
|
||||
selectedItems = selectedItems.filter(function (i) {
|
||||
selectedItems = selectedItems.filter(i => {
|
||||
return i !== id;
|
||||
});
|
||||
selectedElements = selectedElements.filter(function (i) {
|
||||
selectedElements = selectedElements.filter(i => {
|
||||
return i !== chkItemSelect;
|
||||
});
|
||||
}
|
||||
|
||||
if (selectedItems.length) {
|
||||
var itemSelectionCount = document.querySelector('.itemSelectionCount');
|
||||
const itemSelectionCount = document.querySelector('.itemSelectionCount');
|
||||
if (itemSelectionCount) {
|
||||
itemSelectionCount.innerHTML = selectedItems.length;
|
||||
}
|
||||
@ -88,33 +95,33 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
function showSelection(item, isChecked) {
|
||||
|
||||
var itemSelectionPanel = item.querySelector('.itemSelectionPanel');
|
||||
let itemSelectionPanel = item.querySelector('.itemSelectionPanel');
|
||||
|
||||
if (!itemSelectionPanel) {
|
||||
|
||||
itemSelectionPanel = document.createElement('div');
|
||||
itemSelectionPanel.classList.add('itemSelectionPanel');
|
||||
|
||||
var parent = item.querySelector('.cardBox') || item.querySelector('.cardContent');
|
||||
const parent = item.querySelector('.cardBox') || item.querySelector('.cardContent');
|
||||
parent.classList.add('withMultiSelect');
|
||||
parent.appendChild(itemSelectionPanel);
|
||||
|
||||
var cssClass = 'chkItemSelect';
|
||||
let cssClass = 'chkItemSelect';
|
||||
if (isChecked && !browser.firefox) {
|
||||
// In firefox, the initial tap hold doesnt' get treated as a click
|
||||
// In other browsers it does, so we need to make sure that initial click is ignored
|
||||
cssClass += ' checkedInitial';
|
||||
}
|
||||
var checkedAttribute = isChecked ? ' checked' : '';
|
||||
itemSelectionPanel.innerHTML = '<label class="checkboxContainer"><input type="checkbox" is="emby-checkbox" data-outlineclass="multiSelectCheckboxOutline" class="' + cssClass + '"' + checkedAttribute + '/><span></span></label>';
|
||||
var chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||
const checkedAttribute = isChecked ? ' checked' : '';
|
||||
itemSelectionPanel.innerHTML = `<label class="checkboxContainer"><input type="checkbox" is="emby-checkbox" data-outlineclass="multiSelectCheckboxOutline" class="${cssClass}"${checkedAttribute}/><span></span></label>`;
|
||||
const chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||
chkItemSelect.addEventListener('change', onSelectionChange);
|
||||
}
|
||||
}
|
||||
|
||||
function showSelectionCommands() {
|
||||
|
||||
var selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||
let selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||
|
||||
if (!selectionCommandsPanel) {
|
||||
|
||||
@ -124,19 +131,19 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
document.body.appendChild(selectionCommandsPanel);
|
||||
currentSelectionCommandsPanel = selectionCommandsPanel;
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<button is="paper-icon-button-light" class="btnCloseSelectionPanel autoSize"><span class="material-icons close"></span></button>';
|
||||
html += '<h1 class="itemSelectionCount"></h1>';
|
||||
|
||||
const moreIcon = 'more_vert';
|
||||
html += '<button is="paper-icon-button-light" class="btnSelectionPanelOptions autoSize" style="margin-left:auto;"><span class="material-icons ' + moreIcon + '"></span></button>';
|
||||
html += `<button is="paper-icon-button-light" class="btnSelectionPanelOptions autoSize" style="margin-left:auto;"><span class="material-icons ${moreIcon}"></span></button>`;
|
||||
|
||||
selectionCommandsPanel.innerHTML = html;
|
||||
|
||||
selectionCommandsPanel.querySelector('.btnCloseSelectionPanel').addEventListener('click', hideSelections);
|
||||
|
||||
var btnSelectionPanelOptions = selectionCommandsPanel.querySelector('.btnSelectionPanelOptions');
|
||||
const btnSelectionPanelOptions = selectionCommandsPanel.querySelector('.btnSelectionPanelOptions');
|
||||
|
||||
dom.addEventListener(btnSelectionPanelOptions, 'click', showMenuForSelectedItems, { passive: true });
|
||||
}
|
||||
@ -144,9 +151,9 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
function alertText(options) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(options).then(resolve, resolve);
|
||||
});
|
||||
});
|
||||
@ -154,24 +161,24 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
function deleteItems(apiClient, itemIds) {
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
var msg = globalize.translate('ConfirmDeleteItem');
|
||||
var title = globalize.translate('HeaderDeleteItem');
|
||||
let msg = globalize.translate('ConfirmDeleteItem');
|
||||
let title = globalize.translate('HeaderDeleteItem');
|
||||
|
||||
if (itemIds.length > 1) {
|
||||
msg = globalize.translate('ConfirmDeleteItems');
|
||||
title = globalize.translate('HeaderDeleteItems');
|
||||
}
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
|
||||
confirm(msg, title).then(function () {
|
||||
var promises = itemIds.map(function (itemId) {
|
||||
confirm(msg, title).then(() => {
|
||||
const promises = itemIds.map(itemId => {
|
||||
apiClient.deleteItem(itemId);
|
||||
});
|
||||
|
||||
Promise.all(promises).then(resolve, function () {
|
||||
Promise.all(promises).then(resolve, () => {
|
||||
|
||||
alertText(globalize.translate('ErrorDeletingItem')).then(reject, reject);
|
||||
});
|
||||
@ -183,11 +190,11 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
function showMenuForSelectedItems(e) {
|
||||
|
||||
var apiClient = connectionManager.currentApiClient();
|
||||
const apiClient = connectionManager.currentApiClient();
|
||||
|
||||
apiClient.getCurrentUser().then(function (user) {
|
||||
apiClient.getCurrentUser().then(user => {
|
||||
|
||||
var menuItems = [];
|
||||
const menuItems = [];
|
||||
|
||||
menuItems.push({
|
||||
name: globalize.translate('AddToCollection'),
|
||||
@ -244,18 +251,18 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
icon: 'refresh'
|
||||
});
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: e.target,
|
||||
callback: function (id) {
|
||||
var items = selectedItems.slice(0);
|
||||
var serverId = apiClient.serverInfo().Id;
|
||||
const items = selectedItems.slice(0);
|
||||
const serverId = apiClient.serverInfo().Id;
|
||||
|
||||
switch (id) {
|
||||
case 'addtocollection':
|
||||
require(['collectionEditor'], function (collectionEditor) {
|
||||
new collectionEditor().show({
|
||||
import('collectionEditor').then(({default: collectionEditor}) => {
|
||||
new collectionEditor({
|
||||
items: items,
|
||||
serverId: serverId
|
||||
});
|
||||
@ -264,8 +271,8 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
dispatchNeedsRefresh();
|
||||
break;
|
||||
case 'playlist':
|
||||
require(['playlistEditor'], function (playlistEditor) {
|
||||
new playlistEditor().show({
|
||||
import('playlistEditor').then(({default: playlistEditor}) => {
|
||||
new playlistEditor({
|
||||
items: items,
|
||||
serverId: serverId
|
||||
});
|
||||
@ -282,21 +289,21 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
combineVersions(apiClient, items);
|
||||
break;
|
||||
case 'markplayed':
|
||||
items.forEach(function (itemId) {
|
||||
items.forEach(itemId => {
|
||||
apiClient.markPlayed(apiClient.getCurrentUserId(), itemId);
|
||||
});
|
||||
hideSelections();
|
||||
dispatchNeedsRefresh();
|
||||
break;
|
||||
case 'markunplayed':
|
||||
items.forEach(function (itemId) {
|
||||
items.forEach(itemId => {
|
||||
apiClient.markUnplayed(apiClient.getCurrentUserId(), itemId);
|
||||
});
|
||||
hideSelections();
|
||||
dispatchNeedsRefresh();
|
||||
break;
|
||||
case 'refresh':
|
||||
require(['refreshDialog'], function (refreshDialog) {
|
||||
import('refreshDialog').then(({default: refreshDialog}) => {
|
||||
new refreshDialog({
|
||||
itemIds: items,
|
||||
serverId: serverId
|
||||
@ -317,18 +324,18 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
function dispatchNeedsRefresh() {
|
||||
|
||||
var elems = [];
|
||||
const elems = [];
|
||||
|
||||
[].forEach.call(selectedElements, function (i) {
|
||||
[].forEach.call(selectedElements, i => {
|
||||
|
||||
var container = dom.parentWithAttribute(i, 'is', 'emby-itemscontainer');
|
||||
const container = dom.parentWithAttribute(i, 'is', 'emby-itemscontainer');
|
||||
|
||||
if (container && elems.indexOf(container) === -1) {
|
||||
if (container && !elems.includes(container)) {
|
||||
elems.push(container);
|
||||
}
|
||||
});
|
||||
|
||||
for (var i = 0, length = elems.length; i < length; i++) {
|
||||
for (let i = 0, length = elems.length; i < length; i++) {
|
||||
elems[i].notifyRefreshNeeded(true);
|
||||
}
|
||||
}
|
||||
@ -337,8 +344,9 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
if (selection.length < 2) {
|
||||
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert({
|
||||
|
||||
text: globalize.translate('PleaseSelectTwoItems')
|
||||
});
|
||||
});
|
||||
@ -352,7 +360,7 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
type: 'POST',
|
||||
url: apiClient.getUrl('Videos/MergeVersions', { Ids: selection.join(',') })
|
||||
|
||||
}).then(function () {
|
||||
}).then(() => {
|
||||
|
||||
loading.hide();
|
||||
hideSelections();
|
||||
@ -362,9 +370,9 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
function showSelections(initialCard) {
|
||||
|
||||
require(['emby-checkbox'], function () {
|
||||
var cards = document.querySelectorAll('.card');
|
||||
for (var i = 0, length = cards.length; i < length; i++) {
|
||||
import('emby-checkbox').then(() => {
|
||||
const cards = document.querySelectorAll('.card');
|
||||
for (let i = 0, length = cards.length; i < length; i++) {
|
||||
showSelection(cards[i], initialCard === cards[i]);
|
||||
}
|
||||
|
||||
@ -375,13 +383,13 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
function onContainerClick(e) {
|
||||
|
||||
var target = e.target;
|
||||
const target = e.target;
|
||||
|
||||
if (selectedItems.length) {
|
||||
|
||||
var card = dom.parentWithClass(target, 'card');
|
||||
const card = dom.parentWithClass(target, 'card');
|
||||
if (card) {
|
||||
var itemSelectionPanel = card.querySelector('.itemSelectionPanel');
|
||||
const itemSelectionPanel = card.querySelector('.itemSelectionPanel');
|
||||
if (itemSelectionPanel) {
|
||||
return onItemSelectionPanelClick(e, itemSelectionPanel);
|
||||
}
|
||||
@ -395,15 +403,15 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
document.addEventListener('viewbeforehide', hideSelections);
|
||||
|
||||
return function (options) {
|
||||
export default function (options) {
|
||||
|
||||
var self = this;
|
||||
const self = this;
|
||||
|
||||
var container = options.container;
|
||||
const container = options.container;
|
||||
|
||||
function onTapHold(e) {
|
||||
|
||||
var card = dom.parentWithClass(e.target, 'card');
|
||||
const card = dom.parentWithClass(e.target, 'card');
|
||||
|
||||
if (card) {
|
||||
|
||||
@ -423,13 +431,13 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
return e.changedTouches || e.targetTouches || e.touches;
|
||||
}
|
||||
|
||||
var touchTarget;
|
||||
var touchStartTimeout;
|
||||
var touchStartX;
|
||||
var touchStartY;
|
||||
let touchTarget;
|
||||
let touchStartTimeout;
|
||||
let touchStartX;
|
||||
let touchStartY;
|
||||
function onTouchStart(e) {
|
||||
|
||||
var touch = getTouches(e)[0];
|
||||
const touch = getTouches(e)[0];
|
||||
touchTarget = null;
|
||||
touchStartX = 0;
|
||||
touchStartY = 0;
|
||||
@ -437,10 +445,10 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
if (touch) {
|
||||
touchStartX = touch.clientX;
|
||||
touchStartY = touch.clientY;
|
||||
var element = touch.target;
|
||||
const element = touch.target;
|
||||
|
||||
if (element) {
|
||||
var card = dom.parentWithClass(element, 'card');
|
||||
const card = dom.parentWithClass(element, 'card');
|
||||
|
||||
if (card) {
|
||||
|
||||
@ -459,13 +467,13 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
function onTouchMove(e) {
|
||||
|
||||
if (touchTarget) {
|
||||
var touch = getTouches(e)[0];
|
||||
var deltaX;
|
||||
var deltaY;
|
||||
const touch = getTouches(e)[0];
|
||||
let deltaX;
|
||||
let deltaY;
|
||||
|
||||
if (touch) {
|
||||
var touchEndX = touch.clientX || 0;
|
||||
var touchEndY = touch.clientY || 0;
|
||||
const touchEndX = touch.clientX || 0;
|
||||
const touchEndY = touch.clientY || 0;
|
||||
deltaX = Math.abs(touchEndX - (touchStartX || 0));
|
||||
deltaY = Math.abs(touchEndY - (touchStartY || 0));
|
||||
} else {
|
||||
@ -509,7 +517,7 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
return;
|
||||
}
|
||||
|
||||
var card = dom.parentWithClass(touchTarget, 'card');
|
||||
const card = dom.parentWithClass(touchTarget, 'card');
|
||||
touchTarget = null;
|
||||
|
||||
if (card) {
|
||||
@ -556,12 +564,12 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
|
||||
self.onContainerClick = onContainerClick;
|
||||
|
||||
self.destroy = function () {
|
||||
self.destroy = () => {
|
||||
|
||||
container.removeEventListener('click', onContainerClick);
|
||||
container.removeEventListener('contextmenu', onTapHold);
|
||||
|
||||
var element = container;
|
||||
const element = container;
|
||||
|
||||
dom.removeEventListener(element, 'touchstart', onTouchStart, {
|
||||
passive: true
|
||||
@ -586,5 +594,6 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||
passive: true
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,31 +1,46 @@
|
||||
define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader', 'layoutManager', 'playbackManager', 'nowPlayingHelper', 'apphost', 'dom', 'connectionManager', 'itemContextMenu', 'paper-icon-button-light', 'emby-ratingbutton'], function (require, datetime, itemHelper, events, browser, imageLoader, layoutManager, playbackManager, nowPlayingHelper, appHost, dom, connectionManager, itemContextMenu) {
|
||||
'use strict';
|
||||
import require from 'require';
|
||||
import datetime from 'datetime';
|
||||
import itemHelper from 'itemHelper';
|
||||
import events from 'events';
|
||||
import browser from 'browser';
|
||||
import imageLoader from 'imageLoader';
|
||||
import layoutManager from 'layoutManager';
|
||||
import playbackManager from 'playbackManager';
|
||||
import nowPlayingHelper from 'nowPlayingHelper';
|
||||
import appHost from 'apphost';
|
||||
import dom from 'dom';
|
||||
import connectionManager from 'connectionManager';
|
||||
import itemContextMenu from 'itemContextMenu';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-ratingbutton';
|
||||
|
||||
var currentPlayer;
|
||||
var currentPlayerSupportedCommands = [];
|
||||
/* eslint-disable indent */
|
||||
|
||||
var currentTimeElement;
|
||||
var nowPlayingImageElement;
|
||||
var nowPlayingTextElement;
|
||||
var nowPlayingUserData;
|
||||
var muteButton;
|
||||
var volumeSlider;
|
||||
var volumeSliderContainer;
|
||||
var playPauseButtons;
|
||||
var positionSlider;
|
||||
var toggleRepeatButton;
|
||||
var toggleRepeatButtonIcon;
|
||||
let currentPlayer;
|
||||
let currentPlayerSupportedCommands = [];
|
||||
|
||||
var lastUpdateTime = 0;
|
||||
var lastPlayerState = {};
|
||||
var isEnabled;
|
||||
var currentRuntimeTicks = 0;
|
||||
let currentTimeElement;
|
||||
let nowPlayingImageElement;
|
||||
let nowPlayingTextElement;
|
||||
let nowPlayingUserData;
|
||||
let muteButton;
|
||||
let volumeSlider;
|
||||
let volumeSliderContainer;
|
||||
let playPauseButtons;
|
||||
let positionSlider;
|
||||
let toggleRepeatButton;
|
||||
let toggleRepeatButtonIcon;
|
||||
|
||||
var isVisibilityAllowed = true;
|
||||
let lastUpdateTime = 0;
|
||||
let lastPlayerState = {};
|
||||
let isEnabled;
|
||||
let currentRuntimeTicks = 0;
|
||||
|
||||
let isVisibilityAllowed = true;
|
||||
|
||||
function getNowPlayingBarHtml() {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<div class="nowPlayingBar hide nowPlayingBar-hidden">';
|
||||
|
||||
@ -214,7 +229,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
|
||||
if (currentPlayer) {
|
||||
|
||||
var newPercent = parseFloat(this.value);
|
||||
const newPercent = parseFloat(this.value);
|
||||
|
||||
playbackManager.seekPercent(newPercent, currentPlayer);
|
||||
}
|
||||
@ -223,13 +238,13 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
|
||||
positionSlider.getBubbleText = function (value) {
|
||||
|
||||
var state = lastPlayerState;
|
||||
const state = lastPlayerState;
|
||||
|
||||
if (!state || !state.NowPlayingItem || !currentRuntimeTicks) {
|
||||
return '--:--';
|
||||
}
|
||||
|
||||
var ticks = currentRuntimeTicks;
|
||||
let ticks = currentRuntimeTicks;
|
||||
ticks /= 100;
|
||||
ticks *= value;
|
||||
|
||||
@ -246,12 +261,12 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
|
||||
function showRemoteControl() {
|
||||
|
||||
require(['appRouter'], function (appRouter) {
|
||||
import('appRouter').then(({default: appRouter}) => {
|
||||
appRouter.showNowPlaying();
|
||||
});
|
||||
}
|
||||
|
||||
var nowPlayingBarElement;
|
||||
let nowPlayingBarElement;
|
||||
function getNowPlayingBar() {
|
||||
|
||||
if (nowPlayingBarElement) {
|
||||
@ -259,10 +274,14 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
}
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
|
||||
require(['appFooter-shared', 'itemShortcuts', 'css!./nowPlayingBar.css', 'emby-slider'], function (appfooter, itemShortcuts) {
|
||||
|
||||
var parentContainer = appfooter.element;
|
||||
Promise.all([
|
||||
import('appFooter-shared'),
|
||||
import('itemShortcuts'),
|
||||
import('css!./nowPlayingBar.css'),
|
||||
import('emby-slider')
|
||||
])
|
||||
.then(([appfooter, itemShortcuts]) => {
|
||||
const parentContainer = appfooter.element;
|
||||
nowPlayingBarElement = parentContainer.querySelector('.nowPlayingBar');
|
||||
|
||||
if (nowPlayingBarElement) {
|
||||
@ -315,13 +334,13 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
|
||||
lastPlayerState = state;
|
||||
|
||||
var playerInfo = playbackManager.getPlayerInfo();
|
||||
const playerInfo = playbackManager.getPlayerInfo();
|
||||
|
||||
var playState = state.PlayState || {};
|
||||
const playState = state.PlayState || {};
|
||||
|
||||
updatePlayPauseState(playState.IsPaused);
|
||||
|
||||
var supportedCommands = playerInfo.supportedCommands;
|
||||
const supportedCommands = playerInfo.supportedCommands;
|
||||
currentPlayerSupportedCommands = supportedCommands;
|
||||
|
||||
if (supportedCommands.indexOf('SetRepeatMode') === -1) {
|
||||
@ -339,11 +358,11 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
positionSlider.disabled = !playState.CanSeek;
|
||||
|
||||
// determines if both forward and backward buffer progress will be visible
|
||||
var isProgressClear = state.MediaSource && state.MediaSource.RunTimeTicks == null;
|
||||
const isProgressClear = state.MediaSource && state.MediaSource.RunTimeTicks == null;
|
||||
positionSlider.setIsClear(isProgressClear);
|
||||
}
|
||||
|
||||
var nowPlayingItem = state.NowPlayingItem || {};
|
||||
const nowPlayingItem = state.NowPlayingItem || {};
|
||||
updateTimeDisplay(playState.PositionTicks, nowPlayingItem.RunTimeTicks, playbackManager.getBufferedRanges(player));
|
||||
|
||||
updateNowPlayingInfo(state);
|
||||
@ -374,7 +393,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
// See bindEvents for why this is necessary
|
||||
if (positionSlider && !positionSlider.dragging) {
|
||||
if (runtimeTicks) {
|
||||
var pct = positionTicks / runtimeTicks;
|
||||
let pct = positionTicks / runtimeTicks;
|
||||
pct *= 100;
|
||||
|
||||
positionSlider.value = pct;
|
||||
@ -388,7 +407,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
}
|
||||
|
||||
if (currentTimeElement) {
|
||||
var timeText = positionTicks == null ? '--:--' : datetime.getDisplayRunningTime(positionTicks);
|
||||
let timeText = positionTicks == null ? '--:--' : datetime.getDisplayRunningTime(positionTicks);
|
||||
if (runtimeTicks) {
|
||||
timeText += ' / ' + datetime.getDisplayRunningTime(runtimeTicks);
|
||||
}
|
||||
@ -399,10 +418,10 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
|
||||
function updatePlayerVolumeState(isMuted, volumeLevel) {
|
||||
|
||||
var supportedCommands = currentPlayerSupportedCommands;
|
||||
const supportedCommands = currentPlayerSupportedCommands;
|
||||
|
||||
var showMuteButton = true;
|
||||
var showVolumeSlider = true;
|
||||
let showMuteButton = true;
|
||||
let showVolumeSlider = true;
|
||||
|
||||
if (supportedCommands.indexOf('ToggleMute') === -1) {
|
||||
showMuteButton = false;
|
||||
@ -504,12 +523,12 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
return null;
|
||||
}
|
||||
|
||||
var currentImgUrl;
|
||||
let currentImgUrl;
|
||||
function updateNowPlayingInfo(state) {
|
||||
|
||||
var nowPlayingItem = state.NowPlayingItem;
|
||||
const nowPlayingItem = state.NowPlayingItem;
|
||||
|
||||
var textLines = nowPlayingItem ? nowPlayingHelper.getNowPlayingNames(nowPlayingItem) : [];
|
||||
const textLines = nowPlayingItem ? nowPlayingHelper.getNowPlayingNames(nowPlayingItem) : [];
|
||||
nowPlayingTextElement.innerHTML = '';
|
||||
if (textLines) {
|
||||
let itemText = document.createElement('div');
|
||||
@ -533,15 +552,15 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
nowPlayingTextElement.appendChild(secondaryText);
|
||||
}
|
||||
|
||||
var imgHeight = 70;
|
||||
const imgHeight = 70;
|
||||
|
||||
var url = nowPlayingItem ? (seriesImageUrl(nowPlayingItem, {
|
||||
const url = nowPlayingItem ? (seriesImageUrl(nowPlayingItem, {
|
||||
height: imgHeight
|
||||
}) || imageUrl(nowPlayingItem, {
|
||||
height: imgHeight
|
||||
})) : null;
|
||||
|
||||
var isRefreshing = false;
|
||||
let isRefreshing = false;
|
||||
|
||||
if (url !== currentImgUrl) {
|
||||
currentImgUrl = url;
|
||||
@ -561,10 +580,10 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
if (nowPlayingItem.Id) {
|
||||
if (isRefreshing) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId);
|
||||
const apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId);
|
||||
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
|
||||
var userData = item.UserData || {};
|
||||
var likes = userData.Likes == null ? '' : userData.Likes;
|
||||
const userData = item.UserData || {};
|
||||
const likes = userData.Likes == null ? '' : userData.Likes;
|
||||
if (!layoutManager.mobile) {
|
||||
let contextButton = nowPlayingBarElement.querySelector('.btnToggleContextMenu');
|
||||
// We remove the previous event listener by replacing the item in each update event
|
||||
@ -645,7 +664,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
// in the event of a stop->play command
|
||||
|
||||
// Don't call getNowPlayingBar here because we don't want to end up creating it just to hide it
|
||||
var elem = document.getElementsByClassName('nowPlayingBar')[0];
|
||||
const elem = document.getElementsByClassName('nowPlayingBar')[0];
|
||||
if (elem) {
|
||||
|
||||
slideDown(elem);
|
||||
@ -655,7 +674,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
function onPlaybackStopped(e, state) {
|
||||
|
||||
console.debug('nowplaying event: ' + e.type);
|
||||
var player = this;
|
||||
const player = this;
|
||||
|
||||
if (player.isLocalPlayer) {
|
||||
if (state.NextMediaType !== 'Audio') {
|
||||
@ -674,14 +693,14 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
return;
|
||||
}
|
||||
|
||||
var player = this;
|
||||
const player = this;
|
||||
updatePlayPauseState(player.paused());
|
||||
}
|
||||
|
||||
function onStateChanged(event, state) {
|
||||
|
||||
console.debug('nowplaying event: ' + event.type);
|
||||
var player = this;
|
||||
const player = this;
|
||||
|
||||
if (!state.NowPlayingItem || layoutManager.tv) {
|
||||
hideNowPlayingBar();
|
||||
@ -712,21 +731,21 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
}
|
||||
|
||||
// Try to avoid hammering the document with changes
|
||||
var now = new Date().getTime();
|
||||
const now = new Date().getTime();
|
||||
if ((now - lastUpdateTime) < 700) {
|
||||
|
||||
return;
|
||||
}
|
||||
lastUpdateTime = now;
|
||||
|
||||
var player = this;
|
||||
const player = this;
|
||||
currentRuntimeTicks = playbackManager.duration(player);
|
||||
updateTimeDisplay(playbackManager.currentTime(player), currentRuntimeTicks, playbackManager.getBufferedRanges(player));
|
||||
}
|
||||
|
||||
function releaseCurrentPlayer() {
|
||||
|
||||
var player = currentPlayer;
|
||||
const player = currentPlayer;
|
||||
|
||||
if (player) {
|
||||
events.off(player, 'playbackstart', onPlaybackStart);
|
||||
@ -750,14 +769,14 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
return;
|
||||
}
|
||||
|
||||
var player = this;
|
||||
const player = this;
|
||||
|
||||
updatePlayerVolumeState(player.isMuted(), player.getVolume());
|
||||
}
|
||||
|
||||
function refreshFromPlayer(player) {
|
||||
|
||||
var state = playbackManager.getPlayerState(player);
|
||||
const state = playbackManager.getPlayerState(player);
|
||||
|
||||
onStateChanged.call(player, { type: 'init' }, state);
|
||||
}
|
||||
@ -814,4 +833,5 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -692,7 +692,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
||||
function showPlaybackInfoErrorMessage(instance, errorCode, playNextTrack) {
|
||||
|
||||
require(['alert'], function (alert) {
|
||||
alert({
|
||||
alert.default({
|
||||
text: globalize.translate('PlaybackError' + errorCode),
|
||||
title: globalize.translate('HeaderPlaybackError')
|
||||
}).then(function () {
|
||||
|
@ -118,7 +118,7 @@ export function show(button) {
|
||||
|
||||
});
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
|
||||
loading.hide();
|
||||
|
||||
@ -153,8 +153,12 @@ export function show(button) {
|
||||
}
|
||||
|
||||
function showActivePlayerMenu(playerInfo) {
|
||||
|
||||
require(['dialogHelper', 'dialog', 'emby-checkbox', 'emby-button'], function (dialogHelper) {
|
||||
Promise.all([
|
||||
import('dialogHelper'),
|
||||
import('dialog'),
|
||||
import('emby-checkbox'),
|
||||
import('emby-button')
|
||||
]).then(([dialogHelper]) => {
|
||||
showActivePlayerMenuInternal(dialogHelper, playerInfo);
|
||||
});
|
||||
}
|
||||
@ -163,7 +167,7 @@ function disconnectFromPlayer(currentDeviceName) {
|
||||
|
||||
if (playbackManager.getSupportedCommands().indexOf('EndSession') !== -1) {
|
||||
|
||||
require(['dialog'], function (dialog) {
|
||||
import('dialog').then(({default: dialog}) => {
|
||||
|
||||
var menuItems = [];
|
||||
|
||||
|
@ -1,31 +1,42 @@
|
||||
define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'qualityoptions', 'globalize', 'loading', 'connectionManager', 'dom', 'events', 'emby-select', 'emby-checkbox'], function (require, browser, appSettings, appHost, focusManager, qualityoptions, globalize, loading, connectionManager, dom, events) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
import appSettings from 'appSettings';
|
||||
import appHost from 'apphost';
|
||||
import focusManager from 'focusManager';
|
||||
import qualityoptions from 'qualityoptions';
|
||||
import globalize from 'globalize';
|
||||
import loading from 'loading';
|
||||
import connectionManager from 'connectionManager';
|
||||
import events from 'events';
|
||||
import 'emby-select';
|
||||
import 'emby-checkbox';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function fillSkipLengths(select) {
|
||||
|
||||
var options = [5, 10, 15, 20, 25, 30];
|
||||
const options = [5, 10, 15, 20, 25, 30];
|
||||
|
||||
select.innerHTML = options.map(function (option) {
|
||||
select.innerHTML = options.map(option => {
|
||||
return {
|
||||
name: globalize.translate('ValueSeconds', option),
|
||||
value: option * 1000
|
||||
};
|
||||
}).map(function (o) {
|
||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
||||
}).map(o => {
|
||||
return `<option value="${o.value}">${o.name}</option>`;
|
||||
}).join('');
|
||||
}
|
||||
|
||||
function populateLanguages(select, languages) {
|
||||
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += "<option value=''>" + globalize.translate('AnyLanguage') + '</option>';
|
||||
html += `<option value=''>${globalize.translate('AnyLanguage')}</option>`;
|
||||
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
for (let i = 0, length = languages.length; i < length; i++) {
|
||||
|
||||
var culture = languages[i];
|
||||
const culture = languages[i];
|
||||
|
||||
html += "<option value='" + culture.ThreeLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
||||
html += `<option value='${culture.ThreeLetterISOLanguageName}'>${culture.DisplayName}</option>`;
|
||||
}
|
||||
|
||||
select.innerHTML = html;
|
||||
@ -33,7 +44,7 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
|
||||
function setMaxBitrateIntoField(select, isInNetwork, mediatype) {
|
||||
|
||||
var options = mediatype === 'Audio' ? qualityoptions.getAudioQualityOptions({
|
||||
const options = mediatype === 'Audio' ? qualityoptions.getAudioQualityOptions({
|
||||
|
||||
currentMaxBitrate: appSettings.maxStreamingBitrate(isInNetwork, mediatype),
|
||||
isAutomaticBitrateEnabled: appSettings.enableAutomaticBitrateDetection(isInNetwork, mediatype),
|
||||
@ -47,10 +58,10 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
|
||||
});
|
||||
|
||||
select.innerHTML = options.map(function (i) {
|
||||
select.innerHTML = options.map(i => {
|
||||
|
||||
// render empty string instead of 0 for the auto option
|
||||
return '<option value="' + (i.bitrate || '') + '">' + i.name + '</option>';
|
||||
return `<option value="${i.bitrate || ''}">${i.name}</option>`;
|
||||
}).join('');
|
||||
|
||||
if (appSettings.enableAutomaticBitrateDetection(isInNetwork, mediatype)) {
|
||||
@ -62,23 +73,23 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
|
||||
function fillChromecastQuality(select) {
|
||||
|
||||
var options = qualityoptions.getVideoQualityOptions({
|
||||
const options = qualityoptions.getVideoQualityOptions({
|
||||
|
||||
currentMaxBitrate: appSettings.maxChromecastBitrate(),
|
||||
isAutomaticBitrateEnabled: !appSettings.maxChromecastBitrate(),
|
||||
enableAuto: true
|
||||
});
|
||||
|
||||
select.innerHTML = options.map(function (i) {
|
||||
select.innerHTML = options.map(i => {
|
||||
|
||||
// render empty string instead of 0 for the auto option
|
||||
return '<option value="' + (i.bitrate || '') + '">' + i.name + '</option>';
|
||||
return `<option value="${i.bitrate || ''}">${i.name}</option>`;
|
||||
}).join('');
|
||||
|
||||
select.value = appSettings.maxChromecastBitrate() || '';
|
||||
}
|
||||
|
||||
function setMaxBitrateFromField(select, isInNetwork, mediatype, value) {
|
||||
function setMaxBitrateFromField(select, isInNetwork, mediatype) {
|
||||
|
||||
if (select.value) {
|
||||
appSettings.maxStreamingBitrate(isInNetwork, mediatype, select.value);
|
||||
@ -110,7 +121,7 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
return;
|
||||
}
|
||||
|
||||
apiClient.getEndpointInfo().then(function (endpointInfo) {
|
||||
apiClient.getEndpointInfo().then(endpointInfo => {
|
||||
|
||||
if (endpointInfo.IsInNetwork) {
|
||||
|
||||
@ -133,7 +144,7 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
});
|
||||
}
|
||||
|
||||
function showOrHideEpisodesField(context, user, apiClient) {
|
||||
function showOrHideEpisodesField(context) {
|
||||
|
||||
if (browser.tizen || browser.web0s) {
|
||||
context.querySelector('.fldEpisodeAutoPlay').classList.add('hide');
|
||||
@ -145,12 +156,12 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
|
||||
function loadForm(context, user, userSettings, apiClient) {
|
||||
|
||||
var loggedInUserId = apiClient.getCurrentUserId();
|
||||
var userId = user.Id;
|
||||
const loggedInUserId = apiClient.getCurrentUserId();
|
||||
const userId = user.Id;
|
||||
|
||||
showHideQualityFields(context, user, apiClient);
|
||||
|
||||
apiClient.getCultures().then(function (allCultures) {
|
||||
apiClient.getCultures().then(allCultures => {
|
||||
|
||||
populateLanguages(context.querySelector('#selectAudioLanguage'), allCultures);
|
||||
|
||||
@ -159,7 +170,7 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
});
|
||||
|
||||
// hide cinema mode options if disabled at server level
|
||||
apiClient.getNamedConfiguration('cinemamode').then(function (cinemaConfig) {
|
||||
apiClient.getNamedConfiguration('cinemamode').then(cinemaConfig => {
|
||||
|
||||
if (cinemaConfig.EnableIntrosForMovies || cinemaConfig.EnableIntrosForEpisodes) {
|
||||
context.querySelector('.cinemaModeOptions').classList.remove('hide');
|
||||
@ -204,18 +215,18 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
|
||||
fillChromecastQuality(context.querySelector('.selectChromecastVideoQuality'));
|
||||
|
||||
var selectChromecastVersion = context.querySelector('.selectChromecastVersion');
|
||||
const selectChromecastVersion = context.querySelector('.selectChromecastVersion');
|
||||
selectChromecastVersion.value = userSettings.chromecastVersion();
|
||||
|
||||
var selectSkipForwardLength = context.querySelector('.selectSkipForwardLength');
|
||||
const selectSkipForwardLength = context.querySelector('.selectSkipForwardLength');
|
||||
fillSkipLengths(selectSkipForwardLength);
|
||||
selectSkipForwardLength.value = userSettings.skipForwardLength();
|
||||
|
||||
var selectSkipBackLength = context.querySelector('.selectSkipBackLength');
|
||||
const selectSkipBackLength = context.querySelector('.selectSkipBackLength');
|
||||
fillSkipLengths(selectSkipBackLength);
|
||||
selectSkipBackLength.value = userSettings.skipBackLength();
|
||||
|
||||
showOrHideEpisodesField(context, user, apiClient);
|
||||
showOrHideEpisodesField(context);
|
||||
|
||||
loading.hide();
|
||||
}
|
||||
@ -248,20 +259,20 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
|
||||
loading.show();
|
||||
|
||||
apiClient.getUser(userId).then(function (user) {
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
saveUser(context, user, userSettings, apiClient).then(function () {
|
||||
saveUser(context, user, userSettings, apiClient).then(() => {
|
||||
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
|
||||
events.trigger(instance, 'saved');
|
||||
|
||||
}, function () {
|
||||
}, () => {
|
||||
loading.hide();
|
||||
});
|
||||
});
|
||||
@ -269,14 +280,14 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
|
||||
function onSubmit(e) {
|
||||
|
||||
var self = this;
|
||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
var userId = self.options.userId;
|
||||
var userSettings = self.options.userSettings;
|
||||
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(function () {
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
var enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
const enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||
});
|
||||
|
||||
@ -289,9 +300,9 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
|
||||
function embed(options, self) {
|
||||
|
||||
require(['text!./playbackSettings.template.html'], function (template) {
|
||||
return import('text!./playbackSettings.template.html').then(({default: template}) => {
|
||||
|
||||
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
||||
options.element.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
||||
|
||||
@ -307,43 +318,43 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||
});
|
||||
}
|
||||
|
||||
function PlaybackSettings(options) {
|
||||
|
||||
class PlaybackSettings {
|
||||
constructor(options) {
|
||||
this.options = options;
|
||||
|
||||
embed(options, this);
|
||||
}
|
||||
|
||||
PlaybackSettings.prototype.loadData = function () {
|
||||
loadData() {
|
||||
|
||||
var self = this;
|
||||
var context = self.options.element;
|
||||
const self = this;
|
||||
const context = self.options.element;
|
||||
|
||||
loading.show();
|
||||
|
||||
var userId = self.options.userId;
|
||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
var userSettings = self.options.userSettings;
|
||||
const userId = self.options.userId;
|
||||
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
const userSettings = self.options.userSettings;
|
||||
|
||||
apiClient.getUser(userId).then(function (user) {
|
||||
apiClient.getUser(userId).then(user => {
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
||||
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||
|
||||
self.dataLoaded = true;
|
||||
|
||||
loadForm(context, user, userSettings, apiClient);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
PlaybackSettings.prototype.submit = function () {
|
||||
submit() {
|
||||
onSubmit.call(this);
|
||||
};
|
||||
}
|
||||
|
||||
PlaybackSettings.prototype.destroy = function () {
|
||||
destroy() {
|
||||
|
||||
this.options = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return PlaybackSettings;
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
export default PlaybackSettings;
|
||||
|
@ -1,9 +1,19 @@
|
||||
define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlayManager', 'playMethodHelper', 'layoutManager', 'serverNotifications', 'paper-icon-button-light', 'css!./playerstats'], function (events, globalize, playbackManager, connectionManager, syncPlayManager, playMethodHelper, layoutManager, serverNotifications) {
|
||||
'use strict';
|
||||
import events from 'events';
|
||||
import globalize from 'globalize';
|
||||
import playbackManager from 'playbackManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import syncPlayManager from 'syncPlayManager';
|
||||
import playMethodHelper from 'playMethodHelper';
|
||||
import layoutManager from 'layoutManager';
|
||||
import serverNotifications from 'serverNotifications';
|
||||
import 'paper-icon-button-light';
|
||||
import 'css!./playerstats';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function init(instance) {
|
||||
|
||||
var parent = document.createElement('div');
|
||||
const parent = document.createElement('div');
|
||||
|
||||
parent.classList.add('playerStats');
|
||||
|
||||
@ -13,7 +23,7 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
parent.classList.add('hide');
|
||||
|
||||
var button;
|
||||
let button;
|
||||
|
||||
if (layoutManager.tv) {
|
||||
button = '';
|
||||
@ -21,7 +31,7 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
button = '<button type="button" is="paper-icon-button-light" class="playerStats-closeButton"><span class="material-icons close"></span></button>';
|
||||
}
|
||||
|
||||
var contentClass = layoutManager.tv ? 'playerStats-content playerStats-content-tv' : 'playerStats-content';
|
||||
const contentClass = layoutManager.tv ? 'playerStats-content playerStats-content-tv' : 'playerStats-content';
|
||||
|
||||
parent.innerHTML = '<div class="' + contentClass + '">' + button + '<div class="playerStats-stats"></div></div>';
|
||||
|
||||
@ -44,9 +54,9 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
elem.querySelector('.playerStats-stats').innerHTML = categories.map(function (category) {
|
||||
|
||||
var categoryHtml = '';
|
||||
let categoryHtml = '';
|
||||
|
||||
var stats = category.stats;
|
||||
const stats = category.stats;
|
||||
|
||||
if (stats.length && category.name) {
|
||||
categoryHtml += '<div class="playerStats-stat playerStats-stat-header">';
|
||||
@ -62,11 +72,11 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
categoryHtml += '</div>';
|
||||
}
|
||||
|
||||
for (var i = 0, length = stats.length; i < length; i++) {
|
||||
for (let i = 0, length = stats.length; i < length; i++) {
|
||||
|
||||
categoryHtml += '<div class="playerStats-stat">';
|
||||
|
||||
var stat = stats[i];
|
||||
const stat = stats[i];
|
||||
|
||||
categoryHtml += '<div class="playerStats-stat-label">';
|
||||
categoryHtml += stat.label;
|
||||
@ -86,13 +96,13 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
function getSession(instance, player) {
|
||||
|
||||
var now = new Date().getTime();
|
||||
const now = new Date().getTime();
|
||||
|
||||
if ((now - (instance.lastSessionTime || 0)) < 10000) {
|
||||
return Promise.resolve(instance.lastSession);
|
||||
}
|
||||
|
||||
var apiClient = connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
|
||||
const apiClient = connectionManager.getApiClient(playbackManager.currentItem(player).ServerId);
|
||||
|
||||
return apiClient.getSessions({
|
||||
deviceId: apiClient.deviceId()
|
||||
@ -114,12 +124,12 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
}
|
||||
|
||||
function getTranscodingStats(session, player, displayPlayMethod) {
|
||||
var sessionStats = [];
|
||||
const sessionStats = [];
|
||||
|
||||
var videoCodec;
|
||||
var audioCodec;
|
||||
var totalBitrate;
|
||||
var audioChannels;
|
||||
let videoCodec;
|
||||
let audioCodec;
|
||||
let totalBitrate;
|
||||
let audioChannels;
|
||||
|
||||
if (session.TranscodingInfo) {
|
||||
|
||||
@ -208,11 +218,11 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
function getMediaSourceStats(session, player, displayPlayMethod) {
|
||||
|
||||
var sessionStats = [];
|
||||
const sessionStats = [];
|
||||
|
||||
var mediaSource = playbackManager.currentMediaSource(player) || {};
|
||||
var totalBitrate = mediaSource.Bitrate;
|
||||
var mediaFileSize = mediaSource.Size;
|
||||
const mediaSource = playbackManager.currentMediaSource(player) || {};
|
||||
const totalBitrate = mediaSource.Bitrate;
|
||||
const mediaFileSize = mediaSource.Size;
|
||||
|
||||
if (mediaSource.Container) {
|
||||
sessionStats.push({
|
||||
@ -236,26 +246,26 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
});
|
||||
}
|
||||
|
||||
var mediaStreams = mediaSource.MediaStreams || [];
|
||||
var videoStream = mediaStreams.filter(function (s) {
|
||||
const mediaStreams = mediaSource.MediaStreams || [];
|
||||
const videoStream = mediaStreams.filter(function (s) {
|
||||
|
||||
return s.Type === 'Video';
|
||||
|
||||
})[0] || {};
|
||||
|
||||
var videoCodec = videoStream.Codec;
|
||||
const videoCodec = videoStream.Codec;
|
||||
|
||||
var audioStreamIndex = playbackManager.getAudioStreamIndex(player);
|
||||
var audioStream = playbackManager.audioTracks(player).filter(function (s) {
|
||||
const audioStreamIndex = playbackManager.getAudioStreamIndex(player);
|
||||
const audioStream = playbackManager.audioTracks(player).filter(function (s) {
|
||||
|
||||
return s.Type === 'Audio' && s.Index === audioStreamIndex;
|
||||
|
||||
})[0] || {};
|
||||
|
||||
var audioCodec = audioStream.Codec;
|
||||
var audioChannels = audioStream.Channels;
|
||||
const audioCodec = audioStream.Codec;
|
||||
const audioChannels = audioStream.Channels;
|
||||
|
||||
var videoInfos = [];
|
||||
const videoInfos = [];
|
||||
|
||||
if (videoCodec) {
|
||||
videoInfos.push(videoCodec.toUpperCase());
|
||||
@ -279,7 +289,7 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
});
|
||||
}
|
||||
|
||||
var audioInfos = [];
|
||||
const audioInfos = [];
|
||||
|
||||
if (audioCodec) {
|
||||
audioInfos.push(audioCodec.toUpperCase());
|
||||
@ -328,8 +338,8 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
}
|
||||
|
||||
function getSyncPlayStats() {
|
||||
var syncStats = [];
|
||||
var stats = syncPlayManager.getStats();
|
||||
const syncStats = [];
|
||||
const stats = syncPlayManager.getStats();
|
||||
|
||||
syncStats.push({
|
||||
label: globalize.translate('LabelSyncPlayTimeOffset'),
|
||||
@ -351,18 +361,18 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
function getStats(instance, player) {
|
||||
|
||||
var statsPromise = player.getStats ? player.getStats() : Promise.resolve({});
|
||||
var sessionPromise = getSession(instance, player);
|
||||
const statsPromise = player.getStats ? player.getStats() : Promise.resolve({});
|
||||
const sessionPromise = getSession(instance, player);
|
||||
|
||||
return Promise.all([statsPromise, sessionPromise]).then(function (responses) {
|
||||
|
||||
var playerStatsResult = responses[0];
|
||||
var playerStats = playerStatsResult.categories || [];
|
||||
var session = responses[1];
|
||||
const playerStatsResult = responses[0];
|
||||
const playerStats = playerStatsResult.categories || [];
|
||||
const session = responses[1];
|
||||
|
||||
var displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
|
||||
const displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
|
||||
|
||||
var baseCategory = {
|
||||
const baseCategory = {
|
||||
stats: [],
|
||||
name: 'Playback Info'
|
||||
};
|
||||
@ -377,13 +387,13 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
value: player.name
|
||||
});
|
||||
|
||||
var categories = [];
|
||||
const categories = [];
|
||||
|
||||
categories.push(baseCategory);
|
||||
|
||||
for (var i = 0, length = playerStats.length; i < length; i++) {
|
||||
for (let i = 0, length = playerStats.length; i < length; i++) {
|
||||
|
||||
var category = playerStats[i];
|
||||
const category = playerStats[i];
|
||||
if (category.type === 'audio') {
|
||||
category.name = 'Audio Info';
|
||||
} else if (category.type === 'video') {
|
||||
@ -419,7 +429,7 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
function renderPlayerStats(instance, player) {
|
||||
|
||||
var now = new Date().getTime();
|
||||
const now = new Date().getTime();
|
||||
|
||||
if ((now - (instance.lastRender || 0)) < 700) {
|
||||
return;
|
||||
@ -429,7 +439,7 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
getStats(instance, player).then(function (stats) {
|
||||
|
||||
var elem = instance.element;
|
||||
const elem = instance.element;
|
||||
if (!elem) {
|
||||
return;
|
||||
}
|
||||
@ -440,7 +450,7 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
function bindEvents(instance, player) {
|
||||
|
||||
var localOnTimeUpdate = function () {
|
||||
const localOnTimeUpdate = function () {
|
||||
renderPlayerStats(instance, player);
|
||||
};
|
||||
|
||||
@ -450,14 +460,15 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
|
||||
function unbindEvents(instance, player) {
|
||||
|
||||
var localOnTimeUpdate = instance.onTimeUpdate;
|
||||
const localOnTimeUpdate = instance.onTimeUpdate;
|
||||
|
||||
if (localOnTimeUpdate) {
|
||||
events.off(player, 'timeupdate', localOnTimeUpdate);
|
||||
}
|
||||
}
|
||||
|
||||
function PlayerStats(options) {
|
||||
class PlayerStats {
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
|
||||
@ -466,13 +477,13 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
this.enabled(true);
|
||||
}
|
||||
|
||||
PlayerStats.prototype.enabled = function (enabled) {
|
||||
enabled(enabled) {
|
||||
|
||||
if (enabled == null) {
|
||||
return this._enabled;
|
||||
}
|
||||
|
||||
var options = this.options;
|
||||
const options = this.options;
|
||||
|
||||
if (!options) {
|
||||
return;
|
||||
@ -486,15 +497,15 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
this.element.classList.add('hide');
|
||||
unbindEvents(this, options.player);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
PlayerStats.prototype.toggle = function () {
|
||||
toggle() {
|
||||
this.enabled(!this.enabled());
|
||||
};
|
||||
}
|
||||
|
||||
PlayerStats.prototype.destroy = function () {
|
||||
destroy() {
|
||||
|
||||
var options = this.options;
|
||||
const options = this.options;
|
||||
|
||||
if (options) {
|
||||
|
||||
@ -502,12 +513,14 @@ define(['events', 'globalize', 'playbackManager', 'connectionManager', 'syncPlay
|
||||
unbindEvents(this, options.player);
|
||||
}
|
||||
|
||||
var elem = this.element;
|
||||
const elem = this.element;
|
||||
if (elem) {
|
||||
elem.parentNode.removeChild(elem);
|
||||
this.element = null;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return PlayerStats;
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
|
||||
export default PlayerStats;
|
||||
|
@ -1,13 +1,28 @@
|
||||
define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackManager', 'connectionManager', 'userSettings', 'appRouter', 'globalize', 'emby-input', 'paper-icon-button-light', 'emby-select', 'material-icons', 'css!./../formdialog', 'emby-button'], function (dom, shell, dialogHelper, loading, layoutManager, playbackManager, connectionManager, userSettings, appRouter, globalize) {
|
||||
'use strict';
|
||||
import dom from 'dom';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import loading from 'loading';
|
||||
import layoutManager from 'layoutManager';
|
||||
import playbackManager from 'playbackManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import * as userSettings from 'userSettings';
|
||||
import appRouter from 'appRouter';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-input';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-select';
|
||||
import 'material-icons';
|
||||
import 'css!./../formdialog';
|
||||
import 'emby-button';
|
||||
|
||||
var currentServerId;
|
||||
/* eslint-disable indent */
|
||||
|
||||
let currentServerId;
|
||||
|
||||
function onSubmit(e) {
|
||||
var panel = dom.parentWithClass(this, 'dialog');
|
||||
const panel = dom.parentWithClass(this, 'dialog');
|
||||
|
||||
var playlistId = panel.querySelector('#selectPlaylistToAddTo').value;
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
const playlistId = panel.querySelector('#selectPlaylistToAddTo').value;
|
||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
||||
|
||||
if (playlistId) {
|
||||
userSettings.set('playlisteditor-lastplaylistid', playlistId);
|
||||
@ -23,7 +38,7 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
function createPlaylist(apiClient, dlg) {
|
||||
loading.show();
|
||||
|
||||
var url = apiClient.getUrl('Playlists', {
|
||||
const url = apiClient.getUrl('Playlists', {
|
||||
Name: dlg.querySelector('#txtNewPlaylistName').value,
|
||||
Ids: dlg.querySelector('.fldSelectedItemIds').value || '',
|
||||
userId: apiClient.getCurrentUserId()
|
||||
@ -34,10 +49,10 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
type: 'POST',
|
||||
url: url,
|
||||
dataType: 'json'
|
||||
}).then(function (result) {
|
||||
}).then(result => {
|
||||
loading.hide();
|
||||
|
||||
var id = result.Id;
|
||||
const id = result.Id;
|
||||
dlg.submitted = true;
|
||||
dialogHelper.close(dlg);
|
||||
redirectToPlaylist(apiClient, id);
|
||||
@ -49,7 +64,7 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
}
|
||||
|
||||
function addToPlaylist(apiClient, dlg, id) {
|
||||
var itemIds = dlg.querySelector('.fldSelectedItemIds').value || '';
|
||||
const itemIds = dlg.querySelector('.fldSelectedItemIds').value || '';
|
||||
|
||||
if (id === 'queue') {
|
||||
playbackManager.queue({
|
||||
@ -63,7 +78,7 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
|
||||
loading.show();
|
||||
|
||||
var url = apiClient.getUrl('Playlists/' + id + '/Items', {
|
||||
const url = apiClient.getUrl(`Playlists/${id}/Items`, {
|
||||
Ids: itemIds,
|
||||
userId: apiClient.getCurrentUserId()
|
||||
});
|
||||
@ -72,7 +87,7 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
type: 'POST',
|
||||
url: url
|
||||
|
||||
}).then(function () {
|
||||
}).then(() => {
|
||||
loading.hide();
|
||||
|
||||
dlg.submitted = true;
|
||||
@ -85,36 +100,36 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
}
|
||||
|
||||
function populatePlaylists(editorOptions, panel) {
|
||||
var select = panel.querySelector('#selectPlaylistToAddTo');
|
||||
const select = panel.querySelector('#selectPlaylistToAddTo');
|
||||
|
||||
loading.hide();
|
||||
|
||||
panel.querySelector('.newPlaylistInfo').classList.add('hide');
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
Recursive: true,
|
||||
IncludeItemTypes: 'Playlist',
|
||||
SortBy: 'SortName',
|
||||
EnableTotalRecordCount: false
|
||||
};
|
||||
|
||||
var apiClient = connectionManager.getApiClient(currentServerId);
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(function (result) {
|
||||
var html = '';
|
||||
const apiClient = connectionManager.getApiClient(currentServerId);
|
||||
apiClient.getItems(apiClient.getCurrentUserId(), options).then(result => {
|
||||
let html = '';
|
||||
|
||||
if (editorOptions.enableAddToPlayQueue !== false && playbackManager.isPlaying()) {
|
||||
html += '<option value="queue">' + globalize.translate('AddToPlayQueue') + '</option>';
|
||||
html += `<option value="queue">${globalize.translate('AddToPlayQueue')}</option>`;
|
||||
}
|
||||
|
||||
html += '<option value="">' + globalize.translate('OptionNew') + '</option>';
|
||||
html += `<option value="">${globalize.translate('OptionNew')}</option>`;
|
||||
|
||||
html += result.Items.map(function (i) {
|
||||
return '<option value="' + i.Id + '">' + i.Name + '</option>';
|
||||
html += result.Items.map(i => {
|
||||
return `<option value="${i.Id}">${i.Name}</option>`;
|
||||
});
|
||||
|
||||
select.innerHTML = html;
|
||||
|
||||
var defaultValue = editorOptions.defaultValue;
|
||||
let defaultValue = editorOptions.defaultValue;
|
||||
if (!defaultValue) {
|
||||
defaultValue = userSettings.get('playlisteditor-lastplaylistid') || '';
|
||||
}
|
||||
@ -132,29 +147,29 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
}
|
||||
|
||||
function getEditorHtml(items) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
html += '<div class="formDialogContent smoothScrollY" style="padding-top:2em;">';
|
||||
html += '<div class="dialogContentInner dialog-content-centered">';
|
||||
html += '<form style="margin:auto;">';
|
||||
|
||||
html += '<div class="fldSelectPlaylist selectContainer">';
|
||||
var autoFocus = items.length ? ' autofocus' : '';
|
||||
html += '<select is="emby-select" id="selectPlaylistToAddTo" label="' + globalize.translate('LabelPlaylist') + '"' + autoFocus + '></select>';
|
||||
let autoFocus = items.length ? ' autofocus' : '';
|
||||
html += `<select is="emby-select" id="selectPlaylistToAddTo" label="${globalize.translate('LabelPlaylist')}"${autoFocus}></select>`;
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="newPlaylistInfo">';
|
||||
|
||||
html += '<div class="inputContainer">';
|
||||
autoFocus = items.length ? '' : ' autofocus';
|
||||
html += '<input is="emby-input" type="text" id="txtNewPlaylistName" required="required" label="' + globalize.translate('LabelName') + '"' + autoFocus + ' />';
|
||||
html += `<input is="emby-input" type="text" id="txtNewPlaylistName" required="required" label="${globalize.translate('LabelName')}"${autoFocus} />`;
|
||||
html += '</div>';
|
||||
|
||||
// newPlaylistInfo
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="formDialogFooter">';
|
||||
html += '<button is="emby-button" type="submit" class="raised btnSubmit block formDialogFooterItem button-submit">' + globalize.translate('Add') + '</button>';
|
||||
html += `<button is="emby-button" type="submit" class="raised btnSubmit block formDialogFooterItem button-submit">${globalize.translate('Add')}</button>`;
|
||||
html += '</div>';
|
||||
|
||||
html += '<input type="hidden" class="fldSelectedItemIds" />';
|
||||
@ -187,7 +202,7 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
} else {
|
||||
content.querySelector('.fldSelectPlaylist').classList.add('hide');
|
||||
|
||||
var selectPlaylistToAddTo = content.querySelector('#selectPlaylistToAddTo');
|
||||
const selectPlaylistToAddTo = content.querySelector('#selectPlaylistToAddTo');
|
||||
selectPlaylistToAddTo.innerHTML = '';
|
||||
selectPlaylistToAddTo.value = '';
|
||||
triggerChange(selectPlaylistToAddTo);
|
||||
@ -195,21 +210,18 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
}
|
||||
|
||||
function centerFocus(elem, horiz, on) {
|
||||
require(['scrollHelper'], function (scrollHelper) {
|
||||
var fn = on ? 'on' : 'off';
|
||||
import('scrollHelper').then(scrollHelper => {
|
||||
const fn = on ? 'on' : 'off';
|
||||
scrollHelper.centerFocus[fn](elem, horiz);
|
||||
});
|
||||
}
|
||||
|
||||
function PlaylistEditor() {
|
||||
|
||||
}
|
||||
|
||||
PlaylistEditor.prototype.show = function (options) {
|
||||
var items = options.items || {};
|
||||
export class showEditor {
|
||||
constructor(options) {
|
||||
const items = options.items || {};
|
||||
currentServerId = options.serverId;
|
||||
|
||||
var dialogOptions = {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
};
|
||||
@ -220,12 +232,12 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
dialogOptions.size = 'small';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
var html = '';
|
||||
var title = globalize.translate('HeaderAddToPlaylist');
|
||||
let html = '';
|
||||
const title = globalize.translate('HeaderAddToPlaylist');
|
||||
|
||||
html += '<div class="formDialogHeader">';
|
||||
html += '<button is="paper-icon-button-light" class="btnCancel autoSize" tabindex="-1"><span class="material-icons arrow_back"></span></button>';
|
||||
@ -241,7 +253,7 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
|
||||
initEditor(dlg, options, items);
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function () {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
@ -249,7 +261,7 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, true);
|
||||
}
|
||||
|
||||
return dialogHelper.open(dlg).then(function () {
|
||||
return dialogHelper.open(dlg).then(() => {
|
||||
if (layoutManager.tv) {
|
||||
centerFocus(dlg.querySelector('.formDialogContent'), false, false);
|
||||
}
|
||||
@ -260,7 +272,8 @@ define(['dom', 'shell', 'dialogHelper', 'loading', 'layoutManager', 'playbackMan
|
||||
|
||||
return Promise.reject();
|
||||
});
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return PlaylistEditor;
|
||||
});
|
||||
/* eslint-enable indent */
|
||||
export default showEditor;
|
||||
|
@ -1,12 +1,24 @@
|
||||
define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize', 'dom', 'require', 'material-icons', 'emby-button', 'paper-icon-button-light', 'emby-input', 'formDialogStyle'], function(browser, dialogHelper, layoutManager, scrollHelper, globalize, dom, require) {
|
||||
'use strict';
|
||||
import browser from 'browser';
|
||||
import dialogHelper from 'dialogHelper';
|
||||
import layoutManager from 'layoutManager';
|
||||
import scrollHelper from 'scrollHelper';
|
||||
import globalize from 'globalize';
|
||||
import dom from 'dom';
|
||||
import 'material-icons';
|
||||
import 'emby-button';
|
||||
import 'paper-icon-button-light';
|
||||
import 'emby-input';
|
||||
import 'formDialogStyle';
|
||||
|
||||
/* eslint-disable indent */
|
||||
export default (() => {
|
||||
|
||||
function replaceAll(str, find, replace) {
|
||||
return str.split(find).join(replace);
|
||||
}
|
||||
|
||||
function setInputProperties(dlg, options) {
|
||||
var txtInput = dlg.querySelector('#txtInput');
|
||||
const txtInput = dlg.querySelector('#txtInput');
|
||||
|
||||
if (txtInput.label) {
|
||||
txtInput.label(options.label || '');
|
||||
@ -17,7 +29,7 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
}
|
||||
|
||||
function showDialog(options, template) {
|
||||
var dialogOptions = {
|
||||
const dialogOptions = {
|
||||
removeOnClose: true,
|
||||
scrollY: false
|
||||
};
|
||||
@ -26,7 +38,7 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
dialogOptions.size = 'fullscreen';
|
||||
}
|
||||
|
||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
||||
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||
|
||||
dlg.classList.add('formDialog');
|
||||
|
||||
@ -39,7 +51,7 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
dlg.classList.add('dialog-fullscreen-lowres');
|
||||
}
|
||||
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
||||
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||
dialogHelper.close(dlg);
|
||||
});
|
||||
|
||||
@ -53,16 +65,16 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
|
||||
setInputProperties(dlg, options);
|
||||
|
||||
var submitValue;
|
||||
let submitValue;
|
||||
|
||||
dlg.querySelector('form').addEventListener('submit', function (e) {
|
||||
dlg.querySelector('form').addEventListener('submit', e => {
|
||||
|
||||
submitValue = dlg.querySelector('#txtInput').value;
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
|
||||
// Important, don't close the dialog until after the form has completed submitting, or it will cause an error in Chrome
|
||||
setTimeout(function () {
|
||||
setTimeout(() => {
|
||||
dialogHelper.close(dlg);
|
||||
}, 300);
|
||||
|
||||
@ -71,9 +83,9 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
|
||||
dlg.querySelector('.submitText').innerHTML = options.confirmText || globalize.translate('ButtonOk');
|
||||
|
||||
dlg.style.minWidth = (Math.min(400, dom.getWindowSize().innerWidth - 50)) + 'px';
|
||||
dlg.style.minWidth = `${Math.min(400, dom.getWindowSize().innerWidth - 50)}px`;
|
||||
|
||||
return dialogHelper.open(dlg).then(function () {
|
||||
return dialogHelper.open(dlg).then(() => {
|
||||
if (layoutManager.tv) {
|
||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||
}
|
||||
@ -87,7 +99,7 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
}
|
||||
|
||||
if ((browser.tv || browser.xboxOne) && window.confirm) {
|
||||
return function (options) {
|
||||
return options => {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
label: '',
|
||||
@ -95,8 +107,8 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
};
|
||||
}
|
||||
|
||||
var label = replaceAll(options.label || '', '<br/>', '\n');
|
||||
var result = prompt(label, options.text || '');
|
||||
const label = replaceAll(options.label || '', '<br/>', '\n');
|
||||
const result = prompt(label, options.text || '');
|
||||
|
||||
if (result) {
|
||||
return Promise.resolve(result);
|
||||
@ -105,9 +117,9 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
}
|
||||
};
|
||||
} else {
|
||||
return function (options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(['text!./prompt.template.html'], function (template) {
|
||||
return options => {
|
||||
return new Promise((resolve, reject) => {
|
||||
import('text!./prompt.template.html').then(({default: template}) => {
|
||||
if (typeof options === 'string') {
|
||||
options = {
|
||||
title: '',
|
||||
@ -119,4 +131,5 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||
});
|
||||
};
|
||||
}
|
||||
});
|
||||
})();
|
||||
/* eslint-enable indent */
|
||||
|
@ -156,7 +156,7 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
||||
|
||||
var html = '';
|
||||
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
|
@ -116,7 +116,7 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
||||
|
||||
var html = '';
|
||||
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
|
@ -219,7 +219,7 @@ define(['globalize', 'connectionManager', 'serverNotifications', 'require', 'loa
|
||||
require(['text!./recordingfields.template.html'], function (template) {
|
||||
var options = self.options;
|
||||
var context = options.parent;
|
||||
context.innerHTML = globalize.translateDocument(template, 'core');
|
||||
context.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
context.querySelector('.singleRecordingButton').addEventListener('click', onRecordChange.bind(self));
|
||||
context.querySelector('.seriesRecordingButton').addEventListener('click', onRecordSeriesChange.bind(self));
|
||||
|
@ -34,7 +34,7 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm({
|
||||
confirm.default({
|
||||
|
||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||
primary: 'delete',
|
||||
@ -59,7 +59,7 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm({
|
||||
confirm.default({
|
||||
|
||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||
primary: 'delete',
|
||||
|
@ -168,7 +168,7 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
||||
var dlg = options.context;
|
||||
|
||||
dlg.classList.add('hide');
|
||||
dlg.innerHTML = globalize.translateDocument(template, 'core');
|
||||
dlg.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.querySelector('.formDialogHeader').classList.add('hide');
|
||||
dlg.querySelector('.formDialogFooter').classList.add('hide');
|
||||
@ -221,7 +221,7 @@ define(['dialogHelper', 'globalize', 'layoutManager', 'mediaInfo', 'apphost', 'c
|
||||
|
||||
var html = '';
|
||||
|
||||
html += globalize.translateDocument(template, 'core');
|
||||
html += globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.innerHTML = html;
|
||||
|
||||
|
@ -215,7 +215,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
|
||||
context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = '<button is="emby-ratingbutton" type="button" class="listItemButton paper-icon-button-light" data-id="' + fullItem.Id + '" data-serverid="' + fullItem.ServerId + '" data-itemtype="' + fullItem.Type + '" data-likes="' + likes + '" data-isfavorite="' + userData.IsFavorite + '"><span class="material-icons favorite"></span></button>';
|
||||
});
|
||||
} else {
|
||||
backdrop.clear();
|
||||
backdrop.clearBackdrop();
|
||||
context.querySelector('.nowPlayingPageUserDataButtons').innerHTML = '';
|
||||
}
|
||||
}
|
||||
@ -674,7 +674,7 @@ define(['browser', 'datetime', 'backdrop', 'libraryBrowser', 'listView', 'imageL
|
||||
require(['playlistEditor'], function (playlistEditor) {
|
||||
getSaveablePlaylistItems().then(function (items) {
|
||||
var serverId = items.length ? items[0].ServerId : ApiClient.serverId();
|
||||
new playlistEditor().show({
|
||||
new playlistEditor.showEditor({
|
||||
items: items.map(function (i) {
|
||||
return i.Id;
|
||||
}),
|
||||
|
@ -1,10 +1,19 @@
|
||||
define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPicker', 'emby-input', 'flexStyles', 'material-icons', 'css!./searchfields'], function (layoutManager, globalize, require, events, browser, AlphaPicker) {
|
||||
'use strict';
|
||||
import layoutManager from 'layoutManager';
|
||||
import globalize from 'globalize';
|
||||
import events from 'events';
|
||||
import browser from 'browser';
|
||||
import AlphaPicker from 'alphaPicker';
|
||||
import 'emby-input';
|
||||
import 'flexStyles';
|
||||
import 'material-icons';
|
||||
import 'css!./searchfields';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function onSearchTimeout() {
|
||||
|
||||
var instance = this;
|
||||
var value = instance.nextSearchValue;
|
||||
const instance = this;
|
||||
let value = instance.nextSearchValue;
|
||||
|
||||
value = (value || '').trim();
|
||||
events.trigger(instance, 'search', [value]);
|
||||
@ -22,14 +31,14 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||
|
||||
function onAlphaValueClicked(e) {
|
||||
|
||||
var value = e.detail.value;
|
||||
var searchFieldsInstance = this;
|
||||
const value = e.detail.value;
|
||||
const searchFieldsInstance = this;
|
||||
|
||||
var txtSearch = searchFieldsInstance.options.element.querySelector('.searchfields-txtSearch');
|
||||
const txtSearch = searchFieldsInstance.options.element.querySelector('.searchfields-txtSearch');
|
||||
|
||||
if (value === 'backspace') {
|
||||
|
||||
var val = txtSearch.value;
|
||||
const val = txtSearch.value;
|
||||
txtSearch.value = val.length ? val.substring(0, val.length - 1) : '';
|
||||
|
||||
} else {
|
||||
@ -53,16 +62,16 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||
|
||||
function onSearchInput(e) {
|
||||
|
||||
var value = e.target.value;
|
||||
var searchFieldsInstance = this;
|
||||
const value = e.target.value;
|
||||
const searchFieldsInstance = this;
|
||||
triggerSearch(searchFieldsInstance, value);
|
||||
}
|
||||
|
||||
function embed(elem, instance, options) {
|
||||
|
||||
require(['text!./searchfields.template.html'], function (template) {
|
||||
import('text!./searchfields.template.html').then(({default: template}) => {
|
||||
|
||||
var html = globalize.translateDocument(template, 'core');
|
||||
let html = globalize.translateHtml(template, 'core');
|
||||
|
||||
if (browser.tizen || browser.orsay) {
|
||||
html = html.replace('<input ', '<input readonly ');
|
||||
@ -72,10 +81,10 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||
|
||||
elem.classList.add('searchFields');
|
||||
|
||||
var txtSearch = elem.querySelector('.searchfields-txtSearch');
|
||||
const txtSearch = elem.querySelector('.searchfields-txtSearch');
|
||||
|
||||
if (layoutManager.tv) {
|
||||
var alphaPickerElement = elem.querySelector('.alphaPicker');
|
||||
const alphaPickerElement = elem.querySelector('.alphaPicker');
|
||||
|
||||
elem.querySelector('.alphaPicker').classList.remove('hide');
|
||||
initAlphaPicker(alphaPickerElement, instance);
|
||||
@ -87,38 +96,39 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||
});
|
||||
}
|
||||
|
||||
function SearchFields(options) {
|
||||
class SearchFields {
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
embed(options.element, this, options);
|
||||
}
|
||||
|
||||
SearchFields.prototype.focus = function () {
|
||||
focus() {
|
||||
|
||||
this.options.element.querySelector('.searchfields-txtSearch').focus();
|
||||
};
|
||||
}
|
||||
destroy() {
|
||||
|
||||
SearchFields.prototype.destroy = function () {
|
||||
|
||||
var options = this.options;
|
||||
const options = this.options;
|
||||
if (options) {
|
||||
options.element.classList.remove('searchFields');
|
||||
}
|
||||
this.options = null;
|
||||
|
||||
var alphaPicker = this.alphaPicker;
|
||||
const alphaPicker = this.alphaPicker;
|
||||
if (alphaPicker) {
|
||||
alphaPicker.destroy();
|
||||
}
|
||||
this.alphaPicker = null;
|
||||
|
||||
var searchTimeout = this.searchTimeout;
|
||||
const searchTimeout = this.searchTimeout;
|
||||
if (searchTimeout) {
|
||||
clearTimeout(searchTimeout);
|
||||
}
|
||||
this.searchTimeout = null;
|
||||
this.nextSearchValue = null;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return SearchFields;
|
||||
});
|
||||
export default SearchFields;
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,9 +1,19 @@
|
||||
define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager', 'cardBuilder', 'appRouter', 'emby-scroller', 'emby-itemscontainer', 'emby-button'], function (layoutManager, globalize, require, events, connectionManager, cardBuilder, appRouter) {
|
||||
'use strict';
|
||||
import layoutManager from 'layoutManager';
|
||||
import globalize from 'globalize';
|
||||
import require from 'require';
|
||||
import events from 'events';
|
||||
import connectionManager from 'connectionManager';
|
||||
import cardBuilder from 'cardBuilder';
|
||||
import appRouter from 'appRouter';
|
||||
import 'emby-scroller';
|
||||
import 'emby-itemscontainer';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadSuggestions(instance, context, apiClient) {
|
||||
|
||||
var options = {
|
||||
const options = {
|
||||
|
||||
SortBy: 'IsFavoriteOrLiked,Random',
|
||||
IncludeItemTypes: 'Movie,Series,MusicArtist',
|
||||
@ -21,18 +31,18 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||
result.Items = [];
|
||||
}
|
||||
|
||||
var html = result.Items.map(function (i) {
|
||||
const html = result.Items.map(function (i) {
|
||||
|
||||
var href = appRouter.getRouteUrl(i);
|
||||
const href = appRouter.getRouteUrl(i);
|
||||
|
||||
var itemHtml = '<div><a is="emby-linkbutton" class="button-link" style="display:inline-block;padding:.5em 1em;" href="' + href + '">';
|
||||
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('');
|
||||
|
||||
var searchSuggestions = context.querySelector('.searchSuggestions');
|
||||
const searchSuggestions = context.querySelector('.searchSuggestions');
|
||||
searchSuggestions.querySelector('.searchSuggestionsList').innerHTML = html;
|
||||
|
||||
if (result.Items.length) {
|
||||
@ -49,9 +59,9 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||
});
|
||||
}
|
||||
|
||||
var allowSearch = true;
|
||||
let allowSearch = true;
|
||||
|
||||
var queryIncludeItemTypes = query.IncludeItemTypes;
|
||||
const queryIncludeItemTypes = query.IncludeItemTypes;
|
||||
|
||||
if (instance.options.collectionType === 'tvshows') {
|
||||
if (query.IncludeArtists) {
|
||||
@ -127,7 +137,7 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||
query.EnableTotalRecordCount = false;
|
||||
query.ImageTypeLimit = 1;
|
||||
|
||||
var methodName = 'getItems';
|
||||
let methodName = 'getItems';
|
||||
|
||||
if (!query.IncludeMedia) {
|
||||
if (query.IncludePeople) {
|
||||
@ -566,9 +576,9 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||
|
||||
section = context.querySelector(section);
|
||||
|
||||
var items = result.Items || result.SearchHints;
|
||||
const items = result.Items || result.SearchHints;
|
||||
|
||||
var itemsContainer = section.querySelector('.itemsContainer');
|
||||
const itemsContainer = section.querySelector('.itemsContainer');
|
||||
|
||||
cardBuilder.buildCards(items, Object.assign({
|
||||
|
||||
@ -588,20 +598,20 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||
}
|
||||
|
||||
function replaceAll(originalString, strReplace, strWith) {
|
||||
var reg = new RegExp(strReplace, 'ig');
|
||||
const reg = new RegExp(strReplace, 'ig');
|
||||
return originalString.replace(reg, strWith);
|
||||
}
|
||||
|
||||
function embed(elem, instance, options) {
|
||||
|
||||
require(['text!./searchresults.template.html'], function (template) {
|
||||
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');
|
||||
}
|
||||
|
||||
var html = globalize.translateDocument(template, 'core');
|
||||
const html = globalize.translateHtml(template, 'core');
|
||||
|
||||
elem.innerHTML = html;
|
||||
|
||||
@ -610,28 +620,29 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||
});
|
||||
}
|
||||
|
||||
function SearchResults(options) {
|
||||
class SearchResults {
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
embed(options.element, this, options);
|
||||
}
|
||||
search(value) {
|
||||
|
||||
SearchResults.prototype.search = function (value) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(this.options.serverId);
|
||||
const apiClient = connectionManager.getApiClient(this.options.serverId);
|
||||
|
||||
search(this, apiClient, this.options.element, value);
|
||||
};
|
||||
}
|
||||
destroy() {
|
||||
|
||||
SearchResults.prototype.destroy = function () {
|
||||
|
||||
var options = this.options;
|
||||
const options = this.options;
|
||||
if (options) {
|
||||
options.element.classList.remove('searchFields');
|
||||
}
|
||||
this.options = null;
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
return SearchResults;
|
||||
});
|
||||
export default SearchResults;
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
22
src/components/settingshelper.js
Normal file
22
src/components/settingshelper.js
Normal file
@ -0,0 +1,22 @@
|
||||
import globalize from 'globalize';
|
||||
|
||||
/**
|
||||
* Helper for handling settings.
|
||||
* @module components/settingsHelper
|
||||
*/
|
||||
|
||||
export 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>';
|
||||
}
|
||||
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
export default {
|
||||
populateLanguages: populateLanguages
|
||||
};
|
@ -1,18 +1,30 @@
|
||||
define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'globalize', 'loading', 'dom', 'recordingHelper'], function (playbackManager, inputManager, connectionManager, appRouter, globalize, loading, dom, recordingHelper) {
|
||||
'use strict';
|
||||
/* eslint-disable indent */
|
||||
|
||||
/**
|
||||
* Module shortcuts.
|
||||
* @module components/shortcuts
|
||||
*/
|
||||
|
||||
import playbackManager from 'playbackManager';
|
||||
import inputManager from 'inputManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import appRouter from 'appRouter';
|
||||
import globalize from 'globalize';
|
||||
import dom from 'dom';
|
||||
import recordingHelper from 'recordingHelper';
|
||||
|
||||
function playAllFromHere(card, serverId, queue) {
|
||||
|
||||
var parent = card.parentNode;
|
||||
var className = card.classList.length ? ('.' + card.classList[0]) : '';
|
||||
var cards = parent.querySelectorAll(className + '[data-id]');
|
||||
const parent = card.parentNode;
|
||||
const className = card.classList.length ? (`.${card.classList[0]}`) : '';
|
||||
const cards = parent.querySelectorAll(`${className}[data-id]`);
|
||||
|
||||
var ids = [];
|
||||
const ids = [];
|
||||
|
||||
var foundCard = false;
|
||||
var startIndex;
|
||||
let foundCard = false;
|
||||
let startIndex;
|
||||
|
||||
for (var i = 0, length = cards.length; i < length; i++) {
|
||||
for (let i = 0, length = cards.length; i < length; i++) {
|
||||
if (cards[i] === card) {
|
||||
foundCard = true;
|
||||
startIndex = i;
|
||||
@ -22,12 +34,12 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
}
|
||||
}
|
||||
|
||||
var itemsContainer = dom.parentWithClass(card, 'itemsContainer');
|
||||
const itemsContainer = dom.parentWithClass(card, 'itemsContainer');
|
||||
if (itemsContainer && itemsContainer.fetchData) {
|
||||
|
||||
var queryOptions = queue ? { StartIndex: startIndex } : {};
|
||||
const queryOptions = queue ? { StartIndex: startIndex } : {};
|
||||
|
||||
return itemsContainer.fetchData(queryOptions).then(function (result) {
|
||||
return itemsContainer.fetchData(queryOptions).then(result => {
|
||||
|
||||
if (queue) {
|
||||
return playbackManager.queue({
|
||||
@ -64,7 +76,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
|
||||
function showProgramDialog(item) {
|
||||
|
||||
require(['recordingCreator'], function (recordingCreator) {
|
||||
import('recordingCreator').then(({default:recordingCreator}) => {
|
||||
|
||||
recordingCreator.show(item.Id, item.ServerId);
|
||||
});
|
||||
@ -73,11 +85,11 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
function getItem(button) {
|
||||
|
||||
button = dom.parentWithAttribute(button, 'data-id');
|
||||
var serverId = button.getAttribute('data-serverid');
|
||||
var id = button.getAttribute('data-id');
|
||||
var type = button.getAttribute('data-type');
|
||||
const serverId = button.getAttribute('data-serverid');
|
||||
const id = button.getAttribute('data-id');
|
||||
const type = button.getAttribute('data-type');
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
if (type === 'Timer') {
|
||||
return apiClient.getLiveTvTimer(id);
|
||||
@ -99,19 +111,19 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
|
||||
function showContextMenu(card, options) {
|
||||
|
||||
getItem(card).then(function (item) {
|
||||
getItem(card).then(item => {
|
||||
|
||||
var playlistId = card.getAttribute('data-playlistid');
|
||||
var collectionId = card.getAttribute('data-collectionid');
|
||||
const playlistId = card.getAttribute('data-playlistid');
|
||||
const collectionId = card.getAttribute('data-collectionid');
|
||||
|
||||
if (playlistId) {
|
||||
var elem = dom.parentWithAttribute(card, 'data-playlistitemid');
|
||||
const elem = dom.parentWithAttribute(card, 'data-playlistitemid');
|
||||
item.PlaylistItemId = elem ? elem.getAttribute('data-playlistitemid') : null;
|
||||
}
|
||||
|
||||
require(['itemContextMenu'], function (itemContextMenu) {
|
||||
import('itemContextMenu').then(({default: itemContextMenu}) => {
|
||||
|
||||
connectionManager.getApiClient(item.ServerId).getCurrentUser().then(function (user) {
|
||||
connectionManager.getApiClient(item.ServerId).getCurrentUser().then(user => {
|
||||
itemContextMenu.show(Object.assign({
|
||||
item: item,
|
||||
play: true,
|
||||
@ -122,9 +134,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
collectionId: collectionId,
|
||||
user: user
|
||||
|
||||
}, options || {})).then(function (result) {
|
||||
|
||||
var itemsContainer;
|
||||
}, options || {})).then(result => {
|
||||
|
||||
if (result.command === 'playallfromhere' || result.command === 'queueallfromhere') {
|
||||
executeAction(card, options.positionTo, result.command);
|
||||
@ -157,9 +167,9 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
|
||||
function showPlayMenu(card, target) {
|
||||
|
||||
var item = getItemInfoFromCard(card);
|
||||
const item = getItemInfoFromCard(card);
|
||||
|
||||
require(['playMenu'], function (playMenu) {
|
||||
import('playMenu').then(({default: playMenu}) => {
|
||||
|
||||
playMenu.show({
|
||||
|
||||
@ -170,7 +180,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
}
|
||||
|
||||
function sendToast(text) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(text);
|
||||
});
|
||||
}
|
||||
@ -179,19 +189,19 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
|
||||
target = target || card;
|
||||
|
||||
var id = card.getAttribute('data-id');
|
||||
let id = card.getAttribute('data-id');
|
||||
|
||||
if (!id) {
|
||||
card = dom.parentWithAttribute(card, 'data-id');
|
||||
id = card.getAttribute('data-id');
|
||||
}
|
||||
|
||||
var item = getItemInfoFromCard(card);
|
||||
const item = getItemInfoFromCard(card);
|
||||
|
||||
var serverId = item.ServerId;
|
||||
var type = item.Type;
|
||||
const serverId = item.ServerId;
|
||||
const type = item.Type;
|
||||
|
||||
var playableItemId = type === 'Program' ? item.ChannelId : item.Id;
|
||||
const playableItemId = type === 'Program' ? item.ChannelId : item.Id;
|
||||
|
||||
if (item.MediaType === 'Photo' && action === 'link') {
|
||||
action = 'play';
|
||||
@ -213,7 +223,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
});
|
||||
} else if (action === 'play' || action === 'resume') {
|
||||
|
||||
var startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0');
|
||||
const startPositionTicks = parseInt(card.getAttribute('data-positionticks') || '0');
|
||||
|
||||
playbackManager.play({
|
||||
ids: [playableItemId],
|
||||
@ -244,7 +254,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
onRecordCommand(serverId, id, type, card.getAttribute('data-timerid'), card.getAttribute('data-seriestimerid'));
|
||||
} else if (action === 'menu') {
|
||||
|
||||
var options = target.getAttribute('data-playoptions') === 'false' ?
|
||||
const options = target.getAttribute('data-playoptions') === 'false' ?
|
||||
{
|
||||
shuffle: false,
|
||||
instantMix: false,
|
||||
@ -261,7 +271,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
} else if (action === 'playmenu') {
|
||||
showPlayMenu(card, target);
|
||||
} else if (action === 'edit') {
|
||||
getItem(target).then(function (item) {
|
||||
getItem(target).then(item => {
|
||||
editItem(item, serverId);
|
||||
});
|
||||
} else if (action === 'playtrailer') {
|
||||
@ -270,9 +280,9 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
getItem(target).then(addToPlaylist);
|
||||
} else if (action === 'custom') {
|
||||
|
||||
var customAction = target.getAttribute('data-customaction');
|
||||
const customAction = target.getAttribute('data-customaction');
|
||||
|
||||
card.dispatchEvent(new CustomEvent('action-' + customAction, {
|
||||
card.dispatchEvent(new CustomEvent(`action-${customAction}`, {
|
||||
detail: {
|
||||
playlistItemId: card.getAttribute('data-playlistitemid')
|
||||
},
|
||||
@ -283,7 +293,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
}
|
||||
|
||||
function addToPlaylist(item) {
|
||||
require(['playlistEditor'], function (playlistEditor) {
|
||||
import('playlistEditor').then(({default: playlistEditor}) => {
|
||||
|
||||
new playlistEditor().show({
|
||||
items: [item.Id],
|
||||
@ -295,35 +305,35 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
|
||||
function playTrailer(item) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
const apiClient = connectionManager.getApiClient(item.ServerId);
|
||||
|
||||
apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(function (trailers) {
|
||||
apiClient.getLocalTrailers(apiClient.getCurrentUserId(), item.Id).then(trailers => {
|
||||
playbackManager.play({ items: trailers });
|
||||
});
|
||||
}
|
||||
|
||||
function editItem(item, serverId) {
|
||||
|
||||
var apiClient = connectionManager.getApiClient(serverId);
|
||||
const apiClient = connectionManager.getApiClient(serverId);
|
||||
|
||||
return new Promise(function (resolve, reject) {
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
var serverId = apiClient.serverInfo().Id;
|
||||
const serverId = apiClient.serverInfo().Id;
|
||||
|
||||
if (item.Type === 'Timer') {
|
||||
if (item.ProgramId) {
|
||||
require(['recordingCreator'], function (recordingCreator) {
|
||||
import('recordingCreator').then(({default: recordingCreator}) => {
|
||||
|
||||
recordingCreator.show(item.ProgramId, serverId).then(resolve, reject);
|
||||
});
|
||||
} else {
|
||||
require(['recordingEditor'], function (recordingEditor) {
|
||||
import('recordingEditor').then(({default: recordingEditor}) => {
|
||||
|
||||
recordingEditor.show(item.Id, serverId).then(resolve, reject);
|
||||
});
|
||||
}
|
||||
} else {
|
||||
require(['metadataEditor'], function (metadataEditor) {
|
||||
import('metadataEditor').then(({default: metadataEditor}) => {
|
||||
|
||||
metadataEditor.show(item.Id, serverId).then(resolve, reject);
|
||||
});
|
||||
@ -335,19 +345,19 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
|
||||
if (type === 'Program' || timerId || seriesTimerId) {
|
||||
|
||||
var programId = type === 'Program' ? id : null;
|
||||
const programId = type === 'Program' ? id : null;
|
||||
recordingHelper.toggleRecording(serverId, programId, timerId, seriesTimerId);
|
||||
}
|
||||
}
|
||||
|
||||
function onClick(e) {
|
||||
export function onClick(e) {
|
||||
|
||||
var card = dom.parentWithClass(e.target, 'itemAction');
|
||||
const card = dom.parentWithClass(e.target, 'itemAction');
|
||||
|
||||
if (card) {
|
||||
|
||||
var actionElement = card;
|
||||
var action = actionElement.getAttribute('data-action');
|
||||
let actionElement = card;
|
||||
let action = actionElement.getAttribute('data-action');
|
||||
|
||||
if (!action) {
|
||||
actionElement = dom.parentWithAttribute(actionElement, 'data-action');
|
||||
@ -368,12 +378,12 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
|
||||
function onCommand(e) {
|
||||
|
||||
var cmd = e.detail.command;
|
||||
const cmd = e.detail.command;
|
||||
|
||||
if (cmd === 'play' || cmd === 'resume' || cmd === 'record' || cmd === 'menu' || cmd === 'info') {
|
||||
|
||||
var target = e.target;
|
||||
var card = dom.parentWithClass(target, 'itemAction') || dom.parentWithAttribute(target, 'data-id');
|
||||
const target = e.target;
|
||||
const card = dom.parentWithClass(target, 'itemAction') || dom.parentWithAttribute(target, 'data-id');
|
||||
|
||||
if (card) {
|
||||
e.preventDefault();
|
||||
@ -383,7 +393,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
}
|
||||
}
|
||||
|
||||
function on(context, options) {
|
||||
export function on(context, options) {
|
||||
|
||||
options = options || {};
|
||||
|
||||
@ -396,7 +406,7 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
}
|
||||
}
|
||||
|
||||
function off(context, options) {
|
||||
export function off(context, options) {
|
||||
options = options || {};
|
||||
|
||||
context.removeEventListener('click', onClick);
|
||||
@ -406,23 +416,24 @@ define(['playbackManager', 'inputManager', 'connectionManager', 'appRouter', 'gl
|
||||
}
|
||||
}
|
||||
|
||||
function getShortcutAttributesHtml(item, serverId) {
|
||||
export function getShortcutAttributesHtml(item, serverId) {
|
||||
|
||||
var 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 + '"';
|
||||
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}"`;
|
||||
|
||||
var collectionType = item.CollectionType;
|
||||
const collectionType = item.CollectionType;
|
||||
if (collectionType) {
|
||||
html += ' data-collectiontype="' + collectionType + '"';
|
||||
html += ` data-collectiontype="${collectionType}"`;
|
||||
}
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
return {
|
||||
/* eslint-enable indent */
|
||||
|
||||
export default {
|
||||
on: on,
|
||||
off: off,
|
||||
onClick: onClick,
|
||||
getShortcutAttributesHtml: getShortcutAttributesHtml
|
||||
};
|
||||
};
|
||||
|
||||
});
|
||||
|
@ -84,7 +84,7 @@ define(['apphost', 'userSettings', 'browser', 'events', 'backdrop', 'globalize',
|
||||
currentSound = null;
|
||||
}
|
||||
|
||||
backdrop.clear();
|
||||
backdrop.clearBackdrop();
|
||||
}
|
||||
|
||||
function onThemeLoaded() {
|
||||
|
@ -73,7 +73,7 @@ define(['require', 'dom', 'focusManager', 'dialogHelper', 'loading', 'layoutMana
|
||||
|
||||
html += template;
|
||||
|
||||
dlg.innerHTML = globalize.translateDocument(html, 'core');
|
||||
dlg.innerHTML = globalize.translateHtml(html, 'core');
|
||||
|
||||
fillSortBy(dlg, options.sortOptions);
|
||||
initEditor(dlg, options.settings);
|
||||
|
@ -69,7 +69,7 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
|
||||
confirm({
|
||||
confirm.default({
|
||||
|
||||
title: globalize.translate('ConfirmDeletion'),
|
||||
text: msg,
|
||||
@ -448,7 +448,7 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
||||
dlg.classList.add('formDialog');
|
||||
dlg.classList.add('subtitleEditorDialog');
|
||||
|
||||
dlg.innerHTML = globalize.translateDocument(template, 'core');
|
||||
dlg.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
dlg.querySelector('.originalSubtitleFileLabel').innerHTML = globalize.translate('File');
|
||||
|
||||
|
@ -1,9 +1,11 @@
|
||||
define([], function () {
|
||||
'use strict';
|
||||
/**
|
||||
* Subtitle settings visual helper.
|
||||
* @module components/subtitleSettings/subtitleAppearanceHelper
|
||||
*/
|
||||
|
||||
function getTextStyles(settings, isCue) {
|
||||
function getTextStyles(settings, isCue) {
|
||||
|
||||
var list = [];
|
||||
let list = [];
|
||||
|
||||
if (isCue) {
|
||||
switch (settings.textSize || '') {
|
||||
@ -72,12 +74,12 @@ define([], function () {
|
||||
break;
|
||||
}
|
||||
|
||||
var background = settings.textBackground || 'transparent';
|
||||
const background = settings.textBackground || 'transparent';
|
||||
if (background) {
|
||||
list.push({ name: 'background-color', value: background });
|
||||
}
|
||||
|
||||
var textColor = settings.textColor || '#ffffff';
|
||||
const textColor = settings.textColor || '#ffffff';
|
||||
if (textColor) {
|
||||
list.push({ name: 'color', value: textColor });
|
||||
}
|
||||
@ -115,34 +117,29 @@ define([], function () {
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
function getWindowStyles(settings) {
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
function getStyles(settings, isCue) {
|
||||
export function getStyles(settings, isCue) {
|
||||
|
||||
return {
|
||||
text: getTextStyles(settings, isCue),
|
||||
window: getWindowStyles(settings)
|
||||
window: []
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
function applyStyleList(styles, elem) {
|
||||
function applyStyleList(styles, elem) {
|
||||
|
||||
for (var i = 0, length = styles.length; i < length; i++) {
|
||||
for (let i = 0, length = styles.length; i < length; i++) {
|
||||
|
||||
var style = styles[i];
|
||||
let style = styles[i];
|
||||
|
||||
elem.style[style.name] = style.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function applyStyles(elements, appearanceSettings) {
|
||||
export function applyStyles(elements, appearanceSettings) {
|
||||
|
||||
var styles = getStyles(appearanceSettings);
|
||||
let styles = getStyles(appearanceSettings);
|
||||
|
||||
if (elements.text) {
|
||||
applyStyleList(styles.text, elements.text);
|
||||
@ -150,10 +147,8 @@ define([], function () {
|
||||
if (elements.window) {
|
||||
applyStyleList(styles.window, elements.window);
|
||||
}
|
||||
}
|
||||
|
||||
return {
|
||||
}
|
||||
export default {
|
||||
getStyles: getStyles,
|
||||
applyStyles: applyStyles
|
||||
};
|
||||
});
|
||||
};
|
||||
|
@ -1,20 +1,27 @@
|
||||
define(['require', 'globalize', 'appSettings', 'apphost', 'focusManager', 'loading', 'connectionManager', 'subtitleAppearanceHelper', 'dom', 'events', 'listViewStyle', 'emby-select', 'emby-input', 'emby-checkbox', 'flexStyles'], function (require, globalize, appSettings, appHost, focusManager, loading, connectionManager, subtitleAppearanceHelper, dom, events) {
|
||||
'use strict';
|
||||
import require from 'require';
|
||||
import globalize from 'globalize';
|
||||
import appHost from 'apphost';
|
||||
import appSettings from 'appSettings';
|
||||
import focusManager from 'focusManager';
|
||||
import loading from 'loading';
|
||||
import connectionManager from 'connectionManager';
|
||||
import subtitleAppearanceHelper from 'subtitleAppearanceHelper';
|
||||
import settingsHelper from 'settingsHelper';
|
||||
import dom from 'dom';
|
||||
import events from 'events';
|
||||
import 'listViewStyle';
|
||||
import 'emby-select';
|
||||
import 'emby-input';
|
||||
import 'emby-checkbox';
|
||||
import 'flexStyles';
|
||||
|
||||
function populateLanguages(select, languages) {
|
||||
var html = '';
|
||||
/**
|
||||
* Subtitle settings.
|
||||
* @module components/subtitleSettings/subtitleSettings
|
||||
*/
|
||||
|
||||
html += "<option value=''>" + globalize.translate('AnyLanguage') + '</option>';
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
var culture = languages[i];
|
||||
html += "<option value='" + culture.ThreeLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
||||
}
|
||||
|
||||
select.innerHTML = html;
|
||||
}
|
||||
|
||||
function getSubtitleAppearanceObject(context) {
|
||||
var appearanceSettings = {};
|
||||
function getSubtitleAppearanceObject(context) {
|
||||
let appearanceSettings = {};
|
||||
|
||||
appearanceSettings.textSize = context.querySelector('#selectTextSize').value;
|
||||
appearanceSettings.dropShadow = context.querySelector('#selectDropShadow').value;
|
||||
@ -23,9 +30,9 @@ define(['require', 'globalize', 'appSettings', 'apphost', 'focusManager', 'loadi
|
||||
appearanceSettings.textColor = context.querySelector('#inputTextColor').value;
|
||||
|
||||
return appearanceSettings;
|
||||
}
|
||||
}
|
||||
|
||||
function loadForm(context, user, userSettings, appearanceSettings, apiClient) {
|
||||
function loadForm(context, user, userSettings, appearanceSettings, apiClient) {
|
||||
|
||||
apiClient.getCultures().then(function (allCultures) {
|
||||
|
||||
@ -33,9 +40,9 @@ define(['require', 'globalize', 'appSettings', 'apphost', 'focusManager', 'loadi
|
||||
context.querySelector('.fldBurnIn').classList.remove('hide');
|
||||
}
|
||||
|
||||
var selectSubtitleLanguage = context.querySelector('#selectSubtitleLanguage');
|
||||
let selectSubtitleLanguage = context.querySelector('#selectSubtitleLanguage');
|
||||
|
||||
populateLanguages(selectSubtitleLanguage, allCultures);
|
||||
settingsHelper.populateLanguages(selectSubtitleLanguage, allCultures);
|
||||
|
||||
selectSubtitleLanguage.value = user.Configuration.SubtitleLanguagePreference || '';
|
||||
context.querySelector('#selectSubtitlePlaybackMode').value = user.Configuration.SubtitleMode || '';
|
||||
@ -56,11 +63,11 @@ define(['require', 'globalize', 'appSettings', 'apphost', 'focusManager', 'loadi
|
||||
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function saveUser(context, user, userSettingsInstance, appearanceKey, apiClient) {
|
||||
function saveUser(context, user, userSettingsInstance, appearanceKey, apiClient) {
|
||||
|
||||
var appearanceSettings = userSettingsInstance.getSubtitleAppearanceSettings(appearanceKey);
|
||||
let appearanceSettings = userSettingsInstance.getSubtitleAppearanceSettings(appearanceKey);
|
||||
appearanceSettings = Object.assign(appearanceSettings, getSubtitleAppearanceObject(context));
|
||||
|
||||
userSettingsInstance.setSubtitleAppearanceSettings(appearanceSettings, appearanceKey);
|
||||
@ -69,9 +76,9 @@ define(['require', 'globalize', 'appSettings', 'apphost', 'focusManager', 'loadi
|
||||
user.Configuration.SubtitleMode = context.querySelector('#selectSubtitlePlaybackMode').value;
|
||||
|
||||
return apiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||
}
|
||||
}
|
||||
|
||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||
|
||||
loading.show();
|
||||
|
||||
@ -83,7 +90,7 @@ define(['require', 'globalize', 'appSettings', 'apphost', 'focusManager', 'loadi
|
||||
|
||||
loading.hide();
|
||||
if (enableSaveConfirmation) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
@ -94,60 +101,41 @@ define(['require', 'globalize', 'appSettings', 'apphost', 'focusManager', 'loadi
|
||||
loading.hide();
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
var self = this;
|
||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
var userId = self.options.userId;
|
||||
var userSettings = self.options.userSettings;
|
||||
function onSubtitleModeChange(e) {
|
||||
|
||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
||||
var enableSaveConfirmation = self.options.enableSaveConfirmation;
|
||||
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||
});
|
||||
let view = dom.parentWithClass(e.target, 'subtitlesettings');
|
||||
|
||||
// Disable default form submission
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function onSubtitleModeChange(e) {
|
||||
|
||||
var view = dom.parentWithClass(e.target, 'subtitlesettings');
|
||||
|
||||
var subtitlesHelp = view.querySelectorAll('.subtitlesHelp');
|
||||
for (var i = 0, length = subtitlesHelp.length; i < length; i++) {
|
||||
let subtitlesHelp = view.querySelectorAll('.subtitlesHelp');
|
||||
for (let i = 0, length = subtitlesHelp.length; i < length; i++) {
|
||||
subtitlesHelp[i].classList.add('hide');
|
||||
}
|
||||
view.querySelector('.subtitles' + this.value + 'Help').classList.remove('hide');
|
||||
}
|
||||
}
|
||||
|
||||
function onAppearanceFieldChange(e) {
|
||||
function onAppearanceFieldChange(e) {
|
||||
|
||||
var view = dom.parentWithClass(e.target, 'subtitlesettings');
|
||||
let view = dom.parentWithClass(e.target, 'subtitlesettings');
|
||||
|
||||
var appearanceSettings = getSubtitleAppearanceObject(view);
|
||||
let appearanceSettings = getSubtitleAppearanceObject(view);
|
||||
|
||||
var elements = {
|
||||
let elements = {
|
||||
window: view.querySelector('.subtitleappearance-preview-window'),
|
||||
text: view.querySelector('.subtitleappearance-preview-text')
|
||||
};
|
||||
|
||||
subtitleAppearanceHelper.applyStyles(elements, appearanceSettings);
|
||||
}
|
||||
}
|
||||
|
||||
function embed(options, self) {
|
||||
function embed(options, self) {
|
||||
|
||||
require(['text!./subtitlesettings.template.html'], function (template) {
|
||||
import('text!./subtitlesettings.template.html').then(({default: template}) => {
|
||||
|
||||
options.element.classList.add('subtitlesettings');
|
||||
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
||||
options.element.innerHTML = globalize.translateHtml(template, 'core');
|
||||
|
||||
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
||||
options.element.querySelector('form').addEventListener('submit', self.onSubmit.bind(self));
|
||||
|
||||
options.element.querySelector('#selectSubtitlePlaybackMode').addEventListener('change', onSubtitleModeChange);
|
||||
options.element.querySelector('#selectTextSize').addEventListener('change', onAppearanceFieldChange);
|
||||
@ -170,44 +158,64 @@ define(['require', 'globalize', 'appSettings', 'apphost', 'focusManager', 'loadi
|
||||
focusManager.autoFocus(options.element);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function SubtitleSettings(options) {
|
||||
export class SubtitleSettings {
|
||||
|
||||
constructor(options) {
|
||||
|
||||
this.options = options;
|
||||
|
||||
embed(options, this);
|
||||
}
|
||||
|
||||
SubtitleSettings.prototype.loadData = function () {
|
||||
|
||||
var self = this;
|
||||
var context = self.options.element;
|
||||
loadData() {
|
||||
let self = this;
|
||||
let context = self.options.element;
|
||||
|
||||
loading.show();
|
||||
|
||||
var userId = self.options.userId;
|
||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
var userSettings = self.options.userSettings;
|
||||
let userId = self.options.userId;
|
||||
let apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
let userSettings = self.options.userSettings;
|
||||
|
||||
apiClient.getUser(userId).then(function (user) {
|
||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
||||
self.dataLoaded = true;
|
||||
|
||||
var appearanceSettings = userSettings.getSubtitleAppearanceSettings(self.options.appearanceKey);
|
||||
let appearanceSettings = userSettings.getSubtitleAppearanceSettings(self.options.appearanceKey);
|
||||
|
||||
loadForm(context, user, userSettings, appearanceSettings, apiClient);
|
||||
});
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
SubtitleSettings.prototype.submit = function () {
|
||||
onSubmit.call(this);
|
||||
};
|
||||
submit() {
|
||||
this.onSubmit(null);
|
||||
}
|
||||
|
||||
SubtitleSettings.prototype.destroy = function () {
|
||||
destroy() {
|
||||
this.options = null;
|
||||
};
|
||||
}
|
||||
|
||||
return SubtitleSettings;
|
||||
});
|
||||
onSubmit(e) {
|
||||
const self = this;
|
||||
let apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||
let userId = self.options.userId;
|
||||
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);
|
||||
});
|
||||
|
||||
// Disable default form submission
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
export default SubtitleSettings;
|
||||
|
@ -51,7 +51,7 @@ define(['playbackManager', 'userSettings', 'alphaPicker', 'alphaNumericShortcuts
|
||||
|
||||
instance.itemsContainer = view.querySelector('.itemsContainer');
|
||||
|
||||
instance.alphaPicker = new AlphaPicker({
|
||||
instance.alphaPicker = new AlphaPicker.default({
|
||||
element: instance.alphaPickerElement,
|
||||
itemsContainer: instance.itemsContainer,
|
||||
itemClass: 'card'
|
||||
@ -331,7 +331,7 @@ define(['playbackManager', 'userSettings', 'alphaPicker', 'alphaNumericShortcuts
|
||||
}
|
||||
|
||||
if (this.enableAlphaNumericShortcuts !== false) {
|
||||
this.alphaNumericShortcuts = new AlphaNumericShortcuts({
|
||||
this.alphaNumericShortcuts = new AlphaNumericShortcuts.default({
|
||||
itemsContainer: this.itemsContainer
|
||||
});
|
||||
}
|
||||
@ -561,7 +561,7 @@ define(['playbackManager', 'userSettings', 'alphaPicker', 'alphaNumericShortcuts
|
||||
|
||||
var alphaNumericShortcuts = this.alphaNumericShortcuts;
|
||||
if (alphaNumericShortcuts) {
|
||||
alphaNumericShortcuts.destroy();
|
||||
alphaNumericShortcuts.default.destroy();
|
||||
this.alphaNumericShortcuts = null;
|
||||
}
|
||||
};
|
||||
|
@ -95,7 +95,7 @@ define(['backdrop', 'mainTabsManager', 'layoutManager', 'emby-tabs'], function (
|
||||
TabbedView.prototype.onResume = function (options) {
|
||||
|
||||
this.setTitle();
|
||||
backdrop.clear();
|
||||
backdrop.clearBackdrop();
|
||||
|
||||
var currentTabController = this.currentTabController;
|
||||
|
||||
|
@ -139,7 +139,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-input', 'listVi
|
||||
var page = $(e.target).parents('.xmltvForm')[0];
|
||||
|
||||
require(['directorybrowser'], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
var picker = new directoryBrowser.default();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
callback: function (path) {
|
||||
|
@ -84,7 +84,7 @@ define(['require', 'dialogHelper', 'loading', 'apphost', 'layoutManager', 'conne
|
||||
|
||||
html += template;
|
||||
|
||||
dlg.innerHTML = globalize.translateDocument(html, 'core');
|
||||
dlg.innerHTML = globalize.translateHtml(html, 'core');
|
||||
|
||||
var settingElements = dlg.querySelectorAll('.viewSetting');
|
||||
for (var i = 0, length = settingElements.length; i < length; i++) {
|
||||
|
@ -1,14 +1,20 @@
|
||||
define(['appSettings', 'loading', 'browser', 'globalize', 'emby-button'], function(appSettings, loading, browser, globalize) {
|
||||
'use strict';
|
||||
import appSettings from 'appSettings';
|
||||
import loading from 'loading';
|
||||
import browser from 'browser';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function handleConnectionResult(page, result) {
|
||||
loading.hide();
|
||||
switch (result.State) {
|
||||
case 'SignedIn':
|
||||
var apiClient = result.ApiClient;
|
||||
case 'SignedIn': {
|
||||
const apiClient = result.ApiClient;
|
||||
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||
Dashboard.navigate('home.html');
|
||||
break;
|
||||
}
|
||||
case 'ServerSignIn':
|
||||
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id, false, 'none');
|
||||
break;
|
||||
@ -30,7 +36,7 @@ define(['appSettings', 'loading', 'browser', 'globalize', 'emby-button'], functi
|
||||
|
||||
function submitServer(page) {
|
||||
loading.show();
|
||||
var host = page.querySelector('#txtServerHost').value;
|
||||
const host = page.querySelector('#txtServerHost').value;
|
||||
ConnectionManager.connectToAddress(host, {
|
||||
enableAutoLogin: appSettings.enableAutoLogin()
|
||||
}).then(function(result) {
|
||||
@ -42,11 +48,11 @@ define(['appSettings', 'loading', 'browser', 'globalize', 'emby-button'], functi
|
||||
});
|
||||
}
|
||||
|
||||
return function(view, params) {
|
||||
export default function(view, params) {
|
||||
view.querySelector('.addServerForm').addEventListener('submit', onServerSubmit);
|
||||
view.querySelector('.btnCancel').addEventListener('click', goBack);
|
||||
|
||||
require(['autoFocuser'], function (autoFocuser) {
|
||||
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||
autoFocuser.autoFocus(view);
|
||||
});
|
||||
|
||||
@ -57,9 +63,10 @@ define(['appSettings', 'loading', 'browser', 'globalize', 'emby-button'], functi
|
||||
}
|
||||
|
||||
function goBack() {
|
||||
require(['appRouter'], function(appRouter) {
|
||||
import('appRouter').then(({default: appRouter}) => {
|
||||
appRouter.back();
|
||||
});
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,6 @@
|
||||
define(['globalize'], function (globalize) {
|
||||
'use strict';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function processForgotPasswordResult(result) {
|
||||
if ('ContactAdmin' == result.Action) {
|
||||
@ -17,7 +18,7 @@ define(['globalize'], function (globalize) {
|
||||
}
|
||||
|
||||
if ('PinCode' == result.Action) {
|
||||
var msg = globalize.translate('MessageForgotPasswordFileCreated');
|
||||
let msg = globalize.translate('MessageForgotPasswordFileCreated');
|
||||
msg += '<br/>';
|
||||
msg += '<br/>';
|
||||
msg += 'Enter PIN here to finish Password Reset<br/>';
|
||||
@ -34,7 +35,7 @@ define(['globalize'], function (globalize) {
|
||||
}
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
function onSubmit(e) {
|
||||
ApiClient.ajax({
|
||||
type: 'POST',
|
||||
@ -49,5 +50,6 @@ define(['globalize'], function (globalize) {
|
||||
}
|
||||
|
||||
view.querySelector('form').addEventListener('submit', onSubmit);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,9 +1,10 @@
|
||||
define(['globalize'], function (globalize) {
|
||||
'use strict';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function processForgotPasswordResult(result) {
|
||||
if (result.Success) {
|
||||
var msg = globalize.translate('MessagePasswordResetForUsers');
|
||||
let msg = globalize.translate('MessagePasswordResetForUsers');
|
||||
msg += '<br/>';
|
||||
msg += '<br/>';
|
||||
msg += result.UsersReset.join('<br/>');
|
||||
@ -22,7 +23,7 @@ define(['globalize'], function (globalize) {
|
||||
});
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
function onSubmit(e) {
|
||||
ApiClient.ajax({
|
||||
type: 'POST',
|
||||
@ -37,5 +38,6 @@ define(['globalize'], function (globalize) {
|
||||
}
|
||||
|
||||
view.querySelector('form').addEventListener('submit', onSubmit);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,7 +1,18 @@
|
||||
define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layoutManager', 'libraryMenu', 'browser', 'globalize', 'cardStyle', 'emby-checkbox'], function (appHost, appSettings, dom, connectionManager, loading, layoutManager, libraryMenu, browser, globalize) {
|
||||
'use strict';
|
||||
import appHost from 'apphost';
|
||||
import appSettings from 'appSettings';
|
||||
import dom from 'dom';
|
||||
import connectionManager from 'connectionManager';
|
||||
import loading from 'loading';
|
||||
import layoutManager from 'layoutManager';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import browser from 'browser';
|
||||
import globalize from 'globalize';
|
||||
import 'cardStyle';
|
||||
import 'emby-checkbox';
|
||||
|
||||
var enableFocusTransform = !browser.slow && !browser.edge;
|
||||
/* eslint-disable indent */
|
||||
|
||||
const enableFocusTransform = !browser.slow && !browser.edge;
|
||||
|
||||
function authenticateUserByName(page, apiClient, username, password) {
|
||||
loading.show();
|
||||
@ -18,7 +29,7 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
|
||||
const UnauthorizedOrForbidden = [401, 403];
|
||||
if (UnauthorizedOrForbidden.includes(response.status)) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
const messageKey = response.status === 401 ? 'MessageInvalidUser' : 'MessageUnauthorizedUser';
|
||||
toast(globalize.translate(messageKey));
|
||||
});
|
||||
@ -50,23 +61,23 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
}
|
||||
}
|
||||
|
||||
var metroColors = ['#6FBD45', '#4BB3DD', '#4164A5', '#E12026', '#800080', '#E1B222', '#008040', '#0094FF', '#FF00C7', '#FF870F', '#7F0037'];
|
||||
const metroColors = ['#6FBD45', '#4BB3DD', '#4164A5', '#E12026', '#800080', '#E1B222', '#008040', '#0094FF', '#FF00C7', '#FF870F', '#7F0037'];
|
||||
|
||||
function getRandomMetroColor() {
|
||||
var index = Math.floor(Math.random() * (metroColors.length - 1));
|
||||
const index = Math.floor(Math.random() * (metroColors.length - 1));
|
||||
return metroColors[index];
|
||||
}
|
||||
|
||||
function getMetroColor(str) {
|
||||
if (str) {
|
||||
var character = String(str.substr(0, 1).charCodeAt());
|
||||
var sum = 0;
|
||||
const character = String(str.substr(0, 1).charCodeAt());
|
||||
let sum = 0;
|
||||
|
||||
for (var i = 0; i < character.length; i++) {
|
||||
for (let i = 0; i < character.length; i++) {
|
||||
sum += parseInt(character.charAt(i));
|
||||
}
|
||||
|
||||
var index = String(sum).substr(-1);
|
||||
const index = String(sum).substr(-1);
|
||||
return metroColors[index];
|
||||
}
|
||||
|
||||
@ -74,13 +85,13 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
}
|
||||
|
||||
function loadUserList(context, apiClient, users) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
for (var i = 0; i < users.length; i++) {
|
||||
var user = users[i];
|
||||
for (let i = 0; i < users.length; i++) {
|
||||
const user = users[i];
|
||||
|
||||
// TODO move card creation code to Card component
|
||||
var cssClass = 'card squareCard scalableCard squareCard-scalable';
|
||||
let cssClass = 'card squareCard scalableCard squareCard-scalable';
|
||||
|
||||
if (layoutManager.tv) {
|
||||
cssClass += ' show-focus';
|
||||
@ -90,13 +101,13 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
}
|
||||
}
|
||||
|
||||
var cardBoxCssClass = 'cardBox cardBox-bottompadded';
|
||||
const cardBoxCssClass = 'cardBox cardBox-bottompadded';
|
||||
html += '<button type="button" class="' + cssClass + '">';
|
||||
html += '<div class="' + cardBoxCssClass + '">';
|
||||
html += '<div class="cardScalable">';
|
||||
html += '<div class="cardPadder cardPadder-square"></div>';
|
||||
html += '<div class="cardContent" data-haspw="' + user.HasPassword + '" data-username="' + user.Name + '" data-userid="' + user.Id + '">';
|
||||
var imgUrl;
|
||||
let imgUrl;
|
||||
|
||||
if (user.PrimaryImageTag) {
|
||||
imgUrl = apiClient.getUserImageUrl(user.Id, {
|
||||
@ -106,7 +117,7 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
});
|
||||
html += '<div class="cardImageContainer coveredImage coveredImage-noScale" style="background-image:url(\'' + imgUrl + "');\"></div>";
|
||||
} else {
|
||||
var background = getMetroColor(user.Id);
|
||||
const background = getMetroColor(user.Id);
|
||||
imgUrl = 'assets/img/avatar.png';
|
||||
html += '<div class="cardImageContainer coveredImage coveredImage-noScale" style="background-image:url(\'' + imgUrl + "');background-color:" + background + ';"></div>';
|
||||
}
|
||||
@ -123,9 +134,9 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
context.querySelector('#divUsers').innerHTML = html;
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
function getApiClient() {
|
||||
var serverId = params.serverid;
|
||||
const serverId = params.serverid;
|
||||
|
||||
if (serverId) {
|
||||
return connectionManager.getOrCreateApiClient(serverId);
|
||||
@ -139,20 +150,20 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
view.querySelector('.manualLoginForm').classList.add('hide');
|
||||
view.querySelector('.btnManual').classList.remove('hide');
|
||||
|
||||
require(['autoFocuser'], function (autoFocuser) {
|
||||
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||
autoFocuser.autoFocus(view);
|
||||
});
|
||||
}
|
||||
|
||||
view.querySelector('#divUsers').addEventListener('click', function (e) {
|
||||
var card = dom.parentWithClass(e.target, 'card');
|
||||
var cardContent = card ? card.querySelector('.cardContent') : null;
|
||||
const card = dom.parentWithClass(e.target, 'card');
|
||||
const cardContent = card ? card.querySelector('.cardContent') : null;
|
||||
|
||||
if (cardContent) {
|
||||
var context = view;
|
||||
var id = cardContent.getAttribute('data-userid');
|
||||
var name = cardContent.getAttribute('data-username');
|
||||
var haspw = cardContent.getAttribute('data-haspw');
|
||||
const context = view;
|
||||
const id = cardContent.getAttribute('data-userid');
|
||||
const name = cardContent.getAttribute('data-username');
|
||||
const haspw = cardContent.getAttribute('data-haspw');
|
||||
|
||||
if (id === 'manual') {
|
||||
context.querySelector('#txtManualName').value = '';
|
||||
@ -168,7 +179,7 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
});
|
||||
view.querySelector('.manualLoginForm').addEventListener('submit', function (e) {
|
||||
appSettings.enableAutoLogin(view.querySelector('.chkRememberLogin').checked);
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
authenticateUserByName(view, apiClient, view.querySelector('#txtManualName').value, view.querySelector('#txtManualPassword').value);
|
||||
e.preventDefault();
|
||||
return false;
|
||||
@ -192,7 +203,7 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
view.querySelector('.btnSelectServer').classList.add('hide');
|
||||
}
|
||||
|
||||
var apiClient = getApiClient();
|
||||
const apiClient = getApiClient();
|
||||
apiClient.getPublicUsers().then(function (users) {
|
||||
if (users.length) {
|
||||
showVisualForm();
|
||||
@ -211,5 +222,6 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||
view.addEventListener('viewhide', function (e) {
|
||||
libraryMenu.setTransparentMenu(false);
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,10 +1,28 @@
|
||||
define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', 'apphost', 'focusManager', 'connectionManager', 'globalize', 'actionsheet', 'dom', 'browser', 'material-icons', 'flexStyles', 'emby-scroller', 'emby-itemscontainer', 'cardStyle', 'emby-button'], function (loading, appRouter, layoutManager, libraryMenu, appSettings, appHost, focusManager, connectionManager, globalize, actionSheet, dom, browser) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import appRouter from 'appRouter';
|
||||
import layoutManager from 'layoutManager';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import appSettings from 'appSettings';
|
||||
import appHost from 'apphost';
|
||||
import focusManager from 'focusManager';
|
||||
import connectionManager from 'connectionManager';
|
||||
import globalize from 'globalize';
|
||||
import actionSheet from 'actionsheet';
|
||||
import dom from 'dom';
|
||||
import browser from 'browser';
|
||||
import 'material-icons';
|
||||
import 'flexStyles';
|
||||
import 'emby-scroller';
|
||||
import 'emby-itemscontainer';
|
||||
import 'cardStyle';
|
||||
import 'emby-button';
|
||||
|
||||
var enableFocusTransform = !browser.slow && !browser.edge;
|
||||
/* eslint-disable indent */
|
||||
|
||||
const enableFocusTransform = !browser.slow && !browser.edge;
|
||||
|
||||
function renderSelectServerItems(view, servers) {
|
||||
var items = servers.map(function (server) {
|
||||
const items = servers.map(function (server) {
|
||||
return {
|
||||
name: server.Name,
|
||||
showIcon: true,
|
||||
@ -14,8 +32,8 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
server: server
|
||||
};
|
||||
});
|
||||
var html = items.map(function (item) {
|
||||
var cardImageContainer;
|
||||
let html = items.map(function (item) {
|
||||
let cardImageContainer;
|
||||
|
||||
if (item.showIcon) {
|
||||
cardImageContainer = '<span class="cardImageIcon material-icons ' + item.icon + '"></span>';
|
||||
@ -25,7 +43,7 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
|
||||
// TODO move card creation code to Card component
|
||||
|
||||
var cssClass = 'card overflowSquareCard loginSquareCard scalableCard overflowSquareCard-scalable';
|
||||
let cssClass = 'card overflowSquareCard loginSquareCard scalableCard overflowSquareCard-scalable';
|
||||
|
||||
if (layoutManager.tv) {
|
||||
cssClass += ' show-focus';
|
||||
@ -35,10 +53,10 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
}
|
||||
}
|
||||
|
||||
var cardBoxCssClass = 'cardBox';
|
||||
const cardBoxCssClass = 'cardBox';
|
||||
|
||||
var innerOpening = '<div class="' + cardBoxCssClass + '">';
|
||||
var cardContainer = '';
|
||||
const innerOpening = '<div class="' + cardBoxCssClass + '">';
|
||||
let cardContainer = '';
|
||||
cardContainer += '<button raised class="' + cssClass + '" style="display:inline-block;" data-id="' + item.id + '" data-url="' + (item.url || '') + '" data-cardtype="' + item.cardType + '">';
|
||||
cardContainer += innerOpening;
|
||||
cardContainer += '<div class="cardScalable">';
|
||||
@ -55,7 +73,7 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
cardContainer += '</div></div></button>';
|
||||
return cardContainer;
|
||||
}).join('');
|
||||
var itemsContainer = view.querySelector('.servers');
|
||||
const itemsContainer = view.querySelector('.servers');
|
||||
|
||||
if (!items.length) {
|
||||
html = '<p>' + globalize.translate('MessageNoServersAvailable') + '</p>';
|
||||
@ -89,7 +107,7 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
}
|
||||
|
||||
function alertTextWithOptions(options) {
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(options);
|
||||
});
|
||||
}
|
||||
@ -98,14 +116,14 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
alertText(globalize.translate('MessageUnableToConnectToServer'));
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
function connectToServer(server) {
|
||||
loading.show();
|
||||
connectionManager.connectToServer(server, {
|
||||
enableAutoLogin: appSettings.enableAutoLogin()
|
||||
}).then(function (result) {
|
||||
loading.hide();
|
||||
var apiClient = result.ApiClient;
|
||||
const apiClient = result.ApiClient;
|
||||
|
||||
switch (result.State) {
|
||||
case 'SignedIn':
|
||||
@ -140,7 +158,7 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
}
|
||||
|
||||
function onServerClick(server) {
|
||||
var menuItems = [];
|
||||
const menuItems = [];
|
||||
menuItems.push({
|
||||
name: globalize.translate('Connect'),
|
||||
id: 'connect'
|
||||
@ -178,10 +196,10 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
connectionManager.getAvailableServers().then(onServersRetrieved);
|
||||
}
|
||||
|
||||
var servers;
|
||||
let servers;
|
||||
updatePageStyle(view, params);
|
||||
view.addEventListener('viewshow', function (e) {
|
||||
var isRestored = e.detail.isRestored;
|
||||
const isRestored = e.detail.isRestored;
|
||||
appRouter.setTitle(null);
|
||||
libraryMenu.setTransparentMenu(true);
|
||||
|
||||
@ -190,20 +208,21 @@ define(['loading', 'appRouter', 'layoutManager', 'libraryMenu', 'appSettings', '
|
||||
}
|
||||
});
|
||||
view.querySelector('.servers').addEventListener('click', function (e) {
|
||||
var card = dom.parentWithClass(e.target, 'card');
|
||||
const card = dom.parentWithClass(e.target, 'card');
|
||||
|
||||
if (card) {
|
||||
var url = card.getAttribute('data-url');
|
||||
const url = card.getAttribute('data-url');
|
||||
|
||||
if (url) {
|
||||
appRouter.show(url);
|
||||
} else {
|
||||
var id = card.getAttribute('data-id');
|
||||
const id = card.getAttribute('data-id');
|
||||
onServerClick(servers.filter(function (s) {
|
||||
return s.Id === id;
|
||||
})[0]);
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,8 +1,14 @@
|
||||
define(['datetime', 'loading', 'libraryMenu', 'dom', 'globalize', 'emby-button'], function (datetime, loading, libraryMenu, dom, globalize) {
|
||||
'use strict';
|
||||
import datetime from 'datetime';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import dom from 'dom';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function revoke(page, key) {
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm(globalize.translate('MessageConfirmRevokeApiKey'), globalize.translate('HeaderConfirmRevokeApiKey')).then(function () {
|
||||
loading.show();
|
||||
ApiClient.ajax({
|
||||
@ -16,8 +22,8 @@ define(['datetime', 'loading', 'libraryMenu', 'dom', 'globalize', 'emby-button']
|
||||
}
|
||||
|
||||
function renderKeys(page, keys) {
|
||||
var rows = keys.map(function (item) {
|
||||
var html = '';
|
||||
const rows = keys.map(function (item) {
|
||||
let html = '';
|
||||
html += '<tr class="detailTableBodyRow detailTableBodyRow-shaded">';
|
||||
html += '<td class="detailTableBodyCell">';
|
||||
html += '<button type="button" is="emby-button" data-token="' + item.AccessToken + '" class="raised raised-mini btnRevoke" data-mini="true" title="' + globalize.translate('ButtonRevoke') + '" style="margin:0;">' + globalize.translate('ButtonRevoke') + '</button>';
|
||||
@ -29,7 +35,7 @@ define(['datetime', 'loading', 'libraryMenu', 'dom', 'globalize', 'emby-button']
|
||||
html += item.AppName || '';
|
||||
html += '</td>';
|
||||
html += '<td class="detailTableBodyCell" style="vertical-align:middle;">';
|
||||
var date = datetime.parseISO8601Date(item.DateCreated, true);
|
||||
const date = datetime.parseISO8601Date(item.DateCreated, true);
|
||||
html += datetime.toLocaleDateString(date) + ' ' + datetime.getDisplayTime(date);
|
||||
html += '</td>';
|
||||
return html += '</tr>';
|
||||
@ -46,7 +52,7 @@ define(['datetime', 'loading', 'libraryMenu', 'dom', 'globalize', 'emby-button']
|
||||
}
|
||||
|
||||
function showNewKeyPrompt(page) {
|
||||
require(['prompt'], function (prompt) {
|
||||
import('prompt').then(({default: prompt}) => {
|
||||
prompt({
|
||||
title: globalize.translate('HeaderNewApiKey'),
|
||||
label: globalize.translate('LabelAppName'),
|
||||
@ -65,12 +71,12 @@ define(['datetime', 'loading', 'libraryMenu', 'dom', 'globalize', 'emby-button']
|
||||
}
|
||||
|
||||
pageIdOn('pageinit', 'apiKeysPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
page.querySelector('.btnNewKey').addEventListener('click', function () {
|
||||
showNewKeyPrompt(page);
|
||||
});
|
||||
page.querySelector('.tblApiKeys').addEventListener('click', function (e) {
|
||||
var btnRevoke = dom.parentWithClass(e.target, 'btnRevoke');
|
||||
const btnRevoke = dom.parentWithClass(e.target, 'btnRevoke');
|
||||
|
||||
if (btnRevoke) {
|
||||
revoke(page, btnRevoke.getAttribute('data-token'));
|
||||
@ -80,4 +86,5 @@ define(['datetime', 'loading', 'libraryMenu', 'dom', 'globalize', 'emby-button']
|
||||
pageIdOn('pagebeforeshow', 'apiKeysPage', function () {
|
||||
loadData(this);
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,11 +1,31 @@
|
||||
define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'loading', 'connectionManager', 'playMethodHelper', 'cardBuilder', 'imageLoader', 'components/activitylog', 'scripts/imagehelper', 'indicators', 'listViewStyle', 'emby-button', 'flexStyles', 'emby-button', 'emby-itemscontainer'], function (datetime, events, itemHelper, serverNotifications, dom, globalize, datefns, dfnshelper, loading, connectionManager, playMethodHelper, cardBuilder, imageLoader, ActivityLog, imageHelper, indicators) {
|
||||
'use strict';
|
||||
import datetime from 'datetime';
|
||||
import events from 'events';
|
||||
import itemHelper from 'itemHelper';
|
||||
import serverNotifications from 'serverNotifications';
|
||||
import dom from 'dom';
|
||||
import globalize from 'globalize';
|
||||
import * as datefns from 'date-fns';
|
||||
import dfnshelper from 'dfnshelper';
|
||||
import loading from 'loading';
|
||||
import connectionManager from 'connectionManager';
|
||||
import playMethodHelper from 'playMethodHelper';
|
||||
import cardBuilder from 'cardBuilder';
|
||||
import imageLoader from 'imageLoader';
|
||||
import ActivityLog from 'components/activitylog';
|
||||
import imageHelper from 'scripts/imagehelper';
|
||||
import indicators from 'indicators';
|
||||
import 'listViewStyle';
|
||||
import 'emby-button';
|
||||
import 'flexStyles';
|
||||
import 'emby-itemscontainer';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function showPlaybackInfo(btn, session) {
|
||||
require(['alert'], function (alert) {
|
||||
var title;
|
||||
var text = [];
|
||||
var displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
|
||||
import('alert').then(({default: alert}) => {
|
||||
let title;
|
||||
let text = [];
|
||||
const displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
|
||||
|
||||
if (displayPlayMethod === 'DirectStream') {
|
||||
title = globalize.translate('DirectStreaming');
|
||||
@ -33,7 +53,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
function showSendMessageForm(btn, session) {
|
||||
require(['prompt'], function (prompt) {
|
||||
import('prompt').then(({default: prompt}) => {
|
||||
prompt({
|
||||
title: globalize.translate('HeaderSendMessage'),
|
||||
label: globalize.translate('LabelMessageText'),
|
||||
@ -50,8 +70,8 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
function showOptionsMenu(btn, session) {
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
var menuItems = [];
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
const menuItems = [];
|
||||
|
||||
if (session.ServerId && session.DeviceId !== connectionManager.deviceId()) {
|
||||
menuItems.push({
|
||||
@ -84,14 +104,14 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
function onActiveDevicesClick(evt) {
|
||||
var btn = dom.parentWithClass(evt.target, 'sessionCardButton');
|
||||
const btn = dom.parentWithClass(evt.target, 'sessionCardButton');
|
||||
|
||||
if (btn) {
|
||||
var card = dom.parentWithClass(btn, 'card');
|
||||
const card = dom.parentWithClass(btn, 'card');
|
||||
|
||||
if (card) {
|
||||
var sessionId = card.id;
|
||||
var session = (DashboardPage.sessionsList || []).filter(function (dashboardSession) {
|
||||
const sessionId = card.id;
|
||||
const session = (DashboardPage.sessionsList || []).filter(function (dashboardSession) {
|
||||
return 'session' + dashboardSession.Id === sessionId;
|
||||
})[0];
|
||||
|
||||
@ -113,11 +133,11 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
function filterSessions(sessions) {
|
||||
var list = [];
|
||||
var minActiveDate = new Date().getTime() - 9e5;
|
||||
const list = [];
|
||||
const minActiveDate = new Date().getTime() - 9e5;
|
||||
|
||||
for (var i = 0, length = sessions.length; i < length; i++) {
|
||||
var session = sessions[i];
|
||||
for (let i = 0, length = sessions.length; i < length; i++) {
|
||||
const session = sessions[i];
|
||||
|
||||
if (!session.NowPlayingItem && !session.UserId) {
|
||||
continue;
|
||||
@ -139,7 +159,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
EnableTotalRecordCount: false,
|
||||
EnableImageTypes: 'Primary,Thumb,Backdrop'
|
||||
}).then(function (result) {
|
||||
var itemsContainer = view.querySelector('.activeRecordingItems');
|
||||
const itemsContainer = view.querySelector('.activeRecordingItems');
|
||||
|
||||
if (!result.Items.length) {
|
||||
view.querySelector('.activeRecordingsSection').classList.add('hide');
|
||||
@ -199,31 +219,31 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
function renderActiveConnections(view, sessions) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
DashboardPage.sessionsList = sessions;
|
||||
var parentElement = view.querySelector('.activeDevices');
|
||||
var cardElem = parentElement.querySelector('.card');
|
||||
const parentElement = view.querySelector('.activeDevices');
|
||||
const cardElem = parentElement.querySelector('.card');
|
||||
|
||||
if (cardElem) {
|
||||
cardElem.classList.add('deadSession');
|
||||
}
|
||||
|
||||
for (var i = 0, length = sessions.length; i < length; i++) {
|
||||
var session = sessions[i];
|
||||
var rowId = 'session' + session.Id;
|
||||
var elem = view.querySelector('#' + rowId);
|
||||
for (let i = 0, length = sessions.length; i < length; i++) {
|
||||
const session = sessions[i];
|
||||
const rowId = 'session' + session.Id;
|
||||
const elem = view.querySelector('#' + rowId);
|
||||
|
||||
if (elem) {
|
||||
DashboardPage.updateSession(elem, session);
|
||||
} else {
|
||||
var nowPlayingItem = session.NowPlayingItem;
|
||||
var className = 'scalableCard card activeSession backdropCard backdropCard-scalable';
|
||||
const nowPlayingItem = session.NowPlayingItem;
|
||||
const className = 'scalableCard card activeSession backdropCard backdropCard-scalable';
|
||||
html += '<div class="' + className + '" id="' + rowId + '">';
|
||||
html += '<div class="cardBox visualCardBox">';
|
||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||
html += '<div class="cardContent">';
|
||||
var imgUrl = DashboardPage.getNowPlayingImageUrl(nowPlayingItem);
|
||||
const imgUrl = DashboardPage.getNowPlayingImageUrl(nowPlayingItem);
|
||||
|
||||
if (imgUrl) {
|
||||
html += '<div class="sessionNowPlayingContent sessionNowPlayingContent-withbackground"';
|
||||
@ -234,7 +254,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
|
||||
html += '<div class="sessionNowPlayingInnerContent">';
|
||||
html += '<div class="sessionAppInfo">';
|
||||
var clientImage = DashboardPage.getClientImage(session);
|
||||
const clientImage = DashboardPage.getClientImage(session);
|
||||
|
||||
if (clientImage) {
|
||||
html += clientImage;
|
||||
@ -247,7 +267,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="sessionNowPlayingDetails">';
|
||||
var nowPlayingName = DashboardPage.getNowPlayingName(session);
|
||||
const nowPlayingName = DashboardPage.getNowPlayingName(session);
|
||||
html += '<div class="sessionNowPlayingInfo" data-imgsrc="' + nowPlayingName.image + '">';
|
||||
html += nowPlayingName.html;
|
||||
html += '</div>';
|
||||
@ -255,7 +275,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
html += '</div>';
|
||||
|
||||
if (nowPlayingItem && nowPlayingItem.RunTimeTicks) {
|
||||
var percent = 100 * (session.PlayState.PositionTicks || 0) / nowPlayingItem.RunTimeTicks;
|
||||
const percent = 100 * (session.PlayState.PositionTicks || 0) / nowPlayingItem.RunTimeTicks;
|
||||
html += indicators.getProgressHtml(percent, {
|
||||
containerClass: 'playbackProgress'
|
||||
});
|
||||
@ -267,7 +287,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
if (session.TranscodingInfo && session.TranscodingInfo.CompletionPercentage) {
|
||||
var percent = session.TranscodingInfo.CompletionPercentage.toFixed(1);
|
||||
const percent = session.TranscodingInfo.CompletionPercentage.toFixed(1);
|
||||
html += indicators.getProgressHtml(percent, {
|
||||
containerClass: 'transcodingProgress'
|
||||
});
|
||||
@ -284,7 +304,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
html += '<div class="sessionCardFooter cardFooter">';
|
||||
html += '<div class="sessionCardButtons flex align-items-center justify-content-center">';
|
||||
|
||||
var btnCssClass = session.ServerId && session.NowPlayingItem && session.SupportsRemoteControl ? '' : ' hide';
|
||||
let btnCssClass = session.ServerId && session.NowPlayingItem && session.SupportsRemoteControl ? '' : ' hide';
|
||||
const playIcon = session.PlayState.IsPaused ? 'pause' : 'play_arrow';
|
||||
|
||||
html += '<button is="paper-icon-button-light" class="sessionCardButton btnSessionPlayPause paper-icon-button-light ' + btnCssClass + '"><span class="material-icons ' + playIcon + '"></span></button>';
|
||||
@ -302,7 +322,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
html += '</div>';
|
||||
|
||||
html += '<div class="flex align-items-center justify-content-center">';
|
||||
var userImage = DashboardPage.getUserImage(session);
|
||||
const userImage = DashboardPage.getUserImage(session);
|
||||
html += userImage ? '<div class="activitylogUserPhoto" style="background-image:url(\'' + userImage + "');\"></div>" : '<div style="height:1.71em;"></div>';
|
||||
html += '<div class="sessionUserName">';
|
||||
html += DashboardPage.getUsersHtml(session);
|
||||
@ -316,7 +336,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
parentElement.insertAdjacentHTML('beforeend', html);
|
||||
var deadSessionElem = parentElement.querySelector('.deadSession');
|
||||
const deadSessionElem = parentElement.querySelector('.deadSession');
|
||||
|
||||
if (deadSessionElem) {
|
||||
deadSessionElem.parentNode.removeChild(deadSessionElem);
|
||||
@ -324,7 +344,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
function renderRunningTasks(view, tasks) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
tasks = tasks.filter(function (task) {
|
||||
if ('Idle' != task.State) {
|
||||
return !task.IsHidden;
|
||||
@ -339,13 +359,13 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
view.querySelector('.runningTasksContainer').classList.add('hide');
|
||||
}
|
||||
|
||||
for (var i = 0, length = tasks.length; i < length; i++) {
|
||||
var task = tasks[i];
|
||||
for (let i = 0, length = tasks.length; i < length; i++) {
|
||||
const task = tasks[i];
|
||||
html += '<p>';
|
||||
html += task.Name + '<br/>';
|
||||
|
||||
if (task.State === 'Running') {
|
||||
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
|
||||
const progress = (task.CurrentProgressPercentage || 0).toFixed(1);
|
||||
html += '<progress max="100" value="' + progress + '" title="' + progress + '%">';
|
||||
html += progress + '%';
|
||||
html += '</progress>';
|
||||
@ -371,9 +391,9 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
apiClient.sendMessage('ScheduledTasksInfoStop');
|
||||
},
|
||||
getSessionNowPlayingStreamInfo: function (session) {
|
||||
var html = '';
|
||||
var showTranscodingInfo = false;
|
||||
var displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
|
||||
let html = '';
|
||||
let showTranscodingInfo = false;
|
||||
const displayPlayMethod = playMethodHelper.getDisplayPlayMethod(session);
|
||||
|
||||
if (displayPlayMethod === 'DirectStream') {
|
||||
html += globalize.translate('DirectStreaming');
|
||||
@ -390,7 +410,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
|
||||
if (showTranscodingInfo) {
|
||||
var line = [];
|
||||
const line = [];
|
||||
|
||||
if (session.TranscodingInfo) {
|
||||
if (session.TranscodingInfo.Bitrate) {
|
||||
@ -422,8 +442,8 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
return html;
|
||||
},
|
||||
getSessionNowPlayingTime: function (session) {
|
||||
var nowPlayingItem = session.NowPlayingItem;
|
||||
var html = '';
|
||||
const nowPlayingItem = session.NowPlayingItem;
|
||||
let html = '';
|
||||
|
||||
if (nowPlayingItem) {
|
||||
if (session.PlayState.PositionTicks) {
|
||||
@ -447,8 +467,8 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
return session.Client + ' ' + session.ApplicationVersion;
|
||||
},
|
||||
getNowPlayingName: function (session) {
|
||||
var imgUrl = '';
|
||||
var nowPlayingItem = session.NowPlayingItem;
|
||||
let imgUrl = '';
|
||||
const nowPlayingItem = session.NowPlayingItem;
|
||||
// FIXME: It seems that, sometimes, server sends date in the future, so date-fns displays messages like 'in less than a minute'. We should fix
|
||||
// how dates are returned by the server when the session is active and show something like 'Active now', instead of past/future sentences
|
||||
if (!nowPlayingItem) {
|
||||
@ -458,8 +478,8 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
};
|
||||
}
|
||||
|
||||
var topText = itemHelper.getDisplayName(nowPlayingItem);
|
||||
var bottomText = '';
|
||||
let topText = itemHelper.getDisplayName(nowPlayingItem);
|
||||
let bottomText = '';
|
||||
|
||||
if (nowPlayingItem.Artists && nowPlayingItem.Artists.length) {
|
||||
bottomText = topText;
|
||||
@ -499,13 +519,13 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
};
|
||||
},
|
||||
getUsersHtml: function (session) {
|
||||
var html = [];
|
||||
const html = [];
|
||||
|
||||
if (session.UserId) {
|
||||
html.push(session.UserName);
|
||||
}
|
||||
|
||||
for (var i = 0, length = session.AdditionalUsers.length; i < length; i++) {
|
||||
for (let i = 0, length = session.AdditionalUsers.length; i < length; i++) {
|
||||
html.push(session.AdditionalUsers[i].UserName);
|
||||
}
|
||||
|
||||
@ -523,7 +543,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
},
|
||||
updateSession: function (row, session) {
|
||||
row.classList.remove('deadSession');
|
||||
var nowPlayingItem = session.NowPlayingItem;
|
||||
const nowPlayingItem = session.NowPlayingItem;
|
||||
|
||||
if (nowPlayingItem) {
|
||||
row.classList.add('playingSession');
|
||||
@ -543,7 +563,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
row.querySelector('.btnSessionInfo').classList.add('hide');
|
||||
}
|
||||
|
||||
var btnSessionPlayPause = row.querySelector('.btnSessionPlayPause');
|
||||
const btnSessionPlayPause = row.querySelector('.btnSessionPlayPause');
|
||||
|
||||
if (session.ServerId && nowPlayingItem && session.SupportsRemoteControl && session.DeviceId !== connectionManager.deviceId()) {
|
||||
btnSessionPlayPause.classList.remove('hide');
|
||||
@ -561,18 +581,18 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
row.querySelector('.sessionNowPlayingTime').innerHTML = DashboardPage.getSessionNowPlayingTime(session);
|
||||
row.querySelector('.sessionUserName').innerHTML = DashboardPage.getUsersHtml(session);
|
||||
row.querySelector('.sessionAppSecondaryText').innerHTML = DashboardPage.getAppSecondaryText(session);
|
||||
var nowPlayingName = DashboardPage.getNowPlayingName(session);
|
||||
var nowPlayingInfoElem = row.querySelector('.sessionNowPlayingInfo');
|
||||
const nowPlayingName = DashboardPage.getNowPlayingName(session);
|
||||
const nowPlayingInfoElem = row.querySelector('.sessionNowPlayingInfo');
|
||||
|
||||
if (!(nowPlayingName.image && nowPlayingName.image == nowPlayingInfoElem.getAttribute('data-imgsrc'))) {
|
||||
nowPlayingInfoElem.innerHTML = nowPlayingName.html;
|
||||
nowPlayingInfoElem.setAttribute('data-imgsrc', nowPlayingName.image || '');
|
||||
}
|
||||
|
||||
var playbackProgressElem = row.querySelector('.playbackProgress');
|
||||
const playbackProgressElem = row.querySelector('.playbackProgress');
|
||||
|
||||
if (nowPlayingItem && nowPlayingItem.RunTimeTicks) {
|
||||
var percent = 100 * (session.PlayState.PositionTicks || 0) / nowPlayingItem.RunTimeTicks;
|
||||
const percent = 100 * (session.PlayState.PositionTicks || 0) / nowPlayingItem.RunTimeTicks;
|
||||
playbackProgressElem.outerHTML = indicators.getProgressHtml(percent, {
|
||||
containerClass: 'playbackProgress'
|
||||
});
|
||||
@ -582,10 +602,10 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
});
|
||||
}
|
||||
|
||||
var transcodingProgress = row.querySelector('.transcodingProgress');
|
||||
const transcodingProgress = row.querySelector('.transcodingProgress');
|
||||
|
||||
if (session.TranscodingInfo && session.TranscodingInfo.CompletionPercentage) {
|
||||
var percent = session.TranscodingInfo.CompletionPercentage.toFixed(1);
|
||||
const percent = session.TranscodingInfo.CompletionPercentage.toFixed(1);
|
||||
transcodingProgress.outerHTML = indicators.getProgressHtml(percent, {
|
||||
containerClass: 'transcodingProgress'
|
||||
});
|
||||
@ -595,8 +615,8 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
});
|
||||
}
|
||||
|
||||
var imgUrl = DashboardPage.getNowPlayingImageUrl(nowPlayingItem) || '';
|
||||
var imgElem = row.querySelector('.sessionNowPlayingContent');
|
||||
const imgUrl = DashboardPage.getNowPlayingImageUrl(nowPlayingItem) || '';
|
||||
const imgElem = row.querySelector('.sessionNowPlayingContent');
|
||||
|
||||
if (imgUrl != imgElem.getAttribute('data-src')) {
|
||||
imgElem.style.backgroundImage = imgUrl ? "url('" + imgUrl + "')" : '';
|
||||
@ -610,7 +630,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
},
|
||||
getClientImage: function (connection) {
|
||||
var iconUrl = imageHelper.getDeviceIcon(connection);
|
||||
const iconUrl = imageHelper.getDeviceIcon(connection);
|
||||
return "<img src='" + iconUrl + "' />";
|
||||
},
|
||||
getNowPlayingImageUrl: function (item) {
|
||||
@ -640,7 +660,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
});
|
||||
}
|
||||
|
||||
var imageTags = (item || {}).ImageTags || {};
|
||||
const imageTags = (item || {}).ImageTags || {};
|
||||
|
||||
if (item && imageTags.Thumb) {
|
||||
return ApiClient.getScaledImageUrl(item.Id, {
|
||||
@ -694,20 +714,20 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
},
|
||||
systemUpdateTaskKey: 'SystemUpdateTask',
|
||||
stopTask: function (btn, id) {
|
||||
var page = dom.parentWithClass(btn, 'page');
|
||||
const page = dom.parentWithClass(btn, 'page');
|
||||
ApiClient.stopScheduledTask(id).then(function () {
|
||||
pollForInfo(page, ApiClient);
|
||||
});
|
||||
},
|
||||
restart: function (btn) {
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
title: globalize.translate('HeaderRestart'),
|
||||
text: globalize.translate('MessageConfirmRestart'),
|
||||
confirmText: globalize.translate('ButtonRestart'),
|
||||
primary: 'delete'
|
||||
}).then(function () {
|
||||
var page = dom.parentWithClass(btn, 'page');
|
||||
const page = dom.parentWithClass(btn, 'page');
|
||||
page.querySelector('#btnRestartServer').disabled = true;
|
||||
page.querySelector('#btnShutdown').disabled = true;
|
||||
ApiClient.restartServer();
|
||||
@ -715,14 +735,14 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
});
|
||||
},
|
||||
shutdown: function (btn) {
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
title: globalize.translate('HeaderShutdown'),
|
||||
text: globalize.translate('MessageConfirmShutdown'),
|
||||
confirmText: globalize.translate('ButtonShutdown'),
|
||||
primary: 'delete'
|
||||
}).then(function () {
|
||||
var page = dom.parentWithClass(btn, 'page');
|
||||
const page = dom.parentWithClass(btn, 'page');
|
||||
page.querySelector('#btnRestartServer').disabled = true;
|
||||
page.querySelector('#btnShutdown').disabled = true;
|
||||
ApiClient.shutdownServer();
|
||||
@ -730,7 +750,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
});
|
||||
}
|
||||
};
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
function onRestartRequired(evt, apiClient) {
|
||||
console.debug('onRestartRequired not implemented', evt, apiClient);
|
||||
}
|
||||
@ -769,11 +789,11 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
}
|
||||
|
||||
var serverId = ApiClient.serverId();
|
||||
const serverId = ApiClient.serverId();
|
||||
view.querySelector('.activeDevices').addEventListener('click', onActiveDevicesClick);
|
||||
view.addEventListener('viewshow', function () {
|
||||
var page = this;
|
||||
var apiClient = ApiClient;
|
||||
const page = this;
|
||||
const apiClient = ApiClient;
|
||||
|
||||
if (apiClient) {
|
||||
loading.show();
|
||||
@ -810,7 +830,7 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
});
|
||||
view.addEventListener('viewbeforehide', function () {
|
||||
var apiClient = ApiClient;
|
||||
const apiClient = ApiClient;
|
||||
events.off(serverNotifications, 'RestartRequired', onRestartRequired);
|
||||
events.off(serverNotifications, 'ServerShuttingDown', onServerShuttingDown);
|
||||
events.off(serverNotifications, 'ServerRestarting', onServerRestarting);
|
||||
@ -824,18 +844,19 @@ define(['datetime', 'events', 'itemHelper', 'serverNotifications', 'dom', 'globa
|
||||
}
|
||||
});
|
||||
view.addEventListener('viewdestroy', function () {
|
||||
var page = this;
|
||||
var userActivityLog = page.userActivityLog;
|
||||
const page = this;
|
||||
const userActivityLog = page.userActivityLog;
|
||||
|
||||
if (userActivityLog) {
|
||||
userActivityLog.destroy();
|
||||
}
|
||||
|
||||
var serverActivityLog = page.serverActivityLog;
|
||||
const serverActivityLog = page.serverActivityLog;
|
||||
|
||||
if (serverActivityLog) {
|
||||
serverActivityLog.destroy();
|
||||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,10 @@
|
||||
define(['loading', 'libraryMenu', 'dom', 'emby-input', 'emby-button'], function (loading, libraryMenu, dom) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import dom from 'dom';
|
||||
import 'emby-input';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function load(page, device, deviceOptions) {
|
||||
page.querySelector('#txtCustomName', page).value = deviceOptions.CustomName || '';
|
||||
@ -7,13 +12,13 @@ define(['loading', 'libraryMenu', 'dom', 'emby-input', 'emby-button'], function
|
||||
}
|
||||
|
||||
function loadData() {
|
||||
var page = this;
|
||||
const page = this;
|
||||
loading.show();
|
||||
var id = getParameterByName('id');
|
||||
var promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', {
|
||||
const id = getParameterByName('id');
|
||||
const promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', {
|
||||
Id: id
|
||||
}));
|
||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Options', {
|
||||
const promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Options', {
|
||||
Id: id
|
||||
}));
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
@ -23,7 +28,7 @@ define(['loading', 'libraryMenu', 'dom', 'emby-input', 'emby-button'], function
|
||||
}
|
||||
|
||||
function save(page) {
|
||||
var id = getParameterByName('id');
|
||||
const id = getParameterByName('id');
|
||||
ApiClient.ajax({
|
||||
url: ApiClient.getUrl('Devices/Options', {
|
||||
Id: id
|
||||
@ -37,14 +42,15 @@ define(['loading', 'libraryMenu', 'dom', 'emby-input', 'emby-button'], function
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
var form = this;
|
||||
const form = this;
|
||||
save(dom.parentWithClass(form, 'page'));
|
||||
e.preventDefault();
|
||||
return false;
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
view.querySelector('form').addEventListener('submit', onSubmit);
|
||||
view.addEventListener('viewshow', loadData);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,14 +1,24 @@
|
||||
define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'date-fns', 'dfnshelper', 'emby-button', 'emby-itemscontainer', 'cardStyle'], function (loading, dom, libraryMenu, globalize, imageHelper, datefns, dfnshelper) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import dom from 'dom';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
import imageHelper from 'scripts/imagehelper';
|
||||
import * as datefns from 'date-fns';
|
||||
import dfnshelper from 'dfnshelper';
|
||||
import 'emby-button';
|
||||
import 'emby-itemscontainer';
|
||||
import 'cardStyle';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function canDelete(deviceId) {
|
||||
return deviceId !== ApiClient.deviceId();
|
||||
}
|
||||
|
||||
function deleteDevice(page, id) {
|
||||
var msg = globalize.translate('DeleteDeviceConfirmation');
|
||||
const msg = globalize.translate('DeleteDeviceConfirmation');
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
text: msg,
|
||||
title: globalize.translate('HeaderDeleteDevice'),
|
||||
@ -29,7 +39,7 @@ define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'da
|
||||
}
|
||||
|
||||
function showDeviceMenu(view, btn, deviceId) {
|
||||
var menuItems = [];
|
||||
let menuItems = [];
|
||||
|
||||
if (canEdit) {
|
||||
menuItems.push({
|
||||
@ -47,7 +57,7 @@ define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'da
|
||||
});
|
||||
}
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: btn,
|
||||
@ -66,15 +76,15 @@ define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'da
|
||||
}
|
||||
|
||||
function load(page, devices) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += devices.map(function (device) {
|
||||
var deviceHtml = '';
|
||||
let deviceHtml = '';
|
||||
deviceHtml += "<div data-id='" + device.Id + "' class='card backdropCard'>";
|
||||
deviceHtml += '<div class="cardBox visualCardBox">';
|
||||
deviceHtml += '<div class="cardScalable">';
|
||||
deviceHtml += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||
deviceHtml += '<a is="emby-linkbutton" href="' + (canEdit ? 'device.html?id=' + device.Id : '#') + '" class="cardContent cardImageContainer">';
|
||||
var iconUrl = imageHelper.getDeviceIcon(device);
|
||||
const iconUrl = imageHelper.getDeviceIcon(device);
|
||||
|
||||
if (iconUrl) {
|
||||
deviceHtml += '<div class="cardImage" style="background-image:url(\'' + iconUrl + "');background-size: auto 64%;background-position:center center;\">";
|
||||
@ -124,10 +134,10 @@ define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'da
|
||||
});
|
||||
}
|
||||
|
||||
var canEdit = ApiClient.isMinServerVersion('3.4.1.31');
|
||||
return function (view, params) {
|
||||
const canEdit = ApiClient.isMinServerVersion('3.4.1.31');
|
||||
export default function (view, params) {
|
||||
view.querySelector('.devicesList').addEventListener('click', function (e) {
|
||||
var btnDeviceMenu = dom.parentWithClass(e.target, 'btnDeviceMenu');
|
||||
const btnDeviceMenu = dom.parentWithClass(e.target, 'btnDeviceMenu');
|
||||
|
||||
if (btnDeviceMenu) {
|
||||
showDeviceMenu(view, btnDeviceMenu, btnDeviceMenu.getAttribute('data-id'));
|
||||
@ -136,5 +146,6 @@ define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'da
|
||||
view.addEventListener('viewshow', function () {
|
||||
loadData(this);
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,10 +1,18 @@
|
||||
define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-input', 'emby-checkbox', 'listViewStyle', 'emby-button'], function ($, loading, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-select';
|
||||
import 'emby-button';
|
||||
import 'emby-input';
|
||||
import 'emby-checkbox';
|
||||
import 'listViewStyle';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadProfile(page) {
|
||||
loading.show();
|
||||
var promise1 = getProfile();
|
||||
var promise2 = ApiClient.getUsers();
|
||||
const promise1 = getProfile();
|
||||
const promise2 = ApiClient.getUsers();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
currentProfile = responses[0];
|
||||
renderProfile(page, currentProfile, responses[1]);
|
||||
@ -13,8 +21,8 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function getProfile() {
|
||||
var id = getParameterByName('id');
|
||||
var url = id ? 'Dlna/Profiles/' + id : 'Dlna/Profiles/Default';
|
||||
const id = getParameterByName('id');
|
||||
const url = id ? 'Dlna/Profiles/' + id : 'Dlna/Profiles/Default';
|
||||
return ApiClient.getJSON(ApiClient.getUrl(url));
|
||||
}
|
||||
|
||||
@ -26,7 +34,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
$('#chkEnableAlbumArtInDidl', page).prop('checked', profile.EnableAlbumArtInDidl);
|
||||
$('#chkEnableSingleImageLimit', page).prop('checked', profile.EnableSingleAlbumArtLimit);
|
||||
renderXmlDocumentAttributes(page, profile.XmlRootAttributes || []);
|
||||
var idInfo = profile.Identification || {};
|
||||
const idInfo = profile.Identification || {};
|
||||
renderIdentificationHeaders(page, idInfo.Headers || []);
|
||||
renderSubtitleProfiles(page, profile.SubtitleProfiles || []);
|
||||
$('#txtInfoFriendlyName', page).val(profile.FriendlyName || '');
|
||||
@ -65,7 +73,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
profile.ContainerProfiles = profile.ContainerProfiles || [];
|
||||
profile.CodecProfiles = profile.CodecProfiles || [];
|
||||
profile.ResponseProfiles = profile.ResponseProfiles || [];
|
||||
var usersHtml = '<option></option>' + users.map(function (u) {
|
||||
const usersHtml = '<option></option>' + users.map(function (u) {
|
||||
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
||||
}).join('');
|
||||
$('#selectUser', page).html(usersHtml).val(profile.UserId || '');
|
||||
@ -73,9 +81,9 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function renderIdentificationHeaders(page, headers) {
|
||||
var index = 0;
|
||||
var html = '<div class="paperList">' + headers.map(function (h) {
|
||||
var li = '<div class="listItem">';
|
||||
let index = 0;
|
||||
const html = '<div class="paperList">' + headers.map(function (h) {
|
||||
let li = '<div class="listItem">';
|
||||
li += '<span class="material-icons listItemIcon info"></span>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + h.Name + ': ' + (h.Value || '') + '</h3>';
|
||||
@ -86,9 +94,9 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
index++;
|
||||
return li;
|
||||
}).join('') + '</div>';
|
||||
var elem = $('.httpHeaderIdentificationList', page).html(html).trigger('create');
|
||||
const elem = $('.httpHeaderIdentificationList', page).html(html).trigger('create');
|
||||
$('.btnDeleteIdentificationHeader', elem).on('click', function () {
|
||||
var itemIndex = parseInt(this.getAttribute('data-index'));
|
||||
const itemIndex = parseInt(this.getAttribute('data-index'));
|
||||
currentProfile.Identification.Headers.splice(itemIndex, 1);
|
||||
renderIdentificationHeaders(page, currentProfile.Identification.Headers);
|
||||
});
|
||||
@ -106,7 +114,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
isSubProfileNew = null == header;
|
||||
header = header || {};
|
||||
currentSubProfile = header;
|
||||
var popup = $('#identificationHeaderPopup', page);
|
||||
const popup = $('#identificationHeaderPopup', page);
|
||||
$('#txtIdentificationHeaderName', popup).val(header.Name || '');
|
||||
$('#txtIdentificationHeaderValue', popup).val(header.Value || '');
|
||||
$('#selectMatchType', popup).val(header.Match || 'Equals');
|
||||
@ -130,8 +138,8 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function renderXmlDocumentAttributes(page, attribute) {
|
||||
var html = '<div class="paperList">' + attribute.map(function (h) {
|
||||
var li = '<div class="listItem">';
|
||||
const html = '<div class="paperList">' + attribute.map(function (h) {
|
||||
let li = '<div class="listItem">';
|
||||
li += '<span class="material-icons listItemIcon info"></span>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + h.Name + ' = ' + (h.Value || '') + '</h3>';
|
||||
@ -139,9 +147,9 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
li += '<button type="button" is="paper-icon-button-light" class="btnDeleteXmlAttribute listItemButton" data-index="0"><span class="material-icons delete"></span></button>';
|
||||
return li += '</div>';
|
||||
}).join('') + '</div>';
|
||||
var elem = $('.xmlDocumentAttributeList', page).html(html).trigger('create');
|
||||
const elem = $('.xmlDocumentAttributeList', page).html(html).trigger('create');
|
||||
$('.btnDeleteXmlAttribute', elem).on('click', function () {
|
||||
var itemIndex = parseInt(this.getAttribute('data-index'));
|
||||
const itemIndex = parseInt(this.getAttribute('data-index'));
|
||||
currentProfile.XmlRootAttributes.splice(itemIndex, 1);
|
||||
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
|
||||
});
|
||||
@ -151,7 +159,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
isSubProfileNew = null == attribute;
|
||||
attribute = attribute || {};
|
||||
currentSubProfile = attribute;
|
||||
var popup = $('#xmlAttributePopup', page);
|
||||
const popup = $('#xmlAttributePopup', page);
|
||||
$('#txtXmlAttributeName', popup).val(attribute.Name || '');
|
||||
$('#txtXmlAttributeValue', popup).val(attribute.Value || '');
|
||||
openPopup(popup[0]);
|
||||
@ -171,9 +179,9 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function renderSubtitleProfiles(page, profiles) {
|
||||
var index = 0;
|
||||
var html = '<div class="paperList">' + profiles.map(function (h) {
|
||||
var li = '<div class="listItem lnkEditSubProfile" data-index="' + index + '">';
|
||||
let index = 0;
|
||||
const html = '<div class="paperList">' + profiles.map(function (h) {
|
||||
let li = '<div class="listItem lnkEditSubProfile" data-index="' + index + '">';
|
||||
li += '<span class="material-icons listItemIcon info"></span>';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">' + (h.Format || '') + '</h3>';
|
||||
@ -183,14 +191,14 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
index++;
|
||||
return li;
|
||||
}).join('') + '</div>';
|
||||
var elem = $('.subtitleProfileList', page).html(html).trigger('create');
|
||||
const elem = $('.subtitleProfileList', page).html(html).trigger('create');
|
||||
$('.btnDeleteProfile', elem).on('click', function () {
|
||||
var itemIndex = parseInt(this.getAttribute('data-index'));
|
||||
const itemIndex = parseInt(this.getAttribute('data-index'));
|
||||
currentProfile.SubtitleProfiles.splice(itemIndex, 1);
|
||||
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
|
||||
});
|
||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||
var itemIndex = parseInt(this.getAttribute('data-index'));
|
||||
const itemIndex = parseInt(this.getAttribute('data-index'));
|
||||
editSubtitleProfile(page, currentProfile.SubtitleProfiles[itemIndex]);
|
||||
});
|
||||
}
|
||||
@ -199,7 +207,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
isSubProfileNew = null == profile;
|
||||
profile = profile || {};
|
||||
currentSubProfile = profile;
|
||||
var popup = $('#subtitleProfilePopup', page);
|
||||
const popup = $('#subtitleProfilePopup', page);
|
||||
$('#txtSubtitleProfileFormat', popup).val(profile.Format || '');
|
||||
$('#selectSubtitleProfileMethod', popup).val(profile.Method || '');
|
||||
$('#selectSubtitleProfileDidlMode', popup).val(profile.DidlMode || '');
|
||||
@ -244,12 +252,11 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function renderDirectPlayProfiles(page, profiles) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
let currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
for (const [index, profile] of profiles.entries()) {
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||
@ -257,7 +264,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
html += '<div>';
|
||||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + i + '">';
|
||||
html += '<a is="emby-linkbutton" href="#" class="lnkEditSubProfile" data-profileindex="' + index + '">';
|
||||
html += '<p>' + globalize.translate('ValueContainer', profile.Container || allText) + '</p>';
|
||||
|
||||
if ('Video' == profile.Type) {
|
||||
@ -270,18 +277,18 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
html += '</a>';
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + i + '"><span class="material-icons delete"></span></button>';
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnDeleteProfile listItemButton" data-profileindex="' + index + '"><span class="material-icons delete"></span></button>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
var elem = $('.directPlayProfiles', page).html(html).trigger('create');
|
||||
const elem = $('.directPlayProfiles', page).html(html).trigger('create');
|
||||
$('.btnDeleteProfile', elem).on('click', function () {
|
||||
var index = this.getAttribute('data-profileindex');
|
||||
const index = this.getAttribute('data-profileindex');
|
||||
deleteDirectPlayProfile(page, index);
|
||||
});
|
||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
||||
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||
editDirectPlayProfile(page, currentProfile.DirectPlayProfiles[index]);
|
||||
});
|
||||
}
|
||||
@ -295,7 +302,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
isSubProfileNew = null == directPlayProfile;
|
||||
directPlayProfile = directPlayProfile || {};
|
||||
currentSubProfile = directPlayProfile;
|
||||
var popup = $('#popupEditDirectPlayProfile', page);
|
||||
const popup = $('#popupEditDirectPlayProfile', page);
|
||||
$('#selectDirectPlayProfileType', popup).val(directPlayProfile.Type || 'Video').trigger('change');
|
||||
$('#txtDirectPlayContainer', popup).val(directPlayProfile.Container || '');
|
||||
$('#txtDirectPlayAudioCodec', popup).val(directPlayProfile.AudioCodec || '');
|
||||
@ -304,12 +311,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function renderTranscodingProfiles(page, profiles) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
let currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||
let profile = profiles[i];
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||
@ -336,13 +343,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
var elem = $('.transcodingProfiles', page).html(html).trigger('create');
|
||||
const elem = $('.transcodingProfiles', page).html(html).trigger('create');
|
||||
$('.btnDeleteProfile', elem).on('click', function () {
|
||||
var index = this.getAttribute('data-profileindex');
|
||||
const index = this.getAttribute('data-profileindex');
|
||||
deleteTranscodingProfile(page, index);
|
||||
});
|
||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
||||
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||
editTranscodingProfile(page, currentProfile.TranscodingProfiles[index]);
|
||||
});
|
||||
}
|
||||
@ -351,7 +358,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
isSubProfileNew = null == transcodingProfile;
|
||||
transcodingProfile = transcodingProfile || {};
|
||||
currentSubProfile = transcodingProfile;
|
||||
var popup = $('#transcodingProfilePopup', page);
|
||||
const popup = $('#transcodingProfilePopup', page);
|
||||
$('#selectTranscodingProfileType', popup).val(transcodingProfile.Type || 'Video').trigger('change');
|
||||
$('#txtTranscodingContainer', popup).val(transcodingProfile.Container || '');
|
||||
$('#txtTranscodingAudioCodec', popup).val(transcodingProfile.AudioCodec || '');
|
||||
@ -390,12 +397,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function renderContainerProfiles(page, profiles) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
let currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||
let profile = profiles[i];
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||
@ -420,13 +427,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
var elem = $('.containerProfiles', page).html(html).trigger('create');
|
||||
const elem = $('.containerProfiles', page).html(html).trigger('create');
|
||||
$('.btnDeleteProfile', elem).on('click', function () {
|
||||
var index = this.getAttribute('data-profileindex');
|
||||
const index = this.getAttribute('data-profileindex');
|
||||
deleteContainerProfile(page, index);
|
||||
});
|
||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
||||
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||
editContainerProfile(page, currentProfile.ContainerProfiles[index]);
|
||||
});
|
||||
}
|
||||
@ -440,7 +447,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
isSubProfileNew = null == containerProfile;
|
||||
containerProfile = containerProfile || {};
|
||||
currentSubProfile = containerProfile;
|
||||
var popup = $('#containerProfilePopup', page);
|
||||
const popup = $('#containerProfilePopup', page);
|
||||
$('#selectContainerProfileType', popup).val(containerProfile.Type || 'Video').trigger('change');
|
||||
$('#txtContainerProfileContainer', popup).val(containerProfile.Container || '');
|
||||
$('.radioTabButton:first', popup).trigger('click');
|
||||
@ -461,13 +468,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function renderCodecProfiles(page, profiles) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
let currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
var type = profile.Type.replace('VideoAudio', 'Video Audio');
|
||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||
let profile = profiles[i];
|
||||
const type = profile.Type.replace('VideoAudio', 'Video Audio');
|
||||
|
||||
if (type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + type + '</li>';
|
||||
@ -492,13 +499,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
var elem = $('.codecProfiles', page).html(html).trigger('create');
|
||||
const elem = $('.codecProfiles', page).html(html).trigger('create');
|
||||
$('.btnDeleteProfile', elem).on('click', function () {
|
||||
var index = this.getAttribute('data-profileindex');
|
||||
const index = this.getAttribute('data-profileindex');
|
||||
deleteCodecProfile(page, index);
|
||||
});
|
||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
||||
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||
editCodecProfile(page, currentProfile.CodecProfiles[index]);
|
||||
});
|
||||
}
|
||||
@ -512,7 +519,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
isSubProfileNew = null == codecProfile;
|
||||
codecProfile = codecProfile || {};
|
||||
currentSubProfile = codecProfile;
|
||||
var popup = $('#codecProfilePopup', page);
|
||||
const popup = $('#codecProfilePopup', page);
|
||||
$('#selectCodecProfileType', popup).val(codecProfile.Type || 'Video').trigger('change');
|
||||
$('#txtCodecProfileCodec', popup).val(codecProfile.Codec || '');
|
||||
$('.radioTabButton:first', popup).trigger('click');
|
||||
@ -533,12 +540,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
function renderResponseProfiles(page, profiles) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
||||
var currentType;
|
||||
let currentType;
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||
const profile = profiles[i];
|
||||
|
||||
if (profile.Type !== currentType) {
|
||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||
@ -572,13 +579,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
}
|
||||
|
||||
html += '</ul>';
|
||||
var elem = $('.mediaProfiles', page).html(html).trigger('create');
|
||||
const elem = $('.mediaProfiles', page).html(html).trigger('create');
|
||||
$('.btnDeleteProfile', elem).on('click', function () {
|
||||
var index = this.getAttribute('data-profileindex');
|
||||
const index = this.getAttribute('data-profileindex');
|
||||
deleteResponseProfile(page, index);
|
||||
});
|
||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
||||
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||
editResponseProfile(page, currentProfile.ResponseProfiles[index]);
|
||||
});
|
||||
}
|
||||
@ -592,7 +599,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
isSubProfileNew = null == responseProfile;
|
||||
responseProfile = responseProfile || {};
|
||||
currentSubProfile = responseProfile;
|
||||
var popup = $('#responseProfilePopup', page);
|
||||
const popup = $('#responseProfilePopup', page);
|
||||
$('#selectResponseProfileType', popup).val(responseProfile.Type || 'Video').trigger('change');
|
||||
$('#txtResponseProfileContainer', popup).val(responseProfile.Container || '');
|
||||
$('#txtResponseProfileAudioCodec', popup).val(responseProfile.AudioCodec || '');
|
||||
@ -618,7 +625,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
|
||||
function saveProfile(page, profile) {
|
||||
updateProfile(page, profile);
|
||||
var id = getParameterByName('id');
|
||||
const id = getParameterByName('id');
|
||||
|
||||
if (id) {
|
||||
ApiClient.ajax({
|
||||
@ -627,7 +634,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
data: JSON.stringify(profile),
|
||||
contentType: 'application/json'
|
||||
}).then(function () {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast('Settings saved.');
|
||||
});
|
||||
}, Dashboard.processErrorResponse);
|
||||
@ -687,18 +694,18 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
profile.UserId = $('#selectUser', page).val();
|
||||
}
|
||||
|
||||
var currentProfile;
|
||||
var currentSubProfile;
|
||||
var isSubProfileNew;
|
||||
var allText = globalize.translate('LabelAll');
|
||||
let currentProfile;
|
||||
let currentSubProfile;
|
||||
let isSubProfileNew;
|
||||
const allText = globalize.translate('LabelAll');
|
||||
|
||||
$(document).on('pageinit', '#dlnaProfilePage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('.radioTabButton', page).on('click', function () {
|
||||
$(this).siblings().removeClass('ui-btn-active');
|
||||
$(this).addClass('ui-btn-active');
|
||||
var value = 'A' == this.tagName ? this.getAttribute('data-value') : this.value;
|
||||
var elem = $('.' + value, page);
|
||||
const value = 'A' == this.tagName ? this.getAttribute('data-value') : this.value;
|
||||
const elem = $('.' + value, page);
|
||||
elem.siblings('.tabContent').hide();
|
||||
elem.show();
|
||||
});
|
||||
@ -783,7 +790,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
$('.xmlAttributeForm').off('submit', DlnaProfilePage.onXmlAttributeFormSubmit).on('submit', DlnaProfilePage.onXmlAttributeFormSubmit);
|
||||
$('.subtitleProfileForm').off('submit', DlnaProfilePage.onSubtitleProfileFormSubmit).on('submit', DlnaProfilePage.onSubtitleProfileFormSubmit);
|
||||
}).on('pageshow', '#dlnaProfilePage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('#radioInfo', page).trigger('click');
|
||||
loadProfile(page);
|
||||
});
|
||||
@ -826,4 +833,5 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||
return false;
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,11 @@
|
||||
define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-button'], function ($, globalize, loading, libraryMenu) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import globalize from 'globalize';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import 'listViewStyle';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadProfiles(page) {
|
||||
loading.show();
|
||||
@ -23,14 +29,14 @@ define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-
|
||||
}
|
||||
|
||||
function renderProfiles(page, element, profiles) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
|
||||
if (profiles.length) {
|
||||
html += '<div class="paperList">';
|
||||
}
|
||||
|
||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
||||
var profile = profiles[i];
|
||||
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||
let profile = profiles[i];
|
||||
html += '<div class="listItem listItem-border">';
|
||||
html += '<span class="listItemIcon material-icons live_tv"></span>';
|
||||
html += '<div class="listItemBody two-line">';
|
||||
@ -52,13 +58,13 @@ define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-
|
||||
|
||||
element.innerHTML = html;
|
||||
$('.btnDeleteProfile', element).on('click', function () {
|
||||
var id = this.getAttribute('data-profileid');
|
||||
const id = this.getAttribute('data-profileid');
|
||||
deleteProfile(page, id);
|
||||
});
|
||||
}
|
||||
|
||||
function deleteProfile(page, id) {
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm(globalize.translate('MessageConfirmProfileDeletion'), globalize.translate('HeaderConfirmProfileDeletion')).then(function () {
|
||||
loading.show();
|
||||
ApiClient.ajax({
|
||||
@ -86,4 +92,5 @@ define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-
|
||||
libraryMenu.setTabs('dlna', 1, getTabs);
|
||||
loadProfiles(this);
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,9 @@
|
||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadPage(page, config, users) {
|
||||
page.querySelector('#chkEnablePlayTo').checked = config.EnablePlayTo;
|
||||
@ -8,7 +12,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
$('#chkEnableServer', page).prop('checked', config.EnableServer);
|
||||
$('#chkBlastAliveMessages', page).prop('checked', config.BlastAliveMessages);
|
||||
$('#txtBlastInterval', page).val(config.BlastAliveMessageIntervalSeconds);
|
||||
var usersHtml = users.map(function (u) {
|
||||
const usersHtml = users.map(function (u) {
|
||||
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
||||
}).join('');
|
||||
$('#selectUser', page).html(usersHtml).val(config.DefaultUserId || '');
|
||||
@ -17,7 +21,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
const form = this;
|
||||
ApiClient.getNamedConfiguration('dlna').then(function (config) {
|
||||
config.EnablePlayTo = form.querySelector('#chkEnablePlayTo').checked;
|
||||
config.EnableDebugLog = form.querySelector('#chkEnableDlnaDebugLogging').checked;
|
||||
@ -46,11 +50,12 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}).on('pageshow', '#dlnaSettingsPage', function () {
|
||||
libraryMenu.setTabs('dlna', 0, getTabs);
|
||||
loading.show();
|
||||
var page = this;
|
||||
var promise1 = ApiClient.getNamedConfiguration('dlna');
|
||||
var promise2 = ApiClient.getUsers();
|
||||
const page = this;
|
||||
const promise1 = ApiClient.getNamedConfiguration('dlna');
|
||||
const promise2 = ApiClient.getUsers();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
loadPage(page, responses[0], responses[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,10 @@
|
||||
define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, loading, globalize, dom, libraryMenu) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import globalize from 'globalize';
|
||||
import dom from 'dom';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadPage(page, config, systemInfo) {
|
||||
Array.prototype.forEach.call(page.querySelectorAll('.chkDecodeCodec'), function (c) {
|
||||
@ -27,10 +32,10 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
|
||||
function onSaveEncodingPathFailure(response) {
|
||||
loading.hide();
|
||||
var msg = '';
|
||||
let msg = '';
|
||||
msg = globalize.translate('FFmpegSavePathNotFound');
|
||||
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(msg);
|
||||
});
|
||||
}
|
||||
@ -49,9 +54,9 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
var form = this;
|
||||
const form = this;
|
||||
|
||||
var onDecoderConfirmed = function () {
|
||||
const onDecoderConfirmed = function () {
|
||||
loading.show();
|
||||
ApiClient.getNamedConfiguration('encoding').then(function (config) {
|
||||
config.DownMixAudioBoost = $('#txtDownMixAudioBoost', form).val();
|
||||
@ -75,7 +80,7 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
ApiClient.updateNamedConfiguration('encoding', config).then(function () {
|
||||
updateEncoder(form);
|
||||
}, function () {
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(globalize.translate('DefaultErrorMessage'));
|
||||
});
|
||||
|
||||
@ -85,7 +90,7 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
};
|
||||
|
||||
if ($('#selectVideoDecoder', form).val()) {
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert({
|
||||
title: globalize.translate('TitleHardwareAcceleration'),
|
||||
text: globalize.translate('HardwareAccelerationWarning')
|
||||
@ -100,7 +105,7 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
|
||||
function setDecodingCodecsVisible(context, value) {
|
||||
value = value || '';
|
||||
var any;
|
||||
let any;
|
||||
Array.prototype.forEach.call(context.querySelectorAll('.chkDecodeCodec'), function (c) {
|
||||
if (-1 === c.getAttribute('data-types').split(',').indexOf(value)) {
|
||||
dom.parentWithTag(c, 'LABEL').classList.add('hide');
|
||||
@ -131,7 +136,7 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
}
|
||||
|
||||
$(document).on('pageinit', '#encodingSettingsPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
page.querySelector('#selectVideoDecoder').addEventListener('change', function () {
|
||||
if ('vaapi' == this.value) {
|
||||
page.querySelector('.fldVaapiDevice').classList.remove('hide');
|
||||
@ -150,8 +155,8 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
setDecodingCodecsVisible(page, this.value);
|
||||
});
|
||||
$('#btnSelectEncoderPath', page).on('click.selectDirectory', function () {
|
||||
require(['directorybrowser'], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
callback: function (path) {
|
||||
@ -165,8 +170,8 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
});
|
||||
});
|
||||
$('#btnSelectTranscodingTempPath', page).on('click.selectDirectory', function () {
|
||||
require(['directorybrowser'], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
picker.show({
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
@ -185,11 +190,12 @@ define(['jQuery', 'loading', 'globalize', 'dom', 'libraryMenu'], function ($, lo
|
||||
}).on('pageshow', '#encodingSettingsPage', function () {
|
||||
loading.show();
|
||||
libraryMenu.setTabs('playback', 0, getTabs);
|
||||
var page = this;
|
||||
const page = this;
|
||||
ApiClient.getNamedConfiguration('encoding').then(function (config) {
|
||||
ApiClient.getSystemInfo().then(function (systemInfo) {
|
||||
loadPage(page, config, systemInfo);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,13 @@
|
||||
define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emby-input', 'emby-select', 'emby-button'], function ($, loading, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-textarea';
|
||||
import 'emby-input';
|
||||
import 'emby-select';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadPage(page, config, languageOptions, systemInfo) {
|
||||
page.querySelector('#txtServerName').value = systemInfo.ServerName;
|
||||
@ -16,7 +24,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
const form = this;
|
||||
$(form).parents('.page');
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
config.ServerName = $('#txtServerName', form).val();
|
||||
@ -24,7 +32,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||
config.CachePath = form.querySelector('#txtCachePath').value;
|
||||
config.MetadataPath = $('#txtMetadataPath', form).val();
|
||||
config.MetadataNetworkPath = $('#txtMetadataNetworkPath', form).val();
|
||||
var requiresReload = config.UICulture !== currentLanguage;
|
||||
let requiresReload = config.UICulture !== currentLanguage;
|
||||
ApiClient.updateServerConfiguration(config).then(function() {
|
||||
ApiClient.getNamedConfiguration(brandingConfigKey).then(function(brandingConfig) {
|
||||
brandingConfig.LoginDisclaimer = form.querySelector('#txtLoginDisclaimer').value;
|
||||
@ -43,7 +51,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||
});
|
||||
});
|
||||
}, function () {
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(globalize.translate('DefaultErrorMessage'));
|
||||
});
|
||||
|
||||
@ -53,13 +61,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||
return false;
|
||||
}
|
||||
|
||||
var currentBrandingOptions;
|
||||
var currentLanguage;
|
||||
var brandingConfigKey = 'branding';
|
||||
return function (view, params) {
|
||||
let currentBrandingOptions;
|
||||
let currentLanguage;
|
||||
const brandingConfigKey = 'branding';
|
||||
export default function (view, params) {
|
||||
$('#btnSelectCachePath', view).on('click.selectDirectory', function () {
|
||||
require(['directorybrowser'], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
picker.show({
|
||||
callback: function (path) {
|
||||
if (path) {
|
||||
@ -75,8 +83,8 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||
});
|
||||
});
|
||||
$('#btnSelectMetadataPath', view).on('click.selectDirectory', function () {
|
||||
require(['directorybrowser'], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
picker.show({
|
||||
path: $('#txtMetadataPath', view).val(),
|
||||
networkSharePath: $('#txtMetadataNetworkPath', view).val(),
|
||||
@ -100,9 +108,9 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||
});
|
||||
$('.dashboardGeneralForm', view).off('submit', onSubmit).on('submit', onSubmit);
|
||||
view.addEventListener('viewshow', function () {
|
||||
var promiseConfig = ApiClient.getServerConfiguration();
|
||||
var promiseLanguageOptions = ApiClient.getJSON(ApiClient.getUrl('Localization/Options'));
|
||||
var promiseSystemInfo = ApiClient.getSystemInfo();
|
||||
const promiseConfig = ApiClient.getServerConfiguration();
|
||||
const promiseLanguageOptions = ApiClient.getJSON(ApiClient.getUrl('Localization/Options'));
|
||||
const promiseSystemInfo = ApiClient.getSystemInfo();
|
||||
Promise.all([promiseConfig, promiseLanguageOptions, promiseSystemInfo]).then(function (responses) {
|
||||
loadPage(view, responses[0], responses[1], responses[2]);
|
||||
});
|
||||
@ -112,5 +120,6 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||
view.querySelector('#txtCustomCss').value = config.CustomCss || '';
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,10 @@
|
||||
define(['globalize', 'loading', 'libraryMenu', 'emby-checkbox', 'emby-button', 'emby-button'], function(globalize, loading, libraryMenu) {
|
||||
'use strict';
|
||||
import globalize from 'globalize';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function getTabs() {
|
||||
return [{
|
||||
@ -17,7 +22,7 @@ define(['globalize', 'loading', 'libraryMenu', 'emby-checkbox', 'emby-button', '
|
||||
}];
|
||||
}
|
||||
|
||||
return function(view, params) {
|
||||
export default function(view, params) {
|
||||
function loadData() {
|
||||
ApiClient.getServerConfiguration().then(function(config) {
|
||||
view.querySelector('.chkFolderView').checked = config.EnableFolderView;
|
||||
@ -33,7 +38,7 @@ define(['globalize', 'loading', 'libraryMenu', 'emby-checkbox', 'emby-button', '
|
||||
|
||||
view.querySelector('form').addEventListener('submit', function(e) {
|
||||
loading.show();
|
||||
var form = this;
|
||||
const form = this;
|
||||
ApiClient.getServerConfiguration().then(function(config) {
|
||||
config.EnableFolderView = form.querySelector('.chkFolderView').checked;
|
||||
config.EnableGroupingIntoCollections = form.querySelector('.chkGroupMoviesIntoCollections').checked;
|
||||
@ -63,5 +68,6 @@ define(['globalize', 'loading', 'libraryMenu', 'emby-checkbox', 'emby-button', '
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,9 +1,20 @@
|
||||
define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'globalize', 'dom', 'indicators', 'scripts/imagehelper', 'cardStyle', 'emby-itemrefreshindicator'], function ($, appHost, taskButton, loading, libraryMenu, globalize, dom, indicators, imageHelper) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import appHost from 'apphost';
|
||||
import taskButton from 'scripts/taskbutton';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
import dom from 'dom';
|
||||
import indicators from 'indicators';
|
||||
import imageHelper from 'scripts/imagehelper';
|
||||
import 'cardStyle';
|
||||
import 'emby-itemrefreshindicator';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function addVirtualFolder(page) {
|
||||
require(['medialibrarycreator'], function (medialibrarycreator) {
|
||||
new medialibrarycreator().show({
|
||||
import('medialibrarycreator').then(({default: medialibrarycreator}) => {
|
||||
new medialibrarycreator({
|
||||
collectionTypeOptions: getCollectionTypeOptions().filter(function (f) {
|
||||
return !f.hidden;
|
||||
}),
|
||||
@ -17,8 +28,8 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
function editVirtualFolder(page, virtualFolder) {
|
||||
require(['medialibraryeditor'], function (medialibraryeditor) {
|
||||
new medialibraryeditor().show({
|
||||
import('medialibraryeditor').then(({default: medialibraryeditor}) => {
|
||||
new medialibraryeditor({
|
||||
refresh: shouldRefreshLibraryAfterChanges(page),
|
||||
library: virtualFolder
|
||||
}).then(function (hasChanges) {
|
||||
@ -30,23 +41,21 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
function deleteVirtualFolder(page, virtualFolder) {
|
||||
var msg = globalize.translate('MessageAreYouSureYouWishToRemoveMediaFolder');
|
||||
let msg = globalize.translate('MessageAreYouSureYouWishToRemoveMediaFolder');
|
||||
|
||||
if (virtualFolder.Locations.length) {
|
||||
msg += '<br/><br/>' + globalize.translate('MessageTheFollowingLocationWillBeRemovedFromLibrary') + '<br/><br/>';
|
||||
msg += virtualFolder.Locations.join('<br/>');
|
||||
}
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
|
||||
text: msg,
|
||||
title: globalize.translate('HeaderRemoveMediaFolder'),
|
||||
confirmText: globalize.translate('Delete'),
|
||||
primary: 'delete'
|
||||
|
||||
}).then(function () {
|
||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||
const refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () {
|
||||
reloadLibrary(page);
|
||||
});
|
||||
@ -55,7 +64,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
function refreshVirtualFolder(page, virtualFolder) {
|
||||
require(['refreshDialog'], function (refreshDialog) {
|
||||
import('refreshDialog').then(({default: refreshDialog}) => {
|
||||
new refreshDialog({
|
||||
itemIds: [virtualFolder.ItemId],
|
||||
serverId: ApiClient.serverId(),
|
||||
@ -65,13 +74,13 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
function renameVirtualFolder(page, virtualFolder) {
|
||||
require(['prompt'], function (prompt) {
|
||||
import('prompt').then(({default: prompt}) => {
|
||||
prompt({
|
||||
label: globalize.translate('LabelNewName'),
|
||||
confirmText: globalize.translate('ButtonRename')
|
||||
}).then(function (newName) {
|
||||
if (newName && newName != virtualFolder.Name) {
|
||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||
const refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function () {
|
||||
reloadLibrary(page);
|
||||
});
|
||||
@ -81,10 +90,10 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
function showCardMenu(page, elem, virtualFolders) {
|
||||
var card = dom.parentWithClass(elem, 'card');
|
||||
var index = parseInt(card.getAttribute('data-index'));
|
||||
var virtualFolder = virtualFolders[index];
|
||||
var menuItems = [];
|
||||
const card = dom.parentWithClass(elem, 'card');
|
||||
const index = parseInt(card.getAttribute('data-index'));
|
||||
const virtualFolder = virtualFolders[index];
|
||||
const menuItems = [];
|
||||
menuItems.push({
|
||||
name: globalize.translate('ButtonEditImages'),
|
||||
id: 'editimages',
|
||||
@ -111,7 +120,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
icon: 'refresh'
|
||||
});
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: elem,
|
||||
@ -153,7 +162,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
function reloadVirtualFolders(page, virtualFolders) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
virtualFolders.push({
|
||||
Name: globalize.translate('ButtonAddMediaLibrary'),
|
||||
icon: 'add_circle',
|
||||
@ -164,12 +173,12 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
showNameWithIcon: false
|
||||
});
|
||||
|
||||
for (var i = 0; i < virtualFolders.length; i++) {
|
||||
var virtualFolder = virtualFolders[i];
|
||||
for (let i = 0; i < virtualFolders.length; i++) {
|
||||
const virtualFolder = virtualFolders[i];
|
||||
html += getVirtualFolderHtml(page, virtualFolder, i);
|
||||
}
|
||||
|
||||
var divVirtualFolders = page.querySelector('#divVirtualFolders');
|
||||
const divVirtualFolders = page.querySelector('#divVirtualFolders');
|
||||
divVirtualFolders.innerHTML = html;
|
||||
divVirtualFolders.classList.add('itemsContainer');
|
||||
divVirtualFolders.classList.add('vertical-wrap');
|
||||
@ -180,9 +189,9 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
addVirtualFolder(page);
|
||||
});
|
||||
$('.editLibrary', divVirtualFolders).on('click', function () {
|
||||
var card = $(this).parents('.card')[0];
|
||||
var index = parseInt(card.getAttribute('data-index'));
|
||||
var virtualFolder = virtualFolders[index];
|
||||
const card = $(this).parents('.card')[0];
|
||||
const index = parseInt(card.getAttribute('data-index'));
|
||||
const virtualFolder = virtualFolders[index];
|
||||
|
||||
if (virtualFolder.ItemId) {
|
||||
editVirtualFolder(page, virtualFolder);
|
||||
@ -192,7 +201,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
function editImages(page, virtualFolder) {
|
||||
require(['imageEditor'], function (imageEditor) {
|
||||
import('imageEditor').then(({default: imageEditor}) => {
|
||||
imageEditor.show({
|
||||
itemId: virtualFolder.ItemId,
|
||||
serverId: ApiClient.serverId()
|
||||
@ -240,8 +249,8 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
function getVirtualFolderHtml(page, virtualFolder, index) {
|
||||
var html = '';
|
||||
var style = '';
|
||||
let html = '';
|
||||
let style = '';
|
||||
|
||||
if (page.classList.contains('wizardPage')) {
|
||||
style += 'min-width:33.3%;';
|
||||
@ -257,7 +266,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||
html += '<div class="cardContent">';
|
||||
var imgUrl = '';
|
||||
let imgUrl = '';
|
||||
|
||||
if (virtualFolder.PrimaryImageItemId) {
|
||||
imgUrl = ApiClient.getScaledImageUrl(virtualFolder.PrimaryImageItemId, {
|
||||
@ -266,7 +275,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
});
|
||||
}
|
||||
|
||||
var hasCardImageContainer;
|
||||
let hasCardImageContainer;
|
||||
|
||||
if (imgUrl) {
|
||||
html += '<div class="cardImageContainer editLibrary" style="cursor:pointer;background-image:url(\'' + imgUrl + "');\">";
|
||||
@ -316,7 +325,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
var typeName = getCollectionTypeOptions().filter(function (t) {
|
||||
let typeName = getCollectionTypeOptions().filter(function (t) {
|
||||
return t.value == virtualFolder.CollectionType;
|
||||
})[0];
|
||||
typeName = typeName ? typeName.name : globalize.translate('FolderTypeUnset');
|
||||
@ -376,7 +385,8 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
});
|
||||
pageIdOn('pageshow', 'mediaLibraryPage', function () {
|
||||
libraryMenu.setTabs('librarysetup', 0, getTabs);
|
||||
var page = this;
|
||||
|
||||
const page = this;
|
||||
taskButton({
|
||||
mode: 'on',
|
||||
progressElem: page.querySelector('.refreshProgress'),
|
||||
@ -385,7 +395,8 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
});
|
||||
});
|
||||
pageIdOn('pagebeforehide', 'mediaLibraryPage', function () {
|
||||
var page = this;
|
||||
|
||||
const page = this;
|
||||
taskButton({
|
||||
mode: 'off',
|
||||
progressElem: page.querySelector('.refreshProgress'),
|
||||
@ -393,4 +404,5 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||
button: page.querySelector('.btnRefresh')
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,12 +1,18 @@
|
||||
define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle'], function($, dom, loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import dom from 'dom';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
import 'listViewStyle';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function populateLanguages(select) {
|
||||
return ApiClient.getCultures().then(function(languages) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<option value=''></option>";
|
||||
for (var i = 0, length = languages.length; i < length; i++) {
|
||||
var culture = languages[i];
|
||||
for (let i = 0, length = languages.length; i < length; i++) {
|
||||
const culture = languages[i];
|
||||
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
||||
}
|
||||
select.innerHTML = html;
|
||||
@ -15,10 +21,10 @@ define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle']
|
||||
|
||||
function populateCountries(select) {
|
||||
return ApiClient.getCountries().then(function(allCountries) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<option value=''></option>";
|
||||
for (var i = 0, length = allCountries.length; i < length; i++) {
|
||||
var culture = allCountries[i];
|
||||
for (let i = 0, length = allCountries.length; i < length; i++) {
|
||||
const culture = allCountries[i];
|
||||
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + '</option>';
|
||||
}
|
||||
select.innerHTML = html;
|
||||
@ -26,9 +32,9 @@ define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle']
|
||||
}
|
||||
|
||||
function loadPage(page) {
|
||||
var promises = [ApiClient.getServerConfiguration(), populateLanguages(page.querySelector('#selectLanguage')), populateCountries(page.querySelector('#selectCountry'))];
|
||||
const promises = [ApiClient.getServerConfiguration(), populateLanguages(page.querySelector('#selectLanguage')), populateCountries(page.querySelector('#selectCountry'))];
|
||||
Promise.all(promises).then(function(responses) {
|
||||
var config = responses[0];
|
||||
const config = responses[0];
|
||||
page.querySelector('#selectLanguage').value = config.PreferredMetadataLanguage || '';
|
||||
page.querySelector('#selectCountry').value = config.MetadataCountryCode || '';
|
||||
loading.hide();
|
||||
@ -36,7 +42,7 @@ define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle']
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
var form = this;
|
||||
const form = this;
|
||||
return loading.show(), ApiClient.getServerConfiguration().then(function(config) {
|
||||
config.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value;
|
||||
config.MetadataCountryCode = form.querySelector('#selectCountry').value;
|
||||
@ -67,4 +73,5 @@ define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle']
|
||||
loading.show();
|
||||
loadPage(this);
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,8 +1,12 @@
|
||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadPage(page, config, users) {
|
||||
var html = '<option value="" selected="selected">' + globalize.translate('OptionNone') + '</option>';
|
||||
let html = '<option value="" selected="selected">' + globalize.translate('OptionNone') + '</option>';
|
||||
html += users.map(function (user) {
|
||||
return '<option value="' + user.Id + '">' + user.Name + '</option>';
|
||||
}).join('');
|
||||
@ -16,7 +20,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
const form = this;
|
||||
ApiClient.getNamedConfiguration(metadataKey).then(function (config) {
|
||||
config.UserId = $('#selectUser', form).val() || null;
|
||||
config.ReleaseDateFormat = $('#selectReleaseDateFormat', form).val();
|
||||
@ -32,10 +36,10 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}
|
||||
|
||||
function showConfirmMessage(config) {
|
||||
var msg = [];
|
||||
const msg = [];
|
||||
msg.push(globalize.translate('MetadataSettingChangeHelp'));
|
||||
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert({
|
||||
text: msg.join('<br/><br/>')
|
||||
});
|
||||
@ -58,17 +62,18 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}];
|
||||
}
|
||||
|
||||
var metadataKey = 'xbmcmetadata';
|
||||
const metadataKey = 'xbmcmetadata';
|
||||
$(document).on('pageinit', '#metadataNfoPage', function () {
|
||||
$('.metadataNfoForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
}).on('pageshow', '#metadataNfoPage', function () {
|
||||
libraryMenu.setTabs('metadata', 3, getTabs);
|
||||
loading.show();
|
||||
var page = this;
|
||||
var promise1 = ApiClient.getUsers();
|
||||
var promise2 = ApiClient.getNamedConfiguration(metadataKey);
|
||||
const page = this;
|
||||
const promise1 = ApiClient.getUsers();
|
||||
const promise2 = ApiClient.getNamedConfiguration(metadataKey);
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
loadPage(page, responses[1], responses[0]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,12 +1,17 @@
|
||||
define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'], function (loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-checkbox';
|
||||
import 'emby-select';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function onSubmit(e) {
|
||||
var form = this;
|
||||
var localAddress = form.querySelector('#txtLocalAddress').value;
|
||||
var enableUpnp = form.querySelector('#chkEnableUpnp').checked;
|
||||
const form = this;
|
||||
const localAddress = form.querySelector('#txtLocalAddress').value;
|
||||
const enableUpnp = form.querySelector('#chkEnableUpnp').checked;
|
||||
confirmSelections(localAddress, enableUpnp, function () {
|
||||
var validationResult = getValidationAlert(form);
|
||||
const validationResult = getValidationAlert(form);
|
||||
|
||||
if (validationResult) {
|
||||
showAlertText(validationResult);
|
||||
@ -47,7 +52,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||
}
|
||||
|
||||
function triggerChange(select) {
|
||||
var evt = document.createEvent('HTMLEvents');
|
||||
const evt = document.createEvent('HTMLEvents');
|
||||
evt.initEvent('change', false, true);
|
||||
select.dispatchEvent(evt);
|
||||
}
|
||||
@ -65,8 +70,8 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||
}
|
||||
|
||||
function validateHttps(form) {
|
||||
var certPath = form.querySelector('#txtCertificatePath').value || null;
|
||||
var httpsEnabled = form.querySelector('#chkEnableHttps').checked;
|
||||
const certPath = form.querySelector('#txtCertificatePath').value || null;
|
||||
const httpsEnabled = form.querySelector('#chkEnableHttps').checked;
|
||||
|
||||
if (httpsEnabled && !certPath) {
|
||||
return showAlertText({
|
||||
@ -80,7 +85,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||
|
||||
function showAlertText(options) {
|
||||
return new Promise(function (resolve, reject) {
|
||||
require(['alert'], function (alert) {
|
||||
import('alert').then(({default: alert}) => {
|
||||
alert(options).then(resolve, reject);
|
||||
});
|
||||
});
|
||||
@ -97,7 +102,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||
}
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
function loadPage(page, config) {
|
||||
page.querySelector('#txtPortNumber').value = config.HttpServerPortNumber;
|
||||
page.querySelector('#txtPublicPort').value = config.PublicPort;
|
||||
@ -111,7 +116,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||
page.querySelector('#chkEnableHttps').checked = config.EnableHttps;
|
||||
page.querySelector('#chkRequireHttps').checked = config.RequireHttps;
|
||||
page.querySelector('#txtBaseUrl').value = config.BaseUrl || '';
|
||||
var txtCertificatePath = page.querySelector('#txtCertificatePath');
|
||||
const txtCertificatePath = page.querySelector('#txtCertificatePath');
|
||||
txtCertificatePath.value = config.CertificatePath || '';
|
||||
page.querySelector('#txtCertPassword').value = config.CertificatePassword || '';
|
||||
page.querySelector('#chkEnableUpnp').checked = config.EnableUPnP;
|
||||
@ -135,8 +140,8 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||
}
|
||||
});
|
||||
view.querySelector('#btnSelectCertPath').addEventListener('click', function () {
|
||||
require(['directorybrowser'], function (directoryBrowser) {
|
||||
var picker = new directoryBrowser();
|
||||
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||
const picker = new directoryBrowser();
|
||||
picker.show({
|
||||
includeFiles: true,
|
||||
includeDirectories: true,
|
||||
@ -158,5 +163,6 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||
loadPage(view, config);
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,9 @@
|
||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadPage(page, config) {
|
||||
$('#txtMinResumePct', page).val(config.MinResumePct);
|
||||
@ -10,7 +14,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
const form = this;
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
config.MinResumePct = $('#txtMinResumePct', form).val();
|
||||
config.MaxResumePct = $('#txtMaxResumePct', form).val();
|
||||
@ -40,9 +44,10 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}).on('pageshow', '#playbackConfigurationPage', function () {
|
||||
loading.show();
|
||||
libraryMenu.setTabs('playback', 1, getTabs);
|
||||
var page = this;
|
||||
const page = this;
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
loadPage(page, config);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -91,7 +91,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'connectionManager', 'e
|
||||
msg += globalize.translate('PleaseConfirmPluginInstallation');
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
confirm(msg, globalize.translate('HeaderConfirmPluginInstallation')).then(function () {
|
||||
confirm.default(msg, globalize.translate('HeaderConfirmPluginInstallation')).then(function () {
|
||||
alertCallback();
|
||||
}, function () {
|
||||
console.debug('plugin not installed');
|
||||
|
@ -5,7 +5,7 @@ define(['loading', 'libraryMenu', 'dom', 'globalize', 'cardStyle', 'emby-button'
|
||||
var msg = globalize.translate('UninstallPluginConfirmation', name);
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
confirm({
|
||||
confirm.default({
|
||||
title: globalize.translate('UninstallPluginHeader'),
|
||||
text: msg,
|
||||
primary: 'delete',
|
||||
|
@ -1,11 +1,19 @@
|
||||
define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby-button', 'emby-select'], function ($, loading, datetime, dom, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import datetime from 'datetime';
|
||||
import dom from 'dom';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-input';
|
||||
import 'emby-button';
|
||||
import 'emby-select';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function fillTimeOfDay(select) {
|
||||
|
||||
var options = [];
|
||||
const options = [];
|
||||
|
||||
for (var i = 0; i < 86400000; i += 900000) {
|
||||
for (let i = 0; i < 86400000; i += 900000) {
|
||||
options.push({
|
||||
name: ScheduledTaskPage.getDisplayTime(i * 10000),
|
||||
value: i * 10000
|
||||
@ -18,15 +26,15 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
}
|
||||
|
||||
Array.prototype.remove = function (from, to) {
|
||||
var rest = this.slice((to || from) + 1 || this.length);
|
||||
const rest = this.slice((to || from) + 1 || this.length);
|
||||
this.length = from < 0 ? this.length + from : from;
|
||||
return this.push.apply(this, rest);
|
||||
};
|
||||
|
||||
var ScheduledTaskPage = {
|
||||
const ScheduledTaskPage = {
|
||||
refreshScheduledTask: function (view) {
|
||||
loading.show();
|
||||
var id = getParameterByName('id');
|
||||
let id = getParameterByName('id');
|
||||
ApiClient.getScheduledTask(id).then(function (task) {
|
||||
ScheduledTaskPage.loadScheduledTask(view, task);
|
||||
});
|
||||
@ -35,18 +43,18 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
$('.taskName', view).html(task.Name);
|
||||
$('#pTaskDescription', view).html(task.Description);
|
||||
|
||||
require(['listViewStyle'], function () {
|
||||
import('listViewStyle').then(() => {
|
||||
ScheduledTaskPage.loadTaskTriggers(view, task);
|
||||
});
|
||||
|
||||
loading.hide();
|
||||
},
|
||||
loadTaskTriggers: function (context, task) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<div class="paperList">';
|
||||
|
||||
for (var i = 0, length = task.Triggers.length; i < length; i++) {
|
||||
var trigger = task.Triggers[i];
|
||||
for (let i = 0, length = task.Triggers.length; i < length; i++) {
|
||||
const trigger = task.Triggers[i];
|
||||
|
||||
html += '<div class="listItem listItem-border">';
|
||||
html += '<span class="material-icons listItemIcon schedule"></span>';
|
||||
@ -58,7 +66,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
html += "<div class='listItemBodyText'>" + ScheduledTaskPage.getTriggerFriendlyName(trigger) + '</div>';
|
||||
if (trigger.MaxRuntimeMs) {
|
||||
html += '<div class="listItemBodyText secondary">';
|
||||
var hours = trigger.MaxRuntimeTicks / 36e9;
|
||||
const hours = trigger.MaxRuntimeTicks / 36e9;
|
||||
if (hours == 1) {
|
||||
html += globalize.translate('ValueTimeLimitSingleHour');
|
||||
} else {
|
||||
@ -92,7 +100,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
|
||||
if (trigger.Type == 'IntervalTrigger') {
|
||||
|
||||
var hours = trigger.IntervalTicks / 36e9;
|
||||
const hours = trigger.IntervalTicks / 36e9;
|
||||
|
||||
if (hours == 0.25) {
|
||||
return globalize.translate('EveryXMinutes', '15');
|
||||
@ -117,8 +125,8 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
return trigger.Type;
|
||||
},
|
||||
getDisplayTime: function (ticks) {
|
||||
var ms = ticks / 1e4;
|
||||
var now = new Date();
|
||||
const ms = ticks / 1e4;
|
||||
const now = new Date();
|
||||
now.setHours(0, 0, 0, 0);
|
||||
now.setTime(now.getTime() + ms);
|
||||
return datetime.getDisplayTime(now);
|
||||
@ -129,15 +137,15 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
$('#popupAddTrigger', view).removeClass('hide');
|
||||
},
|
||||
confirmDeleteTrigger: function (view, index) {
|
||||
require(['confirm'], function (confirm) {
|
||||
confirm(globalize.translate('MessageDeleteTaskTrigger'), globalize.translate('HeaderDeleteTaskTrigger')).then(function () {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm.default(globalize.translate('MessageDeleteTaskTrigger'), globalize.translate('HeaderDeleteTaskTrigger')).then(function () {
|
||||
ScheduledTaskPage.deleteTrigger(view, index);
|
||||
});
|
||||
});
|
||||
},
|
||||
deleteTrigger: function (view, index) {
|
||||
loading.show();
|
||||
var id = getParameterByName('id');
|
||||
let id = getParameterByName('id');
|
||||
ApiClient.getScheduledTask(id).then(function (task) {
|
||||
task.Triggers.remove(index);
|
||||
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
||||
@ -179,7 +187,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
}
|
||||
},
|
||||
getTriggerToAdd: function (page) {
|
||||
var trigger = {
|
||||
const trigger = {
|
||||
Type: $('#selectTriggerType', page).val()
|
||||
};
|
||||
|
||||
@ -194,7 +202,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
trigger.IntervalTicks = $('#selectInterval', page).val();
|
||||
}
|
||||
|
||||
var timeLimit = $('#txtTimeLimit', page).val() || '0';
|
||||
let timeLimit = $('#txtTimeLimit', page).val() || '0';
|
||||
timeLimit = parseFloat(timeLimit) * 3600000;
|
||||
|
||||
trigger.MaxRuntimeMs = timeLimit || null;
|
||||
@ -202,10 +210,10 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
return trigger;
|
||||
}
|
||||
};
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
function onSubmit(e) {
|
||||
loading.show();
|
||||
var id = getParameterByName('id');
|
||||
let id = getParameterByName('id');
|
||||
ApiClient.getScheduledTask(id).then(function (task) {
|
||||
task.Triggers.push(ScheduledTaskPage.getTriggerToAdd(view));
|
||||
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
||||
@ -226,7 +234,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
ScheduledTaskPage.showAddTriggerPopup(view);
|
||||
});
|
||||
view.addEventListener('click', function (e) {
|
||||
var btnDeleteTrigger = dom.parentWithClass(e.target, 'btnDeleteTrigger');
|
||||
const btnDeleteTrigger = dom.parentWithClass(e.target, 'btnDeleteTrigger');
|
||||
|
||||
if (btnDeleteTrigger) {
|
||||
ScheduledTaskPage.confirmDeleteTrigger(view, parseInt(btnDeleteTrigger.getAttribute('data-index')));
|
||||
@ -235,5 +243,6 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||
view.addEventListener('viewshow', function () {
|
||||
ScheduledTaskPage.refreshScheduledTask(view);
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,14 @@
|
||||
define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date-fns', 'dfnshelper', 'listViewStyle', 'emby-button'], function ($, loading, events, globalize, serverNotifications, datefns, dfnshelper) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import events from 'events';
|
||||
import globalize from 'globalize';
|
||||
import serverNotifications from 'serverNotifications';
|
||||
import * as datefns from 'date-fns';
|
||||
import dfnshelper from 'dfnshelper';
|
||||
import 'listViewStyle';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function reloadList(page) {
|
||||
ApiClient.getScheduledTasks({
|
||||
@ -17,10 +26,10 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||
return a == b ? 0 : a < b ? -1 : 1;
|
||||
});
|
||||
|
||||
var currentCategory;
|
||||
var html = '';
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
var task = tasks[i];
|
||||
let currentCategory;
|
||||
let html = '';
|
||||
for (let i = 0; i < tasks.length; i++) {
|
||||
const task = tasks[i];
|
||||
if (task.Category != currentCategory) {
|
||||
currentCategory = task.Category;
|
||||
if (currentCategory) {
|
||||
@ -63,11 +72,11 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||
}
|
||||
|
||||
function getTaskProgressHtml(task) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
if (task.State === 'Idle') {
|
||||
if (task.LastExecutionResult) {
|
||||
var endtime = Date.parse(task.LastExecutionResult.EndTimeUtc);
|
||||
var starttime = Date.parse(task.LastExecutionResult.StartTimeUtc);
|
||||
const endtime = Date.parse(task.LastExecutionResult.EndTimeUtc);
|
||||
const starttime = Date.parse(task.LastExecutionResult.StartTimeUtc);
|
||||
html += globalize.translate('LabelScheduledTaskLastRan', datefns.formatDistanceToNow(endtime, dfnshelper.localeWithSuffix),
|
||||
datefns.formatDistance(starttime, endtime, { locale: dfnshelper.getLocale() }));
|
||||
if (task.LastExecutionResult.Status === 'Failed') {
|
||||
@ -79,7 +88,7 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||
}
|
||||
}
|
||||
} else if (task.State === 'Running') {
|
||||
var progress = (task.CurrentProgressPercentage || 0).toFixed(1);
|
||||
const progress = (task.CurrentProgressPercentage || 0).toFixed(1);
|
||||
html += '<div style="display:flex;align-items:center;">';
|
||||
html += '<div class="taskProgressOuter" title="' + progress + '%" style="flex-grow:1;">';
|
||||
html += '<div class="taskProgressInner" style="width:' + progress + '%;">';
|
||||
@ -94,7 +103,7 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||
}
|
||||
|
||||
function setTaskButtonIcon(button, icon) {
|
||||
var inner = button.querySelector('.material-icons');
|
||||
let inner = button.querySelector('.material-icons');
|
||||
inner.classList.remove('stop', 'play_arrow');
|
||||
inner.classList.add(icon);
|
||||
}
|
||||
@ -114,10 +123,10 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||
$(elem).parents('.listItem')[0].setAttribute('data-status', state);
|
||||
}
|
||||
|
||||
return function(view, params) {
|
||||
export default function(view, params) {
|
||||
function updateTasks(tasks) {
|
||||
for (var i = 0; i < tasks.length; i++) {
|
||||
var task = tasks[i];
|
||||
for (let i = 0; i < tasks.length; i++) {
|
||||
const task = tasks[i];
|
||||
view.querySelector('#taskProgress' + task.Id).innerHTML = getTaskProgressHtml(task);
|
||||
updateTaskButton(view.querySelector('#btnTask' + task.Id), task.State);
|
||||
}
|
||||
@ -146,12 +155,12 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||
pollInterval && clearInterval(pollInterval);
|
||||
}
|
||||
|
||||
var pollInterval;
|
||||
var serverId = ApiClient.serverId();
|
||||
let pollInterval;
|
||||
const serverId = ApiClient.serverId();
|
||||
|
||||
$('.divScheduledTasks', view).on('click', '.btnStartTask', function() {
|
||||
var button = this;
|
||||
var id = button.getAttribute('data-taskid');
|
||||
const button = this;
|
||||
let id = button.getAttribute('data-taskid');
|
||||
ApiClient.startScheduledTask(id).then(function() {
|
||||
updateTaskButton(button, 'Running');
|
||||
reloadList(view);
|
||||
@ -159,8 +168,8 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||
});
|
||||
|
||||
$('.divScheduledTasks', view).on('click', '.btnStopTask', function() {
|
||||
var button = this;
|
||||
var id = button.getAttribute('data-taskid');
|
||||
const button = this;
|
||||
let id = button.getAttribute('data-taskid');
|
||||
ApiClient.stopScheduledTask(id).then(function() {
|
||||
updateTaskButton(button, '');
|
||||
reloadList(view);
|
||||
@ -178,5 +187,6 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||
reloadList(view);
|
||||
events.on(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,8 +1,10 @@
|
||||
define(['components/activitylog', 'globalize'], function (ActivityLog, globalize) {
|
||||
'use strict';
|
||||
import ActivityLog from 'components/activitylog';
|
||||
import globalize from 'globalize';
|
||||
|
||||
return function (view, params) {
|
||||
var activityLog;
|
||||
/* eslint-disable indent */
|
||||
|
||||
export default function (view, params) {
|
||||
let activityLog;
|
||||
|
||||
if (params.useractivity !== 'false') {
|
||||
view.querySelector('.activityItems').setAttribute('data-useractivity', 'true');
|
||||
@ -27,5 +29,6 @@ define(['components/activitylog', 'globalize'], function (ActivityLog, globalize
|
||||
|
||||
activityLog = null;
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,5 +1,9 @@
|
||||
define(['jQuery', 'libraryMenu', 'loading', 'globalize'], function ($, libraryMenu, loading, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import loading from 'loading';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadPage(page, config) {
|
||||
$('#txtRemoteClientBitrateLimit', page).val(config.RemoteClientBitrateLimit / 1e6 || '');
|
||||
@ -8,7 +12,7 @@ define(['jQuery', 'libraryMenu', 'loading', 'globalize'], function ($, libraryMe
|
||||
|
||||
function onSubmit() {
|
||||
loading.show();
|
||||
var form = this;
|
||||
const form = this;
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
config.RemoteClientBitrateLimit = parseInt(1e6 * parseFloat($('#txtRemoteClientBitrateLimit', form).val() || '0'));
|
||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||
@ -35,9 +39,10 @@ define(['jQuery', 'libraryMenu', 'loading', 'globalize'], function ($, libraryMe
|
||||
}).on('pageshow', '#streamingSettingsPage', function () {
|
||||
loading.show();
|
||||
libraryMenu.setTabs('playback', 2, getTabs);
|
||||
var page = this;
|
||||
const page = this;
|
||||
ApiClient.getServerConfiguration().then(function (config) {
|
||||
loadPage(page, config);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,26 +1,25 @@
|
||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadDeleteFolders(page, user, mediaFolders) {
|
||||
ApiClient.getJSON(ApiClient.getUrl('Channels', {
|
||||
SupportsMediaDeletion: true
|
||||
})).then(function (channelsResult) {
|
||||
var i;
|
||||
var length;
|
||||
var folder;
|
||||
var isChecked;
|
||||
var checkedAttribute;
|
||||
var html = '';
|
||||
let isChecked;
|
||||
let checkedAttribute;
|
||||
let html = '';
|
||||
|
||||
for (i = 0, length = mediaFolders.length; i < length; i++) {
|
||||
folder = mediaFolders[i];
|
||||
for (const folder of mediaFolders) {
|
||||
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id);
|
||||
checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
for (i = 0, length = channelsResult.Items.length; i < length; i++) {
|
||||
folder = channelsResult.Items[i];
|
||||
for (const folder of channelsResult.Items) {
|
||||
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id);
|
||||
checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||
@ -38,9 +37,9 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
page.querySelector('.fldSelectLoginProvider').classList.add('hide');
|
||||
}
|
||||
|
||||
var currentProviderId = user.Policy.AuthenticationProviderId;
|
||||
const currentProviderId = user.Policy.AuthenticationProviderId;
|
||||
page.querySelector('.selectLoginProvider').innerHTML = providers.map(function (provider) {
|
||||
var selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||
const selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||
return '<option value="' + provider.Id + '"' + selected + '>' + provider.Name + '</option>';
|
||||
});
|
||||
}
|
||||
@ -52,15 +51,14 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
page.querySelector('.fldSelectPasswordResetProvider').classList.add('hide');
|
||||
}
|
||||
|
||||
var currentProviderId = user.Policy.PasswordResetProviderId;
|
||||
const currentProviderId = user.Policy.PasswordResetProviderId;
|
||||
page.querySelector('.selectPasswordResetProvider').innerHTML = providers.map(function (provider) {
|
||||
var selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||
const selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||
return '<option value="' + provider.Id + '"' + selected + '>' + provider.Name + '</option>';
|
||||
});
|
||||
}
|
||||
|
||||
function loadUser(page, user) {
|
||||
currentUser = user;
|
||||
ApiClient.getJSON(ApiClient.getUrl('Auth/Providers')).then(function (providers) {
|
||||
loadAuthProviders(page, user, providers);
|
||||
});
|
||||
@ -114,7 +112,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
Dashboard.navigate('userprofiles.html');
|
||||
loading.hide();
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
@ -159,7 +157,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
var page = $(this).parents('.page')[0];
|
||||
const page = $(this).parents('.page')[0];
|
||||
loading.show();
|
||||
getUser().then(function (result) {
|
||||
saveUser(result, page);
|
||||
@ -168,7 +166,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}
|
||||
|
||||
function getUser() {
|
||||
var userId = getParameterByName('userId');
|
||||
const userId = getParameterByName('userId');
|
||||
return ApiClient.getUser(userId);
|
||||
}
|
||||
|
||||
@ -179,11 +177,10 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
});
|
||||
}
|
||||
|
||||
var currentUser;
|
||||
$(document).on('pageinit', '#editUserPage', function () {
|
||||
$('.editUserProfileForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
this.querySelector('.sharingHelp').innerHTML = globalize.translate('OptionAllowLinkSharingHelp', 30);
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('#chkEnableDeleteAllFolders', this).on('change', function () {
|
||||
if (this.checked) {
|
||||
$('.deleteAccess', page).hide();
|
||||
@ -201,4 +198,5 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}).on('pagebeforeshow', '#editUserPage', function () {
|
||||
loadData(this);
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,40 +1,44 @@
|
||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function triggerChange(select) {
|
||||
var evt = document.createEvent('HTMLEvents');
|
||||
const evt = document.createEvent('HTMLEvents');
|
||||
evt.initEvent('change', false, true);
|
||||
select.dispatchEvent(evt);
|
||||
}
|
||||
|
||||
function loadMediaFolders(page, user, mediaFolders) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderLibraries') + '</h3>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
|
||||
for (var i = 0, length = mediaFolders.length; i < length; i++) {
|
||||
var folder = mediaFolders[i];
|
||||
var isChecked = user.Policy.EnableAllFolders || -1 != user.Policy.EnabledFolders.indexOf(folder.Id);
|
||||
var checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
for (let i = 0, length = mediaFolders.length; i < length; i++) {
|
||||
const folder = mediaFolders[i];
|
||||
const isChecked = user.Policy.EnableAllFolders || -1 != user.Policy.EnabledFolders.indexOf(folder.Id);
|
||||
const checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
page.querySelector('.folderAccess').innerHTML = html;
|
||||
var chkEnableAllFolders = page.querySelector('#chkEnableAllFolders');
|
||||
const chkEnableAllFolders = page.querySelector('#chkEnableAllFolders');
|
||||
chkEnableAllFolders.checked = user.Policy.EnableAllFolders;
|
||||
triggerChange(chkEnableAllFolders);
|
||||
}
|
||||
|
||||
function loadChannels(page, user, channels) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderChannels') + '</h3>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
|
||||
for (var i = 0, length = channels.length; i < length; i++) {
|
||||
var folder = channels[i];
|
||||
var isChecked = user.Policy.EnableAllChannels || -1 != user.Policy.EnabledChannels.indexOf(folder.Id);
|
||||
var checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
for (let i = 0, length = channels.length; i < length; i++) {
|
||||
const folder = channels[i];
|
||||
const isChecked = user.Policy.EnableAllChannels || -1 != user.Policy.EnabledChannels.indexOf(folder.Id);
|
||||
const checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
@ -51,13 +55,13 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}
|
||||
|
||||
function loadDevices(page, user, devices) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderDevices') + '</h3>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
|
||||
for (var i = 0, length = devices.length; i < length; i++) {
|
||||
var device = devices[i];
|
||||
var checkedAttribute = user.Policy.EnableAllDevices || -1 != user.Policy.EnabledDevices.indexOf(device.Id) ? ' checked="checked"' : '';
|
||||
for (let i = 0, length = devices.length; i < length; i++) {
|
||||
const device = devices[i];
|
||||
const checkedAttribute = user.Policy.EnableAllDevices || -1 != user.Policy.EnabledDevices.indexOf(device.Id) ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkDevice" data-id="' + device.Id + '" ' + checkedAttribute + '><span>' + device.Name + ' - ' + device.AppName + '</span></label>';
|
||||
}
|
||||
|
||||
@ -84,7 +88,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
function onSaveComplete(page) {
|
||||
loading.hide();
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
@ -116,9 +120,9 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
var page = $(this).parents('.page');
|
||||
const page = $(this).parents('.page');
|
||||
loading.show();
|
||||
var userId = getParameterByName('userId');
|
||||
const userId = getParameterByName('userId');
|
||||
ApiClient.getUser(userId).then(function (result) {
|
||||
saveUser(result, page);
|
||||
});
|
||||
@ -126,7 +130,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
}
|
||||
|
||||
$(document).on('pageinit', '#userLibraryAccessPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('#chkEnableAllDevices', page).on('change', function () {
|
||||
if (this.checked) {
|
||||
$('.deviceAccessListContainer', page).hide();
|
||||
@ -150,29 +154,30 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||
});
|
||||
$('.userLibraryAccessForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
}).on('pageshow', '#userLibraryAccessPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
loading.show();
|
||||
var promise1;
|
||||
var userId = getParameterByName('userId');
|
||||
let promise1;
|
||||
const userId = getParameterByName('userId');
|
||||
|
||||
if (userId) {
|
||||
promise1 = ApiClient.getUser(userId);
|
||||
} else {
|
||||
var deferred = $.Deferred();
|
||||
const deferred = $.Deferred();
|
||||
deferred.resolveWith(null, [{
|
||||
Configuration: {}
|
||||
}]);
|
||||
promise1 = deferred.promise();
|
||||
}
|
||||
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
var promise4 = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||
const promise2 = Dashboard.getCurrentUser();
|
||||
const promise4 = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||
IsHidden: false
|
||||
}));
|
||||
var promise5 = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||
var promise6 = ApiClient.getJSON(ApiClient.getUrl('Devices'));
|
||||
const promise5 = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||
const promise6 = ApiClient.getJSON(ApiClient.getUrl('Devices'));
|
||||
Promise.all([promise1, promise2, promise4, promise5, promise6]).then(function (responses) {
|
||||
loadUser(page, responses[0], responses[1], responses[2].Items, responses[3].Items, responses[4].Items);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,13 +1,17 @@
|
||||
define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import loading from 'loading';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-checkbox';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadMediaFolders(page, mediaFolders) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderLibraries') + '</h3>';
|
||||
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
||||
|
||||
for (var i = 0; i < mediaFolders.length; i++) {
|
||||
var folder = mediaFolders[i];
|
||||
for (let i = 0; i < mediaFolders.length; i++) {
|
||||
const folder = mediaFolders[i];
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '"/><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
@ -17,12 +21,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||
}
|
||||
|
||||
function loadChannels(page, channels) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderChannels') + '</h3>';
|
||||
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
||||
|
||||
for (var i = 0; i < channels.length; i++) {
|
||||
var folder = channels[i];
|
||||
for (let i = 0; i < channels.length; i++) {
|
||||
const folder = channels[i];
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '"/><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
@ -42,10 +46,10 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||
$('#txtUsername', page).val('');
|
||||
$('#txtPassword', page).val('');
|
||||
loading.show();
|
||||
var promiseFolders = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||
const promiseFolders = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||
IsHidden: false
|
||||
}));
|
||||
var promiseChannels = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||
const promiseChannels = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||
Promise.all([promiseFolders, promiseChannels]).then(function (responses) {
|
||||
loadMediaFolders(page, responses[0].Items);
|
||||
loadChannels(page, responses[1].Items);
|
||||
@ -54,7 +58,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||
}
|
||||
|
||||
function saveUser(page) {
|
||||
var user = {};
|
||||
const user = {};
|
||||
user.Name = $('#txtUsername', page).val();
|
||||
user.Password = $('#txtPassword', page).val();
|
||||
ApiClient.createUser(user).then(function (user) {
|
||||
@ -84,7 +88,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||
Dashboard.navigate('useredit.html?userId=' + user.Id);
|
||||
});
|
||||
}, function (response) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('DefaultErrorMessage'));
|
||||
});
|
||||
|
||||
@ -93,7 +97,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||
}
|
||||
|
||||
function onSubmit() {
|
||||
var page = $(this).parents('.page')[0];
|
||||
const page = $(this).parents('.page')[0];
|
||||
loading.show();
|
||||
saveUser(page);
|
||||
return false;
|
||||
@ -104,7 +108,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||
}
|
||||
|
||||
$(document).on('pageinit', '#newUserPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('#chkEnableAllChannels', page).on('change', function () {
|
||||
if (this.checked) {
|
||||
$('.channelAccessListContainer', page).hide();
|
||||
@ -123,4 +127,5 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||
}).on('pageshow', '#newUserPage', function () {
|
||||
loadData(this);
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,17 +1,22 @@
|
||||
define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewStyle', 'paper-icon-button-light'], function ($, datetime, loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import $ from 'jQuery';
|
||||
import datetime from 'datetime';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
import 'listViewStyle';
|
||||
import 'paper-icon-button-light';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function populateRatings(allParentalRatings, page) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<option value=''></option>";
|
||||
var i;
|
||||
var length;
|
||||
var rating;
|
||||
var ratings = [];
|
||||
let rating;
|
||||
const ratings = [];
|
||||
|
||||
for (i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
if (rating = allParentalRatings[i], ratings.length) {
|
||||
var lastRating = ratings[ratings.length - 1];
|
||||
const lastRating = ratings[ratings.length - 1];
|
||||
|
||||
if (lastRating.Value === rating.Value) {
|
||||
lastRating.Name += '/' + rating.Name;
|
||||
@ -25,7 +30,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
});
|
||||
}
|
||||
|
||||
for (i = 0, length = ratings.length; i < length; i++) {
|
||||
for (let i = 0, length = ratings.length; i < length; i++) {
|
||||
rating = ratings[i];
|
||||
html += "<option value='" + rating.Value + "'>" + rating.Name + '</option>';
|
||||
}
|
||||
@ -34,7 +39,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
}
|
||||
|
||||
function loadUnratedItems(page, user) {
|
||||
var items = [{
|
||||
const items = [{
|
||||
name: globalize.translate('OptionBlockBooks'),
|
||||
value: 'Book'
|
||||
}, {
|
||||
@ -56,13 +61,13 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
name: globalize.translate('OptionBlockTvShows'),
|
||||
value: 'Series'
|
||||
}];
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderBlockItemsWithNoRating') + '</h3>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var item = items[i];
|
||||
var checkedAttribute = -1 != user.Policy.BlockUnratedItems.indexOf(item.value) ? ' checked="checked"' : '';
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
const item = items[i];
|
||||
const checkedAttribute = -1 != user.Policy.BlockUnratedItems.indexOf(item.value) ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkUnratedItem" data-itemtype="' + item.value + '" type="checkbox"' + checkedAttribute + '><span>' + item.name + '</span></label>';
|
||||
}
|
||||
|
||||
@ -76,11 +81,11 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
loadUnratedItems(page, user);
|
||||
loadBlockedTags(page, user.Policy.BlockedTags);
|
||||
populateRatings(allParentalRatings, page);
|
||||
var ratingValue = '';
|
||||
let ratingValue = '';
|
||||
|
||||
if (user.Policy.MaxParentalRating) {
|
||||
for (var i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
var rating = allParentalRatings[i];
|
||||
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
const rating = allParentalRatings[i];
|
||||
|
||||
if (user.Policy.MaxParentalRating >= rating.Value) {
|
||||
ratingValue = rating.Value;
|
||||
@ -101,8 +106,8 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
}
|
||||
|
||||
function loadBlockedTags(page, tags) {
|
||||
var html = tags.map(function (h) {
|
||||
var li = '<div class="listItem">';
|
||||
let html = tags.map(function (h) {
|
||||
let li = '<div class="listItem">';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">';
|
||||
li += h;
|
||||
@ -116,10 +121,10 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
html = '<div class="paperList">' + html + '</div>';
|
||||
}
|
||||
|
||||
var elem = $('.blockedTags', page).html(html).trigger('create');
|
||||
const elem = $('.blockedTags', page).html(html).trigger('create');
|
||||
$('.btnDeleteTag', elem).on('click', function () {
|
||||
var tag = this.getAttribute('data-tag');
|
||||
var newTags = tags.filter(function (t) {
|
||||
const tag = this.getAttribute('data-tag');
|
||||
const newTags = tags.filter(function (t) {
|
||||
return t != tag;
|
||||
});
|
||||
loadBlockedTags(page, newTags);
|
||||
@ -132,10 +137,10 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
}
|
||||
|
||||
function renderAccessSchedule(page, schedules) {
|
||||
var html = '';
|
||||
var index = 0;
|
||||
let html = '';
|
||||
let index = 0;
|
||||
html += schedules.map(function (a) {
|
||||
var itemHtml = '';
|
||||
let itemHtml = '';
|
||||
itemHtml += '<div class="liSchedule listItem" data-day="' + a.DayOfWeek + '" data-start="' + a.StartHour + '" data-end="' + a.EndHour + '">';
|
||||
itemHtml += '<div class="listItemBody two-line">';
|
||||
itemHtml += '<h3 class="listItemBodyText">';
|
||||
@ -148,7 +153,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
index++;
|
||||
return itemHtml;
|
||||
}).join('');
|
||||
var accessScheduleList = page.querySelector('.accessScheduleList');
|
||||
const accessScheduleList = page.querySelector('.accessScheduleList');
|
||||
accessScheduleList.innerHTML = html;
|
||||
$('.btnDelete', accessScheduleList).on('click', function () {
|
||||
deleteAccessSchedule(page, schedules, parseInt(this.getAttribute('data-index')));
|
||||
@ -158,7 +163,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
function onSaveComplete(page) {
|
||||
loading.hide();
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('SettingsSaved'));
|
||||
});
|
||||
}
|
||||
@ -178,8 +183,8 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
}
|
||||
|
||||
function getDisplayTime(hours) {
|
||||
var minutes = 0;
|
||||
var pct = hours % 1;
|
||||
let minutes = 0;
|
||||
const pct = hours % 1;
|
||||
|
||||
if (pct) {
|
||||
minutes = parseInt(60 * pct);
|
||||
@ -190,12 +195,11 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
|
||||
function showSchedulePopup(page, schedule, index) {
|
||||
schedule = schedule || {};
|
||||
|
||||
require(['components/accessSchedule/accessSchedule'], function (accessschedule) {
|
||||
import('components/accessSchedule/accessSchedule').then(({default: accessschedule}) => {
|
||||
accessschedule.show({
|
||||
schedule: schedule
|
||||
}).then(function (updatedSchedule) {
|
||||
var schedules = getSchedulesFromPage(page);
|
||||
const schedules = getSchedulesFromPage(page);
|
||||
|
||||
if (-1 == index) {
|
||||
index = schedules.length;
|
||||
@ -224,11 +228,12 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
}
|
||||
|
||||
function showBlockedTagPopup(page) {
|
||||
require(['prompt'], function (prompt) {
|
||||
|
||||
import('prompt').then(({default: prompt}) => {
|
||||
prompt({
|
||||
label: globalize.translate('LabelTag')
|
||||
}).then(function (value) {
|
||||
var tags = getBlockedTagsFromPage(page);
|
||||
const tags = getBlockedTagsFromPage(page);
|
||||
|
||||
if (-1 == tags.indexOf(value)) {
|
||||
tags.push(value);
|
||||
@ -240,9 +245,9 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
|
||||
window.UserParentalControlPage = {
|
||||
onSubmit: function () {
|
||||
var page = $(this).parents('.page');
|
||||
const page = $(this).parents('.page');
|
||||
loading.show();
|
||||
var userId = getParameterByName('userId');
|
||||
const userId = getParameterByName('userId');
|
||||
ApiClient.getUser(userId).then(function (result) {
|
||||
saveUser(result, page);
|
||||
});
|
||||
@ -250,7 +255,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
}
|
||||
};
|
||||
$(document).on('pageinit', '#userParentalControlPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('.btnAddSchedule', page).on('click', function () {
|
||||
showSchedulePopup(page, {}, -1);
|
||||
});
|
||||
@ -259,13 +264,14 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||
});
|
||||
$('.userParentalControlForm').off('submit', UserParentalControlPage.onSubmit).on('submit', UserParentalControlPage.onSubmit);
|
||||
}).on('pageshow', '#userParentalControlPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
loading.show();
|
||||
var userId = getParameterByName('userId');
|
||||
var promise1 = ApiClient.getUser(userId);
|
||||
var promise2 = ApiClient.getParentalRatings();
|
||||
const userId = getParameterByName('userId');
|
||||
const promise1 = ApiClient.getUser(userId);
|
||||
const promise2 = ApiClient.getParentalRatings();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
loadUser(page, responses[0], responses[1]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,14 +1,18 @@
|
||||
define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading, libraryMenu, globalize) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import libraryMenu from 'libraryMenu';
|
||||
import globalize from 'globalize';
|
||||
import 'emby-button';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function loadUser(page, params) {
|
||||
var userid = params.userId;
|
||||
const userid = params.userId;
|
||||
ApiClient.getUser(userid).then(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (loggedInUser) {
|
||||
libraryMenu.setTitle(user.Name);
|
||||
page.querySelector('.username').innerHTML = user.Name;
|
||||
var showPasswordSection = true;
|
||||
var showLocalAccessSection = false;
|
||||
let showPasswordSection = true;
|
||||
let showLocalAccessSection = false;
|
||||
|
||||
if ('Guest' == user.ConnectLinkType) {
|
||||
page.querySelector('.localAccessSection').classList.add('hide');
|
||||
@ -34,7 +38,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
page.querySelector('.localAccessSection').classList.add('hide');
|
||||
}
|
||||
|
||||
var txtEasyPassword = page.querySelector('#txtEasyPassword');
|
||||
const txtEasyPassword = page.querySelector('#txtEasyPassword');
|
||||
txtEasyPassword.value = '';
|
||||
|
||||
if (user.HasConfiguredEasyPassword) {
|
||||
@ -48,7 +52,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
|
||||
page.querySelector('.chkEnableLocalEasyPassword').checked = user.Configuration.EnableLocalPassword;
|
||||
|
||||
require(['autoFocuser'], function (autoFocuser) {
|
||||
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||
autoFocuser.autoFocus(page);
|
||||
});
|
||||
});
|
||||
@ -58,10 +62,10 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
page.querySelector('#txtNewPasswordConfirm').value = '';
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
export default function (view, params) {
|
||||
function saveEasyPassword() {
|
||||
var userId = params.userId;
|
||||
var easyPassword = view.querySelector('#txtEasyPassword').value;
|
||||
const userId = params.userId;
|
||||
const easyPassword = view.querySelector('#txtEasyPassword').value;
|
||||
|
||||
if (easyPassword) {
|
||||
ApiClient.updateEasyPassword(userId, easyPassword).then(function () {
|
||||
@ -78,7 +82,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
||||
loading.hide();
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('MessageSettingsSaved'));
|
||||
});
|
||||
|
||||
@ -88,9 +92,9 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
}
|
||||
|
||||
function savePassword() {
|
||||
var userId = params.userId;
|
||||
var currentPassword = view.querySelector('#txtCurrentPassword').value;
|
||||
var newPassword = view.querySelector('#txtNewPassword').value;
|
||||
const userId = params.userId;
|
||||
let currentPassword = view.querySelector('#txtCurrentPassword').value;
|
||||
const newPassword = view.querySelector('#txtNewPassword').value;
|
||||
|
||||
if (view.querySelector('#fldCurrentPassword').classList.contains('hide')) {
|
||||
// Firefox does not respect autocomplete=off, so clear it if the field is supposed to be hidden (and blank)
|
||||
@ -101,7 +105,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
ApiClient.updateUserPassword(userId, currentPassword, newPassword).then(function () {
|
||||
loading.hide();
|
||||
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('PasswordSaved'));
|
||||
});
|
||||
|
||||
@ -116,10 +120,10 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
var form = this;
|
||||
const form = this;
|
||||
|
||||
if (form.querySelector('#txtNewPassword').value != form.querySelector('#txtNewPasswordConfirm').value) {
|
||||
require(['toast'], function (toast) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
toast(globalize.translate('PasswordMatchError'));
|
||||
});
|
||||
} else {
|
||||
@ -139,11 +143,10 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
}
|
||||
|
||||
function resetPassword() {
|
||||
var msg = globalize.translate('PasswordResetConfirmation');
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
const msg = globalize.translate('PasswordResetConfirmation');
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm(msg, globalize.translate('PasswordResetHeader')).then(function () {
|
||||
var userId = params.userId;
|
||||
const userId = params.userId;
|
||||
loading.show();
|
||||
ApiClient.resetUserPassword(userId).then(function () {
|
||||
loading.hide();
|
||||
@ -158,11 +161,11 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
}
|
||||
|
||||
function resetEasyPassword() {
|
||||
var msg = globalize.translate('PinCodeResetConfirmation');
|
||||
const msg = globalize.translate('PinCodeResetConfirmation');
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm(msg, globalize.translate('HeaderPinCodeReset')).then(function () {
|
||||
var userId = params.userId;
|
||||
const userId = params.userId;
|
||||
loading.show();
|
||||
ApiClient.resetEasyPassword(userId).then(function () {
|
||||
loading.hide();
|
||||
@ -183,5 +186,6 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||
view.addEventListener('viewshow', function () {
|
||||
loadUser(view, params);
|
||||
});
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
@ -1,10 +1,20 @@
|
||||
define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-button-light', 'cardStyle', 'emby-button', 'indicators', 'flexStyles'], function (loading, dom, globalize, datefns, dfnshelper) {
|
||||
'use strict';
|
||||
import loading from 'loading';
|
||||
import dom from 'dom';
|
||||
import globalize from 'globalize';
|
||||
import * as datefns from 'date-fns';
|
||||
import dfnshelper from 'dfnshelper';
|
||||
import 'paper-icon-button-light';
|
||||
import 'cardStyle';
|
||||
import 'emby-button';
|
||||
import 'indicators';
|
||||
import 'flexStyles';
|
||||
|
||||
/* eslint-disable indent */
|
||||
|
||||
function deleteUser(page, id) {
|
||||
var msg = globalize.translate('DeleteUserConfirmation');
|
||||
const msg = globalize.translate('DeleteUserConfirmation');
|
||||
|
||||
require(['confirm'], function (confirm) {
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
title: globalize.translate('DeleteUser'),
|
||||
text: msg,
|
||||
@ -20,10 +30,10 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
}
|
||||
|
||||
function showUserMenu(elem) {
|
||||
var card = dom.parentWithClass(elem, 'card');
|
||||
var page = dom.parentWithClass(card, 'page');
|
||||
var userId = card.getAttribute('data-userid');
|
||||
var menuItems = [];
|
||||
const card = dom.parentWithClass(elem, 'card');
|
||||
const page = dom.parentWithClass(card, 'page');
|
||||
const userId = card.getAttribute('data-userid');
|
||||
const menuItems = [];
|
||||
menuItems.push({
|
||||
name: globalize.translate('ButtonOpen'),
|
||||
id: 'open',
|
||||
@ -45,7 +55,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
icon: 'delete'
|
||||
});
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: card,
|
||||
@ -72,8 +82,8 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
}
|
||||
|
||||
function getUserHtml(user, addConnectIndicator) {
|
||||
var html = '';
|
||||
var cssClass = 'card squareCard scalableCard squareCard-scalable';
|
||||
let html = '';
|
||||
let cssClass = 'card squareCard scalableCard squareCard-scalable';
|
||||
|
||||
if (user.Policy.IsDisabled) {
|
||||
cssClass += ' grayscale';
|
||||
@ -84,7 +94,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||
html += '<div class="cardPadder cardPadder-square"></div>';
|
||||
html += '<a is="emby-linkbutton" class="cardContent" href="useredit.html?userId=' + user.Id + '">';
|
||||
var imgUrl;
|
||||
let imgUrl;
|
||||
|
||||
if (user.PrimaryImageTag) {
|
||||
imgUrl = ApiClient.getUserImageUrl(user.Id, {
|
||||
@ -94,7 +104,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
});
|
||||
}
|
||||
|
||||
var imageClass = 'cardImage';
|
||||
let imageClass = 'cardImage';
|
||||
|
||||
if (user.Policy.IsDisabled) {
|
||||
imageClass += ' disabledUser';
|
||||
@ -118,7 +128,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
html += '<button type="button" is="paper-icon-button-light" class="btnUserMenu flex-shrink-zero"><span class="material-icons more_vert"></span></button>';
|
||||
html += '</div>';
|
||||
html += '<div class="cardText cardText-secondary">';
|
||||
var lastSeen = getLastSeenText(user.LastActivityDate);
|
||||
const lastSeen = getLastSeenText(user.LastActivityDate);
|
||||
html += '' != lastSeen ? lastSeen : ' ';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
@ -146,17 +156,17 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
}
|
||||
|
||||
function showPendingUserMenu(elem) {
|
||||
var menuItems = [];
|
||||
const menuItems = [];
|
||||
menuItems.push({
|
||||
name: globalize.translate('ButtonCancel'),
|
||||
id: 'delete',
|
||||
icon: 'delete'
|
||||
});
|
||||
|
||||
require(['actionsheet'], function (actionsheet) {
|
||||
var card = dom.parentWithClass(elem, 'card');
|
||||
var page = dom.parentWithClass(card, 'page');
|
||||
var id = card.getAttribute('data-id');
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
const card = dom.parentWithClass(elem, 'card');
|
||||
const page = dom.parentWithClass(card, 'page');
|
||||
const id = card.getAttribute('data-id');
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: card,
|
||||
@ -171,7 +181,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
}
|
||||
|
||||
function getPendingUserHtml(user) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<div data-id='" + user.Id + "' class='card squareCard scalableCard squareCard-scalable'>";
|
||||
html += '<div class="cardBox cardBox-bottompadded visualCardBox">';
|
||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||
@ -236,7 +246,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
}
|
||||
|
||||
function showInvitePopup(page) {
|
||||
require(['components/guestinviter/guestinviter'], function (guestinviter) {
|
||||
import('components/guestinviter/guestinviter').then(({default: guestinviter}) => {
|
||||
guestinviter.show().then(function () {
|
||||
loadData(page);
|
||||
});
|
||||
@ -244,19 +254,19 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
}
|
||||
|
||||
pageIdOn('pageinit', 'userProfilesPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
page.querySelector('.btnAddUser').addEventListener('click', function() {
|
||||
Dashboard.navigate('usernew.html');
|
||||
});
|
||||
page.querySelector('.localUsers').addEventListener('click', function (e__e) {
|
||||
var btnUserMenu = dom.parentWithClass(e__e.target, 'btnUserMenu');
|
||||
const btnUserMenu = dom.parentWithClass(e__e.target, 'btnUserMenu');
|
||||
|
||||
if (btnUserMenu) {
|
||||
showUserMenu(btnUserMenu);
|
||||
}
|
||||
});
|
||||
page.querySelector('.pending').addEventListener('click', function (e__r) {
|
||||
var btnUserMenu = dom.parentWithClass(e__r.target, 'btnUserMenu');
|
||||
const btnUserMenu = dom.parentWithClass(e__r.target, 'btnUserMenu');
|
||||
|
||||
if (btnUserMenu) {
|
||||
showPendingUserMenu(btnUserMenu);
|
||||
@ -266,4 +276,5 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||
pageIdOn('pagebeforeshow', 'userProfilesPage', function () {
|
||||
loadData(this);
|
||||
});
|
||||
});
|
||||
|
||||
/* eslint-enable indent */
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user