Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugues Peccatte <hugues.peccatte@gmail.com>2015-07-21 00:28:51 +0300
committerHugues Peccatte <hugues.peccatte@gmail.com>2015-07-21 00:28:51 +0300
commit119e745d26a8227550e38a0ef63a26ad69768b33 (patch)
treeac558a040084bd73288371503c1a119ab69fea07 /js/tbl_change.js
parent9bd54931c069ec8941d36b54eba8d1fc34ba61cb (diff)
Simplify if statements.
Remove duplicate Jquery selector. Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
Diffstat (limited to 'js/tbl_change.js')
-rw-r--r--js/tbl_change.js42
1 files changed, 14 insertions, 28 deletions
diff --git a/js/tbl_change.js b/js/tbl_change.js
index cedaafbcc1..4d70dbcee7 100644
--- a/js/tbl_change.js
+++ b/js/tbl_change.js
@@ -339,38 +339,28 @@ AJAX.registerOnload('tbl_change.js', function () {
// validate the comment form when it is submitted
$("#insertForm").validate();
jQuery.validator.addMethod("validationFunctionForHex", function(value, element) {
- if (value.match(/^[a-f0-9]*$/i) === null) {
- return false;
- } else {
- return true;
- }
+ return value.match(/^[a-f0-9]*$/i) !== null;
});
jQuery.validator.addMethod("validationFunctionForFuns", function(value, element, options) {
if (value.substring(0, 3) === "AES" && options.data('type') !== 'HEX') {
return false;
- } else if (value.substring(0, 3) === "MD5"
- && typeof options.data('maxlength') !== 'undefined'
- && options.data('maxlength') < 32) {
- return false;
- } else {
- return true;
}
+
+ return !(value.substring(0, 3) === "MD5"
+ && typeof options.data('maxlength') !== 'undefined'
+ && options.data('maxlength') < 32);
});
jQuery.validator.addMethod("validationFunctionForDateTime", function(value, element, options) {
var dt_value = value;
var theType = options;
if (theType == "date") {
- if (! isDate(dt_value)) {
- return false;
- }
- return true;
+ return isDate(dt_value);
+
} else if (theType == "time") {
- if (! isTime(dt_value)) {
- return false;
- }
- return true;
+ return isTime(dt_value);
+
} else if (theType == "datetime" || theType == "timestamp") {
var tmstmp = false;
dt_value = dt_value.trim();
@@ -385,16 +375,12 @@ AJAX.registerOnload('tbl_change.js', function () {
}
var dv = dt_value.indexOf(" ");
if (dv == -1) { // Only the date component, which is valid
- if (! isDate(dt_value, tmstmp)) {
- return false;
- }
- return true;
+ return isDate(dt_value, tmstmp);
+
} else {
- if (! (isDate(dt_value.substring(0, dv), tmstmp)
- && isTime(dt_value.substring(dv + 1)))) {
- return false;
- }
- return true;
+ return isDate(dt_value.substring(0, dv), tmstmp)
+ && isTime(dt_value.substring(dv + 1));
+
}
}
});