UI hide Devices sections work #612

This commit is contained in:
Jokob-sk
2024-04-01 12:26:28 +11:00
parent a672070ff0
commit af8c053ded
5 changed files with 49 additions and 13 deletions

View File

@@ -1008,7 +1008,7 @@ function setupSmoothScrolling() {
var url = window.location.href;
if (url.includes("#")) {
var idFromURL = url.substring(url.indexOf("#") + 1);
if ($("#" + idFromURL).length > 0) {
if (idFromURL != "" && $("#" + idFromURL).length > 0) {
scrollToElement(idFromURL);
}
}

View File

@@ -147,6 +147,36 @@ function initSettingDropdown(settingKey, // Identifier for the setting
}
// -----------------------------------------------------------------------------
// 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()
}
});
}
}
// -----------------------------------------------------------------------------
// Data processors