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>

3e3dfbe05e42a41c0efb1335d38cb7f67ee651c6

Wolfsblvt <wolfsblvt@gmail.com>

Signed
3 files changed, +11 -1Showing whitespace changes
public/script.js+6 -1
@@ -7516,7 +7516,7 @@ export function select_rm_info(type, charId, previousCharId = null) {
75167516
7517/**7517/**
7518 * Selects the right menu for displaying the character editor.7518 * Selects the right menu for displaying the character editor.
7519 * @param {number|string} chid Character array index7519 * @param {string} chid Character array index
7520 * @param {object} [param1] Options for the switch7520 * @param {object} [param1] Options for the switch
7521 * @param {boolean} [param1.switchMenu=true] Whether to switch the menu7521 * @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 $('#character_media_allowed_icon').toggle(externalMediaState);7594 $('#character_media_allowed_icon').toggle(externalMediaState);
7595 $('#character_media_forbidden_icon').toggle(!externalMediaState);7595 $('#character_media_forbidden_icon').toggle(!externalMediaState);
75967596
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 saveSettingsDebounced();7602 saveSettingsDebounced();
7598}7603}
75997604
public/scripts/events.js+1 -0
@@ -36,6 +36,7 @@ export const event_types = {
36 OAI_PRESET_IMPORT_READY: 'oai_preset_import_ready',36 OAI_PRESET_IMPORT_READY: 'oai_preset_import_ready',
37 WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated',37 WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated',
38 WORLDINFO_UPDATED: 'worldinfo_updated',38 WORLDINFO_UPDATED: 'worldinfo_updated',
39 CHARACTER_EDITOR_OPENED: 'character_editor_opened',
39 CHARACTER_EDITED: 'character_edited',40 CHARACTER_EDITED: 'character_edited',
40 CHARACTER_PAGE_LOADED: 'character_page_loaded',41 CHARACTER_PAGE_LOADED: 'character_page_loaded',
41 CHARACTER_GROUP_OVERLAY_STATE_CHANGE_BEFORE: 'character_group_overlay_state_change_before',42 CHARACTER_GROUP_OVERLAY_STATE_CHANGE_BEFORE: 'character_group_overlay_state_change_before',
public/style.css+4 -0
@@ -2931,6 +2931,10 @@ select option:not(:checked) {
2931 color: var(--white70a);2931 color: var(--white70a);
2932}2932}
29332933
2934select option[disabled]:not(:checked) {
2935 color: var(--white30a);
2936}
2937
2934/*#######################################################################*/2938/*#######################################################################*/
29352939
2936#rm_api_block {2940#rm_api_block {