diff --git a/src/www/firewall_rule_lookup.php b/src/www/firewall_rule_lookup.php index 2eed958de..618c76e80 100644 --- a/src/www/firewall_rule_lookup.php +++ b/src/www/firewall_rule_lookup.php @@ -42,7 +42,16 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') { // search auto-generated rules foreach ($fw->iterateFilterRules() as $rule) { if (!empty($rule->getRef()) && $rid == $rule->getLabel()) { - header(url_safe('Location: /%s#%s', explode("#", $rule->getRef()))); + if (strpos($rule->getRef(), '?if=') !== false) { + $parts = parse_url($rule->getRef()); + if (!empty($parts['fragment'])) { + parse_str($parts['query'], $query); + $params = [$parts['path'], $query['if'], $parts['fragment']]; + header(url_safe('Location: /%s?if=%s#%s', $params)); + } + } else { + header(url_safe('Location: /%s#%s', explode("#", $rule->getRef()))); + } exit; } } diff --git a/src/www/interfaces.php b/src/www/interfaces.php index da19eec05..7f3f1d543 100644 --- a/src/www/interfaces.php +++ b/src/www/interfaces.php @@ -1756,7 +1756,7 @@ include("head.inc"); } }); $("#rfc3118_isp").change(); - + window_highlight_table_option(); }); diff --git a/src/www/javascript/opnsense_legacy.js b/src/www/javascript/opnsense_legacy.js index 162a99999..658aea0e9 100644 --- a/src/www/javascript/opnsense_legacy.js +++ b/src/www/javascript/opnsense_legacy.js @@ -31,15 +31,15 @@ */ function notice_action(action,msgid) { - jQuery.ajax({ - type: 'post', - cache: false, - url: 'index.php', - data: {closenotice: msgid}, - success: function(response) { - jQuery('#menu_messages').html(response); - } - }); + jQuery.ajax({ + type: 'post', + cache: false, + url: 'index.php', + data: {closenotice: msgid}, + success: function(response) { + jQuery('#menu_messages').html(response); + } + }); } /** @@ -144,3 +144,27 @@ function hook_stacked_form_tables(match) } }); } + +/** + * highlight table option using window location hash + */ +function window_highlight_table_option() +{ + if (window.location.hash != "") { + let option_id = window.location.hash.substr(1); + let option = $("[name='" + option_id +"']"); + let arrow = $("").addClass("fa fa-arrow-right pull-right"); + let container = $("
"); + let title_td = option.closest('tr').find('td:eq(0)'); + container.css('width', '0%'); + container.css('display', 'inline-block'); + container.css('white-space', 'nowrap'); + + title_td.append(container); + let animate_width = title_td.width() - container.position().left+ title_td.find('i:eq(0)').position().left; + $('html, body').animate({scrollTop: option.position().top}, 500, function() { + container.append(arrow); + container.animate({width: animate_width}, 800); + }); + } +} diff --git a/src/www/system_advanced_firewall.php b/src/www/system_advanced_firewall.php index 8cc17aea1..7a1845041 100644 --- a/src/www/system_advanced_firewall.php +++ b/src/www/system_advanced_firewall.php @@ -237,24 +237,7 @@ include("head.inc"); ?>