From 5eae17b988429f2a58819b60da32eee6ba1200f3 Mon Sep 17 00:00:00 2001 From: blavenie <benoit.lavenier@e-is.pro> Date: Thu, 4 Aug 2016 10:45:08 +0200 Subject: [PATCH] -Fix JS hint --- gulpfile.js | 37 ++++++++++++++++++- hooks/before_prepare/02_jshint.js | 6 ++- www/js/app.js | 6 +-- www/js/controllers/app-controllers.js | 2 +- www/js/controllers/transfer-controllers.js | 2 +- www/js/controllers/wot-controllers.js | 4 +- www/js/directives.js | 2 +- www/js/services/bma-services.js | 4 +- www/js/services/modal-services.js | 4 +- www/js/services/wallet-services.js | 2 +- .../es/js/controllers/market-controllers.js | 22 +++++------ .../es/js/controllers/user-controllers.js | 8 ++-- www/plugins/es/js/services/es-services.js | 2 +- www/plugins/es/js/services/market-services.js | 2 +- www/plugins/es/js/services/social-services.js | 8 ++-- 15 files changed, 75 insertions(+), 36 deletions(-) diff --git a/gulpfile.js b/gulpfile.js index 435d4255..2f99a46a 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -273,7 +273,42 @@ gulp.task('ng_annotate:web', ['templatecache:web'], function (done) { .on('end', done); }); -gulp.task('optimize-files:web', ['ng_annotate:web'], function(done) { +gulp.task('copy-plugin-files:web', ['clean:tmp', 'clean:web', 'sass', 'config'], function(done) { + var tmpPath = './platforms/web/www'; + es.concat( + // Transform i18n into JS + gulp.src(paths.ng_translate_plugin) + .pipe(ngTranslate({standalone:true, module: 'cesium.plugins.translations'})) + .pipe(gulp.dest(tmpPath + '/dist/dist_js/plugins')), + + // Copy CSS + gulp.src(paths.css_plugin) + .pipe(gulp.dest(tmpPath + '/dist/dist_css/plugins')) + ) + .on('end', done); +}); + +gulp.task('templatecache-plugin:web', ['copy-plugin-files:web'], function (done) { + var tmpPath = './platforms/web/www'; + gulp.src(paths.templatecache_plugin) + .pipe(templateCache({ + standalone:true, + module:"cesium.plugins.templates", + root: "plugins/" + })) + .pipe(gulp.dest(tmpPath + '/dist/dist_js/plugins')) + .on('end', done); +}); + +gulp.task('ng_annotate-plugin:web', ['templatecache-plugin:web'], function (done) { + var tmpPath = './platforms/web/www'; + gulp.src(paths.ng_annotate_plugin) + .pipe(ngAnnotate({single_quotes: true})) + .pipe(gulp.dest(tmpPath + '/dist/dist_js/plugins')) + .on('end', done); +}); + +gulp.task('optimize-files:web', ['ng_annotate:web', 'ng_annotate-plugin:web'], function(done) { var tmpPath = './platforms/web/www'; var jsFilter = filter(["**/*.js", "!**/vendor/*"], { restore: true }); var cssFilter = filter("**/*.css", { restore: true }); diff --git a/hooks/before_prepare/02_jshint.js b/hooks/before_prepare/02_jshint.js index 4d05587c..7e94c58e 100755 --- a/hooks/before_prepare/02_jshint.js +++ b/hooks/before_prepare/02_jshint.js @@ -9,7 +9,11 @@ var foldersToProcess = [ 'js', 'js/controllers', 'js/entity', - 'js/services' + 'js/services', + 'plugins/es/js', + 'plugins/es/js/controllers', + 'plugins/es/js/entity', + 'plugins/es/js/services' ]; foldersToProcess.forEach(function(folder) { diff --git a/www/js/app.js b/www/js/app.js index 1a6a5815..44f9edef 100644 --- a/www/js/app.js +++ b/www/js/app.js @@ -144,9 +144,9 @@ angular.module('cesium', ['ionic', 'ionic-material', 'ngMessages', 'ngAnimate', .config(function($ionicNativeTransitionsProvider){ 'ngInject'; // Use native transition - var enableNativeTransitions = ionic.Platform.isAndroid() || ionic.Platform.isIOS()/*) && - ionic.Platform.grade.toLowerCase()=='a';*/ - $ionicNativeTransitionsProvider.enable(enableNativeTransitions); + // FIXME : native transition on a PAD move also the left menu ! + //var enableNativeTransitions = ionic.Platform.isAndroid() || ionic.Platform.isIOS(); + //$ionicNativeTransitionsProvider.enable(enableNativeTransitions); }) // endRemoveIf(no-device) diff --git a/www/js/controllers/app-controllers.js b/www/js/controllers/app-controllers.js index 4cf8bc22..ad4be942 100644 --- a/www/js/controllers/app-controllers.js +++ b/www/js/controllers/app-controllers.js @@ -263,7 +263,7 @@ function AppController($scope, $rootScope, $ionicModal, $state, $ionicSideMenuDe if (walletData) { $state.go(state ? state : 'app.view_wallet'); } - }) + }); } }; diff --git a/www/js/controllers/transfer-controllers.js b/www/js/controllers/transfer-controllers.js index 21ceeb8c..f2debf66 100644 --- a/www/js/controllers/transfer-controllers.js +++ b/www/js/controllers/transfer-controllers.js @@ -70,7 +70,7 @@ function TransferController($scope, $rootScope, $state, BMA, Wallet, UIUtils, $t $scope.cancel = function() { //TODO : go back ? - alert('TODO : go back ?') + alert('TODO : go back ?'); }; $scope.setForm = function(form) { diff --git a/www/js/controllers/wot-controllers.js b/www/js/controllers/wot-controllers.js index cfcfd66a..57e39f8d 100644 --- a/www/js/controllers/wot-controllers.js +++ b/www/js/controllers/wot-controllers.js @@ -147,14 +147,14 @@ function WotLookupModalController($scope, BMA, $state, UIUtils, $timeout, Device $scope.cancel = function(){ $scope.closeModal(); - } + }; $scope.doSelectIdentity = function(pub, uid){ $scope.closeModal({ pubkey: pub, uid: uid }); - } + }; } diff --git a/www/js/directives.js b/www/js/directives.js index b2fc11fa..c683a6f3 100644 --- a/www/js/directives.js +++ b/www/js/directives.js @@ -115,6 +115,6 @@ angular.module('cesium.directives', []) } }); } - } + }; }) ; diff --git a/www/js/services/bma-services.js b/www/js/services/bma-services.js index ae748a74..9aa4f481 100644 --- a/www/js/services/bma-services.js +++ b/www/js/services/bma-services.js @@ -59,8 +59,8 @@ angular.module('cesium.bma.services', ['cesium.http.services', 'ngResource', function getBlockchainCurrent(cache) { return $q(function(resolve, reject) { var now = new Date(); - if (cache && data.blockchain.current !== null - && (now.getTime() - data.blockchain.current.timestamp) <= constants.CACHE_TIME_MS) { + if (cache && data.blockchain.current !== null && + (now.getTime() - data.blockchain.current.timestamp) <= constants.CACHE_TIME_MS) { resolve(data.blockchain.current.result); return; } diff --git a/www/js/services/modal-services.js b/www/js/services/modal-services.js index 758565ae..5c0ec953 100644 --- a/www/js/services/modal-services.js +++ b/www/js/services/modal-services.js @@ -94,7 +94,7 @@ angular.module('cesium.modal.services', []) return { show: show - } + }; }) .factory('Modals', function(ModalUtils) { @@ -120,6 +120,6 @@ angular.module('cesium.modal.services', []) showTransfer: showTransfer, showLogin: showLogin, showWotLookup: showWotLookup - } + }; }); diff --git a/www/js/services/wallet-services.js b/www/js/services/wallet-services.js index e0ab41a9..42ef807a 100644 --- a/www/js/services/wallet-services.js +++ b/www/js/services/wallet-services.js @@ -852,7 +852,7 @@ angular.module('cesium.wallet.services', ['ngResource', 'ngApi', 'cesium.bma.ser }); store(); // save the wallet resolve(result); - }).catch(function(err){reject(err);});; + }).catch(function(err){reject(err);}); }); }).catch(function(err){reject(err);}); }).catch(function(err){reject(err);}); diff --git a/www/plugins/es/js/controllers/market-controllers.js b/www/plugins/es/js/controllers/market-controllers.js index 0f738197..977a559e 100644 --- a/www/plugins/es/js/controllers/market-controllers.js +++ b/www/plugins/es/js/controllers/market-controllers.js @@ -408,7 +408,7 @@ function MarketRecordViewController($scope, $rootScope, $ionicModal, Wallet, Mar .catch(function(err) { UIUtils.loading.hide(); $scope.member = null; - }) + }); }) .catch(function(err) { if (!$scope.secondTry) { @@ -484,7 +484,7 @@ function MarketRecordViewController($scope, $rootScope, $ionicModal, Wallet, Mar }); }, 10); }); - } + }; $scope.sendComment = function() { if (!$scope.commentData.message || $scope.commentData.message.trim().length === 0) { @@ -512,21 +512,21 @@ function MarketRecordViewController($scope, $rootScope, $ionicModal, Wallet, Mar .then(function (id){ obj.id = id; }) - .catch(UIUtils.onError('MARKET.ERROR.FAILED_SAVE_COMMENT'));; + .catch(UIUtils.onError('MARKET.ERROR.FAILED_SAVE_COMMENT')); } // Update else { Market.record.comment.update(comment, {id: comment.id}) - .catch(UIUtils.onError('MARKET.ERROR.FAILED_SAVE_COMMENT'));; + .catch(UIUtils.onError('MARKET.ERROR.FAILED_SAVE_COMMENT')); } }); - } + }; $scope.editComment = function(index) { var comment = $scope.comments[index]; $scope.comments.splice(index, 1); $scope.commentData = comment; - } + }; $scope.removeComment = function(index) { var comment = $scope.comments[index]; @@ -534,7 +534,7 @@ function MarketRecordViewController($scope, $rootScope, $ionicModal, Wallet, Mar $scope.comments.splice(index, 1); Market.record.comment.remove(comment.id, Wallet.data.keypair) .catch(UIUtils.onError('MARKET.ERROR.FAILED_REMOVE_COMMENT')); - } + }; } function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils, $state, CryptoUtils, $q, $ionicPopup, Device, $timeout) { @@ -569,7 +569,7 @@ function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils .then(function(currencies){ $scope.formData.currency = $scope.currency; UIUtils.loading.hide(); - }) + }); } }); }); @@ -639,7 +639,7 @@ function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils } }; - $scope.formData.picturesCount = $scope.pictures.length + $scope.formData.picturesCount = $scope.pictures.length; if ($scope.formData.picturesCount > 0) { $scope.formData.pictures = $scope.pictures.reduce(function(res, pic) { return res.concat({file: UIUtils.image.toAttachment(pic)}); @@ -673,7 +673,7 @@ function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils $scope.openCurrencyLookup = function() { alert('Not implemented yet. Please submit an issue if occur again.'); - } + }; $scope.selectNewPicture = function() { if ($scope.isDeviceEnable()){ @@ -685,7 +685,7 @@ function MarketRecordEditController($scope, $ionicModal, Wallet, Market, UIUtils fileInput[0].click(); } } - } + }; $scope.openPicturePopup = function() { Device.camera.getPicture() diff --git a/www/plugins/es/js/controllers/user-controllers.js b/www/plugins/es/js/controllers/user-controllers.js index 1b531674..37fd63c4 100644 --- a/www/plugins/es/js/controllers/user-controllers.js +++ b/www/plugins/es/js/controllers/user-controllers.js @@ -82,7 +82,7 @@ function ProfileController($scope, $rootScope, UIUtils, $timeout, UserService, $ else { UIUtils.onError('PROFILE.ERROR.LOAD_PROFILE_FAILED')(err); }*/ - }) + }); }); $timeout(function () { @@ -146,14 +146,14 @@ function ProfileController($scope, $rootScope, UIUtils, $timeout, UserService, $ selector: '#social-' + $filter('formatSlug')(url) }); }, 0); - } + }; $scope.editSocialNetwork = function(index) { var social = $scope.formData.socials[index]; $scope.formData.socials.splice(index, 1); $scope.socialData.url = social.url; $focus('socialUrl'); - } + }; $scope.fileChanged = function(event) { UIUtils.loading.show(); @@ -193,7 +193,7 @@ function ProfileController($scope, $rootScope, UIUtils, $timeout, UserService, $ }) .catch(UIUtils.onError('PROFILE.ERROR.SAVE_PROFILE_FAILED')); } - } + }; if ($scope.avatar && $scope.avatar.src) { UIUtils.image.resizeSrc($scope.avatar.src, true) // resize to thumbnail diff --git a/www/plugins/es/js/services/es-services.js b/www/plugins/es/js/services/es-services.js index 88a27652..ff0f1e10 100644 --- a/www/plugins/es/js/services/es-services.js +++ b/www/plugins/es/js/services/es-services.js @@ -124,7 +124,7 @@ angular.module('cesium.es.services', ['ngResource', 'cesium.services', 'cesium.c /*$rootScope.globals = {}; $cookie.remove('globals'); $http.defaults.headers.common.Authorization = 'Basic ';*/ - }; + } function emptyHit() { return { diff --git a/www/plugins/es/js/services/market-services.js b/www/plugins/es/js/services/market-services.js index 28b52ca0..50f944f9 100644 --- a/www/plugins/es/js/services/market-services.js +++ b/www/plugins/es/js/services/market-services.js @@ -101,7 +101,7 @@ angular.module('cesium.market.services', ['ngResource', 'cesium.services', 'cesi function getCommons() { var _source = fields.commons.reduce(function(res, field){ - return res + ',' + field + return res + ',' + field; }, '').substring(1); return ESUtils.get('http://' + server + '/market/record/:id?_source=' + _source); } diff --git a/www/plugins/es/js/services/social-services.js b/www/plugins/es/js/services/social-services.js index 6ae64196..d5f7ff1a 100644 --- a/www/plugins/es/js/services/social-services.js +++ b/www/plugins/es/js/services/social-services.js @@ -35,7 +35,7 @@ angular.module('cesium.social.services', ['ngResource']) regex.EMAIL = exact(regex.EMAIL); _.keys(regex.socials).forEach(function(key){ regex.socials[key] = exact(regex.socials[key]); - }) + }); function getTypeFromUrl(url){ var type; @@ -45,7 +45,7 @@ angular.module('cesium.social.services', ['ngResource']) if (protocol == 'http' || protocol == 'https') { var slashPathIndex = url.indexOf('/', protocol.length + 3); if (slashPathIndex > 0) { - urlToMatch = url.substring(0, slashPathIndex) + urlToMatch = url.substring(0, slashPathIndex); } } console.log("match URI, try to match: " + urlToMatch); @@ -69,7 +69,7 @@ angular.module('cesium.social.services', ['ngResource']) } function getFromUrl(url) { - var url = url ? url.trim() : url; + url = url ? url.trim() : url; if (url && url.length > 0) { if (url.startsWith('www.')) { url = 'http://' + url; @@ -85,7 +85,7 @@ angular.module('cesium.social.services', ['ngResource']) function reduceArray(socials) { var map = {}; socials.forEach(function(social) { - var social = getFromUrl(social.url); + social = getFromUrl(social.url); if (social) { var id = $filter('formatSlug')(social.url); map[id] = social; -- GitLab