]> git.ipfire.org Git - people/fbuehrle/ipfire-2.x.git/commitdiff
ids.cgi: Display oinkcode section after page load when neccessary.
authorStefan Schantl <stefan.schantl@ipfire.org>
Fri, 12 Apr 2019 16:21:01 +0000 (18:21 +0200)
committerMichael Tremer <michael.tremer@ipfire.org>
Thu, 11 Apr 2019 09:28:19 +0000 (10:28 +0100)
Fixes #12048.

Signed-off-by: Stefan Schantl <stefan.schantl@ipfire.org>
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/ids.cgi

index 98c6f57b44fc36756f67dcb86f3621f11895174e..00db6a0c3afd197627547d09ee3f635610f8971a 100644 (file)
@@ -689,20 +689,26 @@ print"var show = \"$Lang::tr{'ids show'}\"\;\n";
 print"var hide = \"$Lang::tr{'ids hide'}\"\;\n";
 
 print <<END
-       // JQuery function to show/hide the text input field for
+       // Java Script function to show/hide the text input field for
        // Oinkcode/Subscription code.
-       \$(function() {
-               \$('#RULES').change(function(){
-                       if(\$('#RULES').val() == 'registered') {
-                               \$('#code').show();
-                       } else if(\$('#RULES').val() == 'subscripted') {
-                               \$('#code').show();
-                       } else if(\$('#RULES').val() == 'emerging_pro') {
-                               \$('#code').show();
-                       } else {
-                               \$('#code').hide();
-                       }
-               });
+       var update_code = function() {
+               if(\$('#RULES').val() == 'registered') {
+                       \$('#code').show();
+               } else if(\$('#RULES').val() == 'subscripted') {
+                       \$('#code').show();
+               } else if(\$('#RULES').val() == 'emerging_pro') {
+                       \$('#code').show();
+               } else {
+                       \$('#code').hide();
+               }
+       };
+
+       // JQuery function to call corresponding function when
+       // the ruleset is changed or the page is loaded for showing/hiding
+       // the code area.
+       \$(document).ready(function() {
+               \$('#RULES').change(update_code);
+               update_code();
        });
 
        // Tiny java script function to show/hide the rules