Brought over .common from nutty.gg premium

This commit is contained in:
nutty
2026-04-28 17:13:12 +10:00
parent a89b03074c
commit 9bf1efb46a
5 changed files with 247 additions and 2 deletions
+18
View File
@@ -70,6 +70,12 @@ function LoadJSON(settingsJson) {
settingItem.classList.add('setting-item');
settingItem.id = `item-${setting.id}`;
// Indent settings that are dependent on other settings using the showIf property
if (setting.showIf) {
const depth = GetSettingDepth(setting, data.settings);
settingItem.style.marginLeft = `${depth * 20}px`;
}
const labelDescriptionDiv = document.createElement('div');
if (setting.label) {
@@ -469,6 +475,18 @@ window.addEventListener('message', (event) => {
}
});
function GetSettingDepth(setting, allSettings) {
let depth = 0;
let current = setting;
while (current.showIf) {
depth++;
current = allSettings.find(s => s.id === current.showIf) || {};
}
return depth;
}