diff --git a/www/js/app.js b/www/js/app.js index 6c5269078bb079671c69c730cd360561d4af1224..50f4eb4105a6deb838e22031f90c7d7127d0eb82 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -104,7 +104,7 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'pascalprecht if (!input) return ''; input = input.toLowerCase(); return input.substring(0,1).toUpperCase()+input.substring(1); - } + }; }) .filter('formatPubkey', function() { @@ -301,10 +301,7 @@ if (typeof String.prototype.format !== 'function') { String.prototype.format = function() { var args = arguments; return this.replace(/{(\d+)}/g, function(match, number) { - return typeof args[number] != 'undefined' - ? args[number] - : match - ; + return typeof args[number] != 'undefined' ? args[number] : match; }); }; } diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index 35cdb24d62bd7a9aa75e8b9f9abdcc54d2c38432..ec22c094f84322af7f0d3303f4874de2d1f10aa8 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -86,7 +86,7 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ $rootScope.smallscreen = screenmatch.bind('xs, sm', $rootScope); - $rootScope.smallscreen.active === true; //true if the screen is xs or sm + $rootScope.smallscreen.active = true; //true if the screen is xs or sm //////////////////////////////////////// // Show currency view @@ -155,40 +155,6 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ }); }; - $scope.isGlobalStart = function() { - return $rootScope.tour; - } - - $scope.startCurrencyTour = function(index) { - index = index || csSettings.data.helptip.currency; - if (index < 0) return; - // Create a new scope for the tour controller - var childScope = $scope.$new(); - $controller('HelpTourCtrl', { '$scope': childScope}); - childScope.tour = false; - return childScope.startCurrencyTour(index) // skip menu helptip - .then(function(endIndex) { - childScope.$destroy(); - csSettings.data.helptip.currency = endIndex; - csSettings.store(); - }); - }; - - $scope.startWotTour = function(index) { - index = index || csSettings.data.helptip.wot; - if (index < 0) return; - // Create a new scope for the tour controller - var childScope = $scope.$new(); - $controller('HelpTourCtrl', { '$scope': childScope}); - childScope.tour = false; - return childScope.startWotTour(1) - .then(function(endIndex) { - childScope.$destroy(); - csSettings.data.helptip.wot = endIndex; - csSettings.store(); - }); - }; - //////////////////////////////////////// // Login & wallet //////////////////////////////////////// @@ -240,7 +206,7 @@ function AppController($scope, $rootScope, $state, $ionicSideMenuDelegate, $q, $ }); } resolve(true); - }) + }); }; return $q(function(resolve, reject){ diff --git a/www/js/controllers/settings-controllers.js b/www/js/controllers/settings-controllers.js index de171d2339c0cf88b2078ef363e86679ef42464b..b91490eaf9bcdd4c4d5933b9e5182ca2568472fb 100644 --- a/www/js/controllers/settings-controllers.js +++ b/www/js/controllers/settings-controllers.js @@ -38,7 +38,7 @@ function SettingsController($scope, $q, $ionicPopup, $timeout, $translate, csHtt } UIUtils.loading.hide(); $scope.loading = false; - + $scope.showHelpTip(); $timeout(function() { // Set Ink UIUtils.ink({selector: '.item'}); @@ -150,7 +150,7 @@ function SettingsController($scope, $q, $ionicPopup, $timeout, $translate, csHtt $scope.loading = true; // Make sure to format helptip - $scope.cleanupHelpTip() + $scope.cleanupHelpTip(); angular.merge(csSettings.data, $scope.formData); csSettings.store(); @@ -180,7 +180,7 @@ function SettingsController($scope, $q, $ionicPopup, $timeout, $translate, csHtt $scope.showHelpTip = function() { var index = angular.isDefined(index) ? index : csSettings.data.helptip.settings; if (index < 0) return; - if (index == 0) index = 1; // skip first step + if (index === 0) index = 1; // skip first step // Create a new scope for the tour controller var helptipScope = $scope.createHelptipScope(); diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index baa22221c6184f51e1cba2ff5617fccc1a117fe6..a25c2fe1e4aafb8c6a027ca558aecfdca28b45b7 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -144,6 +144,7 @@ function WotLookupController($scope, $rootScope, BMA, $state, UIUtils, $timeout, $scope.search.type = 'text'; WotService.search(text) .then(function(idties){ + if ($scope.search.type != 'text') return; // could have change if ($scope.search.text.trim() !== text) return; // search text has changed before received response if ((!idties || !idties.length) && BMA.regex.PUBKEY.test(text)) { @@ -160,25 +161,22 @@ function WotLookupController($scope, $rootScope, BMA, $state, UIUtils, $timeout, $scope.doGetNewcomers= function(limit, more) { $scope.search.loading = more ? false : true; $scope.search.type = 'newcomers'; - $scope.search.limit = (limit && limit > 0) ? limit : $scope.search.limit; - var searchFunction = csConfig.initPhase ? WotService.all : WotService.newcomers; - return searchFunction($scope.search.limit).then(function(idties){ - if (!$scope.search.type == 'newcomers') return; // could have change + if ($scope.search.type != 'newcomers') return; // could have change $scope.doDisplayResult(idties); }); }; - $scope.doGetPending= function(limit, more) { + $scope.doGetPending = function(limit, more) { $scope.search.loading = more ? false : true; $scope.search.type = 'pending'; $scope.search.limit = (limit && limit > 0) ? limit : $scope.search.limit; return WotService.pending($scope.search.limit).then(function(res){ - if (!$scope.search.type == 'pending') return; // could have change + if ($scope.search.type != 'pending') return; // could have change $scope.doDisplayResult(res); }); }; @@ -190,7 +188,11 @@ function WotLookupController($scope, $rootScope, BMA, $state, UIUtils, $timeout, $scope.search.limit = defaultSearchLimit; } $scope.search.loadingMore = true; - $scope.doGetNewcomers($scope.search.limit, true) + var searchFunction = ($scope.search.type == 'newcomers') ? + $scope.doGetNewcomers : + $scope.doGetPending; + + searchFunction($scope.search.limit, true) .then(function() { $scope.search.loadingMore = false; }) @@ -243,7 +245,7 @@ function WotLookupController($scope, $rootScope, BMA, $state, UIUtils, $timeout, $scope.showHelpTip = function() { var index = angular.isDefined(index) ? index : csSettings.data.helptip.wot; if (index < 0) return; - if (index == 0) index = 1; // skip first step + if (index === 0) index = 1; // skip first step // Create a new scope for the tour controller var helptipScope = $scope.createHelptipScope(); diff --git a/www/js/services/utils-services.js b/www/js/services/utils-services.js index 6797cdcc151302161691b5456606c9d8b07def6b..5562ea23746ee46f6c106000a67d211f11d7accf 100644 --- a/www/js/services/utils-services.js +++ b/www/js/services/utils-services.js @@ -345,7 +345,7 @@ angular.module('cesium.utils.services', ['ngResource']) var elements = document.querySelectorAll(options.autofocus); for (var i=0; i<elements.length; i++) { var element = elements[i]; - if (element != null) { + if (element !== null) { element.focus(); break; } diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index 2731b5a3b17f53301d8cb19fdb7709fd9dba8e39..fe337fdb2c871e5330590e07cbf82b299a40fede 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -952,7 +952,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser if (outputAmount > 0) { outputAmount = outputBase === 0 ? outputAmount : outputAmount / Math.pow(10, outputBase); tx += outputAmount + ':' + outputBase + ':SIG(' + destPub + ')\n'; - outputOffset++ + outputOffset++; } outputBase--; } diff --git a/www/js/services/wot-services.js b/www/js/services/wot-services.js index 4796e692b583fab5da5d618b2693060be42978ea..3b370e280d201b40760cc8b4b6463878d6dbb4f3 100644 --- a/www/js/services/wot-services.js +++ b/www/js/services/wot-services.js @@ -533,7 +533,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic idty.errors = ['INVALID_MS_BLOCK_HASH']; console.debug("Invalid membership for uid={0}: block hash not match a real block (block cancelled)".format(idty.uid)); //} - }) + }); }); return $q(function(resolve, reject) { api.data.raisePromise.search(null, idties) @@ -544,8 +544,7 @@ angular.module('cesium.wot.services', ['ngResource', 'ngApi', 'cesium.bma.servic reject(err); }); }); - }) - + }); }); }, diff --git a/www/plugins/es/js/services/user-services.js b/www/plugins/es/js/services/user-services.js index f1a9a5a797b0fba8fa8af4c74402e8c26eafcb7b..02a94fb3f7376fd379715b16f8aef8680f849a89 100644 --- a/www/plugins/es/js/services/user-services.js +++ b/www/plugins/es/js/services/user-services.js @@ -248,7 +248,7 @@ angular.module('cesium.es.user.services', ['cesium.services', 'cesium.es.http.se console.debug('[esUser] Local settings already up to date'); resolve(data); return; - }; + } var boxKeypair = CryptoUtils.box.keypair.fromSignKeypair(data.keypair); var nonce = CryptoUtils.util.decode_base58(record.nonce); // Decrypt settings content