summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/usr/local/www/firewall_nat_edit.php22
-rwxr-xr-xsrc/usr/local/www/foot.inc1
-rw-r--r--src/usr/local/www/jquery/pfSenseHelpers.js50
3 files changed, 51 insertions, 22 deletions
diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php
index 9d7578b..9a32ebb 100644
--- a/src/usr/local/www/firewall_nat_edit.php
+++ b/src/usr/local/www/firewall_nat_edit.php
@@ -970,28 +970,6 @@ events.push(function(){
var showsource = 0;
var iface_old = '';
- // ---------- "Library" functions ---------------------------------------------------------------------------------
- // Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden
- function hideInput(id, hide) {
- if (hide)
- $('#' + id).parent().parent('div').addClass('hidden');
- else
- $('#' + id).parent().parent('div').removeClass('hidden');
- }
-
- // Disables the specified input element
- function disableInput(id, disable) {
- $('#' + id).prop("disabled", disable);
- }
-
- // Hides all elements of the specified class. This will usually be a section
- function hideClass(s_class, hide) {
- if (hide)
- $('.' + s_class).hide();
- else
- $('.' + s_class).show();
- }
-
// ---------- jQuery functions, lovingly converted from the original javascript------------------------------------------
function ext_change() {
diff --git a/src/usr/local/www/foot.inc b/src/usr/local/www/foot.inc
index f5108dd..500474f 100755
--- a/src/usr/local/www/foot.inc
+++ b/src/usr/local/www/foot.inc
@@ -23,5 +23,6 @@
<script src="/jquery/jquery-ui-1.11.2.min.js"></script>
<script src="/bootstrap/js/bootstrap.min.js"></script>
<script src="/jquery/pfSense.js"></script>
+ <script src="/jquery/pfSenseHelpers.js"></script>
</body>
</html> \ No newline at end of file
diff --git a/src/usr/local/www/jquery/pfSenseHelpers.js b/src/usr/local/www/jquery/pfSenseHelpers.js
new file mode 100644
index 0000000..6fde31e
--- /dev/null
+++ b/src/usr/local/www/jquery/pfSenseHelpers.js
@@ -0,0 +1,50 @@
+// These helper functions are used on many/most UI pages to hide/show/disable/enable form elements where required
+
+// Hides the <div> in which the specified input element lives so that the input, its label and help text are hidden
+function hideInput(id, hide) {
+ if(hide)
+ $('#' + id).parent().parent('div').addClass('hidden');
+ else
+ $('#' + id).parent().parent('div').removeClass('hidden');
+}
+
+// Hides the <div> in which the specified group input element lives so that the input,
+// its label and help text are hidden
+function hideGroupInput(id, hide) {
+ if(hide)
+ $('#' + id).parent('div').addClass('hidden');
+ else
+ $('#' + id).parent('div').removeClass('hidden');
+}
+
+// Hides the <div> in which the specified checkbox lives so that the checkbox, its label and help text are hidden
+function hideCheckbox(id, hide) {
+ if(hide)
+ $('#' + id).parent().parent().parent('div').addClass('hidden');
+ else
+ $('#' + id).parent().parent().parent('div').removeClass('hidden');
+}
+
+// Disables the specified input element
+function disableInput(id, disable) {
+ $('#' + id).prop("disabled", disable);
+}
+
+// Hides all elements of the specified class. This will usually be a section
+function hideClass(s_class, hide) {
+ if(hide)
+ $('.' + s_class).hide();
+ else
+ $('.' + s_class).show();
+}
+
+// Hides all elements of the specified class assigned to a group. This will usually be a group
+function hideGroupClass(s_class, hide) {
+ if(hide)
+ $('.' + s_class).parent().parent().parent().hide();
+ else
+ $('.' + s_class).parent().parent().parent().show();
+}
+
+
+
OpenPOWER on IntegriCloud