diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000000..7874581198 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,3 @@ +node_modules/ +tools/ +src/assets/font-awesome-custom/ \ No newline at end of file diff --git a/.eslintrc.json b/.eslintrc.json index f726384a76..91880b905e 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -3,11 +3,7 @@ "env": { "node": true }, - "extends": [ - "plugin:vue/recommended", - "eslint:recommended", - "@vue/standard" - ], + "extends": ["plugin:vue/recommended", "@vue/prettier"], "rules": { "no-unused-vars": "warn", "no-console": "warn", @@ -19,70 +15,9 @@ "vue/no-use-v-if-with-v-for": "error", "vue/prop-name-casing": ["error", "camelCase"], "eqeqeq": "warn", - "camelcase": "off", - - "no-trailing-spaces": "off", - "semi": [ - "error", - "always" - ], - "quotes": "off", - "object-curly-spacing": "warn", - "brace-style": [ - "warn", - "1tbs", - { - "allowSingleLine": false - } - ], - "space-before-function-paren": [ - "warn", - "never" - ], - "object-shorthand": [ - "error", - "always" - ], - "no-var": "error", - "prefer-const": "error", - "no-multi-assign": "error", - "space-infix-ops": "warn", - "indent": [ - "off", - 2 - ], - "vue/html-indent": [ - "off", - 2 - ], - "vue/script-indent": [ - "off", - 2, - { - "baseIndent": 1 - } - ], - "vue/no-multi-spaces": "warn", - "vue/max-attributes-per-line": ["warn", { - "singleline": 4, - "multiline": { - "max": 1, - "allowFirstLine": false - } - }], - "vue/html-closing-bracket-newline": "off", - "vue/html-closing-bracket-spacing": "off", - "array-bracket-spacing": "off", - "vue/multiline-html-element-content-newline": "off", - "vue/singleline-html-element-content-newline": "off", - "quote-props": "off", - "object-curly-newline": "off", - "dot-notation": "off", - "vue/no-spaces-around-equal-signs-in-attribute": "off", - "lines-between-class-members": "off", - "keyword-spacing": "off" + "camelcase": "off" }, "parserOptions": { "parser": "babel-eslint" } -} \ No newline at end of file +} diff --git a/.prettierignore b/.prettierignore new file mode 100644 index 0000000000..a713f2482a --- /dev/null +++ b/.prettierignore @@ -0,0 +1,2 @@ +src/assets/font-awesome-custom/ +src/translations/ \ No newline at end of file diff --git a/.prettierrc b/.prettierrc new file mode 100644 index 0000000000..9284ec1b7f --- /dev/null +++ b/.prettierrc @@ -0,0 +1,7 @@ +{ + "semi": true, + "vueIndentScriptAndStyle": false, + "endOfLine": "lf", + "singleQuote": true, + "printWidth": 120 +} \ No newline at end of file diff --git a/babel.config.js b/babel.config.js index 93d5322c65..02fb2b5a30 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,15 +1,12 @@ module.exports = { presets: [ - ['@vue/cli-plugin-babel/preset', { - // see https://cli.vuejs.org/guide/browser-compatibility.html#usebuiltins-usage - // those are set only for IE11 and can be dropped when abandonned - polyfills: [ - 'es6.promise', - 'es6.symbol', - 'es6.array.from', - 'es6.object.assign', - 'es7.object.values' - ] - }] - ] + [ + '@vue/cli-plugin-babel/preset', + { + // see https://cli.vuejs.org/guide/browser-compatibility.html#usebuiltins-usage + // those are set only for IE11 and can be dropped when abandonned + polyfills: ['es6.promise', 'es6.symbol', 'es6.array.from', 'es6.object.assign', 'es7.object.values'], + }, + ], + ], }; diff --git a/package-lock.json b/package-lock.json index 4e46ad3f67..6e3e010c31 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1230,6 +1230,14 @@ "semver": "^6.0.0", "source-map-support": "^0.5.11", "tslib": "^1.10.0" + }, + "dependencies": { + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true + } } } } @@ -1574,6 +1582,12 @@ "integrity": "sha512-f5j5b/Gf71L+dbqxIpQ4Z2WlmI/mPJ0fOkGGmFgtb6sAu97EPczzbS3/tJKxmcYDj55OX6ssqwDAWOHIYDRDGA==", "dev": true }, + "@types/parse-json": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.0.tgz", + "integrity": "sha512-//oorEZjL6sbPcKUaCdIGlIUeH26mgzimjBB77G6XRgnDl/L5wOnpyBGRe/Mmf5CVW3PwEBE1NjiMZ/ssFh4wA==", + "dev": true + }, "@types/q": { "version": "1.5.2", "resolved": "https://registry.npmjs.org/@types/q/-/q-1.5.2.tgz", @@ -2191,6 +2205,13 @@ "yallist": "^2.1.2" } }, + "prettier": { + "version": "1.19.1", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", + "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "dev": true, + "optional": true + }, "yallist": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/yallist/-/yallist-2.1.2.tgz", @@ -2199,6 +2220,15 @@ } } }, + "@vue/eslint-config-prettier": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/@vue/eslint-config-prettier/-/eslint-config-prettier-6.0.0.tgz", + "integrity": "sha512-wFQmv45c3ige5EA+ngijq40YpVcIkAy0Lihupnsnd1Dao5CBbPyfCzqtejFLZX1EwH/kCJdpz3t6s+5wd3+KxQ==", + "dev": true, + "requires": { + "eslint-config-prettier": "^6.0.0" + } + }, "@vue/eslint-config-standard": { "version": "5.1.2", "resolved": "https://registry.npmjs.org/@vue/eslint-config-standard/-/eslint-config-standard-5.1.2.tgz", @@ -2671,6 +2701,12 @@ "integrity": "sha1-45sJrqne+Gao8gbiiK9jkZuuOcQ=", "dev": true }, + "array-differ": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/array-differ/-/array-differ-3.0.0.tgz", + "integrity": "sha512-THtfYS6KtME/yIAhKjZ2ul7XI96lQGHRputJQHO80LAWQnuGP4iCIN8vdMRboGbIEYBwU33q8Tch1os2+X0kMg==", + "dev": true + }, "array-find": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/array-find/-/array-find-1.0.0.tgz", @@ -2731,6 +2767,12 @@ "es-abstract": "^1.17.0-next.1" } }, + "arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "dev": true + }, "asap": { "version": "2.0.6", "resolved": "https://registry.npmjs.org/asap/-/asap-2.0.6.tgz", @@ -4337,6 +4379,12 @@ "integrity": "sha1-3dgA2gxmEnOTzKWVDqloo6rxJTs=", "dev": true }, + "compare-versions": { + "version": "3.6.0", + "resolved": "https://registry.npmjs.org/compare-versions/-/compare-versions-3.6.0.tgz", + "integrity": "sha512-W6Af2Iw1z4CB7q4uU4hv646dW9GQuBM+YpC0UvUCWSD8w90SJjp+ujJuXaEMtAXBtSqGfMPuFOVn4/+FlaqfBA==", + "dev": true + }, "component-emitter": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/component-emitter/-/component-emitter-1.3.0.tgz", @@ -6150,6 +6198,23 @@ } } }, + "eslint-config-prettier": { + "version": "6.11.0", + "resolved": "https://registry.npmjs.org/eslint-config-prettier/-/eslint-config-prettier-6.11.0.tgz", + "integrity": "sha512-oB8cpLWSAjOVFEJhhyMZh6NOEOtBVziaqdDQ86+qhDHFbZXoRTM7pNSvFRfW/W/L/LrQ38C99J5CGuRBBzBsdA==", + "dev": true, + "requires": { + "get-stdin": "^6.0.0" + }, + "dependencies": { + "get-stdin": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", + "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "dev": true + } + } + }, "eslint-config-standard": { "version": "14.1.1", "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.1.1.tgz", @@ -6401,6 +6466,15 @@ } } }, + "eslint-plugin-prettier": { + "version": "3.1.3", + "resolved": "https://registry.npmjs.org/eslint-plugin-prettier/-/eslint-plugin-prettier-3.1.3.tgz", + "integrity": "sha512-+HG5jmu/dN3ZV3T6eCD7a4BlAySdN7mLIbJYo0z1cFQuI+r2DiTJEFeF68ots93PsnrMxbzIZ2S/ieX+mkrBeQ==", + "dev": true, + "requires": { + "prettier-linter-helpers": "^1.0.0" + } + }, "eslint-plugin-promise": { "version": "4.2.1", "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.2.1.tgz", @@ -6801,6 +6875,12 @@ "integrity": "sha1-ewUhjd+WZ79/Nwv3/bLLFf3Qqkk=", "dev": true }, + "fast-diff": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/fast-diff/-/fast-diff-1.2.0.tgz", + "integrity": "sha512-xJuoT5+L99XlZ8twedaRf6Ax2TgQVxvgZOYoPKqZufmJib0tL2tegPBOZb1pVNgIhlqDlA0eO0c3wBvQcmzx4w==", + "dev": true + }, "fast-glob": { "version": "2.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-2.2.7.tgz", @@ -6986,6 +7066,15 @@ "locate-path": "^2.0.0" } }, + "find-versions": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/find-versions/-/find-versions-3.2.0.tgz", + "integrity": "sha512-P8WRou2S+oe222TOCHitLy8zj+SIsVJh52VP4lvXkaFVnOFFdoWv1H1Jjvel1aI6NCFOAaeAVm8qrI0odiLcww==", + "dev": true, + "requires": { + "semver-regex": "^2.0.0" + } + }, "flat-cache": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-2.0.1.tgz", @@ -7922,6 +8011,181 @@ "integrity": "sha512-SEQu7vl8KjNL2eoGBLF3+wAjpsNfA9XMlXAYj/3EdaNfAlxKthD1xjEQfGOUhllCGGJVNY34bRr6lPINhNjyZw==", "dev": true }, + "husky": { + "version": "4.2.5", + "resolved": "https://registry.npmjs.org/husky/-/husky-4.2.5.tgz", + "integrity": "sha512-SYZ95AjKcX7goYVZtVZF2i6XiZcHknw50iXvY7b0MiGoj5RwdgRQNEHdb+gPDPCXKlzwrybjFjkL6FOj8uRhZQ==", + "dev": true, + "requires": { + "chalk": "^4.0.0", + "ci-info": "^2.0.0", + "compare-versions": "^3.6.0", + "cosmiconfig": "^6.0.0", + "find-versions": "^3.2.0", + "opencollective-postinstall": "^2.0.2", + "pkg-dir": "^4.2.0", + "please-upgrade-node": "^3.2.0", + "slash": "^3.0.0", + "which-pm-runs": "^1.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "4.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.2.1.tgz", + "integrity": "sha512-9VGjrMsG1vePxcSweQsN20KY/c4zN0h9fLjqAbwbPfahM3t+NL+M9HC8xeXG2I8pX5NoamTGNuomEUFI7fcUjA==", + "dev": true, + "requires": { + "@types/color-name": "^1.1.1", + "color-convert": "^2.0.1" + } + }, + "chalk": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.0.0.tgz", + "integrity": "sha512-N9oWFcegS0sFr9oh1oz2d7Npos6vNoWW9HvtCg5N1KRFpUhaAhvTv5Y58g880fZaEYSNm3qDz8SU1UrGvp+n7A==", + "dev": true, + "requires": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + } + }, + "ci-info": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-2.0.0.tgz", + "integrity": "sha512-5tK7EtrZ0N+OLFMthtqOj4fI2Jeb88C4CAZPu25LDVUgXJ0A3Js4PMGqrn0JU1W0Mh1/Z8wZzYPxqUrXeBboCQ==", + "dev": true + }, + "color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "requires": { + "color-name": "~1.1.4" + } + }, + "color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "cosmiconfig": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-6.0.0.tgz", + "integrity": "sha512-xb3ZL6+L8b9JLLCx3ZdoZy4+2ECphCMo2PwqgP1tlfVq6M6YReyzBJtvWWtbDSpNr9hn96pkCiZqUcFEc+54Qg==", + "dev": true, + "requires": { + "@types/parse-json": "^4.0.0", + "import-fresh": "^3.1.0", + "parse-json": "^5.0.0", + "path-type": "^4.0.0", + "yaml": "^1.7.2" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true + }, + "import-fresh": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/import-fresh/-/import-fresh-3.2.1.tgz", + "integrity": "sha512-6e1q1cnWP2RXD9/keSkxHScg508CdXqXWgWBaETNhyuBFz+kUZlKboh+ISK+bU++DmbHimVBrOz/zzPe0sZ3sQ==", + "dev": true, + "requires": { + "parent-module": "^1.0.0", + "resolve-from": "^4.0.0" + } + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-type": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-type/-/path-type-4.0.0.tgz", + "integrity": "sha512-gDKb8aZMDeD/tZWs9P6+q0J9Mwkdl6xMV8TjnGP3qJVJ06bdMgkbBlLU8IdfOsIsFz2BW1rNVT3XuNEl8zPAvw==", + "dev": true + }, + "pkg-dir": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/pkg-dir/-/pkg-dir-4.2.0.tgz", + "integrity": "sha512-HRDzbaKjC+AOWVXxAU/x54COGeIv9eb+6CkDSQoNTt4XyWoIJvuPsXizxu/Fr23EiekbtZwmh1IcIG/l/a10GQ==", + "dev": true, + "requires": { + "find-up": "^4.0.0" + } + }, + "resolve-from": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-4.0.0.tgz", + "integrity": "sha512-pb/MYmXstAkysRFx8piNI1tGFNQIFA3vkE3Gq4EuA1dF6gHp/+vgZqsCGJapvy8N3Q+4o7FwvquPJcnZ7RYy4g==", + "dev": true + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true + }, + "supports-color": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.1.0.tgz", + "integrity": "sha512-oRSIpR8pxT1Wr2FquTNnGet79b3BWljqOuoW/h4oBhxJ/HUbX5nX6JSruTkvXDCFMwDPvsaTTbvMLKZWSy0R5g==", + "dev": true, + "requires": { + "has-flag": "^4.0.0" + } + } + } + }, "iconv-lite": { "version": "0.4.24", "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz", @@ -9703,6 +9967,12 @@ "run-queue": "^1.0.3" } }, + "mri": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/mri/-/mri-1.1.5.tgz", + "integrity": "sha512-d2RKzMD4JNyHMbnbWnznPaa8vbdlq/4pNZ3IgdaGrVbBhebBsGUUE/6qorTMYNS6TwuH3ilfOlD2bf4Igh8CKg==", + "dev": true + }, "ms": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz", @@ -9724,6 +9994,27 @@ "integrity": "sha1-iZ8R2WhuXgXLkbNdXw5jt3PPyQE=", "dev": true }, + "multimatch": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/multimatch/-/multimatch-4.0.0.tgz", + "integrity": "sha512-lDmx79y1z6i7RNx0ZGCPq1bzJ6ZoDDKbvh7jxr9SJcWLkShMzXrHbYVpTdnhNM5MXpDUxCQ4DgqVttVXlBgiBQ==", + "dev": true, + "requires": { + "@types/minimatch": "^3.0.3", + "array-differ": "^3.0.0", + "array-union": "^2.1.0", + "arrify": "^2.0.1", + "minimatch": "^3.0.4" + }, + "dependencies": { + "array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", + "dev": true + } + } + }, "mute-stream": { "version": "0.0.7", "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.7.tgz", @@ -10313,6 +10604,12 @@ "is-wsl": "^1.1.0" } }, + "opencollective-postinstall": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/opencollective-postinstall/-/opencollective-postinstall-2.0.2.tgz", + "integrity": "sha512-pVOEP16TrAO2/fjej1IdOyupJY8KDUM1CvsaScRbw6oddvpQoOfGk4ywha0HKKVAD6RkW4x6Q+tNBwhf3Bgpuw==", + "dev": true + }, "opener": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/opener/-/opener-1.5.1.tgz", @@ -10815,6 +11112,15 @@ "find-up": "^2.1.0" } }, + "please-upgrade-node": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/please-upgrade-node/-/please-upgrade-node-3.2.0.tgz", + "integrity": "sha512-gQR3WpIgNIKwBMVLkpMUeR3e1/E1y42bqDQZfql+kDeXd8COYfM8PQA4X6y7a8u9Ua9FHmsrrmirW2vHs45hWg==", + "dev": true, + "requires": { + "semver-compare": "^1.0.0" + } + }, "pnp-webpack-plugin": { "version": "1.6.4", "resolved": "https://registry.npmjs.org/pnp-webpack-plugin/-/pnp-webpack-plugin-1.6.4.tgz", @@ -11464,11 +11770,20 @@ "dev": true }, "prettier": { - "version": "1.19.1", - "resolved": "https://registry.npmjs.org/prettier/-/prettier-1.19.1.tgz", - "integrity": "sha512-s7PoyDv/II1ObgQunCbB9PdLmUcBZcnWOcxDh7O0N/UwDEsHyqkW+Qh28jW+mVuCdx7gLB0BotYI1Y6uI9iyew==", + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/prettier/-/prettier-2.0.5.tgz", + "integrity": "sha512-7PtVymN48hGcO4fGjybyBSIWDsLU4H4XlvOHfq91pz9kkGlonzwTfYkaIEwiRg/dAJF9YlbsduBAgtYLi+8cFg==", "dev": true }, + "prettier-linter-helpers": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/prettier-linter-helpers/-/prettier-linter-helpers-1.0.0.tgz", + "integrity": "sha512-GbK2cP9nraSSUF9N2XwUwqfzlAFlMNYYl+ShE/V+H8a9uNl/oUqB1w2EL54Jh0OlyRSd8RfWYJ3coVS4TROP2w==", + "dev": true, + "requires": { + "fast-diff": "^1.1.2" + } + }, "pretty-error": { "version": "2.1.1", "resolved": "https://registry.npmjs.org/pretty-error/-/pretty-error-2.1.1.tgz", @@ -11479,6 +11794,180 @@ "utila": "~0.4" } }, + "pretty-quick": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pretty-quick/-/pretty-quick-2.0.1.tgz", + "integrity": "sha512-y7bJt77XadjUr+P1uKqZxFWLddvj3SKY6EU4BuQtMxmmEFSMpbN132pUWdSG1g1mtUfO0noBvn7wBf0BVeomHg==", + "dev": true, + "requires": { + "chalk": "^2.4.2", + "execa": "^2.1.0", + "find-up": "^4.1.0", + "ignore": "^5.1.4", + "mri": "^1.1.4", + "multimatch": "^4.0.0" + }, + "dependencies": { + "cross-spawn": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.2.tgz", + "integrity": "sha512-PD6G8QG3S4FK/XCGFbEQrDqO2AnMMsy0meR7lerlIOHAAbkuavGU/pOqprrlvfTNjvowivTeBsjebAL0NSoMxw==", + "dev": true, + "requires": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + } + }, + "execa": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/execa/-/execa-2.1.0.tgz", + "integrity": "sha512-Y/URAVapfbYy2Xp/gb6A0E7iR8xeqOCXsuuaoMn7A5PzrXUK84E1gyiEfq0wQd/GHA6GsoHWwhNq8anb0mleIw==", + "dev": true, + "requires": { + "cross-spawn": "^7.0.0", + "get-stream": "^5.0.0", + "is-stream": "^2.0.0", + "merge-stream": "^2.0.0", + "npm-run-path": "^3.0.0", + "onetime": "^5.1.0", + "p-finally": "^2.0.0", + "signal-exit": "^3.0.2", + "strip-final-newline": "^2.0.0" + } + }, + "find-up": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-4.1.0.tgz", + "integrity": "sha512-PpOwAdQ/YlXQ2vj8a3h8IipDuYRi3wceVQQGYWxNINccq40Anw7BlsEXCMbt1Zt+OLA6Fq9suIpIWD0OsnISlw==", + "dev": true, + "requires": { + "locate-path": "^5.0.0", + "path-exists": "^4.0.0" + } + }, + "get-stream": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/get-stream/-/get-stream-5.1.0.tgz", + "integrity": "sha512-EXr1FOzrzTfGeL0gQdeFEvOMm2mzMOglyiOXSTpPC+iAjAKftbr3jpCMWynogwYnM+eSj9sHGc6wjIcDvYiygw==", + "dev": true, + "requires": { + "pump": "^3.0.0" + } + }, + "ignore": { + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", + "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", + "dev": true + }, + "is-stream": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.0.tgz", + "integrity": "sha512-XCoy+WlUr7d1+Z8GgSuXmpuUFC9fOhRXglJMx+dwLKTkL44Cjd4W1Z5P+BQZpr+cR93aGP4S/s7Ftw6Nd/kiEw==", + "dev": true + }, + "locate-path": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-5.0.0.tgz", + "integrity": "sha512-t7hw9pI+WvuwNJXwk5zVHpyhIqzg2qTlklJOf0mVxGSbe3Fp2VieZcduNYjaLDoy6p9uGpQEGWG87WpMKlNq8g==", + "dev": true, + "requires": { + "p-locate": "^4.1.0" + } + }, + "mimic-fn": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz", + "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg==", + "dev": true + }, + "npm-run-path": { + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/npm-run-path/-/npm-run-path-3.1.0.tgz", + "integrity": "sha512-Dbl4A/VfiVGLgQv29URL9xshU8XDY1GeLy+fsaZ1AA8JDSfjvr5P5+pzRbWqRSBxk6/DW7MIh8lTM/PaGnP2kg==", + "dev": true, + "requires": { + "path-key": "^3.0.0" + } + }, + "onetime": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.0.tgz", + "integrity": "sha512-5NcSkPHhwTVFIQN+TUqXoS5+dlElHXdpAWu9I0HP20YOtIi+aZ0Ct82jdlILDxjLEAWwvm+qj1m6aEtsDVmm6Q==", + "dev": true, + "requires": { + "mimic-fn": "^2.1.0" + } + }, + "p-finally": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/p-finally/-/p-finally-2.0.1.tgz", + "integrity": "sha512-vpm09aKwq6H9phqRQzecoDpD8TmVyGw70qmWlyq5onxY7tqyTTFVvxMykxQSQKILBSFlbXpypIw2T1Ml7+DDtw==", + "dev": true + }, + "p-limit": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-2.3.0.tgz", + "integrity": "sha512-//88mFWSJx8lxCzwdAABTJL2MyWB12+eIY7MDL2SqLmAkeKU9qxRvWuSyTjm3FUmpBEMuFfckAIqEaVGUDxb6w==", + "dev": true, + "requires": { + "p-try": "^2.0.0" + } + }, + "p-locate": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-4.1.0.tgz", + "integrity": "sha512-R79ZZ/0wAxKGu3oYMlz8jy/kbhsNrS7SKZ7PxEHBgJ5+F2mtFW2fK2cOtBh1cHYkQsbzFV7I+EoRKe6Yt0oK7A==", + "dev": true, + "requires": { + "p-limit": "^2.2.0" + } + }, + "p-try": { + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/p-try/-/p-try-2.2.0.tgz", + "integrity": "sha512-R4nPAVTAU0B9D35/Gk3uJf/7XYbQcyohSKdvAxIRSNghFl4e71hVoGnBNQz9cWaXxO2I10KTC+3jMdvvoKw6dQ==", + "dev": true + }, + "path-exists": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-4.0.0.tgz", + "integrity": "sha512-ak9Qy5Q7jYb2Wwcey5Fpvg2KoAc/ZIhLSLOSBmRmygPsGwkVVt0fZa0qrtMz+m6tJTAHfZQ8FnmB4MG4LWy7/w==", + "dev": true + }, + "path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "dev": true + }, + "shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dev": true, + "requires": { + "shebang-regex": "^3.0.0" + } + }, + "shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "dev": true + }, + "which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dev": true, + "requires": { + "isexe": "^2.0.0" + } + } + } + }, "private": { "version": "0.1.8", "resolved": "https://registry.npmjs.org/private/-/private-0.1.8.tgz", @@ -12514,6 +13003,12 @@ "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, + "semver-compare": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/semver-compare/-/semver-compare-1.0.0.tgz", + "integrity": "sha1-De4hahyUGrN+nvsXiPavxf9VN/w=", + "dev": true + }, "semver-diff": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/semver-diff/-/semver-diff-2.1.0.tgz", @@ -12531,6 +13026,12 @@ } } }, + "semver-regex": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/semver-regex/-/semver-regex-2.0.0.tgz", + "integrity": "sha512-mUdIBBvdn0PLOeP3TEkMH7HHeUP3GjsXCwKarjv/kGmUFOYg1VqEemKhoQpWMu6X2I8kHeuVdGibLGkVK+/5Qw==", + "dev": true + }, "send": { "version": "0.17.1", "resolved": "https://registry.npmjs.org/send/-/send-0.17.1.tgz", @@ -15572,6 +16073,12 @@ "integrity": "sha1-2e8H3Od7mQK4o6j6SzHD4/fm6Ho=", "dev": true }, + "which-pm-runs": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/which-pm-runs/-/which-pm-runs-1.0.0.tgz", + "integrity": "sha1-Zws6+8VS4LVd9rd4DKdGFfI60cs=", + "dev": true + }, "wide-align": { "version": "1.1.3", "resolved": "https://registry.npmjs.org/wide-align/-/wide-align-1.1.3.tgz", @@ -15732,6 +16239,15 @@ "integrity": "sha512-a4UGQaWPH59mOXUYnAG2ewncQS4i4F43Tv3JoAM+s2VDAmS9NsK8GpDMLrCHPksFT7h3K6TOoUNn2pb7RoXx4g==", "dev": true }, + "yaml": { + "version": "1.9.2", + "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.9.2.tgz", + "integrity": "sha512-HPT7cGGI0DuRcsO51qC1j9O16Dh1mZ2bnXwsi0jrSpsLz0WxOLSLXfkABVl6bZO629py3CU+OMJtpNHDLB97kg==", + "dev": true, + "requires": { + "@babel/runtime": "^7.9.2" + } + }, "yargs": { "version": "3.32.0", "resolved": "https://registry.npmjs.org/yargs/-/yargs-3.32.0.tgz", diff --git a/package.json b/package.json index 6e8329de83..be0c1f9b97 100644 --- a/package.json +++ b/package.json @@ -2,6 +2,7 @@ "name": "c2c_ui", "description": "https://www.camptocamp.org user interface", "version": "7.3.1", + "private": true, "author": "Camptocamp community ", "repository": { "type": "git", @@ -60,6 +61,7 @@ "@vue/cli-plugin-babel": "4.3.1", "@vue/cli-plugin-eslint": "4.3.1", "@vue/cli-service": "4.3.1", + "@vue/eslint-config-prettier": "6.0.0", "@vue/eslint-config-standard": "5.1.2", "angular-gettext-tools": "2.5.3", "babel-eslint": "^10.1.0", @@ -67,10 +69,14 @@ "eslint": "6.8.0", "eslint-plugin-import": "2.20.2", "eslint-plugin-node": "11.1.0", + "eslint-plugin-prettier": "3.1.3", "eslint-plugin-promise": "4.2.1", "eslint-plugin-standard": "4.0.1", "eslint-plugin-vue": "6.2.2", + "husky": "4.2.5", "node-sass": "4.14.1", + "prettier": "2.0.5", + "pretty-quick": "2.0.1", "sass-loader": "8.0.2", "snyk": "1.321.0", "vue-template-compiler": "2.6.11", @@ -89,5 +95,10 @@ "not dead", "not ie <= 10" ], - "snyk": true + "snyk": true, + "husky": { + "hooks": { + "pre-commit": "pretty-quick --staged" + } + } } diff --git a/src/App.vue b/src/App.vue index bbb898f735..f69c3870fb 100644 --- a/src/App.vue +++ b/src/App.vue @@ -1,12 +1,12 @@ diff --git a/src/assets/font-awesome-custom/js/activity/hiking.js b/src/assets/font-awesome-custom/js/activity/hiking.js index e3e6496128..29a720a676 100644 --- a/src/assets/font-awesome-custom/js/activity/hiking.js +++ b/src/assets/font-awesome-custom/js/activity/hiking.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/ice_climbing.js b/src/assets/font-awesome-custom/js/activity/ice_climbing.js index 4c1ffe7860..59aa388925 100644 --- a/src/assets/font-awesome-custom/js/activity/ice_climbing.js +++ b/src/assets/font-awesome-custom/js/activity/ice_climbing.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/index.js b/src/assets/font-awesome-custom/js/activity/index.js index c2eadfeb64..525caa6f61 100644 --- a/src/assets/font-awesome-custom/js/activity/index.js +++ b/src/assets/font-awesome-custom/js/activity/index.js @@ -1,10 +1,10 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ import hiking from "./hiking" import ice_climbing from "./ice_climbing" import mountain_biking from "./mountain_biking" import mountain_climbing from "./mountain_climbing" +import other from "./other" import paragliding from "./paragliding" import rock_climbing from "./rock_climbing" import skitouring from "./skitouring" @@ -18,6 +18,7 @@ export { ice_climbing, mountain_biking, mountain_climbing, + other, paragliding, rock_climbing, skitouring, diff --git a/src/assets/font-awesome-custom/js/activity/mountain_biking.js b/src/assets/font-awesome-custom/js/activity/mountain_biking.js index 9aa581f068..f00c7bb65e 100644 --- a/src/assets/font-awesome-custom/js/activity/mountain_biking.js +++ b/src/assets/font-awesome-custom/js/activity/mountain_biking.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/mountain_climbing.js b/src/assets/font-awesome-custom/js/activity/mountain_climbing.js index b793a89760..373fa8498c 100644 --- a/src/assets/font-awesome-custom/js/activity/mountain_climbing.js +++ b/src/assets/font-awesome-custom/js/activity/mountain_climbing.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/other.js b/src/assets/font-awesome-custom/js/activity/other.js index a54048dcb8..4612cf4445 100644 --- a/src/assets/font-awesome-custom/js/activity/other.js +++ b/src/assets/font-awesome-custom/js/activity/other.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/paragliding.js b/src/assets/font-awesome-custom/js/activity/paragliding.js index f61b42232d..59b0c32aeb 100644 --- a/src/assets/font-awesome-custom/js/activity/paragliding.js +++ b/src/assets/font-awesome-custom/js/activity/paragliding.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/rock_climbing.js b/src/assets/font-awesome-custom/js/activity/rock_climbing.js index dc9e415daa..f26bc95581 100644 --- a/src/assets/font-awesome-custom/js/activity/rock_climbing.js +++ b/src/assets/font-awesome-custom/js/activity/rock_climbing.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/skitouring.js b/src/assets/font-awesome-custom/js/activity/skitouring.js index b464e42991..2117d61a31 100644 --- a/src/assets/font-awesome-custom/js/activity/skitouring.js +++ b/src/assets/font-awesome-custom/js/activity/skitouring.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/slacklining.js b/src/assets/font-awesome-custom/js/activity/slacklining.js index 7f3a266f59..d02bc7145d 100644 --- a/src/assets/font-awesome-custom/js/activity/slacklining.js +++ b/src/assets/font-awesome-custom/js/activity/slacklining.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/snow_ice_mixed.js b/src/assets/font-awesome-custom/js/activity/snow_ice_mixed.js index 34da9e120c..bb06c2cd05 100644 --- a/src/assets/font-awesome-custom/js/activity/snow_ice_mixed.js +++ b/src/assets/font-awesome-custom/js/activity/snow_ice_mixed.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/snowshoeing.js b/src/assets/font-awesome-custom/js/activity/snowshoeing.js index ce95ea1b12..ea528f639f 100644 --- a/src/assets/font-awesome-custom/js/activity/snowshoeing.js +++ b/src/assets/font-awesome-custom/js/activity/snowshoeing.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/activity/via_ferrata.js b/src/assets/font-awesome-custom/js/activity/via_ferrata.js index 51ff71dcc5..a8d1303563 100644 --- a/src/assets/font-awesome-custom/js/activity/via_ferrata.js +++ b/src/assets/font-awesome-custom/js/activity/via_ferrata.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/document-type/index.js b/src/assets/font-awesome-custom/js/document-type/index.js index b900a10895..eb89c4b39e 100644 --- a/src/assets/font-awesome-custom/js/document-type/index.js +++ b/src/assets/font-awesome-custom/js/document-type/index.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ import outing from "./outing" diff --git a/src/assets/font-awesome-custom/js/document-type/outing.js b/src/assets/font-awesome-custom/js/document-type/outing.js index 77e6b72186..c35b7c63e9 100644 --- a/src/assets/font-awesome-custom/js/document-type/outing.js +++ b/src/assets/font-awesome-custom/js/document-type/outing.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { @@ -10,6 +9,6 @@ export default { 64, [], "", - 'M 21.654297 4 L 20.226562 9.5957031 C 17.763546 10.08053 15.497747 11.350995 13.685547 13.261719 L 8.609375 11.101562 L 11.394531 16.458984 C 10.287742 18.578547 9.6666696 20.996393 9.5839844 23.5 L 4 26.162109 L 10.007812 27.978516 C 10.519189 30.216937 11.462167 32.314918 12.763672 34.119141 L 10.521484 40.363281 L 15.685547 37.181641 C 16.224197 37.598161 16.786995 37.97163 17.369141 38.298828 C 17.41544 33.633463 20.48998 30.918482 25.494141 32.421875 C 26.752154 32.79982 28.470438 32.881775 29.552734 33.523438 C 30.503278 29.864387 32.878523 25.882812 36.423828 25.882812 L 42.007812 23.222656 L 35.998047 21.404297 C 35.48667 19.165875 34.545646 17.067895 33.244141 15.263672 L 35.486328 9.0195312 L 30.322266 12.201172 C 28.385093 10.678712 26.155852 9.7353058 23.849609 9.4648438 L 21.654297 4 z M 36.980469 27.007812 C 33.435165 27.007812 31.061871 30.989386 30.111328 34.648438 C 29.029032 34.006776 27.310747 33.922866 26.052734 33.544922 C 20.069154 31.747282 16.827164 35.972436 18.246094 42.363281 C 18.466603 43.356495 18.500261 44.318144 18.783203 45.230469 C 16.638892 46.589774 12.634766 49.268696 12.634766 52.242188 C 12.634766 56.623055 18.270327 60.000011 22.148438 60 L 51.8125 60 C 55.690596 60 60 56.623056 60 52.242188 C 60 49.268695 57.323994 46.589774 55.179688 45.230469 C 55.462643 44.318163 55.523187 43.368075 55.714844 42.363281 C 56.81099 36.616546 53.716511 32.434064 47.910156 33.544922 C 46.630035 33.789828 45.429958 34.006776 44.347656 34.648438 C 43.397113 30.989386 40.525774 27.007813 36.980469 27.007812 z ' + 'M 21.654297 4 L 20.226562 9.5957031 C 17.763546 10.08053 15.497747 11.350995 13.685547 13.261719 L 8.609375 11.101562 L 11.394531 16.458984 C 10.287742 18.578547 9.6666696 20.996393 9.5839844 23.5 L 4 26.162109 L 10.007812 27.978516 C 10.519189 30.216937 11.462167 32.314918 12.763672 34.119141 L 10.521484 40.363281 L 15.685547 37.181641 C 16.224197 37.598161 16.786995 37.97163 17.369141 38.298828 C 17.41544 33.633463 20.48998 30.918482 25.494141 32.421875 C 26.752154 32.79982 28.470438 32.881775 29.552734 33.523438 C 30.503278 29.864387 32.878523 25.882812 36.423828 25.882812 L 42.007812 23.222656 L 35.998047 21.404297 C 35.48667 19.165875 34.545646 17.067895 33.244141 15.263672 L 35.486328 9.0195312 L 30.322266 12.201172 C 28.385093 10.678712 26.155852 9.7353058 23.849609 9.4648438 L 21.654297 4 z M 36.980469 27.007812 C 33.435165 27.007812 31.061871 30.989386 30.111328 34.648438 C 29.029032 34.006776 27.310747 33.922866 26.052734 33.544922 C 20.069154 31.747282 16.827164 35.972436 18.246094 42.363281 C 18.466603 43.356495 18.500261 44.318144 18.783203 45.230469 C 16.638892 46.589774 12.634766 49.268696 12.634766 52.242188 C 12.634766 56.623055 18.270327 60.000011 22.148438 60 L 51.8125 60 C 55.690596 60 60 56.623056 60 52.242188 C 60 49.268695 57.323994 46.589774 55.179688 45.230469 C 55.462643 44.318163 55.523187 43.368075 55.714844 42.363281 C 56.81099 36.616546 53.716511 32.434064 47.910156 33.544922 C 46.630035 33.789828 45.429958 34.006776 44.347656 34.648438 C 43.397113 30.989386 40.525774 27.007813 36.980469 27.007812 z' ] } \ No newline at end of file diff --git a/src/assets/font-awesome-custom/js/miscs/index.js b/src/assets/font-awesome-custom/js/miscs/index.js index f15532973c..623fa83238 100644 --- a/src/assets/font-awesome-custom/js/miscs/index.js +++ b/src/assets/font-awesome-custom/js/miscs/index.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ import paragliding from "./paragliding" diff --git a/src/assets/font-awesome-custom/js/miscs/paragliding.js b/src/assets/font-awesome-custom/js/miscs/paragliding.js index db43723883..3d75cfff54 100644 --- a/src/assets/font-awesome-custom/js/miscs/paragliding.js +++ b/src/assets/font-awesome-custom/js/miscs/paragliding.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/quality/draft.js b/src/assets/font-awesome-custom/js/quality/draft.js index 50778e00fc..755da7d1e5 100644 --- a/src/assets/font-awesome-custom/js/quality/draft.js +++ b/src/assets/font-awesome-custom/js/quality/draft.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/quality/empty.js b/src/assets/font-awesome-custom/js/quality/empty.js index 4f684274c4..a4a314a71f 100644 --- a/src/assets/font-awesome-custom/js/quality/empty.js +++ b/src/assets/font-awesome-custom/js/quality/empty.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/quality/fine.js b/src/assets/font-awesome-custom/js/quality/fine.js index b008ab6dab..3fcd33e9b6 100644 --- a/src/assets/font-awesome-custom/js/quality/fine.js +++ b/src/assets/font-awesome-custom/js/quality/fine.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/quality/great.js b/src/assets/font-awesome-custom/js/quality/great.js index a312985d82..e43ed8f807 100644 --- a/src/assets/font-awesome-custom/js/quality/great.js +++ b/src/assets/font-awesome-custom/js/quality/great.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/quality/index.js b/src/assets/font-awesome-custom/js/quality/index.js index 1c7966222c..9b63af2b1e 100644 --- a/src/assets/font-awesome-custom/js/quality/index.js +++ b/src/assets/font-awesome-custom/js/quality/index.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ import draft from "./draft" import empty from "./empty" diff --git a/src/assets/font-awesome-custom/js/quality/medium.js b/src/assets/font-awesome-custom/js/quality/medium.js index cc47841975..7b2c4566a1 100644 --- a/src/assets/font-awesome-custom/js/quality/medium.js +++ b/src/assets/font-awesome-custom/js/quality/medium.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/access.js b/src/assets/font-awesome-custom/js/waypoint/access.js index 8bc235c795..0e19f1ecc5 100644 --- a/src/assets/font-awesome-custom/js/waypoint/access.js +++ b/src/assets/font-awesome-custom/js/waypoint/access.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/base_camp.js b/src/assets/font-awesome-custom/js/waypoint/base_camp.js index e69eeee4a9..998327969b 100644 --- a/src/assets/font-awesome-custom/js/waypoint/base_camp.js +++ b/src/assets/font-awesome-custom/js/waypoint/base_camp.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/bergschrund.js b/src/assets/font-awesome-custom/js/waypoint/bergschrund.js index 699fd8b0c7..28cb9227e9 100644 --- a/src/assets/font-awesome-custom/js/waypoint/bergschrund.js +++ b/src/assets/font-awesome-custom/js/waypoint/bergschrund.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/bisse.js b/src/assets/font-awesome-custom/js/waypoint/bisse.js index 024aefdc2a..1458916370 100644 --- a/src/assets/font-awesome-custom/js/waypoint/bisse.js +++ b/src/assets/font-awesome-custom/js/waypoint/bisse.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/bivouac.js b/src/assets/font-awesome-custom/js/waypoint/bivouac.js index 206a54eeee..b2060b19c5 100644 --- a/src/assets/font-awesome-custom/js/waypoint/bivouac.js +++ b/src/assets/font-awesome-custom/js/waypoint/bivouac.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/camp_site.js b/src/assets/font-awesome-custom/js/waypoint/camp_site.js index c23142f525..2a8da1f2fe 100644 --- a/src/assets/font-awesome-custom/js/waypoint/camp_site.js +++ b/src/assets/font-awesome-custom/js/waypoint/camp_site.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/canyon.js b/src/assets/font-awesome-custom/js/waypoint/canyon.js index 4f6977a8e3..d913843075 100644 --- a/src/assets/font-awesome-custom/js/waypoint/canyon.js +++ b/src/assets/font-awesome-custom/js/waypoint/canyon.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/cave.js b/src/assets/font-awesome-custom/js/waypoint/cave.js index c969e1c0e2..96bf49b5aa 100644 --- a/src/assets/font-awesome-custom/js/waypoint/cave.js +++ b/src/assets/font-awesome-custom/js/waypoint/cave.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/cliff.js b/src/assets/font-awesome-custom/js/waypoint/cliff.js index 10e990a3b7..db0d19a004 100644 --- a/src/assets/font-awesome-custom/js/waypoint/cliff.js +++ b/src/assets/font-awesome-custom/js/waypoint/cliff.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/climbing_indoor.js b/src/assets/font-awesome-custom/js/waypoint/climbing_indoor.js index baa6adac73..bf99dab0c1 100644 --- a/src/assets/font-awesome-custom/js/waypoint/climbing_indoor.js +++ b/src/assets/font-awesome-custom/js/waypoint/climbing_indoor.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/climbing_outdoor.js b/src/assets/font-awesome-custom/js/waypoint/climbing_outdoor.js index cafe89a198..90a0dac171 100644 --- a/src/assets/font-awesome-custom/js/waypoint/climbing_outdoor.js +++ b/src/assets/font-awesome-custom/js/waypoint/climbing_outdoor.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/confluence.js b/src/assets/font-awesome-custom/js/waypoint/confluence.js index 9ea9306d1c..4c730624be 100644 --- a/src/assets/font-awesome-custom/js/waypoint/confluence.js +++ b/src/assets/font-awesome-custom/js/waypoint/confluence.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/gite.js b/src/assets/font-awesome-custom/js/waypoint/gite.js index 044be9ada5..b78688f556 100644 --- a/src/assets/font-awesome-custom/js/waypoint/gite.js +++ b/src/assets/font-awesome-custom/js/waypoint/gite.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/glacier.js b/src/assets/font-awesome-custom/js/waypoint/glacier.js index 67777bcdc0..5a3c02c32e 100644 --- a/src/assets/font-awesome-custom/js/waypoint/glacier.js +++ b/src/assets/font-awesome-custom/js/waypoint/glacier.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/hut.js b/src/assets/font-awesome-custom/js/waypoint/hut.js index 028e3d7c2c..8a2bdafc14 100644 --- a/src/assets/font-awesome-custom/js/waypoint/hut.js +++ b/src/assets/font-awesome-custom/js/waypoint/hut.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/index.js b/src/assets/font-awesome-custom/js/waypoint/index.js index 3d3c3245ca..36ec8a428b 100644 --- a/src/assets/font-awesome-custom/js/waypoint/index.js +++ b/src/assets/font-awesome-custom/js/waypoint/index.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ import access from "./access" import base_camp from "./base_camp" diff --git a/src/assets/font-awesome-custom/js/waypoint/lake.js b/src/assets/font-awesome-custom/js/waypoint/lake.js index ca9b40eb5b..1cde321d27 100644 --- a/src/assets/font-awesome-custom/js/waypoint/lake.js +++ b/src/assets/font-awesome-custom/js/waypoint/lake.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/local_product.js b/src/assets/font-awesome-custom/js/waypoint/local_product.js index efb24aa828..37492fd81d 100644 --- a/src/assets/font-awesome-custom/js/waypoint/local_product.js +++ b/src/assets/font-awesome-custom/js/waypoint/local_product.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/locality.js b/src/assets/font-awesome-custom/js/waypoint/locality.js index 44232de9b5..fa74682ab8 100644 --- a/src/assets/font-awesome-custom/js/waypoint/locality.js +++ b/src/assets/font-awesome-custom/js/waypoint/locality.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/misc.js b/src/assets/font-awesome-custom/js/waypoint/misc.js index d56d8dedd6..d2d0b125c9 100644 --- a/src/assets/font-awesome-custom/js/waypoint/misc.js +++ b/src/assets/font-awesome-custom/js/waypoint/misc.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/paragliding_landing.js b/src/assets/font-awesome-custom/js/waypoint/paragliding_landing.js index 9298bf0688..fb2d4448ff 100644 --- a/src/assets/font-awesome-custom/js/waypoint/paragliding_landing.js +++ b/src/assets/font-awesome-custom/js/waypoint/paragliding_landing.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/paragliding_takeoff.js b/src/assets/font-awesome-custom/js/waypoint/paragliding_takeoff.js index 7b44569f84..03916d722a 100644 --- a/src/assets/font-awesome-custom/js/waypoint/paragliding_takeoff.js +++ b/src/assets/font-awesome-custom/js/waypoint/paragliding_takeoff.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/pass.js b/src/assets/font-awesome-custom/js/waypoint/pass.js index d54e8b641b..bd62d039ac 100644 --- a/src/assets/font-awesome-custom/js/waypoint/pass.js +++ b/src/assets/font-awesome-custom/js/waypoint/pass.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/pit.js b/src/assets/font-awesome-custom/js/waypoint/pit.js index a8c7c21d32..ae8ceb978a 100644 --- a/src/assets/font-awesome-custom/js/waypoint/pit.js +++ b/src/assets/font-awesome-custom/js/waypoint/pit.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/shelter.js b/src/assets/font-awesome-custom/js/waypoint/shelter.js index 96fd36c922..8199170fc5 100644 --- a/src/assets/font-awesome-custom/js/waypoint/shelter.js +++ b/src/assets/font-awesome-custom/js/waypoint/shelter.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/slackline_spot.js b/src/assets/font-awesome-custom/js/waypoint/slackline_spot.js index 8f327b4d46..d3f65670a8 100644 --- a/src/assets/font-awesome-custom/js/waypoint/slackline_spot.js +++ b/src/assets/font-awesome-custom/js/waypoint/slackline_spot.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/summit.js b/src/assets/font-awesome-custom/js/waypoint/summit.js index 3cc63666a1..e052af946e 100644 --- a/src/assets/font-awesome-custom/js/waypoint/summit.js +++ b/src/assets/font-awesome-custom/js/waypoint/summit.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/virtual.js b/src/assets/font-awesome-custom/js/waypoint/virtual.js index 156e2b0da3..bdf32fb25a 100644 --- a/src/assets/font-awesome-custom/js/waypoint/virtual.js +++ b/src/assets/font-awesome-custom/js/waypoint/virtual.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/waterfall.js b/src/assets/font-awesome-custom/js/waypoint/waterfall.js index 3ce01f90ee..21f58a2a67 100644 --- a/src/assets/font-awesome-custom/js/waypoint/waterfall.js +++ b/src/assets/font-awesome-custom/js/waypoint/waterfall.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/waterpoint.js b/src/assets/font-awesome-custom/js/waypoint/waterpoint.js index 2033e5f4e9..84bf0c23f2 100644 --- a/src/assets/font-awesome-custom/js/waypoint/waterpoint.js +++ b/src/assets/font-awesome-custom/js/waypoint/waterpoint.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/waypoints.js b/src/assets/font-awesome-custom/js/waypoint/waypoints.js index 1863b9f671..f53ec49830 100644 --- a/src/assets/font-awesome-custom/js/waypoint/waypoints.js +++ b/src/assets/font-awesome-custom/js/waypoint/waypoints.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/weather_station.js b/src/assets/font-awesome-custom/js/waypoint/weather_station.js index 0e149be95f..9b35dedf4f 100644 --- a/src/assets/font-awesome-custom/js/waypoint/weather_station.js +++ b/src/assets/font-awesome-custom/js/waypoint/weather_station.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/assets/font-awesome-custom/js/waypoint/webcam.js b/src/assets/font-awesome-custom/js/waypoint/webcam.js index b5e414d711..c1d184dac6 100644 --- a/src/assets/font-awesome-custom/js/waypoint/webcam.js +++ b/src/assets/font-awesome-custom/js/waypoint/webcam.js @@ -1,5 +1,4 @@ // Auto-generated file by generate-icons.js -/* eslint-disable */ export default { diff --git a/src/components/alert-window/AlertWindow.vue b/src/components/alert-window/AlertWindow.vue index 9b55df2113..ccc26ccf45 100644 --- a/src/components/alert-window/AlertWindow.vue +++ b/src/components/alert-window/AlertWindow.vue @@ -9,20 +9,18 @@ diff --git a/src/components/association-editor/AssociationImageLink.vue b/src/components/association-editor/AssociationImageLink.vue index 413366d9b5..cae2f43342 100644 --- a/src/components/association-editor/AssociationImageLink.vue +++ b/src/components/association-editor/AssociationImageLink.vue @@ -1,47 +1,44 @@ diff --git a/src/components/association-editor/AssociationItems.vue b/src/components/association-editor/AssociationItems.vue index 94df6bcaa8..d4d0507939 100644 --- a/src/components/association-editor/AssociationItems.vue +++ b/src/components/association-editor/AssociationItems.vue @@ -7,28 +7,28 @@
+ class="columns is-mobile is-gapless document-row has-hover-background" + >
- - - @{{ child.document.forum_username }} - () + + @{{ child.document.forum_username }} () - + - + - + - + + target="_blank" + />
@@ -42,7 +42,8 @@ 'is-success': child.status === 'proposition', }" :disabled="child.disabled" - @click="onclick(child)"> + @click="onclick(child)" + > {{ child.buttonLabel }}
@@ -51,234 +52,233 @@
+ v-translate + > Too many results: please refine your search.
- diff --git a/src/components/association-editor/AssociationOutingLink.vue b/src/components/association-editor/AssociationOutingLink.vue index 6be651d98f..b93d437999 100644 --- a/src/components/association-editor/AssociationOutingLink.vue +++ b/src/components/association-editor/AssociationOutingLink.vue @@ -1,27 +1,23 @@ diff --git a/src/components/association-editor/AssociationsWindow.vue b/src/components/association-editor/AssociationsWindow.vue index 4eb3975864..1cd231e145 100644 --- a/src/components/association-editor/AssociationsWindow.vue +++ b/src/components/association-editor/AssociationsWindow.vue @@ -7,7 +7,8 @@ class="input" ref="input" :placeholder="$gettext('Search a document to associate...')" - @input="search"> + @input="search" + /> @@ -20,100 +21,100 @@ :child-type="item.documentType" :current="item.current" :forbidden-children="item.forbiddenChildren" - :propositions="propositions[item.searchArrayName]" /> + :propositions="propositions[item.searchArrayName]" + />
- diff --git a/src/components/cards/AreaCard.vue b/src/components/cards/AreaCard.vue index d13dc2054d..02623e119e 100644 --- a/src/components/cards/AreaCard.vue +++ b/src/components/cards/AreaCard.vue @@ -13,12 +13,9 @@ diff --git a/src/components/cards/ArticleCard.vue b/src/components/cards/ArticleCard.vue index 895bba0125..63a0ef4b9b 100644 --- a/src/components/cards/ArticleCard.vue +++ b/src/components/cards/ArticleCard.vue @@ -19,17 +19,13 @@ - diff --git a/src/components/cards/BookCard.vue b/src/components/cards/BookCard.vue index 0a43d426cb..a1c899484d 100644 --- a/src/components/cards/BookCard.vue +++ b/src/components/cards/BookCard.vue @@ -19,17 +19,13 @@ - diff --git a/src/components/cards/DocumentCard.vue b/src/components/cards/DocumentCard.vue index c538f3e67e..eb6c3227c9 100644 --- a/src/components/cards/DocumentCard.vue +++ b/src/components/cards/DocumentCard.vue @@ -5,86 +5,81 @@ :document="document" class="document-card" :target="target" - :highlighted="highlighted" /> - + :highlighted="highlighted" + /> + diff --git a/src/components/cards/FeedCard.vue b/src/components/cards/FeedCard.vue index a29a4b29f9..5565b71825 100644 --- a/src/components/cards/FeedCard.vue +++ b/src/components/cards/FeedCard.vue @@ -5,8 +5,9 @@ + @error="useDefaultAvatarIcon = true" + :src="$options.forumAvatarUrl + item.user.forum_username + '/36/1_1.png'" + /> @@ -19,19 +20,19 @@ - {{ dates }} + {{ dates }}

{{ locale.summary | stripMarkdown | max300chars }}

- + - - + + @@ -71,7 +72,7 @@ {{ $moment.timeAgo(item.time) }} - + @@ -79,149 +80,144 @@ - - diff --git a/src/components/cards/MapCard.vue b/src/components/cards/MapCard.vue index db51f64bd3..8b1ddf5967 100644 --- a/src/components/cards/MapCard.vue +++ b/src/components/cards/MapCard.vue @@ -15,12 +15,9 @@ diff --git a/src/components/cards/OutingCard.vue b/src/components/cards/OutingCard.vue index defcdc7ac6..5fcbcccb77 100644 --- a/src/components/cards/OutingCard.vue +++ b/src/components/cards/OutingCard.vue @@ -39,7 +39,7 @@
- {{ $moment.toLocalizedString(document.date_end, "LL") }} + {{ $moment.toLocalizedString(document.date_end, 'LL') }} @@ -48,12 +48,9 @@ diff --git a/src/components/cards/ProfileCard.vue b/src/components/cards/ProfileCard.vue index af59757a0c..1ec7f8b0c7 100644 --- a/src/components/cards/ProfileCard.vue +++ b/src/components/cards/ProfileCard.vue @@ -13,9 +13,7 @@ - +   + class="is-ellipsed" + /> diff --git a/src/components/cards/RouteCard.vue b/src/components/cards/RouteCard.vue index 724a38430f..b4e514d785 100644 --- a/src/components/cards/RouteCard.vue +++ b/src/components/cards/RouteCard.vue @@ -9,7 +9,6 @@ - @@ -17,18 +16,12 @@ - + {{ document.height_diff_up }} m - + {{ document.height_diff_difficulties }} m @@ -37,31 +30,29 @@ - + + + :title="$gettext('orientations')" + > - {{ document.orientations.join(", ") }} + {{ document.orientations.join(', ') }} - diff --git a/src/components/cards/WaypointCard.vue b/src/components/cards/WaypointCard.vue index 25a1c9a562..8b586960f1 100644 --- a/src/components/cards/WaypointCard.vue +++ b/src/components/cards/WaypointCard.vue @@ -22,12 +22,9 @@ diff --git a/src/components/cards/XreportCard.vue b/src/components/cards/XreportCard.vue index f0b3fc83a9..8214fb5072 100644 --- a/src/components/cards/XreportCard.vue +++ b/src/components/cards/XreportCard.vue @@ -14,29 +14,24 @@ {{ $gettext(document.event_type, 'event_types') }} - - {{ $moment.parseDate(document.date).locale(this.$language.current).format("LL") }} + {{ $moment.parseDate(document.date).locale(this.$language.current).format('LL') }} - diff --git a/src/components/cards/utils/CardActivitiesItem.vue b/src/components/cards/utils/CardActivitiesItem.vue index 9781431349..3854630d5c 100644 --- a/src/components/cards/utils/CardActivitiesItem.vue +++ b/src/components/cards/utils/CardActivitiesItem.vue @@ -3,18 +3,18 @@ diff --git a/src/components/cards/utils/CardContainer.vue b/src/components/cards/utils/CardContainer.vue index 1277ae1440..51f2640e21 100644 --- a/src/components/cards/utils/CardContainer.vue +++ b/src/components/cards/utils/CardContainer.vue @@ -1,5 +1,5 @@ diff --git a/src/components/cards/utils/CardElevationItem.vue b/src/components/cards/utils/CardElevationItem.vue index 94486d8296..6c346f6c26 100644 --- a/src/components/cards/utils/CardElevationItem.vue +++ b/src/components/cards/utils/CardElevationItem.vue @@ -6,14 +6,12 @@ diff --git a/src/components/cards/utils/CardEventActivityItem.vue b/src/components/cards/utils/CardEventActivityItem.vue index ee8c49cc84..e25c42231e 100644 --- a/src/components/cards/utils/CardEventActivityItem.vue +++ b/src/components/cards/utils/CardEventActivityItem.vue @@ -1,21 +1,24 @@ diff --git a/src/components/cards/utils/CardRegionItem.vue b/src/components/cards/utils/CardRegionItem.vue index e8c7c54bdd..ac5aa37af5 100644 --- a/src/components/cards/utils/CardRegionItem.vue +++ b/src/components/cards/utils/CardRegionItem.vue @@ -3,22 +3,18 @@ {{ text }} - diff --git a/src/components/cards/utils/CardRow.vue b/src/components/cards/utils/CardRow.vue index 3f2dc6367e..9e89a04300 100644 --- a/src/components/cards/utils/CardRow.vue +++ b/src/components/cards/utils/CardRow.vue @@ -5,30 +5,29 @@ diff --git a/src/components/cards/utils/CardTitle.vue b/src/components/cards/utils/CardTitle.vue index f30d06f5fa..e51199d5aa 100644 --- a/src/components/cards/utils/CardTitle.vue +++ b/src/components/cards/utils/CardTitle.vue @@ -7,18 +7,16 @@ diff --git a/src/components/cards/utils/mixins.js b/src/components/cards/utils/mixins.js index ca51765a5b..0f854973bb 100644 --- a/src/components/cards/utils/mixins.js +++ b/src/components/cards/utils/mixins.js @@ -9,7 +9,6 @@ import CardActivitiesItem from './CardActivitiesItem'; import CardEventActivityItem from './CardEventActivityItem'; export const cardMixin = { - components: { CardContainer, CardTitle, @@ -17,23 +16,22 @@ export const cardMixin = { CardRegionItem, CardElevationItem, CardActivitiesItem, - CardEventActivityItem + CardEventActivityItem, }, props: { target: { type: String, - default: undefined + default: undefined, }, highlighted: { type: Boolean, - default: false - } - } + default: false, + }, + }, }; export const documentCardMixin = { - mixins: [cardMixin, requireDocumentProperty] - + mixins: [cardMixin, requireDocumentProperty], }; diff --git a/src/components/datatable/DocumentsTable.vue b/src/components/datatable/DocumentsTable.vue index e96a2db6ed..8a734df6c5 100644 --- a/src/components/datatable/DocumentsTable.vue +++ b/src/components/datatable/DocumentsTable.vue @@ -1,6 +1,6 @@ diff --git a/src/components/datatable/cell-renderers/DocumentAuthor.vue b/src/components/datatable/cell-renderers/DocumentAuthor.vue index f16cc61683..d2cb70bdf5 100644 --- a/src/components/datatable/cell-renderers/DocumentAuthor.vue +++ b/src/components/datatable/cell-renderers/DocumentAuthor.vue @@ -3,7 +3,7 @@ diff --git a/src/components/datatable/cell-renderers/DocumentField.vue b/src/components/datatable/cell-renderers/DocumentField.vue index 96cdb7c052..9af4017cc5 100644 --- a/src/components/datatable/cell-renderers/DocumentField.vue +++ b/src/components/datatable/cell-renderers/DocumentField.vue @@ -3,7 +3,7 @@ diff --git a/src/components/datatable/cell-renderers/DocumentLink.vue b/src/components/datatable/cell-renderers/DocumentLink.vue index 1f6dcb2c96..c0bc825345 100644 --- a/src/components/datatable/cell-renderers/DocumentLink.vue +++ b/src/components/datatable/cell-renderers/DocumentLink.vue @@ -3,7 +3,7 @@ diff --git a/src/components/datatable/cell-renderers/MarkerCondition.vue b/src/components/datatable/cell-renderers/MarkerCondition.vue index 833a39b8a3..aba7f1af7f 100644 --- a/src/components/datatable/cell-renderers/MarkerCondition.vue +++ b/src/components/datatable/cell-renderers/MarkerCondition.vue @@ -3,7 +3,7 @@ diff --git a/src/components/datatable/cell-renderers/MarkerGpsTrace.vue b/src/components/datatable/cell-renderers/MarkerGpsTrace.vue index ba19143114..b4527f752d 100644 --- a/src/components/datatable/cell-renderers/MarkerGpsTrace.vue +++ b/src/components/datatable/cell-renderers/MarkerGpsTrace.vue @@ -3,7 +3,7 @@ diff --git a/src/components/datatable/cell-renderers/MarkerImageCount.vue b/src/components/datatable/cell-renderers/MarkerImageCount.vue index e5b4567e64..eb7053450d 100644 --- a/src/components/datatable/cell-renderers/MarkerImageCount.vue +++ b/src/components/datatable/cell-renderers/MarkerImageCount.vue @@ -3,7 +3,7 @@ diff --git a/src/components/datatable/cell-renderers/MarkerQuality.vue b/src/components/datatable/cell-renderers/MarkerQuality.vue index b07aa76182..45d079986a 100644 --- a/src/components/datatable/cell-renderers/MarkerQuality.vue +++ b/src/components/datatable/cell-renderers/MarkerQuality.vue @@ -3,7 +3,7 @@ diff --git a/src/components/datatable/cell-renderers/OutingDate.vue b/src/components/datatable/cell-renderers/OutingDate.vue index 7fa9271602..d4f07dbac1 100644 --- a/src/components/datatable/cell-renderers/OutingDate.vue +++ b/src/components/datatable/cell-renderers/OutingDate.vue @@ -5,7 +5,7 @@ diff --git a/src/components/datatable/cell-renderers/OutingRating.vue b/src/components/datatable/cell-renderers/OutingRating.vue index 68a88ee3ce..40c9d1329f 100644 --- a/src/components/datatable/cell-renderers/OutingRating.vue +++ b/src/components/datatable/cell-renderers/OutingRating.vue @@ -3,7 +3,7 @@ diff --git a/src/components/datatable/cell-renderers/RouteRating.vue b/src/components/datatable/cell-renderers/RouteRating.vue index 68a88ee3ce..40c9d1329f 100644 --- a/src/components/datatable/cell-renderers/RouteRating.vue +++ b/src/components/datatable/cell-renderers/RouteRating.vue @@ -3,7 +3,7 @@ diff --git a/src/components/feed-widget/FeedWidget.vue b/src/components/feed-widget/FeedWidget.vue index 129ce31a36..0f2aa89881 100644 --- a/src/components/feed-widget/FeedWidget.vue +++ b/src/components/feed-widget/FeedWidget.vue @@ -1,213 +1,207 @@ + estimateSize(item) { + const headerSize = 47; + const titleSize = 29; + const summarySize = 30; + const figuresSize = 30; + const areaSize = 29; + const footerSize = 38; + const gallerySize = 223; + const marginSize = 22; - diff --git a/src/components/gallery/Gallery.vue b/src/components/gallery/Gallery.vue index 9aa3d2331e..d93cc16a57 100644 --- a/src/components/gallery/Gallery.vue +++ b/src/components/gallery/Gallery.vue @@ -1,64 +1,60 @@ diff --git a/src/components/generics/Activities.vue b/src/components/generics/Activities.vue index f58e0c9786..5e70c36b70 100644 --- a/src/components/generics/Activities.vue +++ b/src/components/generics/Activities.vue @@ -1,25 +1,30 @@ diff --git a/src/components/generics/ContentBox.vue b/src/components/generics/ContentBox.vue index ea41d874b5..2962b4bab6 100644 --- a/src/components/generics/ContentBox.vue +++ b/src/components/generics/ContentBox.vue @@ -5,59 +5,60 @@ diff --git a/src/components/generics/DocumentField.vue b/src/components/generics/DocumentField.vue index 4433bcd8a3..b6b0009162 100644 --- a/src/components/generics/DocumentField.vue +++ b/src/components/generics/DocumentField.vue @@ -1,24 +1,19 @@ diff --git a/src/components/generics/DocumentRating.vue b/src/components/generics/DocumentRating.vue index 4a2f0b9be5..8f8c6997ca 100644 --- a/src/components/generics/DocumentRating.vue +++ b/src/components/generics/DocumentRating.vue @@ -11,11 +11,14 @@ - {{ document.rock_free_rating }}>{{ document.rock_required_rating }} - + @@ -83,8 +86,9 @@ v-for="rating of (showHelper ? displayed_ratings : [])" :key="rating" :to="getHelperLink(fields[rating].helper)" - class="dropdown-item"> -
+ class="dropdown-item" + > +
{{ document[rating] }}
@@ -95,72 +99,72 @@ diff --git a/src/components/generics/DocumentTitle.vue b/src/components/generics/DocumentTitle.vue index d34ef5db37..deae53e420 100644 --- a/src/components/generics/DocumentTitle.vue +++ b/src/components/generics/DocumentTitle.vue @@ -6,22 +6,22 @@ diff --git a/src/components/generics/DropdownButton.vue b/src/components/generics/DropdownButton.vue index cdbe178474..d6d1bee5f1 100644 --- a/src/components/generics/DropdownButton.vue +++ b/src/components/generics/DropdownButton.vue @@ -1,7 +1,6 @@ diff --git a/src/components/generics/HtmlHeader.vue b/src/components/generics/HtmlHeader.vue index 484bdf4f08..0add041b4e 100644 --- a/src/components/generics/HtmlHeader.vue +++ b/src/components/generics/HtmlHeader.vue @@ -1,26 +1,26 @@ diff --git a/src/components/generics/LoadingNotification.vue b/src/components/generics/LoadingNotification.vue index 7227fce273..5a9885419f 100644 --- a/src/components/generics/LoadingNotification.vue +++ b/src/components/generics/LoadingNotification.vue @@ -13,25 +13,24 @@ diff --git a/src/components/generics/Markdown.vue b/src/components/generics/Markdown.vue index f499b41349..b17820a354 100644 --- a/src/components/generics/Markdown.vue +++ b/src/components/generics/Markdown.vue @@ -1,4 +1,3 @@ - diff --git a/src/components/generics/inputs/InputEventActivity.vue b/src/components/generics/inputs/InputEventActivity.vue index 205a6b64c7..9be12fad6c 100644 --- a/src/components/generics/inputs/InputEventActivity.vue +++ b/src/components/generics/inputs/InputEventActivity.vue @@ -1,13 +1,14 @@ diff --git a/src/components/generics/inputs/InputMarkdown.vue b/src/components/generics/inputs/InputMarkdown.vue index ac420642ec..fcb6334b15 100644 --- a/src/components/generics/inputs/InputMarkdown.vue +++ b/src/components/generics/inputs/InputMarkdown.vue @@ -5,24 +5,22 @@ diff --git a/src/components/generics/inputs/InputMultiSelect.vue b/src/components/generics/inputs/InputMultiSelect.vue index 0f250cb324..836110a77d 100644 --- a/src/components/generics/inputs/InputMultiSelect.vue +++ b/src/components/generics/inputs/InputMultiSelect.vue @@ -1,74 +1,71 @@ diff --git a/src/components/generics/inputs/InputOrientation.vue b/src/components/generics/inputs/InputOrientation.vue index 302a3bafab..a22840fa0e 100644 --- a/src/components/generics/inputs/InputOrientation.vue +++ b/src/components/generics/inputs/InputOrientation.vue @@ -1,14 +1,14 @@ diff --git a/src/components/generics/inputs/InputSimple.vue b/src/components/generics/inputs/InputSimple.vue index 849bf82349..b375835a7f 100644 --- a/src/components/generics/inputs/InputSimple.vue +++ b/src/components/generics/inputs/InputSimple.vue @@ -1,26 +1,15 @@ diff --git a/src/components/generics/inputs/InputYesNo.vue b/src/components/generics/inputs/InputYesNo.vue index 3cc3751259..d423ec7ff4 100644 --- a/src/components/generics/inputs/InputYesNo.vue +++ b/src/components/generics/inputs/InputYesNo.vue @@ -1,22 +1,10 @@ diff --git a/src/components/generics/inputs/mixins.js b/src/components/generics/inputs/mixins.js index abe736e654..3cb7f77d93 100644 --- a/src/components/generics/inputs/mixins.js +++ b/src/components/generics/inputs/mixins.js @@ -2,56 +2,57 @@ export const baseMixin = { props: { type: { type: String, - default: 'text' + default: 'text', }, disabled: { type: Boolean, - default: null + default: null, }, required: { type: Boolean, - default: null + default: null, }, hasError: { type: Boolean, - default: false + default: false, }, i18n: { type: Boolean, - default: false + default: false, }, divisor: { type: Number, - default: undefined + default: undefined, }, placeholder: { type: String, - default: null - } + default: null, + }, }, computed: { value_: { get() { - return this.type !== 'number' || this.divisor === undefined || !this.value ? this.value : this.value / this.divisor; + return this.type !== 'number' || this.divisor === undefined || !this.value + ? this.value + : this.value / this.divisor; }, set(value) { if (!this.disabled) { value = this.type !== 'number' || this.divisor === undefined || !value ? value : value * this.divisor; this.$emit('input', value); } - } - } - } + }, + }, + }, }; export const arrayMixin = { - props: { value: { type: Array, - default: null - } + default: null, + }, }, computed: { @@ -63,8 +64,8 @@ export const arrayMixin = { if (!this.disabled) { this.$emit('input', value); } - } - } + }, + }, }, methods: { @@ -84,6 +85,6 @@ export const arrayMixin = { if (newValue.length !== 0 || !this.required) { this.value_ = newValue; } - } - } + }, + }, }; diff --git a/src/components/generics/links/AddLink.vue b/src/components/generics/links/AddLink.vue index e391a47814..3d85698f66 100644 --- a/src/components/generics/links/AddLink.vue +++ b/src/components/generics/links/AddLink.vue @@ -1,7 +1,7 @@ diff --git a/src/components/generics/links/AssociationHistoryLink.vue b/src/components/generics/links/AssociationHistoryLink.vue index 93b92bb865..0b562379e5 100644 --- a/src/components/generics/links/AssociationHistoryLink.vue +++ b/src/components/generics/links/AssociationHistoryLink.vue @@ -1,59 +1,56 @@ diff --git a/src/components/generics/links/AuthorLink.vue b/src/components/generics/links/AuthorLink.vue index 61fa843826..8a5facc27c 100644 --- a/src/components/generics/links/AuthorLink.vue +++ b/src/components/generics/links/AuthorLink.vue @@ -1,18 +1,18 @@ diff --git a/src/components/generics/links/ContributorLink.vue b/src/components/generics/links/ContributorLink.vue index 28459e4158..3f280a36af 100644 --- a/src/components/generics/links/ContributorLink.vue +++ b/src/components/generics/links/ContributorLink.vue @@ -3,12 +3,12 @@ - + {{ contributor.name }} ( - c + c | d @@ -19,15 +19,15 @@ diff --git a/src/components/generics/links/DiffLink.vue b/src/components/generics/links/DiffLink.vue index c6df6817cf..50ba8a5e5f 100644 --- a/src/components/generics/links/DiffLink.vue +++ b/src/components/generics/links/DiffLink.vue @@ -1,32 +1,37 @@ diff --git a/src/components/generics/links/DocumentLink.vue b/src/components/generics/links/DocumentLink.vue index 1f2b4c8e1c..a7038d8e19 100644 --- a/src/components/generics/links/DocumentLink.vue +++ b/src/components/generics/links/DocumentLink.vue @@ -1,39 +1,36 @@ diff --git a/src/components/generics/links/EditLink.vue b/src/components/generics/links/EditLink.vue index fe6504d0ca..8daae2d030 100644 --- a/src/components/generics/links/EditLink.vue +++ b/src/components/generics/links/EditLink.vue @@ -1,8 +1,9 @@ diff --git a/src/components/generics/links/HistoryLink.vue b/src/components/generics/links/HistoryLink.vue index 5a4b9260e5..e0e75681eb 100644 --- a/src/components/generics/links/HistoryLink.vue +++ b/src/components/generics/links/HistoryLink.vue @@ -1,5 +1,5 @@ diff --git a/src/components/generics/links/VersionLink.vue b/src/components/generics/links/VersionLink.vue index 996e47a613..9e4b2ec3c2 100644 --- a/src/components/generics/links/VersionLink.vue +++ b/src/components/generics/links/VersionLink.vue @@ -1,7 +1,8 @@ diff --git a/src/components/generics/markers/MarkerCondition.vue b/src/components/generics/markers/MarkerCondition.vue index 519f22af00..d3bd9c4ce0 100644 --- a/src/components/generics/markers/MarkerCondition.vue +++ b/src/components/generics/markers/MarkerCondition.vue @@ -5,12 +5,12 @@ diff --git a/src/components/generics/markers/MarkerDocumentType.vue b/src/components/generics/markers/MarkerDocumentType.vue index fc3d347ad9..c9859fafbe 100644 --- a/src/components/generics/markers/MarkerDocumentType.vue +++ b/src/components/generics/markers/MarkerDocumentType.vue @@ -5,9 +5,9 @@ diff --git a/src/components/generics/markers/MarkerHelper.vue b/src/components/generics/markers/MarkerHelper.vue index 83371ee51f..ad0893bebe 100644 --- a/src/components/generics/markers/MarkerHelper.vue +++ b/src/components/generics/markers/MarkerHelper.vue @@ -1,24 +1,20 @@ diff --git a/src/components/generics/markers/MarkerImageCount.vue b/src/components/generics/markers/MarkerImageCount.vue index 339f220720..d132faed38 100644 --- a/src/components/generics/markers/MarkerImageCount.vue +++ b/src/components/generics/markers/MarkerImageCount.vue @@ -1,17 +1,17 @@ diff --git a/src/components/generics/markers/MarkerQuality.vue b/src/components/generics/markers/MarkerQuality.vue index 6fe2047274..375707fd92 100644 --- a/src/components/generics/markers/MarkerQuality.vue +++ b/src/components/generics/markers/MarkerQuality.vue @@ -5,12 +5,12 @@ diff --git a/src/components/generics/modals/ModalCard.vue b/src/components/generics/modals/ModalCard.vue index 3e992eddb4..16e4485b3b 100644 --- a/src/components/generics/modals/ModalCard.vue +++ b/src/components/generics/modals/ModalCard.vue @@ -1,6 +1,5 @@ - diff --git a/src/components/generics/modals/ModalConfirmation.vue b/src/components/generics/modals/ModalConfirmation.vue index 0395f8986e..eee8fd1c4d 100644 --- a/src/components/generics/modals/ModalConfirmation.vue +++ b/src/components/generics/modals/ModalConfirmation.vue @@ -4,7 +4,6 @@
-
Warning: This action cannot be undone! @@ -12,13 +11,9 @@
-
-
- diff --git a/src/components/generics/modals/ModalWindow.vue b/src/components/generics/modals/ModalWindow.vue index 51f94aac75..9e305a2aa0 100644 --- a/src/components/generics/modals/ModalWindow.vue +++ b/src/components/generics/modals/ModalWindow.vue @@ -1,7 +1,7 @@ diff --git a/src/components/generics/modals/mixins.js b/src/components/generics/modals/mixins.js index be4c814b9b..6b5957505a 100644 --- a/src/components/generics/modals/mixins.js +++ b/src/components/generics/modals/mixins.js @@ -1,8 +1,7 @@ - export default { data() { return { - visible: false + visible: false, }; }, @@ -15,6 +14,6 @@ export default { hide() { this.visible = false; this.$emit('hide'); - } - } + }, + }, }; diff --git a/src/components/generics/pretty-links/PrettyBookLink.vue b/src/components/generics/pretty-links/PrettyBookLink.vue index 1fa9b04113..6ca79183c8 100644 --- a/src/components/generics/pretty-links/PrettyBookLink.vue +++ b/src/components/generics/pretty-links/PrettyBookLink.vue @@ -1,28 +1,24 @@ diff --git a/src/components/generics/pretty-links/PrettyOutingLink.vue b/src/components/generics/pretty-links/PrettyOutingLink.vue index b13922fd17..74a861d4fb 100644 --- a/src/components/generics/pretty-links/PrettyOutingLink.vue +++ b/src/components/generics/pretty-links/PrettyOutingLink.vue @@ -11,29 +11,27 @@  •  {{ outing.author.name }}
- +  •  - + diff --git a/src/components/generics/pretty-links/PrettyRouteLink.vue b/src/components/generics/pretty-links/PrettyRouteLink.vue index 77df6d22dd..e0c034aef5 100644 --- a/src/components/generics/pretty-links/PrettyRouteLink.vue +++ b/src/components/generics/pretty-links/PrettyRouteLink.vue @@ -5,17 +5,16 @@ + class="is-size-3 has-text-secondary icon-activities" + /> + class="has-text-normal" + > {{ route.height_diff_difficulties }} m, - + {{ route.orientations.join(', ') }}, @@ -32,47 +31,44 @@ diff --git a/src/components/generics/pretty-links/PrettyWaypointLink.vue b/src/components/generics/pretty-links/PrettyWaypointLink.vue index 58ce7f6aa3..02fdd75e90 100644 --- a/src/components/generics/pretty-links/PrettyWaypointLink.vue +++ b/src/components/generics/pretty-links/PrettyWaypointLink.vue @@ -1,30 +1,27 @@ diff --git a/src/components/helper/HelperWindow.vue b/src/components/helper/HelperWindow.vue index 7e2a1ae4a7..20f456a117 100644 --- a/src/components/helper/HelperWindow.vue +++ b/src/components/helper/HelperWindow.vue @@ -1,7 +1,7 @@ diff --git a/src/components/image-viewer/ImageInfo.vue b/src/components/image-viewer/ImageInfo.vue index aff9e9a820..ecad388f3d 100644 --- a/src/components/image-viewer/ImageInfo.vue +++ b/src/components/image-viewer/ImageInfo.vue @@ -34,7 +34,7 @@
    -
  • {{ document.camera_name }}
  • +
  • {{ document.camera_name }}
  • {{ document.exposure_time }}s
  • f/{{ document.fnumber }}
  • {{ document.focal_length }} mm
  • @@ -48,48 +48,46 @@ diff --git a/src/components/image-viewer/ImageViewer.vue b/src/components/image-viewer/ImageViewer.vue index d75e7fc54e..212c1bc980 100644 --- a/src/components/image-viewer/ImageViewer.vue +++ b/src/components/image-viewer/ImageViewer.vue @@ -13,23 +13,14 @@ :document="activeDocument" :lang="activeDocument.available_langs[0]" class="has-text-grey-lighter" - @click="visible=false"> + @click="visible = false" + > - - - + + + @@ -44,301 +35,302 @@ v-for="(image, index) of images" :key="image.document_id" class="image-viewer-bullet has-cursor-pointer" - :class="{'image-viewer-bullet-active': image === activeDocument}" + :class="{ 'image-viewer-bullet-active': image === activeDocument }" :title="image.locales[0].title" @click="onPaginationClick(index)" - :style="`width: calc((100vw - 1.5rem) / ${images.length});`" /> + :style="`width: calc((100vw - 1.5rem) / ${images.length});`" + /> - - diff --git a/src/components/images-uploader/ImageUploader.vue b/src/components/images-uploader/ImageUploader.vue index 9638fdeca9..63626c4882 100644 --- a/src/components/images-uploader/ImageUploader.vue +++ b/src/components/images-uploader/ImageUploader.vue @@ -1,8 +1,6 @@ diff --git a/src/components/images-uploader/ImagesUploader.vue b/src/components/images-uploader/ImagesUploader.vue index f940f37f46..1c020be2f3 100644 --- a/src/components/images-uploader/ImagesUploader.vue +++ b/src/components/images-uploader/ImagesUploader.vue @@ -4,7 +4,8 @@
    + class="column is-one-third-fullhd is-one-third-widescreen is-half-desktop is-half-tablet is-12-mobile" + > + @retryUpload="startUpload(image)" + />
    -
    -
    +
    +
    + class="input-file" + /> @@ -46,293 +46,285 @@ + v-translate + > + Save +
    diff --git a/src/components/map/BiodivInformation.vue b/src/components/map/BiodivInformation.vue index 3c58b92fe3..1b1241ece2 100644 --- a/src/components/map/BiodivInformation.vue +++ b/src/components/map/BiodivInformation.vue @@ -11,7 +11,7 @@

    sensitive_months: - {{ months.join(", ") }} + {{ months.join(', ') }}

    @@ -22,46 +22,44 @@ diff --git a/src/components/map/OlMap.vue b/src/components/map/OlMap.vue index b324284f6f..30b760b2b2 100644 --- a/src/components/map/OlMap.vue +++ b/src/components/map/OlMap.vue @@ -1,14 +1,14 @@ diff --git a/src/components/map/SwissProtectionAreaInformation.vue b/src/components/map/SwissProtectionAreaInformation.vue index c28cba7af6..6dbbe4e2b4 100644 --- a/src/components/map/SwissProtectionAreaInformation.vue +++ b/src/components/map/SwissProtectionAreaInformation.vue @@ -32,51 +32,51 @@ diff --git a/src/components/map/map-layers.js b/src/components/map/map-layers.js index f53918f427..6ab3b9ad22 100644 --- a/src/components/map/map-layers.js +++ b/src/components/map/map-layers.js @@ -7,15 +7,13 @@ function createSwisstopoLayer(title, layer, format = 'jpeg', time = 'current', r type: 'base', visible: false, source: new ol.source.XYZ({ - attributions: [ - 'swisstopo' - ], - urls: ['10', '11', '12', '13', '14'].map(i => { + attributions: ['swisstopo'], + urls: ['10', '11', '12', '13', '14'].map((i) => { return `https://wmts${i}.geo.admin.ch/1.0.0/${layer}/default/${time}/3857/{z}/{x}/{y}.${format}`; }), - maxZoom: 17 + maxZoom: 17, }), - restricted + restricted, }); } @@ -33,7 +31,7 @@ function createIgnFrSource(title, layer, format = 'jpeg') { const tileGrid = new ol.tilegrid.WMTS({ origin: [-20037508, 20037508], resolutions, - matrixIds + matrixIds, }); const source = new ol.source.WMTS({ @@ -47,15 +45,15 @@ function createIgnFrSource(title, layer, format = 'jpeg') { attributions: [ '' + '' - ] + 'theme/geoportal/img/logo_gp.gif">', + ], }); return new ol.layer.Tile({ title, type: 'base', visible: false, - source + source, }); } @@ -72,19 +70,19 @@ function createIgnEsSource(title, source) { let url = 'http://www.ign.es/wmts/'; let layer; switch (source) { - case 'raster': - default: - url += 'mapa-raster'; - layer = 'MTN'; - break; - case 'base': - url += 'ign-base'; - layer = 'IGNBaseTodo'; - break; - case 'ortho': - url += 'pnoa-ma'; - layer = 'OI.OrthoimageCoverage'; - break; + case 'raster': + default: + url += 'mapa-raster'; + layer = 'MTN'; + break; + case 'base': + url += 'ign-base'; + layer = 'IGNBaseTodo'; + break; + case 'ortho': + url += 'pnoa-ma'; + layer = 'OI.OrthoimageCoverage'; + break; } const levels = 21; @@ -101,7 +99,7 @@ function createIgnEsSource(title, source) { extent: [-20037508.34, -20037508.34, 20037508.34, 20037508.34], origin: [-20037508.34, 20037508.34], resolutions, - matrixIds + matrixIds, }); return new ol.layer.Tile({ @@ -115,8 +113,8 @@ function createIgnEsSource(title, source) { format: 'image/jpeg', projection: 'EPSG:3857', tileGrid, - attributions: ['CC BY 4.0 www.basemap.at' - }) + attributions: 'www.basemap.at', + }), }); } -export const cartoLayers = function() { +export const cartoLayers = function () { // $gettext('ESRI', 'Map layer') /* const esri = new ol.layer.Tile({ title: 'Esri', @@ -211,8 +209,8 @@ export const cartoLayers = function() { attributions: '© OpenStreetMap | ' + '© OpenTopoMap', - maxZoom: 17 - }) + maxZoom: 17, + }), }); // $gettext('IGN maps', 'Map layer') @@ -239,11 +237,11 @@ export const cartoLayers = function() { ignEsMaps, ignEsOrtho, basemap, - basemapOrtho + basemapOrtho, ]; }; -export const dataLayers = function() { +export const dataLayers = function () { // $gettext('IGN', 'Map slopes layer') const ignSlopes = createIgnFrSource('IGN', 'GEOGRAPHICALGRIDSYSTEMS.SLOPES.MOUNTAIN', 'png'); ignSlopes.setOpacity(0.4); @@ -254,7 +252,7 @@ export const dataLayers = function() { return [ignSlopes, swissSlopes]; }; -export const protectionAreasLayers = function() { +export const protectionAreasLayers = function () { const swissTranquilityZones = createSwisstopoLayer( 'Swiss tranquility zones', 'ch.bafu.wrz-wildruhezonen_portal', diff --git a/src/components/map/map-utils.js b/src/components/map/map-utils.js index b44fe8aae9..3d214b3818 100644 --- a/src/components/map/map-utils.js +++ b/src/components/map/map-utils.js @@ -1,14 +1,14 @@ - import ol from '@/js/libs/ol.js'; import utils from '@/js/utils.js'; import { icon } from '@fortawesome/fontawesome-svg-core'; -const buildTextStyle = function(title, highlight) { +const buildTextStyle = function (title, highlight) { // createTextStyle_ = function(feature, type, highlight) { let text; - if (highlight) { // on hover in list view + if (highlight) { + // on hover in list view const def = { text: utils.stringDivider(title, 30, '\n'), textAlign: 'left', @@ -17,12 +17,12 @@ const buildTextStyle = function(title, highlight) { font: '12px verdana,sans-serif', stroke: new ol.style.Stroke({ color: 'white', - width: 3 + width: 3, }), fill: new ol.style.Fill({ - color: 'black' + color: 'black', }), - textBaseline: 'middle' + textBaseline: 'middle', }; text = new ol.style.Text(def); @@ -31,34 +31,34 @@ const buildTextStyle = function(title, highlight) { return text; }; -export const buildPolygonStyle = function() { +export const buildPolygonStyle = function () { return new ol.style.Style({ stroke: new ol.style.Stroke({ color: [190, 190, 190, 1], - width: 1 + width: 1, }), fill: new ol.style.Fill({ - color: [254, 228, 120, 0.7] - }) + color: [254, 228, 120, 0.7], + }), }); }; -export const buildDiffStyle = function(isOld) { +export const buildDiffStyle = function (isOld) { return new ol.style.Style({ stroke: new ol.style.Stroke({ color: isOld ? 'red' : 'green', - width: isOld ? 5 : 3 + width: isOld ? 5 : 3, }), image: new ol.style.Circle({ fill: new ol.style.Fill({ - color: isOld ? 'rgba(255, 0, 0, 0.5)' : 'rgba(0, 255, 0, 0.9)' + color: isOld ? 'rgba(255, 0, 0, 0.5)' : 'rgba(0, 255, 0, 0.9)', }), - radius: isOld ? 10 : 5 - }) + radius: isOld ? 10 : 5, + }), }); }; -const buildPointStyle = function(title, svgSrc, color, highlight) { +const buildPointStyle = function (title, svgSrc, color, highlight) { const imgSize = highlight ? 30 : 20; const circleRadius = highlight ? 20 : 15; @@ -67,17 +67,17 @@ const buildPointStyle = function(title, svgSrc, color, highlight) { const iconStyle = new ol.style.Style({ image: new ol.style.Icon({ - src: 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svgSrc) + src: 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(svgSrc), }), - text: buildTextStyle(title, highlight) + text: buildTextStyle(title, highlight), }); const circleStyle = new ol.style.Style({ image: new ol.style.Circle({ radius: circleRadius, fill: new ol.style.Fill({ color: 'rgba(255, 255, 255, 0.5)' }), - stroke: new ol.style.Stroke({ color: '#ddd', width: 2 }) - }) + stroke: new ol.style.Stroke({ color: '#ddd', width: 2 }), + }), }); return [circleStyle, iconStyle]; @@ -88,18 +88,18 @@ const svgSrcByDocumentType = { o: icon({ prefix: 'document-type', iconName: 'outing' }).html[0], r: icon({ prefix: 'fas', iconName: 'route' }).html[0], u: icon({ prefix: 'fas', iconName: 'user' }).html[0], - x: icon({ prefix: 'fas', iconName: 'flag-checkered' }).html[0] + x: icon({ prefix: 'fas', iconName: 'flag-checkered' }).html[0], }; const colorByConditionRating = { - 'excellent': '#008000', - 'good': '#9ACD32', - 'average': '#FFFF00', - 'poor': '#FF0000', - 'awful': '#8B0000' + excellent: '#008000', + good: '#9ACD32', + average: '#FFFF00', + poor: '#FF0000', + awful: '#8B0000', }; -export const getDocumentPointStyle = function(document, title, highlight) { +export const getDocumentPointStyle = function (document, title, highlight) { const type = document.type; let color = null; let svgSrc = null; @@ -124,13 +124,13 @@ export const getDocumentPointStyle = function(document, title, highlight) { return buildPointStyle(title, svgSrc, color, highlight); }; -export const getDocumentLineStyle = function(title, highlight) { +export const getDocumentLineStyle = function (title, highlight) { return new ol.style.Style({ stroke: new ol.style.Stroke({ color: highlight ? 'red' : 'yellow', - width: 3 + width: 3, }), - text: buildTextStyle(title, highlight) + text: buildTextStyle(title, highlight), }); }; diff --git a/src/components/markdown-editor/EditorButton.vue b/src/components/markdown-editor/EditorButton.vue index 00cb88f39f..ceb8683583 100644 --- a/src/components/markdown-editor/EditorButton.vue +++ b/src/components/markdown-editor/EditorButton.vue @@ -5,7 +5,8 @@ :title="tooltip" :target="target" :href="href" - @click="!disabled ? $emit('click', arguments[0]) : {}"> + @click="!disabled ? $emit('click', arguments[0]) : {}" + > @@ -16,32 +17,32 @@ diff --git a/src/components/markdown-editor/LinkHelper.vue b/src/components/markdown-editor/LinkHelper.vue index ff9500f578..e2f2049d2f 100644 --- a/src/components/markdown-editor/LinkHelper.vue +++ b/src/components/markdown-editor/LinkHelper.vue @@ -8,7 +8,7 @@ {{ $gettext('text to display') | uppercaseFirstLetter }}
    - +
    @@ -16,7 +16,7 @@ {{ $gettext('URL') | uppercaseFirstLetter }}
    - +
    @@ -31,25 +31,24 @@ diff --git a/src/components/markdown-editor/MarkdownEditor.vue b/src/components/markdown-editor/MarkdownEditor.vue index 1bb66f5737..486ad33f03 100644 --- a/src/components/markdown-editor/MarkdownEditor.vue +++ b/src/components/markdown-editor/MarkdownEditor.vue @@ -1,23 +1,24 @@ diff --git a/src/components/yeti/Disclaimer.vue b/src/components/yeti/Disclaimer.vue index 6500201200..6c9fc452eb 100644 --- a/src/components/yeti/Disclaimer.vue +++ b/src/components/yeti/Disclaimer.vue @@ -1,12 +1,48 @@ diff --git a/src/js/Cache.js b/src/js/Cache.js index 0087268ace..5b4d082fe8 100644 --- a/src/js/Cache.js +++ b/src/js/Cache.js @@ -12,7 +12,7 @@ * requested : Cache.get() ********************************************************************/ -const Cache = function() { +const Cache = function () { this._size = 0; this._data = new Map(); // cache of 256ko @@ -24,7 +24,7 @@ const Cache = function() { this._maxSize = 250000; }; -Cache.prototype.feed = function(key, value) { +Cache.prototype.feed = function (key, value) { this.delete(key); this._data.set(key, value); @@ -38,18 +38,18 @@ Cache.prototype.feed = function(key, value) { } }; -Cache.prototype.has = function(key) { +Cache.prototype.has = function (key) { return this._data.has(key); }; -Cache.prototype.get = function(key) { +Cache.prototype.get = function (key) { const value = this._data.get(key); this.feed(key, value); // put it back to top return value; }; -Cache.prototype.delete = function(key) { +Cache.prototype.delete = function (key) { if (this._data.has(key)) { this._size -= this._data.get(key).length + key.length; this._data.delete(key); diff --git a/src/js/Worker.js b/src/js/Worker.js index 1e47f87b69..779087ef93 100644 --- a/src/js/Worker.js +++ b/src/js/Worker.js @@ -21,9 +21,7 @@ class Worker { } const partial = this._stack.shift(); this._working = true; - partial() - .then(this._next.bind(this)) - .catch(this._next.bind(this)); + partial().then(this._next.bind(this)).catch(this._next.bind(this)); } } diff --git a/src/js/apis/BaseApi.js b/src/js/apis/BaseApi.js index e3a91b409c..81cb7ed7f9 100644 --- a/src/js/apis/BaseApi.js +++ b/src/js/apis/BaseApi.js @@ -7,7 +7,7 @@ import axios from 'axios'; // but, Promise prototype is not writable // So let's polyfill it, whith a Promise-like object -const ApiData = function(promise) { +const ApiData = function (promise) { const self = this; this.response = null; @@ -17,33 +17,33 @@ const ApiData = function(promise) { this.loading = true; promise.then( - response => { + (response) => { self.loading = false; self.response = response; self.data = response.data; }, - error => { + (error) => { self.loading = false; self.error = error; } ); }; -ApiData.prototype.then = function(callback) { +ApiData.prototype.then = function (callback) { this.promise_.then(callback); return this; }; -ApiData.prototype.catch = function(callback) { +ApiData.prototype.catch = function (callback) { this.promise_.catch(callback); return this; }; -const BaseApi = function(apiUrl) { +const BaseApi = function (apiUrl) { this.axios = axios.create({ // axios instances shares same common headers. this trick fix this. headers: { common: {} }, - baseURL: apiUrl + baseURL: apiUrl, }); }; @@ -51,19 +51,19 @@ const BaseApi = function(apiUrl) { * Generic request helpers */ -BaseApi.prototype.get = function(url, params) { +BaseApi.prototype.get = function (url, params) { return new ApiData(this.axios.get(url, params)); }; -BaseApi.prototype.post = function(url, body) { +BaseApi.prototype.post = function (url, body) { return new ApiData(this.axios.post(url, body)); }; -BaseApi.prototype.put = function(url, body) { +BaseApi.prototype.put = function (url, body) { return new ApiData(this.axios.put(url, body)); }; -BaseApi.prototype.delete = function(url, body) { +BaseApi.prototype.delete = function (url, body) { return new ApiData(this.axios.delete(url, body)); }; diff --git a/src/js/apis/BiodivSportsService.js b/src/js/apis/BiodivSportsService.js index 1e97aafb21..39fb31f446 100644 --- a/src/js/apis/BiodivSportsService.js +++ b/src/js/apis/BiodivSportsService.js @@ -5,15 +5,15 @@ function BiodivSportsService() { this.axios = axios.create(); } -BiodivSportsService.prototype.fetchData = function(extent, activities, language) { +BiodivSportsService.prototype.fetchData = function (extent, activities, language) { if (language !== 'fr' && language !== 'en' && language !== 'it') { language = 'en'; } const params = { - 'in_bbox': `${extent[0]},${extent[1]},${extent[2]},${extent[3]}`, + in_bbox: `${extent[0]},${extent[1]},${extent[2]},${extent[3]}`, language, - 'fields': 'id,geometry,name,description,info_url,period,kml_url' + fields: 'id,geometry,name,description,info_url,period,kml_url', }; if (activities && activities.length > 0) { diff --git a/src/js/apis/RespecterCestProtegerService.js b/src/js/apis/RespecterCestProtegerService.js index 65e92eb484..019cf67b66 100644 --- a/src/js/apis/RespecterCestProtegerService.js +++ b/src/js/apis/RespecterCestProtegerService.js @@ -4,7 +4,7 @@ function RespecterCestProtegerService() { this.axios = axios.create(); } -RespecterCestProtegerService.prototype.identify = function(position, extent, mapWidth, mapHeight, language) { +RespecterCestProtegerService.prototype.identify = function (position, extent, mapWidth, mapHeight, language) { if (language !== 'fr' && language !== 'de' && language !== 'it') { language = 'en'; } diff --git a/src/js/apis/c2c/AssociationService.js b/src/js/apis/c2c/AssociationService.js index 48a0b6ef8a..338c84f6a4 100644 --- a/src/js/apis/c2c/AssociationService.js +++ b/src/js/apis/c2c/AssociationService.js @@ -2,7 +2,7 @@ function AssociationService(api) { this.api = api; } -AssociationService.prototype.create = function(parent, child) { +AssociationService.prototype.create = function (parent, child) { const pType = parent.type; const cType = child.type; @@ -28,20 +28,20 @@ AssociationService.prototype.create = function(parent, child) { return this.api.post('/associations', data); }; -AssociationService.prototype.remove = function(parent, child) { +AssociationService.prototype.remove = function (parent, child) { const data = { parent_document_id: parent.document_id, - child_document_id: child.document_id + child_document_id: child.document_id, }; return this.api.delete('/associations', { data }); }; -AssociationService.prototype.getHistory = function(params) { +AssociationService.prototype.getHistory = function (params) { let url = '/associations-history'; const query = []; - const addFilter = function(key, value) { + const addFilter = function (key, value) { if (value) { query.push(`${key}=${value}`); } diff --git a/src/js/apis/c2c/DocumentService.js b/src/js/apis/c2c/DocumentService.js index b280ad65e9..e911532ef0 100644 --- a/src/js/apis/c2c/DocumentService.js +++ b/src/js/apis/c2c/DocumentService.js @@ -1,18 +1,17 @@ - function DocumentService(api, documentType) { this.documentType = documentType; this.api = api; } -DocumentService.prototype.getAll = function(params) { +DocumentService.prototype.getAll = function (params) { return this.api.get('/' + this.documentType + 's', { params }); }; -DocumentService.prototype.get = function(id, lang) { +DocumentService.prototype.get = function (id, lang) { return this.api.get('/' + this.documentType + 's/' + id, { params: { l: lang } }); }; -DocumentService.prototype.getCooked = function(id, prefered_lang) { +DocumentService.prototype.getCooked = function (id, prefered_lang) { // chinese is not yet present as topoguide lang, so default it to english prefered_lang = prefered_lang === 'zh_CN' ? 'en' : prefered_lang; const promise = this.api.get('/' + this.documentType + 's/' + id + `?cook=${prefered_lang}`); @@ -20,23 +19,23 @@ DocumentService.prototype.getCooked = function(id, prefered_lang) { return promise; }; -DocumentService.prototype.getVersion = function(id, lang, versionId) { +DocumentService.prototype.getVersion = function (id, lang, versionId) { const url = '/' + this.documentType + 's/' + id + '/' + lang + '/' + versionId; return this.api.get(url); }; -DocumentService.prototype.save = function(document, comment) { +DocumentService.prototype.save = function (document, comment) { return this.api.put('/' + this.documentType + 's/' + document.document_id, { document, - message: comment + message: comment, }); }; -DocumentService.prototype.create = function(document) { +DocumentService.prototype.create = function (document) { return this.api.post('/' + this.documentType + 's', document); }; -DocumentService.prototype.getHistory = function(document_id, lang) { +DocumentService.prototype.getHistory = function (document_id, lang) { return this.api.get('/document/' + document_id + '/history/' + lang); }; diff --git a/src/js/apis/c2c/FeedService.js b/src/js/apis/c2c/FeedService.js index 1601ccdcdf..f1dad1b902 100644 --- a/src/js/apis/c2c/FeedService.js +++ b/src/js/apis/c2c/FeedService.js @@ -2,15 +2,15 @@ function FeedService(api) { this.api = api; } -FeedService.prototype.getDefaultFeed = function(params) { +FeedService.prototype.getDefaultFeed = function (params) { return this.api.get('/feed', { params }); }; -FeedService.prototype.getProfileFeed = function(params) { +FeedService.prototype.getProfileFeed = function (params) { return this.api.get('/profile-feed', { params }); }; -FeedService.prototype.getPersonalFeed = function(params) { +FeedService.prototype.getPersonalFeed = function (params) { return this.api.get('/personal-feed', { params }); }; diff --git a/src/js/apis/c2c/ForumService.js b/src/js/apis/c2c/ForumService.js index b2b9b4751f..e62e7afccf 100644 --- a/src/js/apis/c2c/ForumService.js +++ b/src/js/apis/c2c/ForumService.js @@ -4,11 +4,11 @@ function ForumService(api) { this.api = api; } -ForumService.prototype.getPrivateMessagesCount = function() { +ForumService.prototype.getPrivateMessagesCount = function () { return this.api.get('/forum/private-messages/unread-count'); }; -ForumService.prototype.createTopic = function(document_id, lang) { +ForumService.prototype.createTopic = function (document_id, lang) { return this.api.post('/forum/topics', { document_id, lang }); }; diff --git a/src/js/apis/c2c/ModeratorService.js b/src/js/apis/c2c/ModeratorService.js index d65359c6a1..12a958277b 100644 --- a/src/js/apis/c2c/ModeratorService.js +++ b/src/js/apis/c2c/ModeratorService.js @@ -5,23 +5,23 @@ function ModeratorService(api) { /** * Protection service */ -ModeratorService.prototype.protectDocument = function(documentId) { - return this.api.post('/documents/protect', { 'document_id': documentId }); +ModeratorService.prototype.protectDocument = function (documentId) { + return this.api.post('/documents/protect', { document_id: documentId }); }; -ModeratorService.prototype.unprotectDocument = function(documentId) { - return this.api.post('/documents/unprotect', { 'document_id': documentId }); +ModeratorService.prototype.unprotectDocument = function (documentId) { + return this.api.post('/documents/unprotect', { document_id: documentId }); }; /** * Delete service */ -ModeratorService.prototype.deleteDocument = function(documentId) { +ModeratorService.prototype.deleteDocument = function (documentId) { return this.api.delete('/documents/delete/' + documentId); }; -ModeratorService.prototype.deleteLocale = function(documentId, lang) { +ModeratorService.prototype.deleteLocale = function (documentId, lang) { const url = '/documents/delete/' + String(documentId) + '/' + lang; return this.api.delete(url, {}); }; @@ -29,36 +29,36 @@ ModeratorService.prototype.deleteLocale = function(documentId, lang) { /** * Merge service */ -ModeratorService.prototype.mergeDocuments = function(sourceDocumentId, targetDocumentId) { +ModeratorService.prototype.mergeDocuments = function (sourceDocumentId, targetDocumentId) { const data = { - 'source_document_id': sourceDocumentId, - 'target_document_id': targetDocumentId + source_document_id: sourceDocumentId, + target_document_id: targetDocumentId, }; return this.api.post('/documents/merge', data); }; -ModeratorService.prototype.revertDocument = function(documentId, lang, versionId) { +ModeratorService.prototype.revertDocument = function (documentId, lang, versionId) { return this.api.post('/documents/revert', { - 'document_id': documentId, + document_id: documentId, lang, - 'version_id': versionId + version_id: versionId, }); }; /** * block account service */ -ModeratorService.prototype.isAccountBlocked = function(userId) { +ModeratorService.prototype.isAccountBlocked = function (userId) { return this.api.get('/users/blocked/' + userId); }; -ModeratorService.prototype.blockAccount = function(userId) { - return this.api.post('/users/block', { 'user_id': userId }); +ModeratorService.prototype.blockAccount = function (userId) { + return this.api.post('/users/block', { user_id: userId }); }; -ModeratorService.prototype.unblockAccount = function(userId) { - return this.api.post('/users/unblock', { 'user_id': userId }); +ModeratorService.prototype.unblockAccount = function (userId) { + return this.api.post('/users/unblock', { user_id: userId }); }; export default ModeratorService; diff --git a/src/js/apis/c2c/UserProfileService.js b/src/js/apis/c2c/UserProfileService.js index 8bd140c276..5b5ab4e246 100644 --- a/src/js/apis/c2c/UserProfileService.js +++ b/src/js/apis/c2c/UserProfileService.js @@ -1,4 +1,3 @@ - function UserProfileService(api) { this.api = api; @@ -9,7 +8,7 @@ function UserProfileService(api) { post(preferences) { return api.post('/users/preferences', preferences); - } + }, }; this.following = { @@ -27,7 +26,7 @@ function UserProfileService(api) { isFollowing(user_id) { return api.get('/users/following-user/' + user_id); - } + }, }; this.account = { @@ -37,7 +36,7 @@ function UserProfileService(api) { post(currentpassword, name, forum_username, email, is_profile_public, newpassword) { const payload = { - currentpassword + currentpassword, }; if (name !== null) { @@ -61,43 +60,43 @@ function UserProfileService(api) { } return api.post('/users/account', payload); - } + }, }; } -UserProfileService.prototype.login = function(username, password) { +UserProfileService.prototype.login = function (username, password) { return this.api.post('/users/login', { username, password, - discourse: true + discourse: true, }); }; -UserProfileService.prototype.logout = function() { +UserProfileService.prototype.logout = function () { return this.api.post('/users/logout', { discourse: true }); }; -UserProfileService.prototype.update_preferred_language = function(lang) { +UserProfileService.prototype.update_preferred_language = function (lang) { return this.api.post('/users/update_preferred_language', { lang }); }; -UserProfileService.prototype.requestPasswordChange = function(email) { +UserProfileService.prototype.requestPasswordChange = function (email) { return this.api.post('/users/request_password_change', { email }); }; -UserProfileService.prototype.validateNewPassword = function(nonce, password) { +UserProfileService.prototype.validateNewPassword = function (nonce, password) { return this.api.post('/users/validate_new_password/' + nonce, { password }); }; -UserProfileService.prototype.register = function(data) { +UserProfileService.prototype.register = function (data) { return this.api.post('/users/register', data); }; -UserProfileService.prototype.validateChangeEmail = function(nonce) { +UserProfileService.prototype.validateChangeEmail = function (nonce) { return this.api.post('/users/validate_change_email/' + nonce); }; -UserProfileService.prototype.validateRegisterEmail = function(nonce) { +UserProfileService.prototype.validateRegisterEmail = function (nonce) { return this.api.post('/users/validate_register_email/' + nonce); }; diff --git a/src/js/apis/c2c/index.js b/src/js/apis/c2c/index.js index 0de20d52ec..589cd32e0f 100644 --- a/src/js/apis/c2c/index.js +++ b/src/js/apis/c2c/index.js @@ -41,7 +41,7 @@ CamptocampApi.prototype = Object.create(BaseApi.prototype); // restore good contructor CamptocampApi.prototype.constructor = CamptocampApi; -CamptocampApi.prototype.setAuthorizationToken = function(token) { +CamptocampApi.prototype.setAuthorizationToken = function (token) { if (token) { this.axios.defaults.headers.common.Authorization = 'JWT token="' + token + '"'; } else if (this.axios.defaults.headers.common.Authorization) { @@ -51,10 +51,10 @@ CamptocampApi.prototype.setAuthorizationToken = function(token) { /* some function that not belong to a dedicated service */ -CamptocampApi.prototype.search = function(params) { +CamptocampApi.prototype.search = function (params) { return this.get('/search', { params }); }; -CamptocampApi.prototype.getRecentChanges = function(params) { +CamptocampApi.prototype.getRecentChanges = function (params) { return this.get('/documents/changes', { params }); }; @@ -66,30 +66,31 @@ CamptocampApi.prototype.getRecentChanges = function(params) { /** * Upload images service */ -CamptocampApi.prototype.uploadImage = function(file, onUploadProgress, onSucess, onFailure) { +CamptocampApi.prototype.uploadImage = function (file, onUploadProgress, onSucess, onFailure) { const formData = new FormData(); formData.append('file', file); const requestConfig = { headers: { - 'Content-Type': undefined // overwrite with undefined + 'Content-Type': undefined, // overwrite with undefined }, - onUploadProgress + onUploadProgress, }; /* can't user post_ helper: it's not the API url */ /* TODO : move this function in another service... */ - return this.axios.post(config.urls.imageBackend + '/upload', formData, requestConfig) + return this.axios + .post(config.urls.imageBackend + '/upload', formData, requestConfig) .then(onSucess) .catch(onFailure); }; -CamptocampApi.prototype.createImages = function(images) { +CamptocampApi.prototype.createImages = function (images) { return this.post('/images/list', { images }); }; -CamptocampApi.prototype.cooker = function(data) { +CamptocampApi.prototype.cooker = function (data) { return this.post('/cooker', data); }; diff --git a/src/js/apis/forum.js b/src/js/apis/forum.js index a809228769..2101cccc11 100644 --- a/src/js/apis/forum.js +++ b/src/js/apis/forum.js @@ -1,4 +1,3 @@ - import BaseApi from '@/js/apis/BaseApi.js'; import config from '@/js/config'; @@ -15,14 +14,14 @@ Forum.prototype.constructor = Forum; Object.defineProperty(Forum.prototype, 'url', { get() { return config.urls.forum; - } + }, }); -Forum.prototype.getTopic = function(topicId) { +Forum.prototype.getTopic = function (topicId) { return this.get('/t/title/' + topicId + '.json'); }; -Forum.prototype.getLatest = function(excludeCategoryIds) { +Forum.prototype.getLatest = function (excludeCategoryIds) { if (excludeCategoryIds) { excludeCategoryIds = '?' + excludeCategoryIds.map((id) => `exclude_category_ids[]=${id}`).join('&'); } else { @@ -31,14 +30,14 @@ Forum.prototype.getLatest = function(excludeCategoryIds) { const result = this.get(`/latest.json${excludeCategoryIds}`); - result.then(function(response) { + result.then(function (response) { const users = {}; - response.data.users.forEach(function(user) { + response.data.users.forEach(function (user) { users[user.username] = user; }); - response.data.topic_list.topics.map(function(topic) { + response.data.topic_list.topics.map(function (topic) { topic.last_poster_user = users[topic.last_poster_username]; }); }); @@ -46,14 +45,14 @@ Forum.prototype.getLatest = function(excludeCategoryIds) { return result; }; -Forum.prototype.readAnnouncement = function(lang) { +Forum.prototype.readAnnouncement = function (lang) { lang = lang === 'zh_CN' ? 'en' : lang; return this.get('/t/annonce-' + lang + '.json'); }; // Tehcniccly not part of the API, but this helper // is probably at the best place here... -Forum.prototype.getAvatarUrl = function(user, size) { +Forum.prototype.getAvatarUrl = function (user, size) { const template = user.avatar_template.startsWith('/') ? this.url + user.avatar_template : user.avatar_template; return template.replace('{size}', size); }; diff --git a/src/js/apis/photon.js b/src/js/apis/photon.js index 2729116d69..f9cd77914a 100644 --- a/src/js/apis/photon.js +++ b/src/js/apis/photon.js @@ -13,12 +13,12 @@ Photon.prototype = Object.create(BaseApi.prototype); // restore good contructor Photon.prototype.constructor = Photon; -Photon.prototype.getPropositions = function(query, lang, centerWgs84) { +Photon.prototype.getPropositions = function (query, lang, centerWgs84) { const params = { q: query, lang, lon: centerWgs84[0], - lat: centerWgs84[1] + lat: centerWgs84[1], }; return this.get('/', { params }); diff --git a/src/js/config.js b/src/js/config.js index 9680d0ccb0..c56b55abda 100644 --- a/src/js/config.js +++ b/src/js/config.js @@ -2,12 +2,12 @@ // DO not modify this file. If you need another build parameter // please go to vue.config.js in root - // eslint-disable-next-line no-undef +// eslint-disable-next-line no-undef const config = CAMPTOCAMP_CONFIG; const LOCAL_STORAGE_KEY = 'SiteConfiguration.urlsName'; -config.setUrlsName = function(name) { +config.setUrlsName = function (name) { window.localStorage.setItem(LOCAL_STORAGE_KEY, name); }; diff --git a/src/js/constants/Field.js b/src/js/constants/Field.js index bdfea6537e..120ad55b13 100644 --- a/src/js/constants/Field.js +++ b/src/js/constants/Field.js @@ -12,7 +12,7 @@ for (const property of Object.values(fieldsProperties)) { } } -const onlyRockClimbing = function(document) { +const onlyRockClimbing = function (document) { const activities = document.activities; if (!activities || activities.length === 0 || activities.length > 1) { @@ -23,8 +23,8 @@ const onlyRockClimbing = function(document) { }; // this handler is only for routes -const getIsOnlyRockClimbingTypesHandler = function(types) { - return function(document) { +const getIsOnlyRockClimbingTypesHandler = function (types) { + return function (document) { if (document.type !== 'r') { return true; } @@ -61,7 +61,7 @@ const extraIsVisibleForHandlers = { equipment_rating: getIsOnlyRockClimbingTypesHandler(['single', 'multi']), rock_required_rating: getIsOnlyRockClimbingTypesHandler(['single', 'multi']), - aid_rating: getIsOnlyRockClimbingTypesHandler(['single', 'multi']) + aid_rating: getIsOnlyRockClimbingTypesHandler(['single', 'multi']), }; function Field(id, properties = {}) { @@ -117,7 +117,7 @@ function Field(id, properties = {}) { } } -Field.prototype.valueToUrl = function(value) { +Field.prototype.valueToUrl = function (value) { if (this.queryMode === 'numericalRangeSlider' || this.queryMode === 'valuesRangeSlider') { return value.join(','); } @@ -153,7 +153,7 @@ Field.prototype.valueToUrl = function(value) { throw new Error('Unknow field queryMode for ' + this.name + ': ' + this.queryMode); }; -Field.prototype.urlToValue = function(url) { +Field.prototype.urlToValue = function (url) { if (this.queryMode === 'numericalRangeSlider') { let value = url || this.defaultUrlQuery; value = value.split(','); @@ -186,7 +186,7 @@ Field.prototype.urlToValue = function(url) { } if (this.queryMode === 'checkbox') { - return !((url === null || url === undefined || url === '' || url === 'false')); + return !(url === null || url === undefined || url === '' || url === 'false'); } if (this.queryMode === 'input') { @@ -204,13 +204,17 @@ Field.prototype.urlToValue = function(url) { } if (this.queryMode === 'input-document') { - return url ? String(url).split(',').map(num => parseInt(num, 10)) : []; + return url + ? String(url) + .split(',') + .map((num) => parseInt(num, 10)) + : []; } throw new Error('Unknow field queryMode for ' + this.name + ': ' + this.queryMode); }; -Field.prototype.getErrorObject = function(description) { +Field.prototype.getErrorObject = function (description) { let errorName; if (this.parent === 'document') { @@ -223,11 +227,11 @@ Field.prototype.getErrorObject = function(description) { return { name: errorName, - description + description, }; }; -Field.prototype.getError = function(document, locale) { +Field.prototype.getError = function (document, locale) { if (!this.isVisibleFor(document)) { return null; } @@ -260,7 +264,7 @@ Field.prototype.getError = function(document, locale) { return null; }; -Field.prototype.isVisibleForActivities = function(activities) { +Field.prototype.isVisibleForActivities = function (activities) { let result = true; if (this.activities && activities) { @@ -270,7 +274,7 @@ Field.prototype.isVisibleForActivities = function(activities) { return result; }; -Field.prototype.isVisibleForWaypointType = function(waypointType) { +Field.prototype.isVisibleForWaypointType = function (waypointType) { if (!this.waypoint_types) { return true; } @@ -282,7 +286,7 @@ Field.prototype.isVisibleForWaypointType = function(waypointType) { return this.waypoint_types.includes(waypointType); }; -Field.prototype.isVisibleForWaypointTypes = function(waypointTypes) { +Field.prototype.isVisibleForWaypointTypes = function (waypointTypes) { if (!this.waypoint_types) { return true; } @@ -294,7 +298,7 @@ Field.prototype.isVisibleForWaypointTypes = function(waypointTypes) { return utils.intersectionIsNotNull(this.waypoint_types, waypointTypes); }; -Field.prototype.isVisibleFor = function(document) { +Field.prototype.isVisibleFor = function (document) { if (!this.extraIsVisibleFor(document)) { return false; } diff --git a/src/js/constants/index.js b/src/js/constants/index.js index 98a6f6d2bc..adabe2c018 100644 --- a/src/js/constants/index.js +++ b/src/js/constants/index.js @@ -2,7 +2,7 @@ import common from './common.json'; import Field from './Field.js'; import documentsProperties from './documentsProperties.json'; -const getFieldsObject = function(fieldsArray) { +const getFieldsObject = function (fieldsArray) { const result = {}; for (const def of fieldsArray) { @@ -37,8 +37,8 @@ function Constants() { this.letterToDocumentType[documentProperties.letter] = documentType; } - documentsProperties.outing.fields.date_start.max = (new Date()).toISOString().substring(0, 10); - documentsProperties.outing.fields.date_end.max = (new Date()).toISOString().substring(0, 10); + documentsProperties.outing.fields.date_start.max = new Date().toISOString().substring(0, 10); + documentsProperties.outing.fields.date_end.max = new Date().toISOString().substring(0, 10); } export default new Constants(); diff --git a/src/js/cooker.js b/src/js/cooker.js index bb49a22781..7753787da6 100644 --- a/src/js/cooker.js +++ b/src/js/cooker.js @@ -15,22 +15,22 @@ const NOT_MARKDOWN_PROPERTY = new Set([ 'slope', 'conditions_levels', 'topic_id', - 'participants' + 'participants', ]); -const Cooker = function() { +const Cooker = function () { this._cache = new Cache(); }; -Cooker.prototype.has = function(markdown) { +Cooker.prototype.has = function (markdown) { return this._cache.has(markdown); }; -Cooker.prototype.get = function(markdown) { +Cooker.prototype.get = function (markdown) { return this._cache.get(markdown); }; -Cooker.prototype.feed = function(locale, cooked) { +Cooker.prototype.feed = function (locale, cooked) { for (const key of Object.keys(locale)) { if (!NOT_MARKDOWN_PROPERTY.has(key) && locale[key]) { this._cache.feed(locale[key], cooked[key]); @@ -38,7 +38,7 @@ Cooker.prototype.feed = function(locale, cooked) { } }; -Cooker.prototype.cook = function(locale) { +Cooker.prototype.cook = function (locale) { const missing = {}; const result = {}; let mustCallServer = false; @@ -55,7 +55,7 @@ Cooker.prototype.cook = function(locale) { } if (mustCallServer) { - return c2c.cooker(missing).then(response => { + return c2c.cooker(missing).then((response) => { this.feed(missing, response.data); // complete data with previously calculated data @@ -65,14 +65,14 @@ Cooker.prototype.cook = function(locale) { // otherwise, return a fake promise const response = { - data: result + data: result, }; return { response, then(callback) { callback(response); - } + }, }; } }; diff --git a/src/js/get-fundraiser.js b/src/js/get-fundraiser.js index 5796a41ecc..31ea1c19eb 100644 --- a/src/js/get-fundraiser.js +++ b/src/js/get-fundraiser.js @@ -3,34 +3,38 @@ const mapping = { // url: ' https://www.helloasso.com/associations/rockclimber/formulaires/1/widget' // }, - 14474: { // Scotland - url: 'https://www.7amax.co.uk/' + 14474: { + // Scotland + url: 'https://www.7amax.co.uk/', }, - 14151: { // Malta - url: 'https://maltaclimbingclub.org/bolt-fund/' + 14151: { + // Malta + url: 'https://maltaclimbingclub.org/bolt-fund/', }, - 14125: { // Philippines - url: 'http://www.climbphilippines.com/boltfund.html' - } + 14125: { + // Philippines + url: 'http://www.climbphilippines.com/boltfund.html', + }, }; -const intersection = function(array1, array2) { +const intersection = function (array1, array2) { if (!array1 || !array2) { return []; } - return array1.filter(value => array2.includes(value)); + return array1.filter((value) => array2.includes(value)); }; -export default function(document) { +export default function (document) { // Only areas, waypoints, routes if (!['r', 'w', 'a'].includes(document.type)) { return null; } - if (document.type === 'r') { // routes + if (document.type === 'r') { + // routes // only mountain_climbing and rock_climbing activity if (!intersection(document.activities, ['mountain_climbing', 'rock_climbing']).length) { return null; @@ -40,7 +44,8 @@ export default function(document) { if (!['P1', 'P1+'].includes(document.equipment_rating)) { return null; } - } else if (document.type === 'w') { // waypoints + } else if (document.type === 'w') { + // waypoints // only climbing outdoor sites if (document.waypoint_type !== 'climbing_outdoor') { return null; diff --git a/src/js/image-urls.js b/src/js/image-urls.js index 73014b811d..6342a12bb1 100644 --- a/src/js/image-urls.js +++ b/src/js/image-urls.js @@ -1,6 +1,6 @@ import config from '@/js/config'; -const getUrl = function(image, size) { +const getUrl = function (image, size) { if (!image.filename) { const sizeArg = size ? `?$size=${size}` : ''; return `${config.urls.api}/images/proxy/${image.document_id}${sizeArg}`; @@ -36,5 +36,5 @@ export default { /* Original size */ get(image) { return getUrl(image); - } + }, }; diff --git a/src/js/libs/d3.js b/src/js/libs/d3.js index 58eed1cdb8..685746bfb0 100644 --- a/src/js/libs/d3.js +++ b/src/js/libs/d3.js @@ -7,7 +7,7 @@ function D3() { this.resolvingCount_ = 0; } -D3.prototype.resolve_ = function() { +D3.prototype.resolve_ = function () { if (this.resolved_ || this.resolving_) { return; } @@ -27,10 +27,10 @@ D3.prototype.resolve_ = function() { this.load_(import(/* webpackChunkName: "chunk-d3" */ 'd3-selection'), 'selection'); }; -D3.prototype.load_ = function(promise, key) { +D3.prototype.load_ = function (promise, key) { this.resolvingCount_++; - promise.then(response => { + promise.then((response) => { if (response.default) { this[key] = response.default; } else { @@ -49,13 +49,13 @@ D3.prototype.load_ = function(promise, key) { }); }; -D3.prototype.postResolve_ = function() { +D3.prototype.postResolve_ = function () { for (const callback of this.callbacks_) { callback(); } }; -D3.prototype.then = function(callback) { +D3.prototype.then = function (callback) { this.resolve_(); if (this.resolved_) { diff --git a/src/js/libs/ol.js b/src/js/libs/ol.js index 4917fb324f..26ffbc8e40 100644 --- a/src/js/libs/ol.js +++ b/src/js/libs/ol.js @@ -59,7 +59,7 @@ export default { FullScreen, ScaleLine, Zoom, - Attribution + Attribution, }, extent: { @@ -67,39 +67,39 @@ export default { getWidth, containsXY, createEmpty, - extend + extend, }, format: { GeoJSON, GPX, - KML + KML, }, geom: { LineString, Point, - Polygon + Polygon, }, interaction: { Draw, Modify, Snap, - DragAndDrop + DragAndDrop, }, layer: { Vector: VectorLayer, Tile: TileLayer, - Image: ImageLayer + Image: ImageLayer, }, proj: { get: getProjection, transform: transformProjection, transformExtent, - toLonLat + toLonLat, }, source: { @@ -107,7 +107,7 @@ export default { BingMaps, XYZ, WMTS, - ImageStatic + ImageStatic, }, style: { @@ -116,10 +116,10 @@ export default { Circle, Fill, Stroke, - Text + Text, }, tilegrid: { - WMTS: WMTSTileGrid - } + WMTS: WMTSTileGrid, + }, }; diff --git a/src/js/properties-mixins.js b/src/js/properties-mixins.js index be3b4fa43e..4e9ee91016 100644 --- a/src/js/properties-mixins.js +++ b/src/js/properties-mixins.js @@ -1,26 +1,25 @@ - export const requireDocumentProperty = { props: { document: { type: Object, - required: true - } + required: true, + }, }, computed: { documentType() { return this.$documentUtils.getDocumentType(this.document.type); - } - } + }, + }, }; export const requireFieldProperty = { props: { field: { type: Object, - required: true - } - } + required: true, + }, + }, }; export const requireDocumentTypeProperty = { @@ -28,9 +27,9 @@ export const requireDocumentTypeProperty = { documentType: { type: String, required: true, - validator: value => { + validator: (value) => { return value.length > 1; - } - } - } + }, + }, + }, }; diff --git a/src/js/upload-file.js b/src/js/upload-file.js index 5601b8077e..5878b5560f 100644 --- a/src/js/upload-file.js +++ b/src/js/upload-file.js @@ -19,7 +19,7 @@ if (!HTMLCanvasElement.prototype.toBlob) { Object.defineProperty(HTMLCanvasElement.prototype, 'toBlob', { value(callback, type, quality) { const dataURL = this.toDataURL(type, quality).split(',')[1]; - setTimeout(function() { + setTimeout(function () { const binStr = atob(dataURL); const len = binStr.length; const arr = new Uint8Array(len); @@ -30,13 +30,13 @@ if (!HTMLCanvasElement.prototype.toBlob) { callback(new Blob([arr], { type: type || 'image/png' })); }); - } + }, }); } // https://github.com/c2corg/v6_ui/blob/c9962a6c3bac0670eab732d563f9f480379f84d1/c2corg_ui/static/js/utils.js#L273 -const convertDMSToDecimal = function(degrees, minutes, seconds, direction) { - let decimal = Number(degrees) + (Number(minutes) / 60) + (parseFloat(seconds) / 3600); +const convertDMSToDecimal = function (degrees, minutes, seconds, direction) { + let decimal = Number(degrees) + Number(minutes) / 60 + parseFloat(seconds) / 3600; // Don't do anything for N or E if (direction === 'S' || direction === 'W') { @@ -46,7 +46,7 @@ const convertDMSToDecimal = function(degrees, minutes, seconds, direction) { return decimal; }; -const parseDate = function(exif, iptc) { +const parseDate = function (exif, iptc) { const iptcDate = iptc ? iptc.DateCreated : null; const exifDate = exif ? exif.DateTimeOriginal || exif.DateTime : null; @@ -65,7 +65,7 @@ const parseDate = function(exif, iptc) { return date && date.isValid() ? date.format() : null; }; -const parseExifGeometry = function(exif) { +const parseExifGeometry = function (exif) { if (!exif.GPSLatitude || !exif.GPSLongitude) { return undefined; } @@ -81,12 +81,12 @@ const parseExifGeometry = function(exif) { } const location = ol.proj.transform([lon, lat], 'EPSG:4326', 'EPSG:3857'); - const geom = { 'coordinates': location, 'type': 'Point' }; + const geom = { coordinates: location, type: 'Point' }; - return { 'geom': JSON.stringify(geom) }; + return { geom: JSON.stringify(geom) }; }; -const parseExifElevation = function(exif) { +const parseExifElevation = function (exif) { if (!exif.GPSAltitude) { return undefined; } @@ -95,16 +95,16 @@ const parseExifElevation = function(exif) { return isNaN(elevation) ? undefined : elevation; }; -const setIfDefined = function(document, name, value) { +const setIfDefined = function (document, name, value) { if (value !== undefined) { document[name] = value; } }; -const uploadFile = function(file, onDataUrlReady, onUploadProgress, onSuccess, onFailure) { +const uploadFile = function (file, onDataUrlReady, onUploadProgress, onSuccess, onFailure) { const document = {}; - const parseMetaData = function(metaData) { + const parseMetaData = function (metaData) { const exif = metaData.exif ? metaData.exif.getAll() : null; const iptc = metaData.iptc ? metaData.iptc.getAll() : null; let orientation = 0; @@ -118,14 +118,14 @@ const uploadFile = function(file, onDataUrlReady, onUploadProgress, onSuccess, o setIfDefined(document, 'iso_speed', exif.PhotographicSensitivity); setIfDefined(document, 'focal_length', exif.FocalLengthIn35mmFilm); setIfDefined(document, 'fnumber', exif.FNumber); - setIfDefined(document, 'camera_name', (exif.Make && exif.Model) ? (exif.Make + ' ' + exif.Model) : undefined); + setIfDefined(document, 'camera_name', exif.Make && exif.Model ? exif.Make + ' ' + exif.Model : undefined); setIfDefined(document, 'geometry', parseExifGeometry(exif)); setIfDefined(document, 'elevation', parseExifElevation(exif)); } preProcess(orientation); }; - const preProcess = function(orientation) { + const preProcess = function (orientation) { if (orientation !== 0 && file.type === 'image/jpeg') { loadImage( file, @@ -148,14 +148,14 @@ const uploadFile = function(file, onDataUrlReady, onUploadProgress, onSuccess, o } }; - const processDataUrl = function(dataUrl) { + const processDataUrl = function (dataUrl) { // send data url to caller onDataUrlReady(dataUrl); // and use this to get image dimensions const img = new Image(); - img.onload = function() { + img.onload = function () { // image is loaded; sizes are available document.width = img.width; document.height = img.height; @@ -164,12 +164,12 @@ const uploadFile = function(file, onDataUrlReady, onUploadProgress, onSuccess, o img.src = dataUrl; }; - const onUploadSuccess = function(event) { + const onUploadSuccess = function (event) { document.filename = event.data.filename; onSuccess(document); }; - const upload = function(data) { + const upload = function (data) { worker.push(c2c.uploadImage.bind(c2c), data, onUploadProgress, onUploadSuccess, onFailure); }; diff --git a/src/js/utils.js b/src/js/utils.js index debeed6323..6ffd9ea512 100644 --- a/src/js/utils.js +++ b/src/js/utils.js @@ -1,13 +1,11 @@ - import saveAs from 'file-saver'; export default { - // from https://github.com/c2corg/v6_ui/blob/c9962a6c3bac0670eab732d563f9f480379f84d1/c2corg_ui/static/js/utils.js#L194 stringDivider(str, width, spaceReplacer) { if (str && str.length > width) { let p = width; - while (p > 0 && (str[p] !== ' ' && str[p] !== '-')) { + while (p > 0 && str[p] !== ' ' && str[p] !== '-') { p--; } @@ -44,7 +42,7 @@ export default { downloadCsv(objects, fileName, keys) { const defaultGetter = (object, key) => object[key]; - const convertToCsv = function(value) { + const convertToCsv = function (value) { if (value === null || value === undefined) { return ''; } @@ -108,11 +106,12 @@ export default { // decode html entities in a text. Remove any html markup decodeHtmlEntities(input) { - if (!DOMParser) { // prevent errors on old browsers + if (!DOMParser) { + // prevent errors on old browsers return input; } const doc = new DOMParser().parseFromString(input, 'text/html'); return doc.documentElement.textContent; - } + }, }; diff --git a/src/js/vue-plugins/alert-window.js b/src/js/vue-plugins/alert-window.js index 61dfcd191f..459b9c2c2b 100644 --- a/src/js/vue-plugins/alert-window.js +++ b/src/js/vue-plugins/alert-window.js @@ -1,8 +1,7 @@ - export default function install(Vue) { Object.defineProperty(Vue.prototype, '$alert', { get() { return this.$root.$children[0].$refs.alertWindow; - } + }, }); } diff --git a/src/js/vue-plugins/document-utils.js b/src/js/vue-plugins/document-utils.js index 694b426a72..d8baf8293a 100644 --- a/src/js/vue-plugins/document-utils.js +++ b/src/js/vue-plugins/document-utils.js @@ -10,7 +10,6 @@ import constants from '@/js/constants'; export default function install(Vue) { Vue.prototype.$documentUtils = new Vue({ methods: { - getCreationTitle(documentType) { if (documentType === 'outing') return this.$gettext('add an outing'); if (documentType === 'route') return this.$gettext('add a route'); @@ -91,7 +90,8 @@ export default function install(Vue) { }, hasRating(document) { - return document.global_rating || + return ( + document.global_rating || document.rock_free_rating || document.rock_required_rating || document.aid_rating || @@ -107,7 +107,8 @@ export default function install(Vue) { document.mtb_down_rating || document.hiking_mtb_exposition || document.labande_global_rating || - document.labande_ski_rating; + document.labande_ski_rating + ); }, getAssociationArrayName(child) { @@ -116,7 +117,7 @@ export default function install(Vue) { }, isInArray(array, document) { - return array.filter(item => item.document_id === document.document_id).length !== 0; + return array.filter((item) => item.document_id === document.document_id).length !== 0; }, addAssociation(document, child) { @@ -134,7 +135,7 @@ export default function install(Vue) { const arrayName = this.getAssociationArrayName(child); const array = document.associations[arrayName]; - document.associations[arrayName] = array.filter(item => item.document_id !== child.document_id); + document.associations[arrayName] = array.filter((item) => item.document_id !== child.document_id); }, propagateAssociationProperties(parent, child) { @@ -172,7 +173,7 @@ export default function install(Vue) { 'via_ferrata_rating', 'mtb_down_rating', - 'mtb_up_rating' + 'mtb_up_rating', ]; names.forEach((name) => { @@ -205,10 +206,8 @@ export default function install(Vue) { const result = { type: def.letter, - locales: [ - this.buildLocale(documentType, lang) - ], - associations: {} + locales: [this.buildLocale(documentType, lang)], + associations: {}, }; for (const field of Object.values(def.fields)) { @@ -226,7 +225,7 @@ export default function install(Vue) { if (def.geoLocalized) { result.geometry = { geom: null, - geom_detail: null + geom_detail: null, }; } @@ -239,7 +238,7 @@ export default function install(Vue) { if (areas) { // the areas often come in different orders within 3 area objects. - const orderedAreas = { 'range': [], 'admin_limits': [], 'country': [] }; + const orderedAreas = { range: [], admin_limits: [], country: [] }; for (const area of areas) { orderedAreas[area.area_type].push(this.getLocaleSmart(area).title); @@ -286,16 +285,17 @@ export default function install(Vue) { return start.format('Do') + ' - ' + end.format('LL'); } else { // moment does not offer a short hand for date with weekday. - const longFormat = { - 'ca': 'dddd D MMMM [de] YYYY [a les]', - 'de': 'ddd, D. MMMM YYYY', - 'en': 'dddd, D MMMM YYYY', - 'es': 'dddd, D [de] MMMM [de]', - 'eu': 'dddd, YYYY[ko] MMMM[ren] D[a]', - 'fr': 'dddd D MMMM YYYY', - 'it': 'dddd D MMMM YYYY', - 'zh_CN': 'YYYY年M月D日dddd' - }[this.$language.current] || 'dddd Do MMMM YYYY'; + const longFormat = + { + ca: 'dddd D MMMM [de] YYYY [a les]', + de: 'ddd, D. MMMM YYYY', + en: 'dddd, D MMMM YYYY', + es: 'dddd, D [de] MMMM [de]', + eu: 'dddd, YYYY[ko] MMMM[ren] D[a]', + fr: 'dddd D MMMM YYYY', + it: 'dddd D MMMM YYYY', + zh_CN: 'YYYY年M月D日dddd', + }[this.$language.current] || 'dddd Do MMMM YYYY'; return end.format(longFormat); } @@ -304,7 +304,7 @@ export default function install(Vue) { // Returns true if both documents has same geolocalization point // it compares document.geometry.geom hasSameGeolocation(document1, document2) { - const geomIsValid = function(geom) { + const geomIsValid = function (geom) { return geom.type === 'Point' && Array.isArray(geom.coordinates) && geom.coordinates.length === 2; }; @@ -327,7 +327,7 @@ export default function install(Vue) { const data2 = JSON.parse(geolocation2); if (geomIsValid(data1) && geomIsValid(data2)) { - return (data1.coordinates[0] === data2.coordinates[0] && data1.coordinates[1] === data2.coordinates[1]); + return data1.coordinates[0] === data2.coordinates[0] && data1.coordinates[1] === data2.coordinates[1]; } else if (!geomIsValid(data1) && !geomIsValid(data2)) { // both invalid structure, considere them as identical return true; @@ -336,7 +336,7 @@ export default function install(Vue) { return false; } } - } - } + }, + }, }); } diff --git a/src/js/vue-plugins/font-awesome-config.js b/src/js/vue-plugins/font-awesome-config.js index 12921c1dd3..738bd42383 100644 --- a/src/js/vue-plugins/font-awesome-config.js +++ b/src/js/vue-plugins/font-awesome-config.js @@ -1,4 +1,3 @@ - import { library } from '@fortawesome/fontawesome-svg-core'; import { FontAwesomeIcon, FontAwesomeLayers } from '@fortawesome/vue-fontawesome'; diff --git a/src/js/vue-plugins/generic-components.js b/src/js/vue-plugins/generic-components.js index 7529f25371..b0fae8c4aa 100644 --- a/src/js/vue-plugins/generic-components.js +++ b/src/js/vue-plugins/generic-components.js @@ -1,15 +1,18 @@ - // This module will add components available everywhere export default function install(Vue) { // add all vue component as globals components, given en require context - const addComponents = function(context) { - context.keys().forEach(key => { + const addComponents = function (context) { + context.keys().forEach((key) => { const component = context(key); let name = key.split('/').slice(-1)[0]; // kebab-case-ification, assuming that all module names are in PascalCase - name = name.replace('.vue', '').replace(/([A-Z])/g, '-$1').toLowerCase().substring(1); + name = name + .replace('.vue', '') + .replace(/([A-Z])/g, '-$1') + .toLowerCase() + .substring(1); Vue.component(name, component.default); }); diff --git a/src/js/vue-plugins/gettext-plugin.js b/src/js/vue-plugins/gettext-plugin.js index 10bd66326e..e60d28dfec 100644 --- a/src/js/vue-plugins/gettext-plugin.js +++ b/src/js/vue-plugins/gettext-plugin.js @@ -24,7 +24,8 @@ function cleanMessageId(msgid) { return msgid; } -function getTranslation(lang, messages, msgid, msgctxt) { //, n = 1, context = null, defaultPlural = null){ +function getTranslation(lang, messages, msgid, msgctxt) { + //, n = 1, context = null, defaultPlural = null){ if (messages === undefined) { // `messages are not yet available` return msgid; @@ -61,17 +62,17 @@ function getMessages(lang) { } else if (lang === 'en') { return import(/* webpackChunkName: "translations-en" */ `@/translations/en.json`); } else if (lang === 'ca') { - return import(/* webpackChunkName: "translations-ca" */`@/translations/ca.json`); + return import(/* webpackChunkName: "translations-ca" */ `@/translations/ca.json`); } else if (lang === 'eu') { - return import(/* webpackChunkName: "translations-eu" */`@/translations/eu.json`); + return import(/* webpackChunkName: "translations-eu" */ `@/translations/eu.json`); } else if (lang === 'it') { - return import(/* webpackChunkName: "translations-it" */`@/translations/it.json`); + return import(/* webpackChunkName: "translations-it" */ `@/translations/it.json`); } else if (lang === 'de') { - return import(/* webpackChunkName: "translations-de" */`@/translations/de.json`); + return import(/* webpackChunkName: "translations-de" */ `@/translations/de.json`); } else if (lang === 'es') { - return import(/* webpackChunkName: "translations-es" */`@/translations/es.json`); + return import(/* webpackChunkName: "translations-es" */ `@/translations/es.json`); } else if (lang === 'zh_CN') { - return import(/* webpackChunkName: "translations-es" */`@/translations/zh_CN.json`); + return import(/* webpackChunkName: "translations-es" */ `@/translations/zh_CN.json`); } throw new Error(`Unsuported language : ${lang}`); @@ -82,7 +83,7 @@ export default function install(Vue) { name: 'Language', data: { - current: null + current: null, }, created() { @@ -95,7 +96,7 @@ export default function install(Vue) { es: 'Español', ca: 'Català', eu: 'Euskara', - zh_CN: 'Chinese' + zh_CN: 'Chinese', }; this.translations = {}; @@ -141,9 +142,10 @@ export default function install(Vue) { const messages = getMessages(lang); - return new Promise(resolve => { - if (messages.then) { // messages is a promise - messages.then(translations => { + return new Promise((resolve) => { + if (messages.then) { + // messages is a promise + messages.then((translations) => { this.translations[lang] = translations[lang]; resolve(translations[lang]); }); @@ -160,20 +162,20 @@ export default function install(Vue) { getIANALanguageSubtag(lang) { switch (lang) { - case 'fr': - case 'en': - case 'ca': - case 'eu': - case 'it': - case 'de': - case 'es': - return lang; - case 'zh_CN': - return 'zh'; - default: - // eslint-disable-next-line no-console - console.error(`Unexpected langauage: ${lang}`); - return lang; + case 'fr': + case 'en': + case 'ca': + case 'eu': + case 'it': + case 'de': + case 'es': + return lang; + case 'zh_CN': + return 'zh'; + default: + // eslint-disable-next-line no-console + console.error(`Unexpected langauage: ${lang}`); + return lang; } }, @@ -181,7 +183,7 @@ export default function install(Vue) { if (element.dataset.msgid === undefined) { if (element.childNodes.length > 1 || element.firstChild.nodeType !== TEXT_NODE) { // eslint-disable-next-line - console.error("v-translate must contains only text", element.childNodes) + console.error('v-translate must contains only text', element.childNodes); return; } @@ -194,8 +196,8 @@ export default function install(Vue) { } element.innerText = this.gettext(element.dataset.msgid, element.dataset.msgctxt); - } - } + }, + }, }); // An option to support translation with HTML content: `v-translate`. @@ -211,7 +213,7 @@ export default function install(Vue) { update(el) { // console.log("update", el) languageVm.updateElement(el); - } + }, }); Vue.prototype.$language = languageVm; diff --git a/src/js/vue-plugins/helper-window.js b/src/js/vue-plugins/helper-window.js index 8f24d1cb1e..bc504752e0 100644 --- a/src/js/vue-plugins/helper-window.js +++ b/src/js/vue-plugins/helper-window.js @@ -1,8 +1,7 @@ - export default function install(Vue) { Object.defineProperty(Vue.prototype, '$helper', { get() { return this.$root.$children[0].$refs.helper; - } + }, }); } diff --git a/src/js/vue-plugins/image-viewer.js b/src/js/vue-plugins/image-viewer.js index af593d4514..d50d78dbc1 100644 --- a/src/js/vue-plugins/image-viewer.js +++ b/src/js/vue-plugins/image-viewer.js @@ -1,8 +1,7 @@ - export default function install(Vue) { Object.defineProperty(Vue.prototype, '$imageViewer', { get() { return this.$root.$children[0].$refs.imageViewer; - } + }, }); } diff --git a/src/js/vue-plugins/local-storage.js b/src/js/vue-plugins/local-storage.js index ed2c4fdef9..e612b7b0bb 100644 --- a/src/js/vue-plugins/local-storage.js +++ b/src/js/vue-plugins/local-storage.js @@ -1,4 +1,3 @@ - /* * LocalStorage is a wrapper arround window.localStorage * it allows a key/string to be used as a key/{property:value} object @@ -9,16 +8,16 @@ function LocalStorageItem(key) { this.data_ = JSON.parse(window.localStorage.getItem(key) || '{}'); } -LocalStorageItem.prototype.commit_ = function() { +LocalStorageItem.prototype.commit_ = function () { window.localStorage.setItem(this.key, JSON.stringify(this.data_)); }; -LocalStorageItem.prototype.get = function(propertyName, defaultIfUndefined) { +LocalStorageItem.prototype.get = function (propertyName, defaultIfUndefined) { const result = this.data_[propertyName]; return result === undefined ? defaultIfUndefined : result; }; -LocalStorageItem.prototype.set = function(propertyName, value) { +LocalStorageItem.prototype.set = function (propertyName, value) { // deep copy of value value = JSON.parse(JSON.stringify(value)); @@ -26,17 +25,17 @@ LocalStorageItem.prototype.set = function(propertyName, value) { this.commit_(); }; -LocalStorageItem.prototype.clear = function() { +LocalStorageItem.prototype.clear = function () { this.data_ = {}; this.commit_(); }; -LocalStorageItem.prototype.initialize = function(data) { +LocalStorageItem.prototype.initialize = function (data) { this.data_ = Object.assign({}, data); this.commit_(); }; -LocalStorageItem.prototype.assign = function(data) { +LocalStorageItem.prototype.assign = function (data) { for (const key of Object.keys(data)) { this.data_[key] = data[key]; } @@ -48,7 +47,7 @@ function LocalStorage() { this.cache_ = {}; } -LocalStorage.prototype.getItem = function(key) { +LocalStorage.prototype.getItem = function (key) { if (!this.cache_[key]) { this.cache_[key] = new LocalStorageItem(key); } @@ -69,6 +68,6 @@ export default function install(Vue) { // find another way. Maybe this in created() : // this.$localStorage return localStorage.getItem(`${this.$options.name}.preferences`); - } + }, }); } diff --git a/src/js/vue-plugins/router.js b/src/js/vue-plugins/router.js index 73de8535d2..ae9075ed69 100644 --- a/src/js/vue-plugins/router.js +++ b/src/js/vue-plugins/router.js @@ -42,11 +42,13 @@ const MapEditionView = () => import(/* webpackChunkName: "wiki-tools" */ '@/view const OutingEditionView = () => import(/* webpackChunkName: "wiki-tools" */ '@/views/wiki/edition/OutingEditionView'); const ProfileEditionView = () => import(/* webpackChunkName: "wiki-tools" */ '@/views/wiki/edition/ProfileEditionView'); const RouteEditionView = () => import(/* webpackChunkName: "wiki-tools" */ '@/views/wiki/edition/RouteEditionView'); -const WaypointEditionView = () => import(/* webpackChunkName: "wiki-tools" */ '@/views/wiki/edition/WaypointEditionView'); +const WaypointEditionView = () => + import(/* webpackChunkName: "wiki-tools" */ '@/views/wiki/edition/WaypointEditionView'); const XreportEditionView = () => import(/* webpackChunkName: "wiki-tools" */ '@/views/wiki/edition/XreportEditionView'); const WhatsNewView = () => import(/* webpackChunkName: "wiki-tools" */ `@/views/wiki/WhatsNewView.vue`); const HistoryView = () => import(/* webpackChunkName: "wiki-tools" */ `@/views/wiki/HistoryView.vue`); -const AssociationsHistoryView = () => import(/* webpackChunkName: "wiki-tools" */ `@/views/wiki/AssociationsHistoryView.vue`); +const AssociationsHistoryView = () => + import(/* webpackChunkName: "wiki-tools" */ `@/views/wiki/AssociationsHistoryView.vue`); const DiffView = () => import(/* webpackChunkName: "wiki-tools" */ `@/views/wiki/DiffView.vue`); const routes = [ @@ -71,52 +73,52 @@ const routes = [ name: 'forum', beforeEnter() { location.href = config.urls.forum; - } - } + }, + }, ]; -const addDocumentTypeView = function(def, viewComponent, editionComponent) { +const addDocumentTypeView = function (def, viewComponent, editionComponent) { routes.push({ path: '/' + def.documentType + 's', name: def.documentType + 's', - component: DocumentsView } - ); + component: DocumentsView, + }); routes.push({ path: '/' + def.documentType + 's/:id(\\d+)/:lang?/:title?', name: def.documentType, - component: viewComponent } - ); + component: viewComponent, + }); routes.push({ path: '/' + def.documentType + 's/version/:id(\\d+)/:lang/:version', name: def.documentType + '-version', - component: viewComponent } - ); + component: viewComponent, + }); routes.push({ path: '/' + def.documentType + 's/history/:id(\\d+)/:lang', name: def.documentType + '-history', - component: HistoryView } - ); + component: HistoryView, + }); routes.push({ path: '/' + def.documentType + 's/edit/:id(\\d+)/:lang', name: def.documentType + '-edit', - component: editionComponent } - ); + component: editionComponent, + }); routes.push({ path: '/' + def.documentType + 's/add/:lang?', name: def.documentType + '-add', - component: editionComponent } - ); + component: editionComponent, + }); routes.push({ path: '/' + def.documentType + 's/diff/:id(\\d+)/:lang/:versionFrom/:versionTo', name: def.documentType + '-diff', - component: DiffView } - ); + component: DiffView, + }); }; addDocumentTypeView(constants.objectDefinitions.area, AreaView, AreaEditionView); @@ -165,14 +167,14 @@ const router = new Router({ } // we'll wait for triggerScroll event - return new Promise((resolve, reject) => { + return new Promise((resolve) => { // we add an once handler on the event // view will trigger it once data are present this.app.$root.$once('triggerScroll', () => { resolve(position); }); }); - } + }, }); export default router; diff --git a/src/js/vue-plugins/screen.js b/src/js/vue-plugins/screen.js index 0c4dbe372b..52f8662161 100644 --- a/src/js/vue-plugins/screen.js +++ b/src/js/vue-plugins/screen.js @@ -1,4 +1,3 @@ - const BREAKPOINT_MOBILE = 768; const BREAKPOINT_TABLET = 1023; const BREAKPOINT_DESKTOP = 1215; @@ -11,7 +10,7 @@ export default function install(Vue) { data() { return { width: window.innerWidth, - height: window.innerHeight + height: window.innerHeight, }; }, @@ -31,7 +30,7 @@ export default function install(Vue) { }, isFullHD() { return this.width > BREAKPOINT_WIDESCREEN; - } + }, }, created() { @@ -42,7 +41,7 @@ export default function install(Vue) { onResize() { this.width = window.innerWidth; this.height = window.innerHeight; - } - } + }, + }, }); } diff --git a/src/js/vue-plugins/strip-markdown.js b/src/js/vue-plugins/strip-markdown.js index d6cd6c1b1e..edb5d7bdf3 100644 --- a/src/js/vue-plugins/strip-markdown.js +++ b/src/js/vue-plugins/strip-markdown.js @@ -1,7 +1,7 @@ // A very basic (a.k.a not bullet-proof) filter to remove markdown content from summary export default function install(Vue) { - Vue.filter('stripMarkdown', function(value) { + Vue.filter('stripMarkdown', function (value) { return value .replace(/\[([^\]]+)\]\([^)]+\)/g, '$1') // external links .replace(/\[\[[^|]+\|([^\]]+)\]\]/g, '$1') // internal links diff --git a/src/js/vue-plugins/uppercase-first-letter.js b/src/js/vue-plugins/uppercase-first-letter.js index 5bdbf68205..0603fb4b8e 100644 --- a/src/js/vue-plugins/uppercase-first-letter.js +++ b/src/js/vue-plugins/uppercase-first-letter.js @@ -2,7 +2,7 @@ // use a vue filter to perform This export default function install(Vue) { - Vue.filter('uppercaseFirstLetter', function(value) { + Vue.filter('uppercaseFirstLetter', function (value) { return value.charAt(0).toUpperCase() + value.slice(1); }); } diff --git a/src/js/vue-plugins/user.js b/src/js/vue-plugins/user.js index e12b4e1abd..e7a298feef 100644 --- a/src/js/vue-plugins/user.js +++ b/src/js/vue-plugins/user.js @@ -9,7 +9,6 @@ export default function install(Vue) { const data = this.$localStorage.get(config.urls.api, {}); return { - // The unique name, used to login userName: data['userName'] || null, @@ -32,7 +31,7 @@ export default function install(Vue) { token: data['token'] || null, // token expiration date - expire: data['expire'] || null + expire: data['expire'] || null, }; }, @@ -42,14 +41,14 @@ export default function install(Vue) { }, isLogged() { return Boolean(this.token); - } + }, }, watch: { - 'token': { + token: { handler: 'updateToken', - immediate: true - } + immediate: true, + }, }, created() { @@ -58,19 +57,18 @@ export default function install(Vue) { methods: { signIn(username, password) { - return c2c.userProfile.login(username, password) - .then(response => { - this.lang = response.data.lang; - this.token = response.data.token; - this.roles = response.data.roles; - this.id = response.data.id; - this.userName = response.data.username; - this.name = response.data.name; - this.forumUsername = response.data.forum_username; - this.expire = response.data.expire; - - this.$language.setCurrent(this.lang); - this.commitToLocaleStorage_(); + return c2c.userProfile.login(username, password).then((response) => { + this.lang = response.data.lang; + this.token = response.data.token; + this.roles = response.data.roles; + this.id = response.data.id; + this.userName = response.data.username; + this.name = response.data.name; + this.forumUsername = response.data.forum_username; + this.expire = response.data.expire; + + this.$language.setCurrent(this.lang); + this.commitToLocaleStorage_(); }); }, @@ -89,18 +87,13 @@ export default function install(Vue) { }, updateAccount(currentpassword, name, forum_username, email, is_profile_public, newpassword) { - return c2c.userProfile.account.post( - currentpassword, - name, - forum_username, - email, - is_profile_public, - newpassword - ).then(() => { - this.forumUsername = forum_username === null ? this.forumUsername : forum_username; - this.name = name === null ? this.name : name; - this.commitToLocaleStorage_(); - }); + return c2c.userProfile.account + .post(currentpassword, name, forum_username, email, is_profile_public, newpassword) + .then(() => { + this.forumUsername = forum_username === null ? this.forumUsername : forum_username; + this.name = name === null ? this.name : name; + this.commitToLocaleStorage_(); + }); }, updateToken() { @@ -134,7 +127,7 @@ export default function install(Vue) { } return false; - } - } + }, + }, }); } diff --git a/src/js/vue-plugins/vue-moment.js b/src/js/vue-plugins/vue-moment.js index 4564cd8a32..0d8e5eadc9 100644 --- a/src/js/vue-plugins/vue-moment.js +++ b/src/js/vue-plugins/vue-moment.js @@ -39,8 +39,8 @@ export default function install(Vue) { month(monthNumber) { return moment.localeData(this.$language.current).months()[monthNumber]; - } - } + }, + }, }); Vue.prototype.$moment = momentVm; diff --git a/src/js/waypoint-labels-mixin.js b/src/js/waypoint-labels-mixin.js index ce245d9730..3bb09cbf99 100644 --- a/src/js/waypoint-labels-mixin.js +++ b/src/js/waypoint-labels-mixin.js @@ -1,4 +1,3 @@ - /************************************************************************************************************ Waypoint fields access and access_period has a different signification, depending of waypoint_type It implies different label/titles/placeholders. And this logic is needed in both document views and @@ -10,7 +9,9 @@ export default { computed: { descriptionTitle() { - return this.document && this.document.waypoint_type === 'access' ? this.$gettext('road access') : this.$gettext('description'); + return this.document && this.document.waypoint_type === 'access' + ? this.$gettext('road access') + : this.$gettext('description'); }, accessTitle() { @@ -19,14 +20,14 @@ export default { } switch (this.document.waypoint_type) { - case 'access': - return this.$gettext('public transportation access'); - case 'climbing_outdoor': - return this.$gettext('pedestrian access'); - case 'hut': - return this.$gettext('pedestrian access', 'hut'); - default: - return this.$gettext('road or pedestrian access'); + case 'access': + return this.$gettext('public transportation access'); + case 'climbing_outdoor': + return this.$gettext('pedestrian access'); + case 'hut': + return this.$gettext('pedestrian access', 'hut'); + default: + return this.$gettext('road or pedestrian access'); } }, @@ -36,16 +37,16 @@ export default { } switch (this.document.waypoint_type) { - case 'hut': - case 'gite': - case 'camp_site': - return this.$gettext('opening_periods'); - case 'local_product': - return this.$gettext('opening_hours'); - case 'climbing_outdoor': - return this.$gettext('restricted_access'); - default: - return this.$gettext('access_period'); + case 'hut': + case 'gite': + case 'camp_site': + return this.$gettext('opening_periods'); + case 'local_product': + return this.$gettext('opening_hours'); + case 'climbing_outdoor': + return this.$gettext('restricted_access'); + default: + return this.$gettext('access_period'); } }, @@ -53,10 +54,10 @@ export default { const type = this.document ? this.document.waypoint_type : undefined; switch (type) { - case 'access': - return this.$gettext('Describe road access'); - default: - return this.$gettext('Describe here the waypoint'); + case 'access': + return this.$gettext('Describe road access'); + default: + return this.$gettext('Describe here the waypoint'); } }, @@ -64,14 +65,14 @@ export default { const type = this.document ? this.document.waypoint_type : undefined; switch (type) { - case 'access': - return this.$gettext('Describe pt access'); - case 'hut': - return this.$gettext('Describe pedestrian access', 'hut'); - case 'climbing_outdoor': - return this.$gettext('Describe pedestrian access'); - default: - return this.$gettext('Describe access'); + case 'access': + return this.$gettext('Describe pt access'); + case 'hut': + return this.$gettext('Describe pedestrian access', 'hut'); + case 'climbing_outdoor': + return this.$gettext('Describe pedestrian access'); + default: + return this.$gettext('Describe access'); } }, @@ -79,17 +80,17 @@ export default { const type = this.document ? this.document.waypoint_type : undefined; switch (type) { - case 'hut': - case 'gite': - case 'camp_site': - return this.$gettext('Describe opening periods'); - case 'local_product': - return this.$gettext('Describe opening hours'); - case 'climbing_outdoor': - return this.$gettext('Describe access restrictions'); - default: - return this.$gettext('Describe access period'); + case 'hut': + case 'gite': + case 'camp_site': + return this.$gettext('Describe opening periods'); + case 'local_product': + return this.$gettext('Describe opening hours'); + case 'climbing_outdoor': + return this.$gettext('Describe access restrictions'); + default: + return this.$gettext('Describe access period'); } - } - } + }, + }, }; diff --git a/src/main.js b/src/main.js index 86b3c56908..9c766c00d6 100644 --- a/src/main.js +++ b/src/main.js @@ -49,16 +49,14 @@ Vue.use(VueAnalytics, { return { page: route.path, title: 'Camptocamp.org', - location: window.location.href + location: window.location.href, }; - } + }, }, - set: [ - { field: 'anonymizeIp', value: true } - ], + set: [{ field: 'anonymizeIp', value: true }], fields: { - cookieDomain: window.location.host === 'localhost:8080' ? 'none' : window.location.host - } + cookieDomain: window.location.host === 'localhost:8080' ? 'none' : window.location.host, + }, }); Vue.use(vueMoment); // moment functions @@ -79,5 +77,5 @@ new Vue({ created() { this.$language.firstLoad(); }, - render: h => h(App) + render: (h) => h(App), }).$mount('#app'); diff --git a/src/views/Advertisement.vue b/src/views/Advertisement.vue index 92e45dc538..740050c59c 100644 --- a/src/views/Advertisement.vue +++ b/src/views/Advertisement.vue @@ -4,54 +4,52 @@ :title="$gettext('advertisement')" :src="$options.publicPath + 'affiz.html'" frameborder="0" - scrolling="no" /> + scrolling="no" + /> -
    diff --git a/src/views/Navigation.vue b/src/views/Navigation.vue index eea4a5f5bd..b3b5fd6341 100644 --- a/src/views/Navigation.vue +++ b/src/views/Navigation.vue @@ -1,23 +1,21 @@ diff --git a/src/views/SideMenu.vue b/src/views/SideMenu.vue index 4fc910b6e3..29c26c6a26 100644 --- a/src/views/SideMenu.vue +++ b/src/views/SideMenu.vue @@ -1,23 +1,19 @@ diff --git a/src/views/SiteNotice.vue b/src/views/SiteNotice.vue index 689462f74a..50f5430ad4 100644 --- a/src/views/SiteNotice.vue +++ b/src/views/SiteNotice.vue @@ -2,7 +2,8 @@
    + @click="showContent = !showContent" + >
    @@ -64,7 +66,8 @@ key="no-comment" :href="discussionUrl" class="button is-primary" - v-translate> + v-translate + > Post the first comment @@ -76,192 +79,188 @@ diff --git a/src/views/document/utils/boxes/ElevationProfile.vue b/src/views/document/utils/boxes/ElevationProfile.vue index 3df7bbf7f0..8538a35622 100644 --- a/src/views/document/utils/boxes/ElevationProfile.vue +++ b/src/views/document/utils/boxes/ElevationProfile.vue @@ -1,16 +1,16 @@ diff --git a/src/views/document/utils/boxes/ImagesBox.vue b/src/views/document/utils/boxes/ImagesBox.vue index 308ef07c51..accdd1dc1f 100644 --- a/src/views/document/utils/boxes/ImagesBox.vue +++ b/src/views/document/utils/boxes/ImagesBox.vue @@ -5,12 +5,12 @@ diff --git a/src/views/document/utils/boxes/LicenseBox.vue b/src/views/document/utils/boxes/LicenseBox.vue index eafeca0f21..779131a6d2 100644 --- a/src/views/document/utils/boxes/LicenseBox.vue +++ b/src/views/document/utils/boxes/LicenseBox.vue @@ -4,46 +4,77 @@ v-if="license === 'by-sa'" :href="'https://creativecommons.org/licenses/by-sa/3.0/deed.' + $language.current" target="_blank" - rel="noreferer"> + rel="noreferer" + > CC - + BY - + SA 3.0 -
    +
    This content is licensed under Creative Commons BY-SA 3.0
    + rel="noreferer" + > CC - + BY NC - + ND 3.0 -
    +
    This content is licensed under Creative Commons BY-NC-ND 3.0
    + v-else-if="license == 'copyright'" + :title=" + $gettext( + 'This picture depicts a book cover. It is the property of its editor and/or author. It is presented here only for illustration purposes.' + ) + " + > This book cover is the property of its editor and/or author @@ -53,48 +84,48 @@ diff --git a/src/views/document/utils/boxes/MapBox.vue b/src/views/document/utils/boxes/MapBox.vue index 6ef1dead8f..fb9141ea46 100644 --- a/src/views/document/utils/boxes/MapBox.vue +++ b/src/views/document/utils/boxes/MapBox.vue @@ -1,14 +1,11 @@ diff --git a/src/views/document/utils/boxes/MapLinks.vue b/src/views/document/utils/boxes/MapLinks.vue index 700a8effbc..eddc8a81d5 100644 --- a/src/views/document/utils/boxes/MapLinks.vue +++ b/src/views/document/utils/boxes/MapLinks.vue @@ -16,9 +16,9 @@ diff --git a/src/views/document/utils/boxes/RecentOutingsBox.vue b/src/views/document/utils/boxes/RecentOutingsBox.vue index 1f287db2f2..17413a3eda 100644 --- a/src/views/document/utils/boxes/RecentOutingsBox.vue +++ b/src/views/document/utils/boxes/RecentOutingsBox.vue @@ -1,14 +1,11 @@ diff --git a/src/views/document/utils/boxes/RoutesBox.vue b/src/views/document/utils/boxes/RoutesBox.vue index c9340de10b..4033d5aa93 100644 --- a/src/views/document/utils/boxes/RoutesBox.vue +++ b/src/views/document/utils/boxes/RoutesBox.vue @@ -1,10 +1,10 @@ diff --git a/src/views/document/utils/boxes/ToolBox.vue b/src/views/document/utils/boxes/ToolBox.vue index d41adc98b9..3863401e23 100644 --- a/src/views/document/utils/boxes/ToolBox.vue +++ b/src/views/document/utils/boxes/ToolBox.vue @@ -1,11 +1,10 @@ diff --git a/src/views/document/utils/boxes/ToolBoxButton.vue b/src/views/document/utils/boxes/ToolBoxButton.vue index eaef2ea899..6e226abcbd 100644 --- a/src/views/document/utils/boxes/ToolBoxButton.vue +++ b/src/views/document/utils/boxes/ToolBoxButton.vue @@ -1,11 +1,7 @@ diff --git a/src/views/document/utils/document-view-mixin.js b/src/views/document/utils/document-view-mixin.js index ab4bca817f..90a40e446f 100644 --- a/src/views/document/utils/document-view-mixin.js +++ b/src/views/document/utils/document-view-mixin.js @@ -1,4 +1,3 @@ - import constants from '@/js/constants'; import c2c from '@/js/apis/c2c'; import cooker from '@/js/cooker'; @@ -22,7 +21,6 @@ import MarkdownSection from './field-viewers/MarkdownSection'; import ProfilesLinks from './field-viewers/ProfilesLinks'; export default { - components: { DocumentViewHeader, @@ -38,21 +36,21 @@ export default { RecentOutingsBox, ToolBox, RoutesBox, - ImagesBox + ImagesBox, }, - mixins: [ viewModeMixin ], + mixins: [viewModeMixin], props: { draft: { type: Object, - default: null - } + default: null, + }, }, data() { return { - promise: null + promise: null, }; }, @@ -100,63 +98,67 @@ export default { lang() { return this.document ? this.document.cooked.lang : null; - } + }, }, watch: { - '$route': { + $route: { handler: 'loadDocument', - immediate: true - } + immediate: true, + }, }, methods: { loadDocument($route) { if (this.isVersionView) { this.$imageViewer.clear(); - this.promise = c2c[this.documentType].getVersion( - this.documentId, - this.$route.params.lang, - this.$route.params.version - ).then(response => { - // version object with all data - response.data.version.next_version_id = response.data.next_version_id; - response.data.version.previous_version_id = response.data.previous_version_id; - - // versionned datas are poor... - response.data.document.areas = []; - response.data.document.creator = null; - response.data.document.associations = { - articles: [], - books: [], - images: [], - users: [], - waypoints: [], - waypoint_children: [], - all_routes: { - documents: [] - }, - recent_outings: { - documents: [] - } - }; - }); + this.promise = c2c[this.documentType] + .getVersion(this.documentId, this.$route.params.lang, this.$route.params.version) + .then((response) => { + // version object with all data + response.data.version.next_version_id = response.data.next_version_id; + response.data.version.previous_version_id = response.data.previous_version_id; + + // versionned datas are poor... + response.data.document.areas = []; + response.data.document.creator = null; + response.data.document.associations = { + articles: [], + books: [], + images: [], + users: [], + waypoints: [], + waypoint_children: [], + all_routes: { + documents: [], + }, + recent_outings: { + documents: [], + }, + }; + }); } else if (this.isDraftView) { this.promise = {}; this.$imageViewer.clear(); - cooker.cook(this.draft.locales[0]).then(response => { + cooker.cook(this.draft.locales[0]).then((response) => { this.draft.cooked = response.data; this.$set(this.promise, 'data', this.draft); }); - } else { // normal mode + } else { + // normal mode // because of updateUrl(), we may have nothing to do - if (this.document && parseInt($route.params.id, 10) === this.document.document_id && this.expected_lang === this.lang) { + if ( + this.document && + parseInt($route.params.id, 10) === this.document.document_id && + this.expected_lang === this.lang + ) { return; } this.$imageViewer.clear(); - this.promise = c2c[this.documentType].getCooked(this.documentId, this.expected_lang) + this.promise = c2c[this.documentType] + .getCooked(this.documentId, this.expected_lang) .then(this.handleRedirection) .then(() => { this.$root.$emit('triggerScroll'); @@ -209,6 +211,6 @@ export default { if (this.$route.path !== path) { this.$router.replace(path); } - } - } + }, + }, }; diff --git a/src/views/document/utils/field-viewers/ActivitiesField.vue b/src/views/document/utils/field-viewers/ActivitiesField.vue index 2bff4ad4c8..b9682ef924 100644 --- a/src/views/document/utils/field-viewers/ActivitiesField.vue +++ b/src/views/document/utils/field-viewers/ActivitiesField.vue @@ -5,21 +5,20 @@ diff --git a/src/views/document/utils/field-viewers/ConditionLevels.vue b/src/views/document/utils/field-viewers/ConditionLevels.vue index dc95ed7777..2a56d2f28f 100644 --- a/src/views/document/utils/field-viewers/ConditionLevels.vue +++ b/src/views/document/utils/field-viewers/ConditionLevels.vue @@ -11,10 +11,16 @@ - {{ level.level_place }} - {{ level.level_snow_height_soft }} - {{ level.level_snow_height_total }} - {{ level.level_comment }} + + {{ level.level_place }} + + + {{ level.level_snow_height_soft }} + + + {{ level.level_snow_height_total }} + + {{ level.level_comment }} @@ -22,76 +28,75 @@ diff --git a/src/views/document/utils/field-viewers/DoubleNumericField.vue b/src/views/document/utils/field-viewers/DoubleNumericField.vue index d384e8404e..a9f7747192 100644 --- a/src/views/document/utils/field-viewers/DoubleNumericField.vue +++ b/src/views/document/utils/field-viewers/DoubleNumericField.vue @@ -9,52 +9,51 @@ diff --git a/src/views/document/utils/field-viewers/EventActivityField.vue b/src/views/document/utils/field-viewers/EventActivityField.vue index bb2c4b76ff..bc75fadca2 100644 --- a/src/views/document/utils/field-viewers/EventActivityField.vue +++ b/src/views/document/utils/field-viewers/EventActivityField.vue @@ -5,21 +5,20 @@ diff --git a/src/views/document/utils/field-viewers/FieldView.vue b/src/views/document/utils/field-viewers/FieldView.vue index 9ecafe7d46..6cdea99628 100644 --- a/src/views/document/utils/field-viewers/FieldView.vue +++ b/src/views/document/utils/field-viewers/FieldView.vue @@ -5,44 +5,44 @@ diff --git a/src/views/document/utils/field-viewers/LabelValue.vue b/src/views/document/utils/field-viewers/LabelValue.vue index 313c48d7e3..00f365cc1b 100644 --- a/src/views/document/utils/field-viewers/LabelValue.vue +++ b/src/views/document/utils/field-viewers/LabelValue.vue @@ -1,7 +1,9 @@ diff --git a/src/views/document/utils/field-viewers/MarkdownSection.vue b/src/views/document/utils/field-viewers/MarkdownSection.vue index a23fa41ac0..2948c6a828 100644 --- a/src/views/document/utils/field-viewers/MarkdownSection.vue +++ b/src/views/document/utils/field-viewers/MarkdownSection.vue @@ -1,6 +1,6 @@ diff --git a/src/views/document/utils/field-viewers/ProfilesLinks.vue b/src/views/document/utils/field-viewers/ProfilesLinks.vue index e6777c38b4..07333ba76d 100644 --- a/src/views/document/utils/field-viewers/ProfilesLinks.vue +++ b/src/views/document/utils/field-viewers/ProfilesLinks.vue @@ -7,25 +7,24 @@ :key="profile.document_id" :document="profile" class="user-link-label" - uppercase-first-letter /> + uppercase-first-letter + /> diff --git a/src/views/document/utils/is-editable-mixin.js b/src/views/document/utils/is-editable-mixin.js index 962141ecac..ac67b11c8b 100644 --- a/src/views/document/utils/is-editable-mixin.js +++ b/src/views/document/utils/is-editable-mixin.js @@ -23,7 +23,10 @@ export default { } } else if (this.documentType === 'image') { // image : it must be own user personnal image. Collaborative image can't be deleted - if (['personal', 'copyright'].includes(this.document.image_type) && this.document.creator.user_id === this.$user.id) { + if ( + ['personal', 'copyright'].includes(this.document.image_type) && + this.document.creator.user_id === this.$user.id + ) { return true; } } else if (this.documentType === 'xreport') { @@ -111,6 +114,6 @@ export default { } return false; - } - } + }, + }, }; diff --git a/src/views/document/utils/view-mode-mixin.js b/src/views/document/utils/view-mode-mixin.js index 3923d5171b..e22e090021 100644 --- a/src/views/document/utils/view-mode-mixin.js +++ b/src/views/document/utils/view-mode-mixin.js @@ -4,12 +4,13 @@ export default { return this.$route.name.endsWith('-version'); }, - isDraftView() { // means preview for edit and add mode + isDraftView() { + // means preview for edit and add mode return this.$route.name.endsWith('-edit') || this.$route.name.endsWith('-add'); }, isNormalView() { return !this.isDraftView && !this.isVersionView; - } - } + }, + }, }; diff --git a/src/views/document/utils/windows/DeleteDocumentWindow.vue b/src/views/document/utils/windows/DeleteDocumentWindow.vue index 76c900665b..4a662d1b20 100644 --- a/src/views/document/utils/windows/DeleteDocumentWindow.vue +++ b/src/views/document/utils/windows/DeleteDocumentWindow.vue @@ -1,10 +1,5 @@ diff --git a/src/views/document/utils/windows/DeleteLocaleWindow.vue b/src/views/document/utils/windows/DeleteLocaleWindow.vue index 3df6db57a4..24350c8965 100644 --- a/src/views/document/utils/windows/DeleteLocaleWindow.vue +++ b/src/views/document/utils/windows/DeleteLocaleWindow.vue @@ -1,10 +1,5 @@ diff --git a/src/views/document/utils/windows/MergeDocumentLink.vue b/src/views/document/utils/windows/MergeDocumentLink.vue index 53e4a77ab0..08ff405bcf 100644 --- a/src/views/document/utils/windows/MergeDocumentLink.vue +++ b/src/views/document/utils/windows/MergeDocumentLink.vue @@ -1,19 +1,17 @@ diff --git a/src/views/document/utils/windows/MergeDocumentWindow.vue b/src/views/document/utils/windows/MergeDocumentWindow.vue index 0624fcbf2f..1278144ad4 100644 --- a/src/views/document/utils/windows/MergeDocumentWindow.vue +++ b/src/views/document/utils/windows/MergeDocumentWindow.vue @@ -10,9 +10,8 @@
    - Merging a source document with a target document transfers all - associations of the source document to the target document, and sets up a - redirection from the source to the target document. + Merging a source document with a target document transfers all associations of the source document to the + target document, and sets up a redirection from the source to the target document.   @@ -34,7 +33,8 @@ v-model="targetDocument" :show-options="false" @load-options="options = arguments[0]" - is-small /> + is-small + />
    @@ -50,21 +50,13 @@
    -
    - -
    @@ -72,80 +64,74 @@ diff --git a/src/views/document/utils/windows/RevertVersionWindow.vue b/src/views/document/utils/windows/RevertVersionWindow.vue index c999481654..d5f6f4e183 100644 --- a/src/views/document/utils/windows/RevertVersionWindow.vue +++ b/src/views/document/utils/windows/RevertVersionWindow.vue @@ -1,8 +1,5 @@ diff --git a/src/views/document/utils/windows/TranslateWindow.vue b/src/views/document/utils/windows/TranslateWindow.vue index 395db48ea7..cf932e2000 100644 --- a/src/views/document/utils/windows/TranslateWindow.vue +++ b/src/views/document/utils/windows/TranslateWindow.vue @@ -6,10 +6,7 @@
    - + {{ $gettext(lang, 'langs') | uppercaseFirstLetter }}
    @@ -17,25 +14,22 @@ diff --git a/src/views/documents/DocumentsView.vue b/src/views/documents/DocumentsView.vue index 9bf542e7b7..a10fcd5d36 100644 --- a/src/views/documents/DocumentsView.vue +++ b/src/views/documents/DocumentsView.vue @@ -3,7 +3,6 @@
    - @@ -15,55 +14,55 @@ + class="dropdown-item is-size-6" + :class="{ 'is-active': type === documentType }" + :to="{ name: type + 's', query: queryWithoutOffset }" + >  {{ getDocumentTypeTitle(type) | uppercaseFirstLetter }}   -
    +
    - + - + + :title="$gettext('List mode')" + /> + :title="$gettext('Cards mode')" + /> + @input="setProperty('displayMode', arguments[0])" + /> + @click="setProperty('displayMode', displayMode === 'map' ? 'both' : 'map')" + /> -
    - +
    @@ -73,25 +72,29 @@ :class="{ 'is-12': !showMap, 'is-8 is-7-fullhd': showMap && listMode, - 'is-8 is-7-widescreen is-6-fullhd': showMap && !listMode - }"> - + 'is-8 is-7-widescreen is-6-fullhd': showMap && !listMode, + }" + > -
    +
    - + @mouseleave="highlightedDocument = null" + > +
    @@ -101,7 +104,8 @@ :document-type="documentType" :highlighted-document="highlightedDocument" @highlightDocument="highlightedDocument = arguments[0]" - class="documents-table" /> + class="documents-table" + />
    + show-recenter-on + />
    -
    diff --git a/src/views/documents/utils/AssociationQueryItem.vue b/src/views/documents/utils/AssociationQueryItem.vue index 08a2dcf47d..2eb0024024 100644 --- a/src/views/documents/utils/AssociationQueryItem.vue +++ b/src/views/documents/utils/AssociationQueryItem.vue @@ -1,11 +1,11 @@ diff --git a/src/views/documents/utils/DateQueryItem.vue b/src/views/documents/utils/DateQueryItem.vue index 139e8b9378..99b16de971 100644 --- a/src/views/documents/utils/DateQueryItem.vue +++ b/src/views/documents/utils/DateQueryItem.vue @@ -2,65 +2,63 @@
    - +
    - +
    diff --git a/src/views/documents/utils/DisplayModeSwitch.vue b/src/views/documents/utils/DisplayModeSwitch.vue index 6befa011dc..d2862467e7 100644 --- a/src/views/documents/utils/DisplayModeSwitch.vue +++ b/src/views/documents/utils/DisplayModeSwitch.vue @@ -7,8 +7,12 @@ + :class="{ 'is-active': value === 'result' }" + @click=" + $refs.displayModeSwitch.isActive = false; + $emit('input', 'result'); + " + > @@ -16,8 +20,12 @@ + :class="{ 'is-active': value === 'both' }" + @click=" + $refs.displayModeSwitch.isActive = false; + $emit('input', 'both'); + " + > @@ -26,8 +34,12 @@ + :class="{ 'is-active': value === 'map' }" + @click=" + $refs.displayModeSwitch.isActive = false; + $emit('input', 'map'); + " + > @@ -37,32 +49,31 @@ diff --git a/src/views/documents/utils/ImageCards.vue b/src/views/documents/utils/ImageCards.vue index 9746bc6716..fe6ca5d541 100644 --- a/src/views/documents/utils/ImageCards.vue +++ b/src/views/documents/utils/ImageCards.vue @@ -5,45 +5,43 @@ :key="document.document_id" :document="document" :title="$documentUtils.getDocumentTitle(document)" - class="card-image"> - + class="card-image" + > + diff --git a/src/views/documents/utils/LoadUserPreferencesButton.vue b/src/views/documents/utils/LoadUserPreferencesButton.vue index d31306588d..a2c3e43bfc 100644 --- a/src/views/documents/utils/LoadUserPreferencesButton.vue +++ b/src/views/documents/utils/LoadUserPreferencesButton.vue @@ -2,8 +2,9 @@
-

Potentiel de danger: {{ potentialDanger }} (BRA: {{ bra.high }})

+

+ Potentiel de danger: {{ potentialDanger }} (BRA: {{ bra.high }}) +

Pas de potentiel de danger sélectionné. Entrez d’abord le BRA

-

Le potentiel de danger est calculé à partir du niveau de danger du BRA. Il peut être affiné en sélectionnant un potentiel dans la plage correspondant au niveau du BRA. Par exemple: Le BRA évoque un danger 3 juste après une période en danger 4. On pourra alors indiquer un potentiel de danger de 12 au lieu de 8.

+

+ Le potentiel de danger est calculé à partir du niveau de danger du BRA. Il peut être affiné en + sélectionnant un potentiel dans la plage correspondant au niveau du BRA. Par exemple: Le BRA évoque un + danger 3 juste après une période en danger 4. On pourra alors indiquer un potentiel de danger de 12 au + lieu de 8. +

@@ -285,19 +309,23 @@

-

Attention, par neige mouillée, aucun facteur de réduction d’orientation ou de fréquentation ne peut être appliqué.

+

+ Attention, par neige mouillée, aucun facteur de réduction d’orientation ou de fréquentation ne peut + être appliqué. +

Groupe

    -
  • +
  • + :value="item.value" + />
@@ -315,16 +343,15 @@ -

Le facteur « pente parcourue fréquemment » n’est pas pris en compte par l’application, car il est souvent difficile de s'en assurer lors de la préparation de course.

- +

+ Le facteur « pente parcourue fréquemment » n’est pas pris en compte par l’application, car il + est souvent difficile de s'en assurer lors de la préparation de course. +

- +
@@ -343,12 +370,12 @@
@@ -359,7 +386,7 @@
- +
@@ -383,12 +410,13 @@ v-model="opacityYetiLayer" :min="0" :max="1" - :interval=".01" + :interval="0.01" tooltip="none" direction="btt" - :rail-style="{background: 'rgba(0,0,0,.25)'}" - :process-style="{background: 'white'}" - @change="onUpdateOpacityYetiLayer" /> + :rail-style="{ background: 'rgba(0,0,0,.25)' }" + :process-style="{ background: 'white' }" + @change="onUpdateOpacityYetiLayer" + />
@@ -399,1066 +427,1085 @@ diff --git a/src/views/portals/utils/DashboardLink.vue b/src/views/portals/utils/DashboardLink.vue index 23967f12a4..3bca3860a9 100644 --- a/src/views/portals/utils/DashboardLink.vue +++ b/src/views/portals/utils/DashboardLink.vue @@ -7,7 +7,8 @@ v-for="area of rangeAreas" :key="area.document_id" :document="area" - class="is-size-7 area-title is-italic" /> + class="is-size-7 area-title is-italic" + />
@@ -16,52 +17,51 @@ diff --git a/src/views/portals/utils/DashboardOutingLink.vue b/src/views/portals/utils/DashboardOutingLink.vue index 9094a3107f..7fc4859f92 100644 --- a/src/views/portals/utils/DashboardOutingLink.vue +++ b/src/views/portals/utils/DashboardOutingLink.vue @@ -6,16 +6,16 @@ diff --git a/src/views/portals/utils/DashboardRouteLink.vue b/src/views/portals/utils/DashboardRouteLink.vue index f850a865a7..aea0a82f9f 100644 --- a/src/views/portals/utils/DashboardRouteLink.vue +++ b/src/views/portals/utils/DashboardRouteLink.vue @@ -1,100 +1,99 @@ diff --git a/src/views/portals/utils/ForumWidget.vue b/src/views/portals/utils/ForumWidget.vue index 6dbc15ccd8..3dfc1688b9 100644 --- a/src/views/portals/utils/ForumWidget.vue +++ b/src/views/portals/utils/ForumWidget.vue @@ -1,5 +1,5 @@ diff --git a/src/views/static-views/NotFoundView.vue b/src/views/static-views/NotFoundView.vue index 347d1cd7fa..a2c93de7a4 100644 --- a/src/views/static-views/NotFoundView.vue +++ b/src/views/static-views/NotFoundView.vue @@ -19,84 +19,84 @@ v-for="(button, i) of buttons" :key="i" :to="button.to" - class="is-size-4 has-text-normal has-hover-background has-text-weight-bold"> - + class="is-size-4 has-text-normal has-hover-background has-text-weight-bold" + > +
{{ button.text | uppercaseFirstLetter }}
- - + diff --git a/src/views/static-views/SeracView.vue b/src/views/static-views/SeracView.vue index 2cfc3e5f81..635e8ba22a 100644 --- a/src/views/static-views/SeracView.vue +++ b/src/views/static-views/SeracView.vue @@ -5,12 +5,14 @@
-

SERAC

-

Let's make our feedbacks valuable

+

+ Let's make our feedbacks valuable +

- SERAC is a worldwide incidents and accidents database aiming at increasing safety in rock climbing and mountain sports. + SERAC is a worldwide incidents and accidents database aiming at increasing safety in rock climbing and + mountain sports.

@@ -20,7 +22,8 @@

Near-accidents are valuable

  • - Near-accidents = delicate situation not leading to physical injury but could have lead to a much more serious event. + Near-accidents = delicate situation not leading to physical injury but could have lead to a much more + serious event.
  • These are positive experiences that reveal usefull risk-management skills. @@ -80,7 +83,7 @@
- +   Know more about SERAC @@ -97,9 +100,10 @@ class="column topoguide-view-small-link" v-for="eventActivity of $options.event_activities" :key="eventActivity" - :to="{name:'xreports', query:{act:eventActivity}}"> + :to="{ name: 'xreports', query: { act: eventActivity } }" + > - + {{ $gettext(eventActivity, 'event_activities') | uppercaseFirstLetter }} @@ -112,58 +116,55 @@ diff --git a/src/views/static-views/TopoguideView.vue b/src/views/static-views/TopoguideView.vue index b5326145ab..f1d821ed05 100644 --- a/src/views/static-views/TopoguideView.vue +++ b/src/views/static-views/TopoguideView.vue @@ -25,7 +25,8 @@ class="column is-4-mobile is-3-tablet is-3-desktop is-3-widescreen is-3-fullhd" v-for="activity of activities" :key="activity" - :to="{name:'outings', query:{act:activity}}"> + :to="{ name: 'outings', query: { act: activity } }" + > {{ $gettext(activity, 'activities') | uppercaseFirstLetter }} @@ -34,7 +35,8 @@ + :to="{ name: 'outing-add' }" + > New outing @@ -51,7 +53,8 @@ class="column is-4-mobile is-3-tablet is-3-desktop is-3-widescreen is-3-fullhd" v-for="activity of activities" :key="activity" - :to="{name:'routes', query:{act:activity}}"> + :to="{ name: 'routes', query: { act: activity } }" + > {{ $gettext(activity, 'activities') | uppercaseFirstLetter }} @@ -60,7 +63,8 @@ + :to="{ name: 'route-add' }" + > New route @@ -77,7 +81,8 @@ class="column is-4-mobile is-2-tablet is-2-desktop is-2-widescreen is-2-fullhd" v-for="waypoint_type of waypoint_types" :key="waypoint_type" - :to="{name:'waypoints', query:{wtyp:waypoint_type}}"> + :to="{ name: 'waypoints', query: { wtyp: waypoint_type } }" + > {{ $gettext(waypoint_type, 'waypoint_types') | uppercaseFirstLetter }} @@ -86,7 +91,8 @@ + :to="{ name: 'waypoint-add' }" + > New waypoint @@ -99,55 +105,53 @@ diff --git a/src/views/static-views/TopoguideViewLink.vue b/src/views/static-views/TopoguideViewLink.vue index ec34e5447f..7326811522 100644 --- a/src/views/static-views/TopoguideViewLink.vue +++ b/src/views/static-views/TopoguideViewLink.vue @@ -8,59 +8,59 @@ diff --git a/src/views/static-views/TopoguideViewSmallLink.vue b/src/views/static-views/TopoguideViewSmallLink.vue index 7203adbb35..5d08450f18 100644 --- a/src/views/static-views/TopoguideViewSmallLink.vue +++ b/src/views/static-views/TopoguideViewSmallLink.vue @@ -7,38 +7,38 @@ diff --git a/src/views/static-views/WorkInProgressView.vue b/src/views/static-views/WorkInProgressView.vue index ef3f1a1671..141d7128fe 100644 --- a/src/views/static-views/WorkInProgressView.vue +++ b/src/views/static-views/WorkInProgressView.vue @@ -6,11 +6,11 @@ diff --git a/src/views/user/AccountView.vue b/src/views/user/AccountView.vue index 2ec99dde7b..e178bb6c35 100644 --- a/src/views/user/AccountView.vue +++ b/src/views/user/AccountView.vue @@ -4,13 +4,7 @@

Change account parameters

- + + icon="key" + /> + icon="key" + /> - + - + + icon="comments" + />
@@ -59,11 +44,7 @@
-
@@ -73,70 +54,67 @@ diff --git a/src/views/user/FollowingView.vue b/src/views/user/FollowingView.vue index 4aa0331a3a..e48c257f80 100644 --- a/src/views/user/FollowingView.vue +++ b/src/views/user/FollowingView.vue @@ -15,14 +15,8 @@
-
- +
+
@@ -31,37 +25,36 @@ diff --git a/src/views/user/LoginView.vue b/src/views/user/LoginView.vue index 8bc41d4491..2665128042 100644 --- a/src/views/user/LoginView.vue +++ b/src/views/user/LoginView.vue @@ -1,11 +1,7 @@ diff --git a/src/views/user/PreferencesView.vue b/src/views/user/PreferencesView.vue index 42a9d3e863..b95b899028 100644 --- a/src/views/user/PreferencesView.vue +++ b/src/views/user/PreferencesView.vue @@ -11,10 +11,11 @@
@@ -24,7 +25,10 @@

Here you may set activity and region filters that will apply to the homepage feed.

-

Only status updates with the selected activities and in the selected areas are shown in your homepage feed. Status updates from followed users will always be shown.

+

+ Only status updates with the selected activities and in the selected areas are shown in your homepage feed. + Status updates from followed users will always be shown. +

Show only updates from followed users in the homepage feed @@ -36,10 +40,11 @@
@@ -53,20 +58,13 @@

{{ $gettext('areas') | uppercaseFirstLetter }}

-
-
- +
+
@@ -77,60 +75,57 @@ diff --git a/src/views/user/utils/BaseForm.vue b/src/views/user/utils/BaseForm.vue index d6d82e51b4..9afa60a25b 100644 --- a/src/views/user/utils/BaseForm.vue +++ b/src/views/user/utils/BaseForm.vue @@ -1,7 +1,7 @@ diff --git a/src/views/user/utils/FormField.vue b/src/views/user/utils/FormField.vue index b38c3e9fc2..529ae58d46 100644 --- a/src/views/user/utils/FormField.vue +++ b/src/views/user/utils/FormField.vue @@ -33,7 +33,8 @@ :autocapitalize="autocapitalize" v-model="value_" class="input" - :class="{'is-danger':hasError || errorMessage}"> + :class="{ 'is-danger': hasError || errorMessage }" + /> @@ -42,79 +43,80 @@ diff --git a/src/views/wiki/AssociationsHistoryView.vue b/src/views/wiki/AssociationsHistoryView.vue index a0a76476f4..47f5ef0762 100644 --- a/src/views/wiki/AssociationsHistoryView.vue +++ b/src/views/wiki/AssociationsHistoryView.vue @@ -7,7 +7,8 @@ :limit="limit" :offset="offset" :document-id="documentId" - :user-id="userId" /> + :user-id="userId" + /> @@ -33,14 +34,12 @@ {{ association.is_creation }} - +   - +   @@ -52,68 +51,66 @@ :limit="limit" :offset="offset" :document-id="documentId" - :user-id="userId" /> + :user-id="userId" + />
diff --git a/src/views/wiki/DiffView.vue b/src/views/wiki/DiffView.vue index 72cbf6100d..09b5b685fa 100644 --- a/src/views/wiki/DiffView.vue +++ b/src/views/wiki/DiffView.vue @@ -5,7 +5,7 @@ diff ({{ lang }}) : - {{ title }} + {{ title }}
@@ -14,13 +14,13 @@ :document-type="documentType" :id="documentId" :version="oldVersion.version.version_id" - :lang="lang"> - Revision #{{ oldVersion.document.version }} as of {{ $moment.toTechnicalString(oldVersion.version.written_at) }} + :lang="lang" + > + Revision #{{ oldVersion.document.version }} as of + {{ $moment.toTechnicalString(oldVersion.version.written_at) }}
-
- by -
+
by
{{ oldVersion.version.comment }}
@@ -31,7 +31,8 @@ :id="documentId" :lang="lang" :version-from="oldVersion.previous_version_id" - :version-to="oldVersion.version.version_id"> + :version-to="oldVersion.version.version_id" + > ← previous difference @@ -47,13 +48,13 @@ :document-type="documentType" :id="documentId" :version="newVersion.version.version_id" - :lang="lang"> - Revision #{{ newVersion.document.version }} as of {{ $moment.toTechnicalString(newVersion.version.written_at) }} + :lang="lang" + > + Revision #{{ newVersion.document.version }} as of + {{ $moment.toTechnicalString(newVersion.version.written_at) }}
-
- by -
+
by
{{ newVersion.version.comment }}
@@ -64,7 +65,8 @@ :id="documentId" :lang="lang" :version-from="newVersion.version.version_id" - :version-to="newVersion.next_version_id"> + :version-to="newVersion.next_version_id" + > next difference → @@ -76,14 +78,13 @@
-
- +
- +
@@ -93,7 +94,7 @@
-

{{ $gettext(key) | uppercase-first-letter }}

+

{{ $gettext(key) | uppercaseFirstLetter }}

null @@ -107,14 +108,16 @@
-

{{ $gettext(key) }}

-
+
{{ block.rows.length }} identical rows
@@ -122,8 +125,14 @@ v-for="(row, rowKey) of block.rows" :key="rowKey" class="row-diff" - :class="{'row-del': !row.isIdentical && !row.isFakeOld, 'row-fake': row.isFakeOld}"> - {{ item.text }} + :class="{ 'row-del': !row.isIdentical && !row.isFakeOld, 'row-fake': row.isFakeOld }" + > + {{ item.text }}
@@ -133,7 +142,10 @@
-
+
{{ block.rows.length }} identical rows
@@ -141,8 +153,14 @@ v-for="(row, rowKey) of block.rows" :key="rowKey" class="row-diff" - :class="{'row-ins': !row.isIdentical && !row.isFakeNew, 'row-fake': row.isFakeNew}"> - {{ item.text }} + :class="{ 'row-ins': !row.isIdentical && !row.isFakeNew, 'row-fake': row.isFakeNew }" + > + {{ item.text }}
@@ -150,444 +168,438 @@
-
- - diff --git a/src/views/wiki/HistoryView.vue b/src/views/wiki/HistoryView.vue index c991cacdd1..c1769da815 100644 --- a/src/views/wiki/HistoryView.vue +++ b/src/views/wiki/HistoryView.vue @@ -7,7 +7,9 @@

- {{ history.title }} + {{ + history.title + }}

+ :version-to="versionTo" + /> @@ -29,26 +32,29 @@ - - - - + + + +
-
+
+ name="versionFrom" + /> + name="versionTo" + /> + :version-to="version.version_id" + />
@@ -71,81 +77,78 @@ :document-type="documentType" :lang="lang" :version-from="versionFrom" - :version-to="versionTo" /> - + :version-to="versionTo" + /> diff --git a/src/views/wiki/WhatsNewView.vue b/src/views/wiki/WhatsNewView.vue index 442fed4d52..31b8a5bcf8 100644 --- a/src/views/wiki/WhatsNewView.vue +++ b/src/views/wiki/WhatsNewView.vue @@ -8,10 +8,7 @@ - +
@@ -29,7 +26,8 @@ :document-type="change.document.documentType" :id="change.document.document_id" :version="change.version_id" - :lang="change.lang"> + :lang="change.lang" + > {{ $moment.toTechnicalString(change.written_at) }} @@ -46,10 +44,10 @@ :id="change.document.document_id" :lang="change.lang" version-from="prev" - :version-to="change.version_id" /> + :version-to="change.version_id" + /> -
Modified the contributor @@ -70,110 +68,109 @@
- diff --git a/src/views/wiki/edition/AreaEditionView.vue b/src/views/wiki/edition/AreaEditionView.vue index 31b342b408..e3118acd30 100644 --- a/src/views/wiki/edition/AreaEditionView.vue +++ b/src/views/wiki/edition/AreaEditionView.vue @@ -4,7 +4,8 @@ :document="document" :generic-errors="genericErrors" :is-loading="saving" - @save="save"> + @save="save" + >
@@ -16,25 +17,23 @@
-
+
diff --git a/src/views/wiki/edition/ArticleEditionView.vue b/src/views/wiki/edition/ArticleEditionView.vue index e7e85e987f..f7f351710f 100644 --- a/src/views/wiki/edition/ArticleEditionView.vue +++ b/src/views/wiki/edition/ArticleEditionView.vue @@ -4,7 +4,8 @@ :document="document" :generic-errors="genericErrors" :is-loading="saving" - @save="save"> + @save="save" + >
@@ -21,23 +22,20 @@ -
+
diff --git a/src/views/wiki/edition/BookEditionView.vue b/src/views/wiki/edition/BookEditionView.vue index 9142014796..98992e443a 100644 --- a/src/views/wiki/edition/BookEditionView.vue +++ b/src/views/wiki/edition/BookEditionView.vue @@ -4,11 +4,12 @@ :document="document" :generic-errors="genericErrors" :is-loading="saving" - @save="save"> - + @save="save" + > + :sub-title="$gettext('Title of the book, author, language and date of publication.')" + >
@@ -22,12 +23,9 @@
-
- +
@@ -36,21 +34,19 @@ + :sub-title="$gettext('Articles, waypoints or routes to be linked.')" + > - diff --git a/src/views/wiki/edition/ImageEditionView.vue b/src/views/wiki/edition/ImageEditionView.vue index c28f1fae56..bfab2fb8ee 100644 --- a/src/views/wiki/edition/ImageEditionView.vue +++ b/src/views/wiki/edition/ImageEditionView.vue @@ -4,10 +4,12 @@ :document="document" :generic-errors="genericErrors" :is-loading="saving || uploadingNewFile" - @save="save"> + @save="save" + > + :sub-title="$gettext('Title, activity and characteristics of the picture')" + >
@@ -22,17 +24,12 @@
-
+
- +
-
- - +
@@ -60,9 +53,7 @@
- +
@@ -74,7 +65,8 @@ + :sub-title="$gettext('Open fields to detail the picture\'s context')" + >
@@ -84,69 +76,71 @@ + :sub-title="$gettext('Articles, waypoints, routes or books to be linked.')" + > - diff --git a/src/views/wiki/edition/MapEditionView.vue b/src/views/wiki/edition/MapEditionView.vue index f4abe74830..af534c4631 100644 --- a/src/views/wiki/edition/MapEditionView.vue +++ b/src/views/wiki/edition/MapEditionView.vue @@ -4,7 +4,8 @@ :document="document" :generic-errors="genericErrors" :is-loading="saving" - @save="save"> + @save="save" + >
@@ -12,17 +13,14 @@
-
+
diff --git a/src/views/wiki/edition/OutingEditionView.vue b/src/views/wiki/edition/OutingEditionView.vue index e719bbcbdb..c457b896c4 100644 --- a/src/views/wiki/edition/OutingEditionView.vue +++ b/src/views/wiki/edition/OutingEditionView.vue @@ -4,24 +4,27 @@ :document="document" :generic-errors="genericErrors" :is-loading="saving" - @save="save"> - + @save="save" + > + :sub-title="$gettext('Main informations about your outing')" + >
+ @input="handleDates" + /> + :min="showBothDates ? document.date_start : undefined" + />
{{ $gettext('Several days?') }}
@@ -36,14 +39,19 @@
- +
- + :sub-title="$gettext('Describe the conditions you encountered during your outing')" + >
@@ -58,9 +66,24 @@
- - - + + +
@@ -68,7 +91,8 @@ + :sub-title="$gettext('People who were with you, and your feelings about this outing')" + >
@@ -80,21 +104,21 @@ :document="document" :field="fields.description" :label="$gettext('personal comments')" - :placeholder="$gettext('write your comments')" /> + :placeholder="$gettext('write your comments')" + />
- + :sub-title="$gettext('Detailed figures, like ratings, height differences, frequentation...')" + >
-
@@ -116,12 +140,7 @@
- +
@@ -138,7 +157,8 @@ :document="document" :field="fields.ski_rating" prefix="?" - @click:prefix="showCotometer" /> + @click:prefix="showCotometer" + /> @@ -155,7 +175,6 @@
- -
+
{{ error.name }} : {{ error.description }}
-
-
+
... - +
@@ -72,139 +70,137 @@ diff --git a/src/views/wiki/edition/utils/FormField.vue b/src/views/wiki/edition/utils/FormField.vue index f6a408756d..17e57475a2 100644 --- a/src/views/wiki/edition/utils/FormField.vue +++ b/src/views/wiki/edition/utils/FormField.vue @@ -19,75 +19,76 @@ :placeholder="placeholder" :unit="unit" :divisor="divisor" - :is-expanded="isExpanded" /> + :is-expanded="isExpanded" + />
diff --git a/src/views/wiki/edition/utils/FormInput.vue b/src/views/wiki/edition/utils/FormInput.vue index acf322c7db..f6b28a6f7b 100644 --- a/src/views/wiki/edition/utils/FormInput.vue +++ b/src/views/wiki/edition/utils/FormInput.vue @@ -1,55 +1,52 @@ diff --git a/src/views/wiki/edition/utils/FormRow.vue b/src/views/wiki/edition/utils/FormRow.vue index d41f144903..35b62d94c4 100644 --- a/src/views/wiki/edition/utils/FormRow.vue +++ b/src/views/wiki/edition/utils/FormRow.vue @@ -10,9 +10,11 @@
+ 'is-grouped is-grouped-multiline': isGrouped, + 'is-expanded': isExpanded, + 'is-narrow': isNarrow, + }" + >
@@ -20,70 +22,70 @@ diff --git a/src/views/wiki/edition/utils/FormSection.vue b/src/views/wiki/edition/utils/FormSection.vue index 8039f36307..7db79ea4ef 100644 --- a/src/views/wiki/edition/utils/FormSection.vue +++ b/src/views/wiki/edition/utils/FormSection.vue @@ -2,10 +2,12 @@
-

+

{{ title }}

-

{{ subTitle }}

+

+ {{ subTitle }} +

diff --git a/src/views/wiki/edition/utils/InputConditionsLevels.vue b/src/views/wiki/edition/utils/InputConditionsLevels.vue index 55972db1cd..67822a32a1 100644 --- a/src/views/wiki/edition/utils/InputConditionsLevels.vue +++ b/src/views/wiki/edition/utils/InputConditionsLevels.vue @@ -9,15 +9,16 @@
+ @click="levels.splice(i, 1)" + />
@@ -25,57 +26,59 @@ diff --git a/src/views/wiki/edition/utils/MapInputRow.vue b/src/views/wiki/edition/utils/MapInputRow.vue index 94509991cf..c9821729de 100644 --- a/src/views/wiki/edition/utils/MapInputRow.vue +++ b/src/views/wiki/edition/utils/MapInputRow.vue @@ -3,7 +3,7 @@
- + @@ -23,7 +23,8 @@ :edited-document="document" :geom-detail-editable="geomDetailEditable" show-center-on-geolocation - show-recenter-on /> + show-recenter-on + />
@@ -38,119 +39,115 @@
-
diff --git a/src/views/wiki/edition/utils/QualityField.vue b/src/views/wiki/edition/utils/QualityField.vue index 4df55c6b3e..b4f6366701 100644 --- a/src/views/wiki/edition/utils/QualityField.vue +++ b/src/views/wiki/edition/utils/QualityField.vue @@ -6,7 +6,7 @@ {{ $gettext('quality') | uppercaseFirstLetter }}   - + @@ -18,259 +18,267 @@ i18n i18n-context="quality_types" :value="computedQuality" - disabled /> + disabled + /> + v-model="document.quality" + />
diff --git a/src/views/wiki/edition/utils/SaveDocumentRow.vue b/src/views/wiki/edition/utils/SaveDocumentRow.vue index 9d2184f299..da72f0450f 100644 --- a/src/views/wiki/edition/utils/SaveDocumentRow.vue +++ b/src/views/wiki/edition/utils/SaveDocumentRow.vue @@ -4,9 +4,10 @@
@@ -25,31 +26,32 @@ type="text" class="input" :disabled="mode !== 'edit'" - :placeholder="$gettext('comment')"> + :placeholder="$gettext('comment')" + />
diff --git a/src/views/wiki/edition/utils/document-edition-view-mixin.js b/src/views/wiki/edition/utils/document-edition-view-mixin.js index 071571a064..d881931908 100644 --- a/src/views/wiki/edition/utils/document-edition-view-mixin.js +++ b/src/views/wiki/edition/utils/document-edition-view-mixin.js @@ -1,4 +1,3 @@ - import constants from '@/js/constants'; import c2c from '@/js/apis/c2c'; @@ -19,9 +18,7 @@ const FORM_PROJ = 'EPSG:4326'; const DATA_PROJ = 'EPSG:3857'; export default { - components: { - FormRow, FormSection, @@ -30,7 +27,7 @@ export default { FormInput, MapInputRow, EditionContainer, - AssociationsInputRow + AssociationsInputRow, }, data() { @@ -39,12 +36,11 @@ export default { fields: null, // keep fields here to set them reactive genericErrors: [], saving: false, - modified: false + modified: false, }; }, computed: { - mode() { return this.$route.name.split('-')[1]; // right part of route name : add or edit }, @@ -68,15 +64,15 @@ export default { editedLocale() { // in edit mode, there is only one locale return this.document ? this.document.locales[0] : null; - } + }, }, watch: { - '$route': { + $route: { handler: 'load', - immediate: true + immediate: true, }, - 'document.geometry.geom': 'setLatitudeLongitude' + 'document.geometry.geom': 'setLatitudeLongitude', }, mounted() { @@ -88,7 +84,7 @@ export default { }, beforeRouteEnter(to, from, next) { - next(vm => { + next((vm) => { if (!vm.$user.isLogged) { vm.$router.push({ name: 'auth' }); } @@ -127,7 +123,8 @@ export default { this.promise = c2c[this.documentType].get(this.documentId, this.lang).then((response) => { const locales = response.data.locales; - if (locales.length === 0) { // it's a translation from an existing doc + if (locales.length === 0) { + // it's a translation from an existing doc locales.push(this.$documentUtils.buildLocale(this.documentType, this.lang)); } @@ -141,7 +138,7 @@ export default { // add current user for outings if (this.documentType === 'outing') { - c2c.profile.get(this.$user.id).then(response => { + c2c.profile.get(this.$user.id).then((response) => { this.$documentUtils.addAssociation(this.document, response.data); }); } @@ -155,7 +152,7 @@ export default { const documentIds = String(this.$route.query[letter]).split(','); for (const documentId of documentIds) { - c2c[documentType].get(documentId).then(response => { + c2c[documentType].get(documentId).then((response) => { this.$documentUtils.addAssociation(this.document, response.data); }); } @@ -201,13 +198,9 @@ export default { this.latitude = Math.round(coords[1] * 1000000) / 1000000; }, - afterLoad() { - - }, - - beforeSave() { + afterLoad() {}, - }, + beforeSave() {}, // display a popup with info from fields taht contains an error // return true if popup is displayed, false otherwise @@ -253,13 +246,13 @@ export default { this.goToDocument(this.document.document_id); }); } else { - promise = c2c[this.documentType].create(this.document).then(response => { + promise = c2c[this.documentType].create(this.document).then((response) => { this.modified = false; this.goToDocument(response.data.document_id); }); } - promise.catch(error => { + promise.catch((error) => { this.saving = false; const data = error.response.data; this.dispatchErrors(data.errors); @@ -273,8 +266,8 @@ export default { name: this.documentType, params: { id: documentId, - lang: this.lang - } + lang: this.lang, + }, }); }, @@ -327,6 +320,6 @@ export default { event.preventDefault(); event.returnValue = ''; } - } - } + }, + }, }; diff --git a/src/views/wiki/utils/AssociationHistoryPagination.vue b/src/views/wiki/utils/AssociationHistoryPagination.vue index abb367b6ed..6669483c72 100644 --- a/src/views/wiki/utils/AssociationHistoryPagination.vue +++ b/src/views/wiki/utils/AssociationHistoryPagination.vue @@ -5,16 +5,18 @@ :disabled="offsetAsNumber === 0" :limit="limit" :user-id="userId" - :document-id="documentId"> + :document-id="documentId" + > newest | + :document-id="documentId" + > oldest ) View : @@ -24,16 +26,18 @@ :limit="limit" :offset="Math.max(offsetAsNumber - limitAsNumber, 0)" :user-id="userId" - :document-id="documentId"> + :document-id="documentId" + > newer {{ limitAsNumber }} | + :document-id="documentId" + > older {{ limitAsNumber }} ) @@ -41,37 +45,37 @@ diff --git a/src/views/wiki/utils/ColoredIconDocument.vue b/src/views/wiki/utils/ColoredIconDocument.vue index b363b6d49e..c76c8008a8 100644 --- a/src/views/wiki/utils/ColoredIconDocument.vue +++ b/src/views/wiki/utils/ColoredIconDocument.vue @@ -5,30 +5,28 @@ diff --git a/src/views/wiki/utils/HistoryViewLinks.vue b/src/views/wiki/utils/HistoryViewLinks.vue index 74c27eb84d..e77a7ef4b3 100644 --- a/src/views/wiki/utils/HistoryViewLinks.vue +++ b/src/views/wiki/utils/HistoryViewLinks.vue @@ -6,10 +6,11 @@ :lang="lang" :version-from="versionFrom" :version-to="versionTo" - v-translate> + v-translate + > Compare selected versions - + See the latest version @@ -19,47 +20,43 @@ List of versions for language: - -  {{ $gettext(lang, 'langs') }} - +  {{ $gettext(lang, 'langs') }}
diff --git a/src/views/wiki/utils/diff_match_patch_uncompressed.js b/src/views/wiki/utils/diff_match_patch_uncompressed.js index 555910ca5d..fe954a8016 100644 --- a/src/views/wiki/utils/diff_match_patch_uncompressed.js +++ b/src/views/wiki/utils/diff_match_patch_uncompressed.js @@ -22,36 +22,34 @@ * @author fraser@google.com (Neil Fraser) */ -/* eslint-disable */ - /** * Class containing the diff, match and patch methods. * @constructor */ -function diffMatchPatch () { +function diffMatchPatch() { // Defaults. // Redefine these in your program to override the defaults. // Number of seconds to map a diff before giving up (0 for infinity). - this.Diff_Timeout = 1.0 + this.Diff_Timeout = 1.0; // Cost of an empty edit operation in terms of edit characters. - this.Diff_EditCost = 4 + this.Diff_EditCost = 4; // At what point is no match declared (0.0 = perfection, 1.0 = very loose). - this.Match_Threshold = 0.5 + this.Match_Threshold = 0.5; // How far to search for a match (0 = exact location, 1000+ = broad match). // A match this many characters away from the expected location will add // 1.0 to the score (0.0 is a perfect match). - this.Match_Distance = 1000 + this.Match_Distance = 1000; // When deleting a large block of text (over ~64 characters), how close do // the contents have to be to match the expected contents. (0.0 = perfection, // 1.0 = very loose). Note that Match_Threshold controls how closely the // end points of a delete need to match. - this.Patch_DeleteThreshold = 0.5 + this.Patch_DeleteThreshold = 0.5; // Chunk size for context length. - this.Patch_Margin = 4 + this.Patch_Margin = 4; // The number of bits in an int. - this.Match_MaxBits = 32 + this.Match_MaxBits = 32; } // DIFF FUNCTIONS @@ -61,12 +59,12 @@ function diffMatchPatch () { * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] * which means: delete 'Hello', add 'Goodbye' and keep ' world.' */ -var DIFF_DELETE = -1 -var DIFF_INSERT = 1 -var DIFF_EQUAL = 0 +var DIFF_DELETE = -1; +var DIFF_INSERT = 1; +var DIFF_EQUAL = 0; /** @typedef {{0: number, 1: string}} */ -diffMatchPatch.Diff +diffMatchPatch.Diff; /** * Find the differences between two texts. Simplifies the problem by stripping @@ -81,61 +79,60 @@ diffMatchPatch.Diff * instead. * @return {!Array.} Array of diff tuples. */ -diffMatchPatch.diff_main = function (text1, text2, opt_checklines, - opt_deadline) { +diffMatchPatch.diff_main = function (text1, text2, opt_checklines, opt_deadline) { // Set a deadline by which time the diff must be complete. if (typeof opt_deadline === 'undefined') { if (this.Diff_Timeout <= 0) { - opt_deadline = Number.MAX_VALUE + opt_deadline = Number.MAX_VALUE; } else { - opt_deadline = (new Date()).getTime() + this.Diff_Timeout * 1000 + opt_deadline = new Date().getTime() + this.Diff_Timeout * 1000; } } - var deadline = opt_deadline + var deadline = opt_deadline; // Check for null inputs. if (text1 == null || text2 == null) { - throw new Error('Null input. (diff_main)') + throw new Error('Null input. (diff_main)'); } // Check for equality (speedup). if (text1 == text2) { if (text1) { - return [[DIFF_EQUAL, text1]] + return [[DIFF_EQUAL, text1]]; } - return [] + return []; } if (typeof opt_checklines === 'undefined') { - opt_checklines = true + opt_checklines = true; } - var checklines = opt_checklines + var checklines = opt_checklines; // Trim off common prefix (speedup). - var commonlength = this.diff_commonPrefix(text1, text2) - var commonprefix = text1.substring(0, commonlength) - text1 = text1.substring(commonlength) - text2 = text2.substring(commonlength) + var commonlength = this.diff_commonPrefix(text1, text2); + var commonprefix = text1.substring(0, commonlength); + text1 = text1.substring(commonlength); + text2 = text2.substring(commonlength); // Trim off common suffix (speedup). - commonlength = this.diff_commonSuffix(text1, text2) - var commonsuffix = text1.substring(text1.length - commonlength) - text1 = text1.substring(0, text1.length - commonlength) - text2 = text2.substring(0, text2.length - commonlength) + commonlength = this.diff_commonSuffix(text1, text2); + var commonsuffix = text1.substring(text1.length - commonlength); + text1 = text1.substring(0, text1.length - commonlength); + text2 = text2.substring(0, text2.length - commonlength); // Compute the diff on the middle block. - var diffs = this.diff_compute_(text1, text2, checklines, deadline) + var diffs = this.diff_compute_(text1, text2, checklines, deadline); // Restore the prefix and suffix. if (commonprefix) { - diffs.unshift([DIFF_EQUAL, commonprefix]) + diffs.unshift([DIFF_EQUAL, commonprefix]); } if (commonsuffix) { - diffs.push([DIFF_EQUAL, commonsuffix]) + diffs.push([DIFF_EQUAL, commonsuffix]); } - this.diff_cleanupMerge(diffs) - return diffs -} + this.diff_cleanupMerge(diffs); + return diffs; +}; /** * Find the differences between two texts. Assumes that the texts do not @@ -149,63 +146,67 @@ diffMatchPatch.diff_main = function (text1, text2, opt_checklines, * @return {!Array.} Array of diff tuples. * @private */ -diffMatchPatch.diff_compute_ = function (text1, text2, checklines, - deadline) { - var diffs +diffMatchPatch.diff_compute_ = function (text1, text2, checklines, deadline) { + var diffs; if (!text1) { // Just add some text (speedup). - return [[DIFF_INSERT, text2]] + return [[DIFF_INSERT, text2]]; } if (!text2) { // Just delete some text (speedup). - return [[DIFF_DELETE, text1]] + return [[DIFF_DELETE, text1]]; } - var longtext = text1.length > text2.length ? text1 : text2 - var shorttext = text1.length > text2.length ? text2 : text1 - var i = longtext.indexOf(shorttext) + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; + var i = longtext.indexOf(shorttext); if (i != -1) { // Shorter text is inside the longer text (speedup). - diffs = [[DIFF_INSERT, longtext.substring(0, i)], + diffs = [ + [DIFF_INSERT, longtext.substring(0, i)], [DIFF_EQUAL, shorttext], - [DIFF_INSERT, longtext.substring(i + shorttext.length)]] + [DIFF_INSERT, longtext.substring(i + shorttext.length)], + ]; // Swap insertions for deletions if diff is reversed. if (text1.length > text2.length) { - diffs[0][0] = diffs[2][0] = DIFF_DELETE + diffs[0][0] = diffs[2][0] = DIFF_DELETE; } - return diffs + return diffs; } if (shorttext.length == 1) { // Single character string. // After the previous speedup, the character can't be an equality. - return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]] + return [ + [DIFF_DELETE, text1], + [DIFF_INSERT, text2], + ]; } // Check to see if the problem can be split in two. - var hm = this.diff_halfMatch_(text1, text2) + var hm = this.diff_halfMatch_(text1, text2); if (hm) { // A half-match was found, sort out the return data. - var text1_a = hm[0] - var text1_b = hm[1] - var text2_a = hm[2] - var text2_b = hm[3] - var mid_common = hm[4] + var text1_a = hm[0]; + var text1_b = hm[1]; + var text2_a = hm[2]; + var text2_b = hm[3]; + var mid_common = hm[4]; // Send both pairs off for separate processing. - var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline) - var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline) + var diffs_a = this.diff_main(text1_a, text2_a, checklines, deadline); + var diffs_b = this.diff_main(text1_b, text2_b, checklines, deadline); // Merge the results. - return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b) + return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b); } if (checklines && text1.length > 100 && text2.length > 100) { - return this.diff_lineMode_(text1, text2, deadline) + return this.diff_lineMode_(text1, text2, deadline); } - return this.diff_bisect_(text1, text2, deadline) -} + return this.diff_bisect_(text1, text2, deadline); +}; /** * Do a quick line-level diff on both strings, then rediff the parts for @@ -219,61 +220,60 @@ diffMatchPatch.diff_compute_ = function (text1, text2, checklines, */ diffMatchPatch.diff_lineMode_ = function (text1, text2, deadline) { // Scan the text on a line-by-line basis first. - var a = this.diff_linesToChars_(text1, text2) - text1 = a.chars1 - text2 = a.chars2 - var linearray = a.lineArray + var a = this.diff_linesToChars_(text1, text2); + text1 = a.chars1; + text2 = a.chars2; + var linearray = a.lineArray; - var diffs = this.diff_main(text1, text2, false, deadline) + var diffs = this.diff_main(text1, text2, false, deadline); // Convert the diff back to original text. - this.diff_charsToLines_(diffs, linearray) + this.diff_charsToLines_(diffs, linearray); // Eliminate freak matches (e.g. blank lines) - this.diff_cleanupSemantic(diffs) + this.diff_cleanupSemantic(diffs); // Rediff any replacement blocks, this time character-by-character. // Add a dummy entry at the end. - diffs.push([DIFF_EQUAL, '']) - var pointer = 0 - var count_delete = 0 - var count_insert = 0 - var text_delete = '' - var text_insert = '' + diffs.push([DIFF_EQUAL, '']); + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ''; + var text_insert = ''; while (pointer < diffs.length) { switch (diffs[pointer][0]) { case DIFF_INSERT: - count_insert++ - text_insert += diffs[pointer][1] - break + count_insert++; + text_insert += diffs[pointer][1]; + break; case DIFF_DELETE: - count_delete++ - text_delete += diffs[pointer][1] - break + count_delete++; + text_delete += diffs[pointer][1]; + break; case DIFF_EQUAL: // Upon reaching an equality, check for prior redundancies. if (count_delete >= 1 && count_insert >= 1) { // Delete the offending records and add the merged ones. - diffs.splice(pointer - count_delete - count_insert, - count_delete + count_insert) - pointer = pointer - count_delete - count_insert - let a = this.diff_main(text_delete, text_insert, false, deadline) + diffs.splice(pointer - count_delete - count_insert, count_delete + count_insert); + pointer = pointer - count_delete - count_insert; + let a = this.diff_main(text_delete, text_insert, false, deadline); for (var j = a.length - 1; j >= 0; j--) { - diffs.splice(pointer, 0, a[j]) + diffs.splice(pointer, 0, a[j]); } - pointer = pointer + a.length + pointer = pointer + a.length; } - count_insert = 0 - count_delete = 0 - text_delete = '' - text_insert = '' - break + count_insert = 0; + count_delete = 0; + text_delete = ''; + text_insert = ''; + break; } - pointer++ + pointer++; } - diffs.pop() // Remove the dummy entry at the end. + diffs.pop(); // Remove the dummy entry at the end. - return diffs -} + return diffs; +}; /** * Find the 'middle snake' of a diff, split the problem in two @@ -287,67 +287,66 @@ diffMatchPatch.diff_lineMode_ = function (text1, text2, deadline) { */ diffMatchPatch.diff_bisect_ = function (text1, text2, deadline) { // Cache the text lengths to prevent multiple calls. - var text1_length = text1.length - var text2_length = text2.length - var max_d = Math.ceil((text1_length + text2_length) / 2) - var v_offset = max_d - var v_length = 2 * max_d - var v1 = new Array(v_length) - var v2 = new Array(v_length) + var text1_length = text1.length; + var text2_length = text2.length; + var max_d = Math.ceil((text1_length + text2_length) / 2); + var v_offset = max_d; + var v_length = 2 * max_d; + var v1 = new Array(v_length); + var v2 = new Array(v_length); // Setting all elements to -1 is faster in Chrome & Firefox than mixing // integers and undefined. for (var x = 0; x < v_length; x++) { - v1[x] = -1 - v2[x] = -1 + v1[x] = -1; + v2[x] = -1; } - v1[v_offset + 1] = 0 - v2[v_offset + 1] = 0 - var delta = text1_length - text2_length + v1[v_offset + 1] = 0; + v2[v_offset + 1] = 0; + var delta = text1_length - text2_length; // If the total number of characters is odd, then the front path will collide // with the reverse path. - var front = (delta % 2 != 0) + var front = delta % 2 != 0; // Offsets for start and end of k loop. // Prevents mapping of space beyond the grid. - var k1start = 0 - var k1end = 0 - var k2start = 0 - var k2end = 0 + var k1start = 0; + var k1end = 0; + var k2start = 0; + var k2end = 0; for (var d = 0; d < max_d; d++) { // Bail out if deadline is reached. - if ((new Date()).getTime() > deadline) { - break + if (new Date().getTime() > deadline) { + break; } // Walk the front path one step. for (let k1 = -d + k1start; k1 <= d - k1end; k1 += 2) { - let k1_offset = v_offset + k1 - var x1 + let k1_offset = v_offset + k1; + var x1; if (k1 == -d || (k1 != d && v1[k1_offset - 1] < v1[k1_offset + 1])) { - x1 = v1[k1_offset + 1] + x1 = v1[k1_offset + 1]; } else { - x1 = v1[k1_offset - 1] + 1 + x1 = v1[k1_offset - 1] + 1; } - let y1 = x1 - k1 - while (x1 < text1_length && y1 < text2_length && - text1.charAt(x1) == text2.charAt(y1)) { - x1++ - y1++ + let y1 = x1 - k1; + while (x1 < text1_length && y1 < text2_length && text1.charAt(x1) == text2.charAt(y1)) { + x1++; + y1++; } - v1[k1_offset] = x1 + v1[k1_offset] = x1; if (x1 > text1_length) { // Ran off the right of the graph. - k1end += 2 + k1end += 2; } else if (y1 > text2_length) { // Ran off the bottom of the graph. - k1start += 2 + k1start += 2; } else if (front) { - let k2_offset = v_offset + delta - k1 + let k2_offset = v_offset + delta - k1; if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] != -1) { // Mirror x2 onto top-left coordinate system. - var x2 = text1_length - v2[k2_offset] + var x2 = text1_length - v2[k2_offset]; if (x1 >= x2) { // Overlap detected. - return this.diff_bisectSplit_(text1, text2, x1, y1, deadline) + return this.diff_bisectSplit_(text1, text2, x1, y1, deadline); } } } @@ -355,37 +354,39 @@ diffMatchPatch.diff_bisect_ = function (text1, text2, deadline) { // Walk the reverse path one step. for (let k2 = -d + k2start; k2 <= d - k2end; k2 += 2) { - let k2_offset = v_offset + k2 - let x2 + let k2_offset = v_offset + k2; + let x2; if (k2 == -d || (k2 != d && v2[k2_offset - 1] < v2[k2_offset + 1])) { - x2 = v2[k2_offset + 1] + x2 = v2[k2_offset + 1]; } else { - x2 = v2[k2_offset - 1] + 1 + x2 = v2[k2_offset - 1] + 1; } - var y2 = x2 - k2 - while (x2 < text1_length && y2 < text2_length && - text1.charAt(text1_length - x2 - 1) == - text2.charAt(text2_length - y2 - 1)) { - x2++ - y2++ + var y2 = x2 - k2; + while ( + x2 < text1_length && + y2 < text2_length && + text1.charAt(text1_length - x2 - 1) == text2.charAt(text2_length - y2 - 1) + ) { + x2++; + y2++; } - v2[k2_offset] = x2 + v2[k2_offset] = x2; if (x2 > text1_length) { // Ran off the left of the graph. - k2end += 2 + k2end += 2; } else if (y2 > text2_length) { // Ran off the top of the graph. - k2start += 2 + k2start += 2; } else if (!front) { - let k1_offset = v_offset + delta - k2 + let k1_offset = v_offset + delta - k2; if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] != -1) { - let x1 = v1[k1_offset] - let y1 = v_offset + x1 - k1_offset + let x1 = v1[k1_offset]; + let y1 = v_offset + x1 - k1_offset; // Mirror x2 onto top-left coordinate system. - x2 = text1_length - x2 + x2 = text1_length - x2; if (x1 >= x2) { // Overlap detected. - return this.diff_bisectSplit_(text1, text2, x1, y1, deadline) + return this.diff_bisectSplit_(text1, text2, x1, y1, deadline); } } } @@ -393,8 +394,11 @@ diffMatchPatch.diff_bisect_ = function (text1, text2, deadline) { } // Diff took too long and hit the deadline or // number of diffs equals number of characters, no commonality at all. - return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]] -} + return [ + [DIFF_DELETE, text1], + [DIFF_INSERT, text2], + ]; +}; /** * Given the location of the 'middle snake', split the diff in two parts @@ -407,19 +411,18 @@ diffMatchPatch.diff_bisect_ = function (text1, text2, deadline) { * @return {!Array.} Array of diff tuples. * @private */ -diffMatchPatch.diff_bisectSplit_ = function (text1, text2, x, y, - deadline) { - var text1a = text1.substring(0, x) - var text2a = text2.substring(0, y) - var text1b = text1.substring(x) - var text2b = text2.substring(y) +diffMatchPatch.diff_bisectSplit_ = function (text1, text2, x, y, deadline) { + var text1a = text1.substring(0, x); + var text2a = text2.substring(0, y); + var text1b = text1.substring(x); + var text2b = text2.substring(y); // Compute both diffs serially. - var diffs = this.diff_main(text1a, text2a, false, deadline) - var diffsb = this.diff_main(text1b, text2b, false, deadline) + var diffs = this.diff_main(text1a, text2a, false, deadline); + var diffsb = this.diff_main(text1b, text2b, false, deadline); - return diffs.concat(diffsb) -} + return diffs.concat(diffsb); +}; /** * Split two texts into an array of strings. Reduce the texts to a string of @@ -433,12 +436,12 @@ diffMatchPatch.diff_bisectSplit_ = function (text1, text2, x, y, * @private */ diffMatchPatch.diff_linesToChars_ = function (text1, text2) { - var lineArray = [] // e.g. lineArray[4] == 'Hello\n' - var lineHash = {} // e.g. lineHash['Hello\n'] == 4 + var lineArray = []; // e.g. lineArray[4] == 'Hello\n' + var lineHash = {}; // e.g. lineHash['Hello\n'] == 4 // '\x00' is a valid character, but various debuggers don't like it. // So we'll insert a junk entry to avoid generating a null character. - lineArray[0] = '' + lineArray[0] = ''; /** * Split a text into an array of strings. Reduce the texts to a string of @@ -448,39 +451,38 @@ diffMatchPatch.diff_linesToChars_ = function (text1, text2) { * @return {string} Encoded string. * @private */ - function diff_linesToCharsMunge_ (text) { - var chars = '' + function diff_linesToCharsMunge_(text) { + var chars = ''; // Walk the text, pulling out a substring for each line. // text.split('\n') would would temporarily double our memory footprint. // Modifying text would create many large strings to garbage collect. - var lineStart = 0 - var lineEnd = -1 + var lineStart = 0; + var lineEnd = -1; // Keeping our own length variable is faster than looking it up. - var lineArrayLength = lineArray.length + var lineArrayLength = lineArray.length; while (lineEnd < text.length - 1) { - lineEnd = text.indexOf('\n', lineStart) + lineEnd = text.indexOf('\n', lineStart); if (lineEnd == -1) { - lineEnd = text.length - 1 + lineEnd = text.length - 1; } - var line = text.substring(lineStart, lineEnd + 1) - lineStart = lineEnd + 1 + var line = text.substring(lineStart, lineEnd + 1); + lineStart = lineEnd + 1; - if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) - : (lineHash[line] !== undefined)) { - chars += String.fromCharCode(lineHash[line]) + if (lineHash.hasOwnProperty ? lineHash.hasOwnProperty(line) : lineHash[line] !== undefined) { + chars += String.fromCharCode(lineHash[line]); } else { - chars += String.fromCharCode(lineArrayLength) - lineHash[line] = lineArrayLength - lineArray[lineArrayLength++] = line + chars += String.fromCharCode(lineArrayLength); + lineHash[line] = lineArrayLength; + lineArray[lineArrayLength++] = line; } } - return chars + return chars; } - var chars1 = diff_linesToCharsMunge_(text1) - var chars2 = diff_linesToCharsMunge_(text2) - return { chars1: chars1, chars2: chars2, lineArray: lineArray } -} + var chars1 = diff_linesToCharsMunge_(text1); + var chars2 = diff_linesToCharsMunge_(text2); + return { chars1: chars1, chars2: chars2, lineArray: lineArray }; +}; /** * Rehydrate the text in a diff from a string of line hashes to real lines of @@ -491,14 +493,14 @@ diffMatchPatch.diff_linesToChars_ = function (text1, text2) { */ diffMatchPatch.diff_charsToLines_ = function (diffs, lineArray) { for (var x = 0; x < diffs.length; x++) { - var chars = diffs[x][1] - var text = [] + var chars = diffs[x][1]; + var text = []; for (var y = 0; y < chars.length; y++) { - text[y] = lineArray[chars.charCodeAt(y)] + text[y] = lineArray[chars.charCodeAt(y)]; } - diffs[x][1] = text.join('') + diffs[x][1] = text.join(''); } -} +}; /** * Determine the common prefix of two strings. @@ -510,26 +512,25 @@ diffMatchPatch.diff_charsToLines_ = function (diffs, lineArray) { diffMatchPatch.diff_commonPrefix = function (text1, text2) { // Quick check for common null cases. if (!text1 || !text2 || text1.charAt(0) != text2.charAt(0)) { - return 0 + return 0; } // Binary search. // Performance analysis: http://neil.fraser.name/news/2007/10/09/ - var pointermin = 0 - var pointermax = Math.min(text1.length, text2.length) - var pointermid = pointermax - var pointerstart = 0 + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerstart = 0; while (pointermin < pointermid) { - if (text1.substring(pointerstart, pointermid) == - text2.substring(pointerstart, pointermid)) { - pointermin = pointermid - pointerstart = pointermin + if (text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid)) { + pointermin = pointermid; + pointerstart = pointermin; } else { - pointermax = pointermid + pointermax = pointermid; } - pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin) + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); } - return pointermid -} + return pointermid; +}; /** * Determine the common suffix of two strings. @@ -539,28 +540,29 @@ diffMatchPatch.diff_commonPrefix = function (text1, text2) { */ diffMatchPatch.diff_commonSuffix = function (text1, text2) { // Quick check for common null cases. - if (!text1 || !text2 || - text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) { - return 0 + if (!text1 || !text2 || text1.charAt(text1.length - 1) != text2.charAt(text2.length - 1)) { + return 0; } // Binary search. // Performance analysis: http://neil.fraser.name/news/2007/10/09/ - var pointermin = 0 - var pointermax = Math.min(text1.length, text2.length) - var pointermid = pointermax - var pointerend = 0 + var pointermin = 0; + var pointermax = Math.min(text1.length, text2.length); + var pointermid = pointermax; + var pointerend = 0; while (pointermin < pointermid) { - if (text1.substring(text1.length - pointermid, text1.length - pointerend) == - text2.substring(text2.length - pointermid, text2.length - pointerend)) { - pointermin = pointermid - pointerend = pointermin + if ( + text1.substring(text1.length - pointermid, text1.length - pointerend) == + text2.substring(text2.length - pointermid, text2.length - pointerend) + ) { + pointermin = pointermid; + pointerend = pointermin; } else { - pointermax = pointermid + pointermax = pointermid; } - pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin) + pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); } - return pointermid -} + return pointermid; +}; /** * Determine if the suffix of one string is the prefix of another. @@ -572,43 +574,42 @@ diffMatchPatch.diff_commonSuffix = function (text1, text2) { */ diffMatchPatch.diff_commonOverlap_ = function (text1, text2) { // Cache the text lengths to prevent multiple calls. - var text1_length = text1.length - var text2_length = text2.length + var text1_length = text1.length; + var text2_length = text2.length; // Eliminate the null case. if (text1_length == 0 || text2_length == 0) { - return 0 + return 0; } // Truncate the longer string. if (text1_length > text2_length) { - text1 = text1.substring(text1_length - text2_length) + text1 = text1.substring(text1_length - text2_length); } else if (text1_length < text2_length) { - text2 = text2.substring(0, text1_length) + text2 = text2.substring(0, text1_length); } - var text_length = Math.min(text1_length, text2_length) + var text_length = Math.min(text1_length, text2_length); // Quick check for the worst case. if (text1 == text2) { - return text_length + return text_length; } // Start by looking for a single character match // and increase length until no match is found. // Performance analysis: http://neil.fraser.name/news/2010/11/04/ - var best = 0 - var length = 1 + var best = 0; + var length = 1; while (length == length) { - var pattern = text1.substring(text_length - length) - var found = text2.indexOf(pattern) + var pattern = text1.substring(text_length - length); + var found = text2.indexOf(pattern); if (found == -1) { - return best + return best; } - length += found - if (found == 0 || text1.substring(text_length - length) == - text2.substring(0, length)) { - best = length - length++ + length += found; + if (found == 0 || text1.substring(text_length - length) == text2.substring(0, length)) { + best = length; + length++; } } -} +}; /** * Do the two texts share a substring which is at least half the length of the @@ -624,14 +625,14 @@ diffMatchPatch.diff_commonOverlap_ = function (text1, text2) { diffMatchPatch.diff_halfMatch_ = function (text1, text2) { if (this.Diff_Timeout <= 0) { // Don't risk returning a non-optimal diff if we have unlimited time. - return null + return null; } - var longtext = text1.length > text2.length ? text1 : text2 - var shorttext = text1.length > text2.length ? text2 : text1 + var longtext = text1.length > text2.length ? text1 : text2; + var shorttext = text1.length > text2.length ? text2 : text1; if (longtext.length < 4 || shorttext.length * 2 < longtext.length) { - return null // Pointless. + return null; // Pointless. } - var dmp = this // 'this' becomes 'window' in a closure. + var dmp = this; // 'this' becomes 'window' in a closure. /** * Does a substring of shorttext exist within longtext such that the substring @@ -645,133 +646,129 @@ diffMatchPatch.diff_halfMatch_ = function (text1, text2) { * of shorttext and the common middle. Or null if there was no match. * @private */ - function diff_halfMatchI_ (longtext, shorttext, i) { + function diff_halfMatchI_(longtext, shorttext, i) { // Start with a 1/4 length substring at position i as a seed. - var seed = longtext.substring(i, i + Math.floor(longtext.length / 4)) - var j = -1 - var best_common = '' - var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b + var seed = longtext.substring(i, i + Math.floor(longtext.length / 4)); + var j = -1; + var best_common = ''; + var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b; while ((j = shorttext.indexOf(seed, j + 1)) != -1) { - var prefixLength = dmp.diff_commonPrefix(longtext.substring(i), - shorttext.substring(j)) - var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i), - shorttext.substring(0, j)) + var prefixLength = dmp.diff_commonPrefix(longtext.substring(i), shorttext.substring(j)); + var suffixLength = dmp.diff_commonSuffix(longtext.substring(0, i), shorttext.substring(0, j)); if (best_common.length < suffixLength + prefixLength) { - best_common = shorttext.substring(j - suffixLength, j) + - shorttext.substring(j, j + prefixLength) - best_longtext_a = longtext.substring(0, i - suffixLength) - best_longtext_b = longtext.substring(i + prefixLength) - best_shorttext_a = shorttext.substring(0, j - suffixLength) - best_shorttext_b = shorttext.substring(j + prefixLength) + best_common = shorttext.substring(j - suffixLength, j) + shorttext.substring(j, j + prefixLength); + best_longtext_a = longtext.substring(0, i - suffixLength); + best_longtext_b = longtext.substring(i + prefixLength); + best_shorttext_a = shorttext.substring(0, j - suffixLength); + best_shorttext_b = shorttext.substring(j + prefixLength); } } if (best_common.length * 2 >= longtext.length) { - return [best_longtext_a, best_longtext_b, - best_shorttext_a, best_shorttext_b, best_common] + return [best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common]; } else { - return null + return null; } } // First check if the second quarter is the seed for a half-match. - var hm1 = diff_halfMatchI_(longtext, shorttext, - Math.ceil(longtext.length / 4)) + var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4)); // Check again based on the third quarter. - var hm2 = diff_halfMatchI_(longtext, shorttext, - Math.ceil(longtext.length / 2)) - var hm + var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2)); + var hm; if (!hm1 && !hm2) { - return null + return null; } else if (!hm2) { - hm = hm1 + hm = hm1; } else if (!hm1) { - hm = hm2 + hm = hm2; } else { // Both matched. Select the longest. - hm = hm1[4].length > hm2[4].length ? hm1 : hm2 + hm = hm1[4].length > hm2[4].length ? hm1 : hm2; } // A half-match was found, sort out the return data. - var text1_a, text1_b, text2_a, text2_b + var text1_a, text1_b, text2_a, text2_b; if (text1.length > text2.length) { - text1_a = hm[0] - text1_b = hm[1] - text2_a = hm[2] - text2_b = hm[3] + text1_a = hm[0]; + text1_b = hm[1]; + text2_a = hm[2]; + text2_b = hm[3]; } else { - text2_a = hm[0] - text2_b = hm[1] - text1_a = hm[2] - text1_b = hm[3] + text2_a = hm[0]; + text2_b = hm[1]; + text1_a = hm[2]; + text1_b = hm[3]; } - var mid_common = hm[4] - return [text1_a, text1_b, text2_a, text2_b, mid_common] -} + var mid_common = hm[4]; + return [text1_a, text1_b, text2_a, text2_b, mid_common]; +}; /** * Reduce the number of edits by eliminating semantically trivial equalities. * @param {!Array.} diffs Array of diff tuples. */ diffMatchPatch.diff_cleanupSemantic = function (diffs) { - var changes = false - var equalities = [] // Stack of indices where equalities are found. - var equalitiesLength = 0 // Keeping our own length var is faster in JS. + var changes = false; + var equalities = []; // Stack of indices where equalities are found. + var equalitiesLength = 0; // Keeping our own length var is faster in JS. /** @type {?string} */ - var lastequality = null + var lastequality = null; // Always equal to diffs[equalities[equalitiesLength - 1]][1] - var pointer = 0 // Index of current position. + var pointer = 0; // Index of current position. // Number of characters that changed prior to the equality. - var length_insertions1 = 0 - var length_deletions1 = 0 + var length_insertions1 = 0; + var length_deletions1 = 0; // Number of characters that changed after the equality. - var length_insertions2 = 0 - var length_deletions2 = 0 + var length_insertions2 = 0; + var length_deletions2 = 0; while (pointer < diffs.length) { - if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found. - equalities[equalitiesLength++] = pointer - length_insertions1 = length_insertions2 - length_deletions1 = length_deletions2 - length_insertions2 = 0 - length_deletions2 = 0 - lastequality = diffs[pointer][1] - } else { // An insertion or deletion. + if (diffs[pointer][0] == DIFF_EQUAL) { + // Equality found. + equalities[equalitiesLength++] = pointer; + length_insertions1 = length_insertions2; + length_deletions1 = length_deletions2; + length_insertions2 = 0; + length_deletions2 = 0; + lastequality = diffs[pointer][1]; + } else { + // An insertion or deletion. if (diffs[pointer][0] == DIFF_INSERT) { - length_insertions2 += diffs[pointer][1].length + length_insertions2 += diffs[pointer][1].length; } else { - length_deletions2 += diffs[pointer][1].length + length_deletions2 += diffs[pointer][1].length; } // Eliminate an equality that is smaller or equal to the edits on both // sides of it. - if (lastequality && (lastequality.length <= - Math.max(length_insertions1, length_deletions1)) && - (lastequality.length <= Math.max(length_insertions2, - length_deletions2))) { + if ( + lastequality && + lastequality.length <= Math.max(length_insertions1, length_deletions1) && + lastequality.length <= Math.max(length_insertions2, length_deletions2) + ) { // Duplicate record. - diffs.splice(equalities[equalitiesLength - 1], 0, - [DIFF_DELETE, lastequality]) + diffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]); // Change second copy to insert. - diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT + diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; // Throw away the equality we just deleted. - equalitiesLength-- + equalitiesLength--; // Throw away the previous equality (it needs to be reevaluated). - equalitiesLength-- - pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1 - length_insertions1 = 0 // Reset the counters. - length_deletions1 = 0 - length_insertions2 = 0 - length_deletions2 = 0 - lastequality = null - changes = true + equalitiesLength--; + pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; + length_insertions1 = 0; // Reset the counters. + length_deletions1 = 0; + length_insertions2 = 0; + length_deletions2 = 0; + lastequality = null; + changes = true; } } - pointer++ + pointer++; } // Normalize the diff. if (changes) { - this.diff_cleanupMerge(diffs) + this.diff_cleanupMerge(diffs); } - this.diff_cleanupSemanticLossless(diffs) + this.diff_cleanupSemanticLossless(diffs); // Find any overlaps between deletions and insertions. // e.g: abcxxxxxxdef @@ -779,46 +776,38 @@ diffMatchPatch.diff_cleanupSemantic = function (diffs) { // e.g: xxxabcdefxxx // -> defxxxabc // Only extract an overlap if it is as big as the edit ahead or behind it. - pointer = 1 + pointer = 1; while (pointer < diffs.length) { - if (diffs[pointer - 1][0] == DIFF_DELETE && - diffs[pointer][0] == DIFF_INSERT) { - var deletion = diffs[pointer - 1][1] - var insertion = diffs[pointer][1] - var overlap_length1 = this.diff_commonOverlap_(deletion, insertion) - var overlap_length2 = this.diff_commonOverlap_(insertion, deletion) + if (diffs[pointer - 1][0] == DIFF_DELETE && diffs[pointer][0] == DIFF_INSERT) { + var deletion = diffs[pointer - 1][1]; + var insertion = diffs[pointer][1]; + var overlap_length1 = this.diff_commonOverlap_(deletion, insertion); + var overlap_length2 = this.diff_commonOverlap_(insertion, deletion); if (overlap_length1 >= overlap_length2) { - if (overlap_length1 >= deletion.length / 2 || - overlap_length1 >= insertion.length / 2) { + if (overlap_length1 >= deletion.length / 2 || overlap_length1 >= insertion.length / 2) { // Overlap found. Insert an equality and trim the surrounding edits. - diffs.splice(pointer, 0, - [DIFF_EQUAL, insertion.substring(0, overlap_length1)]) - diffs[pointer - 1][1] = - deletion.substring(0, deletion.length - overlap_length1) - diffs[pointer + 1][1] = insertion.substring(overlap_length1) - pointer++ + diffs.splice(pointer, 0, [DIFF_EQUAL, insertion.substring(0, overlap_length1)]); + diffs[pointer - 1][1] = deletion.substring(0, deletion.length - overlap_length1); + diffs[pointer + 1][1] = insertion.substring(overlap_length1); + pointer++; } } else { - if (overlap_length2 >= deletion.length / 2 || - overlap_length2 >= insertion.length / 2) { + if (overlap_length2 >= deletion.length / 2 || overlap_length2 >= insertion.length / 2) { // Reverse overlap found. // Insert an equality and swap and trim the surrounding edits. - diffs.splice(pointer, 0, - [DIFF_EQUAL, deletion.substring(0, overlap_length2)]) - diffs[pointer - 1][0] = DIFF_INSERT - diffs[pointer - 1][1] = - insertion.substring(0, insertion.length - overlap_length2) - diffs[pointer + 1][0] = DIFF_DELETE - diffs[pointer + 1][1] = - deletion.substring(overlap_length2) - pointer++ + diffs.splice(pointer, 0, [DIFF_EQUAL, deletion.substring(0, overlap_length2)]); + diffs[pointer - 1][0] = DIFF_INSERT; + diffs[pointer - 1][1] = insertion.substring(0, insertion.length - overlap_length2); + diffs[pointer + 1][0] = DIFF_DELETE; + diffs[pointer + 1][1] = deletion.substring(overlap_length2); + pointer++; } } - pointer++ + pointer++; } - pointer++ + pointer++; } -} +}; /** * Look for single edits surrounded on both sides by equalities @@ -837,10 +826,10 @@ diffMatchPatch.diff_cleanupSemanticLossless = function (diffs) { * @return {number} The score. * @private */ - function diff_cleanupSemanticScore_ (one, two) { + function diff_cleanupSemanticScore_(one, two) { if (!one || !two) { // Edges are the best. - return 6 + return 6; } // Each port of this function behaves slightly differently due to @@ -848,150 +837,142 @@ diffMatchPatch.diff_cleanupSemanticLossless = function (diffs) { // 'whitespace'. Since this function's purpose is largely cosmetic, // the choice has been made to use each language's native features // rather than force total conformity. - var char1 = one.charAt(one.length - 1) - var char2 = two.charAt(0) - var nonAlphaNumeric1 = char1.match(diffMatchPatch.nonAlphaNumericRegex_) - var nonAlphaNumeric2 = char2.match(diffMatchPatch.nonAlphaNumericRegex_) - var whitespace1 = nonAlphaNumeric1 && - char1.match(diffMatchPatch.whitespaceRegex_) - var whitespace2 = nonAlphaNumeric2 && - char2.match(diffMatchPatch.whitespaceRegex_) - var lineBreak1 = whitespace1 && - char1.match(diffMatchPatch.linebreakRegex_) - var lineBreak2 = whitespace2 && - char2.match(diffMatchPatch.linebreakRegex_) - var blankLine1 = lineBreak1 && - one.match(diffMatchPatch.blanklineEndRegex_) - var blankLine2 = lineBreak2 && - two.match(diffMatchPatch.blanklineStartRegex_) + var char1 = one.charAt(one.length - 1); + var char2 = two.charAt(0); + var nonAlphaNumeric1 = char1.match(diffMatchPatch.nonAlphaNumericRegex_); + var nonAlphaNumeric2 = char2.match(diffMatchPatch.nonAlphaNumericRegex_); + var whitespace1 = nonAlphaNumeric1 && char1.match(diffMatchPatch.whitespaceRegex_); + var whitespace2 = nonAlphaNumeric2 && char2.match(diffMatchPatch.whitespaceRegex_); + var lineBreak1 = whitespace1 && char1.match(diffMatchPatch.linebreakRegex_); + var lineBreak2 = whitespace2 && char2.match(diffMatchPatch.linebreakRegex_); + var blankLine1 = lineBreak1 && one.match(diffMatchPatch.blanklineEndRegex_); + var blankLine2 = lineBreak2 && two.match(diffMatchPatch.blanklineStartRegex_); if (blankLine1 || blankLine2) { // Five points for blank lines. - return 5 + return 5; } else if (lineBreak1 || lineBreak2) { // Four points for line breaks. - return 4 + return 4; } else if (nonAlphaNumeric1 && !whitespace1 && whitespace2) { // Three points for end of sentences. - return 3 + return 3; } else if (whitespace1 || whitespace2) { // Two points for whitespace. - return 2 + return 2; } else if (nonAlphaNumeric1 || nonAlphaNumeric2) { // One point for non-alphanumeric. - return 1 + return 1; } - return 0 + return 0; } - var pointer = 1 + var pointer = 1; // Intentionally ignore the first and last element (don't need checking). while (pointer < diffs.length - 1) { - if (diffs[pointer - 1][0] == DIFF_EQUAL && - diffs[pointer + 1][0] == DIFF_EQUAL) { + if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) { // This is a single edit surrounded by equalities. - var equality1 = diffs[pointer - 1][1] - var edit = diffs[pointer][1] - var equality2 = diffs[pointer + 1][1] + var equality1 = diffs[pointer - 1][1]; + var edit = diffs[pointer][1]; + var equality2 = diffs[pointer + 1][1]; // First, shift the edit as far left as possible. - var commonOffset = this.diff_commonSuffix(equality1, edit) + var commonOffset = this.diff_commonSuffix(equality1, edit); if (commonOffset) { - var commonString = edit.substring(edit.length - commonOffset) - equality1 = equality1.substring(0, equality1.length - commonOffset) - edit = commonString + edit.substring(0, edit.length - commonOffset) - equality2 = commonString + equality2 + var commonString = edit.substring(edit.length - commonOffset); + equality1 = equality1.substring(0, equality1.length - commonOffset); + edit = commonString + edit.substring(0, edit.length - commonOffset); + equality2 = commonString + equality2; } // Second, step character by character right, looking for the best fit. - var bestEquality1 = equality1 - var bestEdit = edit - var bestEquality2 = equality2 - var bestScore = diff_cleanupSemanticScore_(equality1, edit) + - diff_cleanupSemanticScore_(edit, equality2) + var bestEquality1 = equality1; + var bestEdit = edit; + var bestEquality2 = equality2; + var bestScore = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2); while (edit.charAt(0) === equality2.charAt(0)) { - equality1 += edit.charAt(0) - edit = edit.substring(1) + equality2.charAt(0) - equality2 = equality2.substring(1) - var score = diff_cleanupSemanticScore_(equality1, edit) + - diff_cleanupSemanticScore_(edit, equality2) + equality1 += edit.charAt(0); + edit = edit.substring(1) + equality2.charAt(0); + equality2 = equality2.substring(1); + var score = diff_cleanupSemanticScore_(equality1, edit) + diff_cleanupSemanticScore_(edit, equality2); // The >= encourages trailing rather than leading whitespace on edits. if (score >= bestScore) { - bestScore = score - bestEquality1 = equality1 - bestEdit = edit - bestEquality2 = equality2 + bestScore = score; + bestEquality1 = equality1; + bestEdit = edit; + bestEquality2 = equality2; } } if (diffs[pointer - 1][1] != bestEquality1) { // We have an improvement, save it back to the diff. if (bestEquality1) { - diffs[pointer - 1][1] = bestEquality1 + diffs[pointer - 1][1] = bestEquality1; } else { - diffs.splice(pointer - 1, 1) - pointer-- + diffs.splice(pointer - 1, 1); + pointer--; } - diffs[pointer][1] = bestEdit + diffs[pointer][1] = bestEdit; if (bestEquality2) { - diffs[pointer + 1][1] = bestEquality2 + diffs[pointer + 1][1] = bestEquality2; } else { - diffs.splice(pointer + 1, 1) - pointer-- + diffs.splice(pointer + 1, 1); + pointer--; } } } - pointer++ + pointer++; } -} +}; // Define some regex patterns for matching boundaries. -diffMatchPatch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/ -diffMatchPatch.whitespaceRegex_ = /\s/ -diffMatchPatch.linebreakRegex_ = /[\r\n]/ -diffMatchPatch.blanklineEndRegex_ = /\n\r?\n$/ -diffMatchPatch.blanklineStartRegex_ = /^\r?\n\r?\n/ +diffMatchPatch.nonAlphaNumericRegex_ = /[^a-zA-Z0-9]/; +diffMatchPatch.whitespaceRegex_ = /\s/; +diffMatchPatch.linebreakRegex_ = /[\r\n]/; +diffMatchPatch.blanklineEndRegex_ = /\n\r?\n$/; +diffMatchPatch.blanklineStartRegex_ = /^\r?\n\r?\n/; /** * Reduce the number of edits by eliminating operationally trivial equalities. * @param {!Array.} diffs Array of diff tuples. */ diffMatchPatch.diff_cleanupEfficiency = function (diffs) { - var changes = false - var equalities = [] // Stack of indices where equalities are found. - var equalitiesLength = 0 // Keeping our own length var is faster in JS. + var changes = false; + var equalities = []; // Stack of indices where equalities are found. + var equalitiesLength = 0; // Keeping our own length var is faster in JS. /** @type {?string} */ - var lastequality = null + var lastequality = null; // Always equal to diffs[equalities[equalitiesLength - 1]][1] - var pointer = 0 // Index of current position. + var pointer = 0; // Index of current position. // Is there an insertion operation before the last equality. - var pre_ins = false + var pre_ins = false; // Is there a deletion operation before the last equality. - var pre_del = false + var pre_del = false; // Is there an insertion operation after the last equality. - var post_ins = false + var post_ins = false; // Is there a deletion operation after the last equality. - var post_del = false + var post_del = false; while (pointer < diffs.length) { - if (diffs[pointer][0] == DIFF_EQUAL) { // Equality found. - if (diffs[pointer][1].length < this.Diff_EditCost && - (post_ins || post_del)) { + if (diffs[pointer][0] == DIFF_EQUAL) { + // Equality found. + if (diffs[pointer][1].length < this.Diff_EditCost && (post_ins || post_del)) { // Candidate found. - equalities[equalitiesLength++] = pointer - pre_ins = post_ins - pre_del = post_del - lastequality = diffs[pointer][1] + equalities[equalitiesLength++] = pointer; + pre_ins = post_ins; + pre_del = post_del; + lastequality = diffs[pointer][1]; } else { // Not a candidate, and can never become one. - equalitiesLength = 0 - lastequality = null + equalitiesLength = 0; + lastequality = null; } - post_ins = post_del = false - } else { // An insertion or deletion. + post_ins = post_del = false; + } else { + // An insertion or deletion. if (diffs[pointer][0] == DIFF_DELETE) { - post_del = true + post_del = true; } else { - post_ins = true + post_ins = true; } /* * Five types to be split: @@ -1001,36 +982,36 @@ diffMatchPatch.diff_cleanupEfficiency = function (diffs) { * AXCD * ABXC */ - if (lastequality && ((pre_ins && pre_del && post_ins && post_del) || - ((lastequality.length < this.Diff_EditCost / 2) && - (pre_ins + pre_del + post_ins + post_del) == 3))) { + if ( + lastequality && + ((pre_ins && pre_del && post_ins && post_del) || + (lastequality.length < this.Diff_EditCost / 2 && pre_ins + pre_del + post_ins + post_del == 3)) + ) { // Duplicate record. - diffs.splice(equalities[equalitiesLength - 1], 0, - [DIFF_DELETE, lastequality]) + diffs.splice(equalities[equalitiesLength - 1], 0, [DIFF_DELETE, lastequality]); // Change second copy to insert. - diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT - equalitiesLength-- // Throw away the equality we just deleted; - lastequality = null + diffs[equalities[equalitiesLength - 1] + 1][0] = DIFF_INSERT; + equalitiesLength--; // Throw away the equality we just deleted; + lastequality = null; if (pre_ins && pre_del) { // No changes made which could affect previous entry, keep going. - post_ins = post_del = true - equalitiesLength = 0 + post_ins = post_del = true; + equalitiesLength = 0; } else { - equalitiesLength-- // Throw away the previous equality. - pointer = equalitiesLength > 0 - ? equalities[equalitiesLength - 1] : -1 - post_ins = post_del = false + equalitiesLength--; // Throw away the previous equality. + pointer = equalitiesLength > 0 ? equalities[equalitiesLength - 1] : -1; + post_ins = post_del = false; } - changes = true + changes = true; } } - pointer++ + pointer++; } if (changes) { - this.diff_cleanupMerge(diffs) + this.diff_cleanupMerge(diffs); } -} +}; /** * Reorder and merge like edit sections. Merge equalities. @@ -1038,125 +1019,118 @@ diffMatchPatch.diff_cleanupEfficiency = function (diffs) { * @param {!Array.} diffs Array of diff tuples. */ diffMatchPatch.diff_cleanupMerge = function (diffs) { - diffs.push([DIFF_EQUAL, '']) // Add a dummy entry at the end. - var pointer = 0 - var count_delete = 0 - var count_insert = 0 - var text_delete = '' - var text_insert = '' - var commonlength + diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end. + var pointer = 0; + var count_delete = 0; + var count_insert = 0; + var text_delete = ''; + var text_insert = ''; + var commonlength; while (pointer < diffs.length) { switch (diffs[pointer][0]) { case DIFF_INSERT: - count_insert++ - text_insert += diffs[pointer][1] - pointer++ - break + count_insert++; + text_insert += diffs[pointer][1]; + pointer++; + break; case DIFF_DELETE: - count_delete++ - text_delete += diffs[pointer][1] - pointer++ - break + count_delete++; + text_delete += diffs[pointer][1]; + pointer++; + break; case DIFF_EQUAL: // Upon reaching an equality, check for prior redundancies. if (count_delete + count_insert > 1) { if (count_delete !== 0 && count_insert !== 0) { // Factor out any common prefixies. - commonlength = this.diff_commonPrefix(text_insert, text_delete) + commonlength = this.diff_commonPrefix(text_insert, text_delete); if (commonlength !== 0) { - if ((pointer - count_delete - count_insert) > 0 && - diffs[pointer - count_delete - count_insert - 1][0] == - DIFF_EQUAL) { - diffs[pointer - count_delete - count_insert - 1][1] += - text_insert.substring(0, commonlength) + if ( + pointer - count_delete - count_insert > 0 && + diffs[pointer - count_delete - count_insert - 1][0] == DIFF_EQUAL + ) { + diffs[pointer - count_delete - count_insert - 1][1] += text_insert.substring(0, commonlength); } else { - diffs.splice(0, 0, [DIFF_EQUAL, - text_insert.substring(0, commonlength)]) - pointer++ + diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]); + pointer++; } - text_insert = text_insert.substring(commonlength) - text_delete = text_delete.substring(commonlength) + text_insert = text_insert.substring(commonlength); + text_delete = text_delete.substring(commonlength); } // Factor out any common suffixies. - commonlength = this.diff_commonSuffix(text_insert, text_delete) + commonlength = this.diff_commonSuffix(text_insert, text_delete); if (commonlength !== 0) { - diffs[pointer][1] = text_insert.substring(text_insert.length - - commonlength) + diffs[pointer][1] - text_insert = text_insert.substring(0, text_insert.length - - commonlength) - text_delete = text_delete.substring(0, text_delete.length - - commonlength) + diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1]; + text_insert = text_insert.substring(0, text_insert.length - commonlength); + text_delete = text_delete.substring(0, text_delete.length - commonlength); } } // Delete the offending records and add the merged ones. if (count_delete === 0) { - diffs.splice(pointer - count_insert, - count_delete + count_insert, [DIFF_INSERT, text_insert]) + diffs.splice(pointer - count_insert, count_delete + count_insert, [DIFF_INSERT, text_insert]); } else if (count_insert === 0) { - diffs.splice(pointer - count_delete, - count_delete + count_insert, [DIFF_DELETE, text_delete]) + diffs.splice(pointer - count_delete, count_delete + count_insert, [DIFF_DELETE, text_delete]); } else { - diffs.splice(pointer - count_delete - count_insert, - count_delete + count_insert, [DIFF_DELETE, text_delete], - [DIFF_INSERT, text_insert]) + diffs.splice( + pointer - count_delete - count_insert, + count_delete + count_insert, + [DIFF_DELETE, text_delete], + [DIFF_INSERT, text_insert] + ); } - pointer = pointer - count_delete - count_insert + - (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1 + pointer = pointer - count_delete - count_insert + (count_delete ? 1 : 0) + (count_insert ? 1 : 0) + 1; } else if (pointer !== 0 && diffs[pointer - 1][0] == DIFF_EQUAL) { // Merge this equality with the previous one. - diffs[pointer - 1][1] += diffs[pointer][1] - diffs.splice(pointer, 1) + diffs[pointer - 1][1] += diffs[pointer][1]; + diffs.splice(pointer, 1); } else { - pointer++ + pointer++; } - count_insert = 0 - count_delete = 0 - text_delete = '' - text_insert = '' - break + count_insert = 0; + count_delete = 0; + text_delete = ''; + text_insert = ''; + break; } } if (diffs[diffs.length - 1][1] === '') { - diffs.pop() // Remove the dummy entry at the end. + diffs.pop(); // Remove the dummy entry at the end. } // Second pass: look for single edits surrounded on both sides by equalities // which can be shifted sideways to eliminate an equality. // e.g: ABAC -> ABAC - var changes = false - pointer = 1 + var changes = false; + pointer = 1; // Intentionally ignore the first and last element (don't need checking). while (pointer < diffs.length - 1) { - if (diffs[pointer - 1][0] == DIFF_EQUAL && - diffs[pointer + 1][0] == DIFF_EQUAL) { + if (diffs[pointer - 1][0] == DIFF_EQUAL && diffs[pointer + 1][0] == DIFF_EQUAL) { // This is a single edit surrounded by equalities. - if (diffs[pointer][1].substring(diffs[pointer][1].length - - diffs[pointer - 1][1].length) == diffs[pointer - 1][1]) { + if ( + diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) == diffs[pointer - 1][1] + ) { // Shift the edit over the previous equality. - diffs[pointer][1] = diffs[pointer - 1][1] + - diffs[pointer][1].substring(0, diffs[pointer][1].length - - diffs[pointer - 1][1].length) - diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1] - diffs.splice(pointer - 1, 1) - changes = true - } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == - diffs[pointer + 1][1]) { - // Shift the edit over the next equality. - diffs[pointer - 1][1] += diffs[pointer + 1][1] diffs[pointer][1] = - diffs[pointer][1].substring(diffs[pointer + 1][1].length) + - diffs[pointer + 1][1] - diffs.splice(pointer + 1, 1) - changes = true + diffs[pointer - 1][1] + + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length); + diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; + diffs.splice(pointer - 1, 1); + changes = true; + } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) { + // Shift the edit over the next equality. + diffs[pointer - 1][1] += diffs[pointer + 1][1]; + diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1]; + diffs.splice(pointer + 1, 1); + changes = true; } } - pointer++ + pointer++; } // If shifts were made, the diff needs reordering and another shift sweep. if (changes) { - this.diff_cleanupMerge(diffs) + this.diff_cleanupMerge(diffs); } -} +}; /** * loc is a location in text1, compute and return the equivalent location in @@ -1167,31 +1141,34 @@ diffMatchPatch.diff_cleanupMerge = function (diffs) { * @return {number} Location within text2. */ diffMatchPatch.diff_xIndex = function (diffs, loc) { - var chars1 = 0 - var chars2 = 0 - var last_chars1 = 0 - var last_chars2 = 0 - var x + var chars1 = 0; + var chars2 = 0; + var last_chars1 = 0; + var last_chars2 = 0; + var x; for (x = 0; x < diffs.length; x++) { - if (diffs[x][0] !== DIFF_INSERT) { // Equality or deletion. - chars1 += diffs[x][1].length + if (diffs[x][0] !== DIFF_INSERT) { + // Equality or deletion. + chars1 += diffs[x][1].length; } - if (diffs[x][0] !== DIFF_DELETE) { // Equality or insertion. - chars2 += diffs[x][1].length + if (diffs[x][0] !== DIFF_DELETE) { + // Equality or insertion. + chars2 += diffs[x][1].length; } - if (chars1 > loc) { // Overshot the location. - break + if (chars1 > loc) { + // Overshot the location. + break; } - last_chars1 = chars1 - last_chars2 = chars2 + last_chars1 = chars1; + last_chars2 = chars2; } // Was the location was deleted? if (diffs.length != x && diffs[x][0] === DIFF_DELETE) { - return last_chars2 + return last_chars2; } // Add the remaining character length. - return last_chars2 + (loc - last_chars1) -} + return last_chars2 + (loc - last_chars1); +}; /** * Convert a diff array into a pretty HTML report. @@ -1199,30 +1176,33 @@ diffMatchPatch.diff_xIndex = function (diffs, loc) { * @return {string} HTML representation. */ diffMatchPatch.diff_prettyHtml = function (diffs) { - var html = [] - var pattern_amp = /&/g - var pattern_lt = //g - var pattern_para = /\n/g + var html = []; + var pattern_amp = /&/g; + var pattern_lt = //g; + var pattern_para = /\n/g; for (var x = 0; x < diffs.length; x++) { - var op = diffs[x][0] // Operation (insert, delete, equal) - var data = diffs[x][1] // Text of change. - var text = data.replace(pattern_amp, '&').replace(pattern_lt, '<') - .replace(pattern_gt, '>').replace(pattern_para, '¶
') + var op = diffs[x][0]; // Operation (insert, delete, equal) + var data = diffs[x][1]; // Text of change. + var text = data + .replace(pattern_amp, '&') + .replace(pattern_lt, '<') + .replace(pattern_gt, '>') + .replace(pattern_para, '¶
'); switch (op) { case DIFF_INSERT: - html[x] = '' + text + '' - break + html[x] = '' + text + ''; + break; case DIFF_DELETE: - html[x] = '' + text + '' - break + html[x] = '' + text + ''; + break; case DIFF_EQUAL: - html[x] = '' + text + '' - break + html[x] = '' + text + ''; + break; } } - return html.join('') -} + return html.join(''); +}; /** * Compute and return the source text (all equalities and deletions). @@ -1230,14 +1210,14 @@ diffMatchPatch.diff_prettyHtml = function (diffs) { * @return {string} Source text. */ diffMatchPatch.diff_text1 = function (diffs) { - var text = [] + var text = []; for (var x = 0; x < diffs.length; x++) { if (diffs[x][0] !== DIFF_INSERT) { - text[x] = diffs[x][1] + text[x] = diffs[x][1]; } } - return text.join('') -} + return text.join(''); +}; /** * Compute and return the destination text (all equalities and insertions). @@ -1245,14 +1225,14 @@ diffMatchPatch.diff_text1 = function (diffs) { * @return {string} Destination text. */ diffMatchPatch.diff_text2 = function (diffs) { - var text = [] + var text = []; for (var x = 0; x < diffs.length; x++) { if (diffs[x][0] !== DIFF_DELETE) { - text[x] = diffs[x][1] + text[x] = diffs[x][1]; } } - return text.join('') -} + return text.join(''); +}; /** * Compute the Levenshtein distance; the number of inserted, deleted or @@ -1261,30 +1241,30 @@ diffMatchPatch.diff_text2 = function (diffs) { * @return {number} Number of changes. */ diffMatchPatch.diff_levenshtein = function (diffs) { - var levenshtein = 0 - var insertions = 0 - var deletions = 0 + var levenshtein = 0; + var insertions = 0; + var deletions = 0; for (var x = 0; x < diffs.length; x++) { - var op = diffs[x][0] - var data = diffs[x][1] + var op = diffs[x][0]; + var data = diffs[x][1]; switch (op) { case DIFF_INSERT: - insertions += data.length - break + insertions += data.length; + break; case DIFF_DELETE: - deletions += data.length - break + deletions += data.length; + break; case DIFF_EQUAL: // A deletion and an insertion is one substitution. - levenshtein += Math.max(insertions, deletions) - insertions = 0 - deletions = 0 - break + levenshtein += Math.max(insertions, deletions); + insertions = 0; + deletions = 0; + break; } } - levenshtein += Math.max(insertions, deletions) - return levenshtein -} + levenshtein += Math.max(insertions, deletions); + return levenshtein; +}; /** * Crush the diff into an encoded string which describes the operations @@ -1295,22 +1275,22 @@ diffMatchPatch.diff_levenshtein = function (diffs) { * @return {string} Delta text. */ diffMatchPatch.diff_toDelta = function (diffs) { - var text = [] + var text = []; for (var x = 0; x < diffs.length; x++) { switch (diffs[x][0]) { case DIFF_INSERT: - text[x] = '+' + encodeURI(diffs[x][1]) - break + text[x] = '+' + encodeURI(diffs[x][1]); + break; case DIFF_DELETE: - text[x] = '-' + diffs[x][1].length - break + text[x] = '-' + diffs[x][1].length; + break; case DIFF_EQUAL: - text[x] = '=' + diffs[x][1].length - break + text[x] = '=' + diffs[x][1].length; + break; } } - return text.join('\t').replace(/%20/g, ' ') -} + return text.join('\t').replace(/%20/g, ' '); +}; /** * Given the original text1, and an encoded string which describes the @@ -1321,52 +1301,50 @@ diffMatchPatch.diff_toDelta = function (diffs) { * @throws {!Error} If invalid input. */ diffMatchPatch.diff_fromDelta = function (text1, delta) { - var diffs = [] - var diffsLength = 0 // Keeping our own length var is faster in JS. - var pointer = 0 // Cursor in text1 - var tokens = delta.split(/\t/g) + var diffs = []; + var diffsLength = 0; // Keeping our own length var is faster in JS. + var pointer = 0; // Cursor in text1 + var tokens = delta.split(/\t/g); for (var x = 0; x < tokens.length; x++) { // Each token begins with a one character parameter which specifies the // operation of this token (delete, insert, equality). - var param = tokens[x].substring(1) + var param = tokens[x].substring(1); switch (tokens[x].charAt(0)) { case '+': try { - diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)] + diffs[diffsLength++] = [DIFF_INSERT, decodeURI(param)]; } catch (ex) { // Malformed URI sequence. - throw new Error('Illegal escape in diff_fromDelta: ' + param) + throw new Error('Illegal escape in diff_fromDelta: ' + param); } - break + break; case '-': - // Fall through. + // Fall through. case '=': - var n = parseInt(param, 10) + var n = parseInt(param, 10); if (isNaN(n) || n < 0) { - throw new Error('Invalid number in diff_fromDelta: ' + param) + throw new Error('Invalid number in diff_fromDelta: ' + param); } - var text = text1.substring(pointer, pointer += n) + var text = text1.substring(pointer, (pointer += n)); if (tokens[x].charAt(0) == '=') { - diffs[diffsLength++] = [DIFF_EQUAL, text] + diffs[diffsLength++] = [DIFF_EQUAL, text]; } else { - diffs[diffsLength++] = [DIFF_DELETE, text] + diffs[diffsLength++] = [DIFF_DELETE, text]; } - break + break; default: // Blank tokens are ok (from a trailing \t). // Anything else is an error. if (tokens[x]) { - throw new Error('Invalid diff operation in diff_fromDelta: ' + - tokens[x]) + throw new Error('Invalid diff operation in diff_fromDelta: ' + tokens[x]); } } } if (pointer != text1.length) { - throw new Error('Delta length (' + pointer + - ') does not equal source text length (' + text1.length + ').') + throw new Error('Delta length (' + pointer + ') does not equal source text length (' + text1.length + ').'); } - return diffs -} + return diffs; +}; // MATCH FUNCTIONS @@ -1380,24 +1358,24 @@ diffMatchPatch.diff_fromDelta = function (text1, delta) { diffMatchPatch.match_main = function (text, pattern, loc) { // Check for null inputs. if (text == null || pattern == null || loc == null) { - throw new Error('Null input. (match_main)') + throw new Error('Null input. (match_main)'); } - loc = Math.max(0, Math.min(loc, text.length)) + loc = Math.max(0, Math.min(loc, text.length)); if (text == pattern) { // Shortcut (potentially not guaranteed by the algorithm) - return 0 + return 0; } else if (!text.length) { // Nothing to match. - return -1 + return -1; } else if (text.substring(loc, loc + pattern.length) == pattern) { // Perfect match at the perfect spot! (Includes case of null pattern) - return loc + return loc; } else { // Do a fuzzy compare. - return this.match_bitap_(text, pattern, loc) + return this.match_bitap_(text, pattern, loc); } -} +}; /** * Locate the best instance of 'pattern' in 'text' near 'loc' using the @@ -1410,13 +1388,13 @@ diffMatchPatch.match_main = function (text, pattern, loc) { */ diffMatchPatch.match_bitap_ = function (text, pattern, loc) { if (pattern.length > this.Match_MaxBits) { - throw new Error('Pattern too long for this browser.') + throw new Error('Pattern too long for this browser.'); } // Initialise the alphabet. - var s = this.match_alphabet_(pattern) + var s = this.match_alphabet_(pattern); - var dmp = this // 'this' becomes 'window' in a closure. + var dmp = this; // 'this' becomes 'window' in a closure. /** * Compute and return the score for a match with e errors and x location. @@ -1426,95 +1404,94 @@ diffMatchPatch.match_bitap_ = function (text, pattern, loc) { * @return {number} Overall score for match (0.0 = good, 1.0 = bad). * @private */ - function match_bitapScore_ (e, x) { - var accuracy = e / pattern.length - var proximity = Math.abs(loc - x) + function match_bitapScore_(e, x) { + var accuracy = e / pattern.length; + var proximity = Math.abs(loc - x); if (!dmp.Match_Distance) { // Dodge divide by zero error. - return proximity ? 1.0 : accuracy + return proximity ? 1.0 : accuracy; } - return accuracy + (proximity / dmp.Match_Distance) + return accuracy + proximity / dmp.Match_Distance; } // Highest score beyond which we give up. - var score_threshold = this.Match_Threshold + var score_threshold = this.Match_Threshold; // Is there a nearby exact match? (speedup) - var best_loc = text.indexOf(pattern, loc) + var best_loc = text.indexOf(pattern, loc); if (best_loc != -1) { - score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold) + score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold); // What about in the other direction? (speedup) - best_loc = text.lastIndexOf(pattern, loc + pattern.length) + best_loc = text.lastIndexOf(pattern, loc + pattern.length); if (best_loc != -1) { - score_threshold = - Math.min(match_bitapScore_(0, best_loc), score_threshold) + score_threshold = Math.min(match_bitapScore_(0, best_loc), score_threshold); } } // Initialise the bit arrays. - var matchmask = 1 << (pattern.length - 1) - best_loc = -1 + var matchmask = 1 << (pattern.length - 1); + best_loc = -1; - var bin_min, bin_mid - var bin_max = pattern.length + text.length - var last_rd + var bin_min, bin_mid; + var bin_max = pattern.length + text.length; + var last_rd; for (var d = 0; d < pattern.length; d++) { // Scan for the best match; each iteration allows for one more error. // Run a binary search to determine how far from 'loc' we can stray at this // error level. - bin_min = 0 - bin_mid = bin_max + bin_min = 0; + bin_mid = bin_max; while (bin_min < bin_mid) { if (match_bitapScore_(d, loc + bin_mid) <= score_threshold) { - bin_min = bin_mid + bin_min = bin_mid; } else { - bin_max = bin_mid + bin_max = bin_mid; } - bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min) + bin_mid = Math.floor((bin_max - bin_min) / 2 + bin_min); } // Use the result from this iteration as the maximum for the next. - bin_max = bin_mid - var start = Math.max(1, loc - bin_mid + 1) - var finish = Math.min(loc + bin_mid, text.length) + pattern.length + bin_max = bin_mid; + var start = Math.max(1, loc - bin_mid + 1); + var finish = Math.min(loc + bin_mid, text.length) + pattern.length; - var rd = Array(finish + 2) - rd[finish + 1] = (1 << d) - 1 + var rd = Array(finish + 2); + rd[finish + 1] = (1 << d) - 1; for (var j = finish; j >= start; j--) { // The alphabet (s) is a sparse hash, so the following line generates // warnings. - var charMatch = s[text.charAt(j - 1)] - if (d === 0) { // First pass: exact match. - rd[j] = ((rd[j + 1] << 1) | 1) & charMatch - } else { // Subsequent passes: fuzzy match. - rd[j] = (((rd[j + 1] << 1) | 1) & charMatch) | - (((last_rd[j + 1] | last_rd[j]) << 1) | 1) | - last_rd[j + 1] + var charMatch = s[text.charAt(j - 1)]; + if (d === 0) { + // First pass: exact match. + rd[j] = ((rd[j + 1] << 1) | 1) & charMatch; + } else { + // Subsequent passes: fuzzy match. + rd[j] = (((rd[j + 1] << 1) | 1) & charMatch) | (((last_rd[j + 1] | last_rd[j]) << 1) | 1) | last_rd[j + 1]; } if (rd[j] & matchmask) { - var score = match_bitapScore_(d, j - 1) + var score = match_bitapScore_(d, j - 1); // This match will almost certainly be better than any existing match. // But check anyway. if (score <= score_threshold) { // Told you so. - score_threshold = score - best_loc = j - 1 + score_threshold = score; + best_loc = j - 1; if (best_loc > loc) { // When passing loc, don't exceed our current distance from loc. - start = Math.max(1, 2 * loc - best_loc) + start = Math.max(1, 2 * loc - best_loc); } else { // Already passed loc, downhill from here on in. - break + break; } } } } // No hope for a (better) match at greater error levels. if (match_bitapScore_(d + 1, loc) > score_threshold) { - break + break; } - last_rd = rd + last_rd = rd; } - return best_loc -} + return best_loc; +}; /** * Initialise the alphabet for the Bitap algorithm. @@ -1523,15 +1500,15 @@ diffMatchPatch.match_bitap_ = function (text, pattern, loc) { * @private */ diffMatchPatch.match_alphabet_ = function (pattern) { - var s = {} + var s = {}; for (let i = 0; i < pattern.length; i++) { - s[pattern.charAt(i)] = 0 + s[pattern.charAt(i)] = 0; } for (let i = 0; i < pattern.length; i++) { - s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1) + s[pattern.charAt(i)] |= 1 << (pattern.length - i - 1); } - return s -} + return s; +}; // PATCH FUNCTIONS @@ -1544,42 +1521,41 @@ diffMatchPatch.match_alphabet_ = function (pattern) { */ diffMatchPatch.patch_addContext_ = function (patch, text) { if (text.length == 0) { - return + return; } - var pattern = text.substring(patch.start2, patch.start2 + patch.length1) - var padding = 0 + var pattern = text.substring(patch.start2, patch.start2 + patch.length1); + var padding = 0; // Look for the first and last matches of pattern in text. If two different // matches are found, increase the pattern length. - while (text.indexOf(pattern) != text.lastIndexOf(pattern) && - pattern.length < this.Match_MaxBits - this.Patch_Margin - - this.Patch_Margin) { - padding += this.Patch_Margin - pattern = text.substring(patch.start2 - padding, - patch.start2 + patch.length1 + padding) + while ( + text.indexOf(pattern) != text.lastIndexOf(pattern) && + pattern.length < this.Match_MaxBits - this.Patch_Margin - this.Patch_Margin + ) { + padding += this.Patch_Margin; + pattern = text.substring(patch.start2 - padding, patch.start2 + patch.length1 + padding); } // Add one chunk for good luck. - padding += this.Patch_Margin + padding += this.Patch_Margin; // Add the prefix. - var prefix = text.substring(patch.start2 - padding, patch.start2) + var prefix = text.substring(patch.start2 - padding, patch.start2); if (prefix) { - patch.diffs.unshift([DIFF_EQUAL, prefix]) + patch.diffs.unshift([DIFF_EQUAL, prefix]); } // Add the suffix. - var suffix = text.substring(patch.start2 + patch.length1, - patch.start2 + patch.length1 + padding) + var suffix = text.substring(patch.start2 + patch.length1, patch.start2 + patch.length1 + padding); if (suffix) { - patch.diffs.push([DIFF_EQUAL, suffix]) + patch.diffs.push([DIFF_EQUAL, suffix]); } // Roll back the start points. - patch.start1 -= prefix.length - patch.start2 -= prefix.length + patch.start1 -= prefix.length; + patch.start2 -= prefix.length; // Extend the lengths. - patch.length1 += prefix.length + suffix.length - patch.length2 += prefix.length + suffix.length -} + patch.length1 += prefix.length + suffix.length; + patch.length2 += prefix.length + suffix.length; +}; /** * Compute a list of patches to turn text1 into text2. @@ -1604,116 +1580,109 @@ diffMatchPatch.patch_addContext_ = function (patch, text) { * @return {!Array.} Array of Patch objects. */ diffMatchPatch.patch_make = function (a, opt_b, opt_c) { - var text1, diffs - if (typeof a === 'string' && typeof opt_b === 'string' && - typeof opt_c === 'undefined') { + var text1, diffs; + if (typeof a === 'string' && typeof opt_b === 'string' && typeof opt_c === 'undefined') { // Method 1: text1, text2 // Compute diffs from text1 and text2. - text1 = /** @type {string} */(a) - diffs = this.diff_main(text1, /** @type {string} */(opt_b), true) + text1 = /** @type {string} */ (a); + diffs = this.diff_main(text1, /** @type {string} */ (opt_b), true); if (diffs.length > 2) { - this.diff_cleanupSemantic(diffs) - this.diff_cleanupEfficiency(diffs) + this.diff_cleanupSemantic(diffs); + this.diff_cleanupEfficiency(diffs); } - } else if (a && typeof a === 'object' && typeof opt_b === 'undefined' && - typeof opt_c === 'undefined') { + } else if (a && typeof a === 'object' && typeof opt_b === 'undefined' && typeof opt_c === 'undefined') { // Method 2: diffs // Compute text1 from diffs. - diffs = /** @type {!Array.} */(a) - text1 = this.diff_text1(diffs) - } else if (typeof a === 'string' && opt_b && typeof opt_b === 'object' && - typeof opt_c === 'undefined') { + diffs = /** @type {!Array.} */ (a); + text1 = this.diff_text1(diffs); + } else if (typeof a === 'string' && opt_b && typeof opt_b === 'object' && typeof opt_c === 'undefined') { // Method 3: text1, diffs - text1 = /** @type {string} */(a) - diffs = /** @type {!Array.} */(opt_b) - } else if (typeof a === 'string' && typeof opt_b === 'string' && - opt_c && typeof opt_c === 'object') { + text1 = /** @type {string} */ (a); + diffs = /** @type {!Array.} */ (opt_b); + } else if (typeof a === 'string' && typeof opt_b === 'string' && opt_c && typeof opt_c === 'object') { // Method 4: text1, text2, diffs // text2 is not used. - text1 = /** @type {string} */(a) - diffs = /** @type {!Array.} */(opt_c) + text1 = /** @type {string} */ (a); + diffs = /** @type {!Array.} */ (opt_c); } else { - throw new Error('Unknown call format to patch_make.') + throw new Error('Unknown call format to patch_make.'); } if (diffs.length === 0) { - return [] // Get rid of the null case. + return []; // Get rid of the null case. } - var patches = [] - var patch = new diffMatchPatch.patch_obj() - var patchDiffLength = 0 // Keeping our own length var is faster in JS. - var char_count1 = 0 // Number of characters into the text1 string. - var char_count2 = 0 // Number of characters into the text2 string. + var patches = []; + var patch = new diffMatchPatch.patch_obj(); + var patchDiffLength = 0; // Keeping our own length var is faster in JS. + var char_count1 = 0; // Number of characters into the text1 string. + var char_count2 = 0; // Number of characters into the text2 string. // Start with text1 (prepatch_text) and apply the diffs until we arrive at // text2 (postpatch_text). We recreate the patches one by one to determine // context info. - var prepatch_text = text1 - var postpatch_text = text1 + var prepatch_text = text1; + var postpatch_text = text1; for (var x = 0; x < diffs.length; x++) { - var diff_type = diffs[x][0] - var diff_text = diffs[x][1] + var diff_type = diffs[x][0]; + var diff_text = diffs[x][1]; if (!patchDiffLength && diff_type !== DIFF_EQUAL) { // A new patch starts here. - patch.start1 = char_count1 - patch.start2 = char_count2 + patch.start1 = char_count1; + patch.start2 = char_count2; } switch (diff_type) { case DIFF_INSERT: - patch.diffs[patchDiffLength++] = diffs[x] - patch.length2 += diff_text.length - postpatch_text = postpatch_text.substring(0, char_count2) + diff_text + - postpatch_text.substring(char_count2) - break + patch.diffs[patchDiffLength++] = diffs[x]; + patch.length2 += diff_text.length; + postpatch_text = postpatch_text.substring(0, char_count2) + diff_text + postpatch_text.substring(char_count2); + break; case DIFF_DELETE: - patch.length1 += diff_text.length - patch.diffs[patchDiffLength++] = diffs[x] - postpatch_text = postpatch_text.substring(0, char_count2) + - postpatch_text.substring(char_count2 + - diff_text.length) - break + patch.length1 += diff_text.length; + patch.diffs[patchDiffLength++] = diffs[x]; + postpatch_text = + postpatch_text.substring(0, char_count2) + postpatch_text.substring(char_count2 + diff_text.length); + break; case DIFF_EQUAL: - if (diff_text.length <= 2 * this.Patch_Margin && - patchDiffLength && diffs.length != x + 1) { + if (diff_text.length <= 2 * this.Patch_Margin && patchDiffLength && diffs.length != x + 1) { // Small equality inside a patch. - patch.diffs[patchDiffLength++] = diffs[x] - patch.length1 += diff_text.length - patch.length2 += diff_text.length + patch.diffs[patchDiffLength++] = diffs[x]; + patch.length1 += diff_text.length; + patch.length2 += diff_text.length; } else if (diff_text.length >= 2 * this.Patch_Margin) { // Time for a new patch. if (patchDiffLength) { - this.patch_addContext_(patch, prepatch_text) - patches.push(patch) - patch = new diffMatchPatch.patch_obj() - patchDiffLength = 0 + this.patch_addContext_(patch, prepatch_text); + patches.push(patch); + patch = new diffMatchPatch.patch_obj(); + patchDiffLength = 0; // Unlike Unidiff, our patch lists have a rolling context. // http://code.google.com/p/google-diff-match-patch/wiki/Unidiff // Update prepatch text & pos to reflect the application of the // just completed patch. - prepatch_text = postpatch_text - char_count1 = char_count2 + prepatch_text = postpatch_text; + char_count1 = char_count2; } } - break + break; } // Update the current character count. if (diff_type !== DIFF_INSERT) { - char_count1 += diff_text.length + char_count1 += diff_text.length; } if (diff_type !== DIFF_DELETE) { - char_count2 += diff_text.length + char_count2 += diff_text.length; } } // Pick up the leftover patch if not empty. if (patchDiffLength) { - this.patch_addContext_(patch, prepatch_text) - patches.push(patch) + this.patch_addContext_(patch, prepatch_text); + patches.push(patch); } - return patches -} + return patches; +}; /** * Given an array of patches, return another array that is identical. @@ -1722,22 +1691,22 @@ diffMatchPatch.patch_make = function (a, opt_b, opt_c) { */ diffMatchPatch.patch_deepCopy = function (patches) { // Making deep copies is hard in JavaScript. - var patchesCopy = [] + var patchesCopy = []; for (var x = 0; x < patches.length; x++) { - var patch = patches[x] - var patchCopy = new diffMatchPatch.patch_obj() - patchCopy.diffs = [] + var patch = patches[x]; + var patchCopy = new diffMatchPatch.patch_obj(); + patchCopy.diffs = []; for (var y = 0; y < patch.diffs.length; y++) { - patchCopy.diffs[y] = patch.diffs[y].slice() + patchCopy.diffs[y] = patch.diffs[y].slice(); } - patchCopy.start1 = patch.start1 - patchCopy.start2 = patch.start2 - patchCopy.length1 = patch.length1 - patchCopy.length2 = patch.length2 - patchesCopy[x] = patchCopy + patchCopy.start1 = patch.start1; + patchCopy.start2 = patch.start2; + patchCopy.length1 = patch.length1; + patchCopy.length2 = patch.length2; + patchesCopy[x] = patchCopy; } - return patchesCopy -} + return patchesCopy; +}; /** * Merge a set of patches onto the text. Return a patched text, as well @@ -1749,92 +1718,94 @@ diffMatchPatch.patch_deepCopy = function (patches) { */ diffMatchPatch.patch_apply = function (patches, text) { if (patches.length == 0) { - return [text, []] + return [text, []]; } // Deep copy the patches so that no changes are made to originals. - patches = this.patch_deepCopy(patches) + patches = this.patch_deepCopy(patches); - var nullPadding = this.patch_addPadding(patches) - text = nullPadding + text + nullPadding + var nullPadding = this.patch_addPadding(patches); + text = nullPadding + text + nullPadding; - this.patch_splitMax(patches) + this.patch_splitMax(patches); // delta keeps track of the offset between the expected and actual location // of the previous patch. If there are patches expected at positions 10 and // 20, but the first patch was found at 12, delta is 2 and the second patch // has an effective expected position of 22. - var delta = 0 - var results = [] + var delta = 0; + var results = []; for (var x = 0; x < patches.length; x++) { - var expected_loc = patches[x].start2 + delta - var text1 = this.diff_text1(patches[x].diffs) - var start_loc - var end_loc = -1 + var expected_loc = patches[x].start2 + delta; + var text1 = this.diff_text1(patches[x].diffs); + var start_loc; + var end_loc = -1; if (text1.length > this.Match_MaxBits) { // patch_splitMax will only provide an oversized pattern in the case of // a monster delete. - start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits), - expected_loc) + start_loc = this.match_main(text, text1.substring(0, this.Match_MaxBits), expected_loc); if (start_loc != -1) { - end_loc = this.match_main(text, + end_loc = this.match_main( + text, text1.substring(text1.length - this.Match_MaxBits), - expected_loc + text1.length - this.Match_MaxBits) + expected_loc + text1.length - this.Match_MaxBits + ); if (end_loc == -1 || start_loc >= end_loc) { // Can't find valid trailing context. Drop this patch. - start_loc = -1 + start_loc = -1; } } } else { - start_loc = this.match_main(text, text1, expected_loc) + start_loc = this.match_main(text, text1, expected_loc); } if (start_loc == -1) { // No match found. :( - results[x] = false + results[x] = false; // Subtract the delta for this failed patch from subsequent patches. - delta -= patches[x].length2 - patches[x].length1 + delta -= patches[x].length2 - patches[x].length1; } else { // Found a match. :) - results[x] = true - delta = start_loc - expected_loc - var text2 + results[x] = true; + delta = start_loc - expected_loc; + var text2; if (end_loc == -1) { - text2 = text.substring(start_loc, start_loc + text1.length) + text2 = text.substring(start_loc, start_loc + text1.length); } else { - text2 = text.substring(start_loc, end_loc + this.Match_MaxBits) + text2 = text.substring(start_loc, end_loc + this.Match_MaxBits); } if (text1 == text2) { // Perfect match, just shove the replacement text in. - text = text.substring(0, start_loc) + - this.diff_text2(patches[x].diffs) + - text.substring(start_loc + text1.length) + text = + text.substring(0, start_loc) + this.diff_text2(patches[x].diffs) + text.substring(start_loc + text1.length); } else { // Imperfect match. Run a diff to get a framework of equivalent // indices. - var diffs = this.diff_main(text1, text2, false) - if (text1.length > this.Match_MaxBits && - this.diff_levenshtein(diffs) / text1.length > - this.Patch_DeleteThreshold) { + var diffs = this.diff_main(text1, text2, false); + if ( + text1.length > this.Match_MaxBits && + this.diff_levenshtein(diffs) / text1.length > this.Patch_DeleteThreshold + ) { // The end points match, but the content is unacceptably bad. - results[x] = false + results[x] = false; } else { - this.diff_cleanupSemanticLossless(diffs) - var index1 = 0 - var index2 + this.diff_cleanupSemanticLossless(diffs); + var index1 = 0; + var index2; for (var y = 0; y < patches[x].diffs.length; y++) { - var mod = patches[x].diffs[y] + var mod = patches[x].diffs[y]; if (mod[0] !== DIFF_EQUAL) { - index2 = this.diff_xIndex(diffs, index1) + index2 = this.diff_xIndex(diffs, index1); } - if (mod[0] === DIFF_INSERT) { // Insertion - text = text.substring(0, start_loc + index2) + mod[1] + - text.substring(start_loc + index2) - } else if (mod[0] === DIFF_DELETE) { // Deletion - text = text.substring(0, start_loc + index2) + - text.substring(start_loc + this.diff_xIndex(diffs, - index1 + mod[1].length)) + if (mod[0] === DIFF_INSERT) { + // Insertion + text = text.substring(0, start_loc + index2) + mod[1] + text.substring(start_loc + index2); + } else if (mod[0] === DIFF_DELETE) { + // Deletion + text = + text.substring(0, start_loc + index2) + + text.substring(start_loc + this.diff_xIndex(diffs, index1 + mod[1].length)); } if (mod[0] !== DIFF_DELETE) { - index1 += mod[1].length + index1 += mod[1].length; } } } @@ -1842,9 +1813,9 @@ diffMatchPatch.patch_apply = function (patches, text) { } } // Strip the padding off. - text = text.substring(nullPadding.length, text.length - nullPadding.length) - return [text, results] -} + text = text.substring(nullPadding.length, text.length - nullPadding.length); + return [text, results]; +}; /** * Add some padding on text start and end so that edges can match something. @@ -1853,56 +1824,56 @@ diffMatchPatch.patch_apply = function (patches, text) { * @return {string} The padding string added to each side. */ diffMatchPatch.patch_addPadding = function (patches) { - var paddingLength = this.Patch_Margin - var nullPadding = '' + var paddingLength = this.Patch_Margin; + var nullPadding = ''; for (let x = 1; x <= paddingLength; x++) { - nullPadding += String.fromCharCode(x) + nullPadding += String.fromCharCode(x); } // Bump all the patches forward. for (let x = 0; x < patches.length; x++) { - patches[x].start1 += paddingLength - patches[x].start2 += paddingLength + patches[x].start1 += paddingLength; + patches[x].start2 += paddingLength; } // Add some padding on start of first diff. - var patch = patches[0] - var diffs = patch.diffs + var patch = patches[0]; + var diffs = patch.diffs; if (diffs.length == 0 || diffs[0][0] != DIFF_EQUAL) { // Add nullPadding equality. - diffs.unshift([DIFF_EQUAL, nullPadding]) - patch.start1 -= paddingLength // Should be 0. - patch.start2 -= paddingLength // Should be 0. - patch.length1 += paddingLength - patch.length2 += paddingLength + diffs.unshift([DIFF_EQUAL, nullPadding]); + patch.start1 -= paddingLength; // Should be 0. + patch.start2 -= paddingLength; // Should be 0. + patch.length1 += paddingLength; + patch.length2 += paddingLength; } else if (paddingLength > diffs[0][1].length) { // Grow first equality. - let extraLength = paddingLength - diffs[0][1].length - diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1] - patch.start1 -= extraLength - patch.start2 -= extraLength - patch.length1 += extraLength - patch.length2 += extraLength + let extraLength = paddingLength - diffs[0][1].length; + diffs[0][1] = nullPadding.substring(diffs[0][1].length) + diffs[0][1]; + patch.start1 -= extraLength; + patch.start2 -= extraLength; + patch.length1 += extraLength; + patch.length2 += extraLength; } // Add some padding on end of last diff. - patch = patches[patches.length - 1] - diffs = patch.diffs + patch = patches[patches.length - 1]; + diffs = patch.diffs; if (diffs.length == 0 || diffs[diffs.length - 1][0] != DIFF_EQUAL) { // Add nullPadding equality. - diffs.push([DIFF_EQUAL, nullPadding]) - patch.length1 += paddingLength - patch.length2 += paddingLength + diffs.push([DIFF_EQUAL, nullPadding]); + patch.length1 += paddingLength; + patch.length2 += paddingLength; } else if (paddingLength > diffs[diffs.length - 1][1].length) { // Grow last equality. - let extraLength = paddingLength - diffs[diffs.length - 1][1].length - diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength) - patch.length1 += extraLength - patch.length2 += extraLength + let extraLength = paddingLength - diffs[diffs.length - 1][1].length; + diffs[diffs.length - 1][1] += nullPadding.substring(0, extraLength); + patch.length1 += extraLength; + patch.length2 += extraLength; } - return nullPadding -} + return nullPadding; +}; /** * Look through the patches and break up any which are longer than the maximum @@ -1911,90 +1882,87 @@ diffMatchPatch.patch_addPadding = function (patches) { * @param {!Array.} patches Array of Patch objects. */ diffMatchPatch.patch_splitMax = function (patches) { - var patch_size = this.Match_MaxBits + var patch_size = this.Match_MaxBits; for (var x = 0; x < patches.length; x++) { if (patches[x].length1 <= patch_size) { - continue + continue; } - var bigpatch = patches[x] + var bigpatch = patches[x]; // Remove the big old patch. - patches.splice(x--, 1) - var start1 = bigpatch.start1 - var start2 = bigpatch.start2 - var precontext = '' + patches.splice(x--, 1); + var start1 = bigpatch.start1; + var start2 = bigpatch.start2; + var precontext = ''; while (bigpatch.diffs.length !== 0) { // Create one of several smaller patches. - var patch = new diffMatchPatch.patch_obj() - var empty = true - patch.start1 = start1 - precontext.length - patch.start2 = start2 - precontext.length + var patch = new diffMatchPatch.patch_obj(); + var empty = true; + patch.start1 = start1 - precontext.length; + patch.start2 = start2 - precontext.length; if (precontext !== '') { - patch.length1 = patch.length2 = precontext.length - patch.diffs.push([DIFF_EQUAL, precontext]) + patch.length1 = patch.length2 = precontext.length; + patch.diffs.push([DIFF_EQUAL, precontext]); } - while (bigpatch.diffs.length !== 0 && - patch.length1 < patch_size - this.Patch_Margin) { - var diff_type = bigpatch.diffs[0][0] - var diff_text = bigpatch.diffs[0][1] + while (bigpatch.diffs.length !== 0 && patch.length1 < patch_size - this.Patch_Margin) { + var diff_type = bigpatch.diffs[0][0]; + var diff_text = bigpatch.diffs[0][1]; if (diff_type === DIFF_INSERT) { // Insertions are harmless. - patch.length2 += diff_text.length - start2 += diff_text.length - patch.diffs.push(bigpatch.diffs.shift()) - empty = false - } else if (diff_type === DIFF_DELETE && patch.diffs.length == 1 && - patch.diffs[0][0] == DIFF_EQUAL && - diff_text.length > 2 * patch_size) { + patch.length2 += diff_text.length; + start2 += diff_text.length; + patch.diffs.push(bigpatch.diffs.shift()); + empty = false; + } else if ( + diff_type === DIFF_DELETE && + patch.diffs.length == 1 && + patch.diffs[0][0] == DIFF_EQUAL && + diff_text.length > 2 * patch_size + ) { // This is a large deletion. Let it pass in one chunk. - patch.length1 += diff_text.length - start1 += diff_text.length - empty = false - patch.diffs.push([diff_type, diff_text]) - bigpatch.diffs.shift() + patch.length1 += diff_text.length; + start1 += diff_text.length; + empty = false; + patch.diffs.push([diff_type, diff_text]); + bigpatch.diffs.shift(); } else { // Deletion or equality. Only take as much as we can stomach. - diff_text = diff_text.substring(0, - patch_size - patch.length1 - this.Patch_Margin) - patch.length1 += diff_text.length - start1 += diff_text.length + diff_text = diff_text.substring(0, patch_size - patch.length1 - this.Patch_Margin); + patch.length1 += diff_text.length; + start1 += diff_text.length; if (diff_type === DIFF_EQUAL) { - patch.length2 += diff_text.length - start2 += diff_text.length + patch.length2 += diff_text.length; + start2 += diff_text.length; } else { - empty = false + empty = false; } - patch.diffs.push([diff_type, diff_text]) + patch.diffs.push([diff_type, diff_text]); if (diff_text == bigpatch.diffs[0][1]) { - bigpatch.diffs.shift() + bigpatch.diffs.shift(); } else { - bigpatch.diffs[0][1] = - bigpatch.diffs[0][1].substring(diff_text.length) + bigpatch.diffs[0][1] = bigpatch.diffs[0][1].substring(diff_text.length); } } } // Compute the head context for the next patch. - precontext = this.diff_text2(patch.diffs) - precontext = - precontext.substring(precontext.length - this.Patch_Margin) + precontext = this.diff_text2(patch.diffs); + precontext = precontext.substring(precontext.length - this.Patch_Margin); // Append the end context for this patch. - var postcontext = this.diff_text1(bigpatch.diffs) - .substring(0, this.Patch_Margin) + var postcontext = this.diff_text1(bigpatch.diffs).substring(0, this.Patch_Margin); if (postcontext !== '') { - patch.length1 += postcontext.length - patch.length2 += postcontext.length - if (patch.diffs.length !== 0 && - patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) { - patch.diffs[patch.diffs.length - 1][1] += postcontext + patch.length1 += postcontext.length; + patch.length2 += postcontext.length; + if (patch.diffs.length !== 0 && patch.diffs[patch.diffs.length - 1][0] === DIFF_EQUAL) { + patch.diffs[patch.diffs.length - 1][1] += postcontext; } else { - patch.diffs.push([DIFF_EQUAL, postcontext]) + patch.diffs.push([DIFF_EQUAL, postcontext]); } } if (!empty) { - patches.splice(++x, 0, patch) + patches.splice(++x, 0, patch); } } } -} +}; /** * Take a list of patches and return a textual representation. @@ -2002,12 +1970,12 @@ diffMatchPatch.patch_splitMax = function (patches) { * @return {string} Text representation of patches. */ diffMatchPatch.patch_toText = function (patches) { - var text = [] + var text = []; for (var x = 0; x < patches.length; x++) { - text[x] = patches[x] + text[x] = patches[x]; } - return text.join('') -} + return text.join(''); +}; /** * Parse a textual representation of patches and return a list of Patch objects. @@ -2016,74 +1984,74 @@ diffMatchPatch.patch_toText = function (patches) { * @throws {!Error} If invalid input. */ diffMatchPatch.patch_fromText = function (textline) { - var patches = [] + var patches = []; if (!textline) { - return patches + return patches; } - var text = textline.split('\n') - var textPointer = 0 - var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/ + var text = textline.split('\n'); + var textPointer = 0; + var patchHeader = /^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/; while (textPointer < text.length) { - var m = text[textPointer].match(patchHeader) + var m = text[textPointer].match(patchHeader); if (!m) { - throw new Error('Invalid patch string: ' + text[textPointer]) + throw new Error('Invalid patch string: ' + text[textPointer]); } - var patch = new diffMatchPatch.patch_obj() - patches.push(patch) - patch.start1 = parseInt(m[1], 10) + var patch = new diffMatchPatch.patch_obj(); + patches.push(patch); + patch.start1 = parseInt(m[1], 10); if (m[2] === '') { - patch.start1-- - patch.length1 = 1 + patch.start1--; + patch.length1 = 1; } else if (m[2] == '0') { - patch.length1 = 0 + patch.length1 = 0; } else { - patch.start1-- - patch.length1 = parseInt(m[2], 10) + patch.start1--; + patch.length1 = parseInt(m[2], 10); } - patch.start2 = parseInt(m[3], 10) + patch.start2 = parseInt(m[3], 10); if (m[4] === '') { - patch.start2-- - patch.length2 = 1 + patch.start2--; + patch.length2 = 1; } else if (m[4] == '0') { - patch.length2 = 0 + patch.length2 = 0; } else { - patch.start2-- - patch.length2 = parseInt(m[4], 10) + patch.start2--; + patch.length2 = parseInt(m[4], 10); } - textPointer++ + textPointer++; while (textPointer < text.length) { - var sign = text[textPointer].charAt(0) + var sign = text[textPointer].charAt(0); try { - var line = decodeURI(text[textPointer].substring(1)) + var line = decodeURI(text[textPointer].substring(1)); } catch (ex) { // Malformed URI sequence. - throw new Error('Illegal escape in patch_fromText: ' + line) + throw new Error('Illegal escape in patch_fromText: ' + line); } if (sign == '-') { // Deletion. - patch.diffs.push([DIFF_DELETE, line]) + patch.diffs.push([DIFF_DELETE, line]); } else if (sign == '+') { // Insertion. - patch.diffs.push([DIFF_INSERT, line]) + patch.diffs.push([DIFF_INSERT, line]); } else if (sign == ' ') { // Minor equality. - patch.diffs.push([DIFF_EQUAL, line]) + patch.diffs.push([DIFF_EQUAL, line]); } else if (sign == '@') { // Start of next patch. - break + break; } else if (sign === '') { // Blank line? Whatever. } else { // WTF? - throw new Error('Invalid patch mode "' + sign + '" in: ' + line) + throw new Error('Invalid patch mode "' + sign + '" in: ' + line); } - textPointer++ + textPointer++; } } - return patches -} + return patches; +}; /** * Class representing one patch operation. @@ -2091,16 +2059,16 @@ diffMatchPatch.patch_fromText = function (textline) { */ diffMatchPatch.patch_obj = function () { /** @type {!Array.} */ - this.diffs = [] + this.diffs = []; /** @type {?number} */ - this.start1 = null + this.start1 = null; /** @type {?number} */ - this.start2 = null + this.start2 = null; /** @type {number} */ - this.length1 = 0 + this.length1 = 0; /** @type {number} */ - this.length2 = 0 -} + this.length2 = 0; +}; /** * Emmulate GNU diff's format. @@ -2109,40 +2077,40 @@ diffMatchPatch.patch_obj = function () { * @return {string} The GNU diff string. */ diffMatchPatch.patch_obj.toString = function () { - var coords1, coords2 + var coords1, coords2; if (this.length1 === 0) { - coords1 = this.start1 + ',0' + coords1 = this.start1 + ',0'; } else if (this.length1 == 1) { - coords1 = this.start1 + 1 + coords1 = this.start1 + 1; } else { - coords1 = (this.start1 + 1) + ',' + this.length1 + coords1 = this.start1 + 1 + ',' + this.length1; } if (this.length2 === 0) { - coords2 = this.start2 + ',0' + coords2 = this.start2 + ',0'; } else if (this.length2 == 1) { - coords2 = this.start2 + 1 + coords2 = this.start2 + 1; } else { - coords2 = (this.start2 + 1) + ',' + this.length2 + coords2 = this.start2 + 1 + ',' + this.length2; } - var text = ['@@ -' + coords1 + ' +' + coords2 + ' @@\n'] - var op + var text = ['@@ -' + coords1 + ' +' + coords2 + ' @@\n']; + var op; // Escape the body of the patch with %xx notation. for (var x = 0; x < this.diffs.length; x++) { switch (this.diffs[x][0]) { case DIFF_INSERT: - op = '+' - break + op = '+'; + break; case DIFF_DELETE: - op = '-' - break + op = '-'; + break; case DIFF_EQUAL: - op = ' ' - break + op = ' '; + break; } - text[x + 1] = op + encodeURI(this.diffs[x][1]) + '\n' + text[x + 1] = op + encodeURI(this.diffs[x][1]) + '\n'; } - return text.join('').replace(/%20/g, ' ') -} + return text.join('').replace(/%20/g, ' '); +}; // Export these global variables so that they survive Google's JS compiler. // In a browser, 'this' will be 'window'. @@ -2155,4 +2123,4 @@ this['DIFF_INSERT'] = DIFF_INSERT; this['DIFF_EQUAL'] = DIFF_EQUAL; */ -export { diffMatchPatch, DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL } +export { diffMatchPatch, DIFF_DELETE, DIFF_INSERT, DIFF_EQUAL }; diff --git a/tools/extract-messages.js b/tools/extract-messages.js index 48c71a342c..e8e232c53b 100644 --- a/tools/extract-messages.js +++ b/tools/extract-messages.js @@ -40,11 +40,11 @@ function Result(msgctxt, msgid) { this.files = {}; // fake hastable } -Result.prototype.addFile = function(file) { +Result.prototype.addFile = function (file) { this.files[file] = null; }; -Result.prototype.toString = function() { +Result.prototype.toString = function () { let result = '#: ' + Object.keys(this.files).sort().join('\n#: ') + '\n'; result += this.msgctxt ? `msgctxt "${this.msgctxt}"\n` : ''; @@ -60,7 +60,7 @@ function Process() { this.includeLineNumberInPositions = false; } -Process.prototype.push = function(file, line, msgctxt, msgid) { +Process.prototype.push = function (file, line, msgctxt, msgid) { // trim msgid = msgid.replace(/^[\r\n\s]*/g, ''); msgid = msgid.replace(/[\r\n\s]*$/g, ''); @@ -79,18 +79,18 @@ Process.prototype.push = function(file, line, msgctxt, msgid) { this.data[key].addFile(position); }; -Process.prototype.addVueComponent = function(file, data) { +Process.prototype.addVueComponent = function (file, data) { this.parseTemplate(file, data); this.parseScript(file, data, gettext_template1); this.parseScript(file, data, gettext_template2); }; -Process.prototype.addScript = function(file, data) { +Process.prototype.addScript = function (file, data) { this.parseScript(file, data, gettext_template1); this.parseScript(file, data, gettext_template2); }; -Process.prototype.parseScript = function(file, data, regex) { +Process.prototype.parseScript = function (file, data, regex) { let msgData; const lines = data.split('\n'); @@ -100,12 +100,12 @@ Process.prototype.parseScript = function(file, data, regex) { const msgid = msgData[1]; const msgctxt = msgData[2]; - this.push(file, i + 1, msgctxt, msgid.replace(/\\'/g, '\'')); + this.push(file, i + 1, msgctxt, msgid.replace(/\\'/g, "'")); } } }; -Process.prototype.parseTemplate = function(file, data) { +Process.prototype.parseTemplate = function (file, data) { // we need line number, but compiler does not provide it. // let use a trick : we do not use directive argument, so // we will modifiy our script by adding v-translate:N @@ -125,7 +125,7 @@ Process.prototype.parseTemplate = function(file, data) { return; } - const parseTranslateDirective = function(node, directiveMeta) { + const parseTranslateDirective = function (node, directiveMeta) { const line = directiveMeta.arg; // the trick: arg is the line number let msgctxt; @@ -150,12 +150,12 @@ Process.prototype.parseTemplate = function(file, data) { compiler.compile(template[1], { preserveWhitespace: false, directives: { - translate: parseTranslateDirective.bind(this) - } + translate: parseTranslateDirective.bind(this), + }, }); }; -Process.prototype.compute = function(file_or_dir) { +Process.prototype.compute = function (file_or_dir) { if (fs.statSync(file_or_dir).isDirectory()) { const files = fs.readdirSync(file_or_dir); @@ -171,7 +171,7 @@ Process.prototype.compute = function(file_or_dir) { } }; -Process.prototype.save = function(potFile) { +Process.prototype.save = function (potFile) { const result = []; for (const key of Object.keys(this.data).sort()) { diff --git a/tools/generate-health.js b/tools/generate-health.js index fb577a9a5b..a7fd477348 100644 --- a/tools/generate-health.js +++ b/tools/generate-health.js @@ -13,7 +13,7 @@ async function main() { await promisify(fs.writeFile)(path.resolve(__dirname, '../dist', 'health.json'), content); } -main().catch(err => { +main().catch((err) => { if (err) { throw err; } diff --git a/tools/generate-icons.js b/tools/generate-icons.js index a552aee94e..7aadad1373 100644 --- a/tools/generate-icons.js +++ b/tools/generate-icons.js @@ -1,11 +1,13 @@ -const fs = require('fs') -const path = require('path') -const parser = require('xml2js') +const fs = require('fs'); +const path = require('path'); +const parser = require('xml2js'); -const HEADER = '// Auto-generated file by generate-icons.js\n/* eslint-disable */\n\n' +const HEADER = '// Auto-generated file by generate-icons.js\n\n'; -const getJsTemplate = function(prefix, name, width, height, svgPathData) { - return HEADER + ` +const getJsTemplate = function (prefix, name, width, height, svgPathData) { + return ( + HEADER + + ` export default { prefix: '${prefix}', iconName: '${name}', @@ -17,67 +19,65 @@ export default { '${svgPathData}' ] }` -} + ); +}; -const getIndexDotJsFileContent = function(names) { - const imports = names.map(name => `import ${name} from "./${name}"`) +const getIndexDotJsFileContent = function (names) { + const imports = names.map((name) => `import ${name} from "./${name}"`); - return HEADER + imports.join('\n') + '\n\nexport {\n ' + names.join(',\n ') + '\n}' -} + return HEADER + imports.join('\n') + '\n\nexport {\n ' + names.join(',\n ') + '\n}'; +}; -const isDirectory = source => fs.lstatSync(source).isDirectory() +const isDirectory = (source) => fs.lstatSync(source).isDirectory(); function main() { - const root = 'src/assets/font-awesome-custom/' + const root = 'src/assets/font-awesome-custom/'; - for (let subDir of fs.readdirSync(root + 'svg')) { - if (isDirectory(path.join(root + 'svg', subDir))) { - const names = [] + for (let subDir of fs.readdirSync(root + 'svg')) { + if (isDirectory(path.join(root + 'svg', subDir))) { + const names = []; - if (!fs.existsSync(root + 'js/' + subDir)) { - fs.mkdirSync(root + 'js/' + subDir) - } + if (!fs.existsSync(root + 'js/' + subDir)) { + fs.mkdirSync(root + 'js/' + subDir); + } - for (let file of fs.readdirSync(root + 'svg/' + subDir)) { - if (file.endsWith('.svg')) { - names.push(file.replace('.svg', '')) + for (let file of fs.readdirSync(root + 'svg/' + subDir)) { + if (file.endsWith('.svg')) { + names.push(file.replace('.svg', '')); - fs.readFile(root + 'svg/' + subDir + '/' + file, function(err, data) { - if (err) { - console.error('Fail: ' + err) - } - parser.parseString(data, function(err, result) { - if (err) { - console.error('Fail: ' + err) - } - const name = file.replace('.svg', '') - - if (result && result.svg && result.svg.path) { - fs.writeFileSync(root + 'js/' + subDir + '/' + name + '.js', getJsTemplate( - subDir, - name, - result.svg.$.width, - result.svg.$.height, - result.svg.path[0].$.d - )) - console.log('Done', subDir, name) - } else { - fs.writeFileSync(root + 'js/' + subDir + '/' + name + '.js', 'export default {}') - console.error('Fail', subDir, name) - } - }) - }) - } + fs.readFile(root + 'svg/' + subDir + '/' + file, function (err, data) { + if (err) { + console.error('Fail: ' + err); } + parser.parseString(data, function (err, result) { + if (err) { + console.error('Fail: ' + err); + } + const name = file.replace('.svg', ''); - fs.writeFileSync(root + 'js/' + subDir + '/index.js', getIndexDotJsFileContent(names)) + if (result && result.svg && result.svg.path) { + fs.writeFileSync( + root + 'js/' + subDir + '/' + name + '.js', + getJsTemplate(subDir, name, result.svg.$.width, result.svg.$.height, result.svg.path[0].$.d) + ); + console.log('Done', subDir, name); + } else { + fs.writeFileSync(root + 'js/' + subDir + '/' + name + '.js', 'export default {}'); + console.error('Fail', subDir, name); + } + }); + }); } + } + + fs.writeFileSync(root + 'js/' + subDir + '/index.js', getIndexDotJsFileContent(names)); } + } } // If running this module directly then call the main function. if (require.main === module) { - main() + main(); } -module.exports = main +module.exports = main; diff --git a/vue.config.js b/vue.config.js index c23b957759..a385d329df 100644 --- a/vue.config.js +++ b/vue.config.js @@ -25,7 +25,6 @@ const result = { }, configureWebpack: { - performance: { hints: 'error', // TODO sizes checks are on compiled files, instead of GZIP sizes @@ -54,15 +53,15 @@ const result = { } return true; - } + }, }, plugins: [ // moment, by default load all locales // this will skip all of it, and a fixed list is setted in @/tools/vue-moment.js', - new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/) - ] - } + new webpack.IgnorePlugin(/^\.\/locale$/, /moment$/), + ], + }, }; /* Please not that all key present in this file are public keys @@ -84,7 +83,7 @@ const config = { media: 'https://sos.exo.io/c2corg-demov6-active', imageBackend: 'https://images.demov6.camptocamp.org', forum: 'https://forum.demov6.camptocamp.org', - recaptchaKey: '6LfWUwoUAAAAAAxud1qqok6wOJJlCUsYXxHizRhc' + recaptchaKey: '6LfWUwoUAAAAAAxud1qqok6wOJJlCUsYXxHizRhc', }, prod: { name: 'prod', @@ -92,16 +91,16 @@ const config = { media: 'https://media.camptocamp.org/c2corg_active', imageBackend: 'https://images.camptocamp.org', forum: 'https://forum.camptocamp.org', - recaptchaKey: '6Lc9Cw4UAAAAAIKnlar0AOsGX_P5S-bk9u8viuo2' - } - } + recaptchaKey: '6Lc9Cw4UAAAAAIKnlar0AOsGX_P5S-bk9u8viuo2', + }, + }, }; config.urls = config.urlsConfigurations.prod; // default : prod const bundleAnalyzerConfig = { analyzerMode: 'disabled', - openAnalyzer: false + openAnalyzer: false, }; if (process.env.BUILD_ENV === 'local' || process.env.BUILD_ENV === undefined) { @@ -111,7 +110,7 @@ if (process.env.BUILD_ENV === 'local' || process.env.BUILD_ENV === undefined) { api: 'http://localhost:6543', media: 'https://sos.exo.io/c2corg-demov6-active', imageBackend: 'https://images.demov6.camptocamp.org', - forum: 'https://forum.demov6.camptocamp.org' + forum: 'https://forum.demov6.camptocamp.org', }; config.ignApiKey = 'hzuh5yjuto8lqbqs2njo0che'; // Key valid for localhost (Expires 08/11/2019) @@ -155,13 +154,11 @@ if (process.env.BUILD_ENV === 'local' || process.env.BUILD_ENV === undefined) { config.publicPath = result.publicPath; -result.configureWebpack.plugins.push( - new BundleAnalyzerPlugin(bundleAnalyzerConfig) -); +result.configureWebpack.plugins.push(new BundleAnalyzerPlugin(bundleAnalyzerConfig)); result.configureWebpack.plugins.push( new webpack.DefinePlugin({ - CAMPTOCAMP_CONFIG: JSON.stringify(config) + CAMPTOCAMP_CONFIG: JSON.stringify(config), }) );