jellyfin-web/dashboard-ui/scripts/homelatest.js

41 lines
1013 B
JavaScript
Raw Normal View History

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