Skip to content
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

The user should be able to control script execution order #2679

Closed
darkred opened this issue Nov 15, 2017 · 12 comments
Closed

The user should be able to control script execution order #2679

darkred opened this issue Nov 15, 2017 · 12 comments
Labels
bankruptcy Issues that have been closed for "bug bankruptcy". Usually very old non-active issues.
Milestone

Comments

@darkred
Copy link

darkred commented Nov 15, 2017

"Execution order" sorting is the feature I miss the most from the legacy full-tab "manage" dialog.
Currently (in GM 4.0), as it seems, the scripts are executed as they are listed in the popup, i.e. in alphabetical order.
With this sorting no longer available, there's no quick way to resolve userscript conflicts anymore.


For reference, I quote from the (now removed) 'Script order' wiki page :

Script order

Scripts can be displayed in order by:

  • Status - Scripts are ordered by activation status: enabled or disabled, then name.
  • Name - Scripts are ordered alphabetically by name regardless of status.
  • Execution order - Scripts are ordered by execution index.

This last order is important for user scripts that conflict with each other. By changing the order of the scripts the conflict can be resolved. You can change the order by right-clicking an user script and choose one of the actions: Execute first, Execute sooner, Execute later or Execute last.

@arantius
Copy link
Collaborator

This is indeed a feature of 3.x missing from 4.x.

I'm definitely not going to promise any particular feature/UI, but being able to have two scripts installed that must run in a particular order would be good.

@arantius arantius added this to the 4.x milestone Nov 15, 2017
@GM-Script-Writer-62850
Copy link

What if in the script source we had a // @priority (int) feature, or perhaps we should call it a runlevel as priority could be miss leading
each tear can be started at/near the same time via async functions
we should probably support negative values also

@tonycpsu
Copy link

Unlike UNIX runlevels, for which there's sort of a natural order, the order of execution for scripts seems more arbitrary. I think it should be up to the user. A default priority that comes from a tag in the script isn't a bad idea, but there needs to be a facility for overriding the order, as there has been in previous versions of GM.

@GM-Script-Writer-62850
Copy link

I do agree with that, but we could edit the runlevel/priority of scrips from the source if need be; i assume that would be easier to implement, at which point a ui could be built around it

@Unchqua
Copy link

Unchqua commented Nov 24, 2017

Vote for this too. Some of my scripts need to be run in particular order and break if run not in their time.
I too think this should be up to the user to decide this order. UI can refer to a kind of "order"/"runlevel" directive from the script but the last word must be the user's. I can even imagine a pair of scripts which behave intentionally different when run 1st-2nd or 2nd-1st, as both refer to the page's DOM which is changed by them.

@Eselce
Copy link
Contributor

Eselce commented Nov 24, 2017

IMHO a runlevel is not what we need here.
I think, in most cases, it's just about executing script A before script B.
This is a (relative) restriction. Runlevel is an absolute measure. Not adequate.
Also, the restriction is quite sparse. All you need is the "earlier"/"later" thing,
and maybe, just for comfort, "first"/"last"...

@arantius arantius changed the title "Execution order" sorting The user should be able to control script execution order Nov 28, 2017
@arantius
Copy link
Collaborator

This is not (strictly) a property of the script itself, so it should not be a header @tag baked into the source. This is a symptom of some combination of scripts whereby one's changes breaks the other (but not vice versa), so the other must run first.

@arantius arantius removed this from the 4.x milestone Jan 19, 2018
@arantius arantius added this to the Features milestone Feb 22, 2018
@StrikeAgainst
Copy link

Will this feature still be a thing some day? I've been missing it since 4.x came out, and had to do some poor workarounds in my scripts to be executed in the right order for the time being.

@arantius
Copy link
Collaborator

... some poor workarounds ...

What was the workaround, and why was it poor?

@Cerberus-tm
Copy link

I remember creating an invisible div with one script, and setting a timer in the other, which was to check whether the div existed yet. Or was that stupid?

I don't think one can set global variables with Greasemonkey and have them be accessible by other scripts? And even that would require setting a timer, wouldn't it?

@arantius arantius added the bankruptcy Issues that have been closed for "bug bankruptcy". Usually very old non-active issues. label Nov 2, 2023
@arantius arantius closed this as completed Nov 2, 2023
@jepsar
Copy link

jepsar commented Nov 2, 2023

Why close as "completed"? Shouldn't it be "not planned"?

@arantius
Copy link
Collaborator

arantius commented Nov 2, 2023

Bulk operations (check multiple from issue search page) only give one "closed". Which apparently assumes completed. Oh well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bankruptcy Issues that have been closed for "bug bankruptcy". Usually very old non-active issues.
Projects
None yet
Development

No branches or pull requests

9 participants