2014-10-15 23:26:39 -04:00
|
|
|
|
(function ($, document) {
|
2014-06-23 12:05:19 -04:00
|
|
|
|
|
2015-03-24 21:14:24 -04:00
|
|
|
|
function loadSections(page, user) {
|
|
|
|
|
|
|
|
|
|
var userId = user.Id;
|
2014-06-23 12:05:19 -04:00
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
|
2014-09-30 00:47:30 -04:00
|
|
|
|
var context = 'home-latest';
|
|
|
|
|
|
2014-12-18 23:20:07 -05:00
|
|
|
|
var latestMediElem = $('.section0', page);
|
|
|
|
|
|
2015-06-16 00:52:01 -04:00
|
|
|
|
Sections.loadRecentlyAdded(latestMediElem, user, context);
|
2014-06-23 12:05:19 -04:00
|
|
|
|
Sections.loadLatestLiveTvRecordings($(".section1", page), userId);
|
|
|
|
|
Sections.loadLatestChannelItems($(".section2", page), userId);
|
|
|
|
|
}
|
|
|
|
|
|
2015-06-16 13:37:49 -04:00
|
|
|
|
$(document).on('pagebeforeshowready', "#homeLatestPage", function () {
|
2014-06-23 12:05:19 -04:00
|
|
|
|
|
|
|
|
|
var page = this;
|
|
|
|
|
|
2015-03-24 21:14:24 -04:00
|
|
|
|
Dashboard.getCurrentUser().done(function (user) {
|
|
|
|
|
loadSections(page, user);
|
|
|
|
|
});
|
2014-06-23 12:05:19 -04:00
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
2014-10-15 23:26:39 -04:00
|
|
|
|
})(jQuery, document);
|