Básicos dos Addons

What is an addon?

An addon is a userscript, userstyle, or combination of both that runs on the Scratch website or project editor when enabled. For example, the “Editor find bar” addon has a userscript that adds a find box to the editor, and a userstyle that styles that box.

What is a userscript?

A userscript is a JavaScript file that is executed every time the user loads a Scratch page. They can modify the document’s HTML, add new buttons, customize Scratch editor behavior, and so much more.

What is a userstyle?

A userstyle is similar to a userscript; you can specify URL patterns for them. However, userstyles inject CSS instead of JavaScript. They are often used along userscripts to style elements added by them, but they can also be used to style native Scratch elements. When that’s the case, we usually call them “themes”.

What should be an addon?

You might wonder if it’s a better idea to create a new addon, or modify an existing one. If two addons share some of these, they should probably be merged.

  • Ambos precisam, ou não, de permissões que requerem interação do usuário (como notificações).
  • Eles têm muito código idêntico.
  • Um usuário comum esperaria que um addon só tivesse ambas as funções.
  • If being separated, they would interfere with each other.

Remember addons are customizable by the user - adding new functionality should not affect existing users of the addon, unless we intentionally decide to do so.