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 -1Ignore whitespace
public/script.js+6 -1
@@ -7516,7 +7516,7 @@ export function select_rm_info(type, charId, previousCharId = null) {
75167516
75177517/**
75187518 * Selects the right menu for displaying the character editor.
75197519 * @param {number|string} chid Character array index
75207520 * @param {object} [param1] Options for the switch
75217521 * @param {boolean} [param1.switchMenu=true] Whether to switch the menu
75227522 */
@@ -7594,6 +7594,11 @@ export function select_selected_character(chid, { switchMenu = true } = {}) {
75947594 $('#character_media_allowed_icon').toggle(externalMediaState);
75957595 $('#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+
75977602 saveSettingsDebounced();
75987603}
75997604
public/scripts/events.js+1 -0
@@ -36,6 +36,7 @@ export const event_types = {
3636 OAI_PRESET_IMPORT_READY: 'oai_preset_import_ready',
3737 WORLDINFO_SETTINGS_UPDATED: 'worldinfo_settings_updated',
3838 WORLDINFO_UPDATED: 'worldinfo_updated',
39+ CHARACTER_EDITOR_OPENED: 'character_editor_opened',
3940 CHARACTER_EDITED: 'character_edited',
4041 CHARACTER_PAGE_LOADED: 'character_page_loaded',
4142 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) {
29312931 color: var(--white70a);
29322932}
29332933
2934+select option[disabled]:not(:checked) {
2935+ color: var(--white30a);
2936+}
2937+
29342938/*#######################################################################*/
29352939
29362940#rm_api_block {