From f2a25d3c9187eb215ef70c2989f5b24b8361add8 Mon Sep 17 00:00:00 2001 From: David Larlet Date: Mon, 25 Sep 2023 11:42:03 -0400 Subject: [PATCH] Switch to curly style for if/else statements --- .prettierrc.yaml | 6 +- package-lock.json | 724 ++++++++++++++++++ package.json | 1 + umap/static/umap/js/umap.autocomplete.js | 22 +- umap/static/umap/js/umap.controls.js | 143 +++- umap/static/umap/js/umap.core.js | 172 +++-- .../umap/js/umap.datalayer.permissions.js | 12 +- umap/static/umap/js/umap.features.js | 163 ++-- umap/static/umap/js/umap.icon.js | 20 +- umap/static/umap/js/umap.js | 280 +++++-- umap/static/umap/js/umap.layer.js | 289 +++++-- umap/static/umap/js/umap.permissions.js | 17 +- umap/static/umap/js/umap.popup.js | 28 +- umap/static/umap/js/umap.slideshow.js | 31 +- umap/static/umap/js/umap.tableeditor.js | 15 +- umap/static/umap/js/umap.ui.js | 77 +- umap/static/umap/js/umap.xhr.js | 51 +- 17 files changed, 1682 insertions(+), 369 deletions(-) diff --git a/.prettierrc.yaml b/.prettierrc.yaml index 8d2f2cbf..76233396 100644 --- a/.prettierrc.yaml +++ b/.prettierrc.yaml @@ -1,6 +1,8 @@ -trailingComma: "es5" +trailingComma: 'es5' tabWidth: 2 semi: false singleQuote: true printWidth: 88 -quoteProps: "consistent" +quoteProps: 'consistent' +plugins: + - prettier-plugin-curly diff --git a/package-lock.json b/package-lock.json index f6c5ca40..0d4ab4e7 100644 --- a/package-lock.json +++ b/package-lock.json @@ -41,10 +41,368 @@ "mocha": "^10.2.0", "optimist": "~0.4.0", "prettier": "^2.8.8", + "prettier-plugin-curly": "^0.1.3", "sinon": "^15.1.0", "uglify-js": "~3.17.4" } }, + "node_modules/@babel/code-frame": { + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "dev": true, + "dependencies": { + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/code-frame/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/code-frame/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/code-frame/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/code-frame/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/code-frame/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/generator": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.23.0", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "dependencies": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "dependencies": { + "@babel/types": "^7.22.5" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", + "dev": true, + "dependencies": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/highlight/node_modules/ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "dependencies": { + "color-convert": "^1.9.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "dependencies": { + "color-name": "1.1.3" + } + }, + "node_modules/@babel/highlight/node_modules/color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "node_modules/@babel/highlight/node_modules/escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true, + "engines": { + "node": ">=0.8.0" + } + }, + "node_modules/@babel/highlight/node_modules/has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/highlight/node_modules/supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "dependencies": { + "has-flag": "^3.0.0" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/@babel/parser": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", + "dev": true, + "bin": { + "parser": "bin/babel-parser.js" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/traverse": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz", + "integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@babel/types": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", + "dev": true, + "dependencies": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + }, + "engines": { + "node": ">=6.9.0" + } + }, + "node_modules/@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "dependencies": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + }, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true, + "engines": { + "node": ">=6.0.0" + } + }, + "node_modules/@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "node_modules/@jridgewell/trace-mapping": { + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "dev": true, + "dependencies": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "node_modules/@mapbox/sexagesimal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@mapbox/sexagesimal/-/sexagesimal-1.1.0.tgz", @@ -1021,6 +1379,15 @@ "node": ">= 6" } }, + "node_modules/globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -1310,6 +1677,12 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "node_modules/js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, "node_modules/js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -1322,6 +1695,18 @@ "js-yaml": "bin/js-yaml.js" } }, + "node_modules/jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true, + "bin": { + "jsesc": "bin/jsesc" + }, + "engines": { + "node": ">=4" + } + }, "node_modules/jsonparse": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz", @@ -1995,6 +2380,22 @@ "url": "https://github.com/prettier/prettier?sponsor=1" } }, + "node_modules/prettier-plugin-curly": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/prettier-plugin-curly/-/prettier-plugin-curly-0.1.3.tgz", + "integrity": "sha512-NYr2BPex/0fFwDbiZZr91kfgBko1tmaorLOrVAkT5rN91mIYYJRiWabRxWGFqzRSO7J0eoEcxakY9NWvJWAh4w==", + "dev": true, + "dependencies": { + "@babel/parser": "^7.22.5", + "@babel/traverse": "^7.22.5" + }, + "engines": { + "node": ">=18" + }, + "peerDependencies": { + "prettier": "^2 || ^3" + } + }, "node_modules/process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", @@ -2286,6 +2687,15 @@ "tiny-inflate": "^1.0.2" } }, + "node_modules/to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", @@ -2555,6 +2965,286 @@ } }, "dependencies": { + "@babel/code-frame": { + "version": "7.22.13", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", + "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "dev": true, + "requires": { + "@babel/highlight": "^7.22.13", + "chalk": "^2.4.2" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/generator": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.23.0.tgz", + "integrity": "sha512-lN85QRR+5IbYrMWM6Y4pE/noaQtg4pNiqeNGX60eqOfo6gtEj6uw/JagelB8vVztSd7R6M5n1+PQkDbHbBRU4g==", + "dev": true, + "requires": { + "@babel/types": "^7.23.0", + "@jridgewell/gen-mapping": "^0.3.2", + "@jridgewell/trace-mapping": "^0.3.17", + "jsesc": "^2.5.1" + } + }, + "@babel/helper-environment-visitor": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.22.20.tgz", + "integrity": "sha512-zfedSIzFhat/gFhWfHtgWvlec0nqB9YEIVrpuwjruLlXfUSnA8cJB0miHKwqDnQ7d32aKo2xt88/xZptwxbfhA==", + "dev": true + }, + "@babel/helper-function-name": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.23.0.tgz", + "integrity": "sha512-OErEqsrxjZTJciZ4Oo+eoZqeW9UIiOcuYKRJA4ZAgV9myA+pOXhhmpfNCKjEH/auVfEYVFJ6y1Tc4r0eIApqiw==", + "dev": true, + "requires": { + "@babel/template": "^7.22.15", + "@babel/types": "^7.23.0" + } + }, + "@babel/helper-hoist-variables": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz", + "integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-split-export-declaration": { + "version": "7.22.6", + "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.22.6.tgz", + "integrity": "sha512-AsUnxuLhRYsisFiaJwvp1QF+I3KjD5FOxut14q/GzovUe6orHLesW2C7d754kRm53h5gqrz6sFl6sxc4BVtE/g==", + "dev": true, + "requires": { + "@babel/types": "^7.22.5" + } + }, + "@babel/helper-string-parser": { + "version": "7.22.5", + "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.22.5.tgz", + "integrity": "sha512-mM4COjgZox8U+JcXQwPijIZLElkgEpO5rsERVDJTc2qfCDfERyob6k5WegS14SX18IIjv+XD+GrqNumY5JRCDw==", + "dev": true + }, + "@babel/helper-validator-identifier": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.22.20.tgz", + "integrity": "sha512-Y4OZ+ytlatR8AI+8KZfKuL5urKp7qey08ha31L8b3BwewJAoJamTzyvxPR/5D+KkdJCGPq/+8TukHBlY10FX9A==", + "dev": true + }, + "@babel/highlight": { + "version": "7.22.20", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", + "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", + "dev": true, + "requires": { + "@babel/helper-validator-identifier": "^7.22.20", + "chalk": "^2.4.2", + "js-tokens": "^4.0.0" + }, + "dependencies": { + "ansi-styles": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", + "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", + "dev": true, + "requires": { + "color-convert": "^1.9.0" + } + }, + "chalk": { + "version": "2.4.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", + "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", + "dev": true, + "requires": { + "ansi-styles": "^3.2.1", + "escape-string-regexp": "^1.0.5", + "supports-color": "^5.3.0" + } + }, + "color-convert": { + "version": "1.9.3", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", + "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", + "dev": true, + "requires": { + "color-name": "1.1.3" + } + }, + "color-name": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", + "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", + "dev": true + }, + "escape-string-regexp": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", + "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", + "dev": true + }, + "has-flag": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", + "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", + "dev": true + }, + "supports-color": { + "version": "5.5.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", + "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", + "dev": true, + "requires": { + "has-flag": "^3.0.0" + } + } + } + }, + "@babel/parser": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.23.0.tgz", + "integrity": "sha512-vvPKKdMemU85V9WE/l5wZEmImpCtLqbnTvqDS2U1fJ96KrxoW7KrXhNsNCblQlg8Ck4b85yxdTyelsMUgFUXiw==", + "dev": true + }, + "@babel/template": { + "version": "7.22.15", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.15.tgz", + "integrity": "sha512-QPErUVm4uyJa60rkI73qneDacvdvzxshT3kksGqlGWYdOTIUOwJ7RDUL8sGqslY1uXWSL6xMFKEXDS3ox2uF0w==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/parser": "^7.22.15", + "@babel/types": "^7.22.15" + } + }, + "@babel/traverse": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.23.0.tgz", + "integrity": "sha512-t/QaEvyIoIkwzpiZ7aoSKK8kObQYeF7T2v+dazAYCb8SXtp58zEVkWW7zAnju8FNKNdr4ScAOEDmMItbyOmEYw==", + "dev": true, + "requires": { + "@babel/code-frame": "^7.22.13", + "@babel/generator": "^7.23.0", + "@babel/helper-environment-visitor": "^7.22.20", + "@babel/helper-function-name": "^7.23.0", + "@babel/helper-hoist-variables": "^7.22.5", + "@babel/helper-split-export-declaration": "^7.22.6", + "@babel/parser": "^7.23.0", + "@babel/types": "^7.23.0", + "debug": "^4.1.0", + "globals": "^11.1.0" + } + }, + "@babel/types": { + "version": "7.23.0", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.23.0.tgz", + "integrity": "sha512-0oIyUfKoI3mSqMvsxBdclDwxXKXAUA8v/apZbc+iSyARYou1o8ZGDxbUYyLFoW2arqS2jDGqJuZvv1d/io1axg==", + "dev": true, + "requires": { + "@babel/helper-string-parser": "^7.22.5", + "@babel/helper-validator-identifier": "^7.22.20", + "to-fast-properties": "^2.0.0" + } + }, + "@jridgewell/gen-mapping": { + "version": "0.3.3", + "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", + "integrity": "sha512-HLhSWOLRi875zjjMG/r+Nv0oCW8umGb0BgEhyX3dDX3egwZtB8PqLnjz3yedt8R5StBrzcg4aBpnh8UA9D1BoQ==", + "dev": true, + "requires": { + "@jridgewell/set-array": "^1.0.1", + "@jridgewell/sourcemap-codec": "^1.4.10", + "@jridgewell/trace-mapping": "^0.3.9" + } + }, + "@jridgewell/resolve-uri": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.1.tgz", + "integrity": "sha512-dSYZh7HhCDtCKm4QakX0xFpsRDqjjtZf/kjI/v3T3Nwt5r8/qz/M19F9ySyOqU94SXBmeG9ttTul+YnR4LOxFA==", + "dev": true + }, + "@jridgewell/set-array": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", + "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", + "dev": true + }, + "@jridgewell/sourcemap-codec": { + "version": "1.4.15", + "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.15.tgz", + "integrity": "sha512-eF2rxCRulEKXHTRiDrDy6erMYWqNw4LPdQ8UQA4huuxaQsVeRPFl2oM8oDGxMFhJUWZf9McpLtJasDDZb/Bpeg==", + "dev": true + }, + "@jridgewell/trace-mapping": { + "version": "0.3.19", + "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.19.tgz", + "integrity": "sha512-kf37QtfW+Hwx/buWGMPcR60iF9ziHa6r/CZJIHbmcm4+0qrXiVdxegAH0F6yddEVQ7zdkjcGCgCzUu+BcbhQxw==", + "dev": true, + "requires": { + "@jridgewell/resolve-uri": "^3.1.0", + "@jridgewell/sourcemap-codec": "^1.4.14" + } + }, "@mapbox/sexagesimal": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@mapbox/sexagesimal/-/sexagesimal-1.1.0.tgz", @@ -3296,6 +3986,12 @@ "is-glob": "^4.0.1" } }, + "globals": { + "version": "11.12.0", + "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", + "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", + "dev": true + }, "gopd": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.0.1.tgz", @@ -3506,6 +4202,12 @@ "resolved": "https://registry.npmjs.org/isarray/-/isarray-1.0.0.tgz", "integrity": "sha1-u5NdSFgsuhaMBoNJV6VKPgcSTxE=" }, + "js-tokens": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", + "integrity": "sha512-RdJUflcE3cUzKiMqQgsCu06FPu9UdIJO0beYbPhHN4k6apgJtifcoCtT9bcxOpYBtpD2kCM6Sbzg4CausW/PKQ==", + "dev": true + }, "js-yaml": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-4.1.0.tgz", @@ -3515,6 +4217,12 @@ "argparse": "^2.0.1" } }, + "jsesc": { + "version": "2.5.2", + "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", + "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", + "dev": true + }, "jsonparse": { "version": "0.0.5", "resolved": "https://registry.npmjs.org/jsonparse/-/jsonparse-0.0.5.tgz", @@ -4042,6 +4750,16 @@ "integrity": "sha512-tdN8qQGvNjw4CHbY+XXk0JgCXn9QiF21a55rBe5LJAU+kDyC4WQn4+awm2Xfk2lQMk5fKup9XgzTZtGkjBdP9Q==", "dev": true }, + "prettier-plugin-curly": { + "version": "0.1.3", + "resolved": "https://registry.npmjs.org/prettier-plugin-curly/-/prettier-plugin-curly-0.1.3.tgz", + "integrity": "sha512-NYr2BPex/0fFwDbiZZr91kfgBko1tmaorLOrVAkT5rN91mIYYJRiWabRxWGFqzRSO7J0eoEcxakY9NWvJWAh4w==", + "dev": true, + "requires": { + "@babel/parser": "^7.22.5", + "@babel/traverse": "^7.22.5" + } + }, "process-nextick-args": { "version": "1.0.7", "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-1.0.7.tgz", @@ -4269,6 +4987,12 @@ "tiny-inflate": "^1.0.2" } }, + "to-fast-properties": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", + "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", + "dev": true + }, "to-regex-range": { "version": "5.0.1", "resolved": "https://registry.npmjs.org/to-regex-range/-/to-regex-range-5.0.1.tgz", diff --git a/package.json b/package.json index b2995e06..1a28dc9f 100644 --- a/package.json +++ b/package.json @@ -12,6 +12,7 @@ "mocha": "^10.2.0", "optimist": "~0.4.0", "prettier": "^2.8.8", + "prettier-plugin-curly": "^0.1.3", "sinon": "^15.1.0", "uglify-js": "~3.17.4" }, diff --git a/umap/static/umap/js/umap.autocomplete.js b/umap/static/umap/js/umap.autocomplete.js index 1f9b65cb..66a53484 100644 --- a/umap/static/umap/js/umap.autocomplete.js +++ b/umap/static/umap/js/umap.autocomplete.js @@ -70,7 +70,9 @@ L.U.AutoComplete = L.Class.extend({ onKeyDown: function (e) { switch (e.keyCode) { case L.U.Keys.TAB: - if (this.CURRENT !== null) this.setChoice() + if (this.CURRENT !== null) { + this.setChoice() + } L.DomEvent.stop(e) break case L.U.Keys.ENTER: @@ -164,8 +166,11 @@ L.U.AutoComplete = L.Class.extend({ this.clear() return } - if (`${val}` === `${this.CACHE}`) return - else this.CACHE = val + if (`${val}` === `${this.CACHE}`) { + return + } else { + this.CACHE = val + } this._do_search( val, function (data) { @@ -227,8 +232,11 @@ L.U.AutoComplete = L.Class.extend({ highlight: function () { this.forEach(this.RESULTS, (result, index) => { - if (index === this.CURRENT) L.DomUtil.addClass(result.el, 'on') - else L.DomUtil.removeClass(result.el, 'on') + if (index === this.CURRENT) { + L.DomUtil.addClass(result.el, 'on') + } else { + L.DomUtil.removeClass(result.el, 'on') + } }) }, @@ -260,7 +268,9 @@ L.U.AutoComplete = L.Class.extend({ L.U.AutoComplete.Ajax = L.U.AutoComplete.extend({ initialize: function (el, options) { L.U.AutoComplete.prototype.initialize.call(this, el, options) - if (!this.el) return this + if (!this.el) { + return this + } this.createInput() this.createContainer() this.selected_container = this.initSelectedContainer() diff --git a/umap/static/umap/js/umap.controls.js b/umap/static/umap/js/umap.controls.js index 380bd134..8fb3a897 100644 --- a/umap/static/umap/js/umap.controls.js +++ b/umap/static/umap/js/umap.controls.js @@ -6,8 +6,9 @@ L.U.BaseAction = L.ToolbarAction.extend({ tooltip: this.options.tooltip, } L.ToolbarAction.prototype.initialize.call(this) - if (this.options.helpMenu && !this.map.helpMenuActions[this.options.className]) + if (this.options.helpMenu && !this.map.helpMenuActions[this.options.className]) { this.map.helpMenuActions[this.options.className] = this + } }, }) @@ -177,8 +178,11 @@ L.U.ToggleEditAction = L.U.BaseFeatureAction.extend({ }, onClick: function (e) { - if (this.feature._toggleEditing) this.feature._toggleEditing(e) // Path - else this.feature.edit(e) // Marker + if (this.feature._toggleEditing) { + this.feature._toggleEditing(e) + } else { + this.feature.edit(e) + } // Marker }, }) @@ -191,8 +195,9 @@ L.U.DeleteFeatureAction = L.U.BaseFeatureAction.extend({ }, postInit: function () { - if (!this.feature.isMulti()) + if (!this.feature.isMulti()) { this.options.toolbarIcon.className = 'umap-delete-one-of-one' + } }, onClick: function (e) { @@ -275,7 +280,9 @@ L.U.ContinueLineAction = L.U.BaseVertexAction.extend({ // Leaflet.Toolbar doesn't allow twice same toolbar class… L.U.SettingsToolbar = L.Toolbar.Control.extend({ addTo: function (map) { - if (map.options.editMode !== 'advanced') return + if (map.options.editMode !== 'advanced') { + return + } L.Toolbar.Control.prototype.addTo.call(this, map) }, }) @@ -382,8 +389,11 @@ L.U.MoreControls = L.Control.extend({ const pos = this.getPosition(), corner = this._map._controlCorners[pos], className = 'umap-more-controls' - if (L.DomUtil.hasClass(corner, className)) L.DomUtil.removeClass(corner, className) - else L.DomUtil.addClass(corner, className) + if (L.DomUtil.hasClass(corner, className)) { + L.DomUtil.removeClass(corner, className) + } else { + L.DomUtil.addClass(corner, className) + } }, }) @@ -502,8 +512,12 @@ L.U.DataLayersControl = L.Control.extend({ }, onAdd: function (map) { - if (!this._container) this._initLayout(map) - if (map.options.datalayersControl === 'expanded') this.expand() + if (!this._container) { + this._initLayout(map) + } + if (map.options.datalayersControl === 'expanded') { + this.expand() + } return this._container }, @@ -525,18 +539,21 @@ L.U.DataLayersControl = L.Control.extend({ }, collapse: function () { - if (this._map.options.datalayersControl === 'expanded') return + if (this._map.options.datalayersControl === 'expanded') { + return + } L.DomUtil.removeClass(this._container, 'expanded') }, addDataLayer: function (container, datalayer, draggable) { const datalayerLi = L.DomUtil.create('li', '', container) - if (draggable) + if (draggable) { L.DomUtil.element( 'i', { className: 'drag-handle', title: L._('Drag to reorder') }, datalayerLi ) + } datalayer.renderToolbox(datalayerLi) const title = L.DomUtil.add( 'span', @@ -557,7 +574,9 @@ L.U.DataLayersControl = L.Control.extend({ }, openPanel: function () { - if (!this.map.editEnabled) return + if (!this.map.editEnabled) { + return + } const container = L.DomUtil.create('ul', 'umap-browse-datalayers') this.map.eachDataLayerReverse(function (datalayer) { this.addDataLayer(container, datalayer, true) @@ -569,11 +588,17 @@ L.U.DataLayersControl = L.Control.extend({ const layer = this.map.datalayers[e.src.dataset.id], other = this.map.datalayers[e.dst.dataset.id], minIndex = Math.min(e.initialIndex, e.finalIndex) - if (e.finalIndex === 0) layer.bringToTop() - else if (e.finalIndex > e.initialIndex) layer.insertBefore(other) - else layer.insertAfter(other) + if (e.finalIndex === 0) { + layer.bringToTop() + } else if (e.finalIndex > e.initialIndex) { + layer.insertBefore(other) + } else { + layer.insertAfter(other) + } this.map.eachDataLayerReverse((datalayer) => { - if (datalayer.getRank() >= minIndex) datalayer.isDirty = true + if (datalayer.getRank() >= minIndex) { + datalayer.isDirty = true + } }) this.map.indexDatalayers() }, @@ -615,16 +640,19 @@ L.U.DataLayer.include({ remove.title = L._('Delete layer') if (this.isReadOnly()) { L.DomUtil.addClass(container, 'readonly') - } - else { + } else { L.DomEvent.on(edit, 'click', this.edit, this) L.DomEvent.on(table, 'click', this.tableEdit, this) L.DomEvent.on( remove, 'click', function () { - if (!this.isVisible()) return - if (!confirm(L._('Are you sure you want to delete this layer?'))) return + if (!this.isVisible()) { + return + } + if (!confirm(L._('Are you sure you want to delete this layer?'))) { + return + } this._delete() this.map.ui.closePanel() }, @@ -673,7 +701,9 @@ L.U.DataLayer.include({ L.U.DataLayer.addInitHook(function () { this.on('hide', this.propagateHide) this.on('show', this.propagateShow) - if (this.isVisible()) this.propagateShow() + if (this.isVisible()) { + this.propagateShow() + } }) L.U.Map.include({ @@ -761,7 +791,9 @@ L.U.Map.include({ const build = () => { ul.innerHTML = '' datalayer.eachFeature((feature) => { - if (filterValue && !feature.matchFilter(filterValue, filterKeys)) return + if (filterValue && !feature.matchFilter(filterValue, filterKeys)) { + return + } ul.appendChild(addFeature(feature)) }) } @@ -808,7 +840,9 @@ L.U.Map.include({ keys.forEach((key) => { knownValues[key] = [] - if (!this.facets[key]) this.facets[key] = [] + if (!this.facets[key]) { + this.facets[key] = [] + } }) this.eachBrowsableDataLayer((datalayer) => { @@ -826,11 +860,14 @@ L.U.Map.include({ let found = false this.eachBrowsableDataLayer((datalayer) => { datalayer.resetLayer(true) - if (datalayer.hasDataVisible()) found = true + if (datalayer.hasDataVisible()) { + found = true + } }) // TODO: display a results counter in the panel instead. - if (!found) + if (!found) { this.ui.alert({ content: L._('No results for these facets'), level: 'info' }) + } } const fields = keys.map((current) => [ @@ -996,10 +1033,11 @@ L.U.Map.include({ const status = this.permissions.getShareStatusDisplay() name.textContent = this.getDisplayName() // status is not set until map is saved once - if (status) + if (status) { share_status.textContent = L._('Visibility: {status}', { status: status, }) + } } update() this.once('saved', L.bind(update, this)) @@ -1127,8 +1165,11 @@ L.U.Map.include({ ) exportCaveat.id = 'export_caveat_text' const toggleCaveat = () => { - if (typeInput.value === 'umap') exportCaveat.style.display = 'none' - else exportCaveat.style.display = 'inherit' + if (typeInput.value === 'umap') { + exportCaveat.style.display = 'none' + } else { + exportCaveat.style.display = 'inherit' + } } L.DomEvent.on(typeInput, 'change', toggleCaveat) for (const key in this.EXPORT_TYPES) { @@ -1136,15 +1177,20 @@ L.U.Map.include({ option = L.DomUtil.create('option', '', typeInput) option.value = key option.textContent = this.EXPORT_TYPES[key].name || key - if (this.EXPORT_TYPES[key].selected) option.selected = true + if (this.EXPORT_TYPES[key].selected) { + option.selected = true + } } } toggleCaveat() const download = L.DomUtil.create('a', 'button', container) download.textContent = L._('Download data') L.DomEvent.on(download, 'click', () => { - if (typeInput.value === 'umap') this.fullDownload() - else this.download(typeInput.value) + if (typeInput.value === 'umap') { + this.fullDownload() + } else { + this.download(typeInput.value) + } }) this.ui.openPanel({ data: { html: container } }) }, @@ -1215,8 +1261,9 @@ L.U.TileLayerControl = L.Control.extend({ if ( window.location.protocol === 'https:' && tilelayer.options.url_template.indexOf('http:') === 0 - ) + ) { return + } this.addTileLayerElement(tilelayer, options) }, this) this.map.ui.openPanel({ @@ -1238,7 +1285,9 @@ L.U.TileLayerControl = L.Control.extend({ 'click', function () { this.map.selectTileLayer(tilelayer) - if (options && options.callback) options.callback(tilelayer) + if (options && options.callback) { + options.callback(tilelayer) + } }, this ) @@ -1309,7 +1358,9 @@ L.U.Search = L.PhotonSearch.extend({ initialize: function (map, input, options) { L.PhotonSearch.prototype.initialize.call(this, map, input, options) this.options.url = map.options.urls.search - if (map.options.maxBounds) this.options.bbox = map.options.maxBounds.toBBoxString() + if (map.options.maxBounds) { + this.options.bbox = map.options.maxBounds.toBBoxString() + } }, onBlur: function (e) { @@ -1379,7 +1430,9 @@ L.U.SearchControl = L.Control.extend({ limit: 10, noResultLabel: L._('No results'), } - if (map.options.photonUrl) options.url = map.options.photonUrl + if (map.options.photonUrl) { + options.url = map.options.photonUrl + } const container = L.DomUtil.create('div', '') const title = L.DomUtil.create('h3', '', container) @@ -1537,13 +1590,18 @@ L.U.Editable = L.Editable.extend({ this.on('editable:drawing:end', this.closeTooltip) // Layer for items added by users this.on('editable:drawing:cancel', (e) => { - if (e.layer._latlngs && e.layer._latlngs.length < e.layer.editor.MIN_VERTEX) + if (e.layer._latlngs && e.layer._latlngs.length < e.layer.editor.MIN_VERTEX) { e.layer.del() - if (e.layer instanceof L.U.Marker) e.layer.del() + } + if (e.layer instanceof L.U.Marker) { + e.layer.del() + } }) this.on('editable:drawing:commit', function (e) { e.layer.isDirty = true - if (this.map.editedFeature !== e.layer) e.layer.edit(e) + if (this.map.editedFeature !== e.layer) { + e.layer.edit(e) + } }) this.on('editable:editing', (e) => { const layer = e.layer @@ -1555,11 +1613,14 @@ L.U.Editable = L.Editable.extend({ }) this.on('editable:vertex:ctrlclick', (e) => { const index = e.vertex.getIndex() - if (index === 0 || (index === e.vertex.getLastIndex() && e.vertex.continue)) + if (index === 0 || (index === e.vertex.getLastIndex() && e.vertex.continue)) { e.vertex.continue() + } }) this.on('editable:vertex:altclick', (e) => { - if (e.vertex.editor.vertexCanBeDeleted(e.vertex)) e.vertex.delete() + if (e.vertex.editor.vertexCanBeDeleted(e.vertex)) { + e.vertex.delete() + } }) this.on('editable:vertex:rawclick', this.onVertexRawClick) }, @@ -1576,7 +1637,7 @@ L.U.Editable = L.Editable.extend({ return new L.U.Marker(this.map, latlng, this._getDefaultProperties()) }, - _getDefaultProperties: function() { + _getDefaultProperties: function () { const result = {} if (this.map.options.featuresHaveOwner && this.map.options.hasOwnProperty('user')) { result.geojson = { properties: { owner: this.map.options.user.id } } diff --git a/umap/static/umap/js/umap.core.js b/umap/static/umap/js/umap.core.js index a9398945..d038c5cd 100644 --- a/umap/static/umap/js/umap.core.js +++ b/umap/static/umap/js/umap.core.js @@ -13,7 +13,9 @@ L.Util.queryString = (name, fallback) => { qa = {} for (const i in qs) { const key = qs[i].split('=') - if (!key) continue + if (!key) { + continue + } qa[decode(key[0])] = key[1] ? decode(key[1]) : 1 } return qa[name] || fallback @@ -26,19 +28,27 @@ L.Util.booleanFromQueryString = (name) => { L.Util.setFromQueryString = (options, name) => { const value = L.Util.queryString(name) - if (typeof value !== 'undefined') options[name] = value + if (typeof value !== 'undefined') { + options[name] = value + } } L.Util.setBooleanFromQueryString = (options, name) => { const value = L.Util.queryString(name) - if (typeof value !== 'undefined') options[name] = value == '1' || value == 'true' + if (typeof value !== 'undefined') { + options[name] = value == '1' || value == 'true' + } } L.Util.setNullableBooleanFromQueryString = (options, name) => { let value = L.Util.queryString(name) if (typeof value !== 'undefined') { - if (value === 'null') value = null - else if (value === '0' || value === 'false') value = false - else value = true + if (value === 'null') { + value = null + } else if (value === '0' || value === 'false') { + value = false + } else { + value = true + } options[name] = value } } @@ -74,7 +84,9 @@ L.Util.escapeHTML = (s) => { return s } L.Util.toHTML = (r, options) => { - if (!r) return '' + if (!r) { + return '' + } const target = (options && options.target) || 'blank' let ii @@ -94,8 +106,9 @@ L.Util.toHTML = (r, options) => { // unordered lists r = r.replace(/^\*\* (.*)/gm, '') r = r.replace(/^\* (.*)/gm, '') - for (ii = 0; ii < 3; ii++) + for (ii = 0; ii < 3; ii++) { r = r.replace(new RegExp(`${newline}