From 71514d81eedf3743102ca4bc2d0519356c6d6401 Mon Sep 17 00:00:00 2001 From: arzynik Date: Thu, 6 Mar 2014 22:04:07 -0800 Subject: [PATCH] performance improvments --- .../views/default/seven/frontend/home.phtml | 31 +++++++++++++++++++ www/assets/js/app.js | 27 +++++++++++----- www/assets/js/controllers.js | 2 +- www/assets/js/services.phonegap.js | 2 +- www/assets/js/services.position.js | 2 +- 5 files changed, 54 insertions(+), 10 deletions(-) create mode 100644 include/views/default/seven/frontend/home.phtml diff --git a/include/views/default/seven/frontend/home.phtml b/include/views/default/seven/frontend/home.phtml new file mode 100644 index 000000000..6fa72af07 --- /dev/null +++ b/include/views/default/seven/frontend/home.phtml @@ -0,0 +1,31 @@ +
+ +
+
+
+ Push one of those restaurants down there. + The RESTAURANTS. + The AWESOME restaurants. + Down there. + NOT me!! + @#%*@%&! + ... + .... + ..... + ...... + ....... + ........ + I quit. + + Push a button.
Get food.    
+
+
+
+
+
+
+

Order the top local delivery food.

+

Choose one of these awesome restaurants

+
+
+
diff --git a/www/assets/js/app.js b/www/assets/js/app.js index 1b687bb3a..1ea5c65ba 100644 --- a/www/assets/js/app.js +++ b/www/assets/js/app.js @@ -250,7 +250,6 @@ NGApp.config(['$routeProvider', '$locationProvider', function($routeProvider, $l // global route change items NGApp.controller('AppController', function ($scope, $route, $http, $routeParams, $rootScope, $location, $window, AccountService, MainNavigationService, AccountSignOut, CartService, ReferralService, LocationService, PhoneGapService ) { - // define external pointers App.rootScope = $rootScope; App.location = $location; @@ -263,6 +262,8 @@ NGApp.controller('AppController', function ($scope, $route, $http, $routeParams, $rootScope.signout = AccountSignOut; $rootScope.isPhoneGap = App.isPhoneGap; $rootScope.server = App.server; + + $rootScope.animationClass = ''; $rootScope.debug = function() { return ( App.config && App.config.user && App.config.user.debug ); @@ -412,7 +413,7 @@ NGApp.controller('AppController', function ($scope, $route, $http, $routeParams, App.parallax.bg = null; - App.setTop(); + App.scrollTop($rootScope.scrollTop); $rootScope.scrollTop = 0; }); @@ -486,22 +487,34 @@ App.toggleMenu = function() { }; -/** - * scroll to the top of the page - */ +/* App.setTop = function() { $('html, body, .snap-content-inner').scrollTop(0); + setTimeout(function() { + $('html, body, .snap-content-inner').scrollTop(0); + },13); + -/* $('#ng-view').css('-webkit-transform','translate3d(0,0,0)'); setTimeout(function() { $('#ng-view').css('-webkit-transform',''); },1000); -*/ + }; +*/ + + +/** + * scroll to the top of the page + */ App.scrollTop = function(top) { setTimeout(function() { + if (!top) { + setTimeout(function() { + $('html, body, .snap-content-inner').scrollTop(0); + },10); + } $('html, body, .snap-content-inner').animate({scrollTop: top || 0}, 10, $.easing.easeInOutQuart ? 'easeInOutQuart' : null); },3); }; diff --git a/www/assets/js/controllers.js b/www/assets/js/controllers.js index 10319efe0..27f0f55b0 100644 --- a/www/assets/js/controllers.js +++ b/www/assets/js/controllers.js @@ -78,7 +78,7 @@ NGApp.controller('HomeCtrl', function ($scope, $http, $location, RestaurantsServ } else { $location.path('/location'); } - } + } $location.replace(); }); diff --git a/www/assets/js/services.phonegap.js b/www/assets/js/services.phonegap.js index f45f8c85f..7ede1a7b3 100644 --- a/www/assets/js/services.phonegap.js +++ b/www/assets/js/services.phonegap.js @@ -17,7 +17,7 @@ NGApp.factory( 'PhoneGapService', function( $route, $rootScope ){ service.routeChanged = function( route ){ if( App.isPhoneGap && !App.splashHidden && ( !route || route == 'home' ) ){ - navigator.splashscreen.show(); + //navigator.splashscreen.show(); } else { setTimeout( function(){ navigator.splashscreen.hide(); diff --git a/www/assets/js/services.position.js b/www/assets/js/services.position.js index 74261c427..4c201cc93 100644 --- a/www/assets/js/services.position.js +++ b/www/assets/js/services.position.js @@ -259,7 +259,7 @@ NGApp.factory('LocationService', function ($location, $rootScope, RestaurantsSer if ( parseInt( service.position.locs.length ) > 0 ) { service.restaurantsService.list( // success - has restaurants - function () { App.go( '/food-delivery', 'push' ); }, + function () { App.go( '/food-delivery'); }, // no restaurant function () {} );