Fix time editing in Info Box - set both start and end time to edited value
This commit is contained in:
@@ -9,8 +9,8 @@ const extensionName = 'third-party/rpg-companion-sillytavern';
|
|||||||
// This supports both global (public/extensions) and user-specific (data/default-user/extensions) installations
|
// This supports both global (public/extensions) and user-specific (data/default-user/extensions) installations
|
||||||
const currentScriptPath = import.meta.url;
|
const currentScriptPath = import.meta.url;
|
||||||
const isUserExtension = currentScriptPath.includes('/data/') || currentScriptPath.includes('\\data\\');
|
const isUserExtension = currentScriptPath.includes('/data/') || currentScriptPath.includes('\\data\\');
|
||||||
const extensionFolderPath = isUserExtension
|
const extensionFolderPath = isUserExtension
|
||||||
? `data/default-user/extensions/${extensionName}`
|
? `data/default-user/extensions/${extensionName}`
|
||||||
: `scripts/extensions/${extensionName}`;
|
: `scripts/extensions/${extensionName}`;
|
||||||
|
|
||||||
let extensionSettings = {
|
let extensionSettings = {
|
||||||
@@ -2352,10 +2352,8 @@ function updateInfoBoxField(field, value) {
|
|||||||
return `🌡️: ${value}`;
|
return `🌡️: ${value}`;
|
||||||
} else if (field === 'timeStart' && line.includes('🕒:')) {
|
} else if (field === 'timeStart' && line.includes('🕒:')) {
|
||||||
// Update time format: "HH:MM → HH:MM"
|
// Update time format: "HH:MM → HH:MM"
|
||||||
const currentTime = line.replace('🕒:', '').trim();
|
// When user edits, set both start and end time to the new value
|
||||||
const timeParts = currentTime.split('→').map(t => t.trim());
|
return `🕒: ${value} → ${value}`;
|
||||||
const timeEnd = timeParts[1] || timeParts[0]; // Keep end time or use start as both
|
|
||||||
return `🕒: ${value} → ${timeEnd}`;
|
|
||||||
} else if (field === 'location' && line.includes('🗺️:')) {
|
} else if (field === 'location' && line.includes('🗺️:')) {
|
||||||
return `🗺️: ${value}`;
|
return `🗺️: ${value}`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user