32 lines
800 B
JavaScript
32 lines
800 B
JavaScript
/*
|
|
HOME — continue-watching row + trending rows.
|
|
*/
|
|
(function () {
|
|
'use strict';
|
|
|
|
SR.app.initChrome();
|
|
|
|
const sections = document.getElementById('sections');
|
|
|
|
const cont = SR.cards.continueRow();
|
|
if (cont) sections.appendChild(cont);
|
|
|
|
function appendRow(data, title) {
|
|
if (!data || !data.count) return;
|
|
sections.appendChild(SR.cards.row(title, data.results.map(SR.cards.normalizeItem)));
|
|
}
|
|
|
|
(async () => {
|
|
try {
|
|
appendRow(await SR.api.trending('movie', 'day'), 'Trending movies today');
|
|
} catch (e) {
|
|
SR.app.showError(e, 'could not load trending movies');
|
|
}
|
|
try {
|
|
appendRow(await SR.api.trending('tv', 'week'), 'Trending shows this week');
|
|
} catch (e) {
|
|
SR.app.showError(e, 'could not load trending shows');
|
|
}
|
|
})();
|
|
})();
|