You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
v2.15.9 and newer returns a randomly generated id or the `id` specified in the third parameter (previously v2.12.5...2.15.8 returned an `id` equal to `caption`), which allows changing the command in-place without recreating it:
354
-
```js
355
-
const id = 'status';
356
-
const inplace = id === GM_registerMenuCommand('Enabled', onClick, { id });
357
-
// .......later:
358
-
if (inplace) { // change the command in-place if supported
v2.15.9 and newer returns a randomly generated id or the `id` specified in the third parameter (previously v2.12.5...2.15.8 returned an `id` equal to `caption`), which allows changing the command in-place.
365
354
366
355
- <Field name="caption" type="string" />
367
356
@@ -386,6 +375,24 @@ if (inplace) { // change the command in-place if supported
386
375
387
376
If you want to add a shortcut, please see [vm.shortcut](https://github.com/violentmonkey/vm-shortcut).
388
377
378
+
Here's how you can change the command in-place, thus preserving its relative position in the list of multiple commands:
379
+
```js
380
+
const id = 'status';
381
+
const inplace = id === GM_registerMenuCommand('Enabled', onClick, { id });
382
+
if (inplace) {
383
+
// supported: change the command in-place using the same `id`
0 commit comments