1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

remove legacy jquery function from source

This commit is contained in:
dkanada 2020-05-25 14:59:57 +09:00
parent ca4001f5b7
commit 739473c0fb
11 changed files with 76 additions and 103 deletions

View file

@ -1,4 +1,4 @@
define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'fnchecked'], function ($, loading, libraryMenu, globalize) {
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
'use strict';
function loadDeleteFolders(page, user, mediaFolders) {
@ -27,7 +27,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'fnchecked'], function
}
$('.deleteAccess', page).html(html).trigger('create');
$('#chkEnableDeleteAllFolders', page).checked(user.Policy.EnableContentDeletion).trigger('change');
$('#chkEnableDeleteAllFolders', page).checked = user.Policy.EnableContentDeletion;
});
}
@ -85,23 +85,23 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'fnchecked'], function
libraryMenu.setTitle(user.Name);
page.querySelector('.username').innerHTML = user.Name;
$('#txtUserName', page).val(user.Name);
$('#chkIsAdmin', page).checked(user.Policy.IsAdministrator);
$('#chkDisabled', page).checked(user.Policy.IsDisabled);
$('#chkIsHidden', page).checked(user.Policy.IsHidden);
$('#chkRemoteControlSharedDevices', page).checked(user.Policy.EnableSharedDeviceControl);
$('#chkEnableRemoteControlOtherUsers', page).checked(user.Policy.EnableRemoteControlOfOtherUsers);
$('#chkEnableDownloading', page).checked(user.Policy.EnableContentDownloading);
$('#chkManageLiveTv', page).checked(user.Policy.EnableLiveTvManagement);
$('#chkEnableLiveTvAccess', page).checked(user.Policy.EnableLiveTvAccess);
$('#chkEnableMediaPlayback', page).checked(user.Policy.EnableMediaPlayback);
$('#chkEnableAudioPlaybackTranscoding', page).checked(user.Policy.EnableAudioPlaybackTranscoding);
$('#chkEnableVideoPlaybackTranscoding', page).checked(user.Policy.EnableVideoPlaybackTranscoding);
$('#chkEnableVideoPlaybackRemuxing', page).checked(user.Policy.EnablePlaybackRemuxing);
$('#chkForceRemoteSourceTranscoding', page).checked(user.Policy.ForceRemoteSourceTranscoding);
$('#chkRemoteAccess', page).checked(null == user.Policy.EnableRemoteAccess || user.Policy.EnableRemoteAccess);
$('#chkEnableSyncTranscoding', page).checked(user.Policy.EnableSyncTranscoding);
$('#chkEnableConversion', page).checked(user.Policy.EnableMediaConversion || false);
$('#chkEnableSharing', page).checked(user.Policy.EnablePublicSharing);
$('#chkIsAdmin', page).checked = user.Policy.IsAdministrator;
$('#chkDisabled', page).checked = user.Policy.IsDisabled;
$('#chkIsHidden', page).checked = user.Policy.IsHidden;
$('#chkRemoteControlSharedDevices', page).checked = user.Policy.EnableSharedDeviceControl;
$('#chkEnableRemoteControlOtherUsers', page).checked = user.Policy.EnableRemoteControlOfOtherUsers;
$('#chkEnableDownloading', page).checked = user.Policy.EnableContentDownloading;
$('#chkManageLiveTv', page).checked = user.Policy.EnableLiveTvManagement;
$('#chkEnableLiveTvAccess', page).checked = user.Policy.EnableLiveTvAccess;
$('#chkEnableMediaPlayback', page).checked = user.Policy.EnableMediaPlayback;
$('#chkEnableAudioPlaybackTranscoding', page).checked = user.Policy.EnableAudioPlaybackTranscoding;
$('#chkEnableVideoPlaybackTranscoding', page).checked = user.Policy.EnableVideoPlaybackTranscoding;
$('#chkEnableVideoPlaybackRemuxing', page).checked = user.Policy.EnablePlaybackRemuxing;
$('#chkForceRemoteSourceTranscoding', page).checked = user.Policy.ForceRemoteSourceTranscoding;
$('#chkRemoteAccess', page).checked = null == user.Policy.EnableRemoteAccess || user.Policy.EnableRemoteAccess;
$('#chkEnableSyncTranscoding', page).checked = user.Policy.EnableSyncTranscoding;
$('#chkEnableConversion', page).checked = user.Policy.EnableMediaConversion || false;
$('#chkEnableSharing', page).checked = user.Policy.EnablePublicSharing;
$('#txtRemoteClientBitrateLimit', page).val(user.Policy.RemoteClientBitrateLimit / 1e6 || '');
$('#txtLoginAttemptsBeforeLockout', page).val(user.Policy.LoginAttemptsBeforeLockout || '0');
loading.hide();
@ -118,28 +118,28 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'fnchecked'], function
function saveUser(user, page) {
user.Name = $('#txtUserName', page).val();
user.Policy.IsAdministrator = $('#chkIsAdmin', page).checked();
user.Policy.IsHidden = $('#chkIsHidden', page).checked();
user.Policy.IsDisabled = $('#chkDisabled', page).checked();
user.Policy.EnableRemoteControlOfOtherUsers = $('#chkEnableRemoteControlOtherUsers', page).checked();
user.Policy.EnableLiveTvManagement = $('#chkManageLiveTv', page).checked();
user.Policy.EnableLiveTvAccess = $('#chkEnableLiveTvAccess', page).checked();
user.Policy.EnableSharedDeviceControl = $('#chkRemoteControlSharedDevices', page).checked();
user.Policy.EnableMediaPlayback = $('#chkEnableMediaPlayback', page).checked();
user.Policy.EnableAudioPlaybackTranscoding = $('#chkEnableAudioPlaybackTranscoding', page).checked();
user.Policy.EnableVideoPlaybackTranscoding = $('#chkEnableVideoPlaybackTranscoding', page).checked();
user.Policy.EnablePlaybackRemuxing = $('#chkEnableVideoPlaybackRemuxing', page).checked();
user.Policy.ForceRemoteSourceTranscoding = $('#chkForceRemoteSourceTranscoding', page).checked();
user.Policy.EnableContentDownloading = $('#chkEnableDownloading', page).checked();
user.Policy.EnableSyncTranscoding = $('#chkEnableSyncTranscoding', page).checked();
user.Policy.EnableMediaConversion = $('#chkEnableConversion', page).checked();
user.Policy.EnablePublicSharing = $('#chkEnableSharing', page).checked();
user.Policy.EnableRemoteAccess = $('#chkRemoteAccess', page).checked();
user.Policy.IsAdministrator = $('#chkIsAdmin', page).checked;
user.Policy.IsHidden = $('#chkIsHidden', page).checked;
user.Policy.IsDisabled = $('#chkDisabled', page).checked;
user.Policy.EnableRemoteControlOfOtherUsers = $('#chkEnableRemoteControlOtherUsers', page).checked;
user.Policy.EnableLiveTvManagement = $('#chkManageLiveTv', page).checked;
user.Policy.EnableLiveTvAccess = $('#chkEnableLiveTvAccess', page).checked;
user.Policy.EnableSharedDeviceControl = $('#chkRemoteControlSharedDevices', page).checked;
user.Policy.EnableMediaPlayback = $('#chkEnableMediaPlayback', page).checked;
user.Policy.EnableAudioPlaybackTranscoding = $('#chkEnableAudioPlaybackTranscoding', page).checked;
user.Policy.EnableVideoPlaybackTranscoding = $('#chkEnableVideoPlaybackTranscoding', page).checked;
user.Policy.EnablePlaybackRemuxing = $('#chkEnableVideoPlaybackRemuxing', page).checked;
user.Policy.ForceRemoteSourceTranscoding = $('#chkForceRemoteSourceTranscoding', page).checked;
user.Policy.EnableContentDownloading = $('#chkEnableDownloading', page).checked;
user.Policy.EnableSyncTranscoding = $('#chkEnableSyncTranscoding', page).checked;
user.Policy.EnableMediaConversion = $('#chkEnableConversion', page).checked;
user.Policy.EnablePublicSharing = $('#chkEnableSharing', page).checked;
user.Policy.EnableRemoteAccess = $('#chkRemoteAccess', page).checked;
user.Policy.RemoteClientBitrateLimit = parseInt(1e6 * parseFloat($('#txtRemoteClientBitrateLimit', page).val() || '0'));
user.Policy.LoginAttemptsBeforeLockout = parseInt($('#txtLoginAttemptsBeforeLockout', page).val() || '0');
user.Policy.AuthenticationProviderId = page.querySelector('.selectLoginProvider').value;
user.Policy.PasswordResetProviderId = page.querySelector('.selectPasswordResetProvider').value;
user.Policy.EnableContentDeletion = $('#chkEnableDeleteAllFolders', page).checked();
user.Policy.EnableContentDeletion = $('#chkEnableDeleteAllFolders', page).checked;
user.Policy.EnableContentDeletionFromFolders = user.Policy.EnableContentDeletion ? [] : $('.chkFolder', page).get().filter(function (c) {
return c.checked;
}).map(function (c) {

View file

@ -1,4 +1,4 @@
define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'fnchecked'], function ($, loading, libraryMenu, globalize) {
define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading, libraryMenu, globalize) {
'use strict';
function triggerChange(select) {
@ -47,7 +47,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'fnchecked'], function
$('.channelAccessContainer', page).hide();
}
$('#chkEnableAllChannels', page).checked(user.Policy.EnableAllChannels).trigger('change');
$('#chkEnableAllChannels', page).checked = user.Policy.EnableAllChannels;
}
function loadDevices(page, user, devices) {
@ -63,7 +63,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'fnchecked'], function
html += '</div>';
$('.deviceAccess', page).show().html(html);
$('#chkEnableAllDevices', page).checked(user.Policy.EnableAllDevices).trigger('change');
$('#chkEnableAllDevices', page).checked = user.Policy.EnableAllDevices;
if (user.Policy.IsAdministrator) {
page.querySelector('.deviceAccessContainer').classList.add('hide');
@ -90,19 +90,19 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize', 'fnchecked'], function
}
function saveUser(user, page) {
user.Policy.EnableAllFolders = $('#chkEnableAllFolders', page).checked();
user.Policy.EnableAllFolders = $('#chkEnableAllFolders', page).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).checked();
user.Policy.EnableAllChannels = $('#chkEnableAllChannels', page).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).checked();
user.Policy.EnableAllDevices = $('#chkEnableAllDevices', page).checked;
user.Policy.EnabledDevices = user.Policy.EnableAllDevices ? [] : $('.chkDevice', page).get().filter(function (c) {
return c.checked;
}).map(function (c) {

View file

@ -1,4 +1,4 @@
define(['jQuery', 'loading', 'globalize', 'fnchecked', 'emby-checkbox'], function ($, loading, globalize) {
define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading, globalize) {
'use strict';
function loadMediaFolders(page, mediaFolders) {
@ -13,7 +13,7 @@ define(['jQuery', 'loading', 'globalize', 'fnchecked', 'emby-checkbox'], functio
html += '</div>';
$('.folderAccess', page).html(html).trigger('create');
$('#chkEnableAllFolders', page).checked(false).trigger('change');
$('#chkEnableAllFolders', page).checked = false;
}
function loadChannels(page, channels) {
@ -35,7 +35,7 @@ define(['jQuery', 'loading', 'globalize', 'fnchecked', 'emby-checkbox'], functio
$('.channelAccessContainer', page).hide();
}
$('#chkEnableAllChannels', page).checked(false).trigger('change');
$('#chkEnableAllChannels', page).checked = false;
}
function loadUser(page) {
@ -58,7 +58,7 @@ define(['jQuery', 'loading', 'globalize', 'fnchecked', 'emby-checkbox'], functio
user.Name = $('#txtUsername', page).val();
user.Password = $('#txtPassword', page).val();
ApiClient.createUser(user).then(function (user) {
user.Policy.EnableAllFolders = $('#chkEnableAllFolders', page).checked();
user.Policy.EnableAllFolders = $('#chkEnableAllFolders', page).checked;
user.Policy.EnabledFolders = [];
if (!user.Policy.EnableAllFolders) {
@ -69,7 +69,7 @@ define(['jQuery', 'loading', 'globalize', 'fnchecked', 'emby-checkbox'], functio
});
}
user.Policy.EnableAllChannels = $('#chkEnableAllChannels', page).checked();
user.Policy.EnableAllChannels = $('#chkEnableAllChannels', page).checked;
user.Policy.EnabledChannels = [];
if (!user.Policy.EnableAllChannels) {