Scratch3-Dev-Tools icon indicating copy to clipboard operation
Scratch3-Dev-Tools copied to clipboard

Add HEX

Open Sheshank-s opened this issue 6 years ago • 14 comments

Adds: #8

Note: This does not touch any of the code for the find. The find on master in @griffpatch 's repo is broken, and it is broken in this repo as well. After you merge this you can fix that.

Sheshank-s avatar Sep 22 '19 16:09 Sheshank-s

Hey there, I love the concept of what you are trying to add, but I feel we really need it to automate the Colour sliders... I haven't looked at your changes yet, so give me a bit of time and I'll review the change, thanks.

griffpatch avatar Sep 23 '19 10:09 griffpatch

Okay. The change is basically a hex to scratch converter. It'll still be useful, but so far from what i've seen its impossible to automate it.

Sheshank-s avatar Sep 23 '19 21:09 Sheshank-s

Possibly some bad news... It appears the scratch team may remove the JavaScript entry points I am using too make the whole extension work... I'm going to hold off further development until I know more. :(

On Mon, 23 Sep 2019, 22:59 Sheshank Shankar, [email protected] wrote:

Okay. The change is basically a hex to scratch converter. It'll still be useful, but so far from what i've seen its impossible to automate it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/griffpatch/Scratch3-Dev-Tools/pull/11?email_source=notifications&email_token=ABTM3PXC2ABYV3NQR4JEBR3QLE35TA5CNFSM4IZDQO2KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD7MM2WI#issuecomment-534302041, or mute the thread https://github.com/notifications/unsubscribe-auth/ABTM3PTEMS7WCKPDYPAD7VLQLE35TANCNFSM4IZDQO2A .

griffpatch avatar Sep 24 '19 05:09 griffpatch

Hmm.. how did you find this out? Also if you don't mind can you join this: https://join.slack.com/t/scratchhub/shared_invite/enQtNzU5ODI2OTY0NjQzLWMyZmEzM2I4YWM1N2U1MzEwZmMwNTQ0M2M3MGUxYWUzZWNlZDg4ODc3MDVhODFiOTk3MDNiZTNmODZmZWRjNzI It's a slack i use for communicating with scratchers about development. It would be helpful since you would get notifications

Sheshank-s avatar Sep 24 '19 13:09 Sheshank-s

@griffpatch any updates?

Sheshank-s avatar Sep 26 '19 00:09 Sheshank-s

@GreenBayRules I think it would be a better idea to open this pull request on the official scratch-gui repository. By doing this, these features would be available on Offline Scratch as well. It is a must, really!

d-siganos avatar Apr 01 '20 14:04 d-siganos

On my branch, I've managed to edit the project.bundle.js file, meaning I can expose any module to the window. So even if scratch removes all the js entrypoint's i can add them back.

Joeclinton1 avatar Aug 23 '20 18:08 Joeclinton1

What modules can you gain access to? Anything deeper than the ones I already access? I'd be very interested.

On Sun, 23 Aug 2020 at 19:22, Joe Clinton [email protected] wrote:

On my branch, I've managed to edit the project.bundle.js file, meaning I can expose any module to the window. So even if scratch removes all the js entrypoint's i can add them back.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/griffpatch/Scratch3-Dev-Tools/pull/11#issuecomment-678807441, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTM3PQXEAXT5FZB4356PELSCFM7XANCNFSM4IZDQO2A .

griffpatch avatar Aug 24 '20 08:08 griffpatch

@griffpatch Right now, i've exposed Runtime to the window as I need it for the what i'm working on. I also previously exposed VirtualMachine which in itself contains runtime, but also alot of other useful modules.

I should be able to expose any module by just adding "window.module_name = <reference to module>" to project.bundle.js.

Joeclinton1 avatar Aug 24 '20 11:08 Joeclinton1

So will that work on the Scratch website or only your own build of scratch?

On Mon, 24 Aug 2020 at 12:19, Joe Clinton [email protected] wrote:

@griffpatch https://github.com/griffpatch Right now, i've exposed Runtime to the window as I need it for the what i'm working on. I've also previously exposed VirtualMachine which in itself contains runtime, but also alot of other useful modules.

I should be able to expose any module by just adding "window.module_name = " to project.bundle.js.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/griffpatch/Scratch3-Dev-Tools/pull/11#issuecomment-679067253, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTM3PWWTCD7VXMSFEITNJTSCJECZANCNFSM4IZDQO2A .

griffpatch avatar Aug 24 '20 13:08 griffpatch

So will that work on the Scratch website or only your own build of scratch?

It works on the regular scratch website. It's taken me some time to get it to work, but here's the solution I settled on:

  1. It uses the webrequest module to block the request for the projects.bundle.js file before the request is sent. (redirecting to my own edited file, was considered but I wanted it to be more flexible and not break if the scratch code is updated)
  2. In injectSimple.js, it requests the file separately and inserts "window.runtime = this.runtime" just after runtime is defined.
  3. It injects the modified script into the document.

I added a new background.js file for blocking the request, added more to the manifest.json file to allow the webrequest module, and added the script modifier and injector to injectSimple.js.

I'm currently working on a set of profiling tools, to make testing the performance of scratch projects easier and was going to submit a pull request once I had finished that. But I can break the pull request into parts and submit just the runtime exposing code as a separate pull request, if that works better.

Joeclinton1 avatar Aug 24 '20 13:08 Joeclinton1

That is real smart. I'd love to play around and see what this makes possible! The major thing is to not break the scratch website of they update though... Always a problem... If I can access scripts in other sprites we would have so much more power

On Mon, 24 Aug 2020, 14:43 Joe Clinton, [email protected] wrote:

So will that work on the Scratch website or only your own build of scratch?

It works on the regular scratch website. It's taken me some time to get it to work, but here's the solution I settled on:

  1. It uses the webrequest module to block the request for the projects.bundle.js file before the request is sent. (redirecting to my own edited file, was considered but I wanted it to be more flexible and not break if the scratch code is updated)
  2. In injectSimple.js, it requests the file separately and inserts "window.runtime = this.runtime" just after runtime is defined.
  3. It inserts the modified script into the document.

I added a new background.js file for blocking the request, added more to the manifest.json file to allow the webrequest module, and added the script modifier and injector to injectSimple.js.

I'm currently working on a set of profiling tools, to make testing the performance of scratch projects easier and was going to submit a pull request once I had finished that. But I can break the pull request into parts and submit just the runtime exposing code as a separate pull request, if that works better.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/griffpatch/Scratch3-Dev-Tools/pull/11#issuecomment-679134306, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTM3PVDL2IRB77M6VNR3ETSCJVALANCNFSM4IZDQO2A .

griffpatch avatar Aug 24 '20 13:08 griffpatch

If you don't mind splitting out the exposing part then I would be very excited to look at it.

On Mon, 24 Aug 2020 at 14:43, Joe Clinton [email protected] wrote:

So will that work on the Scratch website or only your own build of scratch?

It works on the regular scratch website. It's taken me some time to get it to work, but here's the solution I settled on:

  1. It uses the webrequest module to block the request for the projects.bundle.js file before the request is sent. (redirecting to my own edited file, was considered but I wanted it to be more flexible and not break if the scratch code is updated)
  2. In injectSimple.js, it requests the file separately and inserts "window.runtime = this.runtime" just after runtime is defined.
  3. It inserts the modified script into the document.

I added a new background.js file for blocking the request, added more to the manifest.json file to allow the webrequest module, and added the script modifier and injector to injectSimple.js.

I'm currently working on a set of profiling tools, to make testing the performance of scratch projects easier and was going to submit a pull request once I had finished that. But I can break the pull request into parts and submit just the runtime exposing code as a separate pull request, if that works better.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/griffpatch/Scratch3-Dev-Tools/pull/11#issuecomment-679134306, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABTM3PVDL2IRB77M6VNR3ETSCJVALANCNFSM4IZDQO2A .

griffpatch avatar Aug 24 '20 14:08 griffpatch

If you don't mind splitting out the exposing part then I would be very excited to look at it.

Ok, I've moved the exposer part to a new branch and will submit a pull request very soon. This will only contain the runtime addition but adding VirtualMachine aswell is as simple as inserting window.VM = this

Joeclinton1 avatar Aug 24 '20 15:08 Joeclinton1