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

display new fields on person page

This commit is contained in:
Luke Pulverenti 2013-04-12 14:22:40 -04:00
parent 8785935d23
commit 0d19fce987
4 changed files with 50 additions and 20 deletions

View file

@ -17,10 +17,13 @@
</div> </div>
<div class="itemDetailBlock"> <div class="itemDetailBlock">
<p id="itemMiscInfo" class="itemMiscInfo"></p>
<p id="itemOverview"></p> <p id="itemOverview"></p>
<p id="itemMiscInfo" class="itemMiscInfo"></p>
<p id="itemRatings"></p> <p id="itemRatings"></p>
<p id="itemBirthday"></p>
<p id="itemBirthLocation"></p>
<p id="itemDeathDate"></p>
<p id="itemLinks"></p> <p id="itemLinks"></p>
</div> </div>

View file

@ -109,7 +109,7 @@ function humane_date(date_str) {
]; ];
var dt = new Date; var dt = new Date;
var date = parseISO8601Date(date_str, true); var date = parseISO8601Date(date_str, { toLocal: true });
var seconds = ((dt - date) / 1000); var seconds = ((dt - date) / 1000);
var token = ' ago'; var token = ' ago';
@ -173,7 +173,9 @@ function getParameterByName(name) {
return decodeURIComponent(results[1].replace(/\+/g, " ")); return decodeURIComponent(results[1].replace(/\+/g, " "));
} }
function parseISO8601Date(s, toLocal) { function parseISO8601Date(s, options) {
options = options || {};
// parenthese matches: // parenthese matches:
// year month day hours minutes seconds // year month day hours minutes seconds
@ -181,8 +183,7 @@ function parseISO8601Date(s, toLocal) {
// tzstring plusminus hours minutes // tzstring plusminus hours minutes
var re = /(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d+)?(Z|([+-])(\d\d):(\d\d))/; var re = /(\d{4})-(\d\d)-(\d\d)T(\d\d):(\d\d):(\d\d)(\.\d+)?(Z|([+-])(\d\d):(\d\d))/;
var d = []; var d = s.match(re);
d = s.match(re);
// "2010-12-07T11:00:00.000-09:00" parses to: // "2010-12-07T11:00:00.000-09:00" parses to:
// ["2010-12-07T11:00:00.000-09:00", "2010", "12", "07", "11", // ["2010-12-07T11:00:00.000-09:00", "2010", "12", "07", "11",
@ -192,6 +193,7 @@ function parseISO8601Date(s, toLocal) {
// "00", "00", ".000", "Z", undefined, undefined, undefined] // "00", "00", ".000", "Z", undefined, undefined, undefined]
if (!d) { if (!d) {
throw "Couldn't parse ISO 8601 date string '" + s + "'"; throw "Couldn't parse ISO 8601 date string '" + s + "'";
} }
@ -223,7 +225,7 @@ function parseISO8601Date(s, toLocal) {
} else { } else {
ms += offset; ms += offset;
} }
} else if (!toLocal) { } else if (!options.toLocal) {
ms += new Date().getTimezoneOffset() * 60000; ms += new Date().getTimezoneOffset() * 60000;
} }

View file

@ -52,6 +52,33 @@
renderUserDataIcons(page, item); renderUserDataIcons(page, item);
renderLinks(page, item); renderLinks(page, item);
if (item.Type == "Person" && item.PremiereDate) {
var birthday = parseISO8601Date(item.PremiereDate, { toLocal: true }).toDateString();
$('#itemBirthday', page).show().html("Birthday:&nbsp;&nbsp;" + birthday);
} else {
$('#itemBirthday', page).hide();
}
if (item.Type == "Person" && item.EndDate) {
var deathday = parseISO8601Date(item.EndDate, { toLocal: true }).toDateString();
$('#itemDeathDate', page).show().html("Death day:&nbsp;&nbsp;" + deathday);
} else {
$('#itemDeathDate', page).hide();
}
if (item.Type == "Person" && item.ProductionLocations && item.ProductionLocations.length) {
var gmap = '<a target="_blank" href="https://maps.google.com/maps?q=' + item.ProductionLocations[0] + '">' + item.ProductionLocations[0] + '</a>';
$('#itemBirthLocation', page).show().html("Birth place:&nbsp;&nbsp;" + gmap).trigger('create');
} else {
$('#itemBirthLocation', page).hide();
}
} }
function renderLinks(page, item) { function renderLinks(page, item) {

View file

@ -1,7 +1,7 @@
$.ajaxSetup({ $.ajaxSetup({
crossDomain: true, crossDomain: true,
error: function (event, jqxhr, settings, exception) { error: function (event) {
Dashboard.hideLoadingMsg(); Dashboard.hideLoadingMsg();
if (!Dashboard.suppressAjaxErrors) { if (!Dashboard.suppressAjaxErrors) {
@ -23,8 +23,6 @@ $(document).one('click', WebNotifications.requestPermission);
var Dashboard = { var Dashboard = {
jQueryMobileInit: function () { jQueryMobileInit: function () {
//$.mobile.defaultPageTransition = 'slide';
// Page // Page
//$.mobile.page.prototype.options.theme = "a"; //$.mobile.page.prototype.options.theme = "a";
//$.mobile.page.prototype.options.headerTheme = "a"; //$.mobile.page.prototype.options.headerTheme = "a";