First... let me congratulate you on a good job of combining many different technical bits and pieces! It shows that you've really dug into the meat of TiddlyWiki! Having said that, I think I can suggest ways to use existing TiddlyWiki features to reduce some of the complexities while still achieving (nearly) the same results.
Let's start with these two pieces:
- GetStartupContext.js
- Set Startup Context
The result of these two pieces is to, on startup, get the value of the "?context=..." parameter from the URL and save it in a tiddler for later use. However, you are probably not aware that the TWCore already does this work for you by automatically creating a set of shadow tiddlers that breaks the URL into its component parts:
$:/info/url/full
$:/info/url/host
$:/info/url/hostname
$:/info/url/origin
$:/info/url/pathname
$:/info/url/port
$:/info/url/protocol
$:/info/url/search
For your purposes, you would be most interested in the last one, $:/info/url/search. Given the URLs you show above, this tiddler would contain text
or
Note that the tiddler includes the URL parameter itself, "?context=", not just the value. This is different from your results, but can be easily handled later on.
- Alternate TiddlyWiki Purposes
Instead of using a custom field, "purpose", you can just set the value in $:/info/url/search, like this:
<div style="font-size:14px;line-height:1.7;margin-left:30px;color:dimgray;">
<$radio tiddler="$:/info/url/search" value="?context=ProductReviews"> {{TiddlyWiki Title 1}} </$radio> <<link "ProductReviews">>
<br>
<$radio tiddler="$:/info/url/search" value="?context=OffGridding"> {{TiddlyWiki Title 2}} </$radio> <<link "OffGridding">>
</div>
Notes:
* I retain the existing data value format, including the "?context=" prefix. This keeps the content of $:/info/url/search consistent with the value that was automatically set.
* I've turned the inline links (for bookmarking) into a macro definition using a parameter for the desired suffix, so that it only need to be specified once.
By tagging the above tiddler with $:/tags/SideBarSegment and adding a field named list-before, with a blank value, the radio buttons will appear above the title in the sidebar. This eliminates much of the need for the "Fancy TiddlyWiki Title" tiddler. The rest of that tiddler is selecting which title to display, and applying styles to the TiddlyWiki title. This can be achieved directly in the $:/SiteTitle tiddler, like this:
<div style="border-top:solid lightgray;">
<div style="font-size:15px;line-height:1.5">Charlie's</div>
<$reveal state="$:/info/url/search" type="match" text="?context=ProductReviews">
{{TiddlyWiki Title 1}}
</$reveal>
<$reveal state="$:/info/url/search" type="match" text="?context=OffGridding">
{{TiddlyWiki Title 2}}
</$reveal>
</div>
Similarly, your conditional subtitle can be achieved directly in the $:/SiteSubtitle tiddler, like this:
<div style="color:darkgray;font-size:90%;text-align:right;border-bottom:solid lightgray">
- Version:
<$list filter="[!is[system]!has[draft.of]!sort[modified]limit[1]]">
<$view field="modified" format="date" template="YYYY-0MM-0DD 0hh12:0mmam" />
</$list>
- <br/>
<$reveal state="$:/info/url/search" type="match" text="?context=OffGridding">
<div style="color:gray;border-top:solid lightgray thin;text-align:left;">
//Easy, practical, and budget-friendly experiments/solutions for "light" grid independence.//
</div>
</$reveal>
</div>
Note that the first part (the version text) is only specified once, and is always displayed, regardless of which "mode" you are currently showing,
and the second part (the $reveal) is only displayed when you are showing the "OffGridding" mode.
I've probably left out some bits and pieces here and there, but hopefully this makes sense to you and you can fill in whatever I've missed without too much trouble.
enjoy,
-e