sharpie7 / circuitjs1

Electronic Circuit Simulator in the Browser
GNU General Public License v2.0
2.29k stars 633 forks source link

Generated Links #481

Closed dvdff closed 4 years ago

dvdff commented 4 years ago

The new form of generated links does not include values - which means it is not possible to update values from outside the browser.

pfalstad commented 4 years ago

Could you describe in more detail what you are doing, that you need to modify values in the links? I have some javascript code that generates circuit links but it uses old-style links, which still work.

dvdff commented 4 years ago

We generate circuit with unique values for students in the class that we teach. Previously with the Falstad links, the values were just a component in the url that we could modify with a code script, but this seems to not be possible with the new urls as these are all letters.

If you have some code to generate these links that would be much appreciated.


From: Paul Falstad notifications@github.com Sent: Tuesday, August 11, 2020 2:55:33 PM To: sharpie7/circuitjs1 circuitjs1@noreply.github.com Cc: Sam C 1234dvdff@gmail.com; Author author@noreply.github.com Subject: Re: [sharpie7/circuitjs1] Generated Links (#481)

Could you describe in more detail what you are doing, that you need to modify values in the links? I have some javascript code that generates circuit links but it uses old-style links, which still work.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/sharpie7/circuitjs1/issues/481#issuecomment-671724392, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABXNNAT7YAPCQIO52NFCRQ3SADFMLANCNFSM4P2SJKEA.

pfalstad commented 4 years ago

Well, if your existing code is generating circuits using old style links, it will still work.

If you need to create new circuits that you can modify with a script, you can generate the old style links by doing File->Export As Text, then replacing all the spaces with "+" and URL encoding the rest (replacing newlines with %0A).

Or, you could get the compression library we are using: https://github.com/pieroxy/lz-string/ And then do File->Export As Text, and compress the result using compressToEncodedURIComponent. Or take a new-style link, decompress it using decompressFromEncodedURIComponent, modify it and then compress it again.

dvdff commented 4 years ago

Thanks for your advice on this. We have been able to regenerate these links from the suggestions you provided above, by generating a link from the exported text.

Thanks again.


From: Paul Falstad notifications@github.com Sent: Wednesday, August 12, 2020 4:06:24 AM To: sharpie7/circuitjs1 circuitjs1@noreply.github.com Cc: Sam C 1234dvdff@gmail.com; Author author@noreply.github.com Subject: Re: [sharpie7/circuitjs1] Generated Links (#481)

Well, if your existing code is generating circuits using old style links, it will still work.

If you need to create new circuits that you can modify with a script, you can generate the old style links by doing File->Export As Text, then replacing all the spaces with "+" and URL encoding the rest (replacing newlines with %0A).

Or, you could get the compression library we are using: https://github.com/pieroxy/lz-string/ And then do File->Export As Text, and compress the result using compressToEncodedURIComponent. Or take a new-style link, decompress it using decompressFromEncodedURIComponent, modify it and then compress it again.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHubhttps://github.com/sharpie7/circuitjs1/issues/481#issuecomment-672147239, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ABXNNAR3XRQKFHMQUNOUMZTSAGCCBANCNFSM4P2SJKEA.