Revision 3ece7116
Added by Stephen Beaver almost 10 years ago
src/usr/local/www/firewall_nat_edit.php | ||
---|---|---|
970 | 970 |
var showsource = 0; |
971 | 971 |
var iface_old = ''; |
972 | 972 |
|
973 |
// ---------- "Library" functions --------------------------------------------------------------------------------- |
|
974 |
// Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden |
|
975 |
function hideInput(id, hide) { |
|
976 |
if (hide) |
|
977 |
$('#' + id).parent().parent('div').addClass('hidden'); |
|
978 |
else |
|
979 |
$('#' + id).parent().parent('div').removeClass('hidden'); |
|
980 |
} |
|
981 |
|
|
982 |
// Disables the specified input element |
|
983 |
function disableInput(id, disable) { |
|
984 |
$('#' + id).prop("disabled", disable); |
|
985 |
} |
|
986 |
|
|
987 |
// Hides all elements of the specified class. This will usually be a section |
|
988 |
function hideClass(s_class, hide) { |
|
989 |
if (hide) |
|
990 |
$('.' + s_class).hide(); |
|
991 |
else |
|
992 |
$('.' + s_class).show(); |
|
993 |
} |
|
994 |
|
|
995 | 973 |
// ---------- jQuery functions, lovingly converted from the original javascript------------------------------------------ |
996 | 974 |
function ext_change() { |
997 | 975 |
|
src/usr/local/www/foot.inc | ||
---|---|---|
23 | 23 |
<script src="/jquery/jquery-ui-1.11.2.min.js"></script> |
24 | 24 |
<script src="/bootstrap/js/bootstrap.min.js"></script> |
25 | 25 |
<script src="/jquery/pfSense.js"></script> |
26 |
<script src="/jquery/pfSenseHelpers.js"></script> |
|
26 | 27 |
</body> |
27 | 28 |
</html> |
src/usr/local/www/jquery/pfSenseHelpers.js | ||
---|---|---|
1 |
// These helper functions are used on many/most UI pages to hide/show/disable/enable form elements where required |
|
2 |
|
|
3 |
// Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden |
|
4 |
function hideInput(id, hide) { |
|
5 |
if(hide) |
|
6 |
$('#' + id).parent().parent('div').addClass('hidden'); |
|
7 |
else |
|
8 |
$('#' + id).parent().parent('div').removeClass('hidden'); |
|
9 |
} |
|
10 |
|
|
11 |
// Hides the <div> in which the specified group input element lives so that the input, |
|
12 |
// its label and help text are hidden |
|
13 |
function hideGroupInput(id, hide) { |
|
14 |
if(hide) |
|
15 |
$('#' + id).parent('div').addClass('hidden'); |
|
16 |
else |
|
17 |
$('#' + id).parent('div').removeClass('hidden'); |
|
18 |
} |
|
19 |
|
|
20 |
// Hides the <div> in which the specified checkbox lives so that the checkbox, its label and help text are hidden |
|
21 |
function hideCheckbox(id, hide) { |
|
22 |
if(hide) |
|
23 |
$('#' + id).parent().parent().parent('div').addClass('hidden'); |
|
24 |
else |
|
25 |
$('#' + id).parent().parent().parent('div').removeClass('hidden'); |
|
26 |
} |
|
27 |
|
|
28 |
// Disables the specified input element |
|
29 |
function disableInput(id, disable) { |
|
30 |
$('#' + id).prop("disabled", disable); |
|
31 |
} |
|
32 |
|
|
33 |
// Hides all elements of the specified class. This will usually be a section |
|
34 |
function hideClass(s_class, hide) { |
|
35 |
if(hide) |
|
36 |
$('.' + s_class).hide(); |
|
37 |
else |
|
38 |
$('.' + s_class).show(); |
|
39 |
} |
|
40 |
|
|
41 |
// Hides all elements of the specified class assigned to a group. This will usually be a group |
|
42 |
function hideGroupClass(s_class, hide) { |
|
43 |
if(hide) |
|
44 |
$('.' + s_class).parent().parent().parent().hide(); |
|
45 |
else |
|
46 |
$('.' + s_class).parent().parent().parent().show(); |
|
47 |
} |
|
48 |
|
|
49 |
|
|
50 |
|
Also available in: Unified diff
Preparation #5159 (Javascript refactoring)
javascript/pfSenseHelpers.js created and populated with common hide/show/disable/enable functions
file included via foot.inc
Those functions removed from firewall_nat_edit.php to test