pywebexec 1.2.0__py3-none-any.whl → 1.4.12__py3-none-any.whl

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.
@@ -1,5 +1,12 @@
1
+ @font-face {
2
+ font-family: 'Consolas NF';
3
+ src: url('/static/css/Consolas NF.ttf');
4
+ font-weight: 400;
5
+ font-style: normal;
6
+ }
1
7
  body {
2
- font-family: Arial, sans-serif;
8
+ font-family: Arial, sans-serif;
9
+ overflow: hidden;
3
10
  }
4
11
  .table-container {
5
12
  height: 270px;
@@ -30,21 +37,26 @@ th {
30
37
  width: 100%;
31
38
  }
32
39
  select { /* Safari bug */
40
+ -webkit-appearance: none;
41
+ -webkit-border-radius: none;
42
+ appearance: none;
43
+ outline: none;
33
44
  font-size: 15px;
34
45
  border: #aaa solid 1px;
35
46
  border-radius: 5px;
47
+ padding: 0px 5px 5px 0px;
48
+ min-width: 150px;
36
49
  }
37
50
  .output {
38
51
  white-space: pre-wrap;
39
- background: #f0f0f0;
52
+ background: #111;
40
53
  padding: 10px;
41
54
  border: 1px solid #ccc;
42
- font-family: monospace;
43
55
  border-radius: 10px;
44
- overflow-y: auto;
56
+ overflow-y: hidden;
45
57
  }
46
58
  .copy-icon { cursor: pointer; }
47
- .monospace { font-family: monospace; }
59
+ .monospace { font-family: Consolas NF, monospace; }
48
60
  .copied { color: green; margin-left: 5px; }
49
61
  button {
50
62
  -webkit-appearance: none;
@@ -62,6 +74,11 @@ button {
62
74
  form {
63
75
  padding-bottom: 15px;
64
76
  }
77
+ .form-inline {
78
+ display: flex;
79
+ align-items: center;
80
+ gap: 10px;
81
+ }
65
82
  .status-icon {
66
83
  display: inline-block;
67
84
  width: 16px;
@@ -103,21 +120,90 @@ form {
103
120
  .copy_clip_ok, .copy_clip_ok:hover {
104
121
  background-image: url("/static/images/copy_ok.svg");
105
122
  }
106
- input {
107
- width: 50%;
123
+ #params, #commandName {
108
124
  -webkit-appearance: none;
109
125
  -webkit-border-radius: none;
110
126
  appearance: none;
111
127
  border-radius: 15px;
112
128
  padding: 3px;
113
- padding-right: 13px;
114
129
  border: 1px #aaa solid;
115
130
  height: 15px;
116
131
  font-size: 15px;
117
132
  outline: none;
133
+ background-color: white;
134
+ margin: 0; /* Remove margin */
135
+ }
136
+
137
+ #commandName {
138
+ width: auto; /* Allow dynamic width */
139
+ background-size: 16px 16px;
140
+ border-radius: 15px 0px 0px 15px;
141
+ border-right: 0px;
118
142
  text-indent: 5px;
143
+ padding-right: 0px;
144
+ }
145
+ #params {
146
+ width: auto; /* Allow dynamic width */
147
+ border-radius: 0px 15px 15px 0px;
148
+ border-left: 0px;
149
+ }
150
+
151
+ .input-group {
152
+ display: flex;
153
+ align-items: center;
154
+ /*width: 60%;*/
155
+ }
156
+
157
+ .show-command-list-button {
119
158
  background-color: white;
159
+ cursor: pointer;
160
+ height: 21px;
161
+ font-size: 15px;
162
+ border-top: 1px solid #aaa;
163
+ border-bottom: 1px solid #aaa;
164
+ border-radius: 0px;
165
+ display: flex;
166
+ align-items: center;
167
+ justify-content: center;
168
+ }
169
+
170
+ .show-command-list-button .arrow {
171
+ visibility: hidden; /* Hide arrow by default */
120
172
  }
173
+
174
+ .show-command-list-button:hover .arrow {
175
+ visibility: visible; /* Show arrow on hover */
176
+ }
177
+
178
+ #commandName:focus + .show-command-list-button .arrow {
179
+ visibility: visible; /* Show arrow when input has focus */
180
+ }
181
+
182
+ #commandList.show + .show-command-list-button .arrow {
183
+ display: none; /* Hide arrow when list is shown */
184
+ }
185
+
186
+ .command-list {
187
+ display: none;
188
+ position: absolute;
189
+ background-color: white;
190
+ border: 1px solid #aaa;
191
+ border-radius: 5px;
192
+ padding: 0px 5px 0px 5px;
193
+ margin-top: 2px;
194
+ overflow-y: auto;
195
+ z-index: 1000;
196
+ }
197
+
198
+ .command-item {
199
+ padding: 3px 5px 3px 5px;
200
+ cursor: pointer;
201
+ }
202
+
203
+ .command-item:hover, .command-item.highlighted {
204
+ background-color: #eee;
205
+ }
206
+
121
207
  .currentcommand {
122
208
  background-color: #eef;
123
209
  }
@@ -156,6 +242,7 @@ body.dimmed * {
156
242
  height: 100%;
157
243
  background-color: rgba(0, 0, 0, 0.5);
158
244
  z-index: 1000;
245
+ overflow-y: hidden;
159
246
  }
160
247
  .dimmer-text {
161
248
  color: white;
@@ -166,3 +253,29 @@ body.dimmed * {
166
253
  left: 50%;
167
254
  transform: translate(-50%, -50%);
168
255
  }
256
+ /* allow wide chars in terminal */
257
+ span {
258
+ letter-spacing: -0.03px !important;
259
+ }
260
+ .slider-container {
261
+ display: flex;
262
+ align-items: center;
263
+ gap: 10px;
264
+ margin-top: 10px;
265
+ }
266
+ #outputSlider {
267
+ width: 100%;
268
+ }
269
+ .popup-button {
270
+ background: none;
271
+ border: none;
272
+ cursor: pointer;
273
+ padding: 0;
274
+ margin-left: 5px;
275
+ vertical-align: middle;
276
+ }
277
+ .popup-button img {
278
+ width: 16px;
279
+ height: 16px;
280
+ }
281
+
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Copyright (c) 2014 The xterm.js authors. All rights reserved.
3
+ * Copyright (c) 2012-2013, Christopher Jeffrey (MIT License)
4
+ * https://github.com/chjj/term.js
5
+ * @license MIT
6
+ *
7
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ * of this software and associated documentation files (the "Software"), to deal
9
+ * in the Software without restriction, including without limitation the rights
10
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ * copies of the Software, and to permit persons to whom the Software is
12
+ * furnished to do so, subject to the following conditions:
13
+ *
14
+ * The above copyright notice and this permission notice shall be included in
15
+ * all copies or substantial portions of the Software.
16
+ *
17
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
23
+ * THE SOFTWARE.
24
+ *
25
+ * Originally forked from (with the author's permission):
26
+ * Fabrice Bellard's javascript vt100 for jslinux:
27
+ * http://bellard.org/jslinux/
28
+ * Copyright (c) 2011 Fabrice Bellard
29
+ * The original design remains. The terminal itself
30
+ * has been extended to include xterm CSI codes, among
31
+ * other features.
32
+ */
33
+
34
+ /**
35
+ * Default styles for xterm.js
36
+ */
37
+
38
+ .xterm {
39
+ cursor: text;
40
+ position: relative;
41
+ user-select: none;
42
+ -ms-user-select: none;
43
+ -webkit-user-select: none;
44
+ }
45
+
46
+ .xterm.focus,
47
+ .xterm:focus {
48
+ outline: none;
49
+ }
50
+
51
+ .xterm .xterm-helpers {
52
+ position: absolute;
53
+ top: 0;
54
+ /**
55
+ * The z-index of the helpers must be higher than the canvases in order for
56
+ * IMEs to appear on top.
57
+ */
58
+ z-index: 5;
59
+ }
60
+
61
+ .xterm .xterm-helper-textarea {
62
+ padding: 0;
63
+ border: 0;
64
+ margin: 0;
65
+ /* Move textarea out of the screen to the far left, so that the cursor is not visible */
66
+ position: absolute;
67
+ opacity: 0;
68
+ left: -9999em;
69
+ top: 0;
70
+ width: 0;
71
+ height: 0;
72
+ z-index: -5;
73
+ /** Prevent wrapping so the IME appears against the textarea at the correct position */
74
+ white-space: nowrap;
75
+ overflow: hidden;
76
+ resize: none;
77
+ }
78
+
79
+ .xterm .composition-view {
80
+ /* TODO: Composition position got messed up somewhere */
81
+ background: #000;
82
+ color: #FFF;
83
+ display: none;
84
+ position: absolute;
85
+ white-space: nowrap;
86
+ z-index: 1;
87
+ }
88
+
89
+ .xterm .composition-view.active {
90
+ display: block;
91
+ }
92
+
93
+ .xterm .xterm-viewport {
94
+ /* On OS X this is required in order for the scroll bar to appear fully opaque */
95
+ background-color: #000;
96
+ overflow-y: scroll;
97
+ cursor: default;
98
+ position: absolute;
99
+ right: 0;
100
+ left: 0;
101
+ top: 0;
102
+ bottom: 0;
103
+ }
104
+
105
+ .xterm .xterm-screen {
106
+ position: relative;
107
+ }
108
+
109
+ .xterm .xterm-screen canvas {
110
+ position: absolute;
111
+ left: 0;
112
+ top: 0;
113
+ }
114
+
115
+ .xterm .xterm-scroll-area {
116
+ visibility: hidden;
117
+ }
118
+
119
+ .xterm-char-measure-element {
120
+ display: inline-block;
121
+ visibility: hidden;
122
+ position: absolute;
123
+ top: 0;
124
+ left: -9999em;
125
+ line-height: normal;
126
+ }
127
+
128
+ .xterm.enable-mouse-events {
129
+ /* When mouse events are enabled (eg. tmux), revert to the standard pointer cursor */
130
+ cursor: default;
131
+ }
132
+
133
+ .xterm.xterm-cursor-pointer,
134
+ .xterm .xterm-cursor-pointer {
135
+ cursor: pointer;
136
+ }
137
+
138
+ .xterm.column-select.focus {
139
+ /* Column selection mode */
140
+ cursor: crosshair;
141
+ }
142
+
143
+ .xterm .xterm-accessibility,
144
+ .xterm .xterm-message {
145
+ position: absolute;
146
+ left: 0;
147
+ top: 0;
148
+ bottom: 0;
149
+ right: 0;
150
+ z-index: 10;
151
+ color: transparent;
152
+ pointer-events: none;
153
+ }
154
+
155
+ .xterm .live-region {
156
+ position: absolute;
157
+ left: -9999px;
158
+ width: 1px;
159
+ height: 1px;
160
+ overflow: hidden;
161
+ }
162
+
163
+ .xterm-dim {
164
+ /* Dim should not apply to background, so the opacity of the foreground color is applied
165
+ * explicitly in the generated class and reset to 1 here */
166
+ opacity: 1 !important;
167
+ }
168
+
169
+ .xterm-underline-1 { text-decoration: underline; }
170
+ .xterm-underline-2 { text-decoration: double underline; }
171
+ .xterm-underline-3 { text-decoration: wavy underline; }
172
+ .xterm-underline-4 { text-decoration: dotted underline; }
173
+ .xterm-underline-5 { text-decoration: dashed underline; }
174
+
175
+ .xterm-overline {
176
+ text-decoration: overline;
177
+ }
178
+
179
+ .xterm-overline.xterm-underline-1 { text-decoration: overline underline; }
180
+ .xterm-overline.xterm-underline-2 { text-decoration: overline double underline; }
181
+ .xterm-overline.xterm-underline-3 { text-decoration: overline wavy underline; }
182
+ .xterm-overline.xterm-underline-4 { text-decoration: overline dotted underline; }
183
+ .xterm-overline.xterm-underline-5 { text-decoration: overline dashed underline; }
184
+
185
+ .xterm-strikethrough {
186
+ text-decoration: line-through;
187
+ }
188
+
189
+ .xterm-screen .xterm-decoration-container .xterm-decoration {
190
+ z-index: 6;
191
+ position: absolute;
192
+ }
193
+
194
+ .xterm-screen .xterm-decoration-container .xterm-decoration.xterm-decoration-top-layer {
195
+ z-index: 7;
196
+ }
197
+
198
+ .xterm-decoration-overview-ruler {
199
+ z-index: 8;
200
+ position: absolute;
201
+ top: 0;
202
+ right: 0;
203
+ pointer-events: none;
204
+ }
205
+
206
+ .xterm-decoration-top {
207
+ z-index: 2;
208
+ position: relative;
209
+ }
@@ -0,0 +1 @@
1
+ <svg width="12" height="12" xmlns="http://www.w3.org/2000/svg"><polygon points="4 3 12 3 8 10 4 3" fill="black" /></svg>
@@ -1 +1,8 @@
1
- <svg fill="#000000" viewBox="-1 0 19 19" xmlns="http://www.w3.org/2000/svg" class="cf-icon-svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"><path d="M16.5 9.5a8 8 0 1 1-8-8 8 8 0 0 1 8 8zm-2.97.006a5.03 5.03 0 1 0-5.03 5.03 5.03 5.03 0 0 0 5.03-5.03zm-7.383-.4H4.289a4.237 4.237 0 0 1 2.565-3.498q.1-.042.2-.079a7.702 7.702 0 0 0-.907 3.577zm0 .8a7.7 7.7 0 0 0 .908 3.577q-.102-.037-.201-.079a4.225 4.225 0 0 1-2.565-3.498zm.8-.8a9.04 9.04 0 0 1 .163-1.402 6.164 6.164 0 0 1 .445-1.415c.289-.615.66-1.013.945-1.013.285 0 .656.398.945 1.013a6.18 6.18 0 0 1 .445 1.415 9.078 9.078 0 0 1 .163 1.402zm3.106.8a9.073 9.073 0 0 1-.163 1.402 6.187 6.187 0 0 1-.445 1.415c-.289.616-.66 1.013-.945 1.013-.285 0-.656-.397-.945-1.013a6.172 6.172 0 0 1-.445-1.415 9.036 9.036 0 0 1-.163-1.402zm1.438-3.391a4.211 4.211 0 0 1 1.22 2.591h-1.858a7.698 7.698 0 0 0-.908-3.577q.102.037.201.08a4.208 4.208 0 0 1 1.345.906zm-.638 3.391h1.858a4.238 4.238 0 0 1-2.565 3.498q-.1.043-.2.08a7.697 7.697 0 0 0 .907-3.578z"></path></g></svg>
1
+ <svg viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g>
2
+ <g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g>
3
+ <g id="SVGRepo_iconCarrier">
4
+ <path opacity="0.8" d="M3 8C3 6.11438 3 5.17157 3.58579 4.58579C4.17157 4 5.11438 4 7 4H12H17C18.8856 4 19.8284 4 20.4142 4.58579C21 5.17157 21 6.11438 21 8V12V16C21 17.8856 21 18.8284 20.4142 19.4142C19.8284 20 18.8856 20 17 20H12H7C5.11438 20 4.17157 20 3.58579 19.4142C3 18.8284 3 17.8856 3 16V12V8Z" style="fill: rgba(5, 167, 98, 0.9);"></path>
5
+ <path d="M13 15H16" stroke="#323232" stroke-width="2" stroke-linecap="round"></path>
6
+ <path d="M8 15L10.5 12.5V12.5C10.7761 12.2239 10.7761 11.7761 10.5 11.5V11.5L8 9" stroke="#323232" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"></path>
7
+ <path d="M3 8C3 6.11438 3 5.17157 3.58579 4.58579C4.17157 4 5.11438 4 7 4H12H17C18.8856 4 19.8284 4 20.4142 4.58579C21 5.17157 21 6.11438 21 8V12V16C21 17.8856 21 18.8284 20.4142 19.4142C19.8284 20 18.8856 20 17 20H12H7C5.11438 20 4.17157 20 3.58579 19.4142C3 18.8284 3 17.8856 3 16V12V8Z" stroke="#323232" stroke-width="2" stroke-linejoin="round"></path>
8
+ </g></svg>
@@ -0,0 +1 @@
1
+ <svg fill="#000000" viewBox="0 0 32 32" version="1.1" xmlns="http://www.w3.org/2000/svg"><g id="SVGRepo_bgCarrier" stroke-width="0"></g><g id="SVGRepo_tracerCarrier" stroke-linecap="round" stroke-linejoin="round"></g><g id="SVGRepo_iconCarrier"> <title>popout</title> <path d="M15.694 13.541l2.666 2.665 5.016-5.017 2.59 2.59 0.004-7.734-7.785-0.046 2.526 2.525-5.017 5.017zM25.926 16.945l-1.92-1.947 0.035 9.007-16.015 0.009 0.016-15.973 8.958-0.040-2-2h-7c-1.104 0-2 0.896-2 2v16c0 1.104 0.896 2 2 2h16c1.104 0 2-0.896 2-2l-0.074-7.056z"></path> </g></svg>
@@ -0,0 +1,223 @@
1
+ // commands.js
2
+ let commandInput = document.getElementById('commandName');
3
+ let paramsInput = document.getElementById('params');
4
+ let commandListSelect = document.getElementById('commandList');
5
+ let showCommandListButton = document.getElementById('showCommandListButton');
6
+ let isHandlingKeydown = false;
7
+
8
+ function unfilterCommands() {
9
+ const options = commandListSelect.options;
10
+ for (let i = 0; i < options.length; i++) {
11
+ options[i].style.display = 'block';
12
+ }
13
+ commandListSelect.size = Math.min(20, commandListSelect.options.length);
14
+ }
15
+
16
+ function filterCommands() {
17
+ const value = commandInput.value.slice(0, commandInput.selectionStart);
18
+ const options = commandListSelect.options;
19
+ let nbVisibleItems = 0;
20
+ for (let i = 0; i < options.length; i++) {
21
+ if (options[i].text.startsWith(value)) {
22
+ options[i].style.display = 'block';
23
+ nbVisibleItems += 1;
24
+ } else {
25
+ options[i].style.display = 'none';
26
+ }
27
+ }
28
+ if (nbVisibleItems > 1) {
29
+ commandListSelect.size = Math.min(20, nbVisibleItems);
30
+ commandListSelect.style.display = 'block';
31
+ } else {
32
+ commandListSelect.style.display = 'none';
33
+ }
34
+ }
35
+
36
+ function setCommandListPosition() {
37
+ const rect = commandInput.getBoundingClientRect();
38
+ commandListSelect.style.left = `${rect.left}px`;
39
+ commandListSelect.style.top = `${rect.bottom}px`;
40
+ }
41
+
42
+ function adjustInputWidth(input) {
43
+ input.style.width = 'auto';
44
+ input.style.width = `${input.scrollWidth}px`;
45
+ }
46
+
47
+
48
+ paramsInput.addEventListener('input', () => adjustInputWidth(paramsInput));
49
+ commandInput.addEventListener('input', () => {
50
+ adjustInputWidth(commandInput);
51
+ filterCommands(); // Filter commands on input
52
+ });
53
+
54
+ paramsInput.addEventListener('mouseover', () => {
55
+ paramsInput.focus();
56
+ paramsInput.setSelectionRange(0, paramsInput.value.length);
57
+ });
58
+
59
+ commandInput.addEventListener('mouseover', () => {
60
+ commandInput.focus();
61
+ commandInput.setSelectionRange(0, commandInput.value.length);
62
+ });
63
+
64
+ commandInput.addEventListener('input', (event) => {
65
+ if (event.inputType === 'deleteContentBackward') {
66
+ const newValue = commandInput.value.slice(0, -1);
67
+ commandInput.value = newValue;
68
+ commandInput.setSelectionRange(newValue.length, newValue.length);
69
+ }
70
+ const value = commandInput.value;
71
+ const options = commandListSelect.options;
72
+ if (value) {
73
+ const match = Array.from(options).find(option => option.text.startsWith(value));
74
+ if (match) {
75
+ commandInput.value = match.text;
76
+ commandInput.setSelectionRange(value.length, match.text.length);
77
+ } else {
78
+ commandInput.value = value.slice(0, -1);
79
+ }
80
+ }
81
+ filterCommands();
82
+ adjustInputWidth(commandInput); // Adjust width on input
83
+ });
84
+
85
+ commandInput.addEventListener('keydown', (event) => {
86
+ if (event.key === ' ' || event.key === 'ArrowRight') {
87
+ event.preventDefault();
88
+ paramsInput.focus();
89
+ paramsInput.setSelectionRange(0, paramsInput.value.length);
90
+ } else if (event.key === 'ArrowDown') {
91
+ /*setCommandListPosition();*/
92
+ unfilterCommands();
93
+ if (commandListSelect.options.length > 1) {
94
+ commandListSelect.style.display = 'block';
95
+ commandListSelect.focus();
96
+ commandListSelect.selectedIndex = 0;
97
+ }
98
+ event.preventDefault();
99
+ }
100
+ });
101
+
102
+ paramsInput.addEventListener('keydown', (event) => {
103
+ if (paramsInput.selectionStart > 0) return;
104
+ if (event.key === 'ArrowLeft') {
105
+ commandInput.focus();
106
+ commandInput.setSelectionRange(0, commandInput.value.length);
107
+ event.preventDefault();
108
+ return;
109
+ }
110
+ if (event.key === 'Backspace') {
111
+ val = paramsInput.value
112
+ paramsInput.value = val.slice(0, paramsInput.selectionStart) + val.slice(paramsInput.selectionEnd)
113
+ commandInput.focus();
114
+ commandInput.setSelectionRange(0, commandInput.value.length);
115
+ event.preventDefault();
116
+ }
117
+ });
118
+
119
+ commandListSelect.addEventListener('keydown', (event) => {
120
+ if (event.key === 'Enter') {
121
+ event.preventDefault(); // Prevent form submission
122
+ const selectedOption = commandListSelect.options[commandListSelect.selectedIndex];
123
+ commandInput.value = selectedOption.text;
124
+ commandListSelect.style.display = 'none';
125
+ adjustInputWidth(commandInput);
126
+ paramsInput.focus();
127
+ return;
128
+ }
129
+ if (event.key === 'ArrowUp' && commandListSelect.selectedIndex == 0) {
130
+ commandInput.focus();
131
+ commandListSelect.style.display = 'none'
132
+ }
133
+ });
134
+
135
+ commandListSelect.addEventListener('click', (event) => {
136
+ event.preventDefault(); // Prevent form submission
137
+ const selectedOption = commandListSelect.options[commandListSelect.selectedIndex];
138
+ commandInput.value = selectedOption.text;
139
+ commandListSelect.style.display = 'none';
140
+ adjustInputWidth(commandInput);
141
+ paramsInput.focus();
142
+ });
143
+
144
+
145
+ commandInput.addEventListener('click', () => {
146
+ setCommandListPosition();
147
+ if (commandListSelect.style.display == 'none')
148
+ commandListSelect.style.display = 'block';
149
+ else
150
+ commandListSelect.style.display = 'none';
151
+ filterCommands();
152
+ });
153
+
154
+ commandInput.addEventListener('blur', (event) => {
155
+ if (event.relatedTarget === showCommandListButton || event.relatedTarget === commandListSelect) {
156
+ event.preventDefault();
157
+ return;
158
+ }
159
+ commandListSelect.style.display = 'none';
160
+ adjustInputWidth(commandInput);
161
+ });
162
+
163
+ showCommandListButton.addEventListener('click', (event) => {
164
+ event.preventDefault();
165
+ setCommandListPosition();
166
+ unfilterCommands();
167
+ if (commandListSelect.style.display == 'none')
168
+ commandListSelect.style.display = 'block';
169
+ else
170
+ commandListSelect.style.display = 'none';
171
+ });
172
+
173
+ window.addEventListener('click', (event) => {
174
+ if (!commandInput.contains(event.target) && !commandListSelect.contains(event.target) && !showCommandListButton.contains(event.target)) {
175
+ commandListSelect.style.display = 'none';
176
+ }
177
+ });
178
+
179
+ window.addEventListener('keydown', (event) => {
180
+ if ([commandInput, paramsInput, commandListSelect].includes(document.activeElement)) return;
181
+ if (event.code === `Key${event.key.toUpperCase()}`) {
182
+ commandInput.focus();
183
+ commandInput.dispatchEvent(new KeyboardEvent('keydown', event));
184
+ }
185
+ });
186
+
187
+ window.addEventListener('resize', () => {
188
+ setCommandListPosition();
189
+ });
190
+
191
+ window.addEventListener('load', () => {
192
+ fetchExecutables();
193
+ adjustInputWidth(paramsInput); // Adjust width on load
194
+ adjustInputWidth(commandInput); // Adjust width on load
195
+ setCommandListPosition();
196
+ });
197
+
198
+ async function fetchExecutables() {
199
+ try {
200
+ const response = await fetch(`/executables${urlToken}`);
201
+ if (!response.ok) {
202
+ throw new Error('Failed to fetch command status');
203
+ }
204
+ const executables = await response.json();
205
+ commandListSelect.innerHTML = '';
206
+ executables.forEach(executable => {
207
+ const option = document.createElement('option');
208
+ option.className = 'command-item';
209
+ option.text = executable;
210
+ commandListSelect.appendChild(option);
211
+ });
212
+ } catch (error) {
213
+ alert("Failed to fetch executables");
214
+ }
215
+ commandListSelect.size = Math.min(20, commandListSelect.options.length);
216
+ if (commandListSelect.options.length == 1) {
217
+ commandInput.value = commandListSelect.options[0].text;
218
+ showCommandListButton.style.display = 'none';
219
+ }
220
+ if (commandListSelect.options.length == 0)
221
+ document.getElementById('launchForm').style.display = 'none';
222
+
223
+ }