mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
strings cleanup, small fixes
This commit is contained in:
@@ -437,7 +437,7 @@
|
||||
|
||||
if(archivedCount > 0)
|
||||
{
|
||||
$('#showArchivedNumber').text(`(${archivedCount})`);
|
||||
$('#showArchivedNumber').text(`(${archivedCount})`);
|
||||
}
|
||||
|
||||
if(offlineCount > 0)
|
||||
@@ -968,7 +968,6 @@ $(window).on('resize', function () {
|
||||
// init pop up hover boxes for device details
|
||||
initHoverNodeInfo();
|
||||
|
||||
// display toggles
|
||||
$(document).ready(function () {
|
||||
// Restore cached values on load
|
||||
const cachedOffline = getCache('showOffline');
|
||||
@@ -981,12 +980,34 @@ $(document).ready(function () {
|
||||
$('input[name="showArchived"]').prop('checked', cachedArchived === 'true');
|
||||
}
|
||||
|
||||
// Function to enable/disable showArchived based on showOffline
|
||||
function updateArchivedToggle() {
|
||||
const isOfflineChecked = $('input[name="showOffline"]').is(':checked');
|
||||
const archivedToggle = $('input[name="showArchived"]');
|
||||
|
||||
if (!isOfflineChecked) {
|
||||
archivedToggle.prop('checked', false);
|
||||
archivedToggle.prop('disabled', true);
|
||||
setCache('showArchived', false);
|
||||
} else {
|
||||
archivedToggle.prop('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
// Initial state on load
|
||||
updateArchivedToggle();
|
||||
|
||||
// Bind change event for both toggles
|
||||
$('input[name="showOffline"], input[name="showArchived"]').on('change', function () {
|
||||
const name = $(this).attr('name');
|
||||
const value = $(this).is(':checked');
|
||||
setCache(name, value);
|
||||
|
||||
// Update state of showArchived if showOffline changed
|
||||
if (name === 'showOffline') {
|
||||
updateArchivedToggle();
|
||||
}
|
||||
|
||||
// Refresh page after a brief delay to ensure cache is written
|
||||
setTimeout(() => {
|
||||
location.reload();
|
||||
@@ -994,6 +1015,7 @@ $(document).ready(function () {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user