mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update translations
This commit is contained in:
parent
b26707208f
commit
0784ca7a0a
29 changed files with 331 additions and 183 deletions
|
@ -1,79 +1,8 @@
|
|||
(function ($, document) {
|
||||
|
||||
function reloadFromChannels(page, channels) {
|
||||
|
||||
var channelsHtml = channels.map(function (c) {
|
||||
|
||||
return '<div id="channel' + c.Id + '"></div>';
|
||||
|
||||
}).join('');
|
||||
|
||||
$('.items', page).html(channelsHtml);
|
||||
|
||||
for (var i = 0, length = channels.length; i < length; i++) {
|
||||
|
||||
var channel = channels[i];
|
||||
|
||||
reloadFromChannel(page, channel, i);
|
||||
}
|
||||
}
|
||||
|
||||
function reloadFromChannel(page, channel, index) {
|
||||
|
||||
var screenWidth = $(window).width();
|
||||
|
||||
var options = {
|
||||
|
||||
Limit: screenWidth >= 1920 ? 10 : (screenWidth >= 1440 ? 8 : (screenWidth >= 800 ? 6 : 6)),
|
||||
Fields: "PrimaryImageAspectRatio",
|
||||
Filters: "IsUnplayed",
|
||||
UserId: Dashboard.getCurrentUserId(),
|
||||
ChannelIds: channel.Id
|
||||
};
|
||||
|
||||
$.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
if (result.Items.length) {
|
||||
|
||||
var text = Globalize.translate('HeaderLatestFromChannel').replace('{0}', channel.Name);
|
||||
if (index) {
|
||||
html += '<h1 class="listHeader">' + text + '</h1>';
|
||||
} else {
|
||||
html += '<h1 class="listHeader firstListHeader">' + text + '</h1>';
|
||||
}
|
||||
}
|
||||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: 'auto',
|
||||
defaultShape: 'square',
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
context: 'channels',
|
||||
lazy: true
|
||||
});
|
||||
|
||||
$('#channel' + channel.Id + '', page).html(html).trigger('create').createPosterItemMenus();
|
||||
});
|
||||
}
|
||||
|
||||
function reloadItems(page) {
|
||||
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var options = {
|
||||
|
||||
UserId: Dashboard.getCurrentUserId(),
|
||||
SupportsLatestItems: true
|
||||
};
|
||||
|
||||
$.getJSON(ApiClient.getUrl("Channels", options)).done(function (result) {
|
||||
|
||||
reloadFromChannels(page, result.Items);
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
Sections.loadLatestChannelItems($(".items", page), Dashboard.getCurrentUserId());
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#channelsLatestPage", function () {
|
||||
|
|
|
@ -13,6 +13,16 @@
|
|||
return true;
|
||||
}
|
||||
|
||||
function htmlEncode(value) {
|
||||
//create a in-memory div, set it's inner text(which jQuery automatically encodes)
|
||||
//then grab the encoded contents back out. The div never exists on the page.
|
||||
return $('<div/>').text(value).html();
|
||||
}
|
||||
|
||||
function htmlDecode(value) {
|
||||
return $('<div/>').html(value).text();
|
||||
}
|
||||
|
||||
// Array Remove - By John Resig (MIT Licensed)
|
||||
Array.prototype.remove = function (from, to) {
|
||||
var rest = this.slice((to || from) + 1 || this.length);
|
||||
|
|
35
dashboard-ui/scripts/homelatest.js
Normal file
35
dashboard-ui/scripts/homelatest.js
Normal file
|
@ -0,0 +1,35 @@
|
|||
(function ($, document, apiClient) {
|
||||
|
||||
function loadSections(page, userId) {
|
||||
|
||||
var i, length;
|
||||
var sectionCount = 3;
|
||||
|
||||
var elem = $('.sections', page);
|
||||
|
||||
if (!elem.html().length) {
|
||||
var html = '';
|
||||
for (i = 0, length = sectionCount; i < length; i++) {
|
||||
|
||||
html += '<div class="homePageSection section' + i + '"></div>';
|
||||
}
|
||||
|
||||
elem.html(html);
|
||||
}
|
||||
|
||||
Sections.loadRecentlyAdded($('.section0', page), userId);
|
||||
Sections.loadLatestLiveTvRecordings($(".section1", page), userId);
|
||||
Sections.loadLatestChannelItems($(".section2", page), userId);
|
||||
}
|
||||
|
||||
$(document).on('pagebeforeshow', "#homeLatestPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var userId = Dashboard.getCurrentUserId();
|
||||
|
||||
loadSections(page, userId);
|
||||
|
||||
});
|
||||
|
||||
})(jQuery, document, ApiClient);
|
|
@ -14,24 +14,6 @@
|
|||
return deferred.promise();
|
||||
}
|
||||
|
||||
function getDefaultSection(index) {
|
||||
|
||||
switch (index) {
|
||||
|
||||
case 0:
|
||||
return 'smalllibrarytiles';
|
||||
case 1:
|
||||
return 'resume';
|
||||
case 2:
|
||||
return 'latestmedia';
|
||||
case 3:
|
||||
return '';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function loadRecentlyAdded(elem, userId) {
|
||||
|
||||
var screenWidth = $(window).width();
|
||||
|
@ -40,7 +22,7 @@
|
|||
|
||||
SortBy: "DateCreated",
|
||||
SortOrder: "Descending",
|
||||
Limit: screenWidth >= 2400 ? 30 : (screenWidth >= 1920 ? 20 : (screenWidth >= 1440 ? 10 : (screenWidth >= 800 ? 9 : 8))),
|
||||
Limit: screenWidth >= 2400 ? 30 : (screenWidth >= 1920 ? 15 : (screenWidth >= 1440 ? 10 : (screenWidth >= 800 ? 9 : 8))),
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio",
|
||||
Filters: "IsUnplayed,IsNotFolder",
|
||||
|
@ -115,9 +97,12 @@
|
|||
|
||||
if (items.length) {
|
||||
|
||||
var cssClass = index ? 'listHeader' : 'listHeader firstListHeader';
|
||||
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
|
||||
|
||||
html += '<h1 class="' + cssClass + '">' + Globalize.translate('HeaderMyLibrary') + '</h1>';
|
||||
html += '<div>';
|
||||
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + Globalize.translate('HeaderMyViews') + '</h1>';
|
||||
html += '<a href="mypreferencesdisplay.html" data-role="button" data-icon="edit" data-mini="true" data-inline="true" data-iconpos="notext" class="sectionHeaderButton">d</a>';
|
||||
html += '</div>';
|
||||
|
||||
html += '<div>';
|
||||
html += LibraryBrowser.getPosterViewHtml({
|
||||
|
@ -214,6 +199,158 @@
|
|||
});
|
||||
}
|
||||
|
||||
function handleLibraryLinkNavigations(elem) {
|
||||
|
||||
$('a.posterItem', elem).on('click', function () {
|
||||
|
||||
var text = $('.posterItemText', this).html();
|
||||
|
||||
LibraryMenu.setText(text);
|
||||
});
|
||||
}
|
||||
|
||||
function loadLatestChannelItems(elem, userId, options) {
|
||||
|
||||
options = $.extend(options || {}, {
|
||||
|
||||
UserId: userId,
|
||||
SupportsLatestItems: true
|
||||
});
|
||||
|
||||
$.getJSON(ApiClient.getUrl("Channels", options)).done(function (result) {
|
||||
|
||||
var channels = result.Items;
|
||||
|
||||
var channelsHtml = channels.map(function (c) {
|
||||
|
||||
return '<div id="channel' + c.Id + '"></div>';
|
||||
|
||||
}).join('');
|
||||
|
||||
$(elem).html(channelsHtml);
|
||||
|
||||
for (var i = 0, length = channels.length; i < length; i++) {
|
||||
|
||||
var channel = channels[i];
|
||||
|
||||
loadLatestChannelItemsFromChannel(elem, channel, i);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
function loadLatestChannelItemsFromChannel(page, channel, index) {
|
||||
|
||||
var screenWidth = $(window).width();
|
||||
|
||||
var options = {
|
||||
|
||||
Limit: screenWidth >= 1920 ? 9 : (screenWidth >= 1440 ? 8 : (screenWidth >= 800 ? 6 : 6)),
|
||||
Fields: "PrimaryImageAspectRatio",
|
||||
Filters: "IsUnplayed",
|
||||
UserId: Dashboard.getCurrentUserId(),
|
||||
ChannelIds: channel.Id
|
||||
};
|
||||
|
||||
$.getJSON(ApiClient.getUrl("Channels/Items/Latest", options)).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
if (result.Items.length) {
|
||||
|
||||
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
|
||||
|
||||
html += '<div>';
|
||||
var text = Globalize.translate('HeaderLatestFromChannel').replace('{0}', channel.Name);
|
||||
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + text + '</h1>';
|
||||
html += '<a href="channelitems.html?context=channels&id=' + channel.Id + '" data-role="button" data-icon="arrow-r" data-mini="true" data-inline="true" data-iconpos="notext" class="sectionHeaderButton">d</a>';
|
||||
html += '</div>';
|
||||
}
|
||||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: 'auto',
|
||||
defaultShape: 'square',
|
||||
showTitle: true,
|
||||
centerText: true,
|
||||
context: 'channels',
|
||||
lazy: true
|
||||
});
|
||||
|
||||
$('#channel' + channel.Id + '', page).html(html).trigger('create').createPosterItemMenus();
|
||||
});
|
||||
}
|
||||
|
||||
function loadLatestLiveTvRecordings(elem, userId, index) {
|
||||
|
||||
ApiClient.getLiveTvRecordings({
|
||||
|
||||
userId: userId,
|
||||
limit: 9,
|
||||
IsInProgress: false
|
||||
|
||||
}).done(function (result) {
|
||||
|
||||
var html = '';
|
||||
|
||||
if (result.Items.length) {
|
||||
|
||||
var cssClass = index !== 0 ? 'listHeader' : 'listHeader firstListHeader';
|
||||
|
||||
html += '<div>';
|
||||
html += '<h1 style="display:inline-block; vertical-align:middle;" class="' + cssClass + '">' + Globalize.translate('HeaderLatestTvRecordings') + '</h1>';
|
||||
html += '<a href="livetvrecordings.html?context=livetv" data-role="button" data-icon="arrow-r" data-mini="true" data-inline="true" data-iconpos="notext" class="sectionHeaderButton">d</a>';
|
||||
html += '</div>';
|
||||
}
|
||||
|
||||
var screenWidth = $(window).width();
|
||||
|
||||
html += LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
shape: "auto",
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
overlayText: screenWidth >= 600,
|
||||
coverImage: true,
|
||||
lazy: true
|
||||
});
|
||||
|
||||
elem.html(html).trigger('create').createPosterItemMenus();
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
window.Sections = {
|
||||
loadRecentlyAdded: loadRecentlyAdded,
|
||||
loadLatestChannelMedia: loadLatestChannelMedia,
|
||||
loadLibraryTiles: loadLibraryTiles,
|
||||
loadLibraryFolders: loadLibraryFolders,
|
||||
loadResume: loadResume,
|
||||
loadLatestChannelItems: loadLatestChannelItems,
|
||||
loadLatestLiveTvRecordings: loadLatestLiveTvRecordings
|
||||
};
|
||||
|
||||
})(jQuery, document, ApiClient);
|
||||
|
||||
(function ($, document, apiClient) {
|
||||
|
||||
function getDefaultSection(index) {
|
||||
|
||||
switch (index) {
|
||||
|
||||
case 0:
|
||||
return 'smalllibrarytiles';
|
||||
case 1:
|
||||
return 'resume';
|
||||
case 2:
|
||||
return '';
|
||||
case 3:
|
||||
return '';
|
||||
default:
|
||||
return '';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function loadSection(page, userId, displayPreferences, index) {
|
||||
|
||||
var section = displayPreferences.CustomPrefs['home' + index] || getDefaultSection(index);
|
||||
|
@ -221,23 +358,27 @@
|
|||
var elem = $('.section' + index, page);
|
||||
|
||||
if (section == 'latestmedia') {
|
||||
loadRecentlyAdded(elem, userId);
|
||||
Sections.loadRecentlyAdded(elem, userId);
|
||||
}
|
||||
else if (section == 'librarytiles') {
|
||||
loadLibraryTiles(elem, userId, 'backdrop', index);
|
||||
Sections.loadLibraryTiles(elem, userId, 'backdrop', index);
|
||||
}
|
||||
else if (section == 'smalllibrarytiles' || section == 'librarybuttons') {
|
||||
loadLibraryTiles(elem, userId, 'miniBackdrop', index);
|
||||
Sections.loadLibraryTiles(elem, userId, 'smallBackdrop', index);
|
||||
}
|
||||
else if (section == 'resume') {
|
||||
loadResume(elem, userId);
|
||||
Sections.loadResume(elem, userId);
|
||||
}
|
||||
|
||||
else if (section == 'latesttvrecordings') {
|
||||
Sections.loadLatestLiveTvRecordings(elem, userId);
|
||||
}
|
||||
|
||||
else if (section == 'folders') {
|
||||
loadLibraryFolders(elem, userId, 'backdrop', index);
|
||||
Sections.loadLibraryFolders(elem, userId, 'smallBackdrop', index);
|
||||
|
||||
} else if (section == 'latestchannelmedia') {
|
||||
loadLatestChannelMedia(elem, userId);
|
||||
Sections.loadLatestChannelMedia(elem, userId);
|
||||
|
||||
} else {
|
||||
|
||||
|
@ -268,16 +409,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
function handleLibraryLinkNavigations(elem) {
|
||||
|
||||
$('a', elem).on('click', function () {
|
||||
|
||||
var text = $('.posterItemText', this).html();
|
||||
|
||||
LibraryMenu.setText(text);
|
||||
});
|
||||
}
|
||||
|
||||
var homePageDismissValue = '2';
|
||||
|
||||
function dismissWelcome(page, userId) {
|
||||
|
|
|
@ -377,11 +377,11 @@
|
|||
return 'movieslatest.html?topParentId=' + item.Id;
|
||||
}
|
||||
|
||||
if (item.CollectionType == 'boxsets' || item.Type == 'ManualCollectionsFolder') {
|
||||
if (item.CollectionType == 'boxsets') {
|
||||
return 'collections.html?topParentId=' + item.Id;
|
||||
}
|
||||
|
||||
if (item.CollectionType == 'trailers' || item.Type == 'TrailerCollectionFolder') {
|
||||
if (item.CollectionType == 'trailers') {
|
||||
return 'movietrailers.html?topParentId=' + item.Id;
|
||||
}
|
||||
|
||||
|
@ -807,7 +807,7 @@
|
|||
|
||||
if (!imgUrl && !options.showTitle) {
|
||||
html += "<div class='posterItemDefaultText'>";
|
||||
html += name;
|
||||
html += htmlEncode(name);
|
||||
html += "</div>";
|
||||
}
|
||||
|
||||
|
@ -828,7 +828,7 @@
|
|||
|
||||
if (options.showTitle || forceName) {
|
||||
|
||||
lines.push(name);
|
||||
lines.push(htmlEncode(name));
|
||||
}
|
||||
|
||||
if (options.showItemCounts) {
|
||||
|
|
|
@ -34,15 +34,16 @@
|
|||
|
||||
html += '<div class="posterItemOverlayInner">';
|
||||
|
||||
var isSmallItem = $(posterItem).hasClass('smallBackdropPosterItem');
|
||||
var isSmallItem = $(posterItem).hasClass('smallBackdropPosterItem') || $(posterItem).hasClass('miniBackdropPosterItem');
|
||||
var isMiniItem = $(posterItem).hasClass('miniBackdropPosterItem');
|
||||
var isPortrait = $(posterItem).hasClass('portraitPosterItem');
|
||||
var isSquare = $(posterItem).hasClass('squarePosterItem');
|
||||
|
||||
var parentName = isSmallItem || isPortrait ? null : item.SeriesName;
|
||||
var parentName = isSmallItem || isMiniItem || isPortrait ? null : item.SeriesName;
|
||||
var name = LibraryBrowser.getPosterViewDisplayName(item, true);
|
||||
|
||||
html += '<div style="font-weight:bold;margin-bottom:1em;">';
|
||||
var logoHeight = isSmallItem ? 20 : 26;
|
||||
var logoHeight = isSmallItem || isMiniItem ? 20 : 26;
|
||||
var maxLogoWidth = isPortrait ? 100 : 200;
|
||||
var imgUrl;
|
||||
|
||||
|
@ -76,27 +77,29 @@
|
|||
html += '<p>';
|
||||
html += name;
|
||||
html += '</p>';
|
||||
} else if (!isSmallItem) {
|
||||
} else if (!isSmallItem && !isMiniItem) {
|
||||
html += '<p class="itemMiscInfo" style="white-space:nowrap;">';
|
||||
html += LibraryBrowser.getMiscInfoHtml(item);
|
||||
html += '</p>';
|
||||
}
|
||||
|
||||
html += '<div style="margin:1.25em 0;">';
|
||||
html += '<span class="itemCommunityRating">';
|
||||
html += LibraryBrowser.getRatingHtml(item, false);
|
||||
html += '</span>';
|
||||
if (!isMiniItem) {
|
||||
html += '<div style="margin:1.25em 0;">';
|
||||
html += '<span class="itemCommunityRating">';
|
||||
html += LibraryBrowser.getRatingHtml(item, false);
|
||||
html += '</span>';
|
||||
|
||||
if (isPortrait) {
|
||||
html += '<span class="userDataIcons" style="display:block;margin:1.25em 0;">';
|
||||
html += LibraryBrowser.getUserDataIconsHtml(item);
|
||||
html += '</span>';
|
||||
} else {
|
||||
html += '<span class="userDataIcons">';
|
||||
html += LibraryBrowser.getUserDataIconsHtml(item);
|
||||
html += '</span>';
|
||||
if (isPortrait) {
|
||||
html += '<span class="userDataIcons" style="display:block;margin:1.25em 0;">';
|
||||
html += LibraryBrowser.getUserDataIconsHtml(item);
|
||||
html += '</span>';
|
||||
} else {
|
||||
html += '<span class="userDataIcons">';
|
||||
html += LibraryBrowser.getUserDataIconsHtml(item);
|
||||
html += '</span>';
|
||||
}
|
||||
html += '</div>';
|
||||
}
|
||||
html += '</div>';
|
||||
|
||||
html += '<div>';
|
||||
|
||||
|
@ -179,9 +182,7 @@
|
|||
|
||||
}
|
||||
|
||||
$.fn.createPosterItemMenus = function (options) {
|
||||
|
||||
options = options || {};
|
||||
$.fn.createPosterItemMenus = function () {
|
||||
|
||||
var preventHover = false;
|
||||
|
||||
|
@ -243,7 +244,7 @@
|
|||
preventHover = true;
|
||||
}
|
||||
|
||||
var elems = '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem';
|
||||
var elems = '.backdropPosterItem,.smallBackdropPosterItem,.portraitPosterItem,.squarePosterItem,.miniBackdropPosterItem';
|
||||
|
||||
return this.off('.posterItemHoverMenu')
|
||||
.on('mouseenter.posterItemHoverMenu', elems, onHoverIn)
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
|
||||
html += '<a class="headerButton headerButtonRight headerUserButton" href="#" onclick="Dashboard.showUserFlyout(this);">';
|
||||
|
||||
var userButtonHeight = 22;
|
||||
var userButtonHeight = 21;
|
||||
if (user.PrimaryImageTag) {
|
||||
|
||||
var url = ApiClient.getUserImageUrl(user.Id, {
|
||||
|
|
|
@ -209,7 +209,7 @@
|
|||
|
||||
$(document).on('headercreated', function (e) {
|
||||
|
||||
$('<a class="headerButton headerButtonRight btnNotifications" href="#" title="Notifications"><div class="btnNotificationsInner">0</div></a>').insertBefore($('.headerUserButton')).on('click', Notifications.showNotificationsFlyout);
|
||||
$('<a class="headerButton headerButtonRight btnNotifications" href="#" title="Notifications"><div class="btnNotificationsInner">0</div></a>').insertAfter($('.headerUserButton')).on('click', Notifications.showNotificationsFlyout);
|
||||
|
||||
Notifications.updateNotificationCount();
|
||||
});
|
||||
|
|
|
@ -231,7 +231,7 @@ var Dashboard = {
|
|||
var html = '<span style="margin-right: 1em;">Please restart to finish updating.</span>';
|
||||
|
||||
if (systemInfo.CanSelfRestart) {
|
||||
html += '<button type="button" data-icon="refresh" onclick="$(this).buttonEnabled(false);Dashboard.restartServer();" data-theme="b" data-inline="true" data-mini="true">Restart Server</button>';
|
||||
html += '<button type="button" data-icon="refresh" onclick="$(this).buttonEnabled(false);Dashboard.restartServer();" data-theme="b" data-inline="true" data-mini="true">Restart</button>';
|
||||
}
|
||||
|
||||
Dashboard.showFooterNotification({ id: "serverRestartWarning", html: html, forceShow: true, allowHide: false });
|
||||
|
|
|
@ -104,8 +104,10 @@
|
|||
|
||||
if (result.Items.length) {
|
||||
$('#resumableSection', page).show();
|
||||
$('.nextUpHeader', page).removeClass('firstListHeader');
|
||||
} else {
|
||||
$('#resumableSection', page).hide();
|
||||
$('.nextUpHeader', page).addClass('firstListHeader');
|
||||
}
|
||||
|
||||
$('#resumableItems', page).html(LibraryBrowser.getPosterViewHtml({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue