mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-01-31 11:35:37 +01:00
Merge pull request #1882 from berbant/staging
Link to character's source page
This commit is contained in:
commit
2e002032b3
@ -3998,6 +3998,9 @@
|
||||
<option id="renameCharButton" data-i18n="Rename">
|
||||
Rename
|
||||
</option>
|
||||
<option id="character_source" data-i18n="Link to Source">
|
||||
Link to Source
|
||||
</option>
|
||||
<!--<option id="dupe_button">
|
||||
Duplicate
|
||||
</option>
|
||||
|
@ -6481,6 +6481,13 @@ export function select_selected_character(chid) {
|
||||
setWorldInfoButtonClass(chid);
|
||||
checkEmbeddedWorld(chid);
|
||||
|
||||
// Disable or enable Link to Source dropdown menu item depending on the presence of 'full_path' property
|
||||
$('#character_source').prop( "disabled", true );
|
||||
const chidSourceData = Object.values(characters[this_chid].data.extensions)
|
||||
Object.entries(chidSourceData).forEach(function([key, value]) {
|
||||
if (Object.keys(value).includes('full_path')) $('#character_source').prop( "disabled", false );
|
||||
});
|
||||
|
||||
$('#form_create').attr('actiontype', 'editcharacter');
|
||||
$('.form_create_bottom_buttons_block .chat_lorebook_button').show();
|
||||
saveSettingsDebounced();
|
||||
@ -9809,6 +9816,22 @@ jQuery(async function () {
|
||||
await importEmbeddedWorldInfo();
|
||||
saveCharacterDebounced();
|
||||
break;
|
||||
case 'character_source':
|
||||
const chidSourceData = characters[this_chid].data.extensions
|
||||
switch(true) {
|
||||
case Object.hasOwn(chidSourceData, 'chub') :
|
||||
window.open('https://chub.ai/characters/' + chidSourceData.chub.full_path, '_blank');
|
||||
break;
|
||||
case Object.hasOwn(chidSourceData, 'janitorai') : // not implemented yet
|
||||
window.open('https://janitorai.com/characters/' + chidSourceData.janitorai.full_path, '_blank');
|
||||
break;
|
||||
case Object.hasOwn(chidSourceData, 'pygmalion') : // not implemented yet
|
||||
window.open('https://pygmalion.chat/character/' + chidSourceData.pygmalion.full_path, '_blank');
|
||||
break;
|
||||
default: toastr.info("This character doesn't seem to have a source.");
|
||||
}
|
||||
break;
|
||||
|
||||
/*case 'delete_button':
|
||||
popup_type = "del_ch";
|
||||
callPopup(`
|
||||
|
Loading…
x
Reference in New Issue
Block a user