mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
fix double path concatenation
This commit is contained in:
parent
008a512a5d
commit
4a999736b3
15 changed files with 287 additions and 22 deletions
19
ApiClient.js
19
ApiClient.js
|
@ -2018,11 +2018,28 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout, wi
|
|||
|
||||
options.imageType = "logo";
|
||||
|
||||
var logoItemId = item.HasLogo ? item.Id : item.ParentLogoItemId;
|
||||
var logoItemId = item.ImageTags && item.ImageTags.Logo ? item.Id : item.ParentLogoItemId;
|
||||
|
||||
return logoItemId ? self.getImageUrl(logoItemId, options) : null;
|
||||
};
|
||||
|
||||
self.getThumbImageUrl = function (item, options) {
|
||||
|
||||
if (!item) {
|
||||
throw new Error("null item");
|
||||
}
|
||||
|
||||
options = options || {
|
||||
|
||||
};
|
||||
|
||||
options.imageType = "thumb";
|
||||
|
||||
var itemId = item.ImageTags && item.ImageTags.Thumb ? item.Id : item.ParentThumbItemId;
|
||||
|
||||
return itemId ? self.getImageUrl(itemId, options) : null;
|
||||
};
|
||||
|
||||
/**
|
||||
* Constructs an array of backdrop image url's for an item
|
||||
* If the item doesn't have any backdrops, it will inherit them from a parent
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html" class="ui-btn-active">Genres</a>
|
||||
|
@ -53,6 +54,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
|
@ -64,6 +66,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html" class="ui-btn-active">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
|
|
|
@ -130,18 +130,6 @@
|
|||
$('.alphabetPicker', page).alphaValue(query.NameStartsWithOrGreater);
|
||||
}
|
||||
|
||||
function formatDigit(i) {
|
||||
return i < 10 ? "0" + i : i;
|
||||
}
|
||||
|
||||
function getDateFormat(date) {
|
||||
|
||||
// yyyyMMddHHmmss
|
||||
var d = date;
|
||||
|
||||
return "" + d.getFullYear() + formatDigit(d.getMonth() + 1) + formatDigit(d.getDate()) + formatDigit(d.getHours()) + formatDigit(d.getMinutes()) + formatDigit(d.getSeconds());
|
||||
}
|
||||
|
||||
$(document).on('pageinit', "#episodesPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
@ -246,7 +234,7 @@
|
|||
|
||||
query.LocationTypes = this.checked || futureChecked ? "virtual" : null;
|
||||
query.HasPremiereDate = this.checked || futureChecked ? true : null;
|
||||
query.MaxPremiereDate = this.checked ? getDateFormat(new Date()) : null;
|
||||
query.MaxPremiereDate = this.checked ? LibraryBrowser.getDateParamValue(new Date()) : null;
|
||||
|
||||
reloadItems(page);
|
||||
});
|
||||
|
@ -257,7 +245,7 @@
|
|||
|
||||
query.LocationTypes = this.checked || missingChecked ? "virtual" : null;
|
||||
query.HasPremiereDate = this.checked || missingChecked ? true : null;
|
||||
query.MinPremiereDate = this.checked ? getDateFormat(new Date()) : null;
|
||||
query.MinPremiereDate = this.checked ? LibraryBrowser.getDateParamValue(new Date()) : null;
|
||||
|
||||
reloadItems(page);
|
||||
});
|
||||
|
|
|
@ -46,10 +46,21 @@
|
|||
localStorage.setItem(key + '_' + Dashboard.getCurrentUserId(), JSON.stringify(values));
|
||||
},
|
||||
|
||||
getDateParamValue: function (date) {
|
||||
|
||||
function formatDigit(i) {
|
||||
return i < 10 ? "0" + i : i;
|
||||
}
|
||||
|
||||
var d = date;
|
||||
|
||||
return "" + d.getFullYear() + formatDigit(d.getMonth() + 1) + formatDigit(d.getDate()) + formatDigit(d.getHours()) + formatDigit(d.getMinutes()) + formatDigit(d.getSeconds());
|
||||
},
|
||||
|
||||
getPosterDetailViewHtml: function (options) {
|
||||
|
||||
var items = options.items;
|
||||
var currentYear;
|
||||
var currentIndexValue;
|
||||
|
||||
if (!options.shape) {
|
||||
options.shape = options.preferBackdrop ? "backdrop" : "poster";
|
||||
|
@ -66,10 +77,10 @@
|
|||
if (options.timeline) {
|
||||
var year = item.ProductionYear || "Unknown Year";
|
||||
|
||||
if (year != currentYear) {
|
||||
if (year != currentIndexValue) {
|
||||
|
||||
html += '<h2 class="timelineHeader">' + year + '</h2>';
|
||||
currentYear = year;
|
||||
currentIndexValue = year;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -643,6 +654,7 @@
|
|||
getPosterViewHtml: function (options) {
|
||||
|
||||
var items = options.items;
|
||||
var currentIndexValue;
|
||||
|
||||
options.shape = options.shape || "portrait";
|
||||
|
||||
|
@ -654,6 +666,29 @@
|
|||
|
||||
var item = items[i];
|
||||
|
||||
var futureDateText;
|
||||
|
||||
if (item.PremiereDate) {
|
||||
try {
|
||||
|
||||
futureDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(item.PremiereDate), true);
|
||||
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if (options.showPremiereDateIndex && futureDateText) {
|
||||
|
||||
var val = futureDateText || "Unknown Date";
|
||||
|
||||
if (val != currentIndexValue) {
|
||||
|
||||
html += '<h2 class="timelineHeader">' + val + '</h2>';
|
||||
currentIndexValue = val;
|
||||
}
|
||||
}
|
||||
|
||||
var imgUrl = null;
|
||||
var background = null;
|
||||
var width = null;
|
||||
|
@ -668,7 +703,37 @@
|
|||
tag: item.BackdropImageTags[0]
|
||||
});
|
||||
|
||||
} else if (item.ImageTags && item.ImageTags.Primary) {
|
||||
}
|
||||
else if (options.preferThumb && item.ImageTags && item.ImageTags.Thumb) {
|
||||
|
||||
imgUrl = ApiClient.getImageUrl(item, {
|
||||
type: "Thumb",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.ImageTags.Thumb
|
||||
});
|
||||
|
||||
}
|
||||
else if (options.preferThumb && item.SeriesThumbImageTag) {
|
||||
|
||||
imgUrl = ApiClient.getImageUrl(item.SeriesId, {
|
||||
type: "Thumb",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.SeriesThumbImageTag
|
||||
});
|
||||
|
||||
}
|
||||
else if (options.preferThumb && item.ParentThumbItemId) {
|
||||
|
||||
imgUrl = ApiClient.getThumbImageUrl(item, {
|
||||
type: "Thumb",
|
||||
height: 198,
|
||||
width: 352
|
||||
});
|
||||
|
||||
}
|
||||
else if (item.ImageTags && item.ImageTags.Primary) {
|
||||
|
||||
height = 300;
|
||||
width = primaryImageAspectRatio ? parseInt(height * primaryImageAspectRatio) : null;
|
||||
|
@ -703,6 +768,35 @@
|
|||
tag: item.BackdropImageTags[0]
|
||||
});
|
||||
|
||||
}
|
||||
else if (item.ImageTags && item.ImageTags.Thumb) {
|
||||
|
||||
imgUrl = ApiClient.getImageUrl(item, {
|
||||
type: "Thumb",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.ImageTags.Thumb
|
||||
});
|
||||
|
||||
}
|
||||
else if (item.SeriesThumbImageTag) {
|
||||
|
||||
imgUrl = ApiClient.getImageUrl(item.SeriesId, {
|
||||
type: "Thumb",
|
||||
height: 198,
|
||||
width: 352,
|
||||
tag: item.SeriesThumbImageTag
|
||||
});
|
||||
|
||||
}
|
||||
else if (item.ParentThumbItemId) {
|
||||
|
||||
imgUrl = ApiClient.getThumbImageUrl(item, {
|
||||
type: "Thumb",
|
||||
height: 198,
|
||||
width: 352
|
||||
});
|
||||
|
||||
}
|
||||
else if (item.MediaType == "Audio" || item.Type == "MusicAlbum" || item.Type == "MusicArtist") {
|
||||
|
||||
|
@ -786,6 +880,22 @@
|
|||
html += "</div>";
|
||||
}
|
||||
|
||||
if (options.showPremiereDate && item.PremiereDate) {
|
||||
|
||||
try {
|
||||
|
||||
var date = parseISO8601Date(item.PremiereDate);
|
||||
|
||||
html += "<div class='posterItemText'>";
|
||||
html += LibraryBrowser.getPremiereDateText(item, date);
|
||||
html += "</div>";
|
||||
|
||||
} catch (err) {
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (options.showProgressBar) {
|
||||
|
||||
html += "<div class='posterItemText posterItemProgress'>";
|
||||
|
@ -794,7 +904,9 @@
|
|||
}
|
||||
|
||||
if (item.LocationType == "Offline" || item.LocationType == "Virtual") {
|
||||
if (options.showLocationTypeIndicator !== false) {
|
||||
html += LibraryBrowser.getOfflineIndicatorHtml(item);
|
||||
}
|
||||
} else if (options.showNewIndicator !== false) {
|
||||
html += LibraryBrowser.getNewIndicatorHtml(item);
|
||||
}
|
||||
|
@ -806,6 +918,71 @@
|
|||
return html;
|
||||
},
|
||||
|
||||
isSameDay: function (date1, date2) {
|
||||
|
||||
return date1.getFullYear() == date2.getFullYear() && date1.getDate() == date2.getDate();
|
||||
|
||||
},
|
||||
|
||||
getFutureDateText: function (date, includeDayNamesInFuture) {
|
||||
|
||||
var weekday = [];
|
||||
weekday[0] = "Sunday";
|
||||
weekday[1] = "Monday";
|
||||
weekday[2] = "Tuesday";
|
||||
weekday[3] = "Wednesday";
|
||||
weekday[4] = "Thursday";
|
||||
weekday[5] = "Friday";
|
||||
weekday[6] = "Saturday";
|
||||
|
||||
var currentDate = new Date();
|
||||
|
||||
var day;
|
||||
|
||||
if (LibraryBrowser.isSameDay(date, currentDate)) {
|
||||
return "Today";
|
||||
}
|
||||
|
||||
currentDate.setDate(currentDate.getDate() + 1);
|
||||
if (LibraryBrowser.isSameDay(date, currentDate)) {
|
||||
return "Tomorrow";
|
||||
}
|
||||
|
||||
var todayDayOfWeek = new Date().getDay();
|
||||
currentDate.setDate(currentDate.getDate() + 1);
|
||||
|
||||
while (currentDate.getDay() > todayDayOfWeek) {
|
||||
|
||||
currentDate.setDate(currentDate.getDate() + 1);
|
||||
|
||||
if (LibraryBrowser.isSameDay(date, currentDate)) {
|
||||
|
||||
return weekday[currentDate.getDay()];
|
||||
}
|
||||
}
|
||||
|
||||
if (includeDayNamesInFuture) {
|
||||
return weekday[date.getDay()] + " " + date.toLocaleDateString();
|
||||
}
|
||||
|
||||
return date.toLocaleDateString();
|
||||
},
|
||||
|
||||
getPremiereDateText: function (item, date) {
|
||||
|
||||
var day = LibraryBrowser.getFutureDateText(date);
|
||||
|
||||
if (item.SeriesStudio) {
|
||||
day += " on " + item.SeriesStudio;
|
||||
}
|
||||
|
||||
if (item.AirTime) {
|
||||
day += " at " + item.AirTime;
|
||||
}
|
||||
|
||||
return day;
|
||||
},
|
||||
|
||||
getPosterViewDisplayName: function (item) {
|
||||
|
||||
var name = item.Name;
|
||||
|
|
|
@ -37,7 +37,8 @@
|
|||
Filters: "IsResumable",
|
||||
Limit: 8,
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData"
|
||||
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
|
||||
ExcludeLocationTypes: "Virtual"
|
||||
};
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||
|
|
42
dashboard-ui/scripts/tvupcoming.js
Normal file
42
dashboard-ui/scripts/tvupcoming.js
Normal file
|
@ -0,0 +1,42 @@
|
|||
(function ($, document) {
|
||||
|
||||
$(document).on('pagebeforeshow', "#tvUpcomingPage", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
var options = {
|
||||
|
||||
SortBy: "PremiereDate,AirTime",
|
||||
SortOrder: "Ascending",
|
||||
IncludeItemTypes: "Episode",
|
||||
Limit: 40,
|
||||
Recursive: true,
|
||||
Fields: "PrimaryImageAspectRatio,SeriesInfo,UserData",
|
||||
HasPremiereDate: true,
|
||||
MinPremiereDate: LibraryBrowser.getDateParamValue(new Date())
|
||||
};
|
||||
|
||||
ApiClient.getItems(Dashboard.getCurrentUserId(), options).done(function (result) {
|
||||
|
||||
if (!result.Items.length) {
|
||||
$('#upcomingItems', page).html("Nothing here. To utilize this feature, please enable future episodes in the dashboard metadata configuration.");
|
||||
return;
|
||||
}
|
||||
$('#upcomingItems', page).html(LibraryBrowser.getPosterViewHtml({
|
||||
items: result.Items,
|
||||
useAverageAspectRatio: true,
|
||||
showLocationTypeIndicator: false,
|
||||
showNewIndicator: false,
|
||||
shape: "backdrop",
|
||||
showTitle: true,
|
||||
showParentTitle: true,
|
||||
showPremiereDate: true,
|
||||
showPremiereDateIndex: true,
|
||||
preferThumb: true
|
||||
}));
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
})(jQuery, document);
|
|
@ -8,6 +8,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html" class="ui-btn-active">Genres</a>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html" class="ui-btn-active">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html" class="ui-btn-active">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html" class="ui-btn-active">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
|
|
30
dashboard-ui/tvupcoming.html
Normal file
30
dashboard-ui/tvupcoming.html
Normal file
|
@ -0,0 +1,30 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Media Browser</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="tvUpcomingPage" data-role="page" class="page libraryPage" data-theme="a" data-view="tv">
|
||||
<div class="libraryViewNav">
|
||||
<a href="tvrecommended.html">Suggested</a>
|
||||
<a href="tvnextup.html">Next up</a>
|
||||
<a href="tvupcoming.html" class="ui-btn-active">Upcoming</a>
|
||||
<a href="tvshows.html">Shows</a>
|
||||
<a href="episodes.html">Episodes</a>
|
||||
<a href="tvgenres.html">Genres</a>
|
||||
<a href="tvpeople.html">Actors</a>
|
||||
<a href="tvstudios.html">Networks</a>
|
||||
</div>
|
||||
<div data-role="content">
|
||||
<table class="ehsContent">
|
||||
<tr>
|
||||
<td>
|
||||
<div id="upcomingItems">
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
|
@ -1,6 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.180" targetFramework="net45" />
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.181" targetFramework="net45" />
|
||||
<package id="ServiceStack.Common" version="3.9.62" targetFramework="net45" />
|
||||
<package id="ServiceStack.Text" version="3.9.62" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue