⚙ Settings #779

This commit is contained in:
jokob-sk
2024-09-06 07:59:35 +10:00
parent 8c0da1d0df
commit 43aa40efbb
7 changed files with 56 additions and 40 deletions

View File

@@ -68,38 +68,6 @@ function initDeviceSelectors(devicesListAll_JSON) {
}
// -----------------------------------------------------------------------------
// Hide elements on the page based on the supplied setting
function hideUIelements(settingKey) {
hiddenSectionsSetting = getSetting(settingKey)
if(hiddenSectionsSetting != "") // handle if settings not yet initialized
{
sectionsArray = createArray(hiddenSectionsSetting)
// remove spaces to get IDs
var newArray = $.map(sectionsArray, function(value) {
return value.replace(/\s/g, '');
});
$.each(newArray, function(index, hiddenSection) {
if($('#' + hiddenSection))
{
$('#' + hiddenSection).hide()
}
});
}
}
// -----------------------------------------------------------------------------
// Updates the icon preview
function updateIconPreview (inputId) {
@@ -284,10 +252,15 @@ function initSelect2() {
}
}
// try to initialize select2
setTimeout(() => {
initSelect2()
}, 1000);
// init select2 after dom laoded
window.addEventListener("load", function() {
// try to initialize select2
setTimeout(() => {
initSelect2()
}, 1000);
});
console.log("init ui_components.js")