From d36a15d02dc38b9a532d4b6174f7516b75845ccc Mon Sep 17 00:00:00 2001 From: cuom1999 Date: Sun, 2 Apr 2023 17:57:32 -0500 Subject: [PATCH] Fix problem search pagination --- templates/feed/feed_js.html | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/templates/feed/feed_js.html b/templates/feed/feed_js.html index 904fb74..80d878d 100644 --- a/templates/feed/feed_js.html +++ b/templates/feed/feed_js.html @@ -3,6 +3,17 @@ window.has_next_page = {{1 if page_obj.has_next() else 0}}; window.loading_page = false; $(function() { + function getQueryParams() { + var queryParams = {}; + var query = window.location.search.substring(1); + var vars = query.split("&"); + for (var i = 0; i < vars.length; i++) { + var pair = vars[i].split("="); + queryParams[pair[0]] = decodeURIComponent(pair[1]); + } + return queryParams; + } + $(window).on("scroll", function() { if (window.loading_page || !window.has_next_page) return; var distanceFromBottom = $(document).height() - ($(window).scrollTop() + $(window).height()); @@ -13,6 +24,8 @@ "page": window.page + 1, }; + params = Object.assign({}, getQueryParams(), params); + $.get("{{feed_content_url}}", params) .done(function(data) { $(".has_next").remove();