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

Styling is Inefficient #12

Open
MiniCoder11 opened this issue Sep 17, 2020 · 12 comments
Open

Styling is Inefficient #12

MiniCoder11 opened this issue Sep 17, 2020 · 12 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested

Comments

@MiniCoder11
Copy link
Collaborator

Although our current method definitely works, it is inefficient and messy. In addition, it uses several hundred lines of JavaScript even though we could certainly shorten it to less (probably even 150 or fewer). I'm going to take some time to setup CSS variables and universal styling and algorithmically apply it to pages so that the theme should (theoretically) work anywhere on Scratch and it also should be more compact and consistant.

My only question: Should we minify the JavaScript at the end? It would save a bit of filesize but also make the code harder to read and may discourage some users who want to read it to verify it is safe to use.

@MiniCoder11 MiniCoder11 added enhancement New feature or request help wanted Extra attention is needed question Further information is requested labels Sep 18, 2020
@VFDan
Copy link
Owner

VFDan commented Sep 29, 2020

IMO we shouldn't minify at the end, as people will want to know that it is just doing a dark theme and not logging their password.

@MiniCoder11
Copy link
Collaborator Author

IMO we shouldn't minify at the end, as people will want to know that it is just doing a dark theme and not logging their password.

My thoughts exactly. That's the same reason why the userscript disables itself on account pages where sensitive information could be entered or viewed.

Griffpatch's messaging extension has just been updated (They beat me to it. I was working on my ScratchTools project with the same goal). They have three dark themes but none of them (In my opinion) are as complete or aesthetically pleasing as ours. Should I include this stylesheet in my extension? Should we submit it to Scratch Add-ons? What is our next course of action?

@VFDan
Copy link
Owner

VFDan commented Sep 30, 2020

I say add it to both, as it's open source and it's not competitive :)

@MiniCoder11
Copy link
Collaborator Author

I say add it to both, as it's open source and it's not competitive :)

Sounds great! 😄

@MiniCoder11
Copy link
Collaborator Author

I'm just not going to be able to press the comment button to submit the link to them until I've organized the code! 😆

@MiniCoder11
Copy link
Collaborator Author

@VFDan I've completely revamped the entire dark theme and managed to remove 155 lines. I also fixed many things I've overlooked in this version. So far, the user script only really "works" on the explore, home, project, and editor pages but I am patching in more styles. The userscript also grabs the VM and enables 60FPS mode for projects as well as adding a feature where you can create a variable with the name "lastKeyPressed" and it will be automatically updated with the last key you press (including shift, escape, backspace, etc.)

Userscript repository: https://github.com/MiniCoder11/ScratchMod
Keypress test project: https://scratch.mit.edu/projects/452975589/

@VFDan
Copy link
Owner

VFDan commented Dec 4, 2020

@MiniCoder11 Nice! World_Languages said in Discord DMs that the only way our dark theme will be added will be if we split it into an editor version and website version as the way Scratch Addons applies dark themes is by adding CSS not JS.

@VFDan
Copy link
Owner

VFDan commented Dec 4, 2020

However, you should isolate the dark theme from your code and push here as this is supposed to be a dark theme and nothing else.

@MiniCoder11
Copy link
Collaborator Author

@VFDan I know that this is only supposed to be a dark theme which is why I didn't push it to this repository. Eventually, I plan to revise my browser extension to be compatible with ScratchAddons extensions but as of now I'm just working on aesthetic features in a temporary userscript. As for the ScratchAddons theme, we can easily convert it from JS to CSS by removing the GM_addStyle functions and running the rest through a CSS beautifier to get proper spacing/indentation. Unless you suggest otherwise, I was not planning on adding my recent changes to our userscript because I was not sure if you would like the color styles.

@VFDan
Copy link
Owner

VFDan commented Dec 4, 2020

Oh, I wasn't aware that you changed the colors. The thing with for a ScratchAddons theme is we have to split it into an editor version and a website version to be CSS only, as we refresh the style when doing an editor page.

@MiniCoder11
Copy link
Collaborator Author

Luckily, seperation should be fairly simple. All we have to do is grab the CSS from the editor section of the if statement and the CSS from the main section.

@VFDan
Copy link
Owner

VFDan commented Dec 8, 2020

Yep

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants