URL control, e.g set params, get field values, even create tiddlers - doable?

107 views
Skip to first unread message

Mat

unread,
Jan 17, 2016, 10:14:20 AM1/17/16
to tiddl...@googlegroups.com
What control do we have over a TW via the browsers URL field?


For example, you might know that it is possible to use a filter directly in the (browser) url to control which tiddlers show up, for instance;


Regarding that second example, filtering out plugins, it so happens that it's a very big first tiddler but there really is a listing of all plugins as separate tiddlres below it. For a more (humanly) informative presentation, we can expand the filter to be;

 
...which shows several tiddlers titled as the description of the plugins they originate from. 

Now, as you note, those descriptions are really presented as "missing tiddlers".

My question is what can be done to control this - and/or other "aspects" such as accessing field values, set parameters and even create tiddlers... via the URL

In the above example, I might want to present the result in a single tiddler and with the plugin title followed by its description.

And, if you haven't seen it, you can do pretty darn amazing stuff by just using the URL field. For instance, merely copy-paste this into the URL field;

(A little plead though; these examples are really cool per se but please don't let comments regarding them hijack the thread.)


data:text/html, <div contenteditable style="width:500px; height:500px; border:1px dashed #CCC">

or how about an instant code editor?


data:text/html, <style>#editor { position: absolute; top: 0; right: 0; bottom: 0; left: 0; }</style><div id="editor"> function foo(items) { var x = "All this is syntax highlighted"; return x; } </div> <script src="http://ajaxorg.github.io/ace-builds/src-min/ace.js" type="text/javascript" charset="utf-8"></script> <script> var editor = ace.edit("editor"); editor.getSession().setUseWorker(false); editor.setTheme("ace/theme/monokai"); editor.getSession().setMode("ace/mode/javascript"); </script>




Is it possible to combine a regular TW permalink with a command like that, straight in the browser url?

Is it possible to "pull out" field values in the TW and present them in an temporarily created tiddler at the appearing site? And other types of queries?

Is it possilbe to overwrite data as it is being displayed? For instnace, can I set my own style for background color for when I load at tiddlywiki.com?

...

<:-)


Possibly relevant links

Maybe one can pass json values directly in the URL to create a tiddler?

Dropbox describing how to include json in URLs

Setting queries (yes?) via URL, but I think for a specific service (or?)

maybe somehow relevant


Tobias Beer

unread,
Jan 18, 2016, 10:29:26 AM1/18/16
to TiddlyWiki
Hi Mat,
 
What control do we have over a TW via the browsers URL field?

Whatever url "paramifiers" are supported,
the full documentation of which appears missing.
This should be (y)our primary concern for now.
 
My question is what can be done to control this - and/or other "aspects" such as accessing field values, set parameters and even create tiddlers... via the URL

It would require another paramifier to specify a template / dynamic tiddler that:
  1. either already exists
    • I guess that's not what you want, because you seem to want full control outside of what is already present
  2. is encoded in the url hash
    • unpacked by tiddlywiki
    • rendered using an appropriate component that knows how to handle it
In the above example, I might want to present the result in a single tiddler and with the plugin title followed by its description.

So, you'd need to pass your desired template uri-encoded to TiddlyWiki and it would have to know what to do with all that, e.g. use some (temporary) tiddler $:/core/ui/Startup to render this dynamic template.

Is it possible to combine a regular TW permalink with a command like that, straight in the browser url?

It all depends what you eventually what to achieve. 

Is it possible to "pull out" field values in the TW and present them in an temporarily created tiddler at the appearing site? And other types of queries?

With the above mentioned "dynamic template" thingy, possibly.

Is it possilbe to overwrite data as it is being displayed? 
For instance, can I set my own style for background color for when I load at tiddlywiki.com?

It would require another type of paramifier, e.g. "dynamic actions". There you would specify, url-encoded(!), the actions to be performed on startup, leveraging whatever actions the core / that wiki supports.

All this sounds reaaaally man-hour-intensive in terms of development.
So, the question would be: What's are the benefits of all this?

Best wishes,

Tobias.

Jed Carty

unread,
Jan 18, 2016, 1:30:12 PM1/18/16
to TiddlyWiki
It sounds like you want to do a lambda function style tiddlywiki thing. Jeremy was talking about doing something like that with amazon hosting during the last hangout but I don't remember any of the specifics of that. I think that it could be very useful (or at least interesting), but as Tobias said, it would probably be a lot of work. If we have some goal in mind than I would be willing to put some time into work on this. With all of the time I have for new projects....

Mat

unread,
Jan 18, 2016, 1:58:25 PM1/18/16
to TiddlyWiki
@Tobias, I really appreciate the input.

What control do we have over a TW via the browsers URL field?

Whatever url "paramifiers" are supported,

I got a chuckle as I googled the term "paramifiers" - sounds like something established but to my surprise it's TW lingo.

...and, it seems a certain Mr. Beer was involved on the matter concerning TiddlySpace; Startup Parameters.

(BTW, some quick tests to apply it to TW5 failed, unsurprisingly)
 

the full documentation of which appears missing.
This should be (y)our primary concern for now.

Yes. But does anyone other than @Jeremy have the knowledge?

The little I do find is the tiddlre on PermaLinks. It briefly mentions the filter-via-url possibility and under last paragraph ("Techical Details") basically details how to set a target tiddler in the river.

 
 
  1. is encoded in the url hash
    • unpacked by tiddlywiki
    • rendered using an appropriate component that knows how to handle it
Is it really necessary that TW knows what to do with it? I mean, given the examples I provided that created instantaneous divs etc - could the URL perhaps "force" the display, by concatenating(?) the URL stuff and the TW stuff. Perhaps inject is a better term. As you note in the "instant code editor" example it contains js and I'm thinking it could perhaps create a div and insert it at some specified position in the document?


All this sounds reaaaally man-hour-intensive in terms of development.
So, the question would be: What's are the benefits of all this?


Actually, I think it is one of those concepts that would be so useful that I can't even say what it would open up for (including risks). But I'll mention some ideas off the top of my head (an in a very arbitrary order);

*You could show an iframe where the src is this special URL so that what is displayed is a, by you, formatted list of the plugins in the target TW (for the 2-step import I discovered the other day).
*...or, bigger, "community aggregator" that consists totally of iframes like a trello display, each frame displaying a list of tiddlers from all included TWs, but where you set tags to filter their lists by.  
*...or even much bigger a concept; what if the URL can really merge multiple wikis from different sources by scrubbing so only the body content from multiple wikis are displayed in main document. I understnad the URL is limited in length, preventing too many such added wikis, but it sounds a bit like federation.
*More humbly; inject a custom stylesheet to get your personal settings ("Big font for my poor eyes, beautiful polka stripes and blinking fonts everywhere")
*etc, ad infinitum... my imagination (and knowledge) is too limited.

<:-)
Reply all
Reply to author
Forward
0 new messages