From cd6594aa5e4b69bfd17db3e77dbd6816f89c21a9 Mon Sep 17 00:00:00 2001 From: Mator Date: Tue, 11 Apr 2017 11:19:25 -0700 Subject: [PATCH 01/74] now displaying a loader spinner while mod analysis is being loaded --- .../Directives/editMod/modAnalysisManager.js | 10 +++++--- .../editMod/modAnalysisManager.html | 24 ++++++++++--------- 2 files changed, 20 insertions(+), 14 deletions(-) diff --git a/mod-picker/app/assets/javascripts/Directives/editMod/modAnalysisManager.js b/mod-picker/app/assets/javascripts/Directives/editMod/modAnalysisManager.js index 4a59de8cd..72dab332e 100644 --- a/mod-picker/app/assets/javascripts/Directives/editMod/modAnalysisManager.js +++ b/mod-picker/app/assets/javascripts/Directives/editMod/modAnalysisManager.js @@ -7,15 +7,18 @@ app.directive('modAnalysisManager', function() { } }); -app.controller('modAnalysisManagerController', function($scope, $rootScope, pluginService, objectUtils, assetUtils) { +app.controller('modAnalysisManagerController', function($scope, $rootScope, $timeout, pluginService, assetUtils, objectUtils) { // inherited variables $scope.currentGame = $rootScope.currentGame; $scope.changeAnalysisFile = function(event) { var input = event.target; if (input.files && input.files[0]) { - $scope.loadAnalysisFile(input.files[0]); - input.value = ""; + $scope.loadingAnalysis = true; + $timeout(function() { + $scope.loadAnalysisFile(input.files[0]); + input.value = ""; + }); } }; @@ -161,6 +164,7 @@ app.controller('modAnalysisManagerController', function($scope, $rootScope, plug analysis.mod_options.forEach($scope.prepareModOption); $scope.$applyAsync(function() { $scope.mod.analysis = analysis; + $scope.loadingAnalysis = false; $scope.getRequirementsFromAnalysis(); }); }; diff --git a/mod-picker/public/resources/directives/editMod/modAnalysisManager.html b/mod-picker/public/resources/directives/editMod/modAnalysisManager.html index aeb386490..d847e54b5 100644 --- a/mod-picker/public/resources/directives/editMod/modAnalysisManager.html +++ b/mod-picker/public/resources/directives/editMod/modAnalysisManager.html @@ -10,17 +10,19 @@

-
- -
+ +
+ +
-
- -
+
+ +
- + +
\ No newline at end of file From 012aad5f554e8c0a1a75f2356bf7aa1ca8fba00a Mon Sep 17 00:00:00 2001 From: Mator Date: Tue, 11 Apr 2017 14:44:58 -0700 Subject: [PATCH 02/74] editMod and submitMod now use $watchCollection instead of a recursive $watch --- mod-picker/app/assets/javascripts/Views/mod/editMod.js | 2 +- mod-picker/app/assets/javascripts/Views/mod/submitMod.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mod-picker/app/assets/javascripts/Views/mod/editMod.js b/mod-picker/app/assets/javascripts/Views/mod/editMod.js index 39a140d7e..81ebac4ce 100644 --- a/mod-picker/app/assets/javascripts/Views/mod/editMod.js +++ b/mod-picker/app/assets/javascripts/Views/mod/editMod.js @@ -221,5 +221,5 @@ app.controller('editModController', function($scope, $rootScope, $state, modObje } }; - $scope.$watch('mod', $scope.checkIfValid, true); + $scope.$watchCollection('mod', $scope.checkIfValid, true); }); \ No newline at end of file diff --git a/mod-picker/app/assets/javascripts/Views/mod/submitMod.js b/mod-picker/app/assets/javascripts/Views/mod/submitMod.js index 6a0aa776c..ee0c737f6 100644 --- a/mod-picker/app/assets/javascripts/Views/mod/submitMod.js +++ b/mod-picker/app/assets/javascripts/Views/mod/submitMod.js @@ -148,5 +148,5 @@ app.controller('submitModController', function($scope, $rootScope, $state, modSe }); }; - $scope.$watch('mod', $scope.checkIfValid, true); + $scope.$watchCollection('mod', $scope.checkIfValid); }); From 7f781992e3162ab04265fd68e655ce06a4a025d3 Mon Sep 17 00:00:00 2001 From: Mator Date: Tue, 11 Apr 2017 14:45:19 -0700 Subject: [PATCH 03/74] fixed non-boolean return values in modValidationService --- .../javascripts/Services/modValidationService.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/mod-picker/app/assets/javascripts/Services/modValidationService.js b/mod-picker/app/assets/javascripts/Services/modValidationService.js index 42e3dfcef..4ae94d7b4 100644 --- a/mod-picker/app/assets/javascripts/Services/modValidationService.js +++ b/mod-picker/app/assets/javascripts/Services/modValidationService.js @@ -18,14 +18,14 @@ app.service('modValidationService', function() { // if we are only submitting custom sources, we need to verify // we have all general info if (!mod.sources.length) { - sourcesValid = sourcesValid && mod.name && mod.authors && - mod.released; + sourcesValid = sourcesValid && !!mod.name && !!mod.authors && + !!mod.released; } } else { // if we don't have any custom sources we should verify we have // the scraped data for at least one official source - sourcesValid = sourcesValid && (mod.nexus || mod.workshop || mod.lab || oldSources); + sourcesValid = sourcesValid && (!!mod.nexus || !!mod.workshop || !!mod.lab || oldSources); } return sourcesValid; @@ -66,7 +66,7 @@ app.service('modValidationService', function() { var setIds = []; set.forEach(function(item) { var itemId = item[key]; - setValid = setValid && itemId; + setValid = setValid && !!itemId; if (!itemId || item._destroy) return; var idPresent = setIds.indexOf(itemId) > -1; if (idPresent) { @@ -92,13 +92,13 @@ app.service('modValidationService', function() { this.configsValid = function(config_files) { var configsValid = true; config_files.forEach(function(configFile) { - configsValid = configsValid && configFile.filename.length && - configFile.install_path.length && configFile.text_body.length; + configsValid = configsValid && !!configFile.filename.length && + !!configFile.install_path.length && !!configFile.text_body.length; }); return configsValid; }; this.categoriesValid = function(mod) { - return mod.categories && mod.categories.length <= 2 && (mod.is_official || mod.categories.length); + return !!mod.categories && mod.categories.length <= 2 && (mod.is_official || !!mod.categories.length); }; }); \ No newline at end of file From 7218d5c7b93c1b3b68c84011c466f80a387905ac Mon Sep 17 00:00:00 2001 From: Mator Date: Tue, 11 Apr 2017 14:52:20 -0700 Subject: [PATCH 04/74] added angular-elastic vendor javascript for elastic textareas --- mod-picker/app/assets/javascripts/modpicker-vendor.js | 1 + mod-picker/app/assets/javascripts/modpicker.js | 2 +- mod-picker/vendor/assets/javascripts/angular-elastic.min.js | 6 ++++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 mod-picker/vendor/assets/javascripts/angular-elastic.min.js diff --git a/mod-picker/app/assets/javascripts/modpicker-vendor.js b/mod-picker/app/assets/javascripts/modpicker-vendor.js index 1c1ce113d..c1b453399 100644 --- a/mod-picker/app/assets/javascripts/modpicker-vendor.js +++ b/mod-picker/app/assets/javascripts/modpicker-vendor.js @@ -9,4 +9,5 @@ //= require rzslider.min.js //= require angular-animate.min.js //= require angular-elastic-input.min.js +//= require angular-elastic.min.js //= require spin.min.js \ No newline at end of file diff --git a/mod-picker/app/assets/javascripts/modpicker.js b/mod-picker/app/assets/javascripts/modpicker.js index f0c70d851..fa103b7c1 100644 --- a/mod-picker/app/assets/javascripts/modpicker.js +++ b/mod-picker/app/assets/javascripts/modpicker.js @@ -20,7 +20,7 @@ if (["/skyrim", "/skyrimse"].indexOf(window.location.pathname) > -1) { } var app = angular.module('modPicker', [ - 'ui.router', 'rzModule', 'ngAnimate', 'puElasticInput', 'hc.marked', 'smoothScroll', 'relativeDate', 'ct.ui.router.extras', 'dndLists', 'pasvaz.bindonce' + 'ui.router', 'rzModule', 'ngAnimate', 'puElasticInput', 'monospaced.elastic', 'hc.marked', 'smoothScroll', 'relativeDate', 'ct.ui.router.extras', 'dndLists', 'pasvaz.bindonce' ]); app.config(['$httpProvider', '$compileProvider', '$locationProvider', function($httpProvider, $compileProvider, $locationProvider) { diff --git a/mod-picker/vendor/assets/javascripts/angular-elastic.min.js b/mod-picker/vendor/assets/javascripts/angular-elastic.min.js new file mode 100644 index 000000000..b58d607b2 --- /dev/null +++ b/mod-picker/vendor/assets/javascripts/angular-elastic.min.js @@ -0,0 +1,6 @@ +/* + * angular-elastic v2.5.1 + * (c) 2014 Monospaced http://monospaced.com + * License: MIT + */ +"undefined"!=typeof module&&"undefined"!=typeof exports&&module.exports===exports&&(module.exports="monospaced.elastic"),angular.module("monospaced.elastic",[]).constant("msdElasticConfig",{append:""}).directive("msdElastic",["$timeout","$window","msdElasticConfig",function(a,b,c){"use strict";return{require:"ngModel",restrict:"A, C",link:function(d,e,f,g){function A(){var a=m;x=h,p=getComputedStyle(h),angular.forEach(z,function(b){a+=b+":"+p.getPropertyValue(b)+";"}),o.setAttribute("style",a)}function B(){var b,c,e,f,g;x!==h&&A(),y||(y=!0,o.value=h.value+k,o.style.overflowY=h.style.overflowY,b=""===h.style.height?"auto":parseInt(h.style.height,10),c=getComputedStyle(h).getPropertyValue("width"),"px"===c.substr(c.length-2,2)&&(f=parseInt(c,10)-s.width,o.style.width=f+"px"),e=o.scrollHeight,e>w?(e=w,g="scroll"):e