mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Merge pull request #1546 from Camc314/migrate-to-ES6-13
Migration of user to ES6 Modules
This commit is contained in:
commit
41c94463bb
7 changed files with 203 additions and 165 deletions
|
@ -179,6 +179,12 @@
|
||||||
"src/controllers/dashboard/networking.js",
|
"src/controllers/dashboard/networking.js",
|
||||||
"src/controllers/dashboard/playback.js",
|
"src/controllers/dashboard/playback.js",
|
||||||
"src/controllers/dashboard/plugins/repositories.js",
|
"src/controllers/dashboard/plugins/repositories.js",
|
||||||
|
"src/controllers/dashboard/users/useredit.js",
|
||||||
|
"src/controllers/dashboard/users/userlibraryaccess.js",
|
||||||
|
"src/controllers/dashboard/users/usernew.js",
|
||||||
|
"src/controllers/dashboard/users/userparentalcontrol.js",
|
||||||
|
"src/controllers/dashboard/users/userpasswordpage.js",
|
||||||
|
"src/controllers/dashboard/users/userprofilespage.js",
|
||||||
"src/controllers/wizard/finish.js",
|
"src/controllers/wizard/finish.js",
|
||||||
"src/controllers/wizard/remoteaccess.js",
|
"src/controllers/wizard/remoteaccess.js",
|
||||||
"src/controllers/wizard/settings.js",
|
"src/controllers/wizard/settings.js",
|
||||||
|
|
|
@ -1,25 +1,27 @@
|
||||||
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 loadDeleteFolders(page, user, mediaFolders) {
|
function loadDeleteFolders(page, user, mediaFolders) {
|
||||||
ApiClient.getJSON(ApiClient.getUrl('Channels', {
|
ApiClient.getJSON(ApiClient.getUrl('Channels', {
|
||||||
SupportsMediaDeletion: true
|
SupportsMediaDeletion: true
|
||||||
})).then(function (channelsResult) {
|
})).then(function (channelsResult) {
|
||||||
var i;
|
let folder;
|
||||||
var length;
|
let isChecked;
|
||||||
var folder;
|
let checkedAttribute;
|
||||||
var isChecked;
|
let html = '';
|
||||||
var checkedAttribute;
|
|
||||||
var html = '';
|
|
||||||
|
|
||||||
for (i = 0, length = mediaFolders.length; i < length; i++) {
|
for (let i = 0, length = mediaFolders.length; i < length; i++) {
|
||||||
folder = mediaFolders[i];
|
folder = mediaFolders[i];
|
||||||
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id);
|
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id);
|
||||||
checkedAttribute = isChecked ? ' checked="checked"' : '';
|
checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, length = channelsResult.Items.length; i < length; i++) {
|
for (let i = 0, length = channelsResult.Items.length; i < length; i++) {
|
||||||
folder = channelsResult.Items[i];
|
folder = channelsResult.Items[i];
|
||||||
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id);
|
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id);
|
||||||
checkedAttribute = isChecked ? ' checked="checked"' : '';
|
checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||||
|
@ -38,9 +40,9 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
page.querySelector('.fldSelectLoginProvider').classList.add('hide');
|
page.querySelector('.fldSelectLoginProvider').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentProviderId = user.Policy.AuthenticationProviderId;
|
const currentProviderId = user.Policy.AuthenticationProviderId;
|
||||||
page.querySelector('.selectLoginProvider').innerHTML = providers.map(function (provider) {
|
page.querySelector('.selectLoginProvider').innerHTML = providers.map(function (provider) {
|
||||||
var selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
const selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||||
return '<option value="' + provider.Id + '"' + selected + '>' + provider.Name + '</option>';
|
return '<option value="' + provider.Id + '"' + selected + '>' + provider.Name + '</option>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52,15 +54,14 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
page.querySelector('.fldSelectPasswordResetProvider').classList.add('hide');
|
page.querySelector('.fldSelectPasswordResetProvider').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentProviderId = user.Policy.PasswordResetProviderId;
|
const currentProviderId = user.Policy.PasswordResetProviderId;
|
||||||
page.querySelector('.selectPasswordResetProvider').innerHTML = providers.map(function (provider) {
|
page.querySelector('.selectPasswordResetProvider').innerHTML = providers.map(function (provider) {
|
||||||
var selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
const selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||||
return '<option value="' + provider.Id + '"' + selected + '>' + provider.Name + '</option>';
|
return '<option value="' + provider.Id + '"' + selected + '>' + provider.Name + '</option>';
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadUser(page, user) {
|
function loadUser(page, user) {
|
||||||
currentUser = user;
|
|
||||||
ApiClient.getJSON(ApiClient.getUrl('Auth/Providers')).then(function (providers) {
|
ApiClient.getJSON(ApiClient.getUrl('Auth/Providers')).then(function (providers) {
|
||||||
loadAuthProviders(page, user, providers);
|
loadAuthProviders(page, user, providers);
|
||||||
});
|
});
|
||||||
|
@ -112,7 +113,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
Dashboard.navigate('userprofiles.html');
|
Dashboard.navigate('userprofiles.html');
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -155,7 +156,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
var page = $(this).parents('.page')[0];
|
const page = $(this).parents('.page')[0];
|
||||||
loading.show();
|
loading.show();
|
||||||
getUser().then(function (result) {
|
getUser().then(function (result) {
|
||||||
saveUser(result, page);
|
saveUser(result, page);
|
||||||
|
@ -164,7 +165,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUser() {
|
function getUser() {
|
||||||
var userId = getParameterByName('userId');
|
const userId = getParameterByName('userId');
|
||||||
return ApiClient.getUser(userId);
|
return ApiClient.getUser(userId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -175,11 +176,10 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentUser;
|
|
||||||
$(document).on('pageinit', '#editUserPage', function () {
|
$(document).on('pageinit', '#editUserPage', function () {
|
||||||
$('.editUserProfileForm').off('submit', onSubmit).on('submit', onSubmit);
|
$('.editUserProfileForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||||
this.querySelector('.sharingHelp').innerHTML = globalize.translate('OptionAllowLinkSharingHelp', 30);
|
this.querySelector('.sharingHelp').innerHTML = globalize.translate('OptionAllowLinkSharingHelp', 30);
|
||||||
var page = this;
|
const page = this;
|
||||||
$('#chkEnableDeleteAllFolders', this).on('change', function () {
|
$('#chkEnableDeleteAllFolders', this).on('change', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
$('.deleteAccess', page).hide();
|
$('.deleteAccess', page).hide();
|
||||||
|
@ -197,4 +197,5 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}).on('pagebeforeshow', '#editUserPage', function () {
|
}).on('pagebeforeshow', '#editUserPage', function () {
|
||||||
loadData(this);
|
loadData(this);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,40 +1,44 @@
|
||||||
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 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);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadMediaFolders(page, user, mediaFolders) {
|
function loadMediaFolders(page, user, mediaFolders) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderLibraries') + '</h3>';
|
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderLibraries') + '</h3>';
|
||||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||||
|
|
||||||
for (var i = 0, length = mediaFolders.length; i < length; i++) {
|
for (let i = 0, length = mediaFolders.length; i < length; i++) {
|
||||||
var folder = mediaFolders[i];
|
const folder = mediaFolders[i];
|
||||||
var isChecked = user.Policy.EnableAllFolders || -1 != user.Policy.EnabledFolders.indexOf(folder.Id);
|
const isChecked = user.Policy.EnableAllFolders || -1 != user.Policy.EnabledFolders.indexOf(folder.Id);
|
||||||
var checkedAttribute = isChecked ? ' checked="checked"' : '';
|
const checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
page.querySelector('.folderAccess').innerHTML = html;
|
page.querySelector('.folderAccess').innerHTML = html;
|
||||||
var chkEnableAllFolders = page.querySelector('#chkEnableAllFolders');
|
const chkEnableAllFolders = page.querySelector('#chkEnableAllFolders');
|
||||||
chkEnableAllFolders.checked = user.Policy.EnableAllFolders;
|
chkEnableAllFolders.checked = user.Policy.EnableAllFolders;
|
||||||
triggerChange(chkEnableAllFolders);
|
triggerChange(chkEnableAllFolders);
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadChannels(page, user, channels) {
|
function loadChannels(page, user, channels) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderChannels') + '</h3>';
|
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderChannels') + '</h3>';
|
||||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||||
|
|
||||||
for (var i = 0, length = channels.length; i < length; i++) {
|
for (let i = 0, length = channels.length; i < length; i++) {
|
||||||
var folder = channels[i];
|
const folder = channels[i];
|
||||||
var isChecked = user.Policy.EnableAllChannels || -1 != user.Policy.EnabledChannels.indexOf(folder.Id);
|
const isChecked = user.Policy.EnableAllChannels || -1 != user.Policy.EnabledChannels.indexOf(folder.Id);
|
||||||
var checkedAttribute = isChecked ? ' checked="checked"' : '';
|
const checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,13 +55,13 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadDevices(page, user, devices) {
|
function loadDevices(page, user, devices) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderDevices') + '</h3>';
|
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderDevices') + '</h3>';
|
||||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||||
|
|
||||||
for (var i = 0, length = devices.length; i < length; i++) {
|
for (let i = 0, length = devices.length; i < length; i++) {
|
||||||
var device = devices[i];
|
const device = devices[i];
|
||||||
var checkedAttribute = user.Policy.EnableAllDevices || -1 != user.Policy.EnabledDevices.indexOf(device.Id) ? ' checked="checked"' : '';
|
const checkedAttribute = user.Policy.EnableAllDevices || -1 != user.Policy.EnabledDevices.indexOf(device.Id) ? ' checked="checked"' : '';
|
||||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkDevice" data-id="' + device.Id + '" ' + checkedAttribute + '><span>' + device.Name + ' - ' + device.AppName + '</span></label>';
|
html += '<label><input type="checkbox" is="emby-checkbox" class="chkDevice" data-id="' + device.Id + '" ' + checkedAttribute + '><span>' + device.Name + ' - ' + device.AppName + '</span></label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -84,7 +88,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
function onSaveComplete(page) {
|
function onSaveComplete(page) {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -116,9 +120,9 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
var page = $(this).parents('.page');
|
const page = $(this).parents('.page');
|
||||||
loading.show();
|
loading.show();
|
||||||
var userId = getParameterByName('userId');
|
const userId = getParameterByName('userId');
|
||||||
ApiClient.getUser(userId).then(function (result) {
|
ApiClient.getUser(userId).then(function (result) {
|
||||||
saveUser(result, page);
|
saveUser(result, page);
|
||||||
});
|
});
|
||||||
|
@ -126,7 +130,7 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pageinit', '#userLibraryAccessPage', function () {
|
$(document).on('pageinit', '#userLibraryAccessPage', function () {
|
||||||
var page = this;
|
const page = this;
|
||||||
$('#chkEnableAllDevices', page).on('change', function () {
|
$('#chkEnableAllDevices', page).on('change', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
$('.deviceAccessListContainer', page).hide();
|
$('.deviceAccessListContainer', page).hide();
|
||||||
|
@ -150,29 +154,30 @@ define(['jQuery', 'loading', 'libraryMenu', 'globalize'], function ($, loading,
|
||||||
});
|
});
|
||||||
$('.userLibraryAccessForm').off('submit', onSubmit).on('submit', onSubmit);
|
$('.userLibraryAccessForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||||
}).on('pageshow', '#userLibraryAccessPage', function () {
|
}).on('pageshow', '#userLibraryAccessPage', function () {
|
||||||
var page = this;
|
const page = this;
|
||||||
loading.show();
|
loading.show();
|
||||||
var promise1;
|
let promise1;
|
||||||
var userId = getParameterByName('userId');
|
const userId = getParameterByName('userId');
|
||||||
|
|
||||||
if (userId) {
|
if (userId) {
|
||||||
promise1 = ApiClient.getUser(userId);
|
promise1 = ApiClient.getUser(userId);
|
||||||
} else {
|
} else {
|
||||||
var deferred = $.Deferred();
|
const deferred = $.Deferred();
|
||||||
deferred.resolveWith(null, [{
|
deferred.resolveWith(null, [{
|
||||||
Configuration: {}
|
Configuration: {}
|
||||||
}]);
|
}]);
|
||||||
promise1 = deferred.promise();
|
promise1 = deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
var promise2 = Dashboard.getCurrentUser();
|
const promise2 = Dashboard.getCurrentUser();
|
||||||
var promise4 = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
const promise4 = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||||
IsHidden: false
|
IsHidden: false
|
||||||
}));
|
}));
|
||||||
var promise5 = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
const promise5 = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||||
var promise6 = ApiClient.getJSON(ApiClient.getUrl('Devices'));
|
const promise6 = ApiClient.getJSON(ApiClient.getUrl('Devices'));
|
||||||
Promise.all([promise1, promise2, promise4, promise5, promise6]).then(function (responses) {
|
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);
|
loadUser(page, responses[0], responses[1], responses[2].Items, responses[3].Items, responses[4].Items);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,13 +1,17 @@
|
||||||
define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import loading from 'loading';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'emby-checkbox';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function loadMediaFolders(page, mediaFolders) {
|
function loadMediaFolders(page, mediaFolders) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderLibraries') + '</h3>';
|
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderLibraries') + '</h3>';
|
||||||
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
||||||
|
|
||||||
for (var i = 0; i < mediaFolders.length; i++) {
|
for (let i = 0; i < mediaFolders.length; i++) {
|
||||||
var folder = mediaFolders[i];
|
const folder = mediaFolders[i];
|
||||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '"/><span>' + folder.Name + '</span></label>';
|
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '"/><span>' + folder.Name + '</span></label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -17,12 +21,12 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadChannels(page, channels) {
|
function loadChannels(page, channels) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderChannels') + '</h3>';
|
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderChannels') + '</h3>';
|
||||||
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
||||||
|
|
||||||
for (var i = 0; i < channels.length; i++) {
|
for (let i = 0; i < channels.length; i++) {
|
||||||
var folder = channels[i];
|
const folder = channels[i];
|
||||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '"/><span>' + folder.Name + '</span></label>';
|
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '"/><span>' + folder.Name + '</span></label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,10 +46,10 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||||
$('#txtUsername', page).val('');
|
$('#txtUsername', page).val('');
|
||||||
$('#txtPassword', page).val('');
|
$('#txtPassword', page).val('');
|
||||||
loading.show();
|
loading.show();
|
||||||
var promiseFolders = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
const promiseFolders = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||||
IsHidden: false
|
IsHidden: false
|
||||||
}));
|
}));
|
||||||
var promiseChannels = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
const promiseChannels = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||||
Promise.all([promiseFolders, promiseChannels]).then(function (responses) {
|
Promise.all([promiseFolders, promiseChannels]).then(function (responses) {
|
||||||
loadMediaFolders(page, responses[0].Items);
|
loadMediaFolders(page, responses[0].Items);
|
||||||
loadChannels(page, responses[1].Items);
|
loadChannels(page, responses[1].Items);
|
||||||
|
@ -54,7 +58,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveUser(page) {
|
function saveUser(page) {
|
||||||
var user = {};
|
const user = {};
|
||||||
user.Name = $('#txtUsername', page).val();
|
user.Name = $('#txtUsername', page).val();
|
||||||
user.Password = $('#txtPassword', page).val();
|
user.Password = $('#txtPassword', page).val();
|
||||||
ApiClient.createUser(user).then(function (user) {
|
ApiClient.createUser(user).then(function (user) {
|
||||||
|
@ -84,7 +88,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||||
Dashboard.navigate('useredit.html?userId=' + user.Id);
|
Dashboard.navigate('useredit.html?userId=' + user.Id);
|
||||||
});
|
});
|
||||||
}, function (response) {
|
}, function (response) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('DefaultErrorMessage'));
|
toast(globalize.translate('DefaultErrorMessage'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -93,7 +97,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
var page = $(this).parents('.page')[0];
|
const page = $(this).parents('.page')[0];
|
||||||
loading.show();
|
loading.show();
|
||||||
saveUser(page);
|
saveUser(page);
|
||||||
return false;
|
return false;
|
||||||
|
@ -104,7 +108,7 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pageinit', '#newUserPage', function () {
|
$(document).on('pageinit', '#newUserPage', function () {
|
||||||
var page = this;
|
const page = this;
|
||||||
$('#chkEnableAllChannels', page).on('change', function () {
|
$('#chkEnableAllChannels', page).on('change', function () {
|
||||||
if (this.checked) {
|
if (this.checked) {
|
||||||
$('.channelAccessListContainer', page).hide();
|
$('.channelAccessListContainer', page).hide();
|
||||||
|
@ -123,4 +127,5 @@ define(['jQuery', 'loading', 'globalize', 'emby-checkbox'], function ($, loading
|
||||||
}).on('pageshow', '#newUserPage', function () {
|
}).on('pageshow', '#newUserPage', function () {
|
||||||
loadData(this);
|
loadData(this);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,17 +1,22 @@
|
||||||
define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewStyle', 'paper-icon-button-light'], function ($, datetime, loading, libraryMenu, globalize) {
|
import $ from 'jQuery';
|
||||||
'use strict';
|
import datetime from 'datetime';
|
||||||
|
import loading from 'loading';
|
||||||
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'listViewStyle';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function populateRatings(allParentalRatings, page) {
|
function populateRatings(allParentalRatings, page) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += "<option value=''></option>";
|
html += "<option value=''></option>";
|
||||||
var i;
|
let rating;
|
||||||
var length;
|
const ratings = [];
|
||||||
var rating;
|
|
||||||
var ratings = [];
|
|
||||||
|
|
||||||
for (i = 0, length = allParentalRatings.length; i < length; i++) {
|
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||||
if (rating = allParentalRatings[i], ratings.length) {
|
if (rating = allParentalRatings[i], ratings.length) {
|
||||||
var lastRating = ratings[ratings.length - 1];
|
const lastRating = ratings[ratings.length - 1];
|
||||||
|
|
||||||
if (lastRating.Value === rating.Value) {
|
if (lastRating.Value === rating.Value) {
|
||||||
lastRating.Name += '/' + rating.Name;
|
lastRating.Name += '/' + rating.Name;
|
||||||
|
@ -25,7 +30,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0, length = ratings.length; i < length; i++) {
|
for (let i = 0, length = ratings.length; i < length; i++) {
|
||||||
rating = ratings[i];
|
rating = ratings[i];
|
||||||
html += "<option value='" + rating.Value + "'>" + rating.Name + '</option>';
|
html += "<option value='" + rating.Value + "'>" + rating.Name + '</option>';
|
||||||
}
|
}
|
||||||
|
@ -34,7 +39,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadUnratedItems(page, user) {
|
function loadUnratedItems(page, user) {
|
||||||
var items = [{
|
const items = [{
|
||||||
name: globalize.translate('OptionBlockBooks'),
|
name: globalize.translate('OptionBlockBooks'),
|
||||||
value: 'Book'
|
value: 'Book'
|
||||||
}, {
|
}, {
|
||||||
|
@ -56,13 +61,13 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
name: globalize.translate('OptionBlockTvShows'),
|
name: globalize.translate('OptionBlockTvShows'),
|
||||||
value: 'Series'
|
value: 'Series'
|
||||||
}];
|
}];
|
||||||
var html = '';
|
let html = '';
|
||||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderBlockItemsWithNoRating') + '</h3>';
|
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderBlockItemsWithNoRating') + '</h3>';
|
||||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||||
|
|
||||||
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 checkedAttribute = -1 != user.Policy.BlockUnratedItems.indexOf(item.value) ? ' checked="checked"' : '';
|
const checkedAttribute = -1 != user.Policy.BlockUnratedItems.indexOf(item.value) ? ' checked="checked"' : '';
|
||||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkUnratedItem" data-itemtype="' + item.value + '" type="checkbox"' + checkedAttribute + '><span>' + item.name + '</span></label>';
|
html += '<label><input type="checkbox" is="emby-checkbox" class="chkUnratedItem" data-itemtype="' + item.value + '" type="checkbox"' + checkedAttribute + '><span>' + item.name + '</span></label>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,11 +81,11 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
loadUnratedItems(page, user);
|
loadUnratedItems(page, user);
|
||||||
loadBlockedTags(page, user.Policy.BlockedTags);
|
loadBlockedTags(page, user.Policy.BlockedTags);
|
||||||
populateRatings(allParentalRatings, page);
|
populateRatings(allParentalRatings, page);
|
||||||
var ratingValue = '';
|
let ratingValue = '';
|
||||||
|
|
||||||
if (user.Policy.MaxParentalRating) {
|
if (user.Policy.MaxParentalRating) {
|
||||||
for (var i = 0, length = allParentalRatings.length; i < length; i++) {
|
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||||
var rating = allParentalRatings[i];
|
const rating = allParentalRatings[i];
|
||||||
|
|
||||||
if (user.Policy.MaxParentalRating >= rating.Value) {
|
if (user.Policy.MaxParentalRating >= rating.Value) {
|
||||||
ratingValue = rating.Value;
|
ratingValue = rating.Value;
|
||||||
|
@ -101,8 +106,8 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadBlockedTags(page, tags) {
|
function loadBlockedTags(page, tags) {
|
||||||
var html = tags.map(function (h) {
|
let html = tags.map(function (h) {
|
||||||
var li = '<div class="listItem">';
|
let li = '<div class="listItem">';
|
||||||
li += '<div class="listItemBody">';
|
li += '<div class="listItemBody">';
|
||||||
li += '<h3 class="listItemBodyText">';
|
li += '<h3 class="listItemBodyText">';
|
||||||
li += h;
|
li += h;
|
||||||
|
@ -116,10 +121,10 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
html = '<div class="paperList">' + html + '</div>';
|
html = '<div class="paperList">' + html + '</div>';
|
||||||
}
|
}
|
||||||
|
|
||||||
var elem = $('.blockedTags', page).html(html).trigger('create');
|
const elem = $('.blockedTags', page).html(html).trigger('create');
|
||||||
$('.btnDeleteTag', elem).on('click', function () {
|
$('.btnDeleteTag', elem).on('click', function () {
|
||||||
var tag = this.getAttribute('data-tag');
|
const tag = this.getAttribute('data-tag');
|
||||||
var newTags = tags.filter(function (t) {
|
const newTags = tags.filter(function (t) {
|
||||||
return t != tag;
|
return t != tag;
|
||||||
});
|
});
|
||||||
loadBlockedTags(page, newTags);
|
loadBlockedTags(page, newTags);
|
||||||
|
@ -132,10 +137,10 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
}
|
}
|
||||||
|
|
||||||
function renderAccessSchedule(page, schedules) {
|
function renderAccessSchedule(page, schedules) {
|
||||||
var html = '';
|
let html = '';
|
||||||
var index = 0;
|
let index = 0;
|
||||||
html += schedules.map(function (a) {
|
html += schedules.map(function (a) {
|
||||||
var itemHtml = '';
|
let itemHtml = '';
|
||||||
itemHtml += '<div class="liSchedule listItem" data-day="' + a.DayOfWeek + '" data-start="' + a.StartHour + '" data-end="' + a.EndHour + '">';
|
itemHtml += '<div class="liSchedule listItem" data-day="' + a.DayOfWeek + '" data-start="' + a.StartHour + '" data-end="' + a.EndHour + '">';
|
||||||
itemHtml += '<div class="listItemBody two-line">';
|
itemHtml += '<div class="listItemBody two-line">';
|
||||||
itemHtml += '<h3 class="listItemBodyText">';
|
itemHtml += '<h3 class="listItemBodyText">';
|
||||||
|
@ -148,7 +153,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
index++;
|
index++;
|
||||||
return itemHtml;
|
return itemHtml;
|
||||||
}).join('');
|
}).join('');
|
||||||
var accessScheduleList = page.querySelector('.accessScheduleList');
|
const accessScheduleList = page.querySelector('.accessScheduleList');
|
||||||
accessScheduleList.innerHTML = html;
|
accessScheduleList.innerHTML = html;
|
||||||
$('.btnDelete', accessScheduleList).on('click', function () {
|
$('.btnDelete', accessScheduleList).on('click', function () {
|
||||||
deleteAccessSchedule(page, schedules, parseInt(this.getAttribute('data-index')));
|
deleteAccessSchedule(page, schedules, parseInt(this.getAttribute('data-index')));
|
||||||
|
@ -158,7 +163,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
function onSaveComplete(page) {
|
function onSaveComplete(page) {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('SettingsSaved'));
|
toast(globalize.translate('SettingsSaved'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -178,8 +183,8 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
}
|
}
|
||||||
|
|
||||||
function getDisplayTime(hours) {
|
function getDisplayTime(hours) {
|
||||||
var minutes = 0;
|
let minutes = 0;
|
||||||
var pct = hours % 1;
|
const pct = hours % 1;
|
||||||
|
|
||||||
if (pct) {
|
if (pct) {
|
||||||
minutes = parseInt(60 * pct);
|
minutes = parseInt(60 * pct);
|
||||||
|
@ -190,12 +195,11 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
|
|
||||||
function showSchedulePopup(page, schedule, index) {
|
function showSchedulePopup(page, schedule, index) {
|
||||||
schedule = schedule || {};
|
schedule = schedule || {};
|
||||||
|
import('components/accessSchedule/accessSchedule').then(({default: accessschedule}) => {
|
||||||
require(['components/accessSchedule/accessSchedule'], function (accessschedule) {
|
|
||||||
accessschedule.show({
|
accessschedule.show({
|
||||||
schedule: schedule
|
schedule: schedule
|
||||||
}).then(function (updatedSchedule) {
|
}).then(function (updatedSchedule) {
|
||||||
var schedules = getSchedulesFromPage(page);
|
const schedules = getSchedulesFromPage(page);
|
||||||
|
|
||||||
if (-1 == index) {
|
if (-1 == index) {
|
||||||
index = schedules.length;
|
index = schedules.length;
|
||||||
|
@ -224,11 +228,12 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
}
|
}
|
||||||
|
|
||||||
function showBlockedTagPopup(page) {
|
function showBlockedTagPopup(page) {
|
||||||
require(['prompt'], function (prompt) {
|
|
||||||
prompt.default({
|
import('prompt').then(({default: prompt}) => {
|
||||||
|
prompt({
|
||||||
label: globalize.translate('LabelTag')
|
label: globalize.translate('LabelTag')
|
||||||
}).then(function (value) {
|
}).then(function (value) {
|
||||||
var tags = getBlockedTagsFromPage(page);
|
const tags = getBlockedTagsFromPage(page);
|
||||||
|
|
||||||
if (-1 == tags.indexOf(value)) {
|
if (-1 == tags.indexOf(value)) {
|
||||||
tags.push(value);
|
tags.push(value);
|
||||||
|
@ -240,9 +245,9 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
|
|
||||||
window.UserParentalControlPage = {
|
window.UserParentalControlPage = {
|
||||||
onSubmit: function () {
|
onSubmit: function () {
|
||||||
var page = $(this).parents('.page');
|
const page = $(this).parents('.page');
|
||||||
loading.show();
|
loading.show();
|
||||||
var userId = getParameterByName('userId');
|
const userId = getParameterByName('userId');
|
||||||
ApiClient.getUser(userId).then(function (result) {
|
ApiClient.getUser(userId).then(function (result) {
|
||||||
saveUser(result, page);
|
saveUser(result, page);
|
||||||
});
|
});
|
||||||
|
@ -250,7 +255,7 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
$(document).on('pageinit', '#userParentalControlPage', function () {
|
$(document).on('pageinit', '#userParentalControlPage', function () {
|
||||||
var page = this;
|
const page = this;
|
||||||
$('.btnAddSchedule', page).on('click', function () {
|
$('.btnAddSchedule', page).on('click', function () {
|
||||||
showSchedulePopup(page, {}, -1);
|
showSchedulePopup(page, {}, -1);
|
||||||
});
|
});
|
||||||
|
@ -259,13 +264,14 @@ define(['jQuery', 'datetime', 'loading', 'libraryMenu', 'globalize', 'listViewSt
|
||||||
});
|
});
|
||||||
$('.userParentalControlForm').off('submit', UserParentalControlPage.onSubmit).on('submit', UserParentalControlPage.onSubmit);
|
$('.userParentalControlForm').off('submit', UserParentalControlPage.onSubmit).on('submit', UserParentalControlPage.onSubmit);
|
||||||
}).on('pageshow', '#userParentalControlPage', function () {
|
}).on('pageshow', '#userParentalControlPage', function () {
|
||||||
var page = this;
|
const page = this;
|
||||||
loading.show();
|
loading.show();
|
||||||
var userId = getParameterByName('userId');
|
const userId = getParameterByName('userId');
|
||||||
var promise1 = ApiClient.getUser(userId);
|
const promise1 = ApiClient.getUser(userId);
|
||||||
var promise2 = ApiClient.getParentalRatings();
|
const promise2 = ApiClient.getParentalRatings();
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
loadUser(page, responses[0], responses[1]);
|
loadUser(page, responses[0], responses[1]);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,14 +1,18 @@
|
||||||
define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading, libraryMenu, globalize) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import libraryMenu from 'libraryMenu';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import 'emby-button';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function loadUser(page, params) {
|
function loadUser(page, params) {
|
||||||
var userid = params.userId;
|
const userid = params.userId;
|
||||||
ApiClient.getUser(userid).then(function (user) {
|
ApiClient.getUser(userid).then(function (user) {
|
||||||
Dashboard.getCurrentUser().then(function (loggedInUser) {
|
Dashboard.getCurrentUser().then(function (loggedInUser) {
|
||||||
libraryMenu.setTitle(user.Name);
|
libraryMenu.setTitle(user.Name);
|
||||||
page.querySelector('.username').innerHTML = user.Name;
|
page.querySelector('.username').innerHTML = user.Name;
|
||||||
var showPasswordSection = true;
|
let showPasswordSection = true;
|
||||||
var showLocalAccessSection = false;
|
let showLocalAccessSection = false;
|
||||||
|
|
||||||
if ('Guest' == user.ConnectLinkType) {
|
if ('Guest' == user.ConnectLinkType) {
|
||||||
page.querySelector('.localAccessSection').classList.add('hide');
|
page.querySelector('.localAccessSection').classList.add('hide');
|
||||||
|
@ -34,7 +38,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
page.querySelector('.localAccessSection').classList.add('hide');
|
page.querySelector('.localAccessSection').classList.add('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
var txtEasyPassword = page.querySelector('#txtEasyPassword');
|
const txtEasyPassword = page.querySelector('#txtEasyPassword');
|
||||||
txtEasyPassword.value = '';
|
txtEasyPassword.value = '';
|
||||||
|
|
||||||
if (user.HasConfiguredEasyPassword) {
|
if (user.HasConfiguredEasyPassword) {
|
||||||
|
@ -48,7 +52,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
|
|
||||||
page.querySelector('.chkEnableLocalEasyPassword').checked = user.Configuration.EnableLocalPassword;
|
page.querySelector('.chkEnableLocalEasyPassword').checked = user.Configuration.EnableLocalPassword;
|
||||||
|
|
||||||
require(['autoFocuser'], function (autoFocuser) {
|
import('autoFocuser').then(({default: autoFocuser}) => {
|
||||||
autoFocuser.autoFocus(page);
|
autoFocuser.autoFocus(page);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -58,10 +62,10 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
page.querySelector('#txtNewPasswordConfirm').value = '';
|
page.querySelector('#txtNewPasswordConfirm').value = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
return function (view, params) {
|
export default function (view, params) {
|
||||||
function saveEasyPassword() {
|
function saveEasyPassword() {
|
||||||
var userId = params.userId;
|
const userId = params.userId;
|
||||||
var easyPassword = view.querySelector('#txtEasyPassword').value;
|
const easyPassword = view.querySelector('#txtEasyPassword').value;
|
||||||
|
|
||||||
if (easyPassword) {
|
if (easyPassword) {
|
||||||
ApiClient.updateEasyPassword(userId, easyPassword).then(function () {
|
ApiClient.updateEasyPassword(userId, easyPassword).then(function () {
|
||||||
|
@ -78,7 +82,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
ApiClient.updateUserConfiguration(user.Id, user.Configuration).then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('MessageSettingsSaved'));
|
toast(globalize.translate('MessageSettingsSaved'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -88,9 +92,9 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
}
|
}
|
||||||
|
|
||||||
function savePassword() {
|
function savePassword() {
|
||||||
var userId = params.userId;
|
const userId = params.userId;
|
||||||
var currentPassword = view.querySelector('#txtCurrentPassword').value;
|
let currentPassword = view.querySelector('#txtCurrentPassword').value;
|
||||||
var newPassword = view.querySelector('#txtNewPassword').value;
|
const newPassword = view.querySelector('#txtNewPassword').value;
|
||||||
|
|
||||||
if (view.querySelector('#fldCurrentPassword').classList.contains('hide')) {
|
if (view.querySelector('#fldCurrentPassword').classList.contains('hide')) {
|
||||||
// Firefox does not respect autocomplete=off, so clear it if the field is supposed to be hidden (and blank)
|
// Firefox does not respect autocomplete=off, so clear it if the field is supposed to be hidden (and blank)
|
||||||
|
@ -101,7 +105,7 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
ApiClient.updateUserPassword(userId, currentPassword, newPassword).then(function () {
|
ApiClient.updateUserPassword(userId, currentPassword, newPassword).then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('PasswordSaved'));
|
toast(globalize.translate('PasswordSaved'));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -116,10 +120,10 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit(e) {
|
function onSubmit(e) {
|
||||||
var form = this;
|
const form = this;
|
||||||
|
|
||||||
if (form.querySelector('#txtNewPassword').value != form.querySelector('#txtNewPasswordConfirm').value) {
|
if (form.querySelector('#txtNewPassword').value != form.querySelector('#txtNewPasswordConfirm').value) {
|
||||||
require(['toast'], function (toast) {
|
import('toast').then(({default: toast}) => {
|
||||||
toast(globalize.translate('PasswordMatchError'));
|
toast(globalize.translate('PasswordMatchError'));
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -139,11 +143,10 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetPassword() {
|
function resetPassword() {
|
||||||
var msg = globalize.translate('PasswordResetConfirmation');
|
const msg = globalize.translate('PasswordResetConfirmation');
|
||||||
|
import('confirm').then(({default: confirm}) => {
|
||||||
require(['confirm'], function (confirm) {
|
confirm(msg, globalize.translate('PasswordResetHeader')).then(function () {
|
||||||
confirm.default(msg, globalize.translate('PasswordResetHeader')).then(function () {
|
const userId = params.userId;
|
||||||
var userId = params.userId;
|
|
||||||
loading.show();
|
loading.show();
|
||||||
ApiClient.resetUserPassword(userId).then(function () {
|
ApiClient.resetUserPassword(userId).then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
@ -158,11 +161,11 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetEasyPassword() {
|
function resetEasyPassword() {
|
||||||
var msg = globalize.translate('PinCodeResetConfirmation');
|
const msg = globalize.translate('PinCodeResetConfirmation');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
import('confirm').then(({default: confirm}) => {
|
||||||
confirm.default(msg, globalize.translate('HeaderPinCodeReset')).then(function () {
|
confirm(msg, globalize.translate('HeaderPinCodeReset')).then(function () {
|
||||||
var userId = params.userId;
|
const userId = params.userId;
|
||||||
loading.show();
|
loading.show();
|
||||||
ApiClient.resetEasyPassword(userId).then(function () {
|
ApiClient.resetEasyPassword(userId).then(function () {
|
||||||
loading.hide();
|
loading.hide();
|
||||||
|
@ -183,5 +186,6 @@ define(['loading', 'libraryMenu', 'globalize', 'emby-button'], function (loading
|
||||||
view.addEventListener('viewshow', function () {
|
view.addEventListener('viewshow', function () {
|
||||||
loadUser(view, params);
|
loadUser(view, params);
|
||||||
});
|
});
|
||||||
};
|
}
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
|
@ -1,11 +1,21 @@
|
||||||
define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-button-light', 'cardStyle', 'emby-button', 'indicators', 'flexStyles'], function (loading, dom, globalize, datefns, dfnshelper) {
|
import loading from 'loading';
|
||||||
'use strict';
|
import dom from 'dom';
|
||||||
|
import globalize from 'globalize';
|
||||||
|
import * as datefns from 'date-fns';
|
||||||
|
import dfnshelper from 'dfnshelper';
|
||||||
|
import 'paper-icon-button-light';
|
||||||
|
import 'cardStyle';
|
||||||
|
import 'emby-button';
|
||||||
|
import 'indicators';
|
||||||
|
import 'flexStyles';
|
||||||
|
|
||||||
|
/* eslint-disable indent */
|
||||||
|
|
||||||
function deleteUser(page, id) {
|
function deleteUser(page, id) {
|
||||||
var msg = globalize.translate('DeleteUserConfirmation');
|
const msg = globalize.translate('DeleteUserConfirmation');
|
||||||
|
|
||||||
require(['confirm'], function (confirm) {
|
import('confirm').then(({default: confirm}) => {
|
||||||
confirm.default({
|
confirm({
|
||||||
title: globalize.translate('DeleteUser'),
|
title: globalize.translate('DeleteUser'),
|
||||||
text: msg,
|
text: msg,
|
||||||
confirmText: globalize.translate('ButtonDelete'),
|
confirmText: globalize.translate('ButtonDelete'),
|
||||||
|
@ -20,10 +30,10 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
}
|
}
|
||||||
|
|
||||||
function showUserMenu(elem) {
|
function showUserMenu(elem) {
|
||||||
var card = dom.parentWithClass(elem, 'card');
|
const card = dom.parentWithClass(elem, 'card');
|
||||||
var page = dom.parentWithClass(card, 'page');
|
const page = dom.parentWithClass(card, 'page');
|
||||||
var userId = card.getAttribute('data-userid');
|
const userId = card.getAttribute('data-userid');
|
||||||
var menuItems = [];
|
const menuItems = [];
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
name: globalize.translate('ButtonOpen'),
|
name: globalize.translate('ButtonOpen'),
|
||||||
id: 'open',
|
id: 'open',
|
||||||
|
@ -45,7 +55,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
icon: 'delete'
|
icon: 'delete'
|
||||||
});
|
});
|
||||||
|
|
||||||
require(['actionsheet'], function (actionsheet) {
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: card,
|
positionTo: card,
|
||||||
|
@ -72,8 +82,8 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
}
|
}
|
||||||
|
|
||||||
function getUserHtml(user, addConnectIndicator) {
|
function getUserHtml(user, addConnectIndicator) {
|
||||||
var html = '';
|
let html = '';
|
||||||
var cssClass = 'card squareCard scalableCard squareCard-scalable';
|
let cssClass = 'card squareCard scalableCard squareCard-scalable';
|
||||||
|
|
||||||
if (user.Policy.IsDisabled) {
|
if (user.Policy.IsDisabled) {
|
||||||
cssClass += ' grayscale';
|
cssClass += ' grayscale';
|
||||||
|
@ -84,7 +94,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||||
html += '<div class="cardPadder cardPadder-square"></div>';
|
html += '<div class="cardPadder cardPadder-square"></div>';
|
||||||
html += '<a is="emby-linkbutton" class="cardContent" href="useredit.html?userId=' + user.Id + '">';
|
html += '<a is="emby-linkbutton" class="cardContent" href="useredit.html?userId=' + user.Id + '">';
|
||||||
var imgUrl;
|
let imgUrl;
|
||||||
|
|
||||||
if (user.PrimaryImageTag) {
|
if (user.PrimaryImageTag) {
|
||||||
imgUrl = ApiClient.getUserImageUrl(user.Id, {
|
imgUrl = ApiClient.getUserImageUrl(user.Id, {
|
||||||
|
@ -94,7 +104,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
var imageClass = 'cardImage';
|
let imageClass = 'cardImage';
|
||||||
|
|
||||||
if (user.Policy.IsDisabled) {
|
if (user.Policy.IsDisabled) {
|
||||||
imageClass += ' disabledUser';
|
imageClass += ' disabledUser';
|
||||||
|
@ -118,7 +128,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
html += '<button type="button" is="paper-icon-button-light" class="btnUserMenu flex-shrink-zero"><span class="material-icons more_vert"></span></button>';
|
html += '<button type="button" is="paper-icon-button-light" class="btnUserMenu flex-shrink-zero"><span class="material-icons more_vert"></span></button>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '<div class="cardText cardText-secondary">';
|
html += '<div class="cardText cardText-secondary">';
|
||||||
var lastSeen = getLastSeenText(user.LastActivityDate);
|
const lastSeen = getLastSeenText(user.LastActivityDate);
|
||||||
html += '' != lastSeen ? lastSeen : ' ';
|
html += '' != lastSeen ? lastSeen : ' ';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
|
@ -146,17 +156,17 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
}
|
}
|
||||||
|
|
||||||
function showPendingUserMenu(elem) {
|
function showPendingUserMenu(elem) {
|
||||||
var menuItems = [];
|
const menuItems = [];
|
||||||
menuItems.push({
|
menuItems.push({
|
||||||
name: globalize.translate('ButtonCancel'),
|
name: globalize.translate('ButtonCancel'),
|
||||||
id: 'delete',
|
id: 'delete',
|
||||||
icon: 'delete'
|
icon: 'delete'
|
||||||
});
|
});
|
||||||
|
|
||||||
require(['actionsheet'], function (actionsheet) {
|
import('actionsheet').then(({default: actionsheet}) => {
|
||||||
var card = dom.parentWithClass(elem, 'card');
|
const card = dom.parentWithClass(elem, 'card');
|
||||||
var page = dom.parentWithClass(card, 'page');
|
const page = dom.parentWithClass(card, 'page');
|
||||||
var id = card.getAttribute('data-id');
|
const id = card.getAttribute('data-id');
|
||||||
actionsheet.show({
|
actionsheet.show({
|
||||||
items: menuItems,
|
items: menuItems,
|
||||||
positionTo: card,
|
positionTo: card,
|
||||||
|
@ -171,7 +181,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPendingUserHtml(user) {
|
function getPendingUserHtml(user) {
|
||||||
var html = '';
|
let html = '';
|
||||||
html += "<div data-id='" + user.Id + "' class='card squareCard scalableCard squareCard-scalable'>";
|
html += "<div data-id='" + user.Id + "' class='card squareCard scalableCard squareCard-scalable'>";
|
||||||
html += '<div class="cardBox cardBox-bottompadded visualCardBox">';
|
html += '<div class="cardBox cardBox-bottompadded visualCardBox">';
|
||||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||||
|
@ -236,7 +246,7 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
}
|
}
|
||||||
|
|
||||||
function showInvitePopup(page) {
|
function showInvitePopup(page) {
|
||||||
require(['components/guestinviter/guestinviter'], function (guestinviter) {
|
import('components/guestinviter/guestinviter').then(({default: guestinviter}) => {
|
||||||
guestinviter.show().then(function () {
|
guestinviter.show().then(function () {
|
||||||
loadData(page);
|
loadData(page);
|
||||||
});
|
});
|
||||||
|
@ -244,19 +254,19 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
}
|
}
|
||||||
|
|
||||||
pageIdOn('pageinit', 'userProfilesPage', function () {
|
pageIdOn('pageinit', 'userProfilesPage', function () {
|
||||||
var page = this;
|
const page = this;
|
||||||
page.querySelector('.btnAddUser').addEventListener('click', function() {
|
page.querySelector('.btnAddUser').addEventListener('click', function() {
|
||||||
Dashboard.navigate('usernew.html');
|
Dashboard.navigate('usernew.html');
|
||||||
});
|
});
|
||||||
page.querySelector('.localUsers').addEventListener('click', function (e__e) {
|
page.querySelector('.localUsers').addEventListener('click', function (e__e) {
|
||||||
var btnUserMenu = dom.parentWithClass(e__e.target, 'btnUserMenu');
|
const btnUserMenu = dom.parentWithClass(e__e.target, 'btnUserMenu');
|
||||||
|
|
||||||
if (btnUserMenu) {
|
if (btnUserMenu) {
|
||||||
showUserMenu(btnUserMenu);
|
showUserMenu(btnUserMenu);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
page.querySelector('.pending').addEventListener('click', function (e__r) {
|
page.querySelector('.pending').addEventListener('click', function (e__r) {
|
||||||
var btnUserMenu = dom.parentWithClass(e__r.target, 'btnUserMenu');
|
const btnUserMenu = dom.parentWithClass(e__r.target, 'btnUserMenu');
|
||||||
|
|
||||||
if (btnUserMenu) {
|
if (btnUserMenu) {
|
||||||
showPendingUserMenu(btnUserMenu);
|
showPendingUserMenu(btnUserMenu);
|
||||||
|
@ -266,4 +276,5 @@ define(['loading', 'dom', 'globalize', 'date-fns', 'dfnshelper', 'paper-icon-but
|
||||||
pageIdOn('pagebeforeshow', 'userProfilesPage', function () {
|
pageIdOn('pagebeforeshow', 'userProfilesPage', function () {
|
||||||
loadData(this);
|
loadData(this);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
/* eslint-enable indent */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue