Small change, (visually) disable "Link to Source" on characters that weren't downloaded from a source (#4588) * feat: enable character source dropdown based on availability and style disabled options * feat: emit event when character is in right character panel * refactor: rename CHARACTER_SELECT_SELECTED event to CHARACTER_EDITOR_OPENED for clarity * Always disable source option when peeking in groups --------- Co-authored-by: Cohee <18619528+Cohee1207@users.noreply.github.com>
Signed| @@ -7516,7 +7516,7 @@ export function select_rm_info(type, charId, previousCharId = null) { | ||
| 7516 | 7516 | |
| 7517 | 7517 | /** |
| 7518 | 7518 | * Selects the right menu for displaying the character editor. |
| 7519 | 7519 | * @param {number|string} chid Character array index |
| 7520 | 7520 | * @param {object} [param1] Options for the switch |
| 7521 | 7521 | * @param {boolean} [param1.switchMenu=true] Whether to switch the menu |
| 7522 | 7522 | */ |
| @@ -7594,6 +7594,11 @@ export function select_selected_character(chid, { switchMenu = true } = {}) { | ||
| 7594 | 7594 | $('#character_media_allowed_icon').toggle(externalMediaState); |
| 7595 | 7595 | $('#character_media_forbidden_icon').toggle(!externalMediaState); |
| 7596 | 7596 | |
| 7597 | + // Update some stuff about the char management dropdown | |
| 7598 | + $('#character_source').attr('disabled', selected_group || !getCharacterSource(chid) ? '' : null); | |
| 7599 | + | |
| 7600 | + eventSource.emit(event_types.CHARACTER_EDITOR_OPENED, chid); | |
| 7601 | + | |
| 7597 | 7602 | saveSettingsDebounced(); |
| 7598 | 7603 | } |
| 7599 | 7604 | |
| @@ -36,6 +36,7 @@ export const event_types = { | ||
| 36 | 36 | OAI_PRESET_IMPORT_READY: 'oai_preset_import_ready', |
| 37 | 37 | WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated', |
| 38 | 38 | WORLDINFO_UPDATED: 'worldinfo_updated', |
| 39 | + CHARACTER_EDITOR_OPENED: 'character_editor_opened', | |
| 39 | 40 | CHARACTER_EDITED: 'character_edited', |
| 40 | 41 | CHARACTER_PAGE_LOADED: 'character_page_loaded', |
| 41 | 42 | CHARACTER_GROUP_OVERLAY_STATE_CHANGE_BEFORE: 'character_group_overlay_state_change_before', |
| @@ -2931,6 +2931,10 @@ select option:not(:checked) { | ||
| 2931 | 2931 | color: var(--white70a); |
| 2932 | 2932 | } |
| 2933 | 2933 | |
| 2934 | +select option[disabled]:not(:checked) { | |
| 2935 | + color: var(--white30a); | |
| 2936 | +} | |
| 2937 | + | |
| 2934 | 2938 | /*#######################################################################*/ |
| 2935 | 2939 | |
| 2936 | 2940 | #rm_api_block { |