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();
|
printTags();
|
||||||
printGroups();
|
printGroups();
|
||||||
favsToHotswap();
|
|
||||||
sortCharactersList();
|
sortCharactersList();
|
||||||
|
favsToHotswap();
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getCharacters() {
|
async function getCharacters() {
|
||||||
|
@ -27,6 +27,7 @@ import {
|
|||||||
SECRET_KEYS,
|
SECRET_KEYS,
|
||||||
secret_state,
|
secret_state,
|
||||||
} from "./secrets.js";
|
} from "./secrets.js";
|
||||||
|
import { sortByCssOrder } from "./utils.js";
|
||||||
|
|
||||||
var NavToggle = document.getElementById("nav-toggle");
|
var NavToggle = document.getElementById("nav-toggle");
|
||||||
var RPanelPin = document.getElementById("rm_button_panel_pin");
|
var RPanelPin = document.getElementById("rm_button_panel_pin");
|
||||||
@ -275,7 +276,7 @@ export async function favsToHotswap() {
|
|||||||
const maxCount = 6;
|
const maxCount = 6;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
|
|
||||||
$(selector).each(function () {
|
$(selector).sort(sortByCssOrder).each(function () {
|
||||||
if ($(this).hasClass('is_fav') && count < maxCount) {
|
if ($(this).hasClass('is_fav') && count < maxCount) {
|
||||||
const isCharacter = $(this).hasClass('character_select');
|
const isCharacter = $(this).hasClass('character_select');
|
||||||
const isGroup = $(this).hasClass('group_select');
|
const isGroup = $(this).hasClass('group_select');
|
||||||
|
@ -9,6 +9,7 @@ import {
|
|||||||
getRequestHeaders,
|
getRequestHeaders,
|
||||||
substituteParams,
|
substituteParams,
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
|
import { favsToHotswap } from "./RossAscends-mods.js";
|
||||||
import {
|
import {
|
||||||
groups,
|
groups,
|
||||||
selected_group,
|
selected_group,
|
||||||
@ -986,6 +987,7 @@ $(document).ready(() => {
|
|||||||
power_user.sort_order = $(this).find(":selected").data('order');
|
power_user.sort_order = $(this).find(":selected").data('order');
|
||||||
power_user.sort_rule = $(this).find(":selected").data('rule');
|
power_user.sort_rule = $(this).find(":selected").data('rule');
|
||||||
sortCharactersList();
|
sortCharactersList();
|
||||||
|
favsToHotswap();
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -182,4 +182,10 @@ export async function initScrollHeight(element) {
|
|||||||
$(element).css("height", "");
|
$(element).css("height", "");
|
||||||
$(element).css("height", `${newHeight}px`);
|
$(element).css("height", `${newHeight}px`);
|
||||||
//resetScrollHeight(element);
|
//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