Merge branch 'es6' into migrate-to-ES6-28
This commit is contained in:
commit
e2391aabb2
76 changed files with 2074 additions and 1609 deletions
65
package.json
65
package.json
|
@ -92,25 +92,37 @@
|
||||||
"test": [
|
"test": [
|
||||||
"src/components/accessSchedule/accessSchedule.js",
|
"src/components/accessSchedule/accessSchedule.js",
|
||||||
"src/components/actionSheet/actionSheet.js",
|
"src/components/actionSheet/actionSheet.js",
|
||||||
|
"src/components/activitylog.js",
|
||||||
|
"src/components/alert.js",
|
||||||
"src/components/alphaPicker/alphaPicker.js",
|
"src/components/alphaPicker/alphaPicker.js",
|
||||||
|
"src/components/appFooter/appFooter.js",
|
||||||
"src/components/autoFocuser.js",
|
"src/components/autoFocuser.js",
|
||||||
"src/components/backdrop/backdrop.js",
|
"src/components/backdrop/backdrop.js",
|
||||||
"src/components/cardbuilder/cardBuilder.js",
|
"src/components/cardbuilder/cardBuilder.js",
|
||||||
"src/components/cardbuilder/chaptercardbuilder.js",
|
"src/components/cardbuilder/chaptercardbuilder.js",
|
||||||
"src/components/cardbuilder/peoplecardbuilder.js",
|
"src/components/cardbuilder/peoplecardbuilder.js",
|
||||||
|
"src/components/channelMapper/channelMapper.js",
|
||||||
|
"src/components/confirm/confirm.js",
|
||||||
|
"src/components/displaySettings/displaySettings.js",
|
||||||
|
"src/components/homeScreenSettings/homeScreenSettings.js",
|
||||||
"src/components/directorybrowser/directorybrowser.js",
|
"src/components/directorybrowser/directorybrowser.js",
|
||||||
"src/components/collectionEditor/collectionEditor.js",
|
"src/components/collectionEditor/collectionEditor.js",
|
||||||
"src/components/dialog/dialog.js",
|
"src/components/dialog/dialog.js",
|
||||||
|
"src/components/directorybrowser/directorybrowser.js",
|
||||||
"src/components/dialogHelper/dialogHelper.js",
|
"src/components/dialogHelper/dialogHelper.js",
|
||||||
"src/components/channelMapper/channelMapper.js",
|
"src/components/homesections/homesections.js",
|
||||||
"src/components/images/imageLoader.js",
|
"src/components/images/imageLoader.js",
|
||||||
"src/components/imageUploader/imageUploader.js",
|
"src/components/imageUploader/imageUploader.js",
|
||||||
"src/components/indicators/indicators.js",
|
"src/components/indicators/indicators.js",
|
||||||
|
"src/components/itemContextMenu.js",
|
||||||
"src/components/itemidentifier/itemidentifier.js",
|
"src/components/itemidentifier/itemidentifier.js",
|
||||||
"src/components/itemMediaInfo/itemMediaInfo.js",
|
"src/components/itemMediaInfo/itemMediaInfo.js",
|
||||||
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
"src/components/lazyLoader/lazyLoaderIntersectionObserver.js",
|
||||||
|
"src/components/multiSelect/multiSelect.js",
|
||||||
|
"src/components/maintabsmanager.js",
|
||||||
"src/components/mediaLibraryCreator/mediaLibraryCreator.js",
|
"src/components/mediaLibraryCreator/mediaLibraryCreator.js",
|
||||||
"src/components/mediaLibraryEditor/mediaLibraryEditor.js",
|
"src/components/mediaLibraryEditor/mediaLibraryEditor.js",
|
||||||
|
"src/components/nowPlayingBar/nowPlayingBar.js",
|
||||||
"src/components/listview/listview.js",
|
"src/components/listview/listview.js",
|
||||||
"src/components/playback/brightnessosd.js",
|
"src/components/playback/brightnessosd.js",
|
||||||
"src/components/playback/mediasession.js",
|
"src/components/playback/mediasession.js",
|
||||||
|
@ -121,12 +133,16 @@
|
||||||
"src/components/playback/playmethodhelper.js",
|
"src/components/playback/playmethodhelper.js",
|
||||||
"src/components/playback/remotecontrolautoplay.js",
|
"src/components/playback/remotecontrolautoplay.js",
|
||||||
"src/components/playback/volumeosd.js",
|
"src/components/playback/volumeosd.js",
|
||||||
|
"src/components/prompt/prompt.js",
|
||||||
|
"src/components/playbackSettings/playbackSettings.js",
|
||||||
"src/components/playlisteditor/playlisteditor.js",
|
"src/components/playlisteditor/playlisteditor.js",
|
||||||
"src/components/groupedcards.js",
|
"src/components/groupedcards.js",
|
||||||
"src/components/htmlMediaHelper.js",
|
"src/components/htmlMediaHelper.js",
|
||||||
"src/components/playmenu.js",
|
"src/components/playmenu.js",
|
||||||
"src/components/sanatizefilename.js",
|
"src/components/sanatizefilename.js",
|
||||||
"src/components/scrollManager.js",
|
"src/components/scrollManager.js",
|
||||||
|
"src/components/search/searchfields.js",
|
||||||
|
"src/components/search/searchresults.js",
|
||||||
"src/components/settingshelper.js",
|
"src/components/settingshelper.js",
|
||||||
"src/components/subtitlesettings/subtitlesettings.js",
|
"src/components/subtitlesettings/subtitlesettings.js",
|
||||||
"src/components/subtitlesettings/subtitleappearancehelper.js",
|
"src/components/subtitlesettings/subtitleappearancehelper.js",
|
||||||
|
@ -135,28 +151,73 @@
|
||||||
"src/components/syncPlay/playbackPermissionManager.js",
|
"src/components/syncPlay/playbackPermissionManager.js",
|
||||||
"src/components/syncPlay/syncPlayManager.js",
|
"src/components/syncPlay/syncPlayManager.js",
|
||||||
"src/components/syncPlay/timeSyncManager.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/apikeys.js",
|
||||||
"src/controllers/dashboard/dashboard.js",
|
"src/controllers/dashboard/dashboard.js",
|
||||||
"src/controllers/dashboard/encodingsettings.js",
|
"src/controllers/dashboard/encodingsettings.js",
|
||||||
"src/controllers/dashboard/logs.js",
|
"src/controllers/dashboard/logs.js",
|
||||||
"src/controllers/user/subtitles.js",
|
"src/controllers/user/subtitles.js",
|
||||||
|
"src/controllers/dashboard/general.js",
|
||||||
|
"src/controllers/dashboard/librarydisplay.js",
|
||||||
|
"src/controllers/dashboard/metadataImages.js",
|
||||||
|
"src/controllers/dashboard/metadatanfo.js",
|
||||||
"src/controllers/dashboard/plugins/repositories.js",
|
"src/controllers/dashboard/plugins/repositories.js",
|
||||||
|
"src/controllers/dashboard/streaming.js",
|
||||||
|
"src/controllers/dashboard/mediaLibrary.js",
|
||||||
|
"src/controllers/dashboard/networking.js",
|
||||||
|
"src/controllers/dashboard/playback.js",
|
||||||
|
"src/controllers/dashboard/plugins/repositories.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/searchpage.js",
|
||||||
|
"src/controllers/dashboard/scheduledtasks/scheduledtask.js",
|
||||||
|
"src/controllers/dashboard/scheduledtasks/scheduledtasks.js",
|
||||||
|
"src/controllers/dashboard/dlna/profile.js",
|
||||||
|
"src/controllers/dashboard/dlna/profiles.js",
|
||||||
|
"src/controllers/dashboard/dlna/settings.js",
|
||||||
|
"src/controllers/dashboard/devices/devices.js",
|
||||||
|
"src/controllers/dashboard/devices/device.js",
|
||||||
|
"src/controllers/dashboard/serveractivity.js",
|
||||||
"src/elements/emby-tabs/emby-tabs.js",
|
"src/elements/emby-tabs/emby-tabs.js",
|
||||||
"src/elements/emby-scroller/emby-scroller.js",
|
"src/elements/emby-scroller/emby-scroller.js",
|
||||||
"src/elements/emby-radio/emby-radio.js",
|
"src/elements/emby-radio/emby-radio.js",
|
||||||
|
"src/elements/emby-checkbox/emby-checkbox.js",
|
||||||
|
"src/elements/emby-itemrefreshindicator/emby-itemrefreshindicator.js",
|
||||||
"src/elements/emby-progressbar/emby-progressbar.js",
|
"src/elements/emby-progressbar/emby-progressbar.js",
|
||||||
"src/elements/emby-progressring/emby-progressring.js",
|
"src/elements/emby-progressring/emby-progressring.js",
|
||||||
"src/elements/emby-itemrefreshindicator/emby-itemrefreshindicator.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-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-slider/emby-slider.js",
|
||||||
"src/elements/emby-checkbox/emby-checkbox.js",
|
"src/elements/emby-tabs/emby-tabs.js",
|
||||||
"src/elements/emby-textarea/emby-textarea.js",
|
"src/elements/emby-textarea/emby-textarea.js",
|
||||||
"src/elements/emby-toggle/emby-toggle.js",
|
"src/elements/emby-toggle/emby-toggle.js",
|
||||||
|
"src/elements/emby-button/emby-button.js",
|
||||||
|
"src/elements/emby-button/paper-icon-button-light.js",
|
||||||
|
"src/elements/emby-collapse/emby-collapse.js",
|
||||||
|
"src/elements/emby-input/emby-input.js",
|
||||||
"src/plugins/bookPlayer/plugin.js",
|
"src/plugins/bookPlayer/plugin.js",
|
||||||
"src/plugins/bookPlayer/tableOfContents.js",
|
"src/plugins/bookPlayer/tableOfContents.js",
|
||||||
"src/plugins/photoPlayer/plugin.js",
|
"src/plugins/photoPlayer/plugin.js",
|
||||||
"src/scripts/settings/appSettings.js",
|
"src/scripts/settings/appSettings.js",
|
||||||
"src/scripts/settings/userSettings.js",
|
"src/scripts/settings/userSettings.js",
|
||||||
"src/scripts/settings/webSettings.js",
|
"src/scripts/settings/webSettings.js",
|
||||||
|
"src/scripts/datetime.js",
|
||||||
"src/scripts/deleteHelper.js",
|
"src/scripts/deleteHelper.js",
|
||||||
"src/scripts/dfnshelper.js",
|
"src/scripts/dfnshelper.js",
|
||||||
"src/scripts/dom.js",
|
"src/scripts/dom.js",
|
||||||
|
|
|
@ -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) {
|
import events from 'events';
|
||||||
'use strict';
|
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) {
|
function getEntryHtml(entry, apiClient) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="listItem listItem-border">';
|
html += '<div class="listItem listItem-border">';
|
||||||
var color = '#00a4dc';
|
let color = '#00a4dc';
|
||||||
var icon = 'notifications';
|
let icon = 'notifications';
|
||||||
|
|
||||||
if ('Error' == entry.Severity || 'Fatal' == entry.Severity || 'Warn' == entry.Severity) {
|
if ('Error' == entry.Severity || 'Fatal' == entry.Severity || 'Warn' == entry.Severity) {
|
||||||
color = '#cc0000';
|
color = '#cc0000';
|
||||||
|
@ -56,8 +66,8 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
}
|
}
|
||||||
|
|
||||||
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
limit = limit || parseInt(elem.getAttribute('data-activitylimit') || '7');
|
||||||
var minDate = new Date();
|
const minDate = new Date();
|
||||||
var hasUserId = 'false' !== elem.getAttribute('data-useractivity');
|
const hasUserId = 'false' !== elem.getAttribute('data-useractivity');
|
||||||
|
|
||||||
if (hasUserId) {
|
if (hasUserId) {
|
||||||
minDate.setTime(minDate.getTime() - 24 * 60 * 60 * 1000); // one day back
|
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-activitystartindex', startIndex);
|
||||||
elem.setAttribute('data-activitylimit', limit);
|
elem.setAttribute('data-activitylimit', limit);
|
||||||
if (!startIndex) {
|
if (!startIndex) {
|
||||||
var activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
const activityContainer = dom.parentWithClass(elem, 'activityContainer');
|
||||||
|
|
||||||
if (activityContainer) {
|
if (activityContainer) {
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
|
@ -91,7 +101,7 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onActivityLogUpdate(e, apiClient, data) {
|
function onActivityLogUpdate(e, apiClient, data) {
|
||||||
var options = this.options;
|
const options = this.options;
|
||||||
|
|
||||||
if (options && options.serverId === apiClient.serverId()) {
|
if (options && options.serverId === apiClient.serverId()) {
|
||||||
reloadData(this, options.element, apiClient);
|
reloadData(this, options.element, apiClient);
|
||||||
|
@ -99,14 +109,14 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onListClick(e) {
|
function onListClick(e) {
|
||||||
var btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
const btnEntryInfo = dom.parentWithClass(e.target, 'btnEntryInfo');
|
||||||
|
|
||||||
if (btnEntryInfo) {
|
if (btnEntryInfo) {
|
||||||
var id = btnEntryInfo.getAttribute('data-id');
|
const id = btnEntryInfo.getAttribute('data-id');
|
||||||
var items = this.items;
|
const items = this.items;
|
||||||
|
|
||||||
if (items) {
|
if (items) {
|
||||||
var item = items.filter(function (i) {
|
const item = items.filter(function (i) {
|
||||||
return i.Id.toString() === id;
|
return i.Id.toString() === id;
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
|
@ -118,35 +128,35 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
}
|
}
|
||||||
|
|
||||||
function showItemOverview(item) {
|
function showItemOverview(item) {
|
||||||
require(['alert'], function (alert) {
|
import('alert').then(({default: alert}) => {
|
||||||
alert({
|
alert({
|
||||||
text: item.Overview
|
text: item.Overview
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function ActivityLog(options) {
|
class ActivityLog {
|
||||||
|
constructor(options) {
|
||||||
this.options = options;
|
this.options = options;
|
||||||
var element = options.element;
|
const element = options.element;
|
||||||
element.classList.add('activityLogListWidget');
|
element.classList.add('activityLogListWidget');
|
||||||
element.addEventListener('click', onListClick.bind(this));
|
element.addEventListener('click', onListClick.bind(this));
|
||||||
var apiClient = connectionManager.getApiClient(options.serverId);
|
const apiClient = connectionManager.getApiClient(options.serverId);
|
||||||
reloadData(this, element, apiClient);
|
reloadData(this, element, apiClient);
|
||||||
var onUpdate = onActivityLogUpdate.bind(this);
|
const onUpdate = onActivityLogUpdate.bind(this);
|
||||||
this.updateFn = onUpdate;
|
this.updateFn = onUpdate;
|
||||||
events.on(serverNotifications, 'ActivityLogEntry', onUpdate);
|
events.on(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||||
apiClient.sendMessage('ActivityLogEntryStart', '0,1500');
|
apiClient.sendMessage('ActivityLogEntryStart', '0,1500');
|
||||||
}
|
}
|
||||||
|
destroy() {
|
||||||
ActivityLog.prototype.destroy = function () {
|
const options = this.options;
|
||||||
var options = this.options;
|
|
||||||
|
|
||||||
if (options) {
|
if (options) {
|
||||||
options.element.classList.remove('activityLogListWidget');
|
options.element.classList.remove('activityLogListWidget');
|
||||||
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
connectionManager.getApiClient(options.serverId).sendMessage('ActivityLogEntryStop', '0,1500');
|
||||||
}
|
}
|
||||||
|
|
||||||
var onUpdate = this.updateFn;
|
const onUpdate = this.updateFn;
|
||||||
|
|
||||||
if (onUpdate) {
|
if (onUpdate) {
|
||||||
events.off(serverNotifications, 'ActivityLogEntry', onUpdate);
|
events.off(serverNotifications, 'ActivityLogEntry', onUpdate);
|
||||||
|
@ -154,7 +164,9 @@ define(['events', 'globalize', 'dom', 'date-fns', 'dfnshelper', 'userSettings',
|
||||||
|
|
||||||
this.items = null;
|
this.items = null;
|
||||||
this.options = null;
|
this.options = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ActivityLog;
|
export default ActivityLog;
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,14 +1,17 @@
|
||||||
define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import dialog from 'dialog';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function replaceAll(originalString, strReplace, strWith) {
|
function replaceAll(originalString, strReplace, strWith) {
|
||||||
var reg = new RegExp(strReplace, 'ig');
|
const reg = new RegExp(strReplace, 'ig');
|
||||||
return originalString.replace(reg, strWith);
|
return originalString.replace(reg, strWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (text, title) {
|
export default function (text, title) {
|
||||||
|
|
||||||
var options;
|
let options;
|
||||||
if (typeof text === 'string') {
|
if (typeof text === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -21,7 +24,7 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||||
if (browser.tv && window.alert) {
|
if (browser.tv && window.alert) {
|
||||||
alert(replaceAll(options.text || '', '<br/>', '\n'));
|
alert(replaceAll(options.text || '', '<br/>', '\n'));
|
||||||
} else {
|
} else {
|
||||||
var items = [];
|
const items = [];
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
name: globalize.translate('ButtonGotIt'),
|
name: globalize.translate('ButtonGotIt'),
|
||||||
|
@ -41,5 +44,6 @@ define(['browser', 'dialog', 'globalize'], function (browser, dialog, globalize)
|
||||||
}
|
}
|
||||||
|
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,17 +1,18 @@
|
||||||
define(['browser', 'css!./appFooter'], function (browser) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import 'css!./appFooter';
|
||||||
|
|
||||||
function render(options) {
|
function render(options) {
|
||||||
var elem = document.createElement('div');
|
const elem = document.createElement('div');
|
||||||
elem.classList.add('appfooter');
|
elem.classList.add('appfooter');
|
||||||
|
|
||||||
document.body.appendChild(elem);
|
document.body.appendChild(elem);
|
||||||
|
|
||||||
return elem;
|
return elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
function appFooter(options) {
|
class appFooter {
|
||||||
var self = this;
|
constructor(options) {
|
||||||
|
const self = this;
|
||||||
|
|
||||||
self.element = render(options);
|
self.element = render(options);
|
||||||
self.add = function (elem) {
|
self.add = function (elem) {
|
||||||
|
@ -26,12 +27,11 @@ define(['browser', 'css!./appFooter'], function (browser) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
destroy() {
|
||||||
appFooter.prototype.destroy = function () {
|
|
||||||
var self = this;
|
var self = this;
|
||||||
|
|
||||||
self.element = null;
|
self.element = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return appFooter;
|
export default new appFooter;
|
||||||
});
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ define(['loading', 'globalize', 'events', 'viewManager', 'skinManager', 'backdro
|
||||||
break;
|
break;
|
||||||
case 'ServerUpdateNeeded':
|
case 'ServerUpdateNeeded':
|
||||||
require(['alert'], function (alert) {
|
require(['alert'], function (alert) {
|
||||||
alert({
|
alert.default({
|
||||||
text: globalize.translate('ServerUpdateNeeded', 'https://github.com/jellyfin/jellyfin'),
|
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>')
|
html: globalize.translate('ServerUpdateNeeded', '<a href="https://github.com/jellyfin/jellyfin">https://github.com/jellyfin/jellyfin</a>')
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import dialog from 'dialog';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
export default (() => {
|
||||||
|
|
||||||
function replaceAll(str, find, replace) {
|
function replaceAll(str, find, replace) {
|
||||||
return str.split(find).join(replace);
|
return str.split(find).join(replace);
|
||||||
|
@ -7,7 +11,7 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
|
|
||||||
if (browser.tv && window.confirm) {
|
if (browser.tv && window.confirm) {
|
||||||
// Use the native confirm dialog
|
// Use the native confirm dialog
|
||||||
return function (options) {
|
return options => {
|
||||||
if (typeof options === 'string') {
|
if (typeof options === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: '',
|
title: '',
|
||||||
|
@ -15,8 +19,8 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = replaceAll(options.text || '', '<br/>', '\n');
|
const text = replaceAll(options.text || '', '<br/>', '\n');
|
||||||
var result = confirm(text);
|
const result = confirm(text);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
|
@ -26,8 +30,8 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
// Use our own dialog
|
// Use our own dialog
|
||||||
return function (text, title) {
|
return (text, title) => {
|
||||||
var options;
|
let options;
|
||||||
if (typeof text === 'string') {
|
if (typeof text === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: title,
|
title: title,
|
||||||
|
@ -37,7 +41,7 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
options = text;
|
options = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
var items = [];
|
const items = [];
|
||||||
|
|
||||||
items.push({
|
items.push({
|
||||||
name: options.cancelText || globalize.translate('ButtonCancel'),
|
name: options.cancelText || globalize.translate('ButtonCancel'),
|
||||||
|
@ -53,7 +57,7 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
|
|
||||||
options.buttons = items;
|
options.buttons = items;
|
||||||
|
|
||||||
return dialog.show(options).then(function (result) {
|
return dialog.show(options).then(result => {
|
||||||
if (result === 'ok') {
|
if (result === 'ok') {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
@ -62,4 +66,5 @@ define(['browser', 'dialog', 'globalize'], function(browser, dialog, globalize)
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
})();
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -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) {
|
import browser from 'browser';
|
||||||
'use strict';
|
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) {
|
function fillThemes(select, isDashboard) {
|
||||||
select.innerHTML = skinManager.getThemes().map(function (t) {
|
select.innerHTML = skinManager.getThemes().map(t => {
|
||||||
var value = t.id;
|
let value = t.id;
|
||||||
if (t.isDefault && !isDashboard) {
|
if (t.isDefault && !isDashboard) {
|
||||||
value = '';
|
value = '';
|
||||||
} else if (t.isDefaultServerDashboard && isDashboard) {
|
} else if (t.isDefaultServerDashboard && isDashboard) {
|
||||||
value = '';
|
value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return '<option value="' + value + '">' + t.name + '</option>';
|
return `<option value="${value}">${t.name}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadScreensavers(context, userSettings) {
|
function loadScreensavers(context, userSettings) {
|
||||||
var selectScreensaver = context.querySelector('.selectScreensaver');
|
const selectScreensaver = context.querySelector('.selectScreensaver');
|
||||||
var options = pluginManager.ofType('screensaver').map(function (plugin) {
|
const options = pluginManager.ofType('screensaver').map(plugin => {
|
||||||
return {
|
return {
|
||||||
name: plugin.name,
|
name: plugin.name,
|
||||||
value: plugin.id
|
value: plugin.id
|
||||||
|
@ -28,8 +43,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
value: 'none'
|
value: 'none'
|
||||||
});
|
});
|
||||||
|
|
||||||
selectScreensaver.innerHTML = options.map(function (o) {
|
selectScreensaver.innerHTML = options.map(o => {
|
||||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
return `<option value="${o.value}">${o.name}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
selectScreensaver.value = userSettings.screensaver();
|
selectScreensaver.value = userSettings.screensaver();
|
||||||
|
|
||||||
|
@ -41,8 +56,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
|
|
||||||
function loadSoundEffects(context, userSettings) {
|
function loadSoundEffects(context, userSettings) {
|
||||||
|
|
||||||
var selectSoundEffects = context.querySelector('.selectSoundEffects');
|
const selectSoundEffects = context.querySelector('.selectSoundEffects');
|
||||||
var options = pluginManager.ofType('soundeffects').map(function (plugin) {
|
const options = pluginManager.ofType('soundeffects').map(plugin => {
|
||||||
return {
|
return {
|
||||||
name: plugin.name,
|
name: plugin.name,
|
||||||
value: plugin.id
|
value: plugin.id
|
||||||
|
@ -54,8 +69,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
value: 'none'
|
value: 'none'
|
||||||
});
|
});
|
||||||
|
|
||||||
selectSoundEffects.innerHTML = options.map(function (o) {
|
selectSoundEffects.innerHTML = options.map(o => {
|
||||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
return `<option value="${o.value}">${o.name}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
selectSoundEffects.value = userSettings.soundEffects();
|
selectSoundEffects.value = userSettings.soundEffects();
|
||||||
|
|
||||||
|
@ -67,17 +82,17 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
|
|
||||||
function loadSkins(context, userSettings) {
|
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 {
|
return {
|
||||||
name: plugin.name,
|
name: plugin.name,
|
||||||
value: plugin.id
|
value: plugin.id
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
||||||
selectSkin.innerHTML = options.map(function (o) {
|
selectSkin.innerHTML = options.map(o => {
|
||||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
return `<option value="${o.value}">${o.name}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
selectSkin.value = userSettings.skin();
|
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) {
|
if (browser.tizen || browser.web0s) {
|
||||||
context.querySelector('.fldDisplayMissingEpisodes').classList.add('hide');
|
context.querySelector('.fldDisplayMissingEpisodes').classList.add('hide');
|
||||||
|
@ -102,10 +117,7 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
context.querySelector('.fldDisplayMissingEpisodes').classList.remove('hide');
|
context.querySelector('.fldDisplayMissingEpisodes').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadForm(context, user, userSettings, apiClient) {
|
function loadForm(context, user, userSettings) {
|
||||||
|
|
||||||
var loggedInUserId = apiClient.getCurrentUserId();
|
|
||||||
var userId = user.Id;
|
|
||||||
|
|
||||||
if (user.Policy.IsAdministrator) {
|
if (user.Policy.IsAdministrator) {
|
||||||
context.querySelector('.selectDashboardThemeContainer').classList.remove('hide');
|
context.querySelector('.selectDashboardThemeContainer').classList.remove('hide');
|
||||||
|
@ -167,8 +179,8 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
|
|
||||||
context.querySelector('.chkRunAtStartup').checked = appSettings.runAtStartup();
|
context.querySelector('.chkRunAtStartup').checked = appSettings.runAtStartup();
|
||||||
|
|
||||||
var selectTheme = context.querySelector('#selectTheme');
|
const selectTheme = context.querySelector('#selectTheme');
|
||||||
var selectDashboardTheme = context.querySelector('#selectDashboardTheme');
|
const selectDashboardTheme = context.querySelector('#selectDashboardTheme');
|
||||||
|
|
||||||
fillThemes(selectTheme);
|
fillThemes(selectTheme);
|
||||||
fillThemes(selectDashboardTheme, true);
|
fillThemes(selectDashboardTheme, true);
|
||||||
|
@ -195,7 +207,7 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
|
|
||||||
context.querySelector('.selectLayout').value = layoutManager.getSavedLayout() || '';
|
context.querySelector('.selectLayout').value = layoutManager.getSavedLayout() || '';
|
||||||
|
|
||||||
showOrHideMissingEpisodesField(context, user, apiClient);
|
showOrHideMissingEpisodesField(context);
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}
|
}
|
||||||
|
@ -239,29 +251,29 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
function save(instance, context, userId, userSettings, apiClient, enableSaveConfirmation) {
|
||||||
loading.show();
|
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();
|
loading.hide();
|
||||||
if (enableSaveConfirmation) {
|
if (enableSaveConfirmation) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
events.trigger(instance, 'saved');
|
events.trigger(instance, 'saved');
|
||||||
}, function () {
|
}, () => {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
var self = this;
|
const self = this;
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||||
var userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
var userSettings = self.options.userSettings;
|
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);
|
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -272,50 +284,51 @@ define(['require', 'browser', 'layoutManager', 'appSettings', 'pluginManager', '
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function embed(options, self) {
|
async function embed(options, self) {
|
||||||
require(['text!./displaySettings.template.html'], function (template) {
|
const { default: template } = await import('text!./displaySettings.template.html');
|
||||||
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
||||||
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
options.element.querySelector('form').addEventListener('submit', onSubmit.bind(self));
|
||||||
if (options.enableSaveButton) {
|
if (options.enableSaveButton) {
|
||||||
options.element.querySelector('.btnSave').classList.remove('hide');
|
options.element.querySelector('.btnSave').classList.remove('hide');
|
||||||
}
|
}
|
||||||
self.loadData(options.autoFocus);
|
self.loadData(options.autoFocus);
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function DisplaySettings(options) {
|
class DisplaySettings {
|
||||||
this.options = options;
|
constructor(options) {
|
||||||
embed(options, this);
|
this.options = options;
|
||||||
}
|
embed(options, this);
|
||||||
|
}
|
||||||
|
|
||||||
DisplaySettings.prototype.loadData = function (autoFocus) {
|
loadData(autoFocus) {
|
||||||
var self = this;
|
const self = this;
|
||||||
var context = self.options.element;
|
const context = self.options.element;
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
var userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||||
var userSettings = self.options.userSettings;
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
return apiClient.getUser(userId).then(function (user) {
|
return apiClient.getUser(userId).then(user => {
|
||||||
return userSettings.setUserInfo(userId, apiClient).then(function () {
|
return userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||||
self.dataLoaded = true;
|
self.dataLoaded = true;
|
||||||
loadForm(context, user, userSettings, apiClient);
|
loadForm(context, user, userSettings);
|
||||||
if (autoFocus) {
|
if (autoFocus) {
|
||||||
focusManager.autoFocus(context);
|
focusManager.autoFocus(context);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
};
|
|
||||||
|
|
||||||
DisplaySettings.prototype.submit = function () {
|
submit() {
|
||||||
onSubmit.call(this);
|
onSubmit.call(this);
|
||||||
};
|
}
|
||||||
|
|
||||||
DisplaySettings.prototype.destroy = function () {
|
destroy() {
|
||||||
this.options = null;
|
this.options = null;
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return DisplaySettings;
|
/* eslint-enable indent */
|
||||||
});
|
export default DisplaySettings;
|
||||||
|
|
|
@ -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) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
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) {
|
function renderViews(page, user, result) {
|
||||||
|
|
||||||
var folderHtml = '';
|
let folderHtml = '';
|
||||||
|
|
||||||
folderHtml += '<div class="checkboxList">';
|
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 += '<label>';
|
||||||
currentHtml += '<input type="checkbox" is="emby-checkbox" class="chkGroupFolder" data-folderid="' + i.Id + '" id="' + id + '"' + checkedHtml + '/>';
|
currentHtml += `<input type="checkbox" is="emby-checkbox" class="chkGroupFolder" data-folderid="${i.Id}" id="${id}"${checkedHtml}/>`;
|
||||||
currentHtml += '<span>' + i.Name + '</span>';
|
currentHtml += `<span>${i.Name}</span>`;
|
||||||
currentHtml += '</label>';
|
currentHtml += '</label>';
|
||||||
|
|
||||||
return currentHtml;
|
return currentHtml;
|
||||||
|
@ -34,7 +45,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function getLandingScreenOptions(type) {
|
function getLandingScreenOptions(type) {
|
||||||
|
|
||||||
var list = [];
|
const list = [];
|
||||||
|
|
||||||
if (type === 'movies') {
|
if (type === 'movies') {
|
||||||
list.push({
|
list.push({
|
||||||
|
@ -123,27 +134,27 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function getLandingScreenOptionsHtml(type, userValue) {
|
function getLandingScreenOptionsHtml(type, userValue) {
|
||||||
|
|
||||||
return getLandingScreenOptions(type).map(function (o) {
|
return getLandingScreenOptions(type).map(o => {
|
||||||
|
|
||||||
var selected = userValue === o.value || (o.isDefault && !userValue);
|
const selected = userValue === o.value || (o.isDefault && !userValue);
|
||||||
var selectedHtml = selected ? ' selected' : '';
|
const selectedHtml = selected ? ' selected' : '';
|
||||||
var optionValue = o.isDefault ? '' : o.value;
|
const optionValue = o.isDefault ? '' : o.value;
|
||||||
|
|
||||||
return '<option value="' + optionValue + '"' + selectedHtml + '>' + o.name + '</option>';
|
return `<option value="${optionValue}"${selectedHtml}>${o.name}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderViewOrder(context, user, result) {
|
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>';
|
currentHtml += '<span class="material-icons listItemIcon folder_open"></span>';
|
||||||
|
|
||||||
|
@ -155,8 +166,8 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
currentHtml += '</div>';
|
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="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="btnViewItemDown btnViewItemMove autoSize" title="${globalize.translate('Down')}"><span class="material-icons keyboard_arrow_down"></span></button>`;
|
||||||
|
|
||||||
currentHtml += '</div>';
|
currentHtml += '</div>';
|
||||||
|
|
||||||
|
@ -170,14 +181,14 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function updateHomeSectionValues(context, userSettings) {
|
function updateHomeSectionValues(context, userSettings) {
|
||||||
|
|
||||||
for (var i = 1; i <= 7; i++) {
|
for (let i = 1; i <= 7; i++) {
|
||||||
|
|
||||||
var select = context.querySelector('#selectHomeSection' + i);
|
const select = context.querySelector(`#selectHomeSection${i}`);
|
||||||
var defaultValue = homeSections.getDefaultSection(i - 1);
|
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 = '';
|
option.value = '';
|
||||||
|
|
||||||
|
@ -193,42 +204,42 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function getPerLibrarySettingsHtml(item, user, userSettings, apiClient) {
|
function getPerLibrarySettingsHtml(item, user, userSettings, apiClient) {
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
var isChecked;
|
let isChecked;
|
||||||
|
|
||||||
if (item.Type === 'Channel' || item.CollectionType === 'boxsets' || item.CollectionType === 'playlists') {
|
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 += '<div>';
|
||||||
html += '<label>';
|
html += '<label>';
|
||||||
html += '<input type="checkbox" is="emby-checkbox" class="chkIncludeInMyMedia" data-folderid="' + item.Id + '"' + (isChecked ? ' checked="checked"' : '') + '/>';
|
html += `<input type="checkbox" is="emby-checkbox" class="chkIncludeInMyMedia" data-folderid="${item.Id}"${isChecked ? ' checked="checked"' : ''}/>`;
|
||||||
html += '<span>' + globalize.translate('DisplayInMyMedia') + '</span>';
|
html += `<span>${globalize.translate('DisplayInMyMedia')}</span>`;
|
||||||
html += '</label>';
|
html += '</label>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var excludeFromLatest = ['playlists', 'livetv', 'boxsets', 'channels'];
|
const excludeFromLatest = ['playlists', 'livetv', 'boxsets', 'channels'];
|
||||||
if (excludeFromLatest.indexOf(item.CollectionType || '') === -1) {
|
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 += '<label class="fldIncludeInLatest">';
|
||||||
html += '<input type="checkbox" is="emby-checkbox" class="chkIncludeInLatest" data-folderid="' + item.Id + '"' + (isChecked ? ' checked="checked"' : '') + '/>';
|
html += `<input type="checkbox" is="emby-checkbox" class="chkIncludeInLatest" data-folderid="${item.Id}"${isChecked ? ' checked="checked"' : ''}/>`;
|
||||||
html += '<span>' + globalize.translate('DisplayInOtherHomeScreenSections') + '</span>';
|
html += `<span>${globalize.translate('DisplayInOtherHomeScreenSections')}</span>`;
|
||||||
html += '</label>';
|
html += '</label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (html) {
|
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') {
|
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 += '<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);
|
html += getLandingScreenOptionsHtml(item.CollectionType, userValue);
|
||||||
|
|
||||||
|
@ -238,7 +249,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
if (html) {
|
if (html) {
|
||||||
|
|
||||||
var prefix = '';
|
let prefix = '';
|
||||||
prefix += '<div class="verticalSection">';
|
prefix += '<div class="verticalSection">';
|
||||||
|
|
||||||
prefix += '<h2 class="sectionTitle">';
|
prefix += '<h2 class="sectionTitle">';
|
||||||
|
@ -254,10 +265,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function renderPerLibrarySettings(context, user, userViews, userSettings, apiClient) {
|
function renderPerLibrarySettings(context, user, userViews, userSettings, apiClient) {
|
||||||
|
|
||||||
var elem = context.querySelector('.perLibrarySettings');
|
const elem = context.querySelector('.perLibrarySettings');
|
||||||
var html = '';
|
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);
|
html += getPerLibrarySettingsHtml(userViews[i], user, userSettings, apiClient);
|
||||||
}
|
}
|
||||||
|
@ -271,10 +282,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
updateHomeSectionValues(context, userSettings);
|
updateHomeSectionValues(context, userSettings);
|
||||||
|
|
||||||
var promise1 = apiClient.getUserViews({ IncludeHidden: true }, user.Id);
|
const promise1 = apiClient.getUserViews({ IncludeHidden: true }, user.Id);
|
||||||
var promise2 = apiClient.getJSON(apiClient.getUrl('Users/' + user.Id + '/GroupingOptions'));
|
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]);
|
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) {
|
function onSectionOrderListClick(e) {
|
||||||
|
|
||||||
var target = dom.parentWithClass(e.target, 'btnViewItemMove');
|
const target = dom.parentWithClass(e.target, 'btnViewItemMove');
|
||||||
|
|
||||||
if (target) {
|
if (target) {
|
||||||
var viewItem = dom.parentWithClass(target, 'viewItem');
|
const viewItem = dom.parentWithClass(target, 'viewItem');
|
||||||
|
|
||||||
if (viewItem) {
|
if (viewItem) {
|
||||||
var ul = dom.parentWithClass(viewItem, 'paperList');
|
const ul = dom.parentWithClass(viewItem, 'paperList');
|
||||||
|
|
||||||
if (target.classList.contains('btnViewItemDown')) {
|
if (target.classList.contains('btnViewItemDown')) {
|
||||||
|
|
||||||
var next = viewItem.nextSibling;
|
const next = viewItem.nextSibling;
|
||||||
|
|
||||||
if (next) {
|
if (next) {
|
||||||
viewItem.parentNode.removeChild(viewItem);
|
viewItem.parentNode.removeChild(viewItem);
|
||||||
|
@ -327,7 +319,7 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var prev = viewItem.previousSibling;
|
const prev = viewItem.previousSibling;
|
||||||
|
|
||||||
if (prev) {
|
if (prev) {
|
||||||
viewItem.parentNode.removeChild(viewItem);
|
viewItem.parentNode.removeChild(viewItem);
|
||||||
|
@ -341,10 +333,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function getCheckboxItems(selector, context, isChecked) {
|
function getCheckboxItems(selector, context, isChecked) {
|
||||||
|
|
||||||
var inputs = context.querySelectorAll(selector);
|
const inputs = context.querySelectorAll(selector);
|
||||||
var list = [];
|
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) {
|
if (inputs[i].checked === isChecked) {
|
||||||
list.push(inputs[i]);
|
list.push(inputs[i]);
|
||||||
|
@ -359,25 +351,25 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
user.Configuration.HidePlayedInLatest = context.querySelector('.chkHidePlayedFromLatest').checked;
|
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');
|
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');
|
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');
|
return i.getAttribute('data-folderid');
|
||||||
});
|
});
|
||||||
|
|
||||||
var viewItems = context.querySelectorAll('.viewItem');
|
const viewItems = context.querySelectorAll('.viewItem');
|
||||||
var orderedViews = [];
|
const orderedViews = [];
|
||||||
var i;
|
let i;
|
||||||
var length;
|
let length;
|
||||||
for (i = 0, length = viewItems.length; i < length; i++) {
|
for (i = 0, length = viewItems.length; i < length; i++) {
|
||||||
orderedViews.push(viewItems[i].getAttribute('data-viewid'));
|
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('homesection5', context.querySelector('#selectHomeSection6').value);
|
||||||
userSettingsInstance.set('homesection6', context.querySelector('#selectHomeSection7').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++) {
|
for (i = 0, length = selectLandings.length; i < length; i++) {
|
||||||
var selectLanding = selectLandings[i];
|
const selectLanding = selectLandings[i];
|
||||||
userSettingsInstance.set('landing-' + selectLanding.getAttribute('data-folderid'), selectLanding.value);
|
userSettingsInstance.set(`landing-${selectLanding.getAttribute('data-folderid')}`, selectLanding.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
return apiClient.updateUserConfiguration(user.Id, user.Configuration);
|
return apiClient.updateUserConfiguration(user.Id, user.Configuration);
|
||||||
|
@ -407,20 +399,20 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
loading.show();
|
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();
|
loading.hide();
|
||||||
if (enableSaveConfirmation) {
|
if (enableSaveConfirmation) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
events.trigger(instance, 'saved');
|
events.trigger(instance, 'saved');
|
||||||
|
|
||||||
}, function () {
|
}, () => {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -428,14 +420,14 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||||
var userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
var userSettings = self.options.userSettings;
|
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);
|
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -448,13 +440,13 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function onChange(e) {
|
function onChange(e) {
|
||||||
|
|
||||||
var chkIncludeInMyMedia = dom.parentWithClass(e.target, 'chkIncludeInMyMedia');
|
const chkIncludeInMyMedia = dom.parentWithClass(e.target, 'chkIncludeInMyMedia');
|
||||||
if (!chkIncludeInMyMedia) {
|
if (!chkIncludeInMyMedia) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var section = dom.parentWithClass(chkIncludeInMyMedia, 'verticalSection');
|
const section = dom.parentWithClass(chkIncludeInMyMedia, 'verticalSection');
|
||||||
var fldIncludeInLatest = section.querySelector('.fldIncludeInLatest');
|
const fldIncludeInLatest = section.querySelector('.fldIncludeInLatest');
|
||||||
if (fldIncludeInLatest) {
|
if (fldIncludeInLatest) {
|
||||||
if (chkIncludeInMyMedia.checked) {
|
if (chkIncludeInMyMedia.checked) {
|
||||||
fldIncludeInLatest.classList.remove('hide');
|
fldIncludeInLatest.classList.remove('hide');
|
||||||
|
@ -466,10 +458,10 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
|
|
||||||
function embed(options, self) {
|
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++) {
|
for (let i = 1; i <= numConfigurableSections; i++) {
|
||||||
template = template.replace('{section' + i + 'label}', globalize.translate('LabelHomeScreenSectionValue', i));
|
template = template.replace(`{section${i}label}`, globalize.translate('LabelHomeScreenSectionValue', i));
|
||||||
}
|
}
|
||||||
|
|
||||||
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
options.element.innerHTML = globalize.translateDocument(template, 'core');
|
||||||
|
@ -492,47 +484,48 @@ define(['require', 'apphost', 'layoutManager', 'focusManager', 'globalize', 'loa
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function HomeScreenSettings(options) {
|
class HomeScreenSettings {
|
||||||
|
constructor(options) {
|
||||||
|
this.options = options;
|
||||||
|
embed(options, this);
|
||||||
|
}
|
||||||
|
|
||||||
this.options = options;
|
loadData(autoFocus) {
|
||||||
|
|
||||||
embed(options, this);
|
const self = this;
|
||||||
|
const context = self.options.element;
|
||||||
|
|
||||||
|
loading.show();
|
||||||
|
|
||||||
|
const userId = self.options.userId;
|
||||||
|
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||||
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
|
apiClient.getUser(userId).then(user => {
|
||||||
|
|
||||||
|
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||||
|
|
||||||
|
self.dataLoaded = true;
|
||||||
|
|
||||||
|
loadForm(context, user, userSettings, apiClient);
|
||||||
|
|
||||||
|
if (autoFocus) {
|
||||||
|
focusManager.autoFocus(context);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
submit() {
|
||||||
|
onSubmit.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
|
||||||
|
this.options = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HomeScreenSettings.prototype.loadData = function (autoFocus) {
|
/* eslint-enable indent */
|
||||||
|
|
||||||
var self = this;
|
export default HomeScreenSettings;
|
||||||
var context = self.options.element;
|
|
||||||
|
|
||||||
loading.show();
|
|
||||||
|
|
||||||
var userId = self.options.userId;
|
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
|
||||||
var userSettings = self.options.userSettings;
|
|
||||||
|
|
||||||
apiClient.getUser(userId).then(function (user) {
|
|
||||||
|
|
||||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
|
||||||
|
|
||||||
self.dataLoaded = true;
|
|
||||||
|
|
||||||
loadForm(context, user, userSettings, apiClient);
|
|
||||||
|
|
||||||
if (autoFocus) {
|
|
||||||
focusManager.autoFocus(context);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
HomeScreenSettings.prototype.submit = function () {
|
|
||||||
onSubmit.call(this);
|
|
||||||
};
|
|
||||||
|
|
||||||
HomeScreenSettings.prototype.destroy = function () {
|
|
||||||
|
|
||||||
this.options = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
return 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) {
|
import connectionManager from 'connectionManager';
|
||||||
'use strict';
|
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) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
return 'smalllibrarytiles';
|
return 'smalllibrarytiles';
|
||||||
|
@ -23,9 +40,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllSectionsToShow(userSettings, sectionCount) {
|
function getAllSectionsToShow(userSettings, sectionCount) {
|
||||||
var sections = [];
|
const sections = [];
|
||||||
for (var i = 0, length = sectionCount; i < length; i++) {
|
for (let i = 0, length = sectionCount; i < length; i++) {
|
||||||
var section = userSettings.get('homesection' + i) || getDefaultSection(i);
|
let section = userSettings.get('homesection' + i) || getDefaultSection(i);
|
||||||
if (section === 'folders') {
|
if (section === 'folders') {
|
||||||
section = getDefaultSection(0);
|
section = getDefaultSection(0);
|
||||||
}
|
}
|
||||||
|
@ -36,22 +53,22 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
return sections;
|
return sections;
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSections(elem, apiClient, user, userSettings) {
|
export function loadSections(elem, apiClient, user, userSettings) {
|
||||||
return getUserViews(apiClient, user.Id).then(function (userViews) {
|
return getUserViews(apiClient, user.Id).then(function (userViews) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
if (userViews.length) {
|
if (userViews.length) {
|
||||||
var sectionCount = 7;
|
const sectionCount = 7;
|
||||||
for (var i = 0; i < sectionCount; i++) {
|
for (let i = 0; i < sectionCount; i++) {
|
||||||
html += '<div class="verticalSection section' + i + '"></div>';
|
html += '<div class="verticalSection section' + i + '"></div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
elem.classList.add('homeSectionsContainer');
|
elem.classList.add('homeSectionsContainer');
|
||||||
|
|
||||||
var promises = [];
|
const promises = [];
|
||||||
var sections = getAllSectionsToShow(userSettings, sectionCount);
|
const sections = getAllSectionsToShow(userSettings, sectionCount);
|
||||||
for (var i = 0; i < sections.length; i++) {
|
for (let i = 0; i < sections.length; i++) {
|
||||||
promises.push(loadSection(elem, apiClient, user, userSettings, userViews, sections, i));
|
promises.push(loadSection(elem, apiClient, user, userSettings, userViews, sections, i));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +79,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var noLibDescription;
|
let noLibDescription;
|
||||||
if (user['Policy'] && user['Policy']['IsAdministrator']) {
|
if (user['Policy'] && user['Policy']['IsAdministrator']) {
|
||||||
noLibDescription = globalize.translate('NoCreatedLibraries', '<br><a id="button-createLibrary" class="button-link">', '</a>');
|
noLibDescription = globalize.translate('NoCreatedLibraries', '<br><a id="button-createLibrary" class="button-link">', '</a>');
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,7 +92,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var createNowLink = elem.querySelector('#button-createLibrary');
|
const createNowLink = elem.querySelector('#button-createLibrary');
|
||||||
if (createNowLink) {
|
if (createNowLink) {
|
||||||
createNowLink.addEventListener('click', function () {
|
createNowLink.addEventListener('click', function () {
|
||||||
Dashboard.navigate('library.html');
|
Dashboard.navigate('library.html');
|
||||||
|
@ -85,9 +102,9 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function destroySections(elem) {
|
export function destroySections(elem) {
|
||||||
var elems = elem.querySelectorAll('.itemsContainer');
|
const elems = elem.querySelectorAll('.itemsContainer');
|
||||||
for (var i = 0; i < elems.length; i++) {
|
for (let i = 0; i < elems.length; i++) {
|
||||||
elems[i].fetchData = null;
|
elems[i].fetchData = null;
|
||||||
elems[i].parentContainer = null;
|
elems[i].parentContainer = null;
|
||||||
elems[i].getItemsHtml = null;
|
elems[i].getItemsHtml = null;
|
||||||
|
@ -96,24 +113,22 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.innerHTML = '';
|
elem.innerHTML = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function pause(elem) {
|
export function pause(elem) {
|
||||||
var elems = elem.querySelectorAll('.itemsContainer');
|
const elems = elem.querySelectorAll('.itemsContainer');
|
||||||
for (var i = 0; i < elems.length; i++) {
|
for (let i = 0; i < elems.length; i++) {
|
||||||
elems[i].pause();
|
elems[i].pause();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function resume(elem, options) {
|
export function resume(elem, options) {
|
||||||
var elems = elem.querySelectorAll('.itemsContainer');
|
const elems = elem.querySelectorAll('.itemsContainer');
|
||||||
var i;
|
const promises = [];
|
||||||
var length;
|
|
||||||
var 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));
|
promises.push(elems[i].resume(options));
|
||||||
}
|
}
|
||||||
|
|
||||||
var promise = Promise.all(promises);
|
const promise = Promise.all(promises);
|
||||||
if (!options || options.returnPromise !== false) {
|
if (!options || options.returnPromise !== false) {
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
@ -121,10 +136,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function loadSection(page, apiClient, user, userSettings, userViews, allSections, index) {
|
function loadSection(page, apiClient, user, userSettings, userViews, allSections, index) {
|
||||||
|
|
||||||
var section = allSections[index];
|
const section = allSections[index];
|
||||||
var userId = user.Id;
|
const userId = user.Id;
|
||||||
|
|
||||||
var elem = page.querySelector('.section' + index);
|
const elem = page.querySelector('.section' + index);
|
||||||
|
|
||||||
if (section === 'latestmedia') {
|
if (section === 'latestmedia') {
|
||||||
loadRecentlyAdded(elem, apiClient, user, userViews);
|
loadRecentlyAdded(elem, apiClient, user, userViews);
|
||||||
|
@ -172,7 +187,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLibraryButtonsHtml(items) {
|
function getLibraryButtonsHtml(items) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="verticalSection verticalSection-extrabottompadding">';
|
html += '<div class="verticalSection verticalSection-extrabottompadding">';
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
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">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer padded-left padded-right vertical-wrap focuscontainer-x" data-multiselect="false">';
|
||||||
|
|
||||||
// library card background images
|
// library card background images
|
||||||
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 icon = imageHelper.getLibraryIcon(item.CollectionType);
|
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>';
|
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) {
|
function loadlibraryButtons(elem, apiClient, user, userSettings, userViews) {
|
||||||
elem.classList.remove('verticalSection');
|
elem.classList.remove('verticalSection');
|
||||||
var html = getLibraryButtonsHtml(userViews);
|
const html = getLibraryButtonsHtml(userViews);
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
imageLoader.lazyChildren(elem);
|
imageLoader.lazyChildren(elem);
|
||||||
|
@ -210,8 +225,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getFetchLatestItemsFn(serverId, parentId, collectionType) {
|
function getFetchLatestItemsFn(serverId, parentId, collectionType) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
var limit = 16;
|
let limit = 16;
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
if (collectionType === 'music') {
|
if (collectionType === 'music') {
|
||||||
|
@ -227,7 +242,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo,Path',
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo,Path',
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
|
@ -241,8 +256,8 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getLatestItemsHtmlFn(itemType, viewType) {
|
function getLatestItemsHtmlFn(itemType, viewType) {
|
||||||
return function (items) {
|
return function (items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
var shape;
|
let shape;
|
||||||
if (itemType === 'Channel' || viewType === 'movies' || viewType === 'books' || viewType === 'tvshows') {
|
if (itemType === 'Channel' || viewType === 'movies' || viewType === 'books' || viewType === 'tvshows') {
|
||||||
shape = getPortraitShape();
|
shape = getPortraitShape();
|
||||||
} else if (viewType === 'music' || viewType === 'homevideos') {
|
} else if (viewType === 'music' || viewType === 'homevideos') {
|
||||||
|
@ -272,7 +287,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderLatestSection(elem, apiClient, user, parent) {
|
function renderLatestSection(elem, apiClient, user, parent) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||||
if (!layoutManager.tv) {
|
if (!layoutManager.tv) {
|
||||||
|
@ -303,7 +318,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getFetchLatestItemsFn(apiClient.serverId(), parent.Id, parent.CollectionType);
|
itemsContainer.fetchData = getFetchLatestItemsFn(apiClient.serverId(), parent.Id, parent.CollectionType);
|
||||||
itemsContainer.getItemsHtml = getLatestItemsHtmlFn(parent.Type, parent.CollectionType);
|
itemsContainer.getItemsHtml = getLatestItemsHtmlFn(parent.Type, parent.CollectionType);
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
|
@ -311,10 +326,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function loadRecentlyAdded(elem, apiClient, user, userViews) {
|
function loadRecentlyAdded(elem, apiClient, user, userViews) {
|
||||||
elem.classList.remove('verticalSection');
|
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++) {
|
for (let i = 0, length = userViews.length; i < length; i++) {
|
||||||
var item = userViews[i];
|
const item = userViews[i];
|
||||||
if (user.Configuration.LatestItemsExcludes.indexOf(item.Id) !== -1) {
|
if (user.Configuration.LatestItemsExcludes.indexOf(item.Id) !== -1) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -323,7 +338,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var frag = document.createElement('div');
|
const frag = document.createElement('div');
|
||||||
frag.classList.add('verticalSection');
|
frag.classList.add('verticalSection');
|
||||||
frag.classList.add('hide');
|
frag.classList.add('hide');
|
||||||
elem.appendChild(frag);
|
elem.appendChild(frag);
|
||||||
|
@ -334,12 +349,14 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getRequirePromise(deps) {
|
function getRequirePromise(deps) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
require(deps, resolve);
|
import(deps).then(() => {
|
||||||
|
return resolve;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLibraryTiles(elem, apiClient, user, userSettings, shape, userViews, allSections) {
|
export function loadLibraryTiles(elem, apiClient, user, userSettings, shape, userViews, allSections) {
|
||||||
var html = '';
|
let html = '';
|
||||||
if (userViews.length) {
|
if (userViews.length) {
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderMyMedia') + '</h2>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
|
@ -372,10 +389,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getContinueWatchingFetchFn(serverId) {
|
function getContinueWatchingFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
var screenWidth = dom.getWindowSize().innerWidth;
|
const screenWidth = dom.getWindowSize().innerWidth;
|
||||||
|
|
||||||
var limit;
|
let limit;
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
limit = 12;
|
limit = 12;
|
||||||
} else {
|
} else {
|
||||||
|
@ -383,7 +400,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
limit = Math.min(limit, 5);
|
limit = Math.min(limit, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
|
@ -398,7 +415,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getContinueWatchingItemsHtml(items) {
|
function getContinueWatchingItemsHtml(items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
|
@ -419,7 +436,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadResumeVideo(elem, apiClient, userId) {
|
function loadResumeVideo(elem, apiClient, userId) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
|
@ -437,7 +454,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.classList.add('hide');
|
elem.classList.add('hide');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getContinueWatchingFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getContinueWatchingFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getContinueWatchingItemsHtml;
|
itemsContainer.getItemsHtml = getContinueWatchingItemsHtml;
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
|
@ -445,10 +462,10 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getContinueListeningFetchFn(serverId) {
|
function getContinueListeningFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
var screenWidth = dom.getWindowSize().innerWidth;
|
const screenWidth = dom.getWindowSize().innerWidth;
|
||||||
|
|
||||||
var limit;
|
let limit;
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
limit = 12;
|
limit = 12;
|
||||||
} else {
|
} else {
|
||||||
|
@ -456,7 +473,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
limit = Math.min(limit, 5);
|
limit = Math.min(limit, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
Limit: limit,
|
Limit: limit,
|
||||||
Recursive: true,
|
Recursive: true,
|
||||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
|
@ -471,7 +488,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getContinueListeningItemsHtml(items) {
|
function getContinueListeningItemsHtml(items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
|
@ -492,7 +509,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadResumeAudio(elem, apiClient, userId) {
|
function loadResumeAudio(elem, apiClient, userId) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + globalize.translate('HeaderContinueWatching') + '</h2>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
|
@ -510,7 +527,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.classList.add('hide');
|
elem.classList.add('hide');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getContinueListeningFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getContinueListeningFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getContinueListeningItemsHtml;
|
itemsContainer.getItemsHtml = getContinueListeningItemsHtml;
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
|
@ -518,7 +535,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getOnNowFetchFn(serverId) {
|
function getOnNowFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getLiveTvRecommendedPrograms({
|
return apiClient.getLiveTvRecommendedPrograms({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
|
@ -532,7 +549,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getOnNowItemsHtml(items) {
|
function getOnNowItemsHtml(items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: 'auto',
|
preferThumb: 'auto',
|
||||||
|
@ -559,7 +576,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
var userId = user.Id;
|
const userId = user.Id;
|
||||||
return apiClient.getLiveTvRecommendedPrograms({
|
return apiClient.getLiveTvRecommendedPrograms({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
IsAiring: true,
|
IsAiring: true,
|
||||||
|
@ -569,7 +586,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
EnableTotalRecordCount: false,
|
EnableTotalRecordCount: false,
|
||||||
Fields: 'ChannelInfo,PrimaryImageAspectRatio'
|
Fields: 'ChannelInfo,PrimaryImageAspectRatio'
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
var html = '';
|
let html = '';
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
elem.classList.remove('padded-left');
|
elem.classList.remove('padded-left');
|
||||||
elem.classList.remove('padded-right');
|
elem.classList.remove('padded-right');
|
||||||
|
@ -654,7 +671,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
itemsContainer.fetchData = getOnNowFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getOnNowFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getOnNowItemsHtml;
|
itemsContainer.getItemsHtml = getOnNowItemsHtml;
|
||||||
|
@ -664,7 +681,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getNextUpFetchFn(serverId) {
|
function getNextUpFetchFn(serverId) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getNextUpEpisodes({
|
return apiClient.getNextUpEpisodes({
|
||||||
Limit: enableScrollX() ? 24 : 15,
|
Limit: enableScrollX() ? 24 : 15,
|
||||||
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
|
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo,Path',
|
||||||
|
@ -677,7 +694,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNextUpItemsHtml(items) {
|
function getNextUpItemsHtml(items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
|
@ -695,7 +712,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNextUp(elem, apiClient, userId) {
|
function loadNextUp(elem, apiClient, userId) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||||
if (!layoutManager.tv) {
|
if (!layoutManager.tv) {
|
||||||
|
@ -727,7 +744,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
elem.classList.add('hide');
|
elem.classList.add('hide');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId());
|
itemsContainer.fetchData = getNextUpFetchFn(apiClient.serverId());
|
||||||
itemsContainer.getItemsHtml = getNextUpItemsHtml;
|
itemsContainer.getItemsHtml = getNextUpItemsHtml;
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
|
@ -735,7 +752,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
|
function getLatestRecordingsFetchFn(serverId, activeRecordingsOnly) {
|
||||||
return function () {
|
return function () {
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
return apiClient.getLiveTvRecordings({
|
return apiClient.getLiveTvRecordings({
|
||||||
userId: apiClient.getCurrentUserId(),
|
userId: apiClient.getCurrentUserId(),
|
||||||
Limit: enableScrollX() ? 12 : 5,
|
Limit: enableScrollX() ? 12 : 5,
|
||||||
|
@ -749,7 +766,7 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
|
|
||||||
function getLatestRecordingItemsHtml(activeRecordingsOnly) {
|
function getLatestRecordingItemsHtml(activeRecordingsOnly) {
|
||||||
return function (items) {
|
return function (items) {
|
||||||
var cardLayout = false;
|
const cardLayout = false;
|
||||||
return cardBuilder.getCardsHtml({
|
return cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
shape: enableScrollX() ? 'autooverflow' : 'auto',
|
shape: enableScrollX() ? 'autooverflow' : 'auto',
|
||||||
|
@ -774,11 +791,11 @@ define(['connectionManager', 'cardBuilder', 'appSettings', 'dom', 'apphost', 'la
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadLatestLiveTvRecordings(elem, activeRecordingsOnly, apiClient, userId) {
|
function loadLatestLiveTvRecordings(elem, activeRecordingsOnly, apiClient, userId) {
|
||||||
var title = activeRecordingsOnly ?
|
const title = activeRecordingsOnly ?
|
||||||
globalize.translate('HeaderActiveRecordings') :
|
globalize.translate('HeaderActiveRecordings') :
|
||||||
globalize.translate('HeaderLatestRecordings');
|
globalize.translate('HeaderLatestRecordings');
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards">';
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + title + '</h2>';
|
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.classList.add('hide');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
var itemsContainer = elem.querySelector('.itemsContainer');
|
const itemsContainer = elem.querySelector('.itemsContainer');
|
||||||
itemsContainer.fetchData = getLatestRecordingsFetchFn(apiClient.serverId(), activeRecordingsOnly);
|
itemsContainer.fetchData = getLatestRecordingsFetchFn(apiClient.serverId(), activeRecordingsOnly);
|
||||||
itemsContainer.getItemsHtml = getLatestRecordingItemsHtml(activeRecordingsOnly);
|
itemsContainer.getItemsHtml = getLatestRecordingItemsHtml(activeRecordingsOnly);
|
||||||
itemsContainer.parentContainer = elem;
|
itemsContainer.parentContainer = elem;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
loadLibraryTiles: loadLibraryTiles,
|
loadLibraryTiles: loadLibraryTiles,
|
||||||
getDefaultSection: getDefaultSection,
|
getDefaultSection: getDefaultSection,
|
||||||
loadSections: loadSections,
|
loadSections: loadSections,
|
||||||
destroySections: destroySections,
|
destroySections: destroySections,
|
||||||
pause: pause,
|
pause: pause,
|
||||||
resume: resume
|
resume: resume
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -200,7 +200,7 @@ define(['dialogHelper', 'connectionManager', 'loading', 'dom', 'layoutManager',
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
|
|
||||||
confirm({
|
confirm.default({
|
||||||
|
|
||||||
text: globalize.translate('ConfirmDeleteImage'),
|
text: globalize.translate('ConfirmDeleteImage'),
|
||||||
confirmText: globalize.translate('Delete'),
|
confirmText: globalize.translate('Delete'),
|
||||||
|
|
|
@ -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) {
|
import appHost from 'apphost';
|
||||||
'use strict';
|
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) {
|
/* eslint-disable indent */
|
||||||
var item = options.item;
|
|
||||||
var user = options.user;
|
|
||||||
|
|
||||||
var canPlay = playbackManager.canPlay(item);
|
export function getCommands(options) {
|
||||||
var restrictOptions = (browser.operaTv || browser.web0s) && !user.Policy.IsAdministrator;
|
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 (canPlay && item.MediaType !== 'Photo') {
|
||||||
if (options.play !== false) {
|
if (options.play !== false) {
|
||||||
|
@ -161,10 +171,10 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var canEdit = itemHelper.canEdit(user, item);
|
const canEdit = itemHelper.canEdit(user, item);
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
if (options.edit !== false && item.Type !== 'SeriesTimer') {
|
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({
|
commands.push({
|
||||||
name: text,
|
name: text,
|
||||||
id: 'edit',
|
id: 'edit',
|
||||||
|
@ -311,31 +321,31 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
}
|
}
|
||||||
|
|
||||||
function executeCommand(item, id, options) {
|
function executeCommand(item, id, options) {
|
||||||
var itemId = item.Id;
|
const itemId = item.Id;
|
||||||
var serverId = item.ServerId;
|
const serverId = item.ServerId;
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 'addtocollection':
|
case 'addtocollection':
|
||||||
require(['collectionEditor'], function (collectionEditor) {
|
import('collectionEditor').then(({default: collectionEditor}) => {
|
||||||
new collectionEditor.showEditor({
|
new collectionEditor({
|
||||||
items: [itemId],
|
items: [itemId],
|
||||||
serverId: serverId
|
serverId: serverId
|
||||||
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'addtoplaylist':
|
case 'addtoplaylist':
|
||||||
require(['playlistEditor'], function (playlistEditor) {
|
import('playlistEditor').then(({default: playlistEditor}) => {
|
||||||
new playlistEditor.showEditor({
|
new playlistEditor({
|
||||||
items: [itemId],
|
items: [itemId],
|
||||||
serverId: serverId
|
serverId: serverId
|
||||||
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
}).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'download':
|
case 'download':
|
||||||
require(['fileDownloader'], function (fileDownloader) {
|
import('fileDownloader').then(({default: fileDownloader}) => {
|
||||||
var downloadHref = apiClient.getItemDownloadUrl(itemId);
|
const downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||||
fileDownloader.download([{
|
fileDownloader.download([{
|
||||||
url: downloadHref,
|
url: downloadHref,
|
||||||
itemId: itemId,
|
itemId: itemId,
|
||||||
|
@ -346,17 +356,17 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
getResolveFunction(getResolveFunction(resolve, id), id)();
|
getResolveFunction(getResolveFunction(resolve, id), id)();
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'copy-stream':
|
case 'copy-stream': {
|
||||||
var downloadHref = apiClient.getItemDownloadUrl(itemId);
|
const downloadHref = apiClient.getItemDownloadUrl(itemId);
|
||||||
var textAreaCopy = function () {
|
const textAreaCopy = function () {
|
||||||
var textArea = document.createElement('textarea');
|
let textArea = document.createElement('textarea');
|
||||||
textArea.value = downloadHref;
|
textArea.value = downloadHref;
|
||||||
document.body.appendChild(textArea);
|
document.body.appendChild(textArea);
|
||||||
textArea.focus();
|
textArea.focus();
|
||||||
textArea.select();
|
textArea.select();
|
||||||
|
|
||||||
if (document.execCommand('copy')) {
|
if (document.execCommand('copy')) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('CopyStreamURLSuccess'));
|
toast(globalize.translate('CopyStreamURLSuccess'));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -371,7 +381,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
} else {
|
} else {
|
||||||
/* eslint-disable-next-line compat/compat */
|
/* eslint-disable-next-line compat/compat */
|
||||||
navigator.clipboard.writeText(downloadHref).then(function () {
|
navigator.clipboard.writeText(downloadHref).then(function () {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('CopyStreamURLSuccess'));
|
toast(globalize.translate('CopyStreamURLSuccess'));
|
||||||
});
|
});
|
||||||
}).catch(function () {
|
}).catch(function () {
|
||||||
|
@ -380,8 +390,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
}
|
}
|
||||||
getResolveFunction(resolve, id)();
|
getResolveFunction(resolve, id)();
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'editsubtitles':
|
case 'editsubtitles':
|
||||||
require(['subtitleEditor'], function (subtitleEditor) {
|
import('subtitleEditor').then(({default: subtitleEditor}) => {
|
||||||
subtitleEditor.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
subtitleEditor.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -389,7 +400,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
editItem(apiClient, item).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
editItem(apiClient, item).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||||
break;
|
break;
|
||||||
case 'editimages':
|
case 'editimages':
|
||||||
require(['imageEditor'], function (imageEditor) {
|
import('imageEditor').then(({default: imageEditor}) => {
|
||||||
imageEditor.show({
|
imageEditor.show({
|
||||||
itemId: itemId,
|
itemId: itemId,
|
||||||
serverId: serverId
|
serverId: serverId
|
||||||
|
@ -397,12 +408,12 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'identify':
|
case 'identify':
|
||||||
require(['itemIdentifier'], function (itemIdentifier) {
|
import('itemIdentifier').then(({default: itemIdentifier}) => {
|
||||||
itemIdentifier.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
itemIdentifier.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
case 'moremediainfo':
|
case 'moremediainfo':
|
||||||
require(['itemMediaInfo'], function (itemMediaInfo) {
|
import('itemMediaInfo').then(({default: itemMediaInfo}) => {
|
||||||
itemMediaInfo.show(itemId, serverId).then(getResolveFunction(resolve, id), getResolveFunction(resolve, id));
|
itemMediaInfo.show(itemId, serverId).then(getResolveFunction(resolve, id), getResolveFunction(resolve, id));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -431,7 +442,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
getResolveFunction(resolve, id)();
|
getResolveFunction(resolve, id)();
|
||||||
break;
|
break;
|
||||||
case 'record':
|
case 'record':
|
||||||
require(['recordingCreator'], function (recordingCreator) {
|
import('recordingCreator').then(({default: recordingCreator}) => {
|
||||||
recordingCreator.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
recordingCreator.show(itemId, serverId).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -502,8 +513,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteTimer(apiClient, item, resolve, command) {
|
function deleteTimer(apiClient, item, resolve, command) {
|
||||||
require(['recordingHelper'], function (recordingHelper) {
|
import('recordingHelper').then(({default: recordingHelper}) => {
|
||||||
var timerId = item.TimerId || item.Id;
|
const timerId = item.TimerId || item.Id;
|
||||||
recordingHelper.cancelTimerWithConfirmation(timerId, item.ServerId).then(function () {
|
recordingHelper.cancelTimerWithConfirmation(timerId, item.ServerId).then(function () {
|
||||||
getResolveFunction(resolve, command, true)();
|
getResolveFunction(resolve, command, true)();
|
||||||
});
|
});
|
||||||
|
@ -511,7 +522,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteSeriesTimer(apiClient, item, resolve, command) {
|
function deleteSeriesTimer(apiClient, item, resolve, command) {
|
||||||
require(['recordingHelper'], function (recordingHelper) {
|
import('recordingHelper').then(({default: recordingHelper}) => {
|
||||||
recordingHelper.cancelSeriesTimerWithConfirmation(item.Id, item.ServerId).then(function () {
|
recordingHelper.cancelSeriesTimerWithConfirmation(item.Id, item.ServerId).then(function () {
|
||||||
getResolveFunction(resolve, command, true)();
|
getResolveFunction(resolve, command, true)();
|
||||||
});
|
});
|
||||||
|
@ -519,9 +530,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
}
|
}
|
||||||
|
|
||||||
function play(item, resume, queue, queueNext) {
|
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) {
|
if (resume && item.UserData && item.UserData.PlaybackPositionTicks) {
|
||||||
startPosition = item.UserData.PlaybackPositionTicks;
|
startPosition = item.UserData.PlaybackPositionTicks;
|
||||||
}
|
}
|
||||||
|
@ -542,18 +553,18 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
|
|
||||||
function editItem(apiClient, item) {
|
function editItem(apiClient, item) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
var serverId = apiClient.serverInfo().Id;
|
const serverId = apiClient.serverInfo().Id;
|
||||||
|
|
||||||
if (item.Type === 'Timer') {
|
if (item.Type === 'Timer') {
|
||||||
require(['recordingEditor'], function (recordingEditor) {
|
import('recordingEditor').then(({default: recordingEditor}) => {
|
||||||
recordingEditor.show(item.Id, serverId).then(resolve, reject);
|
recordingEditor.show(item.Id, serverId).then(resolve, reject);
|
||||||
});
|
});
|
||||||
} else if (item.Type === 'SeriesTimer') {
|
} else if (item.Type === 'SeriesTimer') {
|
||||||
require(['seriesRecordingEditor'], function (recordingEditor) {
|
import('seriesRecordingEditor').then(({default: recordingEditor}) => {
|
||||||
recordingEditor.show(item.Id, serverId).then(resolve, reject);
|
recordingEditor.show(item.Id, serverId).then(resolve, reject);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
require(['metadataEditor'], function (metadataEditor) {
|
import('metadataEditor').then(({default: metadataEditor}) => {
|
||||||
metadataEditor.show(item.Id, serverId).then(resolve, reject);
|
metadataEditor.show(item.Id, serverId).then(resolve, reject);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -562,7 +573,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
|
|
||||||
function deleteItem(apiClient, item) {
|
function deleteItem(apiClient, item) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
require(['deleteHelper'], function (deleteHelper) {
|
import('deleteHelper').then(({default: deleteHelper}) => {
|
||||||
deleteHelper.deleteItem({
|
deleteHelper.deleteItem({
|
||||||
item: item,
|
item: item,
|
||||||
navigate: false
|
navigate: false
|
||||||
|
@ -574,7 +585,7 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
}
|
}
|
||||||
|
|
||||||
function refresh(apiClient, item) {
|
function refresh(apiClient, item) {
|
||||||
require(['refreshDialog'], function (refreshDialog) {
|
import('refreshDialog').then(({default: refreshDialog}) => {
|
||||||
new refreshDialog({
|
new refreshDialog({
|
||||||
itemIds: [item.Id],
|
itemIds: [item.Id],
|
||||||
serverId: apiClient.serverInfo().Id,
|
serverId: apiClient.serverInfo().Id,
|
||||||
|
@ -583,8 +594,8 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function show(options) {
|
export function show(options) {
|
||||||
var commands = getCommands(options);
|
const commands = getCommands(options);
|
||||||
if (!commands.length) {
|
if (!commands.length) {
|
||||||
return Promise.reject();
|
return Promise.reject();
|
||||||
}
|
}
|
||||||
|
@ -598,8 +609,9 @@ define(['apphost', 'globalize', 'connectionManager', 'itemHelper', 'appRouter',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
/* eslint-enable indent */
|
||||||
getCommands: getCommands,
|
|
||||||
show: show
|
export default {
|
||||||
};
|
getCommands: getCommands,
|
||||||
});
|
show: show
|
||||||
|
};
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom, browser, events) {
|
import dom from 'dom';
|
||||||
'use strict';
|
import browser from 'browser';
|
||||||
|
import events from 'events';
|
||||||
|
import 'emby-tabs';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
var tabOwnerView;
|
/* eslint-disable indent */
|
||||||
var queryScope = document.querySelector('.skinHeader');
|
|
||||||
var footerTabsContainer;
|
let tabOwnerView;
|
||||||
var headerTabsContainer;
|
const queryScope = document.querySelector('.skinHeader');
|
||||||
var tabsElem;
|
let footerTabsContainer;
|
||||||
|
let headerTabsContainer;
|
||||||
|
let tabsElem;
|
||||||
|
|
||||||
function enableTabsInFooter() {
|
function enableTabsInFooter() {
|
||||||
return false;
|
return false;
|
||||||
|
@ -44,7 +49,7 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var classList = elem.classList;
|
const classList = elem.classList;
|
||||||
if (classList) {
|
if (classList) {
|
||||||
return !classList.contains('scrollX') && !classList.contains('animatedScrollX');
|
return !classList.contains('scrollX') && !classList.contains('animatedScrollX');
|
||||||
}
|
}
|
||||||
|
@ -52,7 +57,7 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parent = target;
|
let parent = target;
|
||||||
while (parent != null) {
|
while (parent != null) {
|
||||||
if (!allowSwipeOn(parent)) {
|
if (!allowSwipeOn(parent)) {
|
||||||
return false;
|
return false;
|
||||||
|
@ -70,22 +75,22 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||||
}
|
}
|
||||||
|
|
||||||
// implement without hammer
|
// implement without hammer
|
||||||
var pageCount = getTabContainersFn().length;
|
const pageCount = getTabContainersFn().length;
|
||||||
var onSwipeLeft = function (e, target) {
|
const onSwipeLeft = function (e, target) {
|
||||||
if (allowSwipe(target) && view.contains(target)) {
|
if (allowSwipe(target) && view.contains(target)) {
|
||||||
tabsElem.selectNext();
|
tabsElem.selectNext();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
var onSwipeRight = function (e, target) {
|
const onSwipeRight = function (e, target) {
|
||||||
if (allowSwipe(target) && view.contains(target)) {
|
if (allowSwipe(target) && view.contains(target)) {
|
||||||
tabsElem.selectPrevious();
|
tabsElem.selectPrevious();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
require(['touchHelper'], function (TouchHelper) {
|
import('touchHelper').then(({default: TouchHelper}) => {
|
||||||
|
|
||||||
var touchHelper = new TouchHelper.default(view.parentNode.parentNode);
|
const touchHelper = new TouchHelper(view.parentNode.parentNode);
|
||||||
|
|
||||||
events.on(touchHelper, 'swipeleft', onSwipeLeft);
|
events.on(touchHelper, 'swipeleft', onSwipeLeft);
|
||||||
events.on(touchHelper, 'swiperight', onSwipeRight);
|
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 (!view) {
|
||||||
if (tabOwnerView) {
|
if (tabOwnerView) {
|
||||||
|
@ -129,7 +134,7 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||||
|
|
||||||
ensureElements(enableInFooter);
|
ensureElements(enableInFooter);
|
||||||
|
|
||||||
var tabsContainerElem = enableInFooter ? footerTabsContainer : headerTabsContainer;
|
const tabsContainerElem = enableInFooter ? footerTabsContainer : headerTabsContainer;
|
||||||
|
|
||||||
if (!tabOwnerView) {
|
if (!tabOwnerView) {
|
||||||
tabsContainerElem.classList.remove('hide');
|
tabsContainerElem.classList.remove('hide');
|
||||||
|
@ -137,18 +142,18 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||||
|
|
||||||
if (tabOwnerView !== view) {
|
if (tabOwnerView !== view) {
|
||||||
|
|
||||||
var index = 0;
|
let index = 0;
|
||||||
|
|
||||||
var indexAttribute = selectedIndex == null ? '' : (' data-index="' + selectedIndex + '"');
|
const 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 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) {
|
if (t.enabled === false) {
|
||||||
tabClass += ' hide';
|
tabClass += ' hide';
|
||||||
}
|
}
|
||||||
|
|
||||||
var tabHtml;
|
let tabHtml;
|
||||||
|
|
||||||
if (t.cssClass) {
|
if (t.cssClass) {
|
||||||
tabClass += ' ' + t.cssClass;
|
tabClass += ' ' + t.cssClass;
|
||||||
|
@ -177,16 +182,16 @@ define(['dom', 'browser', 'events', 'emby-tabs', 'emby-button'], function (dom,
|
||||||
|
|
||||||
tabsElem.addEventListener('beforetabchange', function (e) {
|
tabsElem.addEventListener('beforetabchange', function (e) {
|
||||||
|
|
||||||
var tabContainers = getTabContainersFn();
|
const tabContainers = getTabContainersFn();
|
||||||
if (e.detail.previousIndex != null) {
|
if (e.detail.previousIndex != null) {
|
||||||
|
|
||||||
var previousPanel = tabContainers[e.detail.previousIndex];
|
const previousPanel = tabContainers[e.detail.previousIndex];
|
||||||
if (previousPanel) {
|
if (previousPanel) {
|
||||||
previousPanel.classList.remove('is-active');
|
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 (e.detail.previousIndex != null && e.detail.previousIndex != e.detail.selectedTabIndex) {
|
||||||
// if (newPanel.animate && (animateTabs || []).indexOf(e.detail.selectedTabIndex) != -1) {
|
// 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) {
|
if (!tabsElem) {
|
||||||
tabsElem = tabsContainerElem.querySelector('[is="emby-tabs"]');
|
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 document.querySelector('.tabs-viewmenubar');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
/* eslint-enable indent */
|
||||||
setTabs: setTabs,
|
|
||||||
getTabsElement: getTabsElement,
|
|
||||||
selectedTabIndex: selectedTabIndex
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
|
@ -212,7 +212,7 @@ define(['itemHelper', 'dom', 'layoutManager', 'dialogHelper', 'datetime', 'loadi
|
||||||
function addElementToList(source, sortCallback) {
|
function addElementToList(source, sortCallback) {
|
||||||
require(['prompt'], function (prompt) {
|
require(['prompt'], function (prompt) {
|
||||||
|
|
||||||
prompt({
|
prompt.default({
|
||||||
label: 'Value:'
|
label: 'Value:'
|
||||||
}).then(function (text) {
|
}).then(function (text) {
|
||||||
var list = dom.parentWithClass(source, 'editableListviewContainer').querySelector('.paperList');
|
var list = dom.parentWithClass(source, 'editableListviewContainer').querySelector('.paperList');
|
||||||
|
|
|
@ -1,13 +1,20 @@
|
||||||
define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'globalize', 'appRouter', 'dom', 'css!./multiSelect'], function (browser, appStorage, appHost, loading, connectionManager, globalize, appRouter, dom) {
|
import browser from 'browser';
|
||||||
'use strict';
|
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 = [];
|
/* eslint-disable indent */
|
||||||
var selectedElements = [];
|
|
||||||
var currentSelectionCommandsPanel;
|
let selectedItems = [];
|
||||||
|
let selectedElements = [];
|
||||||
|
let currentSelectionCommandsPanel;
|
||||||
|
|
||||||
function hideSelections() {
|
function hideSelections() {
|
||||||
|
|
||||||
var selectionCommandsPanel = currentSelectionCommandsPanel;
|
const selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||||
if (selectionCommandsPanel) {
|
if (selectionCommandsPanel) {
|
||||||
|
|
||||||
selectionCommandsPanel.parentNode.removeChild(selectionCommandsPanel);
|
selectionCommandsPanel.parentNode.removeChild(selectionCommandsPanel);
|
||||||
|
@ -15,10 +22,10 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
selectedItems = [];
|
selectedItems = [];
|
||||||
selectedElements = [];
|
selectedElements = [];
|
||||||
var elems = document.querySelectorAll('.itemSelectionPanel');
|
const elems = document.querySelectorAll('.itemSelectionPanel');
|
||||||
for (var i = 0, length = elems.length; i < length; i++) {
|
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.removeChild(elems[i]);
|
||||||
parent.classList.remove('withMultiSelect');
|
parent.classList.remove('withMultiSelect');
|
||||||
}
|
}
|
||||||
|
@ -29,14 +36,14 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
// toggle the checkbox, if it wasn't clicked on
|
// toggle the checkbox, if it wasn't clicked on
|
||||||
if (!dom.parentWithClass(e.target, 'chkItemSelect')) {
|
if (!dom.parentWithClass(e.target, 'chkItemSelect')) {
|
||||||
var chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
const chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||||
|
|
||||||
if (chkItemSelect) {
|
if (chkItemSelect) {
|
||||||
|
|
||||||
if (chkItemSelect.classList.contains('checkedInitial')) {
|
if (chkItemSelect.classList.contains('checkedInitial')) {
|
||||||
chkItemSelect.classList.remove('checkedInitial');
|
chkItemSelect.classList.remove('checkedInitial');
|
||||||
} else {
|
} else {
|
||||||
var newValue = !chkItemSelect.checked;
|
const newValue = !chkItemSelect.checked;
|
||||||
chkItemSelect.checked = newValue;
|
chkItemSelect.checked = newValue;
|
||||||
updateItemSelection(chkItemSelect, newValue);
|
updateItemSelection(chkItemSelect, newValue);
|
||||||
}
|
}
|
||||||
|
@ -50,11 +57,11 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
function updateItemSelection(chkItemSelect, selected) {
|
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) {
|
if (selected) {
|
||||||
|
|
||||||
var current = selectedItems.filter(function (i) {
|
const current = selectedItems.filter(i => {
|
||||||
return i === id;
|
return i === id;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -64,16 +71,16 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
selectedItems = selectedItems.filter(function (i) {
|
selectedItems = selectedItems.filter(i => {
|
||||||
return i !== id;
|
return i !== id;
|
||||||
});
|
});
|
||||||
selectedElements = selectedElements.filter(function (i) {
|
selectedElements = selectedElements.filter(i => {
|
||||||
return i !== chkItemSelect;
|
return i !== chkItemSelect;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (selectedItems.length) {
|
if (selectedItems.length) {
|
||||||
var itemSelectionCount = document.querySelector('.itemSelectionCount');
|
const itemSelectionCount = document.querySelector('.itemSelectionCount');
|
||||||
if (itemSelectionCount) {
|
if (itemSelectionCount) {
|
||||||
itemSelectionCount.innerHTML = selectedItems.length;
|
itemSelectionCount.innerHTML = selectedItems.length;
|
||||||
}
|
}
|
||||||
|
@ -88,33 +95,33 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
function showSelection(item, isChecked) {
|
function showSelection(item, isChecked) {
|
||||||
|
|
||||||
var itemSelectionPanel = item.querySelector('.itemSelectionPanel');
|
let itemSelectionPanel = item.querySelector('.itemSelectionPanel');
|
||||||
|
|
||||||
if (!itemSelectionPanel) {
|
if (!itemSelectionPanel) {
|
||||||
|
|
||||||
itemSelectionPanel = document.createElement('div');
|
itemSelectionPanel = document.createElement('div');
|
||||||
itemSelectionPanel.classList.add('itemSelectionPanel');
|
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.classList.add('withMultiSelect');
|
||||||
parent.appendChild(itemSelectionPanel);
|
parent.appendChild(itemSelectionPanel);
|
||||||
|
|
||||||
var cssClass = 'chkItemSelect';
|
let cssClass = 'chkItemSelect';
|
||||||
if (isChecked && !browser.firefox) {
|
if (isChecked && !browser.firefox) {
|
||||||
// In firefox, the initial tap hold doesnt' get treated as a click
|
// 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
|
// In other browsers it does, so we need to make sure that initial click is ignored
|
||||||
cssClass += ' checkedInitial';
|
cssClass += ' checkedInitial';
|
||||||
}
|
}
|
||||||
var checkedAttribute = isChecked ? ' checked' : '';
|
const checkedAttribute = isChecked ? ' checked' : '';
|
||||||
itemSelectionPanel.innerHTML = '<label class="checkboxContainer"><input type="checkbox" is="emby-checkbox" data-outlineclass="multiSelectCheckboxOutline" class="' + cssClass + '"' + checkedAttribute + '/><span></span></label>';
|
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 chkItemSelect = itemSelectionPanel.querySelector('.chkItemSelect');
|
||||||
chkItemSelect.addEventListener('change', onSelectionChange);
|
chkItemSelect.addEventListener('change', onSelectionChange);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function showSelectionCommands() {
|
function showSelectionCommands() {
|
||||||
|
|
||||||
var selectionCommandsPanel = currentSelectionCommandsPanel;
|
let selectionCommandsPanel = currentSelectionCommandsPanel;
|
||||||
|
|
||||||
if (!selectionCommandsPanel) {
|
if (!selectionCommandsPanel) {
|
||||||
|
|
||||||
|
@ -124,19 +131,19 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
document.body.appendChild(selectionCommandsPanel);
|
document.body.appendChild(selectionCommandsPanel);
|
||||||
currentSelectionCommandsPanel = 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 += '<button is="paper-icon-button-light" class="btnCloseSelectionPanel autoSize"><span class="material-icons close"></span></button>';
|
||||||
html += '<h1 class="itemSelectionCount"></h1>';
|
html += '<h1 class="itemSelectionCount"></h1>';
|
||||||
|
|
||||||
const moreIcon = 'more_vert';
|
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.innerHTML = html;
|
||||||
|
|
||||||
selectionCommandsPanel.querySelector('.btnCloseSelectionPanel').addEventListener('click', hideSelections);
|
selectionCommandsPanel.querySelector('.btnCloseSelectionPanel').addEventListener('click', hideSelections);
|
||||||
|
|
||||||
var btnSelectionPanelOptions = selectionCommandsPanel.querySelector('.btnSelectionPanelOptions');
|
const btnSelectionPanelOptions = selectionCommandsPanel.querySelector('.btnSelectionPanelOptions');
|
||||||
|
|
||||||
dom.addEventListener(btnSelectionPanelOptions, 'click', showMenuForSelectedItems, { passive: true });
|
dom.addEventListener(btnSelectionPanelOptions, 'click', showMenuForSelectedItems, { passive: true });
|
||||||
}
|
}
|
||||||
|
@ -144,9 +151,9 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
function alertText(options) {
|
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);
|
alert(options).then(resolve, resolve);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -154,24 +161,24 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
function deleteItems(apiClient, itemIds) {
|
function deleteItems(apiClient, itemIds) {
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise((resolve, reject) => {
|
||||||
|
|
||||||
var msg = globalize.translate('ConfirmDeleteItem');
|
let msg = globalize.translate('ConfirmDeleteItem');
|
||||||
var title = globalize.translate('HeaderDeleteItem');
|
let title = globalize.translate('HeaderDeleteItem');
|
||||||
|
|
||||||
if (itemIds.length > 1) {
|
if (itemIds.length > 1) {
|
||||||
msg = globalize.translate('ConfirmDeleteItems');
|
msg = globalize.translate('ConfirmDeleteItems');
|
||||||
title = globalize.translate('HeaderDeleteItems');
|
title = globalize.translate('HeaderDeleteItems');
|
||||||
}
|
}
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
import('confirm').then(({default: confirm}) => {
|
||||||
|
|
||||||
confirm(msg, title).then(function () {
|
confirm(msg, title).then(() => {
|
||||||
var promises = itemIds.map(function (itemId) {
|
const promises = itemIds.map(itemId => {
|
||||||
apiClient.deleteItem(itemId);
|
apiClient.deleteItem(itemId);
|
||||||
});
|
});
|
||||||
|
|
||||||
Promise.all(promises).then(resolve, function () {
|
Promise.all(promises).then(resolve, () => {
|
||||||
|
|
||||||
alertText(globalize.translate('ErrorDeletingItem')).then(reject, reject);
|
alertText(globalize.translate('ErrorDeletingItem')).then(reject, reject);
|
||||||
});
|
});
|
||||||
|
@ -183,11 +190,11 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
function showMenuForSelectedItems(e) {
|
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({
|
menuItems.push({
|
||||||
name: globalize.translate('AddToCollection'),
|
name: globalize.translate('AddToCollection'),
|
||||||
|
@ -244,17 +251,17 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
icon: 'refresh'
|
icon: 'refresh'
|
||||||
});
|
});
|
||||||
|
|
||||||
require(['actionsheet'], function (actionsheet) {
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: e.target,
|
positionTo: e.target,
|
||||||
callback: function (id) {
|
callback: function (id) {
|
||||||
var items = selectedItems.slice(0);
|
const items = selectedItems.slice(0);
|
||||||
var serverId = apiClient.serverInfo().Id;
|
const serverId = apiClient.serverInfo().Id;
|
||||||
|
|
||||||
switch (id) {
|
switch (id) {
|
||||||
case 'addtocollection':
|
case 'addtocollection':
|
||||||
require(['collectionEditor'], function (collectionEditor) {
|
import('collectionEditor').then(({default: collectionEditor}) => {
|
||||||
new collectionEditor.showEditor({
|
new collectionEditor.showEditor({
|
||||||
items: items,
|
items: items,
|
||||||
serverId: serverId
|
serverId: serverId
|
||||||
|
@ -264,7 +271,7 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
dispatchNeedsRefresh();
|
dispatchNeedsRefresh();
|
||||||
break;
|
break;
|
||||||
case 'playlist':
|
case 'playlist':
|
||||||
require(['playlistEditor'], function (playlistEditor) {
|
import('playlistEditor').then(({default: playlistEditor}) => {
|
||||||
new playlistEditor.showEditor({
|
new playlistEditor.showEditor({
|
||||||
items: items,
|
items: items,
|
||||||
serverId: serverId
|
serverId: serverId
|
||||||
|
@ -282,21 +289,21 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
combineVersions(apiClient, items);
|
combineVersions(apiClient, items);
|
||||||
break;
|
break;
|
||||||
case 'markplayed':
|
case 'markplayed':
|
||||||
items.forEach(function (itemId) {
|
items.forEach(itemId => {
|
||||||
apiClient.markPlayed(apiClient.getCurrentUserId(), itemId);
|
apiClient.markPlayed(apiClient.getCurrentUserId(), itemId);
|
||||||
});
|
});
|
||||||
hideSelections();
|
hideSelections();
|
||||||
dispatchNeedsRefresh();
|
dispatchNeedsRefresh();
|
||||||
break;
|
break;
|
||||||
case 'markunplayed':
|
case 'markunplayed':
|
||||||
items.forEach(function (itemId) {
|
items.forEach(itemId => {
|
||||||
apiClient.markUnplayed(apiClient.getCurrentUserId(), itemId);
|
apiClient.markUnplayed(apiClient.getCurrentUserId(), itemId);
|
||||||
});
|
});
|
||||||
hideSelections();
|
hideSelections();
|
||||||
dispatchNeedsRefresh();
|
dispatchNeedsRefresh();
|
||||||
break;
|
break;
|
||||||
case 'refresh':
|
case 'refresh':
|
||||||
require(['refreshDialog'], function (refreshDialog) {
|
import('refreshDialog').then(({default: refreshDialog}) => {
|
||||||
new refreshDialog({
|
new refreshDialog({
|
||||||
itemIds: items,
|
itemIds: items,
|
||||||
serverId: serverId
|
serverId: serverId
|
||||||
|
@ -317,18 +324,18 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
function dispatchNeedsRefresh() {
|
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);
|
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);
|
elems[i].notifyRefreshNeeded(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -337,8 +344,9 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
if (selection.length < 2) {
|
if (selection.length < 2) {
|
||||||
|
|
||||||
require(['alert'], function (alert) {
|
import('alert').then(({default: alert}) => {
|
||||||
alert({
|
alert({
|
||||||
|
|
||||||
text: globalize.translate('PleaseSelectTwoItems')
|
text: globalize.translate('PleaseSelectTwoItems')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -352,7 +360,7 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
url: apiClient.getUrl('Videos/MergeVersions', { Ids: selection.join(',') })
|
url: apiClient.getUrl('Videos/MergeVersions', { Ids: selection.join(',') })
|
||||||
|
|
||||||
}).then(function () {
|
}).then(() => {
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
hideSelections();
|
hideSelections();
|
||||||
|
@ -362,9 +370,9 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
function showSelections(initialCard) {
|
function showSelections(initialCard) {
|
||||||
|
|
||||||
require(['emby-checkbox'], function () {
|
import('emby-checkbox').then(() => {
|
||||||
var cards = document.querySelectorAll('.card');
|
const cards = document.querySelectorAll('.card');
|
||||||
for (var i = 0, length = cards.length; i < length; i++) {
|
for (let i = 0, length = cards.length; i < length; i++) {
|
||||||
showSelection(cards[i], initialCard === cards[i]);
|
showSelection(cards[i], initialCard === cards[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -375,13 +383,13 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
function onContainerClick(e) {
|
function onContainerClick(e) {
|
||||||
|
|
||||||
var target = e.target;
|
const target = e.target;
|
||||||
|
|
||||||
if (selectedItems.length) {
|
if (selectedItems.length) {
|
||||||
|
|
||||||
var card = dom.parentWithClass(target, 'card');
|
const card = dom.parentWithClass(target, 'card');
|
||||||
if (card) {
|
if (card) {
|
||||||
var itemSelectionPanel = card.querySelector('.itemSelectionPanel');
|
const itemSelectionPanel = card.querySelector('.itemSelectionPanel');
|
||||||
if (itemSelectionPanel) {
|
if (itemSelectionPanel) {
|
||||||
return onItemSelectionPanelClick(e, itemSelectionPanel);
|
return onItemSelectionPanelClick(e, itemSelectionPanel);
|
||||||
}
|
}
|
||||||
|
@ -395,15 +403,15 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
document.addEventListener('viewbeforehide', hideSelections);
|
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) {
|
function onTapHold(e) {
|
||||||
|
|
||||||
var card = dom.parentWithClass(e.target, 'card');
|
const card = dom.parentWithClass(e.target, 'card');
|
||||||
|
|
||||||
if (card) {
|
if (card) {
|
||||||
|
|
||||||
|
@ -423,13 +431,13 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
return e.changedTouches || e.targetTouches || e.touches;
|
return e.changedTouches || e.targetTouches || e.touches;
|
||||||
}
|
}
|
||||||
|
|
||||||
var touchTarget;
|
let touchTarget;
|
||||||
var touchStartTimeout;
|
let touchStartTimeout;
|
||||||
var touchStartX;
|
let touchStartX;
|
||||||
var touchStartY;
|
let touchStartY;
|
||||||
function onTouchStart(e) {
|
function onTouchStart(e) {
|
||||||
|
|
||||||
var touch = getTouches(e)[0];
|
const touch = getTouches(e)[0];
|
||||||
touchTarget = null;
|
touchTarget = null;
|
||||||
touchStartX = 0;
|
touchStartX = 0;
|
||||||
touchStartY = 0;
|
touchStartY = 0;
|
||||||
|
@ -437,10 +445,10 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
if (touch) {
|
if (touch) {
|
||||||
touchStartX = touch.clientX;
|
touchStartX = touch.clientX;
|
||||||
touchStartY = touch.clientY;
|
touchStartY = touch.clientY;
|
||||||
var element = touch.target;
|
const element = touch.target;
|
||||||
|
|
||||||
if (element) {
|
if (element) {
|
||||||
var card = dom.parentWithClass(element, 'card');
|
const card = dom.parentWithClass(element, 'card');
|
||||||
|
|
||||||
if (card) {
|
if (card) {
|
||||||
|
|
||||||
|
@ -459,13 +467,13 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
function onTouchMove(e) {
|
function onTouchMove(e) {
|
||||||
|
|
||||||
if (touchTarget) {
|
if (touchTarget) {
|
||||||
var touch = getTouches(e)[0];
|
const touch = getTouches(e)[0];
|
||||||
var deltaX;
|
let deltaX;
|
||||||
var deltaY;
|
let deltaY;
|
||||||
|
|
||||||
if (touch) {
|
if (touch) {
|
||||||
var touchEndX = touch.clientX || 0;
|
const touchEndX = touch.clientX || 0;
|
||||||
var touchEndY = touch.clientY || 0;
|
const touchEndY = touch.clientY || 0;
|
||||||
deltaX = Math.abs(touchEndX - (touchStartX || 0));
|
deltaX = Math.abs(touchEndX - (touchStartX || 0));
|
||||||
deltaY = Math.abs(touchEndY - (touchStartY || 0));
|
deltaY = Math.abs(touchEndY - (touchStartY || 0));
|
||||||
} else {
|
} else {
|
||||||
|
@ -509,7 +517,7 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var card = dom.parentWithClass(touchTarget, 'card');
|
const card = dom.parentWithClass(touchTarget, 'card');
|
||||||
touchTarget = null;
|
touchTarget = null;
|
||||||
|
|
||||||
if (card) {
|
if (card) {
|
||||||
|
@ -556,12 +564,12 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
|
|
||||||
self.onContainerClick = onContainerClick;
|
self.onContainerClick = onContainerClick;
|
||||||
|
|
||||||
self.destroy = function () {
|
self.destroy = () => {
|
||||||
|
|
||||||
container.removeEventListener('click', onContainerClick);
|
container.removeEventListener('click', onContainerClick);
|
||||||
container.removeEventListener('contextmenu', onTapHold);
|
container.removeEventListener('contextmenu', onTapHold);
|
||||||
|
|
||||||
var element = container;
|
const element = container;
|
||||||
|
|
||||||
dom.removeEventListener(element, 'touchstart', onTouchStart, {
|
dom.removeEventListener(element, 'touchstart', onTouchStart, {
|
||||||
passive: true
|
passive: true
|
||||||
|
@ -586,5 +594,6 @@ define(['browser', 'appStorage', 'apphost', 'loading', 'connectionManager', 'glo
|
||||||
passive: true
|
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) {
|
import require from 'require';
|
||||||
'use strict';
|
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;
|
/* eslint-disable indent */
|
||||||
var currentPlayerSupportedCommands = [];
|
|
||||||
|
|
||||||
var currentTimeElement;
|
let currentPlayer;
|
||||||
var nowPlayingImageElement;
|
let currentPlayerSupportedCommands = [];
|
||||||
var nowPlayingTextElement;
|
|
||||||
var nowPlayingUserData;
|
|
||||||
var muteButton;
|
|
||||||
var volumeSlider;
|
|
||||||
var volumeSliderContainer;
|
|
||||||
var playPauseButtons;
|
|
||||||
var positionSlider;
|
|
||||||
var toggleRepeatButton;
|
|
||||||
var toggleRepeatButtonIcon;
|
|
||||||
|
|
||||||
var lastUpdateTime = 0;
|
let currentTimeElement;
|
||||||
var lastPlayerState = {};
|
let nowPlayingImageElement;
|
||||||
var isEnabled;
|
let nowPlayingTextElement;
|
||||||
var currentRuntimeTicks = 0;
|
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() {
|
function getNowPlayingBarHtml() {
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
html += '<div class="nowPlayingBar hide nowPlayingBar-hidden">';
|
html += '<div class="nowPlayingBar hide nowPlayingBar-hidden">';
|
||||||
|
|
||||||
|
@ -198,7 +213,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
|
|
||||||
if (currentPlayer) {
|
if (currentPlayer) {
|
||||||
|
|
||||||
var newPercent = parseFloat(this.value);
|
const newPercent = parseFloat(this.value);
|
||||||
|
|
||||||
playbackManager.seekPercent(newPercent, currentPlayer);
|
playbackManager.seekPercent(newPercent, currentPlayer);
|
||||||
}
|
}
|
||||||
|
@ -207,13 +222,13 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
|
|
||||||
positionSlider.getBubbleText = function (value) {
|
positionSlider.getBubbleText = function (value) {
|
||||||
|
|
||||||
var state = lastPlayerState;
|
const state = lastPlayerState;
|
||||||
|
|
||||||
if (!state || !state.NowPlayingItem || !currentRuntimeTicks) {
|
if (!state || !state.NowPlayingItem || !currentRuntimeTicks) {
|
||||||
return '--:--';
|
return '--:--';
|
||||||
}
|
}
|
||||||
|
|
||||||
var ticks = currentRuntimeTicks;
|
let ticks = currentRuntimeTicks;
|
||||||
ticks /= 100;
|
ticks /= 100;
|
||||||
ticks *= value;
|
ticks *= value;
|
||||||
|
|
||||||
|
@ -230,12 +245,12 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
|
|
||||||
function showRemoteControl() {
|
function showRemoteControl() {
|
||||||
|
|
||||||
require(['appRouter'], function (appRouter) {
|
import('appRouter').then(({default: appRouter}) => {
|
||||||
appRouter.showNowPlaying();
|
appRouter.showNowPlaying();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var nowPlayingBarElement;
|
let nowPlayingBarElement;
|
||||||
function getNowPlayingBar() {
|
function getNowPlayingBar() {
|
||||||
|
|
||||||
if (nowPlayingBarElement) {
|
if (nowPlayingBarElement) {
|
||||||
|
@ -243,10 +258,15 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
|
Promise.all([
|
||||||
require(['appFooter-shared', 'itemShortcuts', 'css!./nowPlayingBar.css', 'emby-slider'], function (appfooter, itemShortcuts) {
|
import('appFooter-shared'),
|
||||||
|
import('itemShortcuts'),
|
||||||
var parentContainer = appfooter.element;
|
import('css!./nowPlayingBar.css'),
|
||||||
|
import('emby-slider')
|
||||||
|
])
|
||||||
|
.then(([appfooter, itemShortcuts]) => {
|
||||||
|
console.log(appfooter);
|
||||||
|
const parentContainer = appfooter.element;
|
||||||
nowPlayingBarElement = parentContainer.querySelector('.nowPlayingBar');
|
nowPlayingBarElement = parentContainer.querySelector('.nowPlayingBar');
|
||||||
|
|
||||||
if (nowPlayingBarElement) {
|
if (nowPlayingBarElement) {
|
||||||
|
@ -294,13 +314,13 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
|
|
||||||
lastPlayerState = state;
|
lastPlayerState = state;
|
||||||
|
|
||||||
var playerInfo = playbackManager.getPlayerInfo();
|
const playerInfo = playbackManager.getPlayerInfo();
|
||||||
|
|
||||||
var playState = state.PlayState || {};
|
const playState = state.PlayState || {};
|
||||||
|
|
||||||
updatePlayPauseState(playState.IsPaused);
|
updatePlayPauseState(playState.IsPaused);
|
||||||
|
|
||||||
var supportedCommands = playerInfo.supportedCommands;
|
const supportedCommands = playerInfo.supportedCommands;
|
||||||
currentPlayerSupportedCommands = supportedCommands;
|
currentPlayerSupportedCommands = supportedCommands;
|
||||||
|
|
||||||
if (supportedCommands.indexOf('SetRepeatMode') === -1) {
|
if (supportedCommands.indexOf('SetRepeatMode') === -1) {
|
||||||
|
@ -317,11 +337,11 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
positionSlider.disabled = !playState.CanSeek;
|
positionSlider.disabled = !playState.CanSeek;
|
||||||
|
|
||||||
// determines if both forward and backward buffer progress will be visible
|
// 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);
|
positionSlider.setIsClear(isProgressClear);
|
||||||
}
|
}
|
||||||
|
|
||||||
var nowPlayingItem = state.NowPlayingItem || {};
|
const nowPlayingItem = state.NowPlayingItem || {};
|
||||||
updateTimeDisplay(playState.PositionTicks, nowPlayingItem.RunTimeTicks, playbackManager.getBufferedRanges(player));
|
updateTimeDisplay(playState.PositionTicks, nowPlayingItem.RunTimeTicks, playbackManager.getBufferedRanges(player));
|
||||||
|
|
||||||
updateNowPlayingInfo(state);
|
updateNowPlayingInfo(state);
|
||||||
|
@ -348,7 +368,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
if (positionSlider && !positionSlider.dragging) {
|
if (positionSlider && !positionSlider.dragging) {
|
||||||
if (runtimeTicks) {
|
if (runtimeTicks) {
|
||||||
|
|
||||||
var pct = positionTicks / runtimeTicks;
|
let pct = positionTicks / runtimeTicks;
|
||||||
pct *= 100;
|
pct *= 100;
|
||||||
|
|
||||||
positionSlider.value = pct;
|
positionSlider.value = pct;
|
||||||
|
@ -365,7 +385,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
|
|
||||||
if (currentTimeElement) {
|
if (currentTimeElement) {
|
||||||
|
|
||||||
var timeText = positionTicks == null ? '--:--' : datetime.getDisplayRunningTime(positionTicks);
|
let timeText = positionTicks == null ? '--:--' : datetime.getDisplayRunningTime(positionTicks);
|
||||||
|
|
||||||
if (runtimeTicks) {
|
if (runtimeTicks) {
|
||||||
timeText += ' / ' + datetime.getDisplayRunningTime(runtimeTicks);
|
timeText += ' / ' + datetime.getDisplayRunningTime(runtimeTicks);
|
||||||
|
@ -377,10 +397,10 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
|
|
||||||
function updatePlayerVolumeState(isMuted, volumeLevel) {
|
function updatePlayerVolumeState(isMuted, volumeLevel) {
|
||||||
|
|
||||||
var supportedCommands = currentPlayerSupportedCommands;
|
const supportedCommands = currentPlayerSupportedCommands;
|
||||||
|
|
||||||
var showMuteButton = true;
|
let showMuteButton = true;
|
||||||
var showVolumeSlider = true;
|
let showVolumeSlider = true;
|
||||||
|
|
||||||
if (supportedCommands.indexOf('ToggleMute') === -1) {
|
if (supportedCommands.indexOf('ToggleMute') === -1) {
|
||||||
showMuteButton = false;
|
showMuteButton = false;
|
||||||
|
@ -495,37 +515,37 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentImgUrl;
|
let currentImgUrl;
|
||||||
function updateNowPlayingInfo(state) {
|
function updateNowPlayingInfo(state) {
|
||||||
|
|
||||||
var nowPlayingItem = state.NowPlayingItem;
|
const nowPlayingItem = state.NowPlayingItem;
|
||||||
|
|
||||||
var textLines = nowPlayingItem ? nowPlayingHelper.getNowPlayingNames(nowPlayingItem) : [];
|
const textLines = nowPlayingItem ? nowPlayingHelper.getNowPlayingNames(nowPlayingItem) : [];
|
||||||
if (textLines.length > 1) {
|
if (textLines.length > 1) {
|
||||||
textLines[1].secondary = true;
|
textLines[1].secondary = true;
|
||||||
}
|
}
|
||||||
nowPlayingTextElement.innerHTML = textLines.map(function (nowPlayingName) {
|
nowPlayingTextElement.innerHTML = textLines.map(function (nowPlayingName) {
|
||||||
|
|
||||||
var cssClass = nowPlayingName.secondary ? ' class="nowPlayingBarSecondaryText"' : '';
|
const cssClass = nowPlayingName.secondary ? ' class="nowPlayingBarSecondaryText"' : '';
|
||||||
|
|
||||||
if (nowPlayingName.item) {
|
if (nowPlayingName.item) {
|
||||||
var nowPlayingText = getTextActionButton(nowPlayingName.item, nowPlayingName.text);
|
const nowPlayingText = getTextActionButton(nowPlayingName.item, nowPlayingName.text);
|
||||||
return `<div ${cssClass}>${nowPlayingText}</div>`;
|
return `<div ${cssClass}>${nowPlayingText}</div>`;
|
||||||
}
|
}
|
||||||
|
let nowPlayingText = '';
|
||||||
return `<div ${cssClass}>${nowPlayingText}</div>`;
|
return `<div ${cssClass}>${nowPlayingText}</div>`;
|
||||||
|
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
var imgHeight = 70;
|
const imgHeight = 70;
|
||||||
|
|
||||||
var url = nowPlayingItem ? (seriesImageUrl(nowPlayingItem, {
|
const url = nowPlayingItem ? (seriesImageUrl(nowPlayingItem, {
|
||||||
height: imgHeight
|
height: imgHeight
|
||||||
}) || imageUrl(nowPlayingItem, {
|
}) || imageUrl(nowPlayingItem, {
|
||||||
height: imgHeight
|
height: imgHeight
|
||||||
})) : null;
|
})) : null;
|
||||||
|
|
||||||
var isRefreshing = false;
|
let isRefreshing = false;
|
||||||
|
|
||||||
if (url !== currentImgUrl) {
|
if (url !== currentImgUrl) {
|
||||||
currentImgUrl = url;
|
currentImgUrl = url;
|
||||||
|
@ -541,12 +561,12 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
if (nowPlayingItem.Id) {
|
if (nowPlayingItem.Id) {
|
||||||
if (isRefreshing) {
|
if (isRefreshing) {
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId);
|
const apiClient = connectionManager.getApiClient(nowPlayingItem.ServerId);
|
||||||
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
|
apiClient.getItem(apiClient.getCurrentUserId(), nowPlayingItem.Id).then(function (item) {
|
||||||
var userData = item.UserData || {};
|
const userData = item.UserData || {};
|
||||||
var likes = userData.Likes == null ? '' : userData.Likes;
|
const likes = userData.Likes == null ? '' : userData.Likes;
|
||||||
var contextButton = document.querySelector('.btnToggleContextMenu');
|
const contextButton = document.querySelector('.btnToggleContextMenu');
|
||||||
var options = {
|
const options = {
|
||||||
play: false,
|
play: false,
|
||||||
queue: false,
|
queue: false,
|
||||||
positionTo: contextButton
|
positionTo: contextButton
|
||||||
|
@ -570,7 +590,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
function onPlaybackStart(e, state) {
|
function onPlaybackStart(e, state) {
|
||||||
console.debug('nowplaying event: ' + e.type);
|
console.debug('nowplaying event: ' + e.type);
|
||||||
|
|
||||||
var player = this;
|
const player = this;
|
||||||
|
|
||||||
onStateChanged.call(player, e, state);
|
onStateChanged.call(player, e, state);
|
||||||
}
|
}
|
||||||
|
@ -581,7 +601,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var player = this;
|
const player = this;
|
||||||
|
|
||||||
updateRepeatModeDisplay(playbackManager.getRepeatMode(player));
|
updateRepeatModeDisplay(playbackManager.getRepeatMode(player));
|
||||||
}
|
}
|
||||||
|
@ -604,7 +624,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
// in the event of a stop->play command
|
// 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
|
// 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) {
|
if (elem) {
|
||||||
|
|
||||||
slideDown(elem);
|
slideDown(elem);
|
||||||
|
@ -614,7 +634,7 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
function onPlaybackStopped(e, state) {
|
function onPlaybackStopped(e, state) {
|
||||||
|
|
||||||
console.debug('nowplaying event: ' + e.type);
|
console.debug('nowplaying event: ' + e.type);
|
||||||
var player = this;
|
const player = this;
|
||||||
|
|
||||||
if (player.isLocalPlayer) {
|
if (player.isLocalPlayer) {
|
||||||
if (state.NextMediaType !== 'Audio') {
|
if (state.NextMediaType !== 'Audio') {
|
||||||
|
@ -633,14 +653,14 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var player = this;
|
const player = this;
|
||||||
updatePlayPauseState(player.paused());
|
updatePlayPauseState(player.paused());
|
||||||
}
|
}
|
||||||
|
|
||||||
function onStateChanged(event, state) {
|
function onStateChanged(event, state) {
|
||||||
|
|
||||||
console.debug('nowplaying event: ' + event.type);
|
console.debug('nowplaying event: ' + event.type);
|
||||||
var player = this;
|
const player = this;
|
||||||
|
|
||||||
if (!state.NowPlayingItem || layoutManager.tv) {
|
if (!state.NowPlayingItem || layoutManager.tv) {
|
||||||
hideNowPlayingBar();
|
hideNowPlayingBar();
|
||||||
|
@ -671,21 +691,21 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
}
|
}
|
||||||
|
|
||||||
// Try to avoid hammering the document with changes
|
// Try to avoid hammering the document with changes
|
||||||
var now = new Date().getTime();
|
const now = new Date().getTime();
|
||||||
if ((now - lastUpdateTime) < 700) {
|
if ((now - lastUpdateTime) < 700) {
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
lastUpdateTime = now;
|
lastUpdateTime = now;
|
||||||
|
|
||||||
var player = this;
|
const player = this;
|
||||||
currentRuntimeTicks = playbackManager.duration(player);
|
currentRuntimeTicks = playbackManager.duration(player);
|
||||||
updateTimeDisplay(playbackManager.currentTime(player), currentRuntimeTicks, playbackManager.getBufferedRanges(player));
|
updateTimeDisplay(playbackManager.currentTime(player), currentRuntimeTicks, playbackManager.getBufferedRanges(player));
|
||||||
}
|
}
|
||||||
|
|
||||||
function releaseCurrentPlayer() {
|
function releaseCurrentPlayer() {
|
||||||
|
|
||||||
var player = currentPlayer;
|
const player = currentPlayer;
|
||||||
|
|
||||||
if (player) {
|
if (player) {
|
||||||
events.off(player, 'playbackstart', onPlaybackStart);
|
events.off(player, 'playbackstart', onPlaybackStart);
|
||||||
|
@ -708,14 +728,14 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var player = this;
|
const player = this;
|
||||||
|
|
||||||
updatePlayerVolumeState(player.isMuted(), player.getVolume());
|
updatePlayerVolumeState(player.isMuted(), player.getVolume());
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshFromPlayer(player) {
|
function refreshFromPlayer(player) {
|
||||||
|
|
||||||
var state = playbackManager.getPlayerState(player);
|
const state = playbackManager.getPlayerState(player);
|
||||||
|
|
||||||
onStateChanged.call(player, { type: 'init' }, state);
|
onStateChanged.call(player, { type: 'init' }, state);
|
||||||
}
|
}
|
||||||
|
@ -771,4 +791,5 @@ define(['require', 'datetime', 'itemHelper', 'events', 'browser', 'imageLoader',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -709,7 +709,7 @@ define(['events', 'datetime', 'appSettings', 'itemHelper', 'pluginManager', 'pla
|
||||||
function showPlaybackInfoErrorMessage(instance, errorCode, playNextTrack) {
|
function showPlaybackInfoErrorMessage(instance, errorCode, playNextTrack) {
|
||||||
|
|
||||||
require(['alert'], function (alert) {
|
require(['alert'], function (alert) {
|
||||||
alert({
|
alert.default({
|
||||||
text: globalize.translate('PlaybackError' + errorCode),
|
text: globalize.translate('PlaybackError' + errorCode),
|
||||||
title: globalize.translate('HeaderPlaybackError')
|
title: globalize.translate('HeaderPlaybackError')
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
|
|
|
@ -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) {
|
import browser from 'browser';
|
||||||
'use strict';
|
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) {
|
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 {
|
return {
|
||||||
name: globalize.translate('ValueSeconds', option),
|
name: globalize.translate('ValueSeconds', option),
|
||||||
value: option * 1000
|
value: option * 1000
|
||||||
};
|
};
|
||||||
}).map(function (o) {
|
}).map(o => {
|
||||||
return '<option value="' + o.value + '">' + o.name + '</option>';
|
return `<option value="${o.value}">${o.name}</option>`;
|
||||||
}).join('');
|
}).join('');
|
||||||
}
|
}
|
||||||
|
|
||||||
function populateLanguages(select, languages) {
|
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;
|
select.innerHTML = html;
|
||||||
|
@ -33,7 +44,7 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
|
|
||||||
function setMaxBitrateIntoField(select, isInNetwork, mediatype) {
|
function setMaxBitrateIntoField(select, isInNetwork, mediatype) {
|
||||||
|
|
||||||
var options = mediatype === 'Audio' ? qualityoptions.getAudioQualityOptions({
|
const options = mediatype === 'Audio' ? qualityoptions.getAudioQualityOptions({
|
||||||
|
|
||||||
currentMaxBitrate: appSettings.maxStreamingBitrate(isInNetwork, mediatype),
|
currentMaxBitrate: appSettings.maxStreamingBitrate(isInNetwork, mediatype),
|
||||||
isAutomaticBitrateEnabled: appSettings.enableAutomaticBitrateDetection(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
|
// 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('');
|
}).join('');
|
||||||
|
|
||||||
if (appSettings.enableAutomaticBitrateDetection(isInNetwork, mediatype)) {
|
if (appSettings.enableAutomaticBitrateDetection(isInNetwork, mediatype)) {
|
||||||
|
@ -62,23 +73,23 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
|
|
||||||
function fillChromecastQuality(select) {
|
function fillChromecastQuality(select) {
|
||||||
|
|
||||||
var options = qualityoptions.getVideoQualityOptions({
|
const options = qualityoptions.getVideoQualityOptions({
|
||||||
|
|
||||||
currentMaxBitrate: appSettings.maxChromecastBitrate(),
|
currentMaxBitrate: appSettings.maxChromecastBitrate(),
|
||||||
isAutomaticBitrateEnabled: !appSettings.maxChromecastBitrate(),
|
isAutomaticBitrateEnabled: !appSettings.maxChromecastBitrate(),
|
||||||
enableAuto: true
|
enableAuto: true
|
||||||
});
|
});
|
||||||
|
|
||||||
select.innerHTML = options.map(function (i) {
|
select.innerHTML = options.map(i => {
|
||||||
|
|
||||||
// render empty string instead of 0 for the auto option
|
// 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('');
|
}).join('');
|
||||||
|
|
||||||
select.value = appSettings.maxChromecastBitrate() || '';
|
select.value = appSettings.maxChromecastBitrate() || '';
|
||||||
}
|
}
|
||||||
|
|
||||||
function setMaxBitrateFromField(select, isInNetwork, mediatype, value) {
|
function setMaxBitrateFromField(select, isInNetwork, mediatype) {
|
||||||
|
|
||||||
if (select.value) {
|
if (select.value) {
|
||||||
appSettings.maxStreamingBitrate(isInNetwork, mediatype, select.value);
|
appSettings.maxStreamingBitrate(isInNetwork, mediatype, select.value);
|
||||||
|
@ -110,7 +121,7 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
apiClient.getEndpointInfo().then(function (endpointInfo) {
|
apiClient.getEndpointInfo().then(endpointInfo => {
|
||||||
|
|
||||||
if (endpointInfo.IsInNetwork) {
|
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) {
|
if (browser.tizen || browser.web0s) {
|
||||||
context.querySelector('.fldEpisodeAutoPlay').classList.add('hide');
|
context.querySelector('.fldEpisodeAutoPlay').classList.add('hide');
|
||||||
|
@ -145,12 +156,12 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
|
|
||||||
function loadForm(context, user, userSettings, apiClient) {
|
function loadForm(context, user, userSettings, apiClient) {
|
||||||
|
|
||||||
var loggedInUserId = apiClient.getCurrentUserId();
|
const loggedInUserId = apiClient.getCurrentUserId();
|
||||||
var userId = user.Id;
|
const userId = user.Id;
|
||||||
|
|
||||||
showHideQualityFields(context, user, apiClient);
|
showHideQualityFields(context, user, apiClient);
|
||||||
|
|
||||||
apiClient.getCultures().then(function (allCultures) {
|
apiClient.getCultures().then(allCultures => {
|
||||||
|
|
||||||
populateLanguages(context.querySelector('#selectAudioLanguage'), 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
|
// 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) {
|
if (cinemaConfig.EnableIntrosForMovies || cinemaConfig.EnableIntrosForEpisodes) {
|
||||||
context.querySelector('.cinemaModeOptions').classList.remove('hide');
|
context.querySelector('.cinemaModeOptions').classList.remove('hide');
|
||||||
|
@ -204,18 +215,18 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
|
|
||||||
fillChromecastQuality(context.querySelector('.selectChromecastVideoQuality'));
|
fillChromecastQuality(context.querySelector('.selectChromecastVideoQuality'));
|
||||||
|
|
||||||
var selectChromecastVersion = context.querySelector('.selectChromecastVersion');
|
const selectChromecastVersion = context.querySelector('.selectChromecastVersion');
|
||||||
selectChromecastVersion.value = userSettings.chromecastVersion();
|
selectChromecastVersion.value = userSettings.chromecastVersion();
|
||||||
|
|
||||||
var selectSkipForwardLength = context.querySelector('.selectSkipForwardLength');
|
const selectSkipForwardLength = context.querySelector('.selectSkipForwardLength');
|
||||||
fillSkipLengths(selectSkipForwardLength);
|
fillSkipLengths(selectSkipForwardLength);
|
||||||
selectSkipForwardLength.value = userSettings.skipForwardLength();
|
selectSkipForwardLength.value = userSettings.skipForwardLength();
|
||||||
|
|
||||||
var selectSkipBackLength = context.querySelector('.selectSkipBackLength');
|
const selectSkipBackLength = context.querySelector('.selectSkipBackLength');
|
||||||
fillSkipLengths(selectSkipBackLength);
|
fillSkipLengths(selectSkipBackLength);
|
||||||
selectSkipBackLength.value = userSettings.skipBackLength();
|
selectSkipBackLength.value = userSettings.skipBackLength();
|
||||||
|
|
||||||
showOrHideEpisodesField(context, user, apiClient);
|
showOrHideEpisodesField(context);
|
||||||
|
|
||||||
loading.hide();
|
loading.hide();
|
||||||
}
|
}
|
||||||
|
@ -248,20 +259,20 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
|
|
||||||
loading.show();
|
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();
|
loading.hide();
|
||||||
if (enableSaveConfirmation) {
|
if (enableSaveConfirmation) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
events.trigger(instance, 'saved');
|
events.trigger(instance, 'saved');
|
||||||
|
|
||||||
}, function () {
|
}, () => {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -269,14 +280,14 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||||
var userId = self.options.userId;
|
const userId = self.options.userId;
|
||||||
var userSettings = self.options.userSettings;
|
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);
|
save(self, self.options.element, userId, userSettings, apiClient, enableSaveConfirmation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -289,7 +300,7 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
|
|
||||||
function embed(options, self) {
|
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.translateDocument(template, 'core');
|
||||||
|
|
||||||
|
@ -307,43 +318,43 @@ define(['require', 'browser', 'appSettings', 'apphost', 'focusManager', 'quality
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function PlaybackSettings(options) {
|
class PlaybackSettings {
|
||||||
|
constructor(options) {
|
||||||
|
this.options = options;
|
||||||
|
embed(options, this);
|
||||||
|
}
|
||||||
|
|
||||||
this.options = options;
|
loadData() {
|
||||||
|
|
||||||
embed(options, this);
|
const self = this;
|
||||||
|
const context = self.options.element;
|
||||||
|
|
||||||
|
loading.show();
|
||||||
|
|
||||||
|
const userId = self.options.userId;
|
||||||
|
const apiClient = connectionManager.getApiClient(self.options.serverId);
|
||||||
|
const userSettings = self.options.userSettings;
|
||||||
|
|
||||||
|
apiClient.getUser(userId).then(user => {
|
||||||
|
|
||||||
|
userSettings.setUserInfo(userId, apiClient).then(() => {
|
||||||
|
|
||||||
|
self.dataLoaded = true;
|
||||||
|
|
||||||
|
loadForm(context, user, userSettings, apiClient);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
submit() {
|
||||||
|
onSubmit.call(this);
|
||||||
|
}
|
||||||
|
|
||||||
|
destroy() {
|
||||||
|
|
||||||
|
this.options = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PlaybackSettings.prototype.loadData = function () {
|
/* eslint-enable indent */
|
||||||
|
export default PlaybackSettings;
|
||||||
var self = this;
|
|
||||||
var context = self.options.element;
|
|
||||||
|
|
||||||
loading.show();
|
|
||||||
|
|
||||||
var userId = self.options.userId;
|
|
||||||
var apiClient = connectionManager.getApiClient(self.options.serverId);
|
|
||||||
var userSettings = self.options.userSettings;
|
|
||||||
|
|
||||||
apiClient.getUser(userId).then(function (user) {
|
|
||||||
|
|
||||||
userSettings.setUserInfo(userId, apiClient).then(function () {
|
|
||||||
|
|
||||||
self.dataLoaded = true;
|
|
||||||
|
|
||||||
loadForm(context, user, userSettings, apiClient);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
PlaybackSettings.prototype.submit = function () {
|
|
||||||
onSubmit.call(this);
|
|
||||||
};
|
|
||||||
|
|
||||||
PlaybackSettings.prototype.destroy = function () {
|
|
||||||
|
|
||||||
this.options = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
return PlaybackSettings;
|
|
||||||
});
|
|
||||||
|
|
|
@ -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) {
|
import browser from 'browser';
|
||||||
'use strict';
|
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) {
|
function replaceAll(str, find, replace) {
|
||||||
return str.split(find).join(replace);
|
return str.split(find).join(replace);
|
||||||
}
|
}
|
||||||
|
|
||||||
function setInputProperties(dlg, options) {
|
function setInputProperties(dlg, options) {
|
||||||
var txtInput = dlg.querySelector('#txtInput');
|
const txtInput = dlg.querySelector('#txtInput');
|
||||||
|
|
||||||
if (txtInput.label) {
|
if (txtInput.label) {
|
||||||
txtInput.label(options.label || '');
|
txtInput.label(options.label || '');
|
||||||
|
@ -17,7 +29,7 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDialog(options, template) {
|
function showDialog(options, template) {
|
||||||
var dialogOptions = {
|
const dialogOptions = {
|
||||||
removeOnClose: true,
|
removeOnClose: true,
|
||||||
scrollY: false
|
scrollY: false
|
||||||
};
|
};
|
||||||
|
@ -26,7 +38,7 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
dialogOptions.size = 'fullscreen';
|
dialogOptions.size = 'fullscreen';
|
||||||
}
|
}
|
||||||
|
|
||||||
var dlg = dialogHelper.createDialog(dialogOptions);
|
const dlg = dialogHelper.createDialog(dialogOptions);
|
||||||
|
|
||||||
dlg.classList.add('formDialog');
|
dlg.classList.add('formDialog');
|
||||||
|
|
||||||
|
@ -39,7 +51,7 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
dlg.classList.add('dialog-fullscreen-lowres');
|
dlg.classList.add('dialog-fullscreen-lowres');
|
||||||
}
|
}
|
||||||
|
|
||||||
dlg.querySelector('.btnCancel').addEventListener('click', function (e) {
|
dlg.querySelector('.btnCancel').addEventListener('click', () => {
|
||||||
dialogHelper.close(dlg);
|
dialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -53,16 +65,16 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
|
|
||||||
setInputProperties(dlg, options);
|
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;
|
submitValue = dlg.querySelector('#txtInput').value;
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
|
|
||||||
// Important, don't close the dialog until after the form has completed submitting, or it will cause an error in Chrome
|
// 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);
|
dialogHelper.close(dlg);
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
|
@ -71,9 +83,9 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
|
|
||||||
dlg.querySelector('.submitText').innerHTML = options.confirmText || globalize.translate('ButtonOk');
|
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) {
|
if (layoutManager.tv) {
|
||||||
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
scrollHelper.centerFocus.off(dlg.querySelector('.formDialogContent'), false);
|
||||||
}
|
}
|
||||||
|
@ -87,7 +99,7 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((browser.tv || browser.xboxOne) && window.confirm) {
|
if ((browser.tv || browser.xboxOne) && window.confirm) {
|
||||||
return function (options) {
|
return options => {
|
||||||
if (typeof options === 'string') {
|
if (typeof options === 'string') {
|
||||||
options = {
|
options = {
|
||||||
label: '',
|
label: '',
|
||||||
|
@ -95,8 +107,8 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
var label = replaceAll(options.label || '', '<br/>', '\n');
|
const label = replaceAll(options.label || '', '<br/>', '\n');
|
||||||
var result = prompt(label, options.text || '');
|
const result = prompt(label, options.text || '');
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
return Promise.resolve(result);
|
return Promise.resolve(result);
|
||||||
|
@ -105,9 +117,9 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
return function (options) {
|
return options => {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise((resolve, reject) => {
|
||||||
require(['text!./prompt.template.html'], function (template) {
|
import('text!./prompt.template.html').then(({default: template}) => {
|
||||||
if (typeof options === 'string') {
|
if (typeof options === 'string') {
|
||||||
options = {
|
options = {
|
||||||
title: '',
|
title: '',
|
||||||
|
@ -119,4 +131,5 @@ define(['browser', 'dialogHelper', 'layoutManager', 'scrollHelper', 'globalize',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
})();
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -34,7 +34,7 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
|
|
||||||
confirm({
|
confirm.default({
|
||||||
|
|
||||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||||
primary: 'delete',
|
primary: 'delete',
|
||||||
|
@ -59,7 +59,7 @@ define(['globalize', 'loading', 'connectionManager'], function (globalize, loadi
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
|
|
||||||
confirm({
|
confirm.default({
|
||||||
|
|
||||||
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
text: globalize.translate('MessageConfirmRecordingCancellation'),
|
||||||
primary: 'delete',
|
primary: 'delete',
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPicker', 'emby-input', 'flexStyles', 'material-icons', 'css!./searchfields'], function (layoutManager, globalize, require, events, browser, AlphaPicker) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
import require from 'require';
|
||||||
|
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() {
|
function onSearchTimeout() {
|
||||||
|
|
||||||
var instance = this;
|
const instance = this;
|
||||||
var value = instance.nextSearchValue;
|
let value = instance.nextSearchValue;
|
||||||
|
|
||||||
value = (value || '').trim();
|
value = (value || '').trim();
|
||||||
events.trigger(instance, 'search', [value]);
|
events.trigger(instance, 'search', [value]);
|
||||||
|
@ -22,14 +32,14 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||||
|
|
||||||
function onAlphaValueClicked(e) {
|
function onAlphaValueClicked(e) {
|
||||||
|
|
||||||
var value = e.detail.value;
|
const value = e.detail.value;
|
||||||
var searchFieldsInstance = this;
|
const searchFieldsInstance = this;
|
||||||
|
|
||||||
var txtSearch = searchFieldsInstance.options.element.querySelector('.searchfields-txtSearch');
|
const txtSearch = searchFieldsInstance.options.element.querySelector('.searchfields-txtSearch');
|
||||||
|
|
||||||
if (value === 'backspace') {
|
if (value === 'backspace') {
|
||||||
|
|
||||||
var val = txtSearch.value;
|
const val = txtSearch.value;
|
||||||
txtSearch.value = val.length ? val.substring(0, val.length - 1) : '';
|
txtSearch.value = val.length ? val.substring(0, val.length - 1) : '';
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -53,8 +63,8 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||||
|
|
||||||
function onSearchInput(e) {
|
function onSearchInput(e) {
|
||||||
|
|
||||||
var value = e.target.value;
|
const value = e.target.value;
|
||||||
var searchFieldsInstance = this;
|
const searchFieldsInstance = this;
|
||||||
triggerSearch(searchFieldsInstance, value);
|
triggerSearch(searchFieldsInstance, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -62,7 +72,7 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||||
|
|
||||||
require(['text!./searchfields.template.html'], function (template) {
|
require(['text!./searchfields.template.html'], function (template) {
|
||||||
|
|
||||||
var html = globalize.translateDocument(template, 'core');
|
let html = globalize.translateDocument(template, 'core');
|
||||||
|
|
||||||
if (browser.tizen || browser.orsay) {
|
if (browser.tizen || browser.orsay) {
|
||||||
html = html.replace('<input ', '<input readonly ');
|
html = html.replace('<input ', '<input readonly ');
|
||||||
|
@ -72,10 +82,10 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||||
|
|
||||||
elem.classList.add('searchFields');
|
elem.classList.add('searchFields');
|
||||||
|
|
||||||
var txtSearch = elem.querySelector('.searchfields-txtSearch');
|
const txtSearch = elem.querySelector('.searchfields-txtSearch');
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
var alphaPickerElement = elem.querySelector('.alphaPicker');
|
const alphaPickerElement = elem.querySelector('.alphaPicker');
|
||||||
|
|
||||||
elem.querySelector('.alphaPicker').classList.remove('hide');
|
elem.querySelector('.alphaPicker').classList.remove('hide');
|
||||||
initAlphaPicker(alphaPickerElement, instance);
|
initAlphaPicker(alphaPickerElement, instance);
|
||||||
|
@ -87,38 +97,39 @@ define(['layoutManager', 'globalize', 'require', 'events', 'browser', 'alphaPick
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function SearchFields(options) {
|
class SearchFields {
|
||||||
|
constructor(options) {
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
embed(options.element, this, options);
|
embed(options.element, this, options);
|
||||||
}
|
}
|
||||||
|
focus() {
|
||||||
SearchFields.prototype.focus = function () {
|
|
||||||
|
|
||||||
this.options.element.querySelector('.searchfields-txtSearch').focus();
|
this.options.element.querySelector('.searchfields-txtSearch').focus();
|
||||||
};
|
}
|
||||||
|
destroy() {
|
||||||
|
|
||||||
SearchFields.prototype.destroy = function () {
|
const options = this.options;
|
||||||
|
|
||||||
var options = this.options;
|
|
||||||
if (options) {
|
if (options) {
|
||||||
options.element.classList.remove('searchFields');
|
options.element.classList.remove('searchFields');
|
||||||
}
|
}
|
||||||
this.options = null;
|
this.options = null;
|
||||||
|
|
||||||
var alphaPicker = this.alphaPicker;
|
const alphaPicker = this.alphaPicker;
|
||||||
if (alphaPicker) {
|
if (alphaPicker) {
|
||||||
alphaPicker.destroy();
|
alphaPicker.destroy();
|
||||||
}
|
}
|
||||||
this.alphaPicker = null;
|
this.alphaPicker = null;
|
||||||
|
|
||||||
var searchTimeout = this.searchTimeout;
|
const searchTimeout = this.searchTimeout;
|
||||||
if (searchTimeout) {
|
if (searchTimeout) {
|
||||||
clearTimeout(searchTimeout);
|
clearTimeout(searchTimeout);
|
||||||
}
|
}
|
||||||
this.searchTimeout = null;
|
this.searchTimeout = null;
|
||||||
this.nextSearchValue = 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) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
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) {
|
function loadSuggestions(instance, context, apiClient) {
|
||||||
|
|
||||||
var options = {
|
const options = {
|
||||||
|
|
||||||
SortBy: 'IsFavoriteOrLiked,Random',
|
SortBy: 'IsFavoriteOrLiked,Random',
|
||||||
IncludeItemTypes: 'Movie,Series,MusicArtist',
|
IncludeItemTypes: 'Movie,Series,MusicArtist',
|
||||||
|
@ -21,18 +31,18 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||||
result.Items = [];
|
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 += i.Name;
|
||||||
itemHtml += '</a></div>';
|
itemHtml += '</a></div>';
|
||||||
return itemHtml;
|
return itemHtml;
|
||||||
|
|
||||||
}).join('');
|
}).join('');
|
||||||
|
|
||||||
var searchSuggestions = context.querySelector('.searchSuggestions');
|
const searchSuggestions = context.querySelector('.searchSuggestions');
|
||||||
searchSuggestions.querySelector('.searchSuggestionsList').innerHTML = html;
|
searchSuggestions.querySelector('.searchSuggestionsList').innerHTML = html;
|
||||||
|
|
||||||
if (result.Items.length) {
|
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 (instance.options.collectionType === 'tvshows') {
|
||||||
if (query.IncludeArtists) {
|
if (query.IncludeArtists) {
|
||||||
|
@ -127,7 +137,7 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||||
query.EnableTotalRecordCount = false;
|
query.EnableTotalRecordCount = false;
|
||||||
query.ImageTypeLimit = 1;
|
query.ImageTypeLimit = 1;
|
||||||
|
|
||||||
var methodName = 'getItems';
|
let methodName = 'getItems';
|
||||||
|
|
||||||
if (!query.IncludeMedia) {
|
if (!query.IncludeMedia) {
|
||||||
if (query.IncludePeople) {
|
if (query.IncludePeople) {
|
||||||
|
@ -566,9 +576,9 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||||
|
|
||||||
section = context.querySelector(section);
|
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({
|
cardBuilder.buildCards(items, Object.assign({
|
||||||
|
|
||||||
|
@ -588,7 +598,7 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function replaceAll(originalString, strReplace, strWith) {
|
function replaceAll(originalString, strReplace, strWith) {
|
||||||
var reg = new RegExp(strReplace, 'ig');
|
const reg = new RegExp(strReplace, 'ig');
|
||||||
return originalString.replace(reg, strWith);
|
return originalString.replace(reg, strWith);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -601,7 +611,7 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||||
template = replaceAll(template, 'itemsContainer scrollSlider', 'itemsContainer scrollSlider vertical-wrap');
|
template = replaceAll(template, 'itemsContainer scrollSlider', 'itemsContainer scrollSlider vertical-wrap');
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = globalize.translateDocument(template, 'core');
|
const html = globalize.translateDocument(template, 'core');
|
||||||
|
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
|
|
||||||
|
@ -610,28 +620,29 @@ define(['layoutManager', 'globalize', 'require', 'events', 'connectionManager',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function SearchResults(options) {
|
class SearchResults {
|
||||||
|
constructor(options) {
|
||||||
|
|
||||||
this.options = options;
|
this.options = options;
|
||||||
embed(options.element, this, options);
|
embed(options.element, this, options);
|
||||||
}
|
}
|
||||||
|
search(value) {
|
||||||
|
|
||||||
SearchResults.prototype.search = function (value) {
|
const apiClient = connectionManager.getApiClient(this.options.serverId);
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(this.options.serverId);
|
|
||||||
|
|
||||||
search(this, apiClient, this.options.element, value);
|
search(this, apiClient, this.options.element, value);
|
||||||
};
|
}
|
||||||
|
destroy() {
|
||||||
|
|
||||||
SearchResults.prototype.destroy = function () {
|
const options = this.options;
|
||||||
|
|
||||||
var options = this.options;
|
|
||||||
if (options) {
|
if (options) {
|
||||||
options.element.classList.remove('searchFields');
|
options.element.classList.remove('searchFields');
|
||||||
}
|
}
|
||||||
this.options = null;
|
this.options = null;
|
||||||
|
|
||||||
};
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return SearchResults;
|
export default SearchResults;
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -69,7 +69,7 @@ define(['dialogHelper', 'require', 'layoutManager', 'globalize', 'userSettings',
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
|
|
||||||
confirm({
|
confirm.default({
|
||||||
|
|
||||||
title: globalize.translate('ConfirmDeletion'),
|
title: globalize.translate('ConfirmDeletion'),
|
||||||
text: msg,
|
text: msg,
|
||||||
|
|
|
@ -1,14 +1,20 @@
|
||||||
define(['appSettings', 'loading', 'browser', 'globalize', 'emby-button'], function(appSettings, loading, browser, globalize) {
|
import appSettings from 'appSettings';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import browser from 'browser';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function handleConnectionResult(page, result) {
|
function handleConnectionResult(page, result) {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
switch (result.State) {
|
switch (result.State) {
|
||||||
case 'SignedIn':
|
case 'SignedIn': {
|
||||||
var apiClient = result.ApiClient;
|
const apiClient = result.ApiClient;
|
||||||
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
Dashboard.onServerChanged(apiClient.getCurrentUserId(), apiClient.accessToken(), apiClient);
|
||||||
Dashboard.navigate('home.html');
|
Dashboard.navigate('home.html');
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
case 'ServerSignIn':
|
case 'ServerSignIn':
|
||||||
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id, false, 'none');
|
Dashboard.navigate('login.html?serverid=' + result.Servers[0].Id, false, 'none');
|
||||||
break;
|
break;
|
||||||
|
@ -30,7 +36,7 @@ define(['appSettings', 'loading', 'browser', 'globalize', 'emby-button'], functi
|
||||||
|
|
||||||
function submitServer(page) {
|
function submitServer(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var host = page.querySelector('#txtServerHost').value;
|
const host = page.querySelector('#txtServerHost').value;
|
||||||
ConnectionManager.connectToAddress(host, {
|
ConnectionManager.connectToAddress(host, {
|
||||||
enableAutoLogin: appSettings.enableAutoLogin()
|
enableAutoLogin: appSettings.enableAutoLogin()
|
||||||
}).then(function(result) {
|
}).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('.addServerForm').addEventListener('submit', onServerSubmit);
|
||||||
view.querySelector('.btnCancel').addEventListener('click', goBack);
|
view.querySelector('.btnCancel').addEventListener('click', goBack);
|
||||||
|
|
||||||
require(['autoFocuser'], function (autoFocuser) {
|
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||||
autoFocuser.autoFocus(view);
|
autoFocuser.autoFocus(view);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -57,9 +63,10 @@ define(['appSettings', 'loading', 'browser', 'globalize', 'emby-button'], functi
|
||||||
}
|
}
|
||||||
|
|
||||||
function goBack() {
|
function goBack() {
|
||||||
require(['appRouter'], function(appRouter) {
|
import('appRouter').then(({default: appRouter}) => {
|
||||||
appRouter.back();
|
appRouter.back();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
define(['globalize'], function (globalize) {
|
import globalize from 'globalize';
|
||||||
'use strict';
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function processForgotPasswordResult(result) {
|
function processForgotPasswordResult(result) {
|
||||||
if ('ContactAdmin' == result.Action) {
|
if ('ContactAdmin' == result.Action) {
|
||||||
|
@ -17,7 +18,7 @@ define(['globalize'], function (globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('PinCode' == result.Action) {
|
if ('PinCode' == result.Action) {
|
||||||
var msg = globalize.translate('MessageForgotPasswordFileCreated');
|
let msg = globalize.translate('MessageForgotPasswordFileCreated');
|
||||||
msg += '<br/>';
|
msg += '<br/>';
|
||||||
msg += '<br/>';
|
msg += '<br/>';
|
||||||
msg += 'Enter PIN here to finish Password Reset<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) {
|
function onSubmit(e) {
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
@ -49,5 +50,6 @@ define(['globalize'], function (globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
view.querySelector('form').addEventListener('submit', onSubmit);
|
view.querySelector('form').addEventListener('submit', onSubmit);
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
define(['globalize'], function (globalize) {
|
import globalize from 'globalize';
|
||||||
'use strict';
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function processForgotPasswordResult(result) {
|
function processForgotPasswordResult(result) {
|
||||||
if (result.Success) {
|
if (result.Success) {
|
||||||
var msg = globalize.translate('MessagePasswordResetForUsers');
|
let msg = globalize.translate('MessagePasswordResetForUsers');
|
||||||
msg += '<br/>';
|
msg += '<br/>';
|
||||||
msg += '<br/>';
|
msg += '<br/>';
|
||||||
msg += result.UsersReset.join('<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) {
|
function onSubmit(e) {
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
|
@ -37,5 +38,6 @@ define(['globalize'], function (globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
view.querySelector('form').addEventListener('submit', onSubmit);
|
view.querySelector('form').addEventListener('submit', onSubmit);
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,14 +1,24 @@
|
||||||
define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layoutManager', 'browser', 'globalize', 'cardStyle', 'emby-checkbox'], function (appHost, appSettings, dom, connectionManager, loading, layoutManager, browser, globalize) {
|
import appHost from 'apphost';
|
||||||
'use strict';
|
import appSettings from 'appSettings';
|
||||||
|
import dom from 'dom';
|
||||||
|
import connectionManager from 'connectionManager';
|
||||||
|
import loading from 'loading';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
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) {
|
function authenticateUserByName(page, apiClient, username, password) {
|
||||||
loading.show();
|
loading.show();
|
||||||
apiClient.authenticateUserByName(username, password).then(function (result) {
|
apiClient.authenticateUserByName(username, password).then(function (result) {
|
||||||
var user = result.User;
|
const user = result.User;
|
||||||
var serverId = getParameterByName('serverid');
|
const serverId = getParameterByName('serverid');
|
||||||
var newUrl;
|
let newUrl;
|
||||||
|
|
||||||
if (user.Policy.IsAdministrator && !serverId) {
|
if (user.Policy.IsAdministrator && !serverId) {
|
||||||
newUrl = 'dashboard.html';
|
newUrl = 'dashboard.html';
|
||||||
|
@ -26,7 +36,7 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||||
|
|
||||||
const UnauthorizedOrForbidden = [401, 403];
|
const UnauthorizedOrForbidden = [401, 403];
|
||||||
if (UnauthorizedOrForbidden.includes(response.status)) {
|
if (UnauthorizedOrForbidden.includes(response.status)) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
const messageKey = response.status === 401 ? 'MessageInvalidUser' : 'MessageUnauthorizedUser';
|
const messageKey = response.status === 401 ? 'MessageInvalidUser' : 'MessageUnauthorizedUser';
|
||||||
toast(globalize.translate(messageKey));
|
toast(globalize.translate(messageKey));
|
||||||
});
|
});
|
||||||
|
@ -58,23 +68,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() {
|
function getRandomMetroColor() {
|
||||||
var index = Math.floor(Math.random() * (metroColors.length - 1));
|
const index = Math.floor(Math.random() * (metroColors.length - 1));
|
||||||
return metroColors[index];
|
return metroColors[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
function getMetroColor(str) {
|
function getMetroColor(str) {
|
||||||
if (str) {
|
if (str) {
|
||||||
var character = String(str.substr(0, 1).charCodeAt());
|
const character = String(str.substr(0, 1).charCodeAt());
|
||||||
var sum = 0;
|
let sum = 0;
|
||||||
|
|
||||||
for (var i = 0; i < character.length; i++) {
|
for (let i = 0; i < character.length; i++) {
|
||||||
sum += parseInt(character.charAt(i));
|
sum += parseInt(character.charAt(i));
|
||||||
}
|
}
|
||||||
|
|
||||||
var index = String(sum).substr(-1);
|
const index = String(sum).substr(-1);
|
||||||
return metroColors[index];
|
return metroColors[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -82,13 +92,13 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadUserList(context, apiClient, users) {
|
function loadUserList(context, apiClient, users) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
for (var i = 0; i < users.length; i++) {
|
for (let i = 0; i < users.length; i++) {
|
||||||
var user = users[i];
|
const user = users[i];
|
||||||
|
|
||||||
// TODO move card creation code to Card component
|
// 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) {
|
if (layoutManager.tv) {
|
||||||
cssClass += ' show-focus';
|
cssClass += ' show-focus';
|
||||||
|
@ -98,13 +108,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 += '<button type="button" class="' + cssClass + '">';
|
||||||
html += '<div class="' + cardBoxCssClass + '">';
|
html += '<div class="' + cardBoxCssClass + '">';
|
||||||
html += '<div class="cardScalable">';
|
html += '<div class="cardScalable">';
|
||||||
html += '<div class="cardPadder cardPadder-square"></div>';
|
html += '<div class="cardPadder cardPadder-square"></div>';
|
||||||
html += '<div class="cardContent" data-haspw="' + user.HasPassword + '" data-username="' + user.Name + '" data-userid="' + user.Id + '">';
|
html += '<div class="cardContent" data-haspw="' + user.HasPassword + '" data-username="' + user.Name + '" data-userid="' + user.Id + '">';
|
||||||
var imgUrl;
|
let imgUrl;
|
||||||
|
|
||||||
if (user.PrimaryImageTag) {
|
if (user.PrimaryImageTag) {
|
||||||
imgUrl = apiClient.getUserImageUrl(user.Id, {
|
imgUrl = apiClient.getUserImageUrl(user.Id, {
|
||||||
|
@ -114,7 +124,7 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||||
});
|
});
|
||||||
html += '<div class="cardImageContainer coveredImage coveredImage-noScale" style="background-image:url(\'' + imgUrl + "');\"></div>";
|
html += '<div class="cardImageContainer coveredImage coveredImage-noScale" style="background-image:url(\'' + imgUrl + "');\"></div>";
|
||||||
} else {
|
} else {
|
||||||
var background = getMetroColor(user.Id);
|
const background = getMetroColor(user.Id);
|
||||||
imgUrl = 'assets/img/avatar.png';
|
imgUrl = 'assets/img/avatar.png';
|
||||||
html += '<div class="cardImageContainer coveredImage coveredImage-noScale" style="background-image:url(\'' + imgUrl + "');background-color:" + background + ';"></div>';
|
html += '<div class="cardImageContainer coveredImage coveredImage-noScale" style="background-image:url(\'' + imgUrl + "');background-color:" + background + ';"></div>';
|
||||||
}
|
}
|
||||||
|
@ -131,9 +141,9 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||||
context.querySelector('#divUsers').innerHTML = html;
|
context.querySelector('#divUsers').innerHTML = html;
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
function getApiClient() {
|
function getApiClient() {
|
||||||
var serverId = params.serverid;
|
const serverId = params.serverid;
|
||||||
|
|
||||||
if (serverId) {
|
if (serverId) {
|
||||||
return connectionManager.getOrCreateApiClient(serverId);
|
return connectionManager.getOrCreateApiClient(serverId);
|
||||||
|
@ -147,20 +157,20 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||||
view.querySelector('.manualLoginForm').classList.add('hide');
|
view.querySelector('.manualLoginForm').classList.add('hide');
|
||||||
view.querySelector('.btnManual').classList.remove('hide');
|
view.querySelector('.btnManual').classList.remove('hide');
|
||||||
|
|
||||||
require(['autoFocuser'], function (autoFocuser) {
|
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||||
autoFocuser.autoFocus(view);
|
autoFocuser.autoFocus(view);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
view.querySelector('#divUsers').addEventListener('click', function (e) {
|
view.querySelector('#divUsers').addEventListener('click', function (e) {
|
||||||
var card = dom.parentWithClass(e.target, 'card');
|
const card = dom.parentWithClass(e.target, 'card');
|
||||||
var cardContent = card ? card.querySelector('.cardContent') : null;
|
const cardContent = card ? card.querySelector('.cardContent') : null;
|
||||||
|
|
||||||
if (cardContent) {
|
if (cardContent) {
|
||||||
var context = view;
|
const context = view;
|
||||||
var id = cardContent.getAttribute('data-userid');
|
const id = cardContent.getAttribute('data-userid');
|
||||||
var name = cardContent.getAttribute('data-username');
|
const name = cardContent.getAttribute('data-username');
|
||||||
var haspw = cardContent.getAttribute('data-haspw');
|
const haspw = cardContent.getAttribute('data-haspw');
|
||||||
|
|
||||||
if (id === 'manual') {
|
if (id === 'manual') {
|
||||||
context.querySelector('#txtManualName').value = '';
|
context.querySelector('#txtManualName').value = '';
|
||||||
|
@ -176,7 +186,7 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||||
});
|
});
|
||||||
view.querySelector('.manualLoginForm').addEventListener('submit', function (e) {
|
view.querySelector('.manualLoginForm').addEventListener('submit', function (e) {
|
||||||
appSettings.enableAutoLogin(view.querySelector('.chkRememberLogin').checked);
|
appSettings.enableAutoLogin(view.querySelector('.chkRememberLogin').checked);
|
||||||
var apiClient = getApiClient();
|
const apiClient = getApiClient();
|
||||||
authenticateUserByName(view, apiClient, view.querySelector('#txtManualName').value, view.querySelector('#txtManualPassword').value);
|
authenticateUserByName(view, apiClient, view.querySelector('#txtManualName').value, view.querySelector('#txtManualPassword').value);
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
|
@ -199,7 +209,7 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||||
view.querySelector('.btnSelectServer').classList.add('hide');
|
view.querySelector('.btnSelectServer').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var apiClient = getApiClient();
|
const apiClient = getApiClient();
|
||||||
apiClient.getPublicUsers().then(function (users) {
|
apiClient.getPublicUsers().then(function (users) {
|
||||||
if (users.length) {
|
if (users.length) {
|
||||||
showVisualForm();
|
showVisualForm();
|
||||||
|
@ -215,5 +225,6 @@ define(['apphost', 'appSettings', 'dom', 'connectionManager', 'loading', 'layout
|
||||||
view.querySelector('.disclaimer').textContent = options.LoginDisclaimer || '';
|
view.querySelector('.disclaimer').textContent = options.LoginDisclaimer || '';
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,10 +1,27 @@
|
||||||
define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focusManager', 'connectionManager', 'globalize', 'actionsheet', 'dom', 'browser', 'material-icons', 'flexStyles', 'emby-scroller', 'emby-itemscontainer', 'cardStyle', 'emby-button'], function (loading, appRouter, layoutManager, appSettings, appHost, focusManager, connectionManager, globalize, actionSheet, dom, browser) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import appRouter from 'appRouter';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
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) {
|
function renderSelectServerItems(view, servers) {
|
||||||
var items = servers.map(function (server) {
|
const items = servers.map(function (server) {
|
||||||
return {
|
return {
|
||||||
name: server.Name,
|
name: server.Name,
|
||||||
showIcon: true,
|
showIcon: true,
|
||||||
|
@ -14,8 +31,8 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
server: server
|
server: server
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
var html = items.map(function (item) {
|
let html = items.map(function (item) {
|
||||||
var cardImageContainer;
|
let cardImageContainer;
|
||||||
|
|
||||||
if (item.showIcon) {
|
if (item.showIcon) {
|
||||||
cardImageContainer = '<span class="cardImageIcon material-icons ' + item.icon + '"></span>';
|
cardImageContainer = '<span class="cardImageIcon material-icons ' + item.icon + '"></span>';
|
||||||
|
@ -25,7 +42,7 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
|
|
||||||
// TODO move card creation code to Card component
|
// 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) {
|
if (layoutManager.tv) {
|
||||||
cssClass += ' show-focus';
|
cssClass += ' show-focus';
|
||||||
|
@ -35,10 +52,10 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var cardBoxCssClass = 'cardBox';
|
const cardBoxCssClass = 'cardBox';
|
||||||
|
|
||||||
var innerOpening = '<div class="' + cardBoxCssClass + '">';
|
const innerOpening = '<div class="' + cardBoxCssClass + '">';
|
||||||
var cardContainer = '';
|
let cardContainer = '';
|
||||||
cardContainer += '<button raised class="' + cssClass + '" style="display:inline-block;" data-id="' + item.id + '" data-url="' + (item.url || '') + '" data-cardtype="' + item.cardType + '">';
|
cardContainer += '<button raised class="' + cssClass + '" style="display:inline-block;" data-id="' + item.id + '" data-url="' + (item.url || '') + '" data-cardtype="' + item.cardType + '">';
|
||||||
cardContainer += innerOpening;
|
cardContainer += innerOpening;
|
||||||
cardContainer += '<div class="cardScalable">';
|
cardContainer += '<div class="cardScalable">';
|
||||||
|
@ -55,7 +72,7 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
cardContainer += '</div></div></button>';
|
cardContainer += '</div></div></button>';
|
||||||
return cardContainer;
|
return cardContainer;
|
||||||
}).join('');
|
}).join('');
|
||||||
var itemsContainer = view.querySelector('.servers');
|
const itemsContainer = view.querySelector('.servers');
|
||||||
|
|
||||||
if (!items.length) {
|
if (!items.length) {
|
||||||
html = '<p>' + globalize.translate('MessageNoServersAvailable') + '</p>';
|
html = '<p>' + globalize.translate('MessageNoServersAvailable') + '</p>';
|
||||||
|
@ -89,7 +106,7 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
}
|
}
|
||||||
|
|
||||||
function alertTextWithOptions(options) {
|
function alertTextWithOptions(options) {
|
||||||
require(['alert'], function (alert) {
|
import('alert').then(({default: alert}) => {
|
||||||
alert(options);
|
alert(options);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -98,14 +115,14 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
alertText(globalize.translate('MessageUnableToConnectToServer'));
|
alertText(globalize.translate('MessageUnableToConnectToServer'));
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
function connectToServer(server) {
|
function connectToServer(server) {
|
||||||
loading.show();
|
loading.show();
|
||||||
connectionManager.connectToServer(server, {
|
connectionManager.connectToServer(server, {
|
||||||
enableAutoLogin: appSettings.enableAutoLogin()
|
enableAutoLogin: appSettings.enableAutoLogin()
|
||||||
}).then(function (result) {
|
}).then(function (result) {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
var apiClient = result.ApiClient;
|
const apiClient = result.ApiClient;
|
||||||
|
|
||||||
switch (result.State) {
|
switch (result.State) {
|
||||||
case 'SignedIn':
|
case 'SignedIn':
|
||||||
|
@ -140,7 +157,7 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
}
|
}
|
||||||
|
|
||||||
function onServerClick(server) {
|
function onServerClick(server) {
|
||||||
var menuItems = [];
|
const menuItems = [];
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
name: globalize.translate('Connect'),
|
name: globalize.translate('Connect'),
|
||||||
id: 'connect'
|
id: 'connect'
|
||||||
|
@ -178,10 +195,10 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
connectionManager.getAvailableServers().then(onServersRetrieved);
|
connectionManager.getAvailableServers().then(onServersRetrieved);
|
||||||
}
|
}
|
||||||
|
|
||||||
var servers;
|
let servers;
|
||||||
updatePageStyle(view, params);
|
updatePageStyle(view, params);
|
||||||
view.addEventListener('viewshow', function (e) {
|
view.addEventListener('viewshow', function (e) {
|
||||||
var isRestored = e.detail.isRestored;
|
const isRestored = e.detail.isRestored;
|
||||||
appRouter.setTitle(null);
|
appRouter.setTitle(null);
|
||||||
|
|
||||||
if (!isRestored) {
|
if (!isRestored) {
|
||||||
|
@ -189,20 +206,21 @@ define(['loading', 'appRouter', 'layoutManager', 'appSettings', 'apphost', 'focu
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
view.querySelector('.servers').addEventListener('click', function (e) {
|
view.querySelector('.servers').addEventListener('click', function (e) {
|
||||||
var card = dom.parentWithClass(e.target, 'card');
|
const card = dom.parentWithClass(e.target, 'card');
|
||||||
|
|
||||||
if (card) {
|
if (card) {
|
||||||
var url = card.getAttribute('data-url');
|
const url = card.getAttribute('data-url');
|
||||||
|
|
||||||
if (url) {
|
if (url) {
|
||||||
appRouter.show(url);
|
appRouter.show(url);
|
||||||
} else {
|
} else {
|
||||||
var id = card.getAttribute('data-id');
|
const id = card.getAttribute('data-id');
|
||||||
onServerClick(servers.filter(function (s) {
|
onServerClick(servers.filter(function (s) {
|
||||||
return s.Id === id;
|
return s.Id === id;
|
||||||
})[0]);
|
})[0]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,5 +1,10 @@
|
||||||
define(['loading', 'libraryMenu', 'dom', 'emby-input', 'emby-button'], function (loading, libraryMenu, dom) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import dom from 'dom';
|
||||||
|
import 'emby-input';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function load(page, device, deviceOptions) {
|
function load(page, device, deviceOptions) {
|
||||||
page.querySelector('#txtCustomName', page).value = deviceOptions.CustomName || '';
|
page.querySelector('#txtCustomName', page).value = deviceOptions.CustomName || '';
|
||||||
|
@ -7,13 +12,13 @@ define(['loading', 'libraryMenu', 'dom', 'emby-input', 'emby-button'], function
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadData() {
|
function loadData() {
|
||||||
var page = this;
|
const page = this;
|
||||||
loading.show();
|
loading.show();
|
||||||
var id = getParameterByName('id');
|
const id = getParameterByName('id');
|
||||||
var promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', {
|
const promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', {
|
||||||
Id: id
|
Id: id
|
||||||
}));
|
}));
|
||||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Options', {
|
const promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Options', {
|
||||||
Id: id
|
Id: id
|
||||||
}));
|
}));
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
|
@ -23,7 +28,7 @@ define(['loading', 'libraryMenu', 'dom', 'emby-input', 'emby-button'], function
|
||||||
}
|
}
|
||||||
|
|
||||||
function save(page) {
|
function save(page) {
|
||||||
var id = getParameterByName('id');
|
const id = getParameterByName('id');
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
url: ApiClient.getUrl('Devices/Options', {
|
url: ApiClient.getUrl('Devices/Options', {
|
||||||
Id: id
|
Id: id
|
||||||
|
@ -37,14 +42,15 @@ define(['loading', 'libraryMenu', 'dom', 'emby-input', 'emby-button'], function
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
var form = this;
|
const form = this;
|
||||||
save(dom.parentWithClass(form, 'page'));
|
save(dom.parentWithClass(form, 'page'));
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
view.querySelector('form').addEventListener('submit', onSubmit);
|
view.querySelector('form').addEventListener('submit', onSubmit);
|
||||||
view.addEventListener('viewshow', loadData);
|
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) {
|
import loading from 'loading';
|
||||||
'use strict';
|
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) {
|
function canDelete(deviceId) {
|
||||||
return deviceId !== ApiClient.deviceId();
|
return deviceId !== ApiClient.deviceId();
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteDevice(page, id) {
|
function deleteDevice(page, id) {
|
||||||
var msg = globalize.translate('DeleteDeviceConfirmation');
|
const msg = globalize.translate('DeleteDeviceConfirmation');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
import('confirm').then(({default: confirm}) => {
|
||||||
confirm({
|
confirm({
|
||||||
text: msg,
|
text: msg,
|
||||||
title: globalize.translate('HeaderDeleteDevice'),
|
title: globalize.translate('HeaderDeleteDevice'),
|
||||||
|
@ -29,7 +39,7 @@ define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'da
|
||||||
}
|
}
|
||||||
|
|
||||||
function showDeviceMenu(view, btn, deviceId) {
|
function showDeviceMenu(view, btn, deviceId) {
|
||||||
var menuItems = [];
|
let menuItems = [];
|
||||||
|
|
||||||
if (canEdit) {
|
if (canEdit) {
|
||||||
menuItems.push({
|
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({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: btn,
|
positionTo: btn,
|
||||||
|
@ -66,15 +76,15 @@ define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'da
|
||||||
}
|
}
|
||||||
|
|
||||||
function load(page, devices) {
|
function load(page, devices) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += devices.map(function (device) {
|
html += devices.map(function (device) {
|
||||||
var deviceHtml = '';
|
let deviceHtml = '';
|
||||||
deviceHtml += "<div data-id='" + device.Id + "' class='card backdropCard'>";
|
deviceHtml += "<div data-id='" + device.Id + "' class='card backdropCard'>";
|
||||||
deviceHtml += '<div class="cardBox visualCardBox">';
|
deviceHtml += '<div class="cardBox visualCardBox">';
|
||||||
deviceHtml += '<div class="cardScalable">';
|
deviceHtml += '<div class="cardScalable">';
|
||||||
deviceHtml += '<div class="cardPadder cardPadder-backdrop"></div>';
|
deviceHtml += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||||
deviceHtml += '<a is="emby-linkbutton" href="' + (canEdit ? 'device.html?id=' + device.Id : '#') + '" class="cardContent cardImageContainer">';
|
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) {
|
if (iconUrl) {
|
||||||
deviceHtml += '<div class="cardImage" style="background-image:url(\'' + iconUrl + "');background-size: auto 64%;background-position:center center;\">";
|
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');
|
const canEdit = ApiClient.isMinServerVersion('3.4.1.31');
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
view.querySelector('.devicesList').addEventListener('click', function (e) {
|
view.querySelector('.devicesList').addEventListener('click', function (e) {
|
||||||
var btnDeviceMenu = dom.parentWithClass(e.target, 'btnDeviceMenu');
|
const btnDeviceMenu = dom.parentWithClass(e.target, 'btnDeviceMenu');
|
||||||
|
|
||||||
if (btnDeviceMenu) {
|
if (btnDeviceMenu) {
|
||||||
showDeviceMenu(view, btnDeviceMenu, btnDeviceMenu.getAttribute('data-id'));
|
showDeviceMenu(view, btnDeviceMenu, btnDeviceMenu.getAttribute('data-id'));
|
||||||
|
@ -136,5 +146,6 @@ define(['loading', 'dom', 'libraryMenu', 'globalize', 'scripts/imagehelper', 'da
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
loadData(this);
|
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) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
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) {
|
function loadProfile(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var promise1 = getProfile();
|
const promise1 = getProfile();
|
||||||
var promise2 = ApiClient.getUsers();
|
const promise2 = ApiClient.getUsers();
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
currentProfile = responses[0];
|
currentProfile = responses[0];
|
||||||
renderProfile(page, currentProfile, responses[1]);
|
renderProfile(page, currentProfile, responses[1]);
|
||||||
|
@ -13,8 +21,8 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function getProfile() {
|
function getProfile() {
|
||||||
var id = getParameterByName('id');
|
const id = getParameterByName('id');
|
||||||
var url = id ? 'Dlna/Profiles/' + id : 'Dlna/Profiles/Default';
|
const url = id ? 'Dlna/Profiles/' + id : 'Dlna/Profiles/Default';
|
||||||
return ApiClient.getJSON(ApiClient.getUrl(url));
|
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);
|
$('#chkEnableAlbumArtInDidl', page).prop('checked', profile.EnableAlbumArtInDidl);
|
||||||
$('#chkEnableSingleImageLimit', page).prop('checked', profile.EnableSingleAlbumArtLimit);
|
$('#chkEnableSingleImageLimit', page).prop('checked', profile.EnableSingleAlbumArtLimit);
|
||||||
renderXmlDocumentAttributes(page, profile.XmlRootAttributes || []);
|
renderXmlDocumentAttributes(page, profile.XmlRootAttributes || []);
|
||||||
var idInfo = profile.Identification || {};
|
const idInfo = profile.Identification || {};
|
||||||
renderIdentificationHeaders(page, idInfo.Headers || []);
|
renderIdentificationHeaders(page, idInfo.Headers || []);
|
||||||
renderSubtitleProfiles(page, profile.SubtitleProfiles || []);
|
renderSubtitleProfiles(page, profile.SubtitleProfiles || []);
|
||||||
$('#txtInfoFriendlyName', page).val(profile.FriendlyName || '');
|
$('#txtInfoFriendlyName', page).val(profile.FriendlyName || '');
|
||||||
|
@ -65,7 +73,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
profile.ContainerProfiles = profile.ContainerProfiles || [];
|
profile.ContainerProfiles = profile.ContainerProfiles || [];
|
||||||
profile.CodecProfiles = profile.CodecProfiles || [];
|
profile.CodecProfiles = profile.CodecProfiles || [];
|
||||||
profile.ResponseProfiles = profile.ResponseProfiles || [];
|
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>';
|
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
||||||
}).join('');
|
}).join('');
|
||||||
$('#selectUser', page).html(usersHtml).val(profile.UserId || '');
|
$('#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) {
|
function renderIdentificationHeaders(page, headers) {
|
||||||
var index = 0;
|
let index = 0;
|
||||||
var html = '<div class="paperList">' + headers.map(function (h) {
|
const html = '<div class="paperList">' + headers.map(function (h) {
|
||||||
var li = '<div class="listItem">';
|
let li = '<div class="listItem">';
|
||||||
li += '<span class="material-icons listItemIcon info"></span>';
|
li += '<span class="material-icons listItemIcon info"></span>';
|
||||||
li += '<div class="listItemBody">';
|
li += '<div class="listItemBody">';
|
||||||
li += '<h3 class="listItemBodyText">' + h.Name + ': ' + (h.Value || '') + '</h3>';
|
li += '<h3 class="listItemBodyText">' + h.Name + ': ' + (h.Value || '') + '</h3>';
|
||||||
|
@ -86,9 +94,9 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
index++;
|
index++;
|
||||||
return li;
|
return li;
|
||||||
}).join('') + '</div>';
|
}).join('') + '</div>';
|
||||||
var elem = $('.httpHeaderIdentificationList', page).html(html).trigger('create');
|
const elem = $('.httpHeaderIdentificationList', page).html(html).trigger('create');
|
||||||
$('.btnDeleteIdentificationHeader', elem).on('click', function () {
|
$('.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);
|
currentProfile.Identification.Headers.splice(itemIndex, 1);
|
||||||
renderIdentificationHeaders(page, currentProfile.Identification.Headers);
|
renderIdentificationHeaders(page, currentProfile.Identification.Headers);
|
||||||
});
|
});
|
||||||
|
@ -106,7 +114,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
isSubProfileNew = null == header;
|
isSubProfileNew = null == header;
|
||||||
header = header || {};
|
header = header || {};
|
||||||
currentSubProfile = header;
|
currentSubProfile = header;
|
||||||
var popup = $('#identificationHeaderPopup', page);
|
const popup = $('#identificationHeaderPopup', page);
|
||||||
$('#txtIdentificationHeaderName', popup).val(header.Name || '');
|
$('#txtIdentificationHeaderName', popup).val(header.Name || '');
|
||||||
$('#txtIdentificationHeaderValue', popup).val(header.Value || '');
|
$('#txtIdentificationHeaderValue', popup).val(header.Value || '');
|
||||||
$('#selectMatchType', popup).val(header.Match || 'Equals');
|
$('#selectMatchType', popup).val(header.Match || 'Equals');
|
||||||
|
@ -130,8 +138,8 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderXmlDocumentAttributes(page, attribute) {
|
function renderXmlDocumentAttributes(page, attribute) {
|
||||||
var html = '<div class="paperList">' + attribute.map(function (h) {
|
const html = '<div class="paperList">' + attribute.map(function (h) {
|
||||||
var li = '<div class="listItem">';
|
let li = '<div class="listItem">';
|
||||||
li += '<span class="material-icons listItemIcon info"></span>';
|
li += '<span class="material-icons listItemIcon info"></span>';
|
||||||
li += '<div class="listItemBody">';
|
li += '<div class="listItemBody">';
|
||||||
li += '<h3 class="listItemBodyText">' + h.Name + ' = ' + (h.Value || '') + '</h3>';
|
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>';
|
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>';
|
return li += '</div>';
|
||||||
}).join('') + '</div>';
|
}).join('') + '</div>';
|
||||||
var elem = $('.xmlDocumentAttributeList', page).html(html).trigger('create');
|
const elem = $('.xmlDocumentAttributeList', page).html(html).trigger('create');
|
||||||
$('.btnDeleteXmlAttribute', elem).on('click', function () {
|
$('.btnDeleteXmlAttribute', elem).on('click', function () {
|
||||||
var itemIndex = parseInt(this.getAttribute('data-index'));
|
const itemIndex = parseInt(this.getAttribute('data-index'));
|
||||||
currentProfile.XmlRootAttributes.splice(itemIndex, 1);
|
currentProfile.XmlRootAttributes.splice(itemIndex, 1);
|
||||||
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
|
renderXmlDocumentAttributes(page, currentProfile.XmlRootAttributes);
|
||||||
});
|
});
|
||||||
|
@ -151,7 +159,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
isSubProfileNew = null == attribute;
|
isSubProfileNew = null == attribute;
|
||||||
attribute = attribute || {};
|
attribute = attribute || {};
|
||||||
currentSubProfile = attribute;
|
currentSubProfile = attribute;
|
||||||
var popup = $('#xmlAttributePopup', page);
|
const popup = $('#xmlAttributePopup', page);
|
||||||
$('#txtXmlAttributeName', popup).val(attribute.Name || '');
|
$('#txtXmlAttributeName', popup).val(attribute.Name || '');
|
||||||
$('#txtXmlAttributeValue', popup).val(attribute.Value || '');
|
$('#txtXmlAttributeValue', popup).val(attribute.Value || '');
|
||||||
openPopup(popup[0]);
|
openPopup(popup[0]);
|
||||||
|
@ -171,9 +179,9 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderSubtitleProfiles(page, profiles) {
|
function renderSubtitleProfiles(page, profiles) {
|
||||||
var index = 0;
|
let index = 0;
|
||||||
var html = '<div class="paperList">' + profiles.map(function (h) {
|
const html = '<div class="paperList">' + profiles.map(function (h) {
|
||||||
var li = '<div class="listItem lnkEditSubProfile" data-index="' + index + '">';
|
let li = '<div class="listItem lnkEditSubProfile" data-index="' + index + '">';
|
||||||
li += '<span class="material-icons listItemIcon info"></span>';
|
li += '<span class="material-icons listItemIcon info"></span>';
|
||||||
li += '<div class="listItemBody">';
|
li += '<div class="listItemBody">';
|
||||||
li += '<h3 class="listItemBodyText">' + (h.Format || '') + '</h3>';
|
li += '<h3 class="listItemBodyText">' + (h.Format || '') + '</h3>';
|
||||||
|
@ -183,14 +191,14 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
index++;
|
index++;
|
||||||
return li;
|
return li;
|
||||||
}).join('') + '</div>';
|
}).join('') + '</div>';
|
||||||
var elem = $('.subtitleProfileList', page).html(html).trigger('create');
|
const elem = $('.subtitleProfileList', page).html(html).trigger('create');
|
||||||
$('.btnDeleteProfile', elem).on('click', function () {
|
$('.btnDeleteProfile', elem).on('click', function () {
|
||||||
var itemIndex = parseInt(this.getAttribute('data-index'));
|
const itemIndex = parseInt(this.getAttribute('data-index'));
|
||||||
currentProfile.SubtitleProfiles.splice(itemIndex, 1);
|
currentProfile.SubtitleProfiles.splice(itemIndex, 1);
|
||||||
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
|
renderSubtitleProfiles(page, currentProfile.SubtitleProfiles);
|
||||||
});
|
});
|
||||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||||
var itemIndex = parseInt(this.getAttribute('data-index'));
|
const itemIndex = parseInt(this.getAttribute('data-index'));
|
||||||
editSubtitleProfile(page, currentProfile.SubtitleProfiles[itemIndex]);
|
editSubtitleProfile(page, currentProfile.SubtitleProfiles[itemIndex]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -199,7 +207,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
isSubProfileNew = null == profile;
|
isSubProfileNew = null == profile;
|
||||||
profile = profile || {};
|
profile = profile || {};
|
||||||
currentSubProfile = profile;
|
currentSubProfile = profile;
|
||||||
var popup = $('#subtitleProfilePopup', page);
|
const popup = $('#subtitleProfilePopup', page);
|
||||||
$('#txtSubtitleProfileFormat', popup).val(profile.Format || '');
|
$('#txtSubtitleProfileFormat', popup).val(profile.Format || '');
|
||||||
$('#selectSubtitleProfileMethod', popup).val(profile.Method || '');
|
$('#selectSubtitleProfileMethod', popup).val(profile.Method || '');
|
||||||
$('#selectSubtitleProfileDidlMode', popup).val(profile.DidlMode || '');
|
$('#selectSubtitleProfileDidlMode', popup).val(profile.DidlMode || '');
|
||||||
|
@ -244,12 +252,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderDirectPlayProfiles(page, profiles) {
|
function renderDirectPlayProfiles(page, profiles) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
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++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
var profile = profiles[i];
|
const profile = profiles[i];
|
||||||
|
|
||||||
if (profile.Type !== currentType) {
|
if (profile.Type !== currentType) {
|
||||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||||
|
@ -275,13 +283,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</ul>';
|
html += '</ul>';
|
||||||
var elem = $('.directPlayProfiles', page).html(html).trigger('create');
|
const elem = $('.directPlayProfiles', page).html(html).trigger('create');
|
||||||
$('.btnDeleteProfile', elem).on('click', function () {
|
$('.btnDeleteProfile', elem).on('click', function () {
|
||||||
var index = this.getAttribute('data-profileindex');
|
const index = this.getAttribute('data-profileindex');
|
||||||
deleteDirectPlayProfile(page, index);
|
deleteDirectPlayProfile(page, index);
|
||||||
});
|
});
|
||||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||||
editDirectPlayProfile(page, currentProfile.DirectPlayProfiles[index]);
|
editDirectPlayProfile(page, currentProfile.DirectPlayProfiles[index]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -295,7 +303,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
isSubProfileNew = null == directPlayProfile;
|
isSubProfileNew = null == directPlayProfile;
|
||||||
directPlayProfile = directPlayProfile || {};
|
directPlayProfile = directPlayProfile || {};
|
||||||
currentSubProfile = directPlayProfile;
|
currentSubProfile = directPlayProfile;
|
||||||
var popup = $('#popupEditDirectPlayProfile', page);
|
const popup = $('#popupEditDirectPlayProfile', page);
|
||||||
$('#selectDirectPlayProfileType', popup).val(directPlayProfile.Type || 'Video').trigger('change');
|
$('#selectDirectPlayProfileType', popup).val(directPlayProfile.Type || 'Video').trigger('change');
|
||||||
$('#txtDirectPlayContainer', popup).val(directPlayProfile.Container || '');
|
$('#txtDirectPlayContainer', popup).val(directPlayProfile.Container || '');
|
||||||
$('#txtDirectPlayAudioCodec', popup).val(directPlayProfile.AudioCodec || '');
|
$('#txtDirectPlayAudioCodec', popup).val(directPlayProfile.AudioCodec || '');
|
||||||
|
@ -304,12 +312,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderTranscodingProfiles(page, profiles) {
|
function renderTranscodingProfiles(page, profiles) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
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++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
var profile = profiles[i];
|
let profile = profiles[i];
|
||||||
|
|
||||||
if (profile.Type !== currentType) {
|
if (profile.Type !== currentType) {
|
||||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||||
|
@ -336,13 +344,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</ul>';
|
html += '</ul>';
|
||||||
var elem = $('.transcodingProfiles', page).html(html).trigger('create');
|
const elem = $('.transcodingProfiles', page).html(html).trigger('create');
|
||||||
$('.btnDeleteProfile', elem).on('click', function () {
|
$('.btnDeleteProfile', elem).on('click', function () {
|
||||||
var index = this.getAttribute('data-profileindex');
|
const index = this.getAttribute('data-profileindex');
|
||||||
deleteTranscodingProfile(page, index);
|
deleteTranscodingProfile(page, index);
|
||||||
});
|
});
|
||||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||||
editTranscodingProfile(page, currentProfile.TranscodingProfiles[index]);
|
editTranscodingProfile(page, currentProfile.TranscodingProfiles[index]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -351,7 +359,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
isSubProfileNew = null == transcodingProfile;
|
isSubProfileNew = null == transcodingProfile;
|
||||||
transcodingProfile = transcodingProfile || {};
|
transcodingProfile = transcodingProfile || {};
|
||||||
currentSubProfile = transcodingProfile;
|
currentSubProfile = transcodingProfile;
|
||||||
var popup = $('#transcodingProfilePopup', page);
|
const popup = $('#transcodingProfilePopup', page);
|
||||||
$('#selectTranscodingProfileType', popup).val(transcodingProfile.Type || 'Video').trigger('change');
|
$('#selectTranscodingProfileType', popup).val(transcodingProfile.Type || 'Video').trigger('change');
|
||||||
$('#txtTranscodingContainer', popup).val(transcodingProfile.Container || '');
|
$('#txtTranscodingContainer', popup).val(transcodingProfile.Container || '');
|
||||||
$('#txtTranscodingAudioCodec', popup).val(transcodingProfile.AudioCodec || '');
|
$('#txtTranscodingAudioCodec', popup).val(transcodingProfile.AudioCodec || '');
|
||||||
|
@ -390,12 +398,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderContainerProfiles(page, profiles) {
|
function renderContainerProfiles(page, profiles) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
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++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
var profile = profiles[i];
|
let profile = profiles[i];
|
||||||
|
|
||||||
if (profile.Type !== currentType) {
|
if (profile.Type !== currentType) {
|
||||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||||
|
@ -420,13 +428,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</ul>';
|
html += '</ul>';
|
||||||
var elem = $('.containerProfiles', page).html(html).trigger('create');
|
const elem = $('.containerProfiles', page).html(html).trigger('create');
|
||||||
$('.btnDeleteProfile', elem).on('click', function () {
|
$('.btnDeleteProfile', elem).on('click', function () {
|
||||||
var index = this.getAttribute('data-profileindex');
|
const index = this.getAttribute('data-profileindex');
|
||||||
deleteContainerProfile(page, index);
|
deleteContainerProfile(page, index);
|
||||||
});
|
});
|
||||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||||
editContainerProfile(page, currentProfile.ContainerProfiles[index]);
|
editContainerProfile(page, currentProfile.ContainerProfiles[index]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -440,7 +448,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
isSubProfileNew = null == containerProfile;
|
isSubProfileNew = null == containerProfile;
|
||||||
containerProfile = containerProfile || {};
|
containerProfile = containerProfile || {};
|
||||||
currentSubProfile = containerProfile;
|
currentSubProfile = containerProfile;
|
||||||
var popup = $('#containerProfilePopup', page);
|
const popup = $('#containerProfilePopup', page);
|
||||||
$('#selectContainerProfileType', popup).val(containerProfile.Type || 'Video').trigger('change');
|
$('#selectContainerProfileType', popup).val(containerProfile.Type || 'Video').trigger('change');
|
||||||
$('#txtContainerProfileContainer', popup).val(containerProfile.Container || '');
|
$('#txtContainerProfileContainer', popup).val(containerProfile.Container || '');
|
||||||
$('.radioTabButton:first', popup).trigger('click');
|
$('.radioTabButton:first', popup).trigger('click');
|
||||||
|
@ -461,13 +469,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderCodecProfiles(page, profiles) {
|
function renderCodecProfiles(page, profiles) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
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++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
var profile = profiles[i];
|
let profile = profiles[i];
|
||||||
var type = profile.Type.replace('VideoAudio', 'Video Audio');
|
const type = profile.Type.replace('VideoAudio', 'Video Audio');
|
||||||
|
|
||||||
if (type !== currentType) {
|
if (type !== currentType) {
|
||||||
html += '<li data-role="list-divider">' + type + '</li>';
|
html += '<li data-role="list-divider">' + type + '</li>';
|
||||||
|
@ -492,13 +500,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</ul>';
|
html += '</ul>';
|
||||||
var elem = $('.codecProfiles', page).html(html).trigger('create');
|
const elem = $('.codecProfiles', page).html(html).trigger('create');
|
||||||
$('.btnDeleteProfile', elem).on('click', function () {
|
$('.btnDeleteProfile', elem).on('click', function () {
|
||||||
var index = this.getAttribute('data-profileindex');
|
const index = this.getAttribute('data-profileindex');
|
||||||
deleteCodecProfile(page, index);
|
deleteCodecProfile(page, index);
|
||||||
});
|
});
|
||||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||||
editCodecProfile(page, currentProfile.CodecProfiles[index]);
|
editCodecProfile(page, currentProfile.CodecProfiles[index]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -512,7 +520,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
isSubProfileNew = null == codecProfile;
|
isSubProfileNew = null == codecProfile;
|
||||||
codecProfile = codecProfile || {};
|
codecProfile = codecProfile || {};
|
||||||
currentSubProfile = codecProfile;
|
currentSubProfile = codecProfile;
|
||||||
var popup = $('#codecProfilePopup', page);
|
const popup = $('#codecProfilePopup', page);
|
||||||
$('#selectCodecProfileType', popup).val(codecProfile.Type || 'Video').trigger('change');
|
$('#selectCodecProfileType', popup).val(codecProfile.Type || 'Video').trigger('change');
|
||||||
$('#txtCodecProfileCodec', popup).val(codecProfile.Codec || '');
|
$('#txtCodecProfileCodec', popup).val(codecProfile.Codec || '');
|
||||||
$('.radioTabButton:first', popup).trigger('click');
|
$('.radioTabButton:first', popup).trigger('click');
|
||||||
|
@ -533,12 +541,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderResponseProfiles(page, profiles) {
|
function renderResponseProfiles(page, profiles) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<ul data-role="listview" data-inset="true" data-split-icon="delete">';
|
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++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
var profile = profiles[i];
|
const profile = profiles[i];
|
||||||
|
|
||||||
if (profile.Type !== currentType) {
|
if (profile.Type !== currentType) {
|
||||||
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
html += '<li data-role="list-divider">' + profile.Type + '</li>';
|
||||||
|
@ -572,13 +580,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</ul>';
|
html += '</ul>';
|
||||||
var elem = $('.mediaProfiles', page).html(html).trigger('create');
|
const elem = $('.mediaProfiles', page).html(html).trigger('create');
|
||||||
$('.btnDeleteProfile', elem).on('click', function () {
|
$('.btnDeleteProfile', elem).on('click', function () {
|
||||||
var index = this.getAttribute('data-profileindex');
|
const index = this.getAttribute('data-profileindex');
|
||||||
deleteResponseProfile(page, index);
|
deleteResponseProfile(page, index);
|
||||||
});
|
});
|
||||||
$('.lnkEditSubProfile', elem).on('click', function () {
|
$('.lnkEditSubProfile', elem).on('click', function () {
|
||||||
var index = parseInt(this.getAttribute('data-profileindex'));
|
const index = parseInt(this.getAttribute('data-profileindex'));
|
||||||
editResponseProfile(page, currentProfile.ResponseProfiles[index]);
|
editResponseProfile(page, currentProfile.ResponseProfiles[index]);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -592,7 +600,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
isSubProfileNew = null == responseProfile;
|
isSubProfileNew = null == responseProfile;
|
||||||
responseProfile = responseProfile || {};
|
responseProfile = responseProfile || {};
|
||||||
currentSubProfile = responseProfile;
|
currentSubProfile = responseProfile;
|
||||||
var popup = $('#responseProfilePopup', page);
|
const popup = $('#responseProfilePopup', page);
|
||||||
$('#selectResponseProfileType', popup).val(responseProfile.Type || 'Video').trigger('change');
|
$('#selectResponseProfileType', popup).val(responseProfile.Type || 'Video').trigger('change');
|
||||||
$('#txtResponseProfileContainer', popup).val(responseProfile.Container || '');
|
$('#txtResponseProfileContainer', popup).val(responseProfile.Container || '');
|
||||||
$('#txtResponseProfileAudioCodec', popup).val(responseProfile.AudioCodec || '');
|
$('#txtResponseProfileAudioCodec', popup).val(responseProfile.AudioCodec || '');
|
||||||
|
@ -618,7 +626,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
|
|
||||||
function saveProfile(page, profile) {
|
function saveProfile(page, profile) {
|
||||||
updateProfile(page, profile);
|
updateProfile(page, profile);
|
||||||
var id = getParameterByName('id');
|
const id = getParameterByName('id');
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
|
@ -627,7 +635,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
data: JSON.stringify(profile),
|
data: JSON.stringify(profile),
|
||||||
contentType: 'application/json'
|
contentType: 'application/json'
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast('Settings saved.');
|
toast('Settings saved.');
|
||||||
});
|
});
|
||||||
}, Dashboard.processErrorResponse);
|
}, Dashboard.processErrorResponse);
|
||||||
|
@ -687,18 +695,18 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
profile.UserId = $('#selectUser', page).val();
|
profile.UserId = $('#selectUser', page).val();
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentProfile;
|
let currentProfile;
|
||||||
var currentSubProfile;
|
let currentSubProfile;
|
||||||
var isSubProfileNew;
|
let isSubProfileNew;
|
||||||
var allText = globalize.translate('LabelAll');
|
const allText = globalize.translate('LabelAll');
|
||||||
|
|
||||||
$(document).on('pageinit', '#dlnaProfilePage', function () {
|
$(document).on('pageinit', '#dlnaProfilePage', function () {
|
||||||
var page = this;
|
const page = this;
|
||||||
$('.radioTabButton', page).on('click', function () {
|
$('.radioTabButton', page).on('click', function () {
|
||||||
$(this).siblings().removeClass('ui-btn-active');
|
$(this).siblings().removeClass('ui-btn-active');
|
||||||
$(this).addClass('ui-btn-active');
|
$(this).addClass('ui-btn-active');
|
||||||
var value = 'A' == this.tagName ? this.getAttribute('data-value') : this.value;
|
const value = 'A' == this.tagName ? this.getAttribute('data-value') : this.value;
|
||||||
var elem = $('.' + value, page);
|
const elem = $('.' + value, page);
|
||||||
elem.siblings('.tabContent').hide();
|
elem.siblings('.tabContent').hide();
|
||||||
elem.show();
|
elem.show();
|
||||||
});
|
});
|
||||||
|
@ -783,7 +791,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
$('.xmlAttributeForm').off('submit', DlnaProfilePage.onXmlAttributeFormSubmit).on('submit', DlnaProfilePage.onXmlAttributeFormSubmit);
|
$('.xmlAttributeForm').off('submit', DlnaProfilePage.onXmlAttributeFormSubmit).on('submit', DlnaProfilePage.onXmlAttributeFormSubmit);
|
||||||
$('.subtitleProfileForm').off('submit', DlnaProfilePage.onSubtitleProfileFormSubmit).on('submit', DlnaProfilePage.onSubtitleProfileFormSubmit);
|
$('.subtitleProfileForm').off('submit', DlnaProfilePage.onSubtitleProfileFormSubmit).on('submit', DlnaProfilePage.onSubtitleProfileFormSubmit);
|
||||||
}).on('pageshow', '#dlnaProfilePage', function () {
|
}).on('pageshow', '#dlnaProfilePage', function () {
|
||||||
var page = this;
|
const page = this;
|
||||||
$('#radioInfo', page).trigger('click');
|
$('#radioInfo', page).trigger('click');
|
||||||
loadProfile(page);
|
loadProfile(page);
|
||||||
});
|
});
|
||||||
|
@ -826,4 +834,5 @@ define(['jQuery', 'loading', 'globalize', 'emby-select', 'emby-button', 'emby-in
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,5 +1,11 @@
|
||||||
define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-button'], function ($, globalize, loading, libraryMenu) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
import loading from 'loading';
|
||||||
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import 'listViewStyle';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function loadProfiles(page) {
|
function loadProfiles(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
|
@ -23,14 +29,14 @@ define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderProfiles(page, element, profiles) {
|
function renderProfiles(page, element, profiles) {
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
if (profiles.length) {
|
if (profiles.length) {
|
||||||
html += '<div class="paperList">';
|
html += '<div class="paperList">';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (var i = 0, length = profiles.length; i < length; i++) {
|
for (let i = 0, length = profiles.length; i < length; i++) {
|
||||||
var profile = profiles[i];
|
let profile = profiles[i];
|
||||||
html += '<div class="listItem listItem-border">';
|
html += '<div class="listItem listItem-border">';
|
||||||
html += '<span class="listItemIcon material-icons live_tv"></span>';
|
html += '<span class="listItemIcon material-icons live_tv"></span>';
|
||||||
html += '<div class="listItemBody two-line">';
|
html += '<div class="listItemBody two-line">';
|
||||||
|
@ -52,13 +58,13 @@ define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-
|
||||||
|
|
||||||
element.innerHTML = html;
|
element.innerHTML = html;
|
||||||
$('.btnDeleteProfile', element).on('click', function () {
|
$('.btnDeleteProfile', element).on('click', function () {
|
||||||
var id = this.getAttribute('data-profileid');
|
const id = this.getAttribute('data-profileid');
|
||||||
deleteProfile(page, id);
|
deleteProfile(page, id);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function 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 () {
|
confirm(globalize.translate('MessageConfirmProfileDeletion'), globalize.translate('HeaderConfirmProfileDeletion')).then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
|
@ -86,4 +92,5 @@ define(['jQuery', 'globalize', 'loading', 'libraryMenu', 'listViewStyle', 'emby-
|
||||||
libraryMenu.setTabs('dlna', 1, getTabs);
|
libraryMenu.setTabs('dlna', 1, getTabs);
|
||||||
loadProfiles(this);
|
loadProfiles(this);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function loadPage(page, config, users) {
|
function loadPage(page, config, users) {
|
||||||
page.querySelector('#chkEnablePlayTo').checked = config.EnablePlayTo;
|
page.querySelector('#chkEnablePlayTo').checked = config.EnablePlayTo;
|
||||||
|
@ -8,7 +12,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
$('#chkEnableServer', page).prop('checked', config.EnableServer);
|
$('#chkEnableServer', page).prop('checked', config.EnableServer);
|
||||||
$('#chkBlastAliveMessages', page).prop('checked', config.BlastAliveMessages);
|
$('#chkBlastAliveMessages', page).prop('checked', config.BlastAliveMessages);
|
||||||
$('#txtBlastInterval', page).val(config.BlastAliveMessageIntervalSeconds);
|
$('#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>';
|
return '<option value="' + u.Id + '">' + u.Name + '</option>';
|
||||||
}).join('');
|
}).join('');
|
||||||
$('#selectUser', page).html(usersHtml).val(config.DefaultUserId || '');
|
$('#selectUser', page).html(usersHtml).val(config.DefaultUserId || '');
|
||||||
|
@ -17,7 +21,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
loading.show();
|
loading.show();
|
||||||
var form = this;
|
const form = this;
|
||||||
ApiClient.getNamedConfiguration('dlna').then(function (config) {
|
ApiClient.getNamedConfiguration('dlna').then(function (config) {
|
||||||
config.EnablePlayTo = form.querySelector('#chkEnablePlayTo').checked;
|
config.EnablePlayTo = form.querySelector('#chkEnablePlayTo').checked;
|
||||||
config.EnableDebugLog = form.querySelector('#chkEnableDlnaDebugLogging').checked;
|
config.EnableDebugLog = form.querySelector('#chkEnableDlnaDebugLogging').checked;
|
||||||
|
@ -46,11 +50,12 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}).on('pageshow', '#dlnaSettingsPage', function () {
|
}).on('pageshow', '#dlnaSettingsPage', function () {
|
||||||
libraryMenu.setTabs('dlna', 0, getTabs);
|
libraryMenu.setTabs('dlna', 0, getTabs);
|
||||||
loading.show();
|
loading.show();
|
||||||
var page = this;
|
const page = this;
|
||||||
var promise1 = ApiClient.getNamedConfiguration('dlna');
|
const promise1 = ApiClient.getNamedConfiguration('dlna');
|
||||||
var promise2 = ApiClient.getUsers();
|
const promise2 = ApiClient.getUsers();
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
loadPage(page, responses[0], responses[1]);
|
loadPage(page, responses[0], responses[1]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,5 +1,13 @@
|
||||||
define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emby-input', 'emby-select', 'emby-button'], function ($, loading, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
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) {
|
function loadPage(page, config, languageOptions, systemInfo) {
|
||||||
page.querySelector('#txtServerName').value = systemInfo.ServerName;
|
page.querySelector('#txtServerName').value = systemInfo.ServerName;
|
||||||
|
@ -16,7 +24,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
loading.show();
|
loading.show();
|
||||||
var form = this;
|
const form = this;
|
||||||
$(form).parents('.page');
|
$(form).parents('.page');
|
||||||
ApiClient.getServerConfiguration().then(function (config) {
|
ApiClient.getServerConfiguration().then(function (config) {
|
||||||
config.ServerName = $('#txtServerName', form).val();
|
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.CachePath = form.querySelector('#txtCachePath').value;
|
||||||
config.MetadataPath = $('#txtMetadataPath', form).val();
|
config.MetadataPath = $('#txtMetadataPath', form).val();
|
||||||
config.MetadataNetworkPath = $('#txtMetadataNetworkPath', form).val();
|
config.MetadataNetworkPath = $('#txtMetadataNetworkPath', form).val();
|
||||||
var requiresReload = config.UICulture !== currentLanguage;
|
let requiresReload = config.UICulture !== currentLanguage;
|
||||||
ApiClient.updateServerConfiguration(config).then(function() {
|
ApiClient.updateServerConfiguration(config).then(function() {
|
||||||
ApiClient.getNamedConfiguration(brandingConfigKey).then(function(brandingConfig) {
|
ApiClient.getNamedConfiguration(brandingConfigKey).then(function(brandingConfig) {
|
||||||
brandingConfig.LoginDisclaimer = form.querySelector('#txtLoginDisclaimer').value;
|
brandingConfig.LoginDisclaimer = form.querySelector('#txtLoginDisclaimer').value;
|
||||||
|
@ -43,7 +51,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}, function () {
|
}, function () {
|
||||||
require(['alert'], function (alert) {
|
import('alert').then(({default: alert}) => {
|
||||||
alert(globalize.translate('DefaultErrorMessage'));
|
alert(globalize.translate('DefaultErrorMessage'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -53,13 +61,13 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentBrandingOptions;
|
let currentBrandingOptions;
|
||||||
var currentLanguage;
|
let currentLanguage;
|
||||||
var brandingConfigKey = 'branding';
|
const brandingConfigKey = 'branding';
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
$('#btnSelectCachePath', view).on('click.selectDirectory', function () {
|
$('#btnSelectCachePath', view).on('click.selectDirectory', function () {
|
||||||
require(['directorybrowser'], function (directoryBrowser) {
|
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||||
var picker = new directoryBrowser.default();
|
const picker = new directoryBrowser();
|
||||||
picker.show({
|
picker.show({
|
||||||
callback: function (path) {
|
callback: function (path) {
|
||||||
if (path) {
|
if (path) {
|
||||||
|
@ -75,8 +83,8 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox', 'emby-textarea', 'emb
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
$('#btnSelectMetadataPath', view).on('click.selectDirectory', function () {
|
$('#btnSelectMetadataPath', view).on('click.selectDirectory', function () {
|
||||||
require(['directorybrowser'], function (directoryBrowser) {
|
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||||
var picker = new directoryBrowser.default();
|
const picker = new directoryBrowser();
|
||||||
picker.show({
|
picker.show({
|
||||||
path: $('#txtMetadataPath', view).val(),
|
path: $('#txtMetadataPath', view).val(),
|
||||||
networkSharePath: $('#txtMetadataNetworkPath', 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);
|
$('.dashboardGeneralForm', view).off('submit', onSubmit).on('submit', onSubmit);
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
var promiseConfig = ApiClient.getServerConfiguration();
|
const promiseConfig = ApiClient.getServerConfiguration();
|
||||||
var promiseLanguageOptions = ApiClient.getJSON(ApiClient.getUrl('Localization/Options'));
|
const promiseLanguageOptions = ApiClient.getJSON(ApiClient.getUrl('Localization/Options'));
|
||||||
var promiseSystemInfo = ApiClient.getSystemInfo();
|
const promiseSystemInfo = ApiClient.getSystemInfo();
|
||||||
Promise.all([promiseConfig, promiseLanguageOptions, promiseSystemInfo]).then(function (responses) {
|
Promise.all([promiseConfig, promiseLanguageOptions, promiseSystemInfo]).then(function (responses) {
|
||||||
loadPage(view, responses[0], responses[1], responses[2]);
|
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 || '';
|
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) {
|
import globalize from 'globalize';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function getTabs() {
|
function getTabs() {
|
||||||
return [{
|
return [{
|
||||||
|
@ -17,7 +22,7 @@ define(['globalize', 'loading', 'libraryMenu', 'emby-checkbox', 'emby-button', '
|
||||||
}];
|
}];
|
||||||
}
|
}
|
||||||
|
|
||||||
return function(view, params) {
|
export default function(view, params) {
|
||||||
function loadData() {
|
function loadData() {
|
||||||
ApiClient.getServerConfiguration().then(function(config) {
|
ApiClient.getServerConfiguration().then(function(config) {
|
||||||
view.querySelector('.chkFolderView').checked = config.EnableFolderView;
|
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) {
|
view.querySelector('form').addEventListener('submit', function(e) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var form = this;
|
const form = this;
|
||||||
ApiClient.getServerConfiguration().then(function(config) {
|
ApiClient.getServerConfiguration().then(function(config) {
|
||||||
config.EnableFolderView = form.querySelector('.chkFolderView').checked;
|
config.EnableFolderView = form.querySelector('.chkFolderView').checked;
|
||||||
config.EnableGroupingIntoCollections = form.querySelector('.chkGroupMoviesIntoCollections').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) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
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) {
|
function addVirtualFolder(page) {
|
||||||
require(['medialibrarycreator'], function (medialibrarycreator) {
|
import('medialibrarycreator').then(({default: medialibrarycreator}) => {
|
||||||
new medialibrarycreator.showEditor({
|
new medialibrarycreator({
|
||||||
collectionTypeOptions: getCollectionTypeOptions().filter(function (f) {
|
collectionTypeOptions: getCollectionTypeOptions().filter(function (f) {
|
||||||
return !f.hidden;
|
return !f.hidden;
|
||||||
}),
|
}),
|
||||||
|
@ -17,8 +28,8 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
function editVirtualFolder(page, virtualFolder) {
|
function editVirtualFolder(page, virtualFolder) {
|
||||||
require(['medialibraryeditor'], function (medialibraryeditor) {
|
import('medialibraryeditor').then(({default: medialibraryeditor}) => {
|
||||||
new medialibraryeditor.showEditor({
|
new medialibraryeditor({
|
||||||
refresh: shouldRefreshLibraryAfterChanges(page),
|
refresh: shouldRefreshLibraryAfterChanges(page),
|
||||||
library: virtualFolder
|
library: virtualFolder
|
||||||
}).then(function (hasChanges) {
|
}).then(function (hasChanges) {
|
||||||
|
@ -30,23 +41,21 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteVirtualFolder(page, virtualFolder) {
|
function deleteVirtualFolder(page, virtualFolder) {
|
||||||
var msg = globalize.translate('MessageAreYouSureYouWishToRemoveMediaFolder');
|
let msg = globalize.translate('MessageAreYouSureYouWishToRemoveMediaFolder');
|
||||||
|
|
||||||
if (virtualFolder.Locations.length) {
|
if (virtualFolder.Locations.length) {
|
||||||
msg += '<br/><br/>' + globalize.translate('MessageTheFollowingLocationWillBeRemovedFromLibrary') + '<br/><br/>';
|
msg += '<br/><br/>' + globalize.translate('MessageTheFollowingLocationWillBeRemovedFromLibrary') + '<br/><br/>';
|
||||||
msg += virtualFolder.Locations.join('<br/>');
|
msg += virtualFolder.Locations.join('<br/>');
|
||||||
}
|
}
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
import('confirm').then(({default: confirm}) => {
|
||||||
confirm({
|
confirm({
|
||||||
|
|
||||||
text: msg,
|
text: msg,
|
||||||
title: globalize.translate('HeaderRemoveMediaFolder'),
|
title: globalize.translate('HeaderRemoveMediaFolder'),
|
||||||
confirmText: globalize.translate('Delete'),
|
confirmText: globalize.translate('Delete'),
|
||||||
primary: 'delete'
|
primary: 'delete'
|
||||||
|
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
const refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||||
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () {
|
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () {
|
||||||
reloadLibrary(page);
|
reloadLibrary(page);
|
||||||
});
|
});
|
||||||
|
@ -55,7 +64,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
function refreshVirtualFolder(page, virtualFolder) {
|
function refreshVirtualFolder(page, virtualFolder) {
|
||||||
require(['refreshDialog'], function (refreshDialog) {
|
import('refreshDialog').then(({default: refreshDialog}) => {
|
||||||
new refreshDialog({
|
new refreshDialog({
|
||||||
itemIds: [virtualFolder.ItemId],
|
itemIds: [virtualFolder.ItemId],
|
||||||
serverId: ApiClient.serverId(),
|
serverId: ApiClient.serverId(),
|
||||||
|
@ -65,13 +74,13 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
function renameVirtualFolder(page, virtualFolder) {
|
function renameVirtualFolder(page, virtualFolder) {
|
||||||
require(['prompt'], function (prompt) {
|
import('prompt').then(({default: prompt}) => {
|
||||||
prompt({
|
prompt({
|
||||||
label: globalize.translate('LabelNewName'),
|
label: globalize.translate('LabelNewName'),
|
||||||
confirmText: globalize.translate('ButtonRename')
|
confirmText: globalize.translate('ButtonRename')
|
||||||
}).then(function (newName) {
|
}).then(function (newName) {
|
||||||
if (newName && newName != virtualFolder.Name) {
|
if (newName && newName != virtualFolder.Name) {
|
||||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
const refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||||
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function () {
|
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function () {
|
||||||
reloadLibrary(page);
|
reloadLibrary(page);
|
||||||
});
|
});
|
||||||
|
@ -81,10 +90,10 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
function showCardMenu(page, elem, virtualFolders) {
|
function showCardMenu(page, elem, virtualFolders) {
|
||||||
var card = dom.parentWithClass(elem, 'card');
|
const card = dom.parentWithClass(elem, 'card');
|
||||||
var index = parseInt(card.getAttribute('data-index'));
|
const index = parseInt(card.getAttribute('data-index'));
|
||||||
var virtualFolder = virtualFolders[index];
|
const virtualFolder = virtualFolders[index];
|
||||||
var menuItems = [];
|
const menuItems = [];
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
name: globalize.translate('ButtonEditImages'),
|
name: globalize.translate('ButtonEditImages'),
|
||||||
id: 'editimages',
|
id: 'editimages',
|
||||||
|
@ -111,7 +120,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
icon: 'refresh'
|
icon: 'refresh'
|
||||||
});
|
});
|
||||||
|
|
||||||
require(['actionsheet'], function (actionsheet) {
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: elem,
|
positionTo: elem,
|
||||||
|
@ -153,7 +162,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadVirtualFolders(page, virtualFolders) {
|
function reloadVirtualFolders(page, virtualFolders) {
|
||||||
var html = '';
|
let html = '';
|
||||||
virtualFolders.push({
|
virtualFolders.push({
|
||||||
Name: globalize.translate('ButtonAddMediaLibrary'),
|
Name: globalize.translate('ButtonAddMediaLibrary'),
|
||||||
icon: 'add_circle',
|
icon: 'add_circle',
|
||||||
|
@ -164,12 +173,12 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
showNameWithIcon: true
|
showNameWithIcon: true
|
||||||
});
|
});
|
||||||
|
|
||||||
for (var i = 0; i < virtualFolders.length; i++) {
|
for (let i = 0; i < virtualFolders.length; i++) {
|
||||||
var virtualFolder = virtualFolders[i];
|
const virtualFolder = virtualFolders[i];
|
||||||
html += getVirtualFolderHtml(page, virtualFolder, i);
|
html += getVirtualFolderHtml(page, virtualFolder, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
var divVirtualFolders = page.querySelector('#divVirtualFolders');
|
const divVirtualFolders = page.querySelector('#divVirtualFolders');
|
||||||
divVirtualFolders.innerHTML = html;
|
divVirtualFolders.innerHTML = html;
|
||||||
divVirtualFolders.classList.add('itemsContainer');
|
divVirtualFolders.classList.add('itemsContainer');
|
||||||
divVirtualFolders.classList.add('vertical-wrap');
|
divVirtualFolders.classList.add('vertical-wrap');
|
||||||
|
@ -180,9 +189,9 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
addVirtualFolder(page);
|
addVirtualFolder(page);
|
||||||
});
|
});
|
||||||
$('.editLibrary', divVirtualFolders).on('click', function () {
|
$('.editLibrary', divVirtualFolders).on('click', function () {
|
||||||
var card = $(this).parents('.card')[0];
|
const card = $(this).parents('.card')[0];
|
||||||
var index = parseInt(card.getAttribute('data-index'));
|
const index = parseInt(card.getAttribute('data-index'));
|
||||||
var virtualFolder = virtualFolders[index];
|
const virtualFolder = virtualFolders[index];
|
||||||
|
|
||||||
if (virtualFolder.ItemId) {
|
if (virtualFolder.ItemId) {
|
||||||
editVirtualFolder(page, virtualFolder);
|
editVirtualFolder(page, virtualFolder);
|
||||||
|
@ -192,7 +201,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
function editImages(page, virtualFolder) {
|
function editImages(page, virtualFolder) {
|
||||||
require(['imageEditor'], function (imageEditor) {
|
import('imageEditor').then(({default: imageEditor}) => {
|
||||||
imageEditor.show({
|
imageEditor.show({
|
||||||
itemId: virtualFolder.ItemId,
|
itemId: virtualFolder.ItemId,
|
||||||
serverId: ApiClient.serverId()
|
serverId: ApiClient.serverId()
|
||||||
|
@ -240,8 +249,8 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
function getVirtualFolderHtml(page, virtualFolder, index) {
|
function getVirtualFolderHtml(page, virtualFolder, index) {
|
||||||
var html = '';
|
let html = '';
|
||||||
var style = '';
|
let style = '';
|
||||||
|
|
||||||
if (page.classList.contains('wizardPage')) {
|
if (page.classList.contains('wizardPage')) {
|
||||||
style += 'min-width:33.3%;';
|
style += 'min-width:33.3%;';
|
||||||
|
@ -252,7 +261,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||||
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
html += '<div class="cardPadder cardPadder-backdrop"></div>';
|
||||||
html += '<div class="cardContent">';
|
html += '<div class="cardContent">';
|
||||||
var imgUrl = '';
|
let imgUrl = '';
|
||||||
|
|
||||||
if (virtualFolder.PrimaryImageItemId) {
|
if (virtualFolder.PrimaryImageItemId) {
|
||||||
imgUrl = ApiClient.getScaledImageUrl(virtualFolder.PrimaryImageItemId, {
|
imgUrl = ApiClient.getScaledImageUrl(virtualFolder.PrimaryImageItemId, {
|
||||||
|
@ -261,7 +270,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var hasCardImageContainer;
|
let hasCardImageContainer;
|
||||||
|
|
||||||
if (imgUrl) {
|
if (imgUrl) {
|
||||||
html += '<div class="cardImageContainer editLibrary" style="cursor:pointer;background-image:url(\'' + imgUrl + "');\">";
|
html += '<div class="cardImageContainer editLibrary" style="cursor:pointer;background-image:url(\'' + imgUrl + "');\">";
|
||||||
|
@ -311,7 +320,7 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
var typeName = getCollectionTypeOptions().filter(function (t) {
|
let typeName = getCollectionTypeOptions().filter(function (t) {
|
||||||
return t.value == virtualFolder.CollectionType;
|
return t.value == virtualFolder.CollectionType;
|
||||||
})[0];
|
})[0];
|
||||||
typeName = typeName ? typeName.name : globalize.translate('FolderTypeUnset');
|
typeName = typeName ? typeName.name : globalize.translate('FolderTypeUnset');
|
||||||
|
@ -371,8 +380,9 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
});
|
});
|
||||||
pageIdOn('pageshow', 'mediaLibraryPage', function () {
|
pageIdOn('pageshow', 'mediaLibraryPage', function () {
|
||||||
libraryMenu.setTabs('librarysetup', 0, getTabs);
|
libraryMenu.setTabs('librarysetup', 0, getTabs);
|
||||||
var page = this;
|
|
||||||
taskButton.default({
|
const page = this;
|
||||||
|
taskButton({
|
||||||
mode: 'on',
|
mode: 'on',
|
||||||
progressElem: page.querySelector('.refreshProgress'),
|
progressElem: page.querySelector('.refreshProgress'),
|
||||||
taskKey: 'RefreshLibrary',
|
taskKey: 'RefreshLibrary',
|
||||||
|
@ -380,12 +390,14 @@ define(['jQuery', 'apphost', 'scripts/taskbutton', 'loading', 'libraryMenu', 'gl
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
pageIdOn('pagebeforehide', 'mediaLibraryPage', function () {
|
pageIdOn('pagebeforehide', 'mediaLibraryPage', function () {
|
||||||
var page = this;
|
|
||||||
taskButton.default({
|
const page = this;
|
||||||
|
taskButton({
|
||||||
mode: 'off',
|
mode: 'off',
|
||||||
progressElem: page.querySelector('.refreshProgress'),
|
progressElem: page.querySelector('.refreshProgress'),
|
||||||
taskKey: 'RefreshLibrary',
|
taskKey: 'RefreshLibrary',
|
||||||
button: page.querySelector('.btnRefresh')
|
button: page.querySelector('.btnRefresh')
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,12 +1,18 @@
|
||||||
define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle'], function($, dom, loading, libraryMenu, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import dom from 'dom';
|
||||||
|
import loading from 'loading';
|
||||||
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'listViewStyle';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function populateLanguages(select) {
|
function populateLanguages(select) {
|
||||||
return ApiClient.getCultures().then(function(languages) {
|
return ApiClient.getCultures().then(function(languages) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += "<option value=''></option>";
|
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>';
|
html += "<option value='" + culture.TwoLetterISOLanguageName + "'>" + culture.DisplayName + '</option>';
|
||||||
}
|
}
|
||||||
select.innerHTML = html;
|
select.innerHTML = html;
|
||||||
|
@ -15,10 +21,10 @@ define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle']
|
||||||
|
|
||||||
function populateCountries(select) {
|
function populateCountries(select) {
|
||||||
return ApiClient.getCountries().then(function(allCountries) {
|
return ApiClient.getCountries().then(function(allCountries) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += "<option value=''></option>";
|
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>';
|
html += "<option value='" + culture.TwoLetterISORegionName + "'>" + culture.DisplayName + '</option>';
|
||||||
}
|
}
|
||||||
select.innerHTML = html;
|
select.innerHTML = html;
|
||||||
|
@ -26,9 +32,9 @@ define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle']
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadPage(page) {
|
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) {
|
Promise.all(promises).then(function(responses) {
|
||||||
var config = responses[0];
|
const config = responses[0];
|
||||||
page.querySelector('#selectLanguage').value = config.PreferredMetadataLanguage || '';
|
page.querySelector('#selectLanguage').value = config.PreferredMetadataLanguage || '';
|
||||||
page.querySelector('#selectCountry').value = config.MetadataCountryCode || '';
|
page.querySelector('#selectCountry').value = config.MetadataCountryCode || '';
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
@ -36,7 +42,7 @@ define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle']
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
var form = this;
|
const form = this;
|
||||||
return loading.show(), ApiClient.getServerConfiguration().then(function(config) {
|
return loading.show(), ApiClient.getServerConfiguration().then(function(config) {
|
||||||
config.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value;
|
config.PreferredMetadataLanguage = form.querySelector('#selectLanguage').value;
|
||||||
config.MetadataCountryCode = form.querySelector('#selectCountry').value;
|
config.MetadataCountryCode = form.querySelector('#selectCountry').value;
|
||||||
|
@ -67,4 +73,5 @@ define(['jQuery', 'dom', 'loading', 'libraryMenu', 'globalize', 'listViewStyle']
|
||||||
loading.show();
|
loading.show();
|
||||||
loadPage(this);
|
loadPage(this);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,8 +1,12 @@
|
||||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function loadPage(page, config, users) {
|
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) {
|
html += users.map(function (user) {
|
||||||
return '<option value="' + user.Id + '">' + user.Name + '</option>';
|
return '<option value="' + user.Id + '">' + user.Name + '</option>';
|
||||||
}).join('');
|
}).join('');
|
||||||
|
@ -16,7 +20,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
loading.show();
|
loading.show();
|
||||||
var form = this;
|
const form = this;
|
||||||
ApiClient.getNamedConfiguration(metadataKey).then(function (config) {
|
ApiClient.getNamedConfiguration(metadataKey).then(function (config) {
|
||||||
config.UserId = $('#selectUser', form).val() || null;
|
config.UserId = $('#selectUser', form).val() || null;
|
||||||
config.ReleaseDateFormat = $('#selectReleaseDateFormat', form).val();
|
config.ReleaseDateFormat = $('#selectReleaseDateFormat', form).val();
|
||||||
|
@ -32,10 +36,10 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}
|
}
|
||||||
|
|
||||||
function showConfirmMessage(config) {
|
function showConfirmMessage(config) {
|
||||||
var msg = [];
|
const msg = [];
|
||||||
msg.push(globalize.translate('MetadataSettingChangeHelp'));
|
msg.push(globalize.translate('MetadataSettingChangeHelp'));
|
||||||
|
|
||||||
require(['alert'], function (alert) {
|
import('alert').then(({default: alert}) => {
|
||||||
alert({
|
alert({
|
||||||
text: msg.join('<br/><br/>')
|
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 () {
|
$(document).on('pageinit', '#metadataNfoPage', function () {
|
||||||
$('.metadataNfoForm').off('submit', onSubmit).on('submit', onSubmit);
|
$('.metadataNfoForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||||
}).on('pageshow', '#metadataNfoPage', function () {
|
}).on('pageshow', '#metadataNfoPage', function () {
|
||||||
libraryMenu.setTabs('metadata', 3, getTabs);
|
libraryMenu.setTabs('metadata', 3, getTabs);
|
||||||
loading.show();
|
loading.show();
|
||||||
var page = this;
|
const page = this;
|
||||||
var promise1 = ApiClient.getUsers();
|
const promise1 = ApiClient.getUsers();
|
||||||
var promise2 = ApiClient.getNamedConfiguration(metadataKey);
|
const promise2 = ApiClient.getNamedConfiguration(metadataKey);
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
loadPage(page, responses[1], responses[0]);
|
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) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
import 'emby-select';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
var form = this;
|
const form = this;
|
||||||
var localAddress = form.querySelector('#txtLocalAddress').value;
|
const localAddress = form.querySelector('#txtLocalAddress').value;
|
||||||
var enableUpnp = form.querySelector('#chkEnableUpnp').checked;
|
const enableUpnp = form.querySelector('#chkEnableUpnp').checked;
|
||||||
confirmSelections(localAddress, enableUpnp, function () {
|
confirmSelections(localAddress, enableUpnp, function () {
|
||||||
var validationResult = getValidationAlert(form);
|
const validationResult = getValidationAlert(form);
|
||||||
|
|
||||||
if (validationResult) {
|
if (validationResult) {
|
||||||
showAlertText(validationResult);
|
showAlertText(validationResult);
|
||||||
|
@ -47,7 +52,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerChange(select) {
|
function triggerChange(select) {
|
||||||
var evt = document.createEvent('HTMLEvents');
|
const evt = document.createEvent('HTMLEvents');
|
||||||
evt.initEvent('change', false, true);
|
evt.initEvent('change', false, true);
|
||||||
select.dispatchEvent(evt);
|
select.dispatchEvent(evt);
|
||||||
}
|
}
|
||||||
|
@ -65,8 +70,8 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||||
}
|
}
|
||||||
|
|
||||||
function validateHttps(form) {
|
function validateHttps(form) {
|
||||||
var certPath = form.querySelector('#txtCertificatePath').value || null;
|
const certPath = form.querySelector('#txtCertificatePath').value || null;
|
||||||
var httpsEnabled = form.querySelector('#chkEnableHttps').checked;
|
const httpsEnabled = form.querySelector('#chkEnableHttps').checked;
|
||||||
|
|
||||||
if (httpsEnabled && !certPath) {
|
if (httpsEnabled && !certPath) {
|
||||||
return showAlertText({
|
return showAlertText({
|
||||||
|
@ -80,7 +85,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||||
|
|
||||||
function showAlertText(options) {
|
function showAlertText(options) {
|
||||||
return new Promise(function (resolve, reject) {
|
return new Promise(function (resolve, reject) {
|
||||||
require(['alert'], function (alert) {
|
import('alert').then(({default: alert}) => {
|
||||||
alert(options).then(resolve, reject);
|
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) {
|
function loadPage(page, config) {
|
||||||
page.querySelector('#txtPortNumber').value = config.HttpServerPortNumber;
|
page.querySelector('#txtPortNumber').value = config.HttpServerPortNumber;
|
||||||
page.querySelector('#txtPublicPort').value = config.PublicPort;
|
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('#chkEnableHttps').checked = config.EnableHttps;
|
||||||
page.querySelector('#chkRequireHttps').checked = config.RequireHttps;
|
page.querySelector('#chkRequireHttps').checked = config.RequireHttps;
|
||||||
page.querySelector('#txtBaseUrl').value = config.BaseUrl || '';
|
page.querySelector('#txtBaseUrl').value = config.BaseUrl || '';
|
||||||
var txtCertificatePath = page.querySelector('#txtCertificatePath');
|
const txtCertificatePath = page.querySelector('#txtCertificatePath');
|
||||||
txtCertificatePath.value = config.CertificatePath || '';
|
txtCertificatePath.value = config.CertificatePath || '';
|
||||||
page.querySelector('#txtCertPassword').value = config.CertificatePassword || '';
|
page.querySelector('#txtCertPassword').value = config.CertificatePassword || '';
|
||||||
page.querySelector('#chkEnableUpnp').checked = config.EnableUPnP;
|
page.querySelector('#chkEnableUpnp').checked = config.EnableUPnP;
|
||||||
|
@ -135,8 +140,8 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
view.querySelector('#btnSelectCertPath').addEventListener('click', function () {
|
view.querySelector('#btnSelectCertPath').addEventListener('click', function () {
|
||||||
require(['directorybrowser'], function (directoryBrowser) {
|
import('directorybrowser').then(({default: directoryBrowser}) => {
|
||||||
var picker = new directoryBrowser.default();
|
const picker = new directoryBrowser();
|
||||||
picker.show({
|
picker.show({
|
||||||
includeFiles: true,
|
includeFiles: true,
|
||||||
includeDirectories: true,
|
includeDirectories: true,
|
||||||
|
@ -158,5 +163,6 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-checkbox', 'emby-select'],
|
||||||
loadPage(view, config);
|
loadPage(view, config);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function loadPage(page, config) {
|
function loadPage(page, config) {
|
||||||
$('#txtMinResumePct', page).val(config.MinResumePct);
|
$('#txtMinResumePct', page).val(config.MinResumePct);
|
||||||
|
@ -10,7 +14,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
loading.show();
|
loading.show();
|
||||||
var form = this;
|
const form = this;
|
||||||
ApiClient.getServerConfiguration().then(function (config) {
|
ApiClient.getServerConfiguration().then(function (config) {
|
||||||
config.MinResumePct = $('#txtMinResumePct', form).val();
|
config.MinResumePct = $('#txtMinResumePct', form).val();
|
||||||
config.MaxResumePct = $('#txtMaxResumePct', form).val();
|
config.MaxResumePct = $('#txtMaxResumePct', form).val();
|
||||||
|
@ -40,9 +44,10 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}).on('pageshow', '#playbackConfigurationPage', function () {
|
}).on('pageshow', '#playbackConfigurationPage', function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
libraryMenu.setTabs('playback', 1, getTabs);
|
libraryMenu.setTabs('playback', 1, getTabs);
|
||||||
var page = this;
|
const page = this;
|
||||||
ApiClient.getServerConfiguration().then(function (config) {
|
ApiClient.getServerConfiguration().then(function (config) {
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -91,7 +91,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'connectionManager', 'e
|
||||||
msg += globalize.translate('PleaseConfirmPluginInstallation');
|
msg += globalize.translate('PleaseConfirmPluginInstallation');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm(msg, globalize.translate('HeaderConfirmPluginInstallation')).then(function () {
|
confirm.default(msg, globalize.translate('HeaderConfirmPluginInstallation')).then(function () {
|
||||||
alertCallback();
|
alertCallback();
|
||||||
}, function () {
|
}, function () {
|
||||||
console.debug('plugin not installed');
|
console.debug('plugin not installed');
|
||||||
|
|
|
@ -5,7 +5,7 @@ define(['loading', 'libraryMenu', 'dom', 'globalize', 'cardStyle', 'emby-button'
|
||||||
var msg = globalize.translate('UninstallPluginConfirmation', name);
|
var msg = globalize.translate('UninstallPluginConfirmation', name);
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm({
|
confirm.default({
|
||||||
title: globalize.translate('UninstallPluginHeader'),
|
title: globalize.translate('UninstallPluginHeader'),
|
||||||
text: msg,
|
text: msg,
|
||||||
primary: 'delete',
|
primary: 'delete',
|
||||||
|
|
|
@ -1,11 +1,19 @@
|
||||||
define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby-button', 'emby-select'], function ($, loading, datetime, dom, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
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) {
|
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({
|
options.push({
|
||||||
name: ScheduledTaskPage.getDisplayTime(i * 10000),
|
name: ScheduledTaskPage.getDisplayTime(i * 10000),
|
||||||
value: i * 10000
|
value: i * 10000
|
||||||
|
@ -18,15 +26,15 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
}
|
}
|
||||||
|
|
||||||
Array.prototype.remove = function (from, to) {
|
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;
|
this.length = from < 0 ? this.length + from : from;
|
||||||
return this.push.apply(this, rest);
|
return this.push.apply(this, rest);
|
||||||
};
|
};
|
||||||
|
|
||||||
var ScheduledTaskPage = {
|
const ScheduledTaskPage = {
|
||||||
refreshScheduledTask: function (view) {
|
refreshScheduledTask: function (view) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var id = getParameterByName('id');
|
let id = getParameterByName('id');
|
||||||
ApiClient.getScheduledTask(id).then(function (task) {
|
ApiClient.getScheduledTask(id).then(function (task) {
|
||||||
ScheduledTaskPage.loadScheduledTask(view, task);
|
ScheduledTaskPage.loadScheduledTask(view, task);
|
||||||
});
|
});
|
||||||
|
@ -42,11 +50,11 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
loading.hide();
|
loading.hide();
|
||||||
},
|
},
|
||||||
loadTaskTriggers: function (context, task) {
|
loadTaskTriggers: function (context, task) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<div class="paperList">';
|
html += '<div class="paperList">';
|
||||||
|
|
||||||
for (var i = 0, length = task.Triggers.length; i < length; i++) {
|
for (let i = 0, length = task.Triggers.length; i < length; i++) {
|
||||||
var trigger = task.Triggers[i];
|
const trigger = task.Triggers[i];
|
||||||
|
|
||||||
html += '<div class="listItem listItem-border">';
|
html += '<div class="listItem listItem-border">';
|
||||||
html += '<span class="material-icons listItemIcon schedule"></span>';
|
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>';
|
html += "<div class='listItemBodyText'>" + ScheduledTaskPage.getTriggerFriendlyName(trigger) + '</div>';
|
||||||
if (trigger.MaxRuntimeMs) {
|
if (trigger.MaxRuntimeMs) {
|
||||||
html += '<div class="listItemBodyText secondary">';
|
html += '<div class="listItemBodyText secondary">';
|
||||||
var hours = trigger.MaxRuntimeTicks / 36e9;
|
const hours = trigger.MaxRuntimeTicks / 36e9;
|
||||||
if (hours == 1) {
|
if (hours == 1) {
|
||||||
html += globalize.translate('ValueTimeLimitSingleHour');
|
html += globalize.translate('ValueTimeLimitSingleHour');
|
||||||
} else {
|
} else {
|
||||||
|
@ -92,7 +100,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
|
|
||||||
if (trigger.Type == 'IntervalTrigger') {
|
if (trigger.Type == 'IntervalTrigger') {
|
||||||
|
|
||||||
var hours = trigger.IntervalTicks / 36e9;
|
const hours = trigger.IntervalTicks / 36e9;
|
||||||
|
|
||||||
if (hours == 0.25) {
|
if (hours == 0.25) {
|
||||||
return globalize.translate('EveryXMinutes', '15');
|
return globalize.translate('EveryXMinutes', '15');
|
||||||
|
@ -117,8 +125,8 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
return trigger.Type;
|
return trigger.Type;
|
||||||
},
|
},
|
||||||
getDisplayTime: function (ticks) {
|
getDisplayTime: function (ticks) {
|
||||||
var ms = ticks / 1e4;
|
const ms = ticks / 1e4;
|
||||||
var now = new Date();
|
const now = new Date();
|
||||||
now.setHours(0, 0, 0, 0);
|
now.setHours(0, 0, 0, 0);
|
||||||
now.setTime(now.getTime() + ms);
|
now.setTime(now.getTime() + ms);
|
||||||
return datetime.getDisplayTime(now);
|
return datetime.getDisplayTime(now);
|
||||||
|
@ -130,14 +138,14 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
},
|
},
|
||||||
confirmDeleteTrigger: function (view, index) {
|
confirmDeleteTrigger: function (view, index) {
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm(globalize.translate('MessageDeleteTaskTrigger'), globalize.translate('HeaderDeleteTaskTrigger')).then(function () {
|
confirm.default(globalize.translate('MessageDeleteTaskTrigger'), globalize.translate('HeaderDeleteTaskTrigger')).then(function () {
|
||||||
ScheduledTaskPage.deleteTrigger(view, index);
|
ScheduledTaskPage.deleteTrigger(view, index);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
deleteTrigger: function (view, index) {
|
deleteTrigger: function (view, index) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var id = getParameterByName('id');
|
let id = getParameterByName('id');
|
||||||
ApiClient.getScheduledTask(id).then(function (task) {
|
ApiClient.getScheduledTask(id).then(function (task) {
|
||||||
task.Triggers.remove(index);
|
task.Triggers.remove(index);
|
||||||
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
||||||
|
@ -179,7 +187,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
getTriggerToAdd: function (page) {
|
getTriggerToAdd: function (page) {
|
||||||
var trigger = {
|
const trigger = {
|
||||||
Type: $('#selectTriggerType', page).val()
|
Type: $('#selectTriggerType', page).val()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -194,7 +202,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
trigger.IntervalTicks = $('#selectInterval', page).val();
|
trigger.IntervalTicks = $('#selectInterval', page).val();
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeLimit = $('#txtTimeLimit', page).val() || '0';
|
let timeLimit = $('#txtTimeLimit', page).val() || '0';
|
||||||
timeLimit = parseFloat(timeLimit) * 3600000;
|
timeLimit = parseFloat(timeLimit) * 3600000;
|
||||||
|
|
||||||
trigger.MaxRuntimeMs = timeLimit || null;
|
trigger.MaxRuntimeMs = timeLimit || null;
|
||||||
|
@ -202,10 +210,10 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
return trigger;
|
return trigger;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var id = getParameterByName('id');
|
let id = getParameterByName('id');
|
||||||
ApiClient.getScheduledTask(id).then(function (task) {
|
ApiClient.getScheduledTask(id).then(function (task) {
|
||||||
task.Triggers.push(ScheduledTaskPage.getTriggerToAdd(view));
|
task.Triggers.push(ScheduledTaskPage.getTriggerToAdd(view));
|
||||||
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
ApiClient.updateScheduledTaskTriggers(task.Id, task.Triggers).then(function () {
|
||||||
|
@ -226,7 +234,7 @@ define(['jQuery', 'loading', 'datetime', 'dom', 'globalize', 'emby-input', 'emby
|
||||||
ScheduledTaskPage.showAddTriggerPopup(view);
|
ScheduledTaskPage.showAddTriggerPopup(view);
|
||||||
});
|
});
|
||||||
view.addEventListener('click', function (e) {
|
view.addEventListener('click', function (e) {
|
||||||
var btnDeleteTrigger = dom.parentWithClass(e.target, 'btnDeleteTrigger');
|
const btnDeleteTrigger = dom.parentWithClass(e.target, 'btnDeleteTrigger');
|
||||||
|
|
||||||
if (btnDeleteTrigger) {
|
if (btnDeleteTrigger) {
|
||||||
ScheduledTaskPage.confirmDeleteTrigger(view, parseInt(btnDeleteTrigger.getAttribute('data-index')));
|
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 () {
|
view.addEventListener('viewshow', function () {
|
||||||
ScheduledTaskPage.refreshScheduledTask(view);
|
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) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
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) {
|
function reloadList(page) {
|
||||||
ApiClient.getScheduledTasks({
|
ApiClient.getScheduledTasks({
|
||||||
|
@ -17,10 +26,10 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||||
return a == b ? 0 : a < b ? -1 : 1;
|
return a == b ? 0 : a < b ? -1 : 1;
|
||||||
});
|
});
|
||||||
|
|
||||||
var currentCategory;
|
let currentCategory;
|
||||||
var html = '';
|
let html = '';
|
||||||
for (var i = 0; i < tasks.length; i++) {
|
for (let i = 0; i < tasks.length; i++) {
|
||||||
var task = tasks[i];
|
const task = tasks[i];
|
||||||
if (task.Category != currentCategory) {
|
if (task.Category != currentCategory) {
|
||||||
currentCategory = task.Category;
|
currentCategory = task.Category;
|
||||||
if (currentCategory) {
|
if (currentCategory) {
|
||||||
|
@ -63,11 +72,11 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTaskProgressHtml(task) {
|
function getTaskProgressHtml(task) {
|
||||||
var html = '';
|
let html = '';
|
||||||
if (task.State === 'Idle') {
|
if (task.State === 'Idle') {
|
||||||
if (task.LastExecutionResult) {
|
if (task.LastExecutionResult) {
|
||||||
var endtime = Date.parse(task.LastExecutionResult.EndTimeUtc);
|
const endtime = Date.parse(task.LastExecutionResult.EndTimeUtc);
|
||||||
var starttime = Date.parse(task.LastExecutionResult.StartTimeUtc);
|
const starttime = Date.parse(task.LastExecutionResult.StartTimeUtc);
|
||||||
html += globalize.translate('LabelScheduledTaskLastRan', datefns.formatDistanceToNow(endtime, dfnshelper.localeWithSuffix),
|
html += globalize.translate('LabelScheduledTaskLastRan', datefns.formatDistanceToNow(endtime, dfnshelper.localeWithSuffix),
|
||||||
datefns.formatDistance(starttime, endtime, { locale: dfnshelper.getLocale() }));
|
datefns.formatDistance(starttime, endtime, { locale: dfnshelper.getLocale() }));
|
||||||
if (task.LastExecutionResult.Status === 'Failed') {
|
if (task.LastExecutionResult.Status === 'Failed') {
|
||||||
|
@ -79,7 +88,7 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (task.State === 'Running') {
|
} 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 style="display:flex;align-items:center;">';
|
||||||
html += '<div class="taskProgressOuter" title="' + progress + '%" style="flex-grow:1;">';
|
html += '<div class="taskProgressOuter" title="' + progress + '%" style="flex-grow:1;">';
|
||||||
html += '<div class="taskProgressInner" style="width:' + progress + '%;">';
|
html += '<div class="taskProgressInner" style="width:' + progress + '%;">';
|
||||||
|
@ -94,7 +103,7 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||||
}
|
}
|
||||||
|
|
||||||
function setTaskButtonIcon(button, icon) {
|
function setTaskButtonIcon(button, icon) {
|
||||||
var inner = button.querySelector('.material-icons');
|
let inner = button.querySelector('.material-icons');
|
||||||
inner.classList.remove('stop', 'play_arrow');
|
inner.classList.remove('stop', 'play_arrow');
|
||||||
inner.classList.add(icon);
|
inner.classList.add(icon);
|
||||||
}
|
}
|
||||||
|
@ -114,10 +123,10 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||||
$(elem).parents('.listItem')[0].setAttribute('data-status', state);
|
$(elem).parents('.listItem')[0].setAttribute('data-status', state);
|
||||||
}
|
}
|
||||||
|
|
||||||
return function(view, params) {
|
export default function(view, params) {
|
||||||
function updateTasks(tasks) {
|
function updateTasks(tasks) {
|
||||||
for (var i = 0; i < tasks.length; i++) {
|
for (let i = 0; i < tasks.length; i++) {
|
||||||
var task = tasks[i];
|
const task = tasks[i];
|
||||||
view.querySelector('#taskProgress' + task.Id).innerHTML = getTaskProgressHtml(task);
|
view.querySelector('#taskProgress' + task.Id).innerHTML = getTaskProgressHtml(task);
|
||||||
updateTaskButton(view.querySelector('#btnTask' + task.Id), task.State);
|
updateTaskButton(view.querySelector('#btnTask' + task.Id), task.State);
|
||||||
}
|
}
|
||||||
|
@ -146,12 +155,12 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||||
pollInterval && clearInterval(pollInterval);
|
pollInterval && clearInterval(pollInterval);
|
||||||
}
|
}
|
||||||
|
|
||||||
var pollInterval;
|
let pollInterval;
|
||||||
var serverId = ApiClient.serverId();
|
const serverId = ApiClient.serverId();
|
||||||
|
|
||||||
$('.divScheduledTasks', view).on('click', '.btnStartTask', function() {
|
$('.divScheduledTasks', view).on('click', '.btnStartTask', function() {
|
||||||
var button = this;
|
const button = this;
|
||||||
var id = button.getAttribute('data-taskid');
|
let id = button.getAttribute('data-taskid');
|
||||||
ApiClient.startScheduledTask(id).then(function() {
|
ApiClient.startScheduledTask(id).then(function() {
|
||||||
updateTaskButton(button, 'Running');
|
updateTaskButton(button, 'Running');
|
||||||
reloadList(view);
|
reloadList(view);
|
||||||
|
@ -159,8 +168,8 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||||
});
|
});
|
||||||
|
|
||||||
$('.divScheduledTasks', view).on('click', '.btnStopTask', function() {
|
$('.divScheduledTasks', view).on('click', '.btnStopTask', function() {
|
||||||
var button = this;
|
const button = this;
|
||||||
var id = button.getAttribute('data-taskid');
|
let id = button.getAttribute('data-taskid');
|
||||||
ApiClient.stopScheduledTask(id).then(function() {
|
ApiClient.stopScheduledTask(id).then(function() {
|
||||||
updateTaskButton(button, '');
|
updateTaskButton(button, '');
|
||||||
reloadList(view);
|
reloadList(view);
|
||||||
|
@ -178,5 +187,6 @@ define(['jQuery', 'loading', 'events', 'globalize', 'serverNotifications', 'date
|
||||||
reloadList(view);
|
reloadList(view);
|
||||||
events.on(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
|
events.on(serverNotifications, 'ScheduledTasksInfo', onScheduledTasksUpdate);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
define(['components/activitylog', 'globalize'], function (ActivityLog, globalize) {
|
import ActivityLog from 'components/activitylog';
|
||||||
'use strict';
|
import globalize from 'globalize';
|
||||||
|
|
||||||
return function (view, params) {
|
/* eslint-disable indent */
|
||||||
var activityLog;
|
|
||||||
|
export default function (view, params) {
|
||||||
|
let activityLog;
|
||||||
|
|
||||||
if (params.useractivity !== 'false') {
|
if (params.useractivity !== 'false') {
|
||||||
view.querySelector('.activityItems').setAttribute('data-useractivity', 'true');
|
view.querySelector('.activityItems').setAttribute('data-useractivity', 'true');
|
||||||
|
@ -14,7 +16,7 @@ define(['components/activitylog', 'globalize'], function (ActivityLog, globalize
|
||||||
|
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
if (!activityLog) {
|
if (!activityLog) {
|
||||||
activityLog = new ActivityLog({
|
activityLog = new ActivityLog.default({
|
||||||
serverId: ApiClient.serverId(),
|
serverId: ApiClient.serverId(),
|
||||||
element: view.querySelector('.activityItems')
|
element: view.querySelector('.activityItems')
|
||||||
});
|
});
|
||||||
|
@ -27,5 +29,6 @@ define(['components/activitylog', 'globalize'], function (ActivityLog, globalize
|
||||||
|
|
||||||
activityLog = null;
|
activityLog = null;
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
define(['jQuery', 'libraryMenu', 'loading', 'globalize'], function ($, libraryMenu, loading, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import loading from 'loading';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function loadPage(page, config) {
|
function loadPage(page, config) {
|
||||||
$('#txtRemoteClientBitrateLimit', page).val(config.RemoteClientBitrateLimit / 1e6 || '');
|
$('#txtRemoteClientBitrateLimit', page).val(config.RemoteClientBitrateLimit / 1e6 || '');
|
||||||
|
@ -8,7 +12,7 @@ define(['jQuery', 'libraryMenu', 'loading', 'globalize'], function ($, libraryMe
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
loading.show();
|
loading.show();
|
||||||
var form = this;
|
const form = this;
|
||||||
ApiClient.getServerConfiguration().then(function (config) {
|
ApiClient.getServerConfiguration().then(function (config) {
|
||||||
config.RemoteClientBitrateLimit = parseInt(1e6 * parseFloat($('#txtRemoteClientBitrateLimit', form).val() || '0'));
|
config.RemoteClientBitrateLimit = parseInt(1e6 * parseFloat($('#txtRemoteClientBitrateLimit', form).val() || '0'));
|
||||||
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
|
@ -35,9 +39,10 @@ define(['jQuery', 'libraryMenu', 'loading', 'globalize'], function ($, libraryMe
|
||||||
}).on('pageshow', '#streamingSettingsPage', function () {
|
}).on('pageshow', '#streamingSettingsPage', function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
libraryMenu.setTabs('playback', 2, getTabs);
|
libraryMenu.setTabs('playback', 2, getTabs);
|
||||||
var page = this;
|
const page = this;
|
||||||
ApiClient.getServerConfiguration().then(function (config) {
|
ApiClient.getServerConfiguration().then(function (config) {
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -225,7 +225,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
|
|
||||||
function showBlockedTagPopup(page) {
|
function showBlockedTagPopup(page) {
|
||||||
require(['prompt'], function (prompt) {
|
require(['prompt'], function (prompt) {
|
||||||
prompt({
|
prompt.default({
|
||||||
label: globalize.translate('LabelTag')
|
label: globalize.translate('LabelTag')
|
||||||
}).then(function (value) {
|
}).then(function (value) {
|
||||||
var tags = getBlockedTagsFromPage(page);
|
var tags = getBlockedTagsFromPage(page);
|
||||||
|
|
|
@ -142,7 +142,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
var msg = globalize.translate('PasswordResetConfirmation');
|
var msg = globalize.translate('PasswordResetConfirmation');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm(msg, globalize.translate('PasswordResetHeader')).then(function () {
|
confirm.default(msg, globalize.translate('PasswordResetHeader')).then(function () {
|
||||||
var userId = params.userId;
|
var userId = params.userId;
|
||||||
loading.show();
|
loading.show();
|
||||||
ApiClient.resetUserPassword(userId).then(function () {
|
ApiClient.resetUserPassword(userId).then(function () {
|
||||||
|
@ -161,7 +161,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
var msg = globalize.translate('PinCodeResetConfirmation');
|
var msg = globalize.translate('PinCodeResetConfirmation');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm(msg, globalize.translate('HeaderPinCodeReset')).then(function () {
|
confirm.default(msg, globalize.translate('HeaderPinCodeReset')).then(function () {
|
||||||
var userId = params.userId;
|
var userId = params.userId;
|
||||||
loading.show();
|
loading.show();
|
||||||
ApiClient.resetEasyPassword(userId).then(function () {
|
ApiClient.resetEasyPassword(userId).then(function () {
|
||||||
|
|
|
@ -5,7 +5,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
var msg = globalize.translate('DeleteUserConfirmation');
|
var msg = globalize.translate('DeleteUserConfirmation');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm({
|
confirm.default({
|
||||||
title: globalize.translate('DeleteUser'),
|
title: globalize.translate('DeleteUser'),
|
||||||
text: msg,
|
text: msg,
|
||||||
confirmText: globalize.translate('ButtonDelete'),
|
confirmText: globalize.translate('ButtonDelete'),
|
||||||
|
|
|
@ -1787,7 +1787,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
|
||||||
imageLoader.lazyChildren(collectionItems);
|
imageLoader.lazyChildren(collectionItems);
|
||||||
collectionItems.querySelector('.btnAddToCollection').addEventListener('click', function () {
|
collectionItems.querySelector('.btnAddToCollection').addEventListener('click', function () {
|
||||||
require(['alert'], function (alert) {
|
require(['alert'], function (alert) {
|
||||||
alert({
|
alert.default({
|
||||||
text: globalize.translate('AddItemToCollectionHelp'),
|
text: globalize.translate('AddItemToCollectionHelp'),
|
||||||
html: globalize.translate('AddItemToCollectionHelp') + '<br/><br/><a is="emby-linkbutton" class="button-link" target="_blank" href="https://web.archive.org/web/20181216120305/https://github.com/MediaBrowser/Wiki/wiki/Collections">' + globalize.translate('ButtonLearnMore') + '</a>'
|
html: globalize.translate('AddItemToCollectionHelp') + '<br/><br/><a is="emby-linkbutton" class="button-link" target="_blank" href="https://web.archive.org/web/20181216120305/https://github.com/MediaBrowser/Wiki/wiki/Collections">' + globalize.translate('ButtonLearnMore') + '</a>'
|
||||||
});
|
});
|
||||||
|
@ -1935,7 +1935,7 @@ define(['loading', 'appRouter', 'layoutManager', 'connectionManager', 'userSetti
|
||||||
|
|
||||||
function splitVersions(instance, page, apiClient, params) {
|
function splitVersions(instance, page, apiClient, params) {
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm('Are you sure you wish to split the media sources into separate items?', 'Split Media Apart').then(function () {
|
confirm.default('Are you sure you wish to split the media sources into separate items?', 'Split Media Apart').then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
apiClient.ajax({
|
apiClient.ajax({
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
|
|
|
@ -49,7 +49,7 @@ define(['jQuery', 'globalize', 'scripts/taskbutton', 'dom', 'libraryMenu', 'layo
|
||||||
var message = globalize.translate('MessageConfirmDeleteTunerDevice');
|
var message = globalize.translate('MessageConfirmDeleteTunerDevice');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm(message, globalize.translate('HeaderDeleteDevice')).then(function () {
|
confirm.default(message, globalize.translate('HeaderDeleteDevice')).then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
|
@ -167,7 +167,7 @@ define(['jQuery', 'globalize', 'scripts/taskbutton', 'dom', 'libraryMenu', 'layo
|
||||||
var message = globalize.translate('MessageConfirmDeleteGuideProvider');
|
var message = globalize.translate('MessageConfirmDeleteGuideProvider');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm(message, globalize.translate('HeaderDeleteProvider')).then(function () {
|
confirm.default(message, globalize.translate('HeaderDeleteProvider')).then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
type: 'DELETE',
|
type: 'DELETE',
|
||||||
|
|
|
@ -1,36 +1,37 @@
|
||||||
define(['focusManager', 'searchFields', 'searchResults', 'events'], function (focusManager, SearchFields, SearchResults, events) {
|
import focusManager from 'focusManager';
|
||||||
'use strict';
|
import SearchFields from 'searchFields';
|
||||||
|
import SearchResults from 'searchResults';
|
||||||
|
import events from 'events';
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
function onSearch(e, value) {
|
function onSearch(e, value) {
|
||||||
self.searchResults.search(value);
|
self.searchResults.search(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
const self = this;
|
||||||
|
view.addEventListener('viewshow', function () {
|
||||||
|
if (!self.searchFields) {
|
||||||
|
self.searchFields = new SearchFields({
|
||||||
|
element: view.querySelector('.searchFields')
|
||||||
|
});
|
||||||
|
self.searchResults = new SearchResults({
|
||||||
|
element: view.querySelector('.searchResults'),
|
||||||
|
serverId: params.serverId || ApiClient.serverId(),
|
||||||
|
parentId: params.parentId,
|
||||||
|
collectionType: params.collectionType
|
||||||
|
});
|
||||||
|
events.on(self.searchFields, 'search', onSearch);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
view.addEventListener('viewdestroy', function () {
|
||||||
|
if (self.searchFields) {
|
||||||
|
self.searchFields.destroy();
|
||||||
|
self.searchFields = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
if (self.searchResults) {
|
||||||
view.addEventListener('viewshow', function () {
|
self.searchResults.destroy();
|
||||||
if (!self.searchFields) {
|
self.searchResults = null;
|
||||||
self.searchFields = new SearchFields({
|
}
|
||||||
element: view.querySelector('.searchFields')
|
});
|
||||||
});
|
}
|
||||||
self.searchResults = new SearchResults({
|
|
||||||
element: view.querySelector('.searchResults'),
|
|
||||||
serverId: params.serverId || ApiClient.serverId(),
|
|
||||||
parentId: params.parentId,
|
|
||||||
collectionType: params.collectionType
|
|
||||||
});
|
|
||||||
events.on(self.searchFields, 'search', onSearch);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
view.addEventListener('viewdestroy', function () {
|
|
||||||
if (self.searchFields) {
|
|
||||||
self.searchFields.destroy();
|
|
||||||
self.searchFields = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.searchResults) {
|
|
||||||
self.searchResults.destroy();
|
|
||||||
self.searchResults = null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
});
|
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardBuilder', 'userSettings', 'globalize', 'emby-itemscontainer'], function (loading, events, libraryBrowser, imageLoader, listView, cardBuilder, userSettings, globalize) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import events from 'events';
|
||||||
|
import libraryBrowser from 'libraryBrowser';
|
||||||
|
import imageLoader from 'imageLoader';
|
||||||
|
import listView from 'listView';
|
||||||
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'emby-itemscontainer';
|
||||||
|
|
||||||
return function (view, params, tabContent) {
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
export default function (view, params, tabContent) {
|
||||||
function getPageData(context) {
|
function getPageData(context) {
|
||||||
var key = getSavedQueryKey(context);
|
const key = getSavedQueryKey(context);
|
||||||
var pageData = data[key];
|
let pageData = data[key];
|
||||||
|
|
||||||
if (!pageData) {
|
if (!pageData) {
|
||||||
pageData = data[key] = {
|
pageData = data[key] = {
|
||||||
|
@ -46,8 +55,8 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
|
||||||
}
|
}
|
||||||
|
|
||||||
function onViewStyleChange() {
|
function onViewStyleChange() {
|
||||||
var viewStyle = self.getCurrentViewStyle();
|
const viewStyle = self.getCurrentViewStyle();
|
||||||
var itemsContainer = tabContent.querySelector('.itemsContainer');
|
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||||
|
|
||||||
if ('List' == viewStyle) {
|
if ('List' == viewStyle) {
|
||||||
itemsContainer.classList.add('vertical-list');
|
itemsContainer.classList.add('vertical-list');
|
||||||
|
@ -63,7 +72,7 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
|
||||||
function reloadItems(page) {
|
function reloadItems(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
var query = getQuery(page);
|
const query = getQuery(page);
|
||||||
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
ApiClient.getItems(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||||
function onNextPageClick() {
|
function onNextPageClick() {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
@ -88,8 +97,8 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
|
||||||
}
|
}
|
||||||
|
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
var html;
|
let html;
|
||||||
var pagingHtml = libraryBrowser.getQueryPagingHtml({
|
const pagingHtml = libraryBrowser.getQueryPagingHtml({
|
||||||
startIndex: query.StartIndex,
|
startIndex: query.StartIndex,
|
||||||
limit: query.Limit,
|
limit: query.Limit,
|
||||||
totalRecordCount: result.TotalRecordCount,
|
totalRecordCount: result.TotalRecordCount,
|
||||||
|
@ -99,8 +108,8 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
|
||||||
sortButton: false,
|
sortButton: false,
|
||||||
filterButton: false
|
filterButton: false
|
||||||
});
|
});
|
||||||
var viewStyle = self.getCurrentViewStyle();
|
const viewStyle = self.getCurrentViewStyle();
|
||||||
var itemsContainer = tabContent.querySelector('.itemsContainer');
|
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||||
if (viewStyle == 'List') {
|
if (viewStyle == 'List') {
|
||||||
html = listView.getListViewHtml({
|
html = listView.getListViewHtml({
|
||||||
items: result.Items,
|
items: result.Items,
|
||||||
|
@ -128,22 +137,20 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
|
||||||
overlayPlayButton: true
|
overlayPlayButton: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var i;
|
let elems;
|
||||||
var length;
|
|
||||||
var elems;
|
|
||||||
|
|
||||||
elems = tabContent.querySelectorAll('.paging');
|
elems = tabContent.querySelectorAll('.paging');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].innerHTML = pagingHtml;
|
elems[i].innerHTML = pagingHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
elems = tabContent.querySelectorAll('.btnNextPage');
|
elems = tabContent.querySelectorAll('.btnNextPage');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].addEventListener('click', onNextPageClick);
|
elems[i].addEventListener('click', onNextPageClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
elems = tabContent.querySelectorAll('.btnPreviousPage');
|
elems = tabContent.querySelectorAll('.btnPreviousPage');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].addEventListener('click', onPreviousPageClick);
|
elems[i].addEventListener('click', onPreviousPageClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -153,19 +160,19 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
|
||||||
loading.hide();
|
loading.hide();
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
|
||||||
require(['autoFocuser'], function (autoFocuser) {
|
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||||
autoFocuser.autoFocus(page);
|
autoFocuser.autoFocus(page);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
var data = {};
|
const data = {};
|
||||||
var isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
self.showFilterMenu = function () {
|
self.showFilterMenu = function () {
|
||||||
require(['components/filterdialog/filterdialog'], function ({default: filterDialogFactory}) {
|
import('components/filterdialog/filterdialog').then(({default: filterDialogFactory}) => {
|
||||||
var filterDialog = new filterDialogFactory({
|
const filterDialog = new filterDialogFactory({
|
||||||
query: getQuery(tabContent),
|
query: getQuery(tabContent),
|
||||||
mode: 'episodes',
|
mode: 'episodes',
|
||||||
serverId: ApiClient.serverId()
|
serverId: ApiClient.serverId()
|
||||||
|
@ -219,12 +226,12 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
|
||||||
button: e.target
|
button: e.target
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
var btnSelectView = tabContent.querySelector('.btnSelectView');
|
const btnSelectView = tabContent.querySelector('.btnSelectView');
|
||||||
btnSelectView.addEventListener('click', function (e) {
|
btnSelectView.addEventListener('click', function (e) {
|
||||||
libraryBrowser.showLayoutMenu(e.target, self.getCurrentViewStyle(), 'List,Poster,PosterCard'.split(','));
|
libraryBrowser.showLayoutMenu(e.target, self.getCurrentViewStyle(), 'List,Poster,PosterCard'.split(','));
|
||||||
});
|
});
|
||||||
btnSelectView.addEventListener('layoutchange', function (e) {
|
btnSelectView.addEventListener('layoutchange', function (e) {
|
||||||
var viewStyle = e.detail.viewStyle;
|
const viewStyle = e.detail.viewStyle;
|
||||||
getPageData(tabContent).view = viewStyle;
|
getPageData(tabContent).view = viewStyle;
|
||||||
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle);
|
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle);
|
||||||
onViewStyleChange();
|
onViewStyleChange();
|
||||||
|
@ -240,5 +247,6 @@ define(['loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardB
|
||||||
};
|
};
|
||||||
|
|
||||||
self.destroy = function () {};
|
self.destroy = function () {};
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,10 +1,20 @@
|
||||||
define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader', 'apphost', 'globalize', 'appRouter', 'dom', 'emby-button'], function (layoutManager, loading, libraryBrowser, cardBuilder, lazyLoader, appHost, globalize, appRouter, dom) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import libraryBrowser from 'libraryBrowser';
|
||||||
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import lazyLoader from 'lazyLoader';
|
||||||
|
import appHost from 'apphost';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import appRouter from 'appRouter';
|
||||||
|
import dom from 'dom';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
return function (view, params, tabContent) {
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
export default function (view, params, tabContent) {
|
||||||
function getPageData() {
|
function getPageData() {
|
||||||
var key = getSavedQueryKey();
|
const key = getSavedQueryKey();
|
||||||
var pageData = data[key];
|
let pageData = data[key];
|
||||||
|
|
||||||
if (!pageData) {
|
if (!pageData) {
|
||||||
pageData = data[key] = {
|
pageData = data[key] = {
|
||||||
|
@ -34,7 +44,7 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
|
|
||||||
function getPromise() {
|
function getPromise() {
|
||||||
loading.show();
|
loading.show();
|
||||||
var query = getQuery();
|
const query = getQuery();
|
||||||
return ApiClient.getGenres(ApiClient.getCurrentUserId(), query);
|
return ApiClient.getGenres(ApiClient.getCurrentUserId(), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,17 +61,17 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
function fillItemsContainer(entry) {
|
function fillItemsContainer(entry) {
|
||||||
var elem = entry.target;
|
const elem = entry.target;
|
||||||
var id = elem.getAttribute('data-id');
|
const id = elem.getAttribute('data-id');
|
||||||
var viewStyle = self.getCurrentViewStyle();
|
const viewStyle = self.getCurrentViewStyle();
|
||||||
var limit = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 5 : 9;
|
let limit = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 5 : 9;
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
limit = 10;
|
limit = 10;
|
||||||
}
|
}
|
||||||
|
|
||||||
var enableImageTypes = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 'Primary,Backdrop,Thumb' : 'Primary';
|
const enableImageTypes = 'Thumb' == viewStyle || 'ThumbCard' == viewStyle ? 'Primary,Backdrop,Thumb' : 'Primary';
|
||||||
var query = {
|
const query = {
|
||||||
SortBy: 'SortName',
|
SortBy: 'SortName',
|
||||||
SortOrder: 'Ascending',
|
SortOrder: 'Ascending',
|
||||||
IncludeItemTypes: 'Series',
|
IncludeItemTypes: 'Series',
|
||||||
|
@ -75,7 +85,7 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
ParentId: params.topParentId
|
ParentId: params.topParentId
|
||||||
};
|
};
|
||||||
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then(function (result) {
|
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then(function (result) {
|
||||||
var supportsImageAnalysis = appHost.supports('imageanalysis');
|
const supportsImageAnalysis = appHost.supports('imageanalysis');
|
||||||
|
|
||||||
if (viewStyle == 'Thumb') {
|
if (viewStyle == 'Thumb') {
|
||||||
cardBuilder.buildCards(result.Items, {
|
cardBuilder.buildCards(result.Items, {
|
||||||
|
@ -128,14 +138,14 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadItems(context, promise) {
|
function reloadItems(context, promise) {
|
||||||
var query = getQuery();
|
const query = getQuery();
|
||||||
promise.then(function (result) {
|
promise.then(function (result) {
|
||||||
var elem = context.querySelector('#items');
|
const elem = context.querySelector('#items');
|
||||||
var html = '';
|
let html = '';
|
||||||
var items = result.Items;
|
const items = result.Items;
|
||||||
|
|
||||||
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];
|
||||||
html += '<div class="verticalSection">';
|
html += '<div class="verticalSection">';
|
||||||
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
html += '<div class="sectionTitleContainer sectionTitleContainer-cards padded-left">';
|
||||||
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl(item, {
|
html += '<a is="emby-linkbutton" href="' + appRouter.getRouteUrl(item, {
|
||||||
|
@ -149,7 +159,7 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
html += '</a>';
|
html += '</a>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
var scrollXClass = 'scrollX hiddenScrollX';
|
let scrollXClass = 'scrollX hiddenScrollX';
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollXClass += 'smoothScrollX padded-top-focusscale padded-bottom-focusscale';
|
scrollXClass += 'smoothScrollX padded-top-focusscale padded-bottom-focusscale';
|
||||||
}
|
}
|
||||||
|
@ -182,8 +192,8 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
self.renderTab();
|
self.renderTab();
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
var data = {};
|
const data = {};
|
||||||
|
|
||||||
self.getViewStyles = function () {
|
self.getViewStyles = function () {
|
||||||
return 'Poster,PosterCard,Thumb,ThumbCard'.split(',');
|
return 'Poster,PosterCard,Thumb,ThumbCard'.split(',');
|
||||||
|
@ -200,7 +210,7 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
};
|
};
|
||||||
|
|
||||||
self.enableViewSelection = true;
|
self.enableViewSelection = true;
|
||||||
var promise;
|
let promise;
|
||||||
|
|
||||||
self.preRender = function () {
|
self.preRender = function () {
|
||||||
promise = getPromise();
|
promise = getPromise();
|
||||||
|
@ -209,5 +219,6 @@ define(['layoutManager', 'loading', 'libraryBrowser', 'cardBuilder', 'lazyLoader
|
||||||
self.renderTab = function () {
|
self.renderTab = function () {
|
||||||
reloadItems(tabContent, promise);
|
reloadItems(tabContent, promise);
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,11 +1,16 @@
|
||||||
define(['loading', 'components/groupedcards', 'cardBuilder', 'apphost', 'imageLoader'], function (loading, groupedcards, cardBuilder, appHost, imageLoader) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import groupedcards from 'components/groupedcards';
|
||||||
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import appHost from 'apphost';
|
||||||
|
import imageLoader from 'imageLoader';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function getLatestPromise(context, params) {
|
function getLatestPromise(context, params) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var userId = ApiClient.getCurrentUserId();
|
const userId = ApiClient.getCurrentUserId();
|
||||||
var parentId = params.topParentId;
|
const parentId = params.topParentId;
|
||||||
var options = {
|
const options = {
|
||||||
IncludeItemTypes: 'Episode',
|
IncludeItemTypes: 'Episode',
|
||||||
Limit: 30,
|
Limit: 30,
|
||||||
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
Fields: 'PrimaryImageAspectRatio,BasicSyncInfo',
|
||||||
|
@ -18,7 +23,7 @@ define(['loading', 'components/groupedcards', 'cardBuilder', 'apphost', 'imageLo
|
||||||
|
|
||||||
function loadLatest(context, params, promise) {
|
function loadLatest(context, params, promise) {
|
||||||
promise.then(function (items) {
|
promise.then(function (items) {
|
||||||
var html = '';
|
let html = '';
|
||||||
appHost.supports('imageanalysis');
|
appHost.supports('imageanalysis');
|
||||||
html += cardBuilder.getCardsHtml({
|
html += cardBuilder.getCardsHtml({
|
||||||
items: items,
|
items: items,
|
||||||
|
@ -36,20 +41,20 @@ define(['loading', 'components/groupedcards', 'cardBuilder', 'apphost', 'imageLo
|
||||||
overlayPlayButton: true,
|
overlayPlayButton: true,
|
||||||
lines: 2
|
lines: 2
|
||||||
});
|
});
|
||||||
var elem = context.querySelector('#latestEpisodes');
|
const elem = context.querySelector('#latestEpisodes');
|
||||||
elem.innerHTML = html;
|
elem.innerHTML = html;
|
||||||
imageLoader.lazyChildren(elem);
|
imageLoader.lazyChildren(elem);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
require(['autoFocuser'], function (autoFocuser) {
|
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||||
autoFocuser.autoFocus(context);
|
autoFocuser.autoFocus(context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params, tabContent) {
|
export default function (view, params, tabContent) {
|
||||||
var self = this;
|
const self = this;
|
||||||
var latestPromise;
|
let latestPromise;
|
||||||
|
|
||||||
self.preRender = function () {
|
self.preRender = function () {
|
||||||
latestPromise = getLatestPromise(view, params);
|
latestPromise = getLatestPromise(view, params);
|
||||||
|
@ -59,6 +64,7 @@ define(['loading', 'components/groupedcards', 'cardBuilder', 'apphost', 'imageLo
|
||||||
loadLatest(tabContent, params, latestPromise);
|
loadLatest(tabContent, params, latestPromise);
|
||||||
};
|
};
|
||||||
|
|
||||||
tabContent.querySelector('#latestEpisodes').addEventListener('click', groupedcards.onItemsContainerClick);
|
tabContent.querySelector('#latestEpisodes').addEventListener('click', groupedcards);
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,5 +1,19 @@
|
||||||
define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'dom', 'userSettings', 'cardBuilder', 'playbackManager', 'mainTabsManager', 'globalize', 'scrollStyles', 'emby-itemscontainer', 'emby-button'], function (events, inputManager, libraryMenu, layoutManager, loading, dom, userSettings, cardBuilder, playbackManager, mainTabsManager, globalize) {
|
import events from 'events';
|
||||||
'use strict';
|
import inputManager from 'inputManager';
|
||||||
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import loading from 'loading';
|
||||||
|
import dom from 'dom';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import playbackManager from 'playbackManager';
|
||||||
|
import mainTabsManager from 'mainTabsManager';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'scrollStyles';
|
||||||
|
import 'emby-itemscontainer';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function getTabs() {
|
function getTabs() {
|
||||||
return [{
|
return [{
|
||||||
|
@ -59,7 +73,7 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
function reload() {
|
function reload() {
|
||||||
loading.show();
|
loading.show();
|
||||||
loadResume();
|
loadResume();
|
||||||
|
@ -67,7 +81,7 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadNextUp() {
|
function loadNextUp() {
|
||||||
var query = {
|
const query = {
|
||||||
Limit: 24,
|
Limit: 24,
|
||||||
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo',
|
Fields: 'PrimaryImageAspectRatio,SeriesInfo,DateCreated,BasicSyncInfo',
|
||||||
UserId: ApiClient.getCurrentUserId(),
|
UserId: ApiClient.getCurrentUserId(),
|
||||||
|
@ -83,7 +97,7 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
view.querySelector('.noNextUpItems').classList.remove('hide');
|
view.querySelector('.noNextUpItems').classList.remove('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var container = view.querySelector('#nextUpItems');
|
const container = view.querySelector('#nextUpItems');
|
||||||
cardBuilder.buildCards(result.Items, {
|
cardBuilder.buildCards(result.Items, {
|
||||||
itemsContainer: container,
|
itemsContainer: container,
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
|
@ -98,7 +112,7 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
});
|
});
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
require(['autoFocuser'], function (autoFocuser) {
|
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||||
autoFocuser.autoFocus(view);
|
autoFocuser.autoFocus(view);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -113,10 +127,10 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadResume() {
|
function loadResume() {
|
||||||
var parentId = libraryMenu.getTopParentId();
|
const parentId = libraryMenu.getTopParentId();
|
||||||
var screenWidth = dom.getWindowSize().innerWidth;
|
const screenWidth = dom.getWindowSize().innerWidth;
|
||||||
var limit = screenWidth >= 1600 ? 5 : 6;
|
const limit = screenWidth >= 1600 ? 5 : 6;
|
||||||
var options = {
|
const options = {
|
||||||
SortBy: 'DatePlayed',
|
SortBy: 'DatePlayed',
|
||||||
SortOrder: 'Descending',
|
SortOrder: 'Descending',
|
||||||
IncludeItemTypes: 'Episode',
|
IncludeItemTypes: 'Episode',
|
||||||
|
@ -137,8 +151,8 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
view.querySelector('#resumableSection').classList.add('hide');
|
view.querySelector('#resumableSection').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var allowBottomPadding = !enableScrollX();
|
const allowBottomPadding = !enableScrollX();
|
||||||
var container = view.querySelector('#resumableItems');
|
const container = view.querySelector('#resumableItems');
|
||||||
cardBuilder.buildCards(result.Items, {
|
cardBuilder.buildCards(result.Items, {
|
||||||
itemsContainer: container,
|
itemsContainer: container,
|
||||||
preferThumb: true,
|
preferThumb: true,
|
||||||
|
@ -160,7 +174,7 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTabChange(e) {
|
function onTabChange(e) {
|
||||||
var newIndex = parseInt(e.detail.selectedTabIndex);
|
const newIndex = parseInt(e.detail.selectedTabIndex);
|
||||||
loadTab(view, newIndex);
|
loadTab(view, newIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,49 +187,50 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTabController(page, index, callback) {
|
function getTabController(page, index, callback) {
|
||||||
var depends = [];
|
let depends;
|
||||||
|
|
||||||
switch (index) {
|
switch (index) {
|
||||||
case 0:
|
case 0:
|
||||||
depends.push('controllers/shows/tvshows');
|
depends = 'controllers/shows/tvshows';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
|
depends = 'controllers/shows/tvrecommended';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
depends.push('controllers/shows/tvlatest');
|
depends = 'controllers/shows/tvlatest';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
depends.push('controllers/shows/tvupcoming');
|
depends = 'controllers/shows/tvupcoming';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
depends.push('controllers/shows/tvgenres');
|
depends = 'controllers/shows/tvgenres';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
depends.push('controllers/shows/tvstudios');
|
depends = 'controllers/shows/tvstudios';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
depends.push('controllers/shows/episodes');
|
depends = 'controllers/shows/episodes';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 7:
|
case 7:
|
||||||
depends.push('scripts/searchtab');
|
depends = 'scripts/searchtab';
|
||||||
}
|
}
|
||||||
|
|
||||||
require(depends, function (controllerFactory) {
|
import(depends).then(({default: controllerFactory}) => {
|
||||||
var tabContent;
|
let tabContent;
|
||||||
|
|
||||||
if (index === 1) {
|
if (index === 1) {
|
||||||
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
|
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
|
||||||
self.tabContent = tabContent;
|
self.tabContent = tabContent;
|
||||||
}
|
}
|
||||||
|
|
||||||
var controller = tabControllers[index];
|
let controller = tabControllers[index];
|
||||||
|
|
||||||
if (!controller) {
|
if (!controller) {
|
||||||
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
|
tabContent = view.querySelector(".pageTabContent[data-index='" + index + "']");
|
||||||
|
@ -270,7 +285,7 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
}
|
}
|
||||||
|
|
||||||
function onWebSocketMessage(e, data) {
|
function onWebSocketMessage(e, data) {
|
||||||
var msg = data;
|
const msg = data;
|
||||||
|
|
||||||
if (msg.MessageType === 'UserDataChanged' && msg.Data.UserId == ApiClient.getCurrentUserId()) {
|
if (msg.MessageType === 'UserDataChanged' && msg.Data.UserId == ApiClient.getCurrentUserId()) {
|
||||||
renderedTabs = [];
|
renderedTabs = [];
|
||||||
|
@ -285,13 +300,13 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var isViewRestored;
|
let isViewRestored;
|
||||||
var self = this;
|
const self = this;
|
||||||
var currentTabIndex = parseInt(params.tab || getDefaultTabIndex(params.topParentId));
|
let currentTabIndex = parseInt(params.tab || getDefaultTabIndex(params.topParentId));
|
||||||
var initialTabIndex = currentTabIndex;
|
let initialTabIndex = currentTabIndex;
|
||||||
|
|
||||||
self.initTab = function () {
|
self.initTab = function () {
|
||||||
var tabContent = self.tabContent;
|
const tabContent = self.tabContent;
|
||||||
setScrollClasses(tabContent.querySelector('#resumableItems'), enableScrollX());
|
setScrollClasses(tabContent.querySelector('#resumableItems'), enableScrollX());
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -299,14 +314,14 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
reload();
|
reload();
|
||||||
};
|
};
|
||||||
|
|
||||||
var tabControllers = [];
|
const tabControllers = [];
|
||||||
var renderedTabs = [];
|
let renderedTabs = [];
|
||||||
setScrollClasses(view.querySelector('#resumableItems'), enableScrollX());
|
setScrollClasses(view.querySelector('#resumableItems'), enableScrollX());
|
||||||
view.addEventListener('viewshow', function (e) {
|
view.addEventListener('viewshow', function (e) {
|
||||||
isViewRestored = e.detail.isRestored;
|
isViewRestored = e.detail.isRestored;
|
||||||
initTabs();
|
initTabs();
|
||||||
if (!view.getAttribute('data-title')) {
|
if (!view.getAttribute('data-title')) {
|
||||||
var parentId = params.topParentId;
|
const parentId = params.topParentId;
|
||||||
|
|
||||||
if (parentId) {
|
if (parentId) {
|
||||||
ApiClient.getItem(ApiClient.getCurrentUserId(), parentId).then(function (item) {
|
ApiClient.getItem(ApiClient.getCurrentUserId(), parentId).then(function (item) {
|
||||||
|
@ -335,5 +350,6 @@ define(['events', 'inputManager', 'libraryMenu', 'layoutManager', 'loading', 'do
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,10 +1,21 @@
|
||||||
define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', 'listView', 'cardBuilder', 'alphaPicker', 'userSettings', 'globalize', 'emby-itemscontainer'], function (layoutManager, loading, events, libraryBrowser, imageLoader, listView, cardBuilder, AlphaPicker, userSettings, globalize) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import events from 'events';
|
||||||
|
import libraryBrowser from 'libraryBrowser';
|
||||||
|
import imageLoader from 'imageLoader';
|
||||||
|
import listView from 'listView';
|
||||||
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import AlphaPicker from 'alphaPicker';
|
||||||
|
import * as userSettings from 'userSettings';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'emby-itemscontainer';
|
||||||
|
|
||||||
return function (view, params, tabContent) {
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
export default function (view, params, tabContent) {
|
||||||
function getPageData(context) {
|
function getPageData(context) {
|
||||||
var key = getSavedQueryKey(context);
|
const key = getSavedQueryKey(context);
|
||||||
var pageData = data[key];
|
let pageData = data[key];
|
||||||
|
|
||||||
if (!pageData) {
|
if (!pageData) {
|
||||||
pageData = data[key] = {
|
pageData = data[key] = {
|
||||||
|
@ -45,8 +56,8 @@ define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', '
|
||||||
}
|
}
|
||||||
|
|
||||||
function onViewStyleChange() {
|
function onViewStyleChange() {
|
||||||
var viewStyle = self.getCurrentViewStyle();
|
const viewStyle = self.getCurrentViewStyle();
|
||||||
var itemsContainer = tabContent.querySelector('.itemsContainer');
|
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||||
|
|
||||||
if ('List' == viewStyle) {
|
if ('List' == viewStyle) {
|
||||||
itemsContainer.classList.add('vertical-list');
|
itemsContainer.classList.add('vertical-list');
|
||||||
|
@ -62,7 +73,7 @@ define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', '
|
||||||
function reloadItems(page) {
|
function reloadItems(page) {
|
||||||
loading.show();
|
loading.show();
|
||||||
isLoading = true;
|
isLoading = true;
|
||||||
var query = getQuery(page);
|
const query = getQuery(page);
|
||||||
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then(function (result) {
|
ApiClient.getItems(ApiClient.getCurrentUserId(), query).then(function (result) {
|
||||||
function onNextPageClick() {
|
function onNextPageClick() {
|
||||||
if (isLoading) {
|
if (isLoading) {
|
||||||
|
@ -88,8 +99,8 @@ define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', '
|
||||||
|
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
updateFilterControls(page);
|
updateFilterControls(page);
|
||||||
var html;
|
let html;
|
||||||
var pagingHtml = libraryBrowser.getQueryPagingHtml({
|
const pagingHtml = libraryBrowser.getQueryPagingHtml({
|
||||||
startIndex: query.StartIndex,
|
startIndex: query.StartIndex,
|
||||||
limit: query.Limit,
|
limit: query.Limit,
|
||||||
totalRecordCount: result.TotalRecordCount,
|
totalRecordCount: result.TotalRecordCount,
|
||||||
|
@ -99,7 +110,7 @@ define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', '
|
||||||
sortButton: false,
|
sortButton: false,
|
||||||
filterButton: false
|
filterButton: false
|
||||||
});
|
});
|
||||||
var viewStyle = self.getCurrentViewStyle();
|
const viewStyle = self.getCurrentViewStyle();
|
||||||
if (viewStyle == 'Thumb') {
|
if (viewStyle == 'Thumb') {
|
||||||
html = cardBuilder.getCardsHtml({
|
html = cardBuilder.getCardsHtml({
|
||||||
items: result.Items,
|
items: result.Items,
|
||||||
|
@ -156,49 +167,48 @@ define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', '
|
||||||
showYear: true
|
showYear: true
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
var i;
|
|
||||||
var length;
|
|
||||||
var elems = tabContent.querySelectorAll('.paging');
|
|
||||||
|
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
let elems = tabContent.querySelectorAll('.paging');
|
||||||
|
|
||||||
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].innerHTML = pagingHtml;
|
elems[i].innerHTML = pagingHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
elems = tabContent.querySelectorAll('.btnNextPage');
|
elems = tabContent.querySelectorAll('.btnNextPage');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].addEventListener('click', onNextPageClick);
|
elems[i].addEventListener('click', onNextPageClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
elems = tabContent.querySelectorAll('.btnPreviousPage');
|
elems = tabContent.querySelectorAll('.btnPreviousPage');
|
||||||
for (i = 0, length = elems.length; i < length; i++) {
|
for (let i = 0, length = elems.length; i < length; i++) {
|
||||||
elems[i].addEventListener('click', onPreviousPageClick);
|
elems[i].addEventListener('click', onPreviousPageClick);
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemsContainer = tabContent.querySelector('.itemsContainer');
|
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||||
itemsContainer.innerHTML = html;
|
itemsContainer.innerHTML = html;
|
||||||
imageLoader.lazyChildren(itemsContainer);
|
imageLoader.lazyChildren(itemsContainer);
|
||||||
libraryBrowser.saveQueryValues(getSavedQueryKey(page), query);
|
libraryBrowser.saveQueryValues(getSavedQueryKey(page), query);
|
||||||
loading.hide();
|
loading.hide();
|
||||||
isLoading = false;
|
isLoading = false;
|
||||||
|
|
||||||
require(['autoFocuser'], function (autoFocuser) {
|
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||||
autoFocuser.autoFocus(page);
|
autoFocuser.autoFocus(page);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function updateFilterControls(tabContent) {
|
function updateFilterControls(tabContent) {
|
||||||
var query = getQuery(tabContent);
|
const query = getQuery(tabContent);
|
||||||
self.alphaPicker.value(query.NameStartsWithOrGreater);
|
self.alphaPicker.value(query.NameStartsWithOrGreater);
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
var data = {};
|
const data = {};
|
||||||
var isLoading = false;
|
let isLoading = false;
|
||||||
|
|
||||||
self.showFilterMenu = function () {
|
self.showFilterMenu = function () {
|
||||||
require(['components/filterdialog/filterdialog'], function ({default: filterDialogFactory}) {
|
import('components/filterdialog/filterdialog').then(({default: filterDialogFactory}) => {
|
||||||
var filterDialog = new filterDialogFactory({
|
const filterDialog = new filterDialogFactory({
|
||||||
query: getQuery(tabContent),
|
query: getQuery(tabContent),
|
||||||
mode: 'series',
|
mode: 'series',
|
||||||
serverId: ApiClient.serverId()
|
serverId: ApiClient.serverId()
|
||||||
|
@ -216,17 +226,17 @@ define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', '
|
||||||
};
|
};
|
||||||
|
|
||||||
function initPage(tabContent) {
|
function initPage(tabContent) {
|
||||||
var alphaPickerElement = tabContent.querySelector('.alphaPicker');
|
const alphaPickerElement = tabContent.querySelector('.alphaPicker');
|
||||||
var itemsContainer = tabContent.querySelector('.itemsContainer');
|
const itemsContainer = tabContent.querySelector('.itemsContainer');
|
||||||
|
|
||||||
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
|
alphaPickerElement.addEventListener('alphavaluechanged', function (e) {
|
||||||
var newValue = e.detail.value;
|
const newValue = e.detail.value;
|
||||||
var query = getQuery(tabContent);
|
const query = getQuery(tabContent);
|
||||||
query.NameStartsWithOrGreater = newValue;
|
query.NameStartsWithOrGreater = newValue;
|
||||||
query.StartIndex = 0;
|
query.StartIndex = 0;
|
||||||
reloadItems(tabContent);
|
reloadItems(tabContent);
|
||||||
});
|
});
|
||||||
self.alphaPicker = new AlphaPicker.default({
|
self.alphaPicker = new AlphaPicker({
|
||||||
element: alphaPickerElement,
|
element: alphaPickerElement,
|
||||||
valueChangeEvent: 'click'
|
valueChangeEvent: 'click'
|
||||||
});
|
});
|
||||||
|
@ -267,12 +277,12 @@ define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', '
|
||||||
button: e.target
|
button: e.target
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
var btnSelectView = tabContent.querySelector('.btnSelectView');
|
const btnSelectView = tabContent.querySelector('.btnSelectView');
|
||||||
btnSelectView.addEventListener('click', function (e) {
|
btnSelectView.addEventListener('click', function (e) {
|
||||||
libraryBrowser.showLayoutMenu(e.target, self.getCurrentViewStyle(), 'Banner,List,Poster,PosterCard,Thumb,ThumbCard'.split(','));
|
libraryBrowser.showLayoutMenu(e.target, self.getCurrentViewStyle(), 'Banner,List,Poster,PosterCard,Thumb,ThumbCard'.split(','));
|
||||||
});
|
});
|
||||||
btnSelectView.addEventListener('layoutchange', function (e) {
|
btnSelectView.addEventListener('layoutchange', function (e) {
|
||||||
var viewStyle = e.detail.viewStyle;
|
const viewStyle = e.detail.viewStyle;
|
||||||
getPageData(tabContent).view = viewStyle;
|
getPageData(tabContent).view = viewStyle;
|
||||||
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle);
|
libraryBrowser.saveViewSetting(getSavedQueryKey(tabContent), viewStyle);
|
||||||
getQuery(tabContent).StartIndex = 0;
|
getQuery(tabContent).StartIndex = 0;
|
||||||
|
@ -290,5 +300,6 @@ define(['layoutManager', 'loading', 'events', 'libraryBrowser', 'imageLoader', '
|
||||||
};
|
};
|
||||||
|
|
||||||
self.destroy = function () {};
|
self.destroy = function () {};
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,9 +1,13 @@
|
||||||
define(['loading', 'libraryBrowser', 'cardBuilder', 'apphost'], function (loading, libraryBrowser, cardBuilder, appHost) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import libraryBrowser from 'libraryBrowser';
|
||||||
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import appHost from 'apphost';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function getQuery(params) {
|
function getQuery(params) {
|
||||||
var key = getSavedQueryKey();
|
const key = getSavedQueryKey();
|
||||||
var pageData = data[key];
|
let pageData = data[key];
|
||||||
|
|
||||||
if (!pageData) {
|
if (!pageData) {
|
||||||
pageData = data[key] = {
|
pageData = data[key] = {
|
||||||
|
@ -27,14 +31,14 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'apphost'], function (loadin
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPromise(context, params) {
|
function getPromise(context, params) {
|
||||||
var query = getQuery(params);
|
const query = getQuery(params);
|
||||||
loading.show();
|
loading.show();
|
||||||
return ApiClient.getStudios(ApiClient.getCurrentUserId(), query);
|
return ApiClient.getStudios(ApiClient.getCurrentUserId(), query);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadItems(context, params, promise) {
|
function reloadItems(context, params, promise) {
|
||||||
promise.then(function (result) {
|
promise.then(function (result) {
|
||||||
var elem = context.querySelector('#items');
|
const elem = context.querySelector('#items');
|
||||||
cardBuilder.buildCards(result.Items, {
|
cardBuilder.buildCards(result.Items, {
|
||||||
itemsContainer: elem,
|
itemsContainer: elem,
|
||||||
shape: 'backdrop',
|
shape: 'backdrop',
|
||||||
|
@ -47,16 +51,17 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'apphost'], function (loadin
|
||||||
});
|
});
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
require(['autoFocuser'], function (autoFocuser) {
|
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||||
autoFocuser.autoFocus(context);
|
autoFocuser.autoFocus(context);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var data = {};
|
const data = {};
|
||||||
return function (view, params, tabContent) {
|
|
||||||
var promise;
|
export default function (view, params, tabContent) {
|
||||||
var self = this;
|
let promise;
|
||||||
|
const self = this;
|
||||||
|
|
||||||
self.preRender = function () {
|
self.preRender = function () {
|
||||||
promise = getPromise(view, params);
|
promise = getPromise(view, params);
|
||||||
|
@ -65,5 +70,6 @@ define(['loading', 'libraryBrowser', 'cardBuilder', 'apphost'], function (loadin
|
||||||
self.renderTab = function () {
|
self.renderTab = function () {
|
||||||
reloadItems(tabContent, params, promise);
|
reloadItems(tabContent, params, promise);
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,9 +1,19 @@
|
||||||
define(['layoutManager', 'loading', 'datetime', 'libraryBrowser', 'cardBuilder', 'apphost', 'imageLoader', 'globalize', 'scrollStyles', 'emby-itemscontainer'], function (layoutManager, loading, datetime, libraryBrowser, cardBuilder, appHost, imageLoader, globalize) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import datetime from 'datetime';
|
||||||
|
import libraryBrowser from 'libraryBrowser';
|
||||||
|
import cardBuilder from 'cardBuilder';
|
||||||
|
import appHost from 'apphost';
|
||||||
|
import imageLoader from 'imageLoader';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'scrollStyles';
|
||||||
|
import 'emby-itemscontainer';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function getUpcomingPromise(context, params) {
|
function getUpcomingPromise(context, params) {
|
||||||
loading.show();
|
loading.show();
|
||||||
var query = {
|
const query = {
|
||||||
Limit: 48,
|
Limit: 48,
|
||||||
Fields: 'AirTime,UserData',
|
Fields: 'AirTime,UserData',
|
||||||
UserId: ApiClient.getCurrentUserId(),
|
UserId: ApiClient.getCurrentUserId(),
|
||||||
|
@ -17,7 +27,7 @@ define(['layoutManager', 'loading', 'datetime', 'libraryBrowser', 'cardBuilder',
|
||||||
|
|
||||||
function loadUpcoming(context, params, promise) {
|
function loadUpcoming(context, params, promise) {
|
||||||
promise.then(function (result) {
|
promise.then(function (result) {
|
||||||
var items = result.Items;
|
const items = result.Items;
|
||||||
|
|
||||||
if (items.length) {
|
if (items.length) {
|
||||||
context.querySelector('.noItemsMessage').style.display = 'none';
|
context.querySelector('.noItemsMessage').style.display = 'none';
|
||||||
|
@ -39,19 +49,17 @@ define(['layoutManager', 'loading', 'datetime', 'libraryBrowser', 'cardBuilder',
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderUpcoming(elem, items) {
|
function renderUpcoming(elem, items) {
|
||||||
var i;
|
const groups = [];
|
||||||
var length;
|
let currentGroupName = '';
|
||||||
var groups = [];
|
let currentGroup = [];
|
||||||
var currentGroupName = '';
|
|
||||||
var currentGroup = [];
|
|
||||||
|
|
||||||
for (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 dateText = '';
|
let dateText = '';
|
||||||
|
|
||||||
if (item.PremiereDate) {
|
if (item.PremiereDate) {
|
||||||
try {
|
try {
|
||||||
var premiereDate = datetime.parseISO8601Date(item.PremiereDate, true);
|
const premiereDate = datetime.parseISO8601Date(item.PremiereDate, true);
|
||||||
dateText = datetime.isRelativeDay(premiereDate, -1) ? globalize.translate('Yesterday') : datetime.toLocaleDateString(premiereDate, {
|
dateText = datetime.isRelativeDay(premiereDate, -1) ? globalize.translate('Yesterday') : datetime.toLocaleDateString(premiereDate, {
|
||||||
weekday: 'long',
|
weekday: 'long',
|
||||||
month: 'short',
|
month: 'short',
|
||||||
|
@ -77,17 +85,17 @@ define(['layoutManager', 'loading', 'datetime', 'libraryBrowser', 'cardBuilder',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var html = '';
|
let html = '';
|
||||||
|
|
||||||
for (i = 0, length = groups.length; i < length; i++) {
|
for (let i = 0, length = groups.length; i < length; i++) {
|
||||||
var group = groups[i];
|
const group = groups[i];
|
||||||
html += '<div class="verticalSection">';
|
html += '<div class="verticalSection">';
|
||||||
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + group.name + '</h2>';
|
html += '<h2 class="sectionTitle sectionTitle-cards padded-left">' + group.name + '</h2>';
|
||||||
var allowBottomPadding = true;
|
let allowBottomPadding = true;
|
||||||
|
|
||||||
if (enableScrollX()) {
|
if (enableScrollX()) {
|
||||||
allowBottomPadding = false;
|
allowBottomPadding = false;
|
||||||
var scrollXClass = 'scrollX hiddenScrollX';
|
let scrollXClass = 'scrollX hiddenScrollX';
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
scrollXClass += ' smoothScrollX';
|
scrollXClass += ' smoothScrollX';
|
||||||
|
@ -98,7 +106,7 @@ define(['layoutManager', 'loading', 'datetime', 'libraryBrowser', 'cardBuilder',
|
||||||
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
html += '<div is="emby-itemscontainer" class="itemsContainer vertical-wrap padded-left padded-right">';
|
||||||
}
|
}
|
||||||
|
|
||||||
var supportsImageAnalysis = appHost.supports('imageanalysis');
|
let supportsImageAnalysis = appHost.supports('imageanalysis');
|
||||||
supportsImageAnalysis = false;
|
supportsImageAnalysis = false;
|
||||||
html += cardBuilder.getCardsHtml({
|
html += cardBuilder.getCardsHtml({
|
||||||
items: group.items,
|
items: group.items,
|
||||||
|
@ -124,9 +132,9 @@ define(['layoutManager', 'loading', 'datetime', 'libraryBrowser', 'cardBuilder',
|
||||||
imageLoader.lazyChildren(elem);
|
imageLoader.lazyChildren(elem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params, tabContent) {
|
export default function (view, params, tabContent) {
|
||||||
var upcomingPromise;
|
let upcomingPromise;
|
||||||
var self = this;
|
const self = this;
|
||||||
|
|
||||||
self.preRender = function () {
|
self.preRender = function () {
|
||||||
upcomingPromise = getUpcomingPromise(view, params);
|
upcomingPromise = getUpcomingPromise(view, params);
|
||||||
|
@ -135,5 +143,6 @@ define(['layoutManager', 'loading', 'datetime', 'libraryBrowser', 'cardBuilder',
|
||||||
self.renderTab = function () {
|
self.renderTab = function () {
|
||||||
loadUpcoming(tabContent, params, upcomingPromise);
|
loadUpcoming(tabContent, params, upcomingPromise);
|
||||||
};
|
};
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -21,7 +21,7 @@ define(['displaySettings', 'userSettings', 'autoFocuser'], function (DisplaySett
|
||||||
if (settingsInstance) {
|
if (settingsInstance) {
|
||||||
settingsInstance.loadData();
|
settingsInstance.loadData();
|
||||||
} else {
|
} else {
|
||||||
settingsInstance = new DisplaySettings({
|
settingsInstance = new DisplaySettings.default({
|
||||||
serverId: ApiClient.serverId(),
|
serverId: ApiClient.serverId(),
|
||||||
userId: userId,
|
userId: userId,
|
||||||
element: view.querySelector('.settingsContainer'),
|
element: view.querySelector('.settingsContainer'),
|
||||||
|
|
|
@ -21,7 +21,7 @@ define(['homescreenSettings', 'dom', 'globalize', 'loading', 'userSettings', 'au
|
||||||
if (homescreenSettingsInstance) {
|
if (homescreenSettingsInstance) {
|
||||||
homescreenSettingsInstance.loadData();
|
homescreenSettingsInstance.loadData();
|
||||||
} else {
|
} else {
|
||||||
homescreenSettingsInstance = new HomescreenSettings({
|
homescreenSettingsInstance = new HomescreenSettings.default({
|
||||||
serverId: ApiClient.serverId(),
|
serverId: ApiClient.serverId(),
|
||||||
userId: userId,
|
userId: userId,
|
||||||
element: view.querySelector('.homeScreenSettingsContainer'),
|
element: view.querySelector('.homeScreenSettingsContainer'),
|
||||||
|
|
|
@ -21,7 +21,7 @@ define(['playbackSettings', 'dom', 'globalize', 'loading', 'userSettings', 'auto
|
||||||
if (settingsInstance) {
|
if (settingsInstance) {
|
||||||
settingsInstance.loadData();
|
settingsInstance.loadData();
|
||||||
} else {
|
} else {
|
||||||
settingsInstance = new PlaybackSettings({
|
settingsInstance = new PlaybackSettings.default({
|
||||||
serverId: ApiClient.serverId(),
|
serverId: ApiClient.serverId(),
|
||||||
userId: userId,
|
userId: userId,
|
||||||
element: view.querySelector('.settingsContainer'),
|
element: view.querySelector('.settingsContainer'),
|
||||||
|
|
|
@ -86,7 +86,7 @@ define(['controllers/dashboard/users/userpasswordpage', 'loading', 'libraryMenu'
|
||||||
new UserPasswordPage(view, params);
|
new UserPasswordPage(view, params);
|
||||||
view.querySelector('#btnDeleteImage').addEventListener('click', function () {
|
view.querySelector('#btnDeleteImage').addEventListener('click', function () {
|
||||||
require(['confirm'], function (confirm) {
|
require(['confirm'], function (confirm) {
|
||||||
confirm(globalize.translate('DeleteImageConfirmation'), globalize.translate('DeleteImage')).then(function () {
|
confirm.default(globalize.translate('DeleteImageConfirmation'), globalize.translate('DeleteImage')).then(function () {
|
||||||
loading.show();
|
loading.show();
|
||||||
var userId = getParameterByName('userId');
|
var userId = getParameterByName('userId');
|
||||||
ApiClient.deleteUserImage(userId, 'primary').then(function () {
|
ApiClient.deleteUserImage(userId, 'primary').then(function () {
|
||||||
|
|
|
@ -1,70 +1,75 @@
|
||||||
define(['browser', 'dom', 'layoutManager', 'shell', 'appRouter', 'apphost', 'css!./emby-button', 'registerElement'], function (browser, dom, layoutManager, shell, appRouter, appHost) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import dom from 'dom';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import shell from 'shell';
|
||||||
|
import appRouter from 'appRouter';
|
||||||
|
import appHost from 'apphost';
|
||||||
|
import 'css!./emby-button';
|
||||||
|
import 'registerElement';
|
||||||
|
|
||||||
var EmbyButtonPrototype = Object.create(HTMLButtonElement.prototype);
|
const EmbyButtonPrototype = Object.create(HTMLButtonElement.prototype);
|
||||||
var EmbyLinkButtonPrototype = Object.create(HTMLAnchorElement.prototype);
|
const EmbyLinkButtonPrototype = Object.create(HTMLAnchorElement.prototype);
|
||||||
|
|
||||||
function onAnchorClick(e) {
|
function onAnchorClick(e) {
|
||||||
var href = this.getAttribute('href') || '';
|
const href = this.getAttribute('href') || '';
|
||||||
if (href !== '#') {
|
if (href !== '#') {
|
||||||
if (this.getAttribute('target')) {
|
if (this.getAttribute('target')) {
|
||||||
if (!appHost.supports('targetblank')) {
|
if (!appHost.supports('targetblank')) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
shell.openUrl(href);
|
shell.openUrl(href);
|
||||||
}
|
|
||||||
} else {
|
|
||||||
appRouter.handleAnchorClick(e);
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
e.preventDefault();
|
appRouter.handleAnchorClick(e);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
e.preventDefault();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
EmbyButtonPrototype.createdCallback = function () {
|
||||||
|
if (this.classList.contains('emby-button')) {
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbyButtonPrototype.createdCallback = function () {
|
this.classList.add('emby-button');
|
||||||
if (this.classList.contains('emby-button')) {
|
// TODO replace all instances of element-showfocus with this method
|
||||||
return;
|
if (layoutManager.tv) {
|
||||||
}
|
// handles all special css for tv layout
|
||||||
|
// this method utilizes class chaining
|
||||||
|
this.classList.add('show-focus');
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
this.classList.add('emby-button');
|
EmbyButtonPrototype.attachedCallback = function () {
|
||||||
// TODO replace all instances of element-showfocus with this method
|
if (this.tagName === 'A') {
|
||||||
if (layoutManager.tv) {
|
dom.removeEventListener(this, 'click', onAnchorClick, {});
|
||||||
// handles all special css for tv layout
|
dom.addEventListener(this, 'click', onAnchorClick, {});
|
||||||
// this method utilizes class chaining
|
|
||||||
this.classList.add('show-focus');
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
EmbyButtonPrototype.attachedCallback = function () {
|
if (this.getAttribute('data-autohide') === 'true') {
|
||||||
if (this.tagName === 'A') {
|
if (appHost.supports('externallinks')) {
|
||||||
dom.removeEventListener(this, 'click', onAnchorClick, {});
|
this.classList.remove('hide');
|
||||||
dom.addEventListener(this, 'click', onAnchorClick, {});
|
} else {
|
||||||
|
this.classList.add('hide');
|
||||||
if (this.getAttribute('data-autohide') === 'true') {
|
|
||||||
if (appHost.supports('externallinks')) {
|
|
||||||
this.classList.remove('hide');
|
|
||||||
} else {
|
|
||||||
this.classList.add('hide');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
};
|
||||||
|
|
||||||
EmbyButtonPrototype.detachedCallback = function () {
|
EmbyButtonPrototype.detachedCallback = function () {
|
||||||
dom.removeEventListener(this, 'click', onAnchorClick, {});
|
dom.removeEventListener(this, 'click', onAnchorClick, {});
|
||||||
};
|
};
|
||||||
|
|
||||||
EmbyLinkButtonPrototype.createdCallback = EmbyButtonPrototype.createdCallback;
|
EmbyLinkButtonPrototype.createdCallback = EmbyButtonPrototype.createdCallback;
|
||||||
EmbyLinkButtonPrototype.attachedCallback = EmbyButtonPrototype.attachedCallback;
|
EmbyLinkButtonPrototype.attachedCallback = EmbyButtonPrototype.attachedCallback;
|
||||||
|
|
||||||
document.registerElement('emby-button', {
|
document.registerElement('emby-button', {
|
||||||
prototype: EmbyButtonPrototype,
|
prototype: EmbyButtonPrototype,
|
||||||
extends: 'button'
|
extends: 'button'
|
||||||
});
|
|
||||||
|
|
||||||
document.registerElement('emby-linkbutton', {
|
|
||||||
prototype: EmbyLinkButtonPrototype,
|
|
||||||
extends: 'a'
|
|
||||||
});
|
|
||||||
|
|
||||||
return EmbyButtonPrototype;
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
document.registerElement('emby-linkbutton', {
|
||||||
|
prototype: EmbyLinkButtonPrototype,
|
||||||
|
extends: 'a'
|
||||||
|
});
|
||||||
|
|
||||||
|
export default EmbyButtonPrototype;
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
define(['layoutManager', 'css!./emby-button', 'registerElement'], function (layoutManager) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import 'css!./emby-button';
|
||||||
|
import 'registerElement';
|
||||||
|
|
||||||
var EmbyButtonPrototype = Object.create(HTMLButtonElement.prototype);
|
const EmbyButtonPrototype = Object.create(HTMLButtonElement.prototype);
|
||||||
|
|
||||||
EmbyButtonPrototype.createdCallback = function () {
|
EmbyButtonPrototype.createdCallback = function () {
|
||||||
this.classList.add('paper-icon-button-light');
|
this.classList.add('paper-icon-button-light');
|
||||||
|
|
||||||
if (layoutManager.tv) {
|
if (layoutManager.tv) {
|
||||||
this.classList.add('show-focus');
|
this.classList.add('show-focus');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
document.registerElement('paper-icon-button-light', {
|
document.registerElement('paper-icon-button-light', {
|
||||||
prototype: EmbyButtonPrototype,
|
prototype: EmbyButtonPrototype,
|
||||||
extends: 'button'
|
extends: 'button'
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,18 +1,22 @@
|
||||||
define(['browser', 'css!./emby-collapse', 'registerElement', 'emby-button'], function (browser) {
|
import browser from 'browser';
|
||||||
'use strict';
|
import 'css!./emby-collapse';
|
||||||
|
import 'registerElement';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
var EmbyButtonPrototype = Object.create(HTMLDivElement.prototype);
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
const EmbyButtonPrototype = Object.create(HTMLDivElement.prototype);
|
||||||
|
|
||||||
function slideDownToShow(button, elem) {
|
function slideDownToShow(button, elem) {
|
||||||
|
|
||||||
elem.classList.remove('hide');
|
elem.classList.remove('hide');
|
||||||
elem.classList.add('expanded');
|
elem.classList.add('expanded');
|
||||||
elem.style.height = 'auto';
|
elem.style.height = 'auto';
|
||||||
var height = elem.offsetHeight + 'px';
|
const height = elem.offsetHeight + 'px';
|
||||||
elem.style.height = '0';
|
elem.style.height = '0';
|
||||||
|
|
||||||
// trigger reflow
|
// trigger reflow
|
||||||
var newHeight = elem.offsetHeight;
|
const newHeight = elem.offsetHeight;
|
||||||
elem.style.height = height;
|
elem.style.height = height;
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
|
@ -24,7 +28,7 @@ define(['browser', 'css!./emby-collapse', 'registerElement', 'emby-button'], fun
|
||||||
elem.style.height = 'auto';
|
elem.style.height = 'auto';
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
var icon = button.querySelector('.material-icons');
|
const icon = button.querySelector('.material-icons');
|
||||||
//icon.innerHTML = 'expand_less';
|
//icon.innerHTML = 'expand_less';
|
||||||
icon.classList.add('emby-collapse-expandIconExpanded');
|
icon.classList.add('emby-collapse-expandIconExpanded');
|
||||||
}
|
}
|
||||||
|
@ -33,7 +37,7 @@ define(['browser', 'css!./emby-collapse', 'registerElement', 'emby-button'], fun
|
||||||
|
|
||||||
elem.style.height = elem.offsetHeight + 'px';
|
elem.style.height = elem.offsetHeight + 'px';
|
||||||
// trigger reflow
|
// trigger reflow
|
||||||
var newHeight = elem.offsetHeight;
|
const newHeight = elem.offsetHeight;
|
||||||
|
|
||||||
elem.classList.remove('expanded');
|
elem.classList.remove('expanded');
|
||||||
elem.style.height = '0';
|
elem.style.height = '0';
|
||||||
|
@ -46,15 +50,15 @@ define(['browser', 'css!./emby-collapse', 'registerElement', 'emby-button'], fun
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
var icon = button.querySelector('.material-icons');
|
const icon = button.querySelector('.material-icons');
|
||||||
//icon.innerHTML = 'expand_more';
|
//icon.innerHTML = 'expand_more';
|
||||||
icon.classList.remove('emby-collapse-expandIconExpanded');
|
icon.classList.remove('emby-collapse-expandIconExpanded');
|
||||||
}
|
}
|
||||||
|
|
||||||
function onButtonClick(e) {
|
function onButtonClick(e) {
|
||||||
|
|
||||||
var button = this;
|
const button = this;
|
||||||
var collapseContent = button.parentNode.querySelector('.collapseContent');
|
const collapseContent = button.parentNode.querySelector('.collapseContent');
|
||||||
|
|
||||||
if (collapseContent.expanded) {
|
if (collapseContent.expanded) {
|
||||||
collapseContent.expanded = false;
|
collapseContent.expanded = false;
|
||||||
|
@ -73,18 +77,18 @@ define(['browser', 'css!./emby-collapse', 'registerElement', 'emby-button'], fun
|
||||||
|
|
||||||
this.classList.add('emby-collapse');
|
this.classList.add('emby-collapse');
|
||||||
|
|
||||||
var collapseContent = this.querySelector('.collapseContent');
|
const collapseContent = this.querySelector('.collapseContent');
|
||||||
if (collapseContent) {
|
if (collapseContent) {
|
||||||
collapseContent.classList.add('hide');
|
collapseContent.classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var title = this.getAttribute('title');
|
const title = this.getAttribute('title');
|
||||||
|
|
||||||
var html = '<button is="emby-button" type="button" on-click="toggleExpand" id="expandButton" class="emby-collapsible-button iconRight"><h3 class="emby-collapsible-title" title="' + title + '">' + title + '</h3><span class="material-icons emby-collapse-expandIcon expand_more"></span></button>';
|
const html = '<button is="emby-button" type="button" on-click="toggleExpand" id="expandButton" class="emby-collapsible-button iconRight"><h3 class="emby-collapsible-title" title="' + title + '">' + title + '</h3><span class="material-icons emby-collapse-expandIcon expand_more"></span></button>';
|
||||||
|
|
||||||
this.insertAdjacentHTML('afterbegin', html);
|
this.insertAdjacentHTML('afterbegin', html);
|
||||||
|
|
||||||
var button = this.querySelector('.emby-collapsible-button');
|
const button = this.querySelector('.emby-collapsible-button');
|
||||||
|
|
||||||
button.addEventListener('click', onButtonClick);
|
button.addEventListener('click', onButtonClick);
|
||||||
|
|
||||||
|
@ -97,4 +101,5 @@ define(['browser', 'css!./emby-collapse', 'registerElement', 'emby-button'], fun
|
||||||
prototype: EmbyButtonPrototype,
|
prototype: EmbyButtonPrototype,
|
||||||
extends: 'div'
|
extends: 'div'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,18 +1,23 @@
|
||||||
define(['layoutManager', 'browser', 'dom', 'css!./emby-input', 'registerElement'], function (layoutManager, browser, dom) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import browser from 'browser';
|
||||||
|
import dom from 'dom';
|
||||||
|
import 'css!./emby-input';
|
||||||
|
import 'registerElement';
|
||||||
|
|
||||||
var EmbyInputPrototype = Object.create(HTMLInputElement.prototype);
|
/* eslint-disable indent */
|
||||||
|
|
||||||
var inputId = 0;
|
const EmbyInputPrototype = Object.create(HTMLInputElement.prototype);
|
||||||
var supportsFloatingLabel = false;
|
|
||||||
|
let inputId = 0;
|
||||||
|
let supportsFloatingLabel = false;
|
||||||
|
|
||||||
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
|
if (Object.getOwnPropertyDescriptor && Object.defineProperty) {
|
||||||
|
|
||||||
var descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
||||||
|
|
||||||
// descriptor returning null in webos
|
// descriptor returning null in webos
|
||||||
if (descriptor && descriptor.configurable) {
|
if (descriptor && descriptor.configurable) {
|
||||||
var baseSetMethod = descriptor.set;
|
const baseSetMethod = descriptor.set;
|
||||||
descriptor.set = function (value) {
|
descriptor.set = function (value) {
|
||||||
baseSetMethod.call(this, value);
|
baseSetMethod.call(this, value);
|
||||||
|
|
||||||
|
@ -39,9 +44,9 @@ define(['layoutManager', 'browser', 'dom', 'css!./emby-input', 'registerElement'
|
||||||
|
|
||||||
this.classList.add('emby-input');
|
this.classList.add('emby-input');
|
||||||
|
|
||||||
var parentNode = this.parentNode;
|
const parentNode = this.parentNode;
|
||||||
var document = this.ownerDocument;
|
const document = this.ownerDocument;
|
||||||
var label = document.createElement('label');
|
const label = document.createElement('label');
|
||||||
label.innerHTML = this.getAttribute('label') || '';
|
label.innerHTML = this.getAttribute('label') || '';
|
||||||
label.classList.add('inputLabel');
|
label.classList.add('inputLabel');
|
||||||
label.classList.add('inputLabelUnfocused');
|
label.classList.add('inputLabelUnfocused');
|
||||||
|
@ -95,12 +100,12 @@ define(['layoutManager', 'browser', 'dom', 'css!./emby-input', 'registerElement'
|
||||||
|
|
||||||
function onChange() {
|
function onChange() {
|
||||||
|
|
||||||
var label = this.labelElement;
|
const label = this.labelElement;
|
||||||
if (this.value) {
|
if (this.value) {
|
||||||
label.classList.remove('inputLabel-float');
|
label.classList.remove('inputLabel-float');
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var instanceSupportsFloat = supportsFloatingLabel && this.type !== 'date' && this.type !== 'time';
|
const instanceSupportsFloat = supportsFloatingLabel && this.type !== 'date' && this.type !== 'time';
|
||||||
|
|
||||||
if (instanceSupportsFloat) {
|
if (instanceSupportsFloat) {
|
||||||
label.classList.add('inputLabel-float');
|
label.classList.add('inputLabel-float');
|
||||||
|
@ -121,4 +126,5 @@ define(['layoutManager', 'browser', 'dom', 'css!./emby-input', 'registerElement'
|
||||||
prototype: EmbyInputPrototype,
|
prototype: EmbyInputPrototype,
|
||||||
extends: 'input'
|
extends: 'input'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,12 +1,25 @@
|
||||||
define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager', 'imageLoader', 'layoutManager', 'browser', 'dom', 'loading', 'focusManager', 'serverNotifications', 'events', 'registerElement'], function (itemShortcuts, inputManager, connectionManager, playbackManager, imageLoader, layoutManager, browser, dom, loading, focusManager, serverNotifications, events) {
|
import itemShortcuts from 'itemShortcuts';
|
||||||
'use strict';
|
import inputManager from 'inputManager';
|
||||||
|
import connectionManager from 'connectionManager';
|
||||||
|
import playbackManager from 'playbackManager';
|
||||||
|
import imageLoader from 'imageLoader';
|
||||||
|
import layoutManager from 'layoutManager';
|
||||||
|
import browser from 'browser';
|
||||||
|
import dom from 'dom';
|
||||||
|
import loading from 'loading';
|
||||||
|
import focusManager from 'focusManager';
|
||||||
|
import serverNotifications from 'serverNotifications';
|
||||||
|
import events from 'events';
|
||||||
|
import 'registerElement';
|
||||||
|
|
||||||
var ItemsContainerPrototype = Object.create(HTMLDivElement.prototype);
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
const ItemsContainerPrototype = Object.create(HTMLDivElement.prototype);
|
||||||
|
|
||||||
function onClick(e) {
|
function onClick(e) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
var target = e.target;
|
const target = e.target;
|
||||||
var multiSelect = itemsContainer.multiSelect;
|
let multiSelect = itemsContainer.multiSelect;
|
||||||
|
|
||||||
if (multiSelect) {
|
if (multiSelect) {
|
||||||
if (multiSelect.onContainerClick.call(itemsContainer, e) === false) {
|
if (multiSelect.onContainerClick.call(itemsContainer, e) === false) {
|
||||||
|
@ -24,9 +37,8 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onContextMenu(e) {
|
function onContextMenu(e) {
|
||||||
var itemsContainer = this;
|
const target = e.target;
|
||||||
var target = e.target;
|
const card = dom.parentWithAttribute(target, 'data-id');
|
||||||
var card = dom.parentWithAttribute(target, 'data-id');
|
|
||||||
|
|
||||||
// check for serverId, it won't be present on selectserver
|
// check for serverId, it won't be present on selectserver
|
||||||
if (card && card.getAttribute('data-serverid')) {
|
if (card && card.getAttribute('data-serverid')) {
|
||||||
|
@ -47,7 +59,7 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemsContainerPrototype.enableMultiSelect = function (enabled) {
|
ItemsContainerPrototype.enableMultiSelect = function (enabled) {
|
||||||
var current = this.multiSelect;
|
const current = this.multiSelect;
|
||||||
|
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
if (current) {
|
if (current) {
|
||||||
|
@ -61,8 +73,8 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
require(['multiSelect'], function (MultiSelect) {
|
import('multiSelect').then(({default: MultiSelect}) => {
|
||||||
self.multiSelect = new MultiSelect({
|
self.multiSelect = new MultiSelect({
|
||||||
container: self,
|
container: self,
|
||||||
bindOnClick: false
|
bindOnClick: false
|
||||||
|
@ -71,14 +83,14 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
};
|
};
|
||||||
|
|
||||||
function onDrop(evt, itemsContainer) {
|
function onDrop(evt, itemsContainer) {
|
||||||
var el = evt.item;
|
const el = evt.item;
|
||||||
|
|
||||||
var newIndex = evt.newIndex;
|
const newIndex = evt.newIndex;
|
||||||
var itemId = el.getAttribute('data-playlistitemid');
|
const itemId = el.getAttribute('data-playlistitemid');
|
||||||
var playlistId = el.getAttribute('data-playlistid');
|
const playlistId = el.getAttribute('data-playlistid');
|
||||||
|
|
||||||
if (!playlistId) {
|
if (!playlistId) {
|
||||||
var oldIndex = evt.oldIndex;
|
const oldIndex = evt.oldIndex;
|
||||||
el.dispatchEvent(new CustomEvent('itemdrop', {
|
el.dispatchEvent(new CustomEvent('itemdrop', {
|
||||||
detail: {
|
detail: {
|
||||||
oldIndex: oldIndex,
|
oldIndex: oldIndex,
|
||||||
|
@ -91,8 +103,8 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var serverId = el.getAttribute('data-serverid');
|
const serverId = el.getAttribute('data-serverid');
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
loading.show();
|
loading.show();
|
||||||
|
|
||||||
|
@ -108,7 +120,7 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemsContainerPrototype.enableDragReordering = function (enabled) {
|
ItemsContainerPrototype.enableDragReordering = function (enabled) {
|
||||||
var current = this.sortable;
|
const current = this.sortable;
|
||||||
if (!enabled) {
|
if (!enabled) {
|
||||||
if (current) {
|
if (current) {
|
||||||
current.destroy();
|
current.destroy();
|
||||||
|
@ -121,8 +133,8 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var self = this;
|
const self = this;
|
||||||
require(['sortable'], function (Sortable) {
|
import('sortable').then(({default: Sortable}) => {
|
||||||
self.sortable = new Sortable(self, {
|
self.sortable = new Sortable(self, {
|
||||||
draggable: '.listItem',
|
draggable: '.listItem',
|
||||||
handle: '.listViewDragHandle',
|
handle: '.listViewDragHandle',
|
||||||
|
@ -137,13 +149,13 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
|
|
||||||
function onUserDataChanged(e, apiClient, userData) {
|
function onUserDataChanged(e, apiClient, userData) {
|
||||||
|
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
|
|
||||||
require(['cardBuilder'], function (cardBuilder) {
|
import('cardBuilder').then(({default: cardBuilder}) => {
|
||||||
cardBuilder.onUserDataChanged(userData, itemsContainer);
|
cardBuilder.onUserDataChanged(userData, itemsContainer);
|
||||||
});
|
});
|
||||||
|
|
||||||
var eventsToMonitor = getEventsToMonitor(itemsContainer);
|
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||||
|
|
||||||
// TODO: Check user data change reason?
|
// TODO: Check user data change reason?
|
||||||
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
if (eventsToMonitor.indexOf('markfavorite') !== -1) {
|
||||||
|
@ -154,7 +166,7 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function getEventsToMonitor(itemsContainer) {
|
function getEventsToMonitor(itemsContainer) {
|
||||||
var monitor = itemsContainer.getAttribute('data-monitor');
|
let monitor = itemsContainer.getAttribute('data-monitor');
|
||||||
if (monitor) {
|
if (monitor) {
|
||||||
return monitor.split(',');
|
return monitor.split(',');
|
||||||
}
|
}
|
||||||
|
@ -164,24 +176,24 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
|
|
||||||
function onTimerCreated(e, apiClient, data) {
|
function onTimerCreated(e, apiClient, data) {
|
||||||
|
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
|
|
||||||
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var programId = data.ProgramId;
|
const programId = data.ProgramId;
|
||||||
// This could be null, not supported by all tv providers
|
// This could be null, not supported by all tv providers
|
||||||
var newTimerId = data.Id;
|
const newTimerId = data.Id;
|
||||||
|
|
||||||
require(['cardBuilder'], function (cardBuilder) {
|
import('cardBuilder').then(({default: cardBuilder}) => {
|
||||||
cardBuilder.onTimerCreated(programId, newTimerId, itemsContainer);
|
cardBuilder.onTimerCreated(programId, newTimerId, itemsContainer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSeriesTimerCreated(e, apiClient, data) {
|
function onSeriesTimerCreated(e, apiClient, data) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
return;
|
return;
|
||||||
|
@ -189,49 +201,49 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onTimerCancelled(e, apiClient, data) {
|
function onTimerCancelled(e, apiClient, data) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
if (getEventsToMonitor(itemsContainer).indexOf('timers') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require(['cardBuilder'], function (cardBuilder) {
|
import('cardBuilder').then(({default: cardBuilder}) => {
|
||||||
cardBuilder.onTimerCancelled(data.Id, itemsContainer);
|
cardBuilder.onTimerCancelled(data.Id, itemsContainer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSeriesTimerCancelled(e, apiClient, data) {
|
function onSeriesTimerCancelled(e, apiClient, data) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
if (getEventsToMonitor(itemsContainer).indexOf('seriestimers') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded();
|
itemsContainer.notifyRefreshNeeded();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
require(['cardBuilder'], function (cardBuilder) {
|
import('cardBuilder').then(({default: cardBuilder}) => {
|
||||||
cardBuilder.onSeriesTimerCancelled(data.Id, itemsContainer);
|
cardBuilder.onSeriesTimerCancelled(data.Id, itemsContainer);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function onLibraryChanged(e, apiClient, data) {
|
function onLibraryChanged(e, apiClient, data) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
|
|
||||||
var eventsToMonitor = getEventsToMonitor(itemsContainer);
|
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||||
if (eventsToMonitor.indexOf('seriestimers') !== -1 || eventsToMonitor.indexOf('timers') !== -1) {
|
if (eventsToMonitor.indexOf('seriestimers') !== -1 || eventsToMonitor.indexOf('timers') !== -1) {
|
||||||
// yes this is an assumption
|
// yes this is an assumption
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemsAdded = data.ItemsAdded || [];
|
const itemsAdded = data.ItemsAdded || [];
|
||||||
var itemsRemoved = data.ItemsRemoved || [];
|
const itemsRemoved = data.ItemsRemoved || [];
|
||||||
if (!itemsAdded.length && !itemsRemoved.length) {
|
if (!itemsAdded.length && !itemsRemoved.length) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parentId = itemsContainer.getAttribute('data-parentid');
|
const parentId = itemsContainer.getAttribute('data-parentid');
|
||||||
if (parentId) {
|
if (parentId) {
|
||||||
var foldersAddedTo = data.FoldersAddedTo || [];
|
const foldersAddedTo = data.FoldersAddedTo || [];
|
||||||
var foldersRemovedFrom = data.FoldersRemovedFrom || [];
|
const foldersRemovedFrom = data.FoldersRemovedFrom || [];
|
||||||
var collectionFolders = data.CollectionFolders || [];
|
const collectionFolders = data.CollectionFolders || [];
|
||||||
|
|
||||||
if (foldersAddedTo.indexOf(parentId) === -1 && foldersRemovedFrom.indexOf(parentId) === -1 && collectionFolders.indexOf(parentId) === -1) {
|
if (foldersAddedTo.indexOf(parentId) === -1 && foldersRemovedFrom.indexOf(parentId) === -1 && collectionFolders.indexOf(parentId) === -1) {
|
||||||
return;
|
return;
|
||||||
|
@ -242,10 +254,10 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onPlaybackStopped(e, stopInfo) {
|
function onPlaybackStopped(e, stopInfo) {
|
||||||
var itemsContainer = this;
|
const itemsContainer = this;
|
||||||
var state = stopInfo.state;
|
const state = stopInfo.state;
|
||||||
|
|
||||||
var eventsToMonitor = getEventsToMonitor(itemsContainer);
|
const eventsToMonitor = getEventsToMonitor(itemsContainer);
|
||||||
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') {
|
if (state.NowPlayingItem && state.NowPlayingItem.MediaType === 'Video') {
|
||||||
if (eventsToMonitor.indexOf('videoplayback') !== -1) {
|
if (eventsToMonitor.indexOf('videoplayback') !== -1) {
|
||||||
itemsContainer.notifyRefreshNeeded(true);
|
itemsContainer.notifyRefreshNeeded(true);
|
||||||
|
@ -260,14 +272,14 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function addNotificationEvent(instance, name, handler, owner) {
|
function addNotificationEvent(instance, name, handler, owner) {
|
||||||
var localHandler = handler.bind(instance);
|
const localHandler = handler.bind(instance);
|
||||||
owner = owner || serverNotifications;
|
owner = owner || serverNotifications;
|
||||||
events.on(owner, name, localHandler);
|
events.on(owner, name, localHandler);
|
||||||
instance['event_' + name] = localHandler;
|
instance['event_' + name] = localHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeNotificationEvent(instance, name, owner) {
|
function removeNotificationEvent(instance, name, owner) {
|
||||||
var handler = instance['event_' + name];
|
const handler = instance['event_' + name];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
owner = owner || serverNotifications;
|
owner = owner || serverNotifications;
|
||||||
events.off(owner, name, handler);
|
events.off(owner, name, handler);
|
||||||
|
@ -347,10 +359,10 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
ItemsContainerPrototype.resume = function (options) {
|
ItemsContainerPrototype.resume = function (options) {
|
||||||
this.paused = false;
|
this.paused = false;
|
||||||
|
|
||||||
var refreshIntervalEndTime = this.refreshIntervalEndTime;
|
let refreshIntervalEndTime = this.refreshIntervalEndTime;
|
||||||
if (refreshIntervalEndTime) {
|
if (refreshIntervalEndTime) {
|
||||||
|
|
||||||
var remainingMs = refreshIntervalEndTime - new Date().getTime();
|
const remainingMs = refreshIntervalEndTime - new Date().getTime();
|
||||||
if (remainingMs > 0 && !this.needsRefresh) {
|
if (remainingMs > 0 && !this.needsRefresh) {
|
||||||
resetRefreshInterval(this, remainingMs);
|
resetRefreshInterval(this, remainingMs);
|
||||||
} else {
|
} else {
|
||||||
|
@ -387,7 +399,7 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var timeout = this.refreshTimeout;
|
let timeout = this.refreshTimeout;
|
||||||
if (timeout) {
|
if (timeout) {
|
||||||
clearTimeout(timeout);
|
clearTimeout(timeout);
|
||||||
}
|
}
|
||||||
|
@ -424,9 +436,9 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDataFetched(result) {
|
function onDataFetched(result) {
|
||||||
var items = result.Items || result;
|
const items = result.Items || result;
|
||||||
|
|
||||||
var parentContainer = this.parentContainer;
|
let parentContainer = this.parentContainer;
|
||||||
if (parentContainer) {
|
if (parentContainer) {
|
||||||
if (items.length) {
|
if (items.length) {
|
||||||
parentContainer.classList.remove('hide');
|
parentContainer.classList.remove('hide');
|
||||||
|
@ -435,9 +447,9 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var activeElement = document.activeElement;
|
const activeElement = document.activeElement;
|
||||||
var focusId;
|
let focusId;
|
||||||
var hasActiveElement;
|
let hasActiveElement;
|
||||||
|
|
||||||
if (this.contains(activeElement)) {
|
if (this.contains(activeElement)) {
|
||||||
hasActiveElement = true;
|
hasActiveElement = true;
|
||||||
|
@ -461,7 +473,7 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
|
|
||||||
function setFocus(itemsContainer, focusId) {
|
function setFocus(itemsContainer, focusId) {
|
||||||
if (focusId) {
|
if (focusId) {
|
||||||
var newElement = itemsContainer.querySelector('[data-id="' + focusId + '"]');
|
const newElement = itemsContainer.querySelector('[data-id="' + focusId + '"]');
|
||||||
if (newElement) {
|
if (newElement) {
|
||||||
try {
|
try {
|
||||||
focusManager.focus(newElement);
|
focusManager.focus(newElement);
|
||||||
|
@ -479,4 +491,5 @@ define(['itemShortcuts', 'inputManager', 'connectionManager', 'playbackManager',
|
||||||
prototype: ItemsContainerPrototype,
|
prototype: ItemsContainerPrototype,
|
||||||
extends: 'div'
|
extends: 'div'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby-button'], function (connectionManager, serverNotifications, events, globalize, EmbyButtonPrototype) {
|
import connectionManager from 'connectionManager';
|
||||||
'use strict';
|
import serverNotifications from 'serverNotifications';
|
||||||
|
import events from 'events';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import EmbyButtonPrototype from 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function addNotificationEvent(instance, name, handler) {
|
function addNotificationEvent(instance, name, handler) {
|
||||||
var localHandler = handler.bind(instance);
|
const localHandler = handler.bind(instance);
|
||||||
events.on(serverNotifications, name, localHandler);
|
events.on(serverNotifications, name, localHandler);
|
||||||
instance[name] = localHandler;
|
instance[name] = localHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeNotificationEvent(instance, name) {
|
function removeNotificationEvent(instance, name) {
|
||||||
var handler = instance[name];
|
const handler = instance[name];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
events.off(serverNotifications, name, handler);
|
events.off(serverNotifications, name, handler);
|
||||||
instance[name] = null;
|
instance[name] = null;
|
||||||
|
@ -17,10 +22,10 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
|
|
||||||
function onClick(e) {
|
function onClick(e) {
|
||||||
|
|
||||||
var button = this;
|
const button = this;
|
||||||
var id = button.getAttribute('data-id');
|
const id = button.getAttribute('data-id');
|
||||||
var serverId = button.getAttribute('data-serverid');
|
const serverId = button.getAttribute('data-serverid');
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
if (!button.classList.contains('playstatebutton-played')) {
|
if (!button.classList.contains('playstatebutton-played')) {
|
||||||
apiClient.markPlayed(apiClient.getCurrentUserId(), id, new Date());
|
apiClient.markPlayed(apiClient.getCurrentUserId(), id, new Date());
|
||||||
|
@ -32,14 +37,14 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
}
|
}
|
||||||
|
|
||||||
function onUserDataChanged(e, apiClient, userData) {
|
function onUserDataChanged(e, apiClient, userData) {
|
||||||
var button = this;
|
const button = this;
|
||||||
if (userData.ItemId === button.getAttribute('data-id')) {
|
if (userData.ItemId === button.getAttribute('data-id')) {
|
||||||
setState(button, userData.Played);
|
setState(button, userData.Played);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function setState(button, played, updateAttribute) {
|
function setState(button, played, updateAttribute) {
|
||||||
var icon = button.iconElement;
|
let icon = button.iconElement;
|
||||||
if (!icon) {
|
if (!icon) {
|
||||||
button.iconElement = button.querySelector('.material-icons');
|
button.iconElement = button.querySelector('.material-icons');
|
||||||
icon = button.iconElement;
|
icon = button.iconElement;
|
||||||
|
@ -72,7 +77,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
button.title = globalize.translate('Played');
|
button.title = globalize.translate('Played');
|
||||||
}
|
}
|
||||||
|
|
||||||
var text = button.querySelector('.button-text');
|
let text = button.querySelector('.button-text');
|
||||||
if (text) {
|
if (text) {
|
||||||
text.innerHTML = button.title;
|
text.innerHTML = button.title;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +97,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
|
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
var EmbyPlaystateButtonPrototype = Object.create(EmbyButtonPrototype);
|
const EmbyPlaystateButtonPrototype = Object.create(EmbyButtonPrototype);
|
||||||
|
|
||||||
EmbyPlaystateButtonPrototype.createdCallback = function () {
|
EmbyPlaystateButtonPrototype.createdCallback = function () {
|
||||||
|
|
||||||
|
@ -109,8 +114,8 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
EmbyButtonPrototype.attachedCallback.call(this);
|
EmbyButtonPrototype.attachedCallback.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemId = this.getAttribute('data-id');
|
const itemId = this.getAttribute('data-id');
|
||||||
var serverId = this.getAttribute('data-serverid');
|
const serverId = this.getAttribute('data-serverid');
|
||||||
if (itemId && serverId) {
|
if (itemId && serverId) {
|
||||||
|
|
||||||
setState(this, this.getAttribute('data-played') === 'true', false);
|
setState(this, this.getAttribute('data-played') === 'true', false);
|
||||||
|
@ -137,7 +142,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
this.setAttribute('data-id', item.Id);
|
this.setAttribute('data-id', item.Id);
|
||||||
this.setAttribute('data-serverid', item.ServerId);
|
this.setAttribute('data-serverid', item.ServerId);
|
||||||
|
|
||||||
var played = item.UserData && item.UserData.Played;
|
const played = item.UserData && item.UserData.Played;
|
||||||
setState(this, played);
|
setState(this, played);
|
||||||
bindEvents(this);
|
bindEvents(this);
|
||||||
|
|
||||||
|
@ -156,4 +161,5 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
prototype: EmbyPlaystateButtonPrototype,
|
prototype: EmbyPlaystateButtonPrototype,
|
||||||
extends: 'button'
|
extends: 'button'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,16 +1,12 @@
|
||||||
define([], function() {
|
const ProgramCellPrototype = Object.create(HTMLButtonElement.prototype);
|
||||||
'use strict';
|
|
||||||
|
|
||||||
var ProgramCellPrototype = Object.create(HTMLButtonElement.prototype);
|
ProgramCellPrototype.detachedCallback = function () {
|
||||||
|
this.posLeft = null;
|
||||||
|
this.posWidth = null;
|
||||||
|
this.guideProgramName = null;
|
||||||
|
};
|
||||||
|
|
||||||
ProgramCellPrototype.detachedCallback = function () {
|
document.registerElement('emby-programcell', {
|
||||||
this.posLeft = null;
|
prototype: ProgramCellPrototype,
|
||||||
this.posWidth = null;
|
extends: 'button'
|
||||||
this.guideProgramName = null;
|
|
||||||
};
|
|
||||||
|
|
||||||
document.registerElement('emby-programcell', {
|
|
||||||
prototype: ProgramCellPrototype,
|
|
||||||
extends: 'button'
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,16 +1,21 @@
|
||||||
define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby-button'], function (connectionManager, serverNotifications, events, globalize, EmbyButtonPrototype) {
|
import connectionManager from 'connectionManager';
|
||||||
'use strict';
|
import serverNotifications from 'serverNotifications';
|
||||||
|
import events from 'events';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import EmbyButtonPrototype from 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function addNotificationEvent(instance, name, handler) {
|
function addNotificationEvent(instance, name, handler) {
|
||||||
|
|
||||||
var localHandler = handler.bind(instance);
|
const localHandler = handler.bind(instance);
|
||||||
events.on(serverNotifications, name, localHandler);
|
events.on(serverNotifications, name, localHandler);
|
||||||
instance[name] = localHandler;
|
instance[name] = localHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
function removeNotificationEvent(instance, name) {
|
function removeNotificationEvent(instance, name) {
|
||||||
|
|
||||||
var handler = instance[name];
|
const handler = instance[name];
|
||||||
if (handler) {
|
if (handler) {
|
||||||
events.off(serverNotifications, name, handler);
|
events.off(serverNotifications, name, handler);
|
||||||
instance[name] = null;
|
instance[name] = null;
|
||||||
|
@ -24,13 +29,13 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
|
|
||||||
function onClick(e) {
|
function onClick(e) {
|
||||||
|
|
||||||
var button = this;
|
const button = this;
|
||||||
var id = button.getAttribute('data-id');
|
const id = button.getAttribute('data-id');
|
||||||
var serverId = button.getAttribute('data-serverid');
|
const serverId = button.getAttribute('data-serverid');
|
||||||
var apiClient = connectionManager.getApiClient(serverId);
|
const apiClient = connectionManager.getApiClient(serverId);
|
||||||
|
|
||||||
var likes = this.getAttribute('data-likes');
|
let likes = this.getAttribute('data-likes');
|
||||||
var isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
const isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
||||||
if (likes === 'true') {
|
if (likes === 'true') {
|
||||||
likes = true;
|
likes = true;
|
||||||
} else if (likes === 'false') {
|
} else if (likes === 'false') {
|
||||||
|
@ -47,7 +52,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
|
|
||||||
function onUserDataChanged(e, apiClient, userData) {
|
function onUserDataChanged(e, apiClient, userData) {
|
||||||
|
|
||||||
var button = this;
|
const button = this;
|
||||||
|
|
||||||
if (userData.ItemId === button.getAttribute('data-id')) {
|
if (userData.ItemId === button.getAttribute('data-id')) {
|
||||||
|
|
||||||
|
@ -57,7 +62,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
|
|
||||||
function setState(button, likes, isFavorite, updateAttribute) {
|
function setState(button, likes, isFavorite, updateAttribute) {
|
||||||
|
|
||||||
var icon = button.querySelector('.material-icons');
|
const icon = button.querySelector('.material-icons');
|
||||||
|
|
||||||
if (isFavorite) {
|
if (isFavorite) {
|
||||||
|
|
||||||
|
@ -106,7 +111,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
function setTitle(button) {
|
function setTitle(button) {
|
||||||
button.title = globalize.translate('Favorite');
|
button.title = globalize.translate('Favorite');
|
||||||
|
|
||||||
var text = button.querySelector('.button-text');
|
const text = button.querySelector('.button-text');
|
||||||
if (text) {
|
if (text) {
|
||||||
text.innerHTML = button.title;
|
text.innerHTML = button.title;
|
||||||
}
|
}
|
||||||
|
@ -126,7 +131,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
|
addNotificationEvent(button, 'UserDataChanged', onUserDataChanged);
|
||||||
}
|
}
|
||||||
|
|
||||||
var EmbyRatingButtonPrototype = Object.create(EmbyButtonPrototype);
|
const EmbyRatingButtonPrototype = Object.create(EmbyButtonPrototype);
|
||||||
|
|
||||||
EmbyRatingButtonPrototype.createdCallback = function () {
|
EmbyRatingButtonPrototype.createdCallback = function () {
|
||||||
|
|
||||||
|
@ -143,12 +148,12 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
EmbyButtonPrototype.attachedCallback.call(this);
|
EmbyButtonPrototype.attachedCallback.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
var itemId = this.getAttribute('data-id');
|
const itemId = this.getAttribute('data-id');
|
||||||
var serverId = this.getAttribute('data-serverid');
|
const serverId = this.getAttribute('data-serverid');
|
||||||
if (itemId && serverId) {
|
if (itemId && serverId) {
|
||||||
|
|
||||||
var likes = this.getAttribute('data-likes');
|
let likes = this.getAttribute('data-likes');
|
||||||
var isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
const isFavorite = this.getAttribute('data-isfavorite') === 'true';
|
||||||
if (likes === 'true') {
|
if (likes === 'true') {
|
||||||
likes = true;
|
likes = true;
|
||||||
} else if (likes === 'false') {
|
} else if (likes === 'false') {
|
||||||
|
@ -181,7 +186,7 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
this.setAttribute('data-id', item.Id);
|
this.setAttribute('data-id', item.Id);
|
||||||
this.setAttribute('data-serverid', item.ServerId);
|
this.setAttribute('data-serverid', item.ServerId);
|
||||||
|
|
||||||
var userData = item.UserData || {};
|
const userData = item.UserData || {};
|
||||||
setState(this, userData.Likes, userData.IsFavorite);
|
setState(this, userData.Likes, userData.IsFavorite);
|
||||||
bindEvents(this);
|
bindEvents(this);
|
||||||
|
|
||||||
|
@ -199,4 +204,5 @@ define(['connectionManager', 'serverNotifications', 'events', 'globalize', 'emby
|
||||||
prototype: EmbyRatingButtonPrototype,
|
prototype: EmbyRatingButtonPrototype,
|
||||||
extends: 'button'
|
extends: 'button'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,13 +1,18 @@
|
||||||
define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', 'paper-icon-button-light'], function (layoutManager, dom) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import dom from 'dom';
|
||||||
|
import 'css!./emby-scrollbuttons';
|
||||||
|
import 'registerElement';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
|
||||||
var EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
const EmbyScrollButtonsPrototype = Object.create(HTMLDivElement.prototype);
|
||||||
|
|
||||||
EmbyScrollButtonsPrototype.createdCallback = function () {};
|
EmbyScrollButtonsPrototype.createdCallback = function () {};
|
||||||
|
|
||||||
function getScrollButtonHtml(direction) {
|
function getScrollButtonHtml(direction) {
|
||||||
var html = '';
|
let html = '';
|
||||||
var icon = direction === 'left' ? 'chevron_left' : 'chevron_right';
|
const icon = direction === 'left' ? 'chevron_left' : 'chevron_right';
|
||||||
|
|
||||||
html += '<button type="button" is="paper-icon-button-light" data-ripple="false" data-direction="' + direction + '" class="emby-scrollbuttons-button">';
|
html += '<button type="button" is="paper-icon-button-light" data-ripple="false" data-direction="' + direction + '" class="emby-scrollbuttons-button">';
|
||||||
html += '<span class="material-icons ' + icon + '"></span>';
|
html += '<span class="material-icons ' + icon + '"></span>';
|
||||||
|
@ -45,7 +50,7 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
scrollButtons.scrollButtonsLeft.disabled = true;
|
scrollButtons.scrollButtonsLeft.disabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
var scrollPosEnd = scrollPos + scrollSize;
|
const scrollPosEnd = scrollPos + scrollSize;
|
||||||
if (scrollWidth > 0 && scrollPosEnd >= scrollWidth) {
|
if (scrollWidth > 0 && scrollPosEnd >= scrollWidth) {
|
||||||
scrollButtons.scrollButtonsRight.disabled = true;
|
scrollButtons.scrollButtonsRight.disabled = true;
|
||||||
} else {
|
} else {
|
||||||
|
@ -54,18 +59,18 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScroll(e) {
|
function onScroll(e) {
|
||||||
var scrollButtons = this;
|
const scrollButtons = this;
|
||||||
var scroller = this.scroller;
|
const scroller = this.scroller;
|
||||||
|
|
||||||
var scrollSize = getScrollSize(scroller);
|
const scrollSize = getScrollSize(scroller);
|
||||||
var scrollPos = getScrollPosition(scroller);
|
const scrollPos = getScrollPosition(scroller);
|
||||||
var scrollWidth = getScrollWidth(scroller);
|
const scrollWidth = getScrollWidth(scroller);
|
||||||
|
|
||||||
updateScrollButtons(scrollButtons, scrollSize, scrollPos, scrollWidth);
|
updateScrollButtons(scrollButtons, scrollSize, scrollPos, scrollWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getStyleValue(style, name) {
|
function getStyleValue(style, name) {
|
||||||
var value = style.getPropertyValue(name);
|
let value = style.getPropertyValue(name);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -84,20 +89,20 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
}
|
}
|
||||||
|
|
||||||
function getScrollSize(elem) {
|
function getScrollSize(elem) {
|
||||||
var scrollSize = elem.offsetWidth;
|
let scrollSize = elem.offsetWidth;
|
||||||
var style = window.getComputedStyle(elem, null);
|
let style = window.getComputedStyle(elem, null);
|
||||||
|
|
||||||
var paddingLeft = getStyleValue(style, 'padding-left');
|
let paddingLeft = getStyleValue(style, 'padding-left');
|
||||||
if (paddingLeft) {
|
if (paddingLeft) {
|
||||||
scrollSize -= paddingLeft;
|
scrollSize -= paddingLeft;
|
||||||
}
|
}
|
||||||
|
|
||||||
var paddingRight = getStyleValue(style, 'padding-right');
|
let paddingRight = getStyleValue(style, 'padding-right');
|
||||||
if (paddingRight) {
|
if (paddingRight) {
|
||||||
scrollSize -= paddingRight;
|
scrollSize -= paddingRight;
|
||||||
}
|
}
|
||||||
|
|
||||||
var slider = elem.getScrollSlider();
|
const slider = elem.getScrollSlider();
|
||||||
style = window.getComputedStyle(slider, null);
|
style = window.getComputedStyle(slider, null);
|
||||||
|
|
||||||
paddingLeft = getStyleValue(style, 'padding-left');
|
paddingLeft = getStyleValue(style, 'padding-left');
|
||||||
|
@ -114,14 +119,14 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
}
|
}
|
||||||
|
|
||||||
function onScrollButtonClick(e) {
|
function onScrollButtonClick(e) {
|
||||||
var scroller = this.parentNode.nextSibling;
|
let scroller = this.parentNode.nextSibling;
|
||||||
|
|
||||||
var direction = this.getAttribute('data-direction');
|
const direction = this.getAttribute('data-direction');
|
||||||
var scrollSize = getScrollSize(scroller);
|
const scrollSize = getScrollSize(scroller);
|
||||||
var scrollPos = getScrollPosition(scroller);
|
const scrollPos = getScrollPosition(scroller);
|
||||||
var scrollWidth = getScrollWidth(scroller);
|
const scrollWidth = getScrollWidth(scroller);
|
||||||
|
|
||||||
var newPos;
|
let newPos;
|
||||||
if (direction === 'left') {
|
if (direction === 'left') {
|
||||||
newPos = Math.max(0, scrollPos - scrollSize);
|
newPos = Math.max(0, scrollPos - scrollSize);
|
||||||
} else {
|
} else {
|
||||||
|
@ -132,21 +137,21 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
}
|
}
|
||||||
|
|
||||||
EmbyScrollButtonsPrototype.attachedCallback = function () {
|
EmbyScrollButtonsPrototype.attachedCallback = function () {
|
||||||
var scroller = this.nextSibling;
|
const scroller = this.nextSibling;
|
||||||
this.scroller = scroller;
|
this.scroller = scroller;
|
||||||
|
|
||||||
var parent = this.parentNode;
|
const parent = this.parentNode;
|
||||||
parent.classList.add('emby-scroller-container');
|
parent.classList.add('emby-scroller-container');
|
||||||
|
|
||||||
this.innerHTML = getScrollButtonHtml('left') + getScrollButtonHtml('right');
|
this.innerHTML = getScrollButtonHtml('left') + getScrollButtonHtml('right');
|
||||||
|
|
||||||
var buttons = this.querySelectorAll('.emby-scrollbuttons-button');
|
const buttons = this.querySelectorAll('.emby-scrollbuttons-button');
|
||||||
buttons[0].addEventListener('click', onScrollButtonClick);
|
buttons[0].addEventListener('click', onScrollButtonClick);
|
||||||
buttons[1].addEventListener('click', onScrollButtonClick);
|
buttons[1].addEventListener('click', onScrollButtonClick);
|
||||||
this.scrollButtonsLeft = buttons[0];
|
this.scrollButtonsLeft = buttons[0];
|
||||||
this.scrollButtonsRight = buttons[1];
|
this.scrollButtonsRight = buttons[1];
|
||||||
|
|
||||||
var scrollHandler = onScroll.bind(this);
|
const scrollHandler = onScroll.bind(this);
|
||||||
this.scrollHandler = scrollHandler;
|
this.scrollHandler = scrollHandler;
|
||||||
scroller.addScrollEventListener(scrollHandler, {
|
scroller.addScrollEventListener(scrollHandler, {
|
||||||
capture: false,
|
capture: false,
|
||||||
|
@ -155,10 +160,10 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
};
|
};
|
||||||
|
|
||||||
EmbyScrollButtonsPrototype.detachedCallback = function () {
|
EmbyScrollButtonsPrototype.detachedCallback = function () {
|
||||||
var parent = this.scroller;
|
const parent = this.scroller;
|
||||||
this.scroller = null;
|
this.scroller = null;
|
||||||
|
|
||||||
var scrollHandler = this.scrollHandler;
|
let scrollHandler = this.scrollHandler;
|
||||||
if (parent && scrollHandler) {
|
if (parent && scrollHandler) {
|
||||||
parent.removeScrollEventListener(scrollHandler, {
|
parent.removeScrollEventListener(scrollHandler, {
|
||||||
capture: false,
|
capture: false,
|
||||||
|
@ -175,4 +180,5 @@ define(['layoutManager', 'dom', 'css!./emby-scrollbuttons', 'registerElement', '
|
||||||
prototype: EmbyScrollButtonsPrototype,
|
prototype: EmbyScrollButtonsPrototype,
|
||||||
extends: 'div'
|
extends: 'div'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,7 +1,12 @@
|
||||||
define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registerElement'], function (layoutManager, browser, actionsheet) {
|
import layoutManager from 'layoutManager';
|
||||||
'use strict';
|
import browser from 'browser';
|
||||||
|
import actionsheet from 'actionsheet';
|
||||||
|
import 'css!./emby-select';
|
||||||
|
import 'registerElement';
|
||||||
|
|
||||||
var EmbySelectPrototype = Object.create(HTMLSelectElement.prototype);
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
const EmbySelectPrototype = Object.create(HTMLSelectElement.prototype);
|
||||||
|
|
||||||
function enableNativeMenu() {
|
function enableNativeMenu() {
|
||||||
|
|
||||||
|
@ -27,7 +32,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
|
|
||||||
function triggerChange(select) {
|
function triggerChange(select) {
|
||||||
var evt = document.createEvent('HTMLEvents');
|
const evt = document.createEvent('HTMLEvents');
|
||||||
evt.initEvent('change', false, true);
|
evt.initEvent('change', false, true);
|
||||||
select.dispatchEvent(evt);
|
select.dispatchEvent(evt);
|
||||||
}
|
}
|
||||||
|
@ -39,8 +44,8 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
|
|
||||||
function showActionSheet(select) {
|
function showActionSheet(select) {
|
||||||
|
|
||||||
var labelElem = getLabel(select);
|
const labelElem = getLabel(select);
|
||||||
var title = labelElem ? (labelElem.textContent || labelElem.innerText) : null;
|
const title = labelElem ? (labelElem.textContent || labelElem.innerText) : null;
|
||||||
|
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: select.options,
|
items: select.options,
|
||||||
|
@ -54,7 +59,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
|
|
||||||
function getLabel(select) {
|
function getLabel(select) {
|
||||||
var elem = select.previousSibling;
|
let elem = select.previousSibling;
|
||||||
while (elem && elem.tagName !== 'LABEL') {
|
while (elem && elem.tagName !== 'LABEL') {
|
||||||
elem = elem.previousSibling;
|
elem = elem.previousSibling;
|
||||||
}
|
}
|
||||||
|
@ -62,21 +67,20 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
|
|
||||||
function onFocus(e) {
|
function onFocus(e) {
|
||||||
var label = getLabel(this);
|
const label = getLabel(this);
|
||||||
if (label) {
|
if (label) {
|
||||||
label.classList.add('selectLabelFocused');
|
label.classList.add('selectLabelFocused');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onBlur(e) {
|
function onBlur(e) {
|
||||||
var label = getLabel(this);
|
const label = getLabel(this);
|
||||||
if (label) {
|
if (label) {
|
||||||
label.classList.remove('selectLabelFocused');
|
label.classList.remove('selectLabelFocused');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function onMouseDown(e) {
|
function onMouseDown(e) {
|
||||||
|
|
||||||
// e.button=0 for primary (left) mouse button click
|
// e.button=0 for primary (left) mouse button click
|
||||||
if (!e.button && !enableNativeMenu()) {
|
if (!e.button && !enableNativeMenu()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -85,9 +89,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
|
|
||||||
function onKeyDown(e) {
|
function onKeyDown(e) {
|
||||||
|
|
||||||
switch (e.keyCode) {
|
switch (e.keyCode) {
|
||||||
|
|
||||||
case 13:
|
case 13:
|
||||||
if (!enableNativeMenu()) {
|
if (!enableNativeMenu()) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
@ -107,7 +109,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var inputId = 0;
|
let inputId = 0;
|
||||||
|
|
||||||
EmbySelectPrototype.createdCallback = function () {
|
EmbySelectPrototype.createdCallback = function () {
|
||||||
|
|
||||||
|
@ -137,7 +139,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
|
|
||||||
this.classList.add('emby-select');
|
this.classList.add('emby-select');
|
||||||
|
|
||||||
var label = this.ownerDocument.createElement('label');
|
const label = this.ownerDocument.createElement('label');
|
||||||
label.innerHTML = this.getAttribute('label') || '';
|
label.innerHTML = this.getAttribute('label') || '';
|
||||||
label.classList.add('selectLabel');
|
label.classList.add('selectLabel');
|
||||||
label.htmlFor = this.id;
|
label.htmlFor = this.id;
|
||||||
|
@ -150,7 +152,7 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
|
|
||||||
EmbySelectPrototype.setLabel = function (text) {
|
EmbySelectPrototype.setLabel = function (text) {
|
||||||
|
|
||||||
var label = this.parentNode.querySelector('label');
|
const label = this.parentNode.querySelector('label');
|
||||||
|
|
||||||
label.innerHTML = text;
|
label.innerHTML = text;
|
||||||
};
|
};
|
||||||
|
@ -159,4 +161,5 @@ define(['layoutManager', 'browser', 'actionsheet', 'css!./emby-select', 'registe
|
||||||
prototype: EmbySelectPrototype,
|
prototype: EmbySelectPrototype,
|
||||||
extends: 'select'
|
extends: 'select'
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -150,7 +150,7 @@ define(['appSettings', 'userSettings', 'playbackManager', 'connectionManager', '
|
||||||
|
|
||||||
function alertText(text, title) {
|
function alertText(text, title) {
|
||||||
require(['alert'], function (alert) {
|
require(['alert'], function (alert) {
|
||||||
alert({
|
alert.default({
|
||||||
text: text,
|
text: text,
|
||||||
title: title
|
title: title
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,15 +1,16 @@
|
||||||
define(['globalize'], function (globalize) {
|
import globalize from 'globalize';
|
||||||
'use strict';
|
|
||||||
|
|
||||||
function parseISO8601Date(s, toLocal) {
|
/* eslint-disable indent */
|
||||||
|
|
||||||
|
export function parseISO8601Date(s, toLocal) {
|
||||||
|
|
||||||
// parenthese matches:
|
// parenthese matches:
|
||||||
// year month day hours minutes seconds
|
// year month day hours minutes seconds
|
||||||
// dotmilliseconds
|
// dotmilliseconds
|
||||||
// tzstring plusminus hours minutes
|
// tzstring plusminus hours minutes
|
||||||
var re = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|([+-])(\d{2}):(\d{2}))?/;
|
const re = /(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2}):(\d{2})(\.\d+)?(Z|([+-])(\d{2}):(\d{2}))?/;
|
||||||
|
|
||||||
var d = s.match(re);
|
const d = s.match(re);
|
||||||
|
|
||||||
// "2010-12-07T11:00:00.000-09:00" parses to:
|
// "2010-12-07T11:00:00.000-09:00" parses to:
|
||||||
// ["2010-12-07T11:00:00.000-09:00", "2010", "12", "07", "11",
|
// ["2010-12-07T11:00:00.000-09:00", "2010", "12", "07", "11",
|
||||||
|
@ -24,8 +25,8 @@ define(['globalize'], function (globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse strings, leading zeros into proper ints
|
// parse strings, leading zeros into proper ints
|
||||||
var a = [1, 2, 3, 4, 5, 6, 10, 11];
|
const a = [1, 2, 3, 4, 5, 6, 10, 11];
|
||||||
for (var i in a) {
|
for (let i in a) {
|
||||||
d[a[i]] = parseInt(d[a[i]], 10);
|
d[a[i]] = parseInt(d[a[i]], 10);
|
||||||
}
|
}
|
||||||
d[7] = parseFloat(d[7]);
|
d[7] = parseFloat(d[7]);
|
||||||
|
@ -33,7 +34,7 @@ define(['globalize'], function (globalize) {
|
||||||
// Date.UTC(year, month[, date[, hrs[, min[, sec[, ms]]]]])
|
// Date.UTC(year, month[, date[, hrs[, min[, sec[, ms]]]]])
|
||||||
// note that month is 0-11, not 1-12
|
// note that month is 0-11, not 1-12
|
||||||
// see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC
|
// see https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Date/UTC
|
||||||
var ms = Date.UTC(d[1], d[2] - 1, d[3], d[4], d[5], d[6]);
|
let ms = Date.UTC(d[1], d[2] - 1, d[3], d[4], d[5], d[6]);
|
||||||
|
|
||||||
// if there are milliseconds, add them
|
// if there are milliseconds, add them
|
||||||
if (d[7] > 0) {
|
if (d[7] > 0) {
|
||||||
|
@ -42,7 +43,7 @@ define(['globalize'], function (globalize) {
|
||||||
|
|
||||||
// if there's a timezone, calculate it
|
// if there's a timezone, calculate it
|
||||||
if (d[8] !== 'Z' && d[10]) {
|
if (d[8] !== 'Z' && d[10]) {
|
||||||
var offset = d[10] * 60 * 60 * 1000;
|
let offset = d[10] * 60 * 60 * 1000;
|
||||||
if (d[11]) {
|
if (d[11]) {
|
||||||
offset += d[11] * 60 * 1000;
|
offset += d[11] * 60 * 1000;
|
||||||
}
|
}
|
||||||
|
@ -58,14 +59,14 @@ define(['globalize'], function (globalize) {
|
||||||
return new Date(ms);
|
return new Date(ms);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayRunningTime(ticks) {
|
export function getDisplayRunningTime(ticks) {
|
||||||
var ticksPerHour = 36000000000;
|
const ticksPerHour = 36000000000;
|
||||||
var ticksPerMinute = 600000000;
|
const ticksPerMinute = 600000000;
|
||||||
var ticksPerSecond = 10000000;
|
const ticksPerSecond = 10000000;
|
||||||
|
|
||||||
var parts = [];
|
const parts = [];
|
||||||
|
|
||||||
var hours = ticks / ticksPerHour;
|
let hours = ticks / ticksPerHour;
|
||||||
hours = Math.floor(hours);
|
hours = Math.floor(hours);
|
||||||
|
|
||||||
if (hours) {
|
if (hours) {
|
||||||
|
@ -74,7 +75,7 @@ define(['globalize'], function (globalize) {
|
||||||
|
|
||||||
ticks -= (hours * ticksPerHour);
|
ticks -= (hours * ticksPerHour);
|
||||||
|
|
||||||
var minutes = ticks / ticksPerMinute;
|
let minutes = ticks / ticksPerMinute;
|
||||||
minutes = Math.floor(minutes);
|
minutes = Math.floor(minutes);
|
||||||
|
|
||||||
ticks -= (minutes * ticksPerMinute);
|
ticks -= (minutes * ticksPerMinute);
|
||||||
|
@ -84,7 +85,7 @@ define(['globalize'], function (globalize) {
|
||||||
}
|
}
|
||||||
parts.push(minutes);
|
parts.push(minutes);
|
||||||
|
|
||||||
var seconds = ticks / ticksPerSecond;
|
let seconds = ticks / ticksPerSecond;
|
||||||
seconds = Math.floor(seconds);
|
seconds = Math.floor(seconds);
|
||||||
|
|
||||||
if (seconds < 10) {
|
if (seconds < 10) {
|
||||||
|
@ -95,7 +96,7 @@ define(['globalize'], function (globalize) {
|
||||||
return parts.join(':');
|
return parts.join(':');
|
||||||
}
|
}
|
||||||
|
|
||||||
var toLocaleTimeStringSupportsLocales = function () {
|
const toLocaleTimeStringSupportsLocales = function () {
|
||||||
try {
|
try {
|
||||||
new Date().toLocaleTimeString('i');
|
new Date().toLocaleTimeString('i');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
|
@ -106,9 +107,9 @@ define(['globalize'], function (globalize) {
|
||||||
|
|
||||||
function getOptionList(options) {
|
function getOptionList(options) {
|
||||||
|
|
||||||
var list = [];
|
const list = [];
|
||||||
|
|
||||||
for (var i in options) {
|
for (const i in options) {
|
||||||
list.push({
|
list.push({
|
||||||
name: i,
|
name: i,
|
||||||
value: options[i]
|
value: options[i]
|
||||||
|
@ -118,7 +119,7 @@ define(['globalize'], function (globalize) {
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
function toLocaleString(date, options) {
|
export function toLocaleString(date, options) {
|
||||||
|
|
||||||
if (!date) {
|
if (!date) {
|
||||||
throw new Error('date cannot be null');
|
throw new Error('date cannot be null');
|
||||||
|
@ -128,7 +129,7 @@ define(['globalize'], function (globalize) {
|
||||||
|
|
||||||
if (toLocaleTimeStringSupportsLocales) {
|
if (toLocaleTimeStringSupportsLocales) {
|
||||||
|
|
||||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||||
|
|
||||||
if (currentLocale) {
|
if (currentLocale) {
|
||||||
return date.toLocaleString(currentLocale, options);
|
return date.toLocaleString(currentLocale, options);
|
||||||
|
@ -138,7 +139,7 @@ define(['globalize'], function (globalize) {
|
||||||
return date.toLocaleString();
|
return date.toLocaleString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function toLocaleDateString(date, options) {
|
export function toLocaleDateString(date, options) {
|
||||||
|
|
||||||
if (!date) {
|
if (!date) {
|
||||||
throw new Error('date cannot be null');
|
throw new Error('date cannot be null');
|
||||||
|
@ -148,7 +149,7 @@ define(['globalize'], function (globalize) {
|
||||||
|
|
||||||
if (toLocaleTimeStringSupportsLocales) {
|
if (toLocaleTimeStringSupportsLocales) {
|
||||||
|
|
||||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||||
|
|
||||||
if (currentLocale) {
|
if (currentLocale) {
|
||||||
return date.toLocaleDateString(currentLocale, options);
|
return date.toLocaleDateString(currentLocale, options);
|
||||||
|
@ -156,9 +157,9 @@ define(['globalize'], function (globalize) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// This is essentially a hard-coded polyfill
|
// This is essentially a hard-coded polyfill
|
||||||
var optionList = getOptionList(options);
|
const optionList = getOptionList(options);
|
||||||
if (optionList.length === 1 && optionList[0].name === 'weekday') {
|
if (optionList.length === 1 && optionList[0].name === 'weekday') {
|
||||||
var weekday = [];
|
const weekday = [];
|
||||||
weekday[0] = 'Sun';
|
weekday[0] = 'Sun';
|
||||||
weekday[1] = 'Mon';
|
weekday[1] = 'Mon';
|
||||||
weekday[2] = 'Tue';
|
weekday[2] = 'Tue';
|
||||||
|
@ -172,7 +173,7 @@ define(['globalize'], function (globalize) {
|
||||||
return date.toLocaleDateString();
|
return date.toLocaleDateString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function toLocaleTimeString(date, options) {
|
export function toLocaleTimeString(date, options) {
|
||||||
|
|
||||||
if (!date) {
|
if (!date) {
|
||||||
throw new Error('date cannot be null');
|
throw new Error('date cannot be null');
|
||||||
|
@ -182,7 +183,7 @@ define(['globalize'], function (globalize) {
|
||||||
|
|
||||||
if (toLocaleTimeStringSupportsLocales) {
|
if (toLocaleTimeStringSupportsLocales) {
|
||||||
|
|
||||||
var currentLocale = globalize.getCurrentDateTimeLocale();
|
const currentLocale = globalize.getCurrentDateTimeLocale();
|
||||||
|
|
||||||
if (currentLocale) {
|
if (currentLocale) {
|
||||||
return date.toLocaleTimeString(currentLocale, options);
|
return date.toLocaleTimeString(currentLocale, options);
|
||||||
|
@ -192,7 +193,7 @@ define(['globalize'], function (globalize) {
|
||||||
return date.toLocaleTimeString();
|
return date.toLocaleTimeString();
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayTime(date) {
|
export function getDisplayTime(date) {
|
||||||
|
|
||||||
if (!date) {
|
if (!date) {
|
||||||
throw new Error('date cannot be null');
|
throw new Error('date cannot be null');
|
||||||
|
@ -217,19 +218,19 @@ define(['globalize'], function (globalize) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var time = toLocaleTimeString(date);
|
let time = toLocaleTimeString(date);
|
||||||
|
|
||||||
var timeLower = time.toLowerCase();
|
const timeLower = time.toLowerCase();
|
||||||
|
|
||||||
if (timeLower.indexOf('am') !== -1 || timeLower.indexOf('pm') !== -1) {
|
if (timeLower.indexOf('am') !== -1 || timeLower.indexOf('pm') !== -1) {
|
||||||
|
|
||||||
time = timeLower;
|
time = timeLower;
|
||||||
var hour = date.getHours() % 12;
|
let hour = date.getHours() % 12;
|
||||||
var suffix = date.getHours() > 11 ? 'pm' : 'am';
|
const suffix = date.getHours() > 11 ? 'pm' : 'am';
|
||||||
if (!hour) {
|
if (!hour) {
|
||||||
hour = 12;
|
hour = 12;
|
||||||
}
|
}
|
||||||
var minutes = date.getMinutes();
|
let minutes = date.getMinutes();
|
||||||
|
|
||||||
if (minutes < 10) {
|
if (minutes < 10) {
|
||||||
minutes = '0' + minutes;
|
minutes = '0' + minutes;
|
||||||
|
@ -239,7 +240,7 @@ define(['globalize'], function (globalize) {
|
||||||
time = hour + minutes + suffix;
|
time = hour + minutes + suffix;
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
var timeParts = time.split(':');
|
const timeParts = time.split(':');
|
||||||
|
|
||||||
// Trim off seconds
|
// Trim off seconds
|
||||||
if (timeParts.length > 2) {
|
if (timeParts.length > 2) {
|
||||||
|
@ -253,21 +254,21 @@ define(['globalize'], function (globalize) {
|
||||||
return time;
|
return time;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isRelativeDay(date, offsetInDays) {
|
export function isRelativeDay(date, offsetInDays) {
|
||||||
|
|
||||||
if (!date) {
|
if (!date) {
|
||||||
throw new Error('date cannot be null');
|
throw new Error('date cannot be null');
|
||||||
}
|
}
|
||||||
|
|
||||||
var yesterday = new Date();
|
const yesterday = new Date();
|
||||||
var day = yesterday.getDate() + offsetInDays;
|
const day = yesterday.getDate() + offsetInDays;
|
||||||
|
|
||||||
yesterday.setDate(day); // automatically adjusts month/year appropriately
|
yesterday.setDate(day); // automatically adjusts month/year appropriately
|
||||||
|
|
||||||
return date.getFullYear() === yesterday.getFullYear() && date.getMonth() === yesterday.getMonth() && date.getDate() === day;
|
return date.getFullYear() === yesterday.getFullYear() && date.getMonth() === yesterday.getMonth() && date.getDate() === day;
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
export default {
|
||||||
parseISO8601Date: parseISO8601Date,
|
parseISO8601Date: parseISO8601Date,
|
||||||
getDisplayRunningTime: getDisplayRunningTime,
|
getDisplayRunningTime: getDisplayRunningTime,
|
||||||
toLocaleDateString: toLocaleDateString,
|
toLocaleDateString: toLocaleDateString,
|
||||||
|
@ -279,4 +280,5 @@ define(['globalize'], function (globalize) {
|
||||||
return toLocaleTimeStringSupportsLocales;
|
return toLocaleTimeStringSupportsLocales;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -15,7 +15,7 @@ define(['connectionManager', 'playbackManager', 'syncPlayManager', 'events', 'in
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
require(['alert'], function (alert) {
|
require(['alert'], function (alert) {
|
||||||
alert({ title: args.Header, text: args.Text });
|
alert.default({ title: args.Header, text: args.Text });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,7 +187,7 @@ var Dashboard = {
|
||||||
}
|
}
|
||||||
|
|
||||||
require(['alert'], function (alert) {
|
require(['alert'], function (alert) {
|
||||||
alert({
|
alert.default({
|
||||||
title: options.title || Globalize.translate('HeaderAlert'),
|
title: options.title || Globalize.translate('HeaderAlert'),
|
||||||
text: options.message
|
text: options.message
|
||||||
}).then(options.callback || function () {});
|
}).then(options.callback || function () {});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue