From e8c2388589494f1370231154ffb2030c3871291b Mon Sep 17 00:00:00 2001 From: RadoslavL Date: Thu, 26 Oct 2023 11:30:12 +0300 Subject: [PATCH] Removed the purging of the query parameters --- assets/js/pagination.js | 12 ++++++++++-- src/invidious/frontend/pagination.cr | 6 +++--- src/invidious/views/channel.ecr | 1 + 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/assets/js/pagination.js b/assets/js/pagination.js index 61473d55..2d985920 100644 --- a/assets/js/pagination.js +++ b/assets/js/pagination.js @@ -32,14 +32,22 @@ function button_press(){ // On the first page, the stored continuation token is null. if (prev_ctoken === null) { sessionStorage.removeItem(CONT_CACHE_KEY); - window.location.href = window.location.href.split('?')[0]; + let url = window.location.href.split('?')[0]; + let params = window.location.href.split('?')[1]; + let url_params = new URLSearchParams(params); + url_params.delete('continuation'); + window.location.href = `${url}?${url_params.toString()}`; return; } sessionStorage.setItem(CONT_CACHE_KEY, JSON.stringify(prev_data)); + let url = window.location.href.split('?')[0]; + let params = window.location.href.split('?')[1]; + let url_params = new URLSearchParams(params); + url_params.set("continuation", prev_ctoken); - window.location.href = `${window.location.pathname}?continuation=${prev_ctoken}`; + window.location.href = `${url}?${url_params.toString()}`; }; addEventListener('DOMContentLoaded', function(){ diff --git a/src/invidious/frontend/pagination.cr b/src/invidious/frontend/pagination.cr index 13464503..a29f5936 100644 --- a/src/invidious/frontend/pagination.cr +++ b/src/invidious/frontend/pagination.cr @@ -90,7 +90,7 @@ module Invidious::Frontend::Pagination end end - def nav_ctoken(locale : String?, *, base_url : String | URI, ctoken : String?, first_page : Bool) + def nav_ctoken(locale : String?, *, base_url : String | URI, ctoken : String?, first_page : Bool, params : URI::Params) return String.build do |str| str << %(
\n) str << %(