diff --git a/package-lock.json b/package-lock.json index 1672b289..59101158 100644 --- a/package-lock.json +++ b/package-lock.json @@ -2096,7 +2096,6 @@ "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", "integrity": "sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==", - "optional": true, "requires": { "@nodelib/fs.stat": "2.0.5", "run-parallel": "^1.1.9" @@ -2105,14 +2104,12 @@ "@nodelib/fs.stat": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.stat/-/fs.stat-2.0.5.tgz", - "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==", - "optional": true + "integrity": "sha512-RkhPPp2zrqDAQA/2jNhnztcPAlv64XdhIp7a7454A5ovI7Bukxgt7MX7udwAu3zg1DcpPU0rz3VV1SeaqvY4+A==" }, "@nodelib/fs.walk": { "version": "1.2.8", "resolved": "https://registry.npmjs.org/@nodelib/fs.walk/-/fs.walk-1.2.8.tgz", "integrity": "sha512-oGB+UxlgWcgQkgwo8GcEGwemoTFt3FIO9ababBmaGwXIoBKZ+GTy0pP185beGg7Llih/NSHSV2XAs1lnznocSg==", - "optional": true, "requires": { "@nodelib/fs.scandir": "2.1.5", "fastq": "^1.6.0" @@ -2359,12 +2356,6 @@ "@babel/types": "^7.3.0" } }, - "@types/eslint-visitor-keys": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/@types/eslint-visitor-keys/-/eslint-visitor-keys-1.0.0.tgz", - "integrity": "sha512-OCutwjDZ4aFS6PB1UZ988C4YgwlBHJd6wCeQqaLdmadZ/7e+w79+hbMUFC1QXDNCmdyoRfAFdm0RypzwR+Qpag==", - "dev": true - }, "@types/glob": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/@types/glob/-/glob-7.1.4.tgz", @@ -2504,17 +2495,18 @@ "dev": true }, "@typescript-eslint/eslint-plugin": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-3.10.1.tgz", - "integrity": "sha512-PQg0emRtzZFWq6PxBcdxRH3QIQiyFO3WCVpRL3fgj5oQS3CDs3AeAKfv4DxNhzn8ITdNJGJ4D3Qw8eAJf3lXeQ==", + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-4.29.0.tgz", + "integrity": "sha512-eiREtqWRZ8aVJcNru7cT/AMVnYd9a2UHsfZT8MR1dW3UUEg6jDv9EQ9Cq4CUPZesyQ58YUpoAADGv71jY8RwgA==", "dev": true, "requires": { - "@typescript-eslint/experimental-utils": "3.10.1", - "debug": "^4.1.1", + "@typescript-eslint/experimental-utils": "4.29.0", + "@typescript-eslint/scope-manager": "4.29.0", + "debug": "^4.3.1", "functional-red-black-tree": "^1.0.1", - "regexpp": "^3.0.0", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "regexpp": "^3.1.0", + "semver": "^7.3.5", + "tsutils": "^3.21.0" }, "dependencies": { "debug": { @@ -2544,53 +2536,102 @@ } }, "@typescript-eslint/experimental-utils": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-3.10.1.tgz", - "integrity": "sha512-DewqIgscDzmAfd5nOGe4zm6Bl7PKtMG2Ad0KG8CUZAHlXfAKTF9Ol5PXhiMh39yRL2ChRH1cuuUGOcVyyrhQIw==", + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-4.29.0.tgz", + "integrity": "sha512-FpNVKykfeaIxlArLUP/yQfv/5/3rhl1ov6RWgud4OgbqWLkEq7lqgQU9iiavZRzpzCRQV4XddyFz3wFXdkiX9w==", "dev": true, "requires": { - "@types/json-schema": "^7.0.3", - "@typescript-eslint/types": "3.10.1", - "@typescript-eslint/typescript-estree": "3.10.1", - "eslint-scope": "^5.0.0", - "eslint-utils": "^2.0.0" + "@types/json-schema": "^7.0.7", + "@typescript-eslint/scope-manager": "4.29.0", + "@typescript-eslint/types": "4.29.0", + "@typescript-eslint/typescript-estree": "4.29.0", + "eslint-scope": "^5.1.1", + "eslint-utils": "^3.0.0" + }, + "dependencies": { + "eslint-utils": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/eslint-utils/-/eslint-utils-3.0.0.tgz", + "integrity": "sha512-uuQC43IGctw68pJA1RgbQS8/NP7rch6Cwd4j3ZBtgo4/8Flj4eGE7ZYSZRN3iq5pVUv6GPdW5Z1RFleo84uLDA==", + "dev": true, + "requires": { + "eslint-visitor-keys": "^2.0.0" + } + }, + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } } }, "@typescript-eslint/parser": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-3.10.1.tgz", - "integrity": "sha512-Ug1RcWcrJP02hmtaXVS3axPPTTPnZjupqhgj+NnZ6BCkwSImWk/283347+x9wN+lqOdK9Eo3vsyiyDHgsmiEJw==", + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-4.29.0.tgz", + "integrity": "sha512-+92YRNHFdXgq+GhWQPT2bmjX09X7EH36JfgN2/4wmhtwV/HPxozpCNst8jrWcngLtEVd/4zAwA6BKojAlf+YqA==", "dev": true, "requires": { - "@types/eslint-visitor-keys": "^1.0.0", - "@typescript-eslint/experimental-utils": "3.10.1", - "@typescript-eslint/types": "3.10.1", - "@typescript-eslint/typescript-estree": "3.10.1", - "eslint-visitor-keys": "^1.1.0" + "@typescript-eslint/scope-manager": "4.29.0", + "@typescript-eslint/types": "4.29.0", + "@typescript-eslint/typescript-estree": "4.29.0", + "debug": "^4.3.1" + }, + "dependencies": { + "debug": { + "version": "4.3.2", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", + "integrity": "sha512-mOp8wKcvj7XxC78zLgw/ZA+6TSgkoE2C/ienthhRD298T7UNwAg9diBpLRxC0mOezLl4B0xV7M0cCO6P/O0Xhw==", + "dev": true, + "requires": { + "ms": "2.1.2" + } + }, + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", + "dev": true + } + } + }, + "@typescript-eslint/scope-manager": { + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-4.29.0.tgz", + "integrity": "sha512-HPq7XAaDMM3DpmuijxLV9Io8/6pQnliiXMQUcAdjpJJSR+fdmbD/zHCd7hMkjJn04UQtCQBtshgxClzg6NIS2w==", + "dev": true, + "requires": { + "@typescript-eslint/types": "4.29.0", + "@typescript-eslint/visitor-keys": "4.29.0" } }, "@typescript-eslint/types": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-3.10.1.tgz", - "integrity": "sha512-+3+FCUJIahE9q0lDi1WleYzjCwJs5hIsbugIgnbB+dSCYUxl8L6PwmsyOPFZde2hc1DlTo/xnkOgiTLSyAbHiQ==", + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-4.29.0.tgz", + "integrity": "sha512-2YJM6XfWfi8pgU2HRhTp7WgRw78TCRO3dOmSpAvIQ8MOv4B46JD2chnhpNT7Jq8j0APlIbzO1Bach734xxUl4A==", "dev": true }, "@typescript-eslint/typescript-estree": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-3.10.1.tgz", - "integrity": "sha512-QbcXOuq6WYvnB3XPsZpIwztBoquEYLXh2MtwVU+kO8jgYCiv4G5xrSP/1wg4tkvrEE+esZVquIPX/dxPlePk1w==", + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-4.29.0.tgz", + "integrity": "sha512-8ZpNHDIOyqzzgZrQW9+xQ4k5hM62Xy2R4RPO3DQxMc5Rq5QkCdSpk/drka+DL9w6sXNzV5nrdlBmf8+x495QXQ==", "dev": true, "requires": { - "@typescript-eslint/types": "3.10.1", - "@typescript-eslint/visitor-keys": "3.10.1", - "debug": "^4.1.1", - "glob": "^7.1.6", + "@typescript-eslint/types": "4.29.0", + "@typescript-eslint/visitor-keys": "4.29.0", + "debug": "^4.3.1", + "globby": "^11.0.3", "is-glob": "^4.0.1", - "lodash": "^4.17.15", - "semver": "^7.3.2", - "tsutils": "^3.17.1" + "semver": "^7.3.5", + "tsutils": "^3.21.0" }, "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 + }, "debug": { "version": "4.3.2", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.2.tgz", @@ -2600,6 +2641,26 @@ "ms": "2.1.2" } }, + "globby": { + "version": "11.0.4", + "resolved": "https://registry.npmjs.org/globby/-/globby-11.0.4.tgz", + "integrity": "sha512-9O4MVG9ioZJ08ffbcyVYyLOJLk5JQ688pJ4eMGLpdWLHq/Wr1D9BlriLQyL0E+jbkuePVZXYFj47QM/v093wHg==", + "dev": true, + "requires": { + "array-union": "^2.1.0", + "dir-glob": "^3.0.1", + "fast-glob": "^3.1.1", + "ignore": "^5.1.4", + "merge2": "^1.3.0", + "slash": "^3.0.0" + } + }, + "ignore": { + "version": "5.1.8", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.8.tgz", + "integrity": "sha512-BMpfD7PpiETpBl/A6S498BaIJ6Y/ABT93ETbby2fP00v4EbvPBXWEoaR1UBPKs3iR53pJY7EtZk5KACI57i1Uw==", + "dev": true + }, "ms": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", @@ -2614,16 +2675,31 @@ "requires": { "lru-cache": "^6.0.0" } + }, + "slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true } } }, "@typescript-eslint/visitor-keys": { - "version": "3.10.1", - "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-3.10.1.tgz", - "integrity": "sha512-9JgC82AaQeglebjZMgYR5wgmfUdUc+EitGUUMW8u2nDckaeimzW+VsoLV6FoimPv2id3VQzfjwBxEMVz08ameQ==", + "version": "4.29.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-4.29.0.tgz", + "integrity": "sha512-LoaofO1C/jAJYs0uEpYMXfHboGXzOJeV118X4OsZu9f7rG7Pr9B3+4HTU8+err81rADa4xfQmAxnRnPAI2jp+Q==", "dev": true, "requires": { - "eslint-visitor-keys": "^1.1.0" + "@typescript-eslint/types": "4.29.0", + "eslint-visitor-keys": "^2.0.0" + }, + "dependencies": { + "eslint-visitor-keys": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", + "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", + "dev": true + } } }, "@unimodules/core": { @@ -4414,6 +4490,16 @@ "integrity": "sha512-Un7MIEDdUC5gNpcGDV97op1Ywk748MpHcFTHoYs6qnj1Z3j7I53VG3nwZhKzoBZmbdRNnb6WRdFlwl7tSDuZGw==", "dev": true }, + "bindings": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/bindings/-/bindings-1.5.0.tgz", + "integrity": "sha512-p2q/t/mhvuOj/UeLlV6566GD/guowlr0hHxClI0W9m7MWYkL1F0hLo+0Aexs9HSPCtR1SXQ0TD3MMKrXZajbiQ==", + "dev": true, + "optional": true, + "requires": { + "file-uri-to-path": "1.0.0" + } + }, "bluebird": { "version": "3.7.2", "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", @@ -5805,6 +5891,15 @@ } } }, + "dir-glob": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-3.0.1.tgz", + "integrity": "sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==", + "dev": true, + "requires": { + "path-type": "^4.0.0" + } + }, "dns-equal": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/dns-equal/-/dns-equal-1.0.0.tgz", @@ -7005,7 +7100,6 @@ "version": "3.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", - "optional": true, "requires": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -7029,7 +7123,6 @@ "version": "1.11.1", "resolved": "https://registry.npmjs.org/fastq/-/fastq-1.11.1.tgz", "integrity": "sha512-HOnr8Mc60eNYl1gzwp6r5RoUyAn5/glBolUzP/Ez6IFVPMPirxn/9phgL6zhOtaTy7ISwPvQ+wT+hfcRZh/bzw==", - "optional": true, "requires": { "reusify": "^1.0.4" } @@ -7072,6 +7165,13 @@ "flat-cache": "^3.0.4" } }, + "file-uri-to-path": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/file-uri-to-path/-/file-uri-to-path-1.0.0.tgz", + "integrity": "sha512-0Zt+s3L7Vf1biwWZ29aARiVYLx7iMGnEUl9x33fbB/j3jR81u/O2LbqK+Bm1CDSNDKVtJ/YjwY7TUd5SkeLQLw==", + "dev": true, + "optional": true + }, "fill-range": { "version": "7.0.1", "resolved": "https://registry.npmjs.org/fill-range/-/fill-range-7.0.1.tgz", @@ -11158,8 +11258,7 @@ "merge2": { "version": "1.4.1", "resolved": "https://registry.npmjs.org/merge2/-/merge2-1.4.1.tgz", - "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==", - "optional": true + "integrity": "sha512-8q7VEgMJW4J8tcfVPy8g09NcQwZdbwFEqhe/WZkoIzjn/3TGDwtOCYtXGxA3O8tPzpczCCDgv+P2P5y00ZJOOg==" }, "methods": { "version": "1.1.2", @@ -11421,6 +11520,13 @@ "readable-stream": "^3.6.0" } }, + "nan": { + "version": "2.15.0", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.15.0.tgz", + "integrity": "sha512-8ZtvEnA2c5aYCZYd1cvgdnU6cqwixRoYg70xPLWUws5ORTa/lnw+u4amixRS/Ac5U5mQVgp9pnlSUnbNWFaWZQ==", + "dev": true, + "optional": true + }, "nanomatch": { "version": "1.2.13", "resolved": "https://registry.npmjs.org/nanomatch/-/nanomatch-1.2.13.tgz", @@ -13376,8 +13482,7 @@ "reusify": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/reusify/-/reusify-1.0.4.tgz", - "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==", - "optional": true + "integrity": "sha512-U9nH88a3fc/ekCF1l0/UP1IosiuIjyTh7hBvXVMHYgVcfGvt897Xguj2UOLDeI5BG2m7/uwyaLVT6fbtCwTyzw==" }, "rimraf": { "version": "3.0.2", @@ -13401,7 +13506,6 @@ "version": "1.2.0", "resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz", "integrity": "sha512-5l4VyZR86LZ/lDxZTR6jqL8AFE2S0IFLMP26AbjsLVADxHdhB/c0GUsH+y39UfCi3dzz8OlQuPmnaJOMoDHQBA==", - "optional": true, "requires": { "queue-microtask": "^1.2.2" } @@ -15829,7 +15933,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", @@ -16696,7 +16804,11 @@ "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.13.tgz", "integrity": "sha512-oWb1Z6mkHIskLzEJ/XWX0srkpkTQ7vaopMQkyaEIoq0fmtFVxOthb8cCxeT+p3ynTdkk/RZwbgG4brR5BeWECw==", "dev": true, - "optional": true + "optional": true, + "requires": { + "bindings": "^1.5.0", + "nan": "^2.12.1" + } }, "glob-parent": { "version": "3.1.0", diff --git a/package.json b/package.json index 49451f4d..ff7a0e55 100644 --- a/package.json +++ b/package.json @@ -75,8 +75,8 @@ "@testing-library/jest-dom": "^5.14.1", "@types/jest": "^26.0.23", "@types/webpack-env": "^1.16.0", - "@typescript-eslint/eslint-plugin": "^3.10.1", - "@typescript-eslint/parser": "^3.10.1", + "@typescript-eslint/eslint-plugin": "^4.29.0", + "@typescript-eslint/parser": "^4.29.0", "babel-loader": "^8.2.2", "babel-plugin-inline-import": "^3.0.0", "babel-preset-es2015": "^6.24.1", diff --git a/src/attach/attachPane.js b/src/attach/attachPane.js index 5d6753e4..8c866fae 100644 --- a/src/attach/attachPane.js +++ b/src/attach/attachPane.js @@ -66,7 +66,7 @@ module.exports = { return store } - var div = dom.createElement('div') + const div = dom.createElement('div') const esc = UI.utils.escapeForXML div.setAttribute('class', 'attachPane') div.innerHTML = @@ -238,7 +238,7 @@ module.exports = { } } - var linkClicked = function (x, event, inverse, refresh) { + const linkClicked = function (x, event, inverse, refresh) { let s, o if (inverse) { // Objectlist @@ -292,7 +292,7 @@ module.exports = { div.appendChild(subjectList) } - var showObject = function (x, event, selected) { + const showObject = function (x, event, selected) { if (!selected) { deselectObject() preview.innerHTML = '' // Clean out what is there @@ -367,7 +367,7 @@ module.exports = { } } let i, b - var buttons = [] + const buttons = [] for (i = 0; i < labels.length; i++) { b = buttons[i] = dom.createElement('td') b.textContent = labels[i] @@ -409,7 +409,7 @@ module.exports = { ) ) - var objectList = UI.widgets.selectorPanel( + const objectList = UI.widgets.selectorPanel( dom, kb, objectType, @@ -428,7 +428,7 @@ module.exports = { // objectList.insertBefore(head, objectList.firstChild) - var preview = dom.createElement('div') + const preview = dom.createElement('div') preview.setAttribute( 'style', /* background-color: black; */ 'padding: 0em; margin: 0; height: 100%; overflow:scroll;' @@ -446,7 +446,7 @@ module.exports = { for (const storeURI in stores) { // var store = findStore(kb,subjects[subjectList.length-1]) const store = kb.sym(storeURI) - var mintBox = dom.createElement('div') + const mintBox = dom.createElement('div') mintBox.setAttribute( 'style', 'clear: left; width: 20em; margin-top:2em; background-color:#ccc; border-radius: 1em; padding: 1em; font-weight: bold;' diff --git a/src/audio/audioPane.js b/src/audio/audioPane.js index eb134414..4492f9ec 100644 --- a/src/audio/audioPane.js +++ b/src/audio/audioPane.js @@ -84,7 +84,7 @@ module.exports = { trackRow.textContent = decode(removeExtension(a[2])) } - var moveOn = function (current, level) { + const moveOn = function (current, level) { return new Promise(function (resolve) { level = level || 0 if (!options.chain) return resolve(null) @@ -132,7 +132,7 @@ module.exports = { const endedListener = function (event) { const current = kb.sym(event.target.getAttribute('src')) if (!options.chain) return - var tryNext = function (cur) { + const tryNext = function (cur) { const current = cur moveOn(current).then(function (next) { if (!next) { @@ -153,7 +153,7 @@ module.exports = { tryNext(current) } - var audioControl = function (song, autoplay) { + const audioControl = function (song, autoplay) { const audio = dom.createElement('audio') audio.setAttribute('controls', 'yes') audio.setAttribute('src', song.uri) @@ -167,13 +167,13 @@ module.exports = { const div = dom.createElement('div') const table = div.appendChild(dom.createElement('table')) const labelStyle = 'padding: 0.3em; color:white; background-color: black;' - var artistRow = table.appendChild(dom.createElement('tr')) + const artistRow = table.appendChild(dom.createElement('tr')) artistRow.style.cssText = labelStyle - var albumRow = table.appendChild(dom.createElement('tr')) + const albumRow = table.appendChild(dom.createElement('tr')) albumRow.style.cssText = labelStyle - var trackRow = table.appendChild(dom.createElement('tr')) + const trackRow = table.appendChild(dom.createElement('tr')) trackRow.style.cssText = labelStyle - var controlRow = table.appendChild(dom.createElement('tr')) + const controlRow = table.appendChild(dom.createElement('tr')) guessNames(subject) controlRow.appendChild(audioControl(subject, options.autoplay)) diff --git a/src/classInstancePane.js b/src/classInstancePane.js index 23820210..fb91c990 100644 --- a/src/classInstancePane.js +++ b/src/classInstancePane.js @@ -34,7 +34,7 @@ module.exports = { div.appendChild(pre) pre.appendChild(dom.createTextNode(message)) } - var div = dom.createElement('div') + const div = dom.createElement('div') div.setAttribute('class', 'instancePane') div.setAttribute( 'style', diff --git a/src/dataContentPane.js b/src/dataContentPane.js index 3633b6cf..459d5341 100644 --- a/src/dataContentPane.js +++ b/src/dataContentPane.js @@ -43,7 +43,7 @@ module.exports = { */ statementsAsTables: function statementsAsTables (sts, context, initialRoots) { const myDocument = context.dom - // var outliner = context.getOutliner(myDocument) + // const outliner = context.getOutliner(myDocument) const rep = myDocument.createElement('table') const sz = UI.rdf.Serializer(context.session.store) const res = sz.rootSubjects(sts) @@ -138,7 +138,7 @@ module.exports = { } return myDocument.createTextNode(obj.value) // placeholder - could be smarter, - case 'BlankNode': + case 'BlankNode': { if (obj.toNT() in doneBnodes) { // Break infinite recursion referencedBnodes[obj.toNT()] = true @@ -149,7 +149,7 @@ module.exports = { return anchor } doneBnodes[obj.toNT()] = true // Flag to prevent infinite recursion in propertyTree - var newTable = propertyTree(obj) + const newTable = propertyTree(obj) doneBnodes[obj.toNT()] = newTable // Track where we mentioned it first if ( UI.utils.ancestor(newTable, 'TABLE') && @@ -161,7 +161,7 @@ module.exports = { newTable.style.backgroundColor = 'white' } return newTable - + } case 'Collection': res = myDocument.createElement('table') res.setAttribute('class', 'collectionAsTables') @@ -271,14 +271,14 @@ module.exports = { ) } - var outliner = context.getOutliner(myDocument) - var kb = context.session.store - var div = myDocument.createElement('div') + const outliner = context.getOutliner(myDocument) + const kb = context.session.store + const div = myDocument.createElement('div') div.setAttribute('class', 'dataContentPane') // Because of smushing etc, this will not be a copy of the original source // We could instead either fetch and re-parse the source, // or we could keep all the pre-smushed triples. - var sts = kb.statementsMatching(undefined, undefined, undefined, subject) // @@ slow with current store! + const sts = kb.statementsMatching(undefined, undefined, undefined, subject) // @@ slow with current store! if ($rdf.keepThisCodeForLaterButDisableFerossConstantConditionPolice) { alternativeRendering() diff --git a/src/form/pane.js b/src/form/pane.js index 000443ac..9aa50790 100644 --- a/src/form/pane.js +++ b/src/form/pane.js @@ -48,11 +48,11 @@ module.exports = { // This in general needs a whole lot more thought // and it connects to the discoverbility through links - // var t = kb.findTypeURIs(subject) + // const t = kb.findTypeURIs(subject) const me = UI.authn.currentUser() - var box = dom.createElement('div') + const box = dom.createElement('div') box.setAttribute('class', 'formPane') if (!me) { @@ -112,7 +112,7 @@ module.exports = { /* Keep tis as a reminder to let a New one have its URI given by user mention("Where will this information be stored?") - var ele = dom.createElement('input'); + const ele = dom.createElement('input'); box.appendChild(ele); ele.setAttribute('type', 'text'); ele.setAttribute('size', '72'); @@ -162,7 +162,7 @@ module.exports = { }) for (const d in docs) docList.push(docs[d], d) docList.sort() - for (var i = 0; i < docList.length; i++) { + for (let i = 0; i < docList.length; i++) { const uri = docList[i][1] if (uri && store.updater.editable(uri)) { store = store.sym(uri) @@ -173,7 +173,7 @@ module.exports = { // 3. In a workspace store // @@ TODO: Can probably remove _followeach (not done this time because the commit is a very safe refactor) - var _followeach = function (kb, subject, path) { + const _followeach = function (kb, subject, path) { if (path.length === 0) return [subject] const oo = kb.each(subject, path[0]) let res = [] @@ -194,7 +194,7 @@ module.exports = { mention('Workspace selected OK: ' + ws) const activities = store.each(undefined, ns.space('workspace'), ws) - for (let j = 0; j < activities.length; i++) { + for (let j = 0; j < activities.length; j++) { const act = activities[j] const subjectDoc2 = store.any(ws, ns.space('store')) diff --git a/src/microblogPane/microblogPane.js b/src/microblogPane/microblogPane.js index 1404320f..4cbb9762 100644 --- a/src/microblogPane/microblogPane.js +++ b/src/microblogPane/microblogPane.js @@ -509,6 +509,7 @@ module.exports = { } this.microblogPane = microblogPane const accounts = kb.each(s, FOAF('holdsAccount')) + let account for (const a in accounts) { if ( kb.whether(accounts[a], RDF('type'), SIOC('User')) && @@ -518,7 +519,7 @@ module.exports = { SIOCt('Microblog') ) ) { - var account = accounts[a] + account = accounts[a] break } } @@ -596,7 +597,7 @@ module.exports = { that.notify('You ' + doFollow + username + '.') } } - var followMe = new UI.rdf.Statement( + const followMe = new UI.rdf.Statement( myUser, SIOC('follows'), that.creator.sym, @@ -743,13 +744,13 @@ module.exports = { for (const word in words) { if (words[word].match(/@\w+/)) { const atUser = words[word].replace(/\W/g, '') - var recipient = myFollowList.selectUser(atUser) + const recipient = myFollowList.selectUser(atUser) if (recipient[0] === true) { meta.recipients.push(recipient[1][0]) } else if (recipient[1].length > 1) { // if multiple users allow the user to choose - var xrecipients = doc.createElement('select') - var xrecipientsSubmit = doc.createElement('input') + const xrecipients = doc.createElement('select') + const xrecipientsSubmit = doc.createElement('input') xrecipientsSubmit.type = 'button' xrecipientsSubmit.value = 'Continue' xrecipientsSubmit.addEventListener( @@ -806,7 +807,7 @@ module.exports = { notify('Please set your microblog first.') } } - var mbLetterCount = function () { + const mbLetterCount = function () { xupdateStatusCounter.innerHTML = charCount - xupdateStatus.value.length xupdateStatusCounter.style.color = charCount - xupdateStatus.value.length < 0 ? '#c33' : '' @@ -834,24 +835,29 @@ module.exports = { xnotify.id = 'notify-container' xnotify.className = 'notify-container' this.xnotify = xnotify - var xupdateContainer = doc.createElement('form') + const xupdateContainer = doc.createElement('form') xupdateContainer.className = 'update-container' xupdateContainer.innerHTML = '

What are you up to?

' + let xinReplyToContainer + let xupdateStatus + let xupdateStatusCounter + let xupdateSubmit + let xcreateNewMB if (mb.getMyURI()) { - var xinReplyToContainer = doc.createElement('input') + xinReplyToContainer = doc.createElement('input') xinReplyToContainer.id = 'xinReplyToContainer' xinReplyToContainer.type = 'hidden' - var xupdateStatus = doc.createElement('textarea') + xupdateStatus = doc.createElement('textarea') xupdateStatus.id = 'xupdateStatus' - var xupdateStatusCounter = doc.createElement('span') + xupdateStatusCounter = doc.createElement('span') xupdateStatusCounter.appendChild(doc.createTextNode(charCount)) xupdateStatus.cols = 30 xupdateStatus.addEventListener('keyup', mbLetterCount, false) xupdateStatus.addEventListener('focus', mbLetterCount, false) - var xupdateSubmit = doc.createElement('input') + xupdateSubmit = doc.createElement('input') xupdateSubmit.id = 'xupdateSubmit' xupdateSubmit.type = 'submit' xupdateSubmit.value = 'Send' @@ -866,7 +872,7 @@ module.exports = { "Hi, it looks like you don't have a microblog, " + ' would you like to create one? ' ) - var xcreateNewMB = doc.createElement('input') + xcreateNewMB = doc.createElement('input') xcreateNewMB.type = 'button' xcreateNewMB.value = 'Create a new Microblog' xcreateNewMB.addEventListener('click', lsCreateNewMB, false) @@ -882,6 +888,7 @@ module.exports = { // user header // this.creator const creators = kb.each(s, FOAF('holdsAccount')) + let creator for (const c in creators) { if ( kb.whether(creators[c], RDF('type'), SIOC('User')) && @@ -891,13 +898,14 @@ module.exports = { SIOCt('Microblog') ) ) { - var creator = creators[c] + creator = creators[c] // var mb = kb.sym(creator.uri.split("#")[0]); // UI.store.fetcher.refresh(mb); break // TODO add support for more than one microblog in same foaf } } + let xfollowButton if (creator) { this.creator = mb.getUser(creator) // ---display avatar, if available --- @@ -915,7 +923,7 @@ module.exports = { subheaderContainer.appendChild(userName) // ---display follow button--- if (!this.thisIsMe && mb.getMyURI()) { - var xfollowButton = doc.createElement('input') + xfollowButton = doc.createElement('input') xfollowButton.setAttribute('type', 'button') const followButtonLabel = this.Ifollow ? 'Unfollow ' : 'Follow ' xfollowButton.value = followButtonLabel + this.creator.name @@ -1028,8 +1036,8 @@ module.exports = { // This has the potential to support a post that replies to many messages. const inReplyTo = kb.each(post, SIOC('reply_of')) const xreplyTo = doc.createElement('span') + let theReply for (const reply in inReplyTo) { - var theReply theReply = String(inReplyTo[reply]).replace(/<|>/g, '') const genReplyTo = function () { const reply = doc.createElement('a') @@ -1059,6 +1067,7 @@ module.exports = { xinReplyToContainer.value = post.uri xupdateSubmit.value = 'Reply' } + let xconfirmDeletionDialog const mbDeletePost = function (evt) { const lsconfirmNo = function () { doc @@ -1073,7 +1082,7 @@ module.exports = { .removeChild(xconfirmDeletionDialog) } evt.target.disabled = true - var xconfirmDeletionDialog = doc.createElement('li') + xconfirmDeletionDialog = doc.createElement('li') xconfirmDeletionDialog.className = 'notify conf' xconfirmDeletionDialog.innerHTML += '

Are you sure you want to delete this post?

' @@ -1103,7 +1112,7 @@ module.exports = { .appendChild(xconfirmDeletionDialog) confirmno.focus() - var reallyDelete = function () { + const reallyDelete = function () { // callback after deletion const mbconfirmDeletePost = function (a, success) { if (success) { @@ -1150,18 +1159,21 @@ module.exports = { sparqlUpdater.batch_delete_statement(deleteMe, deleteContainerOf) } } + let themaker + let xreplyButton + let xdeleteButton if (mb.getMyURI()) { // If the microblog in question does not belong to the user, // display the delete post and reply to post buttons. - var themaker = kb.any(post, SIOC('has_creator')) + themaker = kb.any(post, SIOC('has_creator')) if (mb.getMyURI() !== themaker.uri) { - var xreplyButton = doc.createElement('input') + xreplyButton = doc.createElement('input') xreplyButton.type = 'button' xreplyButton.value = 'reply' xreplyButton.className = 'reply' xreplyButton.addEventListener('click', mbReplyTo, false) } else { - var xdeleteButton = doc.createElement('input') + xdeleteButton = doc.createElement('input') xdeleteButton.type = 'button' xdeleteButton.value = 'Delete' xdeleteButton.className = 'reply' @@ -1187,7 +1199,7 @@ module.exports = { myFavorites.remove(favpost, cbFavorite) } } - var xfavorite = doc.createElement('a') + const xfavorite = doc.createElement('a') xfavorite.innerHTML = '★' xfavorite.addEventListener('click', mbFavorite, false) if (myFavorites.favorited(post.uri)) { diff --git a/src/outline/context.ts b/src/outline/context.ts index cb411acd..89e355c2 100644 --- a/src/outline/context.ts +++ b/src/outline/context.ts @@ -1,6 +1,5 @@ import { DataBrowserContext, LiveStore, PaneRegistry } from 'pane-registry' import { getOutliner } from '../index' -import { solidLogicSingleton } from 'solid-ui' import { SolidLogic } from 'solid-logic' export function createContext ( diff --git a/src/outline/dragDrop.js b/src/outline/dragDrop.js index 896445a8..df2d1184 100644 --- a/src/outline/dragDrop.js +++ b/src/outline/dragDrop.js @@ -256,7 +256,7 @@ dragAndDrop.util.DDM = (function DDM () { // 2.Investigate into Gecko drag and drop // 3.Cross Tag Drag And Drop // 4.Firefox native rdf store -var TabulatorOutlinerObserver = { +const TabulatorOutlinerObserver = { onDrop: function (e, aXferData, _dragSession) { const selection = UI.utils.ancestor( UI.utils.ancestor(e.originalTarget, 'TABLE').parentNode, @@ -291,8 +291,9 @@ var TabulatorOutlinerObserver = { onDragEnter: function (e, _dragSession) { // enter or exit something + let selection try { - var selection = UI.utils.ancestor( + selection = UI.utils.ancestor( UI.utils.ancestor(e.originalTarget, 'TABLE').parentNode, 'TABLE' ).outline.selection diff --git a/src/outline/manager.js b/src/outline/manager.js index 1dbb88d5..e86abce3 100644 --- a/src/outline/manager.js +++ b/src/outline/manager.js @@ -1614,6 +1614,7 @@ export default function (context) { if (UI.utils.getTarget(e).tagName === 'INPUT') return + let walk switch (e.keyCode) { case 46: // delete case 8: // backspace @@ -1624,18 +1625,18 @@ export default function (context) { this.UserInput.Delete(selectedTd) } break - case 37: // left + case 37: { // left if (this.walk('left')) return - var titleTd = UI.utils.ancestor(selectedTd.parentNode, 'TD') + const titleTd = UI.utils.ancestor(selectedTd.parentNode, 'TD') outlineCollapse(selectedTd, UI.utils.getAbout(kb, titleTd)) break + } case 39: // right // @@ TODO: Write away the need for exception on next line // eslint-disable-next-line no-case-declarations const obj = UI.utils.getAbout(kb, selectedTd) if (obj) { - var walk = this.walk - + walk = this.walk if (selectedTd.nextSibling) { // when selectedTd is a predicate this.walk('right') @@ -2084,7 +2085,7 @@ export default function (context) { } for (let i = 0; i < returnConditions.length; i++) { - var returnCode + let returnCode if (returnCode === returnConditions[i](subject)) { render() UI.log.debug('outline 1815') @@ -2131,7 +2132,8 @@ export default function (context) { function outlineCollapse (p, subject) { let row = UI.utils.ancestor(p, 'TR') row = UI.utils.ancestor(row.parentNode, 'TR') // two levels up - if (row) var statement = row.AJAR_statement + let statement + if (row) statement = row.AJAR_statement let level // find level (the enclosing TD) for ( level = p.parentNode; @@ -2151,8 +2153,9 @@ export default function (context) { myview = views.defaults[statement.predicate.uri] } UI.log.debug('view= ' + myview) + let deleteNode if (level.parentNode.parentNode.id === 'outline') { - var deleteNode = level.parentNode + deleteNode = level.parentNode } thisOutline.replaceTD( thisOutline.outlineObjectTD(subject, myview, deleteNode, statement), @@ -2285,7 +2288,7 @@ export default function (context) { // // / ///////////////////////////////////////////////////// - var ns = UI.ns + const ns = UI.ns const views = propertyViews(dom) diff --git a/src/outline/propertyViews.test.ts b/src/outline/propertyViews.test.ts index d0952409..7785de29 100644 --- a/src/outline/propertyViews.test.ts +++ b/src/outline/propertyViews.test.ts @@ -1,7 +1,6 @@ /* eslint-env jest */ import { sym } from 'rdflib' import propertyViews from './propertyViews' -import viewAsImage from './viewAsImage' describe('property views', () => { it.each([ @@ -11,7 +10,6 @@ describe('property views', () => { 'http://xmlns.com/foaf/0.1/logo', 'http://schema.org/image' ])('renders %s as image', (property) => { - const asImage = viewAsImage(document) const views = propertyViews(document) const view = views.defaults[property] const result = view(sym('https://pod.example/img.jpg')) @@ -22,7 +20,6 @@ describe('property views', () => { it.each([ 'http://xmlns.com/foaf/0.1/mbox' ])('renders %s as anchor', (property) => { - const asImage = viewAsImage(document) const views = propertyViews(document) const view = views.defaults[property] const result = view(sym('mailto:alice@mail.example')) diff --git a/src/outline/queryByExample.js b/src/outline/queryByExample.js index bc4a2fff..1abcc2aa 100644 --- a/src/outline/queryByExample.js +++ b/src/outline/queryByExample.js @@ -99,7 +99,7 @@ function makeQueryRow (q, tr, constraint) { // ////////////////////////////// - var st = tr.AJAR_statement + const st = tr.AJAR_statement const constraintVar = tr.AJAR_inverse ? st.subject : st.object // this is only used for constraints let hasParent = true diff --git a/src/outline/userInput.js b/src/outline/userInput.js index c0dc9072..450dfe38 100644 --- a/src/outline/userInput.js +++ b/src/outline/userInput.js @@ -209,8 +209,8 @@ module.exports = function UserInput (outline) { } switch (fromCode) { case 'predicates': - case 'objects': - var allArray = outline.clipboard.all + case 'objects': { + const allArray = outline.clipboard.all for (let i = 0; true; i++) { if (term.sameTerm(allArray[i])) { allArray.splice(i, 1) @@ -218,6 +218,7 @@ module.exports = function UserInput (outline) { } } break + } case 'all': throw new Error( 'hostorical code not understood - what is theCollection?' @@ -243,12 +244,13 @@ module.exports = function UserInput (outline) { term = termFrom('objects') if (!term) return break - case 'selected': // header , undetermined generated - var returnArray = termFrom('all') + case 'selected': { // header , undetermined generated + const returnArray = termFrom('all') if (!returnArray) return term = returnArray[0] this.insertTermTo(selectedTd, term, returnArray[1]) return + } } this.insertTermTo(selectedTd, term) }, @@ -316,16 +318,19 @@ module.exports = function UserInput (outline) { const target = selectedTd const about = this.getStatementAbout(target) // timbl - to avoid alert from random clicks if (!about) return + let obj + let trNode try { - var obj = UI.utils.getTerm(target) - var trNode = UI.utils.ancestor(target, 'TR') + obj = UI.utils.getTerm(target) + trNode = UI.utils.ancestor(target, 'TR') } catch (e) { UI.log.warn('userinput.js: ' + e + UI.utils.getAbout(kb, selectedTd)) UI.log.error(target + ' getStatement Error:' + e) } + let tdNode try { - var tdNode = trNode.lastChild + tdNode = trNode.lastChild } catch (e) { UI.log.error(e + '@' + target) } @@ -414,17 +419,23 @@ module.exports = function UserInput (outline) { /* goes here when either this is a literal or escape from menu and then input text */ clearInputAndSave: function clearInputAndSave (e) { + let obj if (!this.lastModified) return if (!this.lastModified.isNew) { try { - var obj = this.getStatementAbout(this.lastModified).object + obj = this.getStatementAbout(this.lastModified).object } catch (e) { return } } let s = this.lastModifiedStat // when 'isNew' this is set at addNewObject() + let defaultpropview + let trNode + let reqTerm + let preStat if (this.lastModified.value !== this.lastModified.defaultValue) { + let trCache if (this.lastModified.value === '') { // ToDo: remove this this.lastModified.value = this.lastModified.defaultValue @@ -438,8 +449,8 @@ module.exports = function UserInput (outline) { s.why ) // TODO: DEFINE ERROR CALLBACK - var defaultpropview = this.views.defaults[s.predicate.uri] - var trCache = UI.utils.ancestor(this.lastModified, 'TR') + defaultpropview = this.views.defaults[s.predicate.uri] + trCache = UI.utils.ancestor(this.lastModified, 'TR') try { UI.store.updater.update([], [s], function ( uri, @@ -478,13 +489,13 @@ module.exports = function UserInput (outline) { } let s1, s2, s3 switch (obj.termType) { - case 'Literal': + case 'Literal': { // generate path and nailing from current values // TODO: DEFINE ERROR CALLBACK - var valueCache = this.lastModified.value + const valueCache = this.lastModified.value trCache = UI.utils.ancestor(this.lastModified, 'TR') - var oldValue = this.lastModified.defaultValue + const oldValue = this.lastModified.defaultValue s2 = $rdf.st( s.subject, s.predicate, @@ -517,9 +528,10 @@ module.exports = function UserInput (outline) { // obj.value=this.lastModified.value; // UserInputFormula.statements.push(s); break - case 'BlankNode': // a request refill with text + } + case 'BlankNode': { // a request refill with text // var newStat - var textTerm = kb.literal(this.lastModified.value, '') + const textTerm = kb.literal(this.lastModified.value, '') // if (s.predicate.termType === 'Collection') { // case: add triple ????????? Weird - tbl @@ -602,15 +614,16 @@ module.exports = function UserInput (outline) { return // The new Td is already generated by fillInRequest, so it's done. } break + } } } } else if (this.lastModified.isNew) { // generate 'Request', there is no way you can input ' (Please Input) ' - var trNode = UI.utils.ancestor(this.lastModified, 'TR') - var reqTerm = this.generateRequest( + trNode = UI.utils.ancestor(this.lastModified, 'TR') + reqTerm = this.generateRequest( '(To be determined. Re-type of drag an object onto this field)' ) - var preStat = trNode.previousSibling.AJAR_statement // the statement of the same predicate + preStat = trNode.previousSibling.AJAR_statement // the statement of the same predicate this.formUndetStat( trNode, preStat.subject, @@ -760,10 +773,11 @@ module.exports = function UserInput (outline) { trIterator.childNodes.length === 1; trIterator = trIterator.previousSibling ); + let predicateTd if (trIterator === removedTr) { const theNext = trIterator.nextSibling if (theNext.nextSibling && theNext.childNodes.length === 1) { - var predicateTd = trIterator.firstChild + predicateTd = trIterator.firstChild predicateTd.setAttribute( 'rowspan', parseInt(predicateTd.getAttribute('rowspan')) - 1 @@ -836,9 +850,11 @@ module.exports = function UserInput (outline) { }, insertTermTo: function insertTermTo (selectedTd, term, isObject) { + let defaultpropview + let preStat switch (selectedTd.className) { case 'undetermined selected': - var defaultpropview = this.views.defaults[ + defaultpropview = this.views.defaults[ selectedTd.parentNode.AJAR_statement.predicate.uri ] this.fillInRequest( @@ -847,13 +863,13 @@ module.exports = function UserInput (outline) { term ) break - case 'pred selected': // paste objects into this predicate - var insertTr = this.appendToPredicate(selectedTd) - var preStat = selectedTd.parentNode.AJAR_statement + case 'pred selected': { // paste objects into this predicate + const insertTr = this.appendToPredicate(selectedTd) + preStat = selectedTd.parentNode.AJAR_statement defaultpropview = this.views.defaults[preStat.predicate.uri] insertTr.appendChild(outline.outlineObjectTD(term, defaultpropview)) // modify store and update here - var isInverse = selectedTd.parentNode.AJAR_inverse + const isInverse = selectedTd.parentNode.AJAR_inverse if (!isInverse) { insertTr.AJAR_statement = kb.add( preStat.subject, @@ -897,10 +913,10 @@ module.exports = function UserInput (outline) { insertTr.AJAR_inverse = isInverse UserInputFormula.statements.push(insertTr.AJAR_statement) break - - case 'selected': // header , undetermined generated - var paneDiv = UI.utils.ancestor(selectedTd, 'TABLE').lastChild - var newTr = paneDiv.insertBefore( + } + case 'selected': { // header , undetermined generated + const paneDiv = UI.utils.ancestor(selectedTd, 'TABLE').lastChild + const newTr = paneDiv.insertBefore( myDocument.createElement('tr'), paneDiv.lastChild ) @@ -945,6 +961,7 @@ module.exports = function UserInput (outline) { this.startFillInText(newTr.lastChild) } break + } } }, @@ -954,6 +971,9 @@ module.exports = function UserInput (outline) { let predicateQuery if (isPredicate) { // predicateTd + let subject + let subjectClass + let sparqlText if (selectedTd.nextSibling.className === 'undetermined') { /* Make set of proprties to propose for a predicate. The naive approach is to take those which have a class @@ -980,12 +1000,12 @@ module.exports = function UserInput (outline) { ?pred rdfs:domain ?subjectClass. } */ - var subject = UI.utils.getAbout( + subject = UI.utils.getAbout( kb, UI.utils.ancestor(selectedTd, 'TABLE').parentNode ) - var subjectClass = kb.any(subject, rdf('type')) - var sparqlText = [] + subjectClass = kb.any(subject, rdf('type')) + sparqlText = [] const endl = '.\n' sparqlText[0] = 'SELECT ?pred WHERE{\n?pred ' + @@ -1418,18 +1438,20 @@ module.exports = function UserInput (outline) { this.className = 'bottom-border-active' if (this._tabulatorMode === 1) { switch (UI.utils.getTarget(e).tagName) { - case 'TD': - var preTd = UI.utils.getTarget(e) + case 'TD': { + const preTd = UI.utils.getTarget(e) if (preTd.className === 'pred') preTd.style.cursor = 'copy' break + } // Uh...I think I might have to give up this - case 'DIV': - var border = UI.utils.getTarget(e) + case 'DIV': { + const border = UI.utils.getTarget(e) if (UI.utils.getTarget(e).className === 'bottom-border') { border.style.borderColor = 'rgb(100%,65%,0%)' border.style.cursor = 'copy' } break + } default: } } @@ -1479,8 +1501,9 @@ module.exports = function UserInput (outline) { if (!trNode) { throw new Error('No ancestor TR for the TD we clicked on:' + something) } + let statement try { - var statement = trNode.AJAR_statement + statement = trNode.AJAR_statement } catch (e) { throw new Error( 'No AJAR_statement!' + @@ -1761,9 +1784,10 @@ module.exports = function UserInput (outline) { table.addEventListener('mouseover', highlightTr, false) // setting for action after selecting item + let selectItem switch (menuType) { case 'DidYouMeanDialog': - var selectItem = function selectItem (e) { + selectItem = function selectItem (e) { qp('DID YOU MEAN SELECT ITEM!!!!!') const target = UI.utils.ancestor(UI.utils.getTarget(e), 'TR') if (target.childNodes.length === 2 && target.nextSibling) { @@ -1775,8 +1799,8 @@ module.exports = function UserInput (outline) { } } break - case 'LimitedPredicateChoice': - var clickedTd = extraInformation.clickedTd + case 'LimitedPredicateChoice': { + const clickedTd = extraInformation.clickedTd selectItem = function selectItem (e) { qp('LIMITED P SELECT ITEM!!!!') const selectedPredicate = UI.utils.getAbout(kb, UI.utils.getTarget(e)) @@ -1800,14 +1824,15 @@ module.exports = function UserInput (outline) { This.lastModified.select() } break + } case 'PredicateAutoComplete': case 'GeneralAutoComplete': case 'GeneralPredicateChoice': case 'JournalTitleAutoComplete': // hql - case 'TypeChoice': + case 'TypeChoice': { // Clickable menu - var isPredicate = extraInformation.isPredicate - var selectedTd = extraInformation.selectedTd + const isPredicate = extraInformation.isPredicate + const selectedTd = extraInformation.selectedTd selectItem = function selectItem (e) { qp('WOOHOO') const inputTerm = UI.utils.getAbout(kb, UI.utils.getTarget(e)) @@ -1837,6 +1862,7 @@ module.exports = function UserInput (outline) { } } break + } default: throw new Error('userinput: unexpected mode') } @@ -1898,18 +1924,23 @@ module.exports = function UserInput (outline) { e.stopPropagation() } let inputText + let bnodeTerm + let IDpredicate + let IDterm + let tr + let th switch (menuType) { - case 'DidYouMeanDialog': - var dialogTerm = extraInformation.dialogTerm - var bnodeTerm = extraInformation.bnodeTerm + case 'DidYouMeanDialog': { + const dialogTerm = extraInformation.dialogTerm + bnodeTerm = extraInformation.bnodeTerm // have to do style instruction passing menu.style.width = 'auto' - var h1 = table.appendChild(myDocument.createElement('tr')) - var h1th = h1.appendChild(myDocument.createElement('th')) + const h1 = table.appendChild(myDocument.createElement('tr')) + const h1th = h1.appendChild(myDocument.createElement('th')) h1th.appendChild(myDocument.createTextNode('Did you mean...')) - var plist = kb.statementsMatching(dialogTerm) - var i + const plist = kb.statementsMatching(dialogTerm) + let i for (i = 0; i < plist.length; i++) { if ( kb.whether( @@ -1921,28 +1952,28 @@ module.exports = function UserInput (outline) { break } } - var IDpredicate = plist[i].predicate - var IDterm = kb.any(dialogTerm, plist[i].predicate) - var text = + const IDpredicate = plist[i].predicate + const IDterm = kb.any(dialogTerm, plist[i].predicate) + const text = UI.utils.label(dialogTerm) + ' who has ' + UI.utils.label(IDpredicate) + ' ' + IDterm + '?' - var h2 = table.appendChild(myDocument.createElement('tr')) - var h2th = h2.appendChild(myDocument.createElement('th')) + const h2 = table.appendChild(myDocument.createElement('tr')) + const h2th = h2.appendChild(myDocument.createElement('th')) h2th.appendChild(myDocument.createTextNode(text)) h1th.setAttribute('colspan', '2') h2th.setAttribute('colspan', '2') - var ans1 = table.appendChild(myDocument.createElement('tr')) + const ans1 = table.appendChild(myDocument.createElement('tr')) ans1 .appendChild(myDocument.createElement('th')) .appendChild(myDocument.createTextNode('Yes')) ans1 .appendChild(myDocument.createElement('td')) .appendChild(myDocument.createTextNode('BOOLEAN')) - var ans2 = table.appendChild(myDocument.createElement('tr')) + const ans2 = table.appendChild(myDocument.createElement('tr')) ans2 .appendChild(myDocument.createElement('th')) .appendChild(myDocument.createTextNode('No')) @@ -1950,6 +1981,7 @@ module.exports = function UserInput (outline) { .appendChild(myDocument.createElement('td')) .appendChild(myDocument.createTextNode('BOOLEAN')) break + } case 'PredicateAutoComplete': // Prompt user for possible relationships for new data inputText = extraInformation.inputText /* The labeller functionality code ahs been lost or dropped -- reinstate this? */ @@ -1989,7 +2021,7 @@ module.exports = function UserInput (outline) { addMenuItem(entries[i][1]) } break - case 'GeneralAutoComplete': + case 'GeneralAutoComplete': { inputText = extraInformation.inputText try { results = outline.labeller.search(inputText) @@ -2003,7 +2035,7 @@ module.exports = function UserInput (outline) { ) } entries = results[0] // [label, subject,priority] - var types = results[1] + const types = results[1] if (entries.length === 0) { console.log('cm length 0\n') // hq this.clearMenu() @@ -2014,9 +2046,9 @@ module.exports = function UserInput (outline) { // console.log("\nGEN ENTRIES["+i+"] = "+entries[i]+"\n");//hq const thisNT = entries[i][1].toNT() // console.log("thisNT="+thisNT+"\n"); - var tr = table.appendChild(myDocument.createElement('tr')) + tr = table.appendChild(myDocument.createElement('tr')) tr.setAttribute('about', thisNT) - var th = tr.appendChild(myDocument.createElement('th')) + th = tr.appendChild(myDocument.createElement('th')) th.appendChild(myDocument.createElement('div')).appendChild( myDocument.createTextNode(entries[i][0]) ) @@ -2045,7 +2077,8 @@ module.exports = function UserInput (outline) { } */ break - case 'JournalTitleAutoComplete': // hql + } + case 'JournalTitleAutoComplete': { // hql // HEART OF JOURNAL TITLE AUTOCOMPLETE // extraInformatin is from above getAutoCompleteHandler @@ -2054,9 +2087,9 @@ module.exports = function UserInput (outline) { console.log('\n===start JournalTitleAutoComplete\n') // Gets all the URI's with type Journal in the knowledge base - var juris = kb.each(undefined, rdf('type'), bibo('Journal')) + const juris = kb.each(undefined, rdf('type'), bibo('Journal')) - var matchedtitle = [] // debugging display before inserts into menu + const matchedtitle = [] // debugging display before inserts into menu for (let i = 0; i < juris.length; i++) { const juri = juris[i] @@ -2090,17 +2123,19 @@ module.exports = function UserInput (outline) { console.log("\\\\done showMenu's JTAutocomplete\n") break - case 'LimitedPredicateChoice': - var choiceTerm = UI.utils.getAbout(kb, extraInformation.clickedTd) + } + case 'LimitedPredicateChoice': { + const choiceTerm = UI.utils.getAbout(kb, extraInformation.clickedTd) // because getAbout relies on kb.fromNT, which does not deal with // the 'Collection' termType. This termType is ambiguous anyway. choiceTerm.termType = 'Collection' - var choices = kb.each(choiceTerm, UI.ns.link('element')) + const choices = kb.each(choiceTerm, UI.ns.link('element')) for (let i = 0; i < choices.length; i++) { addMenuItem(choices[i]) } break - default: + } + default: { tr = table.appendChild(myDocument.createElement('tr')) tr.className = 'no-suggest' th = tr.appendChild(myDocument.createElement('th')) @@ -2115,7 +2150,7 @@ module.exports = function UserInput (outline) { // var This = this tr.addEventListener('click', clearMenu, 'false') - var nullFetcher = function () {} + const nullFetcher = function () {} switch (inputQuery.constructor.name) { case 'Array': for (let i = 0; i < inputQuery.length; i++) { @@ -2132,6 +2167,7 @@ module.exports = function UserInput (outline) { default: kb.query(inputQuery, addPredicateChoice(inputQuery), nullFetcher) } + } } }, // funciton showMenu diff --git a/src/pad/padPane.ts b/src/pad/padPane.ts index ec1816dc..6d82fe7a 100644 --- a/src/pad/padPane.ts +++ b/src/pad/padPane.ts @@ -35,7 +35,7 @@ const paneDef: PaneDefinition = { const newInstance = (newPaneOptions.newInstance = newPaneOptions.newInstance || store.sym(newPaneOptions.newBase + 'index.ttl#this')) - // var newInstance = kb.sym(newBase + 'pad.ttl#thisPad'); + // const newInstance = kb.sym(newBase + 'pad.ttl#thisPad'); const newPadDoc = newInstance.doc() store.add(newInstance, ns.rdf('type'), ns.pad('Notepad'), newPadDoc) @@ -94,7 +94,7 @@ const paneDef: PaneDefinition = { // Access control - // Two variations of ACL for this app, public read and public read/write + // Two constiations of ACL for this app, public read and public read/write // In all cases owner has read write control const genACLtext = function ( docURI: string, @@ -200,7 +200,7 @@ const paneDef: PaneDefinition = { } // Option of either using the workspace system or just typing in a URI - var showBootstrap = function showBootstrap ( + const showBootstrap = function showBootstrap ( thisInstance: any, container: HTMLElement, noun: string @@ -243,7 +243,7 @@ const paneDef: PaneDefinition = { } // Create new document files for new instance of app - var initializeNewInstanceInWorkspace = function (ws: NamedNode) { + const initializeNewInstanceInWorkspace = function (ws: NamedNode) { // @@ TODO Clean up type for newBase let newBase: any = store.any(ws, ns.space('uriPrefix')) if (!newBase) { @@ -261,7 +261,7 @@ const paneDef: PaneDefinition = { initializeNewInstanceAtBase(thisInstance, newBase) } - var initializeNewInstanceAtBase = function ( + const initializeNewInstanceAtBase = function ( thisInstance: any, newBase: string ) { @@ -498,20 +498,20 @@ const paneDef: PaneDefinition = { } // Body of Pane - var appPathSegment = 'app-pad.timbl.com' // how to allocate this string and connect to + const appPathSegment = 'app-pad.timbl.com' // how to allocate this string and connect to const fetcher = store.fetcher const updater = store.updater let me: any - var PAD = Namespace('http://www.w3.org/ns/pim/pad#') + const PAD = Namespace('http://www.w3.org/ns/pim/pad#') - var thisInstance = subject - var padDoc = subject.doc() + const thisInstance = subject + const padDoc = subject.doc() let padEle - var div = dom.createElement('div') + const div = dom.createElement('div') // Build the DOM const structure = div.appendChild(dom.createElement('table')) // @@ make responsive style @@ -526,19 +526,19 @@ const paneDef: PaneDefinition = { naviLoginoutTR.appendChild(dom.createElement('td')) const naviTop = structure.appendChild(dom.createElement('tr')) // stuff - var naviMain = naviTop.appendChild(dom.createElement('td')) + const naviMain = naviTop.appendChild(dom.createElement('td')) naviMain.setAttribute('colspan', '3') const naviMiddle = structure.appendChild(dom.createElement('tr')) // controls const naviMiddle1 = naviMiddle.appendChild(dom.createElement('td')) - var naviMiddle2 = naviMiddle.appendChild(dom.createElement('td')) - var naviMiddle3 = naviMiddle.appendChild(dom.createElement('td')) + const naviMiddle2 = naviMiddle.appendChild(dom.createElement('td')) + const naviMiddle3 = naviMiddle.appendChild(dom.createElement('td')) const naviStatus = structure.appendChild(dom.createElement('tr')) // status etc const statusArea = naviStatus.appendChild(dom.createElement('div')) const naviSpawn = structure.appendChild(dom.createElement('tr')) // create new - var spawnArea = naviSpawn.appendChild(dom.createElement('div')) + const spawnArea = naviSpawn.appendChild(dom.createElement('div')) const naviMenu = structure.appendChild(dom.createElement('tr')) naviMenu.setAttribute('class', 'naviMenu') @@ -547,7 +547,7 @@ const paneDef: PaneDefinition = { naviMenu.appendChild(dom.createElement('td')) naviMenu.appendChild(dom.createElement('td')) - var options: any = { statusArea: statusArea, timingArea: naviMiddle1 } + const options: any = { statusArea: statusArea, timingArea: naviMiddle1 } loadPadData() diff --git a/src/playlist/playlistPane.js b/src/playlist/playlistPane.js index b0de6398..14983ab2 100644 --- a/src/playlist/playlistPane.js +++ b/src/playlist/playlistPane.js @@ -114,6 +114,7 @@ module.exports = { img.setAttribute('style', 'max-width: 560; max-height: 315;') } + let descDiv if (index) { const sl = kb.statementsMatching( null, @@ -127,7 +128,7 @@ module.exports = { } index = parseInt(index.value, 10) - var descDiv = myDocument.createElement('div') + descDiv = myDocument.createElement('div') const pIndex = slots[(slots.indexOf(index) - 1 + slots.length) % slots.length] diff --git a/src/schedule/schedulePane.js b/src/schedule/schedulePane.js index 57fee58d..ad39b60f 100644 --- a/src/schedule/schedulePane.js +++ b/src/schedule/schedulePane.js @@ -53,7 +53,7 @@ module.exports = { // ////////////////////// Accesss control - // Two variations of ACL for this app, public read and public read/write + // Two constiations of ACL for this app, public read and public read/write // In all cases owner has read write control const genACLtext = function (docURI, aclURI, allWrite) { @@ -81,8 +81,8 @@ module.exports = { } /* - var setACL3 = function (docURI, allWrite, callbackFunction) { - var aclText = genACLtext(docURI, aclDoc.uri, allWrite) + const setACL3 = function (docURI, allWrite, callbackFunction) { + const aclText = genACLtext(docURI, aclDoc.uri, allWrite) return UI.acl.setACL(docURI, aclText, callbackFunction) } */ @@ -138,10 +138,10 @@ module.exports = { } // Body of mintNew - var fetcher = kb.fetcher + const fetcher = kb.fetcher const updater = kb.updater - var me = options.me || UI.authn.currentUser() + let me = options.me || UI.authn.currentUser() if (!me) { console.log('MUST BE LOGGED IN') alert('NOT LOGGED IN') @@ -333,7 +333,7 @@ module.exports = { const base = baseDir.uri const resultsDoc = $rdf.sym(base + 'results.ttl') - // var formsURI = base + 'forms.ttl' + // const formsURI = base + 'forms.ttl' // We can't in fact host stuff from there because of CORS const formsURI = 'https://solid.github.io/solid-panes/schedule/formsForSchedule.ttl' @@ -406,7 +406,7 @@ module.exports = { // /////////////////////// Create new document files for new instance of app - var initializeNewInstanceInWorkspace = function (ws) { + const initializeNewInstanceInWorkspace = function (ws) { let newBase = kb.any(ws, ns.space('uriPrefix')) if (!newBase) { newBase = ws.uri.split('#')[0] @@ -423,7 +423,7 @@ module.exports = { initializeNewInstanceAtBase(thisInstance, newBase) } - var initializeNewInstanceAtBase = function (thisInstance, newBase) { + const initializeNewInstanceAtBase = function (thisInstance, newBase) { const options = { thisInstance: thisInstance, newBase: newBase } this.mintNew(context, options) .then(function (options) { @@ -462,7 +462,7 @@ module.exports = { */ } - var getDetails = function () { + const getDetails = function () { console.log('getDetails()') // Looking for blank screen hang-up fetcher.nowOrWhenFetched(detailsDoc.uri, undefined, function (ok, body) { console.log('getDetails() ok? ' + ok) @@ -471,7 +471,7 @@ module.exports = { }) } - var showAppropriateDisplay = function showAppropriateDisplay () { + const showAppropriateDisplay = function showAppropriateDisplay () { console.log('showAppropriateDisplay()') UI.authn.checkUser().then(webId => { @@ -502,7 +502,7 @@ module.exports = { }) } - var showSignon = function showSignon () { + const showSignon = function showSignon () { clearElement(naviMain) const signonContext = { div: div, dom: dom } UI.authn.logIn(signonContext).then(context => { @@ -512,7 +512,7 @@ module.exports = { }) } - var showBootstrap = function showBootstrap () { + const showBootstrap = function showBootstrap () { const div = clearElement(naviMain) div.appendChild( UI.authn.newAppInstance( @@ -552,7 +552,7 @@ module.exports = { const doneButton = dom.createElement('button') - var showForms = function () { + const showForms = function () { clearElement(naviCenter) // Remove refresh button if nec const div = naviMain const wizard = true @@ -596,7 +596,7 @@ module.exports = { b2.removeAttribute('disabled') } } - var b1 = clearElement(naviLeft).appendChild(dom.createElement('button')) + const b1 = clearElement(naviLeft).appendChild(dom.createElement('button')) b1.setAttribute('style', inputStyle) b1.textContent = '<- go back' b1.addEventListener( @@ -610,7 +610,7 @@ module.exports = { false ) - var b2 = clearElement(naviRight).appendChild( + const b2 = clearElement(naviRight).appendChild( dom.createElement('button') ) b2.setAttribute('style', inputStyle) @@ -706,7 +706,7 @@ module.exports = { false ) - var emailButton = dom.createElement('button') + const emailButton = dom.createElement('button') emailButton.setAttribute('style', inputStyle) const emailIcon = emailButton.appendChild(dom.createElement('img')) emailIcon.setAttribute('src', UI.icons.iconBase + 'noun_480183.svg') // noun_480183.svg @@ -745,13 +745,13 @@ module.exports = { // Ask for each day, what times .. @@ to be added some time /* - var setTimesOfDay = function () { - var i, j, x, y, slot, cell, day - var insertables = [] - var possibleDays = kb.each(invitation, ns.sched('option')) + const setTimesOfDay = function () { + const i, j, x, y, slot, cell, day + const insertables = [] + const possibleDays = kb.each(invitation, ns.sched('option')) .map(function (opt) {return kb.any(opt, ns.cal('dtstart'))}) - var cellLookup = [] - var slots = kb.each(invitation, ns.sched('slot')) + const cellLookup = [] + const slots = kb.each(invitation, ns.sched('slot')) if (slots.length === 0) { for (i = 0; i < 2; i++) { slot = UI.widgets.newThing(detailsDoc) @@ -769,32 +769,32 @@ module.exports = { } } - var query = new $rdf.Query('TimesOfDay') - var v = {}['day', 'label', 'value', 'slot', 'cell'].map(function (x) { - query.vars.push(v[x] = $rdf.variable(x)) }) + const query = new $rdf.Query('TimesOfDay') + const v = {}['day', 'label', 'value', 'slot', 'cell'].map(function (x) { + query.consts.push(v[x] = $rdf.constiable(x)) }) query.pat.add(invitation, ns.sched('slot'), v.slot) query.pat.add(v.slot, ns.rdfs('label'), v.label) query.pat.add(v.slot, ns.sched('cell'), v.cell) query.pat.add(v.cell, ns.sched('timeOfDay'), v.value) query.pat.add(v.cell, ns.sched('day'), v.day) - var options = {} + const options = {} options.set_x = kb.each(subject, ns.sched('slot')) // @@@@@ option -> dtstart in future options.set_x = options.set_x.map(function (opt) { return kb.any(opt, ns.rdfs('label')) }) options.set_y = kb.each(subject, ns.sched('option')); // @@@@@ option -> dtstart in future options.set_y = options.set_y.map(function (opt) { return kb.any(opt, ns.cal('dtstart')) }) - var possibleTimes = kb.each(invitation, ns.sched('option')) + const possibleTimes = kb.each(invitation, ns.sched('option')) .map(function (opt) { return kb.any(opt, ns.cal('dtstart')) }) - var displayTheMatrix = function () { - var matrix = div.appendChild(UI.matrix.matrixForQuery( + const displayTheMatrix = function () { + const matrix = div.appendChild(UI.matrix.matrixForQuery( dom, query, v.time, v.author, v.value, options, function () {})) matrix.setAttribute('class', 'matrix') - var refreshButton = dom.createElement('button') + const refreshButton = dom.createElement('button') refreshButton.setAttribute('style', inputStyle) refreshButton.textContent = 'refresh' refreshButton.addEventListener('click', function (e) { @@ -813,21 +813,21 @@ module.exports = { naviCenter.appendChild(refreshButton) } - var dataPointForNT = [] + const dataPointForNT = [] - var doc = resultsDoc + const doc = resultsDoc options.set_y = options.set_y.filter(function (z) { return (! z.sameTerm(me)) }) options.set_y.push(me) // Put me on the end options.cellFunction = function (cell, x, y, value) { - // var point = cellLookup[x.toNT() + y.toNT()] + // const point = cellLookup[x.toNT() + y.toNT()] if (y.sameTerm(me)) { - var callbackFunction = function () { refreshCellColor(cell, value); }; // @@ may need that - var selectOptions = {} - var predicate = ns.sched('timeOfDay') - var cellSubject = dataPointForNT[x.toNT()] - var selector = UI.widgets.makeSelectForOptions(dom, kb, cellSubject, predicate, + const callbackFunction = function () { refreshCellColor(cell, value); }; // @@ may need that + const selectOptions = {} + const predicate = ns.sched('timeOfDay') + const cellSubject = dataPointForNT[x.toNT()] + const selector = UI.widgets.makeSelectForOptions(dom, kb, cellSubject, predicate, possibleAvailabilities, selectOptions, resultsDoc, callbackFunction) cell.appendChild(selector) } else if (value !== null) { @@ -836,29 +836,29 @@ module.exports = { } - var responses = kb.each(invitation, ns.sched('response')) - var myResponse = null + const responses = kb.each(invitation, ns.sched('response')) + const myResponse = null responses.map(function (r) { if (kb.holds(r, ns.dc('author'), me)) { myResponse = r } }) - var id = UI.widgets.newThing(doc).uri + const id = UI.widgets.newThing(doc).uri if (myResponse === null) { myResponse = $rdf.sym(id + '_response') insertables.push($rdf.st(invitation, ns.sched('response'), myResponse, doc)) insertables.push($rdf.st(myResponse, ns.dc('author'), me, doc)) } else { - var dps = kb.each(myResponse, ns.sched('cell')) + const dps = kb.each(myResponse, ns.sched('cell')) dps.map(function (dataPoint) { - var time = kb.any(dataPoint, ns.cal('dtstart')) + const time = kb.any(dataPoint, ns.cal('dtstart')) dataPointForNT[time.toNT()] = dataPoint }) } for (let j = 0; j < possibleTimes.length; j++) { if (dataPointForNT[possibleTimes[j].toNT()]) continue - var dataPoint = $rdf.sym(id + '_' + j) + const dataPoint = $rdf.sym(id + '_' + j) insertables.push($rdf.st(myResponse, ns.sched('cell'), dataPoint, doc)) insertables.push($rdf.st(dataPoint, ns.cal('dtstart'), possibleTimes[j], doc)) // @@ dataPointForNT[possibleTimes[j].toNT()] = dataPoint @@ -879,7 +879,7 @@ module.exports = { // end setTimesOfDay // Read or create empty results file - var getResults = function () { + const getResults = function () { fetcher.nowOrWhenFetched(resultsDoc.uri, (ok, body, response) => { if (!ok) { if (response.status === 404) { @@ -921,13 +921,13 @@ module.exports = { }) } - var showResults = function () { + const showResults = function () { // Now the form for responsing to the poll // // div.appendChild(dom.createElement('hr')) - // var invitation = subject + // const invitation = subject const title = kb.any(invitation, ns.cal('summary')) const comment = kb.any(invitation, ns.cal('comment')) const location = kb.any(invitation, ns.cal('location')) @@ -952,7 +952,7 @@ module.exports = { const v = {} const vs = ['time', 'author', 'value', 'resp', 'cell'] vs.forEach(function (x) { - query.vars.push((v[x] = $rdf.variable(x))) + query.consts.push((v[x] = $rdf.constiable(x))) }) query.pat.add(invitation, ns.sched('response'), v.resp) query.pat.add(v.resp, ns.dc('author'), v.author) @@ -1022,9 +1022,9 @@ module.exports = { } // @@ Give other combos too-- see schedule ontology - // var possibleAvailabilities = [ SCHED('No'), SCHED('Maybe'), SCHED('Yes') ] + // const possibleAvailabilities = [ SCHED('No'), SCHED('Maybe'), SCHED('Yes') ] - // var me = UI.authn.currentUser() + // const me = UI.authn.currentUser() const dataPointForNT = [] @@ -1152,7 +1152,7 @@ module.exports = { naviRight.appendChild(newInstanceButton()) } // showResults - var div = dom.createElement('div') + const div = dom.createElement('div') const structure = div.appendChild(dom.createElement('table')) // @@ make responsive style structure.setAttribute( 'style', @@ -1164,9 +1164,9 @@ module.exports = { naviLoginoutTR.appendChild(dom.createElement('td')) naviLoginoutTR.appendChild(dom.createElement('td')) - var logInOutButton = null + const logInOutButton = null /* - var logInOutButton = UI.authn.loginStatusBox(dom, setUser) + const logInOutButton = UI.authn.loginStatusBox(dom, setUser) // floating divs lead to a mess // logInOutButton.setAttribute('style', 'float: right') // float the beginning of the end naviLoginout3.appendChild(logInOutButton) @@ -1174,7 +1174,7 @@ module.exports = { */ const naviTop = structure.appendChild(dom.createElement('tr')) - var naviMain = naviTop.appendChild(dom.createElement('td')) + const naviMain = naviTop.appendChild(dom.createElement('td')) naviMain.setAttribute('colspan', '3') const naviMenu = structure.appendChild(dom.createElement('tr')) @@ -1184,9 +1184,9 @@ module.exports = { ' text-align: middle; vertical-align: middle; padding-top: 4em; ' ) // naviMenu.setAttribute('style', 'margin-top: 3em;') - var naviLeft = naviMenu.appendChild(dom.createElement('td')) - var naviCenter = naviMenu.appendChild(dom.createElement('td')) - var naviRight = naviMenu.appendChild(dom.createElement('td')) + const naviLeft = naviMenu.appendChild(dom.createElement('td')) + const naviCenter = naviMenu.appendChild(dom.createElement('td')) + const naviRight = naviMenu.appendChild(dom.createElement('td')) getForms() diff --git a/src/socialPane.js b/src/socialPane.js index c7bb6f9b..a0edb86e 100644 --- a/src/socialPane.js +++ b/src/socialPane.js @@ -158,8 +158,8 @@ module.exports = { // ////////// Body of render(): - var outliner = context.getOutliner(dom) - var kb = context.session.store + const outliner = context.getOutliner(dom) + const kb = context.session.store const div = dom.createElement('div') div.setAttribute('class', 'socialPane') const foaf = UI.ns.foaf @@ -182,7 +182,7 @@ module.exports = { tools.style.cssText = navBlockStyle const mainTable = middle.appendChild(dom.createElement('table')) mainTable.style.cssText = mainBlockStyle - var tips = right + const tips = right tips.style.cssText = navBlockStyle // Image top left @@ -226,6 +226,8 @@ module.exports = { // Do I have a public profile document? let profile = null // This could be SPARQL { ?me foaf:primaryTopic [ a foaf:PersonalProfileDocument ] } let editable = false + let incoming + let outgoing if (me) { // The definition of FAF personal profile document is .. const works = kb.each(undefined, foaf('primaryTopic'), me) // having me as primary topic @@ -273,8 +275,8 @@ module.exports = { tools.appendChild(h3) const cme = kb.canon(me) - var incoming = kb.whether(s, knows, cme) - var outgoing = false + incoming = kb.whether(s, knows, cme) + outgoing = false const outgoingSt = kb.statementsMatching(cme, knows, s) if (outgoingSt.length) { outgoing = true @@ -427,7 +429,7 @@ module.exports = { } items.sort() let last = null - var fr + let fr for (let j7 = 0; j7 < items.length; j7++) { fr = items[j7][1] if (fr.sameTerm(last)) continue // unique @@ -471,7 +473,7 @@ module.exports = { } uris.sort() let last2 = '' - var lab2 + let lab2 for (let k = 0; k < uris.length; k++) { const uri = uris[k] if (uri === last2) continue // uniques only diff --git a/src/trustedApplications/trustedApplications.dom.ts b/src/trustedApplications/trustedApplications.dom.ts index 866086f2..da2b0119 100644 --- a/src/trustedApplications/trustedApplications.dom.ts +++ b/src/trustedApplications/trustedApplications.dom.ts @@ -196,11 +196,12 @@ function createApplicationEntry ( } } -function createElement ( +function createElement ( elementName: K, attributes: { [name: string]: string } = {}, - eventListeners: { [eventName: string]: EventListener } = {}, - onCreated: null | ((createdElement: HTMLElementTagNameMap[K]) => void) = null + eventListeners: { [eventName: string]: globalThis.EventListener } = {}, + // eslint-disable-next-line no-unused-vars + onCreated: null | ((createdElement: globalThis.HTMLElementTagNameMap[K]) => void) = null ) { const element = document.createElement(elementName) if (onCreated) { @@ -215,7 +216,7 @@ function createElement ( return element } -export function createContainer ( +export function createContainer ( elementName: K, children: HTMLElement[], attributes = {}, @@ -232,7 +233,7 @@ export function createContainer ( return element } -export function createText ( +export function createText ( elementName: K, textContent: string | null, attributes = {}, diff --git a/src/ui/pane.js b/src/ui/pane.js index b643a619..05edbb00 100644 --- a/src/ui/pane.js +++ b/src/ui/pane.js @@ -58,8 +58,9 @@ module.exports = { const t = kb.findTypeURIs(subject) let store = null + let docuri if (subject.uri) { - var docuri = $rdf.Util.uri.docpart(subject.uri) + docuri = $rdf.Util.uri.docpart(subject.uri) if (subject.uri !== docuri && kb.updater.editable(docuri)) { store = kb.sym($rdf.Util.uri.docpart(subject.uri)) } // an editable ontology with hash