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

70 lines
1.6 KiB
JavaScript
Raw Normal View History

2016-05-05 22:55:15 -04:00
define(['datetime'], function (datetime) {
2015-05-22 15:16:14 -04:00
2015-09-08 00:22:38 -04:00
function getTimersHtml(timers) {
2016-05-06 14:17:02 -04:00
var items = timers.map(function (t) {
t.Type = 'Timer';
return t;
});
var html = LibraryBrowser.getPosterViewHtml({
items: items,
shape: "square",
showTitle: true,
showAirTime: true,
2016-05-06 14:54:14 -04:00
showChannelName: true,
2016-05-06 14:17:02 -04:00
lazy: true,
cardLayout: true,
showDetailsMenu: true
});
return Promise.resolve(html);
2015-09-08 00:22:38 -04:00
}
2015-05-22 15:16:14 -04:00
window.LiveTvHelpers = {
getDaysOfWeek: function () {
var days = [
'Sunday',
'Monday',
'Tuesday',
'Wednesday',
'Thursday',
'Friday',
'Saturday'
];
return days.map(function (d) {
return {
name: d,
value: d
};
});
},
renderOriginalAirDate: function (elem, item) {
2015-09-29 12:29:06 -04:00
var airDate = item.PremiereDate;
2015-05-22 15:16:14 -04:00
if (airDate && item.IsRepeat) {
try {
2016-05-06 00:50:06 -04:00
airDate = datetime.parseISO8601Date(airDate, true).toLocaleDateString();
2015-05-22 15:16:14 -04:00
}
catch (e) {
2015-12-23 12:46:01 -05:00
console.log("Error parsing date: " + airDate);
2015-05-22 15:16:14 -04:00
}
elem.html(Globalize.translate('ValueOriginalAirDate').replace('{0}', airDate)).show();
} else {
elem.hide();
}
2015-09-08 00:22:38 -04:00
},
getTimersHtml: getTimersHtml
2015-05-22 15:16:14 -04:00
};
});