Toggle Regex Script Checkboxes

Added a checkbox to each Regex Script listed under Saved Scripts to easily enable/disable. It can be cumbersome having to load Regex Editor for each script when disabling/enabling multiple Regex Scripts.
This commit is contained in:
LammyShark 2023-10-25 22:48:19 -04:00
parent 339dcaf506
commit 234baf6276
3 changed files with 16 additions and 0 deletions

View File

@ -76,6 +76,14 @@ async function loadRegexScripts() {
const scriptHtml = scriptTemplate.clone(); const scriptHtml = scriptTemplate.clone();
scriptHtml.attr('id', uuidv4()); scriptHtml.attr('id', uuidv4());
scriptHtml.find('.regex_script_name').text(script.scriptName); scriptHtml.find('.regex_script_name').text(script.scriptName);
scriptHtml.find('.disable_regex').prop("checked", script.disabled ?? false)
.each(function() {
$(this).closest('.checkbox').find('span').toggle(this.checked);
})
.on('click', function() {
script.disabled = !script.disabled;
$(this).closest('.checkbox').find('span').toggle(this.checked);
});
scriptHtml.find('.edit_existing_regex').on('click', async function() { scriptHtml.find('.edit_existing_regex').on('click', async function() {
await onRegexEditorOpenClick(scriptHtml.attr("id")); await onRegexEditorOpenClick(scriptHtml.attr("id"));
}); });

View File

@ -2,6 +2,10 @@
<span class="drag-handle menu-handle">&#9776;</span> <span class="drag-handle menu-handle">&#9776;</span>
<div class="regex_script_name flexGrow overflow-hidden"></div> <div class="regex_script_name flexGrow overflow-hidden"></div>
<div class="flex-container flexnowrap"> <div class="flex-container flexnowrap">
<label class="checkbox flex-container">
<span data-i18n="Disabled">Disabled</span>
<input id="disabled" type="checkbox" name="disabled" class="disable_regex" />
</label>
<div class="edit_existing_regex menu_button"> <div class="edit_existing_regex menu_button">
<i class="fa-solid fa-pencil"></i> <i class="fa-solid fa-pencil"></i>
</div> </div>

View File

@ -5,6 +5,10 @@
flex-direction: row; flex-direction: row;
} }
.regex_settings .checkbox {
align-items: center;
}
.regex-script-container { .regex-script-container {
margin-top: 10px; margin-top: 10px;
margin-bottom: 10px; margin-bottom: 10px;