mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Fix hotswap sorting
This commit is contained in:
@ -762,8 +762,8 @@ function printCharacters() {
|
||||
|
||||
printTags();
|
||||
printGroups();
|
||||
favsToHotswap();
|
||||
sortCharactersList();
|
||||
favsToHotswap();
|
||||
}
|
||||
|
||||
async function getCharacters() {
|
||||
|
@ -27,6 +27,7 @@ import {
|
||||
SECRET_KEYS,
|
||||
secret_state,
|
||||
} from "./secrets.js";
|
||||
import { sortByCssOrder } from "./utils.js";
|
||||
|
||||
var NavToggle = document.getElementById("nav-toggle");
|
||||
var RPanelPin = document.getElementById("rm_button_panel_pin");
|
||||
@ -275,7 +276,7 @@ export async function favsToHotswap() {
|
||||
const maxCount = 6;
|
||||
let count = 0;
|
||||
|
||||
$(selector).each(function () {
|
||||
$(selector).sort(sortByCssOrder).each(function () {
|
||||
if ($(this).hasClass('is_fav') && count < maxCount) {
|
||||
const isCharacter = $(this).hasClass('character_select');
|
||||
const isGroup = $(this).hasClass('group_select');
|
||||
|
@ -9,6 +9,7 @@ import {
|
||||
getRequestHeaders,
|
||||
substituteParams,
|
||||
} from "../script.js";
|
||||
import { favsToHotswap } from "./RossAscends-mods.js";
|
||||
import {
|
||||
groups,
|
||||
selected_group,
|
||||
@ -986,6 +987,7 @@ $(document).ready(() => {
|
||||
power_user.sort_order = $(this).find(":selected").data('order');
|
||||
power_user.sort_rule = $(this).find(":selected").data('rule');
|
||||
sortCharactersList();
|
||||
favsToHotswap();
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
|
@ -182,4 +182,10 @@ export async function initScrollHeight(element) {
|
||||
$(element).css("height", "");
|
||||
$(element).css("height", `${newHeight}px`);
|
||||
//resetScrollHeight(element);
|
||||
}
|
||||
|
||||
export function sortByCssOrder(a, b) {
|
||||
const _a = Number($(a).css('order'));
|
||||
const _b = Number($(b).css('order'));
|
||||
return _a - _b;
|
||||
}
|
Reference in New Issue
Block a user