mirror of
https://github.com/ranaldsgift/KefinTweaks.git
synced 2026-11-05 15:52:47 +01:00
Another fix for optional css includes saving incorrectly... need to redo the entire configuration logic in the future lol
This commit is contained in:
1 parent
fedd919501
commit
4a5aa3b91d
1 file changed
+6
-25
@@ -2113,30 +2113,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Collect optional includes configuration from the UI
|
|
||||||
* @param {Object} modalInstance - The modal instance
|
|
||||||
* @returns {Array} Array of { key, enabled } objects
|
|
||||||
*/
|
|
||||||
function collectOptionalIncludesConfig(modalInstance) {
|
|
||||||
const optionalIncludes = [];
|
|
||||||
const allCheckboxes = modalInstance.dialogContent.querySelectorAll('.optionalIncludeCheckbox');
|
|
||||||
|
|
||||||
allCheckboxes.forEach(checkbox => {
|
|
||||||
const key = checkbox.getAttribute('data-key');
|
|
||||||
const enabled = checkbox.checked;
|
|
||||||
|
|
||||||
if (key) {
|
|
||||||
optionalIncludes.push({
|
|
||||||
key: key,
|
|
||||||
enabled: enabled
|
|
||||||
});
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
return optionalIncludes;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Attach event handlers for optional includes checkboxes
|
* Attach event handlers for optional includes checkboxes
|
||||||
* @param {Object} modalInstance - The modal instance
|
* @param {Object} modalInstance - The modal instance
|
||||||
@@ -5222,7 +5198,12 @@ window.KefinTweaksConfig = ${JSON.stringify(config, null, 2)};`;
|
|||||||
if (overrideOptionalIncludes) {
|
if (overrideOptionalIncludes) {
|
||||||
config.optionalIncludes = overrideOptionalIncludes;
|
config.optionalIncludes = overrideOptionalIncludes;
|
||||||
} else {
|
} else {
|
||||||
config.optionalIncludes = collectOptionalIncludesConfig(modalInstance);
|
// Fallback: Use existing config.optionalIncludes to prevent data loss
|
||||||
|
// DOM scraping caused partial overwrites because it only found visible checkboxes for the current category
|
||||||
|
console.warn('[KefinTweaks Configuration] handleSaveConfig called without overrideOptionalIncludes - preserving existing optionalIncludes');
|
||||||
|
if (!config.optionalIncludes) {
|
||||||
|
config.optionalIncludes = [];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Collect skin enabled toggles and merge with JSON skins
|
// Collect skin enabled toggles and merge with JSON skins
|
||||||
|
|||||||
Reference in new issue
Block a user