mirror of
https://github.com/nuttylmao/nutty.gg.git
synced 2026-09-19 04:00:59 -04:00
Brought over .common from nutty.gg premium
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user