From 3cfcfc01a464f1377e0dcc048f271f9608d41759 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Sat, 7 Dec 2013 15:05:56 -0600 Subject: [PATCH] jshint fixes --- js/controllers/routeController.js | 2 +- js/ext/angular/src/directive/ionicContent.js | 2 +- js/ext/angular/src/directive/ionicRadio.js | 4 +-- js/ext/angular/src/directive/ionicScroll.js | 4 +-- js/ext/angular/src/directive/ionicSlideBox.js | 8 ++--- js/ext/angular/src/directive/ionicTabBar.js | 4 +-- .../angular/src/directive/ionicVirtRepeat.js | 6 ++-- .../src/directive/ionicVirtualRepeat.js | 4 +-- js/ext/angular/src/service/ionicLoading.js | 2 +- .../angular/test/service/ionicGesture.unit.js | 4 +-- js/utils/animate.js | 16 ++++----- js/utils/dom.js | 2 +- js/views/scrollView.js | 34 +++++++++---------- test/js/views/listView.unit.js | 2 +- 14 files changed, 47 insertions(+), 47 deletions(-) diff --git a/js/controllers/routeController.js b/js/controllers/routeController.js index e2c7c9593a..486bc82653 100644 --- a/js/controllers/routeController.js +++ b/js/controllers/routeController.js @@ -84,7 +84,7 @@ this.loadUrl() || this.loadUrl(this.getHash()); }, getFragment: function(fragment, forcePushState) { - if (fragment == null) { + if (fragment === null) { fragment = this.location.pathname; var root = this.root.replace(this.trailingSlash, ''); if (!fragment.indexOf(root)) fragment = fragment.substr(root.length); diff --git a/js/ext/angular/src/directive/ionicContent.js b/js/ext/angular/src/directive/ionicContent.js index 3b4a0519f3..2d51189d43 100644 --- a/js/ext/angular/src/directive/ionicContent.js +++ b/js/ext/angular/src/directive/ionicContent.js @@ -94,7 +94,7 @@ angular.module('ionic.ui.content', []) $timeout(function() { sv = new ionic.views.Scroll({ el: $element[0], - scrollEventInterval: parseInt($scope.scrollEventInterval) || 40 + scrollEventInterval: parseInt($scope.scrollEventInterval, 10) || 40 }); // Activate pull-to-refresh diff --git a/js/ext/angular/src/directive/ionicRadio.js b/js/ext/angular/src/directive/ionicRadio.js index c46911d8d7..f9613d02e4 100644 --- a/js/ext/angular/src/directive/ionicRadio.js +++ b/js/ext/angular/src/directive/ionicRadio.js @@ -130,12 +130,12 @@ angular.module('ionic.ui.radio', []) $scope.$on('radioButton.select', function(e, val) { if(val == $scope.$eval($attr.ngValue)) { $element.addClass('active'); - }; + } }); $element.bind('click', clickHandler); } - } + }; }); })(window.ionic); diff --git a/js/ext/angular/src/directive/ionicScroll.js b/js/ext/angular/src/directive/ionicScroll.js index ae0ed0e604..a2e967fcb6 100644 --- a/js/ext/angular/src/directive/ionicScroll.js +++ b/js/ext/angular/src/directive/ionicScroll.js @@ -87,9 +87,9 @@ angular.module('ionic.ui.scroll', []) // Let child scopes access this $scope.$parent.scrollView = sv; }, 500); - } + }; } - } + }; }]); })(); diff --git a/js/ext/angular/src/directive/ionicSlideBox.js b/js/ext/angular/src/directive/ionicSlideBox.js index eb600963b4..4f6749cf38 100644 --- a/js/ext/angular/src/directive/ionicSlideBox.js +++ b/js/ext/angular/src/directive/ionicSlideBox.js @@ -47,7 +47,7 @@ angular.module('ionic.ui.slideBox', []) }); } } - } + }; }]) .directive('slide', function() { @@ -60,9 +60,9 @@ angular.module('ionic.ui.slideBox', []) compile: function(element, attr, transclude) { return function($scope, $element, $attr, slideBoxCtrl) { slideBoxCtrl.slideAdded(); - } + }; } - } + }; }) .directive('pager', function() { @@ -71,7 +71,7 @@ angular.module('ionic.ui.slideBox', []) replace: true, require: '^slideBox', template: '
' - } + }; }); diff --git a/js/ext/angular/src/directive/ionicTabBar.js b/js/ext/angular/src/directive/ionicTabBar.js index 0db4ce4e4f..4876030a38 100644 --- a/js/ext/angular/src/directive/ionicTabBar.js +++ b/js/ext/angular/src/directive/ionicTabBar.js @@ -171,7 +171,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) }); } }); - } + }; } }; }]) @@ -232,6 +232,6 @@ angular.module('ionic.ui.tabs', ['ngAnimate']) transclude: true, template: '
' + '
' - } + }; }); diff --git a/js/ext/angular/src/directive/ionicVirtRepeat.js b/js/ext/angular/src/directive/ionicVirtRepeat.js index 7cd352e6ad..e98fd76891 100644 --- a/js/ext/angular/src/directive/ionicVirtRepeat.js +++ b/js/ext/angular/src/directive/ionicVirtRepeat.js @@ -14,9 +14,9 @@ angular.module('ionic.ui.virtRepeat', []) var virtualList = ctrls[1]; virtualList.listView.renderViewport = function(high, low, start, end) { - } - } + }; + }; } - } + }; }); })(ionic); diff --git a/js/ext/angular/src/directive/ionicVirtualRepeat.js b/js/ext/angular/src/directive/ionicVirtualRepeat.js index f3debc52fd..3107a6d8e4 100644 --- a/js/ext/angular/src/directive/ionicVirtualRepeat.js +++ b/js/ext/angular/src/directive/ionicVirtualRepeat.js @@ -52,7 +52,7 @@ function findViewportAndContent(startElement){ break; } } - if( n == null ){ + if( n === null ){ // That element should work as a viewport. return { viewport: angular.element(e), @@ -320,7 +320,7 @@ angular.module('ionic.ui.virtualRepeat', []) // The watch on the collection is just a watch on the length of the // collection. We don't care if the content changes. scope.$watch(sfVirtualRepeatWatchExpression, sfVirtualRepeatListener, true); - } + }; } }; }]); diff --git a/js/ext/angular/src/service/ionicLoading.js b/js/ext/angular/src/service/ionicLoading.js index 559fcf1fbd..98cea67eea 100644 --- a/js/ext/angular/src/service/ionicLoading.js +++ b/js/ext/angular/src/service/ionicLoading.js @@ -27,7 +27,7 @@ angular.module('ionic.service.loading', ['ionic.ui.loading']) // Make sure there is only one loading element on the page at one point in time var existing = angular.element($document[0].querySelector('.loading-backdrop')); if(existing.length) { - var scope = existing.scope(); + scope = existing.scope(); if(scope.loading) { scope.loading.show(); return scope.loading; diff --git a/js/ext/angular/test/service/ionicGesture.unit.js b/js/ext/angular/test/service/ionicGesture.unit.js index 3e07deac0e..3ff26dc4c6 100644 --- a/js/ext/angular/test/service/ionicGesture.unit.js +++ b/js/ext/angular/test/service/ionicGesture.unit.js @@ -40,9 +40,9 @@ describe('Ionic Gesture Service', function() { gesture.off(g, 'drag', handlers.dragHandle); - var event = new CustomEvent('drag', { target: el }); + event = new CustomEvent('drag', { target: el }); el.dispatchEvent(event); expect(handlers.dragHandle).toHaveBeenCalled(); }); -}) +}); diff --git a/js/utils/animate.js b/js/utils/animate.js index 798a3384ae..9617e8097b 100644 --- a/js/utils/animate.js +++ b/js/utils/animate.js @@ -1,15 +1,15 @@ (function(ionic) { var bezierCoord = function (x,y) { - if(!x) var x=0; - if(!y) var y=0; + if(!x) x=0; + if(!y) y=0; return {x: x, y: y}; - } + }; - function B1(t) { return t*t*t } - function B2(t) { return 3*t*t*(1-t) } - function B3(t) { return 3*t*(1-t)*(1-t) } - function B4(t) { return (1-t)*(1-t)*(1-t) } + function B1(t) { return t*t*t; } + function B2(t) { return 3*t*t*(1-t); } + function B3(t) { return 3*t*(1-t)*(1-t); } + function B4(t) { return (1-t)*(1-t)*(1-t); } ionic.Animator = { // Quadratic bezier solver @@ -64,7 +64,7 @@ if (Math.abs(x2 - x) < epsilon) return curveY(t2); if (x > x2) t0 = t2; else t1 = t2; - t2 = (t1 - t0) * .5 + t0; + t2 = (t1 - t0) * 0.5 + t0; } // Failure diff --git a/js/utils/dom.js b/js/utils/dom.js index 32ddc80f1c..ae34093d81 100644 --- a/js/utils/dom.js +++ b/js/utils/dom.js @@ -20,7 +20,7 @@ }; } } - return null + return null; }, getChildIndex: function(element, type) { diff --git a/js/views/scrollView.js b/js/views/scrollView.js index af85b4aa39..1347bfe81a 100644 --- a/js/views/scrollView.js +++ b/js/views/scrollView.js @@ -59,7 +59,7 @@ if (isNative) { return function(callback, root) { - requestFrame(callback, root) + requestFrame(callback, root); }; } @@ -119,7 +119,7 @@ * @return {Boolean} Whether the animation was stopped (aka, was running before) */ stop: function(id) { - var cleared = running[id] != null; + var cleared = running[id] !== null; if (cleared) { running[id] = null; } @@ -135,7 +135,7 @@ * @return {Boolean} Whether the animation is still running */ isRunning: function(id) { - return running[id] != null; + return running[id] !== null; }, @@ -218,7 +218,7 @@ var value = easingMethod ? easingMethod(percent) : percent; if ((stepCallback(value, now, render) === false || percent === 1) && render) { running[id] = null; - completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, percent === 1 || duration == null); + completedCallback && completedCallback(desiredFrames - (dropCounter / ((now - start) / millisecondsPerSecond)), id, percent === 1 || duration === null); } else if (render) { lastFrame = now; core.effect.Animate.requestAnimationFrame(step, root); @@ -606,10 +606,10 @@ ionic.views.Scroll = ionic.views.View.inherit({ // Update Scroller dimensions for changed content // Add padding to bottom of content this.setDimensions( - Math.min(this.__container.clientWidth, this.__container.parentElement.clientWidth), - Math.min(this.__container.clientHeight, this.__container.parentElement.clientHeight), - this.__content.offsetWidth, - this.__content.offsetHeight+20); + Math.min(this.__container.clientWidth, this.__container.parentElement.clientWidth), + Math.min(this.__container.clientHeight, this.__container.parentElement.clientHeight), + this.__content.offsetWidth, + this.__content.offsetHeight+20); }, /* --------------------------------------------------------------------------- @@ -622,7 +622,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ var content = this.__content; - var docStyle = document.documentElement.style; + var docStyle = document.documentElement.style; var engine; if ('MozAppearance' in docStyle) { @@ -859,11 +859,11 @@ ionic.views.Scroll = ionic.views.View.inherit({ var oldLevel = self.__zoomLevel; // Normalize input origin to center of viewport if not defined - if (originLeft == null) { + if (originLeft === null) { originLeft = self.__clientWidth / 2; } - if (originTop == null) { + if (originTop === null) { originTop = self.__clientHeight / 2; } @@ -933,7 +933,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ } // Correct coordinates based on new zoom level - if (zoom != null && zoom !== self.__zoomLevel) { + if (zoom !== null && zoom !== self.__zoomLevel) { if (!self.options.zooming) { throw new Error("Zooming is not enabled!"); @@ -1041,7 +1041,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ doTouchStart: function(touches, timeStamp) { // Array-like check is enough here - if (touches.length == null) { + if (touches.length === null) { throw new Error("Invalid touch list: " + touches); } @@ -1127,7 +1127,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ doTouchMove: function(touches, timeStamp, scale) { // Array-like check is enough here - if (touches.length == null) { + if (touches.length === null) { throw new Error("Invalid touch list: " + touches); } @@ -1172,7 +1172,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ var level = self.__zoomLevel; // Work with scaling - if (scale != null && self.options.zooming) { + if (scale !== null && self.options.zooming) { var oldLevel = level; @@ -1237,7 +1237,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ scrollTop += (moveY / 2 * this.options.speedMultiplier); // Support pull-to-refresh (only when only y is scrollable) - if (!self.__enableScrollX && self.__refreshHeight != null) { + if (!self.__enableScrollX && self.__refreshHeight !== null) { if (!self.__refreshActive && scrollTop <= -self.__refreshHeight) { @@ -1529,7 +1529,7 @@ ionic.views.Scroll = ionic.views.View.inherit({ var self = this; - if (zoomLevel == null) { + if (zoomLevel === null) { zoomLevel = self.__zoomLevel; } diff --git a/test/js/views/listView.unit.js b/test/js/views/listView.unit.js index ed60a98aaa..53abdb831a 100644 --- a/test/js/views/listView.unit.js +++ b/test/js/views/listView.unit.js @@ -3,7 +3,7 @@ describe('List View', function() { beforeEach(function() { h = document.createElement('div'); h.id = 'content'; - h.className = 'scroll' + h.className = 'scroll'; var l = document.createElement('ul'); l.className = 'list scroll'; h.appendChild(l);