I have one or more bookmarklets and would like to develop a user friendly way to share them. Here is the example content of one;
javascript:(function()%20%7B%0A%24tw.wiki.addTiddlers(%5B%7B%22created%22%3A%2220221108061024852%22%2C%22text%22%3A%22%5C%5Cwhitespace%20trim%5Cn%3C%24button%20tooltip%3D%7B%7B%24%3A%2FPSaT%2FButtons%2Fdownload-wiki!!description%7D%7D%20aria-label%3D%7B%7B%24%3A%2FPSaT%2FButtons%2Fdownload-wiki!!description%7D%7D%20class%3D%3C%3Ctv-config-toolbar-class%3E%3E%3E%5Cn%3C%24wikify%20name%3D%5C%22site-title%5C%22%20text%3D%7B%7B%24%3A%2Fconfig%2FSaveWikiButton%2FFilename%7D%7D%3E%5Cn%3C%24action-sendmessage%20%24message%3D%5C%22tm-download-file%5C%22%20%24param%3D%7B%7B%24%3A%2Fconfig%2FSaveWikiButton%2FTemplate%7D%7D%20filename%3D%3C%3Csite-title%3E%3E%20filename%3D%5C%22mywiki%5C%22%2F%3E%5Cn%3C%2F%24wikify%3E%5Cn%3Cspan%20class%3D%5C%22tc-dirty-indicator%5C%22%3E%5Cn%3C%24list%20filter%3D%5C%22%5B%3Ctv-config-toolbar-icons%3Ematch%5Byes%5D%5D%5C%22%3E%5Cn%7B%7B%24%3A%2Fcore%2Fimages%2Fsave-button%7D%7D%5Cn%3C%2F%24list%3E%5Cn%3C%24list%20filter%3D%5C%22%5B%3Ctv-config-toolbar-text%3Ematch%5Byes%5D%5D%5C%22%3E%5Cn%3Cspan%20class%3D%5C%22tc-btn-text%5C%22%3E%5Cn%3C%24text%20text%3D%7B%7B%24%3A%2FPSaT%2FButtons%2Fdownload-wiki!!caption%7D%7D%2F%3E%5Cn%3C%2Fspan%3E%5Cn%3C%2F%24list%3E%5Cn%3C%2Fspan%3E%5Cn%3C%2F%24button%3E%22%2C%22title%22%3A%22%24%3A%2FPSaT%2FButtons%2Fdownload-wiki%22%2C%22tags%22%3A%22%24%3A%2Ftags%2FPageControls%22%2C%22caption%22%3A%22%7B%7B%24%3A%2Fcore%2Fimages%2Fsave-button%7D%7D%20Download%20Wiki%20with%20changes%22%2C%22description%22%3A%22Download%20Wiki%20with%20changes%22%2C%22modified%22%3A%2220221108062657583%22%7D%5D)%3B%0A%7D)()
I am wondering if there is, or we could build a mime type or deserialiser for JavaScript function like in bookmarklets, such that when they are dropped on a wiki they can import then use a new type and view template of the form
<a href={{!!text}}>{{!!title}}</a>
or something similar.
The result?
- Any file containing a bookmarklet function can be imported to a wiki as a tiddler and automatically become a link;
- If clicked the function will be performed, like silently install the payload as tiddlers.
- The link can also be dragged and dropped into the bookmarks to be used on any tiddlywiki.
Ideally they can also be posted here to make sharing a reusable payload with anyone. eg bookmarklet.txt.json (1.7 KB)
The work around is for me to make a view template cascade that detects if the text has a prefix of javascript:
or javascript:(function()
- It would be better if we used a deserialiser and the type field if an appropriate value exists.