mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #1882 from berbant/staging
Link to character's source page
This commit is contained in:
@@ -3998,6 +3998,9 @@
|
|||||||
<option id="renameCharButton" data-i18n="Rename">
|
<option id="renameCharButton" data-i18n="Rename">
|
||||||
Rename
|
Rename
|
||||||
</option>
|
</option>
|
||||||
|
<option id="character_source" data-i18n="Link to Source">
|
||||||
|
Link to Source
|
||||||
|
</option>
|
||||||
<!--<option id="dupe_button">
|
<!--<option id="dupe_button">
|
||||||
Duplicate
|
Duplicate
|
||||||
</option>
|
</option>
|
||||||
|
@@ -6481,6 +6481,13 @@ export function select_selected_character(chid) {
|
|||||||
setWorldInfoButtonClass(chid);
|
setWorldInfoButtonClass(chid);
|
||||||
checkEmbeddedWorld(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').attr('actiontype', 'editcharacter');
|
||||||
$('.form_create_bottom_buttons_block .chat_lorebook_button').show();
|
$('.form_create_bottom_buttons_block .chat_lorebook_button').show();
|
||||||
saveSettingsDebounced();
|
saveSettingsDebounced();
|
||||||
@@ -9809,6 +9816,22 @@ jQuery(async function () {
|
|||||||
await importEmbeddedWorldInfo();
|
await importEmbeddedWorldInfo();
|
||||||
saveCharacterDebounced();
|
saveCharacterDebounced();
|
||||||
break;
|
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':
|
/*case 'delete_button':
|
||||||
popup_type = "del_ch";
|
popup_type = "del_ch";
|
||||||
callPopup(`
|
callPopup(`
|
||||||
|
Reference in New Issue
Block a user