diff --git a/js/controllers/navController.js b/js/controllers/navController.js index a201762dde..08f1282dc0 100644 --- a/js/controllers/navController.js +++ b/js/controllers/navController.js @@ -1,4 +1,4 @@ -(function(window, document, ionic) { +(function(ionic) { NavController = function(opts) { var _this = this; @@ -102,4 +102,4 @@ }, }; -})(this, document, this.ionic || {}); +})(window.ionic); diff --git a/js/controllers/sideMenuController.js b/js/controllers/sideMenuController.js index 95d8840c22..08c2ebabed 100644 --- a/js/controllers/sideMenuController.js +++ b/js/controllers/sideMenuController.js @@ -1,4 +1,4 @@ -(function(window, document, ionic) { +(function(ionic) { SideMenuController = function(options) { var _this = this; @@ -188,4 +188,4 @@ } }; -})(this, document, ion = this.ionic || {}); +})(window.ionic); diff --git a/js/controllers/tabBarController.js b/js/controllers/tabBarController.js index 4d16eea3de..2c111bbd85 100644 --- a/js/controllers/tabBarController.js +++ b/js/controllers/tabBarController.js @@ -1,4 +1,4 @@ -(function(window, document, ionic) { +(function(ionic) { TabBarController = function(options) { this.tabBar = options.tabBar; @@ -119,4 +119,4 @@ TabBarController.prototype = { }, } -})(this, document, ion = this.ionic || {}); +})(window.ionic); diff --git a/js/events.js b/js/events.js index 5fb9d79f6c..5c2026fce8 100644 --- a/js/events.js +++ b/js/events.js @@ -10,7 +10,7 @@ * Portions lovingly adapted from github.com/maker/ratchet and github.com/alexgibson/tap.js - thanks guys! */ -(function(window, document, ion) { +(function(ionic) { ionic.EventController = { VIRTUALIZED_EVENTS: ['tap', 'swipe', 'swiperight', 'swipeleft', 'drag', 'hold', 'release'], @@ -106,4 +106,4 @@ // Set up various listeners window.addEventListener('click', ionic.EventController.handleClick); -})(this, document, ionic = this.ionic || {}); +})(window.ionic); diff --git a/js/gestures.js b/js/gestures.js index a55190305a..7dbb356e2e 100644 --- a/js/gestures.js +++ b/js/gestures.js @@ -2,9 +2,9 @@ * Simple gesture controllers with some common gestures that emit * gesture events. * - * Ported from github.com/EightMedia/ionic.Gestures.js - thanks! + * Ported from github.com/EightMedia/hammer.js - thanks! */ -(function(window, document, ionic) { +(function(ionic) { /** * ionic.Gestures @@ -1425,4 +1425,4 @@ } } }; -})(this, document, ionic = this.ionic || {}); +})(window.ionic); diff --git a/js/ionic.js b/js/ionic.js index 5b837f8a4e..bd1b08e356 100644 --- a/js/ionic.js +++ b/js/ionic.js @@ -1,28 +1,26 @@ -(function(window, document, ion) { +window.ionic = {}; - function initalize() { - // remove the ready listeners - document.removeEventListener( "DOMContentLoaded", initalize, false ); - window.removeEventListener( "load", initalize, false ); +function initalize() { + // remove the ready listeners + document.removeEventListener( "DOMContentLoaded", initalize, false ); + window.removeEventListener( "load", initalize, false ); - // trigger that the DOM is ready - ion.trigger("ready"); + // trigger that the DOM is ready + ion.trigger("ready"); - // trigger that the start page is in view - ion.trigger("pageview"); + // trigger that the start page is in view + ion.trigger("pageview"); - // trigger that the webapp has been initalized - ion.trigger("initalized"); - } + // trigger that the webapp has been initalized + ion.trigger("initalized"); +} - // When the DOM is ready, initalize the webapp - if ( document.readyState === "complete" ) { - // DOM is already ready - setTimeout( initalize ); - } else { - // DOM isn't ready yet, add event listeners - document.addEventListener( "DOMContentLoaded", initalize, false ); - window.addEventListener( "load", initalize, false ); - } - -})(this, document, ion = this.ion || {}); \ No newline at end of file +// When the DOM is ready, initalize the webapp +if ( document.readyState === "complete" ) { + // DOM is already ready + setTimeout( initalize ); +} else { + // DOM isn't ready yet, add event listeners + document.addEventListener( "DOMContentLoaded", initalize, false ); + window.addEventListener( "load", initalize, false ); +} diff --git a/js/utils.js b/js/utils.js index da1f02f7ae..c6cecece1f 100644 --- a/js/utils.js +++ b/js/utils.js @@ -1,6 +1,6 @@ -(function(window, document, ion) { +(function(ionic) { - ion.Utils = { + ionic.Utils = { /** * extend method, * also used for cloning when dest is an empty object @@ -19,4 +19,4 @@ return dest; }, } -})(this, document, ion = this.ion || {}); +})(window.ionic); diff --git a/js/viewController.js b/js/viewController.js index b98b26b4b6..bef7817668 100644 --- a/js/viewController.js +++ b/js/viewController.js @@ -11,4 +11,4 @@ destroy: function() { } }; -})(this.ionic); +})(window.ionic); diff --git a/js/views/navBar.js b/js/views/navBar.js index 2ca62e26a6..be9a0c730f 100644 --- a/js/views/navBar.js +++ b/js/views/navBar.js @@ -1,4 +1,4 @@ -(function(window, document, ionic) { +(function(ionic) { NavBar = function(opts) { this.el = opts.el; @@ -39,5 +39,4 @@ } } }; -})(this, document, ion = this.ionic || {}); - +})(window.ionic); diff --git a/js/views/sideMenu.js b/js/views/sideMenu.js index c6d56312d2..234f095fdc 100644 --- a/js/views/sideMenu.js +++ b/js/views/sideMenu.js @@ -1,4 +1,4 @@ -(function(window, document, ionic) { +(function(ionic) { SideMenu = function(opts) { this.el = opts.el; this.width = opts.width; @@ -19,4 +19,4 @@ this.el.style.zIndex = -1; } }; -})(this, document, ion = this.ionic || {}); +})(window.ionic); diff --git a/js/views/tabBar.js b/js/views/tabBar.js index b50545f9a5..5010220a12 100644 --- a/js/views/tabBar.js +++ b/js/views/tabBar.js @@ -1,4 +1,4 @@ -(function(window, document, ionic) { +(function(ionic) { TabBarItem = function(el) { this.el = el; @@ -198,4 +198,4 @@ TabBar.prototype = { } }; -})(this, document, this.ionic || {}); +})(window.ionic);