jshint fixes

This commit is contained in:
Adam Bradley
2013-12-07 15:05:56 -06:00
parent bad322d2da
commit 3cfcfc01a4
14 changed files with 47 additions and 47 deletions

View File

@@ -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);

View File

@@ -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

View File

@@ -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);

View File

@@ -87,9 +87,9 @@ angular.module('ionic.ui.scroll', [])
// Let child scopes access this
$scope.$parent.scrollView = sv;
}, 500);
}
};
}
}
};
}]);
})();

View File

@@ -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: '<div class="slide-box-pager"><span ng-repeat="slide in slides"><i class="icon ion-record"></i></span></div>'
}
};
});

View File

@@ -171,7 +171,7 @@ angular.module('ionic.ui.tabs', ['ngAnimate'])
});
}
});
}
};
}
};
}])
@@ -232,6 +232,6 @@ angular.module('ionic.ui.tabs', ['ngAnimate'])
transclude: true,
template: '<div class="tabs tabs-primary" ng-transclude>' +
'</div>'
}
};
});

View File

@@ -14,9 +14,9 @@ angular.module('ionic.ui.virtRepeat', [])
var virtualList = ctrls[1];
virtualList.listView.renderViewport = function(high, low, start, end) {
}
}
};
};
}
}
};
});
})(ionic);

View File

@@ -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);
}
};
}
};
}]);

View File

@@ -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;

View File

@@ -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();
});
})
});

View File

@@ -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

View File

@@ -20,7 +20,7 @@
};
}
}
return null
return null;
},
getChildIndex: function(element, type) {

View File

@@ -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;
}

View File

@@ -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);