I am using bookmarklets more and more. I package a set of tiddlers into a bookmarklet and on a click they are installed silently. This is very helpful to add settings and configurations you like on any tiddlywiki in the wild.
I wanted to ask if there are any javascript bookmarklet experts or otherwise out there if there would be a way to add to the bookmarklet a “function” that could set a filed on a targeted tiddler to now (TW date format) at the time the bookmarklet is clicked?
That is while Loading tiddlers into tiddlywikis with bookmarklets,
apply a time stamp that indicates when the bookmarklet is used.
This would allow us to keep track of when such a bookmarklet was applied allowing us to do a little more automation through bookmarklets.
I have worked out how to do this with a tiddler so we can use the same methods we use to share tiddlers, json or drag and drop. Of you could visit my site and drag a bookmarklet to your bookmarks.
However we can also share the method to create the bookmarklet, thus making it relative to the wiki it is installed in, so rather than the content in the bookmarklet we share, being frozen in time it will use the content in the current wiki as its dragged to your bookmarks.
Once a bookmark is saved it is frozen in time, what this topic asks is can part of the bookmark change when it is used like get a " now tinestamp " and save it in the current wiki?
I have a proof of concept for bookmarks that toggles, reoccuring or are one shot use but this needs supporting macros.
If I could get some funding I would build a full solution
So you want to change the modified timestamp of the imported tiddler? …
I think that’s not a good idea, since it modifies the tiddler, without modifying the text field.
So for a user it may look like a different tiddler but in reality it is not.
On the other hand, if the modified field is changed, it will show up on top of the Recent tab. … If that’s the intention, I could see a reason.
But imo it should be done by the import mechanism, where the user is in control and the bookmark wouldn’t need any javascript
The bookmarklets I install use javascript and install tiddlers silently, rather than the data format, No import necessary. Clicking date downloads it, you can only drag and drop it.
It needs someone who knows how to write a JavaScript function that I can include in the bookmarklet generation.
To reiterate when building a bookmarklet with the “add tiddlers” function. It need only be clicked and the tiddlers are silently installed. No need for the additional import step. What I want to do is load my bookmarklet making tool with an additional javascript function that does one of the following;
Sets the modified field of one of the payload tiddlers to now
Creates a tiddler not existing in the bookmarklet payload with a current created or modified date.
Add a record to a data tiddler (not in the payload) such as timestamp + bookmarklet name or primary tiddler.
The idea is that this simple action will allow a list to detect the installation of one of these one touch bookmarklets, when installed and the order in which they were installed/reinstalled.
This is needed so as to track if you succeeded installing a particular bookmarklet.
I have over a dozen regular settings and additions I install and I don’t need any confirmation or intermediate steps. I do design them so they will not have unwanted side effects.
Thanks this looks promising. I am not so sure how to integrate it.
I have not being able to test it yet.
Here is a simple bookmarklet that installs a single Home tiddler;
The first one involved just adding the code I previously shared after your call to addTiddlers. The 2nd one involved assigning the tiddler array json to a variable and then looping through the array elements adding each one while updating the timestamp.
This was about how; Normally a bookmarklet adds tiddlers, I am wondering if a bookmarklet could on its own set the last modified date of a nominated tiddler already in the wiki. eg; $:/config/last-bookmarklet-installed ie the target tiddler is not in the package.
However looking at your examples I can see the answer to this and the method of appending multiple “functions”.
It will take a little while to incorporate this into my bookmarklet tool but it will make it very powerful and more self documenting.
In TW5 tiddlers are immutable. So if you want to change the modified state of a tiddler you’ll need to read the tiddler and call .getModificationFields() again. Like so:
$tw.wiki.addTiddler(
new $tw.Tiddler($tw.wiki.getTiddler("HelloThere"),
$tw.wiki.getModificationFields()));
If you call this code snippet in the browser dev-console you’ll see that the HelloThere tiddler will be at the top of the Recent Tab.