From 719ae14d3f3efbb262ea7b6bb8904f88becf1c60 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sun, 16 Jan 2022 18:53:19 +0300 Subject: [PATCH 1/3] Add a second paging block on the Channels tab --- src/controllers/livetv.html | 3 +++ src/controllers/livetv/livetvchannels.js | 20 ++++++++++++-------- 2 files changed, 15 insertions(+), 8 deletions(-) diff --git a/src/controllers/livetv.html b/src/controllers/livetv.html index b1f60f4ef..2a484c6db 100644 --- a/src/controllers/livetv.html +++ b/src/controllers/livetv.html @@ -64,6 +64,9 @@
+
+
+
diff --git a/src/controllers/livetv/livetvchannels.js b/src/controllers/livetv/livetvchannels.js index cd7b50dd4..000cb5e3e 100644 --- a/src/controllers/livetv/livetvchannels.js +++ b/src/controllers/livetv/livetvchannels.js @@ -65,14 +65,18 @@ export default function (view, params, tabContent) { } const query = getQuery(); - context.querySelector('.paging').innerHTML = libraryBrowser.getQueryPagingHtml({ - startIndex: query.StartIndex, - limit: query.Limit, - totalRecordCount: result.TotalRecordCount, - showLimit: false, - updatePageSizeSetting: false, - filterButton: false - }); + + for (const elem of context.querySelectorAll('.paging')) { + elem.innerHTML = libraryBrowser.getQueryPagingHtml({ + startIndex: query.StartIndex, + limit: query.Limit, + totalRecordCount: result.TotalRecordCount, + showLimit: false, + updatePageSizeSetting: false, + filterButton: false + }); + } + const html = getChannelsHtml(result.Items); const elem = context.querySelector('#items'); elem.innerHTML = html; From 82dbfce37426f667577eba60fdba8ba83c8777b2 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sun, 16 Jan 2022 18:54:51 +0300 Subject: [PATCH 2/3] Fix autofocus on Channels tab This limits the focus scope to the current tab, so that the channel card is selected the first time you open it. [for testing] The Channels tab should be the default for the LiveTV library. --- src/controllers/livetv/livetvchannels.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/controllers/livetv/livetvchannels.js b/src/controllers/livetv/livetvchannels.js index 000cb5e3e..ce81e633c 100644 --- a/src/controllers/livetv/livetvchannels.js +++ b/src/controllers/livetv/livetvchannels.js @@ -120,7 +120,7 @@ export default function (view, params, tabContent) { isLoading = false; import('../../components/autoFocuser').then(({default: autoFocuser}) => { - autoFocuser.autoFocus(view); + autoFocuser.autoFocus(context); }); }); } From df0da76312603d83bd2f4f767d2df7fb17632639 Mon Sep 17 00:00:00 2001 From: Dmitry Lyzo Date: Sun, 16 Jan 2022 18:55:48 +0300 Subject: [PATCH 3/3] Add auto scroll top when using paging --- src/controllers/livetv/livetvchannels.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/controllers/livetv/livetvchannels.js b/src/controllers/livetv/livetvchannels.js index ce81e633c..9a82a3d53 100644 --- a/src/controllers/livetv/livetvchannels.js +++ b/src/controllers/livetv/livetvchannels.js @@ -50,7 +50,9 @@ export default function (view, params, tabContent) { if (userSettings.libraryPageSize() > 0) { query.StartIndex += query.Limit; } - reloadItems(context); + reloadItems(context).then(() => { + window.scrollTo(0, 0); + }); } function onPreviousPageClick() { @@ -61,7 +63,9 @@ export default function (view, params, tabContent) { if (userSettings.libraryPageSize() > 0) { query.StartIndex = Math.max(0, query.StartIndex - query.Limit); } - reloadItems(context); + reloadItems(context).then(() => { + window.scrollTo(0, 0); + }); } const query = getQuery(); @@ -114,7 +118,7 @@ export default function (view, params, tabContent) { const query = getQuery(); const apiClient = ApiClient; query.UserId = apiClient.getCurrentUserId(); - apiClient.getLiveTvChannels(query).then(function (result) { + return apiClient.getLiveTvChannels(query).then(function (result) { renderChannels(context, result); loading.hide(); isLoading = false;