diff --git a/Gruntfile.js b/Gruntfile.js index 1122e542..93c65e56 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -19,7 +19,7 @@ 'use strict'; var pkg = require('./package.json'); -var AV_CONFIG_VERSION = '103111.8'; +var AV_CONFIG_VERSION = '103111.9'; //Using exclusion patterns slows down Grunt significantly //instead of creating a set of patterns like '**/*.js' and '!**/node_modules/**' @@ -195,10 +195,10 @@ module.exports = function (grunt) { options: { remove: ['script[data-remove!="false"]','link[data-remove!="false"]'], append: [ - {selector:'body',html:''}, + {selector:'body',html:''}, {selector:'body',html:''}, - {selector:'body',html:''}, - {selector:'body',html:''}, + {selector:'body',html:''}, + {selector:'body',html:''}, {selector:'head',html:''} ] }, @@ -228,9 +228,9 @@ module.exports = function (grunt) { 'temp/libnocompat.js': ['<%= dom_munger.data.libnocompatjs %>'], 'temp/lib.js': ['<%= dom_munger.data.libjs %>'], 'temp/app.js': ['<%= dom_munger.data.appjs %>','<%= ngtemplates.main.dest %>'], - 'dist/avConfig-v103111.8.js': ['avConfig.js'], - 'dist/avThemes-v103111.8.js': ['avThemes.js'], - 'dist/avPlugins-v103111.8.js': ['plugins/**/*.js'] + 'dist/avConfig-v103111.9.js': ['avConfig.js'], + 'dist/avThemes-v103111.9.js': ['avThemes.js'], + 'dist/avPlugins-v103111.9.js': ['plugins/**/*.js'] } } }, @@ -262,10 +262,10 @@ module.exports = function (grunt) { beautify: true }, files: { - 'dist/appCommon-v103111.8.js': 'temp/app.js', - 'dist/libCommon-v103111.8.js': 'temp/lib.js', - 'dist/libnocompat-v103111.8.js': 'temp/libnocompat.js', - 'dist/libcompat-v103111.8.js': 'temp/libcompat.js', + 'dist/appCommon-v103111.9.js': 'temp/app.js', + 'dist/libCommon-v103111.9.js': 'temp/lib.js', + 'dist/libnocompat-v103111.9.js': 'temp/libnocompat.js', + 'dist/libcompat-v103111.9.js': 'temp/libcompat.js', 'dist/avWidgets.js': 'avWidgets.js', "dist/locales/moment/es.js": "bower_components/moment/lang/es.js", @@ -348,6 +348,7 @@ module.exports = function (grunt) { grunt.registerTask('build',['check_config', 'jshint','clean:before','less','autoprefixer','dom_munger','ngtemplates','cssmin','concat','merge-json','ngAnnotate','uglify','copy','htmlmin','imagemin','clean:after']); grunt.registerTask('serve', ['dom_munger:read','jshint','connect', 'watch']); grunt.registerTask('test',['dom_munger:read','karma:all_tests']); + grunt.registerTask('default',[]); grunt.event.on('watch', function(action, filepath) { //https://github.com/gruntjs/grunt-contrib-watch/issues/156 diff --git a/avConfig.js b/avConfig.js index 7ffa5c94..9e8fb835 100644 --- a/avConfig.js +++ b/avConfig.js @@ -20,7 +20,7 @@ * in this same file, which you might want to edit and tune if needed. */ -var AV_CONFIG_VERSION = '103111.8'; +var AV_CONFIG_VERSION = '103111.9'; var avConfigData = { // the base url path for ajax requests, for example for sending ballots or diff --git a/bower.json b/bower.json index 0042cd66..ec62afd9 100755 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "avCommon", - "version" : "103111.8", + "version" : "103111.9", "main": "index.html", "ignore": [ "tests", diff --git a/dist/appCommon-v103111.8.js b/dist/appCommon-v103111.9.js similarity index 96% rename from dist/appCommon-v103111.8.js rename to dist/appCommon-v103111.9.js index f65699f5..635db82f 100644 --- a/dist/appCommon-v103111.8.js +++ b/dist/appCommon-v103111.9.js @@ -64,7 +64,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C }; return data; } - return void 0 === userid ? $http.get(backendUrl + "user/", {}) : $http.get(backendUrl + "user/%d" % userid, {}); + return "undefined" == typeof userid ? $http.get(backendUrl + "user/", {}) : $http.get(backendUrl + "user/%d" % userid, {}); }, authmethod.ping = function() { if (!authmethod.isLoggedIn()) { var data = { @@ -117,7 +117,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C }) : $http.get(backendUrl + "auth-event/" + id + "/census/"); }, authmethod.getRegisterFields = function(viewEventData) { var fields = _.filter(angular.copy(viewEventData.extra_fields), function(item) { - return !0 !== item.required_when_registered; + return !0 === item.required_when_registered ? !1 : !0; }); fields || (fields = []); var found = !1; @@ -259,7 +259,9 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C } ]), angular.module("avRegistration").directive("avLogin", [ "Authmethod", "StateDataService", "$parse", "$state", "$location", "$cookies", "$i18next", "$window", "$timeout", "ConfigService", "Patterns", function(Authmethod, StateDataService, $parse, $state, $location, $cookies, $i18next, $window, $timeout, ConfigService, Patterns) { function link(scope, element, attrs) { function isValidTel(inputName) { - return !!document.getElementById(inputName) && angular.element(document.getElementById(inputName)).intlTelInput("isValidNumber"); + if (!document.getElementById(inputName)) return !1; + var telInput = angular.element(document.getElementById(inputName)); + return telInput.intlTelInput("isValidNumber"); } function isValidEmail(email) { var pattern = Patterns.get("email"); @@ -342,10 +344,10 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C el.disabled = !0), scope.telIndex = index + 1, scope.telField = el) : "tlf" === el.type && "sms-otp" === scope.method && (null !== scope.email && -1 === scope.email.indexOf("@") && (el.value = scope.email, el.disabled = !0, scope.currentFormStep = 1), scope.telIndex = index + 1, scope.telField = el), el; - }); - _.filter(fields, function(el) { + }), filled_fields = _.filter(fields, function(el) { return null !== el.value; - }).length === scope.login_fields.length && scope.loginUser(!0); + }); + filled_fields.length === scope.login_fields.length && scope.loginUser(!0); }, scope.view = function(id) { Authmethod.viewEvent(id).success(function(data) { "ok" === data.status ? scope.apply(data.events) : (scope.status = "Not found", document.querySelector(".input-error").style.display = "block"); @@ -493,9 +495,10 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C function link(scope, element, attrs) { scope.dni_re = /^[XYZ]?\d{7,8}[A-Z]$/, scope.validateDni = function(str) { str || (str = ""), str = str.toUpperCase().replace(/\s/, ""); - var prefix = str.charAt(0), index = "XYZ".indexOf(prefix); - return index > -1 && (index, str = str.substr(1), "Y" === prefix ? str = "1" + str : "Z" === prefix && (str = "2" + str)), - "TRWAGMYFPDXBNJZSQVHLCKE".charAt(parseInt(str, 10) % 23) === str.charAt(str.length - 1); + var prefix = str.charAt(0), index = "XYZ".indexOf(prefix), niePrefix = 0; + index > -1 && (niePrefix = index, str = str.substr(1), "Y" === prefix ? str = "1" + str : "Z" === prefix && (str = "2" + str)); + var dni_letters = "TRWAGMYFPDXBNJZSQVHLCKE", letter = dni_letters.charAt(parseInt(str, 10) % 23); + return letter === str.charAt(str.length - 1); }; } return { @@ -552,7 +555,9 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C var validateTel = function() { scope.$evalAsync(function() { var intlNumber = telInput.intlTelInput("getNumber"); - intlNumber && (scope.field.value = intlNumber), !telInput.intlTelInput("isValidNumber") && $("#input" + scope.index).val().replace("[ \t\n]", "").length > 0 ? (telInput.toggleClass("error", !0), + intlNumber && (scope.field.value = intlNumber); + var isValid = telInput.intlTelInput("isValidNumber"); + !isValid && $("#input" + scope.index).val().replace("[ \n]", "").length > 0 ? (telInput.toggleClass("error", !0), scope.isValidNumber = !1) : (telInput.toggleClass("error", !1), scope.isValidNumber = !0); }); }; @@ -639,7 +644,8 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C plugins.signals.fire(signalName, data); }, plugins.hook = function(hookname, data) { for (var i = 0; i < plugins.hooks.length; i++) { - if (!(0, plugins.hooks[i])(hookname, data)) return !1; + var h = plugins.hooks[i], ret = h(hookname, data); + if (!ret) return !1; } return !0; }, plugins; @@ -797,10 +803,12 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C }; } ]), angular.module("avUi").directive("avCollapsing", [ "$window", "$timeout", function($window, $timeout) { function collapseEl(instance, el) { - return instance.collapseSelector ? select(instance, el, instance.collapseSelector) : angular.element(el); + var val = null; + return val = instance.collapseSelector ? select(instance, el, instance.collapseSelector) : angular.element(el); } function select(instance, el, selector) { - return instance.parentSelector ? el.closest(instance.parentSelector).find(selector) : angular.element(selector); + var val; + return val = instance.parentSelector ? el.closest(instance.parentSelector).find(selector) : angular.element(selector); } var checkCollapse = function(instance, el, options) { var maxHeight = select(instance, el, instance.maxHeightSelector).css("max-height"), height = angular.element(el)[0].scrollHeight; @@ -897,7 +905,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C } if (void 0 === format && (format = "str"), 0 === total_votes) return print(0); var base = question.totals.valid_votes + question.totals.null_votes + question.totals.blank_votes; - return void 0 !== over && null !== over || (over = question.answer_total_votes_percentage), + return (void 0 === over || null === over) && (over = question.answer_total_votes_percentage), "over-valid-votes" === over || "over-total-valid-votes" === over ? base = question.totals.valid_votes : "over-total-valid-points" === over && void 0 !== question.totals.valid_points && (base = question.totals.valid_points), print(100 * total_votes / base); }; @@ -917,9 +925,11 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C angular.isUndefined(d.errorData) && (d.errorData = {}); var ret = _.every(d.checks, function(item) { var itemMin, itemMax, max, min, pass = !0; - if ("is-int" === item.check) (pass = angular.isNumber(d.data[item.key], item.postfix)) || error(item.check, { + if ("is-int" === item.check) pass = angular.isNumber(d.data[item.key], item.postfix), + pass || error(item.check, { key: item.key - }, item.postfix); else if ("is-array" === item.check) (pass = angular.isArray(d.data[item.key], item.postfix)) || error(item.check, { + }, item.postfix); else if ("is-array" === item.check) pass = angular.isArray(d.data[item.key], item.postfix), + pass || error(item.check, { key: item.key }, item.postfix); else if ("lambda" === item.check) { if (!item.validator(d.data[item.key])) { @@ -930,7 +940,8 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C _.isObject(item.append) && _.isString(item.append.key) && !_.isUndefined(item.append.value) && (errorData[item.append.key] = evalValue(item.append.value, item)), error(item.check, errorData, item.postfix); } - } else if ("is-string-if-defined" === item.check) (pass = angular.isUndefined(d.data[item.key]) || angular.isString(d.data[item.key], item.postfix)) || error(item.check, { + } else if ("is-string-if-defined" === item.check) pass = angular.isUndefined(d.data[item.key]) || angular.isString(d.data[item.key], item.postfix), + pass || error(item.check, { key: item.key }, item.postfix); else if ("array-length-if-defined" === item.check) { if (angular.isDefined(d.data[item.key]) && (itemMin = evalValue(item.min, d.data), @@ -948,7 +959,8 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C }; error("array-length-max", itemErrorData0, item.postfix); } - } else if ("is-string" === item.check) (pass = angular.isString(d.data[item.key], item.postfix)) || error(item.check, { + } else if ("is-string" === item.check) pass = angular.isString(d.data[item.key], item.postfix), + pass || error(item.check, { key: item.key }, item.postfix); else if ("array-length" === item.check) { if (itemMin = evalValue(item.min, d.data), itemMax = evalValue(item.max, d.data), @@ -1028,7 +1040,7 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C }); }); } - return !(!pass && "chain" === d.data.groupType); + return pass || "chain" !== d.data.groupType ? !0 : !1; }); return ret; } @@ -1038,9 +1050,9 @@ angular.module("avRegistration").factory("Authmethod", [ "$http", "$cookies", "C angular.isNumber(fixedDigits) && fixedDigits >= 0 && (number = number.toFixed(parseInt(fixedDigits))); var number_str = (number + "").replace(".", ","), ret = "", commaPos = number_str.length; -1 !== number_str.indexOf(",") && (commaPos = number_str.indexOf(",")); - for (var i = 0; i < commaPos; i++) { + for (var i = 0; commaPos > i; i++) { var reverse = commaPos - i; - reverse % 3 == 0 && reverse > 0 && i > 0 && (ret += "."), ret += number_str[i]; + reverse % 3 === 0 && reverse > 0 && i > 0 && (ret += "."), ret += number_str[i]; } return ret + number_str.substr(commaPos, number_str.length); }; @@ -1191,6 +1203,6 @@ angular.module("jm.i18next").config([ "$i18nextProvider", "ConfigServiceProvider $templateCache.put("avUi/documentation-directive/documentation-directive.html", '
'), $templateCache.put("avUi/foot-directive/foot-directive.html", '