mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-17 02:48:19 -07:00
Remove old files
This commit is contained in:
parent
0dba3bbb72
commit
37abd530eb
@ -1,58 +0,0 @@
|
||||
define(['apphost', 'connectionManager', 'layoutManager', 'listViewStyle', 'emby-button'], function(appHost, connectionManager, layoutManager) {
|
||||
'use strict';
|
||||
|
||||
return function(view, params) {
|
||||
view.querySelector('.btnLogout').addEventListener('click', function() {
|
||||
Dashboard.logout();
|
||||
});
|
||||
|
||||
view.querySelector('.selectServer').addEventListener('click', function () {
|
||||
Dashboard.selectServer();
|
||||
});
|
||||
|
||||
view.querySelector('.clientSettings').addEventListener('click', function () {
|
||||
window.NativeShell.openClientSettings();
|
||||
});
|
||||
|
||||
view.addEventListener('viewshow', function() {
|
||||
// this page can also be used by admins to change user preferences from the user edit page
|
||||
var userId = params.userId || Dashboard.getCurrentUserId();
|
||||
var page = this;
|
||||
|
||||
page.querySelector('.lnkMyProfile').setAttribute('href', 'myprofile.html?userId=' + userId);
|
||||
page.querySelector('.lnkDisplayPreferences').setAttribute('href', 'mypreferencesdisplay.html?userId=' + userId);
|
||||
page.querySelector('.lnkHomePreferences').setAttribute('href', 'mypreferenceshome.html?userId=' + userId);
|
||||
page.querySelector('.lnkPlaybackPreferences').setAttribute('href', 'mypreferencesplayback.html?userId=' + userId);
|
||||
page.querySelector('.lnkSubtitlePreferences').setAttribute('href', 'mypreferencessubtitles.html?userId=' + userId);
|
||||
|
||||
if (window.NativeShell && window.NativeShell.AppHost.supports('clientsettings')) {
|
||||
page.querySelector('.clientSettings').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.clientSettings').classList.add('hide');
|
||||
}
|
||||
|
||||
if (appHost.default.supports('multiserver')) {
|
||||
page.querySelector('.selectServer').classList.remove('hide');
|
||||
} else {
|
||||
page.querySelector('.selectServer').classList.add('hide');
|
||||
}
|
||||
|
||||
// hide the actions if user preferences are being edited for a different user
|
||||
if (params.userId && params.userId !== Dashboard.getCurrentUserId) {
|
||||
page.querySelector('.userSection').classList.add('hide');
|
||||
page.querySelector('.adminSection').classList.add('hide');
|
||||
}
|
||||
|
||||
ApiClient.getUser(userId).then(function(user) {
|
||||
page.querySelector('.headerUsername').innerHTML = user.Name;
|
||||
if (!user.Policy.IsAdministrator) {
|
||||
page.querySelector('.adminSection').classList.add('hide');
|
||||
}
|
||||
});
|
||||
|
||||
require(['autoFocuser'], function (autoFocuser) {
|
||||
autoFocuser.autoFocus(view);
|
||||
});
|
||||
});
|
||||
};
|
||||
});
|
@ -1,106 +0,0 @@
|
||||
define(['controllers/dashboard/users/userpasswordpage', 'loading', 'libraryMenu', 'apphost', 'globalize', 'emby-button'], function (UserPasswordPage, loading, libraryMenu, appHost, globalize) {
|
||||
'use strict';
|
||||
|
||||
function reloadUser(page) {
|
||||
var userId = getParameterByName('userId');
|
||||
loading.show();
|
||||
ApiClient.getUser(userId).then(function (user) {
|
||||
page.querySelector('.username').innerHTML = user.Name;
|
||||
libraryMenu.setTitle(user.Name);
|
||||
|
||||
var imageUrl = 'assets/img/avatar.png';
|
||||
if (user.PrimaryImageTag) {
|
||||
imageUrl = ApiClient.getUserImageUrl(user.Id, {
|
||||
tag: user.PrimaryImageTag,
|
||||
type: 'Primary'
|
||||
});
|
||||
}
|
||||
|
||||
var userImage = page.querySelector('#image');
|
||||
userImage.style.backgroundImage = 'url(' + imageUrl + ')';
|
||||
|
||||
Dashboard.getCurrentUser().then(function (loggedInUser) {
|
||||
if (user.PrimaryImageTag) {
|
||||
page.querySelector('#btnAddImage').classList.add('hide');
|
||||
page.querySelector('#btnDeleteImage').classList.remove('hide');
|
||||
} else if (appHost.default.supports('fileinput') && (loggedInUser.Policy.IsAdministrator || user.Policy.EnableUserPreferenceAccess)) {
|
||||
page.querySelector('#btnDeleteImage').classList.add('hide');
|
||||
page.querySelector('#btnAddImage').classList.remove('hide');
|
||||
}
|
||||
});
|
||||
loading.hide();
|
||||
});
|
||||
}
|
||||
|
||||
function onFileReaderError(evt) {
|
||||
loading.hide();
|
||||
switch (evt.target.error.code) {
|
||||
case evt.target.error.NOT_FOUND_ERR:
|
||||
require(['toast'], function (toast) {
|
||||
toast(globalize.translate('FileNotFound'));
|
||||
});
|
||||
break;
|
||||
case evt.target.error.ABORT_ERR:
|
||||
onFileReaderAbort();
|
||||
break;
|
||||
case evt.target.error.NOT_READABLE_ERR:
|
||||
default:
|
||||
require(['toast'], function (toast) {
|
||||
toast(globalize.translate('FileReadError'));
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
function onFileReaderAbort(evt) {
|
||||
loading.hide();
|
||||
require(['toast'], function (toast) {
|
||||
toast(globalize.translate('FileReadCancelled'));
|
||||
});
|
||||
}
|
||||
|
||||
function setFiles(page, files) {
|
||||
var userImage = page.querySelector('#image');
|
||||
var file = files[0];
|
||||
|
||||
if (!file || !file.type.match('image.*')) {
|
||||
return false;
|
||||
}
|
||||
|
||||
var reader = new FileReader();
|
||||
reader.onerror = onFileReaderError;
|
||||
reader.onabort = onFileReaderAbort;
|
||||
reader.onload = function (evt) {
|
||||
userImage.style.backgroundImage = 'url(' + evt.target.result + ')';
|
||||
var userId = getParameterByName('userId');
|
||||
ApiClient.uploadUserImage(userId, 'Primary', file).then(function () {
|
||||
loading.hide();
|
||||
reloadUser(page);
|
||||
});
|
||||
};
|
||||
|
||||
reader.readAsDataURL(file);
|
||||
}
|
||||
|
||||
return function (view, params) {
|
||||
reloadUser(view);
|
||||
new UserPasswordPage(view, params);
|
||||
view.querySelector('#btnDeleteImage').addEventListener('click', function () {
|
||||
require(['confirm'], function (confirm) {
|
||||
confirm(globalize.translate('DeleteImageConfirmation'), globalize.translate('DeleteImage')).then(function () {
|
||||
loading.show();
|
||||
var userId = getParameterByName('userId');
|
||||
ApiClient.deleteUserImage(userId, 'primary').then(function () {
|
||||
loading.hide();
|
||||
reloadUser(view);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
view.querySelector('#btnAddImage').addEventListener('click', function (evt) {
|
||||
view.querySelector('#uploadImage').click();
|
||||
});
|
||||
view.querySelector('#uploadImage').addEventListener('change', function (evt) {
|
||||
setFiles(view, evt.target.files);
|
||||
});
|
||||
};
|
||||
});
|
Loading…
Reference in New Issue
Block a user