buttonify instruct header toggles, style instruct columns when disabled

93bfe7f40b747b45df7f48288188e9ad374b6db1

RossAscends <124905043+RossAscends@users.noreply.github.com>

2 files changed, +28 -6Showing whitespace changes
public/index.html+8 -6
@@ -3196,7 +3196,7 @@
31963196
31973197 </div>
31983198 <div id="InstructSettingsColumn" class="flex-container flexNoGap flexFlowColumn flex1">
31993199 <div nameid="instructSettingsBlock">
32003200 <h4 class="standoutHeader title_restorable justifySpaceBetween">
32013201 <div class="flex-container">
32023202 <span data-i18n="Instruct Mode">Instruct Mode</span>
@@ -3206,12 +3206,12 @@
32063206 </div>
32073207 <div class="flex-container">
32083208 <label for="instruct_enabled" class="checkbox_label flex1">
32093209 <input id="instruct_enabled" type="checkbox" style="display:none;" />
32103210 <small data-i18n="Enabled"><i class="fa-solid fa-power-off menu_button margin0"></i></small>
32113211 </label>
32123212 <label for="instruct_bind_to_context" class="checkbox_label flex1" title="If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference." data-i18n="[title]instruct_bind_to_context">
32133213 <input id="instruct_bind_to_context" type="checkbox" style="display:none;" />
32143214 <small data-i18n="Bind to Context"><i class="fa-solid fa-link menu_button margin0" title="If enabled, Context templates will be automatically selected based on selected Instruct template name or by preference."></i></small>
32153215 </label>
32163216 </div>
32173217 </h4>
@@ -3266,6 +3266,7 @@
32663266 <small data-i18n="Force for Groups and Personas">Force for Groups and Personas</small>
32673267 </label>
32683268 </div>
3269+ </div>
32693270 <hr>
32703271 <div name="tokenizerSettingsBlock">
32713272 <div data-newbie-hidden name="tokenizerSelectorBlock">
@@ -3300,7 +3301,8 @@
33003301 <input id="token_padding" class="text_pole textarea_compact" type="number" min="-2048" max="2048" />
33013302 </div>
33023303 </div>
3303-
3304+ <div>
3305+ <h4 class="standoutHeader">Misc.</h4>
33043306 <div>
33053307 <small>
33063308 <span data-i18n="Non-markdown strings">
public/scripts/instruct-mode.js+20 -0
@@ -87,8 +87,16 @@ export async function loadInstructMode(data) {
8787
8888 if (power_user.instruct.enabled) {
8989 $('#instruct_enabled').parent().find('i').addClass('toggleEnabled');
90+ $('#instructSettingsBlock, #InstructSequencesColumn').removeClass('disabled');
9091 } else {
9192 $('#instruct_enabled').parent().find('i').removeClass('toggleEnabled');
93+ $('#instructSettingsBlock, #InstructSequencesColumn').addClass('disabled');
94+ }
95+
96+ if (power_user.instruct.bind_to_context) {
97+ $('#instruct_bind_to_context').parent().find('i').addClass('toggleEnabled');
98+ } else {
99+ $('#instruct_bind_to_context').parent().find('i').removeClass('toggleEnabled');
92100 }
93101
94102 controls.forEach(control => {
@@ -639,8 +647,12 @@ jQuery(() => {
639647 //color toggle for the main switch
640648 if (power_user.instruct.enabled) {
641649 $('#instruct_enabled').parent().find('i').addClass('toggleEnabled');
650+ $('#instructSettingsBlock, #InstructSequencesColumn')
651+ .removeClass('disabled');
642652 } else {
643653 $('#instruct_enabled').parent().find('i').removeClass('toggleEnabled');
654+ $('#instructSettingsBlock, #InstructSequencesColumn')
655+ .addClass('disabled');
644656 }
645657
646658 if (!power_user.instruct.bind_to_context) {
@@ -656,6 +668,14 @@ jQuery(() => {
656668 }
657669 });
658670
671+ $('#instruct_bind_to_context').on('change', function () {
672+ if (power_user.instruct.bind_to_context) {
673+ $('#instruct_bind_to_context').parent().find('i').addClass('toggleEnabled');
674+ } else {
675+ $('#instruct_bind_to_context').parent().find('i').removeClass('toggleEnabled');
676+ }
677+ });
678+
659679 $('#instruct_presets').on('change', function () {
660680 const name = String($(this).find(':selected').val());
661681 const preset = instruct_presets.find(x => x.name === name);