This commit is contained in:
Devdatt Bhatt 2026-06-08 04:11:06 +00:00
parent 283d663306
commit 279e891773
1 changed files with 19 additions and 10 deletions

View File

@ -264,16 +264,25 @@ $selected_interface = $_GET['interface'] ?? array_keys($interface_data)[0] ?? nu
}); });
// Multicast toggle switch functionality // Multicast toggle switch functionality
document.querySelectorAll('.switch input[type="checkbox"]').forEach(checkbox => { document.addEventListener('DOMContentLoaded', function() {
checkbox.addEventListener('change', function() { // Find all multicast toggle switches
const interfaceName = this.id.split('-')[2]; // Get interface name from ID like "multicast-eth0" const multicastSwitches = document.querySelectorAll('.switch input[type="checkbox"]');
const label = document.getElementById(`multicast-label-${interfaceName}`);
multicastSwitches.forEach(checkbox => {
if (this.checked) { checkbox.addEventListener('change', function() {
label.textContent = 'Enabled'; // Get the interface name from the checkbox ID
} else { // ID format: "multicast-eth0" -> split by "-" -> [0] = "multicast", [1] = "eth0"
label.textContent = 'Disabled'; const interfaceName = this.id.split('-')[1];
} const label = document.getElementById(`multicast-label-${interfaceName}`);
if (label) {
if (this.checked) {
label.textContent = 'Enabled';
} else {
label.textContent = 'Disabled';
}
}
});
}); });
}); });
</script> </script>