From 223d89624d8ed33220271b6e402b8da6df5b0756 Mon Sep 17 00:00:00 2001 From: Adam Bradley Date: Mon, 2 Feb 2015 20:49:04 -0600 Subject: [PATCH] style(): main angular references --- .../controller/infiniteScrollController.js | 4 ++-- js/angular/controller/sideMenuController.js | 4 ++-- js/angular/controller/tabsController.js | 6 +++--- js/angular/directive/collectionRepeat.js | 8 ++++---- js/angular/directive/content.js | 4 ++-- js/angular/directive/infiniteScroll.js | 4 ++-- js/angular/directive/item.js | 6 +++--- js/angular/directive/itemFloatingLabel.js | 8 ++++---- js/angular/directive/popoverView.js | 2 +- js/angular/directive/scroll.js | 2 +- js/angular/directive/slideBox.js | 2 +- js/angular/directive/tab.js | 2 +- js/angular/main.js | 4 ++-- js/angular/service/actionSheet.js | 16 ++++++++-------- js/angular/service/collectionRepeatManager.js | 12 ++++++------ js/angular/service/decorators/location.js | 2 +- js/angular/service/loading.js | 8 ++++---- js/angular/service/modal.js | 2 +- js/angular/service/popover.js | 2 +- js/angular/service/popup.js | 8 ++++---- js/angular/service/position.js | 2 +- js/views/listView.js | 2 +- 22 files changed, 55 insertions(+), 55 deletions(-) diff --git a/js/angular/controller/infiniteScrollController.js b/js/angular/controller/infiniteScrollController.js index e1b0a2c7da..3e6d8b561a 100644 --- a/js/angular/controller/infiniteScrollController.js +++ b/js/angular/controller/infiniteScrollController.js @@ -9,11 +9,11 @@ IonicModule self.isLoading = false; $scope.icon = function() { - return angular.isDefined($attrs.icon) ? $attrs.icon : 'ion-load-d'; + return isDefined($attrs.icon) ? $attrs.icon : 'ion-load-d'; }; $scope.spinner = function() { - return angular.isDefined($attrs.spinner) ? $attrs.spinner : ''; + return isDefined($attrs.spinner) ? $attrs.spinner : ''; }; $scope.$on('scroll.infiniteScrollComplete', function() { diff --git a/js/angular/controller/sideMenuController.js b/js/angular/controller/sideMenuController.js index 092df9d24f..2580029d56 100644 --- a/js/angular/controller/sideMenuController.js +++ b/js/angular/controller/sideMenuController.js @@ -348,7 +348,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io self.edgeThresholdEnabled = false; self.edgeDragThreshold = function(value) { if (arguments.length) { - if (angular.isNumber(value) && value > 0) { + if (isNumber(value) && value > 0) { self.edgeThreshold = value; self.edgeThresholdEnabled = true; } else { @@ -386,7 +386,7 @@ function($scope, $attrs, $ionicSideMenuDelegate, $ionicPlatform, $ionicBody, $io $scope.sideMenuContentTranslateX = 0; - var deregisterBackButtonAction = angular.noop; + var deregisterBackButtonAction = noop; var closeSideMenu = angular.bind(self, self.close); $scope.$watch(function() { diff --git a/js/angular/controller/tabsController.js b/js/angular/controller/tabsController.js index 9aa92ec243..1d287565df 100644 --- a/js/angular/controller/tabsController.js +++ b/js/angular/controller/tabsController.js @@ -45,14 +45,14 @@ function($scope, $element, $ionicHistory) { if (tab.$tabSelected) { selectedTab = selectedTabIndex = null; tab.$tabSelected = false; - (tab.onDeselect || angular.noop)(); + (tab.onDeselect || noop)(); tab.$broadcast && tab.$broadcast('$ionicHistory.deselect'); } }; self.select = function(tab, shouldEmitEvent) { var tabIndex; - if (angular.isNumber(tab)) { + if (isNumber(tab)) { tabIndex = tab; if (tabIndex >= self.tabs.length) return; tab = self.tabs[tabIndex]; @@ -83,7 +83,7 @@ function($scope, $element, $ionicHistory) { //Use a funny name like $tabSelected so the developer doesn't overwrite the var in a child scope tab.$tabSelected = true; - (tab.onSelect || angular.noop)(); + (tab.onSelect || noop)(); if (shouldEmitEvent) { $scope.$emit('$ionicHistory.change', { diff --git a/js/angular/directive/collectionRepeat.js b/js/angular/directive/collectionRepeat.js index 001aa6c416..47a8dd67b1 100644 --- a/js/angular/directive/collectionRepeat.js +++ b/js/angular/directive/collectionRepeat.js @@ -144,7 +144,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) { terminal: true, $$tlb: true, require: ['^$ionicScroll', '^?ionNavView'], - controller: [function(){}], + controller: [function() {}], link: function($scope, $element, $attr, ctrls, $transclude) { var scrollCtrl = ctrls[0]; var navViewCtrl = ctrls[1]; @@ -204,7 +204,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) { var collectionRepeatManager = new $collectionRepeatManager({ dataSource: dataSource, element: scrollCtrl.$element, - scrollView: scrollCtrl.scrollView, + scrollView: scrollCtrl.scrollView }); var listExprParsed = $parse(listExpr); @@ -224,7 +224,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) { var before = true; forEach(scrollViewContent.children, function(node, i) { - if ( ionic.DomUtil.elementIsDescendant($element[0], node, scrollViewContent) ) { + if (ionic.DomUtil.elementIsDescendant($element[0], node, scrollViewContent)) { before = false; } else { if (node.hasAttribute('collection-repeat-ignore')) return; @@ -271,7 +271,7 @@ function($collectionRepeatManager, $collectionDataSource, $parse) { collectionRepeatManager.destroy(); dataSource.destroy(); ionic.off('resize', rerenderOnResize, window); - (deregisterViewListener || angular.noop)(); + (deregisterViewListener || noop)(); }); } }; diff --git a/js/angular/directive/content.js b/js/angular/directive/content.js index 8264ffff42..adfe2c404f 100644 --- a/js/angular/directive/content.js +++ b/js/angular/directive/content.js @@ -101,7 +101,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) { }); $scope.direction = $scope.direction || 'y'; - if (angular.isDefined($attr.padding)) { + if (isDefined($attr.padding)) { $scope.$watch($attr.padding, function(newVal) { (innerElement || $element).toggleClass('padding', !!newVal); }); @@ -138,7 +138,7 @@ function($timeout, $controller, $ionicBind, $ionicConfig) { }); $scope.$on('$destroy', function() { - scrollViewOptions.scrollingComplete = angular.noop; + scrollViewOptions.scrollingComplete = noop; delete scrollViewOptions.el; innerElement = null; $element = null; diff --git a/js/angular/directive/infiniteScroll.js b/js/angular/directive/infiniteScroll.js index 2425861c97..b76f5780ff 100644 --- a/js/angular/directive/infiniteScroll.js +++ b/js/angular/directive/infiniteScroll.js @@ -70,7 +70,7 @@ IonicModule return { restrict: 'E', require: ['?^$ionicScroll', 'ionInfiniteScroll'], - template: function($element, $attrs){ + template: function($element, $attrs) { if ($attrs.icon) return ''; return ''; }, @@ -100,7 +100,7 @@ IonicModule infiniteScrollCtrl.scrollEl.addEventListener('scroll', infiniteScrollCtrl.checkBounds); } // Optionally check bounds on start after scrollView is fully rendered - var doImmediateCheck = angular.isDefined($attrs.immediateCheck) ? $scope.$eval($attrs.immediateCheck) : true; + var doImmediateCheck = isDefined($attrs.immediateCheck) ? $scope.$eval($attrs.immediateCheck) : true; if (doImmediateCheck) { $timeout(function() { infiniteScrollCtrl.checkBounds(); }); } diff --git a/js/angular/directive/item.js b/js/angular/directive/item.js index 28c8737163..c5fd9b8f0e 100644 --- a/js/angular/directive/item.js +++ b/js/angular/directive/item.js @@ -37,9 +37,9 @@ IonicModule }], scope: true, compile: function($element, $attrs) { - var isAnchor = angular.isDefined($attrs.href) || - angular.isDefined($attrs.ngHref) || - angular.isDefined($attrs.uiSref); + var isAnchor = isDefined($attrs.href) || + isDefined($attrs.ngHref) || + isDefined($attrs.uiSref); var isComplexItem = isAnchor || //Lame way of testing, but we have to know at compile what to do with the element /ion-(delete|option|reorder)-button/i.test($element.html()); diff --git a/js/angular/directive/itemFloatingLabel.js b/js/angular/directive/itemFloatingLabel.js index cb8e5275d3..17c601a493 100644 --- a/js/angular/directive/itemFloatingLabel.js +++ b/js/angular/directive/itemFloatingLabel.js @@ -8,10 +8,10 @@ IonicModule var input = el.querySelector('input, textarea'); var inputLabel = el.querySelector('.input-label'); - if ( !input || !inputLabel ) return; + if (!input || !inputLabel) return; var onInput = function() { - if ( input.value ) { + if (input.value) { inputLabel.classList.add('has-input'); } else { inputLabel.classList.remove('has-input'); @@ -20,8 +20,8 @@ IonicModule input.addEventListener('input', onInput); - var ngModelCtrl = angular.element(input).controller('ngModel'); - if ( ngModelCtrl ) { + var ngModelCtrl = jqLite(input).controller('ngModel'); + if (ngModelCtrl) { ngModelCtrl.$render = function() { input.value = ngModelCtrl.$viewValue || ''; onInput(); diff --git a/js/angular/directive/popoverView.js b/js/angular/directive/popoverView.js index 4df9f6a979..ff9729b5c1 100644 --- a/js/angular/directive/popoverView.js +++ b/js/angular/directive/popoverView.js @@ -3,7 +3,7 @@ IonicModule return { restrict: 'E', compile: function(element) { - element.append( angular.element('
') ); + element.append(jqLite('
')); element.addClass('popover'); } }; diff --git a/js/angular/directive/scroll.js b/js/angular/directive/scroll.js index c349bce41d..34f922807a 100644 --- a/js/angular/directive/scroll.js +++ b/js/angular/directive/scroll.js @@ -74,7 +74,7 @@ function($timeout, $controller, $ionicBind) { }); $scope.direction = $scope.direction || 'y'; - if (angular.isDefined($attr.padding)) { + if (isDefined($attr.padding)) { $scope.$watch($attr.padding, function(newVal) { innerElement.toggleClass('padding', !!newVal); }); diff --git a/js/angular/directive/slideBox.js b/js/angular/directive/slideBox.js index 4c42e54f3d..8dec991f30 100644 --- a/js/angular/directive/slideBox.js +++ b/js/angular/directive/slideBox.js @@ -87,7 +87,7 @@ function($timeout, $compile, $ionicSlideBoxDelegate, $ionicHistory) { slider.enableSlide($scope.$eval($attrs.disableScroll) !== true); $scope.$watch('activeSlide', function(nv) { - if(angular.isDefined(nv)){ + if(isDefined(nv)){ slider.slide(nv); } }); diff --git a/js/angular/directive/tab.js b/js/angular/directive/tab.js index cb8b9c1ede..a63d702afc 100644 --- a/js/angular/directive/tab.js +++ b/js/angular/directive/tab.js @@ -43,7 +43,7 @@ function($compile, $ionicConfig, $ionicBind, $ionicViewSwitcher) { //Returns ' key="value"' if value exists function attrStr(k, v) { - return angular.isDefined(v) ? ' ' + k + '="' + v + '"' : ''; + return isDefined(v) ? ' ' + k + '="' + v + '"' : ''; } return { restrict: 'E', diff --git a/js/angular/main.js b/js/angular/main.js index 0f4e0bbd95..40b363c462 100644 --- a/js/angular/main.js +++ b/js/angular/main.js @@ -4,5 +4,5 @@ var IonicModule = angular.module('ionic', ['ngAnimate', 'ngSanitize', 'ui.router isDefined = angular.isDefined, isNumber = angular.isNumber, isString = angular.isString, - jqLite = angular.element; - + jqLite = angular.element, + noop = angular.noop; diff --git a/js/angular/service/actionSheet.js b/js/angular/service/actionSheet.js index 0ceb622b97..4de466c4c0 100644 --- a/js/angular/service/actionSheet.js +++ b/js/angular/service/actionSheet.js @@ -94,11 +94,11 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP function actionSheet(opts) { var scope = $rootScope.$new(true); - angular.extend(scope, { - cancel: angular.noop, - destructiveButtonClicked: angular.noop, - buttonClicked: angular.noop, - $deregisterBackButton: angular.noop, + extend(scope, { + cancel: noop, + destructiveButtonClicked: noop, + buttonClicked: noop, + $deregisterBackButton: noop, buttons: [], cancelOnStateChange: true }, opts || {}); @@ -123,7 +123,7 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP var stateChangeListenDone = scope.cancelOnStateChange ? $rootScope.$on('$stateChangeSuccess', function() { scope.cancel(); }) : - angular.noop; + noop; // removes the actionSheet from the screen scope.removeSheet = function(done) { @@ -144,7 +144,7 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP element.remove(); // scope.cancel.$scope is defined near the bottom scope.cancel.$scope = sheetEl = null; - (done || angular.noop)(); + (done || noop)(); }); }; @@ -156,7 +156,7 @@ function($rootScope, $compile, $animate, $timeout, $ionicTemplateLoader, $ionicP $animate.addClass(element, 'active').then(function() { if (scope.removed) return; - (done || angular.noop)(); + (done || noop)(); }); $timeout(function() { if (scope.removed) return; diff --git a/js/angular/service/collectionRepeatManager.js b/js/angular/service/collectionRepeatManager.js index ccb64f7751..6b3e64484d 100644 --- a/js/angular/service/collectionRepeatManager.js +++ b/js/angular/service/collectionRepeatManager.js @@ -41,7 +41,7 @@ function($rootScope, $timeout) { return this.scrollView.__clientWidth; }; this.transformString = function(y, x) { - return 'translate3d('+x+'px,'+y+'px,0)'; + return 'translate3d(' + x + 'px,' + y + 'px,0)'; }; this.primaryDimension = function(dim) { return dim.height; @@ -65,7 +65,7 @@ function($rootScope, $timeout) { return this.scrollView.__clientHeight; }; this.transformString = function(x, y) { - return 'translate3d('+x+'px,'+y+'px,0)'; + return 'translate3d(' + x + 'px,' + y + 'px,0)'; }; this.primaryDimension = function(dim) { return dim.width; @@ -79,8 +79,8 @@ function($rootScope, $timeout) { CollectionRepeatManager.prototype = { destroy: function() { this.renderedItems = {}; - this.render = angular.noop; - this.calculateDimensions = angular.noop; + this.render = noop; + this.calculateDimensions = noop; this.dimensions = []; }, @@ -225,7 +225,7 @@ function($rootScope, $timeout) { } //Scrolling down } else { - while ( (rect = this.dimensions[i + 1]) && rect.primaryPos < scrollValue) { + while ((rect = this.dimensions[i + 1]) && rect.primaryPos < scrollValue) { i++; } } @@ -238,7 +238,7 @@ function($rootScope, $timeout) { render: function(shouldRedrawAll) { var self = this; var i; - var isOutOfBounds = ( this.currentIndex >= this.dataSource.getLength() ); + var isOutOfBounds = (this.currentIndex >= this.dataSource.getLength()); // We want to remove all the items and redraw everything if we're out of bounds // or a flag is passed in. if (isOutOfBounds || shouldRedrawAll) { diff --git a/js/angular/service/decorators/location.js b/js/angular/service/decorators/location.js index 58887d2dc5..bb25412c6b 100644 --- a/js/angular/service/decorators/location.js +++ b/js/angular/service/decorators/location.js @@ -11,7 +11,7 @@ function($provide) { //found nearest to body's scrollTop is set to scroll to an element //with that ID. $location.hash = function(value) { - if (angular.isDefined(value)) { + if (isDefined(value)) { $timeout(function() { var scroll = document.querySelector('.scroll-content'); if (scroll) diff --git a/js/angular/service/loading.js b/js/angular/service/loading.js index 2650195b2a..a94f8f5939 100644 --- a/js/angular/service/loading.js +++ b/js/angular/service/loading.js @@ -71,8 +71,8 @@ function($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop, var loaderInstance; //default values - var deregisterBackAction = angular.noop; - var deregisterStateListener = angular.noop; + var deregisterBackAction = noop; + var deregisterStateListener = noop; var loadingShowDelay = $q.when(); return { @@ -142,7 +142,7 @@ function($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop, deregisterBackAction(); //Disable hardware back button while loading deregisterBackAction = $ionicPlatform.registerBackButtonAction( - angular.noop, + noop, PLATFORM_BACK_BUTTON_PRIORITY_LOADING ); @@ -197,7 +197,7 @@ function($ionicLoadingConfig, $ionicBody, $ionicTemplateLoader, $ionicBackdrop, //If loading.show() was called previously, cancel it and show with our new options loadingShowDelay && $timeout.cancel(loadingShowDelay); - loadingShowDelay = $timeout(angular.noop, delay); + loadingShowDelay = $timeout(noop, delay); loadingShowDelay.then(getLoader).then(function(loader) { if (options.hideOnStateChange) { diff --git a/js/angular/service/modal.js b/js/angular/service/modal.js index 3c75481088..e9c54ad9db 100644 --- a/js/angular/service/modal.js +++ b/js/angular/service/modal.js @@ -150,7 +150,7 @@ function($rootScope, $ionicBody, $compile, $timeout, $ionicPlatform, $ionicTempl self._isShown = true; self._deregisterBackButton = $ionicPlatform.registerBackButtonAction( - self.hardwareBackButtonClose ? angular.bind(self, self.hide) : angular.noop, + self.hardwareBackButtonClose ? angular.bind(self, self.hide) : noop, PLATFORM_BACK_BUTTON_PRIORITY_MODAL ); diff --git a/js/angular/service/popover.js b/js/angular/service/popover.js index 3bfa6ebf09..cee1037a55 100644 --- a/js/angular/service/popover.js +++ b/js/angular/service/popover.js @@ -89,7 +89,7 @@ function($ionicModal, $ionicPosition, $document, $window) { }; function positionView(target, popoverEle) { - var targetEle = angular.element(target.target || target); + var targetEle = jqLite(target.target || target); var buttonOffset = $ionicPosition.offset(targetEle); var popoverWidth = popoverEle.prop('offsetWidth'); var popoverHeight = popoverEle.prop('offsetHeight'); diff --git a/js/angular/service/popup.js b/js/angular/service/popup.js index 0d93e72a29..bdfd3aae41 100644 --- a/js/angular/service/popup.js +++ b/js/angular/service/popup.js @@ -312,7 +312,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB subTitle: options.subTitle, cssClass: options.cssClass, $buttonTapped: function(button, event) { - var result = (button.onTap || angular.noop)(event); + var result = (button.onTap || noop)(event); event = event.originalEvent || event; //jquery events if (!event.defaultPrevented) { @@ -335,7 +335,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB }); }; self.hide = function(callback) { - callback = callback || angular.noop; + callback = callback || noop; if (!self.isShown) return callback(); self.isShown = false; @@ -370,7 +370,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB previousPopup.hide(); } - var resultPromise = $timeout(angular.noop, previousPopup ? config.stackPushDelay : 0) + var resultPromise = $timeout(noop, previousPopup ? config.stackPushDelay : 0) .then(function() { return popupPromise; }) .then(function(popup) { if (!previousPopup) { @@ -411,7 +411,7 @@ function($ionicTemplateLoader, $ionicBackdrop, $q, $timeout, $rootScope, $ionicB $timeout(function() { $ionicBackdrop.release(); }, config.stackPushDelay || 0); - ($ionicPopup._backButtonActionDone || angular.noop)(); + ($ionicPopup._backButtonActionDone || noop)(); } return result; }); diff --git a/js/angular/service/position.js b/js/angular/service/position.js index 4c7d840dd1..57da4afa4f 100644 --- a/js/angular/service/position.js +++ b/js/angular/service/position.js @@ -58,7 +58,7 @@ IonicModule var offsetParentBCR = { top: 0, left: 0 }; var offsetParentEl = parentOffsetEl(element[0]); if (offsetParentEl != $document[0]) { - offsetParentBCR = this.offset(angular.element(offsetParentEl)); + offsetParentBCR = this.offset(jqLite(offsetParentEl)); offsetParentBCR.top += offsetParentEl.clientTop - offsetParentEl.scrollTop; offsetParentBCR.left += offsetParentEl.clientLeft - offsetParentEl.scrollLeft; } diff --git a/js/views/listView.js b/js/views/listView.js index 2de0ad3bee..20807151c0 100644 --- a/js/views/listView.js +++ b/js/views/listView.js @@ -173,7 +173,7 @@ if (!_this._lastDrag) { _this._lastDrag = {}; } - angular.extend(_this._lastDrag, _this._currentDrag); + extend(_this._lastDrag, _this._currentDrag); if (_this._currentDrag) { _this._currentDrag.buttons = null; _this._currentDrag.content = null;