Hashar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/144431

Change subject: Pass jshint on resources/js
......................................................................

Pass jshint on resources/js

There is still two errors left:

 Expected an assignment or function call and instead saw an expression.

They dont make anysense to me :-/

Bug: 66192
Change-Id: I841ce74d6335b35793f85c07e7287617b9cd0cdc
---
M resources/js/chartFormatHelpers.js
M resources/js/fundraising_charts.js
2 files changed, 27 insertions(+), 19 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/FundraisingChart 
refs/changes/31/144431/1

diff --git a/resources/js/chartFormatHelpers.js 
b/resources/js/chartFormatHelpers.js
index cef0b60..9f90065 100644
--- a/resources/js/chartFormatHelpers.js
+++ b/resources/js/chartFormatHelpers.js
@@ -40,7 +40,16 @@
 
 //let's make formatting easy, shall we
 Number.prototype.formatMoney = function(c, d, t){
-  var n = this, c = isNaN(c = Math.abs(c)) ? 2 : c, d = d == undefined ? "," : 
d, t = t == undefined ? "." : t, s = n < 0 ? "-" : "", i = parseInt(n = 
Math.abs(+n || 0).toFixed(c)) + "", j = (j = i.length) > 3 ? j % 3 : 0;
+  var n = this,
+      i,j, s;
+
+  c = isNaN(c = Math.abs(c)) ? 2 : c;
+  d = (d === undefined) ? "," : d;
+  t = (t === undefined) ? "." : t;
+
+  s = n < 0 ? "-" : "";
+  i = parseInt(n = Math.abs(+n || 0).toFixed(c)) + "";
+  j = (j = i.length) > 3 ? j % 3 : 0;
      return s + (j ? i.substr(0, j) + t : "") + 
i.substr(j).replace(/(\d{3})(?=\d)/g, "$1" + t) + (c ? d + Math.abs(n - 
i).toFixed(c).slice(2) : "");
    };
 
@@ -49,7 +58,7 @@
     val = val.toString().replace(/(\d+)(\d{3})/, '$1'+','+'$2');
   }
   return val;
-};
+}
 
 function convertStringDatesToMoments(dataSet){
 
@@ -57,7 +66,7 @@
         d = row.date;
         dateString = d.slice(0,10);
         newDate = moment(dateString);
-        row['date'] = newDate;
+        row.date = newDate;
     });
 
     return dataSet;
@@ -74,9 +83,9 @@
         months = [];
 
     for(i = one_yr_ago_month; i<one_yr_ago_month+12; i++){
-        var m = moment().add('months', i).month()
+        var m = moment().add('months', i).month();
         months.push(moment().month(m).format('MMM'));
     }
 
     return months;
-}
\ No newline at end of file
+}
diff --git a/resources/js/fundraising_charts.js 
b/resources/js/fundraising_charts.js
index b3663d0..3e61a07 100644
--- a/resources/js/fundraising_charts.js
+++ b/resources/js/fundraising_charts.js
@@ -12,12 +12,14 @@
 
 ( function ( mw, $) {
 
+       var ids;
+
     //if there are any pieArea classed areas,
     //iterate through each one to get their dataSets.
     //then draw each one.
     if($('.pieArea').length){
 
-        var ids = $.map(  $('.pieArea'), function( num ){
+        ids = $.map(  $('.pieArea'), function( num ){
             return num.id;
         });
 
@@ -58,7 +60,7 @@
                 }
 
                 drawPieChart(dataSet);
-            }
+            };
 
             $.ajax({
                 dataType: "json",
@@ -70,8 +72,6 @@
             });
 
         });
-
-        
 
     }
     if ($('.barArea').length || $('.lineArea').length) {
@@ -117,13 +117,13 @@
                         data : bardata
                     }
                 ]
-            }
+            };
 
         };
 
         if($('.barArea').length){
 
-            var ids = $.map($('.barArea'), function(num){
+            ids = $.map($('.barArea'), function(num){
                 return num.id;
             });
 
@@ -138,7 +138,7 @@
                     context = $( '#' + el_id.replace('Area','') ).get( 0 
).getContext( '2d' );
 
                     new Chart(context).Bar(formattedData);
-                }
+                };
 
                 $.ajax({
                     dataType: "json",
@@ -153,7 +153,7 @@
         }
         if($('.lineArea').length){
 
-            var ids = $.map($('.lineArea'), function(num){
+            ids = $.map($('.lineArea'), function(num){
                 return num.id;
             });
 
@@ -168,7 +168,7 @@
                     context = $( '#' + el_id.replace('Area','') ).get( 0 
).getContext( '2d' );
 
                     new Chart(context).Line(formattedData);
-                }
+                };
 
                 $.ajax({
                         dataType: "json",
@@ -184,17 +184,17 @@
     }
     if ($('.mapArea').length) {
 
-        var ids = $.map($('.mapArea'), function(num){
+        ids = $.map($('.mapArea'), function(num){
             return num.id;
         });
 
         ids.forEach(function(el_id){
-            
+
             //var dataSet,
                 var jsonDataSource = $('#' + el_id).attr('data-chartdata');
-                
+
                 setData = function( dataSet ){
-                    
+
                     var map = new Datamap({
 
                         element: document.getElementById(el_id),
@@ -249,4 +249,3 @@
     }
 
 } ( mediaWiki, jQuery ));
-

-- 
To view, visit https://gerrit.wikimedia.org/r/144431
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I841ce74d6335b35793f85c07e7287617b9cd0cdc
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/FundraisingChart
Gerrit-Branch: master
Gerrit-Owner: Hashar <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to