From 3060b2553555c12b1a644ad294e19d14fbab75bc Mon Sep 17 00:00:00 2001
From: "p.tessenow"
Date: Wed, 28 Jul 2010 19:08:41 +0000
Subject: [PATCH] refactored JS-function change_argument_visibility()
git-svn-id: https://dev.finn.de/svn/cockpit/branches/reporting_merge@1513 7926756e-e54e-46e6-9721-ed318f58905e
---
assets/javascripts/reporting.js | 28 +++++++++++-----------------
1 file changed, 11 insertions(+), 17 deletions(-)
diff --git a/assets/javascripts/reporting.js b/assets/javascripts/reporting.js
index 993f142a08..736c31038a 100644
--- a/assets/javascripts/reporting.js
+++ b/assets/javascripts/reporting.js
@@ -32,23 +32,17 @@ function toggle_multi_select(select) {
}
function change_argument_visibility(field, arg_nr) {
- var arg1, arg2;
- arg1 = $(field + '_arg_1');
- arg2 = $(field + '_arg_2');
- if (arg1 !== null) {
- if (arg_nr === 0) {
- arg1.hide();
- }
- else {
- arg1.show();
- }
- }
- if (arg2 !== null) {
- if (arg_nr >= 2 || arg_nr <= -2) {
- arg2.show();
- }
- else {
- arg2.hide();
+ var params, i;
+ params = [$(field + '_arg_1'), $(field + '_arg_2')];
+
+ for (i = 0; i < 2; i++) {
+ if (params[i] !== null) {
+ if (arg_nr >= (i + 1) || arg_nr <= (-1 - i) ) {
+ params[i].show();
+ }
+ else {
+ params[i].hide();
+ }
}
}
}