On Wednesday, November 27, 2019 at 7:58:26 PM UTC-8, TonyM wrote:
>
>
>    - Unlike TWC cookies and the cookie jar from Eric are not longer 
>    relevant. 
>
> Some time ago (a few years, in fact) I made a set of cookie-handling 
widgets for TW5.  I use them in the InsideTiddlyWiki book so that various 
settings and state values are automatically saved as cookies, and are 
re-applied when you load the page.  This allows InsideTiddlyWiki "themes" 
and TOC views to be preserved across sessions, so YOUR choices are applied 
each time you visit the site.

To see it in action, go to http://tiddlytools.com/InsideTW and then click 
the "select a theme" button (upper right toolbar, picture icon) and choose 
another theme (e.g., Woodshop), or click the "toggle stretch-to-fit" button 
(next to the theme button), or click the "pin Table of Contents" button 
(upper left, first icon).

Then, reload the page... and notice that your settings were stored (as 
cookies) and re-applied when you reloaded!

The plugins are:

> TiddlyTools/Cookies/action-setcookie.js
> TiddlyTools/Cookies/cookie.js
> TiddlyTools/Cookies/cookienames.js
> TiddlyTools/Cookies/getcookie.js

 
which are used here:

> TiddlyBook/CookieJar


The CookieJar is tagged with $:/tags/PageTemplate so it invoked each time 
you load the page, and uses the <<cookie>> widget, which binds tiddlers 
within the document to specific cookie names.  When the <<cookie>> widget 
is first invoked, it loads tiddlers from stored cookies, and then 
automatically updates the cookies whenever those tiddlers are changed 
during the session.

Note: cookies won't work when viewing local files (which don't allow 
cookies at all)... but it DOES work when you are viewing hosted (online) 
files.  Also, I wrote all of the above long before the LocalStorage plugin 
existed... but similar handling should be possible using LocalStorage 
instead of cookies, which would then permit use for local files as well as 
hosted files.

enjoy,
-e

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWikiDev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywikidev/49db514d-417d-4b72-a2e3-d823cecbb876%40googlegroups.com.

Reply via email to