> I did a little research such as here 
> <https://www.htmlgoodies.com/beyond/reference/reference-external-resources-from-your-bookmarklets.html>
>  and is seems plausible that we could make a bookmarklet that would allow me 
> to drop a specified json file onto a tiddlywiki from the bookmarks I would 
> not even need to go looking for my json file to drag and drop it, just select 
> from the bookmarks. If we can point to json files on our local disk or on a 
> server such as provided by TiddlyServer it would be an easy way to distribute 
> tools, tiddlers, data, plugins and macros to one or more wikis.

A JavaScript bookmarklet cannot in general read files from the local disk. I’ve 
knocked up a macro that does the next best thing: it can generate bookmarklets 
containing an arbitrary set of tiddlers identified by a filter.

This example generates a bookmarklet labelled “MyTiddlers” containing all the 
tiddlers with the tag “HelloThere”:

<<save-as-bookmarklet "MyTiddlers" "[tag[HelloThere]]">>

Drag the bookmarklet link to the browser address bar to install it, and then 
visit another TiddlyWiki. Clicking the bookmarklet will inject the payload 
tiddlers into the target wiki.

The text of the macro:

\define save-as-bookmarklet-href()
(function() {
$tw.wiki.addTiddlers($(json-tiddlers)$);
})()
\end

\define save-as-bookmarklet(title,filter)
<$wikify name="json-tiddlers" output="text" text="""<$text text=<<jsontiddlers 
filter:"$filter$">>/>""">
<a href={{{ 
[<save-as-bookmarklet-href>encodeuricomponent[]addprefix[javascript:]] 
}}}><$text text=<<__title__>>/></a>
</$wikify>
\end

Let me know how you get on,

Best wishes

Jeremy


> On 11 Nov 2019, at 10:36, Ton Gerner <ton.ger...@gmail.com> wrote:
> 
> Hi Tony,
> 
> Thanks. Yes I remember this work. Do you think it could point to a file or 
> contain a payload to drop on a wiki?
> 
> I will look more closely but I need to depend on the templates. Good start 
> though
> 
> 
> 
> I really don't know.  My knowledge of Javascript is almost nihil. I just used 
> Stephan Hadrek's idea, see 
> https://groups.google.com/forum/#!msg/tiddlywiki/cUUXichiwdU/8gTL3lsO0MUJ
> 
> Cheers,
> 
> Ton
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "TiddlyWiki" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to tiddlywiki+unsubscr...@googlegroups.com 
> <mailto:tiddlywiki+unsubscr...@googlegroups.com>.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/tiddlywiki/ee45dc80-e025-48f5-ac12-bbdc45ef5cb5%40googlegroups.com
>  
> <https://groups.google.com/d/msgid/tiddlywiki/ee45dc80-e025-48f5-ac12-bbdc45ef5cb5%40googlegroups.com?utm_medium=email&utm_source=footer>.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to tiddlywiki+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/06022EEF-D846-4E1A-98FC-F4D72C9041E2%40gmail.com.

Reply via email to