define([], function () { function getTimersHtml(timers) { return new Promise(function (resolve, reject) { require(['paper-fab', 'paper-item-body', 'paper-icon-item'], function () { var html = ''; var index = ''; var imgUrl; for (var i = 0, length = timers.length; i < length; i++) { var timer = timers[i]; var startDateText = LibraryBrowser.getFutureDateText(parseISO8601Date(timer.StartDate, { toLocal: true })); if (startDateText != index) { if (index) { html += ''; html += ''; } html += '
'; html += '

' + startDateText + '

'; html += '
'; index = startDateText; } html += ''; var program = timer.ProgramInfo || {}; imgUrl = null; if (program.ImageTags && program.ImageTags.Primary) { imgUrl = ApiClient.getScaledImageUrl(program.Id, { height: 80, tag: program.ImageTags.Primary, type: "Primary" }); } if (imgUrl) { html += ''; } else if (program.IsKids) { html += ''; } else if (program.IsSports) { html += ''; } else if (program.IsMovie) { html += ''; } else if (program.IsNews) { html += ''; } else { html += ''; } html += ''; html += ''; html += '
'; html += timer.Name; html += '
'; html += '
'; html += LibraryBrowser.getDisplayTime(timer.StartDate); html += ' - ' + LibraryBrowser.getDisplayTime(timer.EndDate); html += '
'; html += '
'; html += '
'; if (timer.SeriesTimerId) { html += '
'; html += '
'; html += '
'; html += '
'; html += '
'; } html += ''; html += '
'; } if (timers.length) { html += '
'; html += '
'; } resolve(html); }); }); } 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) { var airDate = item.PremiereDate; if (airDate && item.IsRepeat) { try { airDate = parseISO8601Date(airDate, { toLocal: true }).toLocaleDateString(); } catch (e) { console.log("Error parsing date: " + airDate); } elem.html(Globalize.translate('ValueOriginalAirDate').replace('{0}', airDate)).show(); } else { elem.hide(); } }, getTimersHtml: getTimersHtml }; });