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

update translations

This commit is contained in:
Luke Pulverenti 2015-05-22 11:59:17 -04:00
parent 9e470c9f94
commit 7e55abc130
5 changed files with 144 additions and 96 deletions

View file

@ -338,15 +338,17 @@
} }
@media all and (min-width: 700px) { @media all and (min-width: 700px) {
.backdropCard {
width: 33.3%;
}
.bannerCard { .bannerCard {
width: 50%; width: 50%;
} }
} }
@media all and (min-width: 770px) {
.backdropCard {
width: 33.3%;
}
}
@media all and (min-width: 800px) { @media all and (min-width: 800px) {
.squareCard { .squareCard {

View file

@ -1,6 +1,6 @@
(function (window, document, $, devicePixelRatio) { (function (window, document, $, devicePixelRatio) {
function renderHeader(user) { function renderHeader() {
var html = '<div class="viewMenuBar ui-bar-b">'; var html = '<div class="viewMenuBar ui-bar-b">';
@ -22,30 +22,62 @@
html += '<div class="viewMenuSecondary">'; html += '<div class="viewMenuSecondary">';
var btnCastVisible = user.localUser ? '' : 'visibility:hidden;';
if (!AppInfo.enableHeaderImages) { if (!AppInfo.enableHeaderImages) {
html += '<button id="btnCast" class="btnCast btnCastIcon btnDefaultCast headerButton headerButtonRight" type="button" data-role="none" style="' + btnCastVisible + '">'; html += '<button id="btnCast" class="btnCast btnCastIcon btnDefaultCast headerButton headerButtonRight" type="button" data-role="none" style="display:none;">';
html += '<div class="headerSelectedPlayer"></div><i class="fa fa-wifi"></i>'; html += '<div class="headerSelectedPlayer"></div><i class="fa fa-wifi"></i>';
html += '</button>'; html += '</button>';
} else { } else {
html += '<button id="btnCast" class="btnCast btnDefaultCast headerButton headerButtonRight" type="button" data-role="none" style="' + btnCastVisible + '"><div class="headerSelectedPlayer"></div><div class="btnCastImage"></div></button>'; html += '<button id="btnCast" class="btnCast btnDefaultCast headerButton headerButtonRight" type="button" data-role="none" style="display:none;"><div class="headerSelectedPlayer"></div><div class="btnCastImage"></div></button>';
} }
if (user.localUser) { html += '<button onclick="Search.showSearchPanel($.mobile.activePage);" type="button" data-role="none" class="headerButton headerButtonRight headerSearchButton" style="display:none;"><div class="fa fa-search" style="font-size:21px;"></div></button>';
html += '<button onclick="Search.showSearchPanel($.mobile.activePage);" type="button" data-role="none" class="headerButton headerButtonRight headerSearchButton"><div class="fa fa-search" style="font-size:21px;"></div></button>';
html += '<div class="viewMenuSearch hide"><form class="viewMenuSearchForm">'; html += '<div class="viewMenuSearch hide"><form class="viewMenuSearchForm">';
html += '<input type="text" data-role="none" data-type="search" class="headerSearchInput" autocomplete="off" spellcheck="off" />'; html += '<input type="text" data-role="none" data-type="search" class="headerSearchInput" autocomplete="off" spellcheck="off" />';
html += '<div class="searchInputIcon fa fa-search"></div>'; html += '<div class="searchInputIcon fa fa-search"></div>';
html += '<button data-role="none" type="button" data-iconpos="notext" class="imageButton btnCloseSearch"><i class="fa fa-close"></i></button>'; html += '<button data-role="none" type="button" data-iconpos="notext" class="imageButton btnCloseSearch"><i class="fa fa-close"></i></button>';
html += '</form></div>'; html += '</form></div>';
}
if (user.name) {
html += '<button class="headerButton headerButtonRight headerUserButton" type="button" data-role="none" onclick="Dashboard.showUserFlyout(this);">'; html += '<button class="headerButton headerButtonRight headerUserButton" type="button" data-role="none" onclick="Dashboard.showUserFlyout(this);">';
html += '<div class="fa fa-user"></div>';
html += '</button>';
html += '<a href="dashboard.html" class="headerButton headerButtonRight dashboardEntryHeaderButton" style="display:none;"><div class="fa fa-cog"></div></a>';
html += '</div>';
html += '</div>';
$(document.body).prepend(html);
$('.viewMenuBar').trigger('create').lazyChildren();
$(document).trigger('headercreated');
bindMenuEvents();
}
function addUserToHeader(user) {
var header = $('.viewMenuBar');
if (user.localUser) {
$('.btnCast', header).show();
$('.headerSearchButton', header).show();
} else {
$('.btnCast', header).hide();
$('.headerSearchButton', header).hide();
}
if (user.canManageServer) {
$('.dashboardEntryHeaderButton', header).show();
} else {
$('.dashboardEntryHeaderButton', header).hide();
}
var userButtonHtml = '';
if (user.name) {
if (user.imageUrl && AppInfo.enableUserImage) { if (user.imageUrl && AppInfo.enableUserImage) {
var userButtonHeight = 26; var userButtonHeight = 26;
@ -56,27 +88,12 @@
url += "&height=" + (userButtonHeight * Math.max(devicePixelRatio || 1, 2)); url += "&height=" + (userButtonHeight * Math.max(devicePixelRatio || 1, 2));
} }
html += '<div class="lazy headerUserImage" data-src="' + url + '" style="width:' + userButtonHeight + 'px;height:' + userButtonHeight + 'px;"></div>'; userButtonHtml += '<div class="lazy headerUserImage" data-src="' + url + '" style="width:' + userButtonHeight + 'px;height:' + userButtonHeight + 'px;"></div>';
} else { } else {
html += '<div class="fa fa-user"></div>'; userButtonHtml += '<div class="fa fa-user"></div>';
} }
$('.headerUserButton', header).html(userButtonHtml).lazyChildren();
html += '</button>';
} }
if (user.canManageServer) {
html += '<a href="dashboard.html" class="headerButton headerButtonRight dashboardEntryHeaderButton"><div class="fa fa-cog"></div></a>';
}
html += '</div>';
html += '</div>';
$(document.body).prepend(html);
$('.viewMenuBar').trigger('create').lazyChildren();
$(document).trigger('headercreated');
bindMenuEvents();
} }
function bindMenuEvents() { function bindMenuEvents() {
@ -505,9 +522,7 @@
var viewMenuBar = $('.viewMenuBar'); var viewMenuBar = $('.viewMenuBar');
if (!$('.viewMenuBar').length) { if (!$('.viewMenuBar').length) {
ConnectionManager.user(window.ApiClient).done(function (user) { renderHeader();
renderHeader(user);
updateViewMenuBarHeadroom(page, $('.viewMenuBar')); updateViewMenuBarHeadroom(page, $('.viewMenuBar'));
updateCastIcon(); updateCastIcon();
@ -515,7 +530,9 @@
updateLibraryNavLinks(page); updateLibraryNavLinks(page);
updateContextText(page); updateContextText(page);
requiresViewMenuRefresh = false; requiresViewMenuRefresh = false;
});
ConnectionManager.user(window.ApiClient).done(addUserToHeader);
} else { } else {
updateContextText(page); updateContextText(page);
updateLibraryNavLinks(page); updateLibraryNavLinks(page);

View file

@ -633,35 +633,17 @@ var Dashboard = {
showUserFlyout: function (context) { showUserFlyout: function (context) {
ConnectionManager.user(window.ApiClient).done(function (user) {
var html = '<div data-role="panel" data-position="right" data-display="overlay" id="userFlyout" data-position-fixed="true" data-theme="a">'; var html = '<div data-role="panel" data-position="right" data-display="overlay" id="userFlyout" data-position-fixed="true" data-theme="a">';
html += '<h3>'; html += '<h3 class="userHeader">';
var imgWidth = 48;
if (user.imageUrl && AppInfo.enableUserImage) {
var url = user.imageUrl;
if (user.supportsImageParams) {
url += "&width=" + (imgWidth * Math.max(window.devicePixelRatio || 1, 2));
}
html += '<div class="lazy" data-src="' + url + '" style="width:' + imgWidth + 'px;height:' + imgWidth + 'px;background-size:contain;background-repeat:no-repeat;background-position:center center;border-radius:1000px;vertical-align:middle;margin-right:.8em;display:inline-block;"></div>';
}
html += user.name;
html += '</h3>'; html += '</h3>';
html += '<form>'; html += '<form>';
var isConnectMode = Dashboard.isConnectMode(); html += '<p class="preferencesContainer"></p>';
if (user.localUser && user.localUser.Policy.EnableUserPreferenceAccess) { if (Dashboard.isConnectMode()) {
html += '<p><a data-mini="true" data-role="button" href="mypreferencesdisplay.html?userId=' + user.localUser.Id + '" data-icon="gear">' + Globalize.translate('ButtonMyPreferences') + '</button></a>';
}
if (isConnectMode) {
html += '<p><a data-mini="true" data-role="button" href="selectserver.html" data-icon="cloud">' + Globalize.translate('ButtonSelectServer') + '</button></a>'; html += '<p><a data-mini="true" data-role="button" href="selectserver.html" data-icon="cloud">' + Globalize.translate('ButtonSelectServer') + '</button></a>';
} }
@ -676,9 +658,39 @@ var Dashboard = {
$(this).off("panelclose").remove(); $(this).off("panelclose").remove();
}); });
ConnectionManager.user(window.ApiClient).done(function (user) {
Dashboard.updateUserFlyout(elem, user);
}); });
}, },
updateUserFlyout: function (elem, user) {
var html = '';
var imgWidth = 48;
if (user.imageUrl && AppInfo.enableUserImage) {
var url = user.imageUrl;
if (user.supportsImageParams) {
url += "&width=" + (imgWidth * Math.max(window.devicePixelRatio || 1, 2));
}
html += '<div class="lazy" data-src="' + url + '" style="width:' + imgWidth + 'px;height:' + imgWidth + 'px;background-size:contain;background-repeat:no-repeat;background-position:center center;border-radius:1000px;vertical-align:middle;margin-right:.8em;display:inline-block;"></div>';
}
html += user.name;
$('.userHeader', elem).html(html).lazyChildren();
html = '';
if (user.localUser && user.localUser.Policy.EnableUserPreferenceAccess) {
html += '<p><a data-mini="true" data-role="button" href="mypreferencesdisplay.html?userId=' + user.localUser.Id + '" data-icon="gear">' + Globalize.translate('ButtonMyPreferences') + '</button></a>';
}
$('.preferencesContainer', elem).html(html).trigger('create');
},
getPluginSecurityInfo: function () { getPluginSecurityInfo: function () {
var apiClient = ApiClient; var apiClient = ApiClient;
@ -1568,37 +1580,32 @@ var AppInfo = {};
window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities); window.ConnectionManager = new MediaBrowser.ConnectionManager(Logger, credentialProvider, appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId, capabilities);
$(ConnectionManager).on('apiclientcreated', function (e, apiClient) { $(ConnectionManager).on('apiclientcreated', function (e, newApiClient) {
initializeApiClient(apiClient); initializeApiClient(newApiClient);
}); });
var lastApiClient = ConnectionManager.getLastUsedApiClient(); var apiClient;
if (Dashboard.isConnectMode()) { if (Dashboard.isConnectMode()) {
apiClient = ConnectionManager.getLastUsedApiClient();
if (!Dashboard.isServerlessPage()) { if (!Dashboard.isServerlessPage()) {
if (lastApiClient && lastApiClient.serverAddress() && lastApiClient.getCurrentUserId() && lastApiClient.accessToken()) { if (apiClient && apiClient.serverAddress() && apiClient.getCurrentUserId() && apiClient.accessToken()) {
window.ApiClient = lastApiClient;
initializeApiClient(lastApiClient);
//ConnectionManager.addApiClient(lastApiClient, true).fail(Dashboard.logout);
initializeApiClient(apiClient);
} }
} }
} else { } else {
if (!lastApiClient) { apiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId);
lastApiClient = new MediaBrowser.ApiClient(Logger, Dashboard.serverAddress(), appInfo.appName, appInfo.appVersion, appInfo.deviceName, appInfo.deviceId); ConnectionManager.addApiClient(apiClient);
ConnectionManager.addApiClient(lastApiClient);
} }
window.ApiClient = lastApiClient; window.ApiClient = apiClient;
}
if (window.ApiClient) { if (window.ApiClient) {
ApiClient.getDefaultImageQuality = Dashboard.getDefaultImageQuality; ApiClient.getDefaultImageQuality = Dashboard.getDefaultImageQuality;

View file

@ -365,7 +365,7 @@
var apiClient = window.ApiClient; var apiClient = window.ApiClient;
if (!apiClient) { if (!apiClient || !apiClient.getCurrentUserId()) {
return; return;
} }
@ -400,7 +400,7 @@
onCategorySyncButtonClick(page, this); onCategorySyncButtonClick(page, this);
}); });
}).on('pagebeforeshowready', ".libraryPage", function () { }).on('pageshowready', ".libraryPage", function () {
var page = this; var page = this;

View file

@ -122,6 +122,19 @@
apiClients.push(apiClient); apiClients.push(apiClient);
var existingServer = credentialProvider.credentials().servers.filter(function (s) {
return stringEqualsIgnoreCase(s.ManualAddress, apiClient.serverAddress());
})[0];
if (existingServer) {
existingServer.DateLastAccessed = new Date().getTime();
existingServer.LastConnectionMode = MediaBrowser.ConnectionMode.Manual;
apiClient.serverInfo(existingServer);
}
Events.on(apiClient, 'authenticated', function (e, result) { Events.on(apiClient, 'authenticated', function (e, result) {
onAuthenticated(this, result, {}, true); onAuthenticated(this, result, {}, true);
}); });
@ -130,7 +143,9 @@
return apiClient.getPublicSystemInfo().done(function (systemInfo) { return apiClient.getPublicSystemInfo().done(function (systemInfo) {
var server = credentialProvider.credentials().servers.filter(function (s) { var credentials = credentialProvider.credentials();
var server = credentials.servers.filter(function (s) {
return s.Id == systemInfo.Id; return s.Id == systemInfo.Id;
@ -138,7 +153,14 @@
updateServerInfo(server, systemInfo); updateServerInfo(server, systemInfo);
server.DateLastAccessed = new Date().getTime();
server.LastConnectionMode = MediaBrowser.ConnectionMode.Manual;
server.ManualAddress = apiClient.serverAddress();
apiClient.serverInfo(server); apiClient.serverInfo(server);
credentialProvider.addOrUpdateServer(credentials.servers, server);
credentialProvider.credentials(credentials);
}); });
}; };