jenkins-bot has submitted this change and it was merged. ( 
https://gerrit.wikimedia.org/r/327843 )

Change subject: Clean up some ununsed stuff, fix WS
......................................................................


Clean up some ununsed stuff, fix WS

Also fix jquery references.

Avoiding files with changes in review so as not to create merge conflicts.

Change-Id: I10cf89c8980345f667e64ae4a6d3991021bcffcd
---
M src/app/bindings.js
M src/app/campaign.js
M src/components/app-content/app-content.js
M src/components/boards/generic-board/generic-board.js
M src/components/filters/number-filter/number-filter.js
M src/components/nav-bar/nav-bar.js
M src/components/utils/date-pickers/date-pickers.js
M src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
M src/components/widgets/cat-trombone/cat-trombone.js
M src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
M src/components/widgets/donation-age/donation-age.js
M src/components/widgets/fraud-gauge/fraud-gauge.html
M src/components/widgets/fraud-gauge/fraud-gauge.js
M src/components/widgets/x-by-y/x-by-y.html
M src/components/widgets/x-by-y/x-by-y.js
15 files changed, 603 insertions(+), 622 deletions(-)

Approvals:
  jenkins-bot: Verified
  Ejegg: Looks good to me, approved



diff --git a/src/app/bindings.js b/src/app/bindings.js
index a3eb4a2..9ff9a68 100644
--- a/src/app/bindings.js
+++ b/src/app/bindings.js
@@ -1,104 +1,107 @@
 define([
        'knockout',
-       'c3'
-], function(ko, c3) {
-       function destroyChart(element) {
-               var chart = ko.utils.domData.get(element, 'chart');
-               if (chart) {
+       'jquery',
+       'c3',
+       'select2' // source this file to create the $( 'foo' ).select2 function
+], function( ko, $, c3, select2 ) {
+       function destroyChart( element ) {
+               var chart = ko.utils.domData.get( element, 'chart' );
+               if ( chart ) {
                        chart.destroy();
-                       ko.utils.domData.set(element, 'chart', undefined);
+                       ko.utils.domData.set( element, 'chart', undefined );
                }
        }
+
        ko.bindingHandlers.c3 = {
-               init: function init(element, valueAccessor, 
allBindingsAccessor, viewModel, bindingContext) {
-                       var chart, options = ko.unwrap(valueAccessor());
-                       if (!options) {
+               init: function init( element, valueAccessor, 
allBindingsAccessor, viewModel, bindingContext ) {
+                       var chart, options = ko.unwrap( valueAccessor() );
+                       if ( !options ) {
                                return;
                        }
                        options.bindto = element;
-                       chart = c3.generate(options);
-                       ko.utils.domNodeDisposal.addDisposeCallback(element, 
function() {
-                               destroyChart(element);
-                       });
-                       ko.utils.domData.set(element, 'chart', chart);
+                       chart = c3.generate( options );
+                       ko.utils.domNodeDisposal.addDisposeCallback( element, 
function () {
+                               destroyChart( element );
+                       } );
+                       ko.utils.domData.set( element, 'chart', chart );
                },
-               update: function update(element, valueAccessor, 
allBindingsAccessor, viewModel, bindingContext) {
-                       var chart = ko.utils.domData.get(element, 'chart'),
-                                       options = ko.unwrap(valueAccessor());
-                       if (!options) {
+               update: function update( element, valueAccessor, 
allBindingsAccessor, viewModel, bindingContext ) {
+                       var chart = ko.utils.domData.get( element, 'chart' ),
+                               options = ko.unwrap( valueAccessor() );
+                       if ( !options ) {
                                // Destroys existing chart if you pass a falsy 
value
                                // TODO: also reset when options outside of 
data have changed.
-                               if (chart) {
-                                       destroyChart(element);
+                               if ( chart ) {
+                                       destroyChart( element );
                                }
                                return;
                        }
-                       if (chart) {
-                               chart.load(options.data);
+                       if ( chart ) {
+                               chart.load( options.data );
                                return;
                        }
                        options.bindto = element;
-                       chart = c3.generate(options);
-                       ko.utils.domNodeDisposal.addDisposeCallback(element, 
function() {
-                               destroyChart(element);
-                       });
-                       ko.utils.domData.set(element, 'chart', chart);
+                       chart = c3.generate( options );
+                       ko.utils.domNodeDisposal.addDisposeCallback( element, 
function () {
+                               destroyChart( element );
+                       } );
+                       ko.utils.domData.set( element, 'chart', chart );
                }
        };
        /**
         * From https://github.com/select2/select2/wiki/Knockout.js-Integration
         */
        ko.bindingHandlers.select2 = {
-               init: function(el, valueAccessor, allBindingsAccessor, 
viewModel) {
-                       ko.utils.domNodeDisposal.addDisposeCallback(el, 
function() {
-                               $(el).select2('destroy');
-                       });
+               init: function ( el, valueAccessor, allBindingsAccessor, 
viewModel ) {
+                       ko.utils.domNodeDisposal.addDisposeCallback( el, 
function () {
+                               $( el ).select2( 'destroy' );
+                       } );
 
                        var allBindings = allBindingsAccessor(),
-                               select2 = 
ko.utils.unwrapObservable(allBindings.select2);
+                               select2 = ko.utils.unwrapObservable( 
allBindings.select2 );
 
-                       $(el).select2(select2);
+                       $( el ).select2( select2 );
                },
-               update: function(el, valueAccessor, allBindingsAccessor, 
viewModel) {
+               update: function ( el, valueAccessor, allBindingsAccessor, 
viewModel ) {
                        var allBindings = allBindingsAccessor();
 
-                       if ('value' in allBindings) {
-                               if (allBindings.select2.multiple && 
allBindings.value().constructor !== Array) {
-                                       $(el).select2('val', 
allBindings.value().split(','));
+                       if ( 'value' in allBindings ) {
+                               if ( allBindings.select2.multiple && 
allBindings.value().constructor !== Array ) {
+                                       $( el ).select2( 'val', 
allBindings.value().split( ',' ) );
                                }
                                else {
-                                       $(el).select2('val', 
allBindings.value());
+                                       $( el ).select2( 'val', 
allBindings.value() );
                                }
-                       } else if ('selectedOptions' in allBindings) {
+                       } else if ( 'selectedOptions' in allBindings ) {
                                var converted = [];
-                               var textAccessor = function(value) {
+                               var textAccessor = function ( value ) {
                                        return value;
                                };
-                               if ('optionsText' in allBindings) {
-                                       textAccessor = function(value) {
-                                               var valueAccessor = 
function(item) {
+                               if ( 'optionsText' in allBindings ) {
+                                       textAccessor = function ( value ) {
+                                               var valueAccessor = function ( 
item ) {
                                                        return item;
                                                };
-                                               if ('optionsValue' in 
allBindings) {
-                                                       valueAccessor = 
function(item) {
-                                                               return 
item[allBindings.optionsValue];
+                                               if ( 'optionsValue' in 
allBindings ) {
+                                                       valueAccessor = 
function ( item ) {
+                                                               return item[ 
allBindings.optionsValue ];
                                                        };
                                                }
-                                               var items = 
$.grep(ko.utils.unwrapObservable(allBindings.options), function(e) {
-                                                       return valueAccessor(e) 
=== value;
-                                               });
-                                               if (items.length === 0 || 
items.length > 1) {
+                                               var items = $.grep( 
ko.utils.unwrapObservable( allBindings.options ), function ( e ) {
+                                                       return valueAccessor( e 
) === value;
+                                               } );
+                                               if ( items.length === 0 || 
items.length > 1 ) {
                                                        return 'UNKNOWN';
                                                }
-                                               return 
items[0][allBindings.optionsText];
+                                               return items[ 0 ][ 
allBindings.optionsText ];
                                        };
                                }
-                               $.each(allBindings.selectedOptions(), 
function(key, value) {
-                                       converted.push({id: value, text: 
textAccessor(value)});
-                               });
-                               $(el).select2('data', converted);
+                               $.each( allBindings.selectedOptions(), function 
( key, value ) {
+                                       converted.push( { id: value, text: 
textAccessor( value ) } );
+                               } );
+                               $( el ).select2( 'data', converted );
                        }
                }
        };
        return true;
-});
+} );
diff --git a/src/app/campaign.js b/src/app/campaign.js
index 9ea0692..483286f 100644
--- a/src/app/campaign.js
+++ b/src/app/campaign.js
@@ -29,7 +29,7 @@
 
                // Not a fencepost error - this should be 0 for Jan 1
                return msToDays( diff );
-       }
+       };
 
        Campaign.prototype.getDateFilter = function () {
                var filter = '(DT gt \'' +
@@ -38,13 +38,13 @@
                        this.endDate.toISOString() + '\')';
 
                return filter;
-       }
+       };
 
        Campaign.prototype.getLengthInDays = function () {
                var diff = this.endDate.getTime() - this.startDate.getTime();
 
                return msToDays( diff );
-       }
+       };
 
        return Campaign;
 } );
diff --git a/src/components/app-content/app-content.js 
b/src/components/app-content/app-content.js
index 7958fdb..0fd0315 100644
--- a/src/components/app-content/app-content.js
+++ b/src/components/app-content/app-content.js
@@ -1,131 +1,130 @@
-define(
-       [   'jquery',
+define( [
+       'jquery',
        'knockout',
        'text!./app-content.html'
-       ], function( $, ko, templateMarkup ) {
+], function( $, ko, templateMarkup ) {
 
-               function AppContent( params ) {
-                       var self = this;
+       function AppContent() {
+               var self = this;
 
-                       self.url                = params.url || 'hi';
-                       self.displayedBoard     = ko.observable();
-                       self.userBoards         = ko.observableArray();
-                       self.userdata           = ko.observableArray();
-                       self.displayPage        = ko.observable('Home');
-                       self.loggedIn           = ko.observable(false);
-                       self.welcome            = ko.observable('');
-                       self.widgetTemplates    = ko.observableArray();
-                       self.widgetInstances    = ko.observableArray();
-                       self.currentBoardWidgets= ko.computed( function() {
-                               var widgets = [];
-                               if ( self.displayedBoard() ) {
-                                       $.each( self.displayedBoard().widgets, 
function( idx, widget ) {
-                                               widgets[widget.widgetId] = true;
-                                       } );
-                               }
-                               return widgets;
-                       } );
+               self.displayedBoard = ko.observable();
+               self.userBoards = ko.observableArray();
+               self.userdata = ko.observable();
+               self.displayPage = ko.observable( 'Home' );
+               self.loggedIn = ko.observable( false );
+               self.welcome = ko.observable( '' );
+               self.widgetTemplates = ko.observableArray();
+               self.widgetInstances = ko.observableArray();
+               self.currentBoardWidgets = ko.computed( function () {
+                       var widgets = [];
+                       if ( self.displayedBoard() ) {
+                               $.each( self.displayedBoard().widgets, function 
( idx, widget ) {
+                                       widgets[ widget.widgetId ] = true;
+                               } );
+                       }
+                       return widgets;
+               } );
 
-                       $.get( '/user/info', function( userInfo ) {
-                               if ( userInfo && !userInfo.error ) {
-                                       self.userdata( userInfo );
-                                       self.welcome( 
userInfo.name.charAt(0).toUpperCase() + userInfo.name.slice(1) );
-                                       self.loggedIn( true );
+               $.get( '/user/info', function ( userInfo ) {
+                       if ( userInfo && !userInfo.error ) {
+                               self.userdata( userInfo );
+                               self.welcome( userInfo.name.charAt( 0 
).toUpperCase() + userInfo.name.slice( 1 ) );
+                               self.loggedIn( true );
 
-                                       $.get( 'board/' + 
self.userdata().defaultBoard, function( moredata ){
-                                               self.displayedBoard( moredata );
-                                       });
-
-                                       $.get( 'board/', function ( boards ){
-                                               self.userBoards( boards );
-                                       });
-                               }
-                       });
-
-                       self.addWidgetToBoard = function( event, data ){
-                               $.ajax( {
-                                       method: 'POST',
-                                       url: '/widget-instance',
-                                       contentType: 'application/json; 
charset=UTF-8',
-                                       data: JSON.stringify( {
-                                               widgetId: event.id,
-                                               displayName: 'My ' + 
event.displayName,
-                                               isShared: false
-                                       } ),
-                                       success: function( data ) {
-                                               $.ajax( {
-                                                       method: 'POST',
-                                                       url: '/board/' + 
self.displayedBoard().id + '/widgets',
-                                                       contentType: 
'application/json; charset=UTF-8',
-                                                       data: JSON.stringify( {
-                                                               instanceId: 
data.id
-                                                       } ),
-                                                       success: function( 
stuff ) {
-                                                               //refresh the 
displayed board
-                                                               $.get( 'board/' 
+ self.displayedBoard().id, function( moredata ){
-                                                                       
self.displayedBoard( moredata );
-                                                               });
-                                                       }
-                                               } );
-                                       }
+                               $.get( 'board/' + self.userdata().defaultBoard, 
function ( moredata ) {
+                                       self.displayedBoard( moredata );
                                } );
 
-                       };
+                               $.get( 'board/', function ( boards ) {
+                                       self.userBoards( boards );
+                               } );
+                       }
+               } );
 
-                       self.removeWidgetFromBoard = function( event, data ){
-                               var removingBoard = self.displayedBoard().id;
-                               $.ajax({
-                                       method: 'DELETE',
-                                       url: '/board/' + removingBoard + 
'/widgets/' + event.instanceID,
-                                       success: function( ) {
-                                               $.get( 'board/' + 
removingBoard, function( moredata ){
-                                                       self.displayedBoard( 
moredata );
-                                                       
$('.modal-backdrop').remove();
-                                               });
-                                       }
-                               });
-                       };
-
-                       self.setDisplayPage = function( e, data ){
-                               var pages = [ 'Library', 'Profile', 'Home' ], 
view = data.target.id;
-
-                               if( pages.indexOf(data.target.id) > -1 ){
-                                       self.displayPage(view);
-                               } else if( isNaN( parseInt( view, 10 ) ) ) {
-                                       
self.displayPage($.trim($(data.target).text()));
-                               } else {
-                                       $.get( 'board/' + view, function( bdata 
){
-                                               self.displayPage('Home');
-                                               self.displayedBoard( bdata );
-                                       });
-                               }
-                       };
-
-                       $.get( '/widget', function( widgetTemplates ){
-
-                               var wt = $.map(widgetTemplates, function(n){
-                                       n.onBoard = ko.computed( function() {
-                                               return ( 
self.currentBoardWidgets()[n.id] );
+               self.addWidgetToBoard = function ( event, data ) {
+                       $.ajax( {
+                               method: 'POST',
+                               url: '/widget-instance',
+                               contentType: 'application/json; charset=UTF-8',
+                               data: JSON.stringify( {
+                                       widgetId: event.id,
+                                       displayName: 'My ' + event.displayName,
+                                       isShared: false
+                               } ),
+                               success: function ( data ) {
+                                       $.ajax( {
+                                               method: 'POST',
+                                               url: '/board/' + 
self.displayedBoard().id + '/widgets',
+                                               contentType: 'application/json; 
charset=UTF-8',
+                                               data: JSON.stringify( {
+                                                       instanceId: data.id
+                                               } ),
+                                               success: function ( stuff ) {
+                                                       //refresh the displayed 
board
+                                                       $.get( 'board/' + 
self.displayedBoard().id, function ( moredata ) {
+                                                               
self.displayedBoard( moredata );
+                                                       } );
+                                               }
                                        } );
+                               }
+                       } );
+
+               };
+
+               self.removeWidgetFromBoard = function ( event, data ) {
+                       var removingBoard = self.displayedBoard().id;
+                       $.ajax( {
+                               method: 'DELETE',
+                               url: '/board/' + removingBoard + '/widgets/' + 
event.instanceID,
+                               success: function () {
+                                       $.get( 'board/' + removingBoard, 
function ( moredata ) {
+                                               self.displayedBoard( moredata );
+                                               $( '.modal-backdrop' ).remove();
+                                       } );
+                               }
+                       } );
+               };
+
+               self.setDisplayPage = function ( e, data ) {
+                       var pages = [ 'Library', 'Profile', 'Home' ], view = 
data.target.id;
+
+                       if ( pages.indexOf( data.target.id ) > -1 ) {
+                               self.displayPage( view );
+                       } else if ( isNaN( parseInt( view, 10 ) ) ) {
+                               self.displayPage( $.trim( $( data.target 
).text() ) );
+                       } else {
+                               $.get( 'board/' + view, function ( bdata ) {
+                                       self.displayPage( 'Home' );
+                                       self.displayedBoard( bdata );
+                               } );
+                       }
+               };
+
+               $.get( '/widget', function ( widgetTemplates ) {
+
+                       var wt = $.map( widgetTemplates, function ( n ) {
+                               n.onBoard = ko.computed( function () {
+                                       return ( self.currentBoardWidgets()[ 
n.id ] );
+                               } );
+                               return n;
+                       } );
+
+                       self.widgetTemplates( wt );
+               } );
+
+               self.getUsersWidgetInstances = function () {
+                       $.get( '/widget-instance', function ( widgetInstances ) 
{
+
+                               var wi = $.map( widgetInstances, function ( n ) 
{
                                        return n;
-                               });
+                               } );
 
-                               self.widgetTemplates(wt);
-                       });
+                               self.widgetInstances( wi );
+                       } );
+               };
+               self.getUsersWidgetInstances();
 
-                       self.getUsersWidgetInstances = function(){
-                               $.get('/widget-instance', function( 
widgetInstances ){
+       }
 
-                                       var wi = $.map(widgetInstances, 
function(n){
-                                               return n;
-                                       });
-
-                                       self.widgetInstances(wi);
-                               });
-                       };
-                       self.getUsersWidgetInstances();
-
-               }
-
-               return { viewModel: AppContent, template: templateMarkup };
-       });
+       return { viewModel: AppContent, template: templateMarkup };
+} );
diff --git a/src/components/boards/generic-board/generic-board.js 
b/src/components/boards/generic-board/generic-board.js
index 1bd0688..abb15f0 100644
--- a/src/components/boards/generic-board/generic-board.js
+++ b/src/components/boards/generic-board/generic-board.js
@@ -1,62 +1,65 @@
 define( [
-               'knockout',
-               'text!components/boards/generic-board/generic-board.html',
-               'momentjs',
-               'numeraljs'
-               ], function( ko, template, moment, numeral ){
+       'knockout',
+       'jquery',
+       'text!components/boards/generic-board/generic-board.html',
+       'momentjs'
+], function( ko, $, template, moment ) {
 
-                       function GenericBoardViewModel( params ){
+       function GenericBoardViewModel( params ) {
 
-                               var self = this,
-timeFormat = 'dddd, MMMM Do YYYY, h:mm:ss a';
+               var self = this,
+                       timeFormat = 'dddd, MMMM Do YYYY, h:mm:ss a';
 
-self.sharedContext          = {};
-self.displayedBoard         = params.displayedBoard;
-self.boardName              = ko.observable();
-self.widgetLoads            = ko.observableArray([]);
+               self.sharedContext = {};
+               self.displayedBoard = params.displayedBoard;
+               self.boardName = ko.observable();
+               self.widgetLoads = ko.observableArray( [] );
 
-function setWidgetLoads() {
-       self.widgetLoads.removeAll();
-       $.each( self.displayedBoard().widgets, function( i, widget ) {
-               widget.dataLoading = ko.observable( false );
-               self.widgetLoads.push( widget.dataLoading );
-       } );
-}
-setWidgetLoads();
-self.displayedBoard.subscribe( setWidgetLoads );
+               function setWidgetLoads() {
+                       self.widgetLoads.removeAll();
+                       $.each( self.displayedBoard().widgets, function ( i, 
widget ) {
+                               widget.dataLoading = ko.observable( false );
+                               self.widgetLoads.push( widget.dataLoading );
+                       } );
+               }
 
-//TODO: be able to change board name
-//self.boardName(self.displayedBoard().displayName);
+               setWidgetLoads();
+               self.displayedBoard.subscribe( setWidgetLoads );
 
-//This will return true if any child widget is loading
-self.dataLoading = ko.computed( function() {
-       var i,
-       loads = self.widgetLoads(),
-       widgetCount = loads.length;
+               //TODO: be able to change board name
+               //self.boardName(self.displayedBoard().displayName);
 
-for ( i = 0; i < widgetCount; i++ ) {
-       if ( loads[i]() === true ) {
-               return true;
+               //This will return true if any child widget is loading
+               self.dataLoading = ko.computed( function () {
+                       var i,
+                               loads = self.widgetLoads(),
+                               widgetCount = loads.length;
+
+                       for ( i = 0; i < widgetCount; i++ ) {
+                               if ( loads[ i ]() === true ) {
+                                       return true;
+                               }
+                       }
+                       return false;
+               } ).extend( { throttle: 50 } ); // don't flip too often
+
+               self.dataLoading.subscribe( function ( value ) {
+                       if ( value ) {
+                               $( '#loadingModal' ).modal( 'show' ); //todo: 
knockout-style!
+                       } else {
+                               $( '#loadingModal' ).modal( 'hide' ); //todo: 
knockout-style!
+                       }
+               } );
+
+               $( '#loadingModal' ).on( 'hidden.bs.modal', function () {
+                       $( this ).css( 'display', 'none' );
+                       $( '.modal-backdrop' ).remove();
+               } );
+
+               // Get the date
+               self.displayDate = ko.observable( moment().format( timeFormat ) 
);
        }
-}
-return false;
-} ).extend( { throttle: 50 } ); // don't flip too often
 
-self.dataLoading.subscribe( function( value ) {
-       if ( value ) {
-               $('#loadingModal').modal('show'); //todo: knockout-style!
-       } else {
-               $('#loadingModal').modal('hide'); //todo: knockout-style!
-       }
+       return { viewModel: GenericBoardViewModel, template: template };
+
 } );
-$( '#loadingModal' ).on( 'hidden.bs.modal', function () {
-       $( this ).css( 'display', 'none');
-       $( '.modal-backdrop' ).remove();
-} );
-// Get the date
-self.displayDate = ko.observable( moment().format( timeFormat ) );
-}
-
-return { viewModel: GenericBoardViewModel, template: template };
-
-});
diff --git a/src/components/filters/number-filter/number-filter.js 
b/src/components/filters/number-filter/number-filter.js
index 61e132a..4479d7e 100644
--- a/src/components/filters/number-filter/number-filter.js
+++ b/src/components/filters/number-filter/number-filter.js
@@ -3,9 +3,9 @@
        'text!components/filters/number-filter/number-filter.html',
        'operators'
        ],
-function( ko, template, ops ){
+function( ko, template, ops ) {
 
-       function NumberFilterViewModel( params ){
+       function NumberFilterViewModel( params ) {
                var self = this;
 
                this.operators = [
@@ -20,7 +20,7 @@
                this.min = params.metadata.min;
                this.max = params.metadata.max;
 
-               this.changed = function() {
+               this.changed = function () {
                        var value = self.value();
 
                        params.userChoices( {
@@ -34,9 +34,8 @@
                        }
 
                        params.queryString(
-                                       params.name + ' ' + 
self.selectedOperator() + ' \'' + value + '\''
+                               params.name + ' ' + self.selectedOperator() + ' 
\'' + value + '\''
                        );
-                       return;
                };
 
                this.selectedOperator.subscribe( this.changed );
diff --git a/src/components/nav-bar/nav-bar.js 
b/src/components/nav-bar/nav-bar.js
index e673877..a32af55 100644
--- a/src/components/nav-bar/nav-bar.js
+++ b/src/components/nav-bar/nav-bar.js
@@ -1,84 +1,84 @@
 define( [
        'knockout',
+       'jquery',
        'text!components/nav-bar/nav-bar.html'
-       ], function( ko, template ){
+       ], function( ko, $, template ) {
 
+       function NavBarViewModel( params ) {
+               var self = this;
+               self.loggedIn = params.loggedIn;
+               self.welcome = params.welcome;
+               self.userBoards = params.userBoards;
+               self.displayPage = ko.observable( 'filler' );
+               self.newBoardName = ko.observable( '' );
+               self.boardError = ko.observable( '' );
 
-               function NavBarViewModel( params ){
-                       var self = this;
-                       self.loggedIn = params.loggedIn;
-                       self.welcome = params.welcome;
-                       self.userBoards = params.userBoards;
-                       self.displayPage = ko.observable('filler');
-                       self.newBoardName = ko.observable('');
-                       self.boardError = ko.observable('');
+               self.hideNav = function () {
+                       //make the nav menu fold out of view.
+                       $( '#navContainer .navWrapper' ).toggleClass( 'hide' );
+                       $( '#showNavMenu' ).css( 'display', 'inline' );
+                       $( '#dashApp' ).css( 'padding', '0 0 0 10px' );
+               };
 
-                       self.hideNav = function(){
-                               //make the nav menu fold out of view.
-                               $('#navContainer 
.navWrapper').toggleClass('hide');
-                               $('#showNavMenu').css('display', 'inline');
-                               $('#dashApp').css('padding', '0 0 0 10px');
+               self.showNav = function () {
+                       window.setTimeout( function () {
+                               $( '#navContainer .navWrapper' ).toggleClass( 
'hide' );
+                               $( '#dashApp' ).css( 'padding-left', '175px' );
+                       }, 200 );
+               };
+
+               $( '.mainNavButton' ).click( function ( e ) {
+                       $( '.mainNavButton' ).removeClass( 'selectedSubNav' );
+                       if ( $( e.target ).hasClass( 'mainNavButton' ) ) {
+                               $( e.target ).addClass( 'selectedSubNav' );
+                       } else {
+                               $( e.target.parentElement ).addClass( 
'selectedSubNav' );
+                       }
+               } );
+
+               self.toggleBoardList = function ( e, data ) {
+                       $( '#boards.subNavBoardOpts' ).slideDown( 200, 'swing', 
function () {
+                               $( '#boards.subNavBoardOpts' ).toggleClass( 
'hide' );
+                       } );
+               };
+
+               self.toggleProfileList = function () {
+                       $( '#profileLinks.subNavBoardOpts' ).slideDown( 200, 
'swing', function () {
+                               $( '#profileLinks.subNavBoardOpts' 
).toggleClass( 'hide' );
+                       } );
+               };
+
+               self.addBoard = function () {
+                       var board, name = self.newBoardName();
+                       self.boardError( '' );
+                       if ( name === '' ) {
+                               self.boardError( 'Enter new board name' );
+                               return;
+                       }
+                       board = {
+                               displayName: name,
+                               description: '',
+                               isShared: false,
+                               widgets: []
                        };
-
-                       self.showNav = function(){
-                               window.setTimeout(function(){
-                                       $('#navContainer 
.navWrapper').toggleClass('hide');
-                                       $('#dashApp').css('padding-left', 
'175px');
-                               }, 200);
-                       };
-
-                       $('.mainNavButton').click(function(e){
-                               
$('.mainNavButton').removeClass('selectedSubNav');
-                               if($(e.target).hasClass('mainNavButton')){
-                                       $(e.target).addClass('selectedSubNav');
-                               } else {
-                                       
$(e.target.parentElement).addClass('selectedSubNav');
-                               }
-                       });
-
-                       self.toggleBoardList = function(e, data){
-                               $('#boards.subNavBoardOpts').slideDown(200, 
'swing', function(){
-                                       
$('#boards.subNavBoardOpts').toggleClass('hide');
-                               });
-                       };
-
-                       self.toggleProfileList = function(){
-                               
$('#profileLinks.subNavBoardOpts').slideDown(200, 'swing', function(){
-                                       
$('#profileLinks.subNavBoardOpts').toggleClass('hide');
-                               });
-                       };
-
-                       self.addBoard = function() {
-                               var board, name = self.newBoardName();
-                               self.boardError('');
-                               if ( name === '' ) {
-                                       self.boardError( 'Enter new board name' 
);
-                                       return;
-                               }
-                               board = {
-                                       displayName: name,
-                                       description: '',
-                                       isShared: false,
-                                       widgets: []
-                               };
-                               $.ajax( {
-                                       method: 'POST',
-                                       url: '/board',
-                                       contentType: 'application/json; 
charset=UTF-8',
-                                       data: JSON.stringify( board ),
-                                       success: function( returned ) {
-                                               if ( returned.error ) {
-                                                       self.boardError( 
returned.error );
-                                                       return;
-                                               }
-                                               board.id = returned.id;
-                                               self.userBoards.push( board );
-                                               self.newBoardName( '' );
+                       $.ajax( {
+                               method: 'POST',
+                               url: '/board',
+                               contentType: 'application/json; charset=UTF-8',
+                               data: JSON.stringify( board ),
+                               success: function ( returned ) {
+                                       if ( returned.error ) {
+                                               self.boardError( returned.error 
);
+                                               return;
                                        }
-                               });
-                       };
-               }
+                                       board.id = returned.id;
+                                       self.userBoards.push( board );
+                                       self.newBoardName( '' );
+                               }
+                       } );
+               };
+       }
 
-               return { viewModel: NavBarViewModel, template: template };
+       return { viewModel: NavBarViewModel, template: template };
 
-       });
+} );
diff --git a/src/components/utils/date-pickers/date-pickers.js 
b/src/components/utils/date-pickers/date-pickers.js
index f93fdfe..c78e508 100644
--- a/src/components/utils/date-pickers/date-pickers.js
+++ b/src/components/utils/date-pickers/date-pickers.js
@@ -1,81 +1,76 @@
 define( [
        'knockout',
+       'jquery',
        'text!components/utils/date-pickers/date-pickers.html',
        'bootstrap-timepicker'
-       ], function( ko, template ){
+       ], function( ko, $, template ) {
 
+       function DatePickerViewModel( params ) {
+               var self = this;
 
-               function DatePickerViewModel( params ){
-                       var self = this;
+               self.setupTimepicker = function ( event ) {
+                       $( '#' + event.target.id ).timepicker( {
+                               template: false,
+                               showMeridian: false
+                       } );
+               };
 
-                       self.setupTimepicker = function(event){
-                               $('#' + event.target.id).timepicker({
-                                       template: false,
-                                       showMeridian: false
-                               });
-                       };
+               //initialize inputs
+               self.dateBeginRange = ko.observable( '' );
+               self.dateEndRange = ko.observable( '' );
+               self.chosenTimePeriodPresetDate = ko.observable( '' );
+               self.chosenTimePeriodDate = ko.observable( '' );
+               self.chosenTimePeriodFromTime = ko.observable( '' );
+               self.chosenTimePeriodToTime = ko.observable( '' );
+               self.selectedTimePeriod = params.selectedTimePeriod;
 
-                       //initialize inputs
-                       self.dateBeginRange = ko.observable('');
-                       self.dateEndRange = ko.observable('');
-                       self.chosenTimePeriodPresetDate = ko.observable('');
-                       self.chosenTimePeriodDate = ko.observable('');
-                       self.chosenTimePeriodFromTime = ko.observable('');
-                       self.chosenTimePeriodToTime = ko.observable('');
-                       self.selectedTimePeriod = params.selectedTimePeriod;
+               //TODO: handle resetting fields
+               self.chosenTimePeriod = ko.pureComputed( function () {
+                       var timePeriod;
 
-                       //TODO: handle resetting fields
-                       self.chosenTimePeriod = ko.pureComputed( function (){
-                               var timePeriod;
+                       if ( self.dateBeginRange() && self.dateEndRange() ) {
+                               timePeriod = 'from ' + self.dateBeginRange() + 
' to ' + self.dateEndRange();
+                       } else if ( self.chosenTimePeriodPresetDate() ) {
+                               timePeriod = self.chosenTimePeriodPresetDate();
+                       } else if ( self.chosenTimePeriodDate() && 
self.chosenTimePeriodFromTime() && self.chosenTimePeriodToTime() ) {
+                               timePeriod = self.chosenTimePeriodDate() + ' 
from ' + self.chosenTimePeriodFromTime() + ' to ' + 
self.chosenTimePeriodToTime();
+                       }
 
-                               if (self.dateBeginRange() && 
self.dateEndRange()){
-                                       timePeriod = 'from ' + 
self.dateBeginRange() + ' to ' + self.dateEndRange();
-                               } else if(self.chosenTimePeriodPresetDate()){
-                                       timePeriod = 
self.chosenTimePeriodPresetDate();
-                               } else if(self.chosenTimePeriodDate() && 
self.chosenTimePeriodFromTime() && self.chosenTimePeriodToTime()) {
-                                       timePeriod = 
self.chosenTimePeriodDate() + ' from ' + self.chosenTimePeriodFromTime() + ' to 
' + self.chosenTimePeriodToTime();
-                               }
+                       return timePeriod;
 
-                               return timePeriod;
+               } );
 
-                       });
+               self.shouldShowIncrements = ko.computed( function () {
+                       return true;
+               } );
 
-                       self.submitTimePeriod = function(){
-                               console.log('the time period was submitted');
-                       };
+               self.shouldShowCustom = ko.computed( function () {
+                       return true;
+               } );
 
-                       self.shouldShowIncrements = ko.computed( function(){
-                               return true;
-                       });
+               self.availableTimePresets = ko.observableArray( [
+                       'Last 15 Minutes',
+                       'Last Hour',
+                       'Last 24 Hours',
+                       'Last 5 Minutes'
+               ] );
 
-                       self.shouldShowCustom = ko.computed( function(){
-                               return true;
-                       });
+               self.availableIncrementTypes = ko.observableArray( [
+                       'Hour...',
+                       'Day...',
+                       'Week...',
+                       'Month...',
+                       'Year...'
+               ] );
 
-                       self.availableTimePresets = ko.observableArray([
-                                       'Last 15 Minutes',
-                                       'Last Hour',
-                                       'Last 24 Hours',
-                                       'Last 5 Minutes'
-                                       ]);
+               self.selectedIncrement = ko.observable();
 
-                       self.availableIncrementTypes = ko.observableArray([
-                                       'Hour...',
-                                       'Day...',
-                                       'Week...',
-                                       'Month...',
-                                       'Year...'
-                                       ]);
+               self.getIncrementSubmenu = ko.computed( function () {
 
-                       self.selectedIncrement = ko.observable();
+               } );
 
-                       self.getIncrementSubmenu = ko.computed( function(){
+       }
 
-                       });
+       return { viewModel: DatePickerViewModel, template: template };
 
-
-               }
-
-               return { viewModel: DatePickerViewModel, template: template };
-
-       });
+} );
diff --git 
a/src/components/widgets/amt-per-second-chart/amt-per-second-chart.js 
b/src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
index d713f1d..6993f20 100644
--- a/src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
+++ b/src/components/widgets/amt-per-second-chart/amt-per-second-chart.js
@@ -1,19 +1,18 @@
 define( [
        'knockout',
        
'text!components/widgets/amt-per-second-chart/amt-per-second-chart.html',
-       'c3',
        'numeraljs',
        'WidgetBase'
-], function( ko, template, c3, numeral, WidgetBase ){
+], function( ko, template, numeral, WidgetBase ) {
 
-       function AmtPerSecondChartViewModel( params ){
+       function AmtPerSecondChartViewModel( params ) {
 
                var self = this;
                WidgetBase.call( this, params );
                self.hasData = ko.observable( false );
                self.avgUSDperSecondChart = ko.observable( false );
 
-               self.makeChart = function() {
+               self.makeChart = function () {
                        if ( params.sharedContext.dayObj.length < 2 ) {
                                return;
                        }
@@ -22,34 +21,34 @@
                                xs = new Array( numPoints + 2 ), // label, data 
to date, final point
                                index = 0,
                                remainingNeeded = params.sharedContext.goal();
-                       xs[0] = 'x1';
+                       xs[ 0 ] = 'x1';
 
-                       self.needPerSecond =  new Array( numPoints + 2 );
-                       self.needPerSecond[0] = 'Needed Per Second';
+                       self.needPerSecond = new Array( numPoints + 2 );
+                       self.needPerSecond[ 0 ] = 'Needed Per Second';
 
                        // secondsByHourDonationData already has a label in [0]
                        self.gotPerSecond = 
params.sharedContext.secondsByHourDonationData.slice( 0, numPoints + 1 );
 
-                       for( var d = 1; d < params.sharedContext.dayObj.length; 
d++ ) {
+                       for ( var d = 1; d < 
params.sharedContext.dayObj.length; d++ ) {
                                for ( var h = 0; h < 24; h++ ) {
                                        index = ( d - 1 ) * 24 + h + 1;
                                        if ( index > numPoints + 1 ) {
                                                break;
                                        }
-                                       remainingNeeded = remainingNeeded - 
params.sharedContext.dayObj[d][h + 1].total;
+                                       remainingNeeded = remainingNeeded - 
params.sharedContext.dayObj[ d ][ h + 1 ].total;
                                        if ( remainingNeeded < 0 ) {
                                                remainingNeeded = 0;
                                        }
                                        var hoursLeft = ( 31 - d) * 24 + ( 24 - 
h );
-                                       xs[index] = index;
-                                       self.needPerSecond[index] = ( hoursLeft 
> 0 ) ?
+                                       xs[ index ] = index;
+                                       self.needPerSecond[ index ] = ( 
hoursLeft > 0 ) ?
                                                ( remainingNeeded / hoursLeft ) 
/ 3600
                                                : 0;
                                }
                        }
                        // extend last point to end of graph unless we're 
already there
                        if ( index >= numPoints ) {
-                               xs[numPoints + 1] = index;
+                               xs[ numPoints + 1 ] = index;
                                self.gotPerSecond[ numPoints + 1 ] = 
self.gotPerSecond[ numPoints ];
                                self.needPerSecond[ numPoints + 1 ] = 
self.needPerSecond[ numPoints ];
                        }
@@ -57,13 +56,13 @@
                        self.avgUSDperSecondChart( {
                                size: {
                                        height: 250,
-                                       width: window.width/2
+                                       width: window.width / 2
                                },
                                zoom: { enabled: true },
                                data: {
                                        xs: {
-                                               'Needed Per Second' : 'x1',
-                                               'Donations Per Second' : 'x1'
+                                               'Needed Per Second': 'x1',
+                                               'Donations Per Second': 'x1'
                                        },
                                        columns: [
                                                xs,
@@ -80,18 +79,22 @@
                                        x: {
                                                tick: {
                                                        count: 31,
-                                                       format: function(x){ 
return 'Day ' + ( Math.floor( x / 24 ) + 1 ); }
+                                                       format: function ( x ) {
+                                                               return 'Day ' + 
( Math.floor( x / 24 ) + 1 );
+                                                       }
                                                }
                                        },
                                        y: {
                                                tick: {
-                                                       format: function(x){ 
return numeral(x).format('$0,0.00'); }
+                                                       format: function ( x ) {
+                                                               return numeral( 
x ).format( '$0,0.00' );
+                                                       }
                                                }
                                        }
                                },
                                tooltip: {
                                        format: {
-                                               title: function(x) {
+                                               title: function ( x ) {
                                                        var day = Math.floor( x 
/ 24 ) + 1;
                                                        var hour = x % 24;
                                                        return 'Day ' + day + ' 
' + hour + ':00 &ndash; ' + hour + ':59 UTC';
@@ -105,4 +108,4 @@
 
        return { viewModel: AmtPerSecondChartViewModel, template: template };
 
-});
+} );
diff --git a/src/components/widgets/cat-trombone/cat-trombone.js 
b/src/components/widgets/cat-trombone/cat-trombone.js
index 3a1bf88..74b14e1 100644
--- a/src/components/widgets/cat-trombone/cat-trombone.js
+++ b/src/components/widgets/cat-trombone/cat-trombone.js
@@ -1,13 +1,11 @@
 define( [
-       'knockout',
        'text!components/widgets/cat-trombone/cat-trombone.html',
        'WidgetBase'
-], function( ko, template, WidgetBase ){
+], function( template, WidgetBase ) {
 
-       function CatTromboneViewModel( params ){
-
+       function CatTromboneViewModel( params ) {
                WidgetBase.call( this, params );
-
        }
+
        return { viewModel: CatTromboneViewModel, template: template };
-});
+} );
diff --git 
a/src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js 
b/src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
index 2077e30..5a37f83 100644
--- a/src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
+++ b/src/components/widgets/distance-to-goal-chart/distance-to-goal-chart.js
@@ -1,40 +1,39 @@
 define( [
        'knockout',
        
'text!components/widgets/distance-to-goal-chart/distance-to-goal-chart.html',
-       'c3',
        'numeraljs',
        'WidgetBase'
-], function( ko, template, c3, numeral, WidgetBase ){
+], function( ko, template, numeral, WidgetBase ) {
 
-       function DistanceToGoalChartViewModel( params ){
+       function DistanceToGoalChartViewModel( params ) {
 
                var self = this;
                WidgetBase.call( this, params );
                self.hasData = ko.observable( false );
                self.distanceToGoalChart = ko.observable( false );
 
-               self.makeCharts = function() {
+               self.makeCharts = function () {
                        if ( params.sharedContext.dailyDataArray.length < 2 ) {
                                return;
                        }
                        self.hasData( true );
 
                        self.updatedGoal = params.sharedContext.goal();
-                       self.neededArray = ['Needed'];
-                       for(var d = 1; d < 
params.sharedContext.dailyDataArray.length; d++) {
-                               self.updatedGoal = self.updatedGoal - 
params.sharedContext.dailyDataArray[d];
-                               self.neededArray[d] = self.updatedGoal >= 0 ? 
self.updatedGoal : 0;
+                       self.neededArray = [ 'Needed' ];
+                       for ( var d = 1; d < 
params.sharedContext.dailyDataArray.length; d++ ) {
+                               self.updatedGoal = self.updatedGoal - 
params.sharedContext.dailyDataArray[ d ];
+                               self.neededArray[ d ] = self.updatedGoal >= 0 ? 
self.updatedGoal : 0;
                        }
 
-                       self.distanceToGoalChart({
+                       self.distanceToGoalChart( {
                                size: {
                                        height: 250,
-                                       width: window.width/2
+                                       width: window.width / 2
                                },
                                data: {
                                        columns: [ self.neededArray ],
                                        type: 'area-spline',
-                                       colors: { Needed: 'rgb(217,83,79)'}
+                                       colors: { Needed: 'rgb(217,83,79)' }
                                },
                                grid: {
                                        x: {
@@ -47,7 +46,9 @@
                                axis: {
                                        x: {
                                                tick: {
-                                                       format: function(x){ 
return 'Day ' + (x+1); }
+                                                       format: function ( x ) {
+                                                               return 'Day ' + 
(x + 1);
+                                                       }
                                                }
                                        },
                                        y: {
@@ -56,13 +57,16 @@
                                                        position: 'outer-middle'
                                                },
                                                tick: {
-                                                       format: function(x){ 
return numeral(x).format( '$0.[00]a' ); }
+                                                       format: function ( x ) {
+                                                               return numeral( 
x ).format( '$0.[00]a' );
+                                                       }
                                                }
                                        }
                                }
-                       });
+                       } );
                };
                self.subscribe( params.sharedContext, 'totalsChanged', 
self.makeCharts );
        }
+
        return { viewModel: DistanceToGoalChartViewModel, template: template };
-});
+} );
diff --git a/src/components/widgets/donation-age/donation-age.js 
b/src/components/widgets/donation-age/donation-age.js
index 16206f3..e747ccc 100644
--- a/src/components/widgets/donation-age/donation-age.js
+++ b/src/components/widgets/donation-age/donation-age.js
@@ -1,36 +1,37 @@
-define([
+define( [
        'knockout',
+       'jquery',
        'text!components/widgets/donation-age/donation-age.html',
        'momentjs',
        'WidgetBase'
        ],
-function( ko, template, moment, WidgetBase ){
+function( ko, $, template, moment, WidgetBase ) {
 
-       function DonationAgeViewModel( params ){
+       function DonationAgeViewModel( params ) {
 
                WidgetBase.call( this, params );
 
                var self = this;
 
-               self.title = ko.observable(params.title);
-               self.queryStringSQL = ko.observable('This widget hasn\'t been 
set up yet!');
-               self.averageAgeCivi = ko.observable('...');
-               self.averageAgeInitial = ko.observable('...');
+               self.title = ko.observable( params.title );
+               self.queryStringSQL = ko.observable( 'This widget hasn\'t been 
set up yet!' );
+               self.averageAgeCivi = ko.observable( '...' );
+               self.averageAgeInitial = ko.observable( '...' );
 
                // Reload the data.  For the automatic reload, we're fine 
getting
                // something from the cache.
-               self.reloadData = function( automatic ){
-                       self.dataLoading(true);
+               self.reloadData = function ( automatic ) {
+                       self.dataLoading( true );
                        var url = '/data/donation-age';
                        if ( automatic !== true ) {
                                url += '?cache=false';
                        }
-                       $.get( url , function ( dataget ) {
-                               self.averageAgeCivi( moment.duration( 
dataget.results[0].age, 'seconds' ).humanize() );
-                               self.averageAgeInitial( moment.duration( 
dataget.results[1].age, 'seconds' ).humanize() );
+                       $.get( url, function ( dataget ) {
+                               self.averageAgeCivi( moment.duration( 
dataget.results[ 0 ].age, 'seconds' ).humanize() );
+                               self.averageAgeInitial( moment.duration( 
dataget.results[ 1 ].age, 'seconds' ).humanize() );
                                self.dataLoading( false );
                                self.queryStringSQL( dataget.sqlQuery );
-                       });
+                       } );
                        // Do it every 5 minutes as well
                        setTimeout( function () {
                                self.reloadData( true );
@@ -40,4 +41,4 @@
        }
 
        return { viewModel: DonationAgeViewModel, template: template };
-});
+} );
diff --git a/src/components/widgets/fraud-gauge/fraud-gauge.html 
b/src/components/widgets/fraud-gauge/fraud-gauge.html
index b283ba5..9f7736c 100644
--- a/src/components/widgets/fraud-gauge/fraud-gauge.html
+++ b/src/components/widgets/fraud-gauge/fraud-gauge.html
@@ -84,21 +84,6 @@
                                                                                
<!--Call Date Pickers Component to handle date range-->
                                                                                
<date-pickers params="selectedTimePeriod: selectedTimePeriod"></date-pickers>
                                                                                
<filters params="change: logStateChange, userChoices: userChoices, 
metadataRequest: metadataRequest, queryString: filterQueryString" />
-                                                                               
<!--div class="form-group filterPickerForm">
-                                                                               
        <label>Filter By:</label><br>
-                                                                               
        <p class="small text-warning" style="display: inline"><i class="fa 
fa-lightbulb-o"></i> by default, the result will be "all of the above."</p>
-                                                                               
        <ul class="filterPickerList nav nav-tabs" id="filterNav" role="tablist" 
data-bind="foreach: filters">
-                                                                               
                <li data-bind="visible: $data.values">
-                                                                               
                <input type="checkbox" data-bind="checkedValue: display, 
checked: $parent.selectedFilters, click: $parent.showSubfilters(display)"><span 
data-bind="text: display"></span>
-                                                                               
                <ul class="hide filterPickerList subfilterSubnav" 
data-bind="attr: {'id': display}, foreach: $data.values">
-                                                                               
                        <li>
-                                                                               
                        <input type="checkbox" class="filterChoices" 
data-bind="value: ($parentContext.$data.display + ' eq \'' + $data + '\''), 
checked: $parents[1].selectedSubFilters"><span data-bind="text: $data"></span>
-                                                                               
                        </li>
-                                                                               
                </ul>
-                                                                               
                </li>
-                                                                               
        </ul>
-                                                                               
</div-->
-
                                                                        </form>
                                                                </div>
                                                                <div 
class="modal-footer">
diff --git a/src/components/widgets/fraud-gauge/fraud-gauge.js 
b/src/components/widgets/fraud-gauge/fraud-gauge.js
index d2673aa..9a12c98 100644
--- a/src/components/widgets/fraud-gauge/fraud-gauge.js
+++ b/src/components/widgets/fraud-gauge/fraud-gauge.js
@@ -1,92 +1,87 @@
-define([
+define( [
        'knockout',
+       'jquery',
        'text!components/widgets/fraud-gauge/fraud-gauge.html',
-       'c3',
-       'select2',
        'chartjs',
        'WidgetBase'
        ],
-function( ko, template, c3, select2, Chart, WidgetBase ){
+function ( ko, $, template, Chart, WidgetBase ) {
 
        //extend the chart so we can flip the circle
-       Chart.types.Doughnut.extend({
-               addData: function(segment, atIndex, silent){
+       Chart.types.Doughnut.extend( {
+               addData: function ( segment, atIndex, silent ) {
                        var index = atIndex || this.segments.length;
-                       this.segments.splice(index, 0, new this.SegmentArc({
-                               value : segment.value,
-                               outerRadius : (this.options.animateScale) ? 0 : 
this.outerRadius,
-                               innerRadius : (this.options.animateScale) ? 0 : 
(this.outerRadius/100) * this.options.percentageInnerCutout,
-                               fillColor : segment.color,
-                               highlightColor : segment.highlight || 
segment.color,
-                               showStroke : this.options.segmentShowStroke,
-                               strokeWidth : this.options.segmentStrokeWidth,
-                               strokeColor : this.options.segmentStrokeColor,
-                               startAngle : Math.PI * 2.5,
-                               circumference : (this.options.animateRotate) ? 
0 : this.calculateCircumference(segment.value),
-                               label : segment.label
-                       }));
+                       this.segments.splice( index, 0, new this.SegmentArc( {
+                               value: segment.value,
+                               outerRadius: (this.options.animateScale) ? 0 : 
this.outerRadius,
+                               innerRadius: (this.options.animateScale) ? 0 :
+                                       (this.outerRadius / 100) * 
this.options.percentageInnerCutout,
+                               fillColor: segment.color,
+                               highlightColor: segment.highlight || 
segment.color,
+                               showStroke: this.options.segmentShowStroke,
+                               strokeWidth: this.options.segmentStrokeWidth,
+                               strokeColor: this.options.segmentStrokeColor,
+                               startAngle: Math.PI * 2.5,
+                               circumference: (this.options.animateRotate) ? 0 
: this.calculateCircumference( segment.value ),
+                               label: segment.label
+                       } ) );
 
-                       if (!silent){
+                       if ( !silent ) {
                                this.reflow();
                                this.update();
                        }
                }
-       });
+       } );
 
-       function FraudGaugeViewModel( params ){
+       function FraudGaugeViewModel( params ) {
 
                WidgetBase.call( this, params );
 
-               var self                = this,
-                       wasSaved        = self.chartSaved();
+               var self = this,
+                       wasSaved = self.chartSaved();
 
-               self.queryString                        = '';
-               self.columnSize                         = 
ko.observable('col-lg-' + ( self.config.width || 6 ) + ' fraudGauge');
-               self.selectedTimePeriod         = ko.observable( 
self.config.timeBreakout || 'Last 15 Minutes');
-               self.queryRequest                       = [];
-               self.gaugeValue                         = ko.observable(0);
-               self.queryStringSQL             = ko.observable('This widget 
hasn\'t been set up yet!');
-               self.greenHighRange             = ko.observable( 
self.config.greenHighRange || 17 );
-               self.redLowRange                        = ko.observable( 
self.config.redLowRange || 68 );
-               self.configSet                          = 
ko.observable(Object.keys(self.config).length > 0);
-               self.gauge                                      = 
ko.observable(false);
-               self.showFilterText                     = ko.computed( 
function() {
-                       return !( $.isEmptyObject( self.userChoices() ) );
-               } );
+               self.queryString = '';
+               self.columnSize = ko.observable( 'col-lg-' + ( 
self.config.width || 6 ) + ' fraudGauge' );
+               self.selectedTimePeriod = ko.observable( 
self.config.timeBreakout || 'Last 15 Minutes' );
+               self.gaugeValue = ko.observable( 0 );
+               self.greenHighRange = ko.observable( self.config.greenHighRange 
|| 17 );
+               self.redLowRange = ko.observable( self.config.redLowRange || 68 
);
+               self.configSet = ko.observable( Object.keys( self.config 
).length > 0 );
+               self.gauge = ko.observable( false );
 
-               self.renderPercentRangeChart = function(){
+               self.renderPercentRangeChart = function () {
 
-                       var canvas              = $('#fraudPercentRanges')[0],
-                               ctx             = canvas.getContext('2d');
+                       var canvas = $( '#fraudPercentRanges' )[ 0 ],
+                               ctx = canvas.getContext( '2d' );
 
-                       var placeholder                 = 
document.createElement('canvas');
-                       placeholder.width               = 200;
-                       placeholder.height              = placeholder.width;
-                       var placeholderctx              = 
placeholder.getContext('2d');
+                       var placeholder = document.createElement( 'canvas' );
+                       placeholder.width = 200;
+                       placeholder.height = placeholder.width;
+                       var placeholderctx = placeholder.getContext( '2d' );
 
-                       var ddata = [{
+                       var ddata = [ {
                                value: 90,
                                color: '#000000'
-                       },{
+                       }, {
                                value: 1.8 * (self.greenHighRange()),
                                color: '#4cae4c'
-                       },{
+                       }, {
                                value: 1.8 * (self.redLowRange() - 
self.greenHighRange()),
                                color: '#eea236'
                        }, {
                                value: 1.8 * (100 - self.redLowRange()),
                                color: '#c9302c'
-                       },{
+                       }, {
                                value: 90,
                                color: '#000000'
-                       }];
+                       } ];
 
                        self.gaugeChart = new Chart( placeholderctx ).Doughnut( 
ddata, {
                                animation: false,
                                segmentShowStroke: false,
-                               onAnimationComplete: function() {
-                                       var cropHeight = 
Math.round(placeholder.height/2);
-                                       
ctx.clearRect(0,0,canvas.width,canvas.height);
+                               onAnimationComplete: function () {
+                                       var cropHeight = Math.round( 
placeholder.height / 2 );
+                                       ctx.clearRect( 0, 0, canvas.width, 
canvas.height );
                                        ctx.drawImage(
                                                placeholder,
                                                0,
@@ -99,18 +94,18 @@
                                                cropHeight
                                        );
                                }
-                       });
+                       } );
                };
 
-               self.makeChart = function(){
-                       self.gauge({
+               self.makeChart = function () {
+                       self.gauge( {
                                size: {
                                        height: 300,
                                        width: 390
                                },
                                data: {
                                        columns: [
-                                               ['failure', self.gaugeValue()]
+                                               [ 'failure', self.gaugeValue() ]
                                        ],
                                        type: 'gauge'
                                },
@@ -120,22 +115,22 @@
                                        units: 'failure rate'
                                },
                                color: {
-                                       pattern: ['#FF0000', '#F97600', 
'#F6C600', '#60B044'], // the three color levels for the percentage values.
+                                       pattern: [ '#FF0000', '#F97600', 
'#F6C600', '#60B044' ], // the three color levels for the percentage values.
                                        threshold: {
-                                               values: [ 0, 
self.greenHighRange(), self.redLowRange(), 100]
+                                               values: [ 0, 
self.greenHighRange(), self.redLowRange(), 100 ]
                                        }
                                }
-                       });
+                       } );
                };
 
-               self.validateSubmission = function( times ){
+               self.validateSubmission = function ( times ) {
                        var validation = {
                                validated: '',
                                errors: []
                        };
 
-                       if( !times ){
-                               validation.errors.push('You must submit a valid 
time.');
+                       if ( !times ) {
+                               validation.errors.push( 'You must submit a 
valid time.' );
                                validation.validated = false;
                        } else {
                                validation.validated = true;
@@ -144,41 +139,41 @@
                        return validation;
                };
 
-               self.createQueryString = function(){
-                       var qs                  = self.filterQueryString(),
-                               ds              = '',
-                               timePresets             = [ 'Last 15 Minutes',
-                                                                       'Last 
Hour',
-                                                                       'Last 
24 Hours',
-                                                                       'Last 5 
Minutes'];
+               self.createQueryString = function () {
+                       var qs = self.filterQueryString(),
+                               ds = '',
+                               timePresets = [ 'Last 15 Minutes',
+                                       'Last Hour',
+                                       'Last 24 Hours',
+                                       'Last 5 Minutes' ];
 
                        var currentDate = new Date();
-                       switch( self.selectedTimePeriod() ){
-                               case timePresets[0]:
-                                       var lfm = new 
Date(currentDate.getTime() - (15 * 60 * 1000));
+                       switch ( self.selectedTimePeriod() ) {
+                               case timePresets[ 0 ]:
+                                       var lfm = new Date( 
currentDate.getTime() - (15 * 60 * 1000) );
                                        ds += 'DT gt \'' + lfm.toISOString() + 
'\'';
                                        break;
-                               case timePresets[1]:
-                                       var lh = new Date(currentDate.getTime() 
- (60 * 60 * 1000));
+                               case timePresets[ 1 ]:
+                                       var lh = new Date( 
currentDate.getTime() - (60 * 60 * 1000) );
                                        ds += 'DT gt \'' + lh.toISOString() + 
'\'';
                                        break;
-                               case timePresets[2]:
-                                       var ltfh = new 
Date(currentDate.getTime() - (24 * 60 * 60 * 1000));
+                               case timePresets[ 2 ]:
+                                       var ltfh = new Date( 
currentDate.getTime() - (24 * 60 * 60 * 1000) );
                                        ds += 'DT gt \'' + ltfh.toISOString() + 
'\'';
                                        break;
-                               case timePresets[3]:
-                                       var lfvm = new 
Date(currentDate.getTime() - (5 * 60 * 1000));
+                               case timePresets[ 3 ]:
+                                       var lfvm = new Date( 
currentDate.getTime() - (5 * 60 * 1000) );
                                        ds += 'DT gt \'' + lfvm.toISOString() + 
'\'';
                                        break;
                                default:
-                                       var lfm2 = new 
Date(currentDate.getTime() - (15 * 60 * 1000));
+                                       var lfm2 = new Date( 
currentDate.getTime() - (15 * 60 * 1000) );
                                        ds += 'DT gt \'' + lfm2.toISOString() + 
'\'';
                                        break;
 
                        }
 
                        var postQS = '';
-                       if(qs.length > 0){
+                       if ( qs.length > 0 ) {
                                postQS = qs + ' and ' + ds;
                        } else {
                                postQS = '$filter=' + ds;
@@ -187,27 +182,30 @@
                        return postQS;
                };
 
-               self.resetGaugeSettings = function(){
-                       self.greenHighRange(33);
-                       self.redLowRange(66);
+               self.resetGaugeSettings = function () {
+                       self.greenHighRange( 33 );
+                       self.redLowRange( 66 );
                        self.renderPercentRangeChart();
 
-                       $('#timePeriodDropdown option:eq(0)').prop('selected', 
true);
+                       $( '#timePeriodDropdown option:eq(0)' ).prop( 
'selected', true );
                };
 
-               self.submitGaugeModifications = function(btn){
+               self.submitGaugeModifications = function ( btn ) {
 
-                       if(btn){self.logStateChange(true);}
+                       if ( btn ) {
+                               self.logStateChange( true );
+                       }
 
                        var validation = self.validateSubmission( 
self.selectedTimePeriod() );
-                       if( !validation.validated ){
+                       if ( !validation.validated ) {
 
-                               $('#fraudSubmissionErrors').html('<p 
class="text-danger">you have errors in your submission:</p><ul></ul>' 
).addClass('show');
-                               $.each( validation.errors, function(el, i){
-                                       $('#fraudSubmissionErrors 
ul').append('<li>' + i + '</li>');
-                               });
+                               $( '#fraudSubmissionErrors' ).html(
+                                       '<p class="text-danger">you have errors 
in your submission:</p><ul></ul>' ).addClass( 'show' );
+                               $.each( validation.errors, function ( el, i ) {
+                                       $( '#fraudSubmissionErrors ul' 
).append( '<li>' + i + '</li>' );
+                               } );
 
-                       } else{
+                       } else {
                                self.configSet( true );
 
                                self.queryString = self.createQueryString();
@@ -223,31 +221,31 @@
                                        userChoices: self.userChoices()
                                };
 
-                               var chartDataCall = self.getChartData( 
self.queryString );
-                               $.when( chartDataCall ).then( function( dataget 
){
-                                       self.gaugeValue( parseFloat( 
dataget.results[0].fraud_percent ).toFixed( 2 ) );
-                                       self.queryStringSQL( dataget.sqlQuery );
-                                       self.makeChart();
-                               });
+                               self.getChartData( self.queryString )
+                                       .then( function ( dataget ) {
+                                               self.gaugeValue( parseFloat( 
dataget.results[ 0 ].fraud_percent ).toFixed( 2 ) );
+                                               self.queryStringSQL( 
dataget.sqlQuery );
+                                               self.makeChart();
+                                       } );
                        }
                };
 
-               self.metadataRequest.then( function() {
+               self.metadataRequest.then( function () {
                        self.preDataLoading( false );
 
                        if ( wasSaved ) {
                                // restore choices and show the chart
-                               if(self.config !== 'NULL') {
+                               if ( self.config !== 'NULL' ) {
                                        self.selectedTimePeriod( 
self.config.timeBreakout );
                                        self.userChoices( 
self.config.userChoices );
                                }
                                self.chartSaved( true );
                                self.submitGaugeModifications();
                        }
-               });
+               } );
 
                return this;
        }
 
        return { viewModel: FraudGaugeViewModel, template: template };
-});
+} );
diff --git a/src/components/widgets/x-by-y/x-by-y.html 
b/src/components/widgets/x-by-y/x-by-y.html
index 3dd9d5a..70bfc82 100644
--- a/src/components/widgets/x-by-y/x-by-y.html
+++ b/src/components/widgets/x-by-y/x-by-y.html
@@ -92,13 +92,6 @@
                                                        </div>
                                                        <div data-bind="{ c3: 
xByYChart, attr: { width: chartWidth, height: chartHeight } }"></div>
                                                </div>
-
-                                               <!-- <div class="col-md-2 
pull-right">
-                                                       <button 
class="btn-info"><i class="fa fa-bar-chart"></i></button>
-                                                       <button 
class="btn-info"><i class="fa fa-line-chart"></i></button>
-                                                       <button 
class="btn-info"><i class="fa fa-pie-chart"></i></button>
-                                                       <button 
class="btn-info"><i class="fa fa-table"></i></button>
-                                               </div> -->
                                        </div>
                                </div>
 
diff --git a/src/components/widgets/x-by-y/x-by-y.js 
b/src/components/widgets/x-by-y/x-by-y.js
index 2d076bd..89b8d74 100644
--- a/src/components/widgets/x-by-y/x-by-y.js
+++ b/src/components/widgets/x-by-y/x-by-y.js
@@ -1,54 +1,53 @@
 define( [
        'knockout',
+       'jquery',
        'text!components/widgets/x-by-y/x-by-y.html',
        'momentjs',
        'numeraljs',
-       'c3',
-       'select2',
        'WidgetBase'
-], function( ko, template, moment, numeral, c3, select2, WidgetBase ){
+], function( ko, $, template, moment, numeral, WidgetBase ) {
 
-       function XByYChartViewModel( params ){
+       function XByYChartViewModel( params ) {
 
                WidgetBase.call( this, params );
-               var self      = this,
-                       wasSaved  = self.chartSaved(); //populateChoices() may 
overwrite
+               var self = this,
+                       wasSaved = self.chartSaved(); //populateChoices() may 
overwrite
 
-               self.showSlice                = ko.observable();
-               self.bySlice                  = ko.observable();
-               self.timeChoice               = ko.observable();
-               self.displayedTimeChoice      = ko.observable('');
-               self.queryRequest             = {};
-               self.queryString              = '';
-               self.chosenFilters            = ko.observableArray(); // FIXME: 
remove, maybe adapt display to use filterText
-               self.xByYChart                            = ko.observable( 
false );
-               self.chartWidth(950);
+               self.showSlice = ko.observable();
+               self.bySlice = ko.observable();
+               self.timeChoice = ko.observable();
+               self.displayedTimeChoice = ko.observable( '' );
+               self.queryRequest = {};
+               self.queryString = '';
+               self.chosenFilters = ko.observableArray(); // FIXME: remove, 
maybe adapt display to use filterText
+               self.xByYChart = ko.observable( false );
+               self.chartWidth( 950 );
 
-               self.title = ko.computed( function(){
-                       if( self.displayedTimeChoice()==='Year' ){
+               self.title = ko.computed( function () {
+                       if ( self.displayedTimeChoice() === 'Year' ) {
                                return self.showSlice() + ' Over All Time';
                        } else {
                                return self.showSlice() + ' by ' + 
self.displayedTimeChoice();
                        }
-               });
+               } );
 
-               self.subtitle = ko.computed( function(){
+               self.subtitle = ko.computed( function () {
                        var from = '';
-                       switch(self.displayedTimeChoice()){
+                       switch ( self.displayedTimeChoice() ) {
                                case 'Year':
                                        return;
                                case 'Month':
-                                       from = moment().subtract(1, 
'year').format('MMMM Do, YYYY');
+                                       from = moment().subtract( 1, 'year' 
).format( 'MMMM Do, YYYY' );
                                        break;
                                case 'Day':
-                                       from = moment().subtract(1, 
'month').format('MMMM Do, YYYY');
+                                       from = moment().subtract( 1, 'month' 
).format( 'MMMM Do, YYYY' );
                                        break;
                        }
 
-                       return from + ' to ' + moment().format('MMMM Do, YYYY');
-               });
+                       return from + ' to ' + moment().format( 'MMMM Do, YYYY' 
);
+               } );
 
-               self.makeChart = function(data){
+               self.makeChart = function ( data ) {
                        var colors = {},
                                axes = {},
                                settings,
@@ -79,12 +78,12 @@
                                        },
                                        y: {
                                                tick: {
-                                                       format: function(x){ 
return numeral(x).format('$0,0'); }
+                                                       format: function ( x ) 
{ return numeral( x ).format( '$0,0' ); }
                                                }
                                        },
                                        y2: {
                                                tick: {
-                                                       format: function(x){ 
return numeral(x).format('0,0'); }
+                                                       format: function ( x ) 
{ return numeral( x ).format( '0,0' ); }
                                                },
                                                show: true
                                        }
@@ -97,18 +96,18 @@
                        };
 
                        if ( isGrouped ) {
-                               columns = [data.xs];
+                               columns = [ data.xs ];
                                numValues = data.groupValues.length;
-                               $.each( data.groupValues, function( index, 
groupVal ) {
+                               $.each( data.groupValues, function ( index, 
groupVal ) {
                                        var hue = index * 360 / numValues,
-                                               totalColumnName = 
data.totals[groupVal][0],
-                                               countColumnName = 
data.counts[groupVal][0];
-                                       columns[index + 1] = 
data.totals[groupVal];
-                                       columns[index + 1 + numValues] = 
data.counts[groupVal];
-                                       axes[totalColumnName] = 'y';
-                                       axes[countColumnName] = 'y2';
-                                       colors[totalColumnName] = 'hsl(' + hue 
+ ',100%,50%)';
-                                       colors[countColumnName] = 'hsl(' + hue 
+ ',100%,65%)';
+                                               totalColumnName = data.totals[ 
groupVal ][ 0 ],
+                                               countColumnName = data.counts[ 
groupVal ][ 0 ];
+                                       columns[ index + 1 ] = data.totals[ 
groupVal ];
+                                       columns[ index + 1 + numValues ] = 
data.counts[ groupVal ];
+                                       axes[ totalColumnName ] = 'y';
+                                       axes[ countColumnName ] = 'y2';
+                                       colors[ totalColumnName ] = 'hsl(' + 
hue + ',100%,50%)';
+                                       colors[ countColumnName ] = 'hsl(' + 
hue + ',100%,65%)';
                                } );
                                settings.data = {
                                        columns: columns,
@@ -119,10 +118,10 @@
                                        colors: colors
                                };
                        } else {
-                               colors[data.totals[0]] = 'rgb(92,184,92)';
-                               colors[data.counts[0]] = '#f0ad4e';
-                               axes[data.totals[0]] = 'y';
-                               axes[data.counts[0]] = 'y2';
+                               colors[ data.totals[ 0 ] ] = 'rgb(92,184,92)';
+                               colors[ data.counts[ 0 ] ] = '#f0ad4e';
+                               axes[ data.totals[ 0 ] ] = 'y';
+                               axes[ data.counts[ 0 ] ] = 'y2';
 
                                settings.data = {
                                        columns: [ data.xs, data.totals, 
data.counts ],
@@ -137,86 +136,87 @@
                        self.xByYChart( false );
 
                        self.xByYChart( settings );
-                       self.chartLoaded(true);
+                       self.chartLoaded( true );
                };
 
-               self.showPanelBody = function(area){
-                       $('#'+area+'body').toggleClass('hide');
+               self.showPanelBody = function ( area ) {
+                       $( '#' + area + 'body' ).toggleClass( 'hide' );
                };
 
                //saved charts
                //TODO: these will trigger a saved set of parameters to draw 
the chart with.
-               self.presetTitles = ko.observableArray([
+               self.presetTitles = ko.observableArray( [
                        'This does not work yet.',
                        'Donations During Big English 2015',
                        'Donations for Fiscal Year 2015'
-               ]);
-               ///////
+               ] );
 
-               self.ySlices = ko.observableArray([
+               self.ySlices = ko.observableArray( [
                        'Donations'
                        //'Failed Donations'
-               ]);
+               ] );
 
                self.xSlices = ko.observableArray();
                self.timeChoices = ko.observableArray();
                self.groupChoices = ko.observableArray();
 
                //populate user choices dynamically
-               self.populateChoices = function(){
+               self.populateChoices = function () {
                        //populate y slices
-                       return self.metadataRequest.then( function( reqData ) {
+                       return self.metadataRequest.then( function ( reqData ) {
                                self.metadata = reqData;
 
                                var xArray = [],
-                                       timeArray = ['Year', 'Month', 'Day', 
'Hour'],
+                                       timeArray = [ 'Year', 'Month', 'Day', 
'Hour' ],
                                        groupArray = [];
 
-                               $.each(self.metadata.filters, function(prop, 
obj){
-                                       if(obj.type !== 'number' || prop === 
'Amount'){
-                                               if(obj.canGroup){
+                               $.each( self.metadata.filters, function ( prop, 
obj ) {
+                                       if ( obj.type !== 'number' || prop === 
'Amount' ) {
+                                               if ( obj.canGroup ) {
                                                        xArray.push( { text: 
obj.display, value: prop } );
                                                }
                                        }
-                               });
-                               self.xSlices(xArray);
-                               self.timeChoices(timeArray);
-                               self.groupChoices(groupArray);
-                       });
+                               } );
+                               self.xSlices( xArray );
+                               self.timeChoices( timeArray );
+                               self.groupChoices( groupArray );
+                       } );
 
                };
 
-               self.submitXY = function(){
+               self.submitXY = function () {
 
                        self.queryRequest.ySlice = self.showSlice();
                        self.queryRequest.xSlice = self.bySlice();
                        //self.queryRequest.additionalFilters = 
self.chosenFilters();
                        self.queryRequest.timeBreakout = self.timeChoice();
 
-                       self.queryString                 = 
self.convertToQuery(self.queryRequest);
-                       self.config.showSlice    = self.showSlice();
-                       self.config.bySlice              = self.bySlice();
-                       self.config.queryString  = self.queryString;
+                       self.queryString = self.convertToQuery( 
self.queryRequest );
+                       self.config.showSlice = self.showSlice();
+                       self.config.bySlice = self.bySlice();
+                       self.config.queryString = self.queryString;
                        self.config.timeBreakout = 
self.queryRequest.timeBreakout;
-                       self.config.chartData    = self.chartData;
+                       self.config.chartData = self.chartData;
 
-                       var chartDataCall = self.getChartData(self.queryString);
+                       var chartDataCall = self.getChartData( self.queryString 
);
 
-                       $.when( chartDataCall ).then( function( dataArray ){
-                               self.displayedTimeChoice(self.timeChoice());
-                               self.retrievedResults(dataArray.results);
+                       $.when( chartDataCall ).then( function ( dataArray ) {
+                               self.displayedTimeChoice( self.timeChoice() );
+                               self.retrievedResults( dataArray.results );
 
-                               self.chartData = self.processData( 
self.retrievedResults(), self.timeChoice(), self.bySlice(), dataArray.timestamp 
);
+                               self.chartData = self.processData( 
self.retrievedResults(),
+                                       self.timeChoice(),
+                                       self.bySlice(),
+                                       dataArray.timestamp );
 
-                               self.makeChart(self.chartData);
+                               self.makeChart( self.chartData );
 
-                       });
-
+                       } );
 
                };
 
-               self.populateChoices().then(function() {
-                       self.preDataLoading(false);
+               self.populateChoices().then( function () {
+                       self.preDataLoading( false );
                        if ( wasSaved ) {
                                // restore choices and show the chart
                                self.bySlice( self.config.bySlice );
@@ -225,7 +225,7 @@
                                self.chartSaved( true );
                                self.submitXY();
                        }
-               });
+               } );
 
                return this;
 
@@ -233,4 +233,4 @@
 
        return { viewModel: XByYChartViewModel, template: template };
 
-});
+} );

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

Gerrit-MessageType: merged
Gerrit-Change-Id: I10cf89c8980345f667e64ae4a6d3991021bcffcd
Gerrit-PatchSet: 7
Gerrit-Project: wikimedia/fundraising/dash
Gerrit-Branch: master
Gerrit-Owner: Ejegg <[email protected]>
Gerrit-Reviewer: Cdentinger <[email protected]>
Gerrit-Reviewer: Ejegg <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

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

Reply via email to