Just wanted to post the latest code of my bookmarking-to-tw tests. Briefly, it works by using a bookmark that opens a popup with a form that is populated with the current site title and url, allows editing of fields, then sends the data as a new tiddler in a TiddlyWiki running on a node server. It's a 2-click solution.
There are few parts to the setup, but the files are small and hopefully understandable:
- A bookmarklet
- A static html form
- Javascript functions
- Server options
1. The bookmarklet is placed in your browser's toolbar. It opens a pop-up window getting its contents from the static html form. Because the origin of the popup is the same as the wiki server, there are no cross-site scripting issues. The site title and url are passed to the html file as part of the url using the
u= and
t= parameters.
2. A static html file used for a popup window. I named mine form.html. This is a html file which is opened by the bookmarklet. The static file contains a form, and includes the javascript functions, and buttons to submit or cancel. A javascript function is used to parse the parameters from the url and populate the forms. The file lives in the files/ folder under your node wiki location.
3.The javascript file (
funcs.js in this case)contains helper functions that send the form data to the node server using the
WebServer API.
4. Run the server using the
csrf-disable option set to yes.
It's cool to see it working, but there's lot's of room for improvement. For example I'd like to grab some meta tags from the html as well as just the title and url.
Let me know if you have any questions or thoughts. I'm just a hobbyist and all my knowledge comes from Stackoverflow, so any improvements would be appreciated.
Thanks for looking.