fix zenslider and labmode compatibility check

This commit is contained in:
RossAscends
2023-11-12 17:23:29 +09:00
parent 5331b5dc8a
commit 986eef9830
3 changed files with 25 additions and 20 deletions

View File

@ -121,7 +121,7 @@
<div id="clickSlidersTips" data-i18n="clickslidertips" class="toggle-description wide100p editable-slider-notification"> <div id="clickSlidersTips" data-i18n="clickslidertips" class="toggle-description wide100p editable-slider-notification">
Click slider numbers to input manually. Click slider numbers to input manually.
</div> </div>
<div id="labModeWarning" class="redWarningBG textAlignCenter">MAD LAB MODE ON</div> <div id="labModeWarning" class="redWarningBG textAlignCenter hidden">MAD LAB MODE ON</div>
<a href="https://docs.sillytavern.app/usage/common-settings/" target="_blank" title="Documentation on sampling parameters."> <a href="https://docs.sillytavern.app/usage/common-settings/" target="_blank" title="Documentation on sampling parameters.">
<span name="samplerHelpButton" class="note-link-span topRightInset fa-solid fa-circle-question"></span> <span name="samplerHelpButton" class="note-link-span topRightInset fa-solid fa-circle-question"></span>
</a> </a>
@ -4643,4 +4643,4 @@
</script> </script>
</body> </body>
</html> </html>

View File

@ -993,7 +993,7 @@ function getTagBlock(item) {
const count = Object.values(tag_map).flat().filter(x => x == item.id).length; const count = Object.values(tag_map).flat().filter(x => x == item.id).length;
const template = $('#bogus_folder_template .bogus_folder_select').clone(); const template = $('#bogus_folder_template .bogus_folder_select').clone();
template.attr({ 'tagid': item.id, 'id': `BogusFolder${item.id}` }); template.attr({ 'tagid': item.id, 'id': `BogusFolder${item.id}` });
template.find('.avatar').css({'background-color': item.color, 'color': item.color2 }); template.find('.avatar').css({ 'background-color': item.color, 'color': item.color2 });
template.find('.ch_name').text(item.name); template.find('.ch_name').text(item.name);
template.find('.bogus_folder_counter').text(count); template.find('.bogus_folder_counter').text(count);
return template; return template;
@ -9057,7 +9057,7 @@ jQuery(async function () {
//yolo anything for Lab Mode //yolo anything for Lab Mode
if (power_user.enableLabMode) { if (power_user.enableLabMode) {
console.log($(masterElement).attr('id'), myValue) //console.log($(masterElement).attr('id'), myValue)
$(masterElement).val(myValue).trigger('input') $(masterElement).val(myValue).trigger('input')
return return
} }

View File

@ -432,10 +432,12 @@ var originalSliderValues = []
async function switchLabMode() { async function switchLabMode() {
if (power_user.enableZenSliders) { /* if (power_user.enableZenSliders && power_user.enableLabMode) {
//force disable ZenSliders for Lab Mode toastr.warning("Can't start Lab Mode while Zen Sliders are active")
$("#enableZenSliders").trigger('click') return
} //$("#enableZenSliders").trigger('click')
}
*/
await delay(100) await delay(100)
const value = localStorage.getItem(storage_keys.enableLabMode); const value = localStorage.getItem(storage_keys.enableLabMode);
power_user.enableLabMode = value === null ? false : value == "true"; power_user.enableLabMode = value === null ? false : value == "true";
@ -457,7 +459,7 @@ async function switchLabMode() {
.attr('min', '-99999') .attr('min', '-99999')
.attr('max', '99999') .attr('max', '99999')
.attr('step', '0.001') .attr('step', '0.001')
$("#labModeWarning").show() $("#labModeWarning").removeClass('hidden')
//$("#advanced-ai-config-block input[type='range']").hide() //$("#advanced-ai-config-block input[type='range']").hide()
} else { } else {
@ -470,7 +472,7 @@ async function switchLabMode() {
.trigger('input') .trigger('input')
}); });
$("#advanced-ai-config-block input[type='range']").show() $("#advanced-ai-config-block input[type='range']").show()
$("#labModeWarning").hide() $("#labModeWarning").addClass('hidden')
} }
} }
@ -1550,7 +1552,7 @@ export function fuzzySearchWorldInfo(data, searchValue) {
export function fuzzySearchTags(searchValue) { export function fuzzySearchTags(searchValue) {
const fuse = new Fuse(tags, { const fuse = new Fuse(tags, {
keys: [ keys: [
{ name: 'name', weight: 1}, { name: 'name', weight: 1 },
], ],
includeScore: true, includeScore: true,
ignoreLocation: true, ignoreLocation: true,
@ -2680,28 +2682,31 @@ $(document).ready(() => {
}); });
$("#enableZenSliders").on("input", function () { $("#enableZenSliders").on("input", function () {
if (power_user.enableLabMode) { const value = !!$(this).prop('checked');
if (power_user.enableLabMode === true && value === true) {
//disallow zenSliders while Lab Mode is active //disallow zenSliders while Lab Mode is active
toastr.warning('ZenSliders not allowed in Mad Lab Mode') toastr.warning('Disable Mad Lab Mode before enabling Zen Sliders')
$(this).prop('checked', false); $(this).prop('checked', false).trigger('input');
return return
} }
const value = !!$(this).prop('checked');
power_user.enableZenSliders = value; power_user.enableZenSliders = value;
localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders)); localStorage.setItem(storage_keys.enableZenSliders, Boolean(power_user.enableZenSliders));
saveSettingsDebounced();
switchZenSliders(); switchZenSliders();
}); });
$("#enableLabMode").on("input", function () { $("#enableLabMode").on("input", function () {
if (power_user.enableZenSliders) { const value = !!$(this).prop('checked');
if (power_user.enableZenSliders === true && value === true) {
//disallow Lab Mode if ZenSliders are active //disallow Lab Mode if ZenSliders are active
toastr.warning('Mad Lab Mode not allowed while ZenSliders are active') toastr.warning('Disable Zen Sliders before enabling Mad Lab Mode')
$(this).prop('checked', false); $(this).prop('checked', false).trigger('input');;
return return
} }
const value = !!$(this).prop('checked');
power_user.enableLabMode = value; power_user.enableLabMode = value;
localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode)); localStorage.setItem(storage_keys.enableLabMode, Boolean(power_user.enableLabMode));
saveSettingsDebounced();
switchLabMode(); switchLabMode();
}); });
@ -2815,7 +2820,7 @@ $(document).ready(() => {
switchSimpleMode(); switchSimpleMode();
}); });
$('#bogus_folders').on('input', function() { $('#bogus_folders').on('input', function () {
const value = !!$(this).prop('checked'); const value = !!$(this).prop('checked');
power_user.bogus_folders = value; power_user.bogus_folders = value;
saveSettingsDebounced(); saveSettingsDebounced();