[tor-commits] [globe/master] Fix JavaScript styling issues and add some consistency

isis at torproject.org isis at torproject.org
Mon Aug 17 01:28:02 UTC 2015


commit 1c81a61715b0fc7a2dbe3116fbba919e2a956c61
Author: Chaoyi Zha <summermontreal at gmail.com>
Date:   Sun Aug 16 02:15:39 2015 -0400

    Fix JavaScript styling issues and add some consistency
    
    Signed-off-by: Isis Lovecruft <isis at torproject.org>
---
 src/js/application/app.js                      |   50 ++++++++++++------------
 src/js/components/AlertBoxComponent.js         |    2 +-
 src/js/components/BandwidthStatsComponent.js   |    8 ++--
 src/js/components/LoadingIndicatorComponent.js |    2 +-
 src/js/controllers/ApplicationController.js    |   24 ++++++------
 src/js/controllers/Top10Controller.js          |    2 +-
 src/js/helpers/dataTablesRenderer.js           |    8 ++--
 src/js/helpers/formatter.js                    |   28 ++++++-------
 src/js/helpers/handlebarsHelper.js             |   38 +++++++++---------
 src/js/helpers/util.js                         |   48 +++++++++++------------
 src/js/mixins/ContentReadyTriggerableMixin.js  |    2 +-
 src/js/mixins/PeriodsMixin.js                  |   16 ++++----
 src/js/models/OnionooBandwidthHistory.js       |    8 ++--
 src/js/models/OnionooClientsHistory.js         |    8 ++--
 src/js/models/OnionooDetail.js                 |   50 ++++++++++++------------
 src/js/models/OnionooUptimeHistory.js          |    8 ++--
 src/js/models/OnionooWeightsHistory.js         |    6 +--
 src/js/models/TemporaryStore.js                |   10 ++---
 src/js/routes/BridgeDetailRoute.js             |    8 ++--
 src/js/routes/RelayDetailRoute.js              |   12 +++---
 src/js/routes/StaticRoutes.js                  |    6 +--
 src/js/routes/SummarySearchRoute.js            |   18 ++++-----
 src/js/routes/Top10Route.js                    |    6 +--
 src/js/views/DetailViews.js                    |    8 ++--
 src/js/views/HistoryGraphView.js               |   40 +++++++++----------
 src/js/views/SummariesView.js                  |   36 ++++++++---------
 26 files changed, 226 insertions(+), 226 deletions(-)

diff --git a/src/js/application/app.js b/src/js/application/app.js
index 6fa6ce2..8ec4aa5 100644
--- a/src/js/application/app.js
+++ b/src/js/application/app.js
@@ -5,7 +5,7 @@
 var GLOBE = Ember.Application.create();
 
 // @if NODE_ENV == 'TESTING'
-if($.isFunction(window.prepareForTesting)){
+if ($.isFunction(window.prepareForTesting)) {
     prepareForTesting(GLOBE);
 }
 // @endif
@@ -37,14 +37,14 @@ GLOBE = GLOBE.reopen({
     }),
 
     // Event that observes GLOBE.title and changes the document title
-    titleChanged: function(){
+    titleChanged: function() {
 
         var title = this.get('title');
         var suffix = GLOBE.static.titleSuffix + ' ' + GLOBE.static.version;
 
-        if(title.length){
+        if (title.length) {
             $(document).attr('title', title + ' | ' + suffix);
-        }else{
+        } else {
             $(document).attr('title', suffix);
         }
 
@@ -57,8 +57,8 @@ GLOBE = GLOBE.reopen({
      * @param {String} msg Alert message
      * @return {void}
      */
-    setAlert: function(location, type, msg){
-        if(this.get('alert').hasOwnProperty(location)){
+    setAlert: function(location, type, msg) {
+        if (this.get('alert').hasOwnProperty(location)) {
             this.set('alert.' + location, Em.Object.create({
                 type: type,
                 msg: msg
@@ -70,8 +70,8 @@ GLOBE = GLOBE.reopen({
      * @param {String} location Alert storage location
      * @return {void}
      */
-    clearAlert: function(location){
-        if(this.get('alert').hasOwnProperty(location)){
+    clearAlert: function(location) {
+        if (this.get('alert').hasOwnProperty(location)) {
             this.set('alert.' + location, null);
         }
     }
@@ -80,7 +80,7 @@ GLOBE = GLOBE.reopen({
 GLOBE.static = {
     browser: {
         // check if the current browser is firefox
-        isFirefox: function(){
+        isFirefox: function() {
             // @see http://stackoverflow.com/a/9851769
             return typeof InstallTrigger !== 'undefined';
         }
@@ -444,8 +444,8 @@ GLOBE.static.messages.specifyYourSearch = 'To avoid too many requests, we limit
 
 
 // fill flag array
-for(var icon in GLOBE.static.icons){
-    if(GLOBE.static.icons.hasOwnProperty(icon)){
+for (var icon in GLOBE.static.icons) {
+    if (GLOBE.static.icons.hasOwnProperty(icon)) {
         GLOBE.static.iconsArray.push({
             key: icon,
             value: GLOBE.static.icons[icon]
@@ -454,8 +454,8 @@ for(var icon in GLOBE.static.icons){
 }
 
 // fill countries array
-for(var country in GLOBE.static.countries){
-    if(GLOBE.static.countries.hasOwnProperty(country)){
+for (var country in GLOBE.static.countries) {
+    if (GLOBE.static.countries.hasOwnProperty(country)) {
         GLOBE.static.countriesArray.push({
             key: country,
             value: GLOBE.static.countries[country]
@@ -463,7 +463,7 @@ for(var country in GLOBE.static.countries){
     }
 }
 // sort by country names
-GLOBE.static.countriesArray.sort(function(a, b){
+GLOBE.static.countriesArray.sort(function(a, b) {
     // is a less than b ? -1 else if a greater than b ? 1 otherwise 0 (a==b)
     return a.value < b.value ? -1 : a.value > b.value ? 1 : 0;
 });
@@ -486,15 +486,15 @@ jQuery.fn.dataTableExt.oSort['port-desc']  = function(x,y) {
     x = GLOBE.Formatter.extractPort(x);
     y = GLOBE.Formatter.extractPort(y);
 
-    if(x === GLOBE.static.messages.dataEmpty &&
-        y !== GLOBE.static.messages.dataEmpty){
+    if (x === GLOBE.static.messages.dataEmpty &&
+        y !== GLOBE.static.messages.dataEmpty) {
         return -1;
     }
-    if(y === GLOBE.static.messages.dataEmpty &&
-        x !== GLOBE.static.messages.dataEmpty){
+    if (y === GLOBE.static.messages.dataEmpty &&
+        x !== GLOBE.static.messages.dataEmpty) {
         return 1;
     }
-    if(x === y){
+    if (x === y) {
         return 0;
     }
 
@@ -510,15 +510,15 @@ jQuery.fn.dataTableExt.oSort['port-asc']  = function(x,y) {
     x = GLOBE.Formatter.extractPort(x);
     y = GLOBE.Formatter.extractPort(y);
 
-    if(x === GLOBE.static.messages.dataEmpty &&
-        y !== GLOBE.static.messages.dataEmpty){
+    if (x === GLOBE.static.messages.dataEmpty &&
+        y !== GLOBE.static.messages.dataEmpty) {
         return 1;
     }
-    if(y === GLOBE.static.messages.dataEmpty &&
-        x !== GLOBE.static.messages.dataEmpty){
+    if (y === GLOBE.static.messages.dataEmpty &&
+        x !== GLOBE.static.messages.dataEmpty) {
         return -1;
     }
-    if(x === y){
+    if (x === y) {
         return 0;
     }
 
@@ -530,4 +530,4 @@ jQuery.fn.dataTableExt.oSort['port-asc']  = function(x,y) {
 
 GLOBE.TextField = Em.TextField.extend({
     attributeBindings: ['accept', 'autocomplete', 'autofocus', 'name', 'required']
-});
\ No newline at end of file
+});
diff --git a/src/js/components/AlertBoxComponent.js b/src/js/components/AlertBoxComponent.js
index 69cc99b..e6a70fd 100644
--- a/src/js/components/AlertBoxComponent.js
+++ b/src/js/components/AlertBoxComponent.js
@@ -5,7 +5,7 @@ GLOBE.AlertBoxComponent = Em.Component.extend({
 
     classNameBindings: ['baseClass', 'type'],
 
-    isVisible: function(){
+    isVisible: function() {
         var type = this.get('type'),
             msg = this.get('msg');
 
diff --git a/src/js/components/BandwidthStatsComponent.js b/src/js/components/BandwidthStatsComponent.js
index a3aa732..8f2d558 100644
--- a/src/js/components/BandwidthStatsComponent.js
+++ b/src/js/components/BandwidthStatsComponent.js
@@ -1,20 +1,20 @@
 /*global GLOBE, Em */
 GLOBE.GraphStatsComponent = Em.Component.extend({
     classNames: ['graph-stats'],
-    getAvgs: function(fields){
+    getAvgs: function(fields) {
         var avgHistory = {},
             data = this.get('data'),
             period = this.get('period');
 
-        fields.forEach(function(field){
-            if (data && data[field] && data[field][period]){
+        fields.forEach(function(field) {
+            if (data && data[field] && data[field][period]) {
                 avgHistory[field + 'Avg'] = data[field][period].avg;
             }
         });
 
         return avgHistory;
     },
-    avgShouldChange: function(){
+    avgShouldChange: function() {
         this.setProperties(this.getAvgs(this.get('avgFields')));
     }.observes('period', 'timePeriods')
 });
diff --git a/src/js/components/LoadingIndicatorComponent.js b/src/js/components/LoadingIndicatorComponent.js
index 0ef7746..f3bdd8f 100644
--- a/src/js/components/LoadingIndicatorComponent.js
+++ b/src/js/components/LoadingIndicatorComponent.js
@@ -1,6 +1,6 @@
 /*global GLOBE, Em */
 GLOBE.LoadingIndicatorComponent = Em.Component.extend({
-    isDataLoaded: function(){
+    isDataLoaded: function() {
 
         // change isDataLoaded depending on GLOBE.loading number
         return (GLOBE.get('loading') <= 0);
diff --git a/src/js/controllers/ApplicationController.js b/src/js/controllers/ApplicationController.js
index 202d117..45d570b 100644
--- a/src/js/controllers/ApplicationController.js
+++ b/src/js/controllers/ApplicationController.js
@@ -43,54 +43,54 @@ GLOBE.ApplicationController = Em.Controller.extend({
         flag: null
     },
 
-    init: function(){
+    init: function() {
         this.set('title', '');
     },
 
-    titleChanged: function(){
+    titleChanged: function() {
         var title = this.get('title');
         var suffix = GLOBE.static.titleSuffix + ' ' + GLOBE.static.version;
 
-        if(title.length){
+        if (title.length) {
             $(document).attr('title', title + ' | ' + suffix);
-        }else{
+        } else {
             $(document).attr('title', suffix);
         }
     }.observes('title'),
 
     actions: {
-        toggleAdvancedSearch: function(){
+        toggleAdvancedSearch: function() {
             this.toggleProperty('advancedSearch');
         },
 
         /**
          * action that prepares a payload and transitions to the search route
          */
-        search: function(){
+        search: function() {
             var value = this.get('value');
             var advanced = this.get('advancedSearch');
             var advancedOptions = this.get('advancedSearchOptions');
 
-            if(advanced){
+            if (advanced) {
                 // serialize form
                 var serialized = $('.advanced-search-form').serializeArray();
 
                 // reset
-                for(var option in advancedOptions){
-                    if(advancedOptions.hasOwnProperty(option)){
+                for (var option in advancedOptions) {
+                    if (advancedOptions.hasOwnProperty(option)) {
                         delete advancedOptions[option];
                     }
                 }
 
-                for(var fieldIndex = 0, maxIndex = serialized.length; fieldIndex < maxIndex; fieldIndex++){
+                for (var fieldIndex = 0, maxIndex = serialized.length; fieldIndex < maxIndex; fieldIndex++) {
                     var field = serialized[fieldIndex];
-                    if(field.value && field.value.length){
+                    if (field.value && field.value.length) {
                         advancedOptions[field.name] = field.value;
                     }
                 }
 
                 this.set('advancedSearchOptions', advancedOptions);
-            }else{
+            } else {
                 advancedOptions = {};
             }
 
diff --git a/src/js/controllers/Top10Controller.js b/src/js/controllers/Top10Controller.js
index 8181248..8148b71 100644
--- a/src/js/controllers/Top10Controller.js
+++ b/src/js/controllers/Top10Controller.js
@@ -4,7 +4,7 @@ GLOBE.Top10Controller = Em.ArrayController.extend({
     relays: [],
 
     actions: {
-        showRelayDetail: function(fingerprint){
+        showRelayDetail: function(fingerprint) {
             this.transitionToRoute('relayDetail', fingerprint);
         }
     }
diff --git a/src/js/helpers/dataTablesRenderer.js b/src/js/helpers/dataTablesRenderer.js
index c0ad797..db7343e 100644
--- a/src/js/helpers/dataTablesRenderer.js
+++ b/src/js/helpers/dataTablesRenderer.js
@@ -8,7 +8,7 @@ GLOBE.DataTableRenderer = {
     uptime: function (length) {
         return function (data, type, context) {
             if (type === 'display') {
-                if (context.running){
+                if (context.running) {
                     return GLOBE.Util.UptimeCalculator(data, length).join(' ');
                 } else {
                     return '<span class="has-tip" title="Offline">' + GLOBE.static.messages.dataEmpty + '</span>';
@@ -52,14 +52,14 @@ GLOBE.DataTableRenderer = {
             var flagString = '';
 
             // create flag render
-            if(!data.length){
+            if (!data.length) {
                 return '';
             }
-            data.forEach(function(n){
+            data.forEach(function(n) {
                 flagString += GLOBE.Formatter.propFlag(n);
             });
             return flagString;
         }
         return data;
     }
-};
\ No newline at end of file
+};
diff --git a/src/js/helpers/formatter.js b/src/js/helpers/formatter.js
index ac55bdb..e0bdfe8 100644
--- a/src/js/helpers/formatter.js
+++ b/src/js/helpers/formatter.js
@@ -9,11 +9,11 @@ GLOBE.Formatter = {
      * // returns '2.05KB/s'
      * GLOBE.Formatter.bandwidth(2048)
      */
-    bandwidth: function(value){
+    bandwidth: function(value) {
         var formatted = GLOBE.static.messages.dataEmpty;
 
         value = parseInt(value, 10);
-        if(value !== -1 && !isNaN(value)){
+        if (value !== -1 && !isNaN(value)) {
             var bandwidthKB = value / 1000;
             var bandwidthMB = bandwidthKB / 1000;
 
@@ -42,14 +42,14 @@ GLOBE.Formatter = {
      * // returns '"<span class="boolean true">true</span>"'
      * GLOBE.Formatter.boolean(true)
      */
-    boolean: function(value){
+    boolean: function(value) {
         var wrapped = '';
 
-        if(value === 'true' || value === true){
+        if (value === 'true' || value === true) {
             wrapped = '<span class="boolean true">true</span>';
-        }else if(value === 'false' || value === false){
+        }else if (value === 'false' || value === false) {
             wrapped = '<span class="boolean false">false</span>';
-        }else{
+        } else {
             wrapped = '<span class="boolean">' + GLOBE.static.messages.dataEmpty + '</span>';
         }
         return wrapped;
@@ -64,13 +64,13 @@ GLOBE.Formatter = {
      * // returns '"<span title="Germany" data-tooltip class="has-tip country-flag de_png"></span>"'
      * GLOBE.Formatter.countryFlag('de')
      */
-    countryFlag: function(value){
+    countryFlag: function(value) {
 
         var fullCountry = '';
 
-        if(GLOBE.static.countries.hasOwnProperty(value)){
+        if (GLOBE.static.countries.hasOwnProperty(value)) {
             fullCountry = GLOBE.static.countries[value];
-        }else{
+        } else {
             fullCountry = GLOBE.static.messages.dataEmpty;
             value = 'empty';
         }
@@ -89,11 +89,11 @@ GLOBE.Formatter = {
      * // return '<span class="fa fa-bolt has-tip" data-tooltip title="Fast"></span>'
      * GLOBE.Formatter.propFlag('Fast')
      */
-    propFlag: function(value){
+    propFlag: function(value) {
         var map = GLOBE.static.icons,
             withImage = '';
 
-        if(map.hasOwnProperty(value)){
+        if (map.hasOwnProperty(value)) {
             withImage = '<span class="fa ' + map[value] + ' has-tip" data-tooltip title="' + value + '"></span>';
         }
         return withImage;
@@ -107,10 +107,10 @@ GLOBE.Formatter = {
      * // returns '9000'
      * GLOBE.Formatter.extractPort('10.10.10.1:9000');
      */
-    extractPort: function(value){
+    extractPort: function(value) {
         var port = GLOBE.static.messages.dataEmpty;
 
-        if(typeof value === 'string'){
+        if (typeof value === 'string') {
             var parts = value.split(':'),
                 part;
 
@@ -164,4 +164,4 @@ GLOBE.Formatter = {
 
         return 'IPv' + ipV + ':' + port;
     }
-};
\ No newline at end of file
+};
diff --git a/src/js/helpers/handlebarsHelper.js b/src/js/helpers/handlebarsHelper.js
index 74f2d57..52fc662 100644
--- a/src/js/helpers/handlebarsHelper.js
+++ b/src/js/helpers/handlebarsHelper.js
@@ -2,7 +2,7 @@
 /**
  * @see {@link GLOBE.Formatter.boolean()}
  */
-Em.Handlebars.helper('truefalse', function(value){
+Em.Handlebars.helper('truefalse', function(value) {
     var wrapped = GLOBE.Formatter.boolean(value);
     return new Handlebars.SafeString(wrapped);
 });
@@ -10,7 +10,7 @@ Em.Handlebars.helper('truefalse', function(value){
 /**
  * @see {@link GLOBE.Formatter.bandwidth()}
  */
-Em.Handlebars.helper('bandwidth', function(value){
+Em.Handlebars.helper('bandwidth', function(value) {
     var formatted = GLOBE.Formatter.bandwidth(value);
     return new Handlebars.SafeString(formatted);
 });
@@ -18,11 +18,11 @@ Em.Handlebars.helper('bandwidth', function(value){
 /**
  * Uses {@link GLOBE.static.countries} to get the full name for a country key
  */
-Em.Handlebars.registerBoundHelper('fullCountry', function(value){
+Em.Handlebars.registerBoundHelper('fullCountry', function(value) {
     value = Handlebars.Utils.escapeExpression(value);
 
     var fullCountry = '';
-    if(GLOBE.static.countries.hasOwnProperty(value)){
+    if (GLOBE.static.countries.hasOwnProperty(value)) {
         fullCountry = GLOBE.static.countries[value];
     }
 
@@ -32,7 +32,7 @@ Em.Handlebars.registerBoundHelper('fullCountry', function(value){
 /**
  * @see {@link GLOBE.Formatter.countryFlag()}
  */
-Em.Handlebars.registerBoundHelper('prettyCountryFlag', function(value){
+Em.Handlebars.registerBoundHelper('prettyCountryFlag', function(value) {
     value = Handlebars.Utils.escapeExpression(value);
 
     var countryLabel = GLOBE.Formatter.countryFlag(value);
@@ -42,7 +42,7 @@ Em.Handlebars.registerBoundHelper('prettyCountryFlag', function(value){
 /**
  * @see {@link GLOBE.Formatter.countryFlag()}
  */
-Em.Handlebars.registerBoundHelper('flaggifyShort', function(value){
+Em.Handlebars.registerBoundHelper('flaggifyShort', function(value) {
     value = Handlebars.Utils.escapeExpression(value);
     var withImage = GLOBE.Formatter.countryFlag(value);
     return new Handlebars.SafeString(withImage);
@@ -51,11 +51,11 @@ Em.Handlebars.registerBoundHelper('flaggifyShort', function(value){
 /**
  * Generates HTML that displays an flag icon with flag title
  */
-Em.Handlebars.registerBoundHelper('flaggifyLong', function(value){
+Em.Handlebars.registerBoundHelper('flaggifyLong', function(value) {
     var map = GLOBE.static.icons;
     value = Handlebars.Utils.escapeExpression(value);
     var withImage = value;
-    if(map.hasOwnProperty(value)){
+    if (map.hasOwnProperty(value)) {
         withImage = '<i class="fa ' + map[value] + '"></i> ' + withImage;
     }
     return new Handlebars.SafeString(withImage);
@@ -65,8 +65,8 @@ Em.Handlebars.registerBoundHelper('flaggifyLong', function(value){
  * Uses the 'long' variant to generate an uptime string
  * @see {@title GLOBE.Util.UptimeCalculator}
  */
-Em.Handlebars.helper('uptimeFull', function(value){
-    if(!value){
+Em.Handlebars.helper('uptimeFull', function(value) {
+    if (!value) {
         return '';
     }
     value = Handlebars.Utils.escapeExpression(value);
@@ -78,8 +78,8 @@ Em.Handlebars.helper('uptimeFull', function(value){
  * Uses the 'short' variant to generate an uptime string
  * @see {@title GLOBE.Util.UptimeCalculator}
  */
-Em.Handlebars.helper('uptimeShort', function(value){
-    if(!value){
+Em.Handlebars.helper('uptimeShort', function(value) {
+    if (!value) {
         return '';
     }
     value = Handlebars.Utils.escapeExpression(value);
@@ -90,7 +90,7 @@ Em.Handlebars.helper('uptimeShort', function(value){
 /**
  * @see {@link GLOBE.Formatter.extractPort()}
  */
-Em.Handlebars.helper('extractPort', function(value){
+Em.Handlebars.helper('extractPort', function(value) {
     value = Handlebars.Utils.escapeExpression(value);
 
     var port = GLOBE.Formatter.extractPort(value);
@@ -101,11 +101,11 @@ Em.Handlebars.helper('extractPort', function(value){
 /**
  * uses {@link http://momentjs.com/docs/#/displaying/fromnow/} to display the difference from now and a given time
  */
-Em.Handlebars.helper('fromNow', function(value){
+Em.Handlebars.helper('fromNow', function(value) {
     var fromNow = '',
         valMoment = moment.utc(value);
 
-    if(valMoment.isValid()){
+    if (valMoment.isValid()) {
         fromNow = valMoment.fromNow();
     }
 
@@ -114,18 +114,18 @@ Em.Handlebars.helper('fromNow', function(value){
 /**
  * @see {@link GLOBE.Formatter.familyToFingerprint()}
  */
-Em.Handlebars.helper('familyToFingerprint', function(value){
+Em.Handlebars.helper('familyToFingerprint', function(value) {
     return new Handlebars.SafeString(GLOBE.Formatter.familyToFingerprint(value));
 });
 /**
  * @see {@link GLOBE.Formatter.familyToFingerprint()}
  */
-Em.Handlebars.helper('percent', function(value, precision){
+Em.Handlebars.helper('percent', function(value, precision) {
     return new Handlebars.SafeString(GLOBE.Formatter.percent(value, precision));
 });
 /**
  * @see {@link GLOBE.Formatter.familyToFingerprint()}
  */
-Em.Handlebars.helper('anonIpAdress', function(value){
+Em.Handlebars.helper('anonIpAdress', function(value) {
     return new Handlebars.SafeString(GLOBE.Formatter.anonymizeIpAddress(value));
-});
\ No newline at end of file
+});
diff --git a/src/js/helpers/util.js b/src/js/helpers/util.js
index f646fd7..921d7ba 100644
--- a/src/js/helpers/util.js
+++ b/src/js/helpers/util.js
@@ -7,7 +7,7 @@ GLOBE.Util = {
      * @param {String} string String to check
      * @returns {Boolean} If the checked string is a 40 char hex
      */
-    is40CharHex: function(string){
+    is40CharHex: function(string) {
         var hex40CharRegex = /^[a-f0-9]{40}/i,
             result;
 
@@ -22,7 +22,7 @@ GLOBE.Util = {
      * @param {String} fingerprint
      * @returns {String} hashed fingerprint
      */
-    hashFingerprint: function(fingerprint){
+    hashFingerprint: function(fingerprint) {
         var fingerBin = new jsSHA(fingerprint, 'HEX'),
             hashed = fingerBin.getHash('SHA-1', 'HEX');
         return hashed.toUpperCase();
@@ -33,7 +33,7 @@ GLOBE.Util = {
      * @param {String} value UTC Timestamp
      * @returns {{h: Number, m: Number, s: Number, d: Number}} hour, minute, second, day
      */
-    UtcDiff: function(value){
+    UtcDiff: function(value) {
         var momentDate = moment.utc(value, 'YYYY-MM-DD HH:mm:ss'),
             diff,
             // default result
@@ -72,7 +72,7 @@ GLOBE.Util = {
      * @example
      * if uptime < days the function returns [ hours, minutes ]
      */
-    UptimeCalculator: function(value, type){
+    UptimeCalculator: function(value, type) {
         // if not a valid length return empty data message
         if (value.length !== 19) {
             return [GLOBE.static.messages.dataEmpty];
@@ -89,15 +89,15 @@ GLOBE.Util = {
             labels = shortVersion ? ['d', 'h', 'm', 's'] : ['day', 'hour', 'minute', 'second'],
             uptimeArray = [];
 
-        for(var i = 0, max = units.length; i < max; i++){
-            if(labels[i] && labels[i].length && units[i] > 0){
+        for (var i = 0, max = units.length; i < max; i++) {
+            if (labels[i] && labels[i].length && units[i] > 0) {
                 digits += 1;
                 uptimeArray[i] = units[i] + beforeUnit + (pluralize && units[i] > 1 ? labels[i] + 's' : labels[i]) + afterUnit;
 
-                if(digits > 1){
+                if (digits > 1) {
                     break;
                 }
-            }else{
+            } else {
                 labels[i] = '';
             }
         }
@@ -110,7 +110,7 @@ GLOBE.Util = {
      * @returns {Date} converted date Object
      * @throws {String} will throw an error if the parsed timestamp is invalid
      */
-    utcToDate: function(timestamp){
+    utcToDate: function(timestamp) {
         var timeMoment = moment.utc(timestamp, 'YYYY-MM-DD HH:mm:ss');
 
         if (!timeMoment.isValid()) {
@@ -126,13 +126,13 @@ GLOBE.Util = {
      * @throws {String} throws an error if there is no interval or there is something wrong with start and end date
      * @returns {*}
      */
-    buildTimeValuePairs: function(historyObject){
-        if(historyObject.first && historyObject.last && historyObject.interval){
+    buildTimeValuePairs: function(historyObject) {
+        if (historyObject.first && historyObject.last && historyObject.interval) {
             var startDate = this.utcToDate(historyObject.first),
                 endDate = this.utcToDate(historyObject.last);
 
             // check if Date creation was successfull
-            if(!isNaN(startDate.getTime()) && !isNaN(endDate.getTime())){
+            if (!isNaN(startDate.getTime()) && !isNaN(endDate.getTime())) {
                 // everything worked
 
                 var sum = 0,
@@ -142,7 +142,7 @@ GLOBE.Util = {
                     interval = historyObject.interval * 1000,
                     currentTime = startDate.getTime();
 
-                for(var i = 0, max = values.length; i < max; i++){
+                for (var i = 0, max = values.length; i < max; i++) {
                     var realValue = values[i] * historyObject.factor;
 
                     newValues.push([
@@ -157,11 +157,11 @@ GLOBE.Util = {
                 historyObject.avg = (sum / values.length);
                 historyObject.values = newValues;
 
-            }else{
+            } else {
                 throw 'There was an error parsing the history object timestamps. Check if ' + historyObject.first + ' or ' + historyObject.last + ' are correct.';
             }
 
-        }else{
+        } else {
             throw 'Cannot generate time value pairs if there is no time interval given';
         }
 
@@ -173,10 +173,10 @@ GLOBE.Util = {
      * @param {Object} toBuild
      * @returns {Array}
      */
-    prepareHistoryItems: function(history, toBuild){
+    prepareHistoryItems: function(history, toBuild) {
         var periods = [];
         for (var build in toBuild) {
-            if(toBuild.hasOwnProperty(build)){
+            if (toBuild.hasOwnProperty(build)) {
 
                 var buildHistory = toBuild[build];
                 for (var buildKey in buildHistory) {
@@ -220,7 +220,7 @@ GLOBE.Util = {
         return looksLike;
     },
 
-    processHistoryResponse: function(fieldMapping, response){
+    processHistoryResponse: function(fieldMapping, response) {
         var hasRelays = response && response.relays && response.relays.length,
             hasBridges = response && response.bridges && response.bridges.length,
             relays = {
@@ -302,13 +302,13 @@ GLOBE.Util = {
         return processedHistoryResponse;
     },
 
-    historyValuesFromNowUntil: function(cfg){
+    historyValuesFromNowUntil: function(cfg) {
         var history = cfg.history,
             timeAgo = cfg.timeAgo,
             source = cfg.sourceField,
             dest = cfg.destField;
 
-        Object.keys(history).forEach(function(historyField){
+        Object.keys(history).forEach(function(historyField) {
             if (history[historyField][source]) {
                 // get first timestamp
                 var sum = 0,
@@ -317,9 +317,9 @@ GLOBE.Util = {
                     // get youngest dataset from source
                     now = moment.utc(),
                     timeFromComputedNowAgo = now - timeAgo,
-                    filteredSourceValues = sourceValues.filter(function(valuePair){
+                    filteredSourceValues = sourceValues.filter(function(valuePair) {
                         if (valuePair[0] > timeFromComputedNowAgo) {
-                            if (valuePair[0] < earliestValue){
+                            if (valuePair[0] < earliestValue) {
                                 earliestValue = valuePair[0];
                             }
                             sum += valuePair[1];
@@ -338,8 +338,8 @@ GLOBE.Util = {
         });
     },
 
-    nowMinusPeriod: function(period){
+    nowMinusPeriod: function(period) {
         var periodObject = GLOBE.static.periodObject[period];
         return moment.utc().subtract(periodObject[0], periodObject[1]);
     }
-};
\ No newline at end of file
+};
diff --git a/src/js/mixins/ContentReadyTriggerableMixin.js b/src/js/mixins/ContentReadyTriggerableMixin.js
index b9160c7..83adc8b 100644
--- a/src/js/mixins/ContentReadyTriggerableMixin.js
+++ b/src/js/mixins/ContentReadyTriggerableMixin.js
@@ -3,7 +3,7 @@ GLOBE.ContentReadyTriggerableMixin = Em.Mixin.create({
     /**
      * Function that is called if the controller content is changed.
      */
-    contentChanged: function(){
+    contentChanged: function() {
         this.trigger('content-ready');
     }.observes('content')
 });
\ No newline at end of file
diff --git a/src/js/mixins/PeriodsMixin.js b/src/js/mixins/PeriodsMixin.js
index 1a05ac9..32481d9 100644
--- a/src/js/mixins/PeriodsMixin.js
+++ b/src/js/mixins/PeriodsMixin.js
@@ -4,31 +4,31 @@ GLOBE.PeriodsMixin = Em.Mixin.create({
     periods: [],
     periodsObject: {},
 
-    updatePeriods: function(dataFields){
+    updatePeriods: function(dataFields) {
         var props = this.getProperties(dataFields),
             periods = this.get('periodsObject'),
             periodsArray;
 
-        function populatePeriods(data){
-            Object.keys(data).forEach(function(dataKey){
-                Object.keys(data[dataKey]).forEach(function(period){
+        function populatePeriods(data) {
+            Object.keys(data).forEach(function(dataKey) {
+                Object.keys(data[dataKey]).forEach(function(period) {
                     periods[period] = 1;
                 });
             });
         }
 
-        dataFields.forEach(function(dataField){
+        dataFields.forEach(function(dataField) {
             populatePeriods(props[dataField]);
         });
 
-        periodsArray = Object.keys(periods).map(function(period){
+        periodsArray = Object.keys(periods).map(function(period) {
             return {
                 key: period,
                 title: GLOBE.static.messages[period],
                 active: false,
                 pos: GLOBE.static.numbers[period]
             };
-        }).sort(function(a, b){
+        }).sort(function(a, b) {
             return a.pos - b.pos;
         });
 
@@ -44,7 +44,7 @@ GLOBE.PeriodsMixin = Em.Mixin.create({
 
     actions: {
         tabActivated: function(key) {
-            this.get('periods').forEach(function(period){
+            this.get('periods').forEach(function(period) {
                 if (period.key === key) {
                     Em.set(period, 'active', true);
                 } else {
diff --git a/src/js/models/OnionooBandwidthHistory.js b/src/js/models/OnionooBandwidthHistory.js
index 41ceff6..d50c35e 100644
--- a/src/js/models/OnionooBandwidthHistory.js
+++ b/src/js/models/OnionooBandwidthHistory.js
@@ -9,9 +9,9 @@ GLOBE.OnionooBandwidthHistory.reopenClass({
      * @param {Boolean} isHashed flag if the given hash is already hashed
      * @returns {Promise}
      */
-    find: function(fingerprint, isHashed){
+    find: function(fingerprint, isHashed) {
         var hashedFingerprint = fingerprint;
-        if(!isHashed){
+        if (!isHashed) {
             // use generate hashed fingerprint if not already hashed
             hashedFingerprint = GLOBE.Util.hashFingerprint(fingerprint);
         }
@@ -19,11 +19,11 @@ GLOBE.OnionooBandwidthHistory.reopenClass({
         hashedFingerprint = hashedFingerprint.toUpperCase();
 
         var url = '/bandwidth?lookup=' + hashedFingerprint;
-        return GLOBE.getJSON(url).then(function(result){
+        return GLOBE.getJSON(url).then(function(result) {
             return GLOBE.Util.processHistoryResponse({
                 readHistory: 'read_history',
                 writeHistory: 'write_history'
             }, result);
         });
     }
-});
\ No newline at end of file
+});
diff --git a/src/js/models/OnionooClientsHistory.js b/src/js/models/OnionooClientsHistory.js
index 5e59948..ecc08c5 100644
--- a/src/js/models/OnionooClientsHistory.js
+++ b/src/js/models/OnionooClientsHistory.js
@@ -9,9 +9,9 @@ GLOBE.OnionooClientsHistory.reopenClass({
      * @param {Boolean} isHashed flag if the given hash is already hashed
      * @returns {Promise}
      */
-    find: function(fingerprint, isHashed){
+    find: function(fingerprint, isHashed) {
         var hashedFingerprint = fingerprint;
-        if(!isHashed){
+        if (!isHashed) {
             // use generate hashed fingerprint if not already hashed
             hashedFingerprint = GLOBE.Util.hashFingerprint(fingerprint);
         }
@@ -19,10 +19,10 @@ GLOBE.OnionooClientsHistory.reopenClass({
         hashedFingerprint = hashedFingerprint.toUpperCase();
 
         var url = '/clients?lookup=' + hashedFingerprint;
-        return GLOBE.getJSON(url).then(function(result){
+        return GLOBE.getJSON(url).then(function(result) {
             return GLOBE.Util.compute3DaysHistory(GLOBE.Util.processHistoryResponse({
                 averageClients: 'average_clients'
             }, result));
         });
     }
-});
\ No newline at end of file
+});
diff --git a/src/js/models/OnionooDetail.js b/src/js/models/OnionooDetail.js
index ebcf2f5..f229d90 100644
--- a/src/js/models/OnionooDetail.js
+++ b/src/js/models/OnionooDetail.js
@@ -5,23 +5,23 @@ GLOBE.OnionooBridgeDetail = Em.Object.extend({});
 
 GLOBE.OnionooDetail = Em.Object.extend({});
 GLOBE.OnionooDetail.reopenClass({
-    applyDetailDefaults: function(result, defaults){
+    applyDetailDefaults: function(result, defaults) {
         var details = {
             relays: [],
             bridges: []
         };
 
-        if(result &&
+        if (result &&
             result.hasOwnProperty('relays') &&
-            result.hasOwnProperty('bridges')){
+            result.hasOwnProperty('bridges')) {
 
             var consensus = {
                 bridges: moment.utc(result.bridges_published),
                 relays: moment.utc(result.relays_published)
             };
 
-            if(result.relays.length){
-                for(var i = 0, numRelays = result.relays.length; i < numRelays; i++){
+            if (result.relays.length) {
+                for (var i = 0, numRelays = result.relays.length; i < numRelays; i++) {
 
                     // process result relays
                     var relay = $.extend({}, defaults.relay, result.relays[i]);
@@ -29,9 +29,9 @@ GLOBE.OnionooDetail.reopenClass({
                     var relayLastSeenMoment = moment.utc(relayObj.get('last_seen'));
 
                     // check if consensus.relays and lastSeenMoment exist
-                    if( consensus.relays && relayLastSeenMoment &&
+                    if ( consensus.relays && relayLastSeenMoment &&
                         // check if both are valid (moment.isValid)
-                        consensus.relays.isValid() && relayLastSeenMoment.isValid()){
+                        consensus.relays.isValid() && relayLastSeenMoment.isValid()) {
                         relayObj.set('inLatestConsensus', consensus.relays.isSame(relayLastSeenMoment));
                     }
 
@@ -40,17 +40,17 @@ GLOBE.OnionooDetail.reopenClass({
                 }
             }
 
-            if(result.bridges.length){
-                for(var j = 0, numBridges = result.bridges.length; j < numBridges; j++){
+            if (result.bridges.length) {
+                for (var j = 0, numBridges = result.bridges.length; j < numBridges; j++) {
                     // process result bridges
                     var bridge = $.extend({}, defaults.bridge, result.bridges[j]);
                     var bridgeObj = GLOBE.OnionooRelayDetail.create(bridge);
                     var bridgeLastSeenMoment = moment.utc(bridgeObj.get('last_seen'));
 
                     // check if consensus.relays and lastSeenMoment exist
-                    if( consensus.bridges && bridgeLastSeenMoment &&
+                    if ( consensus.bridges && bridgeLastSeenMoment &&
                         // check if both are valid (moment.isValid)
-                        consensus.bridges.isValid() && bridgeLastSeenMoment.isValid()){
+                        consensus.bridges.isValid() && bridgeLastSeenMoment.isValid()) {
                         bridgeObj.set('inLatestConsensus', consensus.bridges.isSame(bridgeLastSeenMoment));
                     }
 
@@ -66,7 +66,7 @@ GLOBE.OnionooDetail.reopenClass({
      * @param {Object} opts
      * @returns {Promise}
      */
-    findWithFilter: function(opts){
+    findWithFilter: function(opts) {
         //query, filter, fields
         var query = opts.query || '';
         var filter = opts.filter || {};
@@ -83,15 +83,15 @@ GLOBE.OnionooDetail.reopenClass({
 
         // add fields parameters
         var fieldParamString = '';
-        if(fields.length){
+        if (fields.length) {
             fieldParamString = '&fields=' + fields.join(',');
         }
 
         // manually set params
         var advancedParamsString = '&';
-        for(var filterParam in filter){
-            if(filter.hasOwnProperty(filterParam)){
-                if(filter[filterParam].length){
+        for (var filterParam in filter) {
+            if (filter.hasOwnProperty(filterParam)) {
+                if (filter[filterParam].length) {
                     advancedParamsString += filterParam + '=' + filter[filterParam] + '&';
                 }
             }
@@ -105,7 +105,7 @@ GLOBE.OnionooDetail.reopenClass({
 
         url += searchParamString + advancedParamsString + fieldParamString;
 
-        return GLOBE.getJSON(url).then(function(result){
+        return GLOBE.getJSON(url).then(function(result) {
             // getJSON success callback
 
             GLOBE.decrementProperty('loading');
@@ -128,11 +128,11 @@ GLOBE.OnionooDetail.reopenClass({
      * @param {Boolean} isHashed
      * @returns {Promise}
      */
-    find: function(fingerprint, isHashed){
+    find: function(fingerprint, isHashed) {
         var that = this;
         var hashedFingerprint = fingerprint;
 
-        if(!isHashed){
+        if (!isHashed) {
             // use generate hashed fingerprint if not already hashed
             hashedFingerprint = GLOBE.Util.hashFingerprint(fingerprint);
         }
@@ -140,14 +140,14 @@ GLOBE.OnionooDetail.reopenClass({
         hashedFingerprint = hashedFingerprint.toUpperCase();
 
         var storedDetail = GLOBE.TemporaryStore.find('details', hashedFingerprint);
-        if(storedDetail === undefined){
+        if (storedDetail === undefined) {
             // has no detail stored
 
             GLOBE.incrementProperty('loading');
 
             var url = '/details?lookup=' + hashedFingerprint;
 
-            return GLOBE.getJSON(url).then(function(result){
+            return GLOBE.getJSON(url).then(function(result) {
                 var detailsObj = that.applyDetailDefaults(result, {
                     relay: GLOBE.defaults.OnionooRelayDetail,
                     bridge: GLOBE.defaults.OnionooBridgeDetail
@@ -165,7 +165,7 @@ GLOBE.OnionooDetail.reopenClass({
                 return  detailObj;
             });
 
-        }else{
+        } else {
             return new Em.RSVP.Promise(function (resolve) {
                 resolve(storedDetail);
             });
@@ -177,7 +177,7 @@ GLOBE.OnionooDetail.reopenClass({
      * @param {String} order parameter for the onionoo `?order` parameter
      * @returns {Promise}
      */
-    top10: function(order){
+    top10: function(order) {
         var that = this;
         var fields = ['fingerprint', 'nickname', 'advertised_bandwidth', 'last_restarted', 'country', 'flags', 'or_addresses', 'dir_address', 'running', 'hashed_fingerprint'];
 
@@ -191,7 +191,7 @@ GLOBE.OnionooDetail.reopenClass({
         url += '&running=true';
 
         GLOBE.incrementProperty('loading');
-        return GLOBE.getJSON(url).then(function(result){
+        return GLOBE.getJSON(url).then(function(result) {
             GLOBE.decrementProperty('loading');
 
             return that.applyDetailDefaults(result, {
@@ -200,4 +200,4 @@ GLOBE.OnionooDetail.reopenClass({
             });
         });
     }
-});
\ No newline at end of file
+});
diff --git a/src/js/models/OnionooUptimeHistory.js b/src/js/models/OnionooUptimeHistory.js
index 1bc3309..3d5a676 100644
--- a/src/js/models/OnionooUptimeHistory.js
+++ b/src/js/models/OnionooUptimeHistory.js
@@ -9,9 +9,9 @@ GLOBE.OnionooUptimeHistory.reopenClass({
      * @param {Boolean} isHashed flag if the given hash is already hashed
      * @returns {Promise}
      */
-    find: function(fingerprint, isHashed){
+    find: function(fingerprint, isHashed) {
         var hashedFingerprint = fingerprint;
-        if(!isHashed){
+        if (!isHashed) {
             // use generate hashed fingerprint if not already hashed
             hashedFingerprint = GLOBE.Util.hashFingerprint(fingerprint);
         }
@@ -19,10 +19,10 @@ GLOBE.OnionooUptimeHistory.reopenClass({
         hashedFingerprint = hashedFingerprint.toUpperCase();
 
         var url = '/uptime?lookup=' + hashedFingerprint;
-        return GLOBE.getJSON(url).then(function(result){
+        return GLOBE.getJSON(url).then(function(result) {
             return GLOBE.Util.compute3DaysHistory(GLOBE.Util.processHistoryResponse({
                 uptime: 'uptime'
             }, result));
         });
     }
-});
\ No newline at end of file
+});
diff --git a/src/js/models/OnionooWeightsHistory.js b/src/js/models/OnionooWeightsHistory.js
index 87be542..31c98cc 100644
--- a/src/js/models/OnionooWeightsHistory.js
+++ b/src/js/models/OnionooWeightsHistory.js
@@ -8,10 +8,10 @@ GLOBE.OnionooWeightsHistory.reopenClass({
      * @param {Boolean} isHashed
      * @returns {Promise}
      */
-    find: function(fingerprint, isHashed){
+    find: function(fingerprint, isHashed) {
         var hashedFingerprint = fingerprint;
 
-        if(!isHashed){
+        if (!isHashed) {
             // use generate hashed fingerprint if not already hashed
             hashedFingerprint = GLOBE.Util.hashFingerprint(fingerprint);
         }
@@ -20,7 +20,7 @@ GLOBE.OnionooWeightsHistory.reopenClass({
 
         var url = '/weights?lookup=' + hashedFingerprint;
 
-        return GLOBE.getJSON(url).then(function(result){
+        return GLOBE.getJSON(url).then(function(result) {
             return GLOBE.Util.compute3DaysHistory(GLOBE.Util.processHistoryResponse({
                 consensusWeightFraction: 'consensus_weight_fraction',
                 guardProbability: 'guard_probability',
diff --git a/src/js/models/TemporaryStore.js b/src/js/models/TemporaryStore.js
index 5b83334..99a2a84 100644
--- a/src/js/models/TemporaryStore.js
+++ b/src/js/models/TemporaryStore.js
@@ -18,12 +18,12 @@ GLOBE.TemporaryStore.reopenClass({
      * @example
      * GLOBE.TemporaryStore.store('details', 'uid123465' , {foo: 'bar'});
      */
-    store: function(where, hashedFingerprint, obj){
+    store: function(where, hashedFingerprint, obj) {
         // use only uppercase fingerprints
         hashedFingerprint = hashedFingerprint.toUpperCase();
 
         // check if store has property in _where
-        if(this.storage.hasOwnProperty('_' + where)){
+        if (this.storage.hasOwnProperty('_' + where)) {
             this.storage['_' + where][hashedFingerprint] = obj;
         }
 
@@ -37,17 +37,17 @@ GLOBE.TemporaryStore.reopenClass({
      * @example
      * var storedItem = NAMESPACE.TemporaryStore.find('details', 'uid123465');
      */
-    find: function(where, hashedFingerprint){
+    find: function(where, hashedFingerprint) {
         // use only uppercase fingerprints
         hashedFingerprint = hashedFingerprint.toUpperCase();
 
         var obj;
 
         // check if store has property in _where
-        if(this.storage.hasOwnProperty('_' + where)){
+        if (this.storage.hasOwnProperty('_' + where)) {
             obj = this.storage['_' + where][hashedFingerprint];
         }
 
         return obj;
     }
-});
\ No newline at end of file
+});
diff --git a/src/js/routes/BridgeDetailRoute.js b/src/js/routes/BridgeDetailRoute.js
index 806004a..4943964 100644
--- a/src/js/routes/BridgeDetailRoute.js
+++ b/src/js/routes/BridgeDetailRoute.js
@@ -1,11 +1,11 @@
 /*global GLOBE, Em */
 GLOBE.BridgeDetailRoute = Em.Route.extend({
-    model: function(params){
+    model: function(params) {
         return params.fingerprint;
     },
-    setupController: function(controller, fingerprint){
+    setupController: function(controller, fingerprint) {
 
-        GLOBE.OnionooDetail.find(fingerprint).then(function(item){
+        GLOBE.OnionooDetail.find(fingerprint).then(function(item) {
             // check if found bridge
             if (item.bridge.hasOwnProperty('hashed_fingerprint')) {
 
@@ -18,7 +18,7 @@ GLOBE.BridgeDetailRoute = Em.Route.extend({
                     bandwidth: GLOBE.OnionooBandwidthHistory.find(fingerprint, true),
                     uptime: GLOBE.OnionooUptimeHistory.find(fingerprint, true),
                     clients: GLOBE.OnionooClientsHistory.find(fingerprint, true)
-                }).then(function(result){
+                }).then(function(result) {
 
                     controller.setProperties({
                         bandwidthPeriods: result.bandwidth.bridges.periods,
diff --git a/src/js/routes/RelayDetailRoute.js b/src/js/routes/RelayDetailRoute.js
index 8682825..bcdf6fc 100644
--- a/src/js/routes/RelayDetailRoute.js
+++ b/src/js/routes/RelayDetailRoute.js
@@ -1,12 +1,12 @@
 /*global GLOBE, Em */
 GLOBE.RelayDetailRoute = Em.Route.extend({
-    model: function(params){
+    model: function(params) {
         return params.fingerprint;
     },
-    setupController: function(controller, fingerprint){
+    setupController: function(controller, fingerprint) {
         var that = this;
 
-        GLOBE.OnionooDetail.find(fingerprint).then(function(item){
+        GLOBE.OnionooDetail.find(fingerprint).then(function(item) {
 
             // check if found relay
             if (item.relay.hasOwnProperty('fingerprint')) {
@@ -21,7 +21,7 @@ GLOBE.RelayDetailRoute = Em.Route.extend({
                     weight: GLOBE.OnionooWeightsHistory.find(fingerprint),
                     bandwidth: GLOBE.OnionooBandwidthHistory.find(fingerprint),
                     uptime: GLOBE.OnionooUptimeHistory.find(fingerprint)
-                }).then(function(result){
+                }).then(function(result) {
 
                     controller.setProperties({
                         weightPeriods: result.weight.relays.periods,
@@ -35,7 +35,7 @@ GLOBE.RelayDetailRoute = Em.Route.extend({
                     controller.updatePeriods(['weightData', 'bandwidthData', 'uptimeData']);
                 });
 
-            } else if(item.bridge && item.bridge.hasOwnProperty('hashed_fingerprint')) {
+            } else if (item.bridge && item.bridge.hasOwnProperty('hashed_fingerprint')) {
                 // has bridge but no relay
                 that.replaceWith('bridgeDetail', item.bridge.hashed_fingerprint);
             } else {
@@ -47,4 +47,4 @@ GLOBE.RelayDetailRoute = Em.Route.extend({
             GLOBE.set('title', controller.get('model') ? 'Details for ' + controller.get('nickname') + ' | Relay' : GLOBE.static.messages.detailsNotFound);
         });
     }
-});
\ No newline at end of file
+});
diff --git a/src/js/routes/StaticRoutes.js b/src/js/routes/StaticRoutes.js
index e49e3a9..75fe424 100644
--- a/src/js/routes/StaticRoutes.js
+++ b/src/js/routes/StaticRoutes.js
@@ -3,7 +3,7 @@
  * Route for /index
  */
 GLOBE.IndexRoute = Em.Route.extend({
-    activate: function(){
+    activate: function() {
         GLOBE.set('title', '');
     }
 });
@@ -12,7 +12,7 @@ GLOBE.IndexRoute = Em.Route.extend({
  * Route for /code
  */
 GLOBE.CodeRoute = Em.Route.extend({
-    activate: function(){
+    activate: function() {
         GLOBE.set('title', 'Code');
     }
 });
@@ -21,7 +21,7 @@ GLOBE.CodeRoute = Em.Route.extend({
  * Route for /help
  */
 GLOBE.HelpRoute = Em.Route.extend({
-    activate: function(){
+    activate: function() {
         GLOBE.set('title', 'Help');
     }
 });
\ No newline at end of file
diff --git a/src/js/routes/SummarySearchRoute.js b/src/js/routes/SummarySearchRoute.js
index af96785..e76cf5e 100644
--- a/src/js/routes/SummarySearchRoute.js
+++ b/src/js/routes/SummarySearchRoute.js
@@ -1,14 +1,14 @@
 /*global $, GLOBE, Em */
 GLOBE.SummarySearchRoute = Em.Route.extend({
 
-    deactivate: function(){
+    deactivate: function() {
         // clear alerts for search
         GLOBE.clearAlert('search');
     },
-    model: function(params){
+    model: function(params) {
         return params.query;
     },
-    setupController: function(controller, params){
+    setupController: function(controller, params) {
         // deparam querystring
         var deparamd = $.deparam(params),
             query = deparamd.query,
@@ -18,8 +18,8 @@ GLOBE.SummarySearchRoute = Em.Route.extend({
             fields = ['fingerprint', 'nickname', 'advertised_bandwidth', 'last_restarted', 'country', 'flags', 'or_addresses', 'dir_address', 'running', 'hashed_fingerprint'];
 
         // set controller filters from params
-        for(var filter in filters){
-            if(filters.hasOwnProperty(filter)){
+        for (var filter in filters) {
+            if (filters.hasOwnProperty(filter)) {
                 controller.set('controllers.application.advancedSearchOptions.' + filter, filters[filter]);
             }
         }
@@ -31,7 +31,7 @@ GLOBE.SummarySearchRoute = Em.Route.extend({
         controller.set('controllers.application.query', query);
 
         // check if query is a 40 char hex and hash if it's true
-        if(GLOBE.Util.is40CharHex(query)){
+        if (GLOBE.Util.is40CharHex(query)) {
             query = GLOBE.Util.hashFingerprint(query);
         }
 
@@ -42,9 +42,9 @@ GLOBE.SummarySearchRoute = Em.Route.extend({
             query: query,
             filter: filters,
             fields: fields
-        }).then(function(summaries){
+        }).then(function(summaries) {
             // show message if there are too much results
-            if(summaries.relays.length + summaries.bridges.length >= GLOBE.static.numbers.maxSearchResults){
+            if (summaries.relays.length + summaries.bridges.length >= GLOBE.static.numbers.maxSearchResults) {
                 GLOBE.setAlert('search', 'info', GLOBE.static.messages.specifyYourSearch);
             }
 
@@ -66,4 +66,4 @@ GLOBE.SummarySearchRoute = Em.Route.extend({
             GLOBE.setAlert('search', 'warn', GLOBE.static.messages.invalidSearchTerm);
         });
     }
-});
\ No newline at end of file
+});
diff --git a/src/js/routes/Top10Route.js b/src/js/routes/Top10Route.js
index bcb7248..da3b8e4 100644
--- a/src/js/routes/Top10Route.js
+++ b/src/js/routes/Top10Route.js
@@ -1,11 +1,11 @@
 /*global GLOBE, Em */
 GLOBE.Top10Route = Em.Route.extend({
-    activate: function(){
+    activate: function() {
         GLOBE.set('title', 'Top 10 relays');
     },
-    setupController: function(controller){
+    setupController: function(controller) {
         // update main search bar
-        GLOBE.OnionooDetail.top10('-consensus_weight').then(function(summaries){
+        GLOBE.OnionooDetail.top10('-consensus_weight').then(function(summaries) {
             controller.set('content', summaries.relays);
         });
     }
diff --git a/src/js/views/DetailViews.js b/src/js/views/DetailViews.js
index dfc6914..e4cafc5 100644
--- a/src/js/views/DetailViews.js
+++ b/src/js/views/DetailViews.js
@@ -1,19 +1,19 @@
 /*global GLOBE, Em */
 GLOBE.RelayDetailView = Em.View.extend({
-    didInsertElement: function(){
+    didInsertElement: function() {
         this.$('.has-tip').qtip(GLOBE.static.qtipConf.detail);
         this.get('controller').on('content-ready', Em.run.bind(this, this.bindQTip));
     },
 
-    bindQTip: function(){
-        Em.run.scheduleOnce('afterRender', this, function(){
+    bindQTip: function() {
+        Em.run.scheduleOnce('afterRender', this, function() {
             // remove old tips and init again
             this.$('.has-tip').qtip('destroy', true);
             this.$('.has-tip').qtip(GLOBE.static.qtipConf.detail);
         });
     },
 
-    willDestroyElement: function(){
+    willDestroyElement: function() {
         this.$('.has-tip').qtip('destroy', true);
     }
 });
diff --git a/src/js/views/HistoryGraphView.js b/src/js/views/HistoryGraphView.js
index 899ab4a..a5158d1 100644
--- a/src/js/views/HistoryGraphView.js
+++ b/src/js/views/HistoryGraphView.js
@@ -11,9 +11,9 @@ GLOBE.HistoryGraphView = Em.View.extend({
     dygraph: null,
     hasGraph: false,
 
-    click: function(e){
+    click: function(e) {
         // check if clicked element has save-as-png in classList
-        if(e.target.classList.contains('save-as-png')){
+        if (e.target.classList.contains('save-as-png')) {
             var dygraph = this.get('dygraph');
 
             var tmpImage = document.createElement('image');
@@ -23,7 +23,7 @@ GLOBE.HistoryGraphView = Em.View.extend({
         }
     },
 
-    plot: function(){
+    plot: function() {
         var graphOpts = this.get('graphOpts');
         var selector = this.$()[0].id;
         var $graphCanvas = $('#' + selector).find('.graph-canvas');
@@ -48,23 +48,23 @@ GLOBE.HistoryGraphView = Em.View.extend({
             h = 0;
 
         // check if view width/height are set and use these values, otherwise use computed and store them
-        if(storedWidth === 0){
+        if (storedWidth === 0) {
             w = $graphCanvas.width();
             this.set('width', w);
-        }else{
+        } else {
             w = storedWidth;
         }
-        if(storedHeight === 0){
+        if (storedHeight === 0) {
             h = $graphCanvas.height() || 250;
             this.set('height', h);
-        }else{
+        } else {
             h = storedHeight;
         }
 
         // check what histories data to use
-        for(var i = 0, max = graphs.length; i < max; i++){
+        for (var i = 0, max = graphs.length; i < max; i++) {
             var graph = graphs[i];
-            if(data.hasOwnProperty(graph)){
+            if (data.hasOwnProperty(graph)) {
                 histories.push(data[graph]);
             }
         }
@@ -75,22 +75,22 @@ GLOBE.HistoryGraphView = Em.View.extend({
         var countedHistory = 0;
         var maxVal = 0;
 
-        for(var j = 0, max2 = histories.length; j < max2; j++){
+        for (var j = 0, max2 = histories.length; j < max2; j++) {
             var history = histories[j];
 
             // get the data from the chosen period out of the chosen history object
-            if(history && history[period] && history[period].values){
+            if (history && history[period] && history[period].values) {
 
-                for(var historyValueIndex = 0, historyValues = history[period].values.length; historyValueIndex < historyValues; historyValueIndex++){
+                for (var historyValueIndex = 0, historyValues = history[period].values.length; historyValueIndex < historyValues; historyValueIndex++) {
                     var value = history[period].values[historyValueIndex];
 
                     // check if map has something in value[0] (timestamp)
-                    if(dateValueMap.hasOwnProperty(value[0])){
+                    if (dateValueMap.hasOwnProperty(value[0])) {
                         // has already something @timestamp
 
                         // check if value has values.length that is plausible with the number of already history items
                         dateValueMap[value[0]][countedHistory] = value[1];
-                    }else{
+                    } else {
                         // has nothing for this timestamp
                         // example execution: dateValueMap[1373286150000] = [,,20234.072];
                         dateValueMap[value[0]] = [];
@@ -104,8 +104,8 @@ GLOBE.HistoryGraphView = Em.View.extend({
 
         // merge everything into a dygraph format ( [timestamp, value1, value2, ...] )
         var dataset = [];
-        for(var dateValue in dateValueMap){
-            if(dateValueMap.hasOwnProperty(dateValue)){
+        for (var dateValue in dateValueMap) {
+            if (dateValueMap.hasOwnProperty(dateValue)) {
                 var dateValueItem = dateValueMap[dateValue];
 
                 // create array with first position for timestamp
@@ -118,11 +118,11 @@ GLOBE.HistoryGraphView = Em.View.extend({
         }
 
 
-        if(!dataset.length){
+        if (!dataset.length) {
             $graphCanvas.html('<div class="missing-data">No data available :(</div>');
             this.set('hasGraph', false);
             return;
-        }else{
+        } else {
             this.set('hasGraph', true);
             // clear area that holds all the views content
             $graphCanvas.html('');
@@ -148,9 +148,9 @@ GLOBE.HistoryGraphView = Em.View.extend({
         this.set('dygraph', dygraph);
     },
 
-    timePeriodChanged: function(){
+    timePeriodChanged: function() {
         var selectedTimePeriod = this.get('period');
-        if(selectedTimePeriod !== null){
+        if (selectedTimePeriod !== null) {
             this.set('timePeriod', selectedTimePeriod);
             this.plot();
         }
diff --git a/src/js/views/SummariesView.js b/src/js/views/SummariesView.js
index 3e60988..71e396e 100644
--- a/src/js/views/SummariesView.js
+++ b/src/js/views/SummariesView.js
@@ -9,7 +9,7 @@ GLOBE.BaseSummariesView = Em.View.extend({
 
     classNames: ['relay-summary-list'],
 
-    didInsertElement: function(){
+    didInsertElement: function() {
         var that = this;
         var $el = this.$();
         var table = $el.dataTable({
@@ -25,29 +25,29 @@ GLOBE.BaseSummariesView = Em.View.extend({
             'aoColumns': this.get('columnDefinition')
         });
 
-        $el.on('click', 'tr', function(){
+        $el.on('click', 'tr', function() {
             // set function scope and parameter ( == view scope )
             that.rowClickedHandler.call(this, that);
         });
         this.set('dataTable', table);
 
         Em.$(window).on('resize', function () {
-            Em.run.throttle(null, function(){
+            Em.run.throttle(null, function() {
                 table.fnAdjustColumnSizing();
             }, 150);
         });
     },
-    createTableDataItem: function(){return {};},
-    rowClickedHandler: function(){},
+    createTableDataItem: function() {return {};},
+    rowClickedHandler: function() {},
 
-    dataChanged: function(){
+    dataChanged: function() {
         var data = this.get('data');
         var table = this.get('dataTable');
 
-        if(data){
+        if (data) {
             var tableData = [];
 
-            for(var i = 0, max = data.length; i < max; i++){
+            for (var i = 0, max = data.length; i < max; i++) {
                 tableData.push(this.createTableDataItem(data[i]));
             }
 
@@ -59,15 +59,15 @@ GLOBE.BaseSummariesView = Em.View.extend({
         }
     }.observes('data.length'),
 
-    willDestroyElement: function(){
+    willDestroyElement: function() {
         this.$('.has-tip').qtip('destroy', true);
     },
 
-    isVisibleChanged: function(){
+    isVisibleChanged: function() {
         var table = this.get('dataTable');
         var visible = this.get('parentView.isVisible');
-        if(visible && table){
-            setTimeout(function(){
+        if (visible && table) {
+            setTimeout(function() {
                 table.fnAdjustColumnSizing();
 
             }, 0);
@@ -113,13 +113,13 @@ GLOBE.RelaySummariesView = GLOBE.BaseSummariesView.extend({
         'mRender': GLOBE.Formatter.boolean,
         'mDataProp': 'running'
     }],
-    rowClickedHandler: function(scope){
+    rowClickedHandler: function(scope) {
         var item = scope.get('dataTable').fnGetData(this);
-        if(item && item.hasOwnProperty('fingerprint') && item.fingerprint.length === 40){
+        if (item && item.hasOwnProperty('fingerprint') && item.fingerprint.length === 40) {
             scope.get('controller').send('showRelayDetail', item.fingerprint);
         }
     },
-    createTableDataItem: function(item){
+    createTableDataItem: function(item) {
         return {
             'running': item.running,
             'nickname': item.nickname,
@@ -166,13 +166,13 @@ GLOBE.BridgeSummariesView = GLOBE.BaseSummariesView.extend({
         'mRender': GLOBE.Formatter.boolean,
         'mDataProp': 'running'
     }],
-    rowClickedHandler: function(scope){
+    rowClickedHandler: function(scope) {
         var item = scope.get('dataTable').fnGetData(this);
-        if(item && item.hasOwnProperty('fingerprint') && item.fingerprint.length === 40){
+        if (item && item.hasOwnProperty('fingerprint') && item.fingerprint.length === 40) {
             scope.get('controller').send('showBridgeDetail', item.fingerprint);
         }
     },
-    createTableDataItem: function(item){
+    createTableDataItem: function(item) {
         return {
             'nickname': item.nickname,
             'advertisedBandwidth': item.advertised_bandwidth,





More information about the tor-commits mailing list