CRM-12887 get jshint happy with our code
authoreileen <eileen@fuzion.co.nz>
Mon, 24 Jun 2013 00:13:32 +0000 (12:13 +1200)
committereileen <eileen@fuzion.co.nz>
Mon, 24 Jun 2013 00:13:32 +0000 (12:13 +1200)
templates/CRM/Case/Form/ActivityChangeStatus.js
templates/CRM/Contribute/Page/DashBoard.js

index ec150e76bbacbc6781a56fc778ecf44a02aca58b..694f61a4ebc1edccfadb10f3d08133fba193d570 100644 (file)
@@ -62,6 +62,6 @@ cj(function($) {
     );
     return false;
   });
-});
+}
 
 
index af9a7eeb19c46fb0d95da7a063b09f2a75c056f8..a02121fc790aca9c23ec2fcbfa335e76e7d4494a 100644 (file)
@@ -1,49 +1,57 @@
 // http://civicrm.org/licensing
-cj(document).ready( function( ) {
-    getChart( );
-    cj('#chart_view').click(function( ) {
-        if ( cj('#chart_view').hasClass('ui-state-default') ) {
-            cj('#chart_view').removeClass('ui-state-default').addClass('ui-state-active ui-tabs-selected');
-            cj('#table_view').removeClass('ui-state-active ui-tabs-selected').addClass('ui-state-default');
-            getChart( );
-            cj('#tableData').children().html('');
-        }
-    });
-    cj('#table_view').click(function( ) {
-        if ( cj('#table_view').hasClass('ui-state-default') ) {
-            cj('#table_view').removeClass('ui-state-default').addClass('ui-state-active ui-tabs-selected');
-            cj('#chart_view').removeClass('ui-state-active ui-tabs-selected').addClass('ui-state-default');
-            buildTabularView();
-            cj('#chartData').children().html('');
-        }
-    });
-});
+//http://wiki.civicrm.org/confluence/display/CRMDOC43/Javascript+Reference
+/*jslint indent: 2 */
+/*global CRM, cj */
+cj(function ($) {
+  'use strict';
 
-function getChart( ) {
-   var year        = cj('#select_year').val( );
-   var charttype   = cj('#chart_type').val( );
-   var date        = new Date()
-   var currentYear = date.getFullYear( );
-   if ( !charttype ) charttype = 'bvg';
-   if ( !year ) year           = currentYear;
+  function getChart() {
+    var year        = $('#select_year').val();
+    var charttype   = $('#chart_type').val();
+    var date        = new Date();
+    var currentYear = date.getFullYear();
+    if (!charttype) {
+      charttype = 'bvg';
+    }
+    if (!year) {
+      year = currentYear;
+    }
+    var chartUrl = CRM.url("civicrm/ajax/chart", {snippet : 4});
+    chartUrl    += "&year=" + year + "&type=" + charttype;
+    $.ajax({
+      url     : chartUrl,
+      success  : function(html) {
+        $("#chartData").html(html);
+      }
+    });
+  }
 
-   var chartUrl = CRM.url("civicrm/ajax/chart", {snippet : 4});
-   chartUrl    += "&year=" + year + "&type=" + charttype;
-   cj.ajax({
-       url     : chartUrl,
-       success  : function(html){
-           cj( "#chartData" ).html( html );
-       }
-   });
+  function buildTabularView() {
+    var tableUrl = CRM.url("civicrm/contribute/ajax/tableview", {showtable: 1, snippet: 4});
+    $.ajax({
+      url      : tableUrl,
+      success  : function(html) {
+        $("#tableData").html(html);
+      }
+    });
+  }
 
-}
+  getChart();
+  $('#chart_view').click(function() {
+    if ($('#chart_view').hasClass('ui-state-default')) {
+      $('#chart_view').removeClass('ui-state-default').addClass('ui-state-active ui-tabs-selected');
+      $('#table_view').removeClass('ui-state-active ui-tabs-selected').addClass('ui-state-default');
+      getChart();
+      $('#tableData').children().html('');
+    }
+  });
+  $('#table_view').click(function() {
+    if ($('#table_view').hasClass('ui-state-default')) {
+      $('#table_view').removeClass('ui-state-default').addClass('ui-state-active ui-tabs-selected');
+      $('#chart_view').removeClass('ui-state-active ui-tabs-selected').addClass('ui-state-default');
+      buildTabularView();
+      $('#chartData').children().html('');
+    }
+  });
+});
 
-function buildTabularView( ) {
-    var tableUrl = CRM.url("civicrm/contribute/ajax/tableview", {showtable:1, snippet:4});
-    cj.ajax({
-        url      : tableUrl,
-        success  : function(html){
-            cj( "#tableData" ).html( html );
-        }
-    });
-}
\ No newline at end of file