* feat: preset regex * refactor: unify `saveScriptsByType` * fix: default branch for `saveScriptsByType` * refactor: resolve some reviews * fix: lint * refactor: getPresetName -> getCurrentPresetName * refactor: unify regex allow operation * feat: notify whether to reload current chat when preset is changed * refacotr: set timeout for reload current chat notification * fix: _ -> lodash * i18n * Refactor API ID access * refactor: replace UNKNOWN type with a separate constant * refactor: consolidate CSS rules for scoped and preset script blocks * Extend toast timeout * Fix bug with moving, refactor * Refactor bulk toggle operations * Use for..of for preset application * refactor: enhance parameter documentation for scriptType in regex functions * fix: await loadRegexScripts in event handlers * fix: correct script type in saveScriptsByType for preset handling * fix: add null checks for preset manager and API ID in regex functions * feat: implement expandable regex script options in UI * Always show edit/delete buttons * Add title attribute to regex script name * fix: correct class name for regex script display * Remove extra paddings from script blocks * fix: ensure preset scripts are only disallowed if currently allowed during rename * fix: reload on bulk script toggle * feat: add PRESET_RENAMED_BEFORE event type and emit it during preset renaming * fix: always preserve preset extensions on rename * Handle horde in getPresetManager --------- Co-authored-by: ZoinkCN <zoinkcn@outlook.com> Co-authored-by: StageDog <aksanajw845@gmail.com>
131 lines
8.5 KiB
HTML
131 lines
8.5 KiB
HTML
<div class="regex_settings">
|
|
<div class="inline-drawer">
|
|
<div class="inline-drawer-toggle inline-drawer-header">
|
|
<b data-i18n="ext_regex_title">
|
|
Regex
|
|
</b>
|
|
<div class="inline-drawer-icon fa-solid fa-circle-chevron-down down"></div>
|
|
</div>
|
|
<div class="inline-drawer-content">
|
|
<div class="flex-container">
|
|
<div id="open_regex_editor" class="menu_button menu_button_icon" data-i18n="[title]ext_regex_new_global_script_desc" title="New global regex script">
|
|
<i class="fa-solid fa-pen-to-square"></i>
|
|
<small data-i18n="ext_regex_new_global_script">+ Global</small>
|
|
</div>
|
|
<div id="open_scoped_editor" class="menu_button menu_button_icon" data-i18n="[title]ext_regex_new_scoped_script_desc" title="New scoped regex script">
|
|
<i class="fa-solid fa-address-card"></i>
|
|
<small data-i18n="ext_regex_new_scoped_script">+ Scoped</small>
|
|
</div>
|
|
<div id="open_preset_editor" class="menu_button menu_button_icon" data-i18n="[title]ext_regex_new_preset_script_desc" title="New preset regex script">
|
|
<i class="fa-solid fa-sliders"></i>
|
|
<small data-i18n="ext_regex_new_preset_script">+ Preset</small>
|
|
</div>
|
|
<div id="import_regex" class="menu_button menu_button_icon">
|
|
<i class="fa-solid fa-file-import"></i>
|
|
<small data-i18n="ext_regex_import_script">Import</small>
|
|
</div>
|
|
<input type="file" id="import_regex_file" hidden accept="*.json" multiple />
|
|
<label for="regex_bulk_edit" class="menu_button menu_button_icon">
|
|
<input id="regex_bulk_edit" type="checkbox" class="displayNone" />
|
|
<i class="fa-solid fa-edit"></i>
|
|
<small data-i18n="ext_regex_bulk_edit">Bulk Edit</small>
|
|
</label>
|
|
<div id="open_regex_debugger" class="menu_button menu_button_icon" data-i18n="[title]ext_regex_debugger_desc" title="Advanced Regex Debugger">
|
|
<i class="fa-solid fa-bug-slash"></i>
|
|
<small data-i18n="ext_regex_debugger">Debugger</small>
|
|
</div>
|
|
</div>
|
|
<hr class="regex_bulk_operations_hr" />
|
|
<div class="regex_bulk_operations flex-container">
|
|
<div id="bulk_select_all_toggle" class="menu_button menu_button_icon" title="Toggle Select All">
|
|
<i class="fa-solid fa-check-double"></i>
|
|
</div>
|
|
<div id="bulk_enable_regex" class="menu_button menu_button_icon">
|
|
<i class="fa-solid fa-toggle-on"></i>
|
|
<small data-i18n="Enable">Enable</small>
|
|
</div>
|
|
<div id="bulk_disable_regex" class="menu_button menu_button_icon">
|
|
<i class="fa-solid fa-toggle-off"></i>
|
|
<small data-i18n="Disable">Disable</small>
|
|
</div>
|
|
<div id="bulk_regex_move_to_global" class="menu_button menu_button_icon" hidden>
|
|
<i class="fa-solid fa-globe"></i>
|
|
<small data-i18n="ext_regex_move_to_global">Move to global scripts</small>
|
|
</div>
|
|
<div id="bulk_regex_move_to_scoped" class="menu_button menu_button_icon" hidden>
|
|
<i class="fa-solid fa-address-card"></i>
|
|
<small data-i18n="ext_regex_move_to_scoped">Move to scoped scripts</small>
|
|
</div>
|
|
<div id="bulk_regex_move_to_preset" class="menu_button menu_button_icon" hidden>
|
|
<i class="fa-solid fa-sliders"></i>
|
|
<small data-i18n="ext_regex_move_to_preset">Move to preset scripts</small>
|
|
</div>
|
|
<div id="bulk_export_regex" class="menu_button menu_button_icon">
|
|
<i class="fa-solid fa-file-export"></i>
|
|
<small data-i18n="Export">Export</small>
|
|
</div>
|
|
<div id="bulk_delete_regex" class="menu_button menu_button_icon">
|
|
<i class="fa-solid fa-trash"></i>
|
|
<small data-i18n="Delete">Delete</small>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div id="regex_presets_block">
|
|
<div class="flex-container alignItemsBaseline">
|
|
<strong class="flex1" data-i18n="ext_regex_presets">Regex Presets</strong>
|
|
</div>
|
|
<small data-i18n="ext_regex_presets_desc">
|
|
Save and switch between groups of enabled regex scripts.
|
|
</small>
|
|
<div class="flex-container marginTop5">
|
|
<select id="regex_presets" class="text_pole flex1"></select>
|
|
<div id="regex_preset_create" class="menu_button fa-solid fa-file-circle-plus" data-i18n="[title]ext_regex_preset_create" title="Create a new regex preset"></div>
|
|
<div id="regex_preset_update" class="menu_button fa-solid fa-save" data-i18n="[title]ext_regex_preset_update" title="Update existing regex preset"></div>
|
|
<div id="regex_preset_apply" class="menu_button fa-solid fa-recycle" data-i18n="[title]ext_regex_preset_apply" title="Re-apply current preset"></div>
|
|
<div id="regex_preset_delete" class="menu_button fa-solid fa-trash" data-i18n="[title]ext_regex_preset_delete" title="Delete current preset"></div>
|
|
</div>
|
|
</div>
|
|
<hr />
|
|
<div id="global_scripts_block">
|
|
<div>
|
|
<strong data-i18n="ext_regex_global_scripts">Global Scripts</strong>
|
|
</div>
|
|
<small data-i18n="ext_regex_global_scripts_desc">
|
|
Available for all characters. Saved to local settings.
|
|
</small>
|
|
<div id="saved_regex_scripts" no-scripts-text="No scripts found" data-i18n="[no-scripts-text]No scripts found" class="flex-container regex-script-container flexFlowColumn"></div>
|
|
</div>
|
|
<hr />
|
|
<div id="scoped_scripts_block">
|
|
<div class="flex-container alignItemsBaseline">
|
|
<strong class="flex1" data-i18n="ext_regex_scoped_scripts">Scoped Scripts</strong>
|
|
<label id="toggle_scoped_regex" class="checkbox flex-container" for="regex_scoped_toggle">
|
|
<input type="checkbox" id="regex_scoped_toggle" class="enable_scoped" />
|
|
<span class="regex-toggle-on fa-solid fa-toggle-on fa-lg" data-i18n="[title]ext_regex_disallow_scoped" title="Disallow using scoped regex"></span>
|
|
<span class="regex-toggle-off fa-solid fa-toggle-off fa-lg" data-i18n="[title]ext_regex_allow_scoped" title="Allow using scoped regex"></span>
|
|
</label>
|
|
</div>
|
|
<small data-i18n="ext_regex_scoped_scripts_desc">
|
|
Only available for this character. Saved to the card data.
|
|
</small>
|
|
<div id="saved_scoped_scripts" no-scripts-text="No scripts found" data-i18n="[no-scripts-text]No scripts found" class="flex-container regex-script-container flexFlowColumn"></div>
|
|
</div>
|
|
<hr />
|
|
<div id="preset_scripts_block">
|
|
<div class="flex-container alignItemsBaseline">
|
|
<strong class="flex1" data-i18n="ext_regex_preset_scripts">Preset Scripts</strong>
|
|
<label id="toggle_preset_regex" class="checkbox flex-container" for="regex_preset_toggle">
|
|
<input type="checkbox" id="regex_preset_toggle" class="enable_scoped" />
|
|
<span class="regex-toggle-on fa-solid fa-toggle-on fa-lg" data-i18n="[title]ext_regex_disallow_preset" title="Disallow using preset regex"></span>
|
|
<span class="regex-toggle-off fa-solid fa-toggle-off fa-lg" data-i18n="[title]ext_regex_allow_preset" title="Allow using preset regex"></span>
|
|
</label>
|
|
</div>
|
|
<small data-i18n="ext_regex_preset_scripts_desc">
|
|
Only available for this preset. Saved to the preset data.
|
|
</small>
|
|
<div id="saved_preset_scripts" class="flex-container regex-script-container flexFlowColumn"></div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|