public inbox for development@lists.ipfire.org
 help / color / mirror / Atom feed
From: Stefan Schantl <stefan.schantl@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH] ids.cgi: Display oinkcode section after page load when neccessary.
Date: Fri, 12 Apr 2019 18:21:01 +0200	[thread overview]
Message-ID: <20190412162101.4698-1-stefan.schantl@ipfire.org> (raw)

[-- Attachment #1: Type: text/plain, Size: 1570 bytes --]

Fixes #12048.

Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
---
 html/cgi-bin/ids.cgi | 32 +++++++++++++++++++-------------
 1 file changed, 19 insertions(+), 13 deletions(-)

diff --git a/html/cgi-bin/ids.cgi b/html/cgi-bin/ids.cgi
index 98c6f57b4..00db6a0c3 100644
--- a/html/cgi-bin/ids.cgi
+++ b/html/cgi-bin/ids.cgi
@@ -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
-- 
2.20.1


                 reply	other threads:[~2019-04-12 16:21 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190412162101.4698-1-stefan.schantl@ipfire.org \
    --to=stefan.schantl@ipfire.org \
    --cc=development@lists.ipfire.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox