mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update variable declerations
This commit is contained in:
parent
5545c05089
commit
376f00c059
6 changed files with 117 additions and 123 deletions
|
@ -9,21 +9,19 @@ import globalize from 'globalize';
|
|||
ApiClient.getJSON(ApiClient.getUrl('Channels', {
|
||||
SupportsMediaDeletion: true
|
||||
})).then(function (channelsResult) {
|
||||
var i;
|
||||
var length;
|
||||
var folder;
|
||||
var isChecked;
|
||||
var checkedAttribute;
|
||||
var html = '';
|
||||
let folder;
|
||||
let isChecked;
|
||||
let checkedAttribute;
|
||||
let html = '';
|
||||
|
||||
for (i = 0, length = mediaFolders.length; i < length; i++) {
|
||||
for (let i = 0, length = mediaFolders.length; i < length; i++) {
|
||||
folder = mediaFolders[i];
|
||||
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id);
|
||||
checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
for (i = 0, length = channelsResult.Items.length; i < length; i++) {
|
||||
for (let i = 0, length = channelsResult.Items.length; i < length; i++) {
|
||||
folder = channelsResult.Items[i];
|
||||
isChecked = user.Policy.EnableContentDeletion || -1 != user.Policy.EnableContentDeletionFromFolders.indexOf(folder.Id);
|
||||
checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
|
@ -42,9 +40,9 @@ import globalize from 'globalize';
|
|||
page.querySelector('.fldSelectLoginProvider').classList.add('hide');
|
||||
}
|
||||
|
||||
var currentProviderId = user.Policy.AuthenticationProviderId;
|
||||
const currentProviderId = user.Policy.AuthenticationProviderId;
|
||||
page.querySelector('.selectLoginProvider').innerHTML = providers.map(function (provider) {
|
||||
var selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||
const selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||
return '<option value="' + provider.Id + '"' + selected + '>' + provider.Name + '</option>';
|
||||
});
|
||||
}
|
||||
|
@ -56,15 +54,14 @@ import globalize from 'globalize';
|
|||
page.querySelector('.fldSelectPasswordResetProvider').classList.add('hide');
|
||||
}
|
||||
|
||||
var currentProviderId = user.Policy.PasswordResetProviderId;
|
||||
const currentProviderId = user.Policy.PasswordResetProviderId;
|
||||
page.querySelector('.selectPasswordResetProvider').innerHTML = providers.map(function (provider) {
|
||||
var selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||
const selected = provider.Id === currentProviderId || providers.length < 2 ? ' selected' : '';
|
||||
return '<option value="' + provider.Id + '"' + selected + '>' + provider.Name + '</option>';
|
||||
});
|
||||
}
|
||||
|
||||
function loadUser(page, user) {
|
||||
currentUser = user;
|
||||
ApiClient.getJSON(ApiClient.getUrl('Auth/Providers')).then(function (providers) {
|
||||
loadAuthProviders(page, user, providers);
|
||||
});
|
||||
|
@ -159,7 +156,7 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
function onSubmit() {
|
||||
var page = $(this).parents('.page')[0];
|
||||
const page = $(this).parents('.page')[0];
|
||||
loading.show();
|
||||
getUser().then(function (result) {
|
||||
saveUser(result, page);
|
||||
|
@ -168,7 +165,7 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
function getUser() {
|
||||
var userId = getParameterByName('userId');
|
||||
const userId = getParameterByName('userId');
|
||||
return ApiClient.getUser(userId);
|
||||
}
|
||||
|
||||
|
@ -179,11 +176,10 @@ import globalize from 'globalize';
|
|||
});
|
||||
}
|
||||
|
||||
var currentUser;
|
||||
$(document).on('pageinit', '#editUserPage', function () {
|
||||
$('.editUserProfileForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
this.querySelector('.sharingHelp').innerHTML = globalize.translate('OptionAllowLinkSharingHelp', 30);
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('#chkEnableDeleteAllFolders', this).on('change', function () {
|
||||
if (this.checked) {
|
||||
$('.deleteAccess', page).hide();
|
||||
|
|
|
@ -6,39 +6,39 @@ import globalize from 'globalize';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function triggerChange(select) {
|
||||
var evt = document.createEvent('HTMLEvents');
|
||||
const evt = document.createEvent('HTMLEvents');
|
||||
evt.initEvent('change', false, true);
|
||||
select.dispatchEvent(evt);
|
||||
}
|
||||
|
||||
function loadMediaFolders(page, user, mediaFolders) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderLibraries') + '</h3>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
|
||||
for (var i = 0, length = mediaFolders.length; i < length; i++) {
|
||||
var folder = mediaFolders[i];
|
||||
var isChecked = user.Policy.EnableAllFolders || -1 != user.Policy.EnabledFolders.indexOf(folder.Id);
|
||||
var checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
for (let i = 0, length = mediaFolders.length; i < length; i++) {
|
||||
const folder = mediaFolders[i];
|
||||
const isChecked = user.Policy.EnableAllFolders || -1 != user.Policy.EnabledFolders.indexOf(folder.Id);
|
||||
const checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
html += '</div>';
|
||||
page.querySelector('.folderAccess').innerHTML = html;
|
||||
var chkEnableAllFolders = page.querySelector('#chkEnableAllFolders');
|
||||
const chkEnableAllFolders = page.querySelector('#chkEnableAllFolders');
|
||||
chkEnableAllFolders.checked = user.Policy.EnableAllFolders;
|
||||
triggerChange(chkEnableAllFolders);
|
||||
}
|
||||
|
||||
function loadChannels(page, user, channels) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderChannels') + '</h3>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
|
||||
for (var i = 0, length = channels.length; i < length; i++) {
|
||||
var folder = channels[i];
|
||||
var isChecked = user.Policy.EnableAllChannels || -1 != user.Policy.EnabledChannels.indexOf(folder.Id);
|
||||
var checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
for (let i = 0, length = channels.length; i < length; i++) {
|
||||
const folder = channels[i];
|
||||
const isChecked = user.Policy.EnableAllChannels || -1 != user.Policy.EnabledChannels.indexOf(folder.Id);
|
||||
const checkedAttribute = isChecked ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '" ' + checkedAttribute + '><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
|
@ -55,13 +55,13 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
function loadDevices(page, user, devices) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderDevices') + '</h3>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
|
||||
for (var i = 0, length = devices.length; i < length; i++) {
|
||||
var device = devices[i];
|
||||
var checkedAttribute = user.Policy.EnableAllDevices || -1 != user.Policy.EnabledDevices.indexOf(device.Id) ? ' checked="checked"' : '';
|
||||
for (let i = 0, length = devices.length; i < length; i++) {
|
||||
const device = devices[i];
|
||||
const checkedAttribute = user.Policy.EnableAllDevices || -1 != user.Policy.EnabledDevices.indexOf(device.Id) ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkDevice" data-id="' + device.Id + '" ' + checkedAttribute + '><span>' + device.Name + ' - ' + device.AppName + '</span></label>';
|
||||
}
|
||||
|
||||
|
@ -120,9 +120,9 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
function onSubmit() {
|
||||
var page = $(this).parents('.page');
|
||||
const page = $(this).parents('.page');
|
||||
loading.show();
|
||||
var userId = getParameterByName('userId');
|
||||
const userId = getParameterByName('userId');
|
||||
ApiClient.getUser(userId).then(function (result) {
|
||||
saveUser(result, page);
|
||||
});
|
||||
|
@ -130,7 +130,7 @@ import globalize from 'globalize';
|
|||
}
|
||||
|
||||
$(document).on('pageinit', '#userLibraryAccessPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('#chkEnableAllDevices', page).on('change', function () {
|
||||
if (this.checked) {
|
||||
$('.deviceAccessListContainer', page).hide();
|
||||
|
@ -154,27 +154,27 @@ import globalize from 'globalize';
|
|||
});
|
||||
$('.userLibraryAccessForm').off('submit', onSubmit).on('submit', onSubmit);
|
||||
}).on('pageshow', '#userLibraryAccessPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
loading.show();
|
||||
var promise1;
|
||||
var userId = getParameterByName('userId');
|
||||
let promise1;
|
||||
const userId = getParameterByName('userId');
|
||||
|
||||
if (userId) {
|
||||
promise1 = ApiClient.getUser(userId);
|
||||
} else {
|
||||
var deferred = $.Deferred();
|
||||
const deferred = $.Deferred();
|
||||
deferred.resolveWith(null, [{
|
||||
Configuration: {}
|
||||
}]);
|
||||
promise1 = deferred.promise();
|
||||
}
|
||||
|
||||
var promise2 = Dashboard.getCurrentUser();
|
||||
var promise4 = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||
const promise2 = Dashboard.getCurrentUser();
|
||||
const promise4 = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||
IsHidden: false
|
||||
}));
|
||||
var promise5 = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||
var promise6 = ApiClient.getJSON(ApiClient.getUrl('Devices'));
|
||||
const promise5 = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||
const promise6 = ApiClient.getJSON(ApiClient.getUrl('Devices'));
|
||||
Promise.all([promise1, promise2, promise4, promise5, promise6]).then(function (responses) {
|
||||
loadUser(page, responses[0], responses[1], responses[2].Items, responses[3].Items, responses[4].Items);
|
||||
});
|
||||
|
|
|
@ -6,12 +6,12 @@ import 'emby-checkbox';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function loadMediaFolders(page, mediaFolders) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderLibraries') + '</h3>';
|
||||
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
||||
|
||||
for (var i = 0; i < mediaFolders.length; i++) {
|
||||
var folder = mediaFolders[i];
|
||||
for (let i = 0; i < mediaFolders.length; i++) {
|
||||
const folder = mediaFolders[i];
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkFolder" data-id="' + folder.Id + '"/><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
|
@ -21,12 +21,12 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function loadChannels(page, channels) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderChannels') + '</h3>';
|
||||
html += '<div class="checkboxList paperList" style="padding:.5em 1em;">';
|
||||
|
||||
for (var i = 0; i < channels.length; i++) {
|
||||
var folder = channels[i];
|
||||
for (let i = 0; i < channels.length; i++) {
|
||||
const folder = channels[i];
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkChannel" data-id="' + folder.Id + '"/><span>' + folder.Name + '</span></label>';
|
||||
}
|
||||
|
||||
|
@ -46,10 +46,10 @@ import 'emby-checkbox';
|
|||
$('#txtUsername', page).val('');
|
||||
$('#txtPassword', page).val('');
|
||||
loading.show();
|
||||
var promiseFolders = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||
const promiseFolders = ApiClient.getJSON(ApiClient.getUrl('Library/MediaFolders', {
|
||||
IsHidden: false
|
||||
}));
|
||||
var promiseChannels = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||
const promiseChannels = ApiClient.getJSON(ApiClient.getUrl('Channels'));
|
||||
Promise.all([promiseFolders, promiseChannels]).then(function (responses) {
|
||||
loadMediaFolders(page, responses[0].Items);
|
||||
loadChannels(page, responses[1].Items);
|
||||
|
@ -58,7 +58,7 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function saveUser(page) {
|
||||
var user = {};
|
||||
const user = {};
|
||||
user.Name = $('#txtUsername', page).val();
|
||||
user.Password = $('#txtPassword', page).val();
|
||||
ApiClient.createUser(user).then(function (user) {
|
||||
|
@ -97,7 +97,7 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
function onSubmit() {
|
||||
var page = $(this).parents('.page')[0];
|
||||
const page = $(this).parents('.page')[0];
|
||||
loading.show();
|
||||
saveUser(page);
|
||||
return false;
|
||||
|
@ -108,7 +108,7 @@ import 'emby-checkbox';
|
|||
}
|
||||
|
||||
$(document).on('pageinit', '#newUserPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('#chkEnableAllChannels', page).on('change', function () {
|
||||
if (this.checked) {
|
||||
$('.channelAccessListContainer', page).hide();
|
||||
|
|
|
@ -9,16 +9,14 @@ import 'paper-icon-button-light';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function populateRatings(allParentalRatings, page) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<option value=''></option>";
|
||||
var i;
|
||||
var length;
|
||||
var rating;
|
||||
var ratings = [];
|
||||
let rating;
|
||||
const ratings = [];
|
||||
|
||||
for (i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
if (rating = allParentalRatings[i], ratings.length) {
|
||||
var lastRating = ratings[ratings.length - 1];
|
||||
const lastRating = ratings[ratings.length - 1];
|
||||
|
||||
if (lastRating.Value === rating.Value) {
|
||||
lastRating.Name += '/' + rating.Name;
|
||||
|
@ -32,7 +30,7 @@ import 'paper-icon-button-light';
|
|||
});
|
||||
}
|
||||
|
||||
for (i = 0, length = ratings.length; i < length; i++) {
|
||||
for (let i = 0, length = ratings.length; i < length; i++) {
|
||||
rating = ratings[i];
|
||||
html += "<option value='" + rating.Value + "'>" + rating.Name + '</option>';
|
||||
}
|
||||
|
@ -41,7 +39,7 @@ import 'paper-icon-button-light';
|
|||
}
|
||||
|
||||
function loadUnratedItems(page, user) {
|
||||
var items = [{
|
||||
const items = [{
|
||||
name: globalize.translate('OptionBlockBooks'),
|
||||
value: 'Book'
|
||||
}, {
|
||||
|
@ -63,13 +61,13 @@ import 'paper-icon-button-light';
|
|||
name: globalize.translate('OptionBlockTvShows'),
|
||||
value: 'Series'
|
||||
}];
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += '<h3 class="checkboxListLabel">' + globalize.translate('HeaderBlockItemsWithNoRating') + '</h3>';
|
||||
html += '<div class="checkboxList paperList checkboxList-paperList">';
|
||||
|
||||
for (var i = 0, length = items.length; i < length; i++) {
|
||||
var item = items[i];
|
||||
var checkedAttribute = -1 != user.Policy.BlockUnratedItems.indexOf(item.value) ? ' checked="checked"' : '';
|
||||
for (let i = 0, length = items.length; i < length; i++) {
|
||||
const item = items[i];
|
||||
const checkedAttribute = -1 != user.Policy.BlockUnratedItems.indexOf(item.value) ? ' checked="checked"' : '';
|
||||
html += '<label><input type="checkbox" is="emby-checkbox" class="chkUnratedItem" data-itemtype="' + item.value + '" type="checkbox"' + checkedAttribute + '><span>' + item.name + '</span></label>';
|
||||
}
|
||||
|
||||
|
@ -83,11 +81,11 @@ import 'paper-icon-button-light';
|
|||
loadUnratedItems(page, user);
|
||||
loadBlockedTags(page, user.Policy.BlockedTags);
|
||||
populateRatings(allParentalRatings, page);
|
||||
var ratingValue = '';
|
||||
let ratingValue = '';
|
||||
|
||||
if (user.Policy.MaxParentalRating) {
|
||||
for (var i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
var rating = allParentalRatings[i];
|
||||
for (let i = 0, length = allParentalRatings.length; i < length; i++) {
|
||||
const rating = allParentalRatings[i];
|
||||
|
||||
if (user.Policy.MaxParentalRating >= rating.Value) {
|
||||
ratingValue = rating.Value;
|
||||
|
@ -108,8 +106,8 @@ import 'paper-icon-button-light';
|
|||
}
|
||||
|
||||
function loadBlockedTags(page, tags) {
|
||||
var html = tags.map(function (h) {
|
||||
var li = '<div class="listItem">';
|
||||
let html = tags.map(function (h) {
|
||||
let li = '<div class="listItem">';
|
||||
li += '<div class="listItemBody">';
|
||||
li += '<h3 class="listItemBodyText">';
|
||||
li += h;
|
||||
|
@ -123,10 +121,10 @@ import 'paper-icon-button-light';
|
|||
html = '<div class="paperList">' + html + '</div>';
|
||||
}
|
||||
|
||||
var elem = $('.blockedTags', page).html(html).trigger('create');
|
||||
const elem = $('.blockedTags', page).html(html).trigger('create');
|
||||
$('.btnDeleteTag', elem).on('click', function () {
|
||||
var tag = this.getAttribute('data-tag');
|
||||
var newTags = tags.filter(function (t) {
|
||||
const tag = this.getAttribute('data-tag');
|
||||
const newTags = tags.filter(function (t) {
|
||||
return t != tag;
|
||||
});
|
||||
loadBlockedTags(page, newTags);
|
||||
|
@ -139,10 +137,10 @@ import 'paper-icon-button-light';
|
|||
}
|
||||
|
||||
function renderAccessSchedule(page, schedules) {
|
||||
var html = '';
|
||||
var index = 0;
|
||||
let html = '';
|
||||
let index = 0;
|
||||
html += schedules.map(function (a) {
|
||||
var itemHtml = '';
|
||||
let itemHtml = '';
|
||||
itemHtml += '<div class="liSchedule listItem" data-day="' + a.DayOfWeek + '" data-start="' + a.StartHour + '" data-end="' + a.EndHour + '">';
|
||||
itemHtml += '<div class="listItemBody two-line">';
|
||||
itemHtml += '<h3 class="listItemBodyText">';
|
||||
|
@ -155,7 +153,7 @@ import 'paper-icon-button-light';
|
|||
index++;
|
||||
return itemHtml;
|
||||
}).join('');
|
||||
var accessScheduleList = page.querySelector('.accessScheduleList');
|
||||
const accessScheduleList = page.querySelector('.accessScheduleList');
|
||||
accessScheduleList.innerHTML = html;
|
||||
$('.btnDelete', accessScheduleList).on('click', function () {
|
||||
deleteAccessSchedule(page, schedules, parseInt(this.getAttribute('data-index')));
|
||||
|
@ -185,8 +183,8 @@ import 'paper-icon-button-light';
|
|||
}
|
||||
|
||||
function getDisplayTime(hours) {
|
||||
var minutes = 0;
|
||||
var pct = hours % 1;
|
||||
let minutes = 0;
|
||||
const pct = hours % 1;
|
||||
|
||||
if (pct) {
|
||||
minutes = parseInt(60 * pct);
|
||||
|
@ -201,7 +199,7 @@ import 'paper-icon-button-light';
|
|||
accessschedule.show({
|
||||
schedule: schedule
|
||||
}).then(function (updatedSchedule) {
|
||||
var schedules = getSchedulesFromPage(page);
|
||||
const schedules = getSchedulesFromPage(page);
|
||||
|
||||
if (-1 == index) {
|
||||
index = schedules.length;
|
||||
|
@ -234,7 +232,7 @@ import 'paper-icon-button-light';
|
|||
prompt({
|
||||
label: globalize.translate('LabelTag')
|
||||
}).then(function (value) {
|
||||
var tags = getBlockedTagsFromPage(page);
|
||||
const tags = getBlockedTagsFromPage(page);
|
||||
|
||||
if (-1 == tags.indexOf(value)) {
|
||||
tags.push(value);
|
||||
|
@ -246,9 +244,9 @@ import 'paper-icon-button-light';
|
|||
|
||||
window.UserParentalControlPage = {
|
||||
onSubmit: function () {
|
||||
var page = $(this).parents('.page');
|
||||
const page = $(this).parents('.page');
|
||||
loading.show();
|
||||
var userId = getParameterByName('userId');
|
||||
const userId = getParameterByName('userId');
|
||||
ApiClient.getUser(userId).then(function (result) {
|
||||
saveUser(result, page);
|
||||
});
|
||||
|
@ -256,7 +254,7 @@ import 'paper-icon-button-light';
|
|||
}
|
||||
};
|
||||
$(document).on('pageinit', '#userParentalControlPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
$('.btnAddSchedule', page).on('click', function () {
|
||||
showSchedulePopup(page, {}, -1);
|
||||
});
|
||||
|
@ -265,11 +263,11 @@ import 'paper-icon-button-light';
|
|||
});
|
||||
$('.userParentalControlForm').off('submit', UserParentalControlPage.onSubmit).on('submit', UserParentalControlPage.onSubmit);
|
||||
}).on('pageshow', '#userParentalControlPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
loading.show();
|
||||
var userId = getParameterByName('userId');
|
||||
var promise1 = ApiClient.getUser(userId);
|
||||
var promise2 = ApiClient.getParentalRatings();
|
||||
const userId = getParameterByName('userId');
|
||||
const promise1 = ApiClient.getUser(userId);
|
||||
const promise2 = ApiClient.getParentalRatings();
|
||||
Promise.all([promise1, promise2]).then(function (responses) {
|
||||
loadUser(page, responses[0], responses[1]);
|
||||
});
|
||||
|
|
|
@ -6,13 +6,13 @@ import 'emby-button';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function loadUser(page, params) {
|
||||
var userid = params.userId;
|
||||
const userid = params.userId;
|
||||
ApiClient.getUser(userid).then(function (user) {
|
||||
Dashboard.getCurrentUser().then(function (loggedInUser) {
|
||||
libraryMenu.setTitle(user.Name);
|
||||
page.querySelector('.username').innerHTML = user.Name;
|
||||
var showPasswordSection = true;
|
||||
var showLocalAccessSection = false;
|
||||
let showPasswordSection = true;
|
||||
let showLocalAccessSection = false;
|
||||
|
||||
if ('Guest' == user.ConnectLinkType) {
|
||||
page.querySelector('.localAccessSection').classList.add('hide');
|
||||
|
@ -38,7 +38,7 @@ import 'emby-button';
|
|||
page.querySelector('.localAccessSection').classList.add('hide');
|
||||
}
|
||||
|
||||
var txtEasyPassword = page.querySelector('#txtEasyPassword');
|
||||
const txtEasyPassword = page.querySelector('#txtEasyPassword');
|
||||
txtEasyPassword.value = '';
|
||||
|
||||
if (user.HasConfiguredEasyPassword) {
|
||||
|
@ -64,8 +64,8 @@ import 'emby-button';
|
|||
|
||||
export default function (view, params) {
|
||||
function saveEasyPassword() {
|
||||
var userId = params.userId;
|
||||
var easyPassword = view.querySelector('#txtEasyPassword').value;
|
||||
const userId = params.userId;
|
||||
const easyPassword = view.querySelector('#txtEasyPassword').value;
|
||||
|
||||
if (easyPassword) {
|
||||
ApiClient.updateEasyPassword(userId, easyPassword).then(function () {
|
||||
|
@ -92,9 +92,9 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function savePassword() {
|
||||
var userId = params.userId;
|
||||
var currentPassword = view.querySelector('#txtCurrentPassword').value;
|
||||
var newPassword = view.querySelector('#txtNewPassword').value;
|
||||
const userId = params.userId;
|
||||
let currentPassword = view.querySelector('#txtCurrentPassword').value;
|
||||
const newPassword = view.querySelector('#txtNewPassword').value;
|
||||
|
||||
if (view.querySelector('#fldCurrentPassword').classList.contains('hide')) {
|
||||
// Firefox does not respect autocomplete=off, so clear it if the field is supposed to be hidden (and blank)
|
||||
|
@ -120,7 +120,7 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function onSubmit(e) {
|
||||
var form = this;
|
||||
const form = this;
|
||||
|
||||
if (form.querySelector('#txtNewPassword').value != form.querySelector('#txtNewPasswordConfirm').value) {
|
||||
import('toast').then(({default: toast}) => {
|
||||
|
@ -143,10 +143,10 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function resetPassword() {
|
||||
var msg = globalize.translate('PasswordResetConfirmation');
|
||||
const msg = globalize.translate('PasswordResetConfirmation');
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm(msg, globalize.translate('PasswordResetHeader')).then(function () {
|
||||
var userId = params.userId;
|
||||
const userId = params.userId;
|
||||
loading.show();
|
||||
ApiClient.resetUserPassword(userId).then(function () {
|
||||
loading.hide();
|
||||
|
@ -161,11 +161,11 @@ import 'emby-button';
|
|||
}
|
||||
|
||||
function resetEasyPassword() {
|
||||
var msg = globalize.translate('PinCodeResetConfirmation');
|
||||
const msg = globalize.translate('PinCodeResetConfirmation');
|
||||
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm(msg, globalize.translate('HeaderPinCodeReset')).then(function () {
|
||||
var userId = params.userId;
|
||||
const userId = params.userId;
|
||||
loading.show();
|
||||
ApiClient.resetEasyPassword(userId).then(function () {
|
||||
loading.hide();
|
||||
|
|
|
@ -12,7 +12,7 @@ import 'flexStyles';
|
|||
/* eslint-disable indent */
|
||||
|
||||
function deleteUser(page, id) {
|
||||
var msg = globalize.translate('DeleteUserConfirmation');
|
||||
const msg = globalize.translate('DeleteUserConfirmation');
|
||||
|
||||
import('confirm').then(({default: confirm}) => {
|
||||
confirm({
|
||||
|
@ -30,10 +30,10 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function showUserMenu(elem) {
|
||||
var card = dom.parentWithClass(elem, 'card');
|
||||
var page = dom.parentWithClass(card, 'page');
|
||||
var userId = card.getAttribute('data-userid');
|
||||
var menuItems = [];
|
||||
const card = dom.parentWithClass(elem, 'card');
|
||||
const page = dom.parentWithClass(card, 'page');
|
||||
const userId = card.getAttribute('data-userid');
|
||||
const menuItems = [];
|
||||
menuItems.push({
|
||||
name: globalize.translate('ButtonOpen'),
|
||||
id: 'open',
|
||||
|
@ -82,8 +82,8 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getUserHtml(user, addConnectIndicator) {
|
||||
var html = '';
|
||||
var cssClass = 'card squareCard scalableCard squareCard-scalable';
|
||||
let html = '';
|
||||
let cssClass = 'card squareCard scalableCard squareCard-scalable';
|
||||
|
||||
if (user.Policy.IsDisabled) {
|
||||
cssClass += ' grayscale';
|
||||
|
@ -94,7 +94,7 @@ import 'flexStyles';
|
|||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||
html += '<div class="cardPadder cardPadder-square"></div>';
|
||||
html += '<a is="emby-linkbutton" class="cardContent" href="useredit.html?userId=' + user.Id + '">';
|
||||
var imgUrl;
|
||||
let imgUrl;
|
||||
|
||||
if (user.PrimaryImageTag) {
|
||||
imgUrl = ApiClient.getUserImageUrl(user.Id, {
|
||||
|
@ -104,7 +104,7 @@ import 'flexStyles';
|
|||
});
|
||||
}
|
||||
|
||||
var imageClass = 'cardImage';
|
||||
let imageClass = 'cardImage';
|
||||
|
||||
if (user.Policy.IsDisabled) {
|
||||
imageClass += ' disabledUser';
|
||||
|
@ -128,7 +128,7 @@ import 'flexStyles';
|
|||
html += '<button type="button" is="paper-icon-button-light" class="btnUserMenu flex-shrink-zero"><span class="material-icons more_vert"></span></button>';
|
||||
html += '</div>';
|
||||
html += '<div class="cardText cardText-secondary">';
|
||||
var lastSeen = getLastSeenText(user.LastActivityDate);
|
||||
const lastSeen = getLastSeenText(user.LastActivityDate);
|
||||
html += '' != lastSeen ? lastSeen : ' ';
|
||||
html += '</div>';
|
||||
html += '</div>';
|
||||
|
@ -156,7 +156,7 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function showPendingUserMenu(elem) {
|
||||
var menuItems = [];
|
||||
const menuItems = [];
|
||||
menuItems.push({
|
||||
name: globalize.translate('ButtonCancel'),
|
||||
id: 'delete',
|
||||
|
@ -164,9 +164,9 @@ import 'flexStyles';
|
|||
});
|
||||
|
||||
import('actionsheet').then(({default: actionsheet}) => {
|
||||
var card = dom.parentWithClass(elem, 'card');
|
||||
var page = dom.parentWithClass(card, 'page');
|
||||
var id = card.getAttribute('data-id');
|
||||
const card = dom.parentWithClass(elem, 'card');
|
||||
const page = dom.parentWithClass(card, 'page');
|
||||
const id = card.getAttribute('data-id');
|
||||
actionsheet.show({
|
||||
items: menuItems,
|
||||
positionTo: card,
|
||||
|
@ -181,7 +181,7 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
function getPendingUserHtml(user) {
|
||||
var html = '';
|
||||
let html = '';
|
||||
html += "<div data-id='" + user.Id + "' class='card squareCard scalableCard squareCard-scalable'>";
|
||||
html += '<div class="cardBox cardBox-bottompadded visualCardBox">';
|
||||
html += '<div class="cardScalable visualCardBox-cardScalable">';
|
||||
|
@ -254,19 +254,19 @@ import 'flexStyles';
|
|||
}
|
||||
|
||||
pageIdOn('pageinit', 'userProfilesPage', function () {
|
||||
var page = this;
|
||||
const page = this;
|
||||
page.querySelector('.btnAddUser').addEventListener('click', function() {
|
||||
Dashboard.navigate('usernew.html');
|
||||
});
|
||||
page.querySelector('.localUsers').addEventListener('click', function (e__e) {
|
||||
var btnUserMenu = dom.parentWithClass(e__e.target, 'btnUserMenu');
|
||||
const btnUserMenu = dom.parentWithClass(e__e.target, 'btnUserMenu');
|
||||
|
||||
if (btnUserMenu) {
|
||||
showUserMenu(btnUserMenu);
|
||||
}
|
||||
});
|
||||
page.querySelector('.pending').addEventListener('click', function (e__r) {
|
||||
var btnUserMenu = dom.parentWithClass(e__r.target, 'btnUserMenu');
|
||||
const btnUserMenu = dom.parentWithClass(e__r.target, 'btnUserMenu');
|
||||
|
||||
if (btnUserMenu) {
|
||||
showPendingUserMenu(btnUserMenu);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue