-
Notifications
You must be signed in to change notification settings - Fork 442
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] Higher/Lower Order (or Highlight/Grey Out) for the script (not) applying the current URL in SPA #2048
Comments
We can't know if a script is not active on the current SPA route, because it depends on its inner logic. The document is the same for a SPA, so Violentmonkey cannot "activate" or "deactivate" a running script. Such script can signal its state via GM_registerMenuCommand. |
Ah, you already mentioned that. Geez I'm so impatient, sorry. |
We won't implement Maybe we can add GM_setMenuState which will do something to the script name in the popup or add/change its icon? |
Yeah sounds like a good idea. |
Yes. the idea is that, there can be some ways to move the script upwards or downwards as the script is not really applying to the current page URL.
can help people to know which URL is applying on. Other ways (like |
Motivation
In YouTube, it is Single Page Application, so all of them have to set to
@match https://www.youtube.com/*
to ensure them can be executed after the SPA is switched to the desired page (url changed due to history state)Motivation 1: Currently for such a UserJS used in SPA, it is not clear enough to let users know which page(s) it will apply.
Motivation 2: Too many scripts shown under the YouTube SPA. Some are not really "working" in the current URL
Currently the ON/OFF is 100% equal to the
@match
which is not enough for SPAI want some ways to grey out the option so that user can know that it is not applying to the current page.
But this can be wrong (code is actually executing) => might be just some lighter/darker colors.
so I hope that there can be some config to make the script go up/down in the menu.
Proposed Solution
In addition to
@match
, hope there can be@match-active
@match-inactive
It can handle the SPA history state change and popstate change as well.
If
@match-active
is fulfilled (supposed@match
is matched first), the script row will be shown in a HIGHER position (or color highlight)If
@match-inactive
is fulfilled (supposed@match
is matched first), the script row will be shown in a LOWER position (or fade-out color)these are just for the display in the menu. no effect on the actual JS execution.
Use Cases
Example Script: https://greasyfork.org/en/scripts/489605-youtube-watch-later-remove-button-on-hover/code
The text was updated successfully, but these errors were encountered: