Comments (6)
I think the only best way is to create a <style>
element on the page. Although this "sandboxes" it, Stylus does basically the same.
from scratchaddons.
Yeah sure. The main thing to discuss is what APIs to provide so that userstyles don't have to be userscripts, and the addon manager can handle enabling or disabling them. We should specially discuss how to handle settings on userstyles.
from scratchaddons.
I think the only best way is to create a
<style>
element on the page. Although this "sandboxes" it, Stylus does basically the same.
Of course. One interesting thing is that Stylus actually inserts styles after the <body>
element, not inside it.
The complicated part is settings and variables, for example in my userstyle. In the old discussion several options were mentioned:
- To handle Boolean variables, the userstyle could be split into multiple CSS files: one which is always loaded, one for dark mode only and so on. This could be done manually.
- Other variables (colors, numbers) could be converted to CSS variables. This could probably be automated but we would have to actually parse the Stylus code - simply replacing all instances of
text
in my userstyle withvar(--addon-text)
would also changetext-align
tovar(--addon-text)-align
. - Alternatively, Stylus code could be converted to CSS at runtime every time a setting is changed. This is my favorite option because it should be easy to implement: we won't need to write the Stylus preprocessor ourselves because it already exists and almost no conversion is needed to get the addon working (except replacing userstyle settings with addon settings, which is easy to do manually).
from scratchaddons.
IMO the last one is pretty complex, even tho I admit it is a great challenge and not the easy way.
Let's be real, userstyles won't change very much with time, and most of them are small userstyles.
I'd go for the first option and then the second if we want to let users customize things in the userstyle that aren't simple booleans.
The third option could still work tho, but until we want to add more than one Stylus userstyle I don't think the addon handler should need to consider Stylus code.
from scratchaddons.
One interesting thing is that Stylus actually inserts styles after the
<body>
element, not inside it.
Scratch doesn't delete the <style>
elements so we can put it in the body or head without any problems.
from scratchaddons.
Wait, we have chrome.tabs.insertCSS
. I don't really know if addon.tab.insertCSS
exists; I don't have firefox.
from scratchaddons.
Related Issues (20)
- `forum-search` shouldn't have to push the content down when the search bar appears
- `gamepad`: Popup when rebinding controls HOT 1
- Hold the middle mouse button and drag to pan the costume editor canvas HOT 1
- What to do for April Fools 2024? HOT 17
- `download-button`: Spinner color should adapt to button background HOT 2
- Search sprites and sprites folder to not cooperate properly. HOT 15
- New Addon: Make mentions clickable in messages. HOT 6
- Backspace delete and backslash switch to local sprite variable / switch to global variable HOT 10
- Hide-flyout addon bug HOT 1
- New addon: show more costumes in assets list, more than one column HOT 13
- h1 border goes into the logo in README HOT 9
- Downloading a sprite in a folder and uploading it somewhere else creates that folder there. HOT 5
- Data Category Tweaks no longer working! HOT 12
- No hover effect on hovering header buttons HOT 2
- `remix-tree-button` is not inline with `download-button` and `animated-thumb` enabled HOT 4
- "Data category tweaks" not showing "list" icon HOT 1
- `onion-skinning` + `editor-compact`: only 2 digits are visible HOT 2
- "Quote post number" (forum-id) gets inconsisently caught by forum filter HOT 10
- `onion-skinning`: deleted costumes are still rendered until re-enabled HOT 2
- Scratch project code translator HOT 39
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from scratchaddons.