diff --git a/Gruntfile.js b/Gruntfile.js index 0fc3e67622..237fc6c18c 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -45,9 +45,15 @@ module.exports = function(grunt) { jshint: { files: ['Gruntfile.js', 'js/**/*.js', 'test/**/*.js'], options: { + // Disable short circuit check, I will not bend to its will. + expr: true, + browser: true, + multistr: true, // options here to override JSHint defaults globals: { jQuery: true, + ionic: true, + angular: true, console: true, module: true, document: true diff --git a/dist/css/ionic-ios7.css b/dist/css/ionic-ios7.css index e0f643f98d..ab4fdcde45 100644 --- a/dist/css/ionic-ios7.css +++ b/dist/css/ionic-ios7.css @@ -1577,7 +1577,6 @@ input[type="checkbox"][readonly] { .button { position: relative; display: block; - margin: 10px 0 10px 0; padding: 8px 12px; width: 100%; border-width: 0; diff --git a/dist/css/ionic-scoped.css b/dist/css/ionic-scoped.css index 82a18b7c66..11e20443d9 100644 --- a/dist/css/ionic-scoped.css +++ b/dist/css/ionic-scoped.css @@ -2204,7 +2204,6 @@ .ionic .button { position: relative; display: block; - margin: 10px 0 10px 0; padding: 8px 12px; width: 100%; border-width: 0; diff --git a/dist/css/ionic.css b/dist/css/ionic.css index 64e1a379ec..b11044342e 100644 --- a/dist/css/ionic.css +++ b/dist/css/ionic.css @@ -2695,7 +2695,6 @@ input[type="checkbox"][readonly] { .button { position: relative; display: block; - margin: 10px 0 10px 0; padding: 8px 12px; width: 100%; border-width: 0; diff --git a/dist/js/ionic-angular.js b/dist/js/ionic-angular.js index dc2f56445a..f6004ca1b8 100644 --- a/dist/js/ionic-angular.js +++ b/dist/js/ionic-angular.js @@ -33,7 +33,7 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh scope.sheet.hide(); //scope.$destroy(); opts.cancel(); - } + }; scope.buttonClicked = function(index) { // Check if the button click event returned true, which means @@ -51,17 +51,17 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh scope.sheet.hide(); //scope.$destroy(); } - } + }; // Compile the template var element = $compile('')(scope); - var scope = element.scope(); + var s = element.scope(); $document[0].body.appendChild(element[0]); var sheet = new ionic.views.ActionSheet({el: element[0] }); - scope.sheet = sheet; + s.sheet = sheet; sheet.show(); @@ -71,6 +71,16 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh }]); ; ; +angular.module('ionic.service.gesture', []) + +.factory('Gesture', [function() { + return { + on: function(eventType, cb, element) { + return window.ionic.onGesture(eventType, cb, element); + } + }; +}]); +; angular.module('ionic.service.modal', ['ionic.service']) @@ -125,9 +135,12 @@ angular.module('ionic.service', []) return deferred.promise; } - } + }; }]); ; +(function() { +'use strict'; + angular.module('ionic.ui.actionSheet', []) .directive('actionSheet', function() { @@ -152,9 +165,14 @@ angular.module('ionic.ui.actionSheet', []) '' + '' + '' - } + }; }); + +})(); ; +(function() { +'use strict'; + angular.module('ionic.ui.checkbox', []) @@ -193,8 +211,14 @@ angular.module('ionic.ui.checkbox', []) $scope.checkbox.val(ngModel.$viewValue); }; } - } + }; }); + +})(); +; +(function() { +'use strict'; + angular.module('ionic.ui.content', []) // The content directive is a core scrollable content area @@ -221,11 +245,15 @@ angular.module('ionic.ui.content', []) c.addClass('has-tabs'); } c.append(transclude($scope)); - } + }; } - } -}) + }; +}); +})(); ; +(function() { +'use strict'; + angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) .directive('listItem', function() { @@ -234,7 +262,6 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) require: '^list', replace: true, transclude: true, - scope: true, scope: { item: '=', onSelect: '&', @@ -270,7 +297,7 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) $scope.isEditing = v; }); } - } + }; }) .directive('list', function() { @@ -306,11 +333,16 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) if(attr.animation) { $element.addClass(attr.animation); } - } + }; } - } -}) + }; +}); + +})(); ; +(function() { +'use strict'; + angular.module('ionic.ui.nav', ['ionic.service']) .controller('NavCtrl', ['$scope', '$element', '$compile', 'TemplateLoader', function($scope, $element, $compile, TemplateLoader) { @@ -329,7 +361,7 @@ angular.module('ionic.ui.nav', ['ionic.service']) $element.append(cloned); }); }); - } + }; ionic.controllers.NavController.call(this, { content: { @@ -366,7 +398,7 @@ angular.module('ionic.ui.nav', ['ionic.service']) controller: 'NavCtrl', //templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html', template: '
', - } + }; }) .directive('navBar', function() { @@ -383,9 +415,9 @@ angular.module('ionic.ui.nav', ['ionic.service']) scope.navController = navCtrl; scope.goBack = function() { navCtrl.pop(); - } + }; } - } + }; }) .directive('navContent', function() { @@ -414,11 +446,27 @@ angular.module('ionic.ui.nav', ['ionic.service']) } }); } - } + }; }); -; -angular.module('ionic.ui.sideMenu', []) +})(); +; +(function() { +'use strict'; + +/** + * @description + * The sideMenuCtrl lets you quickly have a draggable side + * left and/or right menu, which a center content area. + */ + +angular.module('ionic.ui.sideMenu', ['ionic.service.gesture']) + +/** + * The internal controller for the side menu controller. This + * extends our core Ionic side menu controller and exposes + * some side menu stuff on the current scope. + */ .controller('SideMenuCtrl', function($scope) { var _this = this; @@ -454,21 +502,22 @@ angular.module('ionic.ui.sideMenu', []) return { restrict: 'CA', controller: 'SideMenuCtrl', - } + }; }) -.directive('sideMenuContent', function() { +.directive('sideMenuContent', ['Gesture', function(Gesture) { return { restrict: 'CA', require: '^sideMenuCtrl', scope: true, compile: function(element, attr, transclude) { return function($scope, $element, $attr, sideMenuCtrl) { - window.ionic.onGesture('drag', function(e) { + + Gesture.on('drag', function(e) { sideMenuCtrl._handleDrag(e); }, $element[0]); - window.ionic.onGesture('release', function(e) { + Gesture.on('release', function(e) { sideMenuCtrl._endDrag(e); }, $element[0]); @@ -495,8 +544,8 @@ angular.module('ionic.ui.sideMenu', []) }); }; } - } -}) + }; +}]) .directive('menu', function() { @@ -519,8 +568,9 @@ angular.module('ionic.ui.sideMenu', []) $element.append(transclude($scope)); }; } - } -}) + }; +}); +})(); ; angular.module('ionic.ui.tabs', []) @@ -562,7 +612,7 @@ angular.module('ionic.ui.tabs', []) return function($scope, $element, $attr) { }; } - } + }; }) // Generic controller directive @@ -587,7 +637,7 @@ angular.module('ionic.ui.tabs', []) scope.iconOff = attrs.iconOff; tabsCtrl.addController(scope); } - } + }; }) @@ -601,7 +651,7 @@ angular.module('ionic.ui.tabs', []) template: '
' + '' + '
' - } + }; }) .directive('tabItem', function() { @@ -629,7 +679,7 @@ angular.module('ionic.ui.tabs', []) '' + ' {{title}}' + '' - } + }; }); ; angular.module('ionic.ui.toggle', []) @@ -678,5 +728,5 @@ angular.module('ionic.ui.toggle', []) $scope.toggle.val(ngModel.$viewValue); }; } - } -}) + }; +}); diff --git a/dist/js/ionic.js b/dist/js/ionic.js index 2a9cc4fb43..c7e013771f 100644 --- a/dist/js/ionic.js +++ b/dist/js/ionic.js @@ -94,7 +94,7 @@ window.ionic = { } return null; } - } + }; })(window.ionic); ; /** @@ -196,11 +196,11 @@ window.ionic = { // Map some convenient top-level functions for event handling - ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); } - ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); } - ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); } - ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); } - ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); } + ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); }; + ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); }; + ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); }; + ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); }; + ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); }; // DISABLING FOR NOW. THE TAP CODE AT THE EXT LEVEL SHOULD BE DOING THIS // Set up various listeners @@ -1672,7 +1672,7 @@ window.ionic = { } return parseFloat(window.device.version) >= 7.0; } - } + }; ionic.Platform.detect(); })(window.ionic); @@ -1697,9 +1697,9 @@ window.ionic = { // if the source event wasn't from a touch event then don't use this polyfill if(!e.gesture || e.gesture.pointerType !== "touch" || !e.gesture.srcEvent) return; - var - e = e.gesture.srcEvent, // evaluate the actual source event, not the created event by gestures.js - ele = e.target; + e = e.gesture.srcEvent; // evaluate the actual source event, not the created event by gestures.js + + var ele = e.target; while(ele) { if( ele.tagName === "INPUT" || ele.tagName === "TEXTAREA" || ele.tagName === "SELECT" ) { @@ -1754,7 +1754,7 @@ window.ionic = { } return dest; }, - } + }; })(window.ionic); ; (function(ionic) { @@ -1848,7 +1848,7 @@ window.ionic = { }, end: function(e) { } - } + }; var SlideDrag = function(opts) { this.dragThresholdX = opts.dragThresholdX || 10; @@ -1958,7 +1958,7 @@ window.ionic = { content.classList.remove('list-item-sliding'); } e.target.removeEventListener('webkitTransitionEnd', onRestingAnimationEnd); - } + }; window.requestAnimationFrame(function() { var currentX = parseFloat(_this._currentDrag.content.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0; @@ -1975,12 +1975,13 @@ window.ionic = { // We are done, notify caller doneCallback && doneCallback(); }); - } + }; var ReorderDrag = function(opts) { this.dragThresholdY = opts.dragThresholdY || 0; this.el = opts.el; }; + ReorderDrag.prototype = new DragOp(); ReorderDrag.prototype.start = function(e) { @@ -2178,7 +2179,6 @@ window.ionic = { })(ionic); ; - (function(ionic) { ionic.views.NavBar = function(opts) { @@ -2218,7 +2218,7 @@ window.ionic = { this._currentBackButton = back; this._currentBackButton.onclick = function(event) { _this.shouldGoBack && _this.shouldGoBack(); - } + }; } if(shouldShow && !this._currentBackButton.parentNode) { @@ -2562,7 +2562,7 @@ ionic.controllers.NavController = function(opts) { // TODO: Is this the best way? this.navBar.shouldGoBack = function() { _this.pop(); - } + }; }; ionic.controllers.NavController.prototype = { @@ -2808,8 +2808,9 @@ ionic.controllers.NavController.prototype = { }; })(window.ionic); ; - (function(ionic) { +'use strict'; + /** * The SideMenuController is a controller with a left and/or right menu that * can be slid out and toggled. Seen on many an app. @@ -2989,11 +2990,11 @@ ionic.controllers.NavController.prototype = { // what the drag velocity is var ratio = this.getOpenRatio(); - if(ratio == 0) + if(ratio === 0) return; var velocityThreshold = 0.3; - var velocityX = e.gesture.velocityX + var velocityX = e.gesture.velocityX; var direction = e.gesture.direction; // Less than half, going left @@ -3060,7 +3061,7 @@ ionic.controllers.NavController.prototype = { if(!this._isDragging && Math.abs(this._lastX - this._startX) > this.dragThresholdX) { // if the difference is greater than threshold, start dragging using the current // point as the starting point - this._startX = this._lastX + this._startX = this._lastX; this._isDragging = true; // Initialize dragging @@ -3077,6 +3078,7 @@ ionic.controllers.NavController.prototype = { })(ionic); ; (function(ionic) { +'use strict'; ionic.controllers.TabBarController = function(options) { this.tabBar = options.tabBar; @@ -3195,7 +3197,7 @@ ionic.controllers.TabBarController.prototype = { this._clearSelected(); this.selectController(0); }, -} +}; })(window.ionic); ; diff --git a/js/controllers/navController.js b/js/controllers/navController.js index ac828f8bcd..ac49bcd9a3 100644 --- a/js/controllers/navController.js +++ b/js/controllers/navController.js @@ -22,7 +22,7 @@ ionic.controllers.NavController = function(opts) { // TODO: Is this the best way? this.navBar.shouldGoBack = function() { _this.pop(); - } + }; }; ionic.controllers.NavController.prototype = { diff --git a/js/controllers/sideMenuController.js b/js/controllers/sideMenuController.js index 63dff0c851..5cd5e3a2a5 100644 --- a/js/controllers/sideMenuController.js +++ b/js/controllers/sideMenuController.js @@ -1,5 +1,6 @@ - (function(ionic) { +'use strict'; + /** * The SideMenuController is a controller with a left and/or right menu that * can be slid out and toggled. Seen on many an app. @@ -179,11 +180,11 @@ // what the drag velocity is var ratio = this.getOpenRatio(); - if(ratio == 0) + if(ratio === 0) return; var velocityThreshold = 0.3; - var velocityX = e.gesture.velocityX + var velocityX = e.gesture.velocityX; var direction = e.gesture.direction; // Less than half, going left @@ -250,7 +251,7 @@ if(!this._isDragging && Math.abs(this._lastX - this._startX) > this.dragThresholdX) { // if the difference is greater than threshold, start dragging using the current // point as the starting point - this._startX = this._lastX + this._startX = this._lastX; this._isDragging = true; // Initialize dragging diff --git a/js/controllers/tabBarController.js b/js/controllers/tabBarController.js index 537e489348..f0e1355d24 100644 --- a/js/controllers/tabBarController.js +++ b/js/controllers/tabBarController.js @@ -1,4 +1,5 @@ (function(ionic) { +'use strict'; ionic.controllers.TabBarController = function(options) { this.tabBar = options.tabBar; @@ -117,6 +118,6 @@ ionic.controllers.TabBarController.prototype = { this._clearSelected(); this.selectController(0); }, -} +}; })(window.ionic); diff --git a/js/ext/angular/src/directive/ionicActionSheet.js b/js/ext/angular/src/directive/ionicActionSheet.js index f3cd3f5f3f..756a05dfcb 100644 --- a/js/ext/angular/src/directive/ionicActionSheet.js +++ b/js/ext/angular/src/directive/ionicActionSheet.js @@ -1,3 +1,6 @@ +(function() { +'use strict'; + angular.module('ionic.ui.actionSheet', []) .directive('actionSheet', function() { @@ -22,5 +25,7 @@ angular.module('ionic.ui.actionSheet', []) '' + '' + '' - } + }; }); + +})(); diff --git a/js/ext/angular/src/directive/ionicCheckbox.js b/js/ext/angular/src/directive/ionicCheckbox.js index 9d277a4445..d230b10d85 100644 --- a/js/ext/angular/src/directive/ionicCheckbox.js +++ b/js/ext/angular/src/directive/ionicCheckbox.js @@ -1,3 +1,6 @@ +(function() { +'use strict'; + angular.module('ionic.ui.checkbox', []) @@ -36,5 +39,7 @@ angular.module('ionic.ui.checkbox', []) $scope.checkbox.val(ngModel.$viewValue); }; } - } -}) \ No newline at end of file + }; +}); + +})(); diff --git a/js/ext/angular/src/directive/ionicContent.js b/js/ext/angular/src/directive/ionicContent.js index 92368e4203..7959dde402 100644 --- a/js/ext/angular/src/directive/ionicContent.js +++ b/js/ext/angular/src/directive/ionicContent.js @@ -1,3 +1,6 @@ +(function() { +'use strict'; + angular.module('ionic.ui.content', []) // The content directive is a core scrollable content area @@ -24,7 +27,8 @@ angular.module('ionic.ui.content', []) c.addClass('has-tabs'); } c.append(transclude($scope)); - } + }; } - } -}) + }; +}); +})(); diff --git a/js/ext/angular/src/directive/ionicList.js b/js/ext/angular/src/directive/ionicList.js index df9e8ca77e..e7b656eded 100644 --- a/js/ext/angular/src/directive/ionicList.js +++ b/js/ext/angular/src/directive/ionicList.js @@ -1,3 +1,6 @@ +(function() { +'use strict'; + angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) .directive('listItem', function() { @@ -6,7 +9,6 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) require: '^list', replace: true, transclude: true, - scope: true, scope: { item: '=', onSelect: '&', @@ -42,7 +44,7 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) $scope.isEditing = v; }); } - } + }; }) .directive('list', function() { @@ -78,7 +80,9 @@ angular.module('ionic.ui.list', ['ionic.service', 'ngAnimate']) if(attr.animation) { $element.addClass(attr.animation); } - } + }; } - } -}) + }; +}); + +})(); diff --git a/js/ext/angular/src/directive/ionicNav.js b/js/ext/angular/src/directive/ionicNav.js index 0491161c01..5f13f98bcc 100644 --- a/js/ext/angular/src/directive/ionicNav.js +++ b/js/ext/angular/src/directive/ionicNav.js @@ -1,3 +1,6 @@ +(function() { +'use strict'; + angular.module('ionic.ui.nav', ['ionic.service']) .controller('NavCtrl', ['$scope', '$element', '$compile', 'TemplateLoader', function($scope, $element, $compile, TemplateLoader) { @@ -16,7 +19,7 @@ angular.module('ionic.ui.nav', ['ionic.service']) $element.append(cloned); }); }); - } + }; ionic.controllers.NavController.call(this, { content: { @@ -53,7 +56,7 @@ angular.module('ionic.ui.nav', ['ionic.service']) controller: 'NavCtrl', //templateUrl: 'ext/angular/tmpl/ionicTabBar.tmpl.html', template: '
', - } + }; }) .directive('navBar', function() { @@ -70,9 +73,9 @@ angular.module('ionic.ui.nav', ['ionic.service']) scope.navController = navCtrl; scope.goBack = function() { navCtrl.pop(); - } + }; } - } + }; }) .directive('navContent', function() { @@ -101,5 +104,7 @@ angular.module('ionic.ui.nav', ['ionic.service']) } }); } - } + }; }); + +})(); diff --git a/js/ext/angular/src/directive/ionicSideMenu.js b/js/ext/angular/src/directive/ionicSideMenu.js index 84723eb421..c9bae40e35 100644 --- a/js/ext/angular/src/directive/ionicSideMenu.js +++ b/js/ext/angular/src/directive/ionicSideMenu.js @@ -1,5 +1,19 @@ -angular.module('ionic.ui.sideMenu', []) +(function() { +'use strict'; +/** + * @description + * The sideMenuCtrl lets you quickly have a draggable side + * left and/or right menu, which a center content area. + */ + +angular.module('ionic.ui.sideMenu', ['ionic.service.gesture']) + +/** + * The internal controller for the side menu controller. This + * extends our core Ionic side menu controller and exposes + * some side menu stuff on the current scope. + */ .controller('SideMenuCtrl', function($scope) { var _this = this; @@ -35,21 +49,22 @@ angular.module('ionic.ui.sideMenu', []) return { restrict: 'CA', controller: 'SideMenuCtrl', - } + }; }) -.directive('sideMenuContent', function() { +.directive('sideMenuContent', ['Gesture', function(Gesture) { return { restrict: 'CA', require: '^sideMenuCtrl', scope: true, compile: function(element, attr, transclude) { return function($scope, $element, $attr, sideMenuCtrl) { - window.ionic.onGesture('drag', function(e) { + + Gesture.on('drag', function(e) { sideMenuCtrl._handleDrag(e); }, $element[0]); - window.ionic.onGesture('release', function(e) { + Gesture.on('release', function(e) { sideMenuCtrl._endDrag(e); }, $element[0]); @@ -76,8 +91,8 @@ angular.module('ionic.ui.sideMenu', []) }); }; } - } -}) + }; +}]) .directive('menu', function() { @@ -100,5 +115,6 @@ angular.module('ionic.ui.sideMenu', []) $element.append(transclude($scope)); }; } - } -}) + }; +}); +})(); diff --git a/js/ext/angular/src/directive/ionicTabBar.js b/js/ext/angular/src/directive/ionicTabBar.js index 48399ea83b..6c847fcfec 100644 --- a/js/ext/angular/src/directive/ionicTabBar.js +++ b/js/ext/angular/src/directive/ionicTabBar.js @@ -38,7 +38,7 @@ angular.module('ionic.ui.tabs', []) return function($scope, $element, $attr) { }; } - } + }; }) // Generic controller directive @@ -63,7 +63,7 @@ angular.module('ionic.ui.tabs', []) scope.iconOff = attrs.iconOff; tabsCtrl.addController(scope); } - } + }; }) @@ -77,7 +77,7 @@ angular.module('ionic.ui.tabs', []) template: '
' + '' + '
' - } + }; }) .directive('tabItem', function() { @@ -105,5 +105,5 @@ angular.module('ionic.ui.tabs', []) '' + ' {{title}}' + '' - } + }; }); diff --git a/js/ext/angular/src/directive/ionicToggle.js b/js/ext/angular/src/directive/ionicToggle.js index 57d2736559..cf45a5f1b2 100644 --- a/js/ext/angular/src/directive/ionicToggle.js +++ b/js/ext/angular/src/directive/ionicToggle.js @@ -44,5 +44,5 @@ angular.module('ionic.ui.toggle', []) $scope.toggle.val(ngModel.$viewValue); }; } - } -}) + }; +}); diff --git a/js/ext/angular/src/service/ionicActionSheet.js b/js/ext/angular/src/service/ionicActionSheet.js index e0f684740d..16131c5f3d 100644 --- a/js/ext/angular/src/service/ionicActionSheet.js +++ b/js/ext/angular/src/service/ionicActionSheet.js @@ -19,7 +19,7 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh scope.sheet.hide(); //scope.$destroy(); opts.cancel(); - } + }; scope.buttonClicked = function(index) { // Check if the button click event returned true, which means @@ -37,17 +37,17 @@ angular.module('ionic.service.actionSheet', ['ionic.service', 'ionic.ui.actionSh scope.sheet.hide(); //scope.$destroy(); } - } + }; // Compile the template var element = $compile('')(scope); - var scope = element.scope(); + var s = element.scope(); $document[0].body.appendChild(element[0]); var sheet = new ionic.views.ActionSheet({el: element[0] }); - scope.sheet = sheet; + s.sheet = sheet; sheet.show(); diff --git a/js/ext/angular/src/service/ionicGesture.js b/js/ext/angular/src/service/ionicGesture.js new file mode 100644 index 0000000000..157833f37e --- /dev/null +++ b/js/ext/angular/src/service/ionicGesture.js @@ -0,0 +1,9 @@ +angular.module('ionic.service.gesture', []) + +.factory('Gesture', [function() { + return { + on: function(eventType, cb, element) { + return window.ionic.onGesture(eventType, cb, element); + } + }; +}]); diff --git a/js/ext/angular/src/service/ionicTemplateLoad.js b/js/ext/angular/src/service/ionicTemplateLoad.js index fb5631f67f..aa7eaa97f0 100644 --- a/js/ext/angular/src/service/ionicTemplateLoad.js +++ b/js/ext/angular/src/service/ionicTemplateLoad.js @@ -11,5 +11,5 @@ angular.module('ionic.service', []) return deferred.promise; } - } + }; }]); diff --git a/js/ext/angular/test/directive/ionicTabBar.unit.js b/js/ext/angular/test/directive/ionicTabBar.unit.js index 96766c0318..6f483e47f6 100644 --- a/js/ext/angular/test/directive/ionicTabBar.unit.js +++ b/js/ext/angular/test/directive/ionicTabBar.unit.js @@ -91,4 +91,4 @@ describe('Tab Item directive', function() { a.click(); expect(scope.selectTab).toHaveBeenCalled(); }); -}) +}); diff --git a/js/ext/simple/selector.js b/js/ext/simple/selector.js index 17d6aff93b..d38abb2843 100644 --- a/js/ext/simple/selector.js +++ b/js/ext/simple/selector.js @@ -9,30 +9,32 @@ } return ret; } - } + }; if (window.jQuery) { // if jQuery is present then it should be the default jq = window.jQuery; + var fnExtended = function() { + var + x, + ret; // if incase this isn't an ionic component + + for(x = 0; x < this.length; x++) { + ionic.component( this[x] ); + if( this[x].component ) { + ret = this[x].component[name].apply(this[x].component, arguments); + } + } + + // if this isn't an ionic component, run the usual jQuery fn + return jQueryFn.apply(this, arguments); + }; + // extend the methods which are in ionic.fn and in jQuery.fn for(var name in ionic.fn) { var jQueryFn = jq.fn[name]; - jq.fn[name] = function() { - var - x, - ret; // if incase this isn't an ionic component - - for(x = 0; x < this.length; x++) { - ionic.component( this[x] ); - if( this[x].component ) { - ret = this[x].component[name].apply(this[x].component, arguments); - } - } - - // if this isn't an ionic component, run the usual jQuery fn - return jQueryFn.apply(this, arguments); - } + jq.fn[name] = fnExtended; } } else { @@ -56,7 +58,7 @@ $ = function(selector, context) { return jq.init(selector, context); - } + }; } })(this, document, ionic); diff --git a/js/utils/dom.js b/js/utils/dom.js index e4a8d08053..1c4912fa84 100644 --- a/js/utils/dom.js +++ b/js/utils/dom.js @@ -30,5 +30,5 @@ } return null; } - } + }; })(window.ionic); diff --git a/js/utils/events.js b/js/utils/events.js index 6910c18eaf..b1fd5ef149 100644 --- a/js/utils/events.js +++ b/js/utils/events.js @@ -97,11 +97,11 @@ // Map some convenient top-level functions for event handling - ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); } - ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); } - ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); } - ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); } - ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); } + ionic.on = function() { ionic.EventController.on.apply(ionic.EventController, arguments); }; + ionic.off = function() { ionic.EventController.off.apply(ionic.EventController, arguments); }; + ionic.trigger = function() { ionic.EventController.trigger.apply(ionic.EventController.trigger, arguments); }; + ionic.onGesture = function() { ionic.EventController.onGesture.apply(ionic.EventController.onGesture, arguments); }; + ionic.offGesture = function() { ionic.EventController.offGesture.apply(ionic.EventController.offGesture, arguments); }; // DISABLING FOR NOW. THE TAP CODE AT THE EXT LEVEL SHOULD BE DOING THIS // Set up various listeners diff --git a/js/utils/platform.js b/js/utils/platform.js index 06b7dbf708..55717caaf9 100644 --- a/js/utils/platform.js +++ b/js/utils/platform.js @@ -33,7 +33,7 @@ } return parseFloat(window.device.version) >= 7.0; } - } + }; ionic.Platform.detect(); })(window.ionic); diff --git a/js/utils/tapPolyfill.js b/js/utils/tapPolyfill.js index 324d1522c0..7756f2c11c 100644 --- a/js/utils/tapPolyfill.js +++ b/js/utils/tapPolyfill.js @@ -18,9 +18,9 @@ // if the source event wasn't from a touch event then don't use this polyfill if(!e.gesture || e.gesture.pointerType !== "touch" || !e.gesture.srcEvent) return; - var - e = e.gesture.srcEvent, // evaluate the actual source event, not the created event by gestures.js - ele = e.target; + e = e.gesture.srcEvent; // evaluate the actual source event, not the created event by gestures.js + + var ele = e.target; while(ele) { if( ele.tagName === "INPUT" || ele.tagName === "TEXTAREA" || ele.tagName === "SELECT" ) { diff --git a/js/utils/utils.js b/js/utils/utils.js index c6cecece1f..cd1d4bd6c0 100644 --- a/js/utils/utils.js +++ b/js/utils/utils.js @@ -18,5 +18,5 @@ } return dest; }, - } + }; })(window.ionic); diff --git a/js/views/listView.js b/js/views/listView.js index ed33280d0a..ff42e6d1b1 100644 --- a/js/views/listView.js +++ b/js/views/listView.js @@ -7,7 +7,7 @@ }, end: function(e) { } - } + }; var SlideDrag = function(opts) { this.dragThresholdX = opts.dragThresholdX || 10; @@ -117,7 +117,7 @@ content.classList.remove('list-item-sliding'); } e.target.removeEventListener('webkitTransitionEnd', onRestingAnimationEnd); - } + }; window.requestAnimationFrame(function() { var currentX = parseFloat(_this._currentDrag.content.style.webkitTransform.replace('translate3d(', '').split(',')[0]) || 0; @@ -134,12 +134,13 @@ // We are done, notify caller doneCallback && doneCallback(); }); - } + }; var ReorderDrag = function(opts) { this.dragThresholdY = opts.dragThresholdY || 0; this.el = opts.el; }; + ReorderDrag.prototype = new DragOp(); ReorderDrag.prototype.start = function(e) { diff --git a/js/views/navBarView.js b/js/views/navBarView.js index 209391f003..df68d416bd 100644 --- a/js/views/navBarView.js +++ b/js/views/navBarView.js @@ -1,4 +1,3 @@ - (function(ionic) { ionic.views.NavBar = function(opts) { @@ -38,7 +37,7 @@ this._currentBackButton = back; this._currentBackButton.onclick = function(event) { _this.shouldGoBack && _this.shouldGoBack(); - } + }; } if(shouldShow && !this._currentBackButton.parentNode) { diff --git a/test/js/controllers/navController.unit.js b/test/js/controllers/navController.unit.js index 5b22922ac4..42f6b72e35 100644 --- a/test/js/controllers/navController.unit.js +++ b/test/js/controllers/navController.unit.js @@ -10,8 +10,8 @@ describe('NavController', function() { }, attach: function() { } - } - } + }; + }; beforeEach(function() { navBarEl = document.createElement('div'); diff --git a/test/js/controllers/tabBarController.unit.js b/test/js/controllers/tabBarController.unit.js index 8a6865d0e1..ad14f3ae34 100644 --- a/test/js/controllers/tabBarController.unit.js +++ b/test/js/controllers/tabBarController.unit.js @@ -8,7 +8,7 @@ describe('TabBarController', function() { el: tabEl.get(0) }) }); - }) + }); it('Should add Controllers', function() { ctrl.addController({ @@ -82,4 +82,4 @@ describe('TabBarController', function() { expect(ctrl.getSelectedController()).toBe(ctrl.getController(0)); }); -}) +}); diff --git a/test/js/views/tabBar.unit.js b/test/js/views/tabBar.unit.js index bde5b23a0a..81209a7817 100644 --- a/test/js/views/tabBar.unit.js +++ b/test/js/views/tabBar.unit.js @@ -80,7 +80,7 @@ describe('TabBar view', function() { tabBar.destroy(); - var event = new CustomEvent('tap', { + event = new CustomEvent('tap', { target: item.el }); item.el.dispatchEvent(event); @@ -129,7 +129,7 @@ describe('TabBarItem view', function() { item.destroy(); - var event = new CustomEvent('tap', { + event = new CustomEvent('tap', { target: item.el }); item.el.dispatchEvent(event);