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/homelatest.js

48 lines
1.2 KiB
JavaScript
Raw Normal View History

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-20 20:49:42 -04:00
Dashboard.showLoadingMsg();
var promises = [];
promises.push(Sections.loadRecentlyAdded(latestMediElem, user, context));
promises.push(Sections.loadLatestLiveTvRecordings($(".section1", page), userId));
promises.push(Sections.loadLatestChannelItems($(".section2", page), userId));
$.when(promises).done(function() {
Dashboard.hideLoadingMsg();
});
2014-06-23 12:05:19 -04:00
}
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);