chore: final cleanup
This commit is contained in:
@@ -727,7 +727,6 @@ export function removeMobileTabs() {
|
||||
*/
|
||||
export function setupMobileKeyboardHandling() {
|
||||
if (!window.visualViewport) {
|
||||
// console.log('[RPG Mobile] Visual Viewport API not supported');
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -750,12 +749,9 @@ export function setupMobileKeyboardHandling() {
|
||||
// Keyboard just appeared
|
||||
keyboardVisible = true;
|
||||
$panel.addClass('rpg-keyboard-visible');
|
||||
// console.log('[RPG Mobile] Keyboard opened');
|
||||
} else if (!isKeyboardShowing && keyboardVisible) {
|
||||
// Keyboard just disappeared
|
||||
keyboardVisible = false;
|
||||
$panel.removeClass('rpg-keyboard-visible');
|
||||
// console.log('[RPG Mobile] Keyboard closed');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -369,7 +369,6 @@ export function setupSettingsPopup() {
|
||||
const message = chat[i];
|
||||
if (message.extra && message.extra.rpg_companion_swipes) {
|
||||
delete message.extra.rpg_companion_swipes;
|
||||
// console.log('[RPG Companion] Cleared swipe data from message at index', i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -434,9 +433,7 @@ export function setupSettingsPopup() {
|
||||
updateDiceDisplayCore();
|
||||
updateChatThoughts(); // Clear the thought bubble in chat
|
||||
renderQuests(); // Clear and re-render quests UI
|
||||
renderSkills(); // Clear and re-render skills UI
|
||||
|
||||
// console.log('[RPG Companion] Chat cache cleared');
|
||||
renderSkills();
|
||||
});
|
||||
|
||||
return settingsModal;
|
||||
|
||||
@@ -321,13 +321,12 @@ function renderUserStatsTab() {
|
||||
html += `<label>${i18n.getTranslation('template.trackerEditorModal.userStatsTab.skillsListLabel')}</label>`;
|
||||
html += '<div class="rpg-editor-stats-list" id="rpg-editor-skills-list">';
|
||||
|
||||
// Handle both old format (string array) and new format (object array)
|
||||
// Migration function handles string array → object array conversion on load
|
||||
const skillFields = config.skillsSection.customFields || [];
|
||||
skillFields.forEach((skill, index) => {
|
||||
// Support both old format (string) and new format (object)
|
||||
const skillName = typeof skill === 'string' ? skill : (skill.name || '');
|
||||
const skillDesc = typeof skill === 'string' ? '' : (skill.description || '');
|
||||
const skillEnabled = typeof skill === 'string' ? true : (skill.enabled !== false);
|
||||
const skillName = skill.name || '';
|
||||
const skillDesc = skill.description || '';
|
||||
const skillEnabled = skill.enabled !== false;
|
||||
|
||||
html += `
|
||||
<div class="rpg-editor-stat-item rpg-editor-skill-item" data-index="${index}">
|
||||
@@ -518,9 +517,9 @@ function setupUserStatsListeners() {
|
||||
});
|
||||
|
||||
// Toggle skill category
|
||||
// Migration function handles string array → object array conversion on load
|
||||
$('.rpg-skill-toggle').off('change').on('change', function() {
|
||||
const index = $(this).data('index');
|
||||
ensureSkillIsObject(index);
|
||||
extensionSettings.trackerConfig.userStats.skillsSection.customFields[index].enabled = $(this).is(':checked');
|
||||
saveSettings();
|
||||
renderSkills();
|
||||
@@ -529,7 +528,6 @@ function setupUserStatsListeners() {
|
||||
// Rename skill category
|
||||
$('.rpg-skill-name').off('blur').on('blur', function() {
|
||||
const index = $(this).data('index');
|
||||
ensureSkillIsObject(index);
|
||||
extensionSettings.trackerConfig.userStats.skillsSection.customFields[index].name = $(this).val();
|
||||
saveSettings();
|
||||
renderSkills();
|
||||
@@ -538,27 +536,11 @@ function setupUserStatsListeners() {
|
||||
// Update skill description
|
||||
$('.rpg-skill-desc').off('blur').on('blur', function() {
|
||||
const index = $(this).data('index');
|
||||
ensureSkillIsObject(index);
|
||||
extensionSettings.trackerConfig.userStats.skillsSection.customFields[index].description = $(this).val();
|
||||
saveSettings();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper to convert old string-format skill to object format
|
||||
*/
|
||||
function ensureSkillIsObject(index) {
|
||||
const skill = extensionSettings.trackerConfig.userStats.skillsSection.customFields[index];
|
||||
if (typeof skill === 'string') {
|
||||
extensionSettings.trackerConfig.userStats.skillsSection.customFields[index] = {
|
||||
id: 'skill_' + Date.now(),
|
||||
name: skill,
|
||||
description: '',
|
||||
enabled: true
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Render Info Box configuration tab
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user