axs,
cool hack :)

On Jun 9, 6:36 pm, axs <[email protected]> wrote:
> Hi MHill,
>
> The following code will do what you want (except that the time is in a 24-hr
> format) for the case of editing an existing tiddler:
DateFormats are described here
http://tiddlywiki.tiddlyspace.com/#%5B%5BDate%20Formats%5D%5D

> config.commands.editTiddler.handler_old =
> config.commands.editTiddler.handler;
> config.commands.editTiddler.handler = function(evt,src,title){
> config.commands.editTiddler.handler_old.call(this,evt,src,title);
> var text = jQuery(story.getTiddler(title)).find('textarea[edit=text]');
> var leadingNewline = text.val() ? '\n\n' : '' ;
> text.val(text.val() + leadingNewline + '[' + (new
> Date().formatString('YYYY-0MM-0DD hh:mm')) + '] ');
> }
Seems to work. But there are some little problems.
If you have a TW, that is "readOnly" eg: If it is stored on a server,
the editTiddler command is treated as a "view" command by the TW core.
See "view" at TW site [1].

But if editTiddler command is hijacked with the above function "view"
will still add the Date.
If a user now copy/pastes the content it will be something different,
than the original. Which IMO will be very confusing.

Using some parts from above, I created an AddNowCommand [2], which can
be added to the ToolbarCommands tiddler of your TW.
If you need a new tiddler with Date and time use the
<<newTiddler ....>> macro seen at [3]

I did some basic testing with TiddlySpace and hoster. Vanilla TW will
need testing :)

have fun!
mario

[1] http://www.tiddlywiki.com/
[2] http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#AddNowCommand
[3] 
http://hoster.peermore.com/recipes/TeamWork/tiddlers.wiki#%5b%5bNewTiddler%20with%20DateAndTime%5d%5d

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/tiddlywiki?hl=en.

Reply via email to