kasparsd / HTML5-Notepad-with-Sync

Self-hosted HTML5 Notepad App
https://kaspars.net/projects/html5-notepad
57 stars 24 forks source link

not working #4

Open ashankobewatta opened 6 years ago

ashankobewatta commented 6 years ago

hi anyone that ran this web site successfully please share the config details with us !

regards .

vandys commented 6 years ago

Hi, yes, localStorage doesn't play nicely with the old, old version of jquery used. And new jquery breaks lots of other things. So if you change:

-                       $.post('sync.php', localStorage, function(data) {
+                       // jquery doesn't know how to enumerate
+                       //  localStorage any more
+                       const ls = {};
+                       for (let i = 0; i < localStorage.length; ++i) {
+                           const k = localStorage.key(i);
+                           ls[k] = localStorage[k];
+                       }
+                       $.post('sync.php', ls, function(data) {

in function sync() in index.html, it will start working. It's really pretty nice for being such a small, tidy implementation!

vandys commented 6 years ago

So I punted and wrote a clone using ES6, no jquery, Python CGI, Sqlite3 storage. See Notepad under sources.vsta.org if you're interested.

kasparsd commented 6 years ago

@vandys This is really awesome. I'll mark this project as archived and link to your project, if you don't mind.

vandys commented 6 years ago

If that's your preference, I'd be honored, thanks!