jstrieb / urlpages

Create and view web pages stored entirely in the URL
http://jstrieb.github.io/urlpages
MIT License
1.38k stars 129 forks source link

[Work in progress] lz-string, bookmarklet, comments, getTextareaData, Encoded Input and more #21

Closed benja-johnny closed 5 years ago

benja-johnny commented 5 years ago

Added a few things:

Plus some minor beautification.

benja-johnny commented 5 years ago

Added bookmarklet.js, very alpha.

benja-johnny commented 5 years ago

can you please tell me what are the basic differences in repo and your fork Sorry for asking this dumb question but i am a newbie in JS

It’s a good question, since my commits are all over the place.

Main difference is it uses lz-string base-64 compress/decompress instead of btoa/atob. The other difference is the Editor has an Encoded Input button to easily copy-paste the encoded string part of the URL.

There’s also a bookmarklet, which only works with the original jstrieb/urlpages, because it’d need to contain lz-string-1.4.4.js to use that type of compression, which is too much for a bookmarklet AFAIK.

benja-johnny commented 5 years ago

Tried using brotli instead of lz-string, but couldn’t get brotli/compress to work. https://github.com/foliojs/brotli.js/issues/20

ghost commented 5 years ago

can you please tell me what are the basic differences in repo and your fork Sorry for asking this dumb question but i am a newbie in JS

It’s a good question, since my commits are all over the place.

Main difference is it uses lz-string base-64 compress/decompress instead of btoa/atob. The other difference is the Editor has an Encoded Input button to easily copy-paste the encoded string part of the URL.

There’s also a bookmarklet, which only works with the original jstrieb/urlpages, because it’d need to contain lz-string-1.4.4.js to use that type of compression, which is too much for a bookmarklet AFAIK.

Thanks for answering

ghost commented 5 years ago

@benja-johnny The live rendering of html is not being done in editor as shown below: benja-johnny github io_urlpages_editor_

benja-johnny commented 5 years ago

@benja-johnny The live rendering of html is not being done in editor as shown below:

@aliglelo Thanks for checking it out, will address this issue! The parser (parseHTML function) is still very alpha, so right now if you type in the HTML textbox, it just sorts it between the \<body> tags. You can see this if you press the Copy Code button after typing something in the textboxes. Also, just noticed that the Download Code button isn’t working properly either, will be fixing that too. Had to change a variable.

benja-johnny commented 5 years ago

I’m aware that I made so many changes, that pulling this might not be okay. Leaving the request open.

benja-johnny commented 5 years ago

To elaborate on why this needs an HTML parser: unnecessary code needs to be scraped from a webpage to make the URL shorter. It can be done in the editor by hand, but that isn’t user friendly.

ghost commented 5 years ago

To elaborate on why this needs an HTML parser: unnecessary code needs to be scraped from a webpage to make the URL shorter. It can be done in the editor by hand, but that isn’t user friendly.

Exactly

benja-johnny commented 5 years ago

Yes it now works if we copy code and then run it but as far as live rendering is concerned It still seems to be not working for me

@aliglelo Just tested on Safari, FF, Chrome. Seems to work if I just type something in the first textbox. (Also noticed other bugs, will fix.) It’s still too early for these types of optimizations, since the parser is barely functional. I’ll be improving it next week. Thanks again for trying it out, though. This was the best result I could get (Safari v12.1.1): Screen Shot 2019-07-14 at 14 04 54 On FF and Chrome the same link shows a blank editor preview, sadly. Will be fixing that as well. Link to the thing that's pictured (too long for tinyurl): https://pastebin.com/eM161UPX (This works for me on all 3 browsers.)

benja-johnny commented 5 years ago

Probably a good idea to have this on a separate fork. Closing the request, for now.

ghost commented 5 years ago

Yes it now works if we copy code and then run it but as far as live rendering is concerned It still seems to be not working for me

@aliglelo Just tested on Safari, FF, Chrome. Seems to work if I just type something in the first textbox. (Also noticed other bugs, will fix.) It’s still too early for these types of optimizations, since the parser is barely functional. I’ll be improving it next week. Thanks again for trying it out, though. This was the best result I could get (Safari v12.1.1): Screen Shot 2019-07-14 at 14 04 54 On FF and Chrome the same link shows a blank editor preview, sadly. Will be fixing that as well. Link to the thing that's pictured (too long for tinyurl): pastebin.com/eM161UPX (This works for me on all 3 browsers.)

Excellent work

benja-johnny commented 5 years ago

Excellent work

@aliglelo Thanks; I can only take credit for a few lines though!