From f2bad1336688635524486832773e2eedd004eb16 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Sat, 3 Jan 2015 14:57:44 -0800 Subject: [PATCH] INFRA-132 - Fix jshint warnings in js/angular*.js --- js/angular-crm-ui.js | 36 +++++++++++++-------------- js/angular-crm-util.js | 4 +-- js/angular-crmAttachment.js | 2 +- js/angular-crmCaseType.js | 4 +-- js/angular-crmMailing.js | 6 ++--- js/angular-crmMailing/directives.js | 2 +- js/angular-crmMailing/services.js | 5 ++-- js/angular-crmMailingAB.js | 4 +-- js/angular-crmMailingAB/directives.js | 21 ++++++++-------- js/angular-crmMailingAB/services.js | 6 ++--- 10 files changed, 45 insertions(+), 45 deletions(-) diff --git a/js/angular-crm-ui.js b/js/angular-crm-ui.js index f38e208011..858c537cab 100644 --- a/js/angular-crm-ui.js +++ b/js/angular-crm-ui.js @@ -4,7 +4,7 @@ var uidCount = 0; var partialUrl = function (relPath) { - return CRM.resourceUrls['civicrm'] + '/partials/crmUi/' + relPath; + return CRM.resourceUrls.civicrm + '/partials/crmUi/' + relPath; }; angular.module('crmUi', []) @@ -92,8 +92,8 @@ updateChildren(); scope.$parent.$watch(attrs.crmUiDateTime, updateChildren); - scope.$watch('dtparts.date', updateParent), - scope.$watch('dtparts.time', updateParent) + scope.$watch('dtparts.date', updateParent); + scope.$watch('dtparts.time', updateParent); } }; }) @@ -191,7 +191,7 @@ }); } else { - scope.crmIsRequired = input.prop('required') + scope.crmIsRequired = input.prop('required'); } ngModel = $parse(attrs.crmUiFor)(tgtScope); @@ -220,7 +220,7 @@ ids[name] = "crmUiId_" + (++uidCount); } return ids[name]; - } + }; }, link: function (scope, element, attrs) {} }; @@ -252,7 +252,7 @@ doc.open(); doc.writeln(iframeHtml); doc.close(); - } + }; scope.$parent.$watch(attrs.crmUiIframe, refresh); //setTimeout(function () { refresh(); }, 50); @@ -299,10 +299,10 @@ var defaultVal = function (defaultValue) { var f = function (scope) { return defaultValue; - } + }; f.assign = function (scope, value) { // ignore changes - } + }; return f; }; @@ -314,9 +314,9 @@ return { template: '', link: function (scope, element, attrs) { - var binding = parse(attrs['binding'], true); - var titleLocked = parse(attrs['titleLocked'], ts('Locked')); - var titleUnlocked = parse(attrs['titleUnlocked'], ts('Unlocked')); + var binding = parse(attrs.binding, true); + var titleLocked = parse(attrs.titleLocked, ts('Locked')); + var titleUnlocked = parse(attrs.titleUnlocked, ts('Unlocked')); $(element).addClass('ui-icon lock-button'); var refresh = function () { @@ -459,7 +459,7 @@ scope.$parent.$watch(attrs.crmUiTime, updateChildren); element.on('change', updateParent); } - } + }; }) // like ng-show, but hides/displays elements using "visibility" which maintains positioning @@ -514,12 +514,12 @@ this.$first = function() { return this.$index() === 0; }; /// @return bool whether the current step is last this.$last = function() { return this.$index() === steps.length -1; }; - this.$maxVisit = function() { return maxVisited; } + this.$maxVisit = function() { return maxVisited; }; this.iconFor = function(index) { if (index < this.$index()) return '√'; if (index === this.$index()) return '»'; return ' '; - } + }; this.isSelectable = function(step) { if (step.selected) return false; var result = false; @@ -566,7 +566,7 @@ this.previous = function() { this.goto(this.$index()-1); }; this.next = function() { this.goto(this.$index()+1); }; if ($scope.crmUiWizard) { - $parse($scope.crmUiWizard).assign($scope.$parent, this) + $parse($scope.crmUiWizard).assign($scope.$parent, this); } }, link: function (scope, element, attrs) {} @@ -656,11 +656,11 @@ template: '', link: function (scope, element, attrs) { $(element).click(function () { - var options = scope.$eval(attrs['crmConfirm']); + var options = scope.$eval(attrs.crmConfirm); var defaults = (options.type) ? defaultFuncs[options.type](options) : {}; CRM.confirm(_.extend(defaults, options)) - .on('crmConfirm:yes', function () { scope.$apply(attrs['onYes']); }) - .on('crmConfirm:no', function () { scope.$apply(attrs['onNo']); }); + .on('crmConfirm:yes', function () { scope.$apply(attrs.onYes); }) + .on('crmConfirm:no', function () { scope.$apply(attrs.onNo); }); }); } }; diff --git a/js/angular-crm-util.js b/js/angular-crm-util.js index d27875a2b8..1ac4ed112a 100644 --- a/js/angular-crm-util.js +++ b/js/angular-crm-util.js @@ -59,7 +59,7 @@ level--; } return r; - } + }; } }; return crmLog; @@ -160,7 +160,7 @@ }; return this; - } + }; }); })(angular, CRM.$, CRM._); diff --git a/js/angular-crmAttachment.js b/js/angular-crmAttachment.js index b9957c831c..bc0ec6c4c3 100644 --- a/js/angular-crmAttachment.js +++ b/js/angular-crmAttachment.js @@ -1,7 +1,7 @@ /// crmFile: Manage file attachments (function (angular, $, _) { var partialUrl = function (relPath) { - return CRM.resourceUrls['civicrm'] + '/partials/crmAttachment/' + relPath; + return CRM.resourceUrls.civicrm + '/partials/crmAttachment/' + relPath; }; angular.module('crmAttachment', ['angularFileUpload']); diff --git a/js/angular-crmCaseType.js b/js/angular-crmCaseType.js index dddd2d4036..0caf0fa153 100644 --- a/js/angular-crmCaseType.js +++ b/js/angular-crmCaseType.js @@ -1,7 +1,7 @@ (function(angular, $, _) { var partialUrl = function(relPath) { - return CRM.resourceUrls['civicrm'] + '/partials/crmCaseType/' + relPath; + return CRM.resourceUrls.civicrm + '/partials/crmCaseType/' + relPath; }; var crmCaseType = angular.module('crmCaseType', ['ngRoute', 'ui.utils', 'crmUi', 'unsavedChanges', 'crmUtil']); @@ -222,7 +222,7 @@ }; $scope.isForkable = function() { - return !$scope.caseType.id || $scope.caseType.is_forkable + return !$scope.caseType.id || $scope.caseType.is_forkable; }; $scope.isNewActivitySetAllowed = function(workflow) { diff --git a/js/angular-crmMailing.js b/js/angular-crmMailing.js index 9f5d0a72ea..239475862c 100644 --- a/js/angular-crmMailing.js +++ b/js/angular-crmMailing.js @@ -1,6 +1,6 @@ (function (angular, $, _) { var partialUrl = function partialUrl(relPath) { - return CRM.resourceUrls['civicrm'] + '/partials/crmMailing/' + relPath; + return CRM.resourceUrls.civicrm + '/partials/crmMailing/' + relPath; }; angular.module('crmMailing', [ @@ -132,7 +132,7 @@ return crmStatus({start: ts('Deleting...'), success: ts('Deleted')}, crmMailingMgr.delete($scope.mailing) .then(function () { - leave('unscheduled') + leave('unscheduled'); }) ); }; @@ -158,7 +158,7 @@ scheduled: 'false' }); } - }; + } // Transition URL "/mailing/new" => "/mailing/123" function updateUrl() { diff --git a/js/angular-crmMailing/directives.js b/js/angular-crmMailing/directives.js index 53b24c41ca..bb1104f4c8 100644 --- a/js/angular-crmMailing/directives.js +++ b/js/angular-crmMailing/directives.js @@ -1,6 +1,6 @@ (function (angular, $, _) { var partialUrl = function (relPath) { - return CRM.resourceUrls['civicrm'] + '/partials/crmMailing/' + relPath; + return CRM.resourceUrls.civicrm + '/partials/crmMailing/' + relPath; }; // The following directives have the same simple implementation -- load diff --git a/js/angular-crmMailing/services.js b/js/angular-crmMailing/services.js index adb2961ca5..08681ed110 100644 --- a/js/angular-crmMailing/services.js +++ b/js/angular-crmMailing/services.js @@ -85,7 +85,7 @@ tpl.id = '' + response.id; //parseInt(response.id); tpls.push(tpl); } - lastModifiedTpl = tpl + lastModifiedTpl = tpl; return tpl; }); }, @@ -162,7 +162,6 @@ from_email: crmFromAddresses.getDefault().email, replyto_email: "", subject: "For {contact.display_name}", // fixme - dedupe_email: "1", groups: {include: [2], exclude: [4]}, // fixme mailings: {include: [], exclude: []}, body_html: "Hello {contact.display_name}", // fixme @@ -233,7 +232,7 @@ if (!_.contains(excludes, field)) { mailingTgt[field] = mailingFrom[field]; } - }) + }); }, // @param mailing Object (per APIv3) diff --git a/js/angular-crmMailingAB.js b/js/angular-crmMailingAB.js index 6dab3a7d8b..63715dad16 100644 --- a/js/angular-crmMailingAB.js +++ b/js/angular-crmMailingAB.js @@ -4,7 +4,7 @@ if (!module) { module = 'crmMailingAB'; } - return CRM.resourceUrls['civicrm'] + '/partials/' + module + '/' + relPath; + return CRM.resourceUrls.civicrm + '/partials/' + module + '/' + relPath; }; angular.module('crmMailingAB', ['ngRoute', 'ui.utils', 'ngSanitize', 'crmUi', 'crmAttachment', 'crmMailing', 'crmD3']); @@ -151,7 +151,7 @@ } function updateCriteriaName() { - var criteria = crmMailingABCriteria.get($scope.abtest.ab.testing_criteria_id) + var criteria = crmMailingABCriteria.get($scope.abtest.ab.testing_criteria_id); $scope.criteriaName = criteria ? criteria.name : null; } diff --git a/js/angular-crmMailingAB/directives.js b/js/angular-crmMailingAB/directives.js index 64c9b35820..fb6ea88221 100644 --- a/js/angular-crmMailingAB/directives.js +++ b/js/angular-crmMailingAB/directives.js @@ -1,6 +1,6 @@ (function (angular, $, _) { var partialUrl = function (relPath) { - return CRM.resourceUrls['civicrm'] + '/partials/crmMailingAB/' + relPath; + return CRM.resourceUrls.civicrm + '/partials/crmMailingAB/' + relPath; }; // example: @@ -150,9 +150,10 @@ var m = t[0]; var year = t[2]; var day = t[1].substr(0, t[1].length - 3); + var t1, hur, hour, min; if (t[3] == "") { - var t1 = t[4].split(":"); - var hur = t1[0]; + t1 = t[4].split(":"); + hur = t1[0]; if (t[5] == "AM") { hour = hur; if (hour == 12) { @@ -162,11 +163,11 @@ if (t[5] == "PM") { hour = parseInt(hur) + 12; } - var min = t1[1]; + min = t1[1]; } else { - var t1 = t[3].split(":"); - var hur = t1[0]; + t1 = t[3].split(":"); + hur = t1[0]; if (t[4] == "AM") { hour = hur; if (hour == 12) { @@ -176,7 +177,7 @@ if (t[4] == "PM") { hour = parseInt(hur) + 12; } - var min = t1[1]; + min = t1[1]; } var month = 0; switch (m) { @@ -227,7 +228,7 @@ if (keep_cnt == options.split_count) { scope.graphload = true; - var data = scope.graph_data; + data = scope.graph_data; // set up a colour variable var color = d3.scale.category10(); @@ -320,13 +321,13 @@ svg.append("text") // text label for the x axis .style("text-anchor", "middle") .text(scope.winnercriteria).attr("transform",function (d) { - return "rotate(-90)" + return "rotate(-90)"; }).attr("x", -height / 2) .attr("y", -30); // create a variable called series and bind the date // for each series append a g element and class it as series for css styling - var series = svg.selectAll(".series") + series = svg.selectAll(".series") .data(series) .enter().append("g") .attr("class", "series"); diff --git a/js/angular-crmMailingAB/services.js b/js/angular-crmMailingAB/services.js index e28eac1fd8..e23c905b1f 100644 --- a/js/angular-crmMailingAB/services.js +++ b/js/angular-crmMailingAB/services.js @@ -71,13 +71,13 @@ crmMailingAB.mailings.b = crmMailingMgr.create(); crmMailingAB.mailings.c = crmMailingMgr.create(); crmMailingAB.attachments.a = new CrmAttachments(function () { - return {entity_table: 'civicrm_mailing', entity_id: crmMailingAB.ab['mailing_id_a']}; + return {entity_table: 'civicrm_mailing', entity_id: crmMailingAB.ab.mailing_id_a}; }); crmMailingAB.attachments.b = new CrmAttachments(function () { - return {entity_table: 'civicrm_mailing', entity_id: crmMailingAB.ab['mailing_id_b']}; + return {entity_table: 'civicrm_mailing', entity_id: crmMailingAB.ab.mailing_id_b}; }); crmMailingAB.attachments.c = new CrmAttachments(function () { - return {entity_table: 'civicrm_mailing', entity_id: crmMailingAB.ab['mailing_id_c']}; + return {entity_table: 'civicrm_mailing', entity_id: crmMailingAB.ab.mailing_id_c}; }); var dfr = $q.defer(); -- 2.25.1