Scratchaddons: New Forum Theme

Created on 9 Sep 2020  ·  11Comments  ·  Source: ScratchAddons/ScratchAddons

Is your feature request related to a problem? Please describe.

When Scratch 3 was released, the forums continued using the same theme and scratchblocks style.

Describe the solution you'd like

The menubar should be automatically modernized and scratchblocks v4 should be injected.

Describe alternatives you've considered

There are none.

enhancement

Most helpful comment

I will make a Scratch 2.0 → 3.0 addon at some point (based on my userstyle), and, as @JeffaloBob said, that could also change scratchblocks.

All 11 comments

i like the way maximouse's userstyle fixes the forum's look. perhaps that could automatically inject scratchblocks v4?

I will make a Scratch 2.0 → 3.0 addon at some point (based on my userstyle), and, as @JeffaloBob said, that could also change scratchblocks.

I'm trying to port the userstyle, but it's turning out harder than I thought.

I'm trying to port the userstyle, but it's turning out harder than I thought.

I don't recommend doing that yet because I'm going to change the userstyle's internal structure a lot in the near future.

Honestly, I'd given up anyway. It turns out that it is a lot harder than I thought to port a userstyle.

@mxmou @WorldLanguages Does anyone have any ideas on how to inject v4 Scratchblocks? I know that we'd need to replace menu.js, scratchblocks.js, and a few calls to scratchblocks.rendermatching.

I believe @JeffaloBob knows about scratchblocks

A little problem: the scratchblocks are rendered on $(document).ready, which is equivalent to DOMContentLoaded, but we need to make sure a userscript runs before that event. The jQuery 1.12 (Scratch uses 1.11) implementation of ready can be found here.

The userscript would need to load the latest version of scratchblocks, which should replace the global scratchblocks object, and then override renderMatching to always use 3.0 style.

I will try to implement this because I'm already working on this addon.

I got the expected result: blocks are already rendered when the script runs. The only solution I can think of is re-fetching the page, replacing the element that contains all the posts and running renderMatching() again. Does anyone have a better idea?

We need a run-at document-start like tampermonkey

On Tue, Sep 29, 2020 at 3:39 AM MaxiMouse notifications@github.com wrote:

I got the expected result: blocks are already rendered when the script
runs. The only solution I can think of is re-fetching the page, replacing
the element that contains all the posts and running renderMatching()
again. Does anyone have a better idea?


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/ScratchAddons/ScratchAddons/issues/240#issuecomment-700511730,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AFQENB2MHZQJHSTQUTGLGW3SIGFMVANCNFSM4RBCQZPA
.

--
🍵 https://www.google.com/teapot

A little problem: the scratchblocks are rendered on $(document).ready, which is equivalent to DOMContentLoaded, but we need to make sure a userscript runs _before_ that event. The jQuery 1.12 (Scratch uses 1.11) implementation of ready can be found here.

The userscript would need to load the latest version of scratchblocks, which should replace the global scratchblocks object, and then override renderMatching to always use 3.0 style.

I will try to implement this because I'm already working on this addon.

You might want to take a look at https://github.com/scratchblocks/scratchblocks/issues/274#issuecomment-464191288

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Touchcreator picture Touchcreator  ·  3Comments

GrahamSH-LLK picture GrahamSH-LLK  ·  8Comments

pufferfish101007 picture pufferfish101007  ·  4Comments

Richienb picture Richienb  ·  8Comments

WorldLanguages picture WorldLanguages  ·  8Comments