How To: Deal with conflicting user scripts

supahgreg edited this page Jul 19, 2011 · 4 revisions

When user scripts conflict (i.e. one script breaks the rest), it may be because one of the scripts so drastically changes a page that the other scripts are no longer relevant. In such a case the user should either remove the less desired script(s), or resolve the conflict in one of the following ways:

  1. Rewrite the code: Ask if any of the scripts could be written in a way that renders the conflict null.
  2. Use @run-at: This metadata value should be considered if following option #1. Current Greasemonkey does not support @run-at, however authors can provide support for their Scriptish users by specifying this header.
  3. Use @priority: This metadata value allows you to fine-tune the execution order of user scripts.
  4. Use @delay: This metadata value delays a script's execution. Adding a delay can have a similar effect as using @priority or @run-at in that it (potentially) changes the order in which scripts are executed. This approach should only be used as a last resort when resolving user script conflicts.