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

URL string will be longer in future #22

Open
Rplus opened this issue Apr 22, 2019 · 4 comments
Open

URL string will be longer in future #22

Rplus opened this issue Apr 22, 2019 · 4 comments
Labels
enhancement New feature or request

Comments

@Rplus
Copy link
Owner

Rplus commented Apr 22, 2019

If select all now, it will take about 900 chars in pokedex string in URL.
And it is okay now when it is not longer than 2000 chars (for IE).

It uses Pokedex in URl search string.
There are pokedex: 23 or with isotope number 23_3,
and they concate with dash -.

@Rplus Rplus added the enhancement New feature or request label Apr 22, 2019
@Rplus
Copy link
Owner Author

Rplus commented Apr 22, 2019

To compress that, common js library like lz-string is not a good idea, it will get many special chars.
Because the string should run encodeURIComponent before put it into URL, and URL will be longer when it use special chars.

I think a shorten solution with toString(36):

var ids = ['2', '63', '104_1'];
var str = ids
  .map(i =>
    i.split('_').map(j => (+ j).toString(36))
  )
  .map(k => k.join('_'))
  .join('-');

But it might be ugly, so…

@YesThatAllen
Copy link

I enjoy that I can manually see/edit.build URLs.. any chance that an ellipsis could be used for runs?

Option ; on a mac.. and they work in github URLs:

https://github.com/Rplus/Pokemon-shiny/compare/master…vue?expand=1 (note, that isn't three .)

Of course, I haven't looked for a tool that automatically knows when to shorten 1,2,3,4,5 to 1…5

@Rplus
Copy link
Owner Author

Rplus commented Apr 24, 2019

It is okay for using , and it is possible for parsing .
But the IDs are not all number.
Sometime, ID needs to identify different isotope with underscore: _.

And the second, there are two parts for pokedex: own & registered, the numbers will not be continuous.

@Rplus
Copy link
Owner Author

Rplus commented Sep 10, 2019

Now, we use url Search-String to share, and save that with LocalStorage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants