mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
initial reversion commit
This commit is contained in:
@ -7,7 +7,7 @@ import {
|
||||
power_user,
|
||||
context_presets,
|
||||
} from './power-user.js';
|
||||
import { regexFromString } from './utils.js';
|
||||
import { regexFromString, resetScrollHeight } from './utils.js';
|
||||
|
||||
/**
|
||||
* @type {any[]} Instruct mode presets.
|
||||
@ -42,6 +42,9 @@ const controls = [
|
||||
{ id: 'instruct_system_same_as_user', property: 'system_same_as_user', isCheckbox: true, trigger: true },
|
||||
];
|
||||
|
||||
const chromeUaIdx = navigator.userAgent.lastIndexOf('Chrome/');
|
||||
const chromeVersion = navigator.userAgent.substring(chromeUaIdx + 7, navigator.userAgent.indexOf('.', chromeUaIdx));
|
||||
|
||||
/**
|
||||
* Migrates instruct mode settings into the evergreen format.
|
||||
* @param {object} settings Instruct mode settings.
|
||||
@ -95,11 +98,14 @@ export async function loadInstructMode(data) {
|
||||
if (control.isCheckbox) {
|
||||
$element.prop('checked', power_user.instruct[control.property]);
|
||||
} else {
|
||||
$element[0].innerText = (power_user.instruct[control.property]);
|
||||
$element.val(power_user.instruct[control.property]);
|
||||
}
|
||||
|
||||
$element.on('input', async function () {
|
||||
power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this)[0].innerText;
|
||||
power_user.instruct[control.property] = control.isCheckbox ? !!$(this).prop('checked') : $(this).val;
|
||||
if (chromeUaIdx == -1 || Number(chromeVersion) < 123) {
|
||||
await resetScrollHeight($(this));
|
||||
}
|
||||
saveSettingsDebounced();
|
||||
});
|
||||
|
||||
@ -663,7 +669,7 @@ jQuery(() => {
|
||||
if (control.isCheckbox) {
|
||||
$element.prop('checked', power_user.instruct[control.property]).trigger('input');
|
||||
} else {
|
||||
$element[0].innerText = (power_user.instruct[control.property]);
|
||||
$element.val(power_user.instruct[control.property]);
|
||||
$element.trigger('input');
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user