Interfaces: Diagnostics: Packet Capture - more strict jQuery selector for "(de)select all" button. for https://github.com/opnsense/core/pull/8554

This commit is contained in:
Ad Schellevis 2025-04-16 15:03:06 +02:00
parent 27fdbd950f
commit 1e37f6a7fc

View File

@ -198,18 +198,18 @@
*/
$("#btn_start_new > b").text("{{ lang._('Start') }}");
// (de)select all interfaces
$(".interface_select").closest("td").find('a').remove();
$(".interface_select").closest("td").find('br').remove();
$("select.interface_select").closest("td").find('a').remove();
$("select.interface_select").closest("td").find('br').remove();
let btn_toggle_all = $('<button id="select_all" type="button" class="btn btn-default">');
btn_toggle_all.append($('<i class="fa fa-check-square-o fa-fw" aria-hidden="true"></i>'));
btn_toggle_all.tooltip({"title": "{{ lang._('(de)select all') }}"});
btn_toggle_all.click(function(e){
e.preventDefault();
$(".interface_select option").prop("selected", $("#select_all > i").hasClass("fa-check-square-o"));
$("select.interface_select option").prop("selected", $("#select_all > i").hasClass("fa-check-square-o"));
$("#select_all > i").toggleClass("fa-check-square-o fa-square-o");
$(".interface_select").selectpicker('refresh');
$("select.interface_select").selectpicker('refresh');
});
$(".interface_select").parent().append(btn_toggle_all);
$("select.interface_select").parent().append(btn_toggle_all);
});
</script>