From b7516433644c7f5d9ce128b09ee2d24e5232188a Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Wed, 23 Aug 2023 16:48:44 +0300 Subject: [PATCH] Save pagination state on return to list from card --- public/script.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/public/script.js b/public/script.js index 052ee9cb6..add7da3d5 100644 --- a/public/script.js +++ b/public/script.js @@ -322,6 +322,7 @@ let generatedPromtCache = ""; let generation_started = new Date(); let characters = []; let this_chid; +let saveCharactersPage = 0; let backgrounds = []; const default_avatar = "img/ai4.png"; export const system_avatar = "img/five.png"; @@ -893,6 +894,7 @@ async function printCharacters(fullRefresh = false) { pageSize: Number(localStorage.getItem(storageKey)) || 50, sizeChangerOptions: [10, 25, 50, 100, 250, 500, 1000], pageRange: 1, + pageNumber: saveCharactersPage || 1, position: 'top', showPageNumbers: false, showSizeChanger: true, @@ -913,10 +915,14 @@ async function printCharacters(fullRefresh = false) { }, afterSizeSelectorChange: function (e) { localStorage.setItem(storageKey, e.target.value); - } + }, + afterPaging: function (e) { + saveCharactersPage = e; + }, }); favsToHotswap(); + saveCharactersPage = 0; if (fullRefresh) { printTagFilters(tag_filter_types.character);