';
deviceHtml += '
diff --git a/src/controllers/dashboard/users/useredit.html b/src/controllers/dashboard/users/useredit.html
index 83fa6dced7..e4b6afd33e 100644
--- a/src/controllers/dashboard/users/useredit.html
+++ b/src/controllers/dashboard/users/useredit.html
@@ -1,194 +1,3 @@
diff --git a/src/controllers/dashboard/users/useredit.js b/src/controllers/dashboard/users/useredit.js
deleted file mode 100644
index c45f0c9af3..0000000000
--- a/src/controllers/dashboard/users/useredit.js
+++ /dev/null
@@ -1,196 +0,0 @@
-import 'jquery';
-import loading from '../../../components/loading/loading';
-import libraryMenu from '../../../scripts/libraryMenu';
-import globalize from '../../../scripts/globalize';
-import Dashboard from '../../../scripts/clientUtils';
-import toast from '../../../components/toast/toast';
-
-/* eslint-disable indent */
-
- function loadDeleteFolders(page, user, mediaFolders) {
- ApiClient.getJSON(ApiClient.getUrl('Channels', {
- SupportsMediaDeletion: true
- })).then(function (channelsResult) {
- let isChecked;
- let checkedAttribute;
- let html = '';
-
- for (const folder of mediaFolders) {
- isChecked = user.Policy.EnableContentDeletion || user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id) != -1;
- checkedAttribute = isChecked ? ' checked="checked"' : '';
- html += '
';
- }
-
- for (const folder of channelsResult.Items) {
- isChecked = user.Policy.EnableContentDeletion || user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id) != -1;
- checkedAttribute = isChecked ? ' checked="checked"' : '';
- html += '
';
- }
-
- $('.deleteAccess', page).html(html).trigger('create');
- $('#chkEnableDeleteAllFolders', page).prop('checked', user.Policy.EnableContentDeletion);
- });
- }
-
- function loadAuthProviders(page, user, providers) {
- if (providers.length > 1) {
- page.querySelector('.fldSelectLoginProvider').classList.remove('hide');
- } else {
- page.querySelector('.fldSelectLoginProvider').classList.add('hide');
- }
-
- const currentProviderId = user.Policy.AuthenticationProviderId;
- page.querySelector('.selectLoginProvider').innerHTML = providers.map(function (provider) {
- const selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
- return '
';
- });
- }
-
- function loadPasswordResetProviders(page, user, providers) {
- if (providers.length > 1) {
- page.querySelector('.fldSelectPasswordResetProvider').classList.remove('hide');
- } else {
- page.querySelector('.fldSelectPasswordResetProvider').classList.add('hide');
- }
-
- const currentProviderId = user.Policy.PasswordResetProviderId;
- page.querySelector('.selectPasswordResetProvider').innerHTML = providers.map(function (provider) {
- const selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
- return '
';
- });
- }
-
- function loadUser(page, user) {
- ApiClient.getJSON(ApiClient.getUrl('Auth/Providers')).then(function (providers) {
- loadAuthProviders(page, user, providers);
- });
- ApiClient.getJSON(ApiClient.getUrl('Auth/PasswordResetProviders')).then(function (providers) {
- loadPasswordResetProviders(page, user, providers);
- });
- ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
- IsHidden: false
- })).then(function (folders) {
- loadDeleteFolders(page, user, folders.Items);
- });
-
- if (user.Policy.IsDisabled) {
- $('.disabledUserBanner', page).show();
- } else {
- $('.disabledUserBanner', page).hide();
- }
-
- $('#txtUserName', page).prop('disabled', '').removeAttr('disabled');
- $('#fldConnectInfo', page).show();
- $('.lnkEditUserPreferences', page).attr('href', 'mypreferencesmenu.html?userId=' + user.Id);
- libraryMenu.setTitle(user.Name);
- page.querySelector('.username').innerHTML = user.Name;
- $('#txtUserName', page).val(user.Name);
- $('#chkIsAdmin', page).prop('checked', user.Policy.IsAdministrator);
- $('#chkDisabled', page).prop('checked', user.Policy.IsDisabled);
- $('#chkIsHidden', page).prop('checked', user.Policy.IsHidden);
- $('#chkRemoteControlSharedDevices', page).prop('checked', user.Policy.EnableSharedDeviceControl);
- $('#chkEnableRemoteControlOtherUsers', page).prop('checked', user.Policy.EnableRemoteControlOfOtherUsers);
- $('#chkEnableDownloading', page).prop('checked', user.Policy.EnableContentDownloading);
- $('#chkManageLiveTv', page).prop('checked', user.Policy.EnableLiveTvManagement);
- $('#chkEnableLiveTvAccess', page).prop('checked', user.Policy.EnableLiveTvAccess);
- $('#chkEnableMediaPlayback', page).prop('checked', user.Policy.EnableMediaPlayback);
- $('#chkEnableAudioPlaybackTranscoding', page).prop('checked', user.Policy.EnableAudioPlaybackTranscoding);
- $('#chkEnableVideoPlaybackTranscoding', page).prop('checked', user.Policy.EnableVideoPlaybackTranscoding);
- $('#chkEnableVideoPlaybackRemuxing', page).prop('checked', user.Policy.EnablePlaybackRemuxing);
- $('#chkForceRemoteSourceTranscoding', page).prop('checked', user.Policy.ForceRemoteSourceTranscoding);
- $('#chkRemoteAccess', page).prop('checked', user.Policy.EnableRemoteAccess == null || user.Policy.EnableRemoteAccess);
- $('#txtRemoteClientBitrateLimit', page).val(user.Policy.RemoteClientBitrateLimit / 1e6 || '');
- $('#txtLoginAttemptsBeforeLockout', page).val(user.Policy.LoginAttemptsBeforeLockout || '0');
- $('#txtMaxActiveSessions', page).val(user.Policy.MaxActiveSessions || '0');
- if (ApiClient.isMinServerVersion('10.6.0')) {
- $('#selectSyncPlayAccess').val(user.Policy.SyncPlayAccess);
- }
- loading.hide();
- }
-
- function onSaveComplete() {
- Dashboard.navigate('userprofiles.html');
- loading.hide();
- toast(globalize.translate('SettingsSaved'));
- }
-
- function saveUser(user, page) {
- user.Name = $('#txtUserName', page).val();
- user.Policy.IsAdministrator = $('#chkIsAdmin', page).is(':checked');
- user.Policy.IsHidden = $('#chkIsHidden', page).is(':checked');
- user.Policy.IsDisabled = $('#chkDisabled', page).is(':checked');
- user.Policy.EnableRemoteControlOfOtherUsers = $('#chkEnableRemoteControlOtherUsers', page).is(':checked');
- user.Policy.EnableLiveTvManagement = $('#chkManageLiveTv', page).is(':checked');
- user.Policy.EnableLiveTvAccess = $('#chkEnableLiveTvAccess', page).is(':checked');
- user.Policy.EnableSharedDeviceControl = $('#chkRemoteControlSharedDevices', page).is(':checked');
- user.Policy.EnableMediaPlayback = $('#chkEnableMediaPlayback', page).is(':checked');
- user.Policy.EnableAudioPlaybackTranscoding = $('#chkEnableAudioPlaybackTranscoding', page).is(':checked');
- user.Policy.EnableVideoPlaybackTranscoding = $('#chkEnableVideoPlaybackTranscoding', page).is(':checked');
- user.Policy.EnablePlaybackRemuxing = $('#chkEnableVideoPlaybackRemuxing', page).is(':checked');
- user.Policy.ForceRemoteSourceTranscoding = $('#chkForceRemoteSourceTranscoding', page).is(':checked');
- user.Policy.EnableContentDownloading = $('#chkEnableDownloading', page).is(':checked');
- user.Policy.EnableRemoteAccess = $('#chkRemoteAccess', page).is(':checked');
- user.Policy.RemoteClientBitrateLimit = parseInt(1e6 * parseFloat($('#txtRemoteClientBitrateLimit', page).val() || '0'));
- user.Policy.LoginAttemptsBeforeLockout = parseInt($('#txtLoginAttemptsBeforeLockout', page).val() || '0');
- user.Policy.MaxActiveSessions = parseInt($('#txtMaxActiveSessions', page).val() || '0');
- user.Policy.AuthenticationProviderId = page.querySelector('.selectLoginProvider').value;
- user.Policy.PasswordResetProviderId = page.querySelector('.selectPasswordResetProvider').value;
- user.Policy.EnableContentDeletion = $('#chkEnableDeleteAllFolders', page).is(':checked');
- user.Policy.EnableContentDeletionFromFolders = user.Policy.EnableContentDeletion ? [] : $('.chkFolder', page).get().filter(function (c) {
- return c.checked;
- }).map(function (c) {
- return c.getAttribute('data-id');
- });
- if (ApiClient.isMinServerVersion('10.6.0')) {
- user.Policy.SyncPlayAccess = page.querySelector('#selectSyncPlayAccess').value;
- }
- ApiClient.updateUser(user).then(function () {
- ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () {
- onSaveComplete();
- });
- });
- }
-
- function onSubmit() {
- const page = $(this).parents('.page')[0];
- loading.show();
- getUser().then(function (result) {
- saveUser(result, page);
- });
- return false;
- }
-
- function getUser() {
- const userId = getParameterByName('userId');
- return ApiClient.getUser(userId);
- }
-
- function loadData(page) {
- loading.show();
- getUser().then(function (user) {
- loadUser(page, user);
- });
- }
-
- $(document).on('pageinit', '#editUserPage', function () {
- $('.editUserProfileForm').off('submit', onSubmit).on('submit', onSubmit);
- const page = this;
- $('#chkEnableDeleteAllFolders', this).on('change', function () {
- if (this.checked) {
- $('.deleteAccess', page).hide();
- } else {
- $('.deleteAccess', page).show();
- }
- });
- ApiClient.getServerConfiguration().then(function (config) {
- if (config.EnableRemoteAccess) {
- page.querySelector('.fldRemoteAccess').classList.remove('hide');
- } else {
- page.querySelector('.fldRemoteAccess').classList.add('hide');
- }
- });
- }).on('pagebeforeshow', '#editUserPage', function () {
- loadData(this);
- });
-
-/* eslint-enable indent */
diff --git a/src/controllers/dashboard/users/userlibraryaccess.html b/src/controllers/dashboard/users/userlibraryaccess.html
index 6c80d23d7c..abcbfaf103 100644
--- a/src/controllers/dashboard/users/userlibraryaccess.html
+++ b/src/controllers/dashboard/users/userlibraryaccess.html
@@ -1,68 +1,3 @@
diff --git a/src/controllers/dashboard/users/userlibraryaccess.js b/src/controllers/dashboard/users/userlibraryaccess.js
deleted file mode 100644
index 0f68133d89..0000000000
--- a/src/controllers/dashboard/users/userlibraryaccess.js
+++ /dev/null
@@ -1,186 +0,0 @@
-import 'jquery';
-import loading from '../../../components/loading/loading';
-import libraryMenu from '../../../scripts/libraryMenu';
-import globalize from '../../../scripts/globalize';
-import Dashboard from '../../../scripts/clientUtils';
-import toast from '../../../components/toast/toast';
-
-/* eslint-disable indent */
-
- function triggerChange(select) {
- const evt = document.createEvent('HTMLEvents');
- evt.initEvent('change', false, true);
- select.dispatchEvent(evt);
- }
-
- function loadMediaFolders(page, user, mediaFolders) {
- let html = '';
- html += '
' + globalize.translate('HeaderLibraries') + '
';
- html += '
';
-
- for (let i = 0, length = mediaFolders.length; i < length; i++) {
- const folder = mediaFolders[i];
- const isChecked = user.Policy.EnableAllFolders || user.Policy.EnabledFolders.indexOf(folder.Id) != -1;
- const checkedAttribute = isChecked ? ' checked="checked"' : '';
- html += '';
- }
-
- html += '
';
- page.querySelector('.folderAccess').innerHTML = html;
- const chkEnableAllFolders = page.querySelector('#chkEnableAllFolders');
- chkEnableAllFolders.checked = user.Policy.EnableAllFolders;
- triggerChange(chkEnableAllFolders);
- }
-
- function loadChannels(page, user, channels) {
- let html = '';
- html += '
' + globalize.translate('Channels') + '
';
- html += '
';
-
- for (let i = 0, length = channels.length; i < length; i++) {
- const folder = channels[i];
- const isChecked = user.Policy.EnableAllChannels || user.Policy.EnabledChannels.indexOf(folder.Id) != -1;
- const checkedAttribute = isChecked ? ' checked="checked"' : '';
- html += '';
- }
-
- html += '
';
- $('.channelAccess', page).show().html(html);
-
- if (channels.length) {
- $('.channelAccessContainer', page).show();
- } else {
- $('.channelAccessContainer', page).hide();
- }
-
- const chkEnableAllChannels = page.querySelector('#chkEnableAllChannels');
- chkEnableAllChannels.checked = user.Policy.EnableAllChannels;
- triggerChange(chkEnableAllChannels);
- }
-
- function loadDevices(page, user, devices) {
- let html = '';
- html += '
' + globalize.translate('HeaderDevices') + '
';
- html += '
';
-
- for (let i = 0, length = devices.length; i < length; i++) {
- const device = devices[i];
- const checkedAttribute = user.Policy.EnableAllDevices || user.Policy.EnabledDevices.indexOf(device.Id) != -1 ? ' checked="checked"' : '';
- html += '';
- }
-
- html += '
';
- $('.deviceAccess', page).show().html(html);
- const chkEnableAllDevices = page.querySelector('#chkEnableAllDevices');
- chkEnableAllDevices.checked = user.Policy.EnableAllDevices;
- triggerChange(chkEnableAllDevices);
-
- if (user.Policy.IsAdministrator) {
- page.querySelector('.deviceAccessContainer').classList.add('hide');
- } else {
- page.querySelector('.deviceAccessContainer').classList.remove('hide');
- }
- }
-
- function loadUser(page, user, loggedInUser, mediaFolders, channels, devices) {
- page.querySelector('.username').innerHTML = user.Name;
- libraryMenu.setTitle(user.Name);
- loadChannels(page, user, channels);
- loadMediaFolders(page, user, mediaFolders);
- loadDevices(page, user, devices);
- loading.hide();
- }
-
- function onSaveComplete() {
- loading.hide();
- toast(globalize.translate('SettingsSaved'));
- }
-
- function saveUser(user, page) {
- user.Policy.EnableAllFolders = $('#chkEnableAllFolders', page).is(':checked');
- user.Policy.EnabledFolders = user.Policy.EnableAllFolders ? [] : $('.chkFolder', page).get().filter(function (c) {
- return c.checked;
- }).map(function (c) {
- return c.getAttribute('data-id');
- });
- user.Policy.EnableAllChannels = $('#chkEnableAllChannels', page).is(':checked');
- user.Policy.EnabledChannels = user.Policy.EnableAllChannels ? [] : $('.chkChannel', page).get().filter(function (c) {
- return c.checked;
- }).map(function (c) {
- return c.getAttribute('data-id');
- });
- user.Policy.EnableAllDevices = $('#chkEnableAllDevices', page).is(':checked');
- user.Policy.EnabledDevices = user.Policy.EnableAllDevices ? [] : $('.chkDevice', page).get().filter(function (c) {
- return c.checked;
- }).map(function (c) {
- return c.getAttribute('data-id');
- });
- user.Policy.BlockedChannels = null;
- user.Policy.BlockedMediaFolders = null;
- ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () {
- onSaveComplete();
- });
- }
-
- function onSubmit() {
- const page = $(this).parents('.page');
- loading.show();
- const userId = getParameterByName('userId');
- ApiClient.getUser(userId).then(function (result) {
- saveUser(result, page);
- });
- return false;
- }
-
- $(document).on('pageinit', '#userLibraryAccessPage', function () {
- const page = this;
- $('#chkEnableAllDevices', page).on('change', function () {
- if (this.checked) {
- $('.deviceAccessListContainer', page).hide();
- } else {
- $('.deviceAccessListContainer', page).show();
- }
- });
- $('#chkEnableAllChannels', page).on('change', function () {
- if (this.checked) {
- $('.channelAccessListContainer', page).hide();
- } else {
- $('.channelAccessListContainer', page).show();
- }
- });
- page.querySelector('#chkEnableAllFolders').addEventListener('change', function () {
- if (this.checked) {
- page.querySelector('.folderAccessListContainer').classList.add('hide');
- } else {
- page.querySelector('.folderAccessListContainer').classList.remove('hide');
- }
- });
- $('.userLibraryAccessForm').off('submit', onSubmit).on('submit', onSubmit);
- }).on('pageshow', '#userLibraryAccessPage', function () {
- const page = this;
- loading.show();
- let promise1;
- const userId = getParameterByName('userId');
-
- if (userId) {
- promise1 = ApiClient.getUser(userId);
- } else {
- const deferred = $.Deferred();
- deferred.resolveWith(null, [{
- Configuration: {}
- }]);
- promise1 = deferred.promise();
- }
-
- const promise2 = Dashboard.getCurrentUser();
- const promise4 = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
- IsHidden: false
- }));
- const promise5 = ApiClient.getJSON(ApiClient.getUrl('Channels'));
- const promise6 = ApiClient.getJSON(ApiClient.getUrl('Devices'));
- Promise.all([promise1, promise2, promise4, promise5, promise6]).then(function (responses) {
- loadUser(page, responses[0], responses[1], responses[2].Items, responses[3].Items, responses[4].Items);
- });
- });
-
-/* eslint-enable indent */
diff --git a/src/controllers/dashboard/users/userparentalcontrol.html b/src/controllers/dashboard/users/userparentalcontrol.html
index 884bacc3b6..8a93c3f931 100644
--- a/src/controllers/dashboard/users/userparentalcontrol.html
+++ b/src/controllers/dashboard/users/userparentalcontrol.html
@@ -1,60 +1,3 @@
diff --git a/src/controllers/dashboard/users/userparentalcontrol.js b/src/controllers/dashboard/users/userparentalcontrol.js
deleted file mode 100644
index 86af9a2377..0000000000
--- a/src/controllers/dashboard/users/userparentalcontrol.js
+++ /dev/null
@@ -1,274 +0,0 @@
-import 'jquery';
-import datetime from '../../../scripts/datetime';
-import loading from '../../../components/loading/loading';
-import libraryMenu from '../../../scripts/libraryMenu';
-import globalize from '../../../scripts/globalize';
-import '../../../components/listview/listview.scss';
-import '../../../elements/emby-button/paper-icon-button-light';
-import toast from '../../../components/toast/toast';
-
-/* eslint-disable indent */
-
- function populateRatings(allParentalRatings, page) {
- let html = '';
- html += "
";
- let rating;
- const ratings = [];
-
- for (let i = 0, length = allParentalRatings.length; i < length; i++) {
- if (rating = allParentalRatings[i], ratings.length) {
- const lastRating = ratings[ratings.length - 1];
-
- if (lastRating.Value === rating.Value) {
- lastRating.Name += '/' + rating.Name;
- continue;
- }
- }
-
- ratings.push({
- Name: rating.Name,
- Value: rating.Value
- });
- }
-
- for (let i = 0, length = ratings.length; i < length; i++) {
- rating = ratings[i];
- html += "
';
- }
-
- $('#selectMaxParentalRating', page).html(html);
- }
-
- function loadUnratedItems(page, user) {
- const items = [{
- name: globalize.translate('Books'),
- value: 'Book'
- }, {
- name: globalize.translate('Channels'),
- value: 'ChannelContent'
- }, {
- name: globalize.translate('LiveTV'),
- value: 'LiveTvChannel'
- }, {
- name: globalize.translate('Movies'),
- value: 'Movie'
- }, {
- name: globalize.translate('Music'),
- value: 'Music'
- }, {
- name: globalize.translate('Trailers'),
- value: 'Trailer'
- }, {
- name: globalize.translate('Shows'),
- value: 'Series'
- }];
- let html = '';
- html += '
' + globalize.translate('HeaderBlockItemsWithNoRating') + '
';
- html += '
';
-
- for (let i = 0, length = items.length; i < length; i++) {
- const item = items[i];
- const checkedAttribute = user.Policy.BlockUnratedItems.indexOf(item.value) != -1 ? ' checked="checked"' : '';
- html += '';
- }
-
- html += '
';
- $('.blockUnratedItems', page).html(html).trigger('create');
- }
-
- function loadUser(page, user, allParentalRatings) {
- page.querySelector('.username').innerHTML = user.Name;
- libraryMenu.setTitle(user.Name);
- loadUnratedItems(page, user);
- loadBlockedTags(page, user.Policy.BlockedTags);
- populateRatings(allParentalRatings, page);
- let ratingValue = '';
-
- if (user.Policy.MaxParentalRating) {
- for (let i = 0, length = allParentalRatings.length; i < length; i++) {
- const rating = allParentalRatings[i];
-
- if (user.Policy.MaxParentalRating >= rating.Value) {
- ratingValue = rating.Value;
- }
- }
- }
-
- $('#selectMaxParentalRating', page).val(ratingValue);
-
- if (user.Policy.IsAdministrator) {
- $('.accessScheduleSection', page).hide();
- } else {
- $('.accessScheduleSection', page).show();
- }
-
- renderAccessSchedule(page, user.Policy.AccessSchedules || []);
- loading.hide();
- }
-
- function loadBlockedTags(page, tags) {
- let html = tags.map(function (h) {
- let li = '
';
- li += '
';
- li += '
';
- li += h;
- li += '
';
- li += '';
- li += '
';
- return li += '
';
- }).join('');
-
- if (html) {
- html = '
' + html + '
';
- }
-
- const elem = $('.blockedTags', page).html(html).trigger('create');
- $('.btnDeleteTag', elem).on('click', function () {
- const tag = this.getAttribute('data-tag');
- const newTags = tags.filter(function (t) {
- return t != tag;
- });
- loadBlockedTags(page, newTags);
- });
- }
-
- function deleteAccessSchedule(page, schedules, index) {
- schedules.splice(index, 1);
- renderAccessSchedule(page, schedules);
- }
-
- function renderAccessSchedule(page, schedules) {
- let html = '';
- let index = 0;
- html += schedules.map(function (a) {
- let itemHtml = '';
- itemHtml += '
';
- itemHtml += '
';
- itemHtml += '
';
- itemHtml += globalize.translate('Option' + a.DayOfWeek);
- itemHtml += '
';
- itemHtml += '
' + getDisplayTime(a.StartHour) + ' - ' + getDisplayTime(a.EndHour) + '
';
- itemHtml += '
';
- itemHtml += '
';
- itemHtml += '
';
- index++;
- return itemHtml;
- }).join('');
- const accessScheduleList = page.querySelector('.accessScheduleList');
- accessScheduleList.innerHTML = html;
- $('.btnDelete', accessScheduleList).on('click', function () {
- deleteAccessSchedule(page, schedules, parseInt(this.getAttribute('data-index')));
- });
- }
-
- function onSaveComplete() {
- loading.hide();
- toast(globalize.translate('SettingsSaved'));
- }
-
- function saveUser(user, page) {
- user.Policy.MaxParentalRating = $('#selectMaxParentalRating', page).val() || null;
- user.Policy.BlockUnratedItems = $('.chkUnratedItem', page).get().filter(function (i) {
- return i.checked;
- }).map(function (i) {
- return i.getAttribute('data-itemtype');
- });
- user.Policy.AccessSchedules = getSchedulesFromPage(page);
- user.Policy.BlockedTags = getBlockedTagsFromPage(page);
- ApiClient.updateUserPolicy(user.Id, user.Policy).then(function () {
- onSaveComplete();
- });
- }
-
- function getDisplayTime(hours) {
- let minutes = 0;
- const pct = hours % 1;
-
- if (pct) {
- minutes = parseInt(60 * pct);
- }
-
- return datetime.getDisplayTime(new Date(2000, 1, 1, hours, minutes, 0, 0));
- }
-
- function showSchedulePopup(page, schedule, index) {
- schedule = schedule || {};
- import('../../../components/accessSchedule/accessSchedule').then(({default: accessschedule}) => {
- accessschedule.show({
- schedule: schedule
- }).then(function (updatedSchedule) {
- const schedules = getSchedulesFromPage(page);
-
- if (index == -1) {
- index = schedules.length;
- }
-
- schedules[index] = updatedSchedule;
- renderAccessSchedule(page, schedules);
- });
- });
- }
-
- function getSchedulesFromPage(page) {
- return $('.liSchedule', page).map(function () {
- return {
- DayOfWeek: this.getAttribute('data-day'),
- StartHour: this.getAttribute('data-start'),
- EndHour: this.getAttribute('data-end')
- };
- }).get();
- }
-
- function getBlockedTagsFromPage(page) {
- return $('.blockedTag', page).map(function () {
- return this.getAttribute('data-tag');
- }).get();
- }
-
- function showBlockedTagPopup(page) {
- import('../../../components/prompt/prompt').then(({default: prompt}) => {
- prompt({
- label: globalize.translate('LabelTag')
- }).then(function (value) {
- const tags = getBlockedTagsFromPage(page);
-
- if (tags.indexOf(value) == -1) {
- tags.push(value);
- loadBlockedTags(page, tags);
- }
- });
- });
- }
-
- window.UserParentalControlPage = {
- onSubmit: function () {
- const page = $(this).parents('.page');
- loading.show();
- const userId = getParameterByName('userId');
- ApiClient.getUser(userId).then(function (result) {
- saveUser(result, page);
- });
- return false;
- }
- };
- $(document).on('pageinit', '#userParentalControlPage', function () {
- const page = this;
- $('.btnAddSchedule', page).on('click', function () {
- showSchedulePopup(page, {}, -1);
- });
- $('.btnAddBlockedTag', page).on('click', function () {
- showBlockedTagPopup(page);
- });
- $('.userParentalControlForm').off('submit', UserParentalControlPage.onSubmit).on('submit', UserParentalControlPage.onSubmit);
- }).on('pageshow', '#userParentalControlPage', function () {
- const page = this;
- loading.show();
- const userId = getParameterByName('userId');
- const promise1 = ApiClient.getUser(userId);
- const promise2 = ApiClient.getParentalRatings();
- Promise.all([promise1, promise2]).then(function (responses) {
- loadUser(page, responses[0], responses[1]);
- });
- });
-
-/* eslint-enable indent */
diff --git a/src/controllers/itemDetails/index.js b/src/controllers/itemDetails/index.js
index 4bc07ad1f7..c5287093af 100644
--- a/src/controllers/itemDetails/index.js
+++ b/src/controllers/itemDetails/index.js
@@ -33,6 +33,12 @@ import ServerConnections from '../../components/ServerConnections';
import confirm from '../../components/confirm/confirm';
import { download } from '../../scripts/fileDownloader';
+function autoFocus(container) {
+ import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
+ autoFocuser.autoFocus(container);
+ });
+}
+
function getPromise(apiClient, params) {
const id = params.id;
@@ -368,12 +374,12 @@ function reloadPlayButtons(page, item) {
hideAll(page, 'btnShuffle');
}
- const btnResume = page.querySelector('.mainDetailButtons .btnResume');
- const btnPlay = page.querySelector('.mainDetailButtons .btnPlay');
- if (layoutManager.tv && !btnResume.classList.contains('hide')) {
- btnResume.classList.add('fab');
- } else if (layoutManager.tv && btnResume.classList.contains('hide')) {
- btnPlay.classList.add('fab');
+ if (layoutManager.tv) {
+ const btnResume = page.querySelector('.mainDetailButtons .btnResume');
+ const btnPlay = page.querySelector('.mainDetailButtons .btnPlay');
+ const resumeHidden = btnResume.classList.contains('hide');
+ btnResume.classList.toggle('raised', !resumeHidden);
+ btnPlay.classList.toggle('raised', resumeHidden);
}
return canPlay;
@@ -634,12 +640,6 @@ function reloadFromItem(instance, page, params, item, user) {
setInitialCollapsibleState(page, item, apiClient, params.context, user);
const canPlay = reloadPlayButtons(page, item);
- if ((item.LocalTrailerCount || item.RemoteTrailers && item.RemoteTrailers.length) && playbackManager.getSupportedCommands().indexOf('PlayTrailers') !== -1) {
- hideAll(page, 'btnPlayTrailer', true);
- } else {
- hideAll(page, 'btnPlayTrailer');
- }
-
setTrailerButtonVisibility(page, item);
if (item.Type !== 'Program' || canPlay) {
@@ -727,9 +727,7 @@ function reloadFromItem(instance, page, params, item, user) {
hideAll(page, 'btnDownload', true);
}
- import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
- autoFocuser.autoFocus(page);
- });
+ autoFocus(page);
}
function logoImageUrl(item, apiClient, options) {
@@ -921,7 +919,7 @@ function setInitialCollapsibleState(page, item, apiClient, context, user) {
renderScenes(page, item);
- if (item.SpecialFeatureCount && item.SpecialFeatureCount != 0 && item.Type != 'Series') {
+ if (item.SpecialFeatureCount > 0) {
page.querySelector('#specialsCollapsible').classList.remove('hide');
renderSpecials(page, item, user);
} else {
@@ -1756,9 +1754,7 @@ function renderCollectionItems(page, parentItem, types, items) {
// HACK: Call autoFocuser again because btnPlay may be hidden, but focused by reloadFromItem
// FIXME: Sometimes focus does not move until all (?) sections are loaded
- import('../../components/autoFocuser').then(({ default: autoFocuser }) => {
- autoFocuser.autoFocus(page);
- });
+ autoFocus(page);
}
function renderCollectionItemType(page, parentItem, type, items) {
@@ -2060,6 +2056,7 @@ export default function (view, params) {
currentItem.UserData = userData;
reloadPlayButtons(view, currentItem);
refreshImage(view, currentItem);
+ autoFocus(view);
}
}
}
diff --git a/src/controllers/list.html b/src/controllers/list.html
index 72dd983d6e..e5292522a1 100644
--- a/src/controllers/list.html
+++ b/src/controllers/list.html
@@ -3,6 +3,7 @@