Save pagination state on return to list from card

This commit is contained in:
Cohee 2023-08-23 16:48:44 +03:00
parent c32c080126
commit b751643364

View File

@ -322,6 +322,7 @@ let generatedPromtCache = "";
let generation_started = new Date(); let generation_started = new Date();
let characters = []; let characters = [];
let this_chid; let this_chid;
let saveCharactersPage = 0;
let backgrounds = []; let backgrounds = [];
const default_avatar = "img/ai4.png"; const default_avatar = "img/ai4.png";
export const system_avatar = "img/five.png"; export const system_avatar = "img/five.png";
@ -893,6 +894,7 @@ async function printCharacters(fullRefresh = false) {
pageSize: Number(localStorage.getItem(storageKey)) || 50, pageSize: Number(localStorage.getItem(storageKey)) || 50,
sizeChangerOptions: [10, 25, 50, 100, 250, 500, 1000], sizeChangerOptions: [10, 25, 50, 100, 250, 500, 1000],
pageRange: 1, pageRange: 1,
pageNumber: saveCharactersPage || 1,
position: 'top', position: 'top',
showPageNumbers: false, showPageNumbers: false,
showSizeChanger: true, showSizeChanger: true,
@ -913,10 +915,14 @@ async function printCharacters(fullRefresh = false) {
}, },
afterSizeSelectorChange: function (e) { afterSizeSelectorChange: function (e) {
localStorage.setItem(storageKey, e.target.value); localStorage.setItem(storageKey, e.target.value);
} },
afterPaging: function (e) {
saveCharactersPage = e;
},
}); });
favsToHotswap(); favsToHotswap();
saveCharactersPage = 0;
if (fullRefresh) { if (fullRefresh) {
printTagFilters(tag_filter_types.character); printTagFilters(tag_filter_types.character);