From 0d75c29ce80d4bde17da2de264fa09f60dadad57 Mon Sep 17 00:00:00 2001 From: Coleman Watts Date: Mon, 9 Feb 2015 10:24:52 -0500 Subject: [PATCH] CheckStyle cleanup --- CRM/Contact/Page/AJAX.php | 2 +- js/Common.js | 17 +++++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/CRM/Contact/Page/AJAX.php b/CRM/Contact/Page/AJAX.php index 256c1f8be9..81aef57107 100644 --- a/CRM/Contact/Page/AJAX.php +++ b/CRM/Contact/Page/AJAX.php @@ -975,7 +975,7 @@ LIMIT {$offset}, {$rowCount} $mergeParams .= "&gid={$gid}"; } - $searchRows[$mainId]['actions'] = '' . ts('merge') . ''; + $searchRows[$mainId]['actions'] = '' . ts('merge') . ''; $searchRows[$mainId]['actions'] .= "" . ts('not a duplicate') . ""; } else { diff --git a/js/Common.js b/js/Common.js index 04d471e421..3f87471d95 100644 --- a/js/Common.js +++ b/js/Common.js @@ -1,5 +1,5 @@ // https://civicrm.org/licensing -var CRM = CRM || {}; +if (!CRM) CRM = {}; var cj = CRM.$ = jQuery; CRM._ = _; @@ -17,8 +17,8 @@ function ts(text, params) { if (d && CRM[d] && CRM[d][text]) { text = CRM[d][text]; } - else if (CRM['strings'][text]) { - text = CRM['strings'][text]; + else if (CRM.strings[text]) { + text = CRM.strings[text]; } if (typeof(params) === 'object') { for (var i in params) { @@ -44,7 +44,7 @@ function ts(text, params) { * @param elementType Value to set display style to for showBlocks (e.g. 'block' or 'table-row' or ...) */ function on_load_init_blocks(showBlocks, hideBlocks, elementType) { - if (elementType == null) { + if (!elementType) { elementType = 'block'; } @@ -54,7 +54,7 @@ function on_load_init_blocks(showBlocks, hideBlocks, elementType) { for (i = 0; i < showBlocks.length; i++) { myElement = document.getElementById(showBlocks[i]); /* getElementById returns null if element id doesn't exist in the document */ - if (myElement != null) { + if (myElement) { myElement.style.display = elementType; } else { @@ -66,7 +66,7 @@ function on_load_init_blocks(showBlocks, hideBlocks, elementType) { for (i = 0; i < hideBlocks.length; i++) { myElement = document.getElementById(hideBlocks[i]); /* getElementById returns null if element id doesn't exist in the document */ - if (myElement != null) { + if (myElement) { myElement.style.display = 'none'; } else { @@ -200,6 +200,7 @@ CRM.strings = CRM.strings || {}; (function ($, _, undefined) { "use strict"; + /* jshint validthis: true */ // Theme classes for unattached elements $.fn.select2.defaults.dropdownCssClass = $.ui.dialog.prototype.options.dialogClass = 'crm-container'; @@ -1049,12 +1050,12 @@ CRM.strings = CRM.strings || {}; expires: 0 }; if ($(this).length) { - if (title == '') { + if (title === '') { var label = $('label[for="' + $(this).attr('name') + '"], label[for="' + $(this).attr('id') + '"]').not('[generated=true]'); if (label.length) { label.addClass('crm-error'); var $label = label.clone(); - if (text == '' && $('.crm-marker', $label).length > 0) { + if (text === '' && $('.crm-marker', $label).length > 0) { text = $('.crm-marker', $label).attr('title'); } $('.crm-marker', $label).remove(); -- 2.25.1