Below is the revised plugin that abides by the set values of offset and
count.  I will have to defer to the REAL Eric (Eric S) to answer the issue
about the plugin call not working inside of DefaultTiddlers.


/***
!Code
***/
{{{
// create macro object
var journalMacros = config.macros.GetJournals = {
    handler: function (place,macroName,params,wikifier,paramString,tiddler)
{
        var
paramHash=paramString.parseParams('offset',null,true,false,false);
        var offset=getParam(paramHash,'offset', 0);
        var count=getParam(paramHash,'count', 1);
        var label=getParam(paramHash,'label', undefined);
        if(label) {
       var span = createTiddlyElement(place,"span",null,this.className);
    createTiddlyButton(span,label,null, function(ev) {
           var limit = parseInt(count) + parseInt(offset) - 1;
              var i = 0;
              while (i < limit) {
                 story.displayTiddler("bottom", journalMacros.getTitle(i));
                  i++;
              }});
        } else {
        var limit = parseInt(count) + parseInt(offset) - 1;
           while (offset < limit) {
               story.displayTiddler("bottom",
journalMacros.getTitle(offset));
               offset++;
           }
       }
   },
   getTitle: function(offset) {
      offset = offset || 0;
      var today= new Date();
      var date = new Date(today.getTime() + (offset *  24 * 60 * 60 *
1000));
      var title = date.formatString("DD MMM, YYYY");
      return title;
   }
}
}}}
On Thu, May 24, 2012 at 1:20 PM, airman99 <airma...@gmail.com> wrote:

> Thanks for the script! It worked perfectly when called from a Tiddler, and
> worked for 7 days when called from a link (MainMenu). Can you modify the
> script so that when the "label" function is used, the "count:" and
> "offset:" parameters still work instead of hardcoding the label function
> with 7 days? I played around with it a bit, but my javascript prowess is
> borderline zero, and was unable to make the script do what I want.
>
> Any ideas why when the plugin is called during startup from
> "DefaultTiddlers", it just shows the text of "DefaultTiddler" instead of
> running the script? Maybe the default tiddlers get loaded before the
> scripts get loaded into memory?
>
> TIA
>
> On Wednesday, May 23, 2012 10:53:00 PM UTC-6, airman99 wrote:
>>
>> I am using TW as an appointment book, with one journal per day (e.g.
>> 2012-05-23). Upon startup, I would like TW to display the next 7 days of
>> journal entries. For example, if today is 2012-05-23, I want TW to display
>> the journals for 2012-05-23, 2012-05-24, 2012-05-25 ... 2012-05-29. I have
>> searched in this group for a while and have not seen this request
>> addressed. Have also looked through some of the major plugin sites with no
>> progress. Any ideas would be appreciated.
>
> --
> You received this message because you are subscribed to the Google Groups
> "TiddlyWiki" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/tiddlywiki/-/RG9CNz1wAAgJ.
>
> To post to this group, send email to tiddlywiki@googlegroups.com.
> To unsubscribe from this group, send email to
> tiddlywiki+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/tiddlywiki?hl=en.
>

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

Reply via email to