layerpro 0.0.62 → 0.0.65

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/{dist/LICENSE.txt → LICENSE.txt} +0 -0
  2. package/{dist/README.md → README.md} +0 -0
  3. package/{documents/SECURITY.md → SECURITY.md} +0 -0
  4. package/index.js +2 -7
  5. package/index.js.LICENSE.txt +29 -0
  6. package/package.json +3 -1
  7. package/.editorconfig +0 -13
  8. package/.env +0 -3
  9. package/.eslintignore +0 -12
  10. package/.eslintrc.json +0 -110
  11. package/.gitattributes +0 -2
  12. package/.jsbeautifyrc +0 -26
  13. package/.prettierignore +0 -2
  14. package/.prettierrc +0 -7
  15. package/.vscode/launch.json +0 -22
  16. package/.vscode/settings.json +0 -84
  17. package/.vscodeignore +0 -28
  18. package/__mocks__/fileMock.js +0 -3
  19. package/__mocks__/styleMock.js +0 -3
  20. package/babel.config.js +0 -34
  21. package/backup.bat +0 -43
  22. package/coverage/clover.xml +0 -6
  23. package/coverage/coverage-final.json +0 -1
  24. package/coverage/lcov-report/base.css +0 -224
  25. package/coverage/lcov-report/block-navigation.js +0 -87
  26. package/coverage/lcov-report/favicon.png +0 -0
  27. package/coverage/lcov-report/index.html +0 -101
  28. package/coverage/lcov-report/prettify.css +0 -1
  29. package/coverage/lcov-report/prettify.js +0 -2
  30. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  31. package/coverage/lcov-report/sorter.js +0 -196
  32. package/coverage/lcov.info +0 -0
  33. package/documents/LICENSE.txt +0 -21
  34. package/documents/README.md +0 -7
  35. package/init.js +0 -33
  36. package/jest.config.js +0 -61
  37. package/jsconfig.json +0 -10
  38. package/node/createTag.js +0 -7
  39. package/node/gitDeploy.js +0 -7
  40. package/node/goLive.js +0 -7
  41. package/scripts/genLayer.jsx +0 -234
  42. package/scripts/message.jsx +0 -280
  43. package/scripts/mouseCoords.jsx +0 -45
  44. package/scripts/popup.jsx +0 -604
  45. package/scripts/purge.jsx +0 -29
  46. package/scripts/smoothScroll.js +0 -69
  47. package/scripts/window.js +0 -28
  48. package/styles/dock.scss +0 -100
  49. package/styles/general.scss +0 -241
  50. package/styles/icons.scss +0 -33
  51. package/styles/input.scss +0 -35
  52. package/styles/messages.scss +0 -76
  53. package/styles/resize.scss +0 -99
  54. package/styles/root.scss +0 -14
  55. package/styles/scrollbar.scss +0 -24
  56. package/tests/setupJest.tsx +0 -4
  57. package/tsconfig.json +0 -69
  58. package/typings/cordova.d.ts +0 -12
  59. package/typings/dphelper.d.ts +0 -29
  60. package/typings/image.d.ts +0 -9
  61. package/typings/index.d.ts +0 -7
  62. package/typings/layerpro.d.ts +0 -23
  63. package/typings/menupro.d.ts +0 -18
  64. package/typings/namespace.d.ts +0 -7
  65. package/typings/styles.d.ts +0 -27
  66. package/typings/vscode.d.ts +0 -14724
  67. package/webpack.config.js +0 -239
package/.eslintrc.json DELETED
@@ -1,110 +0,0 @@
1
- {
2
- "root": true,
3
- "env": {
4
- "browser": true,
5
- "node": true,
6
- "jest": true
7
- },
8
- "parser": "@typescript-eslint/parser",
9
- "parserOptions": {
10
- "ecmaVersion": "latest",
11
- "sourceType": "module",
12
- "parser": "babel-eslint",
13
- "ecmaFeatures": {
14
- "modules": true,
15
- "impliedStrict": true,
16
- "jsx": true,
17
- "experimentalObjectRestSpread": true
18
- }
19
- },
20
- "globals": {
21
- "jQuery": true,
22
- "$": true,
23
- "dphelper": true,
24
- "menupro": true,
25
- "layerpro": true
26
- },
27
- "settings": {
28
- "react": {
29
- "version": "detect"
30
- }
31
- },
32
- "plugins": [
33
- "react",
34
- "@typescript-eslint",
35
- "import",
36
- "node",
37
- "promise",
38
- "jest"
39
- ],
40
- "extends": [
41
- "eslint:recommended",
42
- "plugin:react/recommended",
43
- "plugin:@typescript-eslint/recommended",
44
- "plugin:node/recommended",
45
- "plugin:promise/recommended",
46
- "plugin:jest/recommended"
47
- ],
48
- "rules": {
49
- "no-empty": 0,
50
- "no-console": 0,
51
- "no-process-exit": 0,
52
- "@typescript-eslint/no-var-requires": 0,
53
- "node/no-unsupported-features/es-syntax": 0,
54
- "node/no-unsupported-features/node-builtins": 0,
55
- "no-underscore-dangle": [
56
- "off"
57
- ],
58
- "no-plusplus": [
59
- "warn",
60
- {
61
- "allowForLoopAfterthoughts": true
62
- }
63
- ],
64
- "no-param-reassign": [
65
- "off"
66
- ],
67
- "no-prototype-builtins": [
68
- "off"
69
- ],
70
- "no-unused-vars": [
71
- "warn"
72
- ],
73
- "unicorn/no-process-exit": 0,
74
- "comma-dangle": 0,
75
- "semi": [
76
- "error",
77
- "never"
78
- ],
79
- "consistent-return": [
80
- "off"
81
- ],
82
- "max-nested-callbacks": [
83
- "warn",
84
- 3
85
- ],
86
- "import/no-mutable-exports": [
87
- "warn"
88
- ],
89
- "valid-jsdoc": [
90
- "warn",
91
- {
92
- "prefer": {
93
- "returns": "return",
94
- "property": "prop"
95
- },
96
- "requireReturn": false
97
- }
98
- ],
99
- "operator-linebreak": [
100
- "error",
101
- "after",
102
- {
103
- "overrides": {
104
- "?": "ignore",
105
- ":": "ignore"
106
- }
107
- }
108
- ]
109
- }
110
- }
package/.gitattributes DELETED
@@ -1,2 +0,0 @@
1
- # Auto detect text files and perform LF normalization
2
- * text=auto
package/.jsbeautifyrc DELETED
@@ -1,26 +0,0 @@
1
- {
2
- "js":
3
- {
4
- "allowed_file_extensions": ["js", "ts", "tsx", "jsx", "json", "jshintrc", "jsbeautifyrc"],
5
- "brace_style": "collapse-preserve-inline",
6
- "break_chained_methods": false,
7
- "e4x": false,
8
- "end_with_newline": true,
9
- "indent_char": " ",
10
- "indent_level": 0,
11
- "indent_size": 2,
12
- "indent_with_tabs": false,
13
- "jslint_happy": true,
14
- "keep_array_indentation": false,
15
- "keep_function_indentation": false,
16
- "max_preserve_newlines": 2,
17
- "preserve_newlines": true,
18
- "space_after_anon_function": false,
19
- "space_before_conditional": true,
20
- "space_in_empty_paren": false,
21
- "space_in_paren": false,
22
- "unescape_strings": false,
23
- "wrap_line_length": 0
24
- }
25
- }
26
-
package/.prettierignore DELETED
@@ -1,2 +0,0 @@
1
- # Ignore all files:
2
- # *.*
package/.prettierrc DELETED
@@ -1,7 +0,0 @@
1
- {
2
- "trailingComma": "none",
3
- "prettier.trailingComma": "none",
4
- "tabWidth": 2,
5
- "semi": false,
6
- "singleQuote": true
7
- }
@@ -1,22 +0,0 @@
1
- {
2
- "configurations": [
3
- {
4
- "type": "node",
5
- "name": "vscode-jest-tests.v2",
6
- "request": "launch",
7
- "console": "integratedTerminal",
8
- "internalConsoleOptions": "neverOpen",
9
- "disableOptimisticBPs": true,
10
- "program": "${workspaceFolder}\\node_modules\\react-scripts\\node_modules\\.bin\\jest",
11
- "cwd": "${workspaceFolder}",
12
- "args": [
13
- "--runInBand",
14
- "--watchAll=false",
15
- "--testNamePattern",
16
- "${jest.testNamePattern}",
17
- "--runTestsByPath",
18
- "${jest.testFile}"
19
- ]
20
- }
21
- ]
22
- }
@@ -1,84 +0,0 @@
1
- {
2
- "npm.exclude": [
3
- "**/dist",
4
- "dist"
5
- ],
6
- "editor.hover.enabled": true,
7
- "editor.hover.delay": 2000,
8
- "editor.quickSuggestions": {},
9
- "editor.quickSuggestionsDelay": 2000,
10
- "editor.tabCompletion": "off",
11
- "editor.renderWhitespace": "all",
12
- "editor.acceptSuggestionOnEnter": "on",
13
- "editor.defaultFormatter": null,
14
- "editor.formatOnSave": true,
15
- "editor.autoClosingBrackets": "always",
16
- "editor.autoClosingOvertype": "always",
17
- "editor.insertSpaces": true,
18
- "editor.detectIndentation": false,
19
- "editor.tabSize": 2,
20
- "files.trimTrailingWhitespace": true,
21
- "javascript.format.semicolons": "remove",
22
- "typescript.format.semicolons": "remove",
23
- "typescript.referencesCodeLens.enabled": true,
24
- "typescript.suggestionActions.enabled": false,
25
- "javascript.suggestionActions.enabled": false,
26
- "explorer.compactFolders": false,
27
- "[typescript]": {},
28
- "[javascript]": {},
29
- "[markdown]": {},
30
- "[php]": {},
31
- "[css]": {},
32
- "[less]": {},
33
- "[sass]": {},
34
- "[js]": {},
35
- "search.exclude": {
36
- "out": true,
37
- "node_modules/jest-editor-support/src": false,
38
- ".editorconfig": true,
39
- "**/.cache": true,
40
- "**/.DS_Store": true,
41
- "**/.git": true,
42
- "**/.svg": true,
43
- "**/.xml": true,
44
- "**/bower_components": true,
45
- "**/node_*": true,
46
- "**/node_modules": true,
47
- "**/tmp": true,
48
- "babel.config.js": true,
49
- "jest.config.js": true,
50
- "node_modules": true,
51
- "package-lock.json": true,
52
- },
53
- "files.exclude": {
54
- "out": true,
55
- "node_modules/jest-editor-support/src": false,
56
- "coverage/": true,
57
- // ".vscode/": true,
58
- // ".editorconfig": true,
59
- // ".env": true,
60
- // ".eslintignore": true,
61
- // ".eslintrc.json": true,
62
- // ".eslintrc.legacy.json": true,
63
- // ".gitattributes": true,
64
- // ".gitignore": true,
65
- // ".hintrc": true,
66
- // ".jsbeautifyrc": true,
67
- // ".jshintrc": true,
68
- // ".npmignore": true,
69
- // ".npmrc": true,
70
- // ".prettierignore": true,
71
- // ".prettierrc.json": true,
72
- // ".stylelintignore": true,
73
- // ".stylelintrc.json": true,
74
- // "babel.config.js": true,
75
- // "jest.config.js": true,
76
- // "package-lock.json": true,
77
- // "node_modules/": true
78
- },
79
- "typescript.tsdk": "./node_modules/typescript/lib",
80
- "eslint.enable": true,
81
- "editor.codeActionsOnSave": {
82
- "source.fixAll.eslint": true
83
- }
84
- }
package/.vscodeignore DELETED
@@ -1,28 +0,0 @@
1
- .vscode/**
2
- .vscode-insiders/**
3
- .vscode-test/**
4
- src/**
5
- **/*.map
6
- .gitignore
7
- tsconfig.json
8
- **/__mocks__/**
9
- **/tests/**
10
- **/*.ts
11
- **/tsconfig.json
12
- jsconfig.json
13
- jest.config.js
14
- .eslintrc.js
15
- **/.eslintrc.js
16
- prettier.config.js
17
- .travis.yml
18
- yarn.lock
19
- yarn-error.log
20
- scripts/
21
- coverage
22
- .github/**
23
- images/**
24
- !images/vscode-jest.png
25
- node_modules
26
- webpack.config.js
27
- generated-icons/
28
- *.zip
@@ -1,3 +0,0 @@
1
- // __mocks__/fileMock.js
2
-
3
- module.exports = 'test-file-stub'
@@ -1,3 +0,0 @@
1
- // __mocks__/styleMock.js
2
-
3
- module.exports = {}
package/babel.config.js DELETED
@@ -1,34 +0,0 @@
1
- /*
2
- Copyright: © 2022 Dario Passariello <dariopassariello@gmail.com>
3
- License: CC BY-NC-ND 4.0
4
- */
5
-
6
- module.exports = {
7
-
8
- presets: [
9
- "@babel/preset-env",
10
- "@babel/preset-typescript",
11
- "@babel/preset-react"
12
- ],
13
-
14
- plugins: [
15
- "@babel/plugin-proposal-class-properties",
16
- [
17
- "@babel/plugin-transform-runtime",
18
- {
19
- regenerator: true,
20
- },
21
- ],
22
- ],
23
-
24
- env: {
25
- development: {
26
- presets: [['@babel/preset-react', { development: true, useBuiltIns: true }]]
27
- },
28
- production: {
29
- presets: [['@babel/preset-react', { useBuiltIns: true }]],
30
- plugins: [['transform-react-remove-prop-types', { removeImport: true }]]
31
- }
32
- }
33
-
34
- }
package/backup.bat DELETED
@@ -1,43 +0,0 @@
1
- @echo off
2
-
3
- @REM echo THIS FILE RUN BACKUP.
4
- @REM echo CREATED BY DARIO PASSARIELLO.
5
- @REM echo[
6
-
7
- @REM goto :start
8
-
9
- @REM This file permit to run BackUp as Zip file (using 7z) for the APP.
10
- @REM Please don't change anything without authorization.
11
- @REM In case needs help please call the back-end department.
12
- @REM You need to install 7z free software before using this batch
13
-
14
- @REM :start
15
-
16
- @REM :choice
17
- @REM set /P c=Are you sure you want to continue( [Y]/N )? Y
18
- @REM if /I "%c%" EQU "" goto :yes
19
- @REM if /I "%c%" EQU "y" goto :yes
20
- @REM if /I "%c%" EQU "Y" goto :yes
21
- @REM if /I "%c%" EQU "N" goto :no
22
- @REM goto :choice
23
-
24
- @REM :yes
25
-
26
- pushd %~dp0
27
- set THIS_DIR=%CD%
28
- popd
29
-
30
- for /f "tokens=3,2,4 delims=/- " %%x in ("%date%") do set d=%%z%%x%%y
31
- for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
32
- set logtime=%datetime:~8,6%
33
- for /f "skip=1" %%x in ('wmic os get localdatetime') do if not defined tmpDate set tmpDate=%%x
34
- set data=%tmpDate:~0,4%%tmpDate:~4,2%%tmpDate:~6,2%
35
-
36
- "C:\Program Files\7-Zip\7z.exe" a -tzip %THIS_DIR%\.backup\%data%.%logtime%.zip %THIS_DIR% -xr!node_modules -xr!.backup -xr!.git
37
- attrib +h %THIS_DIR%\.backup
38
- echo Zip created into %THIS_DIR%\.backup!
39
- @REM pause
40
- exit
41
-
42
- :no
43
- exit
@@ -1,6 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <coverage generated="1658814507307" clover="3.2.0">
3
- <project timestamp="1658814507307" name="All files">
4
- <metrics statements="0" coveredstatements="0" conditionals="0" coveredconditionals="0" methods="0" coveredmethods="0" elements="0" coveredelements="0" complexity="0" loc="0" ncloc="0" packages="0" files="0" classes="0"/>
5
- </project>
6
- </coverage>
@@ -1 +0,0 @@
1
- {}
@@ -1,224 +0,0 @@
1
- body, html {
2
- margin:0; padding: 0;
3
- height: 100%;
4
- }
5
- body {
6
- font-family: Helvetica Neue, Helvetica, Arial;
7
- font-size: 14px;
8
- color:#333;
9
- }
10
- .small { font-size: 12px; }
11
- *, *:after, *:before {
12
- -webkit-box-sizing:border-box;
13
- -moz-box-sizing:border-box;
14
- box-sizing:border-box;
15
- }
16
- h1 { font-size: 20px; margin: 0;}
17
- h2 { font-size: 14px; }
18
- pre {
19
- font: 12px/1.4 Consolas, "Liberation Mono", Menlo, Courier, monospace;
20
- margin: 0;
21
- padding: 0;
22
- -moz-tab-size: 2;
23
- -o-tab-size: 2;
24
- tab-size: 2;
25
- }
26
- a { color:#0074D9; text-decoration:none; }
27
- a:hover { text-decoration:underline; }
28
- .strong { font-weight: bold; }
29
- .space-top1 { padding: 10px 0 0 0; }
30
- .pad2y { padding: 20px 0; }
31
- .pad1y { padding: 10px 0; }
32
- .pad2x { padding: 0 20px; }
33
- .pad2 { padding: 20px; }
34
- .pad1 { padding: 10px; }
35
- .space-left2 { padding-left:55px; }
36
- .space-right2 { padding-right:20px; }
37
- .center { text-align:center; }
38
- .clearfix { display:block; }
39
- .clearfix:after {
40
- content:'';
41
- display:block;
42
- height:0;
43
- clear:both;
44
- visibility:hidden;
45
- }
46
- .fl { float: left; }
47
- @media only screen and (max-width:640px) {
48
- .col3 { width:100%; max-width:100%; }
49
- .hide-mobile { display:none!important; }
50
- }
51
-
52
- .quiet {
53
- color: #7f7f7f;
54
- color: rgba(0,0,0,0.5);
55
- }
56
- .quiet a { opacity: 0.7; }
57
-
58
- .fraction {
59
- font-family: Consolas, 'Liberation Mono', Menlo, Courier, monospace;
60
- font-size: 10px;
61
- color: #555;
62
- background: #E8E8E8;
63
- padding: 4px 5px;
64
- border-radius: 3px;
65
- vertical-align: middle;
66
- }
67
-
68
- div.path a:link, div.path a:visited { color: #333; }
69
- table.coverage {
70
- border-collapse: collapse;
71
- margin: 10px 0 0 0;
72
- padding: 0;
73
- }
74
-
75
- table.coverage td {
76
- margin: 0;
77
- padding: 0;
78
- vertical-align: top;
79
- }
80
- table.coverage td.line-count {
81
- text-align: right;
82
- padding: 0 5px 0 20px;
83
- }
84
- table.coverage td.line-coverage {
85
- text-align: right;
86
- padding-right: 10px;
87
- min-width:20px;
88
- }
89
-
90
- table.coverage td span.cline-any {
91
- display: inline-block;
92
- padding: 0 5px;
93
- width: 100%;
94
- }
95
- .missing-if-branch {
96
- display: inline-block;
97
- margin-right: 5px;
98
- border-radius: 3px;
99
- position: relative;
100
- padding: 0 4px;
101
- background: #333;
102
- color: yellow;
103
- }
104
-
105
- .skip-if-branch {
106
- display: none;
107
- margin-right: 10px;
108
- position: relative;
109
- padding: 0 4px;
110
- background: #ccc;
111
- color: white;
112
- }
113
- .missing-if-branch .typ, .skip-if-branch .typ {
114
- color: inherit !important;
115
- }
116
- .coverage-summary {
117
- border-collapse: collapse;
118
- width: 100%;
119
- }
120
- .coverage-summary tr { border-bottom: 1px solid #bbb; }
121
- .keyline-all { border: 1px solid #ddd; }
122
- .coverage-summary td, .coverage-summary th { padding: 10px; }
123
- .coverage-summary tbody { border: 1px solid #bbb; }
124
- .coverage-summary td { border-right: 1px solid #bbb; }
125
- .coverage-summary td:last-child { border-right: none; }
126
- .coverage-summary th {
127
- text-align: left;
128
- font-weight: normal;
129
- white-space: nowrap;
130
- }
131
- .coverage-summary th.file { border-right: none !important; }
132
- .coverage-summary th.pct { }
133
- .coverage-summary th.pic,
134
- .coverage-summary th.abs,
135
- .coverage-summary td.pct,
136
- .coverage-summary td.abs { text-align: right; }
137
- .coverage-summary td.file { white-space: nowrap; }
138
- .coverage-summary td.pic { min-width: 120px !important; }
139
- .coverage-summary tfoot td { }
140
-
141
- .coverage-summary .sorter {
142
- height: 10px;
143
- width: 7px;
144
- display: inline-block;
145
- margin-left: 0.5em;
146
- background: url(sort-arrow-sprite.png) no-repeat scroll 0 0 transparent;
147
- }
148
- .coverage-summary .sorted .sorter {
149
- background-position: 0 -20px;
150
- }
151
- .coverage-summary .sorted-desc .sorter {
152
- background-position: 0 -10px;
153
- }
154
- .status-line { height: 10px; }
155
- /* yellow */
156
- .cbranch-no { background: yellow !important; color: #111; }
157
- /* dark red */
158
- .red.solid, .status-line.low, .low .cover-fill { background:#C21F39 }
159
- .low .chart { border:1px solid #C21F39 }
160
- .highlighted,
161
- .highlighted .cstat-no, .highlighted .fstat-no, .highlighted .cbranch-no{
162
- background: #C21F39 !important;
163
- }
164
- /* medium red */
165
- .cstat-no, .fstat-no, .cbranch-no, .cbranch-no { background:#F6C6CE }
166
- /* light red */
167
- .low, .cline-no { background:#FCE1E5 }
168
- /* light green */
169
- .high, .cline-yes { background:rgb(230,245,208) }
170
- /* medium green */
171
- .cstat-yes { background:rgb(161,215,106) }
172
- /* dark green */
173
- .status-line.high, .high .cover-fill { background:rgb(77,146,33) }
174
- .high .chart { border:1px solid rgb(77,146,33) }
175
- /* dark yellow (gold) */
176
- .status-line.medium, .medium .cover-fill { background: #f9cd0b; }
177
- .medium .chart { border:1px solid #f9cd0b; }
178
- /* light yellow */
179
- .medium { background: #fff4c2; }
180
-
181
- .cstat-skip { background: #ddd; color: #111; }
182
- .fstat-skip { background: #ddd; color: #111 !important; }
183
- .cbranch-skip { background: #ddd !important; color: #111; }
184
-
185
- span.cline-neutral { background: #eaeaea; }
186
-
187
- .coverage-summary td.empty {
188
- opacity: .5;
189
- padding-top: 4px;
190
- padding-bottom: 4px;
191
- line-height: 1;
192
- color: #888;
193
- }
194
-
195
- .cover-fill, .cover-empty {
196
- display:inline-block;
197
- height: 12px;
198
- }
199
- .chart {
200
- line-height: 0;
201
- }
202
- .cover-empty {
203
- background: white;
204
- }
205
- .cover-full {
206
- border-right: none !important;
207
- }
208
- pre.prettyprint {
209
- border: none !important;
210
- padding: 0 !important;
211
- margin: 0 !important;
212
- }
213
- .com { color: #999 !important; }
214
- .ignore-none { color: #999; font-weight: normal; }
215
-
216
- .wrapper {
217
- min-height: 100%;
218
- height: auto !important;
219
- height: 100%;
220
- margin: 0 auto -48px;
221
- }
222
- .footer, .push {
223
- height: 48px;
224
- }
@@ -1,87 +0,0 @@
1
- /* eslint-disable */
2
- var jumpToCode = (function init() {
3
- // Classes of code we would like to highlight in the file view
4
- var missingCoverageClasses = ['.cbranch-no', '.cstat-no', '.fstat-no'];
5
-
6
- // Elements to highlight in the file listing view
7
- var fileListingElements = ['td.pct.low'];
8
-
9
- // We don't want to select elements that are direct descendants of another match
10
- var notSelector = ':not(' + missingCoverageClasses.join('):not(') + ') > '; // becomes `:not(a):not(b) > `
11
-
12
- // Selecter that finds elements on the page to which we can jump
13
- var selector =
14
- fileListingElements.join(', ') +
15
- ', ' +
16
- notSelector +
17
- missingCoverageClasses.join(', ' + notSelector); // becomes `:not(a):not(b) > a, :not(a):not(b) > b`
18
-
19
- // The NodeList of matching elements
20
- var missingCoverageElements = document.querySelectorAll(selector);
21
-
22
- var currentIndex;
23
-
24
- function toggleClass(index) {
25
- missingCoverageElements
26
- .item(currentIndex)
27
- .classList.remove('highlighted');
28
- missingCoverageElements.item(index).classList.add('highlighted');
29
- }
30
-
31
- function makeCurrent(index) {
32
- toggleClass(index);
33
- currentIndex = index;
34
- missingCoverageElements.item(index).scrollIntoView({
35
- behavior: 'smooth',
36
- block: 'center',
37
- inline: 'center'
38
- });
39
- }
40
-
41
- function goToPrevious() {
42
- var nextIndex = 0;
43
- if (typeof currentIndex !== 'number' || currentIndex === 0) {
44
- nextIndex = missingCoverageElements.length - 1;
45
- } else if (missingCoverageElements.length > 1) {
46
- nextIndex = currentIndex - 1;
47
- }
48
-
49
- makeCurrent(nextIndex);
50
- }
51
-
52
- function goToNext() {
53
- var nextIndex = 0;
54
-
55
- if (
56
- typeof currentIndex === 'number' &&
57
- currentIndex < missingCoverageElements.length - 1
58
- ) {
59
- nextIndex = currentIndex + 1;
60
- }
61
-
62
- makeCurrent(nextIndex);
63
- }
64
-
65
- return function jump(event) {
66
- if (
67
- document.getElementById('fileSearch') === document.activeElement &&
68
- document.activeElement != null
69
- ) {
70
- // if we're currently focused on the search input, we don't want to navigate
71
- return;
72
- }
73
-
74
- switch (event.which) {
75
- case 78: // n
76
- case 74: // j
77
- goToNext();
78
- break;
79
- case 66: // b
80
- case 75: // k
81
- case 80: // p
82
- goToPrevious();
83
- break;
84
- }
85
- };
86
- })();
87
- window.addEventListener('keydown', jumpToCode);