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

---multi# magic URL to open two shared projects #5397

Open
Vegz78 opened this issue Nov 8, 2023 · 7 comments · May be fixed by microsoft/pxt#10258
Open

---multi# magic URL to open two shared projects #5397

Vegz78 opened this issue Nov 8, 2023 · 7 comments · May be fixed by microsoft/pxt#10258

Comments

@Vegz78
Copy link

Vegz78 commented Nov 8, 2023

Is your feature request related to a problem? Please describe.
When using the radio function in a classroom setting with the simulator, it is intuitive to use the https://makecode.microbit.org/---multi# editors and, for example, have the sender program in the left editor window and the receiver program in the right.

Describe the solution you'd like
I'd like to be able to make a link that opens 2 shared projects, the first in the left window and the second in the right window, maybe with some custom magic URL, maybe like this:
https://makecode.microbit.org/---multi#_YTbKYAAimAxz&_LxghRpHJaKq8

Describe alternatives you've considered
I have found no alternatives.

Additional context
The feature has been discussed on the forum:
https://forum.makecode.com/t/editor-magic-url-flags/10743/5?u=vegz78

@bsiever
Copy link

bsiever commented Feb 18, 2024

I was just thinking about this too. It could really streamline sharing some radio-based projects.

@Vegz78
Copy link
Author

Vegz78 commented Oct 27, 2024

Yeah, @bsiever! -Especially for radio-based projects, this would be a great way to share them in an educational setting etc.!!! (@kiki-lee?)

I managed to open a project directly in the left split screen using the ---multi URL magic flag, but haven't found yet how to also simultaneously open another project on the right side:
https://makecode.microbit.org/---multi#pub:_ismhAmAyA93c

Has anyone in or outside the makecode team found out yet?

@martinwork
Copy link
Contributor

I notice the hot or cold sample does it with tutorials.
https://makecode.microbit.org/projects/hot-or-cold-multi#:~:text=Start%20both%20tutorials%20side%2Dby%2Dside

I don't know why this link doesn't seem to work from here
https://makecode.microbit.org/---multi#pub:_YTbKYAAimAxz:|:pub:_LxghRpHJaKq8

But it works if pasted into the address bar, or from HTML
makecode-multi.zip

<!DOCTYPE html>
<script>
	async function exampleClick() {
	  try {
		window.open( "https://makecode.microbit.org/---multi#pub:_YTbKYAAimAxz:|:pub:_LxghRpHJaKq8", '_blank').focus();
	  } catch (error) {
		console.log(error);
	  }
	}
</script>

<html>
    <body>

        <h1>makecode--multi</h1>

        <p>Link</p>
		
		<a href="https://makecode.microbit.org/---multi#pub:_YTbKYAAimAxz:|:pub:_LxghRpHJaKq8">https://makecode.microbit.org/---multi#pub:_YTbKYAAimAxz:|:pub:_LxghRpHJaKq8</a>
		
        <p>Button</p>
		
		<button onclick="exampleClick()">Example</button>
				
    </body>
</html>

@martinwork
Copy link
Contributor

martinwork commented Oct 27, 2024

The link doesn't work from here because the invisible part has %7C instead of |
https://makecode.microbit.org/---multi#pub:_YTbKYAAimAxz:|:pub:_LxghRpHJaKq8

https://makecode.microbit.org/---multi#pub:_YTbKYAAimAxz:%7C:pub:_LxghRpHJaKq8

@Vegz78
Copy link
Author

Vegz78 commented Oct 27, 2024

You are a special kind of genius destined for greatness, mr. @martinwork!

Great catch and thank you very much! Been looking for a solution to this for ages!

Seems like the ASCII vertical bar is (or was formerly) an "unsafe" character which is force converted to %7C in URLs, at least here on GitHub, but works under the makecode domains and webapps, but not the reencoded %7C. Interesting!

How to make links with vertical bars work in general, then?

UPDATE: Works as link attachments but not links embedded in text in Google Classroom, which is used in many schools. -Awesome!

@martinwork
Copy link
Contributor

Whoever created it is the genius... I just searched the source for multi"!

I found another use here
https://github.com/KitronikLtd/pxt-kitronik-stopbit/blob/master/RadioCrossingLeft.md?plain=1#L10

I think this might be the only place that checks for "|" - actually ":|:".
https://github.com/microsoft/pxt/blob/master/webapp/public/multi.html#L74

Could it also try ":%7C:"?

@Vegz78
Copy link
Author

Vegz78 commented Oct 28, 2024

Could it also try ":%7C:"?

Good idea!

@abchatra / @kiki-lee: Would it be possible to please assign someone on your team on this issue to do the quick change so that the various MakeCode editors responds the same way to :%7C: as to :|:, and it becomes possible to publish links that open two shared and interconnected MakeCode projects directly in the ---multi split screen mode also on many websites that forcibly reencodes URLs with the | (verrtical bar character) to %7C?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants