diff --git a/www/js/app.js b/www/js/app.js index 5970383ed3bebd990cfb69c7acc3b7b01603ab42..dc73c3e0466c5eb42653b351b02ab5c14e56df49 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -90,7 +90,7 @@ window.facebookConnectPlugin.logEvent('fb_mobile_first_app_launch'); } - if (ionic.Platform.isIOS()) { + if (ionic.Platform.isIOS() && window.cordova) { window.FirebasePlugin.grantPermission(); } diff --git a/www/js/pages/football/controller.js b/www/js/pages/football/controller.js index 0e8ca8724350f6a3ee25fc30c45b55c136adedcb..c27089ed87a8bdbb4e1dc2efd4fa75568c5356ba 100644 --- a/www/js/pages/football/controller.js +++ b/www/js/pages/football/controller.js @@ -33,6 +33,7 @@ var deregistrationCallbackList = []; var self = this; + self.shouldUp = false; /** End Controller variables @@ -85,7 +86,19 @@ $scope.selected.push(league); $scope.predictionsNumber += league.predictions_number; } - + + var list = angular.element(document.querySelector('#list-packs .list')); + var ionContent = angular.element(document.querySelector('ion-content'))[0]; + + if (self.shouldUp && $scope.selected.length > 0) { + list.css('marginBottom', '50px'); + if (ionContent.scrollTop >= 340) { + ionContent.scrollTop = ionContent.scrollHeight; + } + } else if (self.shouldUp && $scope.selected.length == 0) { + list.css('marginBottom', '0'); + } + var price = self.findPrice($scope.selected.length); $scope.price = price; $scope.$parent.$parent.select($scope.selected, price, $scope.predictionsNumber, 'football', self.findPack($scope.selected.length)); @@ -274,6 +287,11 @@ }); $scope.freePredictions = freePredictions; $scope.leagues = data[1]['data']; + + if ($scope.leagues.length >= 3) { + self.shouldUp = true; + } + if (window.cordova) { self.products = data[2]; } else { diff --git a/www/js/pages/tennis/controller.js b/www/js/pages/tennis/controller.js index a099baf47f4ac7e7e3f8e1cf77f5ac2899689718..dbd2a1edd1e7a08f7ac28c4149279f0403c69bce 100644 --- a/www/js/pages/tennis/controller.js +++ b/www/js/pages/tennis/controller.js @@ -31,6 +31,7 @@ var deregistrationCallbackList = []; var self = this; + self.shouldUp = false; /** End Controller variables @@ -84,6 +85,18 @@ $scope.predictionsNumber += league.predictions_number; } + var list = angular.element(document.querySelector('#list-packs .list')); + var ionContent = angular.element(document.querySelector('ion-content'))[0]; + + if (self.shouldUp && $scope.selected.length > 0) { + list.css('marginBottom', '50px'); + if (ionContent.scrollTop >= 340) { + ionContent.scrollTop = ionContent.scrollHeight; + } + } else if (self.shouldUp && $scope.selected.length == 0) { + list.css('marginBottom', '0'); + } + var price = self.findPrice($scope.selected.length); $scope.price = price; $scope.$parent.$parent.select($scope.selected, price, $scope.predictionsNumber, 'tennis', self.findPack()); @@ -247,6 +260,11 @@ }); $scope.freePredictions = freePredictions; $scope.leagues = data[1]['data']; + + if ($scope.leagues.length >= 3) { + self.shouldUp = true; + } + if (window.cordova) { self.products = data[2]; } else { diff --git a/www/partials/sport-index.html b/www/partials/sport-index.html index 8a75965b625e5aeb50dce14d3232397a3f7fa7ba..ff4a6149cc66fabad7a2c4f8e0f089b57fa5b42a 100644 --- a/www/partials/sport-index.html +++ b/www/partials/sport-index.html @@ -4,7 +4,7 @@ </ion-item> </ion-list> <h3 class="title-section" translate="all_predictions"></h3> -<ion-list> +<ion-list id="list-packs"> <ion-item ng-repeat="league in leagues track by league.id" class="pack-item" ng-class="!isBought(league) ? 'locked' : ''"> <a ui-sref="{{getLink(league)}}" ng-click="!isBought(league) ? select(league) : ''"> <img src="img/lock.png" ng-hide="isBought(league)" class="lock" alt=""> @@ -30,4 +30,3 @@ </a> </ion-item> </ion-list> -