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

improve user image resolution

This commit is contained in:
Luke Pulverenti 2015-04-27 14:52:54 -04:00
parent 4ae4c4e71a
commit 1ad8c6e955
4 changed files with 26 additions and 6 deletions

View file

@ -50,7 +50,7 @@
var url = user.imageUrl; var url = user.imageUrl;
if (user.supportsImageParams) { if (user.supportsImageParams) {
url += "&height=" + userButtonHeight; url += "&height=" + (userButtonHeight * Math.max(devicePixelRatio || 1, 2));
} }
html += '<img src="' + url + '" style="border-radius: 1000px; height:' + userButtonHeight + 'px;" />'; html += '<img src="' + url + '" style="border-radius: 1000px; height:' + userButtonHeight + 'px;" />';
@ -253,7 +253,7 @@
html += '<div class="sidebarLinks librarySidebarLinks">'; html += '<div class="sidebarLinks librarySidebarLinks">';
html += '<a style="margin-top:0;padding-left:1em;display:block;color:#fff;text-decoration:none;font-size:16px;font-weight:400!important;background: #000;" href="mypreferencesdisplay.html?userId=' + Dashboard.getCurrentUserId() + '">'; html += '<a style="margin-top:0;padding-left:.6em;display:block;color:#fff;text-decoration:none;font-size:16px;font-weight:400!important;background: #000;" href="mypreferencesdisplay.html?userId=' + Dashboard.getCurrentUserId() + '">';
var imgWidth = 48; var imgWidth = 48;
@ -261,10 +261,10 @@
var url = user.imageUrl; var url = user.imageUrl;
if (user.supportsImageParams) { if (user.supportsImageParams) {
url += "&width=" + imgWidth; url += "&width=" + (imgWidth * Math.max(devicePixelRatio || 1, 2));
} }
html += '<img style="max-width:' + imgWidth + 'px;vertical-align:middle;margin-right:.75em;border-radius: 50px;" src="' + url + '" />'; html += '<img style="max-width:' + imgWidth + 'px;vertical-align:middle;margin-right:.8em;border-radius: 50px;" src="' + url + '" />';
} }
html += user.name; html += user.name;
html += '</a>'; html += '</a>';

View file

@ -583,7 +583,7 @@ var Dashboard = {
var url = user.imageUrl; var url = user.imageUrl;
if (user.supportsImageParams) { if (user.supportsImageParams) {
url += "&width=" + imgWidth; url += "&width=" + (imgWidth * Math.max(devicePixelRatio || 1, 2));
} }
html += '<img style="max-width:' + imgWidth + 'px;vertical-align:middle;margin-right:.5em;border-radius: 50px;" src="' + url + '" />'; html += '<img style="max-width:' + imgWidth + 'px;vertical-align:middle;margin-right:.5em;border-radius: 50px;" src="' + url + '" />';

View file

@ -54,6 +54,25 @@
return serverInfo; return serverInfo;
}; };
var currentUser;
/**
* Gets or sets the current user id.
*/
self.getCurrentUser = function () {
if (currentUser != null) {
var deferred = DeferredBuilder.Deferred();
deferred.resolveWith(null, [currentUser]);
return deferred.promise();
}
return self.getUser(self.getCurrentUserId()).done(function (user) {
currentUser = user;
});
};
/** /**
* Gets or sets the current user id. * Gets or sets the current user id.
*/ */
@ -69,6 +88,7 @@
self.setCurrentUserId = function (userId, token) { self.setCurrentUserId = function (userId, token) {
currentUserId = userId; currentUserId = userId;
currentUser = null;
accessToken = token; accessToken = token;
}; };

View file

@ -433,7 +433,7 @@
var apiClient = self.currentApiClient(); var apiClient = self.currentApiClient();
if (apiClient && apiClient.getCurrentUserId()) { if (apiClient && apiClient.getCurrentUserId()) {
apiClient.getUser(apiClient.getCurrentUserId()).done(function (u) { apiClient.getCurrentUser().done(function (u) {
localUser = u; localUser = u;
}).always(onLocalUserDone); }).always(onLocalUserDone);
} else { } else {